diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-01-08 17:07:04 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-01-08 17:07:04 +0000 |
commit | 9dc965d51cc014e4ae3028afd655eb1f30ca4ad1 (patch) | |
tree | 6efff14bca2e24281b3d6a8ae32bb5dde4581aa4 /windows/gui.c | |
parent | 94f13d85551f45d323ed8658f8e849214a5c60e6 (diff) | |
download | netsurf-9dc965d51cc014e4ae3028afd655eb1f30ca4ad1.tar.gz netsurf-9dc965d51cc014e4ae3028afd655eb1f30ca4ad1.tar.bz2 |
Untested update for new clipboard API.
Diffstat (limited to 'windows/gui.c')
-rw-r--r-- | windows/gui.c | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/windows/gui.c b/windows/gui.c index 78c2d1b10..9f44ddfc6 100644 --- a/windows/gui.c +++ b/windows/gui.c @@ -1727,8 +1727,15 @@ void gui_clear_selection(struct gui_window *w) { } -void gui_paste_from_clipboard(struct gui_window *w, int x, int y) +/** + * 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 + */ +void gui_get_clipboard(char **buffer, size_t *length) { + /* TODO: Implement this */ HANDLE clipboard_handle; char *content; @@ -1740,14 +1747,18 @@ void gui_paste_from_clipboard(struct gui_window *w, int x, int y) } } -bool gui_empty_clipboard(void) -{ - return false; -} - -bool gui_add_to_clipboard(const char *text, size_t length, bool space, - const plot_font_style_t *fstyle) +/** + * 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 + */ +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); @@ -1759,7 +1770,7 @@ bool gui_add_to_clipboard(const char *text, size_t length, bool space, size_t len = strlen(original) + 1; hnew = GlobalAlloc(GHND, length + len); new = (char *)GlobalLock(hnew); - snprintf(new, length + len, "%s%s", original, text); + snprintf(new, length + len, "%s%s", original, buffer); if (h != NULL) { GlobalUnlock(h); @@ -1767,29 +1778,6 @@ bool gui_add_to_clipboard(const char *text, size_t length, bool space, } GlobalUnlock(hnew); SetClipboardData(CF_TEXT, hnew); - return true; -} - -bool gui_commit_clipboard(void) -{ - return false; -} - - -bool gui_copy_to_clipboard(struct selection *s) -{ - if (selection_defined(s)) { - /* TODO: Fix this, so it's not looking inside selection - * object */ - -/* OpenClipboard(s->bw->window->main); - EmptyClipboard(); - if (selection_copy_to_clipboard(s)) { - CloseClipboard(); - return true; - } -*/ } - return false; } |