]> git.saurik.com Git - wxWidgets.git/blob - src/x11/nanox.c
Added some Xlib replacement functions and structures for Nano-X
[wxWidgets.git] / src / x11 / nanox.c
1 /*
2 * nanox.c
3 *
4 * Replacements for some comomon Xlib functions
5 */
6
7 #include "wx/setup.h"
8
9 #if wxUSE_NANOX
10
11 #include "wx/x11/nanox/X11/Xlib.h"
12
13 Colormap DefaultColormapOfScreen(Screen /* screen */)
14 {
15 static Colormap s_globalColormap;
16 static bool s_init = FALSE;
17
18 if (!s_init)
19 {
20 GrGetSystemPalette(& s_globalColormap);
21 s_init = TRUE;
22 }
23
24 return s_globalColormap;
25 }
26
27 int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */)
28 {
29 return Success ;
30 }
31
32 int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* srcW */,
33 int /* srcX */, int /* srcY */,
34 unsigned int /* srcWidth */,
35 unsigned int /* srcHeight */,
36 int destX, int destY)
37 {
38 GrMoveCursor(destX, destY);
39 return Success;
40 }
41
42 int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */)
43 {
44 GrSetFocus(focus);
45 return Success;
46 }
47
48 int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */)
49 {
50 * focus_return = GrGetFocus();
51 * revert_to_return = 0;
52 return Success;
53 }
54
55 int XGrabPointer(Display* /* display */, Window /* grab_window */,
56 Bool /* owner_events */, unsigned int /* event_mask */,
57 int /* pointer_mode */, int /* keyboard_mode */,
58 Window /* confine_to */, Cursor /* cursor */, Time /* time */)
59 {
60 /* According to comments in srvevent.c in Nano-X, the pointer
61 * is implicitly grabbed when a mouse button is down.
62 * We may be able to simulate this further in the event loop.
63 */
64 return Success;
65 }
66
67 int XUngrabPointer(Display /* display */, Time /* time */)
68 {
69 return Success;
70 }
71
72 int XCopyArea(Display* /* display */, Drawable src, Drawable dest, GC gc,
73 int src_x, int src_y, unsigned int width, unsigned int height,
74 int dest_x, int dest_y)
75 {
76 GrCopyArea(dest, gc, dest_x, dest_y,
77 width, height, src,
78 src_x, src_y, 0);
79 return Success;
80 }
81
82 int XCopyPlane(Display* /* display */, Drawable src, Drawable dest, GC gc,
83 int src_x, int src_y, unsigned int width, unsigned int height,
84 int dest_x, int dest_y, unsigned long /* plane */)
85 {
86 GrCopyArea(dest, gc, dest_x, dest_y,
87 width, height, src,
88 src_x, src_y, 0);
89 return Success;
90 }
91
92 #if 0
93 typedef struct {
94 GR_WINDOW_ID wid; /* window id (or 0 if no such window) */
95 GR_WINDOW_ID parent; /* parent window id */
96 GR_WINDOW_ID child; /* first child window id (or 0) */
97 GR_WINDOW_ID sibling; /* next sibling window id (or 0) */
98 GR_BOOL inputonly; /* TRUE if window is input only */
99 GR_BOOL mapped; /* TRUE if window is mapped */
100 GR_COUNT unmapcount; /* reasons why window is unmapped */
101 GR_COORD x; /* absolute x position of window */
102 GR_COORD y; /* absolute y position of window */
103 GR_SIZE width; /* width of window */
104 GR_SIZE height; /* height of window */
105 GR_SIZE bordersize; /* size of border */
106 GR_COLOR bordercolor; /* color of border */
107 GR_COLOR background; /* background color */
108 GR_EVENT_MASK eventmask; /* current event mask for this client */
109 GR_WM_PROPS props; /* window properties */
110 GR_CURSOR_ID cursor; /* cursor id*/
111 unsigned long processid; /* process id of owner*/
112 } GR_WINDOW_INFO;
113
114 typedef struct {
115 int x, y; /* location of window */
116 int width, height; /* width and height of window */
117 int border_width; /* border width of window */
118 int depth; /* depth of window */
119 Visual *visual; /* the associated visual structure */
120 Window root; /* root of screen containing window */
121 int class; /* InputOutput, InputOnly*/
122 int bit_gravity; /* one of the bit gravity values */
123 int win_gravity; /* one of the window gravity values */
124 int backing_store; /* NotUseful, WhenMapped, Always */
125 unsigned long backing_planes;/* planes to be preserved if possible */
126 unsigned long backing_pixel;/* value to be used when restoring planes */
127 Bool save_under; /* boolean, should bits under be saved? */
128 Colormap colormap; /* color map to be associated with window */
129 Bool map_installed; /* boolean, is color map currently installed*/
130 int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
131 long all_event_masks; /* set of events all people have interest in*/
132 long your_event_mask; /* my event mask */
133 long do_not_propagate_mask;/* set of events that should not propagate */
134 Bool override_redirect; /* boolean value for override-redirect */
135 Screen *screen; /* back pointer to correct screen */
136 } XWindowAttributes;
137
138 #endif
139
140
141 Status XGetWindowAttributes(Display* display, Window w,
142 XWindowAttributes* window_attributes_return)
143 {
144 GR_WINDOW_INFO info;
145 GrGetWindowInfo(w, & info);
146
147 window_attributes->x = info.x;
148 window_attributes->y = info.y;
149 window_attributes->width = info.width;
150 window_attributes->height = info.height;
151 window_attributes->border_width = info.bordersize;
152 window_attributes->depth = 0;
153 window_attributes->visual = NULL;
154 window_attributes->root = 0;
155 window_attributes->class = info.inputonly ? InputOnly : InputOutput ;
156 window_attributes->bit_gravity = 0;
157 window_attributes->win_gravity = 0;
158 window_attributes->backing_store = 0;
159 window_attributes->backing_planes = 0;
160 window_attributes->backing_pixel = 0;
161 window_attributes->save_under = FALSE;
162 window_attributes->colormap = DefaultColormapOfScreen(0);
163 window_attributes->map_installed = FALSE;
164 window_attributes->map_state = info.mapped ? IsViewable : IsUnmapped ;
165 window_attributes->all_event_masks = 0;
166 window_attributes->do_not_propagate_mask = 0;
167 window_attributes->override_redirect = FALSE;
168 window_attributes->screen = NULL;
169
170 return 1;
171 }
172
173 #endif
174 /* wxUSE_NANOX */