]>
Dogcows Code - chaz/openbox/blob - render/test.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 test.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003 Ben Jansens
6 Copyright (c) 2003 Derek Foreman
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 See the COPYING file for a copy of the GNU General Public License.
23 #include <X11/Xutil.h>
24 #include <X11/extensions/shape.h>
30 static gint
x_error_handler(Display
* disp
, XErrorEvent
* error
)
33 XGetErrorText(disp
, error
->error_code
, buf
, 1024);
50 gint h
= 500, w
= 500;
52 ob_display
= XOpenDisplay(NULL
);
53 XSetErrorHandler(x_error_handler
);
54 ob_screen
= DefaultScreen(ob_display
);
55 ob_root
= RootWindow(ob_display
, ob_screen
);
57 XCreateWindow(ob_display
, RootWindow(ob_display
, 0),
59 CopyFromParent
, /* depth */
60 CopyFromParent
, /* class */
61 CopyFromParent
, /* visual */
64 XMapWindow(ob_display
, win
);
65 XSelectInput(ob_display
, win
, ExposureMask
| StructureNotifyMask
);
66 root
= RootWindow (ob_display
, DefaultScreen (ob_display
));
67 inst
= RrInstanceNew(ob_display
, ob_screen
);
69 look
= RrAppearanceNew(inst
, 0);
70 look
->surface
.grad
= RR_SURFACE_PYRAMID
;
71 look
->surface
.secondary
= RrColorParse(inst
, "Yellow");
72 look
->surface
.primary
= RrColorParse(inst
, "Blue");
73 look
->surface
.interlaced
= FALSE
;
74 if (ob_display
== NULL
) {
75 fprintf(stderr
, "couldn't connect to X server :0\n");
79 RrPaint(look
, win
, w
, h
);
81 XNextEvent(ob_display
, &report
);
82 switch (report
.type
) {
87 report
.xconfigure
.width
,
88 report
.xconfigure
.height
);
94 RrAppearanceFree (look
);
95 RrInstanceFree (inst
);
This page took 0.036255 seconds and 4 git commands to generate.