Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: ui/aura/root_window_host_linux.cc

Issue 12746002: Re-implement overscan & Implement Display Rotation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/aura/root_window_host_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 if (origin_changed) 572 if (origin_changed)
573 delegate_->OnHostMoved(bounds.origin()); 573 delegate_->OnHostMoved(bounds.origin());
574 if (size_changed || current_scale != new_scale) { 574 if (size_changed || current_scale != new_scale) {
575 delegate_->OnHostResized(bounds.size()); 575 delegate_->OnHostResized(bounds.size());
576 } else { 576 } else {
577 delegate_->AsRootWindow()->SchedulePaintInRect( 577 delegate_->AsRootWindow()->SchedulePaintInRect(
578 delegate_->AsRootWindow()->bounds()); 578 delegate_->AsRootWindow()->bounds());
579 } 579 }
580 } 580 }
581 581
582 gfx::Insets RootWindowHostLinux::GetInsets() const {
583 return insets_;
584 }
585
586 void RootWindowHostLinux::SetInsets(const gfx::Insets& insets) {
587 insets_ = insets;
588 if (pointer_barriers_.get()) {
589 UnConfineCursor();
590 ConfineCursorToRootWindow();
591 }
592 }
593
582 gfx::Point RootWindowHostLinux::GetLocationOnNativeScreen() const { 594 gfx::Point RootWindowHostLinux::GetLocationOnNativeScreen() const {
583 return bounds_.origin(); 595 return bounds_.origin();
584 } 596 }
585 597
586 void RootWindowHostLinux::SetCapture() { 598 void RootWindowHostLinux::SetCapture() {
587 // TODO(oshima): Grab x input. 599 // TODO(oshima): Grab x input.
588 } 600 }
589 601
590 void RootWindowHostLinux::ReleaseCapture() { 602 void RootWindowHostLinux::ReleaseCapture() {
591 // TODO(oshima): Release x input. 603 // TODO(oshima): Release x input.
(...skipping 28 matching lines...) Expand all
620 max(0, min(bounds_.height(), win_y_return))); 632 max(0, min(bounds_.height(), win_y_return)));
621 return (win_x_return >= 0 && win_x_return < bounds_.width() && 633 return (win_x_return >= 0 && win_x_return < bounds_.width() &&
622 win_y_return >= 0 && win_y_return < bounds_.height()); 634 win_y_return >= 0 && win_y_return < bounds_.height());
623 } 635 }
624 636
625 bool RootWindowHostLinux::ConfineCursorToRootWindow() { 637 bool RootWindowHostLinux::ConfineCursorToRootWindow() {
626 #if XFIXES_MAJOR >= 5 638 #if XFIXES_MAJOR >= 5
627 DCHECK(!pointer_barriers_.get()); 639 DCHECK(!pointer_barriers_.get());
628 if (pointer_barriers_.get()) 640 if (pointer_barriers_.get())
629 return false; 641 return false;
630 // TODO(oshima): There is a know issue where the pointer barrier
631 // leaks mouse pointer under certain conditions. crbug.com/133694.
632 pointer_barriers_.reset(new XID[4]); 642 pointer_barriers_.reset(new XID[4]);
643 gfx::Rect bounds(bounds_);
644 bounds.Inset(insets_);
633 // Horizontal, top barriers. 645 // Horizontal, top barriers.
634 pointer_barriers_[0] = XFixesCreatePointerBarrier( 646 pointer_barriers_[0] = XFixesCreatePointerBarrier(
635 xdisplay_, x_root_window_, 647 xdisplay_, x_root_window_,
636 bounds_.x(), bounds_.y(), bounds_.right(), bounds_.y(), 648 bounds.x(), bounds.y(), bounds.right(), bounds.y(),
637 BarrierPositiveY, 649 BarrierPositiveY,
638 0, XIAllDevices); 650 0, XIAllDevices);
639 // Horizontal, bottom barriers. 651 // Horizontal, bottom barriers.
640 pointer_barriers_[1] = XFixesCreatePointerBarrier( 652 pointer_barriers_[1] = XFixesCreatePointerBarrier(
641 xdisplay_, x_root_window_, 653 xdisplay_, x_root_window_,
642 bounds_.x(), bounds_.bottom(), bounds_.right(), bounds_.bottom(), 654 bounds.x(), bounds.bottom(), bounds.right(), bounds.bottom(),
643 BarrierNegativeY, 655 BarrierNegativeY,
644 0, XIAllDevices); 656 0, XIAllDevices);
645 // Vertical, left barriers. 657 // Vertical, left barriers.
646 pointer_barriers_[2] = XFixesCreatePointerBarrier( 658 pointer_barriers_[2] = XFixesCreatePointerBarrier(
647 xdisplay_, x_root_window_, 659 xdisplay_, x_root_window_,
648 bounds_.x(), bounds_.y(), bounds_.x(), bounds_.bottom(), 660 bounds.x(), bounds.y(), bounds.x(), bounds.bottom(),
649 BarrierPositiveX, 661 BarrierPositiveX,
650 0, XIAllDevices); 662 0, XIAllDevices);
651 // Vertical, right barriers. 663 // Vertical, right barriers.
652 pointer_barriers_[3] = XFixesCreatePointerBarrier( 664 pointer_barriers_[3] = XFixesCreatePointerBarrier(
653 xdisplay_, x_root_window_, 665 xdisplay_, x_root_window_,
654 bounds_.right(), bounds_.y(), bounds_.right(), bounds_.bottom(), 666 bounds.right(), bounds.y(), bounds.right(), bounds.bottom(),
655 BarrierNegativeX, 667 BarrierNegativeX,
656 0, XIAllDevices); 668 0, XIAllDevices);
657 #endif 669 #endif
658 return true; 670 return true;
659 } 671 }
660 672
661 void RootWindowHostLinux::UnConfineCursor() { 673 void RootWindowHostLinux::UnConfineCursor() {
662 #if XFIXES_MAJOR >= 5 674 #if XFIXES_MAJOR >= 5
663 if (pointer_barriers_.get()) { 675 if (pointer_barriers_.get()) {
664 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[0]); 676 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[0]);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 1003
992 void RootWindowHostLinux::TranslateAndDispatchMouseEvent( 1004 void RootWindowHostLinux::TranslateAndDispatchMouseEvent(
993 ui::MouseEvent* event) { 1005 ui::MouseEvent* event) {
994 RootWindow* root = GetRootWindow(); 1006 RootWindow* root = GetRootWindow();
995 client::ScreenPositionClient* screen_position_client = 1007 client::ScreenPositionClient* screen_position_client =
996 GetScreenPositionClient(root); 1008 GetScreenPositionClient(root);
997 if (screen_position_client && !bounds_.Contains(event->location())) { 1009 if (screen_position_client && !bounds_.Contains(event->location())) {
998 gfx::Point location(event->location()); 1010 gfx::Point location(event->location());
999 screen_position_client->ConvertNativePointToScreen(root, &location); 1011 screen_position_client->ConvertNativePointToScreen(root, &location);
1000 screen_position_client->ConvertPointFromScreen(root, &location); 1012 screen_position_client->ConvertPointFromScreen(root, &location);
1001 // |delegate_|'s OnHoustMouseEvent expects native coordinates relative to 1013 // |delegate_|'s OnHostMouseEvent expects native coordinates relative to
1002 // root. 1014 // root.
1003 location = ui::ConvertPointToPixel(root->layer(), location); 1015 location = ui::ConvertPointToPixel(root->layer(), location);
1004 event->set_location(location); 1016 event->set_location(location);
1005 event->set_root_location(location); 1017 event->set_root_location(location);
1006 } 1018 }
1007 delegate_->OnHostMouseEvent(event); 1019 delegate_->OnHostMouseEvent(event);
1008 } 1020 }
1009 1021
1010 scoped_ptr<ui::XScopedImage> RootWindowHostLinux::GetXImage( 1022 scoped_ptr<ui::XScopedImage> RootWindowHostLinux::GetXImage(
1011 const gfx::Rect& snapshot_bounds) { 1023 const gfx::Rect& snapshot_bounds) {
(...skipping 21 matching lines...) Expand all
1033 return new RootWindowHostLinux(bounds); 1045 return new RootWindowHostLinux(bounds);
1034 } 1046 }
1035 1047
1036 // static 1048 // static
1037 gfx::Size RootWindowHost::GetNativeScreenSize() { 1049 gfx::Size RootWindowHost::GetNativeScreenSize() {
1038 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); 1050 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay();
1039 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 1051 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
1040 } 1052 }
1041 1053
1042 } // namespace aura 1054 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/aura/root_window_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698