change wm_client_to_xwchanges parameter to Client*, remove client from tree when killed

This commit is contained in:
Akos Horvath 2023-06-01 15:21:58 +02:00
parent 00821acf12
commit e1620b452a
2 changed files with 11 additions and 9 deletions

View File

@ -18,20 +18,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "client.h"
#include "util.h"
#include "wm.h"
#include <stdio.h>
#include <string.h>
#include <limits.h>
// TODO
XWindowChanges wm_client_to_xwchanges(Client c)
XWindowChanges wm_client_to_xwchanges(Client *c)
{
XWindowChanges ch;
ch.x = c.x;
ch.y = c.y;
ch.width = c.w;
ch.height = c.h;
ch.x = c->x;
ch.y = c->y;
ch.width = c->w;
ch.height = c->h;
// ch.border_width = 0;
// ch.stack_mode = Above;
@ -166,9 +167,7 @@ void wm_client_focus(Wm *wm, Client *c)
XSetInputFocus(wm->display, c->window, RevertToPointerRoot, CurrentTime);
wm_client_set_atom(wm, c, "_NET_ACTIVE_WINDOW", (unsigned char*) &c->window,
XA_WINDOW, 1);
// XChangeProperty(wm->display, root.window,
// XInternAtom(wm->display, "_NET_ACTIVE_WINDOW", False),
// 33, 32, PropModeReplace, (unsigned char *) &c->window, 1);
c->focused = true;
wm_monitor_clients_border(wm, c->m);
}
@ -197,6 +196,7 @@ void wm_client_focus_dir(Wm *wm, Client *c, int dir)
void wm_client_free(Wm *wm, Client *c)
{
DEBUG_PRINT("%s\n", __func__);
RETURN_IF_NULL(c);
if (c == wm->smon->clients) {
@ -235,6 +235,8 @@ void wm_client_kill(Wm *wm, Client *c)
if (XSendEvent(wm->display, c->window, false, NoEventMask, &event) != Success)
XKillClient(wm->display, c->window);
wm_treenode_remove_client(&c->ws->tree, c);
wm_client_free(wm, c);
wm_layout(wm, m);

View File

@ -46,7 +46,7 @@ struct Client {
bool is_floating;
};
XWindowChanges wm_client_to_xwchanges(Client c);
XWindowChanges wm_client_to_xwchanges(Client *c);
Client* wm_client_find(Wm* wm, Window w);
Client *wm_get_last_client(Wm *wm, Monitor m);
Client* wm_client_create(Wm *wm, Window w);