add mouseover focus, seperate border for focused window,

keyboard directional focus, start working on config ipc
with sockets
This commit is contained in:
2022-07-29 22:18:34 +02:00
parent 452d103a08
commit 02dfb31656
2 changed files with 246 additions and 19 deletions

28
wm.h
View File

@ -5,10 +5,15 @@
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <X11/Xproto.h>
#include <unistd.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xinerama.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/socket.h>
#include <sys/un.h>
// TODO: bar, config command line utility(sockets), avoid global vars
#define RETURN_IF_NULL(c) \
if (c == NULL) \
{ \
@ -33,6 +38,13 @@ for (c = smon->clients; c; c = c->next) \
typedef struct Client Client;
typedef struct Monitor Monitor;
enum Direction {
UP,
DOWN,
LEFT,
RIGHT
};
struct Monitor {
Display *display;
XineramaScreenInfo info;
@ -42,7 +54,6 @@ struct Monitor {
int wscount;
};
struct Client {
int x;
int y;
@ -65,13 +76,14 @@ static Monitor *wm_smon;
static int wm_mc;
static bool wm_other_wm;
static Client wm_root;
static Client *wm_last_client;
static void (*wm_active_layout)(Monitor*);
static float wm_ms_p;
static unsigned int wm_border_col = 0x222222;
static unsigned int wm_focused_border_col = 0x444444;
static unsigned char wm_border_width = 2;
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);
@ -96,7 +108,9 @@ void wm_create_client(Window w);
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);
void wm_client_kill(Client *c);
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);
@ -105,6 +119,12 @@ bool wm_client_is_focused(Client *c);
XWindowChanges wm_client_to_xwchanges(Client c);
Client* wm_client_find(Window w);
void wm_switch_ws(int ws);
void wm_mainloop();
void wm_init();
void wm_socket_init();
void wm_socket_cleanup();
void wm_sigint_handler(int signum);