- return TRUE;
-}
-
-static HWND _hwnd_next_viewer = NULL;
-
-/*
- * maybe this should be integrated with the default message loop - or maybe not ;-)
- */
-static LRESULT CALLBACK
-_win32_on_clipboard_change (HWND hwnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam)
-{
- switch (message)
- {
- case WM_DESTROY : /* remove us from chain */
- {
- ChangeClipboardChain (hwnd, _hwnd_next_viewer);
- return 0;
- }
- case WM_CHANGECBCHAIN :
- {
- HWND hwndRemove = (HWND) wparam; /* handle of window being removed */
- HWND hwndNext = (HWND) lparam; /* handle of next window in chain */
- if (hwndRemove == _hwnd_next_viewer)
- _hwnd_next_viewer = hwndNext == hwnd ? NULL : hwndNext;
- return 0;
- }
- case WM_DRAWCLIPBOARD :
- {
- /* Create the appropriate gdk events */
-
-#ifdef G_ENABLE_DEBUG
- if ((_gdk_debug_flags & GDK_DEBUG_DND) &&
- OpenClipboard (hwnd))
- {
- HWND hwndOwner = GetClipboardOwner ();
- UINT nFormat = 0;
-
- g_print ("WM_DRAWCLIPBOARD: owner:%p formats: ", hwndOwner);
- for (; 0 != (nFormat = EnumClipboardFormats (nFormat));)
- {
- g_print ("%s ", _gdk_win32_cf_to_string (nFormat));
- }
- g_print ("\n");
- CloseClipboard ();
- }
-#endif
- /* XXX: generate the apropriate GdkEventOwnerChange ... */
-
- /* don't break the chain */
- return PostMessage (_hwnd_next_viewer, message, wparam, lparam);
- }
- default :
- return DefWindowProc (hwnd, message, wparam, lparam);
- }
-}
-
-/*
- * Creates a hidden window and adds it to the clipboard chain
- */
-HWND
-_gdk_win32_register_clipboard_notification (void)
-{
- WNDCLASS wclass;
- HWND hwnd;
- ATOM klass;
-
- memset (&wclass, 0, sizeof(WNDCLASS));
- wclass.lpszClassName = "GdkClipboardNotification";
- wclass.lpfnWndProc = _win32_on_clipboard_change;
- wclass.hInstance = _gdk_app_hmodule;
-
- klass = RegisterClass (&wclass);
- if (!klass)
- return NULL;
-
- hwnd = CreateWindow (MAKEINTRESOURCE(klass),
- NULL, WS_POPUP,
- 0, 0, 0, 0, NULL, NULL,
- _gdk_app_hmodule, NULL);
- if (!hwnd)
- {
- UnregisterClass (MAKEINTRESOURCE(klass), _gdk_app_hmodule);
- return NULL;
- }
- _hwnd_next_viewer = SetClipboardViewer (hwnd);
- return hwnd;