cvs commit notification test
[wmaker-crm.git] / wmlib / command.c
blob12740241e0809993ed45a1a0c6fa6e5172fabf6c
1 /* command.c - WindowMaker commands
3 * WMlib - WindowMaker application programming interface
5 * Copyright (C) 1997-2003 Alfredo K. Kojima
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <X11/Xlib.h>
23 #include <stdlib.h>
25 #include "WMaker.h"
26 #include "app.h"
28 static Atom
29 getwmfunc(Display *dpy)
31 return XInternAtom(dpy, "_WINDOWMAKER_WM_FUNCTION", False);
34 void
35 WMHideApplication(WMAppContext *app)
37 XEvent event;
39 event.xclient.type = ClientMessage;
40 event.xclient.message_type = getwmfunc(app->dpy);
41 event.xclient.format = 32;
42 event.xclient.display = app->dpy;
43 event.xclient.window = app->main_window;
44 event.xclient.data.l[0] = WMFHideApplication;
45 event.xclient.data.l[1] = 0;
46 event.xclient.data.l[2] = 0;
47 event.xclient.data.l[3] = 0;
48 XSendEvent(app->dpy, RootWindow(app->dpy, app->screen_number), False,
49 SubstructureNotifyMask|SubstructureRedirectMask, &event);
53 void
54 WMHideOthers(WMAppContext *app)
56 XEvent event;
58 event.xclient.type = ClientMessage;
59 event.xclient.message_type = getwmfunc(app->dpy);
60 event.xclient.format = 32;
61 event.xclient.display = app->dpy;
62 event.xclient.window = app->main_window;
63 event.xclient.data.l[0] = WMFHideOtherApplications;
64 event.xclient.data.l[1] = 0;
65 event.xclient.data.l[2] = 0;
66 event.xclient.data.l[3] = 0;
67 XSendEvent(app->dpy, RootWindow(app->dpy, app->screen_number), False,
68 SubstructureNotifyMask|SubstructureRedirectMask, &event);
74 void
75 WMSetWindowAttributes(Display *dpy, Window window,
76 GNUstepWMAttributes *attributes)
78 Atom atom;
80 atom = XInternAtom(dpy, "_GNUSTEP_WM_ATTR", False);
81 XChangeProperty(dpy, window, atom, atom, 32, PropModeReplace,
82 (unsigned char *)attributes,
83 sizeof(GNUstepWMAttributes)/sizeof(CARD32));