mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
wayland: Make gtk_shell handle our private window states
Instead of using the "allocated" state ranges of xdg_shell, lets just use our own gtk_shell by adding a state enum and a configure event. https://bugzilla.gnome.org/show_bug.cgi?id=769936
This commit is contained in:
parent
cfb3d10e1b
commit
a8d86b4876
@ -40,6 +40,7 @@ typedef struct _MetaWaylandGtkSurface
|
|||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
MetaWaylandSurface *surface;
|
MetaWaylandSurface *surface;
|
||||||
gboolean is_modal;
|
gboolean is_modal;
|
||||||
|
gulong configure_handler_id;
|
||||||
} MetaWaylandGtkSurface;
|
} MetaWaylandGtkSurface;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -48,8 +49,12 @@ gtk_surface_destructor (struct wl_resource *resource)
|
|||||||
MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
|
MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
if (gtk_surface->surface)
|
if (gtk_surface->surface)
|
||||||
g_object_steal_qdata (G_OBJECT (gtk_surface->surface),
|
{
|
||||||
quark_gtk_surface_data);
|
g_object_steal_qdata (G_OBJECT (gtk_surface->surface),
|
||||||
|
quark_gtk_surface_data);
|
||||||
|
g_signal_handler_disconnect (gtk_surface->surface,
|
||||||
|
gtk_surface->configure_handler_id);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (gtk_surface);
|
g_free (gtk_surface);
|
||||||
}
|
}
|
||||||
@ -142,6 +147,34 @@ gtk_surface_surface_destroyed (MetaWaylandGtkSurface *gtk_surface)
|
|||||||
gtk_surface->surface = NULL;
|
gtk_surface->surface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_states (struct wl_array *states,
|
||||||
|
MetaWindow *window)
|
||||||
|
{
|
||||||
|
uint32_t *s;
|
||||||
|
|
||||||
|
if (window->tile_mode == META_TILE_LEFT ||
|
||||||
|
window->tile_mode == META_TILE_RIGHT)
|
||||||
|
{
|
||||||
|
s = wl_array_add (states, sizeof *s);
|
||||||
|
*s = GTK_SURFACE1_STATE_TILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_configure (MetaWaylandSurface *surface,
|
||||||
|
MetaWaylandGtkSurface *gtk_surface)
|
||||||
|
{
|
||||||
|
struct wl_array states;
|
||||||
|
|
||||||
|
wl_array_init (&states);
|
||||||
|
fill_states (&states, surface->window);
|
||||||
|
|
||||||
|
gtk_surface1_send_configure (gtk_surface->resource, &states);
|
||||||
|
|
||||||
|
wl_array_release (&states);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_shell_get_gtk_surface (struct wl_client *client,
|
gtk_shell_get_gtk_surface (struct wl_client *client,
|
||||||
struct wl_resource *resource,
|
struct wl_resource *resource,
|
||||||
@ -170,6 +203,11 @@ gtk_shell_get_gtk_surface (struct wl_client *client,
|
|||||||
&meta_wayland_gtk_surface_interface,
|
&meta_wayland_gtk_surface_interface,
|
||||||
gtk_surface, gtk_surface_destructor);
|
gtk_surface, gtk_surface_destructor);
|
||||||
|
|
||||||
|
gtk_surface->configure_handler_id = g_signal_connect (surface,
|
||||||
|
"configure",
|
||||||
|
G_CALLBACK (on_configure),
|
||||||
|
gtk_surface);
|
||||||
|
|
||||||
g_object_set_qdata_full (G_OBJECT (surface),
|
g_object_set_qdata_full (G_OBJECT (surface),
|
||||||
quark_gtk_surface_data,
|
quark_gtk_surface_data,
|
||||||
gtk_surface,
|
gtk_surface,
|
||||||
|
@ -35,13 +35,6 @@
|
|||||||
#include "wayland/meta-window-wayland.h"
|
#include "wayland/meta-window-wayland.h"
|
||||||
#include "xdg-shell-unstable-v5-server-protocol.h"
|
#include "xdg-shell-unstable-v5-server-protocol.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Define GNOME additional states to xdg-shell
|
|
||||||
* The current reserved range for GNOME is 0x1000 - 0x1FFF
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define XDG_SURFACE_STATE_GNOME_TILED 0x1000
|
|
||||||
|
|
||||||
struct _MetaWaylandXdgSurface
|
struct _MetaWaylandXdgSurface
|
||||||
{
|
{
|
||||||
MetaWaylandSurfaceRoleShellSurface parent;
|
MetaWaylandSurfaceRoleShellSurface parent;
|
||||||
@ -406,13 +399,6 @@ fill_states (struct wl_array *states, MetaWindow *window)
|
|||||||
s = wl_array_add (states, sizeof *s);
|
s = wl_array_add (states, sizeof *s);
|
||||||
*s = XDG_SURFACE_STATE_ACTIVATED;
|
*s = XDG_SURFACE_STATE_ACTIVATED;
|
||||||
}
|
}
|
||||||
/* GNOME extension to xdg-shell states */
|
|
||||||
if (window->tile_mode == META_TILE_LEFT ||
|
|
||||||
window->tile_mode == META_TILE_RIGHT)
|
|
||||||
{
|
|
||||||
s = wl_array_add (states, sizeof *s);
|
|
||||||
*s = XDG_SURFACE_STATE_GNOME_TILED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -46,6 +46,16 @@
|
|||||||
<request name="present">
|
<request name="present">
|
||||||
<arg name="time" type="uint"/>
|
<arg name="time" type="uint"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
|
<!-- Version 2 additions -->
|
||||||
|
|
||||||
|
<enum name="state">
|
||||||
|
<entry name="tiled" value="1"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<event name="configure">
|
||||||
|
<arg name="states" type="array"/>
|
||||||
|
</event>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
|
Loading…
Reference in New Issue
Block a user