Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Client colormaps #343

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ struct Client

uint32_t ewmhflags; /* EWMH types/states */
enum XCBBitGravity gravity; /* Client gravity */
XCBColormap colormap; /* Clients colormap */
};


Expand All @@ -187,6 +188,8 @@ uint8_t applysizehints(Client *c, int32_t *x, int32_t *y, int32_t *width, int32_
/* Frees Client and allocated client properties.
*/
void cleanupclient(Client *c);
/* Initializes the Clients colormap */
void clientinitcolormap(Client *c, XCBWindowAttributes *wa);
/* Initializes the Client decoration */
void clientinitdecor(Client *c);
/* Initializes the Clients floating status, based on clients flags/hints. _NET_WM_STATE/_NET_WM_WINDOW_TYPE */
Expand Down Expand Up @@ -461,6 +464,8 @@ void unfocus(Client *c, uint8_t setfocus);
* No side effects on non filled _class dataw;
*/
void updateclass(Client *c, XCBWMClass *_class);
/* Updates the Clients colormap */
void updatecolormap(Client *c, XCBColormap colormap);
void updatedecor(Client *c);
/* Updates the Client icon if we find one */
void updateicon(Client *c, XCBWindowProperty *iconprop);
Expand Down
28 changes: 28 additions & 0 deletions src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,16 @@ cleanupclient(Client *c)
c = NULL;
}

void
clientinitcolormap(Client *c, XCBWindowAttributes *wa)
{
if(wa)
{
c->colormap = 0;
updatecolormap(c, wa->colormap);
}
}

void
clientinitdecor(Client *c)
{
Expand Down Expand Up @@ -916,6 +926,7 @@ managereply(XCBWindow win, XCBCookie requests[ManageCookieLAST])
}

/* this sets up the desktop which is quite important for some operations */
clientinitcolormap(c, waattributes);
clientinittrans(c, trans);
clientinitgeom(c, wg);
clientinitwtype(c, wtypeunused);
Expand Down Expand Up @@ -1795,6 +1806,8 @@ unmanage(Client *c, uint8_t destroyed)
}
delclienthash(c);
detachcompletely(c);
/* Destroy colormap */
updatecolormap(c, 0);
updateclientlist(win, ClientListRemove);
cleanupclient(c);
Debug("Unmanaged: [%u]", win);
Expand Down Expand Up @@ -1887,6 +1900,21 @@ updateclass(Client *c, XCBWMClass *_class)
}
}

void
updatecolormap(Client *c, XCBColormap colormap)
{
if(c)
{
if(c->colormap)
{ XCBUninstallColormap(_wm.dpy, c->colormap);
}
if(colormap)
{ XCBInstallColormap(_wm.dpy, colormap);
}
c->colormap = colormap;
}
}

static void
__update_motif_decor(Client *c, uint32_t hints)
{
Expand Down