X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fpager.c;h=c04553fe135bdea0af9b16610968ec81b1d69498;hb=cdb84c7c776f214f41ba1a509efb2494e7ed1baf;hp=194a21dc64edb9e46cccba7cd3e9b3ea4237cccd;hpb=bf5bc4b0d129685482eefea499f39f874744e2fd;p=projects%2Fchimara%2Fchimara.git diff --git a/libchimara/pager.c b/libchimara/pager.c index 194a21d..c04553f 100644 --- a/libchimara/pager.c +++ b/libchimara/pager.c @@ -90,12 +90,12 @@ pager_on_key_press_event(GtkTextView *textview, GdkEventKey *event, winid_t win) NULL); switch (event->keyval) { - case GDK_space: case GDK_KP_Space: - case GDK_Page_Down: case GDK_KP_Page_Down: - case GDK_Return: case GDK_KP_Enter: + case GDK_KEY_space: case GDK_KEY_KP_Space: + case GDK_KEY_Page_Down: case GDK_KEY_KP_Page_Down: + case GDK_KEY_Return: case GDK_KEY_KP_Enter: gtk_adjustment_set_value(adj, CLAMP(value + page_size, lower, upper - page_size)); return TRUE; - case GDK_Page_Up: case GDK_KP_Page_Up: + case GDK_KEY_Page_Up: case GDK_KEY_KP_Page_Up: gtk_adjustment_set_value(adj, CLAMP(value - page_size, lower, upper - page_size)); return TRUE; /* don't handle "up" and "down", they're used for input history */ @@ -104,24 +104,20 @@ pager_on_key_press_event(GtkTextView *textview, GdkEventKey *event, winid_t win) return FALSE; /* if the key wasn't handled here, pass it to other handlers */ } -/* Draw the "more" prompt on top of the buffer, after the regular expose event has run */ +/* Draw the "more" prompt on top of the buffer, after the regular draw event has run */ gboolean -pager_on_expose(GtkTextView *textview, GdkEventExpose *event, winid_t win) +pager_on_draw(GtkTextView *textview, cairo_t *cr, winid_t win) { /* Calculate the position of the 'more' tag */ gint promptwidth, promptheight; pango_layout_get_pixel_size(win->pager_layout, &promptwidth, &promptheight); - gint winx, winy, winwidth, winheight; - gdk_window_get_position(event->window, &winx, &winy); - gdk_drawable_get_size(GDK_DRAWABLE(event->window), &winwidth, &winheight); + int winwidth = gtk_widget_get_allocated_width( GTK_WIDGET(textview) ); + int winheight = gtk_widget_get_allocated_height( GTK_WIDGET(textview) ); /* Draw the 'more' tag */ - GdkGC *context = gdk_gc_new(GDK_DRAWABLE(event->window)); - gdk_draw_layout(event->window, context, - winx + winwidth - promptwidth, - winy + winheight - promptheight, - win->pager_layout); + cairo_move_to(cr, winwidth - promptwidth, winheight - promptheight); + pango_cairo_show_layout(cr, win->pager_layout); return FALSE; /* Propagate event further */ } @@ -129,7 +125,7 @@ pager_on_expose(GtkTextView *textview, GdkEventExpose *event, winid_t win) /* Check whether paging should be done. This function is called after the * textview has finished validating text positions. */ void -pager_after_size_request(GtkTextView *textview, GtkRequisition *requisition, winid_t win) +pager_after_size_allocate(GtkTextView *textview, GdkRectangle *allocation, winid_t win) { /* Move the pager to the last visible character in the buffer */ gint view_height, scroll_distance;