diff --git a/zathura/callbacks.c b/zathura/callbacks.c index 010f3730..35fc1da9 100644 --- a/zathura/callbacks.c +++ b/zathura/callbacks.c @@ -747,6 +747,14 @@ void cb_gesture_zoom_scale_changed(GtkGestureZoom* UNUSED(self), gdouble scale, sc_zoom(zathura->ui.session, &argument, NULL, next_zoom * 100); } +void cb_hide_inputbar(GtkWidget* widget, gpointer data) { + g_return_if_fail(widget != NULL); + g_return_if_fail(data != NULL); + + zathura_t* zathura = data; + zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_NONE); +} + void cb_hide_links(GtkWidget* widget, gpointer data) { g_return_if_fail(widget != NULL); g_return_if_fail(data != NULL); diff --git a/zathura/callbacks.h b/zathura/callbacks.h index 9d774f69..124d1d61 100644 --- a/zathura/callbacks.h +++ b/zathura/callbacks.h @@ -281,6 +281,11 @@ void cb_gesture_zoom_begin(GtkGesture* self, GdkEventSequence* sequence, void* d void cb_gesture_zoom_scale_changed(GtkGestureZoom* self, gdouble scale, void* data); +/** + * Clean up after the inputbar has been hidden. + */ +void cb_hide_inputbar(GtkWidget* widget, gpointer data); + /** * Clears all highlighted links when the inputbar gets closed * diff --git a/zathura/zathura.c b/zathura/zathura.c index f39f3dd9..96910928 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -245,6 +245,9 @@ static bool init_ui(zathura_t* zathura) { return false; } + g_signal_connect(GTK_WIDGET(zathura->ui.session->gtk.inputbar), "hide", + G_CALLBACK(cb_hide_inputbar), zathura); + g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "size-allocate", G_CALLBACK(cb_view_resized), zathura); GtkAdjustment* hadjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));