diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-05-09 23:11:05 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2019-05-09 23:11:05 +0100 |
commit | 95b8d129508ccdec5eadabf46eb313b49a6b4369 (patch) | |
tree | e4ff77582e49df9fa3de63f8a0519e6f620d5481 /frontends/windows/window.c | |
parent | 896e531a7fb6874a0a52de746ea8f783a5f9b441 (diff) | |
download | netsurf-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/window.c')
-rw-r--r-- | frontends/windows/window.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/frontends/windows/window.c b/frontends/windows/window.c index 681b2e282..adfc79399 100644 --- a/frontends/windows/window.c +++ b/frontends/windows/window.c @@ -1056,48 +1056,35 @@ nsws_window_command(HWND hwnd, break; case IDM_EDIT_CUT: - OpenClipboard(gw->main); - EmptyClipboard(); - CloseClipboard(); if (GetFocus() == gw->urlbar) { SendMessage(gw->urlbar, WM_CUT, 0, 0); - } else if (gw->bw != NULL) { - browser_window_key_press(gw->bw, NS_KEY_CUT_SELECTION); + } else { + SendMessage(gw->drawingarea, WM_CUT, 0, 0); } break; case IDM_EDIT_COPY: - OpenClipboard(gw->main); - EmptyClipboard(); - CloseClipboard(); if (GetFocus() == gw->urlbar) { SendMessage(gw->urlbar, WM_COPY, 0, 0); - } else if (gw->bw != NULL) { - browser_window_key_press(gw->bw, NS_KEY_COPY_SELECTION); + } else { + SendMessage(gw->drawingarea, WM_COPY, 0, 0); } break; case IDM_EDIT_PASTE: { - OpenClipboard(gw->main); - HANDLE h = GetClipboardData(CF_TEXT); - if (h != NULL) { - char *content = GlobalLock(h); - NSLOG(netsurf, INFO, "pasting %s\n", content); - GlobalUnlock(h); - } - CloseClipboard(); - if (GetFocus() == gw->urlbar) + if (GetFocus() == gw->urlbar) { SendMessage(gw->urlbar, WM_PASTE, 0, 0); - else - browser_window_key_press(gw->bw, NS_KEY_PASTE); + } else { + SendMessage(gw->drawingarea, WM_PASTE, 0, 0); + } break; } case IDM_EDIT_DELETE: if (GetFocus() == gw->urlbar) - SendMessage(gw->urlbar, WM_CUT, 0, 0); + SendMessage(gw->urlbar, WM_CLEAR, 0, 0); else - browser_window_key_press(gw->bw, NS_KEY_DELETE_RIGHT); + SendMessage(gw->drawingarea, WM_CLEAR, 0, 0); break; case IDM_EDIT_SELECT_ALL: |