TGMainFrame::SetIconPixmap not working?

Hello ROOTERS,

I am trying to set an icon and name to my root application.
TGMainFrame::SetClassHints does the trick for the name, but SetIconPixmap does nothing. I’m trying to call it with the argument (“record.png”).

  1. The picture is actually found in the root icons because the return value of the function is different than 0.
  2. It calls TGX11::SetIconPixmap which seems to run fine :
void TGX11::SetIconPixmap(Window_t id, Pixmap_t pic)
{
     std::cout << "TGX11" << std::endl;
    if (!id) return;
     std::cout << "here ok" << std::endl;
    XWMHints hints;
 
    hints.flags = IconPixmapHint;
    hints.icon_pixmap = (Pixmap) pic;
 
    XSetWMHints((Display*)fDisplay, (Window) id, &hints);
}

It prints “here ok” with success when I call TGMainFrame::SetIconPixmap.
3. I guess it comes from the line XSetWMHints(… ? But it seems it is related to X11 and I don’t know how to go further to find a solution.

Do you have any idea how to solve my problem ? Specifications below.

Many thanks !


_ROOT Version: 6.24/06
_Platform: Ubuntu 20.04.4 LTS
_Compiler: g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0


See TGMainFrame::SetIconPixmap(const char *iconName)
Can you provide a simple example showing the issue?

Here is a minimum example :

void test()
{
       TGMainFrame *f = new TGMainFrame(gClient->GetRoot(),800,600);
       f -> SetIconPixmap("/home/root/icons/bld_rgb.png");
       f -> SetClassHints("Testing", "Testing");
       f -> MapWindow();
}

launched with the command $root -l test.C.
Result image below :

Oh, OK, I see. It’s a known issue with the Window Manager of Ubuntu. I’ll have to set-up a VM and investigate, but it’s going to take some time…

1 Like

Sure, no problem ! Nothing urgent. Thanks for your time :slight_smile:

1 Like

Adding a comment to check if you found the issue ?
Thank you

Not yet, sorry, but this is quite low priority…

I understand that this is a minor issue, no problem. I was checking just in case. I might ask the question in few weeks then, unless you can update the post after the 14 days limit ?
Thanks for your time

Don’t worry, I can update any post after the 14 days limit :wink:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.