desktop-shell: update protocol and client to wl_shell_surface
Change desktop-shell protocol to use wl_shell_surface instead of wl_surface. Adapt the desktop-shell client and the shell plugin. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
9d1613eb4a
commit
068ae944db
+16
-23
@@ -51,7 +51,7 @@ struct surface {
|
|||||||
void (*configure)(void *data,
|
void (*configure)(void *data,
|
||||||
struct desktop_shell *desktop_shell,
|
struct desktop_shell *desktop_shell,
|
||||||
uint32_t time, uint32_t edges,
|
uint32_t time, uint32_t edges,
|
||||||
struct wl_surface *surface,
|
struct window *window,
|
||||||
int32_t width, int32_t height);
|
int32_t width, int32_t height);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -260,14 +260,11 @@ static void
|
|||||||
panel_configure(void *data,
|
panel_configure(void *data,
|
||||||
struct desktop_shell *desktop_shell,
|
struct desktop_shell *desktop_shell,
|
||||||
uint32_t time, uint32_t edges,
|
uint32_t time, uint32_t edges,
|
||||||
struct wl_surface *surface,
|
struct window *window,
|
||||||
int32_t width, int32_t height)
|
int32_t width, int32_t height)
|
||||||
{
|
{
|
||||||
struct panel *panel =
|
window_set_child_size(window, width, 32);
|
||||||
window_get_user_data(wl_surface_get_user_data(surface));
|
window_schedule_redraw(window);
|
||||||
|
|
||||||
window_set_child_size(panel->window, width, 32);
|
|
||||||
window_schedule_redraw(panel->window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct panel *
|
static struct panel *
|
||||||
@@ -345,15 +342,12 @@ static void
|
|||||||
background_configure(void *data,
|
background_configure(void *data,
|
||||||
struct desktop_shell *desktop_shell,
|
struct desktop_shell *desktop_shell,
|
||||||
uint32_t time, uint32_t edges,
|
uint32_t time, uint32_t edges,
|
||||||
struct wl_surface *surface,
|
struct window *window,
|
||||||
int32_t width, int32_t height)
|
int32_t width, int32_t height)
|
||||||
{
|
{
|
||||||
struct desktop *desktop = data;
|
struct desktop *desktop = data;
|
||||||
struct background *background =
|
|
||||||
window_get_user_data(wl_surface_get_user_data(surface));
|
|
||||||
|
|
||||||
background_draw(background->window,
|
background_draw(window, width, height, desktop->background_path);
|
||||||
width, height, desktop->background_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -474,7 +468,7 @@ unlock_dialog_create(struct desktop *desktop)
|
|||||||
dialog->button = window_add_item(dialog->window, NULL);
|
dialog->button = window_add_item(dialog->window, NULL);
|
||||||
|
|
||||||
desktop_shell_set_lock_surface(desktop->shell,
|
desktop_shell_set_lock_surface(desktop->shell,
|
||||||
window_get_wl_surface(dialog->window));
|
window_get_wl_shell_surface(dialog->window));
|
||||||
|
|
||||||
unlock_dialog_draw(dialog);
|
unlock_dialog_draw(dialog);
|
||||||
|
|
||||||
@@ -503,13 +497,13 @@ static void
|
|||||||
desktop_shell_configure(void *data,
|
desktop_shell_configure(void *data,
|
||||||
struct desktop_shell *desktop_shell,
|
struct desktop_shell *desktop_shell,
|
||||||
uint32_t time, uint32_t edges,
|
uint32_t time, uint32_t edges,
|
||||||
struct wl_surface *surface,
|
struct wl_shell_surface *shell_surface,
|
||||||
int32_t width, int32_t height)
|
int32_t width, int32_t height)
|
||||||
{
|
{
|
||||||
struct surface *s =
|
struct window *window = wl_shell_surface_get_user_data(shell_surface);
|
||||||
window_get_user_data(wl_surface_get_user_data(surface));
|
struct surface *s = window_get_user_data(window);
|
||||||
|
|
||||||
s->configure(data, desktop_shell, time, edges, surface, width, height);
|
s->configure(data, desktop_shell, time, edges, window, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -619,16 +613,15 @@ int main(int argc, char *argv[])
|
|||||||
global_handler, &desktop);
|
global_handler, &desktop);
|
||||||
|
|
||||||
wl_list_for_each(output, &desktop.outputs, link) {
|
wl_list_for_each(output, &desktop.outputs, link) {
|
||||||
struct wl_surface *surface;
|
struct wl_shell_surface *s;
|
||||||
|
|
||||||
output->panel = panel_create(desktop.display);
|
output->panel = panel_create(desktop.display);
|
||||||
surface = window_get_wl_surface(output->panel->window);
|
s = window_get_wl_shell_surface(output->panel->window);
|
||||||
desktop_shell_set_panel(desktop.shell, output->output, surface);
|
desktop_shell_set_panel(desktop.shell, output->output, s);
|
||||||
|
|
||||||
output->background = background_create(&desktop);
|
output->background = background_create(&desktop);
|
||||||
surface = window_get_wl_surface(output->background->window);
|
s = window_get_wl_shell_surface(output->background->window);
|
||||||
desktop_shell_set_background(desktop.shell,
|
desktop_shell_set_background(desktop.shell, output->output, s);
|
||||||
output->output, surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config_file = config_file_path("wayland-desktop-shell.ini");
|
config_file = config_file_path("wayland-desktop-shell.ini");
|
||||||
|
|||||||
@@ -1989,6 +1989,7 @@ window_create_internal(struct display *display, struct window *parent,
|
|||||||
window->buffer_type = WINDOW_BUFFER_TYPE_SHM;
|
window->buffer_type = WINDOW_BUFFER_TYPE_SHM;
|
||||||
|
|
||||||
wl_surface_set_user_data(window->surface, window);
|
wl_surface_set_user_data(window->surface, window);
|
||||||
|
wl_shell_surface_set_user_data(window->shell_surface, window);
|
||||||
wl_list_insert(display->window_list.prev, &window->link);
|
wl_list_insert(display->window_list.prev, &window->link);
|
||||||
|
|
||||||
wl_shell_surface_add_listener(window->shell_surface,
|
wl_shell_surface_add_listener(window->shell_surface,
|
||||||
|
|||||||
+23
-23
@@ -36,6 +36,8 @@
|
|||||||
#include "compositor.h"
|
#include "compositor.h"
|
||||||
#include "desktop-shell-server-protocol.h"
|
#include "desktop-shell-server-protocol.h"
|
||||||
|
|
||||||
|
struct shell_surface;
|
||||||
|
|
||||||
struct wl_shell {
|
struct wl_shell {
|
||||||
struct wlsc_compositor *compositor;
|
struct wlsc_compositor *compositor;
|
||||||
struct wlsc_shell shell;
|
struct wlsc_shell shell;
|
||||||
@@ -49,7 +51,7 @@ struct wl_shell {
|
|||||||
bool locked;
|
bool locked;
|
||||||
bool prepare_event_sent;
|
bool prepare_event_sent;
|
||||||
|
|
||||||
struct wlsc_surface *lock_surface;
|
struct shell_surface *lock_surface;
|
||||||
struct wl_listener lock_surface_listener;
|
struct wl_listener lock_surface_listener;
|
||||||
struct wl_list hidden_surface_list;
|
struct wl_list hidden_surface_list;
|
||||||
|
|
||||||
@@ -436,7 +438,8 @@ desktop_shell_set_background(struct wl_client *client,
|
|||||||
struct wl_resource *surface_resource)
|
struct wl_resource *surface_resource)
|
||||||
{
|
{
|
||||||
struct wl_shell *shell = resource->data;
|
struct wl_shell *shell = resource->data;
|
||||||
struct wlsc_surface *surface = surface_resource->data;
|
struct shell_surface *shsurf = surface_resource->data;
|
||||||
|
struct wlsc_surface *surface = shsurf->surface;
|
||||||
struct shell_surface *priv;
|
struct shell_surface *priv;
|
||||||
|
|
||||||
wl_list_for_each(priv, &shell->backgrounds, link) {
|
wl_list_for_each(priv, &shell->backgrounds, link) {
|
||||||
@@ -448,20 +451,19 @@ desktop_shell_set_background(struct wl_client *client,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv = get_shell_surface(surface);
|
shsurf->type = SHELL_SURFACE_BACKGROUND;
|
||||||
priv->type = SHELL_SURFACE_BACKGROUND;
|
shsurf->output = output_resource->data;
|
||||||
priv->output = output_resource->data;
|
|
||||||
|
|
||||||
wl_list_insert(&shell->backgrounds, &priv->link);
|
wl_list_insert(&shell->backgrounds, &shsurf->link);
|
||||||
|
|
||||||
surface->x = priv->output->x;
|
surface->x = shsurf->output->x;
|
||||||
surface->y = priv->output->y;
|
surface->y = shsurf->output->y;
|
||||||
|
|
||||||
wl_resource_post_event(resource,
|
wl_resource_post_event(resource,
|
||||||
DESKTOP_SHELL_CONFIGURE,
|
DESKTOP_SHELL_CONFIGURE,
|
||||||
wlsc_compositor_get_time(), 0, surface,
|
wlsc_compositor_get_time(), 0, surface_resource,
|
||||||
priv->output->current->width,
|
shsurf->output->current->width,
|
||||||
priv->output->current->height);
|
shsurf->output->current->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -471,7 +473,8 @@ desktop_shell_set_panel(struct wl_client *client,
|
|||||||
struct wl_resource *surface_resource)
|
struct wl_resource *surface_resource)
|
||||||
{
|
{
|
||||||
struct wl_shell *shell = resource->data;
|
struct wl_shell *shell = resource->data;
|
||||||
struct wlsc_surface *surface = surface_resource->data;
|
struct shell_surface *shsurf = surface_resource->data;
|
||||||
|
struct wlsc_surface *surface = shsurf->surface;
|
||||||
struct shell_surface *priv;
|
struct shell_surface *priv;
|
||||||
|
|
||||||
wl_list_for_each(priv, &shell->panels, link) {
|
wl_list_for_each(priv, &shell->panels, link) {
|
||||||
@@ -483,20 +486,19 @@ desktop_shell_set_panel(struct wl_client *client,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv = get_shell_surface(surface);
|
shsurf->type = SHELL_SURFACE_PANEL;
|
||||||
priv->type = SHELL_SURFACE_PANEL;
|
shsurf->output = output_resource->data;
|
||||||
priv->output = output_resource->data;
|
|
||||||
|
|
||||||
wl_list_insert(&shell->panels, &priv->link);
|
wl_list_insert(&shell->panels, &shsurf->link);
|
||||||
|
|
||||||
surface->x = priv->output->x;
|
surface->x = shsurf->output->x;
|
||||||
surface->y = priv->output->y;
|
surface->y = shsurf->output->y;
|
||||||
|
|
||||||
wl_resource_post_event(resource,
|
wl_resource_post_event(resource,
|
||||||
DESKTOP_SHELL_CONFIGURE,
|
DESKTOP_SHELL_CONFIGURE,
|
||||||
wlsc_compositor_get_time(), 0, surface_resource,
|
wlsc_compositor_get_time(), 0, surface_resource,
|
||||||
priv->output->current->width,
|
shsurf->output->current->width,
|
||||||
priv->output->current->height);
|
shsurf->output->current->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -516,7 +518,6 @@ desktop_shell_set_lock_surface(struct wl_client *client,
|
|||||||
struct wl_resource *surface_resource)
|
struct wl_resource *surface_resource)
|
||||||
{
|
{
|
||||||
struct wl_shell *shell = resource->data;
|
struct wl_shell *shell = resource->data;
|
||||||
struct shell_surface *priv;
|
|
||||||
|
|
||||||
shell->prepare_event_sent = false;
|
shell->prepare_event_sent = false;
|
||||||
|
|
||||||
@@ -529,8 +530,7 @@ desktop_shell_set_lock_surface(struct wl_client *client,
|
|||||||
wl_list_insert(&surface_resource->destroy_listener_list,
|
wl_list_insert(&surface_resource->destroy_listener_list,
|
||||||
&shell->lock_surface_listener.link);
|
&shell->lock_surface_listener.link);
|
||||||
|
|
||||||
priv = get_shell_surface(shell->lock_surface);
|
shell->lock_surface->type = SHELL_SURFACE_LOCK;
|
||||||
priv->type = SHELL_SURFACE_LOCK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
<interface name="desktop_shell" version="1">
|
<interface name="desktop_shell" version="1">
|
||||||
<request name="set_background">
|
<request name="set_background">
|
||||||
<arg name="output" type="object" interface="wl_output"/>
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
<arg name="surface" type="object" interface="wl_surface"/>
|
<arg name="surface" type="object" interface="wl_shell_surface"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="set_panel">
|
<request name="set_panel">
|
||||||
<arg name="output" type="object" interface="wl_output"/>
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
<arg name="surface" type="object" interface="wl_surface"/>
|
<arg name="surface" type="object" interface="wl_shell_surface"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="set_lock_surface">
|
<request name="set_lock_surface">
|
||||||
<arg name="surface" type="object" interface="wl_surface"/>
|
<arg name="surface" type="object" interface="wl_shell_surface"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="unlock"/>
|
<request name="unlock"/>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<event name="configure">
|
<event name="configure">
|
||||||
<arg name="time" type="uint"/>
|
<arg name="time" type="uint"/>
|
||||||
<arg name="edges" type="uint"/>
|
<arg name="edges" type="uint"/>
|
||||||
<arg name="surface" type="object" interface="wl_surface"/>
|
<arg name="surface" type="object" interface="wl_shell_surface"/>
|
||||||
<arg name="width" type="int"/>
|
<arg name="width" type="int"/>
|
||||||
<arg name="height" type="int"/>
|
<arg name="height" type="int"/>
|
||||||
</event>
|
</event>
|
||||||
|
|||||||
Reference in New Issue
Block a user