summaryrefslogtreecommitdiff
path: root/gtk/gtkrange.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-06-30 03:35:30 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-06-30 03:35:30 +0000
commit87cafe5b4b10354d4f4225e939efde92c570fec6 (patch)
treef14deab67b27f93025d43f6a68dfaa1f0d3695c4 /gtk/gtkrange.c
parent546e045ccf7438cdf931482a2e27b97bb24002fe (diff)
downloadgdk-pixbuf-87cafe5b4b10354d4f4225e939efde92c570fec6.tar.gz
Handle broken grabs.
2005-06-29 Matthias Clasen <mclasen@redhat.com> * gtk/gtkbutton.c (gtk_button_grab_broken): Handle broken grabs. * gtk/gtkrange.c (gtk_range_grab_broken): Handle broken grabs. * gdk/gdkevents.h: Add a boolean to specify wether the broken grab was implicit. * gdk/x11/gdkdisplay-x11.c (gdk_display_pointer_is_grabbed): As the documentation states, don't return TRUE for implicit grabs. * gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a boolean field to store wether a pointer grab is implicit. * gdk/x11/gdkmain-x11.c (_gdk_xgrab_check_button_event): Track implicit grabs. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Call _gdk_xgrab_check_button_event for button events.
Diffstat (limited to 'gtk/gtkrange.c')
-rw-r--r--gtk/gtkrange.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index d8340eb7c..af337cdf3 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -124,6 +124,8 @@ static gint gtk_range_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
static gint gtk_range_leave_notify (GtkWidget *widget,
GdkEventCrossing *event);
+static gboolean gtk_range_grab_broken (GtkWidget *widget,
+ GdkEventGrabBroken *event);
static void gtk_range_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void gtk_range_state_changed (GtkWidget *widget,
@@ -244,6 +246,7 @@ gtk_range_class_init (GtkRangeClass *class)
widget_class->scroll_event = gtk_range_scroll_event;
widget_class->enter_notify_event = gtk_range_enter_notify;
widget_class->leave_notify_event = gtk_range_leave_notify;
+ widget_class->grab_broken_event = gtk_range_grab_broken;
widget_class->grab_notify = gtk_range_grab_notify;
widget_class->state_changed = gtk_range_state_changed;
widget_class->style_set = gtk_range_style_set;
@@ -1378,6 +1381,25 @@ stop_scrolling (GtkRange *range)
gtk_widget_queue_draw (GTK_WIDGET (range));
}
+static gboolean
+gtk_range_grab_broken (GtkWidget *widget,
+ GdkEventGrabBroken *event)
+{
+ GtkRange *range = GTK_RANGE (widget);
+
+ if (range->layout->grab_location != MOUSE_OUTSIDE)
+ {
+ if (range->layout->grab_location == MOUSE_SLIDER)
+ update_slider_position (range, range->layout->mouse_x, range->layout->mouse_y);
+
+ stop_scrolling (range);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gint
gtk_range_button_release (GtkWidget *widget,
GdkEventButton *event)