summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default_sxwmrc (renamed from default_sxrc)0
-rw-r--r--src/parser.c8
-rw-r--r--src/sxwm.c72
3 files changed, 42 insertions, 38 deletions
diff --git a/default_sxrc b/default_sxwmrc
index c318190..c318190 100644
--- a/default_sxrc
+++ b/default_sxwmrc
diff --git a/src/parser.c b/src/parser.c
index 0d086a2..eb6ba21 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -33,14 +33,6 @@ static const struct {
static void remap_and_dedupe_binds(Config *cfg)
{
for (int i = 0; i < cfg->bindsn; i++) {
- Binding *b = &cfg->binds[i];
- if (b->mods & (Mod1Mask | Mod4Mask)) {
- unsigned others = b->mods & ~(Mod1Mask | Mod4Mask);
- b->mods = others | cfg->modkey;
- }
- }
-
- for (int i = 0; i < cfg->bindsn; i++) {
for (int j = i + 1; j < cfg->bindsn; j++) {
if (cfg->binds[i].mods == cfg->binds[j].mods && cfg->binds[i].keysym == cfg->binds[j].keysym) {
memmove(&cfg->binds[j], &cfg->binds[j + 1], sizeof(Binding) * (cfg->bindsn - j - 1));
diff --git a/src/sxwm.c b/src/sxwm.c
index c7d041d..91c0839 100644
--- a/src/sxwm.c
+++ b/src/sxwm.c
@@ -537,42 +537,54 @@ void hdl_destroy_ntf(XEvent *xev)
{
Window w = xev->xdestroywindow.window;
- Client *prev = NULL, *c = workspaces[current_ws];
- while (c && c->win != w) {
- prev = c;
- c = c->next;
- }
- if (c) {
- if (focused == c) {
- if (c->next) {
- focused = c->next;
+ // Search all workspaces, not just current one
+ for (int ws = 0; ws < NUM_WORKSPACES; ws++) {
+ Client *prev = NULL, *c = workspaces[ws];
+ while (c && c->win != w) {
+ prev = c;
+ c = c->next;
+ }
+ if (c) {
+ // Update focused if this was the focused client
+ if (focused == c) {
+ if (c->next) {
+ focused = c->next;
+ }
+ else if (prev) {
+ focused = prev;
+ }
+ else {
+ // If this was the only client in current workspace, find next client
+ if (ws == current_ws) {
+ focused = NULL;
+ }
+ }
}
- else if (prev) {
- focused = prev;
+
+ // Remove from linked list
+ if (!prev) {
+ workspaces[ws] = c->next;
}
else {
- focused = NULL;
+ prev->next = c->next;
}
- }
- if (!prev) {
- workspaces[current_ws] = c->next;
- }
- else {
- prev->next = c->next;
- }
+ free(c);
+ update_net_client_list();
+ open_windows--;
- free(c);
- update_net_client_list();
- open_windows--;
- }
-
- tile();
- update_borders();
+ // Only tile and update borders if we're dealing with current workspace
+ if (ws == current_ws) {
+ tile();
+ update_borders();
- if (focused) {
- XSetInputFocus(dpy, focused->win, RevertToPointerRoot, CurrentTime);
- XRaiseWindow(dpy, focused->win);
+ if (focused) {
+ XSetInputFocus(dpy, focused->win, RevertToPointerRoot, CurrentTime);
+ XRaiseWindow(dpy, focused->win);
+ }
+ }
+ return; // Found and removed the client, we're done
+ }
}
}
@@ -1754,4 +1766,4 @@ int main(int ac, char **av)
printf("sxwm: starting...\n");
run();
return 0;
-}
+} \ No newline at end of file