aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-09-27 14:48:53 +0200
committeremersion <contact@emersion.fr>2017-09-27 14:48:53 +0200
commitacf58e04de5652ed13ec46458a39a4dd97ba3b78 (patch)
tree8235e75540ab66ea3fb2f42b0f12f2036b169407
parented9a43c2134f19ddaa4d8e7c9f680d8a3d8329a6 (diff)
Fix segfault, add wl_shell view
-rw-r--r--include/rootston/view.h4
-rw-r--r--rootston/meson.build2
-rw-r--r--rootston/wl_shell.c18
-rw-r--r--types/wlr_wl_shell.c8
4 files changed, 24 insertions, 8 deletions
diff --git a/include/rootston/view.h b/include/rootston/view.h
index b74d1075..eee61563 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -6,8 +6,8 @@
#include <wlr/types/wlr_xdg_shell_v6.h>
struct roots_wl_shell_surface {
+ struct roots_view *view;
// TODO
- void *_placeholder;
};
struct roots_xdg_surface_v6 {
@@ -34,7 +34,7 @@ struct roots_view {
// TODO: Something for roots-enforced width/height
enum roots_view_type type;
union {
- struct wlr_shell_surface *wl_shell_surface;
+ struct wlr_wl_shell_surface *wl_shell_surface;
struct wlr_xdg_surface_v6 *xdg_surface_v6;
};
union {
diff --git a/rootston/meson.build b/rootston/meson.build
index de2d04de..6e9e0041 100644
--- a/rootston/meson.build
+++ b/rootston/meson.build
@@ -10,6 +10,6 @@ executable(
'output.c',
'pointer.c',
'xdg_shell_v6.c',
- 'wl_shell.c'
+ 'wl_shell.c',
], dependencies: wlroots
)
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index 0dcc0565..0929a999 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -16,5 +16,21 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
struct wlr_wl_shell_surface *surface = data;
wlr_log(L_DEBUG, "new wl_shell surface");
- wlr_wl_shell_surface_ping(surface);
+ //wlr_wl_shell_surface_ping(surface);
+
+ struct roots_wl_shell_surface *roots_surface =
+ calloc(1, sizeof(struct roots_wl_shell_surface));
+ // TODO: all of the trimmings
+
+ struct roots_view *view = calloc(1, sizeof(struct roots_view));
+ view->type = ROOTS_WL_SHELL_VIEW;
+ view->x = view->y = 200;
+ view->wl_shell_surface = surface;
+ view->roots_wl_shell_surface = roots_surface;
+ //view->wlr_surface = surface->surface;
+ //view->get_input_bounds = get_input_bounds;
+ //view->activate = activate;
+ view->desktop = desktop;
+ roots_surface->view = view;
+ wl_list_insert(&desktop->views, &view->link);
}
diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c
index 745299bf..42a906c9 100644
--- a/types/wlr_wl_shell.c
+++ b/types/wlr_wl_shell.c
@@ -116,8 +116,6 @@ static void wl_shell_get_shell_surface(struct wl_client *client,
wlr_log(L_DEBUG, "New wl_shell %p (res %p)", state, shell_surface_resource);
wl_resource_set_implementation(shell_surface_resource,
&shell_surface_interface, state, destroy_shell_surface);
- wl_list_insert(&wlr_wl_shell->surfaces, &state->link);
- wl_signal_emit(&wlr_wl_shell->events.new_surface, state);
wl_signal_init(&state->events.ping_timeout);
@@ -128,6 +126,9 @@ static void wl_shell_get_shell_surface(struct wl_client *client,
if (state->ping_timer == NULL) {
wl_client_post_no_memory(client);
}
+
+ wl_list_insert(&wlr_wl_shell->surfaces, &state->link);
+ wl_signal_emit(&wlr_wl_shell->events.new_surface, state);
}
static struct wl_shell_interface wl_shell_impl = {
@@ -199,6 +200,5 @@ void wlr_wl_shell_surface_ping(struct wlr_wl_shell_surface *surface) {
wl_display_next_serial(wl_client_get_display(surface->client));
wl_event_source_timer_update(surface->ping_timer,
surface->shell->ping_timeout);
- wl_shell_surface_send_ping(surface->surface,
- surface->ping_serial);
+ wl_shell_surface_send_ping(surface->surface, surface->ping_serial);
}