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

Side by Side Diff: chrome/browser/gtk/browser_window_gtk.cc

Issue 246029: Linux: Raise window after click on titlebar or border. (Closed)
Patch Set: only raise after click on titlebar or border Created 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gtk/browser_window_gtk.h" 5 #include "chrome/browser/gtk/browser_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <X11/XF86keysym.h> 8 #include <X11/XF86keysym.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 bool has_hit_titlebar = !browser->IsFullscreen() && (toolbar_y < 0) 1968 bool has_hit_titlebar = !browser->IsFullscreen() && (toolbar_y < 0)
1969 && !has_hit_edge; 1969 && !has_hit_edge;
1970 if (event->button == 1) { 1970 if (event->button == 1) {
1971 if (GDK_BUTTON_PRESS == event->type) { 1971 if (GDK_BUTTON_PRESS == event->type) {
1972 guint32 last_click_time = browser->last_click_time_; 1972 guint32 last_click_time = browser->last_click_time_;
1973 gfx::Point last_click_position = browser->last_click_position_; 1973 gfx::Point last_click_position = browser->last_click_position_;
1974 browser->last_click_time_ = event->time; 1974 browser->last_click_time_ = event->time;
1975 browser->last_click_position_ = gfx::Point(static_cast<int>(event->x), 1975 browser->last_click_position_ = gfx::Point(static_cast<int>(event->x),
1976 static_cast<int>(event->y)); 1976 static_cast<int>(event->y));
1977 1977
1978 // Raise the window after a click on either the titlebar or the border to
1979 // match the behavior of most window managers.
1980 if (has_hit_titlebar || has_hit_edge)
1981 gdk_window_raise(GTK_WIDGET(browser->window_)->window);
1982
1978 if (has_hit_titlebar) { 1983 if (has_hit_titlebar) {
1979 // We want to start a move when the user single clicks, but not start a 1984 // We want to start a move when the user single clicks, but not start a
1980 // move when the user double clicks. However, a double click sends the 1985 // move when the user double clicks. However, a double click sends the
1981 // following GDK events: GDK_BUTTON_PRESS, GDK_BUTTON_RELEASE, 1986 // following GDK events: GDK_BUTTON_PRESS, GDK_BUTTON_RELEASE,
1982 // GDK_BUTTON_PRESS, GDK_2BUTTON_PRESS, GDK_BUTTON_RELEASE. If we 1987 // GDK_BUTTON_PRESS, GDK_2BUTTON_PRESS, GDK_BUTTON_RELEASE. If we
1983 // start a gtk_window_begin_move_drag on the second GDK_BUTTON_PRESS, 1988 // start a gtk_window_begin_move_drag on the second GDK_BUTTON_PRESS,
1984 // the call to gtk_window_maximize fails. To work around this, we 1989 // the call to gtk_window_maximize fails. To work around this, we
1985 // keep track of the last click and if it's going to be a double click, 1990 // keep track of the last click and if it's going to be a double click,
1986 // we don't call gtk_window_begin_move_drag. 1991 // we don't call gtk_window_begin_move_drag.
1987 static GtkSettings* settings = gtk_settings_get_default(); 1992 static GtkSettings* settings = gtk_settings_get_default();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 // are taken from the WMs' source code. 2217 // are taken from the WMs' source code.
2213 return (wm_name == "Blackbox" || 2218 return (wm_name == "Blackbox" ||
2214 wm_name == "compiz" || 2219 wm_name == "compiz" ||
2215 wm_name == "e16" || // Enlightenment DR16 2220 wm_name == "e16" || // Enlightenment DR16
2216 wm_name == "KWin" || 2221 wm_name == "KWin" ||
2217 wm_name == "Metacity" || 2222 wm_name == "Metacity" ||
2218 wm_name == "Mutter" || 2223 wm_name == "Mutter" ||
2219 wm_name == "Openbox" || 2224 wm_name == "Openbox" ||
2220 wm_name == "Xfwm4"); 2225 wm_name == "Xfwm4");
2221 } 2226 }
OLDNEW
« 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