switch (bevent->button)
{
- case 1:
+ case MOUSE_BUTTON_LEFT:
if (bevent->type == GDK_2BUTTON_PRESS)
{
if (info)
gtk_widget_grab_focus(ct->listview);
}
break;
- case 3:
+ case MOUSE_BUTTON_RIGHT:
ct->popup = collection_table_popup_menu(ct, (info != NULL));
gtk_menu_popup(GTK_MENU(ct->popup), NULL, NULL, NULL, NULL, bevent->button, bevent->time);
break;
collection_table_selection_remove(ct, ct->click_info, SELECTION_PRELIGHT, NULL);
}
- if (bevent->button == 1 &&
+ if (bevent->button == MOUSE_BUTTON_LEFT &&
info && ct->click_info == info)
{
collection_table_set_focus(ct, info);
}
}
}
- else if (bevent->button == 2 &&
+ else if (bevent->button == MOUSE_BUTTON_MIDDLE &&
info && ct->click_info == info)
{
collection_table_select_util(ct, info, !INFO_SELECTED(info));
dw->click_item = di;
- if (bevent->button == 3)
+ if (bevent->button == MOUSE_BUTTON_RIGHT)
{
/* right click menu */
GtkWidget *menu;
if (!di) return FALSE;
- if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
+ if (bevent->button == MOUSE_BUTTON_LEFT &&
+ bevent->type == GDK_2BUTTON_PRESS)
{
dupe_menu_view(dw, di, widget, FALSE);
}
- if (bevent->button == 2) return TRUE;
+ if (bevent->button == MOUSE_BUTTON_MIDDLE) return TRUE;
- if (bevent->button == 3)
+ if (bevent->button == MOUSE_BUTTON_RIGHT)
{
if (!dupe_listview_item_is_selected(dw, di, widget))
{
return TRUE;
}
- if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS &&
+ if (bevent->button == MOUSE_BUTTON_LEFT &&
+ bevent->type == GDK_BUTTON_PRESS &&
!(bevent->state & GDK_SHIFT_MASK ) &&
!(bevent->state & GDK_CONTROL_MASK ) &&
dupe_listview_item_is_selected(dw, di, widget))
GtkTreeIter iter;
DupeItem *di = NULL;
- if (bevent->button != 1 && bevent->button != 2) return TRUE;
+ if (bevent->button != MOUSE_BUTTON_LEFT && bevent->button != MOUSE_BUTTON_MIDDLE) return TRUE;
store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
gtk_tree_path_free(tpath);
}
- if (bevent->button == 2)
+ if (bevent->button == MOUSE_BUTTON_MIDDLE)
{
if (di && dw->click_item == di)
{
switch (button)
{
- case 1:
+ case MOUSE_BUTTON_LEFT:
view_step_next(vw);
break;
- case 2:
+ case MOUSE_BUTTON_MIDDLE:
view_step_prev(vw);
break;
- case 3:
+ case MOUSE_BUTTON_RIGHT:
menu = view_popup_menu(vw);
gtk_menu_popup (GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time);
break;
static void info_window_image_button_cb(ImageWindow *imd, gint button, guint32 time,
gdouble x, gdouble y, guint state, gpointer data)
{
- if (button == 1)
+ if (button == MOUSE_BUTTON_LEFT)
{
info_window_next_cb(NULL, data);
}
- else if (button == 2 || button == 3)
+ else if (button == MOUSE_BUTTON_MIDDLE || button == MOUSE_BUTTON_RIGHT)
{
info_window_back_cb(NULL, data);
}
switch (button)
{
- case 1:
+ case MOUSE_BUTTON_LEFT:
layout_image_next(lw);
break;
- case 2:
+ case MOUSE_BUTTON_MIDDLE:
layout_image_prev(lw);
break;
- case 3:
+ case MOUSE_BUTTON_RIGHT:
menu = layout_image_pop_menu(lw);
if (imd == lw->image)
{
switch (button)
{
- case 3:
+ case MOUSE_BUTTON_RIGHT:
menu = layout_image_pop_menu(lw);
if (imd == lw->image)
{
}
pi = pan_item_find_by_coord(pw, PAN_ITEM_BOX, rx, ry, "info");
- if (pi && event->button == 1)
+ if (pi && event->button == MOUSE_BUTTON_LEFT)
{
pan_info_update(pw, NULL);
return;
switch (event->button)
{
- case 1:
+ case MOUSE_BUTTON_LEFT:
pan_info_update(pw, pi);
if (!pi && pw->layout == PAN_LAYOUT_CALENDAR)
pan_calendar_update(pw, pi);
}
break;
- case 2:
+ case MOUSE_BUTTON_MIDDLE:
break;
- case 3:
+ case MOUSE_BUTTON_RIGHT:
pan_info_update(pw, pi);
menu = pan_popup_menu(pw);
gtk_menu_popup (GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
switch (bevent->button)
{
- case 1:
+ case MOUSE_BUTTON_LEFT:
pr->in_drag = TRUE;
pr->drag_last_x = bevent->x;
pr->drag_last_y = bevent->y;
NULL, NULL, bevent->time);
gtk_grab_add(widget);
break;
- case 2:
+ case MOUSE_BUTTON_MIDDLE:
pr->drag_moved = 0;
break;
- case 3:
+ case MOUSE_BUTTON_RIGHT:
pr_clicked_signal(pr, bevent);
break;
default:
if (pr->drag_moved < PR_DRAG_SCROLL_THRESHHOLD)
{
- if (bevent->button == 1 && (bevent->state & GDK_SHIFT_MASK))
+ if (bevent->button == MOUSE_BUTTON_LEFT && (bevent->state & GDK_SHIFT_MASK))
{
pr_scroller_start(pr, bevent->x, bevent->y);
}
- else if (bevent->button == 1 || bevent->button == 2)
+ else if (bevent->button == MOUSE_BUTTON_LEFT || bevent->button == MOUSE_BUTTON_MIDDLE)
{
pr_clicked_signal(pr, bevent);
}
sd->click_fd = mfd ? mfd->fd : NULL;
- if (bevent->button == 3)
+ if (bevent->button == MOUSE_BUTTON_RIGHT)
{
GtkWidget *menu;
if (!mfd) return FALSE;
- if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
+ if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_2BUTTON_PRESS)
{
layout_image_set_fd(NULL, mfd->fd);
}
- if (bevent->button == 2) return TRUE;
+ if (bevent->button == MOUSE_BUTTON_MIDDLE) return TRUE;
- if (bevent->button == 3)
+ if (bevent->button == MOUSE_BUTTON_RIGHT)
{
if (!search_result_row_selected(sd, mfd->fd))
{
return TRUE;
}
- if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS &&
+ if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_BUTTON_PRESS &&
!(bevent->state & GDK_SHIFT_MASK ) &&
!(bevent->state & GDK_CONTROL_MASK ) &&
search_result_row_selected(sd, mfd->fd))
MatchFileData *mfd = NULL;
- if (bevent->button != 1 && bevent->button != 2) return TRUE;
+ if (bevent->button != MOUSE_BUTTON_LEFT && bevent->button != MOUSE_BUTTON_MIDDLE) return TRUE;
store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
gtk_tree_path_free(tpath);
}
- if (bevent->button == 2)
+ if (bevent->button == MOUSE_BUTTON_MIDDLE)
{
if (mfd && sd->click_fd == mfd->fd)
{
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
+typedef enum {
+ MOUSE_BUTTON_LEFT = 1,
+ MOUSE_BUTTON_MIDDLE = 2,
+ MOUSE_BUTTON_RIGHT = 3,
+ MOUSE_BUTTON_WHEEL_UP = 4,
+ MOUSE_BUTTON_WHEEL_DOWN = 5
+} MouseButton;
+
typedef enum {
DIRVIEW_LIST,
DIRVIEW_TREE
{
BookMarkData *bm = data;
- if (event->button != 3) return FALSE;
+ if (event->button != MOUSE_BUTTON_RIGHT) return FALSE;
bookmark_menu_popup(bm, button, event->button, event->time, FALSE);
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include "main.h"
#include "ui_misc.h"
#include "ui_bookmark.h"
{
SizerData *sd = data;
- if (bevent->button != 1) return FALSE;
+ if (bevent->button != MOUSE_BUTTON_LEFT) return FALSE;
sd->in_drag = TRUE;
sd->press_x = bevent->x_root;
{
SizerData *sd = data;
- if (bevent->button != 1) return FALSE;
+ if (bevent->button != MOUSE_BUTTON_LEFT) return FALSE;
if (gdk_pointer_is_grabbed() && GTK_WIDGET_HAS_GRAB(sd->sizer))
{
GtkTreeIter iter;
GtkTreeSelection *selection;
- if (event->button != 3 ||
+ if (event->button != MOUSE_BUTTON_RIGHT ||
!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(view), event->x, event->y,
&tpath, &column, &cell_x, &cell_y))
{
static void file_util_delete_multiple_review_button_cb(ImageWindow *imd, gint button, guint32 time,
gdouble x, gdouble y, guint state, gpointer data)
{
- if (button == 1)
+ if (button == MOUSE_BUTTON_LEFT)
{
file_util_delete_multiple_review_next(NULL, data);
}
- else if (button == 2 || button == 3)
+ else if (button == MOUSE_BUTTON_MIDDLE || button == MOUSE_BUTTON_RIGHT)
{
file_util_delete_multiple_review_back(NULL, data);
}
if (!vd->click_fd) return FALSE;
vd_color_set(vd, vd->click_fd, FALSE);
- if (bevent->button != 1) return TRUE;
+ if (bevent->button != MOUSE_BUTTON_LEFT) return TRUE;
if ((bevent->x != 0 || bevent->y != 0) &&
gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y,
vd->click_fd = fd;
vd_color_set(vd, vd->click_fd, TRUE);
- if (bevent->button == 3)
+ if (bevent->button == MOUSE_BUTTON_RIGHT)
{
vd->popup = vd_pop_menu(vd, vd->click_fd);
gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL,
/* clicking this region should automatically reveal an expander, if necessary
* treeview bug: the expander will not expand until a button_motion_event highlights it.
*/
- if (bevent->button == 1 &&
+ if (bevent->button == MOUSE_BUTTON_LEFT &&
!left_of_expander &&
!gtk_tree_view_row_expanded(GTK_TREE_VIEW(vd->view), tpath))
{
vd->click_fd = (nd) ? nd->fd : NULL;
vd_color_set(vd, vd->click_fd, TRUE);
- if (bevent->button == 3)
+ if (bevent->button == MOUSE_BUTTON_RIGHT)
{
vd->popup = vd_pop_menu(vd, vd->click_fd);
gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL,
bevent->button, bevent->time);
}
- return (bevent->button != 1);
+ return (bevent->button != MOUSE_BUTTON_LEFT);
}
static void vdtree_row_expanded(GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *tpath, gpointer data)
switch (bevent->button)
{
- case 1:
+ case MOUSE_BUTTON_LEFT:
if (!GTK_WIDGET_HAS_FOCUS(vfi->listview))
{
gtk_widget_grab_focus(vfi->listview);
}
#endif
break;
- case 3:
+ case MOUSE_BUTTON_RIGHT:
vfi->popup = vficon_pop_menu(vfi, (id != NULL));
gtk_menu_popup(GTK_MENU(vfi->popup), NULL, NULL, NULL, NULL, bevent->button, bevent->time);
break;
if (id) was_selected = (id->selected & SELECTION_SELECTED);
- if (bevent->button == 1 &&
+ if (bevent->button == MOUSE_BUTTON_LEFT &&
id && vfi->click_id == id)
{
vficon_set_focus(vfi, id);
}
}
}
- else if (bevent->button == 2 &&
+ else if (bevent->button == MOUSE_BUTTON_MIDDLE &&
id && vfi->click_id == id)
{
vficon_select_util(vfi, id, !(id->selected & SELECTION_SELECTED));
GtkTreeModel *store;
col_idx = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(column), "column_store_idx"));
- if (bevent->button == 1 &&
+ if (bevent->button == MOUSE_BUTTON_LEFT &&
col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
return FALSE;
vfl->click_fd = fd;
- if (bevent->button == 3)
+ if (bevent->button == MOUSE_BUTTON_RIGHT)
{
vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, col_idx);
gtk_menu_popup(GTK_MENU(vfl->popup), NULL, NULL, NULL, NULL,
if (!fd) return FALSE;
- if (bevent->button == 2)
+ if (bevent->button == MOUSE_BUTTON_MIDDLE)
{
if (!vflist_row_is_selected(vfl, fd))
{
}
- if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS &&
+ if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_BUTTON_PRESS &&
!(bevent->state & GDK_SHIFT_MASK ) &&
!(bevent->state & GDK_CONTROL_MASK ) &&
vflist_row_is_selected(vfl, fd))
}
#if 0
- if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
+ if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_2BUTTON_PRESS)
{
if (vfl->layout) layout_image_full_screen_start(vfl->layout);
}
GtkTreeIter iter;
FileData *fd = NULL;
- if (bevent->button == 2)
+ if (bevent->button == MOUSE_BUTTON_MIDDLE)
{
vflist_color_set(vfl, vfl->click_fd, FALSE);
}
- if (bevent->button != 1 && bevent->button != 2)
+ if (bevent->button != MOUSE_BUTTON_LEFT && bevent->button != MOUSE_BUTTON_MIDDLE)
{
return TRUE;
}
gtk_tree_path_free(tpath);
}
- if (bevent->button == 2)
+ if (bevent->button == MOUSE_BUTTON_MIDDLE)
{
if (fd && vfl->click_fd == fd)
{