crywl/src/lib/client.h

73 lines
2.3 KiB
C

/*
* Attempt to consolidate unavoidable suck into one file, away from dwl.c. This
* file is not meant to be pretty. We use a .h file with static inline
* functions instead of a separate .c module, or function pointers like sway, so
* that they will simply compile out if the chosen #defines leave them unused.
*/
#ifndef CRYWL_CLIENT_H
#define CRYWL_CLIENT_H
#include <wlr/util/box.h>
#include "../util.h"
enum { XDGShell, LayerShell, X11 }; /* client types */
typedef struct Monitor Monitor; // forward declare
typedef struct {
/* Must keep this field first */
unsigned int type; /* XDGShell or X11* */
Monitor *mon;
struct wlr_scene_tree *scene;
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
struct wlr_scene_tree *scene_surface;
struct wl_list link;
struct wl_list flink;
struct wlr_box geom; /* layout-relative, includes border */
struct wlr_box prev; /* layout-relative, includes border */
struct wlr_box bounds; /* only width and height are used */
union {
struct wlr_xdg_surface *xdg;
struct wlr_xwayland_surface *xwayland;
} surface;
struct wlr_xdg_toplevel_decoration_v1 *decoration;
struct wl_listener commit;
struct wl_listener map;
struct wl_listener maximize;
struct wl_listener unmap;
struct wl_listener destroy;
struct wl_listener set_title;
struct wl_listener fullscreen;
struct wl_listener set_decoration_mode;
struct wl_listener destroy_decoration;
#ifdef XWAYLAND
struct wl_listener activate;
struct wl_listener associate;
struct wl_listener dissociate;
struct wl_listener configure;
struct wl_listener set_hints;
#endif
unsigned int bw;
uint32_t tags;
int isfloating, isurgent, isfullscreen;
uint32_t resize; /* configure serial of a pending resize */
} Client;
/* ===== Function Declarations ===== */
void applybounds(Client *c, struct wlr_box *bbox);
void focusclient(Client *c, int lift);
void killclient(const Arg *arg);
void resize(Client *c, struct wlr_box geo, int interact);
void setfloating(Client *c, int floating);
void setfullscreen(Client *c, int fullscreen);
void togglefloating(const Arg *arg);
void togglefullscreen(const Arg *arg);
void toggletag(const Arg *arg);
void toggleview(const Arg *arg);
void updatetitle(struct wl_listener *listener, void *data);
void view(const Arg *arg);
void zoom(const Arg *arg);
#endif /* CRYWL_CLIENT_H */