if (imd->func_button)
{
- imd->func_button(imd, event->button, event->time,
- event->x, event->y, event->state, imd->data_button);
+ imd->func_button(imd, event, imd->data_button);
}
}
if (imd->func_drag)
{
- imd->func_drag(imd, event->button, event->time,
- event->x, event->y, event->state,
- (gfloat)(pr->drag_last_x - event->x) / width, (gfloat)(pr->drag_last_y - event->y) / height,
- imd->data_button);
+ imd->func_drag(imd, event,
+ (gfloat)(pr->drag_last_x - event->x) / width,
+ (gfloat)(pr->drag_last_y - event->y) / height,
+ imd->data_button);
}
}
if (imd->func_scroll &&
event && event->type == GDK_SCROLL)
{
- imd->func_scroll(imd, event->direction, event->time,
- event->x, event->y, event->state, imd->data_scroll);
+ imd->func_scroll(imd, event, imd->data_scroll);
return TRUE;
}
void image_set_button_func(ImageWindow *imd,
- void (*func)(ImageWindow *, gint button, guint32 time, gdouble x, gdouble y, guint state, gpointer),
+ void (*func)(ImageWindow *, GdkEventButton *event, gpointer),
gpointer data)
{
imd->func_button = func;
}
void image_set_drag_func(ImageWindow *imd,
- void (*func)(ImageWindow *, gint button, guint32 time, gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer),
+ void (*func)(ImageWindow *, GdkEventButton *event, gdouble dx, gdouble dy, gpointer),
gpointer data)
{
imd->func_drag = func;
}
void image_set_scroll_func(ImageWindow *imd,
- void (*func)(ImageWindow *, GdkScrollDirection direction, guint32 time, gdouble x, gdouble y, guint state, gpointer),
+ void (*func)(ImageWindow *, GdkEventScroll *event, gpointer),
gpointer data)
{
imd->func_scroll = func;
void (*func)(ImageWindow *imd, gpointer data),
gpointer data);
void image_set_button_func(ImageWindow *imd,
- void (*func)(ImageWindow *, gint button, guint32 time, gdouble x, gdouble y, guint state, gpointer),
+ void (*func)(ImageWindow *, GdkEventButton *event, gpointer),
gpointer data);
void image_set_drag_func(ImageWindow *imd,
- void (*func)(ImageWindow *, gint button, guint32 time, gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer),
+ void (*func)(ImageWindow *, GdkEventButton *event, gdouble dx, gdouble dy, gpointer),
gpointer data);
void image_set_scroll_func(ImageWindow *imd,
- void (*func)(ImageWindow *, GdkScrollDirection direction, guint32 time, gdouble x, gdouble y, guint state, gpointer),
+ void (*func)(ImageWindow *, GdkEventScroll *event, gpointer),
gpointer data);
void image_set_scroll_notify_func(ImageWindow *imd,
void (*func)(ImageWindow *imd, gint x, gint y, gint width, gint height, gpointer data),
* view window main routines
*-----------------------------------------------------------------------------
*/
-
-static void button_cb(ImageWindow *imd, gint button, guint32 time,
- gdouble x, gdouble y, guint state, gpointer data)
+static void button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data)
{
ViewWindow *vw = data;
GtkWidget *menu;
- switch (button)
+ switch (event->button)
{
case MOUSE_BUTTON_LEFT:
view_step_next(vw);
break;
case MOUSE_BUTTON_RIGHT:
menu = view_popup_menu(vw);
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time);
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
break;
default:
break;
}
}
-static void scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time,
- gdouble x, gdouble y, guint state, gpointer data)
+static void scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpointer data)
{
ViewWindow *vw = data;
- if (state & GDK_CONTROL_MASK)
+ if (event->state & GDK_CONTROL_MASK)
{
- switch (direction)
+ switch (event->direction)
{
case GDK_SCROLL_UP:
- image_zoom_adjust_at_point(imd, get_zoom_increment(), x, y);
+ image_zoom_adjust_at_point(imd, get_zoom_increment(), event->x, event->y);
break;
case GDK_SCROLL_DOWN:
- image_zoom_adjust_at_point(imd, -get_zoom_increment(), x, y);
+ image_zoom_adjust_at_point(imd, -get_zoom_increment(), event->x, event->y);
break;
default:
break;
}
}
- else if ( (state & GDK_SHIFT_MASK) != (guint) (options->mousewheel_scrolls))
+ else if ( (event->state & GDK_SHIFT_MASK) != (guint) (options->mousewheel_scrolls))
{
- switch (direction)
+ switch (event->direction)
{
case GDK_SCROLL_UP:
image_scroll(imd, 0, -MOUSEWHEEL_SCROLL_SIZE);
}
else
{
- switch (direction)
+ switch (event->direction)
{
case GDK_SCROLL_UP:
view_step_prev(vw);
gtk_widget_set_sensitive(id->button_back, TRUE);
}
-static void info_window_image_button_cb(ImageWindow *imd, gint button, guint32 time,
- gdouble x, gdouble y, guint state, gpointer data)
+static void info_window_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data)
{
- if (button == MOUSE_BUTTON_LEFT)
+ if (event->button == MOUSE_BUTTON_LEFT)
{
info_window_next_cb(NULL, data);
}
- else if (button == MOUSE_BUTTON_MIDDLE || button == MOUSE_BUTTON_RIGHT)
+ else if (event->button == MOUSE_BUTTON_MIDDLE || event->button == MOUSE_BUTTON_RIGHT)
{
info_window_back_cb(NULL, data);
}
}
-static void info_window_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time,
- gdouble x, gdouble y, guint state, gpointer data)
+static void info_window_image_scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpointer data)
{
- if (direction == GDK_SCROLL_UP)
+ if (event->direction == GDK_SCROLL_UP)
{
info_window_back_cb(NULL, data);
}
- else if (direction == GDK_SCROLL_DOWN)
+ else if (event->direction == GDK_SCROLL_DOWN)
{
info_window_next_cb(NULL, data);
}
}
-static void layout_image_button_cb(ImageWindow *imd, gint button, guint32 time,
- gdouble x, gdouble y, guint state, gpointer data)
+static void layout_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data)
{
LayoutWindow *lw = data;
GtkWidget *menu;
- switch (button)
+ switch (event->button)
{
case MOUSE_BUTTON_LEFT:
layout_image_next(lw);
{
g_object_set_data(G_OBJECT(menu), "click_parent", imd->widget);
}
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time);
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
break;
default:
break;
}
}
-static void layout_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time,
- gdouble x, gdouble y, guint state, gpointer data)
+static void layout_image_scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpointer data)
{
LayoutWindow *lw = data;
}
- if (state & GDK_CONTROL_MASK)
+ if (event->state & GDK_CONTROL_MASK)
{
- switch (direction)
+ switch (event->direction)
{
case GDK_SCROLL_UP:
- layout_image_zoom_adjust_at_point(lw, get_zoom_increment(), x, y);
+ layout_image_zoom_adjust_at_point(lw, get_zoom_increment(), event->x, event->y);
break;
case GDK_SCROLL_DOWN:
- layout_image_zoom_adjust_at_point(lw, -get_zoom_increment(), x, y);
+ layout_image_zoom_adjust_at_point(lw, -get_zoom_increment(), event->x, event->y);
break;
default:
break;
}
}
- else if ( (state & GDK_SHIFT_MASK) != (guint) (options->mousewheel_scrolls))
+ else if ( (event->state & GDK_SHIFT_MASK) != (guint) (options->mousewheel_scrolls))
{
- switch (direction)
+ switch (event->direction)
{
case GDK_SCROLL_UP:
image_scroll(imd, 0, -MOUSEWHEEL_SCROLL_SIZE);
}
else
{
- switch (direction)
+ switch (event->direction)
{
case GDK_SCROLL_UP:
layout_image_prev(lw);
}
}
-static void layout_image_drag_cb(ImageWindow *imd, gint button, guint32 time,
- gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer data)
+static void layout_image_drag_cb(ImageWindow *imd, GdkEventButton *event, gdouble dx, gdouble dy, gpointer data)
{
gint i;
LayoutWindow *lw = data;
-
- for (i=0; i < MAX_SPLIT_IMAGES; i++)
+ for (i = 0; i < MAX_SPLIT_IMAGES; i++)
{
- if (lw->split_images[i] && lw->split_images[i] != imd)
- if (lw->connect_scroll)
+ if (lw->split_images[i] && lw->split_images[i] != imd && lw->connect_scroll)
+ {
+ gdouble sx, sy;
+
+ if (event->state & GDK_CONTROL_MASK)
{
- gdouble sx, sy;
- if (state & GDK_CONTROL_MASK)
- {
- image_get_scroll_center(imd, &sx, &sy);
- }
- else
- {
- image_get_scroll_center(lw->split_images[i], &sx, &sy);
- sx += dx;
- sy += dy;
- }
- image_set_scroll_center(lw->split_images[i], sx, sy);
+ image_get_scroll_center(imd, &sx, &sy);
+ }
+ else
+ {
+ image_get_scroll_center(lw->split_images[i], &sx, &sy);
+ sx += dx;
+ sy += dy;
}
+ image_set_scroll_center(lw->split_images[i], sx, sy);
+ }
}
}
-static void layout_image_button_inactive_cb(ImageWindow *imd, gint button, guint32 time,
- gdouble x, gdouble y, guint state, gpointer data)
+static void layout_image_button_inactive_cb(ImageWindow *imd, GdkEventButton *event, gpointer data)
{
LayoutWindow *lw = data;
GtkWidget *menu;
layout_image_activate(lw, i);
}
- switch (button)
+ switch (event->button)
{
case MOUSE_BUTTON_RIGHT:
menu = layout_image_pop_menu(lw);
{
g_object_set_data(G_OBJECT(menu), "click_parent", imd->widget);
}
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time);
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
break;
default:
break;
}
-static void layout_image_drag_inactive_cb(ImageWindow *imd, gint button, guint32 time,
- gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer data)
+static void layout_image_drag_inactive_cb(ImageWindow *imd, GdkEventButton *event, gdouble dx, gdouble dy, gpointer data)
{
LayoutWindow *lw = data;
-
gint i = image_idx(lw, imd);
if (i != -1)
layout_image_activate(lw, i);
}
-
/* continue as with active image */
- layout_image_drag_cb(imd, button, time, x, y, state, dx, dy, data);
+ layout_image_drag_cb(imd, event, dx, dy, data);
}
gpointer data_tile;
/* button, scroll functions */
- void (*func_button)(ImageWindow *, gint button,
- guint32 time, gdouble x, gdouble y, guint state, gpointer);
- void (*func_drag)(ImageWindow *, gint button,
- guint32 time, gdouble x, gdouble y, guint state, gdouble dx, gdouble dy,gpointer);
- void (*func_scroll)(ImageWindow *, GdkScrollDirection direction,
- guint32 time, gdouble x, gdouble y, guint state, gpointer);
+ void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer);
+ void (*func_drag)(ImageWindow *, GdkEventButton *event, gdouble dx, gdouble dy, gpointer);
+ void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer);
gpointer data_button;
gpointer data_drag;