From 6b852bec6d4ff3ec4cec2361e34f89fbf130d058 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Mon, 12 Apr 2010 19:22:47 +0200 Subject: [PATCH] Scroll and click event callbacks defined Two callbacks for "scroll" and "click" events has been defined and connected to the view. --- zathura.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/zathura.c b/zathura.c index 77187cf..27c5151 100644 --- a/zathura.c +++ b/zathura.c @@ -355,6 +355,8 @@ gboolean cb_inputbar_activate(GtkEntry*, gpointer); gboolean cb_inputbar_form_activate(GtkEntry*, gpointer); gboolean cb_view_kb_pressed(GtkWidget*, GdkEventKey*, gpointer); gboolean cb_view_resized(GtkWidget*, GtkAllocation*, gpointer); +gboolean cb_view_button_pressed(GtkWidget*, GdkEventButton*, gpointer); +gboolean cb_view_scrolled(GtkWidget*, GdkEventScroll*, gpointer); /* configuration */ #include "config.h" @@ -466,8 +468,10 @@ init_zathura() gtk_box_set_spacing(Zathura.UI.continuous, 5); /* view */ - g_signal_connect(G_OBJECT(Zathura.UI.view), "key-press-event", G_CALLBACK(cb_view_kb_pressed), NULL); - g_signal_connect(G_OBJECT(Zathura.UI.view), "size-allocate", G_CALLBACK(cb_view_resized), NULL); + g_signal_connect(G_OBJECT(Zathura.UI.view), "key-press-event", G_CALLBACK(cb_view_kb_pressed), NULL); + g_signal_connect(G_OBJECT(Zathura.UI.view), "size-allocate", G_CALLBACK(cb_view_resized), NULL); + g_signal_connect(G_OBJECT(Zathura.UI.view), "button-press-event", G_CALLBACK(cb_view_button_pressed), NULL); + g_signal_connect(G_OBJECT(Zathura.UI.view), "scroll-event", G_CALLBACK(cb_view_scrolled), NULL); gtk_container_add(GTK_CONTAINER(Zathura.UI.view), GTK_WIDGET(Zathura.UI.viewport)); gtk_viewport_set_shadow_type(Zathura.UI.viewport, GTK_SHADOW_NONE); @@ -3304,6 +3308,17 @@ cb_view_resized(GtkWidget* widget, GtkAllocation* allocation, gpointer data) return TRUE; } +gboolean +cb_view_button_pressed(GtkWidget* widget, GdkEventButton* event, gpointer data) +{ + return TRUE; +} + +gboolean +cb_view_scrolled(GtkWidget* widget, GdkEventScroll* event, gpointer data) +{ + return TRUE; +} /* main function */ int main(int argc, char* argv[])