aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keys.cc1
-rw-r--r--src/keys.hh1
-rw-r--r--src/keysrc3
-rw-r--r--src/ui.cc5
-rw-r--r--src/uicmd.cc10
-rw-r--r--src/uicmd.hh1
6 files changed, 20 insertions, 1 deletions
diff --git a/src/keys.cc b/src/keys.cc
index bbbd30bb..2a97a160 100644
--- a/src/keys.cc
+++ b/src/keys.cc
@@ -139,6 +139,7 @@ static const KeyBinding_t default_keys[] = {
{ "right" , KEYS_RIGHT , 0 , FL_Right },
{ "top" , KEYS_TOP , 0 , FL_Home },
{ "bottom" , KEYS_BOTTOM , 0 , FL_End },
+ { "copy" , KEYS_COPY , FL_CTRL , 'c' },
{ "zoom-in" , KEYS_ZOOM_IN , FL_CTRL , '+' },
{ "zoom-in" , KEYS_ZOOM_IN , FL_CTRL , '=' /* US + */ },
{ "zoom-out" , KEYS_ZOOM_OUT , FL_CTRL , '-' },
diff --git a/src/keys.hh b/src/keys.hh
index 40c01718..72b62d18 100644
--- a/src/keys.hh
+++ b/src/keys.hh
@@ -49,6 +49,7 @@ typedef enum {
KEYS_RIGHT,
KEYS_TOP,
KEYS_BOTTOM,
+ KEYS_COPY,
KEYS_ZOOM_IN,
KEYS_ZOOM_OUT,
KEYS_ZOOM_RESET
diff --git a/src/keysrc b/src/keysrc
index bcfbb039..2d467fa2 100644
--- a/src/keysrc
+++ b/src/keysrc
@@ -78,6 +78,9 @@
# "goto" goes to the location bar at the top of the window.
#<ctrl>l = goto
+# "copy" copies the selected text into the clipboard.
+#<ctrl>c = copy
+
# "stop" loading the page.
#(stop has no default binding)
diff --git a/src/ui.cc b/src/ui.cc
index c5870b04..effd76cf 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -2,7 +2,7 @@
* File: ui.cc
*
* Copyright (C) 2005-2007 Jorge Arellano Cid <jcid@dillo.org>
- * Copyright (C) 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
+ * Copyright (C) 2024-2025 Rodrigo Arias Mallo <rodarima@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -742,6 +742,9 @@ int UI::handle(int event)
} else if (cmd == KEYS_FORWARD) {
a_UIcmd_forw(a_UIcmd_get_bw_by_widget(this));
ret = 1;
+ } else if (cmd == KEYS_COPY) {
+ a_UIcmd_copy(a_UIcmd_get_bw_by_widget(this));
+ ret = 1;
} else if (cmd == KEYS_ZOOM_IN) {
a_UIcmd_zoom_in(a_UIcmd_get_bw_by_widget(this));
ret = 1;
diff --git a/src/uicmd.cc b/src/uicmd.cc
index a2c21311..a46fd7c5 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -953,6 +953,16 @@ void a_UIcmd_redirection0(void *vbw, const DilloUrl *url)
}
/*
+ * Copy selection to clipboard
+ */
+void a_UIcmd_copy(void *vbw)
+{
+ BrowserWindow *bw = (BrowserWindow*) vbw;
+ Layout *layout = (Layout*)bw->render_layout;
+ layout->copyCurrentSelection(1);
+}
+
+/*
* Zoom in
*/
void a_UIcmd_zoom_in(void *vbw)
diff --git a/src/uicmd.hh b/src/uicmd.hh
index 54b8750b..581eac30 100644
--- a/src/uicmd.hh
+++ b/src/uicmd.hh
@@ -35,6 +35,7 @@ void a_UIcmd_forw(void *vbw);
void a_UIcmd_forw_nt(void *vbw);
void a_UIcmd_forw_popup(void *vbw, int x, int y);
void a_UIcmd_home(void *vbw);
+void a_UIcmd_copy(void *vbw);
void a_UIcmd_zoom_in(void *vbw);
void a_UIcmd_zoom_out(void *vbw);
void a_UIcmd_zoom_reset(void *vbw);