split up wm.c into multiple files
This commit is contained in:
128
wm.h
128
wm.h
@ -1,3 +1,6 @@
|
||||
#ifndef WM_H
|
||||
#define WM_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
@ -37,6 +40,7 @@ typedef struct Client Client;
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct Keybind Keybind;
|
||||
typedef struct Arg Arg;
|
||||
typedef struct Wm Wm;
|
||||
|
||||
enum Direction {
|
||||
UP,
|
||||
@ -85,90 +89,84 @@ struct Arg {
|
||||
struct Keybind {
|
||||
unsigned int mask;
|
||||
KeySym keysym;
|
||||
void (*func)(Arg*);
|
||||
void (*func)(Wm*, Arg*);
|
||||
Arg args;
|
||||
};
|
||||
|
||||
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 Window wm_dock = -1;
|
||||
struct Wm {
|
||||
// TODO INIT
|
||||
Display *display;
|
||||
Monitor *monitors;
|
||||
Monitor *smon;
|
||||
int wm_mc;
|
||||
bool other_wm;
|
||||
Client root;
|
||||
Window dock;
|
||||
|
||||
/* global configuration variables */
|
||||
// TODO: active layout not working
|
||||
static void (*wm_active_layout)(Monitor*);
|
||||
static float wm_cfg_ms_p = 0.5;
|
||||
static char wm_cfg_border_col[] = "#222222";
|
||||
static char wm_cfg_focused_border_col[] = "#444444";
|
||||
static unsigned char wm_cfg_border_width = 2;
|
||||
static Keybind *wm_cfg_keybinds;
|
||||
static int wm_cfg_kb_count;
|
||||
static bool wm_cfg_focus_on_motion = true;
|
||||
// TODO: active layout not working
|
||||
void (*active_layout)(Wm *wm, Monitor*);
|
||||
float cfg_ms_p;
|
||||
char *cfg_border_col;
|
||||
char *cfg_focused_border_col;
|
||||
unsigned char cfg_border_width;
|
||||
Keybind *cfg_keybinds;
|
||||
int cfg_kb_count;
|
||||
bool cfg_focus_on_motion;
|
||||
|
||||
static int wm_socket_fd;
|
||||
|
||||
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_keyrelease_handler(XKeyReleasedEvent e);
|
||||
void wm_keypress_handler(XKeyPressedEvent e);
|
||||
void wm_maprequest_handler(XMapRequestEvent e);
|
||||
void wm_motion_handler(XMotionEvent e);
|
||||
int socket_fd;
|
||||
};
|
||||
|
||||
Monitor wm_monitor_open(Display *d, XineramaScreenInfo info);
|
||||
void wm_monitors_open_all(Display *d);
|
||||
void wm_monitors_open_all(Wm *wm, Display *d);
|
||||
Display* wm_connect_display();
|
||||
|
||||
void wm_mstack(Monitor *m);
|
||||
void wm_set_layout(void(*f)(Monitor*));
|
||||
void wm_layout(Monitor *m);
|
||||
void wm_mstack(Wm *wm, Monitor *m);
|
||||
void wm_set_layout(Wm *wm, void(*f)(Wm *wm, Monitor*));
|
||||
void wm_layout(Wm *wm, Monitor *m);
|
||||
|
||||
Client *wm_get_last_client(Monitor m);
|
||||
Client *wm_get_last_client(Wm *wm, Monitor m);
|
||||
|
||||
void wm_client_set_atom(Client *c, const char *name, const unsigned char *data,
|
||||
void wm_client_set_atom(Wm *wm, Client *c, const char *name, const unsigned char *data,
|
||||
Atom type, int nelements);
|
||||
Atom wm_client_get_atom(Client *c, const char *name, unsigned char **atom_ret,
|
||||
Atom wm_client_get_atom(Wm *wm, Client *c, const char *name, unsigned char **atom_ret,
|
||||
unsigned long *nitems_ret);
|
||||
|
||||
Client* wm_client_create(Window w);
|
||||
void wm_client_free(Client *c);
|
||||
void wm_client_kill(Client *c);
|
||||
void wm_client_hide(Client *c);
|
||||
void wm_client_show(Client *c);
|
||||
void wm_client_focus(Client *c);
|
||||
void wm_client_focus_dir(Client *c, int dir);
|
||||
Client* wm_client_create(Wm *wm, Window w);
|
||||
void wm_client_free(Wm *wm, Client *c);
|
||||
void wm_client_kill(Wm *wm, Client *c);
|
||||
void wm_client_hide(Wm *wm, Client *c);
|
||||
void wm_client_show(Wm* wm, Client *c);
|
||||
void wm_client_focus(Wm* wm, Client *c);
|
||||
void wm_client_focus_dir(Wm* wm, Client *c, int dir);
|
||||
Client* wm_client_get_dir_rel_c(Client *c, int dir);
|
||||
Client* wm_client_get_focused();
|
||||
void wm_client_border(Client *c);
|
||||
void wm_client_border_focused(Client *c);
|
||||
void wm_monitor_clients_border(Monitor *m);
|
||||
bool wm_client_is_focused(Client *c);
|
||||
bool wm_window_is_dock(Window w);
|
||||
Client* wm_client_get_focused(Wm* wm);
|
||||
void wm_client_border(Wm* wm, Client *c);
|
||||
void wm_client_border_focused(Wm* wm, Client *c);
|
||||
void wm_monitor_clients_border(Wm* wm, Monitor *m);
|
||||
bool wm_client_is_focused(Wm* wm, Client *c);
|
||||
bool wm_window_is_dock(Wm* wm, Window w);
|
||||
XWindowChanges wm_client_to_xwchanges(Client c);
|
||||
Client* wm_client_find(Window w);
|
||||
Client* wm_client_find(Wm* wm, Window w);
|
||||
|
||||
void wm_spawn(char **str);
|
||||
void wm_spawn(Wm* wm, char **str);
|
||||
|
||||
void wm_switch_ws(int ws);
|
||||
void wm_mainloop();
|
||||
void wm_init();
|
||||
void wm_switch_ws(Wm* wm, int ws);
|
||||
void wm_mainloop(Wm* wm);
|
||||
void wm_init(Wm *wm);
|
||||
void wm_init_cfg_def(Wm *wm);
|
||||
|
||||
void wm_grab_keys();
|
||||
void wm_kb_spawn(Arg *args);
|
||||
void wm_kb_kill(Arg *args);
|
||||
void wm_kb_switch_ws(Arg *args);
|
||||
void wm_kb_focus_dir(Arg *args);
|
||||
void wm_grab_keys(Wm *wm);
|
||||
void wm_kb_spawn(Wm *wm, Arg *args);
|
||||
void wm_kb_kill(Wm *wm, Arg *args);
|
||||
void wm_kb_switch_ws(Wm *wm, Arg *args);
|
||||
void wm_kb_focus_dir(Wm *wm, Arg *args);
|
||||
|
||||
void wm_keybinds_init_def();
|
||||
void wm_keybinds_init_def(Wm *wm);
|
||||
|
||||
struct sockaddr wm_socket_init();
|
||||
void wm_socket_cleanup();
|
||||
void wm_settings_message_parse(char *c, int len);
|
||||
struct sockaddr wm_socket_init(Wm *wm);
|
||||
void wm_socket_cleanup(Wm *wm);
|
||||
void wm_settings_message_parse(Wm *wm, char *c, int len);
|
||||
|
||||
void wm_sigint_handler(int signum);
|
||||
void wm_sigint_handler(Wm *wm, int signum);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user