| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
| 22 #include "base/message_pump_aurax11.h" | 22 #include "base/message_pump_aurax11.h" |
| 23 #include "base/stl_util.h" | 23 #include "base/stl_util.h" |
| 24 #include "base/stringprintf.h" | 24 #include "base/stringprintf.h" |
| 25 #include "third_party/skia/include/core/SkBitmap.h" | 25 #include "third_party/skia/include/core/SkBitmap.h" |
| 26 #include "third_party/skia/include/core/SkCanvas.h" | 26 #include "third_party/skia/include/core/SkCanvas.h" |
| 27 #include "ui/aura/client/capture_client.h" | 27 #include "ui/aura/client/capture_client.h" |
| 28 #include "ui/aura/client/cursor_client.h" | 28 #include "ui/aura/client/cursor_client.h" |
| 29 #include "ui/aura/client/screen_position_client.h" | 29 #include "ui/aura/client/screen_position_client.h" |
| 30 #include "ui/aura/client/user_action_client.h" | 30 #include "ui/aura/client/user_action_client.h" |
| 31 #include "ui/aura/env.h" | |
| 32 #include "ui/aura/root_window.h" | 31 #include "ui/aura/root_window.h" |
| 33 #include "ui/base/cursor/cursor.h" | 32 #include "ui/base/cursor/cursor.h" |
| 34 #include "ui/base/events/event.h" | 33 #include "ui/base/events/event.h" |
| 35 #include "ui/base/events/event_utils.h" | 34 #include "ui/base/events/event_utils.h" |
| 36 #include "ui/base/keycodes/keyboard_codes.h" | 35 #include "ui/base/keycodes/keyboard_codes.h" |
| 37 #include "ui/base/touch/touch_factory.h" | 36 #include "ui/base/touch/touch_factory.h" |
| 38 #include "ui/base/ui_base_switches.h" | 37 #include "ui/base/ui_base_switches.h" |
| 39 #include "ui/base/view_prop.h" | 38 #include "ui/base/view_prop.h" |
| 40 #include "ui/base/x/device_list_cache_x.h" | 39 #include "ui/base/x/device_list_cache_x.h" |
| 41 #include "ui/base/x/valuators.h" | 40 #include "ui/base/x/valuators.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } | 586 } |
| 588 | 587 |
| 589 void RootWindowHostLinux::SetCursor(gfx::NativeCursor cursor) { | 588 void RootWindowHostLinux::SetCursor(gfx::NativeCursor cursor) { |
| 590 if (cursor == current_cursor_) | 589 if (cursor == current_cursor_) |
| 591 return; | 590 return; |
| 592 current_cursor_ = cursor; | 591 current_cursor_ = cursor; |
| 593 SetCursorInternal(cursor); | 592 SetCursorInternal(cursor); |
| 594 } | 593 } |
| 595 | 594 |
| 596 bool RootWindowHostLinux::QueryMouseLocation(gfx::Point* location_return) { | 595 bool RootWindowHostLinux::QueryMouseLocation(gfx::Point* location_return) { |
| 596 client::CursorClient* cursor_client = |
| 597 client::GetCursorClient(GetRootWindow()); |
| 598 if (cursor_client && !cursor_client->IsCursorEnabled()) { |
| 599 *location_return = gfx::Point(0, 0); |
| 600 return false; |
| 601 } |
| 602 |
| 597 ::Window root_return, child_return; | 603 ::Window root_return, child_return; |
| 598 int root_x_return, root_y_return, win_x_return, win_y_return; | 604 int root_x_return, root_y_return, win_x_return, win_y_return; |
| 599 unsigned int mask_return; | 605 unsigned int mask_return; |
| 600 XQueryPointer(xdisplay_, | 606 XQueryPointer(xdisplay_, |
| 601 xwindow_, | 607 xwindow_, |
| 602 &root_return, | 608 &root_return, |
| 603 &child_return, | 609 &child_return, |
| 604 &root_x_return, &root_y_return, | 610 &root_x_return, &root_y_return, |
| 605 &win_x_return, &win_y_return, | 611 &win_x_return, &win_y_return, |
| 606 &mask_return); | 612 &mask_return); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 if (pointer_barriers_.get()) { | 657 if (pointer_barriers_.get()) { |
| 652 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[0]); | 658 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[0]); |
| 653 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[1]); | 659 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[1]); |
| 654 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[2]); | 660 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[2]); |
| 655 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[3]); | 661 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[3]); |
| 656 pointer_barriers_.reset(); | 662 pointer_barriers_.reset(); |
| 657 } | 663 } |
| 658 #endif | 664 #endif |
| 659 } | 665 } |
| 660 | 666 |
| 661 void RootWindowHostLinux::OnCursorVisibilityChanged(bool show) { | 667 void RootWindowHostLinux::OnCursorEnableStateChanged(bool enabled) { |
| 662 #if defined(OS_CHROMEOS) | 668 #if defined(OS_CHROMEOS) |
| 663 // Temporarily pause tap-to-click when the cursor is hidden. | 669 // Temporarily pause tap-to-click when the cursor is hidden. |
| 664 Atom prop = atom_cache_.GetAtom("Tap Paused"); | 670 Atom prop = atom_cache_.GetAtom("Tap Paused"); |
| 665 unsigned char value = !show; | 671 unsigned char value = !enabled; |
| 666 XIDeviceList dev_list = | 672 XIDeviceList dev_list = |
| 667 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_); | 673 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_); |
| 668 | 674 |
| 669 // Only slave pointer devices could possibly have tap-paused property. | 675 // Only slave pointer devices could possibly have tap-paused property. |
| 670 for (int i = 0; i < dev_list.count; i++) { | 676 for (int i = 0; i < dev_list.count; i++) { |
| 671 if (dev_list[i].use == XISlavePointer) { | 677 if (dev_list[i].use == XISlavePointer) { |
| 672 Atom old_type; | 678 Atom old_type; |
| 673 int old_format; | 679 int old_format; |
| 674 unsigned long old_nvalues, bytes; | 680 unsigned long old_nvalues, bytes; |
| 675 unsigned char* data; | 681 unsigned char* data; |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 return new RootWindowHostLinux(bounds); | 1000 return new RootWindowHostLinux(bounds); |
| 995 } | 1001 } |
| 996 | 1002 |
| 997 // static | 1003 // static |
| 998 gfx::Size RootWindowHost::GetNativeScreenSize() { | 1004 gfx::Size RootWindowHost::GetNativeScreenSize() { |
| 999 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 1005 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| 1000 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 1006 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
| 1001 } | 1007 } |
| 1002 | 1008 |
| 1003 } // namespace aura | 1009 } // namespace aura |
| OLD | NEW |