summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-08-02 14:38:47 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-08-02 14:38:47 +0100
commit5747465437ebc476dfa1385825e7844d8a253485 (patch)
tree44dad3ab5b2a99cac733463816824cf00b4b51aa /gtk
parent408dd00ed448caebf53999704ef03b6c45cdd8b7 (diff)
downloadnetsurf-5747465437ebc476dfa1385825e7844d8a253485.tar.gz
netsurf-5747465437ebc476dfa1385825e7844d8a253485.tar.bz2
Use selection_copy_to_clipboard instead of peering at core innards.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/selection.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/gtk/selection.c b/gtk/selection.c
index be2e44cbf..14935671f 100644
--- a/gtk/selection.c
+++ b/gtk/selection.c
@@ -22,21 +22,13 @@
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/textinput.h"
#include "desktop/selection.h"
#include "desktop/browser.h"
#include "gtk/selection.h"
#include "gtk/window.h"
-#include "utils/utf8.h"
-
-#include "render/box.h"
static GString *current_selection = NULL;
static GtkClipboard *clipboard;
-
-static bool copy_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text,
- size_t whitespace_length);
bool gui_add_to_clipboard(const char *text, size_t length, bool space)
@@ -48,31 +40,10 @@ bool gui_add_to_clipboard(const char *text, size_t length, bool space)
return true;
}
-bool copy_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text,
- size_t whitespace_length)
-{
- bool add_space = box != NULL ? box->space != 0 : false;
-
- /* add any whitespace which precedes the text from this box */
- if (whitespace_text != NULL && whitespace_length > 0) {
- if (!gui_add_to_clipboard(whitespace_text,
- whitespace_length, false)) {
- return false;
- }
- }
-
- /* add the text from this box */
- if (!gui_add_to_clipboard(text, length, add_space))
- return false;
-
- return true;
-}
-
bool gui_copy_to_clipboard(struct selection *s)
{
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
- if (s->defined && selection_traverse(s, copy_handler, NULL))
+ if (s->defined && selection_copy_to_clipboard(s))
gui_commit_clipboard();
return TRUE;
}