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/views/widget/desktop_aura/x11_desktop_window_move_client.h" | 5 #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 None, | 106 None, |
107 None, | 107 None, |
108 CurrentTime); | 108 CurrentTime); |
109 XUngrabServer(display); | 109 XUngrabServer(display); |
110 if (ret != GrabSuccess) { | 110 if (ret != GrabSuccess) { |
111 DLOG(ERROR) << "Grabbing new tab for dragging failed: " | 111 DLOG(ERROR) << "Grabbing new tab for dragging failed: " |
112 << ui::GetX11ErrorString(display, ret); | 112 << ui::GetX11ErrorString(display, ret); |
113 return aura::client::MOVE_CANCELED; | 113 return aura::client::MOVE_CANCELED; |
114 } | 114 } |
115 | 115 |
116 MessageLoopForUI* loop = MessageLoopForUI::current(); | 116 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
117 MessageLoop::ScopedNestableTaskAllower allow_nested(loop); | 117 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop); |
118 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher()); | 118 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher()); |
119 quit_closure_ = run_loop.QuitClosure(); | 119 quit_closure_ = run_loop.QuitClosure(); |
120 run_loop.Run(); | 120 run_loop.Run(); |
121 return aura::client::MOVE_SUCCESSFUL; | 121 return aura::client::MOVE_SUCCESSFUL; |
122 } | 122 } |
123 | 123 |
124 void X11DesktopWindowMoveClient::EndMoveLoop() { | 124 void X11DesktopWindowMoveClient::EndMoveLoop() { |
125 if (!in_move_loop_) | 125 if (!in_move_loop_) |
126 return; | 126 return; |
127 | 127 |
128 // TODO(erg): Is this ungrab the cause of having to click to give input focus | 128 // TODO(erg): Is this ungrab the cause of having to click to give input focus |
129 // on drawn out windows? Not ungrabbing here screws the X server until I kill | 129 // on drawn out windows? Not ungrabbing here screws the X server until I kill |
130 // the chrome process. | 130 // the chrome process. |
131 | 131 |
132 // Ungrab before we let go of the window. | 132 // Ungrab before we let go of the window. |
133 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 133 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
134 XUngrabPointer(display, CurrentTime); | 134 XUngrabPointer(display, CurrentTime); |
135 | 135 |
136 base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow( | 136 base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow( |
137 grab_input_window_); | 137 grab_input_window_); |
138 root_window_ = NULL; | 138 root_window_ = NULL; |
139 XDestroyWindow(display, grab_input_window_); | 139 XDestroyWindow(display, grab_input_window_); |
140 | 140 |
141 in_move_loop_ = false; | 141 in_move_loop_ = false; |
142 quit_closure_.Run(); | 142 quit_closure_.Run(); |
143 } | 143 } |
144 | 144 |
145 } // namespace views | 145 } // namespace views |
OLD | NEW |