OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/root_window_host_linux.h" | 5 #include "ui/aura/root_window_host_linux.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xcursor/Xcursor.h> | 8 #include <X11/Xcursor/Xcursor.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/cursorfont.h> | 10 #include <X11/cursorfont.h> |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 } | 1025 } |
1026 | 1026 |
1027 bool RootWindowHostLinux::IsWindowManagerPresent() { | 1027 bool RootWindowHostLinux::IsWindowManagerPresent() { |
1028 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership | 1028 // Per ICCCM 2.8, "Manager Selections", window managers should take ownership |
1029 // of WM_Sn selections (where n is a screen number). | 1029 // of WM_Sn selections (where n is a screen number). |
1030 return XGetSelectionOwner( | 1030 return XGetSelectionOwner( |
1031 xdisplay_, atom_cache_.GetAtom("WM_S0")) != None; | 1031 xdisplay_, atom_cache_.GetAtom("WM_S0")) != None; |
1032 } | 1032 } |
1033 | 1033 |
1034 void RootWindowHostLinux::SetCursorInternal(gfx::NativeCursor cursor) { | 1034 void RootWindowHostLinux::SetCursorInternal(gfx::NativeCursor cursor) { |
1035 ::Cursor xcursor = | 1035 ::Cursor xcursor; |
1036 image_cursors_->IsImageCursor(cursor) ? | 1036 if (image_cursors_->IsImageCursor(cursor)) |
1037 image_cursors_->ImageCursorFromNative(cursor) : | 1037 xcursor = image_cursors_->ImageCursorFromNative(cursor); |
1038 (cursor == ui::kCursorNone ? invisible_cursor_ : | 1038 else if (cursor == ui::kCursorNone) |
1039 (cursor == ui::kCursorCustom ? cursor.platform() : | 1039 xcursor = invisible_cursor_; |
1040 ui::GetXCursor(CursorShapeFromNative(cursor)))); | 1040 else if (cursor == ui::kCursorCustom) |
| 1041 xcursor = cursor.platform(); |
| 1042 else if (delegate_->GetDeviceScaleFactor() == 1.0) |
| 1043 xcursor = ui::GetXCursor(CursorShapeFromNative(cursor)); |
| 1044 else |
| 1045 xcursor = image_cursors_->ImageCursorFromNative(ui::kCursorPointer); |
1041 XDefineCursor(xdisplay_, xwindow_, xcursor); | 1046 XDefineCursor(xdisplay_, xwindow_, xcursor); |
1042 } | 1047 } |
1043 | 1048 |
1044 // static | 1049 // static |
1045 RootWindowHost* RootWindowHost::Create(RootWindowHostDelegate* delegate, | 1050 RootWindowHost* RootWindowHost::Create(RootWindowHostDelegate* delegate, |
1046 const gfx::Rect& bounds) { | 1051 const gfx::Rect& bounds) { |
1047 return new RootWindowHostLinux(delegate, bounds); | 1052 return new RootWindowHostLinux(delegate, bounds); |
1048 } | 1053 } |
1049 | 1054 |
1050 // static | 1055 // static |
1051 RootWindowHost* RootWindowHost::GetForAcceleratedWidget( | 1056 RootWindowHost* RootWindowHost::GetForAcceleratedWidget( |
1052 gfx::AcceleratedWidget accelerated_widget) { | 1057 gfx::AcceleratedWidget accelerated_widget) { |
1053 return reinterpret_cast<RootWindowHost*>( | 1058 return reinterpret_cast<RootWindowHost*>( |
1054 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); | 1059 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); |
1055 } | 1060 } |
1056 | 1061 |
1057 // static | 1062 // static |
1058 gfx::Size RootWindowHost::GetNativeScreenSize() { | 1063 gfx::Size RootWindowHost::GetNativeScreenSize() { |
1059 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 1064 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
1060 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 1065 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
1061 } | 1066 } |
1062 | 1067 |
1063 } // namespace aura | 1068 } // namespace aura |
OLD | NEW |