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

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

Issue 10834205: Draggable region support for frameless app window on GTK. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: refactor the patch. Created 8 years, 4 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: chrome/browser/ui/gtk/browser_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index 8f106730388764997c736c0a6c1f208b36eab793..682fc540b371e64c0717af2a41df3964f5fb859e 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -2322,42 +2322,8 @@ bool BrowserWindowGtk::HandleTitleBarLeftMousePress(
GdkEventButton* event,
guint32 last_click_time,
gfx::Point last_click_position) {
- // We want to start a move when the user single clicks, but not start a
- // move when the user double clicks. However, a double click sends the
- // following GDK events: GDK_BUTTON_PRESS, GDK_BUTTON_RELEASE,
- // GDK_BUTTON_PRESS, GDK_2BUTTON_PRESS, GDK_BUTTON_RELEASE. If we
- // start a gtk_window_begin_move_drag on the second GDK_BUTTON_PRESS,
- // the call to gtk_window_maximize fails. To work around this, we
- // keep track of the last click and if it's going to be a double click,
- // we don't call gtk_window_begin_move_drag.
- static GtkSettings* settings = gtk_settings_get_default();
- gint double_click_time = 250;
- gint double_click_distance = 5;
- g_object_get(G_OBJECT(settings),
- "gtk-double-click-time", &double_click_time,
- "gtk-double-click-distance", &double_click_distance,
- NULL);
-
- guint32 click_time = event->time - last_click_time;
- int click_move_x = abs(event->x - last_click_position.x());
- int click_move_y = abs(event->y - last_click_position.y());
-
- if (click_time > static_cast<guint32>(double_click_time) ||
- click_move_x > double_click_distance ||
- click_move_y > double_click_distance) {
- // Ignore drag requests if the window is the size of the screen.
- // We do this to avoid triggering fullscreen mode in metacity
- // (without the --no-force-fullscreen flag) and in compiz (with
- // Legacy Fullscreen Mode enabled).
- if (!BoundsMatchMonitorSize()) {
- gtk_window_begin_move_drag(window_, event->button,
- static_cast<gint>(event->x_root),
- static_cast<gint>(event->y_root),
- event->time);
- }
- return TRUE;
- }
- return FALSE;
+ return gtk_window_util::HandleTitleBarLeftMousePress(window_, bounds_,
+ event, last_click_time, last_click_position);
}
bool BrowserWindowGtk::HandleWindowEdgeLeftMousePress(
@@ -2496,17 +2462,6 @@ bool BrowserWindowGtk::UseCustomFrame() const {
return use_custom_frame_pref_.GetValue() && !browser_->is_app();
}
-bool BrowserWindowGtk::BoundsMatchMonitorSize() {
- // A screen can be composed of multiple monitors.
- GdkScreen* screen = gtk_window_get_screen(window_);
- gint monitor_num = gdk_screen_get_monitor_at_window(screen,
- gtk_widget_get_window(GTK_WIDGET(window_)));
-
- GdkRectangle monitor_size;
- gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor_size);
- return bounds_.size() == gfx::Size(monitor_size.width, monitor_size.height);
-}
-
void BrowserWindowGtk::PlaceBookmarkBar(bool is_floating) {
TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::PlaceBookmarkBar");

Powered by Google App Engine
This is Rietveld 408576698