Only copy selected text in normal and fullscreen mode

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2014-02-14 11:46:17 +01:00
parent f2fbf92621
commit a85decc8cc
3 changed files with 11 additions and 5 deletions

View file

@ -50,7 +50,8 @@ cb_buffer_changed(girara_session_t* session)
} }
static void static void
update_visible_pages(zathura_t* zathura) { update_visible_pages(zathura_t* zathura)
{
const unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document); const unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document);
for (unsigned int page_id = 0; page_id < number_of_pages; page_id++) { for (unsigned int page_id = 0; page_id < number_of_pages; page_id++) {
@ -539,6 +540,11 @@ cb_page_widget_text_selected(ZathuraPage* page, const char* text, void* data)
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
zathura_t* zathura = data; zathura_t* zathura = data;
girara_mode_t mode = girara_mode_get(zathura->ui.session);
if (mode != zathura->modes.normal && mode != zathura->modes.fullscreen) {
return;
}
GdkAtom* selection = get_selection(zathura); GdkAtom* selection = get_selection(zathura);
/* copy to clipboard */ /* copy to clipboard */

View file

@ -483,8 +483,8 @@ zathura_dbus_goto_page_and_highlight(const char* filename, unsigned int page,
} }
GError* error = NULL; GError* error = NULL;
GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SESSION, GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL,
NULL, &error); &error);
if (connection == NULL) { if (connection == NULL) {
girara_error("Could not connect to session bus: %s", error->message); girara_error("Could not connect to session bus: %s", error->message);
g_error_free(error); g_error_free(error);

View file

@ -1242,7 +1242,7 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
girara_mode_set(session, zathura->modes.fullscreen); girara_mode_set(session, zathura->modes.fullscreen);
} }
fullscreen = fullscreen ? false : true; fullscreen = !fullscreen;
return false; return false;
} }
@ -1315,7 +1315,7 @@ sc_toggle_presentation(girara_session_t* session, girara_argument_t*
girara_mode_set(session, zathura->modes.presentation); girara_mode_set(session, zathura->modes.presentation);
} }
fullscreen = fullscreen ? false : true; fullscreen = !fullscreen;
return false; return false;
} }