X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fpager.c;h=efb941b46f39bb945e82292539e89c5371d09f02;hb=59f3bc1e4f21377c362c1f497fb225711127d7a0;hp=194a21dc64edb9e46cccba7cd3e9b3ea4237cccd;hpb=edf59e1a751771655752b61e211053e08a8cbe3a;p=projects%2Fchimara%2Fchimara.git diff --git a/libchimara/pager.c b/libchimara/pager.c index 194a21d..efb941b 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; @@ -161,13 +157,7 @@ pager_after_size_request(GtkTextView *textview, GtkRequisition *requisition, win if(!win->currently_paging) { if(scroll_distance > view_height) { start_paging(win); - /* Seriously... */ - /* COMPAT: */ -#if GTK_CHECK_VERSION(2,14,0) gdk_window_invalidate_rect(gtk_widget_get_window(win->widget), NULL, TRUE); -#else - gdk_window_invalidate_rect(win->widget->window, NULL, TRUE); -#endif } } }