diff --git a/gdk/macos/gdkmacosclipboard-private.h b/gdk/macos/gdkmacosclipboard-private.h index 5679b13a36..4866cf22e0 100644 --- a/gdk/macos/gdkmacosclipboard-private.h +++ b/gdk/macos/gdkmacosclipboard-private.h @@ -27,10 +27,6 @@ G_BEGIN_DECLS -#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER -typedef NSString *NSPasteboardType; -#endif - #define GDK_TYPE_MACOS_CLIPBOARD (_gdk_macos_clipboard_get_type()) G_DECLARE_FINAL_TYPE (GdkMacosClipboard, _gdk_macos_clipboard, GDK, MACOS_CLIPBOARD, GdkClipboard) diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c index 615dcf46e2..09718e999a 100644 --- a/gdk/macos/gdkmacosdisplay-translate.c +++ b/gdk/macos/gdkmacosdisplay-translate.c @@ -1265,6 +1265,14 @@ _gdk_macos_display_translate (GdkMacosDisplay *self, _gdk_macos_display_clear_sorting (self); } } + else if (is_motion_event(event_type)) + { + NSWindow *orig_window = [nsevent window]; + + if (orig_window && GDK_IS_MACOS_WINDOW (orig_window)) + [NSApp sendEvent:nsevent]; + } + return fill_event (self, window, nsevent, x, y); } diff --git a/gdk/macos/gdkmacospasteboard-private.h b/gdk/macos/gdkmacospasteboard-private.h index cac18a8fde..cc7f6b8e47 100644 --- a/gdk/macos/gdkmacospasteboard-private.h +++ b/gdk/macos/gdkmacospasteboard-private.h @@ -26,6 +26,10 @@ G_BEGIN_DECLS +#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER +typedef NSString *NSPasteboardType; +#endif + @interface GdkMacosPasteboardItemDataProvider : NSObject { GdkContentProvider *_contentProvider; diff --git a/gdk/macos/gdkmacospasteboard.c b/gdk/macos/gdkmacospasteboard.c index 0903c5352a..b26248a954 100644 --- a/gdk/macos/gdkmacospasteboard.c +++ b/gdk/macos/gdkmacospasteboard.c @@ -400,7 +400,7 @@ _gdk_macos_pasteboard_register_drag_types (NSWindow *window) gdk_content_formats_get_gtypes (formats, &n_gtypes); if (n_gtypes) - [ret addObject:NSPasteboardTypeURL]; + [ret addObject:PTYPE(URL)]; gdk_content_formats_unref (formats); } diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c index e9150a6a06..f8d6cd992a 100644 --- a/gdk/win32/gdkclipdrop-win32.c +++ b/gdk/win32/gdkclipdrop-win32.c @@ -149,7 +149,7 @@ GTK might also call gdk_clipboard_store_async(), which instructs the W32 backend to put the data into the OS clipboard manager by sending WM_RENDERALLFORMATS to itself and then handling it normally. -Every time W32 backend gets WM_DRAWCLIPBOARD or WM_CLIPBOARDUPDATE, +Every time W32 backend gets WM_CLIPBOARDUPDATE, it calls GetUpdatedClipboardFormats() and GetClipboardSequenceNumber() and caches the results of both. These calls do not require the clipboard to be opened. @@ -245,7 +245,7 @@ When clipboard owner changes, the old owner receives WM_DESTROYCLIPBOARD message the clipboard thread schedules a call to gdk_clipboard_claim_remote() in the main thread, with an empty list of formats, to indicate that the clipboard is now owned by a remote process. -Later the OS will send WM_DRAWCLIPBOARD or WM_CLIPBOARDUPDATE to indicate +Later the OS will send WM_CLIPBOARDUPDATE to indicate the new clipboard contents (see above). DND: @@ -416,8 +416,6 @@ struct _GdkWin32ClipboardThread */ HWND clipboard_opened_for; - HWND hwnd_next_viewer; - /* We can't peek the queue or "unpop" queue items, * so the items that we can't act upon (yet) got * to be stored *somewhere*. @@ -1171,7 +1169,7 @@ inner_clipboard_window_procedure (HWND hwnd, switch (message) { - case WM_DESTROY: /* remove us from chain */ + case WM_DESTROY: /* unregister the clipboard listener */ { if (clipboard_thread_data == NULL) { @@ -1179,34 +1177,15 @@ inner_clipboard_window_procedure (HWND hwnd, return DefWindowProcW (hwnd, message, wparam, lparam); } - ChangeClipboardChain (hwnd, clipboard_thread_data->hwnd_next_viewer); + RemoveClipboardFormatListener (hwnd); PostQuitMessage (0); 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 (clipboard_thread_data == NULL) - { - g_warning ("Clipboard thread got an actionable message with no thread data"); - return DefWindowProcW (hwnd, message, wparam, lparam); - } - - if (hwndRemove == clipboard_thread_data->hwnd_next_viewer) - clipboard_thread_data->hwnd_next_viewer = hwndNext == hwnd ? NULL : hwndNext; - else if (clipboard_thread_data->hwnd_next_viewer != NULL) - return SendMessage (clipboard_thread_data->hwnd_next_viewer, message, wparam, lparam); - - return 0; - } case WM_DESTROYCLIPBOARD: { return 0; } case WM_CLIPBOARDUPDATE: - case WM_DRAWCLIPBOARD: { HWND hwnd_owner; HWND hwnd_opener; @@ -1272,9 +1251,6 @@ inner_clipboard_window_procedure (HWND hwnd, g_idle_add_full (G_PRIORITY_DEFAULT, clipboard_owner_changed, NULL, NULL); } - if (clipboard_thread_data->hwnd_next_viewer != NULL) - return SendMessage (clipboard_thread_data->hwnd_next_viewer, message, wparam, lparam); - /* clear error to avoid confusing SetClipboardViewer() return */ SetLastError (0); @@ -1386,7 +1362,7 @@ inner_clipboard_window_procedure (HWND hwnd, * OpenClipboard() is required/possible */ GDK_NOTE (DND, - g_print (" SetClipboardData (%s, %p)", + g_print (" SetClipboardData (%s, %p)\n", _gdk_win32_cf_to_string (wparam), returned_render->main_thread_data_handle)); @@ -1426,7 +1402,7 @@ _clipboard_window_procedure (HWND hwnd, } /* - * Creates a hidden window and adds it to the clipboard chain + * Creates a hidden window and add a clipboard listener */ static gboolean register_clipboard_notification () @@ -1452,9 +1428,8 @@ register_clipboard_notification () goto failed; SetLastError (0); - clipboard_thread_data->hwnd_next_viewer = SetClipboardViewer (clipboard_thread_data->clipboard_window); - if (clipboard_thread_data->hwnd_next_viewer == NULL && GetLastError() != NO_ERROR) + if (AddClipboardFormatListener (clipboard_thread_data->clipboard_window) == FALSE) { DestroyWindow (clipboard_thread_data->clipboard_window); goto failed; @@ -1462,11 +1437,6 @@ register_clipboard_notification () g_idle_add_full (G_PRIORITY_DEFAULT, clipboard_window_created, (gpointer) clipboard_thread_data->clipboard_window, NULL); - /* FIXME: http://msdn.microsoft.com/en-us/library/ms649033(v=VS.85).aspx */ - /* This is only supported by Vista, and not yet by mingw64 */ - /* if (AddClipboardFormatListener (hwnd) == FALSE) */ - /* goto failed; */ - return TRUE; failed: diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index d0f6a5bf49..65c8e28a98 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -548,6 +548,9 @@ _gdk_win32_display_open (const char *display_name) g_signal_emit_by_name (_gdk_display, "opened"); + /* Precalculate keymap, see #6203 */ + (void) _gdk_win32_display_get_keymap (_gdk_display); + GDK_NOTE (MISC, g_print ("... _gdk_display now set up\n")); return _gdk_display; @@ -1170,6 +1173,9 @@ gdk_win32_display_get_setting (GdkDisplay *display, const char *name, GValue *value) { + if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS) + return FALSE; + return _gdk_win32_get_setting (name, value); } diff --git a/gtk/gtkapplication-quartz.c b/gtk/gtkapplication-quartz.c index 6ac74a4f07..8639b09bf1 100644 --- a/gtk/gtkapplication-quartz.c +++ b/gtk/gtkapplication-quartz.c @@ -57,14 +57,12 @@ typedef struct G_DEFINE_TYPE (GtkApplicationImplQuartz, gtk_application_impl_quartz, GTK_TYPE_APPLICATION_IMPL) -@interface GtkApplicationQuartzDelegate : NSObject +@interface GtkApplicationQuartzDelegate : NSObject { GtkApplicationImplQuartz *quartz; } - (id)initWithImpl:(GtkApplicationImplQuartz*)impl; -- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender; -- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames; @end @implementation GtkApplicationQuartzDelegate @@ -114,6 +112,11 @@ G_DEFINE_TYPE (GtkApplicationImplQuartz, gtk_application_impl_quartz, GTK_TYPE_A [theApplication replyToOpenOrPrint:NSApplicationDelegateReplySuccess]; } + +- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app +{ + return YES; +} @end /* these exist only for accel handling */ diff --git a/testsuite/gdk/meson.build b/testsuite/gdk/meson.build index 2cc27d5eb7..72197266fe 100644 --- a/testsuite/gdk/meson.build +++ b/testsuite/gdk/meson.build @@ -13,9 +13,7 @@ tests = [ { 'name': 'contentformats' }, { 'name': 'contentserializer' }, { 'name': 'cursor' }, - { 'name': 'display' }, { 'name': 'displaymanager' }, - { 'name': 'encoding' }, { 'name': 'glcontext' }, { 'name': 'keysyms' }, { 'name': 'memorytexture' }, @@ -27,6 +25,13 @@ tests = [ { 'name': 'popuplayout' }, ] +if x11_enabled + tests += [ + { 'name': 'display' }, + { 'name': 'encoding' }, + ] +endif + foreach t : tests test_name = t.get('name') test_exe = executable(test_name, diff --git a/testsuite/gtk/icontheme.c b/testsuite/gtk/icontheme.c index 31c9b1cb40..43b6708a8a 100644 --- a/testsuite/gtk/icontheme.c +++ b/testsuite/gtk/icontheme.c @@ -59,7 +59,7 @@ assert_icon_lookup_size (const char *icon_name, { GtkIconPaintable *info; GFile *file; - char *path = NULL; + char *uri = NULL; if (fallbacks) { @@ -83,26 +83,26 @@ assert_icon_lookup_size (const char *icon_name, file = gtk_icon_paintable_get_file (info); if (file) { - path = g_file_get_path (file); + uri = g_file_get_uri (file); g_object_unref (file); } if (filename) { - if (path == NULL || !g_str_has_suffix (path, filename)) + if (uri == NULL || !g_str_has_suffix (uri, filename)) { g_error ("Icon for \"%s\" with flags %s at size %d should be \"...%s\" but is \"...%s\"", icon_name, lookup_flags_to_string (flags), size, - filename, path); + filename, uri); return; } } else { - g_assert_null (path); + g_assert_null (uri); } - g_free (path); + g_free (uri); g_assert_cmpint (gdk_paintable_get_intrinsic_width (GDK_PAINTABLE (info)), ==, size); diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build index 12b025f317..744738da74 100644 --- a/testsuite/gtk/meson.build +++ b/testsuite/gtk/meson.build @@ -100,12 +100,17 @@ tests = [ { 'name': 'treesorter' }, { 'name': 'treeview' }, { 'name': 'typename' }, - { 'name': 'displayclose' }, { 'name': 'revealer-size' }, { 'name': 'widgetorder' }, { 'name': 'widget-refcount' }, ] +if x11_enabled + tests += [ + { 'name': 'displayclose' }, + ] +endif + # Tests that test private apis and therefore are linked against libgtk-4.a internal_tests = [ { 'name': 'bitmask' },