use type enum to distinguish Client from LayerSurface

This commit is contained in:
Devin J. Pohly 2021-09-05 15:55:36 -05:00
parent 40e45a336a
commit 929d3d9569
1 changed files with 6 additions and 2 deletions

8
dwl.c
View File

@ -65,10 +65,10 @@
/* enums */ /* enums */
enum { CurNormal, CurMove, CurResize }; /* cursor */ enum { CurNormal, CurMove, CurResize }; /* cursor */
enum { XDGShell, LayerShell, X11Managed, X11Unmanaged }; /* client types */
#ifdef XWAYLAND #ifdef XWAYLAND
enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar, enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */ NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */
enum { XDGShell, X11Managed, X11Unmanaged }; /* client types */
#endif #endif
typedef union { typedef union {
@ -87,6 +87,8 @@ typedef struct {
typedef struct Monitor Monitor; typedef struct Monitor Monitor;
typedef struct { typedef struct {
/* Must be first */
unsigned int type; /* XDGShell or X11* */
struct wl_list link; struct wl_list link;
struct wl_list flink; struct wl_list flink;
struct wl_list slink; struct wl_list slink;
@ -103,7 +105,6 @@ typedef struct {
struct wlr_box geom; /* layout-relative, includes border */ struct wlr_box geom; /* layout-relative, includes border */
Monitor *mon; Monitor *mon;
#ifdef XWAYLAND #ifdef XWAYLAND
unsigned int type;
struct wl_listener activate; struct wl_listener activate;
struct wl_listener configure; struct wl_listener configure;
#endif #endif
@ -140,6 +141,8 @@ typedef struct {
} Keyboard; } Keyboard;
typedef struct { typedef struct {
/* Must be first */
unsigned int type; /* LayerShell */
struct wlr_layer_surface_v1 *layer_surface; struct wlr_layer_surface_v1 *layer_surface;
struct wl_list link; struct wl_list link;
@ -917,6 +920,7 @@ createlayersurface(struct wl_listener *listener, void *data)
} }
layersurface = calloc(1, sizeof(LayerSurface)); layersurface = calloc(1, sizeof(LayerSurface));
layersurface->type = LayerShell;
LISTEN(&wlr_layer_surface->surface->events.commit, LISTEN(&wlr_layer_surface->surface->events.commit,
&layersurface->surface_commit, commitlayersurfacenotify); &layersurface->surface_commit, commitlayersurfacenotify);
LISTEN(&wlr_layer_surface->events.destroy, &layersurface->destroy, LISTEN(&wlr_layer_surface->events.destroy, &layersurface->destroy,