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) ...@@ -427,6 +427,7 @@ set_icon(const void *data, size_t width, XWMHints *hints)
unsigned short tmp; unsigned short tmp;
XColor fg; XColor fg;
bool sethints = (hints == NULL); bool sethints = (hints == NULL);
unsigned long lasti, lastim;
// This is literally the wost possible way to create a pixmap. :) // This is literally the wost possible way to create a pixmap. :)
/* /*
...@@ -446,26 +447,37 @@ set_icon(const void *data, size_t width, XWMHints *hints) ...@@ -446,26 +447,37 @@ set_icon(const void *data, size_t width, XWMHints *hints)
for (x = 0, i = 0; x < width; x++) { for (x = 0, i = 0; x < width; x++) {
for (y = 0; y < width; y++) { for (y = 0; y < width; y++) {
if (idata[i] & 0xff000000) { if (idata[i] & 0xff000000) {
tmp = (idata[i] & 0xff); if (VisualIsRGB8)
fg.red = tmp << 8 | tmp; fg.pixel = idata[i] & 0xffffff;
tmp = (idata[i] & 0xff00) >> 8;
fg.green = tmp << 8 | tmp;
tmp = (idata[i] & 0xff0000) >> 16;
fg.blue = tmp << 8 | tmp;
fg.flags = DoRed | DoGreen | DoBlue;
if (x11.XAllocColor(dpy, wincmap, &fg) == 0)
fail = true;
else { else {
x11.XSetForeground(dpy, igc, fg.pixel); tmp = (idata[i] & 0xff);
x11.XDrawPoint(dpy, icn, igc, y, x); fg.red = tmp << 8 | tmp;
x11.XSetForeground(dpy, imgc, white); tmp = (idata[i] & 0xff00) >> 8;
x11.XDrawPoint(dpy, icn_mask, imgc, y, x); fg.green = tmp << 8 | tmp;
tmp = (idata[i] & 0xff0000) >> 16;
fg.blue = tmp << 8 | tmp;
fg.flags = DoRed | DoGreen | DoBlue;
if (x11.XAllocColor(dpy, wincmap, &fg) == 0)
fail = true;
} }
if (fail) if (fail)
break; 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);
lastim = white;
}
x11.XDrawPoint(dpy, icn_mask, imgc, y, x);
} }
else { else {
x11.XSetForeground(dpy, imgc, black); if (lastim != black) {
x11.XSetForeground(dpy, imgc, black);
lastim = black;
}
x11.XDrawPoint(dpy, icn_mask, imgc, y, x); x11.XDrawPoint(dpy, icn_mask, imgc, y, x);
} }
i++; i++;
...@@ -512,6 +524,7 @@ static int init_window() ...@@ -512,6 +524,7 @@ static int init_window()
if (dpy == NULL) { if (dpy == NULL) {
return(-1); return(-1);
} }
x11.XSynchronize(dpy, False);
#ifdef WITH_XRENDER #ifdef WITH_XRENDER
if (xrender_found && x11.XRenderQueryVersion(dpy, &major, &minor) == 0) 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