]> Dogcows Code - chaz/openbox/blob - tests/restack.c
add a title to the session logout confirm prompt
[chaz/openbox] / tests / restack.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 extentsrequest.c for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
5
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.
10
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.
15
16 See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #include <stdio.h>
20 #include <unistd.h>
21 #include <X11/Xlib.h>
22 #include <X11/Xatom.h>
23
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;
31
32 display = XOpenDisplay(NULL);
33
34 if (display == NULL) {
35 fprintf(stderr, "couldn't connect to X server :0\n");
36 return 0;
37 }
38
39 _restack = XInternAtom(display, "_NET_RESTACK_WINDOW", False);
40
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));
45
46 XMapWindow(display, win);
47 XFlush(display);
48
49 printf("requesting bottom in 3\n");
50 sleep(3);
51
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);
65
66 printf("requesting top in 3\n");
67 sleep(3);
68
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);
82
83 printf("requesting bottomif in 3\n");
84 sleep(3);
85
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);
99
100 printf("requesting topif in 3\n");
101 sleep(3);
102
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);
116
117 printf("requesting opposite in 3\n");
118 sleep(3);
119
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);
133
134 while (1) {
135 XNextEvent(display, &report);
136 }
137
138 return 1;
139 }
This page took 0.037175 seconds and 4 git commands to generate.