app/display/gimpdisplayshell-callbacks.c libgimpwidgets/gimpcolorselect.c

2008-09-03  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-callbacks.c
	* libgimpwidgets/gimpcolorselect.c
	* modules/color-selector-water.c
	* plug-ins/ifs-compose/ifs-compose.c: instead of using
	gdk_window_get_pointer() if GdkEventMotion::is_hint is TRUE,
	simply always use the coords from the event and call
	gdk_event_request_motions() to ask for more motion events. This is
	the recommended way and also works for events from devices other
	than the core pointer.

	* plug-ins/ifs-compose/ifs-compose.c (design_area_motion): some
	code cleanup while i was at it.


svn path=/trunk/; revision=26843
This commit is contained in:
Michael Natterer 2008-09-03 19:24:51 +00:00 committed by Michael Natterer
parent 5357d42ab3
commit 435f6e3974
5 changed files with 60 additions and 70 deletions

View File

@ -1,3 +1,18 @@
2008-09-03 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.c
* libgimpwidgets/gimpcolorselect.c
* modules/color-selector-water.c
* plug-ins/ifs-compose/ifs-compose.c: instead of using
gdk_window_get_pointer() if GdkEventMotion::is_hint is TRUE,
simply always use the coords from the event and call
gdk_event_request_motions() to ask for more motion events. This is
the recommended way and also works for events from devices other
than the core pointer.
* plug-ins/ifs-compose/ifs-compose.c (design_area_motion): some
code cleanup while i was at it.
2008-09-03 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpbutton.c: massively simplified. Don't fiddle

View File

@ -1137,15 +1137,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
}
}
/* Ask for the pointer position, but ignore it except for cursor
* handling, so motion events sync with the button press/release events
*/
if (mevent->is_hint)
{
gimp_display_shell_get_device_coords (shell,
mevent->device,
&display_coords);
}
/* Ask for more motion events in case the event was a hint */
gdk_event_request_motions (mevent);
update_sw_cursor = TRUE;

View File

@ -667,15 +667,8 @@ gimp_color_select_xy_events (GtkWidget *widget,
case GDK_MOTION_NOTIFY:
mevent = (GdkEventMotion *) event;
if (mevent->is_hint)
{
gdk_window_get_pointer (widget->window, &x, &y, NULL);
}
else
{
x = mevent->x;
y = mevent->y;
}
break;
default:
@ -700,7 +693,7 @@ gimp_color_select_xy_events (GtkWidget *widget,
gimp_color_select_update (select, UPDATE_VALUES | UPDATE_CALLER);
if (event->type == GDK_MOTION_NOTIFY)
/* Ask for more motion events in case the event was a hint */
gdk_event_request_motions ((GdkEventMotion *) event);
return TRUE;
@ -760,14 +753,7 @@ gimp_color_select_z_events (GtkWidget *widget,
case GDK_MOTION_NOTIFY:
mevent = (GdkEventMotion *) event;
if (mevent->is_hint)
{
gdk_window_get_pointer (widget->window, NULL, &z, NULL);
}
else
{
z = mevent->y;
}
break;
default:
@ -787,6 +773,9 @@ gimp_color_select_z_events (GtkWidget *widget,
gimp_color_select_update (select,
UPDATE_VALUES | UPDATE_XY_COLOR | UPDATE_CALLER);
/* Ask for more motion events in case the event was a hint */
gdk_event_request_motions ((GdkEventMotion *) event);
return TRUE;
}

View File

@ -395,8 +395,8 @@ motion_notify_event (GtkWidget *widget,
}
}
if (event->is_hint)
gdk_device_get_state (event->device, event->window, NULL, NULL);
/* Ask for more motion events in case the event was a hint */
gdk_event_request_motions (event);
return TRUE;
}

View File

@ -1699,20 +1699,13 @@ design_area_motion (GtkWidget *widget,
gdouble yo;
gdouble xn;
gdouble yn;
gint px, py;
gdouble width = ifsDesign->area->allocation.width;
gdouble height = ifsDesign->area->allocation.height;
Aff2 trans, t1, t2, t3;
if (!(ifsDesign->button_state & GDK_BUTTON1_MASK)) return FALSE;
if (event->is_hint)
{
gtk_widget_get_pointer (ifsDesign->area, &px, &py);
event->x = px;
event->y = py;
}
if (! (ifsDesign->button_state & GDK_BUTTON1_MASK))
return FALSE;
xo = (ifsDesign->op_x - ifsDesign->op_xcenter);
yo = (ifsDesign->op_y - ifsDesign->op_ycenter);
@ -1722,7 +1715,6 @@ design_area_motion (GtkWidget *widget,
switch (ifsDesign->op)
{
case OP_ROTATE:
{
aff2_translate (&t1,-ifsDesign->op_xcenter*width,
-ifsDesign->op_ycenter*width);
aff2_scale (&t2,
@ -1735,9 +1727,8 @@ design_area_motion (GtkWidget *widget,
ifsDesign->op_ycenter*width);
aff2_compose (&trans, &t3, &t2);
break;
}
case OP_STRETCH:
{
aff2_translate (&t1,-ifsDesign->op_xcenter*width,
-ifsDesign->op_ycenter*width);
aff2_compute_stretch (&t2, xo, yo, xn, yn);
@ -1746,13 +1737,11 @@ design_area_motion (GtkWidget *widget,
ifsDesign->op_ycenter*width);
aff2_compose (&trans, &t1, &t3);
break;
}
case OP_TRANSLATE:
{
aff2_translate (&trans,(xn-xo)*width,(yn-yo)*width);
break;
}
}
for (i = 0; i < ifsvals.num_elements; i++)
if (element_selected[i])
@ -1775,6 +1764,7 @@ design_area_motion (GtkWidget *widget,
aff2_compose (&elements[i]->trans, &trans,
&ifsD->selected_orig[i].trans);
}
aff_element_decompose_trans (elements[i],&elements[i]->trans,
width, height, ifsvals.center_x,
ifsvals.center_y);
@ -1785,6 +1775,9 @@ design_area_motion (GtkWidget *widget,
update_values ();
design_area_redraw ();
/* Ask for more motion events in case the event was a hint */
gdk_event_request_motions (event);
return FALSE;
}