RE: [gtk-list] Minimizing/iconizing and maximizing/restoring win
- From: Pierre Hanser <hanser club-internet fr>
- To: gtk-list redhat com
- Subject: RE: [gtk-list] Minimizing/iconizing and maximizing/restoring win
- Date: Sat, 10 Oct 1998 08:44:52 +0200 (MET DST)
On 09-Oct-98 Ang Chin Han wrote:
> How do you minimize or maximize a window using GTK? I've skimmed
> through the sources (both 1.0 and 1.1) but it seems to be
> unimplemented.
>
Hello
I use a little file for these needs, collected from various
places and variousmessages on this list:
========
#include <gdk/gdkx.h>
#include "iconic.h"
/* 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 create a window in iconic state */
void window_iconify (GdkWindow *window)
{
XWMHints *xwmh;
GdkWindowPrivate *Private;
Private = (GdkWindowPrivate*) window;
xwmh = XGetWMHints (Private->xdisplay, Private->xwindow);
xwmh->initial_state = IconicState;
xwmh->flags |= StateHint;
XSetWMHints (Private->xdisplay, Private->xwindow, xwmh);
}
/* useful with some window managers to get key presses */
gboolean window_wm_input (GdkWindow *window)
{
XWMHints *xwmh;
GdkWindowPrivate *Private;
Private = (GdkWindowPrivate*) window;
xwmh = XGetWMHints (Private->xdisplay, Private->xwindow);
if (xwmh == NULL) return false ;
xwmh->input = True;
xwmh->flags |= InputHint;
XSetWMHints (Private->xdisplay, Private->xwindow, xwmh);
return true ;
}
/* to maximise an existing window */
void
window_deiconify (GdkWindow *window)
{
GdkWindowPrivate *Private;
Private = (GdkWindowPrivate*) window;
XMapRaised (Private->xdisplay, Private->xwindow);
}
/* to test if ... */
gboolean
window_is_iconified (GdkWindow *window)
{
XWindowAttributes xattr;
GdkWindowPrivate *Private;
Private = (GdkWindowPrivate*) window;
xattr.map_state = IsUnmapped;
XGetWindowAttributes(Private->xdisplay, Private->xwindow, &xattr);
return (xattr.map_state == IsUnmapped);
}
/* to modify the current icon */
gboolean window_affect_icon (GdkWindow *window)
{
XWMHints *xwmh;
GdkWindowPrivate *Private;
Private = (GdkWindowPrivate*) window;
xwmh = XGetWMHints (Private->xdisplay, Private->xwindow);
if (xwmh == NULL) return false ;
XSetWMHints (Private->xdisplay, Private->xwindow, xwmh);
return true ;
}
=======
I do not make any claim on this code...but use it and
be happy.
Pierre Hanser: hanser@club-internet.fr
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]