From c2b9d22ad155a22a5b25faac64641f38d857aa08 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 7 Feb 2012 15:05:22 +0100 Subject: [PATCH 1/4] don't search on hidden pages --- commands.c | 2 +- shortcuts.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/commands.c b/commands.c index aebedc1..89696ae 100644 --- a/commands.c +++ b/commands.c @@ -287,7 +287,7 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu for (unsigned int page_id = 0; page_id < zathura->document->number_of_pages; ++page_id) { zathura_page_t* page = zathura->document->pages[page_id]; - if (page == NULL) { + if (page == NULL || page->visible == false) { continue; } diff --git a/shortcuts.c b/shortcuts.c index 4712a2b..633cf92 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -19,8 +19,6 @@ bool sc_abort(girara_session_t* session, girara_argument_t* UNUSED(argument), girara_event_t* UNUSED(event), unsigned int UNUSED(t)) { - girara_info("in sc_abort"); - g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); zathura_t* zathura = session->global.data; @@ -329,8 +327,6 @@ sc_search(girara_session_t* session, girara_argument_t* argument, g_return_val_if_fail(argument != NULL, false); g_return_val_if_fail(zathura->document != NULL, false); - girara_info("in sc_search"); - return false; } From aea5024ce342331affb40f89b54e69afb4194dd5 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 7 Feb 2012 15:10:58 +0100 Subject: [PATCH 2/4] add argument printing to zathura_page_render --- document.c | 4 ++-- document.h | 5 +++-- print.c | 2 +- render.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/document.c b/document.c index fb96f4d..40ee942 100644 --- a/document.c +++ b/document.c @@ -546,7 +546,7 @@ zathura_page_image_save(zathura_page_t* page, zathura_image_t* image, const char } bool -zathura_page_render(zathura_page_t* page, cairo_t* cairo) +zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing) { if (page == NULL || page->document == NULL || cairo == NULL) { return NULL; @@ -557,7 +557,7 @@ zathura_page_render(zathura_page_t* page, cairo_t* cairo) return NULL; } - return page->document->functions.page_render_cairo(page, cairo); + return page->document->functions.page_render_cairo(page, cairo, printing); } zathura_index_element_t* diff --git a/document.h b/document.h index 00dcc14..9ee6747 100644 --- a/document.h +++ b/document.h @@ -249,7 +249,7 @@ struct zathura_document_s /** * Renders the page */ - bool (*page_render_cairo)(zathura_page_t* page, cairo_t* cairo); + bool (*page_render_cairo)(zathura_page_t* page, cairo_t* cairo, bool printing); /** * Free page @@ -420,9 +420,10 @@ bool zathura_page_image_save(zathura_page_t* page, zathura_image_t* image, const * * @param page The page object * @param cairo Cairo object + * @param printing render for printing * @return True if no error occured, otherwise false */ -bool zathura_page_render(zathura_page_t* page, cairo_t* cairo); +bool zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing); /** * Create new index element diff --git a/print.c b/print.c index 9eb97f4..e6d683f 100644 --- a/print.c +++ b/print.c @@ -89,5 +89,5 @@ cb_print_draw_page(GtkPrintOperation* UNUSED(print_operation), GtkPrintContext* return; } - zathura_page_render(page, cairo); + zathura_page_render(page, cairo, true); } diff --git a/render.c b/render.c index 86a62f1..3618fae 100644 --- a/render.c +++ b/render.c @@ -194,7 +194,7 @@ render(zathura_t* zathura, zathura_page_t* page) cairo_scale(cairo, zathura->document->scale, zathura->document->scale); } - if (zathura_page_render(page, cairo) == false) { + if (zathura_page_render(page, cairo, false) == false) { cairo_destroy(cairo); cairo_surface_destroy(surface); gdk_threads_leave(); From 751c0980dec4b7c878369ba832494442651e304e Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 7 Feb 2012 15:13:03 +0100 Subject: [PATCH 3/4] remove debug output --- callbacks.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/callbacks.c b/callbacks.c index 0af6c48..73a5627 100644 --- a/callbacks.c +++ b/callbacks.c @@ -82,15 +82,12 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi if (gdk_rectangle_intersect(&view_rect, &page_rect, NULL) == TRUE) { page->visible = true; - girara_info("page %d visible", page_id); - if (updated == false && gdk_rectangle_intersect(¢er, &page_rect, NULL) == TRUE) { zathura->document->current_page_number = page_id; updated = true; } } else { page->visible = false; - girara_info("page %d not visible", page_id); } } From 2678db4a6f8f0b5ccf9977cfbc2039fabcebe91b Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 7 Feb 2012 15:33:49 +0100 Subject: [PATCH 4/4] drop experiments --- page_view_widget.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/page_view_widget.c b/page_view_widget.c index 71dc6de..4fc6653 100644 --- a/page_view_widget.c +++ b/page_view_widget.c @@ -29,16 +29,6 @@ static gboolean zathura_page_view_expose(GtkWidget* widget, GdkEventExpose* even static void zathura_page_view_finalize(GObject* object); static void zathura_page_view_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec); static void zathura_page_view_size_allocate(GtkWidget* widget, GdkRectangle* allocation); -static void zathura_page_view_grab_focus(GtkWidget* widget); - -static gboolean zathura_page_view_focus_in(GtkWidget *widget, GtkDirectionType GIRARA_UNUSED(event)) -{ - ZathuraPageView* view = ZATHURA_PAGE_VIEW(widget); - zathura_page_view_private_t* priv = ZATHURA_PAGE_VIEW_GET_PRIVATE(view); - - girara_info("lala: %d", priv->page->number); - return false; -} enum properties_e { @@ -56,8 +46,6 @@ zathura_page_view_class_init(ZathuraPageViewClass* class) GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(class); widget_class->expose_event = zathura_page_view_expose; widget_class->size_allocate = zathura_page_view_size_allocate; - widget_class->grab_focus = zathura_page_view_grab_focus; - widget_class->focus = zathura_page_view_focus_in; GObjectClass* object_class = G_OBJECT_CLASS(class); object_class->finalize = zathura_page_view_finalize; @@ -300,12 +288,3 @@ zathura_page_view_clear_rectangles(ZathuraPageView* widget) GIRARA_LIST_FOREACH_END(priv->rectangles, pv_rect_t*, iter, rect); girara_list_clear(priv->rectangles); } - -static void -zathura_page_view_grab_focus(GtkWidget* widget) -{ - ZathuraPageView* view = ZATHURA_PAGE_VIEW(widget); - zathura_page_view_private_t* priv = ZATHURA_PAGE_VIEW_GET_PRIVATE(view); - - girara_info("lala: %d", priv->page->number); -}