diff --git a/src/pge/olc/olcPixelGameEngine.h b/src/pge/olc/olcPixelGameEngine.h index 77a72671..5862ae67 100644 --- a/src/pge/olc/olcPixelGameEngine.h +++ b/src/pge/olc/olcPixelGameEngine.h @@ -5687,6 +5687,57 @@ namespace olc XMapWindow(olc_Display, olc_Window); XStoreName(olc_Display, olc_Window, "OneLoneCoder.com - Pixel Game Engine"); + // As per this topic: + // https://stackoverflow.com/questions/50123173/how-to-set-icon-name-in-x11-ubuntu + // Assign the name of the app to the tooltip that + // is visible for the application. + char appTooltip[] = "bsgalone"; + XClassHint *class_hint = XAllocClassHint(); + if (class_hint) { + class_hint->res_name = appTooltip; + class_hint->res_class = appTooltip; + XSetClassHint(olc_Display, olc_Window, class_hint); + XFree(class_hint); + } + + // Change the icon to something nicer, as defined in this topic: + // https://stackoverflow.com/questions/10699927/xlib-argb-window-icon + // In order to define the buffer, we have to use the ARGB syntax + // and represent each pixel as a unsigned integer. + // For example the value + // (4278190080)10 = + // (1111 1111 0000 0000 0000 0000 0000 0000)b + // + A + R + G + B + + // The following buffer represents a simplified version of the hand + // that is characteristic of the application. + unsigned long buffer[] = { + // Dimensions + 16, 16, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ + /* 0 */ 4278190080, 4278190080, 4278190080, 4278190080, 4280418304, 4283367424, 4283367424, 4283367424, 4283367424, 4283367424, 4283367424, 4280418304, 4278190080, 4278190080, 4278190080, 4278190080, + /* 1 */ 4278190080, 4278190080, 4278190080, 4280418304, 4288413696, 4291559424, 4291559424, 4291559424, 4291559424, 4291559424, 4291559424, 4288413696, 4280418304, 4278190080, 4278190080, 4278190080, + /* 2 */ 4278190080, 4278190080, 4280418304, 4288413696, 4291559424, 4291559424, 4291559424, 4291085508, 4291085508, 4291559424, 4291559424, 4291559424, 4288413696, 4280418304, 4278190080, 4278190080, + /* 3 */ 4278190080, 4280418304, 4288413696, 4291559424, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4291085508, 4291559424, 4291559424, 4291559424, 4288413696, 4280418304, 4278190080, + /* 4 */ 4280418304, 4288413696, 4291559424, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4294967295, 4294967295, 4291085508, 4291559424, 4291559424, 4291559424, 4288413696, 4280418304, + /* 5 */ 4283367424, 4291559424, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4291085508, 4291559424, 4291559424, 4291559424, 4291559424, 4283367424, + /* 6 */ 4283367424, 4291559424, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4291085508, 4291559424, 4291085508, 4291559424, 4291559424, 4283367424, + /* 7 */ 4283367424, 4291559424, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4291085508, 4291085508, 4291085508, 4291559424, 4291559424, 4283367424, + /* 8 */ 4283367424, 4291559424, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4294967295, 4294967295, 4291085508, 4291085508, 4294967295, 4291085508, 4291559424, 4291559424, 4283367424, + /* 9 */ 4283367424, 4291559424, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4294967295, 4291085508, 4294967295, 4294967295, 4291085508, 4291085508, 4291559424, 4291559424, 4283367424, + /* 10 */ 4283367424, 4291559424, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4294967295, 4291085508, 4294967295, 4294967295, 4291085508, 4291559424, 4291559424, 4291559424, 4283367424, + /* 11 */ 4280418304, 4288413696, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4291085508, 4294967295, 4294967295, 4291085508, 4291559424, 4291559424, 4291559424, 4288413696, 4280418304, + /* 12 */ 4278190080, 4280418304, 4288413696, 4291559424, 4291559424, 4291085508, 4294967295, 4294967295, 4294967295, 4291085508, 4291559424, 4291559424, 4291559424, 4288413696, 4280418304, 4278190080, + /* 13 */ 4278190080, 4278190080, 4280418304, 4288413696, 4291559424, 4291559424, 4291085508, 4291085508, 4291085508, 4291559424, 4291559424, 4291559424, 4288413696, 4280418304, 4278190080, 4278190080, + /* 14 */ 4278190080, 4278190080, 4278190080, 4280418304, 4288413696, 4291559424, 4291559424, 4291559424, 4291559424, 4291559424, 4291559424, 4288413696, 4280418304, 4278190080, 4278190080, 4278190080, + /* 15 */ 4278190080, 4278190080, 4278190080, 4278190080, 4280418304, 4283367424, 4283367424, 4283367424, 4283367424, 4283367424, 4283367424, 4280418304, 4278190080, 4278190080, 4278190080, 4278190080, + }; + + Display *d = XOpenDisplay(0); + Atom net_wm_icon = XInternAtom(d, "_NET_WM_ICON", False); + Atom cardinal = XInternAtom(olc_Display, "CARDINAL", False); + int length = 2 + 16 * 16; + XChangeProperty(olc_Display, olc_Window, net_wm_icon, cardinal, 32, PropModeReplace, (const unsigned char*) buffer, length); + if (bFullScreen) // Thanks DragonEye, again :D { Atom wm_state;