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_x11.h" | 5 #include "ui/aura/root_window_host_x11.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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Receive resize events for the root-window so |x_root_bounds_| can be | 91 // Receive resize events for the root-window so |x_root_bounds_| can be |
92 // updated. | 92 // updated. |
93 XWindowAttributes attr; | 93 XWindowAttributes attr; |
94 XGetWindowAttributes(display, root_window, &attr); | 94 XGetWindowAttributes(display, root_window, &attr); |
95 if (!(attr.your_event_mask & StructureNotifyMask)) { | 95 if (!(attr.your_event_mask & StructureNotifyMask)) { |
96 XSelectInput(display, root_window, | 96 XSelectInput(display, root_window, |
97 StructureNotifyMask | attr.your_event_mask); | 97 StructureNotifyMask | attr.your_event_mask); |
98 } | 98 } |
99 | 99 |
100 if (!ui::IsXInput2Available()) | 100 if (!base::MessagePumpForUI::HasXInput2()) |
101 return; | 101 return; |
102 | 102 |
103 unsigned char mask[XIMaskLen(XI_LASTEVENT)] = {}; | 103 unsigned char mask[XIMaskLen(XI_LASTEVENT)] = {}; |
104 memset(mask, 0, sizeof(mask)); | 104 memset(mask, 0, sizeof(mask)); |
105 | 105 |
106 XISetMask(mask, XI_HierarchyChanged); | 106 XISetMask(mask, XI_HierarchyChanged); |
107 XISetMask(mask, XI_KeyPress); | 107 XISetMask(mask, XI_KeyPress); |
108 XISetMask(mask, XI_KeyRelease); | 108 XISetMask(mask, XI_KeyRelease); |
109 | 109 |
110 XIEventMask evmask; | 110 XIEventMask evmask; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | | 392 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | |
393 KeyPressMask | KeyReleaseMask | | 393 KeyPressMask | KeyReleaseMask | |
394 EnterWindowMask | LeaveWindowMask | | 394 EnterWindowMask | LeaveWindowMask | |
395 ExposureMask | VisibilityChangeMask | | 395 ExposureMask | VisibilityChangeMask | |
396 StructureNotifyMask | PropertyChangeMask | | 396 StructureNotifyMask | PropertyChangeMask | |
397 PointerMotionMask; | 397 PointerMotionMask; |
398 XSelectInput(xdisplay_, xwindow_, event_mask); | 398 XSelectInput(xdisplay_, xwindow_, event_mask); |
399 XFlush(xdisplay_); | 399 XFlush(xdisplay_); |
400 | 400 |
401 if (ui::IsXInput2Available()) | 401 if (base::MessagePumpForUI::HasXInput2()) |
402 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); | 402 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); |
403 | 403 |
404 SelectEventsForRootWindow(); | 404 SelectEventsForRootWindow(); |
405 | 405 |
406 // Get the initial size of the X root window. | 406 // Get the initial size of the X root window. |
407 XWindowAttributes attrs; | 407 XWindowAttributes attrs; |
408 XGetWindowAttributes(xdisplay_, x_root_window_, &attrs); | 408 XGetWindowAttributes(xdisplay_, x_root_window_, &attrs); |
409 x_root_bounds_.SetRect(attrs.x, attrs.y, attrs.width, attrs.height); | 409 x_root_bounds_.SetRect(attrs.x, attrs.y, attrs.width, attrs.height); |
410 | 410 |
411 // TODO(erg): We currently only request window deletion events. We also | 411 // TODO(erg): We currently only request window deletion events. We also |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 | 1050 |
1051 void RootWindowHostX11::UpdateIsInternalDisplay() { | 1051 void RootWindowHostX11::UpdateIsInternalDisplay() { |
1052 RootWindow* root_window = GetRootWindow(); | 1052 RootWindow* root_window = GetRootWindow(); |
1053 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); | 1053 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); |
1054 gfx::Display display = screen->GetDisplayNearestWindow(root_window); | 1054 gfx::Display display = screen->GetDisplayNearestWindow(root_window); |
1055 is_internal_display_ = display.IsInternal(); | 1055 is_internal_display_ = display.IsInternal(); |
1056 } | 1056 } |
1057 | 1057 |
1058 void RootWindowHostX11::SetCrOSTapPaused(bool state) { | 1058 void RootWindowHostX11::SetCrOSTapPaused(bool state) { |
1059 #if defined(OS_CHROMEOS) | 1059 #if defined(OS_CHROMEOS) |
1060 if (!ui::IsXInput2Available()) | |
1061 return; | |
1062 // Temporarily pause tap-to-click when the cursor is hidden. | 1060 // Temporarily pause tap-to-click when the cursor is hidden. |
1063 Atom prop = atom_cache_.GetAtom("Tap Paused"); | 1061 Atom prop = atom_cache_.GetAtom("Tap Paused"); |
1064 unsigned char value = state; | 1062 unsigned char value = state; |
1065 XIDeviceList dev_list = | 1063 XIDeviceList dev_list = |
1066 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_); | 1064 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_); |
1067 | 1065 |
1068 // Only slave pointer devices could possibly have tap-paused property. | 1066 // Only slave pointer devices could possibly have tap-paused property. |
1069 for (int i = 0; i < dev_list.count; i++) { | 1067 for (int i = 0; i < dev_list.count; i++) { |
1070 if (dev_list[i].use == XISlavePointer) { | 1068 if (dev_list[i].use == XISlavePointer) { |
1071 Atom old_type; | 1069 Atom old_type; |
(...skipping 25 matching lines...) Expand all Loading... |
1097 } | 1095 } |
1098 | 1096 |
1099 namespace test { | 1097 namespace test { |
1100 | 1098 |
1101 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 1099 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
1102 default_override_redirect = override_redirect; | 1100 default_override_redirect = override_redirect; |
1103 } | 1101 } |
1104 | 1102 |
1105 } // namespace test | 1103 } // namespace test |
1106 } // namespace aura | 1104 } // namespace aura |
OLD | NEW |