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/window_tree_host_x11.h" | 5 #include "ui/aura/window_tree_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/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 #include <X11/extensions/Xrandr.h> | 10 #include <X11/extensions/Xrandr.h> |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 uint32_t WindowTreeHostX11::DispatchEvent(const ui::PlatformEvent& event) { | 325 uint32_t WindowTreeHostX11::DispatchEvent(const ui::PlatformEvent& event) { |
326 XEvent* xev = event; | 326 XEvent* xev = event; |
327 if (FindEventTarget(xev) == x_root_window_) { | 327 if (FindEventTarget(xev) == x_root_window_) { |
328 if (xev->type == GenericEvent) | 328 if (xev->type == GenericEvent) |
329 DispatchXI2Event(xev); | 329 DispatchXI2Event(xev); |
330 return ui::POST_DISPATCH_NONE; | 330 return ui::POST_DISPATCH_NONE; |
331 } | 331 } |
332 | 332 |
333 switch (xev->type) { | 333 switch (xev->type) { |
334 case EnterNotify: { | 334 case EnterNotify: { |
| 335 // Ignore EventNotify events from children of |xwindow_|. |
| 336 // NativeViewGLSurfaceGLX adds a child to |xwindow_|. |
| 337 // TODO(pkotwicz|tdanderson): Figure out whether the suppression is |
| 338 // necessary. crbug.com/385716 |
| 339 if (xev->xcrossing.detail == NotifyInferior) |
| 340 break; |
| 341 |
335 aura::Window* root_window = window(); | 342 aura::Window* root_window = window(); |
336 client::CursorClient* cursor_client = | 343 client::CursorClient* cursor_client = |
337 client::GetCursorClient(root_window); | 344 client::GetCursorClient(root_window); |
338 if (cursor_client) { | 345 if (cursor_client) { |
339 const gfx::Display display = gfx::Screen::GetScreenFor(root_window)-> | 346 const gfx::Display display = gfx::Screen::GetScreenFor(root_window)-> |
340 GetDisplayNearestWindow(root_window); | 347 GetDisplayNearestWindow(root_window); |
341 cursor_client->SetDisplay(display); | 348 cursor_client->SetDisplay(display); |
342 } | 349 } |
343 ui::MouseEvent mouse_event(xev); | 350 ui::MouseEvent mouse_event(xev); |
344 // EnterNotify creates ET_MOUSE_MOVE. Mark as synthesized as this is not | 351 // EnterNotify creates ET_MOUSE_MOVE. Mark as synthesized as this is not |
345 // real mouse move event. | 352 // real mouse move event. |
346 mouse_event.set_flags(mouse_event.flags() | ui::EF_IS_SYNTHESIZED); | 353 mouse_event.set_flags(mouse_event.flags() | ui::EF_IS_SYNTHESIZED); |
347 TranslateAndDispatchLocatedEvent(&mouse_event); | 354 TranslateAndDispatchLocatedEvent(&mouse_event); |
348 break; | 355 break; |
349 } | 356 } |
350 case LeaveNotify: { | 357 case LeaveNotify: { |
| 358 // Ignore LeaveNotify events from children of |xwindow_|. |
| 359 // NativeViewGLSurfaceGLX adds a child to |xwindow_|. |
| 360 // TODO(pkotwicz|tdanderson): Figure out whether the suppression is |
| 361 // necessary. crbug.com/385716 |
| 362 if (xev->xcrossing.detail == NotifyInferior) |
| 363 break; |
| 364 |
351 ui::MouseEvent mouse_event(xev); | 365 ui::MouseEvent mouse_event(xev); |
352 TranslateAndDispatchLocatedEvent(&mouse_event); | 366 TranslateAndDispatchLocatedEvent(&mouse_event); |
353 break; | 367 break; |
354 } | 368 } |
355 case Expose: { | 369 case Expose: { |
356 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y, | 370 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y, |
357 xev->xexpose.width, xev->xexpose.height); | 371 xev->xexpose.width, xev->xexpose.height); |
358 compositor()->ScheduleRedrawRect(damage_rect); | 372 compositor()->ScheduleRedrawRect(damage_rect); |
359 break; | 373 break; |
360 } | 374 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 } | 735 } |
722 | 736 |
723 namespace test { | 737 namespace test { |
724 | 738 |
725 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 739 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
726 default_override_redirect = override_redirect; | 740 default_override_redirect = override_redirect; |
727 } | 741 } |
728 | 742 |
729 } // namespace test | 743 } // namespace test |
730 } // namespace aura | 744 } // namespace aura |
OLD | NEW |