aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/wm/wm.h
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-09-28 14:34:34 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-09-28 14:34:34 -0700
commitb9a07a67b85e9192faa0e285b4419bd5ef242a03 (patch)
tree6b3426363e22da403967c6d4cbb0b98f39be4b38 /sys/cmd/wm/wm.h
parentb58f62d4ef7f6e2442bdf8170f8652ba1e08bd12 (diff)
feat: reorganized code to be more modular
Diffstat (limited to 'sys/cmd/wm/wm.h')
-rw-r--r--sys/cmd/wm/wm.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/sys/cmd/wm/wm.h b/sys/cmd/wm/wm.h
index 356c408..b9731e9 100644
--- a/sys/cmd/wm/wm.h
+++ b/sys/cmd/wm/wm.h
@@ -24,3 +24,131 @@
#include <wlr/util/log.h>
#include <xkbcommon/xkbcommon.h>
+
+// -----------------------------------------------------------------------
+// types
+
+enum
+{
+ CursorPassthrough,
+ CursorMove,
+ CursorResize,
+};
+
+typedef struct Keyboard Keyboard;
+typedef struct Client Client;
+typedef struct Monitor Monitor;
+typedef struct Server Server;
+
+struct Keyboard
+{
+ struct wl_list link;
+ struct wlr_input_device *device;
+ struct {
+ struct wl_listener press;
+ struct wl_listener modify;
+ } event;
+};
+
+struct Client
+{
+ struct wl_list link;
+ struct wlr_xdg_surface *xdg;
+ struct {
+ struct wl_listener map;
+ struct wl_listener unmap;
+ struct wl_listener destroy;
+ struct wl_listener request_move;
+ struct wl_listener request_resize;
+ } event;
+ int x, y, mapped;
+};
+
+struct Monitor
+{
+ struct wl_list link;
+ struct wlr_output *output;
+ struct {
+ struct wl_listener render;
+ } event;
+};
+
+struct Server
+{
+ struct wl_display *display;
+ struct wlr_backend *backend;
+ struct wlr_renderer *renderer;
+
+ struct {
+ struct wlr_xdg_shell *xdg;
+ } shell;
+
+ struct wl_list clients;
+
+ struct {
+ Client *client;
+ double x, y;
+ struct wlr_box box;
+ } grab;
+ uint32 resize;
+
+ struct {
+ struct wlr_output_layout *layout;
+ struct wl_list list;
+ } output;
+
+ struct {
+ struct wlr_cursor *dot;
+ struct wlr_xcursor_manager *manager;
+ int mode;
+ } cursor;
+
+ struct {
+ struct wlr_seat *seat;
+ struct wl_list keyboards;
+ } input;
+
+ struct {
+ struct wl_listener make_output;
+ struct wl_listener make_input;
+ struct wl_listener make_xdg_surface;
+
+ struct wl_listener cursor_move;
+ struct wl_listener cursor_move_abs;
+ struct wl_listener cursor_button;
+ struct wl_listener cursor_axis;
+ struct wl_listener cursor_frame;
+
+ struct wl_listener request_cursor;
+ struct wl_listener request_set_selection;
+ } event;
+};
+
+extern struct Server server;
+
+// -----------------------------------------------------------------------
+// functions
+
+/* output.c */
+void make_output(struct wl_listener *, void *);
+
+/* xdg.c */
+void make_xdg_surface(struct wl_listener *, void *);
+
+/* input.c */
+void make_input(struct wl_listener *, void *);
+
+void cursor_axis(struct wl_listener *, void *);
+void cursor_frame(struct wl_listener *, void *);
+void cursor_button(struct wl_listener *, void *);
+void cursor_move(struct wl_listener *, void *);
+void cursor_move_abs(struct wl_listener *, void *);
+
+void request_cursor(struct wl_listener *, void *);
+void request_set_selection(struct wl_listener *, void *);
+
+/* client.c */
+void focus(Client *client, struct wlr_surface *new);
+Client* clientat(double, double, struct wlr_surface **, double *, double *);
+int clienthas(Client *, double, double, struct wlr_surface **, double *, double *);
+void setinteractive(Client *client, int mode, uint32 edges);