mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
Merge branch 'amolenaar/macos-fix-nsapp-shortcuts' into 'main'
macos: fix in-app native shortcuts (regression) See merge request GNOME/gtk!7178
This commit is contained in:
commit
492940205e
@ -161,7 +161,8 @@ void _gdk_macos_display_send_event (GdkMacosDisp
|
||||
void _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
||||
int x,
|
||||
int y);
|
||||
NSEvent *_gdk_macos_display_pop_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_matching_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_exact_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_last_nsevent (void);
|
||||
GdkDrag *_gdk_macos_display_find_drag (GdkMacosDisplay *self,
|
||||
NSInteger sequence_number);
|
||||
|
@ -994,8 +994,11 @@ _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
||||
CGWarpMouseCursorPosition ((CGPoint) { x, y });
|
||||
}
|
||||
|
||||
/* Find the matching `NSEvent` for an `GdkEvent`. This function
|
||||
* return the `NSEvent`, also for rewritten `GdkEvent`'s.
|
||||
*/
|
||||
NSEvent *
|
||||
_gdk_macos_display_pop_nsevent (GdkEvent *event)
|
||||
_gdk_macos_display_get_matching_nsevent (GdkEvent *event)
|
||||
{
|
||||
for (GList *iter = event_map.head; iter; iter = iter->next)
|
||||
{
|
||||
@ -1005,11 +1008,26 @@ _gdk_macos_display_pop_nsevent (GdkEvent *event)
|
||||
map->gdk_event->device == event->device &&
|
||||
map->gdk_event->time == event->time)
|
||||
{
|
||||
NSEvent *nsevent = map->nsevent;
|
||||
g_queue_unlink (&event_map, iter);
|
||||
gdk_event_unref (map->gdk_event);
|
||||
g_free (map);
|
||||
return nsevent;
|
||||
return map->nsevent;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the matching `NSEvent` for the original `GdkEvent`.
|
||||
* If an event was rewritten, it returns `NULL`.
|
||||
*/
|
||||
NSEvent *
|
||||
_gdk_macos_display_get_exact_nsevent (GdkEvent *event)
|
||||
{
|
||||
for (GList *iter = event_map.head; iter; iter = iter->next)
|
||||
{
|
||||
GdkToNSEventMap *map = iter->data;
|
||||
|
||||
if (map->gdk_event == event)
|
||||
{
|
||||
return map->nsevent;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ gdk_macos_event_source_dispatch (GSource *source,
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
NSEvent *nsevent = _gdk_macos_display_pop_nsevent (event);
|
||||
NSEvent *nsevent = _gdk_macos_display_get_exact_nsevent (event);
|
||||
if (nsevent != NULL)
|
||||
[NSApp sendEvent: nsevent];
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ quartz_filter_keypress (GtkIMContext *context,
|
||||
keyval = gdk_key_event_get_keyval (event);
|
||||
keycode = gdk_key_event_get_keycode (event);
|
||||
|
||||
NSEvent *nsevent = _gdk_macos_display_pop_nsevent ((GdkEvent *)event);
|
||||
NSEvent *nsevent = _gdk_macos_display_get_matching_nsevent ((GdkEvent *)event);
|
||||
|
||||
if (!nsevent)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user