Blame src/Iconify.c

Packit Service dc579d
Packit Service dc579d
/***********************************************************
Packit Service dc579d
Copyright 1988 by Wyse Technology, Inc., San Jose, Ca.
Packit Service dc579d
Packit Service dc579d
                        All Rights Reserved
Packit Service dc579d
Packit Service dc579d
Permission to use, copy, modify, and distribute this software and its
Packit Service dc579d
documentation for any purpose and without fee is hereby granted,
Packit Service dc579d
provided that the above copyright notice appear in all copies and that
Packit Service dc579d
both that copyright notice and this permission notice appear in
Packit Service dc579d
supporting documentation, and that the name Wyse not be
Packit Service dc579d
used in advertising or publicity pertaining to distribution of the
Packit Service dc579d
software without specific, written prior permission.
Packit Service dc579d
Packit Service dc579d
WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
Packit Service dc579d
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
Packit Service dc579d
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
Packit Service dc579d
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
Packit Service dc579d
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
Packit Service dc579d
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
Packit Service dc579d
SOFTWARE.
Packit Service dc579d
Packit Service dc579d
******************************************************************/
Packit Service dc579d
/*
Packit Service dc579d
Packit Service dc579d
Copyright 1988, 1998  The Open Group
Packit Service dc579d
Packit Service dc579d
Permission to use, copy, modify, distribute, and sell this software and its
Packit Service dc579d
documentation for any purpose is hereby granted without fee, provided that
Packit Service dc579d
the above copyright notice appear in all copies and that both that
Packit Service dc579d
copyright notice and this permission notice appear in supporting
Packit Service dc579d
documentation.
Packit Service dc579d
Packit Service dc579d
The above copyright notice and this permission notice shall be included
Packit Service dc579d
in all copies or substantial portions of the Software.
Packit Service dc579d
Packit Service dc579d
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Packit Service dc579d
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit Service dc579d
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Packit Service dc579d
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
Packit Service dc579d
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Packit Service dc579d
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Packit Service dc579d
OTHER DEALINGS IN THE SOFTWARE.
Packit Service dc579d
Packit Service dc579d
Except as contained in this notice, the name of The Open Group shall
Packit Service dc579d
not be used in advertising or otherwise to promote the sale, use or
Packit Service dc579d
other dealings in this Software without prior written authorization
Packit Service dc579d
from The Open Group.
Packit Service dc579d
Packit Service dc579d
*/
Packit Service dc579d
Packit Service dc579d
#ifdef HAVE_CONFIG_H
Packit Service dc579d
#include <config.h>
Packit Service dc579d
#endif
Packit Service dc579d
#include <X11/Xlibint.h>
Packit Service dc579d
#include <X11/Xatom.h>
Packit Service dc579d
#include <X11/Xos.h>
Packit Service dc579d
#include <X11/Xutil.h>
Packit Service dc579d
#include <stdio.h>
Packit Service dc579d
Packit Service dc579d
/*
Packit Service dc579d
 * This function instructs the window manager to change this window from
Packit Service dc579d
 * NormalState to IconicState.
Packit Service dc579d
 */
Packit Service dc579d
Status XIconifyWindow (
Packit Service dc579d
    Display *dpy,
Packit Service dc579d
    Window w,
Packit Service dc579d
    int screen)
Packit Service dc579d
{
Packit Service dc579d
    Atom prop;
Packit Service dc579d
Packit Service dc579d
    prop = XInternAtom (dpy, "WM_CHANGE_STATE", False);
Packit Service dc579d
    if (prop == None)
Packit Service dc579d
        return False;
Packit Service dc579d
    else {
Packit Service dc579d
        XClientMessageEvent ev = {
Packit Service dc579d
            .type = ClientMessage,
Packit Service dc579d
            .window = w,
Packit Service dc579d
            .message_type = prop,
Packit Service dc579d
            .format = 32,
Packit Service dc579d
            .data.l[0] = IconicState
Packit Service dc579d
        };
Packit Service dc579d
        Window root = RootWindow (dpy, screen);
Packit Service dc579d
Packit Service dc579d
        return (XSendEvent (dpy, root, False,
Packit Service dc579d
                            SubstructureRedirectMask|SubstructureNotifyMask,
Packit Service dc579d
                            (XEvent *)&ev));
Packit Service dc579d
    }
Packit Service dc579d
}