docs: update

This commit is contained in:
Dylan Araps 2019-10-11 23:40:30 +03:00
parent df174d7e30
commit e38286ae24

33
sowm.c
View File

@ -38,18 +38,15 @@ struct desktop{
int mode; int mode;
}; };
static void configure_request(XEvent *e); static void notify_motion(XEvent *e);
static void destroy_notify(XEvent *e); static void notify_destroy(XEvent *e);
static void map_request(XEvent *e); static void notify_enter(XEvent *e);
static void run(const Arg arg);
static void key_grab(); static void key_grab();
static void key_press(XEvent *e); static void key_press(XEvent *e);
static void button_press(XEvent *e); static void button_press(XEvent *e);
static void button_release(XEvent *e); static void button_release(XEvent *e);
static void motion_notify(XEvent *e);
static void win_add(Window w); static void win_add(Window w);
static void win_del(Window w); static void win_del(Window w);
@ -64,6 +61,10 @@ static void ws_go(const Arg arg);
static void ws_save(int i); static void ws_save(int i);
static void ws_sel(int i); static void ws_sel(int i);
static void configure_request(XEvent *e);
static void map_request(XEvent *e);
static void run(const Arg arg);
static void wm_init(); static void wm_init();
static void wm_setup(); static void wm_setup();
@ -84,10 +85,11 @@ static void (*events[LASTEvent])(XEvent *e) = {
[ButtonPress] = button_press, [ButtonPress] = button_press,
[ButtonRelease] = button_release, [ButtonRelease] = button_release,
[ConfigureRequest] = configure_request, [ConfigureRequest] = configure_request,
[DestroyNotify] = destroy_notify, [DestroyNotify] = notify_destroy,
[KeyPress] = key_press, [KeyPress] = key_press,
[MapRequest] = map_request, [MapRequest] = map_request,
[MotionNotify] = motion_notify [MotionNotify] = notify_motion,
[EnterNotify] = notify_enter
}; };
void win_add(Window w) { void win_add(Window w) {
@ -111,6 +113,9 @@ void win_add(Window w) {
c->next = NULL; c->next = NULL;
c->win = w; c->win = w;
cur = c; cur = c;
XSelectInput(dis, w, PropertyChangeMask|StructureNotifyMask|
EnterWindowMask|FocusChangeMask);
} }
void ws_go(const Arg arg) { void ws_go(const Arg arg) {
@ -182,7 +187,7 @@ void win_to_ws(const Arg arg) {
win_update(); win_update();
} }
void destroy_notify(XEvent *e) { void notify_destroy(XEvent *e) {
int i = 0; int i = 0;
client *c; client *c;
@ -222,6 +227,11 @@ void win_update() {
} }
} }
void notify_enter(XEvent *e) {
XCrossingEvent *ev = &e->xcrossing;
XSetInputFocus(dis, ev->window, RevertToParent, CurrentTime);
}
void key_grab() { void key_grab() {
int i; int i;
KeyCode code; KeyCode code;
@ -252,7 +262,7 @@ void button_press(XEvent *e) {
} }
} }
void motion_notify(XEvent *e) { void notify_motion(XEvent *e) {
XButtonEvent bu = e->xbutton; XButtonEvent bu = e->xbutton;
if (start.subwindow != None) { if (start.subwindow != None) {
@ -388,7 +398,8 @@ void wm_setup() {
curr_desk = arg.i; curr_desk = arg.i;
ws_go(arg); ws_go(arg);
XSelectInput(dis, root, SubstructureNotifyMask|SubstructureRedirectMask); XSelectInput(dis, root, SubstructureNotifyMask|SubstructureRedirectMask|
EnterWindowMask|LeaveWindowMask);
} }
void run(const Arg arg) { void run(const Arg arg) {