forked from AuroraMiddleware/gtk
wayland: emit ::enter/leave-monitor
These signals directly mirror the surface_enter/leave events of the Wayland protocol, so this is very staightforward.
This commit is contained in:
parent
3ee18b88b9
commit
209398d736
@ -2539,6 +2539,13 @@ get_monitor_for_output (GdkWaylandDisplay *display_wayland,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GdkMonitor *
|
||||||
|
gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
|
||||||
|
struct wl_output *output)
|
||||||
|
{
|
||||||
|
return (GdkMonitor *)get_monitor_for_output (GDK_WAYLAND_DISPLAY (display), output);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_display_remove_output (GdkWaylandDisplay *display_wayland,
|
gdk_wayland_display_remove_output (GdkWaylandDisplay *display_wayland,
|
||||||
guint32 id)
|
guint32 id)
|
||||||
|
@ -163,6 +163,8 @@ guint32 gdk_wayland_display_get_output_scale (GdkWaylandDisplay *display_wayland
|
|||||||
struct wl_output *output);
|
struct wl_output *output);
|
||||||
struct wl_output *gdk_wayland_display_get_wl_output (GdkDisplay *display,
|
struct wl_output *gdk_wayland_display_get_wl_output (GdkDisplay *display,
|
||||||
int monitor_num);
|
int monitor_num);
|
||||||
|
GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
|
||||||
|
struct wl_output *output);
|
||||||
|
|
||||||
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
|
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
|
||||||
GdkSeat *seat);
|
GdkSeat *seat);
|
||||||
|
@ -1201,6 +1201,8 @@ surface_enter (void *data,
|
|||||||
{
|
{
|
||||||
GdkSurface *surface = GDK_SURFACE (data);
|
GdkSurface *surface = GDK_SURFACE (data);
|
||||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||||
|
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||||
|
GdkMonitor *monitor;
|
||||||
|
|
||||||
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
|
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
|
||||||
g_message ("surface enter, surface %p output %p", surface, output));
|
g_message ("surface enter, surface %p output %p", surface, output));
|
||||||
@ -1208,6 +1210,9 @@ surface_enter (void *data,
|
|||||||
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
|
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
|
||||||
|
|
||||||
gdk_wayland_surface_update_scale (surface);
|
gdk_wayland_surface_update_scale (surface);
|
||||||
|
|
||||||
|
monitor = gdk_wayland_display_get_monitor_for_output (display, output);
|
||||||
|
gdk_surface_enter_monitor (surface, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1217,6 +1222,8 @@ surface_leave (void *data,
|
|||||||
{
|
{
|
||||||
GdkSurface *surface = GDK_SURFACE (data);
|
GdkSurface *surface = GDK_SURFACE (data);
|
||||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||||
|
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||||
|
GdkMonitor *monitor;
|
||||||
|
|
||||||
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
|
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
|
||||||
g_message ("surface leave, surface %p output %p", surface, output));
|
g_message ("surface leave, surface %p output %p", surface, output));
|
||||||
@ -1225,6 +1232,9 @@ surface_leave (void *data,
|
|||||||
|
|
||||||
if (impl->display_server.outputs)
|
if (impl->display_server.outputs)
|
||||||
gdk_wayland_surface_update_scale (surface);
|
gdk_wayland_surface_update_scale (surface);
|
||||||
|
|
||||||
|
monitor = gdk_wayland_display_get_monitor_for_output (display, output);
|
||||||
|
gdk_surface_leave_monitor (surface, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_surface_listener surface_listener = {
|
static const struct wl_surface_listener surface_listener = {
|
||||||
|
Loading…
Reference in New Issue
Block a user