From 139fe522a7eb4f85dc77e67821bcc45806c48c0c Mon Sep 17 00:00:00 2001 From: "oshima@chromium.org" Date: Wed, 7 Apr 2010 18:20:48 +0000 Subject: Allow SetAlwaysOnTop() before GtkWidget creation. like WidgetWin does. BUG=none TEST=manual: web notification in linux/toolkitview build will work. Review URL: http://codereview.chromium.org/1628006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43855 0039d316-1c4b-4281-b951-d872f2087c98 --- views/widget/widget_gtk.cc | 11 ++++++++--- views/widget/widget_gtk.h | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'views/widget') diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 8898306..329ceb3 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -114,7 +114,8 @@ WidgetGtk::WidgetGtk(Type type) transient_to_parent_(false), got_initial_focus_in_(false), has_focus_(false), - delegate_(NULL) { + delegate_(NULL), + always_on_top_(false) { static bool installed_message_loop_observer = false; if (!installed_message_loop_observer) { installed_message_loop_observer = true; @@ -539,8 +540,10 @@ void WidgetGtk::SetOpacity(unsigned char opacity) { } void WidgetGtk::SetAlwaysOnTop(bool on_top) { - DCHECK(widget_); - gtk_window_set_keep_above(GTK_WINDOW(widget_), on_top); + DCHECK(type_ != TYPE_CHILD); + always_on_top_ = on_top; + if (widget_) + gtk_window_set_keep_above(GTK_WINDOW(widget_), on_top); } RootView* WidgetGtk::GetRootView() { @@ -1149,6 +1152,8 @@ void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) { if (ignore_events_) ConfigureWidgetForIgnoreEvents(); + + SetAlwaysOnTop(always_on_top_); } // The widget needs to be realized before handlers like size-allocate can diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index 075d873..d10237d 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -421,6 +421,10 @@ class WidgetGtk // being used. WidgetDelegate* delegate_; + // If true, the window stays on top of the screen. This is only used + // for types other than TYPE_CHILD. + bool always_on_top_; + DISALLOW_COPY_AND_ASSIGN(WidgetGtk); }; -- cgit v1.1