[gimp] Remove more gdk_pointer_grab() where they are not strictly needed
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Remove more gdk_pointer_grab() where they are not strictly needed
- Date: Sat, 10 Dec 2011 20:51:53 +0000 (UTC)
commit 180cb656ae8107d448452baad30ea7d938e722f9
Author: Michael Natterer <mitch gimp org>
Date: Sat Dec 10 21:51:05 2011 +0100
Remove more gdk_pointer_grab() where they are not strictly needed
and replace them by gtk_grab_add()/remove().
app/widgets/gimpdasheditor.c | 8 +++-----
app/widgets/gimphistogramview.c | 7 ++-----
libgimpwidgets/gimpcolorselect.c | 18 ++++--------------
libgimpwidgets/gimpoffsetarea.c | 36 +++++++++++++++++++++---------------
4 files changed, 30 insertions(+), 39 deletions(-)
---
diff --git a/app/widgets/gimpdasheditor.c b/app/widgets/gimpdasheditor.c
index c135348..f039b12 100644
--- a/app/widgets/gimpdasheditor.c
+++ b/app/widgets/gimpdasheditor.c
@@ -351,9 +351,8 @@ gimp_dash_editor_button_press (GtkWidget *widget,
if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS)
{
- gdk_pointer_grab (gtk_widget_get_window (widget), FALSE,
- GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
- NULL, NULL, bevent->time);
+ gtk_grab_add (widget);
+
index = dash_x_to_index (editor, bevent->x);
editor->edit_mode = ! editor->segments [index];
@@ -375,8 +374,7 @@ gimp_dash_editor_button_release (GtkWidget *widget,
if (bevent->button == 1)
{
- gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (editor)),
- bevent->time);
+ gtk_grab_remove (widget);
update_options_from_segments (editor);
}
diff --git a/app/widgets/gimphistogramview.c b/app/widgets/gimphistogramview.c
index 6d14756..f3e8df1 100644
--- a/app/widgets/gimphistogramview.c
+++ b/app/widgets/gimphistogramview.c
@@ -528,9 +528,7 @@ gimp_histogram_view_button_press (GtkWidget *widget,
GtkAllocation allocation;
gint width;
- gdk_pointer_grab (gtk_widget_get_window (widget), FALSE,
- GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
- NULL, NULL, bevent->time);
+ gtk_grab_add (widget);
gtk_widget_get_allocation (widget, &allocation);
@@ -556,8 +554,7 @@ gimp_histogram_view_button_release (GtkWidget *widget,
{
gint start, end;
- gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (view)),
- bevent->time);
+ gtk_grab_remove (widget);
start = view->start;
end = view->end;
diff --git a/libgimpwidgets/gimpcolorselect.c b/libgimpwidgets/gimpcolorselect.c
index 0056261..7f28f84 100644
--- a/libgimpwidgets/gimpcolorselect.c
+++ b/libgimpwidgets/gimpcolorselect.c
@@ -671,11 +671,7 @@ gimp_color_select_xy_events (GtkWidget *widget,
x = bevent->x;
y = bevent->y;
- gdk_pointer_grab (gtk_widget_get_window (select->xy_color), FALSE,
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, bevent->time);
+ gtk_grab_add (widget);
select->drag_mode = DRAG_XY;
}
break;
@@ -690,8 +686,7 @@ gimp_color_select_xy_events (GtkWidget *widget,
x = bevent->x;
y = bevent->y;
- gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
- bevent->time);
+ gtk_grab_remove (widget);
select->drag_mode = DRAG_NONE;
}
break;
@@ -793,11 +788,7 @@ gimp_color_select_z_events (GtkWidget *widget,
z = bevent->y;
- gdk_pointer_grab (gtk_widget_get_window (select->z_color), FALSE,
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, bevent->time);
+ gtk_grab_add (widget);
select->drag_mode = DRAG_Z;
}
break;
@@ -811,8 +802,7 @@ gimp_color_select_z_events (GtkWidget *widget,
z = bevent->y;
- gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
- bevent->time);
+ gtk_grab_remove (widget);
select->drag_mode = DRAG_NONE;
}
break;
diff --git a/libgimpwidgets/gimpoffsetarea.c b/libgimpwidgets/gimpoffsetarea.c
index a012751..8dc1d7c 100644
--- a/libgimpwidgets/gimpoffsetarea.c
+++ b/libgimpwidgets/gimpoffsetarea.c
@@ -100,7 +100,10 @@ gimp_offset_area_init (GimpOffsetArea *area)
area->display_ratio_x = 1.0;
area->display_ratio_y = 1.0;
- gtk_widget_add_events (GTK_WIDGET (area), GDK_BUTTON_PRESS_MASK);
+ gtk_widget_add_events (GTK_WIDGET (area),
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_BUTTON1_MOTION_MASK);
}
/**
@@ -353,15 +356,15 @@ gimp_offset_area_event (GtkWidget *widget,
switch (event->type)
{
case GDK_BUTTON_PRESS:
- gdk_pointer_grab (gtk_widget_get_window (widget), FALSE,
- (GDK_BUTTON1_MOTION_MASK |
- GDK_BUTTON_RELEASE_MASK),
- NULL, NULL, event->button.time);
-
- orig_offset_x = area->offset_x;
- orig_offset_y = area->offset_y;
- start_x = event->button.x;
- start_y = event->button.y;
+ if (event->button.button == 1)
+ {
+ gtk_grab_add (widget);
+
+ orig_offset_x = area->offset_x;
+ orig_offset_y = area->offset_y;
+ start_x = event->button.x;
+ start_y = event->button.y;
+ }
break;
case GDK_MOTION_NOTIFY:
@@ -381,16 +384,19 @@ gimp_offset_area_event (GtkWidget *widget,
break;
case GDK_BUTTON_RELEASE:
- gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
- event->button.time);
- start_x = start_y = 0;
+ if (event->button.button == 1)
+ {
+ gtk_grab_remove (widget);
+
+ start_x = start_y = 0;
+ }
break;
default:
- break;
+ return FALSE;
}
- return FALSE;
+ return TRUE;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]