Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Sporadic Icon Failure in Ubuntu  (Read 12764 times)

0 Members and 1 Guest are viewing this topic.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #15 on: October 19, 2013, 01:44:18 am »
Xfce is ok(see attachment).
Icon was this as png loaded with sf::Image : http://www.cafebink.com/wp-content/uploads/2013/01/mug_of_beer-7581.jpg
Nope, I did not resize. 1600x1200 icons all the way. 8)
Maybe it's your virtualiztion software messing it up?
I can try install some other DE (or two or three) and see if it runs ok too.
int main()
{
    sf::RenderWindow app(sf::VideoMode(640,480),"hehe");
   
    sf::Image img;
    img.loadFromFile("/home/frex/NetBeansProjects/resources/beer.png");
   
    app.setIcon(img.getSize().x,img.getSize().y,img.getPixelsPtr());
   
   
    while(app.isOpen())
    {
        sf::Event eve;
        while(app.pollEvent(eve)) if(eve.type==sf::Event::Closed) app.close();
        app.clear();
        app.display();
    }
}
Of course I'm not going to install Ubuntu over my beloved Fedora from my beloved Red Hat. ;)
« Last Edit: October 19, 2013, 01:49:02 am by FRex »
Back to C++ gamedev with SFML in May 2023

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #16 on: October 19, 2013, 02:05:35 am »
Maybe it's your virtualiztion software messing it up?

As mentioned before, if this was the case we'd expect it to affect other programs in the system, not just SFML test programs.  Yet I've never seen any of this behavior from any other program in any of the desktop managers.  So there must be something all the other programs are doing that SFML isn't.

I'll try xfce later.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #17 on: October 19, 2013, 05:32:05 am »
Wow, you're right, xfce seems to perform correctly on that opengl test program.

Unfortunately some of the other test programs I'm using aren't working on it  For instance, I have a copy of firefox's desktop entry with no changes except the Exec line is "pinta" instead of "firefox", and in xfce and other DE's the result of that is Pinta with the default icon, not firefox's icon and not pinta's icon.

On Ubuntu this test program sometimes produces an icon which appears to be a blue square with a fuzzy white border...I have no idea wtf that is.

We're clearly missing something huge and fundamental about how icons work on Linux.  Neither the Icon line in a desktop entry nor the icon_pixmap hint sent to the X server come close to having a strong correlation with what actually appears onscreen.

P.S.: I can see why you use xfce though.  Just from doing this testing I'm already liking what I see of it.
« Last Edit: October 19, 2013, 05:37:10 am by Ixrec »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #18 on: October 19, 2013, 07:28:02 am »
Since Qt didn't work I decided to try wxWidgets.  I finally found the X11 icon code in their sources (utilsx11.cpp), so I'll try adapting it for SFML tomorrow.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #19 on: October 19, 2013, 01:59:50 pm »
setIcon didn't work for me on KWin too(uninstalled KDE already too, sorry :P).
I use xfce because it's so cute, light, minimalistic and ok-ish out of the box, I kinda like KDE a tiny bit more and if KWin shipped with Wayland in Fedora and I had patience to learn KDE shortcuts and mouse gestures and configure everything in it throughly to my preferences it'd probably feel better than xfce.
Oh and I installed 19 from CD(17 GNOME and 18 KDE from DVDs and I wanted to try xfce now anyway) so GNOME and KDE wouldn't fit on it. ;D Cause I'm such pro h4cker I don't have a pendrive to install from. ;D
« Last Edit: October 19, 2013, 02:12:01 pm by FRex »
Back to C++ gamedev with SFML in May 2023

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #20 on: October 20, 2013, 04:23:03 am »
Good news: I found some code that appears to be working consistently (ie, the same set of custom icons is ALWAYS used in ALL window managers, NEVER the default icons).  I'll give a detailed report once I've tested it inside SFML and played with more than just two sizes.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #21 on: October 20, 2013, 04:31:14 am »
Quote
ALL window managers
There's like 20+ of them. ;D
Because Linux is about choice, and by Linux I mean Unix because choice extends to kernels. ;D
(Joke totally stolen from Daniel Stone :P)

Can't you already say what solution/code/dark magic ritual it is and which toolkit/library/manual/necronomicon you found it in?
Back to C++ gamedev with SFML in May 2023

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #22 on: October 20, 2013, 04:36:50 am »
Well the source was http://stackoverflow.com/questions/10699927/xlib-argb-window-icon, but just getting that code to compile took several minutes, and merely plugging in the central parts to setIcon() doesn't seem to work (it's pretty similar to Laurent's Qt attempt actually), so I have a long way to go before I can claim to have the complete code for an actual solution.

And I meant the five I've tested with so far.  I'm a bit excited that something finally worked, so cut me some slack =P

Edit: Not making much progress so far.  Trying to change the test code and SFML's internals to be closer to each other, and it seems like everything is either a little change that has no effect, or a big one that completely breaks the one program so it no longer shows a window at all.  Great.
« Last Edit: October 20, 2013, 05:03:13 am by Ixrec »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #23 on: October 21, 2013, 11:53:53 pm »
Is it just me, or does the "X11" test program fail to exit without causing a fatal X server error?


Note that you must run it from the terminal to see this error, and it doesn't appear until after you close the window.
I downloaded and rebuilt a fresh copy of the source code in a different folder just to be sure I wasn't the one causing this.

It looks like I've been wasting a huge amount of time trying to get the icon code I mentioned before to run without any X errors like this, much less run inside SFML without breaking anything, when the icon code itself was never causing the problems >_>
« Last Edit: October 21, 2013, 11:56:12 pm by Ixrec »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #24 on: October 22, 2013, 10:55:59 am »
I think I'm officially out of ideas for this one.  That little code snippet can be made to work in isolation but whenever I try to put the key parts inside SFML it no longer has any significant effect (at least in Unity), and I've failed to find even the slightest hint as to why that is.  Every experiment I do seems to have different results every time I do it.  Plus, not once have I ever gotten a non-blurry custom icon to appear in Unity (which is starting to seriously piss me off).

All I can say for sure is that the approach with _NET_WM_ICON and XChangeProperty() is probably the right one because every source other than the current SFML code seems to use that.  At least, out of the ones that had any X11 icon code at all.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #25 on: October 22, 2013, 11:07:43 am »
Quote
That little code snippet can be made to work in isolation
Do you mean that you tried it in a minimal X11 application written from scratch? Or something else?
Laurent Gomila - SFML developer

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #26 on: October 22, 2013, 11:43:33 am »
At first I replaced most of the SFML test program called X11 with that code, so that CMake magic took care of all the headers and linking for me.

Later on I've been using essentially the original test program's code with parts of that snippet added to it instead of replacing it, since that also seems to work (fatal errors aside).  I have no idea which iteration of this was the most successful (if any), so here's what my X11.cpp looks like right now after a quick cleanup: http://pastebin.com/ABDLqvjp

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #27 on: October 22, 2013, 11:51:57 am »
What you should do is to write a really minimal X11 program that only creates a window, process its events and of course changes its icon. This one should work.
Then you write the same thing, but with the X11 implementation extracted from SFML. This one should fail.

Once you have two minimal apps, once that fails and one that works, it should be fairly easy to spot the difference.

If you have time and motivation, of course :)
Laurent Gomila - SFML developer

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Sporadic Icon Failure in Ubuntu
« Reply #28 on: October 22, 2013, 09:47:44 pm »
That's exactly what I thought I was doing the last three days.