summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-12 03:56:24 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-12 03:56:24 +0000
commit8e85884ba4efff3c2189581d9819dfdfcfb35aa6 (patch)
tree36900f1103b8a1a594cfef82f19820293ec5cc7d
parent5fa9098c17f5463a06f7eb0bd7eea8d9dda0a170 (diff)
downloadchromium_src-8e85884ba4efff3c2189581d9819dfdfcfb35aa6.zip
chromium_src-8e85884ba4efff3c2189581d9819dfdfcfb35aa6.tar.gz
chromium_src-8e85884ba4efff3c2189581d9819dfdfcfb35aa6.tar.bz2
Linux: suppress calling gdk_window_raise() on titlebar click when running compiz. It can cause a really weird bug in the version of compiz in Ubuntu 8.04, which we still want to support.
BUG=19291 TEST=drag a window partially offscreen when using compiz in 8.04, then click in the title bar - it will not disappear or move Review URL: http://codereview.chromium.org/1564024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44233 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc14
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h4
2 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index a574c90..e31d564 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -331,10 +331,19 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser)
is_active_(true),
last_click_time_(0),
maximize_after_show_(false),
+ suppress_window_raise_(false),
accel_group_(NULL) {
use_custom_frame_pref_.Init(prefs::kUseCustomChromeFrame,
browser_->profile()->GetPrefs(), this);
+ // In some (older) versions of compiz, raising top-level windows when they
+ // are partially off-screen causes them to get snapped back on screen, not
+ // always even on the current virtual desktop. If we are running under
+ // compiz, suppress such raises, as they are not necessary in compiz anyway.
+ std::string wm_name;
+ if (x11_util::GetWindowManagerName(&wm_name) && wm_name == "compiz")
+ suppress_window_raise_ = true;
+
window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
g_object_set_qdata(G_OBJECT(window_), GetBrowserWindowQuarkKey(), this);
gtk_widget_add_events(GTK_WIDGET(window_), GDK_BUTTON_PRESS_MASK |
@@ -1815,8 +1824,9 @@ gboolean BrowserWindowGtk::OnButtonPressEvent(GtkWidget* widget,
static_cast<int>(event->y));
// Raise the window after a click on either the titlebar or the border to
- // match the behavior of most window managers.
- if (has_hit_titlebar || has_hit_edge)
+ // match the behavior of most window managers, unless that behavior has
+ // been suppressed.
+ if ((has_hit_titlebar || has_hit_edge) && !window->suppress_window_raise_)
gdk_window_raise(GTK_WIDGET(window->window_)->window);
if (has_hit_titlebar) {
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index bac7a3d..53e58cc 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -402,6 +402,10 @@ class BrowserWindowGtk : public BrowserWindow,
// first time. This is to work around a compiz bug.
bool maximize_after_show_;
+ // If true, don't call gdk_window_raise() when we get a click in the title
+ // bar or window border. This is to work around a compiz bug.
+ bool suppress_window_raise_;
+
// The accelerator group used to handle accelerators, owned by this object.
GtkAccelGroup* accel_group_;