FILE_COLUMN_COUNT
};
-typedef enum {
- SELECTION_NONE = 0,
- SELECTION_SELECTED = 1 << 0,
- SELECTION_PRELIGHT = 1 << 1,
- SELECTION_FOCUS = 1 << 2
-} SelectionType;
-
-typedef struct _IconData IconData;
-struct _IconData
-{
- SelectionType selected;
- FileData *fd;
-};
-
static gint vficon_index_by_id(ViewFile *vf, IconData *in_id);
static IconData *vficon_icon_data(ViewFile *vf, FileData *fd)
{
GtkWidget *label;
gint x, y;
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkDisplay *display;
+ GdkDeviceManager *device_manager;
+ GdkDevice *device;
+#endif
if (VFICON(vf)->tip_window) return;
+#if GTK_CHECK_VERSION(3,0,0)
+ device_manager = gdk_display_get_device_manager(gdk_window_get_display(
+ gtk_tree_view_get_bin_window(GTK_TREE_VIEW(vf->listview))));
+ device = gdk_device_manager_get_client_pointer(device_manager);
+ gdk_window_get_device_position(gtk_tree_view_get_bin_window(GTK_TREE_VIEW(vf->listview)),
+ device, &x, &y, NULL);
+#else
gdk_window_get_pointer(gtk_tree_view_get_bin_window(GTK_TREE_VIEW(vf->listview)), &x, &y, NULL);
+#endif
VFICON(vf)->tip_id = vficon_find_data_by_coord(vf, x, y, NULL);
if (!VFICON(vf)->tip_id) return;
gtk_container_add(GTK_CONTAINER(VFICON(vf)->tip_window), label);
gtk_widget_show(label);
+#if GTK_CHECK_VERSION(3,0,0)
+ display = gdk_display_get_default();
+ device_manager = gdk_display_get_device_manager(display);
+ device = gdk_device_manager_get_client_pointer(device_manager);
+ gdk_device_get_position(device, NULL, &x, &y);
+#else
gdk_window_get_pointer(NULL, &x, &y, NULL);
+#endif
if (!gtk_widget_get_realized(VFICON(vf)->tip_window)) gtk_widget_realize(VFICON(vf)->tip_window);
gtk_window_move(GTK_WINDOW(VFICON(vf)->tip_window), x + 16, y + 16);
static void tip_update(ViewFile *vf, IconData *id)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkDisplay *display = gdk_display_get_default();
+ GdkDeviceManager *device_manager = gdk_display_get_device_manager(display);
+ GdkDevice *device = gdk_device_manager_get_client_pointer(device_manager);
+#endif
+
if (VFICON(vf)->tip_window)
{
gint x, y;
+#if GTK_CHECK_VERSION(3,0,0)
+ gdk_device_get_position(device, NULL, &x, &y);
+#else
gdk_window_get_pointer(NULL, &x, &y, NULL);
+#endif
gtk_window_move(GTK_WINDOW(VFICON(vf)->tip_window), x + 16, y + 16);
if (id != VFICON(vf)->tip_id)
{
/* ensure focus row col are correct */
vficon_find_position(vf, VFICON(vf)->focus_id, &VFICON(vf)->focus_row, &VFICON(vf)->focus_column);
+#if GTK_CHECK_VERSION(3,0,0)
+/* FIXME: Refer to issue #467 on Github. The thumbnail position is not
+ * preserved when the icon view is refreshed. Caused by an unknown call from
+ * the idle loop. This patch hides the problem.
+ */
+ if (vficon_find_iter(vf, VFICON(vf)->focus_id, &iter, NULL))
+ {
+ tree_view_row_make_visible(GTK_TREE_VIEW(vf->listview), &iter, FALSE);
+ }
+#endif
return;
}
vficon_selection_remove(vf, VFICON(vf)->focus_id, SELECTION_FOCUS, NULL);
*-------------------------------------------------------------------
*/
-static gboolean vficon_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
+static gboolean vficon_motion_cb(GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
ViewFile *vf = data;
IconData *id;
- id = vficon_find_data_by_coord(vf, (gint)bevent->x, (gint)bevent->y, NULL);
+ id = vficon_find_data_by_coord(vf, (gint)event->x, (gint)event->y, NULL);
tip_update(vf, id);
return FALSE;