Authors: Ove Kaaven <ovek@transgaming.com>, Andrew Lewycky <andrew@transgaming.com...
[wine/testsucceed.git] / graphics / x11drv / oembitmap.c
blobb5138ce99003c6ad3015d2d0945e53b90cfbb00a
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_hand"
190 /*#include "bitmaps/ocr_sizeall"*/
191 /*#include "bitmaps/ocr_icocur"*/
192 #include "bitmaps/ocr_no"
193 #include "bitmaps/ocr_appstarting"
194 #include "bitmaps/ocr_help"
196 /* Cursor are not all contiguous (go figure...) */
197 #define OCR_FIRST0 OCR_BUMMER
198 #define OCR_LAST0 OCR_DRAGOBJECT
199 #define OCR_BASE0 0
201 #define OCR_FIRST1 OCR_NORMAL
202 #define OCR_LAST1 OCR_UP
203 #define OCR_BASE1 (OCR_BASE0 + OCR_LAST0 - OCR_FIRST0 + 1)
205 #define OCR_FIRST2 OCR_SIZE
206 #define OCR_LAST2 OCR_SIZEALL
207 #define OCR_BASE2 (OCR_BASE1 + OCR_LAST1 - OCR_FIRST1 + 1)
209 #define OCR_FIRST3 OCR_NO
210 #define OCR_LAST3 OCR_APPSTARTING
211 #define OCR_BASE3 (OCR_BASE2 + OCR_LAST2 - OCR_FIRST2 + 1)
213 #define OCR_FIRST4 OCR_HELP
214 #define OCR_LAST4 OCR_HELP
215 #define OCR_BASE4 (OCR_BASE3 + OCR_LAST3 - OCR_FIRST3 + 1)
217 #define NB_CURSORS (OCR_BASE4 + OCR_LAST4 - OCR_FIRST4 + 1)
218 static char **OBM_Cursors_Data[NB_CURSORS] =
220 ocr_bummer, /* OCR_BUMMER */
221 ocr_dragobject, /* OCR_DRAGOBJECT */
222 ocr_normal, /* OCR_NORMAL */
223 ocr_ibeam, /* OCR_IBEAM */
224 ocr_wait, /* OCR_WAIT */
225 ocr_cross, /* OCR_CROSS */
226 ocr_up, /* OCR_UP */
227 ocr_size, /* OCR_SIZE */
228 ocr_icon, /* OCR_ICON */
229 ocr_sizenwse, /* OCR_SIZENWSE */
230 ocr_sizenesw, /* OCR_SIZENESW */
231 ocr_sizewe, /* OCR_SIZEWE */
232 ocr_sizens, /* OCR_SIZENS */
233 ocr_size, /* OCR_SIZEALL */ /* Re-used the same one as OCR_SIZE for now */
234 #if 0
235 ocr_icocur /* OCR_ICOCUR */
236 #endif
237 ocr_no, /* OCR_NO */
238 ocr_hand, /* OCR_HAND */
239 ocr_appstarting, /* OCR_APPSTARTING */
240 ocr_help /* OCR_HELP */
243 static HGLOBAL16 OBM_Cursors[NB_CURSORS];
246 /* All the colors used in the xpm files must be included in this */
247 /* list, to make sure that the loaded bitmaps only use colors from */
248 /* the Windows colormap. Note: the PALETTEINDEX() are not really */
249 /* palette indexes, but system colors that will be converted to */
250 /* indexes later on. */
252 #ifdef HAVE_LIBXXPM
253 static XpmColorSymbol
254 #else /* defined(HAVE_LIBXXPM) */
255 static struct
257 char *name;
258 char *value;
259 Pixel pixel;
261 #endif /* defined(HAVE_LIBXXPM) */
262 OBM_Colors[] =
264 { "black", NULL, (Pixel)RGB(0,0,0) },
265 { "white", NULL, (Pixel)RGB(255,255,255) },
266 { "red", NULL, (Pixel)RGB(255,0,0) },
267 { "green", NULL, (Pixel)RGB(0,255,0) },
268 { "blue", NULL, (Pixel)RGB(0,0,255) },
269 { "yellow", NULL, (Pixel)RGB(255,255,0) },
270 { "cyan", NULL, (Pixel)RGB(0,255,255) },
271 { "dkyellow", NULL, (Pixel)RGB(128,128,0) },
272 { "purple", NULL, (Pixel)RGB(128,0,128) },
273 { "ltgray", NULL, (Pixel)RGB(192,192,192) },
274 { "dkgray", NULL, (Pixel)RGB(128,128,128) },
275 { "button_face", NULL, (Pixel)PALETTEINDEX(COLOR_BTNFACE) },
276 { "button_shadow", NULL, (Pixel)PALETTEINDEX(COLOR_BTNSHADOW) },
277 { "button_highlight", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
278 { "button_edge", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
279 { "button_text", NULL, (Pixel)PALETTEINDEX(COLOR_BTNTEXT) },
280 { "window_frame", NULL, (Pixel)PALETTEINDEX(COLOR_WINDOWFRAME) }
283 #define NB_COLOR_SYMBOLS (sizeof(OBM_Colors)/sizeof(OBM_Colors[0]))
285 /* These are the symbolic colors for monochrome bitmaps */
286 /* This is needed to make sure that black is always 0 and */
287 /* white always 1, as required by Windows. */
289 #ifdef HAVE_LIBXXPM
290 static XpmColorSymbol OBM_BlackAndWhite[2] =
292 { "black", NULL, 0 },
293 { "white", NULL, 0xffffffff }
295 #endif /* defined(HAVE_LIBXXPM) */
299 /***********************************************************************
300 * OBM_InitColorSymbols
302 static BOOL OBM_InitColorSymbols()
304 static BOOL initialized = FALSE;
305 int i;
307 if (initialized) return TRUE; /* Already initialised */
308 initialized = TRUE;
310 for (i = 0; i < NB_COLOR_SYMBOLS; i++)
312 if (OBM_Colors[i].pixel & 0xff000000) /* PALETTEINDEX */
313 OBM_Colors[i].pixel = X11DRV_PALETTE_ToPhysical( NULL,
314 GetSysColor(OBM_Colors[i].pixel & 0xff));
315 else /* RGB*/
316 OBM_Colors[i].pixel = X11DRV_PALETTE_ToPhysical( NULL, OBM_Colors[i].pixel);
318 return TRUE;
322 /***********************************************************************
323 * OBM_MakeBitmap
325 * Allocate a GDI bitmap.
327 #ifdef HAVE_LIBXXPM
328 static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
329 WORD bpp, Pixmap pixmap )
331 HBITMAP hbitmap;
332 BITMAPOBJ * bmpObjPtr;
334 if (!pixmap) return 0;
336 if (!(bmpObjPtr = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC, &hbitmap ))) return 0;
337 bmpObjPtr->size.cx = width;
338 bmpObjPtr->size.cy = height;
339 bmpObjPtr->bitmap.bmType = 0;
340 bmpObjPtr->bitmap.bmWidth = width;
341 bmpObjPtr->bitmap.bmHeight = height;
342 bmpObjPtr->bitmap.bmWidthBytes = BITMAP_GetWidthBytes( width, bpp );
343 bmpObjPtr->bitmap.bmPlanes = 1;
344 bmpObjPtr->bitmap.bmBitsPixel = bpp;
345 bmpObjPtr->bitmap.bmBits = NULL;
346 bmpObjPtr->dib = NULL;
348 bmpObjPtr->funcs = &X11DRV_DC_Funcs;
349 bmpObjPtr->physBitmap = (void *)pixmap;
351 GDI_ReleaseObj( hbitmap );
352 return hbitmap;
354 #endif /* defined(HAVE_LIBXXPM) */
356 /***********************************************************************
357 * OBM_CreatePixmaps
359 * Create the 2 pixmaps from XPM data.
361 * The Xlib critical section must be entered before calling this function.
363 #ifdef HAVE_LIBXXPM
365 typedef struct
367 char **data;
368 XpmAttributes *attrs;
369 Pixmap pixmap;
370 Pixmap pixmask;
371 } OBM_PIXMAP_DESCR;
373 static int OBM_CreatePixmaps( OBM_PIXMAP_DESCR *descr )
375 return XpmCreatePixmapFromData( display, X11DRV_GetXRootWindow(), descr->data,
376 &descr->pixmap, &descr->pixmask, descr->attrs );
378 #endif /* defined(HAVE_LIBXXPM) */
381 /***********************************************************************
382 * OBM_CreateBitmaps
384 * Create the 2 bitmaps from XPM data.
386 static BOOL OBM_CreateBitmaps( char **data, BOOL color,
387 HBITMAP16 *bitmap, HBITMAP16 *mask, POINT *hotspot )
389 #ifdef HAVE_LIBXXPM
390 OBM_PIXMAP_DESCR descr;
391 int err;
393 descr.attrs = (XpmAttributes *)HeapAlloc( GetProcessHeap(), 0,
394 XpmAttributesSize() );
395 if (descr.attrs == NULL) return FALSE;
396 descr.attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols | XpmHotspot;
397 descr.attrs->colormap = X11DRV_PALETTE_PaletteXColormap;
398 descr.attrs->depth = color ? X11DRV_GetDepth() : 1;
399 descr.attrs->colorsymbols = (descr.attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
400 descr.attrs->numsymbols = (descr.attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
402 descr.data = data;
404 EnterCriticalSection( &X11DRV_CritSection );
405 err = CALL_LARGE_STACK( OBM_CreatePixmaps, &descr );
406 LeaveCriticalSection( &X11DRV_CritSection );
408 if (err != XpmSuccess)
410 HeapFree( GetProcessHeap(), 0, descr.attrs );
411 return FALSE;
414 if (hotspot)
416 hotspot->x = descr.attrs->x_hotspot;
417 hotspot->y = descr.attrs->y_hotspot;
420 if (bitmap)
421 *bitmap = OBM_MakeBitmap( descr.attrs->width, descr.attrs->height,
422 descr.attrs->depth, descr.pixmap );
424 if (mask)
425 *mask = OBM_MakeBitmap( descr.attrs->width, descr.attrs->height,
426 1, descr.pixmask );
428 HeapFree( GetProcessHeap(), 0, descr.attrs );
430 if (descr.pixmap && (!bitmap || !*bitmap))
431 TSXFreePixmap( display, descr.pixmap );
432 if (descr.pixmask && (!mask || !*mask))
433 TSXFreePixmap( display, descr.pixmask );
435 if (bitmap && !*bitmap)
437 if (mask && *mask) DeleteObject( *mask );
438 return FALSE;
440 return TRUE;
441 #else /* defined(HAVE_LIBXXPM) */
442 FIXME_(x11drv)(
443 "Xpm support not in the binary, "
444 "please install the Xpm and Xpm-devel packages and recompile\n"
446 return FALSE;
447 #endif /* defined(HAVE_LIBXXPM) */
451 /***********************************************************************
452 * OBM_LoadBitmap
454 static HBITMAP16 OBM_LoadBitmap( WORD id )
456 HBITMAP16 bitmap;
458 if ((id < OBM_FIRST) || (id > OBM_LAST)) return 0;
459 id -= OBM_FIRST;
461 if (!OBM_InitColorSymbols()) return 0;
463 if (!OBM_CreateBitmaps( OBM_Pixmaps_Data[id].data, OBM_Pixmaps_Data[id].color,
464 &bitmap, NULL, NULL ))
466 WARN_(bitmap)("Error creating OEM bitmap %d\n", OBM_FIRST+id );
467 return 0;
469 return bitmap;
473 /***********************************************************************
474 * OBM_LoadCursorIcon
476 static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL fCursor )
478 HBITMAP16 bitmap, mask;
479 POINT hotspot;
480 HGLOBAL16 handle;
481 CURSORICONINFO *pInfo;
482 BITMAPOBJ *bmpXor, *bmpAnd;
483 int sizeXor, sizeAnd;
485 if (fCursor)
487 if ((id >= OCR_FIRST1) && (id <= OCR_LAST1))
488 id = OCR_BASE1 + id - OCR_FIRST1;
489 else if ((id >= OCR_FIRST2) && (id <= OCR_LAST2))
490 id = OCR_BASE2 + id - OCR_FIRST2;
491 else if ((id >= OCR_FIRST0) && (id <= OCR_LAST0))
492 id = OCR_BASE0 + id - OCR_FIRST0;
493 else if ((id >= OCR_FIRST3) && (id <= OCR_LAST3))
494 id = OCR_BASE3 + id - OCR_FIRST3;
495 else if ((id >= OCR_FIRST4) && (id <= OCR_LAST4))
496 id = OCR_BASE4 + id - OCR_FIRST4;
497 else return 0;
498 if (OBM_Cursors[id]) return OBM_Cursors[id];
500 else
502 if ((id < OIC_FIRST) || (id > OIC_LAST)) return 0;
503 id -= OIC_FIRST;
506 if (!OBM_InitColorSymbols()) return 0;
508 if (!OBM_CreateBitmaps( fCursor ? OBM_Cursors_Data[id] : OBM_Icons_Data[id],
509 !fCursor, &bitmap, &mask, &hotspot ))
511 WARN_(cursor)("Error creating OEM cursor/icon %d\n", id );
512 return 0;
515 bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( bitmap, BITMAP_MAGIC );
516 bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( mask, BITMAP_MAGIC );
517 sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes;
518 sizeAnd = bmpXor->bitmap.bmHeight *
519 BITMAP_GetWidthBytes( bmpXor->bitmap.bmWidth, 1 );
521 if (!(handle = GlobalAlloc16( GMEM_MOVEABLE,
522 sizeof(CURSORICONINFO) + sizeXor + sizeAnd)))
523 goto done;
525 pInfo = (CURSORICONINFO *)GlobalLock16( handle );
526 pInfo->ptHotSpot.x = hotspot.x;
527 pInfo->ptHotSpot.y = hotspot.y;
528 pInfo->nWidth = bmpXor->bitmap.bmWidth;
529 pInfo->nHeight = bmpXor->bitmap.bmHeight;
530 pInfo->nWidthBytes = bmpXor->bitmap.bmWidthBytes;
531 pInfo->bPlanes = bmpXor->bitmap.bmPlanes;
532 pInfo->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel;
534 if (mask)
536 /* Invert the mask */
538 TSXSetFunction( display, BITMAP_monoGC, GXinvert );
539 TSXFillRectangle( display, (Pixmap)bmpAnd->physBitmap, BITMAP_monoGC, 0, 0,
540 bmpAnd->bitmap.bmWidth, bmpAnd->bitmap.bmHeight );
541 TSXSetFunction( display, BITMAP_monoGC, GXcopy );
543 /* Set the masked pixels to black */
545 if (bmpXor->bitmap.bmBitsPixel != 1)
547 TSXSetForeground( display, BITMAP_colorGC,
548 X11DRV_PALETTE_ToPhysical( NULL, RGB(0,0,0) ));
549 TSXSetBackground( display, BITMAP_colorGC, 0 );
550 TSXSetFunction( display, BITMAP_colorGC, GXor );
551 TSXCopyPlane(display, (Pixmap)bmpAnd->physBitmap, (Pixmap)bmpXor->physBitmap,
552 BITMAP_colorGC, 0, 0, bmpXor->bitmap.bmWidth, bmpXor->bitmap.bmHeight,
553 0, 0, 1 );
554 TSXSetFunction( display, BITMAP_colorGC, GXcopy );
558 if (mask) GetBitmapBits( mask, sizeAnd, (char *)(pInfo + 1));
559 else memset( (char *)(pInfo + 1), 0xff, sizeAnd );
560 GetBitmapBits( bitmap, sizeXor, (char *)(pInfo + 1) + sizeAnd );
561 if (fCursor) OBM_Cursors[id] = handle;
562 done:
563 GDI_ReleaseObj( mask );
564 GDI_ReleaseObj( bitmap );
565 DeleteObject( bitmap );
566 DeleteObject( mask );
567 return handle;
570 /***********************************************************************
571 * X11DRV_LoadOEMResource
574 HANDLE X11DRV_LoadOEMResource(WORD resid, WORD type)
576 switch(type) {
577 case OEM_BITMAP:
578 return OBM_LoadBitmap(resid);
580 case OEM_CURSOR:
581 return OBM_LoadCursorIcon(resid, TRUE);
583 case OEM_ICON:
584 return OBM_LoadCursorIcon(resid, FALSE);
586 default:
587 ERR_(x11drv)("Unknown type\n");
589 return 0;
593 /***********************************************************************
594 * X11DRV_OBM_Init
596 * Initializes the OBM_Pixmaps_Data and OBM_Icons_Data struct
598 BOOL X11DRV_OBM_Init(void)
600 if (TWEAK_WineLook == WIN31_LOOK) {
601 OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd;
602 OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced;
603 OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom;
604 OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce;
605 OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close;
606 OBM_Pixmaps_Data[OBM_RESTORE - OBM_FIRST].data = obm_restore;
607 OBM_Pixmaps_Data[OBM_RESTORED - OBM_FIRST].data = obm_restored;
609 OBM_Icons_Data[OIC_HAND - OIC_FIRST] = oic_hand;
610 OBM_Icons_Data[OIC_QUES - OIC_FIRST] = oic_ques;
611 OBM_Icons_Data[OIC_BANG - OIC_FIRST] = oic_bang;
612 OBM_Icons_Data[OIC_NOTE - OIC_FIRST] = oic_note;
614 else {
615 OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd_95;
616 OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced_95;
617 OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom_95;
618 OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce_95;
619 OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close_95;
620 OBM_Pixmaps_Data[OBM_RESTORE - OBM_FIRST].data = obm_restore_95;
621 OBM_Pixmaps_Data[OBM_RESTORED - OBM_FIRST].data = obm_restored_95;
623 OBM_Icons_Data[OIC_HAND - OIC_FIRST] = oic_hand_95;
624 OBM_Icons_Data[OIC_QUES - OIC_FIRST] = oic_ques_95;
625 OBM_Icons_Data[OIC_BANG - OIC_FIRST] = oic_bang_95;
626 OBM_Icons_Data[OIC_NOTE - OIC_FIRST] = oic_note_95;
629 return 1;