mirror of https://github.com/GNOME/gimp.git
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:
parent
5357d42ab3
commit
435f6e3974
15
ChangeLog
15
ChangeLog
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
x = mevent->x;
|
||||
y = mevent->y;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -700,8 +693,8 @@ gimp_color_select_xy_events (GtkWidget *widget,
|
|||
|
||||
gimp_color_select_update (select, UPDATE_VALUES | UPDATE_CALLER);
|
||||
|
||||
if (event->type == GDK_MOTION_NOTIFY)
|
||||
gdk_event_request_motions ((GdkEventMotion *) event);
|
||||
/* 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1694,25 +1694,18 @@ static gint
|
|||
design_area_motion (GtkWidget *widget,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
gint i;
|
||||
gint i;
|
||||
gdouble xo;
|
||||
gdouble yo;
|
||||
gdouble xn;
|
||||
gdouble yn;
|
||||
gint px, py;
|
||||
gdouble width = ifsDesign->area->allocation.width;
|
||||
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,36 +1715,32 @@ 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,
|
||||
sqrt((SQR(xn)+SQR(yn))/(SQR(xo)+SQR(yo))),
|
||||
0);
|
||||
aff2_compose (&t3, &t2, &t1);
|
||||
aff2_rotate (&t1, - atan2(yn, xn) + atan2(yo, xo));
|
||||
aff2_compose (&t2, &t1, &t3);
|
||||
aff2_translate (&t3, ifsDesign->op_xcenter*width,
|
||||
ifsDesign->op_ycenter*width);
|
||||
aff2_compose (&trans, &t3, &t2);
|
||||
break;
|
||||
}
|
||||
aff2_translate (&t1,-ifsDesign->op_xcenter*width,
|
||||
-ifsDesign->op_ycenter*width);
|
||||
aff2_scale (&t2,
|
||||
sqrt((SQR(xn)+SQR(yn))/(SQR(xo)+SQR(yo))),
|
||||
0);
|
||||
aff2_compose (&t3, &t2, &t1);
|
||||
aff2_rotate (&t1, - atan2(yn, xn) + atan2(yo, xo));
|
||||
aff2_compose (&t2, &t1, &t3);
|
||||
aff2_translate (&t3, ifsDesign->op_xcenter*width,
|
||||
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);
|
||||
aff2_compose (&t3, &t2, &t1);
|
||||
aff2_translate (&t1, ifsDesign->op_xcenter*width,
|
||||
ifsDesign->op_ycenter*width);
|
||||
aff2_compose (&trans, &t1, &t3);
|
||||
break;
|
||||
}
|
||||
aff2_translate (&t1,-ifsDesign->op_xcenter*width,
|
||||
-ifsDesign->op_ycenter*width);
|
||||
aff2_compute_stretch (&t2, xo, yo, xn, yn);
|
||||
aff2_compose (&t3, &t2, &t1);
|
||||
aff2_translate (&t1, ifsDesign->op_xcenter*width,
|
||||
ifsDesign->op_ycenter*width);
|
||||
aff2_compose (&trans, &t1, &t3);
|
||||
break;
|
||||
|
||||
case OP_TRANSLATE:
|
||||
{
|
||||
aff2_translate (&trans,(xn-xo)*width,(yn-yo)*width);
|
||||
break;
|
||||
}
|
||||
aff2_translate (&trans,(xn-xo)*width,(yn-yo)*width);
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < ifsvals.num_elements; i++)
|
||||
|
@ -1775,16 +1764,20 @@ 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);
|
||||
aff_element_compute_trans (elements[i],width, height,
|
||||
ifsvals.center_x, ifsvals.center_y);
|
||||
ifsvals.center_x, ifsvals.center_y);
|
||||
}
|
||||
|
||||
update_values ();
|
||||
design_area_redraw ();
|
||||
|
||||
/* Ask for more motion events in case the event was a hint */
|
||||
gdk_event_request_motions (event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue