chore: update c files

This commit is contained in:
retoor 2026-01-08 23:24:45 +01:00
parent beda6ec573
commit ab47f3c117
2 changed files with 23 additions and 1 deletions

View File

@ -361,6 +361,9 @@ void client_focus(Client *client)
client_raise(client);
/* Ungrab buttons so the application receives events directly */
XUngrabButton(dwn->display, Button1, AnyModifier, client->window);
client_sync_log("client_focus: decorations");
decorations_render(client, true);
@ -379,6 +382,12 @@ void client_unfocus(Client *client)
return;
}
/* Grab buttons to intercept clicks for focus */
if (dwn != NULL && dwn->display != NULL && client->window != None) {
XGrabButton(dwn->display, Button1, AnyModifier, client->window, False,
ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
}
decorations_render(client, false);
}
@ -428,6 +437,18 @@ void client_minimize(Client *client)
client->flags |= CLIENT_MINIMIZED;
client_hide(client);
Workspace *ws = workspace_get(client->workspace);
if (ws != NULL && ws->focused == client) {
Client *next = workspace_mru_get_previous(client->workspace, client);
if (next != NULL) {
client_focus(next);
} else {
ws->focused = NULL;
XSetInputFocus(dwn->display, dwn->root, RevertToPointerRoot, CurrentTime);
atoms_set_active_window(None);
}
}
}
void client_restore(Client *client)
@ -749,6 +770,7 @@ void client_set_maximize(Client *client, bool maximized)
client_configure(client);
decorations_render(client, true);
client_raise(client);
client_focus(client);
} else {
client->flags &= ~CLIENT_MAXIMIZED;

View File

@ -302,7 +302,7 @@ void decorations_button_press(Client *client, ButtonType button)
case BUTTON_MAXIMIZE:
LOG_DEBUG("Maximize button pressed for %s", client->title);
client_toggle_fullscreen(client);
client_toggle_maximize(client);
break;
case BUTTON_MINIMIZE: