create basics
This commit is contained in:
69
wm.h
Normal file
69
wm.h
Normal file
@ -0,0 +1,69 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
|
||||
#define LAST_WINDOW(c, smon) for (c = smon->clients; c; c = c->next) {}
|
||||
#define FIND_WINDOW(c, smon, window) \
|
||||
for (c = smon->clients; c; c = c->next) \
|
||||
{ \
|
||||
if (c->wn == window) { \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
typedef struct Client Client;
|
||||
typedef struct Monitor Monitor;
|
||||
|
||||
struct Monitor {
|
||||
Display *display;
|
||||
XineramaScreenInfo info;
|
||||
Client *clients;
|
||||
int *wss;
|
||||
int selws;
|
||||
int wscount;
|
||||
};
|
||||
|
||||
|
||||
struct Client {
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
int ws;
|
||||
bool hidden;
|
||||
Monitor *m;
|
||||
Window wn;
|
||||
Client *prev;
|
||||
Client *next;
|
||||
// linked list is not sufficent for manual tiling.
|
||||
// will propably need a tree.
|
||||
};
|
||||
|
||||
static Display *wm_display;
|
||||
static Monitor *wm_monitors;
|
||||
static Monitor *wm_smon;
|
||||
static int wm_mc;
|
||||
static bool wm_other_wm;
|
||||
static Client wm_root;
|
||||
static Client *wm_last_client;
|
||||
|
||||
static int wm_xerror_handler(Display *display, XErrorEvent *e);
|
||||
static int wm_other_wm_handler(Display *display, XErrorEvent *e);
|
||||
void wm_create_handler(XCreateWindowEvent e);
|
||||
void wm_destroy_handler(XDestroyWindowEvent e);
|
||||
void wm_reparent_handler(XReparentEvent e);
|
||||
void wm_configure_handler(XConfigureRequestEvent e);
|
||||
void wm_map_handler(XMapRequestEvent e);
|
||||
|
||||
Monitor wm_monitor_open(Display *d, XineramaScreenInfo info);
|
||||
void wm_monitors_open_all(Display *d);
|
||||
Display* wm_connect_display();
|
||||
XWindowChanges wm_client_to_xwchanges(Client c);
|
||||
void wm_create_client(Window w);
|
||||
void wm_client_hide(Client *c);
|
||||
void wm_client_show(Client *c);
|
||||
void wm_switch_ws(int ws);
|
||||
void wm_mainloop();
|
||||
void wm_init();
|
Reference in New Issue
Block a user