Iliad port
[rodin/chimara.git] / libchimara / pager.c
index 8fa8031a1ccc08ab4ecbe8f6b15ed626c6492cd1..1fdbf4627b333ffb6d3c1ede74756345554ce514 100644 (file)
@@ -30,8 +30,8 @@ move_pager_and_get_scroll_distance(GtkTextView *textview, gint *view_height, gin
        gtk_text_view_get_iter_location(textview, &newpager, &pagerpos);
        gtk_text_view_get_iter_location(textview, &end, &endpos);
 
-       g_printerr("View height = %d\n", visiblerect.height);
-       g_printerr("End - Pager = %d\n", endpos.y - pagerpos.y);
+       /*g_printerr("View height = %d\n", visiblerect.height);
+       g_printerr("End - Pager = %d\n", endpos.y - pagerpos.y);*/
        
        *view_height = visiblerect.height;
        *scroll_distance = endpos.y - pagerpos.y;
@@ -66,12 +66,21 @@ pager_after_size_allocate(GtkTextView *view, GtkAllocation *allocation, winid_t
        /* Move the pager to the last visible character in the buffer */
        gint view_height, scroll_distance;
        move_pager_and_get_scroll_distance( GTK_TEXT_VIEW(win->widget), &view_height, &scroll_distance );
+
+       if(view_height <= 1)
+               /* Paging is unusable when window is too small */
+               return;
        
        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
                }
                else if(scroll_distance > 0) {
                        GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(win->widget));