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

Unified Diff: ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc

Issue 100623008: Allow inactive windows to be created with Linux Aura. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@show_inactive
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
index 545e0cde550ffaea30255827af593b2927f3da30..b392023792b2db1cede9d1cc1019dd6e58dd3a5b 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
@@ -330,13 +330,49 @@ aura::RootWindowHost* DesktopRootWindowHostX11::AsRootWindowHost() {
void DesktopRootWindowHostX11::ShowWindowWithState(
ui::WindowShowState show_state) {
+ if (window_mapped_)
+ return;
+
if (show_state != ui::SHOW_STATE_DEFAULT &&
- show_state != ui::SHOW_STATE_NORMAL) {
- // Only forwarding to Show().
+ show_state != ui::SHOW_STATE_NORMAL &&
+ show_state != ui::SHOW_STATE_INACTIVE) {
+ // It will behave like SHOW_STATE_NORMAL.
NOTIMPLEMENTED();
}
- Show();
+ // Before we map the window, set size hints. Otherwise, some window managers
+ // will ignore toplevel XMoveWindow commands.
+ XSizeHints size_hints;
+ size_hints.flags = PPosition;
+ size_hints.x = bounds_.x();
+ size_hints.y = bounds_.y();
+ XSetWMNormalHints(xdisplay_, xwindow_, &size_hints);
+
+ XWMHints wm_hints;
+ wm_hints.flags = InputHint | StateHint;
+ wm_hints.input = show_state != ui::SHOW_STATE_INACTIVE;
+ wm_hints.initial_state = NormalState;
+ XSetWMHints(xdisplay_, xwindow_, &wm_hints);
+
+ XMapWindow(xdisplay_, xwindow_);
+
+ // We now block until our window is mapped. Some X11 APIs will crash and
+ // burn if passed |xwindow_| before the window is mapped, and XMapWindow is
+ // asynchronous.
+ base::MessagePumpX11::Current()->BlockUntilWindowMapped(xwindow_);
+ window_mapped_ = true;
+
+ // The window has been created and mapped. Keeping the hint will simply
+ // confuse the WM at that point.
+ if (show_state == ui::SHOW_STATE_INACTIVE) {
+ XWMHints wm_hints;
+ wm_hints.flags = InputHint;
+ wm_hints.input = true;
+ XSetWMHints(xdisplay_, xwindow_, &wm_hints);
+ }
+
+ if (show_state != ui::SHOW_STATE_INACTIVE)
sadrul 2013/12/16 03:40:10 Is this change sufficient to not give focus to the
mlamouri (slow - plz ping) 2013/12/16 15:26:05 We still need to call XMapWindow, otherwise XRaise
+ native_widget_delegate_->AsWidget()->SetInitialFocus();
}
void DesktopRootWindowHostX11::ShowMaximizedWithBounds(
@@ -714,25 +750,7 @@ gfx::AcceleratedWidget DesktopRootWindowHostX11::GetAcceleratedWidget() {
}
void DesktopRootWindowHostX11::Show() {
- if (!window_mapped_) {
- // Before we map the window, set size hints. Otherwise, some window managers
- // will ignore toplevel XMoveWindow commands.
- XSizeHints size_hints;
- size_hints.flags = PPosition;
- size_hints.x = bounds_.x();
- size_hints.y = bounds_.y();
- XSetWMNormalHints(xdisplay_, xwindow_, &size_hints);
-
- XMapWindow(xdisplay_, xwindow_);
-
- // We now block until our window is mapped. Some X11 APIs will crash and
- // burn if passed |xwindow_| before the window is mapped, and XMapWindow is
- // asynchronous.
- base::MessagePumpX11::Current()->BlockUntilWindowMapped(xwindow_);
- window_mapped_ = true;
- }
-
- native_widget_delegate_->AsWidget()->SetInitialFocus();
+ ShowWindowWithState(ui::SHOW_STATE_INACTIVE);
sadrul 2013/12/16 03:40:10 This is not right.
mlamouri (slow - plz ping) 2013/12/16 15:26:05 This is actually what Widget::Show() is expected t
}
void DesktopRootWindowHostX11::Hide() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698