Skip to content

Commit

Permalink
Reset adjust mode when hiding inputbar
Browse files Browse the repository at this point in the history
Zathura sets a special adjust mode before showing the inputbar.
Remaining in that mode after it has been hidden breaks things like
rotation, so reset to none.
  • Loading branch information
9ary committed Jun 19, 2024
1 parent d5c7550 commit bc9d4ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions zathura/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions zathura/callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
3 changes: 3 additions & 0 deletions zathura/zathura.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit bc9d4ed

Please sign in to comment.