al_set_display_icon not working on Linux
Trying to use al_set_display_icon(display, al_load_bitmap("icon.tga"));, but doesn't work on Linux. Works fine on Windows with the same code and bitmap. Loading the icon from an archive with PhysFS.
On which window manager is this? Does the Allegro exemple program ex_icon work correctly for you?
On 16 Sep 2016 11:42 pm, "Emily" [email protected] wrote:
Trying to use al_set_display_icon(display, al_load_bitmap("icon.tga"));, but doesn't work on Linux. Works fine on Windows with the same code and bitmap.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/liballeg/allegro5/issues/676, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEWeYHI2sACnWgQ8sTr29_EjpiFv_Bnks5qqw1GgaJpZM4J_YCK .
Under Unity on Ubuntu it's more complicated than it needs to be. You need a .desktop file in ~/.local/share/applications and it needs to be perfectly configured.
Thanks for the tip. Sigh... Keeping on top of all these X window managers is like herding cats. We have standard for X wms, but apparently the Unity guys insist on going against the grain, much like their fellows did with the Mir debacle...
On 17 Sep 2016 12:10 am, "Trent Gamblin" [email protected] wrote:
Under Unity on Ubuntu it's more complicated than it needs to be. You need a .desktop file in ~/.local/share/applications and it needs to be perfectly configured.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/liballeg/allegro5/issues/676#issuecomment-247720629, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEWebKS2fjEbDhEjAHm_lUXgdGW81KJks5qqxO-gaJpZM4J_YCK .
I tried it on Xfwm4 with Xfce4, but I heard it doesn't work on Cinnamon either. I tried creating a desktop file with an icon and putting it in the same folder as the executable, but it didn't work.
ex_icon and ex_icon2 does work.
EDIT: Found the issue! I use the ALLEGRO_GTK_TOPLEVEL display flag to display the menu which breaks the icon for some reason. Removing the flag makes the icon show, but then the menu doesn't work...
It should work on Xfce. Perhaps you need to call it before creating the display. On Sep 16, 2016 4:47 PM, Emily [email protected] wrote:I tried it on Xfwm4 with Xfce4, but I heard it doesn't work on Cinnamon either. I tried creating a desktop file with an icon and putting it in the same folder as the executable, but it didn't work
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.
Looks like you missed my edit, but the ALLEGRO_GTK_TOPLEVEL flag is preventing the icon from working properly
Ah, in that case a temporary fix would be to use GTK to set the icon (see GTK docs.)
Hello,
Ah, in that case a temporary fix would be to use GTK to set the icon (see GTK docs.)
Can you give the code to do that? I don’t know how to get the GtkWindow from the ALLEGRO_DISPLAY. Couldn’t this bug simply be fixed?
I guess we could use something like:
gtk_window_set_icon(
(ALLEGRO_DISPLAY_XGLX *)display)->gtk->gtkwindow,
gdk_pixbuf_new_from_file("images/princess.png", NULL));
But the ALLEGRO_DISPLAY_XGLX structure is internal to Allegro…
I don’t even know how to distinguish between when this is necessary (i.e. using GTK+) and when it is not (e.g. using Windows). What are the macros? I remember Allegro 4 provided things like ALLEGRO_WINDOWS.
That is the only way to do it. You would need to copy the header or whatever the internal one. But it does work. I do it in one of my apps. There should be a function similar to win_get_window or whatever that returns the HWND.
You can see it here https://github.com/goob256/AshEdit/blob/main/src/main.cpp#L2107
OK, thank you very much for answering so fast. I probably won’t include so much code into my project, but it’s good to have this code linked from here. :+1:
On 2022-12-10 10:11, Sylvain wrote:
OK, thank you very much for answering so fast. I probably won’t include so much code into my project, but it’s good to have this code linked from here. 👍
-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you commented.Message ID: @.***>
Links:
[1] https://github.com/liballeg/allegro5/issues/676#issuecomment-1345284460 [2] https://github.com/notifications/unsubscribe-auth/AAF3DL5DTR732HPTOZR4QFDWMSMSFANCNFSM4CP5QCFA
Ok. That code is MIT if you changed your mind. All you need is that function and the headers.
I'm running into the same issue. The workaround suggested by @troutsneeze seems to be offline: https://github.com/goob256/AshEdit/blob/main/src/main.cpp#L2107