Re: Iconified windows




Kenneth Albanowski <kjahds@kjahds.com> writes:

> Silly question: how do I un-iconify a window? Also, how do I tell a window
> is iconfied?
> 
> My goal is a "show an existing window" function that knows to raise and
> uniconify the window, as needed. I can currently do this by hiding and
> showing the window, but this needlessly hides it if it is already visible. 

According to the ICCCM (inter-client-communication manual)

  gdk_window_show (widget->window)

should work. [No hide] A iconified window is unmapped by the window
manager; the WM will take the window being shown as a signal
to remove the icon.

Telling that the window is iconified is a bit trickier. If you
know you showed it, and never withdrew it (which isn't exported
into the GDK API anyways), you can just check if it is mapped -
which you can do with XGetWindowAttributes. (The necessary parts
aren't exported into GDK again, so you'd need to use gdkx.h)

A more different way is to check the WM_STATE property.

Something like (untested)

 guint32 wm_state = gdk_atom_intern ("WM_STATE");
 guchar *data;

 if (!gdk_property_get (widget->window, wm_state, wm_state,
                        0, 4, FALSE, NULL, NULL, NULL, &data))
   {
     /* Window was never shown?
      */
   }
 else
   {
     guint32 state = *(guint32 *)data;

     switch (state) 
       {
       case 0: /* withdrawn state */
       case 1: /* normal state */
       case 2: /* iconic state */
       }

     g_free (data);
   }

That probably could be encapsulated into a gdk_window function.

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]