Files
sowm/sowm.h
T
Dylan Araps 1a4c655b9d meta: Rewrite sowm and swap to XCB.
This was my first real C project and it shows. Learning C is quite
fun and I still have a long way to go. This next rewrite should be
less of a hot-mess than the original Xlib version.

Notable mistakes:

- while (1 && ...)
- for win (spastic pre-processor stuff)
- no proper tracking of client sizes/positions.
- lazy window focus model.
- almost code-golfed code-base.
- circular-doubly-linked-list for clients.

The following changes mark the initial commit for the rewrite.
The window manager works but does not yet do enough for it to be
usable. Clients, keybindings, a configuration file, etc, etc do
not yet exist. Baby steps.
2020-07-11 11:31:30 +03:00

48 lines
1.3 KiB
C

#define _POSIX_C_SOURCE 200809L
#include <xcb/xcb.h>
struct wconf {
int16_t x;
int16_t y;
uint16_t width;
uint16_t height;
uint8_t stack_mode;
xcb_window_t sibling;
};
xcb_connection_t *dpy;
xcb_screen_t *scr;
xcb_drawable_t root;
uint32_t ev_vals[3];
/* xcb event with the largest value */
#define XCB_LAST_EVENT XCB_GET_MODIFIER_MAPPING
#define EVENT_MASK(e) (((e) & ~0x80))
void init_wm(void);
void init_input(void);
void run_loop(void);
void event_button_press(xcb_generic_event_t *ev);
void event_button_release(xcb_generic_event_t *ev);
void event_configure_request(xcb_generic_event_t *ev);
void event_key_press(xcb_generic_event_t *ev);
void event_notify_create(xcb_generic_event_t *ev);
void event_notify_destroy(xcb_generic_event_t *ev);
void event_notify_enter(xcb_generic_event_t *ev);
void event_notify_motion(xcb_generic_event_t *ev);
void (*events[XCB_NO_OPERATION])(xcb_generic_event_t *) = {
[XCB_BUTTON_PRESS] = event_button_press,
[XCB_BUTTON_RELEASE] = event_button_release,
[XCB_CONFIGURE_REQUEST] = event_configure_request,
[XCB_KEY_PRESS] = event_key_press,
[XCB_CREATE_NOTIFY] = event_notify_create,
[XCB_DESTROY_NOTIFY] = event_notify_destroy,
[XCB_ENTER_NOTIFY] = event_notify_enter,
[XCB_MOTION_NOTIFY] = event_notify_motion
};
void win_add(xcb_window_t win);