Skip to content
Snippets Groups Projects
Commit ae643313 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Disable X Synchronize and some minr optimizations in set_icon()

The XSynchronize disablement is the most important here... didn't
realize it defaulted to enabled, which has been slowing down a *lot*
of stuff for a long time... not that there's much left that benefits
from disabling Synchronized XLib except this new terrible icon thing.
parent ca7ab040
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4386 passed
......@@ -427,6 +427,7 @@ set_icon(const void *data, size_t width, XWMHints *hints)
unsigned short tmp;
XColor fg;
bool sethints = (hints == NULL);
unsigned long lasti, lastim;
// This is literally the wost possible way to create a pixmap. :)
/*
......@@ -446,6 +447,9 @@ set_icon(const void *data, size_t width, XWMHints *hints)
for (x = 0, i = 0; x < width; x++) {
for (y = 0; y < width; y++) {
if (idata[i] & 0xff000000) {
if (VisualIsRGB8)
fg.pixel = idata[i] & 0xffffff;
else {
tmp = (idata[i] & 0xff);
fg.red = tmp << 8 | tmp;
tmp = (idata[i] & 0xff00) >> 8;
......@@ -455,17 +459,25 @@ set_icon(const void *data, size_t width, XWMHints *hints)
fg.flags = DoRed | DoGreen | DoBlue;
if (x11.XAllocColor(dpy, wincmap, &fg) == 0)
fail = true;
else {
}
if (fail)
break;
if (lasti != fg.pixel) {
x11.XSetForeground(dpy, igc, fg.pixel);
lasti = fg.pixel;
}
x11.XDrawPoint(dpy, icn, igc, y, x);
if (lastim != white) {
x11.XSetForeground(dpy, imgc, white);
x11.XDrawPoint(dpy, icn_mask, imgc, y, x);
lastim = white;
}
if (fail)
break;
x11.XDrawPoint(dpy, icn_mask, imgc, y, x);
}
else {
if (lastim != black) {
x11.XSetForeground(dpy, imgc, black);
lastim = black;
}
x11.XDrawPoint(dpy, icn_mask, imgc, y, x);
}
i++;
......@@ -512,6 +524,7 @@ static int init_window()
if (dpy == NULL) {
return(-1);
}
x11.XSynchronize(dpy, False);
#ifdef WITH_XRENDER
if (xrender_found && x11.XRenderQueryVersion(dpy, &major, &minor) == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment