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

The final bits of icon insanity.

Actually install the colormap we create.
Remove the 48x48 icon.

As it happens, ChromeOS completely ignores the X11 icons and instead
does some weird magic to drag the icon .png file out of the VM and
uses that.  Basically, getting the icon to work appears to mean
putting some properly named files into magic directores.
parent 4bfdec46
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4381 failed
......@@ -91,7 +91,7 @@ CIOLIBEXPORT double ciolib_initial_scaling = 0;
CIOLIBEXPORT int ciolib_initial_mode = C80;
CIOLIBEXPORT enum ciolib_scaling ciolib_initial_scaling_type = CIOLIB_SCALING_INTERNAL;
CIOLIBEXPORT const void * ciolib_initial_icon = syncicon64;
CIOLIBEXPORT size_t ciolib_initial_icon_width = 64;
CIOLIBEXPORT size_t ciolib_initial_icon_width = SYNCICON64_WIDTH;
CIOLIBEXPORT const uint32_t *ciolib_r2yptr;
CIOLIBEXPORT const uint32_t *ciolib_y2rptr;
......@@ -545,7 +545,7 @@ CIOLIBEXPORT int initciolib(int mode)
cio_textinfo.normattr=LIGHTGRAY;
break;
}
ciolib_seticon(syncicon64, SYNCICON64_WIDTH);
ciolib_seticon(ciolib_initial_icon, ciolib_initial_icon_width);
ciolib_textattr(cio_textinfo.normattr);
_beginthread(ciolib_mouse_thread,0,NULL);
......
......@@ -433,6 +433,10 @@ int x_init(void)
xp_dlclose(dl);
return(-1);
}
if((x11.XInstallColormap=xp_dlsym(dl,XInstallColormap))==NULL) {
xp_dlclose(dl);
return(-1);
}
if((x11.XAllocClassHint=xp_dlsym(dl,XAllocClassHint))==NULL) {
xp_dlclose(dl);
return(-1);
......
......@@ -428,6 +428,15 @@ set_icon(const void *data, size_t width, XWMHints *hints)
XColor fg;
bool sethints = (hints == NULL);
// This is literally the wost possible way to create a pixmap. :)
/*
* This whole mess was added to get the icon working on ChromeOS...
* as it happens, ChromeOS doesn't actually use the X11 icons at
* all for anything ever. Instead it does some weird hackery in
* the icon theme and pulls the icon files out to the host.
* Leaving this here though since it is marginally "better" aside
* from the insane method to create a Pixmap.
*/
icn = x11.XCreatePixmap(dpy, DefaultRootWindow(dpy), width, width, depth);
igc = x11.XCreateGC(dpy, icn, GCFunction | GCForeground | GCBackground | GCGraphicsExposures, &gcv);
icn_mask = x11.XCreatePixmap(dpy, DefaultRootWindow(dpy), width, width, 1);
......@@ -542,6 +551,7 @@ static int init_window()
/* Create window, but defer setting a size and GC. */
XSetWindowAttributes wa = {0};
wincmap = x11.XCreateColormap(dpy, DefaultRootWindow(dpy), visual, AllocNone);
x11.InstallColormap(dpy, wincmap);
wa.colormap = wincmap;
wa.background_pixel = black;
wa.border_pixel = black;
......@@ -1619,7 +1629,6 @@ void x11_event_thread(void *args)
x11.XBell(dpy, 100);
break;
case X11_LOCAL_SETICON: {
// This doesn't work on ChromeOS, presumably because XWayland sucks.
Atom wmicon = x11.XInternAtom(dpy, "_NET_WM_ICON", False);
if (wmicon) {
x11.XChangeProperty(dpy, win, wmicon, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)lev.data.icon_data, lev.data.icon_data[0] * lev.data.icon_data[1] + 2);
......
......@@ -91,6 +91,7 @@ struct x11 {
Window (*XCreateWindow)(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth,
unsigned int class, Visual *visual, unsigned long valuemask, XSetWindowAttributes *attributes);
Colormap (*XCreateColormap)(Display *display, Window w, Visual *visual, int alloc);
int (*XInstallColormap)(Display *, Colormap);
XClassHint *(*XAllocClassHint)(void);
int (*XSetForeground)(Display *display, GC gc, unsigned long foreground);
char *(*XSetLocaleModifiers)(char *modifier_list);
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment