fix class name from changing on resize
This commit is contained in:
parent
31e0ba8cb2
commit
cf67a6fd4e
|
@ -2,3 +2,4 @@ st
|
||||||
*.o
|
*.o
|
||||||
*.orig
|
*.orig
|
||||||
*.rej
|
*.rej
|
||||||
|
.ccls-cache
|
||||||
|
|
65
x.c
65
x.c
|
@ -886,37 +886,46 @@ xclear(int x1, int y1, int x2, int y2)
|
||||||
void
|
void
|
||||||
xhints(void)
|
xhints(void)
|
||||||
{
|
{
|
||||||
XClassHint class = {opt_name ? opt_name : "st",
|
XClassHint class = {opt_name ? opt_name : "st",
|
||||||
opt_class ? opt_class : "St"};
|
opt_class ? opt_class : "St-class"};
|
||||||
XWMHints wm = {.flags = InputHint, .input = 1};
|
XWMHints wm = {.flags = InputHint, .input = 1};
|
||||||
XSizeHints *sizeh;
|
XSizeHints *sizeh;
|
||||||
|
XClassHint current_class;
|
||||||
|
Status status;
|
||||||
|
|
||||||
sizeh = XAllocSizeHints();
|
status = XGetClassHint(xw.dpy, xw.win, ¤t_class);
|
||||||
|
if (status == True) {
|
||||||
|
if (strcmp(current_class.res_class, class.res_class) != 0) {
|
||||||
|
class.res_class = current_class.res_class; /* current_class.res_class; */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize;
|
sizeh = XAllocSizeHints();
|
||||||
sizeh->height = win.h;
|
|
||||||
sizeh->width = win.w;
|
|
||||||
sizeh->height_inc = win.ch;
|
|
||||||
sizeh->width_inc = win.cw;
|
|
||||||
sizeh->base_height = 2 * borderpx;
|
|
||||||
sizeh->base_width = 2 * borderpx;
|
|
||||||
sizeh->min_height = win.ch + 2 * borderpx;
|
|
||||||
sizeh->min_width = win.cw + 2 * borderpx;
|
|
||||||
if (xw.isfixed) {
|
|
||||||
sizeh->flags |= PMaxSize;
|
|
||||||
sizeh->min_width = sizeh->max_width = win.w;
|
|
||||||
sizeh->min_height = sizeh->max_height = win.h;
|
|
||||||
}
|
|
||||||
if (xw.gm & (XValue|YValue)) {
|
|
||||||
sizeh->flags |= USPosition | PWinGravity;
|
|
||||||
sizeh->x = xw.l;
|
|
||||||
sizeh->y = xw.t;
|
|
||||||
sizeh->win_gravity = xgeommasktogravity(xw.gm);
|
|
||||||
}
|
|
||||||
|
|
||||||
XSetWMProperties(xw.dpy, xw.win, NULL, NULL, NULL, 0, sizeh, &wm,
|
sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize;
|
||||||
&class);
|
sizeh->height = win.h;
|
||||||
XFree(sizeh);
|
sizeh->width = win.w;
|
||||||
|
sizeh->height_inc = win.ch;
|
||||||
|
sizeh->width_inc = win.cw;
|
||||||
|
sizeh->base_height = 2 * borderpx;
|
||||||
|
sizeh->base_width = 2 * borderpx;
|
||||||
|
sizeh->min_height = win.ch + 2 * borderpx;
|
||||||
|
sizeh->min_width = win.cw + 2 * borderpx;
|
||||||
|
if (xw.isfixed) {
|
||||||
|
sizeh->flags |= PMaxSize;
|
||||||
|
sizeh->min_width = sizeh->max_width = win.w;
|
||||||
|
sizeh->min_height = sizeh->max_height = win.h;
|
||||||
|
}
|
||||||
|
if (xw.gm & (XValue|YValue)) {
|
||||||
|
sizeh->flags |= USPosition | PWinGravity;
|
||||||
|
sizeh->x = xw.l;
|
||||||
|
sizeh->y = xw.t;
|
||||||
|
sizeh->win_gravity = xgeommasktogravity(xw.gm);
|
||||||
|
}
|
||||||
|
|
||||||
|
XSetWMProperties(xw.dpy, xw.win, NULL, NULL, NULL, 0, sizeh, &wm,
|
||||||
|
&class);
|
||||||
|
XFree(sizeh);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue