From dba5161d2a03258ce09722809698bc4ce1528acc Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sat, 24 Apr 2010 22:51:58 +0000 Subject: [PATCH] Playing around with barf Renamed barf.c.eventbox so gcc doesn't complain about the extension git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@243 ddfedd41-794f-dd11-ae45-00112f111e67 --- tests/{barf.c.eventbox => barf-eventbox.c} | 24 +++++++++++++++++++++- tests/barf.c | 13 +++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) rename tests/{barf.c.eventbox => barf-eventbox.c} (92%) diff --git a/tests/barf.c.eventbox b/tests/barf-eventbox.c similarity index 92% rename from tests/barf.c.eventbox rename to tests/barf-eventbox.c index 29eda83..993c78f 100644 --- a/tests/barf.c.eventbox +++ b/tests/barf-eventbox.c @@ -168,6 +168,11 @@ pager_wait(GtkTextView *eventbox, GdkEventKey *event, GtkTextBuffer *buffer) static gboolean expose_prompt(GtkEventBox *eventbox, GdkEventExpose *event) { + g_printerr("Eventbox expose callback!\n"); + + while(gtk_events_pending()) + gtk_main_iteration(); + GdkGC *context = gdk_gc_new(GDK_DRAWABLE(event->window)); gint winx, winy, winwidth, winheight; @@ -183,6 +188,20 @@ expose_prompt(GtkEventBox *eventbox, GdkEventExpose *event) return FALSE; /* Propagate event further */ } +static gboolean +expose_scroll(GtkScrolledWindow *scroll, GdkEventExpose *event) +{ + g_printerr("Scrolled window expose callback!\n"); + return FALSE; +} + +static gboolean +expose_textview(GtkTextView *textview, GdkEventExpose *event) +{ + g_printerr("Text view expose callback!\n"); + return FALSE; +} + int main(int argc, char **argv) { @@ -225,8 +244,11 @@ main(int argc, char **argv) g_signal_connect_after(adj, "value-changed", G_CALLBACK(adjustment_changed), textview); pager_handler = g_signal_connect(eventbox, "key-press-event", G_CALLBACK(pager_wait), buffer); g_signal_handler_block(eventbox, pager_handler); - expose_handler = g_signal_connect(eventbox, "expose-event", G_CALLBACK(expose_prompt), NULL); + expose_handler = g_signal_connect_after(eventbox, "expose-event", G_CALLBACK(expose_prompt), NULL); g_signal_handler_block(eventbox, expose_handler); + + g_signal_connect(scrolledwindow, "expose-event", G_CALLBACK(expose_scroll), NULL); + g_signal_connect(textview, "expose-event", G_CALLBACK(expose_textview), NULL); /* Create the pager position mark; it stands for the last character in the buffer that has been on-screen */ diff --git a/tests/barf.c b/tests/barf.c index 42b535f..a98b208 100644 --- a/tests/barf.c +++ b/tests/barf.c @@ -148,17 +148,20 @@ pager_wait(GtkTextView *textview, GdkEventKey *event, GtkTextBuffer *buffer) switch (event->keyval) { case GDK_space: case GDK_KP_Space: case GDK_Page_Down: case GDK_KP_Page_Down: gtk_adjustment_set_value(adj, CLAMP(value + page_size, lower, upper - page_size)); - return TRUE; + break; case GDK_Page_Up: case GDK_KP_Page_Up: gtk_adjustment_set_value(adj, CLAMP(value - page_size, lower, upper - page_size)); - return TRUE; + break; case GDK_Return: case GDK_KP_Enter: gtk_adjustment_set_value(adj, CLAMP(value + step_increment, lower, upper - page_size)); - return TRUE; + break; /* don't handle "up" and "down", they're used for input history */ + default: + return FALSE; /* if the key wasn't handled here, pass it to other handlers */ } - - return FALSE; /* if the key wasn't handled here, pass it to other handlers */ + + gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(textview)), TRUE); + return TRUE; /* handled it, stop this event now */ } /* Draw the "more" prompt on top of the buffer, after the regular expose event has run */ -- 2.30.2