]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix clipboard sharing.
authorToni Wilen <twilen@winuae.net>
Sat, 14 Apr 2018 07:32:39 +0000 (10:32 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 14 Apr 2018 07:32:39 +0000 (10:32 +0300)
od-win32/clipboard_win32.cpp
od-win32/win32.cpp

index e196dba371c44dec928d12ee4e3189d60efa9509..a1a2e2af592082f9ed0db05585dc9d405cac890d 100644 (file)
@@ -951,7 +951,7 @@ int amiga_clipboard_want_data(TrapContext *ctx)
 void clipboard_active(HWND hwnd, int active)
 {
        clipactive = active;
-       if (!initialized)
+       if (!initialized || !hwnd)
                return;
        if (clipactive && clipboard_change) {
                clipboard_read(NULL, hwnd, false);
index d37c0861ba5dcc1e43c71d5b6c6de4ac537c5f06..58b102487be4812ed20b4343108180d1a1f25d4d 100644 (file)
@@ -158,6 +158,7 @@ static int start_data = 0;
 static void *tablet;
 HCURSOR normalcursor;
 static HWND hwndNextViewer;
+static bool clipboard_initialized;
 HANDLE AVTask;
 static int all_events_disabled;
 static int mainthreadid;
@@ -1942,13 +1943,15 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam,
 #endif
                DragAcceptFiles(hWnd, TRUE);
                normalcursor = LoadCursor(NULL, IDC_ARROW);
-               if (mon->monitor_id == 0 && !hwndNextViewer) {
+               if (!clipboard_initialized) {
+                       clipboard_initialized = true;
                        hwndNextViewer = SetClipboardViewer(hWnd);
                        clipboard_init(hWnd);
                }
                return 0;
 
        case WM_DESTROY:
+               clipboard_initialized = false;
                if (device_change_timer)
                        KillTimer(hWnd, 4);
                device_change_timer = 0;
@@ -2258,7 +2261,7 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam,
        break;
 
        case WM_CHANGECBCHAIN:
-               if (mon->monitor_id == 0 && hwndNextViewer) {
+               if (clipboard_initialized) {
                        if ((HWND)wParam == hwndNextViewer)
                                hwndNextViewer = (HWND)lParam;
                        else if (hwndNextViewer != NULL)
@@ -2267,7 +2270,7 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam,
                }
                break;
        case WM_DRAWCLIPBOARD:
-               if (mon->monitor_id == 0 && hwndNextViewer) {
+               if (clipboard_initialized) {
                        clipboard_changed(hWnd);
                        SendMessage(hwndNextViewer, message, wParam, lParam);
                        return 0;