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

Side by Side Diff: ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc

Issue 126513004: Rename RootWindowHost to WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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
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/views/widget/desktop_aura/x11_whole_screen_move_loop.h" 5 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. 8 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
9 #undef RootWindow 9 #undef RootWindow
10 10
(...skipping 11 matching lines...) Expand all
22 #include "ui/gfx/screen.h" 22 #include "ui/gfx/screen.h"
23 #include "ui/views/controls/image_view.h" 23 #include "ui/views/controls/image_view.h"
24 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
25 25
26 namespace views { 26 namespace views {
27 27
28 namespace { 28 namespace {
29 29
30 class ScopedCapturer { 30 class ScopedCapturer {
31 public: 31 public:
32 explicit ScopedCapturer(aura::RootWindowHost* host) 32 explicit ScopedCapturer(aura::WindowTreeHost* host)
33 : host_(host) { 33 : host_(host) {
34 host_->SetCapture(); 34 host_->SetCapture();
35 } 35 }
36 36
37 ~ScopedCapturer() { 37 ~ScopedCapturer() {
38 host_->ReleaseCapture(); 38 host_->ReleaseCapture();
39 } 39 }
40 40
41 private: 41 private:
42 aura::RootWindowHost* host_; 42 aura::WindowTreeHost* host_;
43 43
44 DISALLOW_COPY_AND_ASSIGN(ScopedCapturer); 44 DISALLOW_COPY_AND_ASSIGN(ScopedCapturer);
45 }; 45 };
46 46
47 } // namespace 47 } // namespace
48 48
49 X11WholeScreenMoveLoop::X11WholeScreenMoveLoop( 49 X11WholeScreenMoveLoop::X11WholeScreenMoveLoop(
50 X11WholeScreenMoveLoopDelegate* delegate) 50 X11WholeScreenMoveLoopDelegate* delegate)
51 : delegate_(delegate), 51 : delegate_(delegate),
52 in_move_loop_(false), 52 in_move_loop_(false),
53 should_reset_mouse_flags_(false), 53 should_reset_mouse_flags_(false),
54 grab_input_window_(None) { 54 grab_input_window_(None) {
55 } 55 }
56 56
57 X11WholeScreenMoveLoop::~X11WholeScreenMoveLoop() {} 57 X11WholeScreenMoveLoop::~X11WholeScreenMoveLoop() {}
58 58
59 //////////////////////////////////////////////////////////////////////////////// 59 ////////////////////////////////////////////////////////////////////////////////
60 // DesktopRootWindowHostLinux, MessageLoop::Dispatcher implementation: 60 // DesktopWindowTreeHostLinux, MessageLoop::Dispatcher implementation:
61 61
62 bool X11WholeScreenMoveLoop::Dispatch(const base::NativeEvent& event) { 62 bool X11WholeScreenMoveLoop::Dispatch(const base::NativeEvent& event) {
63 XEvent* xev = event; 63 XEvent* xev = event;
64 64
65 // Note: the escape key is handled in the tab drag controller, which has 65 // Note: the escape key is handled in the tab drag controller, which has
66 // keyboard focus even though we took pointer grab. 66 // keyboard focus even though we took pointer grab.
67 switch (xev->type) { 67 switch (xev->type) {
68 case MotionNotify: { 68 case MotionNotify: {
69 if (drag_widget_.get()) { 69 if (drag_widget_.get()) {
70 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); 70 gfx::Screen* screen = gfx::Screen::GetNativeScreen();
(...skipping 11 matching lines...) Expand all
82 delegate_->OnMouseReleased(); 82 delegate_->OnMouseReleased();
83 } 83 }
84 break; 84 break;
85 } 85 }
86 } 86 }
87 87
88 return true; 88 return true;
89 } 89 }
90 90
91 //////////////////////////////////////////////////////////////////////////////// 91 ////////////////////////////////////////////////////////////////////////////////
92 // DesktopRootWindowHostLinux, aura::client::WindowMoveClient implementation: 92 // DesktopWindowTreeHostLinux, aura::client::WindowMoveClient implementation:
93 93
94 bool X11WholeScreenMoveLoop::RunMoveLoop(aura::Window* source, 94 bool X11WholeScreenMoveLoop::RunMoveLoop(aura::Window* source,
95 gfx::NativeCursor cursor) { 95 gfx::NativeCursor cursor) {
96 // Start a capture on the host, so that it continues to receive events during 96 // Start a capture on the host, so that it continues to receive events during
97 // the drag. 97 // the drag.
98 ScopedCapturer capturer(source->GetDispatcher()->host()); 98 ScopedCapturer capturer(source->GetDispatcher()->host());
99 99
100 DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. 100 DCHECK(!in_move_loop_); // Can only handle one nested loop at a time.
101 in_move_loop_ = true; 101 in_move_loop_ = true;
102 102
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 image->SetBounds(0, 0, drag_image_.width(), drag_image_.height()); 236 image->SetBounds(0, 0, drag_image_.width(), drag_image_.height());
237 widget->SetContentsView(image); 237 widget->SetContentsView(image);
238 238
239 widget->Show(); 239 widget->Show();
240 widget->GetNativeWindow()->layer()->SetFillsBoundsOpaquely(false); 240 widget->GetNativeWindow()->layer()->SetFillsBoundsOpaquely(false);
241 241
242 drag_widget_.reset(widget); 242 drag_widget_.reset(widget);
243 } 243 }
244 244
245 } // namespace views 245 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc ('k') | ui/views/widget/desktop_aura/x11_window_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698