cebix / macemu

Basilisk II and SheepShaver Macintosh emulators
1.4k stars 291 forks source link

Basilisk II has no icon on Linux #160

Closed dcoshea closed 6 years ago

dcoshea commented 6 years ago

As at ff129e8, when running under CentOS 7 with KDE (version 4.14), the window title bar, the task manager bar at the bottom of the screen, and the Alt-Tab task switcher all show the default X icon.

I have been looking at addressing this using XChangeProperty() to set _NET_WM_ICON, but have some questions:

  1. It looks like the options are the Windows icon(s) in BasiliskII/src/Windows/BasiliskII.ico, which are only 32x32, or the MacOS X icons in BasiliskII/src/MacOSX/BasiliskII.icns, where both 32x32 and 128x128 icons are available (perhaps even higher-resolution icons are available but my version of libicns-utils isn't built to support them?). Both "work", but the Alt-Tab task switcher in KDE is designed to show large icons, so the 128x128 icon looks appropriate there, whereas the 32x32 icon available from Windows looks quite small (KDE doesn't upscale it). I assume there would be no complaints with me using the MacOS X icons?

  2. I could probably have the existing .ico or .icns file converted to something more useful at make time, but this would require some new rules in the Makefile and add dependencies on more tools at build time. Is it okay if I just commit the converted file to Git and document how to convert it?

Any advice on converting the icons into the format required by _NET_WM_ICON would be welcome. ImageMagick can generate a .h file in PNM format, but it has an ugly variable-length header (not too hard to parse, though) and loses the alpha channel.

asvitkine commented 6 years ago

Using the Mac one seems fine. I'm fine with just checking in a converted version, even if it's in the form of a source file.

On Dec 29, 2017 8:03 AM, "dcoshea" notifications@github.com wrote:

As at ff129e8 https://github.com/cebix/macemu/commit/ff129e8649cff96f6ec1a99b470173e42ae31188, when running under CentOS 7 with KDE (version 4.14), the window title bar, the task manager bar at the bottom of the screen, and the Alt-Tab task switcher all show the default X icon.

I have been looking at addressing this using XChangeProperty() to set _NET_WM_ICON, but have some questions:

1.

It looks like the options are the Windows icon(s) in BasiliskII/src/Windows/BasiliskII.ico, which are only 32x32, or the MacOS X icons in BasiliskII/src/MacOSX/BasiliskII.icns, where both 32x32 and 128x128 icons are available (perhaps even higher-resolution icons are available but my version of libicns-utils isn't built to support them?). Both "work", but the Alt-Tab task switcher in KDE is designed to show large icons, so the 128x128 icon looks appropriate there, whereas the 32x32 icon available from Windows looks quite small (KDE doesn't upscale it). I assume there would be no complaints with me using the MacOS X icons? 2.

I could probably have the existing .ico or .icns file converted to something more useful at make time, but this would require some new rules in the Makefile and add dependencies on more tools at build time. Is it okay if I just commit the converted file to Git and document how to convert it?

Any advice on converting the icons into the format required by _NET_WM_ICON would be welcome. ImageMagick can generate a .h file in PNM format, but it has an ugly variable-length header (not too hard to parse, though) and loses the alpha channel.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cebix/macemu/issues/160, or mute the thread https://github.com/notifications/unsubscribe-auth/AABE8LjERxr5etmLilHmNF9Qmct_hot4ks5tFOMagaJpZM4RPGdo .

asvitkine commented 6 years ago

In another project, I do this:

  1. The source file was saved via GIMP in this format:

/ GIMP RGBA C-Source image dump (app_128x128x32.c) /

  1. Then the code to set it is:

SDL_SysWMinfo info;

SDL_VERSION(&info.version);

if (SDL_GetWMInfo(&info) && info.subsystem == SDL_SYSWM_X11)

{

info.info.x11.lock_func();

{

Atom icon = XInternAtom(info.info.x11.display, "_NET_WM_ICON", False);

if (icon != None)

{

int i, pixel_count = app_icon.width * app_icon.height;

Uint32 data[pixel_count + 2];

unsigned char pixels = (unsigned char ) &data[2];

for (i = 0; i < pixel_count * 4; i += 4)

{

pixels[i+0] = app_icon.pixel_data[i+2];

pixels[i+1] = app_icon.pixel_data[i+1];

pixels[i+2] = app_icon.pixel_data[i+0];

pixels[i+3] = app_icon.pixel_data[i+3];

}

data[0] = m2_icon.width;

data[1] = m2_icon.height;

XChangeProperty(info.info.x11.display, info.info.x11.wmwindow,

icon, XA_CARDINAL, 32, PropModeReplace, (void *) data, sizeof(data)/4);

}

}

info.info.x11.unlock_func();

} On Fri, Dec 29, 2017 at 11:29 AM, Alexei Svitkine <alexei.svitkine@gmail.com

wrote:

Using the Mac one seems fine. I'm fine with just checking in a converted version, even if it's in the form of a source file.

On Dec 29, 2017 8:03 AM, "dcoshea" notifications@github.com wrote:

As at ff129e8 https://github.com/cebix/macemu/commit/ff129e8649cff96f6ec1a99b470173e42ae31188, when running under CentOS 7 with KDE (version 4.14), the window title bar, the task manager bar at the bottom of the screen, and the Alt-Tab task switcher all show the default X icon.

I have been looking at addressing this using XChangeProperty() to set _NET_WM_ICON, but have some questions:

1.

It looks like the options are the Windows icon(s) in BasiliskII/src/Windows/BasiliskII.ico, which are only 32x32, or the MacOS X icons in BasiliskII/src/MacOSX/BasiliskII.icns, where both 32x32 and 128x128 icons are available (perhaps even higher-resolution icons are available but my version of libicns-utils isn't built to support them?). Both "work", but the Alt-Tab task switcher in KDE is designed to show large icons, so the 128x128 icon looks appropriate there, whereas the 32x32 icon available from Windows looks quite small (KDE doesn't upscale it). I assume there would be no complaints with me using the MacOS X icons? 2.

I could probably have the existing .ico or .icns file converted to something more useful at make time, but this would require some new rules in the Makefile and add dependencies on more tools at build time. Is it okay if I just commit the converted file to Git and document how to convert it?

Any advice on converting the icons into the format required by _NET_WM_ICON would be welcome. ImageMagick can generate a .h file in PNM format, but it has an ugly variable-length header (not too hard to parse, though) and loses the alpha channel.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cebix/macemu/issues/160, or mute the thread https://github.com/notifications/unsubscribe-auth/AABE8LjERxr5etmLilHmNF9Qmct_hot4ks5tFOMagaJpZM4RPGdo .

dcoshea commented 6 years ago

Thanks! I should have asked before I started writing any code :)