work on ewmh, bar/non-normal window handling

This commit is contained in:
2022-08-01 12:18:31 +02:00
parent 3206fa9578
commit 4752d41361
2 changed files with 572 additions and 183 deletions

38
wm.h
View File

@ -10,30 +10,28 @@
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/un.h>
// TODO: bar, config command line utility(sockets), avoid global vars
// TODO: dont draw border on not normal windows, floating dialog window,
// window type/name/... atom member variable on Client struct
// TODO: get_atom probably not working correctly
// TODO: important: do not lay out non-regular windows
// TODO: important: code cleanliness, ewmh!!
// TODO: config command line utility(sockets), avoid global vars
#define RETURN_IF_NULL(c) \
if (c == NULL) \
{ \
fprintf(stderr, "wm: client was null in function %s\n", __func__); \
fprintf(stderr, "wm: pointer was null in function %s\n", __func__); \
return; \
}
#define DEBUG
//#define LAST_WINDOW(c, smon) whie {}
//#define FIND_WINDOW(c, smon, window) \
for (c = smon->clients; c; c = c->next) \
{ \
if (c->wn == window) { \
break; \
} \
}
#ifdef DEBUG
#define DEBUG_PRINT(s) printf(s);
#define DEBUG_PRINTV(s, var) printf(s, var);
#endif
#define DEBUG 1
#define DEBUG_PRINT(fmt, ...) \
do { if (DEBUG) fprintf(stderr, fmt, ##__VA_ARGS__); } while (0);
typedef struct Client Client;
typedef struct Monitor Monitor;
@ -76,6 +74,7 @@ static Monitor *wm_smon;
static int wm_mc;
static bool wm_other_wm;
static Client wm_root;
static Window wm_dock;
static void (*wm_active_layout)(Monitor*);
static float wm_ms_p;
static unsigned int wm_border_col = 0x222222;
@ -104,6 +103,11 @@ void wm_layout(Monitor *m);
Client *wm_get_last_client(Monitor m);
void wm_client_set_atom(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,
unsigned long *nitems_ret);
void wm_create_client(Window w);
void wm_client_hide(Client *c);
void wm_client_show(Client *c);
@ -116,6 +120,7 @@ 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_client_is_dock(Client *c);
XWindowChanges wm_client_to_xwchanges(Client c);
Client* wm_client_find(Window w);
@ -124,7 +129,8 @@ void wm_switch_ws(int ws);
void wm_mainloop();
void wm_init();
void wm_socket_init();
struct sockaddr wm_socket_init();
void wm_socket_cleanup();
void wm_settings_message_parse(char *c, int len);
void wm_sigint_handler(int signum);