After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 440691 - WM_HINTS: Initial state IconicState is not honored
WM_HINTS: Initial state IconicState is not honored
Status: RESOLVED DUPLICATE of bug 360900
Product: metacity
Classification: Other
Component: general
2.16.x
Other Linux
: Normal normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2007-05-23 13:02 UTC by Anthony Petrov
Modified: 2007-05-23 23:57 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16



Description Anthony Petrov 2007-05-23 13:02:46 UTC
An application developer may use the WM_HINTS window property to specify an initial state for a top-level window (either normal, iconic, or withdrawn state.) Window Managers are supposed to honor the initial state when the window is mapped for the first time. 

Running the test case (provided below) on Metacity 2.8.1 (GNOME 2.6.1) and Kwin 3.0 (KDE 3.4.0b) does not introduce any problems. However, when the test is ran on Metacity 2.16.1 (GNOME 2.16.1), the window is not in iconic state but rather in normal state when it's first shown. Using xprop one may make sure that the initial iconic state is correctly set in the WM_HINTS property, but the window changes its state to NormalState when it gets mapped.

The test code:

#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xos.h>
#include <X11/Xutil.h>

#include <stdio.h>

Display *display;
int screen_num;
Window root;

Window create_window(char * name, int x, int y, int width, int height) 
{
    XSizeHints sh;
    XWMHints wmh;
    Window win = XCreateSimpleWindow(display, root, x, y, width, height,
                                     2, // border width
                              BlackPixel(display, screen_num),
                              WhitePixel(display, screen_num));                 
    XStoreName(display, win, name);
    XSelectInput(display, win, ButtonPressMask | KeyPressMask);
    
    sh.width = width;
    sh.height = height;
    sh.x = x;
    sh.y = y;
    sh.flags = USPosition | USSize;
    XSetWMNormalHints(display, win, &sh);


    wmh.initial_state = IconicState;
    wmh.flags = StateHint;
    XSetWMHints(display, win, &wmh);

    return win;
}

int main(int argc, char **argv)
{
  Window f1;
  XEvent ev;
  XButtonEvent bev;

  int i, k;

  char *display_name = NULL;
  if ((display = XOpenDisplay(display_name)) == NULL)
  {
    fprintf(stderr, "Couldn't open %s\n", XDisplayName(display_name));
    return -1;
  }
  screen_num = DefaultScreen(display);
  root = RootWindow(display, screen_num);

  f1 = create_window("Frame 1", 100, 100, 200, 200);
  XMapWindow(display, f1);

  XFlush(display);
  XSync(display, False);

  while (1)
  {
    XNextEvent(display, &ev);
    if (ev.type == ButtonPress)
    {
      fprintf(stderr, "Hello, world!\n");
      exit(0);
    }
  }
}
Comment 1 Elijah Newren 2007-05-23 23:57:05 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.


*** This bug has been marked as a duplicate of 360900 ***