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

Unified Diff: chrome/browser/gtk/browser_window_gtk.cc

Issue 202050: Disallow popup windows from setting the window size to the exact (Closed)
Patch Set: Created 11 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/browser_window_gtk.cc
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 52f0887d9fe5a8d6873e1f406b73aa80b6cc1c61..7fcb7e6d67eeee11abe7c91f179c9c8e2920a9c5 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -517,6 +517,21 @@ GdkColor SkColorToGdkColor(const SkColor& color) {
return skia::SkColorToGdkColor(color);
}
+// A helper method for setting the GtkWindow size that should be used in place
+// of calling gtk_window_resize directly. This is done to avoid a WM "feature"
+// where setting the window size to the screen size causes the WM to set the
+// EWMH for full screen mode.
+void SetWindowSize(GtkWindow* window, int width, int height) {
+ GdkScreen* screen = gdk_screen_get_default();
+ if (width == gdk_screen_get_width(screen) &&
+ height == gdk_screen_get_height(screen)) {
+ // Adjust the height so we don't trigger the WM feature.
+ gtk_window_resize(window, width, height - 1);
+ } else {
+ gtk_window_resize(window, width, height);
+ }
+}
+
} // namespace
std::map<XID, GtkWindow*> BrowserWindowGtk::xid_map_;
@@ -800,7 +815,7 @@ void BrowserWindowGtk::SetBounds(const gfx::Rect& bounds) {
gint height = static_cast<gint>(bounds.height());
gtk_window_move(window_, x, y);
- gtk_window_resize(window_, width, height);
+ SetWindowSize(window_, width, height);
}
void BrowserWindowGtk::Close() {
@@ -1442,16 +1457,7 @@ void BrowserWindowGtk::SetGeometryHints() {
SetBounds(bounds);
} else {
// Ignore the position but obey the size.
- GdkScreen* screen = gdk_screen_get_default();
- if (bounds.width() == gdk_screen_get_width(screen) &&
- bounds.height() == gdk_screen_get_height(screen)) {
- // Work around a WM "feature" where if we set the window to the exact
- // size of the monitor, the WM automatically puts us in full screen mode.
- // Instead, adjust the height so we don't trigger this WM work around.
- gtk_window_resize(window_, bounds.width(), bounds.height() - 1);
- } else {
- gtk_window_resize(window_, bounds.width(), bounds.height());
- }
+ SetWindowSize(window_, bounds.width(), bounds.height());
}
}
« 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