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 5, 2024
1 parent 482617c commit 296b48d
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 @@ -828,6 +828,14 @@ cb_gesture_zoom_scale_changed(GtkGestureZoom* UNUSED(self), gdouble scale, void*
refresh_view(zathura);
}

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 @@ -285,6 +285,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 @@ -257,6 +257,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);

Expand Down

0 comments on commit 296b48d

Please sign in to comment.