Implement 'double-click-follow' option

This commit is contained in:
Iamnotagenius 2023-03-26 01:07:55 +03:00
parent 48514b4d56
commit d61fe4a374
Failed to generate hash of commit
2 changed files with 6 additions and 1 deletions

View file

@ -983,7 +983,9 @@ cb_zathura_page_widget_button_release_event(GtkWidget* widget, GdkEventButton* b
if (priv->mouse.selection.y2 == -1 && priv->mouse.selection.x2 == -1 ) { if (priv->mouse.selection.y2 == -1 && priv->mouse.selection.x2 == -1 ) {
/* simple single click */ /* simple single click */
/* get links */ /* get links */
evaluate_link_at_mouse_position(page, oldx, oldy); if (priv->zathura->global.double_click_follow) {
evaluate_link_at_mouse_position(page, oldx, oldy);
}
} else { } else {
zathura_rectangle_t tmp = priv->mouse.selection; zathura_rectangle_t tmp = priv->mouse.selection;
@ -996,6 +998,8 @@ cb_zathura_page_widget_button_release_event(GtkWidget* widget, GdkEventButton* b
if (text != NULL && *text != '\0') { if (text != NULL && *text != '\0') {
/* emit text-selected signal */ /* emit text-selected signal */
g_signal_emit(ZATHURA_PAGE(widget), signals[TEXT_SELECTED], 0, text); g_signal_emit(ZATHURA_PAGE(widget), signals[TEXT_SELECTED], 0, text);
} else if (priv->zathura->global.double_click_follow == false) {
evaluate_link_at_mouse_position(page, oldx, oldy);
} }
g_free(text); g_free(text);
} }

View file

@ -96,6 +96,7 @@ zathura_create(void)
/* global settings */ /* global settings */
zathura->global.search_direction = FORWARD; zathura->global.search_direction = FORWARD;
zathura->global.sandbox = ZATHURA_SANDBOX_NORMAL; zathura->global.sandbox = ZATHURA_SANDBOX_NORMAL;
zathura->global.double_click_follow = true;
/* plugins */ /* plugins */
zathura->plugins.manager = zathura_plugin_manager_new(); zathura->plugins.manager = zathura_plugin_manager_new();