Mercurial > hg > xemacs-beta
comparison lwlib/xlwgcs.c @ 4769:5460287a3327
Remove support for pre-X11R5 systems, including systems without Xmu. See
<870180fe0912091102j6fde7336hdc187608be0ef97@mail.gmail.com> in xemacs-patches.
author | Jerry James <james@xemacs.org> |
---|---|
date | Thu, 10 Dec 2009 12:42:09 -0700 |
parents | 04bc9d2f42c7 |
children | 308d34e9f07d |
comparison
equal
deleted
inserted
replaced
4768:0f5bee973a7b | 4769:5460287a3327 |
---|---|
111 #include <stdio.h> | 111 #include <stdio.h> |
112 | 112 |
113 #include <X11/Xlib.h> | 113 #include <X11/Xlib.h> |
114 #include <X11/IntrinsicP.h> | 114 #include <X11/IntrinsicP.h> |
115 #include <X11/StringDefs.h> | 115 #include <X11/StringDefs.h> |
116 #include "../src/xmu.h" | 116 #include <X11/Xmu/Drawing.h> |
117 #include <X11/Xmu/Misc.h> | |
117 #include "xlwgcs.h" | 118 #include "xlwgcs.h" |
118 | 119 |
119 /* Color & GC allocation. | 120 /* Color & GC allocation. |
120 * | 121 * |
121 * Frame widgets use the following graphics contexts: | 122 * Frame widgets use the following graphics contexts: |
163 * If the widget's background is solid white or solid black, | 164 * If the widget's background is solid white or solid black, |
164 * this code just picks some numbers. (The choice is designed | 165 * this code just picks some numbers. (The choice is designed |
165 * to be compatible with ThreeD interface.) | 166 * to be compatible with ThreeD interface.) |
166 */ | 167 */ |
167 | 168 |
168 | |
169 | |
170 #if XtSpecificationRelease < 5 | |
171 | |
172 static GC XtAllocateGC(Widget, int, unsigned long, XGCValues *, | |
173 unsigned long, unsigned long) ; | |
174 | |
175 #endif | |
176 | 169 |
177 | 170 |
178 #if NeedFunctionPrototypes | 171 #if NeedFunctionPrototypes |
179 static Pixmap getDitherPixmap(Widget, int contrast) ; | 172 static Pixmap getDitherPixmap(Widget, int contrast) ; |
180 #else | 173 #else |
229 | 222 |
230 /* Allocate a GC somewhere between two colors. */ | 223 /* Allocate a GC somewhere between two colors. */ |
231 | 224 |
232 GC | 225 GC |
233 AllocShadeGC(Widget w, Pixel fg, Pixel bg, Font font, | 226 AllocShadeGC(Widget w, Pixel fg, Pixel bg, Font font, |
234 int contrast, | 227 int contrast, Bool be_nice_to_cmap) |
235 #ifdef HAVE_XMU | |
236 Bool be_nice_to_cmap | |
237 #else | |
238 Bool UNUSED (be_nice_to_cmap) | |
239 #endif | |
240 ) | |
241 { | 228 { |
242 XGCValues values ; | 229 XGCValues values ; |
243 unsigned long vmask, dcmask ; | 230 unsigned long vmask, dcmask ; |
244 | 231 |
245 values.foreground = fg ; | 232 values.foreground = fg ; |
253 } else { | 240 } else { |
254 vmask = GCForeground; | 241 vmask = GCForeground; |
255 dcmask = GCFont|GCSubwindowMode|GCDashOffset| | 242 dcmask = GCFont|GCSubwindowMode|GCDashOffset| |
256 GCDashList|GCArcMode|GCGraphicsExposures ; | 243 GCDashList|GCArcMode|GCGraphicsExposures ; |
257 } | 244 } |
258 #ifdef HAVE_XMU | |
259 if( be_nice_to_cmap || w->core.depth == 1) | 245 if( be_nice_to_cmap || w->core.depth == 1) |
260 { | 246 { |
261 if( contrast <= 5 ) | 247 if( contrast <= 5 ) |
262 values.foreground = bg ; | 248 values.foreground = bg ; |
263 else if( contrast >= 95 ) | 249 else if( contrast >= 95 ) |
267 values.fill_style = FillOpaqueStippled ; | 253 values.fill_style = FillOpaqueStippled ; |
268 values.stipple = getDitherPixmap(w, contrast) ; | 254 values.stipple = getDitherPixmap(w, contrast) ; |
269 } | 255 } |
270 | 256 |
271 return XtAllocateGC(w, w->core.depth, vmask, &values, 0L, dcmask) ; | 257 return XtAllocateGC(w, w->core.depth, vmask, &values, 0L, dcmask) ; |
272 } | 258 } else { |
273 else | |
274 #endif | |
275 { | |
276 dcmask |= GCBackground ; | 259 dcmask |= GCBackground ; |
277 values.foreground = AllocGreyPixel(w, fg, bg, contrast) ; | 260 values.foreground = AllocGreyPixel(w, fg, bg, contrast) ; |
278 return XtAllocateGC(w, w->core.depth, vmask, &values, 0L, dcmask) ; | 261 return XtAllocateGC(w, w->core.depth, vmask, &values, 0L, dcmask) ; |
279 } | 262 } |
280 } | 263 } |
322 } | 305 } |
323 | 306 |
324 /* return arm-shadow gc. */ | 307 /* return arm-shadow gc. */ |
325 | 308 |
326 GC | 309 GC |
327 AllocArmGC(Widget w, int contrast, | 310 AllocArmGC(Widget w, int contrast, Bool be_nice_to_cmap) |
328 #ifdef HAVE_XMU | |
329 Bool be_nice_to_cmap | |
330 #else | |
331 Bool UNUSED (be_nice_to_cmap) | |
332 #endif | |
333 ) | |
334 { | 311 { |
335 Screen *scr = XtScreen (w); | 312 Screen *scr = XtScreen (w); |
336 XGCValues values ; | 313 XGCValues values ; |
337 | 314 |
338 /* Not clear exactly what we should do here. Take a look at | 315 /* Not clear exactly what we should do here. Take a look at |
339 * Xaw3d to see what they do. | 316 * Xaw3d to see what they do. |
340 */ | 317 */ |
341 #ifdef HAVE_XMU | |
342 if( w->core.depth == 1 || be_nice_to_cmap ) | 318 if( w->core.depth == 1 || be_nice_to_cmap ) |
343 { | 319 { |
344 values.background = w->core.background_pixel ; | 320 values.background = w->core.background_pixel ; |
345 if( values.background == BlackPixelOfScreen(scr) ) | 321 if( values.background == BlackPixelOfScreen(scr) ) |
346 values.foreground = WhitePixelOfScreen(scr) ; | 322 values.foreground = WhitePixelOfScreen(scr) ; |
352 return XtAllocateGC(w, w->core.depth, | 328 return XtAllocateGC(w, w->core.depth, |
353 GCForeground|GCBackground|GCStipple|GCFillStyle, | 329 GCForeground|GCBackground|GCStipple|GCFillStyle, |
354 &values, 0L, | 330 &values, 0L, |
355 GCFont|GCSubwindowMode|GCGraphicsExposures| | 331 GCFont|GCSubwindowMode|GCGraphicsExposures| |
356 GCDashOffset|GCDashList|GCArcMode) ; | 332 GCDashOffset|GCDashList|GCArcMode) ; |
357 } | 333 } else { |
358 else | |
359 #endif | |
360 { | |
361 values.foreground = AllocShadowPixel(w, 100-contrast) ; | 334 values.foreground = AllocShadowPixel(w, 100-contrast) ; |
362 return XtAllocateGC(w, w->core.depth, | 335 return XtAllocateGC(w, w->core.depth, |
363 GCForeground, &values, | 336 GCForeground, &values, |
364 0L, | 337 0L, |
365 GCBackground|GCFont|GCSubwindowMode|GCGraphicsExposures| | 338 GCBackground|GCFont|GCSubwindowMode|GCGraphicsExposures| |
521 pts[5].x = -s ; pts[5].y = s ; | 494 pts[5].x = -s ; pts[5].y = s ; |
522 XFillPolygon(dpy,win,topgc, pts,6, Nonconvex,CoordModePrevious) ; | 495 XFillPolygon(dpy,win,topgc, pts,6, Nonconvex,CoordModePrevious) ; |
523 } | 496 } |
524 } | 497 } |
525 | 498 |
526 #if XtSpecificationRelease < 5 | |
527 | |
528 static GC | |
529 XtAllocateGC(Widget w, int UNUSED (depth), unsigned long mask, | |
530 XGCValues *values, unsigned long UNUSED (dynamic), | |
531 unsigned long UNUSED (dontcare)) | |
532 { | |
533 return XtGetGC(w, mask, values) ; | |
534 } | |
535 #endif | |
536 | |
537 | |
538 static unsigned char screen0[2] = {0,0} ; | 499 static unsigned char screen0[2] = {0,0} ; |
539 static unsigned char screen25[2] = {0,0xaa} ; | 500 static unsigned char screen25[2] = {0,0xaa} ; |
540 static unsigned char screen75[2] = {0xaa,0xff} ; | 501 static unsigned char screen75[2] = {0xaa,0xff} ; |
541 static unsigned char screen100[2] = {0xff,0xff} ; | 502 static unsigned char screen100[2] = {0xff,0xff} ; |
542 | 503 |