mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 07:04:29 +00:00
Merge branch 'wip/chergert/gdk-macos-fixes' into 'master'
GTK4: fix macos device state query for surfaces See merge request GNOME/gtk!2690
This commit is contained in:
commit
85394b04e0
@ -1179,7 +1179,8 @@ _gdk_macos_display_synthesize_motion (GdkMacosDisplay *self,
|
||||
y,
|
||||
NULL);
|
||||
node = _gdk_event_queue_append (GDK_DISPLAY (self), event);
|
||||
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event, 0);
|
||||
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event,
|
||||
_gdk_display_get_next_serial (GDK_DISPLAY (self)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -380,7 +380,8 @@ gdk_macos_display_sync (GdkDisplay *display)
|
||||
static gulong
|
||||
gdk_macos_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
return 0;
|
||||
static gulong serial = 0;
|
||||
return ++serial;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -437,7 +438,7 @@ gdk_macos_display_queue_events (GdkDisplay *display)
|
||||
_gdk_windowing_got_event (GDK_DISPLAY (self),
|
||||
_gdk_event_queue_append (GDK_DISPLAY (self), event),
|
||||
event,
|
||||
0);
|
||||
_gdk_display_get_next_serial (GDK_DISPLAY (self)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -900,7 +901,8 @@ _gdk_macos_display_break_all_grabs (GdkMacosDisplay *self,
|
||||
grab->surface,
|
||||
TRUE);
|
||||
node = _gdk_event_queue_append (GDK_DISPLAY (self), event);
|
||||
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event, 0);
|
||||
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event,
|
||||
_gdk_display_get_next_serial (GDK_DISPLAY (self)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,8 +238,6 @@ gdk_macos_surface_get_device_state (GdkSurface *surface,
|
||||
GdkDisplay *display;
|
||||
NSWindow *nswindow;
|
||||
NSPoint point;
|
||||
int x_tmp;
|
||||
int y_tmp;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (surface));
|
||||
g_assert (GDK_IS_MACOS_DEVICE (device));
|
||||
@ -247,18 +245,20 @@ gdk_macos_surface_get_device_state (GdkSurface *surface,
|
||||
g_assert (y != NULL);
|
||||
g_assert (mask != NULL);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return FALSE;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (surface));
|
||||
point = [nswindow mouseLocationOutsideOfEventStream];
|
||||
|
||||
_gdk_macos_display_from_display_coords (GDK_MACOS_DISPLAY (display),
|
||||
point.x, point.y,
|
||||
&x_tmp, &y_tmp);
|
||||
*mask = _gdk_macos_display_get_current_keyboard_modifiers (GDK_MACOS_DISPLAY (display))
|
||||
| _gdk_macos_display_get_current_mouse_modifiers (GDK_MACOS_DISPLAY (display));
|
||||
|
||||
*x = x_tmp;
|
||||
*y = x_tmp;
|
||||
*x = point.x;
|
||||
*y = point.y - surface->height;
|
||||
|
||||
return TRUE;
|
||||
return *x >= 0 && *y >= 0 && *x < surface->width && *y < surface->height;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -516,8 +516,12 @@ gtk_file_chooser_native_quartz_show (GtkFileChooserNative *self)
|
||||
transient_for = gtk_native_dialog_get_transient_for (GTK_NATIVE_DIALOG (self));
|
||||
if (transient_for)
|
||||
{
|
||||
GtkNative *native = GTK_NATIVE (transient_for);
|
||||
GdkSurface *surface = gtk_native_get_surface (native);
|
||||
NSWindow *window = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (surface));
|
||||
|
||||
gtk_widget_realize (GTK_WIDGET (transient_for));
|
||||
data->parent = _gdk_macos_surface_get_native (gtk_native_get_surface (GTK_NATIVE (transient_for)));
|
||||
data->parent = window;
|
||||
|
||||
if (gtk_native_dialog_get_modal (GTK_NATIVE_DIALOG (self)))
|
||||
data->modal = TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user