app: Fix key presses not working on mac

Part fixes #9322. This was making GIMP on MacOS unusable.
This commit is contained in:
Lukas Oberhuber 2023-07-02 15:57:44 +01:00
parent 780cda6f72
commit df4ed9c1ec
4 changed files with 2 additions and 46 deletions

View File

@ -26,7 +26,6 @@
#ifdef GDK_WINDOWING_QUARTZ
#import <AppKit/AppKit.h>
#include <gtkosxapplication.h>
#endif
#include "gui/gui-types.h"
@ -262,30 +261,6 @@ gui_unique_quartz_idle_open (GFile *file)
return FALSE;
}
static gboolean
gui_unique_quartz_nsopen_file_callback (GtkosxApplication *osx_app,
gchar *path,
gpointer user_data)
{
GSource *source;
GClosure *closure;
closure = g_cclosure_new (G_CALLBACK (gui_unique_quartz_idle_open),
g_file_new_for_path (path),
(GClosureNotify) g_object_unref);
g_object_watch_closure (G_OBJECT (unique_gimp), closure);
source = g_idle_source_new ();
g_source_set_priority (source, G_PRIORITY_LOW);
g_source_set_closure (source, closure);
g_source_attach (source, NULL);
g_source_unref (source);
return TRUE;
}
@implementation GimpAppleEventHandler
- (void) handleEvent: (NSAppleEventDescriptor *) inEvent
andReplyWith: (NSAppleEventDescriptor *) replyEvent
@ -328,19 +303,11 @@ gui_unique_quartz_nsopen_file_callback (GtkosxApplication *osx_app,
static void
gui_unique_quartz_init (Gimp *gimp)
{
GtkosxApplication *osx_app;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (unique_gimp == NULL);
osx_app = gtkosx_application_get ();
unique_gimp = gimp;
g_signal_connect (osx_app, "NSApplicationOpenFile",
G_CALLBACK (gui_unique_quartz_nsopen_file_callback),
gimp);
/* Using the event handler is a hack, it is necessary because
* gtkosx_application will drop the file open events if any
* event processing is done before gtkosx_application_ready is

View File

@ -31,7 +31,7 @@ libappgui = static_library('appgui',
include_directories: [ rootInclude, rootAppInclude, ],
c_args: '-DG_LOG_DOMAIN="Gimp-GUI"',
dependencies: [
cairo, gegl, gdk_pixbuf, gio_specific, gtk3, gtk3_macos
cairo, gegl, gdk_pixbuf, gio_specific, gtk3
],
install: false,
)

View File

@ -185,7 +185,7 @@ libgimpwidgets_introspectable = [
libgimpwidgets_headers_introspectable,
]
if gtk3_macos.found()
if platform_osx
libgimpwidgets_sources += [
'gimppickbutton-quartz.c',
]

View File

@ -1149,17 +1149,6 @@ if not lua.found() and have_lua
endif
# Check for GTK Mac Integration
if platform_osx and (gtk3.get_variable(pkgconfig: 'targets').contains('quartz'))
# Support for homebrew version of gtk-mac-integration
gtk3_macos = dependency('gtk-mac-integration-gtk3', version: '>=3.0.1', required: false)
if not gtk3_macos.found()
gtk3_macos = dependency('gtk-mac-integration', version: '>=3.0.1')
endif
else
gtk3_macos = no_dep
endif
# Check for XML tools
xmllint = find_program('xmllint', required: false)
xsltproc = find_program('xsltproc')