]>
Dogcows Code - chaz/openbox/blob - tests/confignotifymax.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 confignotify.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.
22 #include <X11/Xatom.h>
29 Atom _net_max
[2],_net_state
;
30 int x
=10,y
=10,h
=100,w
=100;
32 display
= XOpenDisplay(NULL
);
34 if (display
== NULL
) {
35 fprintf(stderr
, "couldn't connect to X server :0\n");
39 _net_state
= XInternAtom(display
, "_NET_WM_STATE", False
);
40 _net_max
[0] = XInternAtom(display
, "_NET_WM_STATE_MAXIMIZED_VERT", False
);
41 _net_max
[1] = XInternAtom(display
, "_NET_WM_STATE_MAXIMIZED_HORZ", False
);
43 win
= XCreateWindow(display
, RootWindow(display
, 0),
44 x
, y
, w
, h
, 0, CopyFromParent
, CopyFromParent
,
45 CopyFromParent
, 0, NULL
);
47 XSetWindowBackground(display
,win
,WhitePixel(display
,0));
48 XChangeProperty(display
, win
, _net_state
, XA_ATOM
, 32,
49 PropModeReplace
, (unsigned char*)&_net_max
, 2);
51 XSelectInput(display
, win
, (ExposureMask
| StructureNotifyMask
|
54 XMapWindow(display
, win
);
58 //XResizeWindow(display, win, w+5, h+5);
59 //XMoveWindow(display, win, x, y);
62 XNextEvent(display
, &report
);
64 switch (report
.type
) {
66 printf("map notify\n");
72 printf("gravity notify event 0x%x window 0x%x x %d y %d\n",
73 report
.xgravity
.event
, report
.xgravity
.window
,
74 report
.xgravity
.x
, report
.xgravity
.y
);
76 case ConfigureNotify
: {
77 int se
= report
.xconfigure
.send_event
;
78 int event
= report
.xconfigure
.event
;
79 int window
= report
.xconfigure
.window
;
80 int x
= report
.xconfigure
.x
;
81 int y
= report
.xconfigure
.y
;
82 int w
= report
.xconfigure
.width
;
83 int h
= report
.xconfigure
.height
;
84 int bw
= report
.xconfigure
.border_width
;
85 int above
= report
.xconfigure
.above
;
86 int or = report
.xconfigure
.override_redirect
;
87 printf("confignotify send %d ev 0x%x win 0x%x %i,%i-%ix%i bw %i\n"
88 " above 0x%x ovrd %d\n",
89 se
,event
,window
,x
,y
,w
,h
,bw
,above
,or);
This page took 0.038146 seconds and 4 git commands to generate.