From 95b8d129508ccdec5eadabf46eb313b49a6b4369 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 9 May 2019 23:11:05 +0100 Subject: 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. --- frontends/windows/window.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'frontends/windows/window.c') 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: -- cgit v1.2.3