summaryrefslogtreecommitdiff
path: root/frontends/windows/gui.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-05-09 23:11:05 +0100
committerVincent Sanders <vince@kyllikki.org>2019-05-09 23:11:05 +0100
commit95b8d129508ccdec5eadabf46eb313b49a6b4369 (patch)
treee4ff77582e49df9fa3de63f8a0519e6f620d5481 /frontends/windows/gui.c
parent896e531a7fb6874a0a52de746ea8f783a5f9b441 (diff)
downloadnetsurf-95b8d129508ccdec5eadabf46eb313b49a6b4369.tar.gz
netsurf-95b8d129508ccdec5eadabf46eb313b49a6b4369.tar.bz2
implement windows clipboard functionality
This allows clipboard to operate (cut, copy, paste and delete) in the win32 front end. The clipboard is set and read in windows unicode mode and then converted to/from utf-8 for the browser core.
Diffstat (limited to 'frontends/windows/gui.c')
-rw-r--r--frontends/windows/gui.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c
index bafe5a4b7..490f23433 100644
--- a/frontends/windows/gui.c
+++ b/frontends/windows/gui.c
@@ -36,7 +36,6 @@
#include "utils/file.h"
#include "utils/messages.h"
#include "netsurf/browser_window.h"
-#include "netsurf/clipboard.h"
#include "windows/schedule.h"
#include "windows/window.h"
@@ -181,65 +180,3 @@ nserror win32_warning(const char *warning, const char *detail)
}
-/**
- * Core asks front end for clipboard contents.
- *
- * \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
- * \param length Byte length of UTF-8 text in buffer
- */
-static void gui_get_clipboard(char **buffer, size_t *length)
-{
- /* TODO: Implement this */
- HANDLE clipboard_handle;
- char *content;
-
- clipboard_handle = GetClipboardData(CF_TEXT);
- if (clipboard_handle != NULL) {
- content = GlobalLock(clipboard_handle);
- NSLOG(netsurf, INFO, "pasting %s", content);
- GlobalUnlock(clipboard_handle);
- }
-}
-
-
-/**
- * Core tells front end to put given text in clipboard
- *
- * \param buffer UTF-8 text, owned by core
- * \param length Byte length of UTF-8 text in buffer
- * \param styles Array of styles given to text runs, owned by core, or NULL
- * \param n_styles Number of text run styles in array
- */
-static void gui_set_clipboard(const char *buffer, size_t length,
- nsclipboard_styles styles[], int n_styles)
-{
- /* TODO: Implement this */
- HANDLE hnew;
- char *new, *original;
- HANDLE h = GetClipboardData(CF_TEXT);
- if (h == NULL)
- original = (char *)"";
- else
- original = GlobalLock(h);
-
- size_t len = strlen(original) + 1;
- hnew = GlobalAlloc(GHND, length + len);
- new = (char *)GlobalLock(hnew);
- snprintf(new, length + len, "%s%s", original, buffer);
-
- if (h != NULL) {
- GlobalUnlock(h);
- EmptyClipboard();
- }
- GlobalUnlock(hnew);
- SetClipboardData(CF_TEXT, hnew);
-}
-
-
-
-static struct gui_clipboard_table clipboard_table = {
- .get = gui_get_clipboard,
- .set = gui_set_clipboard,
-};
-
-struct gui_clipboard_table *win32_clipboard_table = &clipboard_table;