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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 | 432 |
433 void WindowTreeHostX11::SetCapture() { | 433 void WindowTreeHostX11::SetCapture() { |
434 // TODO(oshima): Grab x input. | 434 // TODO(oshima): Grab x input. |
435 } | 435 } |
436 | 436 |
437 void WindowTreeHostX11::ReleaseCapture() { | 437 void WindowTreeHostX11::ReleaseCapture() { |
438 // TODO(oshima): Release x input. | 438 // TODO(oshima): Release x input. |
439 } | 439 } |
440 | 440 |
441 bool WindowTreeHostX11::QueryMouseLocation(gfx::Point* location_return) { | |
442 client::CursorClient* cursor_client = | |
443 client::GetCursorClient(window()); | |
444 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { | |
445 *location_return = gfx::Point(0, 0); | |
446 return false; | |
447 } | |
448 | |
449 ::Window root_return, child_return; | |
450 int root_x_return, root_y_return, win_x_return, win_y_return; | |
451 unsigned int mask_return; | |
452 XQueryPointer(xdisplay_, | |
453 xwindow_, | |
454 &root_return, | |
455 &child_return, | |
456 &root_x_return, &root_y_return, | |
457 &win_x_return, &win_y_return, | |
458 &mask_return); | |
459 *location_return = gfx::Point(max(0, min(bounds_.width(), win_x_return)), | |
460 max(0, min(bounds_.height(), win_y_return))); | |
461 return (win_x_return >= 0 && win_x_return < bounds_.width() && | |
462 win_y_return >= 0 && win_y_return < bounds_.height()); | |
463 } | |
464 | |
465 void WindowTreeHostX11::PostNativeEvent( | 441 void WindowTreeHostX11::PostNativeEvent( |
466 const base::NativeEvent& native_event) { | 442 const base::NativeEvent& native_event) { |
467 DCHECK(xwindow_); | 443 DCHECK(xwindow_); |
468 DCHECK(xdisplay_); | 444 DCHECK(xdisplay_); |
469 XEvent xevent = *native_event; | 445 XEvent xevent = *native_event; |
470 xevent.xany.display = xdisplay_; | 446 xevent.xany.display = xdisplay_; |
471 xevent.xany.window = xwindow_; | 447 xevent.xany.window = xwindow_; |
472 | 448 |
473 switch (xevent.type) { | 449 switch (xevent.type) { |
474 case EnterNotify: | 450 case EnterNotify: |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 } | 604 } |
629 | 605 |
630 namespace test { | 606 namespace test { |
631 | 607 |
632 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 608 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
633 default_override_redirect = override_redirect; | 609 default_override_redirect = override_redirect; |
634 } | 610 } |
635 | 611 |
636 } // namespace test | 612 } // namespace test |
637 } // namespace aura | 613 } // namespace aura |
OLD | NEW |