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 <strings.h> | 7 #include <strings.h> |
8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
9 #include <X11/extensions/Xfixes.h> | 9 #include <X11/extensions/Xfixes.h> |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
11 #include <X11/extensions/Xrandr.h> | 11 #include <X11/extensions/Xrandr.h> |
12 #include <X11/Xatom.h> | 12 #include <X11/Xatom.h> |
13 #include <X11/Xcursor/Xcursor.h> | 13 #include <X11/Xcursor/Xcursor.h> |
14 #include <X11/Xlib.h> | 14 #include <X11/Xlib.h> |
15 | 15 |
16 #include <algorithm> | 16 #include <algorithm> |
17 | 17 |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 #include "base/message_pump_aurax11.h" | 20 #include "base/message_pump_aurax11.h" |
21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
22 #include "base/stringprintf.h" | 22 #include "base/stringprintf.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 23 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "third_party/skia/include/core/SkCanvas.h" | 24 #include "third_party/skia/include/core/SkCanvas.h" |
25 #include "ui/aura/client/capture_client.h" | 25 #include "ui/aura/client/capture_client.h" |
26 #include "ui/aura/client/cursor_client.h" | 26 #include "ui/aura/client/cursor_client.h" |
27 #include "ui/aura/client/screen_position_client.h" | 27 #include "ui/aura/client/screen_position_client.h" |
28 #include "ui/aura/client/user_action_client.h" | 28 #include "ui/aura/client/user_action_client.h" |
29 #include "ui/aura/env.h" | |
30 #include "ui/aura/root_window.h" | 29 #include "ui/aura/root_window.h" |
31 #include "ui/base/cursor/cursor.h" | 30 #include "ui/base/cursor/cursor.h" |
32 #include "ui/base/events/event.h" | 31 #include "ui/base/events/event.h" |
33 #include "ui/base/events/event_utils.h" | 32 #include "ui/base/events/event_utils.h" |
34 #include "ui/base/keycodes/keyboard_codes.h" | 33 #include "ui/base/keycodes/keyboard_codes.h" |
35 #include "ui/base/touch/touch_factory.h" | 34 #include "ui/base/touch/touch_factory.h" |
36 #include "ui/base/ui_base_switches.h" | 35 #include "ui/base/ui_base_switches.h" |
37 #include "ui/base/view_prop.h" | 36 #include "ui/base/view_prop.h" |
38 #include "ui/base/x/valuators.h" | 37 #include "ui/base/x/valuators.h" |
39 #include "ui/base/x/x11_util.h" | 38 #include "ui/base/x/x11_util.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 535 } |
537 | 536 |
538 void RootWindowHostLinux::SetCursor(gfx::NativeCursor cursor) { | 537 void RootWindowHostLinux::SetCursor(gfx::NativeCursor cursor) { |
539 if (cursor == current_cursor_) | 538 if (cursor == current_cursor_) |
540 return; | 539 return; |
541 current_cursor_ = cursor; | 540 current_cursor_ = cursor; |
542 SetCursorInternal(cursor); | 541 SetCursorInternal(cursor); |
543 } | 542 } |
544 | 543 |
545 bool RootWindowHostLinux::QueryMouseLocation(gfx::Point* location_return) { | 544 bool RootWindowHostLinux::QueryMouseLocation(gfx::Point* location_return) { |
| 545 client::CursorClient* cursor_client = |
| 546 client::GetCursorClient(GetRootWindow()); |
| 547 if (cursor_client && !cursor_client->IsCursorEnabled()) { |
| 548 *location_return = gfx::Point(0, 0); |
| 549 return false; |
| 550 } |
| 551 |
546 ::Window root_return, child_return; | 552 ::Window root_return, child_return; |
547 int root_x_return, root_y_return, win_x_return, win_y_return; | 553 int root_x_return, root_y_return, win_x_return, win_y_return; |
548 unsigned int mask_return; | 554 unsigned int mask_return; |
549 XQueryPointer(xdisplay_, | 555 XQueryPointer(xdisplay_, |
550 xwindow_, | 556 xwindow_, |
551 &root_return, | 557 &root_return, |
552 &child_return, | 558 &child_return, |
553 &root_x_return, &root_y_return, | 559 &root_x_return, &root_y_return, |
554 &win_x_return, &win_y_return, | 560 &win_x_return, &win_y_return, |
555 &mask_return); | 561 &mask_return); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 return new RootWindowHostLinux(bounds); | 918 return new RootWindowHostLinux(bounds); |
913 } | 919 } |
914 | 920 |
915 // static | 921 // static |
916 gfx::Size RootWindowHost::GetNativeScreenSize() { | 922 gfx::Size RootWindowHost::GetNativeScreenSize() { |
917 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 923 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
918 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 924 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
919 } | 925 } |
920 | 926 |
921 } // namespace aura | 927 } // namespace aura |
OLD | NEW |