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

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

Issue 1045443002: Make File-Picker modal on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comments and moved input-focus code Created 5 years, 5 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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | no next file » | 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/views/widget/desktop_aura/x11_desktop_handler.h" 5 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 old_host->HandleNativeWidgetActivationChanged(false); 209 old_host->HandleNativeWidgetActivationChanged(false);
210 } 210 }
211 211
212 // Update the current window ID to effectively change the active widget. 212 // Update the current window ID to effectively change the active widget.
213 current_window_ = xid; 213 current_window_ = xid;
214 current_window_active_state_ = active_state; 214 current_window_active_state_ = active_state;
215 215
216 if (active_state == ACTIVE) { 216 if (active_state == ACTIVE) {
217 DesktopWindowTreeHostX11* new_host = 217 DesktopWindowTreeHostX11* new_host =
218 views::DesktopWindowTreeHostX11::GetHostForXID(xid); 218 views::DesktopWindowTreeHostX11::GetHostForXID(xid);
219 if (new_host) 219 if (new_host) {
220 new_host->HandleNativeWidgetActivationChanged(true); 220 new_host->HandleNativeWidgetActivationChanged(true);
sadrul 2015/07/08 15:02:31 We don't actually want to call this if |new_host|
joone 2015/07/08 17:16:45 Yes, we may not need to call this. I will test it.
221 // Set focus to the modal dialog instead of the host window.
222 if (new_host->GetModalDialog())
223 XSetInputFocus(xdisplay_, new_host->GetModalDialog(),
224 RevertToParent, CurrentTime);
225 }
221 } 226 }
222 } 227 }
223 228
224 void X11DesktopHandler::OnWindowCreatedOrDestroyed(int event_type, 229 void X11DesktopHandler::OnWindowCreatedOrDestroyed(int event_type,
225 XID window) { 230 XID window) {
226 // Menus created by Chrome can be drag and drop targets. Since they are 231 // Menus created by Chrome can be drag and drop targets. Since they are
227 // direct children of the screen root window and have override_redirect 232 // direct children of the screen root window and have override_redirect
228 // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them 233 // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them
229 // and use a separate cache to keep track of them. 234 // and use a separate cache to keep track of them.
230 // TODO(varkha): Implement caching of all top level X windows and their 235 // TODO(varkha): Implement caching of all top level X windows and their
231 // coordinates and stacking order to eliminate repeated calls to the X server 236 // coordinates and stacking order to eliminate repeated calls to the X server
232 // during mouse movement, drag and shaping events. 237 // during mouse movement, drag and shaping events.
233 if (event_type == CreateNotify) { 238 if (event_type == CreateNotify) {
234 // The window might be destroyed if the message pump did not get a chance to 239 // The window might be destroyed if the message pump did not get a chance to
235 // run but we can safely ignore the X error. 240 // run but we can safely ignore the X error.
236 gfx::X11ErrorTracker error_tracker; 241 gfx::X11ErrorTracker error_tracker;
237 ui::XMenuList::GetInstance()->MaybeRegisterMenu(window); 242 ui::XMenuList::GetInstance()->MaybeRegisterMenu(window);
238 } else { 243 } else {
239 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); 244 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window);
240 } 245 }
241 246
242 if (event_type == DestroyNotify) { 247 if (event_type == DestroyNotify) {
243 // Notify the XForeignWindowManager that |window| has been destroyed. 248 // Notify the XForeignWindowManager that |window| has been destroyed.
244 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); 249 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window);
245 } 250 }
246 } 251 }
247 252
248 } // namespace views 253 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698