broadway: Track popups
This is more or less a 1:1 copy of the X11 code.
This commit is contained in:
@@ -288,6 +288,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
|||||||
surface->x = message->configure_notify.x;
|
surface->x = message->configure_notify.x;
|
||||||
surface->y = message->configure_notify.y;
|
surface->y = message->configure_notify.y;
|
||||||
|
|
||||||
|
gdk_broadway_surface_update_popups (surface);
|
||||||
|
|
||||||
event = gdk_event_new (GDK_CONFIGURE);
|
event = gdk_event_new (GDK_CONFIGURE);
|
||||||
event->any.surface = g_object_ref (surface);
|
event->any.surface = g_object_ref (surface);
|
||||||
event->configure.x = message->configure_notify.x;
|
event->configure.x = message->configure_notify.x;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ void _gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
|||||||
void _gdk_broadway_surface_grab_check_destroy (GdkSurface *surface);
|
void _gdk_broadway_surface_grab_check_destroy (GdkSurface *surface);
|
||||||
void _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
|
void _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
|
||||||
gulong serial);
|
gulong serial);
|
||||||
|
void gdk_broadway_surface_update_popups (GdkSurface *surface);
|
||||||
|
|
||||||
void _gdk_keymap_keys_changed (GdkDisplay *display);
|
void _gdk_keymap_keys_changed (GdkDisplay *display);
|
||||||
gint _gdk_broadway_get_group_for_state (GdkDisplay *display,
|
gint _gdk_broadway_get_group_for_state (GdkDisplay *display,
|
||||||
|
|||||||
@@ -66,13 +66,21 @@ gdk_broadway_surface_init (GdkBroadwaySurface *impl)
|
|||||||
static void
|
static void
|
||||||
gdk_broadway_surface_finalize (GObject *object)
|
gdk_broadway_surface_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
|
GdkSurface *surface;
|
||||||
GdkBroadwaySurface *impl;
|
GdkBroadwaySurface *impl;
|
||||||
GdkBroadwayDisplay *broadway_display;
|
GdkBroadwayDisplay *broadway_display;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_BROADWAY_SURFACE (object));
|
g_return_if_fail (GDK_IS_BROADWAY_SURFACE (object));
|
||||||
|
|
||||||
|
surface = GDK_SURFACE (object);
|
||||||
impl = GDK_BROADWAY_SURFACE (object);
|
impl = GDK_BROADWAY_SURFACE (object);
|
||||||
|
|
||||||
|
if (surface->parent)
|
||||||
|
{
|
||||||
|
GdkBroadwaySurface *parent_impl = GDK_BROADWAY_SURFACE (surface->parent);
|
||||||
|
parent_impl->popups = g_list_remove (parent_impl->popups, surface);
|
||||||
|
}
|
||||||
|
|
||||||
_gdk_broadway_surface_grab_check_destroy (GDK_SURFACE (impl));
|
_gdk_broadway_surface_grab_check_destroy (GDK_SURFACE (impl));
|
||||||
|
|
||||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (GDK_SURFACE (impl)));
|
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (GDK_SURFACE (impl)));
|
||||||
@@ -225,13 +233,17 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
|
|||||||
surface->surface_type == GDK_SURFACE_TEMP);
|
surface->surface_type == GDK_SURFACE_TEMP);
|
||||||
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), surface);
|
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), surface);
|
||||||
|
|
||||||
g_assert (surface->surface_type == GDK_SURFACE_TOPLEVEL ||
|
if (!surface->parent)
|
||||||
surface->surface_type == GDK_SURFACE_TEMP);
|
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
|
||||||
|
|
||||||
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
|
|
||||||
|
|
||||||
connect_frame_clock (surface);
|
connect_frame_clock (surface);
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
GdkBroadwaySurface *parent_impl = GDK_BROADWAY_SURFACE (parent);
|
||||||
|
parent_impl->popups = g_list_prepend (parent_impl->popups, surface);
|
||||||
|
}
|
||||||
|
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,6 +406,12 @@ gdk_broadway_surface_move_resize (GdkSurface *surface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (surface->parent)
|
||||||
|
{
|
||||||
|
impl->offset_x = x - surface->parent->x;
|
||||||
|
impl->offset_y = y - surface->parent->y;
|
||||||
|
}
|
||||||
|
|
||||||
_gdk_broadway_server_surface_move_resize (broadway_display->server,
|
_gdk_broadway_server_surface_move_resize (broadway_display->server,
|
||||||
impl->id,
|
impl->id,
|
||||||
with_move,
|
with_move,
|
||||||
@@ -797,6 +815,25 @@ gdk_broadway_surface_set_functions (GdkSurface *surface,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdk_broadway_surface_update_popups (GdkSurface *parent)
|
||||||
|
{
|
||||||
|
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (parent);
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
for (l = impl->popups; l; l = l->next)
|
||||||
|
{
|
||||||
|
GdkBroadwaySurface *popup_impl = l->data;
|
||||||
|
GdkSurface *popup = GDK_SURFACE (popup_impl);
|
||||||
|
int new_x = parent->x + popup_impl->offset_x;
|
||||||
|
int new_y = parent->y + popup_impl->offset_y;
|
||||||
|
|
||||||
|
if (new_x != popup->x || new_y != popup->y)
|
||||||
|
gdk_broadway_surface_move_resize (popup, TRUE, new_x, new_y, popup->width, popup->height);
|
||||||
|
gdk_broadway_surface_restack_toplevel (popup, parent, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct _MoveResizeData MoveResizeData;
|
typedef struct _MoveResizeData MoveResizeData;
|
||||||
|
|
||||||
struct _MoveResizeData
|
struct _MoveResizeData
|
||||||
@@ -1189,7 +1226,7 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
|
|||||||
mv_resize->is_resize = TRUE;
|
mv_resize->is_resize = TRUE;
|
||||||
mv_resize->moveresize_button = button;
|
mv_resize->moveresize_button = button;
|
||||||
mv_resize->resize_edge = edge;
|
mv_resize->resize_edge = edge;
|
||||||
mv_resize->moveresize_x = x + surface->x;
|
mv_resize->moveresize_x = x + surface->x;
|
||||||
mv_resize->moveresize_y = y + surface->y;
|
mv_resize->moveresize_y = y + surface->y;
|
||||||
mv_resize->moveresize_surface = g_object_ref (surface);
|
mv_resize->moveresize_surface = g_object_ref (surface);
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ struct _GdkBroadwaySurface
|
|||||||
|
|
||||||
GArray *node_data;
|
GArray *node_data;
|
||||||
GPtrArray *node_data_textures;
|
GPtrArray *node_data_textures;
|
||||||
|
|
||||||
|
int offset_x;
|
||||||
|
int offset_y;
|
||||||
|
|
||||||
|
GList *popups;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkBroadwaySurfaceClass
|
struct _GdkBroadwaySurfaceClass
|
||||||
|
|||||||
Reference in New Issue
Block a user