OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk_util.h" | 5 #include "chrome/browser/gtk/gtk_util.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
9 | 9 |
10 #include <cstdarg> | 10 #include <cstdarg> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // difference is that they accept middle clicks. | 48 // difference is that they accept middle clicks. |
49 gboolean OnMouseButtonPressed(GtkWidget* widget, GdkEventButton* event, | 49 gboolean OnMouseButtonPressed(GtkWidget* widget, GdkEventButton* event, |
50 gpointer userdata) { | 50 gpointer userdata) { |
51 if (event->type == GDK_BUTTON_PRESS) { | 51 if (event->type == GDK_BUTTON_PRESS) { |
52 if (gtk_button_get_focus_on_click(GTK_BUTTON(widget)) && | 52 if (gtk_button_get_focus_on_click(GTK_BUTTON(widget)) && |
53 !GTK_WIDGET_HAS_FOCUS(widget)) { | 53 !GTK_WIDGET_HAS_FOCUS(widget)) { |
54 gtk_widget_grab_focus(widget); | 54 gtk_widget_grab_focus(widget); |
55 } | 55 } |
56 | 56 |
57 gint button_mask = GPOINTER_TO_INT(userdata); | 57 gint button_mask = GPOINTER_TO_INT(userdata); |
58 if (button_mask && (1 << event->button)) | 58 if (button_mask & (1 << event->button)) |
59 gtk_button_pressed(GTK_BUTTON(widget)); | 59 gtk_button_pressed(GTK_BUTTON(widget)); |
60 } | 60 } |
61 | 61 |
62 return TRUE; | 62 return TRUE; |
63 } | 63 } |
64 | 64 |
65 gboolean OnMouseButtonReleased(GtkWidget* widget, GdkEventButton* event, | 65 gboolean OnMouseButtonReleased(GtkWidget* widget, GdkEventButton* event, |
66 gpointer userdata) { | 66 gpointer userdata) { |
67 gint button_mask = GPOINTER_TO_INT(userdata); | 67 gint button_mask = GPOINTER_TO_INT(userdata); |
68 if (button_mask && (1 << event->button)) | 68 if (button_mask && (1 << event->button)) |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 gint x = 0, y = 0, width = 1, height = 1; | 1023 gint x = 0, y = 0, width = 1, height = 1; |
1024 gtk_window_get_position(GTK_WINDOW(dialog), &x, &y); | 1024 gtk_window_get_position(GTK_WINDOW(dialog), &x, &y); |
1025 gtk_window_get_size(GTK_WINDOW(dialog), &width, &height); | 1025 gtk_window_get_size(GTK_WINDOW(dialog), &width, &height); |
1026 | 1026 |
1027 return gfx::Rect(x, y, width, height); | 1027 return gfx::Rect(x, y, width, height); |
1028 } | 1028 } |
1029 | 1029 |
1030 #endif | 1030 #endif |
1031 | 1031 |
1032 } // namespace gtk_util | 1032 } // namespace gtk_util |
OLD | NEW |