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

Unified 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: rebase on master Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/x11_desktop_handler.cc
diff --git a/ui/views/widget/desktop_aura/x11_desktop_handler.cc b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
index b7ca334936c924ce4cfac5ed073e300c0c6779ae..a4f6cb4730232d27d1b328e8451d19243d4479c5 100644
--- a/ui/views/widget/desktop_aura/x11_desktop_handler.cc
+++ b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
@@ -47,7 +47,8 @@ X11DesktopHandler::X11DesktopHandler()
current_window_(None),
current_window_active_state_(NOT_ACTIVE),
atom_cache_(xdisplay_, kAtomsToCache),
- wm_supports_active_window_(false) {
+ wm_supports_active_window_(false),
+ modal_dialog_xid_(None) {
if (ui::PlatformEventSource::GetInstance())
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
aura::Env::GetInstance()->AddObserver(this);
@@ -170,6 +171,13 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) {
::Window window;
if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) &&
window) {
+ // Set focus to the modal dialog.
+ if (modal_dialog_xid_) {
+ XSetInputFocus(xdisplay_, modal_dialog_xid_, RevertToParent,
+ CurrentTime);
sadrul 2015/06/30 17:30:56 Is it necessary to maintain a separate modal_dialo
joone 2015/07/01 03:16:06 Yes, we can query the DWTHX11.
+ break;
+ }
+
OnActiveWindowChanged(window, ACTIVE);
}
}
@@ -216,8 +224,10 @@ void X11DesktopHandler::OnActiveWindowChanged(::Window xid,
if (active_state == ACTIVE) {
DesktopWindowTreeHostX11* new_host =
views::DesktopWindowTreeHostX11::GetHostForXID(xid);
- if (new_host)
+ if (new_host) {
new_host->HandleNativeWidgetActivationChanged(true);
+ modal_dialog_xid_ = new_host->GetModalDialog();
sadrul 2015/06/30 17:30:56 Should you set the input-focus here instead?
joone 2015/07/01 03:16:06 The file dialog doesn't pop-up well when opening t
sadrul 2015/07/01 03:58:14 Can you clarify what you mean? It should be OK to
joone 2015/07/01 21:40:37 Yes, each window can have its own modal dialog and
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698