diff options
Diffstat (limited to 'tests')
45 files changed, 3831 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..9fc5fe8 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,6 @@ +files=$(wildcard *.c) + +all: $(files:.c=) + +%: %.c + $(CC) `pkg-config --cflags --libs glib-2.0` $(CFLAGS) -o $@ $^ -lX11 -lXext -L/usr/X11R6/lib -I/usr/X11R6/include diff --git a/tests/aspect.c b/tests/aspect.c new file mode 100644 index 0000000..1ae3a85 --- /dev/null +++ b/tests/aspect.c @@ -0,0 +1,79 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + aspect.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + XSetWindowAttributes xswa; + unsigned long xswamask; + Display *display; + Window win; + XEvent report; + int x=10,y=10,h=100,w=400; + XSizeHints size; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + xswa.win_gravity = StaticGravity; + xswamask = CWWinGravity; + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, xswamask, &xswa); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + size.flags = PAspect; + size.min_aspect.x = 3; + size.min_aspect.y = 3; + size.max_aspect.x = 3; + size.max_aspect.y = 3; + XSetWMNormalHints(display, win, &size); + + XMapWindow(display, win); + XFlush(display); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/big.c b/tests/big.c new file mode 100644 index 0000000..bc17c5a --- /dev/null +++ b/tests/big.c @@ -0,0 +1,68 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + big.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> + +int main () { + Display *display; + Window win; + XEvent report; + XEvent msg; + int x=10,y=10,h=2000,w=2000; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + sleep(2); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/borderchange.c b/tests/borderchange.c new file mode 100644 index 0000000..56d5500 --- /dev/null +++ b/tests/borderchange.c @@ -0,0 +1,107 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + borderchange.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> + +int main () { + Display *display; + Window win; + XEvent report; + XEvent msg; + int x=10,y=10,h=200,w=200; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + XMapWindow(display, win); + XFlush(display); + + while (XPending(display)) { + XNextEvent(display, &report); + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + } + sleep(2); + + printf("setting border to 0\n"); + XSetWindowBorderWidth(display, win, 0); + XFlush(display); + + while (XPending(display)) { + XNextEvent(display, &report); + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + } + sleep(2); + + printf("setting border to 50\n"); + XSetWindowBorderWidth(display, win, 50); + XFlush(display); + + while (XPending(display)) { + XNextEvent(display, &report); + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 0; +} diff --git a/tests/confignotify.c b/tests/confignotify.c new file mode 100644 index 0000000..4bb09f8 --- /dev/null +++ b/tests/confignotify.c @@ -0,0 +1,89 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + confignotify.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> + +int main () { + Display *display; + Window win; + XEvent report; + XEvent msg; + int x=10,y=10,h=100,w=100; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 0, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XSelectInput(display, win, (ExposureMask | StructureNotifyMask | + GravityNotify)); + + XMapWindow(display, win); + XFlush(display); + + sleep(1); + XResizeWindow(display, win, w+5, h+5); + XMoveWindow(display, win, x, y); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case MapNotify: + printf("map notify\n"); + break; + case Expose: + printf("exposed\n"); + break; + case GravityNotify: + printf("gravity notify event 0x%x window 0x%x x %d y %d\n", + report.xgravity.event, report.xgravity.window, + report.xgravity.x, report.xgravity.y); + break; + case ConfigureNotify: { + int se = report.xconfigure.send_event; + int event = report.xconfigure.event; + int window = report.xconfigure.window; + int x = report.xconfigure.x; + int y = report.xconfigure.y; + int w = report.xconfigure.width; + int h = report.xconfigure.height; + int bw = report.xconfigure.border_width; + int above = report.xconfigure.above; + int or = report.xconfigure.override_redirect; + printf("confignotify send %d ev 0x%x win 0x%x %i,%i-%ix%i bw %i\n" + " above 0x%x ovrd %d\n", + se,event,window,x,y,w,h,bw,above,or); + break; + } + } + + } + + return 1; +} diff --git a/tests/confignotifymax.c b/tests/confignotifymax.c new file mode 100644 index 0000000..0debf5e --- /dev/null +++ b/tests/confignotifymax.c @@ -0,0 +1,97 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + confignotify.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window win; + XEvent report; + XEvent msg; + Atom _net_max[2],_net_state; + int x=10,y=10,h=100,w=100; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + _net_state = XInternAtom(display, "_NET_WM_STATE", False); + _net_max[0] = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", False); + _net_max[1] = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 0, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + XChangeProperty(display, win, _net_state, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_net_max, 2); + + XSelectInput(display, win, (ExposureMask | StructureNotifyMask | + GravityNotify)); + + XMapWindow(display, win); + XFlush(display); + + //sleep(1); + //XResizeWindow(display, win, w+5, h+5); + //XMoveWindow(display, win, x, y); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case MapNotify: + printf("map notify\n"); + break; + case Expose: + printf("exposed\n"); + break; + case GravityNotify: + printf("gravity notify event 0x%x window 0x%x x %d y %d\n", + report.xgravity.event, report.xgravity.window, + report.xgravity.x, report.xgravity.y); + break; + case ConfigureNotify: { + int se = report.xconfigure.send_event; + int event = report.xconfigure.event; + int window = report.xconfigure.window; + int x = report.xconfigure.x; + int y = report.xconfigure.y; + int w = report.xconfigure.width; + int h = report.xconfigure.height; + int bw = report.xconfigure.border_width; + int above = report.xconfigure.above; + int or = report.xconfigure.override_redirect; + printf("confignotify send %d ev 0x%x win 0x%x %i,%i-%ix%i bw %i\n" + " above 0x%x ovrd %d\n", + se,event,window,x,y,w,h,bw,above,or); + break; + } + } + + } + + return 1; +} diff --git a/tests/cursorio.c b/tests/cursorio.c new file mode 100644 index 0000000..527d70c --- /dev/null +++ b/tests/cursorio.c @@ -0,0 +1,57 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + cursorio.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/cursorfont.h> + +int main () { + Display *display; + Window win, child; + XEvent report; + int x=10,y=10,h=100,w=400,b=10; + XSetWindowAttributes a; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, b, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + a.cursor = XCreateFontCursor(display, XC_watch); + child = XCreateWindow(display, win, + x+w/8, y+h/8, 3*w/4, 3*h/4, 0, + CopyFromParent, InputOnly, + CopyFromParent, CWCursor, &a); + + XMapWindow(display, child); + XMapWindow(display, win); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/duplicatesession.c b/tests/duplicatesession.c new file mode 100644 index 0000000..5abe995 --- /dev/null +++ b/tests/duplicatesession.c @@ -0,0 +1,66 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + duplicatesession.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <string.h> +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main (int argc, char **argv) { + Display *display; + Window win1, win2; + XEvent report; + int x=10,y=10,h=100,w=400; + XSizeHints size; + XTextProperty name; + Atom sm_id, enc; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + sm_id = XInternAtom(display,"SM_CLIENT_ID",False); + enc = XInternAtom(display,"STRING",False); + + win1 = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + win2 = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win1,WhitePixel(display,0)); + XSetWindowBackground(display,win2,BlackPixel(display,0)); + + XChangeProperty(display, win1, sm_id, enc, 8, + PropModeAppend, "abcdefg", strlen("abcdefg")); + XChangeProperty(display, win2, sm_id, enc, 8, + PropModeAppend, "abcdefg", strlen("abcdefg")); + + XFlush(display); + XMapWindow(display, win1); + XMapWindow(display, win2); + + while (1) + XNextEvent(display, &report); + + return 1; +} diff --git a/tests/extentsrequest.c b/tests/extentsrequest.c new file mode 100644 index 0000000..055624d --- /dev/null +++ b/tests/extentsrequest.c @@ -0,0 +1,133 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + extentsrequest.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +void request (Display *display, Atom _request, Atom _extents, Window win) { + XEvent msg; + msg.xclient.type = ClientMessage; + msg.xclient.message_type = _request; + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = 0l; + msg.xclient.data.l[1] = 0l; + msg.xclient.data.l[2] = 0l; + msg.xclient.data.l[3] = 0l; + msg.xclient.data.l[4] = 0l; + XSendEvent(display, RootWindow(display, 0), False, + SubstructureNotifyMask | SubstructureRedirectMask, &msg); + XFlush(display); +} + +void reply (Display* display, Atom _extents) { + printf(" waiting for extents\n"); + while (1) { + XEvent report; + XNextEvent(display, &report); + + if (report.type == PropertyNotify && + report.xproperty.atom == _extents) + { + Atom ret_type; + int ret_format; + unsigned long ret_items, ret_bytesleft; + unsigned long *prop_return; + XGetWindowProperty(display, report.xproperty.window, _extents, 0, 4, + False, XA_CARDINAL, &ret_type, &ret_format, + &ret_items, &ret_bytesleft, + (unsigned char**) &prop_return); + if (ret_type == XA_CARDINAL && ret_format == 32 && ret_items == 4) + printf(" got new extents %d, %d, %d, %d\n", + prop_return[0], prop_return[1], prop_return[2], + prop_return[3]); + break; + } + } +} + +int main () { + Display *display; + Window win; + Atom _request, _extents, _type, _normal, _desktop, _state; + Atom _state_fs, _state_mh, _state_mv; + int x=10,y=10,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + _type = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); + _normal = XInternAtom(display, "_NET_WM_WINDOW_TYPE_NORMAL", False); + _desktop = XInternAtom(display, "_NET_WM_WINDOW_TYPE_DESKTOP", False); + _request = XInternAtom(display, "_NET_REQUEST_FRAME_EXTENTS", False); + _extents = XInternAtom(display, "_NET_FRAME_EXTENTS", False); + _state = XInternAtom(display, "_NET_WM_STATE", False); + _state_fs = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False); + _state_mh = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); + _state_mv = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", False); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSelectInput(display, win, PropertyChangeMask); + + printf("requesting for type normal\n"); + XChangeProperty(display, win, _type, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_normal, 1); + request(display, _request, _extents, win); + reply(display, _extents); + + printf("requesting for type normal+fullscreen\n"); + XChangeProperty(display, win, _type, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_normal, 1); + XChangeProperty(display, win, _state, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_state_fs, 1); + request(display, _request, _extents, win); + reply(display, _extents); + + printf("requesting for type normal+maxv\n"); + XChangeProperty(display, win, _type, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_normal, 1); + XChangeProperty(display, win, _state, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_state_mv, 1); + request(display, _request, _extents, win); + reply(display, _extents); + + printf("requesting for type normal+maxh\n"); + XChangeProperty(display, win, _type, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_normal, 1); + XChangeProperty(display, win, _state, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_state_mh, 1); + request(display, _request, _extents, win); + reply(display, _extents); + + printf("requesting for type desktop\n"); + XChangeProperty(display, win, _type, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&_desktop, 1); + request(display, _request, _extents, win); + reply(display, _extents); + + return 1; +} diff --git a/tests/fakeunmap.c b/tests/fakeunmap.c new file mode 100644 index 0000000..d30a917 --- /dev/null +++ b/tests/fakeunmap.c @@ -0,0 +1,60 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + fakeunmap.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + Display *display; + Window win; + XEvent report; + XEvent msg; + int x=50,y=50,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + usleep(10000); + + msg.type = UnmapNotify; + msg.xunmap.display = display; + msg.xunmap.event = RootWindow(display, DefaultScreen(display)); + msg.xunmap.window = win; + msg.xunmap.from_configure = False; + XSendEvent(display, RootWindow(display, DefaultScreen(display)), False, + SubstructureRedirectMask|SubstructureNotifyMask, &msg); + usleep(10000); + + XUnmapWindow(display, win); + XSync(display, False); + + return 1; +} diff --git a/tests/fallback.c b/tests/fallback.c new file mode 100644 index 0000000..721ed31 --- /dev/null +++ b/tests/fallback.c @@ -0,0 +1,64 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + fallback.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window one, two; + XEvent report; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + one = XCreateWindow(display, RootWindow(display, 0), + 0,0,200,200, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + two = XCreateWindow(display, RootWindow(display, 0), + 0,0,150,150, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,one,WhitePixel(display,0)); + XSetWindowBackground(display,two,BlackPixel(display,0)); + + XSetTransientForHint(display, two, one); + + XMapWindow(display, one); + XFlush(display); + usleep(1000); + + XMapWindow(display, two); + XFlush(display); + usleep(1000); + + XDestroyWindow(display, two); + XFlush(display); + usleep(1000); + + XDestroyWindow(display, one); + XSync(display, False); + + return 1; +} diff --git a/tests/focusout.c b/tests/focusout.c new file mode 100644 index 0000000..03ba56f --- /dev/null +++ b/tests/focusout.c @@ -0,0 +1,224 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + focusout.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + Display *display; + Window win, child; + XEvent report; + Atom _net_fs, _net_state; + XEvent msg; + int x=50,y=50,h=100,w=400; + XWMHints hint; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + child = XCreateWindow(display, win, + 10, 10, w-20, h-20, 0, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + XSetWindowBackground(display,child,BlackPixel(display,0)); + + XSelectInput(display, win, + FocusChangeMask|EnterWindowMask|LeaveWindowMask); + XMapWindow(display, win); + XMapWindow(display, child); + + while (1) { + const char *mode, *detail; + + XNextEvent(display, &report); + + switch (report.type) { + case ButtonPress: + printf("button press\n"); + printf("type : %d\n", report.xbutton.type); + printf("serial : %d\n", report.xbutton.serial); + printf("send_event : %d\n", report.xbutton.send_event); + printf("display : 0x%x\n", report.xbutton.display); + printf("window : 0x%x\n", report.xbutton.window); + printf("root : 0x%x\n", report.xbutton.root); + printf("subwindow : 0x%x\n", report.xbutton.subwindow); + printf("time : %d\n", report.xbutton.time); + printf("x, y : %d, %d\n", report.xbutton.x, + report.xbutton.y); + printf("rootx, rooty: %d, %d\n", report.xbutton.x_root, + report.xbutton.y_root); + printf("state : 0x%x\n", report.xbutton.state); + printf("button : %d\n", report.xbutton.button); + printf("same_screen : %d\n", report.xbutton.same_screen); + printf("---\n"); + break; + case MotionNotify: + printf("motion\n"); + printf("type : %d\n", report.xmotion.type); + printf("serial : %d\n", report.xmotion.serial); + printf("send_event : %d\n", report.xmotion.send_event); + printf("display : 0x%x\n", report.xmotion.display); + printf("window : 0x%x\n", report.xmotion.window); + printf("root : 0x%x\n", report.xmotion.root); + printf("subwindow : 0x%x\n", report.xmotion.subwindow); + printf("time : %d\n", report.xmotion.time); + printf("x, y : %d, %d\n", report.xmotion.x, + report.xmotion.y); + printf("rootx, rooty: %d, %d\n", report.xmotion.x_root, + report.xmotion.y_root); + printf("state : 0x%x\n", report.xmotion.state); + printf("is_hint : %d\n", report.xmotion.is_hint); + printf("same_screen : %d\n", report.xmotion.same_screen); + printf("---\n"); + if (XGrabPointer(display, win, False, ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, None, None, + report.xmotion.time) == GrabSuccess) + printf("GrabSuccess\n"); + else + printf("GrabFail\n"); + break; + case ButtonRelease: + XUngrabPointer(display, report.xbutton.time); + break; + case FocusIn: + switch (report.xfocus.mode) { + case NotifyNormal: mode = "NotifyNormal"; break; + case NotifyGrab: mode = "NotifyGrab"; break; + case NotifyUngrab: mode = "NotifyUngrab"; break; + } + + switch (report.xfocus.detail) { + case NotifyAncestor: detail = "NotifyAncestor"; break; + case NotifyVirtual: detail = "NotifyVirtual"; break; + case NotifyInferior: detail = "NotifyInferior"; break; + case NotifyNonlinear: detail = "NotifyNonlinear"; break; + case NotifyNonlinearVirtual: + detail = "NotifyNonlinearVirtual"; break; + case NotifyPointer: detail = "NotifyPointer"; break; + case NotifyPointerRoot: detail = "NotifyPointerRoot"; break; + case NotifyDetailNone: detail = "NotifyDetailNone"; break; + } + printf("focusin\n"); + printf("type : %d\n", report.xfocus.type); + printf("serial : %d\n", report.xfocus.serial); + printf("send_event: %d\n", report.xfocus.send_event); + printf("display : 0x%x\n", report.xfocus.display); + printf("window : 0x%x\n", report.xfocus.window); + printf("mode : %s\n", mode); + printf("detail : %s\n", detail); + printf("---\n"); + break; + case FocusOut: + switch (report.xfocus.mode) { + case NotifyNormal: mode = "NotifyNormal"; break; + case NotifyGrab: mode = "NotifyGrab"; break; + case NotifyUngrab: mode = "NotifyUngrab"; break; + } + + switch (report.xfocus.detail) { + case NotifyAncestor: detail = "NotifyAncestor"; break; + case NotifyVirtual: detail = "NotifyVirtual"; break; + case NotifyInferior: detail = "NotifyInferior"; break; + case NotifyNonlinear: detail = "NotifyNonlinear"; break; + case NotifyNonlinearVirtual: + detail = "NotifyNonlinearVirtual"; break; + case NotifyPointer: detail = "NotifyPointer"; break; + case NotifyPointerRoot: detail = "NotifyPointerRoot"; break; + case NotifyDetailNone: detail = "NotifyDetailNone"; break; + } + printf("focusout\n"); + printf("type : %d\n", report.xfocus.type); + printf("serial : %d\n", report.xfocus.serial); + printf("send_event: %d\n", report.xfocus.send_event); + printf("display : 0x%x\n", report.xfocus.display); + printf("window : 0x%x\n", report.xfocus.window); + printf("mode : %s\n", mode); + printf("detail : %s\n", detail); + printf("---\n"); + break; + case EnterNotify: + switch (report.xcrossing.mode) { + case NotifyNormal: mode = "NotifyNormal"; break; + case NotifyGrab: mode = "NotifyGrab"; break; + case NotifyUngrab: mode = "NotifyUngrab"; break; + } + + switch (report.xcrossing.detail) { + case NotifyAncestor: detail = "NotifyAncestor"; break; + case NotifyVirtual: detail = "NotifyVirtual"; break; + case NotifyInferior: detail = "NotifyInferior"; break; + case NotifyNonlinear: detail = "NotifyNonlinear"; break; + case NotifyNonlinearVirtual: + detail = "NotifyNonlinearVirtual"; break; + case NotifyPointer: detail = "NotifyPointer"; break; + case NotifyPointerRoot: detail = "NotifyPointerRoot"; break; + case NotifyDetailNone: detail = "NotifyDetailNone"; break; + } + printf("enternotify\n"); + printf("type : %d\n", report.xcrossing.type); + printf("serial : %d\n", report.xcrossing.serial); + printf("send_event: %d\n", report.xcrossing.send_event); + printf("display : 0x%x\n", report.xcrossing.display); + printf("window : 0x%x\n", report.xcrossing.window); + printf("mode : %s\n", mode); + printf("detail : %s\n", detail); + printf("---\n"); + break; + case LeaveNotify: + switch (report.xcrossing.mode) { + case NotifyNormal: mode = "NotifyNormal"; break; + case NotifyGrab: mode = "NotifyGrab"; break; + case NotifyUngrab: mode = "NotifyUngrab"; break; + } + + switch (report.xcrossing.detail) { + case NotifyAncestor: detail = "NotifyAncestor"; break; + case NotifyVirtual: detail = "NotifyVirtual"; break; + case NotifyInferior: detail = "NotifyInferior"; break; + case NotifyNonlinear: detail = "NotifyNonlinear"; break; + case NotifyNonlinearVirtual: + detail = "NotifyNonlinearVirtual"; break; + case NotifyPointer: detail = "NotifyPointer"; break; + case NotifyPointerRoot: detail = "NotifyPointerRoot"; break; + case NotifyDetailNone: detail = "NotifyDetailNone"; break; + } + printf("leavenotify\n"); + printf("type : %d\n", report.xcrossing.type); + printf("serial : %d\n", report.xcrossing.serial); + printf("send_event: %d\n", report.xcrossing.send_event); + printf("display : 0x%x\n", report.xcrossing.display); + printf("window : 0x%x\n", report.xcrossing.window); + printf("mode : %s\n", mode); + printf("detail : %s\n", detail); + printf("---\n"); + break; + } + } + + return 1; +} diff --git a/tests/fullscreen.c b/tests/fullscreen.c new file mode 100644 index 0000000..6907cab --- /dev/null +++ b/tests/fullscreen.c @@ -0,0 +1,102 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + fullscreen.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> + +int main () { + Display *display; + Window win; + XEvent report; + Atom _net_fs, _net_state; + XEvent msg; + int x=10,y=10,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + _net_state = XInternAtom(display, "_NET_WM_STATE", False); + _net_fs = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + sleep(2); + + printf("fullscreen\n"); + msg.xclient.type = ClientMessage; + msg.xclient.message_type = _net_state; + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = 2; // toggle + msg.xclient.data.l[1] = _net_fs; + msg.xclient.data.l[2] = 0l; + msg.xclient.data.l[3] = 0l; + msg.xclient.data.l[4] = 0l; + XSendEvent(display, RootWindow(display, 0), False, + SubstructureNotifyMask | SubstructureRedirectMask, &msg); + XFlush(display); + sleep(2); + + printf("restore\n"); + msg.xclient.type = ClientMessage; + msg.xclient.message_type = _net_state; + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = 2; // toggle + msg.xclient.data.l[1] = _net_fs; + msg.xclient.data.l[2] = 0l; + msg.xclient.data.l[3] = 0l; + msg.xclient.data.l[4] = 0l; + XSendEvent(display, RootWindow(display, 0), False, + SubstructureNotifyMask | SubstructureRedirectMask, &msg); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/grav.c b/tests/grav.c new file mode 100644 index 0000000..772fec2 --- /dev/null +++ b/tests/grav.c @@ -0,0 +1,80 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + grav.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + Display *display; + Window win; + XEvent report; + int x=10,y=10,h=100,w=400,b=10; + XSizeHints *hints; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, b, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + hints = XAllocSizeHints(); + hints->flags = PWinGravity; + hints->win_gravity = SouthEastGravity; + XSetWMNormalHints(display, win, hints); + XFree(hints); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + + w = 600; + h = 160; + XMoveResizeWindow(display, win, 1172-w-b*2, 668-h-b*2, w, h); + XFlush(display); + sleep(1); + XResizeWindow(display, win, 900, 275); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/groupmodal.c b/tests/groupmodal.c new file mode 100644 index 0000000..12057eb --- /dev/null +++ b/tests/groupmodal.c @@ -0,0 +1,80 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + grouptran.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window one, two, group; + XEvent report; + XWMHints *wmhints; + Atom state, modal; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + state = XInternAtom(display, "_NET_WM_STATE", True); + modal = XInternAtom(display, "_NET_WM_STATE_MODAL", True); + + group = XCreateWindow(display, RootWindow(display, 0), + 0,0,1,1, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + one = XCreateWindow(display, RootWindow(display, 0), + 0,0,300,300, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + two = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,one,WhitePixel(display,0)); + XSetWindowBackground(display,two,BlackPixel(display,0)); + + XSetTransientForHint(display, two, RootWindow(display,0)); + XChangeProperty(display, two, state, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&modal, 1); + + wmhints = XAllocWMHints(); + + wmhints->flags = WindowGroupHint; + wmhints->window_group = group; + + XSetWMHints(display, one, wmhints); + XSetWMHints(display, two, wmhints); + + XFree(wmhints); + + XMapWindow(display, one); + XFlush(display); + sleep(1); + XMapWindow(display, two); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/grouptran.c b/tests/grouptran.c new file mode 100644 index 0000000..320da2f --- /dev/null +++ b/tests/grouptran.c @@ -0,0 +1,72 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + grouptran.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window one, two, group; + XEvent report; + XWMHints *wmhints; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + group = XCreateWindow(display, RootWindow(display, 0), + 0,0,1,1, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + one = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + two = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,one,WhitePixel(display,0)); + XSetWindowBackground(display,two,BlackPixel(display,0)); + + XSetTransientForHint(display, two, RootWindow(display,0)); + + wmhints = XAllocWMHints(); + + wmhints->flags = WindowGroupHint; + wmhints->window_group = group; + + XSetWMHints(display, one, wmhints); + XSetWMHints(display, two, wmhints); + + XFree(wmhints); + + XMapWindow(display, one); + XMapWindow(display, two); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/grouptran2.c b/tests/grouptran2.c new file mode 100644 index 0000000..4cd6c58 --- /dev/null +++ b/tests/grouptran2.c @@ -0,0 +1,79 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + grouptran2.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window main, grouptran, child, group; + XEvent report; + XWMHints *wmhints; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + group = XCreateWindow(display, RootWindow(display, 0), + 0,0,1,1, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + main = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + grouptran = XCreateWindow(display, RootWindow(display, 0), + 10,10,80,180, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + child = XCreateWindow(display, RootWindow(display, 0), + 20,20,60,60, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,main,WhitePixel(display,0)); + XSetWindowBackground(display,grouptran,BlackPixel(display,0)); + XSetWindowBackground(display,child,WhitePixel(display,0)); + + XSetTransientForHint(display, grouptran, RootWindow(display,0)); + XSetTransientForHint(display, child, grouptran); + + wmhints = XAllocWMHints(); + + wmhints->flags = WindowGroupHint; + wmhints->window_group = group; + + XSetWMHints(display, main, wmhints); + XSetWMHints(display, grouptran, wmhints); + XSetWMHints(display, child, wmhints); + + XFree(wmhints); + + XMapWindow(display, main); + XMapWindow(display, grouptran); + XMapWindow(display, child); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/grouptrancircular.c b/tests/grouptrancircular.c new file mode 100644 index 0000000..3853aef --- /dev/null +++ b/tests/grouptrancircular.c @@ -0,0 +1,73 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + grouptrancircular.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window one, two, group; + XEvent report; + XWMHints *wmhints; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + group = XCreateWindow(display, RootWindow(display, 0), + 0,0,1,1, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + one = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + two = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,one,WhitePixel(display,0)); + XSetWindowBackground(display,two,BlackPixel(display,0)); + + XSetTransientForHint(display, one, RootWindow(display,0)); + XSetTransientForHint(display, two, RootWindow(display,0)); + + wmhints = XAllocWMHints(); + + wmhints->flags = WindowGroupHint; + wmhints->window_group = group; + + XSetWMHints(display, one, wmhints); + XSetWMHints(display, two, wmhints); + + XFree(wmhints); + + XMapWindow(display, one); + XMapWindow(display, two); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/grouptrancircular2.c b/tests/grouptrancircular2.c new file mode 100644 index 0000000..1956c8f --- /dev/null +++ b/tests/grouptrancircular2.c @@ -0,0 +1,79 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + grouptrancircular.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window one, two, three, group; + XEvent report; + XWMHints *wmhints; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + group = XCreateWindow(display, RootWindow(display, 0), + 0,0,1,1, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + one = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + two = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + three = XCreateWindow(display, RootWindow(display, 0), + 0,0,100,100, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,one,WhitePixel(display,0)); + XSetWindowBackground(display,two,BlackPixel(display,0)); + + XSetTransientForHint(display, one, RootWindow(display,0)); + XSetTransientForHint(display, two, one); + XSetTransientForHint(display, three, two); + + wmhints = XAllocWMHints(); + + wmhints->flags = WindowGroupHint; + wmhints->window_group = group; + + XSetWMHints(display, one, wmhints); + XSetWMHints(display, two, wmhints); + XSetWMHints(display, three, wmhints); + + XFree(wmhints); + + XMapWindow(display, one); + XMapWindow(display, two); + XMapWindow(display, three); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/hideshow.py b/tests/hideshow.py new file mode 100755 index 0000000..2e7fc3a --- /dev/null +++ b/tests/hideshow.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +import pygtk +import gtk +import gobject +pygtk.require('2.0') + +class FolderSelector(gtk.Window): + def __init__(self, jules): + gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + print "init folder selector", self, jules + self.set_title("Select Folder") + self.jules = jules + + self.set_size_request(140, 200) + + self.list_model = gtk.ListStore(gobject.TYPE_STRING) + self.tree = gtk.TreeView(self.list_model) + self.folder_column = gtk.TreeViewColumn('Folder') + self.tree.append_column(self.folder_column) + + self.folder_cell = gtk.CellRendererText() + self.folder_column.pack_start(self.folder_cell, True) + self.folder_column.add_attribute(self.folder_cell, 'text', 0) + + self.tree.set_search_column(0) + + self.icon_theme = gtk.icon_theme_get_default() + + self.add(self.tree) + self.show_all() + self.tree.columns_autosize() + print "done init" + +class Jules(gtk.Window): + def __init__(self): + gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + self.set_title("Jules") + self.set_size_request(150, 320) + self.connect("delete_event", self.on_delete_event) + self.connect("destroy", self.on_destroy) + self.scroll = gtk.ScrolledWindow() + + self.tree_model = gtk.TreeStore(gobject.TYPE_STRING, + gobject.TYPE_STRING) + self.tree = gtk.TreeView(self.tree_model) + self.file_column = gtk.TreeViewColumn('name', gtk.CellRendererText(), + markup=0) + self.file_column.set_sort_indicator(True) + self.file_column.set_clickable(True) + self.file_column.set_sort_column_id(1) + self.tree.append_column(self.file_column) + self.tree.set_headers_clickable(True) + self.tree.set_search_column(0) + + self.scroll.add(self.tree) + self.add(self.scroll) + self.show_all() + + self.project_selector = FolderSelector(self) + self.project_selector.hide() + self.project_selector.hide() + + self.project_selector.show() + + def on_delete_event(self, widget, event): + return False + + def on_destroy(self, widget): + gtk.main_quit() + + def run(self): + gtk.main() + + +if __name__ == "__main__": + jules = Jules() + jules.run() diff --git a/tests/iconifydelay.c b/tests/iconifydelay.c new file mode 100644 index 0000000..d0d0573 --- /dev/null +++ b/tests/iconifydelay.c @@ -0,0 +1,67 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + iconifydelay.c for the Openbox window manager + Copyright (c) 2009 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + Display *display; + Window win; + XEvent report; + XEvent msg; + int x=50,y=50,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, DefaultScreen(display)), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSetWindowBackground(display, win, + WhitePixel(display, DefaultScreen(display))); + + usleep(1000000); + XMapWindow(display, win); + XFlush(display); + usleep(1000000); + + msg.xclient.type = ClientMessage; + msg.xclient.message_type = XInternAtom(display, "WM_CHANGE_STATE", False); + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = IconicState; + msg.xclient.data.l[1] = 0; + msg.xclient.data.l[2] = 0; + msg.xclient.data.l[3] = 0; + msg.xclient.data.l[4] = 0; + XSendEvent(display, RootWindow(display, DefaultScreen(display)), + False, SubstructureNotifyMask|SubstructureRedirectMask, &msg); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/icons.c b/tests/icons.c new file mode 100644 index 0000000..e2477c2 --- /dev/null +++ b/tests/icons.c @@ -0,0 +1,251 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + icons.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> +#include <X11/cursorfont.h> +#include <stdlib.h> +#include <stdio.h> +#include <assert.h> +#include <glib.h> + +Window findClient(Display *d, Window win) +{ + Window r, *children; + unsigned int n, i; + Atom state = XInternAtom(d, "WM_STATE", True); + Atom ret_type; + int ret_format; + unsigned long ret_items, ret_bytesleft; + unsigned long *prop_return; + + XQueryTree(d, win, &r, &r, &children, &n); + for (i = 0; i < n; ++i) { + Window w = findClient(d, children[i]); + if (w) return w; + } + + // try me + XGetWindowProperty(d, win, state, 0, 1, + False, state, &ret_type, &ret_format, + &ret_items, &ret_bytesleft, + (unsigned char**) &prop_return); + if (ret_type == None || ret_items < 1) + return None; + return win; // found it! +} + +int main(int argc, char **argv) +{ + Display *d = XOpenDisplay(NULL); + int s = DefaultScreen(d); + Atom net_wm_icon = XInternAtom(d, "_NET_WM_ICON", True); + Atom ret_type; + unsigned int winw = 0, winh = 0; + int ret_format; + unsigned long ret_items, ret_bytesleft; + const int MAX_IMAGES = 10; + unsigned long *prop_return[MAX_IMAGES]; + XImage *i[MAX_IMAGES]; + long offset = 0; + unsigned int image = 0; + unsigned int j; // loop counter + Window id, win; + Pixmap p; + Cursor cur; + XEvent ev; + unsigned int bs = sizeof(long); + + printf("Click on a window with an icon...\n"); + + //int id = strtol(argv[1], NULL, 16); + XUngrabPointer(d, CurrentTime); + cur = XCreateFontCursor(d, XC_crosshair); + XGrabPointer(d, RootWindow(d, s), False, ButtonPressMask, GrabModeAsync, + GrabModeAsync, None, cur, CurrentTime); + while (1) { + XNextEvent(d, &ev); + if (ev.type == ButtonPress) { + XUngrabPointer(d, CurrentTime); + id = findClient(d, ev.xbutton.subwindow); + break; + } + } + + printf("Using window 0x%lx\n", id); + + do { + unsigned int w, h; + + XGetWindowProperty(d, id, net_wm_icon, offset++, 1, + False, XA_CARDINAL, &ret_type, &ret_format, + &ret_items, &ret_bytesleft, + (unsigned char**) &prop_return[image]); + if (ret_type == None || ret_items < 1) { + printf("No icon found\n"); + return 1; + } + w = prop_return[image][0]; + XFree(prop_return[image]); + + XGetWindowProperty(d, id, net_wm_icon, offset++, 1, + False, XA_CARDINAL, &ret_type, &ret_format, + &ret_items, &ret_bytesleft, + (unsigned char**) &prop_return[image]); + if (ret_type == None || ret_items < 1) { + printf("Failed to get height\n"); + return 1; + } + h = prop_return[image][0]; + XFree(prop_return[image]); + + XGetWindowProperty(d, id, net_wm_icon, offset, w*h, + False, XA_CARDINAL, &ret_type, &ret_format, + &ret_items, &ret_bytesleft, + (unsigned char**) &prop_return[image]); + if (ret_type == None || ret_items < w*h) { + printf("Failed to get image data\n"); + return 1; + } + offset += w*h; + + printf("Found icon with size %dx%d\n", w, h); + + i[image] = XCreateImage(d, DefaultVisual(d, s), DefaultDepth(d, s), + ZPixmap, 0, NULL, w, h, 32, 0); + assert(i[image]); + i[image]->byte_order = LSBFirst; + i[image]->data = (char*)prop_return[image]; + for (j = 0; j < w*h; j++) { + unsigned char alpha = (unsigned char)i[image]->data[j*bs+3]; + unsigned char r = (unsigned char) i[image]->data[j*bs+0]; + unsigned char g = (unsigned char) i[image]->data[j*bs+1]; + unsigned char b = (unsigned char) i[image]->data[j*bs+2]; + + // background color + unsigned char bgr = 0; + unsigned char bgg = 0; + unsigned char bgb = 0; + + r = bgr + (r - bgr) * alpha / 256; + g = bgg + (g - bgg) * alpha / 256; + b = bgb + (b - bgb) * alpha / 256; + + i[image]->data[j*4+0] = (char) r; + i[image]->data[j*4+1] = (char) g; + i[image]->data[j*4+2] = (char) b; + } + + winw += w; + if (h > winh) winh = h; + + ++image; + } while (ret_bytesleft > 0 && image < MAX_IMAGES); + +#define hashsize(n) ((guint32)1<<(n)) +#define hashmask(n) (hashsize(n)-1) +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) + +#define mix(a,b,c) \ +{ \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ +} + +#define final(a,b,c) \ +{ \ + c ^= b; c -= rot(b,14); \ + a ^= c; a -= rot(c,11); \ + b ^= a; b -= rot(a,25); \ + c ^= b; c -= rot(b,16); \ + a ^= c; a -= rot(c,4); \ + b ^= a; b -= rot(a,14); \ + c ^= b; c -= rot(b,24); \ +} + + /* hash the images */ + for (j = 0; j < image; ++j) { + unsigned int w, h, length; + guint32 a,b,c; + guint32 initval = 0xf00d; + const guint32 *k = (guint32*)i[j]->data; + + w = i[j]->width; + h = i[j]->height; + length = w * h; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + (((guint32)length)<<2) + initval; + + /*---------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*--------------------------------- handle the last 3 uint32_t's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------ report the result */ + printf("image[%d] %ux%u %lu\n", j, w, h, c); + } + + win = XCreateSimpleWindow(d, RootWindow(d, s), 0, 0, winw, winh, + 0, 0, 0); + assert(win); + XMapWindow(d, win); + + p = XCreatePixmap(d, win, winw, winh, DefaultDepth(d, s)); + XFillRectangle(d, p, DefaultGC(d, s), 0, 0, winw, winh); + + for (j = 0; j < image; ++j) { + static unsigned int x = 0; + + XPutImage(d, p, DefaultGC(d, s), i[j], 0, 0, x, 0, + i[j]->width, i[j]->height); + x += i[j]->width; + XDestroyImage(i[j]); + } + + XSetWindowBackgroundPixmap(d, win, p); + XClearWindow(d, win); + + XFlush(d); + + getchar(); + + XFreePixmap(d, p); + XCloseDisplay(d); +} diff --git a/tests/mapiconic.c b/tests/mapiconic.c new file mode 100644 index 0000000..76455a0 --- /dev/null +++ b/tests/mapiconic.c @@ -0,0 +1,80 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + urgent.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + Display *display; + Window win; + XEvent report; + Atom wm_state; + XEvent msg; + int x=50,y=50,h=100,w=400; + unsigned long state[2]; + XWMHints *hints; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + state[0] = IconicState; + state[1] = None; + + wm_state = XInternAtom(display, "WM_STATE", False); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + hints = XAllocWMHints(); + hints->flags = StateHint; + hints->initial_state = IconicState; + XSetWMHints(display, win, hints); + XFree(hints); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/mingrow.c b/tests/mingrow.c new file mode 100644 index 0000000..b132fa1 --- /dev/null +++ b/tests/mingrow.c @@ -0,0 +1,100 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + noresize.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + XSetWindowAttributes xswa; + unsigned long xswamask; + Display *display; + Window win; + XEvent report; + int x=10,y=10,h=100,w=100; + XSizeHints size; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + xswa.win_gravity = StaticGravity; + xswamask = CWWinGravity; + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 0, CopyFromParent, CopyFromParent, + CopyFromParent, xswamask, &xswa); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + size.flags = PMinSize | PMaxSize; + size.max_width = 0; + size.min_width = w; + size.max_height = 0; + size.min_height = h; + XSetWMNormalHints(display, win, &size); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + XMapWindow(display, win); + XFlush(display); + + printf("sleeping 4.."); + fflush(stdout); + sleep(1); + printf("3.."); + fflush(stdout); + sleep(1); + printf("2.."); + fflush(stdout); + sleep(1); + printf("1.."); + fflush(stdout); + sleep(1); + printf("\n"); + + size.flags = PMinSize | PMaxSize; + size.max_width = 0; + size.min_width = w*2; + size.max_height = 0; + size.min_height = h*2; + XSetWMNormalHints(display, win, &size); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/modal.c b/tests/modal.c new file mode 100644 index 0000000..edbd5cc --- /dev/null +++ b/tests/modal.c @@ -0,0 +1,64 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + modal.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window parent, child; + XEvent report; + Atom state, modal; + int x=10,y=10,h=400,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + state = XInternAtom(display, "_NET_WM_STATE", True); + modal = XInternAtom(display, "_NET_WM_STATE_MODAL", True); + + parent = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + child = XCreateWindow(display, RootWindow(display, 0), + x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,parent,WhitePixel(display,0)); + XSetWindowBackground(display,child,BlackPixel(display,0)); + + XSetTransientForHint(display, child, parent); + XChangeProperty(display, child, state, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&modal, 1); + + XMapWindow(display, parent); + XMapWindow(display, child); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/modal2.c b/tests/modal2.c new file mode 100644 index 0000000..e7afb9b --- /dev/null +++ b/tests/modal2.c @@ -0,0 +1,74 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + modal2.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window parent, child; + XEvent report; + Atom state, modal; + int x=10,y=10,h=400,w=400; + XEvent ce; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + state = XInternAtom(display, "_NET_WM_STATE", True); + modal = XInternAtom(display, "_NET_WM_STATE_MODAL", True); + + parent = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + child = XCreateWindow(display, RootWindow(display, 0), + x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,parent,WhitePixel(display,0)); + XSetWindowBackground(display,child,BlackPixel(display,0)); + + XSetTransientForHint(display, child, parent); + + XMapWindow(display, parent); + XMapWindow(display, child); + XFlush(display); + + ce.xclient.type = ClientMessage; + ce.xclient.message_type = state; + ce.xclient.display = display; + ce.xclient.window = child; + ce.xclient.format = 32; + ce.xclient.data.l[0] = 1; + ce.xclient.data.l[1] = modal; + ce.xclient.data.l[2] = 0; + XSendEvent(display, RootWindow(display, DefaultScreen(display)), + False, SubstructureNotifyMask | SubstructureRedirectMask, &ce); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/modal3.c b/tests/modal3.c new file mode 100644 index 0000000..76c8219 --- /dev/null +++ b/tests/modal3.c @@ -0,0 +1,78 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + modal3.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window parent, child; + XEvent report; + Atom state, modal; + int x=10,y=10,h=400,w=400; + XEvent ce; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + state = XInternAtom(display, "_NET_WM_STATE", True); + modal = XInternAtom(display, "_NET_WM_STATE_MODAL", True); + + parent = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + child = XCreateWindow(display, RootWindow(display, 0), + x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,parent,WhitePixel(display,0)); + XSetWindowBackground(display,child,BlackPixel(display,0)); + + XSetTransientForHint(display, child, parent); + + XMapWindow(display, parent); + XMapWindow(display, child); + XFlush(display); + + ce.xclient.type = ClientMessage; + ce.xclient.message_type = state; + ce.xclient.display = display; + ce.xclient.window = child; + ce.xclient.format = 32; + ce.xclient.data.l[0] = 1; + ce.xclient.data.l[1] = modal; + ce.xclient.data.l[2] = 0; + XSendEvent(display, RootWindow(display, DefaultScreen(display)), + False, SubstructureNotifyMask | SubstructureRedirectMask, &ce); + + ce.xclient.data.l[0] = 0; + XSendEvent(display, RootWindow(display, DefaultScreen(display)), + False, SubstructureNotifyMask | SubstructureRedirectMask, &ce); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/noresize.c b/tests/noresize.c new file mode 100644 index 0000000..c98295b --- /dev/null +++ b/tests/noresize.c @@ -0,0 +1,82 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + noresize.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + XSetWindowAttributes xswa; + unsigned long xswamask; + Display *display; + Window win; + XEvent report; + int x=10,y=10,h=100,w=400; + XSizeHints size; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + xswa.win_gravity = StaticGravity; + xswamask = CWWinGravity; + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 0, CopyFromParent, CopyFromParent, + CopyFromParent, xswamask, &xswa); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + size.flags = PMinSize | PMaxSize; + size.max_width = 0; + size.min_width = w; + size.max_height = 0; + size.min_height = h; + XSetWMNormalHints(display, win, &size); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + XMapWindow(display, win); + XFlush(display); + + XMoveWindow(display, win, 10, 10); + XMoveWindow(display, win, 10, 10); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/oldfullscreen.c b/tests/oldfullscreen.c new file mode 100644 index 0000000..543e960 --- /dev/null +++ b/tests/oldfullscreen.c @@ -0,0 +1,94 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + oldfullscreen.c for the Openbox window manager + Copyright (c) 2010 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <string.h> +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +typedef struct +{ + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long inputMode; + unsigned long status; +} Hints; + +int main (int argc, char **argv) { + Display *display; + Window win; + Window r; + XEvent report; + int x=200,y=200,h=100,w=400,s; + XSizeHints *size; + Hints hints; + Atom prop; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + XGetGeometry(display, RootWindow(display, DefaultScreen(display)), &r, + &x, &y, &w, &h, &s, &s); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 0, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSetWindowBackground(display,win,WhitePixel(display,0)); + + size = XAllocSizeHints(); + size->flags = PPosition; + XSetWMNormalHints(display,win,size); + XFree(size); + + hints.flags = 2; + hints.decorations = 0; + prop = XInternAtom(display, "_MOTIF_WM_HINTS", False); + XChangeProperty(display, win, prop, prop, 32, PropModeReplace, + (unsigned char *)&hints, 5); + + XFlush(display); + XMapWindow(display, win); + + XSelectInput(display, win, StructureNotifyMask | ButtonPressMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case ButtonPress: + XUnmapWindow(display, win); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + s = report.xconfigure.send_event; + printf("confignotify %i,%i-%ix%i (send: %d)\n",x,y,w,h,s); + break; + } + + } + + return 1; +} diff --git a/tests/override.c b/tests/override.c new file mode 100644 index 0000000..44c3a00 --- /dev/null +++ b/tests/override.c @@ -0,0 +1,76 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + override.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> + +int main () { + XSetWindowAttributes xswa; + unsigned long xswamask; + Display *display; + Window win; + XEvent report; + int x=10,y=10,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + xswa.override_redirect = True; + xswamask = CWOverrideRedirect; + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, xswamask, &xswa); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + sleep(1); + XUnmapWindow(display, win); + XFlush(display); + sleep(1); + XMapWindow(display, win); + XFlush(display); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/overrideinputonly.c b/tests/overrideinputonly.c new file mode 100644 index 0000000..0c13ac3 --- /dev/null +++ b/tests/overrideinputonly.c @@ -0,0 +1,58 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + override.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> + +int main (int argc, char *argv[]) { + XSetWindowAttributes xswa; + unsigned long xswamask; + Display *display; + Window win; + XEvent report; + int i,x=0,y=0,h=1,w=1; + + for (i=0; i < argc; i++) { + if (!strcmp(argv[i], "-g") || !strcmp(argv[i], "-geometry")) { + XParseGeometry(argv[++i], &x, &y, &w, &h); + } + } + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + xswa.override_redirect = True; + xswamask = CWOverrideRedirect; + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 0, 0, InputOnly, + CopyFromParent, xswamask, &xswa); + + XMapWindow(display, win); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/positioned.c b/tests/positioned.c new file mode 100644 index 0000000..26f835d --- /dev/null +++ b/tests/positioned.c @@ -0,0 +1,73 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + positioned.c for the Openbox window manager + Copyright (c) 2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <string.h> +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main (int argc, char **argv) { + Display *display; + Window win; + XEvent report; + int x=200,y=200,h=100,w=400,s; + XSizeHints *size; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 0, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSetWindowBackground(display,win,WhitePixel(display,0)); + + size = XAllocSizeHints(); + size->flags = PPosition; + XSetWMNormalHints(display,win,size); + XFree(size); + + XFlush(display); + XMapWindow(display, win); + + XSelectInput(display, win, StructureNotifyMask | ButtonPressMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case ButtonPress: + XUnmapWindow(display, win); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + s = report.xconfigure.send_event; + printf("confignotify %i,%i-%ix%i (send: %d)\n",x,y,w,h,s); + break; + } + + } + + return 1; +} diff --git a/tests/resize.c b/tests/resize.c new file mode 100644 index 0000000..e3a84bb --- /dev/null +++ b/tests/resize.c @@ -0,0 +1,69 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + resize.c for the Openbox window manager + Copyright (c) 2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + Display *display; + Window win; + XEvent report; + int x=10,y=10,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + + sleep(5); + XResizeWindow(display, win, 600, 150); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/restack.c b/tests/restack.c new file mode 100644 index 0000000..fe1bcdb --- /dev/null +++ b/tests/restack.c @@ -0,0 +1,139 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + extentsrequest.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window win; + XEvent report; + Atom _restack; + XEvent msg; + int x=10,y=10,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + _restack = XInternAtom(display, "_NET_RESTACK_WINDOW", False); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + + printf("requesting bottom in 3\n"); + sleep(3); + + msg.xclient.type = ClientMessage; + msg.xclient.message_type = _restack; + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = 2l; + msg.xclient.data.l[1] = 0l; + msg.xclient.data.l[2] = Below; + msg.xclient.data.l[3] = 0l; + msg.xclient.data.l[4] = 0l; + XSendEvent(display, RootWindow(display, 0), False, + SubstructureNotifyMask | SubstructureRedirectMask, &msg); + XFlush(display); + + printf("requesting top in 3\n"); + sleep(3); + + msg.xclient.type = ClientMessage; + msg.xclient.message_type = _restack; + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = 2l; + msg.xclient.data.l[1] = 0l; + msg.xclient.data.l[2] = Above; + msg.xclient.data.l[3] = 0l; + msg.xclient.data.l[4] = 0l; + XSendEvent(display, RootWindow(display, 0), False, + SubstructureNotifyMask | SubstructureRedirectMask, &msg); + XFlush(display); + + printf("requesting bottomif in 3\n"); + sleep(3); + + msg.xclient.type = ClientMessage; + msg.xclient.message_type = _restack; + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = 2l; + msg.xclient.data.l[1] = 0l; + msg.xclient.data.l[2] = BottomIf; + msg.xclient.data.l[3] = 0l; + msg.xclient.data.l[4] = 0l; + XSendEvent(display, RootWindow(display, 0), False, + SubstructureNotifyMask | SubstructureRedirectMask, &msg); + XFlush(display); + + printf("requesting topif in 3\n"); + sleep(3); + + msg.xclient.type = ClientMessage; + msg.xclient.message_type = _restack; + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = 2l; + msg.xclient.data.l[1] = 0l; + msg.xclient.data.l[2] = TopIf; + msg.xclient.data.l[3] = 0l; + msg.xclient.data.l[4] = 0l; + XSendEvent(display, RootWindow(display, 0), False, + SubstructureNotifyMask | SubstructureRedirectMask, &msg); + XFlush(display); + + printf("requesting opposite in 3\n"); + sleep(3); + + msg.xclient.type = ClientMessage; + msg.xclient.message_type = _restack; + msg.xclient.display = display; + msg.xclient.window = win; + msg.xclient.format = 32; + msg.xclient.data.l[0] = 2l; + msg.xclient.data.l[1] = 0l; + msg.xclient.data.l[2] = Opposite; + msg.xclient.data.l[3] = 0l; + msg.xclient.data.l[4] = 0l; + XSendEvent(display, RootWindow(display, 0), False, + SubstructureNotifyMask | SubstructureRedirectMask, &msg); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/shape.c b/tests/shape.c new file mode 100644 index 0000000..c3de7da --- /dev/null +++ b/tests/shape.c @@ -0,0 +1,77 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + shape.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/extensions/shape.h> + +int main () { + + Display *display; + Window win; + XEvent report; + XEvent msg; + int x=50,y=50,h=100,w=400; + XWMHints hint; + XRectangle xrect; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + xrect.x = 10; + xrect.y = 10; + xrect.width = w - 20; + xrect.height = h - 20; + XShapeCombineRectangles(display, win, + ShapeBounding, 0, 0, &xrect, 1, + ShapeSet, Unsorted); + + XSetWindowBackground(display,win,BlackPixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/showhide.c b/tests/showhide.c new file mode 100644 index 0000000..d1a63e2 --- /dev/null +++ b/tests/showhide.c @@ -0,0 +1,54 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + showhide.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + Display *display; + Window win; + XEvent report; + XEvent msg; + int x=50,y=50,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + while (1) { + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSetWindowBackground(display,win,WhitePixel(display,0)); + XMapWindow(display, win); + XFlush(display); + usleep(1000); + XDestroyWindow(display, win); + XSync(display, False); + + break; + sleep(2); + } + + return 1; +} diff --git a/tests/skiptaskbar.c b/tests/skiptaskbar.c new file mode 100644 index 0000000..bb585c6 --- /dev/null +++ b/tests/skiptaskbar.c @@ -0,0 +1,63 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + skiptaskbar.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window win; + XEvent report; + Atom state, skip; + XClassHint classhint; + int x=10,y=10,h=400,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + state = XInternAtom(display, "_NET_WM_STATE", True); + skip = XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", True); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XChangeProperty(display, win, state, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&skip, 1); + + classhint.res_name = "test"; + classhint.res_class = "Test"; + XSetClassHint(display, win, &classhint); + + XMapWindow(display, win); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/skiptaskbar2.c b/tests/skiptaskbar2.c new file mode 100644 index 0000000..3fb2231 --- /dev/null +++ b/tests/skiptaskbar2.c @@ -0,0 +1,68 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + skiptaskbar2.c for the Openbox window manager + Copyright (c) 2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window win; + XEvent report, ce; + Atom state, skip; + int x=10,y=10,h=400,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + state = XInternAtom(display, "_NET_WM_STATE", True); + skip = XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", True); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + + sleep(1); + + ce.xclient.type = ClientMessage; + ce.xclient.message_type = state; + ce.xclient.display = display; + ce.xclient.window = win; + ce.xclient.format = 32; + ce.xclient.data.l[0] = 1; + ce.xclient.data.l[1] = skip; + ce.xclient.data.l[2] = 0; + XSendEvent(display, RootWindow(display, DefaultScreen(display)), + False, SubstructureNotifyMask | SubstructureRedirectMask, &ce); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/stackabove.c b/tests/stackabove.c new file mode 100644 index 0000000..791690f --- /dev/null +++ b/tests/stackabove.c @@ -0,0 +1,73 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + extentsrequest.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +/* Will find the frame for this window and stack itself right above it */ +#define GO_ABOVE 0x4c0003c + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window win, frame, a, p, *c; + unsigned int n; + XWindowChanges changes; + XEvent report; + XEvent msg; + int x=10,y=10,h=100,w=400; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + + printf("requesting move in 10\n"); + sleep(10); + + frame = win; + while (XQueryTree(display, frame, &a, &p, &c, &n) && p != a) + frame = p; + + changes.sibling = GO_ABOVE; + while (XQueryTree(display, changes.sibling, &a, &p, &c, &n) && p != a) + changes.sibling = p; + + changes.stack_mode = Above; + XConfigureWindow(display, frame, CWSibling | CWStackMode, &changes); + XFlush(display); + + printf("moved 0x%lx above 0x%lx\n", frame, changes.sibling); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/stacking.c b/tests/stacking.c new file mode 100644 index 0000000..4d2bda9 --- /dev/null +++ b/tests/stacking.c @@ -0,0 +1,80 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + stacking.c for the Openbox window manager + Copyright (c) 2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window parent, child1, child2, group; + XEvent report; + int x=10,y=10,h=400,w=400; + XWMHints *hints; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + group = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + parent = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + child1 = XCreateWindow(display, RootWindow(display, 0), + x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + child2 = XCreateWindow(display, RootWindow(display, 0), + x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,parent,WhitePixel(display,0)); + XSetWindowBackground(display,child1,BlackPixel(display,0)); + XSetWindowBackground(display,child2,WhitePixel(display,0)); + + hints = XAllocWMHints(); + hints->flags = WindowGroupHint; + hints->window_group = group; + XSetWMHints(display, parent, hints); + XSetWMHints(display, child1, hints); + XSetWMHints(display, child2, hints); + XFree(hints); + + XSetTransientForHint(display, child1, + RootWindow(display, DefaultScreen(display))); + XSetTransientForHint(display, child2, parent); + + XMapWindow(display, parent); + XFlush(display); + sleep(3); + XMapWindow(display, child1); + XFlush(display); + sleep(3); + XMapWindow(display, child2); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/strut.c b/tests/strut.c new file mode 100644 index 0000000..15a4860 --- /dev/null +++ b/tests/strut.c @@ -0,0 +1,84 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + strut.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window win; + XEvent report; + Atom _net_strut; + XEvent msg; + int x=10,y=10,h=100,w=400; + int s[4]; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + _net_strut = XInternAtom(display, "_NET_WM_STRUT", False); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + sleep(2); + + printf("top\n"); + s[0] = 0; s[1] = 0; s[2] = 20; s[3] = 0; + XChangeProperty(display, win, _net_strut, XA_CARDINAL, 32, + PropModeReplace, (unsigned char*) s, 4); + XFlush(display); + sleep(2); + + printf("none\n"); + XDeleteProperty(display, win, _net_strut); + XFlush(display); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/title.c b/tests/title.c new file mode 100644 index 0000000..799bdf5 --- /dev/null +++ b/tests/title.c @@ -0,0 +1,86 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + title.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <string.h> +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main (int argc, char **argv) { + Display *display; + Window win; + XEvent report; + int x=10,y=10,h=100,w=400; + XSizeHints size; + XTextProperty name; + Atom nameprop,nameenc; + + if (argc < 2) return 1; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + if (argc > 2) + nameprop = XInternAtom(display,argv[2],False); + else + nameprop = XInternAtom(display,"WM_NAME",False); + if (argc > 3) + nameenc = XInternAtom(display,argv[3],False); + else + nameenc = XInternAtom(display,"STRING",False); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + +// XStringListToTextProperty(&argv[1], 1, &name); +// XSetWMName(display, win, &name); + XChangeProperty(display, win, nameprop, nameenc, 8, + PropModeAppend, argv[1], strlen(argv[1])); + + XFlush(display); + XMapWindow(display, win); + + XSelectInput(display, win, ExposureMask | StructureNotifyMask); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/urgent.c b/tests/urgent.c new file mode 100644 index 0000000..c29e300 --- /dev/null +++ b/tests/urgent.c @@ -0,0 +1,77 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + urgent.c for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main () { + Display *display; + Window win; + XEvent report; + Atom _net_fs, _net_state; + XEvent msg; + int x=50,y=50,h=100,w=400; + XWMHints hint; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + _net_state = XInternAtom(display, "_NET_WM_STATE", False); + _net_fs = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + sleep(1); + + printf("urgent on\n"); + hint.flags = XUrgencyHint; + XSetWMHints(display, win, &hint); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case Expose: + printf("exposed\n"); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + printf("confignotify %i,%i-%ix%i\n",x,y,w,h); + break; + } + + } + + return 1; +} diff --git a/tests/usertimewin.c b/tests/usertimewin.c new file mode 100644 index 0000000..7a2aa97 --- /dev/null +++ b/tests/usertimewin.c @@ -0,0 +1,74 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + usertimewin.c for the Openbox window manager + Copyright (c) 2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> + +int main () { + Display *display; + Window win, twin; + XEvent report; + Atom atime, atimewin; + int x=10,y=10,h=400,w=400; + Time num; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + atime = XInternAtom(display, "_NET_WM_USER_TIME", True); + atimewin = XInternAtom(display, "_NET_WM_USER_TIME_WINDOW", True); + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + twin = XCreateWindow(display, RootWindow(display, 0), + x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent, + CopyFromParent, 0, 0); + + XSetWindowBackground(display,win,WhitePixel(display,0)); + + XMapWindow(display, win); + XFlush(display); + + sleep(2); + + printf("Setting time window\n"); + XChangeProperty(display, win, atimewin, XA_WINDOW, 32, + PropModeReplace, (unsigned char*)&twin, 1); + XFlush(display); + + sleep(1); + + num = 100; + printf("Setting time stamp on time window\n"); + XChangeProperty(display, twin, atime, XA_CARDINAL, 32, + PropModeReplace, (unsigned char*)&num, 1); + XFlush(display); + + while (1) { + XNextEvent(display, &report); + } + + return 1; +} diff --git a/tests/wmhints.c b/tests/wmhints.c new file mode 100644 index 0000000..b8ab57b --- /dev/null +++ b/tests/wmhints.c @@ -0,0 +1,97 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + oldfullscreen.c for the Openbox window manager + Copyright (c) 2010 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include <string.h> +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +typedef struct +{ + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long inputMode; + unsigned long status; +} Hints; + +int main (int argc, char **argv) { + Display *display; + Window win; + Window r; + XEvent report; + int x=200,y=200,h=100,w=400,s; + Hints hints; + Atom prop; + + display = XOpenDisplay(NULL); + + if (display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } + + win = XCreateWindow(display, RootWindow(display, 0), + x, y, w, h, 0, CopyFromParent, CopyFromParent, + CopyFromParent, 0, NULL); + XSetWindowBackground(display,win,WhitePixel(display,0)); + + hints.flags = 2; + hints.decorations = 0; + prop = XInternAtom(display, "_MOTIF_WM_HINTS", False); + XChangeProperty(display, win, prop, prop, 32, PropModeReplace, + (unsigned char *)&hints, 5); + + XSelectInput(display, win, StructureNotifyMask | ButtonPressMask); + + XMapWindow(display, win); + XFlush(display); + + sleep(1); + + hints.flags = 2; + hints.decorations = 1<<3 || 1 << 1; /* border and title */ + prop = XInternAtom(display, "_MOTIF_WM_HINTS", False); + XChangeProperty(display, win, prop, prop, 32, PropModeReplace, + (unsigned char *)&hints, 5); + + XMapWindow(display, win); + XFlush(display); + + + while (1) { + XNextEvent(display, &report); + + switch (report.type) { + case ButtonPress: + XUnmapWindow(display, win); + break; + case ConfigureNotify: + x = report.xconfigure.x; + y = report.xconfigure.y; + w = report.xconfigure.width; + h = report.xconfigure.height; + s = report.xconfigure.send_event; + printf("confignotify %i,%i-%ix%i (send: %d)\n",x,y,w,h,s); + break; + } + + } + + return 1; +} |