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

Unified Diff: chrome/browser/ui/gtk/apps/native_app_window_gtk.cc

Issue 26427002: Add always-on-top property to app windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge 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
« no previous file with comments | « chrome/browser/ui/gtk/apps/native_app_window_gtk.h ('k') | chrome/browser/ui/gtk/browser_window_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc b/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
index d86e490884ceb258c1176dff184c5b7ce5ddf1ae..9560d66c32c6a4f35ba4736a9057e03fe4ecfacd 100644
--- a/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
+++ b/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
@@ -48,6 +48,7 @@ NativeAppWindowGtk::NativeAppWindowGtk(ShellWindow* shell_window,
is_active_(false),
content_thinks_its_fullscreen_(false),
frameless_(params.frame == ShellWindow::FRAME_NONE),
+ always_on_top_(params.always_on_top),
frame_cursor_(NULL),
atom_cache_(base::MessagePumpGtk::GetDefaultXDisplay(), kAtomsToCache),
is_x_event_listened_(false) {
@@ -91,6 +92,9 @@ NativeAppWindowGtk::NativeAppWindowGtk(ShellWindow* shell_window,
if (frameless_)
gtk_window_set_decorated(window_, false);
+ if (always_on_top_)
+ gtk_window_set_keep_above(window_, TRUE);
+
int min_width = params.minimum_size.width();
int min_height = params.minimum_size.height();
int max_width = params.maximum_size.width();
@@ -339,7 +343,7 @@ void NativeAppWindowGtk::FlashFrame(bool flash) {
}
bool NativeAppWindowGtk::IsAlwaysOnTop() const {
- return false;
+ return always_on_top_;
}
void NativeAppWindowGtk::RenderViewHostChanged(
@@ -381,6 +385,16 @@ bool NativeAppWindowGtk::IsVisible() const {
void NativeAppWindowGtk::HideWithApp() {}
void NativeAppWindowGtk::ShowWithApp() {}
+void NativeAppWindowGtk::SetAlwaysOnTop(bool always_on_top) {
+ if (always_on_top_ != always_on_top) {
+ // gdk_window_get_state() does not give us the correct value for the
+ // GDK_WINDOW_STATE_ABOVE bit. Cache the current state.
+ always_on_top_ = always_on_top;
+ gtk_window_set_keep_above(window_, always_on_top_ ? TRUE : FALSE);
+ shell_window_->OnNativeWindowChanged();
+ }
+}
+
gfx::NativeView NativeAppWindowGtk::GetHostView() const {
NOTIMPLEMENTED();
return NULL;
« no previous file with comments | « chrome/browser/ui/gtk/apps/native_app_window_gtk.h ('k') | chrome/browser/ui/gtk/browser_window_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698