[gtk/wip/chergert/quartz4u: 79/142] macos: move popup-layout-changed signal emission lower
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/quartz4u: 79/142] macos: move popup-layout-changed signal emission lower
- Date: Tue, 23 Jun 2020 18:36:21 +0000 (UTC)
commit 804d6f9dc191863e2ac483cced388c9bcca7cc94
Author: Christian Hergert <chergert redhat com>
Date: Tue May 19 16:59:14 2020 -0700
macos: move popup-layout-changed signal emission lower
This will now fire when we get position updates
gdk/macos/GdkMacosWindow.c | 5 ++++-
gdk/macos/gdkmacospopupsurface.c | 6 +-----
gdk/macos/gdkmacossurface-private.h | 2 ++
gdk/macos/gdkmacossurface.c | 15 ++++++++-------
gdk/macos/gdkmacostoplevelsurface.c | 2 ++
5 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/gdk/macos/GdkMacosWindow.c b/gdk/macos/GdkMacosWindow.c
index 7be84c515c..c9dae2364f 100644
--- a/gdk/macos/GdkMacosWindow.c
+++ b/gdk/macos/GdkMacosWindow.c
@@ -195,6 +195,7 @@
GdkDisplay *display = gdk_surface_get_display (surface);
gboolean maximized = (surface->state & GDK_SURFACE_STATE_MAXIMIZED) != 0;
GdkEvent *event;
+ GList *node;
/* In case the window is changed when maximized remove the maximized state */
if (maximized && !inMaximizeTransition && !NSEqualRects (lastMaximizedFrame, [self frame]))
@@ -203,7 +204,9 @@
_gdk_macos_surface_update_position (gdk_surface);
event = gdk_configure_event_new (surface, surface->width, surface->height);
- _gdk_event_queue_append (GDK_DISPLAY (display), event);
+ node = _gdk_event_queue_append (GDK_DISPLAY (display), event);
+ _gdk_windowing_got_event (display, node, event,
+ _gdk_display_get_next_serial (display));
[self checkSendEnterNotify];
}
diff --git a/gdk/macos/gdkmacospopupsurface.c b/gdk/macos/gdkmacospopupsurface.c
index 84c0183b18..632f71eca6 100644
--- a/gdk/macos/gdkmacospopupsurface.c
+++ b/gdk/macos/gdkmacospopupsurface.c
@@ -31,7 +31,6 @@
struct _GdkMacosPopupSurface
{
GdkMacosSurface parent_instance;
- guint did_initial_present : 1;
};
struct _GdkMacosPopupSurfaceClass
@@ -76,9 +75,6 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
else
return;
- if (self->did_initial_present)
- g_signal_emit_by_name (self, "popup-layout-changed");
-
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
}
@@ -112,7 +108,7 @@ gdk_macos_popup_surface_present (GdkPopup *popup,
gdk_macos_popup_surface_layout (self, width, height, layout);
- self->did_initial_present = TRUE;
+ GDK_MACOS_SURFACE (self)->did_initial_present = TRUE;
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)))
return TRUE;
diff --git a/gdk/macos/gdkmacossurface-private.h b/gdk/macos/gdkmacossurface-private.h
index 6bad486d39..9a7e69391e 100644
--- a/gdk/macos/gdkmacossurface-private.h
+++ b/gdk/macos/gdkmacossurface-private.h
@@ -56,6 +56,8 @@ struct _GdkMacosSurface
int shadow_left;
gint64 pending_frame_counter;
+
+ guint did_initial_present : 1;
};
struct _GdkMacosSurfaceClass
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index c6e997ffa6..cad4275800 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -614,8 +614,6 @@ _gdk_macos_surface_update_fullscreen_state (GdkMacosSurface *self)
void
_gdk_macos_surface_update_position (GdkMacosSurface *self)
{
- GDK_BEGIN_MACOS_ALLOC_POOL;
-
GdkSurface *surface = GDK_SURFACE (self);
GdkDisplay *display = gdk_surface_get_display (surface);
NSRect frame_rect = [self->window frame];
@@ -626,7 +624,8 @@ _gdk_macos_surface_update_position (GdkMacosSurface *self)
content_rect.origin.y + content_rect.size.height,
&surface->x, &surface->y);
- GDK_END_MACOS_ALLOC_POOL;
+ if (GDK_IS_POPUP (self) && self->did_initial_present)
+ g_signal_emit_by_name (self, "popup-layout-changed");
}
void
@@ -797,6 +796,9 @@ _gdk_macos_surface_move_resize (GdkMacosSurface *self,
{
GdkSurface *surface = (GdkSurface *)self;
GdkDisplay *display;
+ GdkEvent *event;
+ GList *node;
+ gboolean size_changed;
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
@@ -814,6 +816,8 @@ _gdk_macos_surface_move_resize (GdkMacosSurface *self,
if (height == -1)
height = surface->height;
+ size_changed = height != surface->height || width != surface->width;
+
surface->x = x;
surface->y = y;
@@ -823,11 +827,8 @@ _gdk_macos_surface_move_resize (GdkMacosSurface *self,
[self->window setFrame:NSMakeRect(x, y - height, width, height)
display:YES];
- if (surface->width != width || surface->height != height)
+ if (size_changed)
{
- GdkEvent *event;
- GList *node;
-
gdk_surface_invalidate_rect (surface, NULL);
event = gdk_configure_event_new (surface, width, height);
diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c
index 65dcf5e1ee..6de799914b 100644
--- a/gdk/macos/gdkmacostoplevelsurface.c
+++ b/gdk/macos/gdkmacostoplevelsurface.c
@@ -146,6 +146,8 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
_gdk_macos_surface_show (GDK_MACOS_SURFACE (self));
+ GDK_MACOS_SURFACE (self)->did_initial_present = TRUE;
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]