gimp r26853 - in trunk: . plug-ins/color-rotate plug-ins/common
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26853 - in trunk: . plug-ins/color-rotate plug-ins/common
- Date: Thu, 4 Sep 2008 08:52:43 +0000 (UTC)
Author: mitch
Date: Thu Sep 4 08:52:42 2008
New Revision: 26853
URL: http://svn.gnome.org/viewvc/gimp?rev=26853&view=rev
Log:
2008-09-04 Michael Natterer <mitch gimp org>
* plug-ins/color-rotate/color-rotate-callbacks.c
* plug-ins/common/filter-pack.c
* plug-ins/common/nova.c
* plug-ins/common/sample-colorize.c: get rid of calls to
gdk_window_get_pointer(), use the coords from the motion event
and use gdk_event_request_motions().
* plug-ins/color-rotate/color-rotate-callbacks.[ch]: some
unrelated cleanup while i was at it.
Modified:
trunk/ChangeLog
trunk/plug-ins/color-rotate/color-rotate-callbacks.c
trunk/plug-ins/color-rotate/color-rotate-callbacks.h
trunk/plug-ins/common/filter-pack.c
trunk/plug-ins/common/nova.c
trunk/plug-ins/common/sample-colorize.c
Modified: trunk/plug-ins/color-rotate/color-rotate-callbacks.c
==============================================================================
--- trunk/plug-ins/color-rotate/color-rotate-callbacks.c (original)
+++ trunk/plug-ins/color-rotate/color-rotate-callbacks.c Thu Sep 4 08:52:42 2008
@@ -65,7 +65,7 @@
}
}
-gchar *
+const gchar *
rcm_units_string (gint units)
{
switch (units)
@@ -348,9 +348,9 @@
/* Circle events */
gboolean
-rcm_expose_event (GtkWidget *widget,
- GdkEvent *event,
- RcmCircle *circle)
+rcm_expose_event (GtkWidget *widget,
+ GdkEventExpose *event,
+ RcmCircle *circle)
{
if (circle->action_flag == VIRGIN)
{
@@ -365,25 +365,23 @@
}
gboolean
-rcm_button_press_event (GtkWidget *widget,
- GdkEvent *event,
- RcmCircle *circle)
-{
- float clicked_angle;
- float *alpha;
- float *beta;
- GdkEventButton *bevent;
+rcm_button_press_event (GtkWidget *widget,
+ GdkEventButton *event,
+ RcmCircle *circle)
+{
+ float clicked_angle;
+ float *alpha;
+ float *beta;
alpha = &circle->angle->alpha;
beta = &circle->angle->beta;
- bevent = (GdkEventButton *) event;
circle->action_flag = DRAG_START;
- clicked_angle = angle_mod_2PI (arctg (CENTER-bevent->y, bevent->x-CENTER));
+ clicked_angle = angle_mod_2PI (arctg (CENTER - event->y, event->x - CENTER));
circle->prev_clicked = clicked_angle;
- if ((sqrt (SQR (bevent->y-CENTER) +
- SQR (bevent->x-CENTER)) > RADIUS * EACH_OR_BOTH) &&
+ if ((sqrt (SQR (event->y - CENTER) +
+ SQR (event->x - CENTER)) > RADIUS * EACH_OR_BOTH) &&
(min_prox (*alpha, *beta, clicked_angle) < G_PI / 12))
{
circle->mode = EACH;
@@ -418,9 +416,9 @@
}
gboolean
-rcm_release_event (GtkWidget *widget,
- GdkEvent *event,
- RcmCircle *circle)
+rcm_release_event (GtkWidget *widget,
+ GdkEventButton *event,
+ RcmCircle *circle)
{
if (circle->action_flag == DRAGING)
{
@@ -440,11 +438,10 @@
}
gboolean
-rcm_motion_notify_event (GtkWidget *widget,
- GdkEvent *event,
- RcmCircle *circle)
+rcm_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event,
+ RcmCircle *circle)
{
- gint x, y;
gfloat clicked_angle, delta;
gfloat *alpha, *beta;
gint cw_ccw;
@@ -460,8 +457,7 @@
&values,
GDK_GC_FUNCTION);
- gdk_window_get_pointer (widget->window, &x, &y, NULL);
- clicked_angle = angle_mod_2PI (arctg (CENTER-y, x-CENTER));
+ clicked_angle = angle_mod_2PI (arctg (CENTER - event->y, event->x - CENTER));
delta = clicked_angle - circle->prev_clicked;
circle->prev_clicked = clicked_angle;
@@ -502,7 +498,9 @@
if (Current.RealTime)
rcm_render_preview (Current.Bna->after);
- }
+ }
+
+ gdk_event_request_motions (event);
return TRUE;
}
@@ -511,9 +509,9 @@
/* Gray circle events */
gboolean
-rcm_gray_expose_event (GtkWidget *widget,
- GdkEvent *event,
- RcmGray *circle)
+rcm_gray_expose_event (GtkWidget *widget,
+ GdkEventExpose *event,
+ RcmGray *circle)
{
if (circle->action_flag == VIRGIN)
{
@@ -532,17 +530,15 @@
}
gboolean
-rcm_gray_button_press_event (GtkWidget *widget,
- GdkEvent *event,
- RcmGray *circle)
-{
- GtkStyle *style = gtk_widget_get_style (widget);
- GdkEventButton *bevent;
- int x, y;
-
- bevent = (GdkEventButton *) event;
- x = bevent->x - GRAY_CENTER - LITTLE_RADIUS;
- y = GRAY_CENTER - bevent->y + LITTLE_RADIUS;
+rcm_gray_button_press_event (GtkWidget *widget,
+ GdkEventButton *event,
+ RcmGray *circle)
+{
+ GtkStyle *style = gtk_widget_get_style (widget);
+ int x, y;
+
+ x = event->x - GRAY_CENTER - LITTLE_RADIUS;
+ y = GRAY_CENTER - event->y + LITTLE_RADIUS;
circle->action_flag = DRAG_START;
circle->hue = angle_mod_2PI(arctg(y, x));
@@ -573,9 +569,9 @@
}
gboolean
-rcm_gray_release_event (GtkWidget *widget,
- GdkEvent *event,
- RcmGray *circle)
+rcm_gray_release_event (GtkWidget *widget,
+ GdkEventButton *event,
+ RcmGray *circle)
{
if (circle->action_flag == DRAGING)
{
@@ -595,9 +591,9 @@
}
gboolean
-rcm_gray_motion_notify_event (GtkWidget *widget,
- GdkEvent *event,
- RcmGray *circle)
+rcm_gray_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event,
+ RcmGray *circle)
{
gint x, y;
GdkGCValues values;
@@ -624,10 +620,8 @@
circle->hue, circle->satur); /* erase */
}
- gdk_window_get_pointer (widget->window, &x, &y, NULL);
-
- x = x - GRAY_CENTER - LITTLE_RADIUS;
- y = GRAY_CENTER - y + LITTLE_RADIUS;
+ x = event->x - GRAY_CENTER - LITTLE_RADIUS;
+ y = GRAY_CENTER - event->y + LITTLE_RADIUS;
circle->hue = angle_mod_2PI (arctg (y, x));
circle->satur = sqrt (SQR (x) + SQR (y)) / GRAY_RADIUS;
@@ -647,6 +641,8 @@
if (Current.RealTime)
rcm_render_preview (Current.Bna->after);
+ gdk_event_request_motions (event);
+
return TRUE;
}
@@ -655,10 +651,9 @@
void
rcm_set_alpha (GtkWidget *entry,
- gpointer data)
+ RcmCircle *circle)
{
- RcmCircle *circle = data;
- GtkStyle *style = gtk_widget_get_style (circle->preview);
+ GtkStyle *style = gtk_widget_get_style (circle->preview);
if (circle->action_flag != VIRGIN)
return;
@@ -677,10 +672,9 @@
void
rcm_set_beta (GtkWidget *entry,
- gpointer data)
+ RcmCircle *circle)
{
- RcmCircle *circle = data;
- GtkStyle *style = gtk_widget_get_style (circle->preview);
+ GtkStyle *style = gtk_widget_get_style (circle->preview);
if (circle->action_flag != VIRGIN)
return;
@@ -699,10 +693,9 @@
void
rcm_set_hue (GtkWidget *entry,
- gpointer data)
+ RcmGray *circle)
{
- RcmGray *circle = data;
- GtkStyle *style = gtk_widget_get_style (circle->preview);
+ GtkStyle *style = gtk_widget_get_style (circle->preview);
if (circle->action_flag != VIRGIN)
return;
@@ -725,10 +718,9 @@
void
rcm_set_satur (GtkWidget *entry,
- gpointer data)
+ RcmGray *circle)
{
- RcmGray *circle = data;
- GtkStyle *style = gtk_widget_get_style (circle->preview);
+ GtkStyle *style = gtk_widget_get_style (circle->preview);
if (circle->action_flag != VIRGIN)
return;
@@ -750,10 +742,9 @@
void
rcm_set_gray_sat (GtkWidget *entry,
- gpointer data)
+ RcmGray *circle)
{
- RcmGray *circle = data;
- GtkStyle *style = gtk_widget_get_style (circle->preview);
+ GtkStyle *style = gtk_widget_get_style (circle->preview);
circle->gray_sat = gtk_spin_button_get_value (GTK_SPIN_BUTTON (entry));
Modified: trunk/plug-ins/color-rotate/color-rotate-callbacks.h
==============================================================================
--- trunk/plug-ins/color-rotate/color-rotate-callbacks.h (original)
+++ trunk/plug-ins/color-rotate/color-rotate-callbacks.h Thu Sep 4 08:52:42 2008
@@ -39,20 +39,14 @@
/* Misc functions */
-float rcm_units_factor (gint units);
+float rcm_units_factor (gint units);
-gchar *rcm_units_string (gint units);
+const gchar * rcm_units_string (gint units);
-void rcm_set_pixmap (GtkWidget **widget,
- GtkWidget *parent,
- GtkWidget *label_box,
- gchar **pixmap_data);
-
-
-/* Ok Button */
-
-void rcm_ok_callback (GtkWidget *widget,
- gpointer data);
+void rcm_set_pixmap (GtkWidget **widget,
+ GtkWidget *parent,
+ GtkWidget *label_box,
+ gchar **pixmap_data);
/* Circle buttons */
@@ -94,45 +88,46 @@
/* Circle events */
-gboolean rcm_expose_event (GtkWidget *widget,
- GdkEvent *event,
- RcmCircle *circle);
-gboolean rcm_button_press_event (GtkWidget *widget,
- GdkEvent *event,
- RcmCircle *circle);
-gboolean rcm_release_event (GtkWidget *widget,
- GdkEvent *event,
- RcmCircle *circle);
-gboolean rcm_motion_notify_event (GtkWidget *widget,
- GdkEvent *event,
- RcmCircle *circle);
+gboolean rcm_expose_event (GtkWidget *widget,
+ GdkEventExpose *event,
+ RcmCircle *circle);
+gboolean rcm_button_press_event (GtkWidget *widget,
+ GdkEventButton *event,
+ RcmCircle *circle);
+gboolean rcm_release_event (GtkWidget *widget,
+ GdkEventButton *event,
+ RcmCircle *circle);
+gboolean rcm_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event,
+ RcmCircle *circle);
/* Gray circle events */
-gboolean rcm_gray_expose_event (GtkWidget *widget,
- GdkEvent *event,
- RcmGray *circle);
-gboolean rcm_gray_button_press_event (GtkWidget *widget,
- GdkEvent *event,
- RcmGray *circle);
-gboolean rcm_gray_release_event (GtkWidget *widget,
- GdkEvent *event,
- RcmGray *circle);
-gboolean rcm_gray_motion_notify_event (GtkWidget *widget,
- GdkEvent *event,
- RcmGray *circle);
+gboolean rcm_gray_expose_event (GtkWidget *widget,
+ GdkEventExpose *event,
+ RcmGray *circle);
+gboolean rcm_gray_button_press_event (GtkWidget *widget,
+ GdkEventButton *event,
+ RcmGray *circle);
+gboolean rcm_gray_release_event (GtkWidget *widget,
+ GdkEventButton *event,
+ RcmGray *circle);
+gboolean rcm_gray_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event,
+ RcmGray *circle);
/* Spinbuttons */
void rcm_set_alpha (GtkWidget *entry,
- gpointer data);
+ RcmCircle *circle);
void rcm_set_beta (GtkWidget *entry,
- gpointer data);
+ RcmCircle *circle);
+
void rcm_set_hue (GtkWidget *entry,
- gpointer data);
+ RcmGray *circle);
void rcm_set_satur (GtkWidget *entry,
- gpointer data);
+ RcmGray *circle);
void rcm_set_gray_sat (GtkWidget *entry,
- gpointer data);
+ RcmGray *circle);
Modified: trunk/plug-ins/common/filter-pack.c
==============================================================================
--- trunk/plug-ins/common/filter-pack.c (original)
+++ trunk/plug-ins/common/filter-pack.c Thu Sep 4 08:52:42 2008
@@ -1545,7 +1545,7 @@
case GDK_MOTION_NOTIFY:
mevent = (GdkEventMotion *) event;
- gdk_window_get_pointer (widget->window, &x, NULL, NULL);
+ x = mevent->x;
if (x >= 0 && x < 256)
{
@@ -1556,6 +1556,8 @@
update_range_labels ();
fp_create_smoothness_graph (AW.aliasing_preview);
}
+
+ gdk_event_request_motions (mevent);
break;
default:
Modified: trunk/plug-ins/common/nova.c
==============================================================================
--- trunk/plug-ins/common/nova.c (original)
+++ trunk/plug-ins/common/nova.c Thu Sep 4 08:52:42 2008
@@ -661,12 +661,12 @@
if (mevent->state & GDK_BUTTON1_MASK)
{
- GdkModifierType mask;
- gint x, y;
+ gboolean retval = nova_center_update (widget, center,
+ mevent->x, mevent->y);
- gdk_window_get_pointer (widget->window, &x, &y, &mask);
+ gdk_event_request_motions (mevent);
- return nova_center_update (widget, center, x, y);
+ return retval;
}
}
break;
Modified: trunk/plug-ins/common/sample-colorize.c
==============================================================================
--- trunk/plug-ins/common/sample-colorize.c (original)
+++ trunk/plug-ins/common/sample-colorize.c Thu Sep 4 08:52:42 2008
@@ -1133,7 +1133,8 @@
if (g_Sdebug)
printf ("EVENT: GDK_MOTION_NOTIFY\n");
mevent = (GdkEventMotion *) event;
- gdk_window_get_pointer (widget->window, &x, NULL, NULL);
+ x = mevent->x;
+ gdk_event_request_motions (mevent);
update = TRUE;
break;
@@ -1240,7 +1241,8 @@
if (g_Sdebug)
printf ("OUT_EVENT: GDK_MOTION_NOTIFY\n");
mevent = (GdkEventMotion *) event;
- gdk_window_get_pointer (widget->window, &x, NULL, NULL);
+ x = mevent->x;
+ gdk_event_request_motions (mevent);
update = TRUE;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]