aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-13 09:20:37 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-13 09:21:28 +0100
commit7dba21c6d885605dd83fb1bea828b0c5e723b0d1 (patch)
tree5282edf2c784ff6306bc08c3b09a93cc8f4cc00f
parentd20c6469c0f420ebf16499881b28e2b5539fa248 (diff)
downloadfiv-7dba21c6d885605dd83fb1bea828b0c5e723b0d1.tar.gz
fiv-7dba21c6d885605dd83fb1bea828b0c5e723b0d1.tar.xz
fiv-7dba21c6d885605dd83fb1bea828b0c5e723b0d1.zip
Use the hand/pointer cursor in the browser
Also, fix the build.
-rw-r--r--fastiv-browser.c23
-rw-r--r--meson.build4
2 files changed, 24 insertions, 3 deletions
diff --git a/fastiv-browser.c b/fastiv-browser.c
index 2db04ea..0d183c4 100644
--- a/fastiv-browser.c
+++ b/fastiv-browser.c
@@ -335,7 +335,7 @@ fastiv_browser_realize(GtkWidget *widget)
.visual = gtk_widget_get_visual(widget),
.event_mask = gtk_widget_get_events(widget) | GDK_KEY_PRESS_MASK |
- GDK_BUTTON_PRESS_MASK,
+ GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK,
};
// We need this window to receive input events at all.
@@ -401,6 +401,26 @@ fastiv_browser_button_press_event(GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
+gboolean
+fastiv_browser_motion_notify_event(GtkWidget *widget, GdkEventMotion *event)
+{
+ FastivBrowser *self = FASTIV_BROWSER(widget);
+ if (event->state != 0)
+ return FALSE;
+
+ const Entry *entry = entry_at(self, event->x, event->y);
+ GdkWindow *window = gtk_widget_get_window(widget);
+ if (entry) {
+ GdkCursor *cursor =
+ gdk_cursor_new_from_name(gdk_window_get_display(window), "pointer");
+ gdk_window_set_cursor(window, cursor);
+ g_object_unref(cursor);
+ } else {
+ gdk_window_set_cursor(window, NULL);
+ }
+ return TRUE;
+}
+
static void
fastiv_browser_style_updated(GtkWidget *widget)
{
@@ -476,6 +496,7 @@ fastiv_browser_class_init(FastivBrowserClass *klass)
widget_class->draw = fastiv_browser_draw;
widget_class->size_allocate = fastiv_browser_size_allocate;
widget_class->button_press_event = fastiv_browser_button_press_event;
+ widget_class->motion_notify_event = fastiv_browser_motion_notify_event;
widget_class->style_updated = fastiv_browser_style_updated;
browser_signals[ITEM_ACTIVATED] =
diff --git a/meson.build b/meson.build
index 0434cff..1125cd9 100644
--- a/meson.build
+++ b/meson.build
@@ -32,10 +32,10 @@ executable('fastiv', 'fastiv.c', 'fastiv-view.c', 'fastiv-io.c',
install : true,
dependencies : [dependencies])
-if gdk_pixbuf.found()
+if gdkpixbuf.found()
executable('io-benchmark', 'fastiv-io-benchmark.c', 'fastiv-io.c', 'xdg.c',
build_by_default : false,
- dependencies : [dependencies, gdk_pixbuf])
+ dependencies : [dependencies, gdkpixbuf])
endif
install_data('fastiv.desktop',