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
3 // found in the LICENSE file.
5 #include "ui/aura/window_tree_host_x11.h"
8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput2.h>
10 #include <X11/extensions/Xrandr.h>
11 #include <X11/Xatom.h>
12 #include <X11/Xcursor/Xcursor.h>
19 #include "base/basictypes.h"
20 #include "base/command_line.h"
21 #include "base/stl_util.h"
22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_util.h"
24 #include "base/strings/stringprintf.h"
25 #include "base/sys_info.h"
26 #include "base/trace_event/trace_event.h"
27 #include "ui/aura/client/cursor_client.h"
28 #include "ui/aura/env.h"
29 #include "ui/aura/window.h"
30 #include "ui/aura/window_event_dispatcher.h"
31 #include "ui/base/cursor/cursor.h"
32 #include "ui/base/ui_base_switches.h"
33 #include "ui/base/view_prop.h"
34 #include "ui/base/x/x11_util.h"
35 #include "ui/compositor/compositor.h"
36 #include "ui/compositor/dip_util.h"
37 #include "ui/compositor/layer.h"
38 #include "ui/events/devices/x11/device_data_manager_x11.h"
39 #include "ui/events/devices/x11/device_list_cache_x11.h"
40 #include "ui/events/devices/x11/touch_factory_x11.h"
41 #include "ui/events/event.h"
42 #include "ui/events/event_switches.h"
43 #include "ui/events/event_utils.h"
44 #include "ui/events/keycodes/keyboard_codes.h"
45 #include "ui/events/platform/platform_event_observer.h"
46 #include "ui/events/platform/x11/x11_event_source.h"
47 #include "ui/gfx/screen.h"
56 const char* kAtomsToCache
[] = {
63 ::Window
FindEventTarget(const base::NativeEvent
& xev
) {
64 ::Window target
= xev
->xany
.window
;
65 if (xev
->type
== GenericEvent
)
66 target
= static_cast<XIDeviceEvent
*>(xev
->xcookie
.data
)->event
;
70 void SelectXInput2EventsForRootWindow(XDisplay
* display
, ::Window root_window
) {
71 CHECK(ui::IsXInput2Available());
72 unsigned char mask
[XIMaskLen(XI_LASTEVENT
)] = {};
73 memset(mask
, 0, sizeof(mask
));
75 XISetMask(mask
, XI_HierarchyChanged
);
78 evmask
.deviceid
= XIAllDevices
;
79 evmask
.mask_len
= sizeof(mask
);
81 XISelectEvents(display
, root_window
, &evmask
, 1);
83 #if defined(OS_CHROMEOS)
84 if (base::SysInfo::IsRunningOnChromeOS()) {
85 // It is necessary to listen for touch events on the root window for proper
86 // touch event calibration on Chrome OS, but this is not currently necessary
87 // on the desktop. This seems to fail in some cases (e.g. when logging
88 // in incognito). So select for non-touch events first, and then select for
89 // touch-events (but keep the other events in the mask, i.e. do not memset
91 // TODO(sad): Figure out why this happens. http://crbug.com/153976
92 XISetMask(mask
, XI_TouchBegin
);
93 XISetMask(mask
, XI_TouchUpdate
);
94 XISetMask(mask
, XI_TouchEnd
);
95 XISelectEvents(display
, root_window
, &evmask
, 1);
100 bool default_override_redirect
= false;
106 // TODO(miletus) : Move this into DeviceDataManager.
107 // Accomplishes 2 tasks concerning touch event calibration:
108 // 1. Being a message-pump observer,
109 // routes all the touch events to the X root window,
110 // where they can be calibrated later.
111 // 2. Has the Calibrate method that does the actual bezel calibration,
112 // when invoked from X root window's event dispatcher.
113 class TouchEventCalibrate
: public ui::PlatformEventObserver
{
115 TouchEventCalibrate() : left_(0), right_(0), top_(0), bottom_(0) {
116 if (ui::PlatformEventSource::GetInstance())
117 ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
118 std::vector
<std::string
> parts
;
119 if (Tokenize(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
120 switches::kTouchCalibration
),
122 if (!base::StringToInt(parts
[0], &left_
))
123 DLOG(ERROR
) << "Incorrect left border calibration value passed.";
124 if (!base::StringToInt(parts
[1], &right_
))
125 DLOG(ERROR
) << "Incorrect right border calibration value passed.";
126 if (!base::StringToInt(parts
[2], &top_
))
127 DLOG(ERROR
) << "Incorrect top border calibration value passed.";
128 if (!base::StringToInt(parts
[3], &bottom_
))
129 DLOG(ERROR
) << "Incorrect bottom border calibration value passed.";
133 ~TouchEventCalibrate() override
{
134 if (ui::PlatformEventSource::GetInstance())
135 ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this);
138 // Modify the location of the |event|,
139 // expanding it from |bounds| to (|bounds| + bezels).
140 // Required when touchscreen is bigger than screen (i.e. has bezels),
141 // because we receive events in touchscreen coordinates,
142 // which need to be expanded when converting to screen coordinates,
143 // so that location on bezels will be outside of screen area.
144 void Calibrate(ui::TouchEvent
* event
, const gfx::Rect
& bounds
) {
148 if (!left_
&& !right_
&& !top_
&& !bottom_
)
151 const int resolution_x
= bounds
.width();
152 const int resolution_y
= bounds
.height();
153 // The "grace area" (10% in this case) is to make it easier for the user to
154 // navigate to the corner.
155 const double kGraceAreaFraction
= 0.1;
156 if (left_
|| right_
) {
157 // Offset the x position to the real
159 // Check if we are in the grace area of the left side.
160 // Note: We might not want to do this when the gesture is locked?
161 if (x
< 0 && x
> -left_
* kGraceAreaFraction
)
163 // Check if we are in the grace area of the right side.
164 // Note: We might not want to do this when the gesture is locked?
165 if (x
> resolution_x
- left_
&&
166 x
< resolution_x
- left_
+ right_
* kGraceAreaFraction
)
167 x
= resolution_x
- left_
;
168 // Scale the screen area back to the full resolution of the screen.
169 x
= (x
* resolution_x
) / (resolution_x
- (right_
+ left_
));
171 if (top_
|| bottom_
) {
172 // When there is a top bezel we add our border,
175 // Check if we are in the grace area of the top side.
176 // Note: We might not want to do this when the gesture is locked?
177 if (y
< 0 && y
> -top_
* kGraceAreaFraction
)
180 // Check if we are in the grace area of the bottom side.
181 // Note: We might not want to do this when the gesture is locked?
182 if (y
> resolution_y
- top_
&&
183 y
< resolution_y
- top_
+ bottom_
* kGraceAreaFraction
)
184 y
= resolution_y
- top_
;
185 // Scale the screen area back to the full resolution of the screen.
186 y
= (y
* resolution_y
) / (resolution_y
- (bottom_
+ top_
));
189 // Set the modified coordinate back to the event.
190 if (event
->root_location() == event
->location()) {
191 // Usually those will be equal,
192 // if not, I am not sure what the correct value should be.
193 event
->set_root_location(gfx::Point(x
, y
));
195 event
->set_location(gfx::Point(x
, y
));
199 // ui::PlatformEventObserver:
200 void WillProcessEvent(const ui::PlatformEvent
& event
) override
{
201 if (event
->type
== GenericEvent
&&
202 (event
->xgeneric
.evtype
== XI_TouchBegin
||
203 event
->xgeneric
.evtype
== XI_TouchUpdate
||
204 event
->xgeneric
.evtype
== XI_TouchEnd
)) {
205 XIDeviceEvent
* xievent
= static_cast<XIDeviceEvent
*>(event
->xcookie
.data
);
206 xievent
->event
= xievent
->root
;
207 xievent
->event_x
= xievent
->root_x
;
208 xievent
->event_y
= xievent
->root_y
;
212 void DidProcessEvent(const ui::PlatformEvent
& event
) override
{}
214 // The difference in screen's native resolution pixels between
215 // the border of the touchscreen and the border of the screen,
222 DISALLOW_COPY_AND_ASSIGN(TouchEventCalibrate
);
225 } // namespace internal
227 ////////////////////////////////////////////////////////////////////////////////
230 WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect
& bounds
)
231 : xdisplay_(gfx::GetXDisplay()),
233 x_root_window_(DefaultRootWindow(xdisplay_
)),
234 current_cursor_(ui::kCursorNull
),
235 window_mapped_(false),
237 touch_calibrate_(new internal::TouchEventCalibrate
),
238 atom_cache_(xdisplay_
, kAtomsToCache
) {
239 XSetWindowAttributes swa
;
240 memset(&swa
, 0, sizeof(swa
));
241 swa
.background_pixmap
= None
;
242 swa
.override_redirect
= default_override_redirect
;
243 xwindow_
= XCreateWindow(
244 xdisplay_
, x_root_window_
,
245 bounds
.x(), bounds
.y(), bounds
.width(), bounds
.height(),
247 CopyFromParent
, // depth
249 CopyFromParent
, // visual
250 CWBackPixmap
| CWOverrideRedirect
,
252 if (ui::PlatformEventSource::GetInstance())
253 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
255 long event_mask
= ButtonPressMask
| ButtonReleaseMask
| FocusChangeMask
|
256 KeyPressMask
| KeyReleaseMask
|
257 EnterWindowMask
| LeaveWindowMask
|
258 ExposureMask
| VisibilityChangeMask
|
259 StructureNotifyMask
| PropertyChangeMask
|
261 XSelectInput(xdisplay_
, xwindow_
, event_mask
);
264 if (ui::IsXInput2Available()) {
265 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_
);
266 SelectXInput2EventsForRootWindow(xdisplay_
, x_root_window_
);
269 // TODO(erg): We currently only request window deletion events. We also
270 // should listen for activation events and anything else that GTK+ listens
271 // for, and do something useful.
273 protocols
[0] = atom_cache_
.GetAtom("WM_DELETE_WINDOW");
274 protocols
[1] = atom_cache_
.GetAtom("_NET_WM_PING");
275 XSetWMProtocols(xdisplay_
, xwindow_
, protocols
, 2);
277 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
278 // the desktop environment.
279 XSetWMProperties(xdisplay_
, xwindow_
, NULL
, NULL
, NULL
, 0, NULL
, NULL
, NULL
);
281 // Likewise, the X server needs to know this window's pid so it knows which
282 // program to kill if the window hangs.
283 // XChangeProperty() expects "pid" to be long.
284 static_assert(sizeof(long) >= sizeof(pid_t
),
285 "pid_t should not be larger than long");
287 XChangeProperty(xdisplay_
,
289 atom_cache_
.GetAtom("_NET_WM_PID"),
293 reinterpret_cast<unsigned char*>(&pid
), 1);
295 // Allow subclasses to create and cache additional atoms.
296 atom_cache_
.allow_uncached_atoms();
298 XRRSelectInput(xdisplay_
, x_root_window_
,
299 RRScreenChangeNotifyMask
| RROutputChangeNotifyMask
);
300 CreateCompositor(GetAcceleratedWidget());
303 WindowTreeHostX11::~WindowTreeHostX11() {
304 if (ui::PlatformEventSource::GetInstance())
305 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
309 XDestroyWindow(xdisplay_
, xwindow_
);
312 bool WindowTreeHostX11::CanDispatchEvent(const ui::PlatformEvent
& event
) {
313 ::Window target
= FindEventTarget(event
);
314 return target
== xwindow_
|| target
== x_root_window_
;
317 uint32_t WindowTreeHostX11::DispatchEvent(const ui::PlatformEvent
& event
) {
319 if (FindEventTarget(xev
) == x_root_window_
) {
320 if (xev
->type
== GenericEvent
)
321 DispatchXI2Event(xev
);
322 return ui::POST_DISPATCH_NONE
;
325 if (xev
->type
== MotionNotify
) {
326 // Discard all but the most recent motion event that targets the same
327 // window with unchanged state.
329 while (XPending(xev
->xany
.display
)) {
331 XPeekEvent(xev
->xany
.display
, &next_event
);
332 if (next_event
.type
== MotionNotify
&&
333 next_event
.xmotion
.window
== xev
->xmotion
.window
&&
334 next_event
.xmotion
.subwindow
== xev
->xmotion
.subwindow
&&
335 next_event
.xmotion
.state
== xev
->xmotion
.state
) {
336 XNextEvent(xev
->xany
.display
, &last_event
);
344 if ((xev
->type
== EnterNotify
|| xev
->type
== LeaveNotify
) &&
345 xev
->xcrossing
.detail
== NotifyInferior
) {
346 // Ignore EventNotify and LeaveNotify events from children of |xwindow_|.
347 // NativeViewGLSurfaceGLX adds a child to |xwindow_|.
348 // TODO(pkotwicz|tdanderson): Figure out whether the suppression is
349 // necessary. crbug.com/385716
350 return ui::POST_DISPATCH_STOP_PROPAGATION
;
353 if (xev
->type
== EnterNotify
||
354 xev
->type
== LeaveNotify
||
355 xev
->type
== KeyPress
||
356 xev
->type
== KeyRelease
||
357 xev
->type
== ButtonPress
||
358 xev
->type
== ButtonRelease
||
359 xev
->type
== MotionNotify
) {
360 switch (ui::EventTypeFromNative(xev
)) {
361 case ui::ET_KEY_PRESSED
:
362 case ui::ET_KEY_RELEASED
: {
363 ui::KeyEvent
keydown_event(xev
);
364 SendEventToProcessor(&keydown_event
);
367 case ui::ET_MOUSE_MOVED
:
368 case ui::ET_MOUSE_DRAGGED
:
369 case ui::ET_MOUSE_ENTERED
:
370 case ui::ET_MOUSE_EXITED
:
371 case ui::ET_MOUSE_PRESSED
:
372 case ui::ET_MOUSE_RELEASED
: {
373 ui::MouseEvent
mouse_event(xev
);
374 if (xev
->type
== EnterNotify
) {
375 aura::Window
* root_window
= window();
376 client::CursorClient
* cursor_client
=
377 client::GetCursorClient(root_window
);
379 const gfx::Display display
= gfx::Screen::GetScreenFor(
380 root_window
)->GetDisplayNearestWindow(root_window
);
381 cursor_client
->SetDisplay(display
);
383 // EnterNotify creates ET_MOUSE_MOVE. Mark as synthesized as this is
384 // not a real mouse move event.
385 mouse_event
.set_flags(mouse_event
.flags() | ui::EF_IS_SYNTHESIZED
);
388 TranslateAndDispatchLocatedEvent(&mouse_event
);
391 case ui::ET_MOUSEWHEEL
: {
392 ui::MouseWheelEvent
mouseev(xev
);
393 TranslateAndDispatchLocatedEvent(&mouseev
);
397 // No event is created for X11-release events for mouse-wheel buttons.
402 return ui::POST_DISPATCH_STOP_PROPAGATION
;
407 gfx::Rect
damage_rect(xev
->xexpose
.x
, xev
->xexpose
.y
,
408 xev
->xexpose
.width
, xev
->xexpose
.height
);
409 compositor()->ScheduleRedrawRect(damage_rect
);
413 if (xev
->xfocus
.mode
!= NotifyGrab
)
414 OnHostLostWindowCapture();
416 case ConfigureNotify
: {
417 DCHECK_EQ(xwindow_
, xev
->xconfigure
.event
);
418 DCHECK_EQ(xwindow_
, xev
->xconfigure
.window
);
419 // It's possible that the X window may be resized by some other means
420 // than from within aura (e.g. the X window manager can change the
421 // size). Make sure the root window size is maintained properly.
422 gfx::Rect
bounds(xev
->xconfigure
.x
, xev
->xconfigure
.y
,
423 xev
->xconfigure
.width
, xev
->xconfigure
.height
);
424 bool size_changed
= bounds_
.size() != bounds
.size();
425 bool origin_changed
= bounds_
.origin() != bounds
.origin();
429 OnHostResized(bounds
.size());
431 OnHostMoved(bounds_
.origin());
435 DispatchXI2Event(xev
);
437 case ClientMessage
: {
438 Atom message_type
= static_cast<Atom
>(xev
->xclient
.data
.l
[0]);
439 if (message_type
== atom_cache_
.GetAtom("WM_DELETE_WINDOW")) {
440 // We have received a close message from the window manager.
441 OnHostCloseRequested();
442 } else if (message_type
== atom_cache_
.GetAtom("_NET_WM_PING")) {
443 XEvent reply_event
= *xev
;
444 reply_event
.xclient
.window
= x_root_window_
;
446 XSendEvent(xdisplay_
,
447 reply_event
.xclient
.window
,
449 SubstructureRedirectMask
| SubstructureNotifyMask
,
455 case MappingNotify
: {
456 switch (xev
->xmapping
.request
) {
457 case MappingModifier
:
458 case MappingKeyboard
:
459 XRefreshKeyboardMapping(&xev
->xmapping
);
462 ui::DeviceDataManagerX11::GetInstance()->UpdateButtonMap();
465 NOTIMPLEMENTED() << " Unknown request: " << xev
->xmapping
.request
;
471 return ui::POST_DISPATCH_STOP_PROPAGATION
;
474 ui::EventSource
* WindowTreeHostX11::GetEventSource() {
478 gfx::AcceleratedWidget
WindowTreeHostX11::GetAcceleratedWidget() {
482 void WindowTreeHostX11::Show() {
483 if (!window_mapped_
) {
484 // Before we map the window, set size hints. Otherwise, some window managers
485 // will ignore toplevel XMoveWindow commands.
486 XSizeHints size_hints
;
487 size_hints
.flags
= PPosition
| PWinGravity
;
488 size_hints
.x
= bounds_
.x();
489 size_hints
.y
= bounds_
.y();
490 // Set StaticGravity so that the window position is not affected by the
491 // frame width when running with window manager.
492 size_hints
.win_gravity
= StaticGravity
;
493 XSetWMNormalHints(xdisplay_
, xwindow_
, &size_hints
);
495 XMapWindow(xdisplay_
, xwindow_
);
497 // We now block until our window is mapped. Some X11 APIs will crash and
498 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is
500 if (ui::X11EventSource::GetInstance())
501 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_
);
502 window_mapped_
= true;
506 void WindowTreeHostX11::Hide() {
507 if (window_mapped_
) {
508 XWithdrawWindow(xdisplay_
, xwindow_
, 0);
509 window_mapped_
= false;
513 gfx::Rect
WindowTreeHostX11::GetBounds() const {
517 void WindowTreeHostX11::SetBounds(const gfx::Rect
& bounds
) {
518 // Even if the host window's size doesn't change, aura's root window
519 // size, which is in DIP, changes when the scale changes.
520 float current_scale
= compositor()->device_scale_factor();
521 float new_scale
= gfx::Screen::GetScreenFor(window())->
522 GetDisplayNearestWindow(window()).device_scale_factor();
523 bool origin_changed
= bounds_
.origin() != bounds
.origin();
524 bool size_changed
= bounds_
.size() != bounds
.size();
525 XWindowChanges changes
= {0};
526 unsigned value_mask
= 0;
529 changes
.width
= bounds
.width();
530 changes
.height
= bounds
.height();
531 value_mask
= CWHeight
| CWWidth
;
534 if (origin_changed
) {
535 changes
.x
= bounds
.x();
536 changes
.y
= bounds
.y();
537 value_mask
|= CWX
| CWY
;
540 XConfigureWindow(xdisplay_
, xwindow_
, value_mask
, &changes
);
542 // Assume that the resize will go through as requested, which should be the
543 // case if we're running without a window manager. If there's a window
544 // manager, it can modify or ignore the request, but (per ICCCM) we'll get a
545 // (possibly synthetic) ConfigureNotify about the actual size and correct
549 OnHostMoved(bounds
.origin());
550 if (size_changed
|| current_scale
!= new_scale
) {
551 OnHostResized(bounds
.size());
553 window()->SchedulePaintInRect(window()->bounds());
557 gfx::Point
WindowTreeHostX11::GetLocationOnNativeScreen() const {
558 return bounds_
.origin();
561 void WindowTreeHostX11::SetCapture() {
562 // Do not grab X11 input. Grabbing X11 input is asynchronous and this method
563 // is expected to be synchronous. Grabbing X11 input is unnecessary on
564 // ChromeOS because ChromeOS manages all of the X windows. When running
565 // ChromeOS on the desktop for the sake of debugging:
566 // - Implicit pointer grab as a result of pressing a mouse button
567 // - Releasing capture as a result of losing activation (FocusOut)
571 void WindowTreeHostX11::ReleaseCapture() {
574 void WindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor
) {
575 if (cursor
== current_cursor_
)
577 current_cursor_
= cursor
;
578 SetCursorInternal(cursor
);
581 void WindowTreeHostX11::MoveCursorToNative(const gfx::Point
& location
) {
582 XWarpPointer(xdisplay_
, None
, x_root_window_
, 0, 0, 0, 0,
583 bounds_
.x() + location
.x(),
584 bounds_
.y() + location
.y());
587 void WindowTreeHostX11::OnCursorVisibilityChangedNative(bool show
) {
590 ui::EventProcessor
* WindowTreeHostX11::GetEventProcessor() {
594 void WindowTreeHostX11::DispatchXI2Event(const base::NativeEvent
& event
) {
595 ui::TouchFactory
* factory
= ui::TouchFactory::GetInstance();
597 XIDeviceEvent
* xiev
= static_cast<XIDeviceEvent
*>(xev
->xcookie
.data
);
598 if (!factory
->ShouldProcessXI2Event(xev
))
601 TRACE_EVENT1("input", "WindowTreeHostX11::DispatchXI2Event",
603 (ui::EventTimeForNow() - ui::EventTimeFromNative(event
)).
606 int num_coalesced
= 0;
608 if (xev
->xgeneric
.evtype
== XI_Motion
) {
609 // If this is a motion event, we want to coalesce all pending motion
610 // events that are at the top of the queue. Note, we don't coalesce
611 // touch update events here.
612 num_coalesced
= ui::CoalescePendingMotionEvents(xev
, &last_event
);
613 if (num_coalesced
> 0)
616 ui::EventType type
= ui::EventTypeFromNative(xev
);
619 case ui::ET_TOUCH_MOVED
:
620 case ui::ET_TOUCH_PRESSED
:
621 case ui::ET_TOUCH_CANCELLED
:
622 case ui::ET_TOUCH_RELEASED
: {
623 ui::TouchEvent
touchev(xev
);
624 if (ui::DeviceDataManagerX11::GetInstance()->TouchEventNeedsCalibrate(
626 touch_calibrate_
->Calibrate(&touchev
, bounds_
);
628 TranslateAndDispatchLocatedEvent(&touchev
);
631 case ui::ET_MOUSE_MOVED
:
632 case ui::ET_MOUSE_DRAGGED
:
633 case ui::ET_MOUSE_PRESSED
:
634 case ui::ET_MOUSE_RELEASED
:
635 case ui::ET_MOUSE_ENTERED
:
636 case ui::ET_MOUSE_EXITED
: {
637 ui::MouseEvent
mouseev(xev
);
638 TranslateAndDispatchLocatedEvent(&mouseev
);
641 case ui::ET_MOUSEWHEEL
: {
642 ui::MouseWheelEvent
mouseev(xev
);
643 TranslateAndDispatchLocatedEvent(&mouseev
);
646 case ui::ET_SCROLL_FLING_START
:
647 case ui::ET_SCROLL_FLING_CANCEL
:
648 case ui::ET_SCROLL
: {
649 ui::ScrollEvent
scrollev(xev
);
650 SendEventToProcessor(&scrollev
);
653 case ui::ET_KEY_PRESSED
:
654 case ui::ET_KEY_RELEASED
: {
655 ui::KeyEvent
key_event(xev
);
656 SendEventToProcessor(&key_event
);
659 case ui::ET_UMA_DATA
:
667 // If we coalesced an event we need to free its cookie.
668 if (num_coalesced
> 0)
669 XFreeEventData(xev
->xgeneric
.display
, &last_event
.xcookie
);
672 void WindowTreeHostX11::SetCursorInternal(gfx::NativeCursor cursor
) {
673 XDefineCursor(xdisplay_
, xwindow_
, cursor
.platform());
676 void WindowTreeHostX11::OnConfigureNotify() {}
678 void WindowTreeHostX11::TranslateAndDispatchLocatedEvent(
679 ui::LocatedEvent
* event
) {
680 SendEventToProcessor(event
);
684 WindowTreeHost
* WindowTreeHost::Create(const gfx::Rect
& bounds
) {
685 return new WindowTreeHostX11(bounds
);
689 gfx::Size
WindowTreeHost::GetNativeScreenSize() {
690 ::XDisplay
* xdisplay
= gfx::GetXDisplay();
691 return gfx::Size(DisplayWidth(xdisplay
, 0), DisplayHeight(xdisplay
, 0));
696 void SetUseOverrideRedirectWindowByDefault(bool override_redirect
) {
697 default_override_redirect
= override_redirect
;