mirror of
https://github.com/dylanaraps/sowm.git
synced 2025-05-19 09:30:24 -07:00
sowm: more broken (for now)
This commit is contained in:
parent
ef61316b5f
commit
d1e8ee5e67
@ -15,7 +15,7 @@ const char* colors[] = {"bud", "/home/goldie/Pictures/Wallpapers", 0};
|
||||
|
||||
static struct key keys[] = {
|
||||
{MOD, XK_q, win_kill, {0}},
|
||||
{MOD, XK_c, win_center, {0}},
|
||||
{MOD, XK_c, win_center, {.w = 0}},
|
||||
{MOD, XK_f, win_fs, {0}},
|
||||
{Mod1Mask, XK_Tab, win_next, {0}},
|
||||
|
||||
|
26
sowm.c
26
sowm.c
@ -67,7 +67,6 @@ static void (*events[LASTEvent])(XEvent *e) = {
|
||||
#include "config.h"
|
||||
|
||||
#define win (client *t=0, *c=list; t!=list->prev; t=c, c=c->next)
|
||||
|
||||
#define ws_save(W) ws_list[W] = list
|
||||
#define ws_sel(W) list = ws_list[ws = W]
|
||||
|
||||
@ -76,15 +75,14 @@ static void (*events[LASTEvent])(XEvent *e) = {
|
||||
&(unsigned int){0}, &(unsigned int){0})
|
||||
|
||||
void win_focus(Window w) {
|
||||
if (list) for win if (c->w == w) {
|
||||
cur = c;
|
||||
XSetInputFocus(d, w, RevertToParent, CurrentTime);
|
||||
|
||||
for win if (c->w == w) cur = c;
|
||||
}
|
||||
}
|
||||
|
||||
void notify_destroy(XEvent *e) {
|
||||
for win if (c->w == e->xdestroywindow.window) win_del(c);
|
||||
|
||||
if (list) win_focus(list->w);
|
||||
if (list) for win if (c->w == e->xdestroywindow.window) win_del(c);
|
||||
}
|
||||
|
||||
void notify_enter(XEvent *e) {
|
||||
@ -125,7 +123,7 @@ void button_press(XEvent *e) {
|
||||
}
|
||||
|
||||
void button_release() {
|
||||
for win if (c->w == mouse.subwindow) c->f = 0;
|
||||
if (list) for win if (c->w == mouse.subwindow) c->f = 0;
|
||||
|
||||
mouse.subwindow = 0;
|
||||
}
|
||||
@ -148,13 +146,13 @@ void win_add(Window w) {
|
||||
list = c;
|
||||
list->prev = list->next = list;
|
||||
}
|
||||
|
||||
ws_save(ws);
|
||||
}
|
||||
|
||||
void win_del(client *c) {
|
||||
struct client **head = &list;
|
||||
|
||||
if (!*head || !c) return;
|
||||
if (*head == c) *head = c->next;
|
||||
if (list || !c) return;
|
||||
if (list == c) list = c->next;
|
||||
if (c->next) c->next->prev = c->prev;
|
||||
if (c->prev) c->prev->next = c->next;
|
||||
|
||||
@ -198,10 +196,12 @@ void win_to_ws(const Arg arg) {
|
||||
XUnmapWindow(d, cur->w);
|
||||
ws_save(tmp);
|
||||
|
||||
if (list) win_focus(list->w);
|
||||
if (list) win_focus(list->prev->w);
|
||||
}
|
||||
|
||||
void win_next() {
|
||||
if (!list) return;
|
||||
|
||||
win_focus(cur->next->w);
|
||||
XRaiseWindow(d, cur->next->w);
|
||||
}
|
||||
@ -222,7 +222,7 @@ void ws_go(const Arg arg) {
|
||||
|
||||
ws_sel(arg.i);
|
||||
|
||||
if (list) win_focus(list->w);
|
||||
if (list) win_focus(list->prev->w);
|
||||
}
|
||||
|
||||
void configure_request(XEvent *e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user