|
|
@ -16,6 +16,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "xdg-shell-client-protocol.h"
|
|
|
|
#include "xdg-shell-client-protocol.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct surface {
|
|
|
|
|
|
|
|
struct wlr_surface *wlr;
|
|
|
|
|
|
|
|
struct wl_listener commit;
|
|
|
|
|
|
|
|
struct wl_listener destroy;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static struct wl_display *remote_display = NULL;
|
|
|
|
static struct wl_display *remote_display = NULL;
|
|
|
|
static struct wl_compositor *compositor = NULL;
|
|
|
|
static struct wl_compositor *compositor = NULL;
|
|
|
|
static struct wl_subcompositor *subcompositor = NULL;
|
|
|
|
static struct wl_subcompositor *subcompositor = NULL;
|
|
|
@ -119,8 +125,34 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
|
|
|
|
wlr_scene_output_send_frame_done(scene_output, &now);
|
|
|
|
wlr_scene_output_send_frame_done(scene_output, &now);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void surface_handle_commit(struct wl_listener *listener, void *data) {
|
|
|
|
|
|
|
|
struct surface *surface = wl_container_of(listener, surface, commit);
|
|
|
|
|
|
|
|
struct wlr_xdg_toplevel *xdg_toplevel =
|
|
|
|
|
|
|
|
wlr_xdg_toplevel_try_from_wlr_surface(surface->wlr);
|
|
|
|
|
|
|
|
if (xdg_toplevel != NULL && xdg_toplevel->base->initial_commit) {
|
|
|
|
|
|
|
|
wlr_xdg_toplevel_set_size(xdg_toplevel, 0, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void surface_handle_destroy(struct wl_listener *listener, void *data) {
|
|
|
|
|
|
|
|
struct surface *surface = wl_container_of(listener, surface, destroy);
|
|
|
|
|
|
|
|
wl_list_remove(&surface->commit.link);
|
|
|
|
|
|
|
|
wl_list_remove(&surface->destroy.link);
|
|
|
|
|
|
|
|
free(surface);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_new_surface(struct wl_listener *listener, void *data) {
|
|
|
|
static void handle_new_surface(struct wl_listener *listener, void *data) {
|
|
|
|
struct wlr_surface *wlr_surface = data;
|
|
|
|
struct wlr_surface *wlr_surface = data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct surface *surface = calloc(1, sizeof(*surface));
|
|
|
|
|
|
|
|
surface->wlr = wlr_surface;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
surface->commit.notify = surface_handle_commit;
|
|
|
|
|
|
|
|
wl_signal_add(&wlr_surface->events.commit, &surface->commit);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
surface->destroy.notify = surface_handle_destroy;
|
|
|
|
|
|
|
|
wl_signal_add(&wlr_surface->events.destroy, &surface->destroy);
|
|
|
|
|
|
|
|
|
|
|
|
wlr_scene_surface_create(&scene->tree, wlr_surface);
|
|
|
|
wlr_scene_surface_create(&scene->tree, wlr_surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|