Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset adjust mode when hiding inputbar #588

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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