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

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

Issue 26427002: Add always-on-top property to app windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed file modes for test files Created 7 years, 2 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/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 d09dc09385c0ac2c83ed0550695eb1fb03ea0db6..3c9aa171e835653e22e5af26e481df4ef76a54ee 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
@@ -124,6 +124,7 @@ DesktopRootWindowHostX11::DesktopRootWindowHostX11(
window_mapped_(false),
focus_when_shown_(false),
is_fullscreen_(false),
+ always_on_top_(false),
current_cursor_(ui::kCursorNull),
native_widget_delegate_(native_widget_delegate),
desktop_native_widget_aura_(desktop_native_widget_aura) {
@@ -432,11 +433,16 @@ bool DesktopRootWindowHostX11::HasCapture() const {
}
void DesktopRootWindowHostX11::SetAlwaysOnTop(bool always_on_top) {
+ always_on_top_ = always_on_top;
SetWMSpecState(always_on_top,
atom_cache_.GetAtom("_NET_WM_STATE_ABOVE"),
None);
}
+bool DesktopRootWindowHostX11::IsAlwaysOnTop() const {
+ return always_on_top_;
+}
+
void DesktopRootWindowHostX11::SetWindowTitle(const string16& title) {
XStoreName(xdisplay_, xwindow_, UTF16ToUTF8(title).c_str());
}
@@ -914,6 +920,20 @@ void DesktopRootWindowHostX11::InitX11Window(
reinterpret_cast<unsigned char*>(&atom), 1);
}
+ // If the window should stay on top of other windows, add the
+ // _NET_WM_STATE_ABOVE property.
+ always_on_top_ = params.keep_on_top;
+ if (always_on_top_) {
+ Atom atom = atom_cache_.GetAtom("_NET_WM_STATE_ABOVE");
+ XChangeProperty (xdisplay_,
Elliot Glaysher 2013/10/08 18:05:00 This will clobber the XChangeProperty immediately
tmdiep 2013/10/09 02:15:04 Thanks for that. Fixed.
+ xwindow_,
+ atom_cache_.GetAtom("_NET_WM_STATE"),
+ XA_ATOM,
+ 32,
+ PropModeAppend,
+ reinterpret_cast<unsigned char*>(&atom), 1);
+ }
+
if (!params.wm_class_name.empty() || !params.wm_class_class.empty()) {
ui::SetWindowClassHint(
xdisplay_, xwindow_, params.wm_class_name, params.wm_class_class);
@@ -1356,6 +1376,7 @@ bool DesktopRootWindowHostX11::Dispatch(const base::NativeEvent& event) {
}
is_fullscreen_ = HasWMSpecProperty("_NET_WM_STATE_FULLSCREEN");
+ always_on_top_ = HasWMSpecProperty("_NET_WM_STATE_ABOVE");
// Now that we have different window properties, we may need to
// relayout the window. (The windows code doesn't need this because

Powered by Google App Engine
This is Rietveld 408576698