Change "plain" to "exact" for If's <title>
[openbox.git] / tests / restack.c
blobfe1bcdb62f0a60cd6711add8cb5cec47f5b4f8cf
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 extentsrequest.c for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
19 #include <stdio.h>
20 #include <unistd.h>
21 #include <X11/Xlib.h>
22 #include <X11/Xatom.h>
24 int main () {
25 Display *display;
26 Window win;
27 XEvent report;
28 Atom _restack;
29 XEvent msg;
30 int x=10,y=10,h=100,w=400;
32 display = XOpenDisplay(NULL);
34 if (display == NULL) {
35 fprintf(stderr, "couldn't connect to X server :0\n");
36 return 0;
39 _restack = XInternAtom(display, "_NET_RESTACK_WINDOW", False);
41 win = XCreateWindow(display, RootWindow(display, 0),
42 x, y, w, h, 10, CopyFromParent, CopyFromParent,
43 CopyFromParent, 0, NULL);
44 XSetWindowBackground(display,win,WhitePixel(display,0));
46 XMapWindow(display, win);
47 XFlush(display);
49 printf("requesting bottom in 3\n");
50 sleep(3);
52 msg.xclient.type = ClientMessage;
53 msg.xclient.message_type = _restack;
54 msg.xclient.display = display;
55 msg.xclient.window = win;
56 msg.xclient.format = 32;
57 msg.xclient.data.l[0] = 2l;
58 msg.xclient.data.l[1] = 0l;
59 msg.xclient.data.l[2] = Below;
60 msg.xclient.data.l[3] = 0l;
61 msg.xclient.data.l[4] = 0l;
62 XSendEvent(display, RootWindow(display, 0), False,
63 SubstructureNotifyMask | SubstructureRedirectMask, &msg);
64 XFlush(display);
66 printf("requesting top in 3\n");
67 sleep(3);
69 msg.xclient.type = ClientMessage;
70 msg.xclient.message_type = _restack;
71 msg.xclient.display = display;
72 msg.xclient.window = win;
73 msg.xclient.format = 32;
74 msg.xclient.data.l[0] = 2l;
75 msg.xclient.data.l[1] = 0l;
76 msg.xclient.data.l[2] = Above;
77 msg.xclient.data.l[3] = 0l;
78 msg.xclient.data.l[4] = 0l;
79 XSendEvent(display, RootWindow(display, 0), False,
80 SubstructureNotifyMask | SubstructureRedirectMask, &msg);
81 XFlush(display);
83 printf("requesting bottomif in 3\n");
84 sleep(3);
86 msg.xclient.type = ClientMessage;
87 msg.xclient.message_type = _restack;
88 msg.xclient.display = display;
89 msg.xclient.window = win;
90 msg.xclient.format = 32;
91 msg.xclient.data.l[0] = 2l;
92 msg.xclient.data.l[1] = 0l;
93 msg.xclient.data.l[2] = BottomIf;
94 msg.xclient.data.l[3] = 0l;
95 msg.xclient.data.l[4] = 0l;
96 XSendEvent(display, RootWindow(display, 0), False,
97 SubstructureNotifyMask | SubstructureRedirectMask, &msg);
98 XFlush(display);
100 printf("requesting topif in 3\n");
101 sleep(3);
103 msg.xclient.type = ClientMessage;
104 msg.xclient.message_type = _restack;
105 msg.xclient.display = display;
106 msg.xclient.window = win;
107 msg.xclient.format = 32;
108 msg.xclient.data.l[0] = 2l;
109 msg.xclient.data.l[1] = 0l;
110 msg.xclient.data.l[2] = TopIf;
111 msg.xclient.data.l[3] = 0l;
112 msg.xclient.data.l[4] = 0l;
113 XSendEvent(display, RootWindow(display, 0), False,
114 SubstructureNotifyMask | SubstructureRedirectMask, &msg);
115 XFlush(display);
117 printf("requesting opposite in 3\n");
118 sleep(3);
120 msg.xclient.type = ClientMessage;
121 msg.xclient.message_type = _restack;
122 msg.xclient.display = display;
123 msg.xclient.window = win;
124 msg.xclient.format = 32;
125 msg.xclient.data.l[0] = 2l;
126 msg.xclient.data.l[1] = 0l;
127 msg.xclient.data.l[2] = Opposite;
128 msg.xclient.data.l[3] = 0l;
129 msg.xclient.data.l[4] = 0l;
130 XSendEvent(display, RootWindow(display, 0), False,
131 SubstructureNotifyMask | SubstructureRedirectMask, &msg);
132 XFlush(display);
134 while (1) {
135 XNextEvent(display, &report);
138 return 1;