summaryrefslogtreecommitdiff
path: root/uisimulator/x11/uibasic.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/x11/uibasic.c')
-rw-r--r--uisimulator/x11/uibasic.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c
index ca3c2c5568..0c3e9bb9d0 100644
--- a/uisimulator/x11/uibasic.c
+++ b/uisimulator/x11/uibasic.c
@@ -48,9 +48,6 @@ GC draw_gc;
48static Colormap cmap; 48static Colormap cmap;
49 49
50int display_zoom=1; 50int display_zoom=1;
51
52Display *dpy;
53Window window;
54bool lcd_display_redraw=true; 51bool lcd_display_redraw=true;
55 52
56XrmOptionDescRec options [] = { 53XrmOptionDescRec options [] = {
@@ -96,16 +93,19 @@ void screen_resized(int width, int height)
96 maxx = width; 93 maxx = width;
97 maxy = height; 94 maxy = height;
98 95
96 XtAppLock(app);
99 XSetForeground(dpy, draw_gc, 97 XSetForeground(dpy, draw_gc,
100 get_pixel_resource("background", "Background", dpy, cmap)); 98 get_pixel_resource("background", "Background", dpy, cmap));
101 XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom, 99 XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom,
102 height*display_zoom); 100 height*display_zoom);
101 XtAppUnlock(app);
103 lcd_display_redraw=true; 102 lcd_display_redraw=true;
104 screen_redraw(); 103 screen_redraw();
105} 104}
106 105
107void drawrect(int color, int x1, int y1, int x2, int y2) 106void drawrect(int color, int x1, int y1, int x2, int y2)
108{ 107{
108 XtAppLock(app);
109 if (color==0) 109 if (color==0)
110 XSetForeground(dpy, draw_gc, 110 XSetForeground(dpy, draw_gc,
111 get_pixel_resource("background", "Background", dpy, cmap)); 111 get_pixel_resource("background", "Background", dpy, cmap));
@@ -115,6 +115,7 @@ void drawrect(int color, int x1, int y1, int x2, int y2)
115 115
116 XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom, 116 XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom,
117 x2*display_zoom, y2*display_zoom); 117 x2*display_zoom, y2*display_zoom);
118 XtAppUnlock(app);
118} 119}
119 120
120static void help(void) 121static void help(void)
@@ -125,6 +126,7 @@ static void help(void)
125 126
126void drawline(int color, int x1, int y1, int x2, int y2) 127void drawline(int color, int x1, int y1, int x2, int y2)
127{ 128{
129 XtAppLock(app);
128 if (color==0) 130 if (color==0)
129 XSetForeground(dpy, draw_gc, 131 XSetForeground(dpy, draw_gc,
130 get_pixel_resource("background", "Background", dpy, cmap)); 132 get_pixel_resource("background", "Background", dpy, cmap));
@@ -137,10 +139,12 @@ void drawline(int color, int x1, int y1, int x2, int y2)
137 (int)(y1*display_zoom), 139 (int)(y1*display_zoom),
138 (int)(x2*display_zoom), 140 (int)(x2*display_zoom),
139 (int)(y2*display_zoom)); 141 (int)(y2*display_zoom));
142 XtAppUnlock(app);
140} 143}
141 144
142void drawdot(int color, int x, int y) 145void drawdot(int color, int x, int y)
143{ 146{
147 XtAppLock(app);
144 if (color==0) 148 if (color==0)
145 XSetForeground(dpy, draw_gc, 149 XSetForeground(dpy, draw_gc,
146 get_pixel_resource("background", "Background", dpy, cmap)); 150 get_pixel_resource("background", "Background", dpy, cmap));
@@ -150,10 +154,12 @@ void drawdot(int color, int x, int y)
150 154
151 XFillRectangle(dpy, window, draw_gc, x*display_zoom, y*display_zoom, 155 XFillRectangle(dpy, window, draw_gc, x*display_zoom, y*display_zoom,
152 display_zoom, display_zoom); 156 display_zoom, display_zoom);
157 XtAppUnlock(app);
153} 158}
154 159
155void drawdots(int color, struct coordinate *points, int count) 160void drawdots(int color, struct coordinate *points, int count)
156{ 161{
162 XtAppLock(app);
157 if (color==0) 163 if (color==0)
158 XSetForeground(dpy, draw_gc, 164 XSetForeground(dpy, draw_gc,
159 get_pixel_resource("background", "Background", dpy, cmap)); 165 get_pixel_resource("background", "Background", dpy, cmap));
@@ -168,10 +174,12 @@ void drawdots(int color, struct coordinate *points, int count)
168 display_zoom, 174 display_zoom,
169 display_zoom); 175 display_zoom);
170 } 176 }
177 XtAppUnlock(app);
171} 178}
172 179
173void drawrectangles(int color, struct rectangle *points, int count) 180void drawrectangles(int color, struct rectangle *points, int count)
174{ 181{
182 XtAppLock(app);
175 if (color==0) 183 if (color==0)
176 XSetForeground(dpy, draw_gc, 184 XSetForeground(dpy, draw_gc,
177 get_pixel_resource("background", "Background", dpy, cmap)); 185 get_pixel_resource("background", "Background", dpy, cmap));
@@ -186,10 +194,12 @@ void drawrectangles(int color, struct rectangle *points, int count)
186 points[count].width*display_zoom, 194 points[count].width*display_zoom,
187 points[count].height*display_zoom); 195 points[count].height*display_zoom);
188 } 196 }
197 XtAppUnlock(app);
189} 198}
190 199
191void drawtext(int color, int x, int y, char *text) 200void drawtext(int color, int x, int y, char *text)
192{ 201{
202 XtAppLock(app);
193 if (color==0) 203 if (color==0)
194 XSetForeground(dpy, draw_gc, 204 XSetForeground(dpy, draw_gc,
195 get_pixel_resource("background", "Background", dpy, cmap)); 205 get_pixel_resource("background", "Background", dpy, cmap));
@@ -199,13 +209,13 @@ void drawtext(int color, int x, int y, char *text)
199 209
200 XDrawString(dpy, window, draw_gc, x*display_zoom, y*display_zoom, text, 210 XDrawString(dpy, window, draw_gc, x*display_zoom, y*display_zoom, text,
201 strlen(text)); 211 strlen(text));
212 XtAppUnlock(app);
202} 213}
203 214
204/* this is where the applicaton starts */ 215/* this is where the applicaton starts */
205extern void app_main(void); 216extern void app_main(void);
206 217
207void 218void screenhack()
208screenhack (Display *the_dpy, Window the_window)
209{ 219{
210 Bool helpme; 220 Bool helpme;
211 221
@@ -216,9 +226,6 @@ screenhack (Display *the_dpy, Window the_window)
216 226
217 printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n"); 227 printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n");
218 228
219 dpy=the_dpy;
220 window=the_window;
221
222 init_window(); 229 init_window();
223 230
224 screen_redraw(); 231 screen_redraw();