From 92bc846ce16fe5fb63c2b4b38a780489e2979b11 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 3 Feb 2003 10:37:16 +0000 Subject: add some tests --- tests/modal.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/modal.c (limited to 'tests/modal.c') diff --git a/tests/modal.c b/tests/modal.c new file mode 100644 index 00000000..df778456 --- /dev/null +++ b/tests/modal.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include + +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; +} -- cgit v1.2.3