parent
0cd418ba42
commit
700941dde8
@ -0,0 +1,13 @@
|
||||
#ifndef _SWAY_DECORATION_H
|
||||
#define _SWAY_DECORATION_H
|
||||
|
||||
#include <wlr/types/wlr_server_decoration.h>
|
||||
|
||||
struct sway_server_decoration {
|
||||
struct wlr_server_decoration *wlr_server_decoration;
|
||||
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener mode;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,41 @@
|
||||
#include <stdlib.h>
|
||||
#include "sway/decoration.h"
|
||||
#include "sway/server.h"
|
||||
#include "sway/tree/view.h"
|
||||
#include "log.h"
|
||||
|
||||
static void server_decoration_handle_destroy(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct sway_server_decoration *deco =
|
||||
wl_container_of(listener, deco, destroy);
|
||||
wl_list_remove(&deco->destroy.link);
|
||||
free(deco);
|
||||
}
|
||||
|
||||
static void server_decoration_handle_mode(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct sway_server_decoration *deco =
|
||||
wl_container_of(listener, deco, mode);
|
||||
struct sway_view *view =
|
||||
view_from_wlr_surface(deco->wlr_server_decoration->surface);
|
||||
|
||||
// TODO
|
||||
wlr_log(WLR_ERROR, "%p %d", view, deco->wlr_server_decoration->mode);
|
||||
}
|
||||
|
||||
void handle_server_decoration(struct wl_listener *listener, void *data) {
|
||||
struct wlr_server_decoration *wlr_deco = data;
|
||||
|
||||
struct sway_server_decoration *deco = calloc(1, sizeof(*deco));
|
||||
if (deco == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
deco->wlr_server_decoration = wlr_deco;
|
||||
|
||||
wl_signal_add(&wlr_deco->events.destroy, &deco->destroy);
|
||||
deco->destroy.notify = server_decoration_handle_destroy;
|
||||
|
||||
wl_signal_add(&wlr_deco->events.mode, &deco->mode);
|
||||
deco->mode.notify = server_decoration_handle_mode;
|
||||
}
|
Loading…
Reference in new issue