Added support for special treatments (use 2 or more fonts, codepage
[wine.git] / graphics / x11drv / oembitmap.c
blob190872112dbe9e8853f76d46d96cb09493f412c8
1 /*
2 * X11DRV OEM bitmap objects
4 * Copyright 1994, 1995 Alexandre Julliard
6 */
8 #include "config.h"
10 #include "ts_xlib.h"
11 #include "ts_xutil.h"
13 #ifdef HAVE_LIBXXPM
14 #include "ts_xpm.h"
15 #else /* defined(HAVE_LIBXXPM) */
16 typedef unsigned long Pixel;
17 #endif /* defined(HAVE_LIBXXPM) */
19 #include <stdlib.h>
20 #include <string.h>
22 #include "bitmap.h"
23 #include "callback.h"
24 #include "color.h"
25 #include "cursoricon.h"
26 #include "debugtools.h"
27 #include "gdi.h"
28 #include "heap.h"
29 #include "local.h"
30 #include "tweak.h"
31 #include "x11drv.h"
33 /* Include OEM pixmaps */
34 #include "bitmaps/obm_lfarrowi"
35 #include "bitmaps/obm_rgarrowi"
36 #include "bitmaps/obm_dnarrowi"
37 #include "bitmaps/obm_uparrowi"
38 #include "bitmaps/obm_combo"
39 #include "bitmaps/obm_mnarrow"
40 #include "bitmaps/obm_lfarrowd"
41 #include "bitmaps/obm_rgarrowd"
42 #include "bitmaps/obm_dnarrowd"
43 #include "bitmaps/obm_uparrowd"
44 #include "bitmaps/obm_restored"
45 #include "bitmaps/obm_restore"
46 #include "bitmaps/obm_lfarrow"
47 #include "bitmaps/obm_rgarrow"
48 #include "bitmaps/obm_dnarrow"
49 #include "bitmaps/obm_uparrow"
50 #include "bitmaps/obm_old_restore"
51 #include "bitmaps/obm_old_zoom"
52 #include "bitmaps/obm_old_reduce"
53 #include "bitmaps/obm_btncorners"
54 #include "bitmaps/obm_checkboxes"
55 #include "bitmaps/obm_check"
56 #include "bitmaps/obm_btsize"
57 #include "bitmaps/obm_old_lfarrow"
58 #include "bitmaps/obm_old_rgarrow"
59 #include "bitmaps/obm_old_dnarrow"
60 #include "bitmaps/obm_old_uparrow"
61 #include "bitmaps/obm_size"
62 #include "bitmaps/obm_old_close"
63 #include "bitmaps/obm_trtype"
64 #include "bitmaps/obm_radiocheck"
66 #include "bitmaps/obm_zoomd"
67 #include "bitmaps/obm_reduced"
68 #include "bitmaps/obm_zoom"
69 #include "bitmaps/obm_reduce"
70 #include "bitmaps/obm_close"
71 #include "bitmaps/obm_zoomd_95"
72 #include "bitmaps/obm_reduced_95"
73 #include "bitmaps/obm_zoom_95"
74 #include "bitmaps/obm_reduce_95"
75 #include "bitmaps/obm_close_95"
76 #include "bitmaps/obm_closed_95"
77 #include "bitmaps/obm_restore_95"
78 #include "bitmaps/obm_restored_95"
80 DECLARE_DEBUG_CHANNEL(bitmap)
81 DECLARE_DEBUG_CHANNEL(cursor)
82 DECLARE_DEBUG_CHANNEL(x11drv)
85 #define OBM_FIRST OBM_CLOSED /* First OEM bitmap */
86 #define OBM_LAST OBM_OLD_CLOSE /* Last OEM bitmap */
88 static struct
90 char** data; /* Pointer to bitmap data */
91 BOOL color; /* Is it a color bitmap? */
92 } OBM_Pixmaps_Data[OBM_LAST-OBM_FIRST+1] = {
93 { obm_closed_95,TRUE}, /* OBM_CLOSED */
94 { obm_radiocheck, FALSE }, /* OBM_RADIOCHECK */
95 { obm_trtype, TRUE }, /* OBM_TRTYPE */
96 { obm_lfarrowi, TRUE }, /* OBM_LFARROWI */
97 { obm_rgarrowi, TRUE }, /* OBM_RGARROWI */
98 { obm_dnarrowi, TRUE }, /* OBM_DNARROWI */
99 { obm_uparrowi, TRUE }, /* OBM_UPARROWI */
100 { obm_combo, FALSE }, /* OBM_COMBO */
101 { obm_mnarrow, FALSE }, /* OBM_MNARROW */
102 { obm_lfarrowd, TRUE }, /* OBM_LFARROWD */
103 { obm_rgarrowd, TRUE }, /* OBM_RGARROWD */
104 { obm_dnarrowd, TRUE }, /* OBM_DNARROWD */
105 { obm_uparrowd, TRUE }, /* OBM_UPARROWD */
106 { obm_restored, TRUE }, /* OBM_RESTORED */
107 { obm_zoomd, TRUE }, /* OBM_ZOOMD */
108 { obm_reduced, TRUE }, /* OBM_REDUCED */
109 { obm_restore, TRUE }, /* OBM_RESTORE */
110 { obm_zoom, TRUE }, /* OBM_ZOOM */
111 { obm_reduce, TRUE }, /* OBM_REDUCE */
112 { obm_lfarrow, TRUE }, /* OBM_LFARROW */
113 { obm_rgarrow, TRUE }, /* OBM_RGARROW */
114 { obm_dnarrow, TRUE }, /* OBM_DNARROW */
115 { obm_uparrow, TRUE }, /* OBM_UPARROW */
116 { obm_close, TRUE }, /* OBM_CLOSE */
117 { obm_old_restore, FALSE }, /* OBM_OLD_RESTORE */
118 { obm_old_zoom, FALSE }, /* OBM_OLD_ZOOM */
119 { obm_old_reduce, FALSE }, /* OBM_OLD_REDUCE */
120 { obm_btncorners, FALSE }, /* OBM_BTNCORNERS */
121 { obm_checkboxes, FALSE }, /* OBM_CHECKBOXES */
122 { obm_check, FALSE }, /* OBM_CHECK */
123 { obm_btsize, FALSE }, /* OBM_BTSIZE */
124 { obm_old_lfarrow, FALSE }, /* OBM_OLD_LFARROW */
125 { obm_old_rgarrow, FALSE }, /* OBM_OLD_RGARROW */
126 { obm_old_dnarrow, FALSE }, /* OBM_OLD_DNARROW */
127 { obm_old_uparrow, FALSE }, /* OBM_OLD_UPARROW */
128 { obm_size, FALSE }, /* OBM_SIZE */
129 { obm_old_close, FALSE }, /* OBM_OLD_CLOSE */
133 /* Include OEM icons */
134 #include "bitmaps/oic_sample"
135 #include "bitmaps/oic_hand"
136 #include "bitmaps/oic_ques"
137 #include "bitmaps/oic_bang"
138 #include "bitmaps/oic_note"
139 #include "bitmaps/oic_portrait"
140 #include "bitmaps/oic_landscape"
141 #include "bitmaps/oic_wineicon"
142 #include "bitmaps/oic_hand_95"
143 #include "bitmaps/oic_ques_95"
144 #include "bitmaps/oic_bang_95"
145 #include "bitmaps/oic_note_95"
146 #include "bitmaps/oic_folder"
147 #include "bitmaps/oic_folder2"
148 #include "bitmaps/oic_floppy"
149 #include "bitmaps/oic_cdrom"
150 #include "bitmaps/oic_hdisk"
151 #include "bitmaps/oic_network"
153 #define OIC_FIRST OIC_SAMPLE /* First OEM icon */
154 #define OIC_LAST OIC_NETWORK /* Last OEM icon */
156 static char **OBM_Icons_Data[OIC_LAST-OIC_FIRST+1] =
158 oic_sample, /* OIC_SAMPLE */
159 oic_hand, /* OIC_HAND */
160 oic_ques, /* OIC_QUES */
161 oic_bang, /* OIC_BANG */
162 oic_note, /* OIC_NOTE */
163 oic_portrait, /* OIC_PORTRAIT */
164 oic_landscape, /* OIC_LANDSCAPE */
165 oic_wineicon, /* OIC_WINEICON */
166 oic_folder, /* OIC_FOLDER */
167 oic_folder2, /* OIC_FOLDER2 */
168 oic_floppy, /* OIC_FLOPPY */
169 oic_cdrom, /* OIC_CDROM */
170 oic_hdisk, /* OIC_HDISK */
171 oic_network /* OIC_NETWORK */
175 /* Include OEM cursors */
176 #include "bitmaps/ocr_normal"
177 #include "bitmaps/ocr_ibeam"
178 #include "bitmaps/ocr_wait"
179 #include "bitmaps/ocr_cross"
180 #include "bitmaps/ocr_up"
181 #include "bitmaps/ocr_size"
182 #include "bitmaps/ocr_icon"
183 #include "bitmaps/ocr_sizenwse"
184 #include "bitmaps/ocr_sizenesw"
185 #include "bitmaps/ocr_sizewe"
186 #include "bitmaps/ocr_sizens"
187 #include "bitmaps/ocr_bummer"
188 #include "bitmaps/ocr_dragobject"
189 /*#include "bitmaps/ocr_sizeall"*/
190 /*#include "bitmaps/ocr_icocur"*/
191 #include "bitmaps/ocr_no"
192 #include "bitmaps/ocr_appstarting"
193 #include "bitmaps/ocr_help"
195 /* Cursor are not all contiguous (go figure...) */
196 #define OCR_FIRST0 OCR_BUMMER
197 #define OCR_LAST0 OCR_DRAGOBJECT
198 #define OCR_BASE0 0
200 #define OCR_FIRST1 OCR_NORMAL
201 #define OCR_LAST1 OCR_UP
202 #define OCR_BASE1 (OCR_BASE0 + OCR_LAST0 - OCR_FIRST0 + 1)
204 #define OCR_FIRST2 OCR_SIZE
205 #define OCR_LAST2 OCR_SIZEALL
206 #define OCR_BASE2 (OCR_BASE1 + OCR_LAST1 - OCR_FIRST1 + 1)
208 #define OCR_FIRST3 OCR_NO
209 #define OCR_LAST3 OCR_NO
210 #define OCR_BASE3 (OCR_BASE2 + OCR_LAST2 - OCR_FIRST2 + 1)
212 #define OCR_FIRST4 OCR_APPSTARTING
213 #define OCR_LAST4 OCR_APPSTARTING
214 #define OCR_BASE4 (OCR_BASE3 + OCR_LAST3 - OCR_FIRST3 + 1)
216 #define OCR_FIRST5 OCR_HELP
217 #define OCR_LAST5 OCR_HELP
218 #define OCR_BASE5 (OCR_BASE4 + OCR_LAST4 - OCR_FIRST4 + 1)
220 #define NB_CURSORS (OCR_BASE5 + OCR_LAST5 - OCR_FIRST5 + 1)
221 static char **OBM_Cursors_Data[NB_CURSORS] =
223 ocr_bummer, /* OCR_BUMMER */
224 ocr_dragobject, /* OCR_DRAGOBJECT */
225 ocr_normal, /* OCR_NORMAL */
226 ocr_ibeam, /* OCR_IBEAM */
227 ocr_wait, /* OCR_WAIT */
228 ocr_cross, /* OCR_CROSS */
229 ocr_up, /* OCR_UP */
230 ocr_size, /* OCR_SIZE */
231 ocr_icon, /* OCR_ICON */
232 ocr_sizenwse, /* OCR_SIZENWSE */
233 ocr_sizenesw, /* OCR_SIZENESW */
234 ocr_sizewe, /* OCR_SIZEWE */
235 ocr_sizens, /* OCR_SIZENS */
236 ocr_size, /* OCR_SIZEALL */ /* Re-used the same one as OCR_SIZE for now */
237 #if 0
238 ocr_icocur /* OCR_ICOCUR */
239 #endif
240 ocr_no, /* OCR_NO */
241 ocr_appstarting, /* OCR_APPSTARTING */
242 ocr_help /* OCR_HELP */
245 static HGLOBAL16 OBM_Cursors[NB_CURSORS];
248 /* All the colors used in the xpm files must be included in this */
249 /* list, to make sure that the loaded bitmaps only use colors from */
250 /* the Windows colormap. Note: the PALETTEINDEX() are not really */
251 /* palette indexes, but system colors that will be converted to */
252 /* indexes later on. */
254 #ifdef HAVE_LIBXXPM
255 static XpmColorSymbol
256 #else /* defined(HAVE_LIBXXPM) */
257 static struct
259 char *name;
260 char *value;
261 Pixel pixel;
263 #endif /* defined(HAVE_LIBXXPM) */
264 OBM_Colors[] =
266 { "black", NULL, (Pixel)RGB(0,0,0) },
267 { "white", NULL, (Pixel)RGB(255,255,255) },
268 { "red", NULL, (Pixel)RGB(255,0,0) },
269 { "green", NULL, (Pixel)RGB(0,255,0) },
270 { "blue", NULL, (Pixel)RGB(0,0,255) },
271 { "yellow", NULL, (Pixel)RGB(255,255,0) },
272 { "cyan", NULL, (Pixel)RGB(0,255,255) },
273 { "dkyellow", NULL, (Pixel)RGB(128,128,0) },
274 { "purple", NULL, (Pixel)RGB(128,0,128) },
275 { "ltgray", NULL, (Pixel)RGB(192,192,192) },
276 { "dkgray", NULL, (Pixel)RGB(128,128,128) },
277 { "button_face", NULL, (Pixel)PALETTEINDEX(COLOR_BTNFACE) },
278 { "button_shadow", NULL, (Pixel)PALETTEINDEX(COLOR_BTNSHADOW) },
279 { "button_highlight", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
280 { "button_edge", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
281 { "button_text", NULL, (Pixel)PALETTEINDEX(COLOR_BTNTEXT) },
282 { "window_frame", NULL, (Pixel)PALETTEINDEX(COLOR_WINDOWFRAME) }
285 #define NB_COLOR_SYMBOLS (sizeof(OBM_Colors)/sizeof(OBM_Colors[0]))
287 /* These are the symbolic colors for monochrome bitmaps */
288 /* This is needed to make sure that black is always 0 and */
289 /* white always 1, as required by Windows. */
291 #ifdef HAVE_LIBXXPM
292 static XpmColorSymbol OBM_BlackAndWhite[2] =
294 { "black", NULL, 0 },
295 { "white", NULL, 0xffffffff }
297 #endif /* defined(HAVE_LIBXXPM) */
300 /* This structure holds the arguments for OBM_CreateBitmaps() */
301 typedef struct
303 char **data; /* In: bitmap data */
304 BOOL color; /* In: color or monochrome */
305 BOOL need_mask; /* In: do we need a mask? */
306 HBITMAP16 bitmap; /* Out: resulting bitmap */
307 HBITMAP16 mask; /* Out: resulting mask (if needed) */
308 POINT hotspot; /* Out: bitmap hotspot */
309 } OBM_BITMAP_DESCR;
312 /***********************************************************************
313 * OBM_InitColorSymbols
315 static BOOL OBM_InitColorSymbols()
317 static BOOL initialized = FALSE;
318 int i;
320 if (initialized) return TRUE; /* Already initialised */
321 initialized = TRUE;
323 for (i = 0; i < NB_COLOR_SYMBOLS; i++)
325 if (OBM_Colors[i].pixel & 0xff000000) /* PALETTEINDEX */
326 OBM_Colors[i].pixel = X11DRV_PALETTE_ToPhysical( NULL,
327 GetSysColor(OBM_Colors[i].pixel & 0xff));
328 else /* RGB*/
329 OBM_Colors[i].pixel = X11DRV_PALETTE_ToPhysical( NULL, OBM_Colors[i].pixel);
331 return TRUE;
335 /***********************************************************************
336 * OBM_MakeBitmap
338 * Allocate a GDI bitmap.
340 #ifdef HAVE_LIBXXPM
341 static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
342 WORD bpp, Pixmap pixmap )
344 HBITMAP16 hbitmap;
345 BITMAPOBJ * bmpObjPtr;
347 if (!pixmap) return 0;
349 hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
350 if (!hbitmap) return 0;
352 bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LOCK( hbitmap );
353 bmpObjPtr->size.cx = width;
354 bmpObjPtr->size.cy = height;
355 bmpObjPtr->bitmap.bmType = 0;
356 bmpObjPtr->bitmap.bmWidth = width;
357 bmpObjPtr->bitmap.bmHeight = height;
358 bmpObjPtr->bitmap.bmWidthBytes = BITMAP_GetWidthBytes( width, bpp );
359 bmpObjPtr->bitmap.bmPlanes = 1;
360 bmpObjPtr->bitmap.bmBitsPixel = bpp;
361 bmpObjPtr->bitmap.bmBits = NULL;
362 bmpObjPtr->dib = NULL;
364 bmpObjPtr->funcs = &X11DRV_DC_Funcs;
365 bmpObjPtr->physBitmap = (void *)pixmap;
367 GDI_HEAP_UNLOCK( hbitmap );
368 return hbitmap;
370 #endif /* defined(HAVE_LIBXXPM) */
372 /***********************************************************************
373 * OBM_CreateBitmaps
375 * Create the 2 bitmaps from XPM data.
377 * The Xlib critical section must be entered before calling this function.
379 static BOOL OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
381 #ifdef HAVE_LIBXXPM
382 Pixmap pixmap, pixmask;
383 XpmAttributes *attrs;
384 int err;
386 attrs = (XpmAttributes *)HeapAlloc( GetProcessHeap(), 0,
387 XpmAttributesSize() );
388 if(attrs == NULL) return FALSE;
389 attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
390 attrs->colormap = X11DRV_PALETTE_PaletteXColormap;
391 attrs->depth = descr->color ? X11DRV_GetDepth() : 1;
392 attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
393 attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
395 err = XpmCreatePixmapFromData( display, X11DRV_GetXRootWindow(), descr->data,
396 &pixmap, &pixmask, attrs );
398 if (err != XpmSuccess)
400 HeapFree( GetProcessHeap(), 0, attrs );
401 return FALSE;
403 descr->hotspot.x = attrs->x_hotspot;
404 descr->hotspot.y = attrs->y_hotspot;
405 descr->bitmap = OBM_MakeBitmap( attrs->width, attrs->height,
406 attrs->depth, pixmap );
407 if (descr->need_mask)
408 descr->mask = OBM_MakeBitmap( attrs->width, attrs->height,
409 1, pixmask );
410 HeapFree( GetProcessHeap(), 0, attrs );
411 if (!descr->bitmap)
413 if (pixmap) XFreePixmap( display, pixmap );
414 if (pixmask) XFreePixmap( display, pixmask );
415 if (descr->bitmap) GDI_FreeObject( descr->bitmap );
416 if (descr->need_mask && descr->mask) GDI_FreeObject( descr->mask );
417 return FALSE;
419 else return TRUE;
420 #else /* defined(HAVE_LIBXXPM) */
421 FIXME_(x11drv)(
422 "Xpm support not in the binary, "
423 "please install Xpm and recompile\n"
425 return FALSE;
426 #endif /* defined(HAVE_LIBXXPM) */
430 /***********************************************************************
431 * OBM_LoadBitmap
433 static HBITMAP16 OBM_LoadBitmap( WORD id )
435 OBM_BITMAP_DESCR descr;
437 if ((id < OBM_FIRST) || (id > OBM_LAST)) return 0;
438 id -= OBM_FIRST;
440 if (!OBM_InitColorSymbols()) return 0;
442 descr.data = OBM_Pixmaps_Data[id].data;
443 descr.color = OBM_Pixmaps_Data[id].color;
444 descr.need_mask = FALSE;
446 EnterCriticalSection( &X11DRV_CritSection );
447 if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
449 LeaveCriticalSection( &X11DRV_CritSection );
450 WARN_(bitmap)("Error creating OEM bitmap %d\n", OBM_FIRST+id );
451 return 0;
453 LeaveCriticalSection( &X11DRV_CritSection );
454 return descr.bitmap;
458 /***********************************************************************
459 * OBM_LoadCursorIcon
461 static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL fCursor )
463 OBM_BITMAP_DESCR descr;
464 HGLOBAL16 handle;
465 CURSORICONINFO *pInfo;
466 BITMAPOBJ *bmpXor, *bmpAnd;
467 int sizeXor, sizeAnd;
469 if (fCursor)
471 if ((id >= OCR_FIRST1) && (id <= OCR_LAST1))
472 id = OCR_BASE1 + id - OCR_FIRST1;
473 else if ((id >= OCR_FIRST2) && (id <= OCR_LAST2))
474 id = OCR_BASE2 + id - OCR_FIRST2;
475 else if ((id >= OCR_FIRST0) && (id <= OCR_LAST0))
476 id = OCR_BASE0 + id - OCR_FIRST0;
477 else if ((id >= OCR_FIRST3) && (id <= OCR_LAST3))
478 id = OCR_BASE3 + id - OCR_FIRST3;
479 else if ((id >= OCR_FIRST4) && (id <= OCR_LAST4))
480 id = OCR_BASE4 + id - OCR_FIRST4;
481 else if ((id >= OCR_FIRST5) && (id <= OCR_LAST5))
482 id = OCR_BASE5 + id - OCR_FIRST5;
483 else return 0;
484 if (OBM_Cursors[id]) return OBM_Cursors[id];
486 else
488 if ((id < OIC_FIRST) || (id > OIC_LAST)) return 0;
489 id -= OIC_FIRST;
492 if (!OBM_InitColorSymbols()) return 0;
494 descr.data = fCursor ? OBM_Cursors_Data[id] : OBM_Icons_Data[id];
495 descr.color = !fCursor;
496 descr.need_mask = TRUE;
498 EnterCriticalSection( &X11DRV_CritSection );
499 if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
501 LeaveCriticalSection( &X11DRV_CritSection );
502 WARN_(cursor)("Error creating OEM cursor/icon %d\n", id );
503 return 0;
505 LeaveCriticalSection( &X11DRV_CritSection );
507 bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( descr.bitmap, BITMAP_MAGIC );
508 bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( descr.mask, BITMAP_MAGIC );
509 sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes;
510 sizeAnd = bmpXor->bitmap.bmHeight *
511 BITMAP_GetWidthBytes( bmpXor->bitmap.bmWidth, 1 );
513 if (!(handle = GlobalAlloc16( GMEM_MOVEABLE,
514 sizeof(CURSORICONINFO) + sizeXor + sizeAnd)))
516 DeleteObject( descr.bitmap );
517 DeleteObject( descr.mask );
518 return 0;
521 pInfo = (CURSORICONINFO *)GlobalLock16( handle );
522 pInfo->ptHotSpot.x = descr.hotspot.x;
523 pInfo->ptHotSpot.y = descr.hotspot.y;
524 pInfo->nWidth = bmpXor->bitmap.bmWidth;
525 pInfo->nHeight = bmpXor->bitmap.bmHeight;
526 pInfo->nWidthBytes = bmpXor->bitmap.bmWidthBytes;
527 pInfo->bPlanes = bmpXor->bitmap.bmPlanes;
528 pInfo->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel;
530 if (descr.mask)
532 /* Invert the mask */
534 TSXSetFunction( display, BITMAP_monoGC, GXinvert );
535 TSXFillRectangle( display, (Pixmap)bmpAnd->physBitmap, BITMAP_monoGC, 0, 0,
536 bmpAnd->bitmap.bmWidth, bmpAnd->bitmap.bmHeight );
537 TSXSetFunction( display, BITMAP_monoGC, GXcopy );
539 /* Set the masked pixels to black */
541 if (bmpXor->bitmap.bmBitsPixel != 1)
543 TSXSetForeground( display, BITMAP_colorGC,
544 X11DRV_PALETTE_ToPhysical( NULL, RGB(0,0,0) ));
545 TSXSetBackground( display, BITMAP_colorGC, 0 );
546 TSXSetFunction( display, BITMAP_colorGC, GXor );
547 TSXCopyPlane(display, (Pixmap)bmpAnd->physBitmap, (Pixmap)bmpXor->physBitmap,
548 BITMAP_colorGC, 0, 0, bmpXor->bitmap.bmWidth, bmpXor->bitmap.bmHeight,
549 0, 0, 1 );
550 TSXSetFunction( display, BITMAP_colorGC, GXcopy );
554 if (descr.mask) GetBitmapBits( descr.mask, sizeAnd, (char *)(pInfo + 1));
555 else memset( (char *)(pInfo + 1), 0xff, sizeAnd );
556 GetBitmapBits( descr.bitmap, sizeXor, (char *)(pInfo + 1) + sizeAnd );
558 DeleteObject( descr.bitmap );
559 DeleteObject( descr.mask );
561 if (fCursor) OBM_Cursors[id] = handle;
562 return handle;
565 /***********************************************************************
566 * X11DRV_LoadOEMResource
569 HANDLE X11DRV_LoadOEMResource(WORD resid, WORD type)
571 switch(type) {
572 case OEM_BITMAP:
573 return OBM_LoadBitmap(resid);
575 case OEM_CURSOR:
576 return OBM_LoadCursorIcon(resid, TRUE);
578 case OEM_ICON:
579 return OBM_LoadCursorIcon(resid, FALSE);
581 default:
582 ERR_(x11drv)("Unknown type\n");
584 return 0;
588 /***********************************************************************
589 * X11DRV_OBM_Init
591 * Initializes the OBM_Pixmaps_Data and OBM_Icons_Data struct
593 BOOL X11DRV_OBM_Init(void)
595 if (TWEAK_WineLook == WIN31_LOOK) {
596 OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd;
597 OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced;
598 OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom;
599 OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce;
600 OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close;
601 OBM_Pixmaps_Data[OBM_RESTORE - OBM_FIRST].data = obm_restore;
602 OBM_Pixmaps_Data[OBM_RESTORED - OBM_FIRST].data = obm_restored;
604 OBM_Icons_Data[OIC_HAND - OIC_FIRST] = oic_hand;
605 OBM_Icons_Data[OIC_QUES - OIC_FIRST] = oic_ques;
606 OBM_Icons_Data[OIC_BANG - OIC_FIRST] = oic_bang;
607 OBM_Icons_Data[OIC_NOTE - OIC_FIRST] = oic_note;
609 else {
610 OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd_95;
611 OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced_95;
612 OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom_95;
613 OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce_95;
614 OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close_95;
615 OBM_Pixmaps_Data[OBM_RESTORE - OBM_FIRST].data = obm_restore_95;
616 OBM_Pixmaps_Data[OBM_RESTORED - OBM_FIRST].data = obm_restored_95;
618 OBM_Icons_Data[OIC_HAND - OIC_FIRST] = oic_hand_95;
619 OBM_Icons_Data[OIC_QUES - OIC_FIRST] = oic_ques_95;
620 OBM_Icons_Data[OIC_BANG - OIC_FIRST] = oic_bang_95;
621 OBM_Icons_Data[OIC_NOTE - OIC_FIRST] = oic_note_95;
624 return 1;