forked from AuroraMiddleware/gtk
macos: check for best_monitor before using
Make sure we have a monitor to enqueue/dequeue from before using it. That also allows us to use this from destroy and what-not.
This commit is contained in:
parent
c7a6d1e8bf
commit
7369ce58da
@ -72,9 +72,12 @@ _gdk_macos_surface_request_frame (GdkMacosSurface *self)
|
|||||||
if (self->awaiting_frame)
|
if (self->awaiting_frame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self->awaiting_frame = TRUE;
|
if (self->best_monitor != NULL)
|
||||||
_gdk_macos_monitor_add_frame_callback (GDK_MACOS_MONITOR (self->best_monitor), self);
|
{
|
||||||
gdk_surface_freeze_updates (GDK_SURFACE (self));
|
self->awaiting_frame = TRUE;
|
||||||
|
_gdk_macos_monitor_add_frame_callback (GDK_MACOS_MONITOR (self->best_monitor), self);
|
||||||
|
gdk_surface_freeze_updates (GDK_SURFACE (self));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -85,9 +88,12 @@ _gdk_macos_surface_cancel_frame (GdkMacosSurface *self)
|
|||||||
if (!self->awaiting_frame)
|
if (!self->awaiting_frame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self->awaiting_frame = FALSE;
|
if (self->best_monitor != NULL)
|
||||||
_gdk_macos_monitor_remove_frame_callback (GDK_MACOS_MONITOR (self->best_monitor), self);
|
{
|
||||||
gdk_surface_thaw_updates (GDK_SURFACE (self));
|
self->awaiting_frame = FALSE;
|
||||||
|
_gdk_macos_monitor_remove_frame_callback (GDK_MACOS_MONITOR (self->best_monitor), self);
|
||||||
|
gdk_surface_thaw_updates (GDK_SURFACE (self));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -199,7 +205,9 @@ gdk_macos_surface_hide (GdkSurface *surface)
|
|||||||
|
|
||||||
self->show_on_next_swap = FALSE;
|
self->show_on_next_swap = FALSE;
|
||||||
|
|
||||||
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
|
_gdk_macos_surface_cancel_frame (self);
|
||||||
|
|
||||||
|
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
||||||
was_key = [self->window isKeyWindow];
|
was_key = [self->window isKeyWindow];
|
||||||
|
|
||||||
seat = gdk_display_get_default_seat (surface->display);
|
seat = gdk_display_get_default_seat (surface->display);
|
||||||
@ -222,13 +230,6 @@ gdk_macos_surface_hide (GdkSurface *surface)
|
|||||||
[parentWindow showAndMakeKey:YES];
|
[parentWindow showAndMakeKey:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->awaiting_frame)
|
|
||||||
{
|
|
||||||
self->awaiting_frame = FALSE;
|
|
||||||
_gdk_macos_monitor_remove_frame_callback (GDK_MACOS_MONITOR (self->best_monitor), self);
|
|
||||||
gdk_surface_freeze_updates (surface);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -469,16 +470,8 @@ gdk_macos_surface_destroy (GdkSurface *surface,
|
|||||||
GdkMacosWindow *window = g_steal_pointer (&self->window);
|
GdkMacosWindow *window = g_steal_pointer (&self->window);
|
||||||
GdkFrameClock *frame_clock;
|
GdkFrameClock *frame_clock;
|
||||||
|
|
||||||
if (self->best_monitor)
|
_gdk_macos_surface_cancel_frame (self);
|
||||||
{
|
g_clear_object (&self->best_monitor);
|
||||||
if (self->awaiting_frame)
|
|
||||||
{
|
|
||||||
_gdk_macos_monitor_remove_frame_callback (GDK_MACOS_MONITOR (self->best_monitor), self);
|
|
||||||
self->awaiting_frame = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_object (&self->best_monitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self))))
|
if ((frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self))))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user