Re: [gtk-list] Minimized / Restored / Maximized window status and control ?



Havoc Pennington wrote:
> 
> Anthony Tekatch <tekatch@idirect.com> writes:
> > How can I tell if a window is minimized?
> >
> 
> I don't think you can, really...
> 
> 
> Havoc
> 

i use this code that requires some Xlib hacking but works.

/////////// ICONIFY STUFF /////////////
/* to iconify an existing window */
static void gdk_window_iconize (GdkWindow *window);
/* to maximise an existing window */
static void window_deiconify (GdkWindow *window);
/* to test if is iconized */
static gboolean window_is_iconified (GdkWindow *window);

/* to iconify an existing window */
void gdk_window_iconize (GdkWindow *window)
{
  GdkWindowPrivate *Private;
  g_return_if_fail (window != NULL);
  Private = (GdkWindowPrivate*) window;
  if (!Private->destroyed)
    XIconifyWindow (Private->xdisplay, Private->xwindow,0);
}

/* to maximise an existing window */
void
window_deiconify (GdkWindow *window)
{
  GdkWindowPrivate *Private;
  g_return_if_fail (window != NULL);
  Private = (GdkWindowPrivate*) window;
  XMapRaised (Private->xdisplay, Private->xwindow);
}

/* to test if is iconized */
gboolean
window_is_iconified (GdkWindow *window)
{
  XWindowAttributes xattr;
  GdkWindowPrivate *Private;
  g_return_val_if_fail (window != NULL,false);
  Private = (GdkWindowPrivate*) window;
  xattr.map_state = IsUnmapped;
  XGetWindowAttributes(Private->xdisplay, Private->xwindow, &xattr);
  return (xattr.map_state == IsUnmapped);
}


hope this helps.
/mario
-----------
Mario Motta
AI Research Group - Rimini - Italy
http://www.programmers.net/artic/Motta/vdk



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