On Sat, 24 Nov 2012, Rodolfo García Peñas wrote:
The problem seems to be that icon->icon_win is not NULL :-)

That's not a problem. Some apps may have an icon window instead of a static icon (maybe they want to display something in the icon). Rather the problem might be that it is not ignored when the ignore client supplied icon option is set.

These code was there, but I am not sure if we can drop it?
I tried other apps, and all was fine.

Not sure either but you could try the attached test case (and check that minimising the window is OK too as the comment suggests that it may have something to do with that).

Regards,
BALATON Zoltan
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

Display *d;
Window leader, mainwin, win;
XClassHint class_hint = { "wmicontest", "WMIconTest" };

int main(int argc, char **argv)
{
  int ret;
  XWMHints hints;

  d = XOpenDisplay(NULL);
  if ( !d )
  {
    fprintf(stderr,"Cannot open display: %s\n", XDisplayName(NULL));
    exit(EXIT_FAILURE);
  }
  printf("Opened display %s\n", DisplayString(d));

  /* Create the leader window */
  leader = XCreateSimpleWindow(d, /* Display */
        DefaultRootWindow(d), /* Parent */
        10, 10, /* x, y */
        10, 10, /* width, height */
        0, /* border_width */
        BlackPixel(d, DefaultScreen(d)), /* border */
        WhitePixel(d, DefaultScreen(d))); /* background */
  printf("XCreateSimpleWindow returned: %lx\n", leader);

  /* Create the main window */
  mainwin = XCreateSimpleWindow(d, /* Display */
        DefaultRootWindow(d), /* Parent */
        0, 0, /* x, y */
        56, 56, /* width, height */
        0, /* border_width */
        BlackPixel(d, DefaultScreen(d)), /* border */
        WhitePixel(d, DefaultScreen(d))); /* background */
  printf("XCreateSimpleWindow returned: %lx\n", mainwin);

  /* Set hints */
  XSetClassHint(d, leader, &class_hint);
  hints.flags = StateHint|WindowGroupHint|IconWindowHint;
  hints.initial_state = WithdrawnState;
  hints.window_group = leader;
  hints.icon_window = mainwin;  /* Use the main window as the icon window */
  XSetWMHints(d, leader, &hints);

  XSetClassHint(d, mainwin, &class_hint);
  hints.flags = StateHint|WindowGroupHint;
  hints.initial_state = NormalState;
  XSetWMHints(d, mainwin, &hints);

  ret = XMapWindow(d, leader);
  printf("XMapWindow returned: %x\n", ret);

  XSync(d, False);
  getchar();

  /* Create a window */
  win = XCreateSimpleWindow(d, /* Display */
        DefaultRootWindow(d), /* Parent */
        100, 100, /* x, y */
        100, 100, /* width, height */
        0, /* border_width */
        BlackPixel(d, DefaultScreen(d)), /* border */
        WhitePixel(d, DefaultScreen(d))); /* background */
  printf("XCreateSimpleWindow returned: %lx\n", win);

  /* Set hints */
  XSetClassHint(d, win, &class_hint);
  XSetWMHints(d, win, &hints);

  ret = XMapRaised(d, win);
  printf("XMapRaised returned: %x\n", ret);

  XSync(d, False);
  getchar();

  XCloseDisplay(d);
  return(EXIT_SUCCESS);
}

Reply via email to