Tried another kludge for the Xmd.h problem.
[wine/multimedia.git] / graphics / x11drv / oembitmap.c
blobbf6839b8c7854d4463dfab4fd978176d07ce30c2
1 /*
2 * X11DRV OEM bitmap objects
4 * Copyright 1994, 1995 Alexandre Julliard
6 */
8 #include <stdlib.h>
9 #include <string.h>
10 #include "ts_xlib.h"
11 #include "ts_xutil.h"
12 #include "ts_xpm.h"
13 #include "gdi.h"
14 #include "x11drv.h"
15 #include "bitmap.h"
16 #include "callback.h"
17 #include "color.h"
18 #include "cursoricon.h"
19 #include "heap.h"
20 #include "tweak.h"
21 #include "debug.h"
23 /* Include OEM pixmaps */
24 #include "bitmaps/obm_cdrom"
25 #include "bitmaps/obm_harddisk"
26 #include "bitmaps/obm_drive"
27 #include "bitmaps/obm_folder2"
28 #include "bitmaps/obm_folder"
29 #include "bitmaps/obm_lfarrowi"
30 #include "bitmaps/obm_rgarrowi"
31 #include "bitmaps/obm_dnarrowi"
32 #include "bitmaps/obm_uparrowi"
33 #include "bitmaps/obm_combo"
34 #include "bitmaps/obm_mnarrow"
35 #include "bitmaps/obm_lfarrowd"
36 #include "bitmaps/obm_rgarrowd"
37 #include "bitmaps/obm_dnarrowd"
38 #include "bitmaps/obm_uparrowd"
39 #include "bitmaps/obm_restored"
40 #include "bitmaps/obm_restore"
41 #include "bitmaps/obm_lfarrow"
42 #include "bitmaps/obm_rgarrow"
43 #include "bitmaps/obm_dnarrow"
44 #include "bitmaps/obm_uparrow"
45 #include "bitmaps/obm_old_restore"
46 #include "bitmaps/obm_old_zoom"
47 #include "bitmaps/obm_old_reduce"
48 #include "bitmaps/obm_btncorners"
49 #include "bitmaps/obm_checkboxes"
50 #include "bitmaps/obm_check"
51 #include "bitmaps/obm_btsize"
52 #include "bitmaps/obm_old_lfarrow"
53 #include "bitmaps/obm_old_rgarrow"
54 #include "bitmaps/obm_old_dnarrow"
55 #include "bitmaps/obm_old_uparrow"
56 #include "bitmaps/obm_size"
57 #include "bitmaps/obm_old_close"
58 #include "bitmaps/obm_trtype"
59 #include "bitmaps/obm_radiocheck"
61 #include "bitmaps/obm_zoomd"
62 #include "bitmaps/obm_reduced"
63 #include "bitmaps/obm_zoom"
64 #include "bitmaps/obm_reduce"
65 #include "bitmaps/obm_close"
66 #include "bitmaps/obm_zoomd_95"
67 #include "bitmaps/obm_reduced_95"
68 #include "bitmaps/obm_zoom_95"
69 #include "bitmaps/obm_reduce_95"
70 #include "bitmaps/obm_close_95"
71 #include "bitmaps/obm_closed_95"
72 #include "bitmaps/obm_restore_95"
73 #include "bitmaps/obm_restored_95"
76 #define OBM_FIRST OBM_RADIOCHECK /* First OEM bitmap */
77 #define OBM_LAST OBM_OLD_CLOSE /* Last OEM bitmap */
79 static struct
81 char** data; /* Pointer to bitmap data */
82 BOOL32 color; /* Is it a color bitmap? */
83 } OBM_Pixmaps_Data[OBM_LAST-OBM_FIRST+1] = {
84 { obm_radiocheck, FALSE }, /* OBM_RADIOCHECK */
85 { obm_trtype, TRUE }, /* OBM_TRTYPE */
86 { obm_cdrom, TRUE }, /* OBM_CDROM */
87 { obm_harddisk, TRUE }, /* OBM_HARDDISK */
88 { obm_drive, TRUE }, /* OBM_DRIVE */
89 { obm_folder2, TRUE }, /* OBM_FOLDER2 */
90 { obm_folder, TRUE }, /* OBM_FOLDER */
91 { obm_lfarrowi, TRUE }, /* OBM_LFARROWI */
92 { obm_rgarrowi, TRUE }, /* OBM_RGARROWI */
93 { obm_dnarrowi, TRUE }, /* OBM_DNARROWI */
94 { obm_uparrowi, TRUE }, /* OBM_UPARROWI */
95 { obm_combo, FALSE }, /* OBM_COMBO */
96 { obm_mnarrow, FALSE }, /* OBM_MNARROW */
97 { obm_lfarrowd, TRUE }, /* OBM_LFARROWD */
98 { obm_rgarrowd, TRUE }, /* OBM_RGARROWD */
99 { obm_dnarrowd, TRUE }, /* OBM_DNARROWD */
100 { obm_uparrowd, TRUE }, /* OBM_UPARROWD */
101 { obm_restored, TRUE }, /* OBM_RESTORED */
102 { obm_zoomd, TRUE }, /* OBM_ZOOMD */
103 { obm_reduced, TRUE }, /* OBM_REDUCED */
104 { obm_restore, TRUE }, /* OBM_RESTORE */
105 { obm_zoom, TRUE }, /* OBM_ZOOM */
106 { obm_reduce, TRUE }, /* OBM_REDUCE */
107 { obm_lfarrow, TRUE }, /* OBM_LFARROW */
108 { obm_rgarrow, TRUE }, /* OBM_RGARROW */
109 { obm_dnarrow, TRUE }, /* OBM_DNARROW */
110 { obm_uparrow, TRUE }, /* OBM_UPARROW */
111 { obm_close, TRUE }, /* OBM_CLOSE */
112 { obm_old_restore, FALSE }, /* OBM_OLD_RESTORE */
113 { obm_old_zoom, FALSE }, /* OBM_OLD_ZOOM */
114 { obm_old_reduce, FALSE }, /* OBM_OLD_REDUCE */
115 { obm_btncorners, FALSE }, /* OBM_BTNCORNERS */
116 { obm_checkboxes, FALSE }, /* OBM_CHECKBOXES */
117 { obm_check, FALSE }, /* OBM_CHECK */
118 { obm_btsize, FALSE }, /* OBM_BTSIZE */
119 { obm_old_lfarrow, FALSE }, /* OBM_OLD_LFARROW */
120 { obm_old_rgarrow, FALSE }, /* OBM_OLD_RGARROW */
121 { obm_old_dnarrow, FALSE }, /* OBM_OLD_DNARROW */
122 { obm_old_uparrow, FALSE }, /* OBM_OLD_UPARROW */
123 { obm_size, FALSE }, /* OBM_SIZE */
124 { obm_old_close, FALSE }, /* OBM_OLD_CLOSE */
128 /* Include OEM icons */
129 #include "bitmaps/oic_sample"
130 #include "bitmaps/oic_hand"
131 #include "bitmaps/oic_ques"
132 #include "bitmaps/oic_bang"
133 #include "bitmaps/oic_note"
134 #include "bitmaps/oic_portrait"
135 #include "bitmaps/oic_landscape"
136 #include "bitmaps/oic_wineicon"
137 #include "bitmaps/oic_hand_95"
138 #include "bitmaps/oic_ques_95"
139 #include "bitmaps/oic_bang_95"
140 #include "bitmaps/oic_note_95"
142 #define OIC_FIRST OIC_SAMPLE /* First OEM icon */
143 #define OIC_LAST OIC_WINEICON /* Last OEM icon */
145 static char **OBM_Icons_Data[OIC_LAST-OIC_FIRST+1] =
147 oic_sample, /* OIC_SAMPLE */
148 oic_hand, /* OIC_HAND */
149 oic_ques, /* OIC_QUES */
150 oic_bang, /* OIC_BANG */
151 oic_note, /* OIC_NOTE */
152 oic_portrait, /* OIC_PORTRAIT */
153 oic_landscape, /* OIC_LANDSCAPE */
154 oic_wineicon /* OIC_WINEICON */
158 /* Include OEM cursors */
159 #include "bitmaps/ocr_normal"
160 #include "bitmaps/ocr_ibeam"
161 #include "bitmaps/ocr_wait"
162 #include "bitmaps/ocr_cross"
163 #include "bitmaps/ocr_up"
164 #include "bitmaps/ocr_size"
165 #include "bitmaps/ocr_icon"
166 #include "bitmaps/ocr_sizenwse"
167 #include "bitmaps/ocr_sizenesw"
168 #include "bitmaps/ocr_sizewe"
169 #include "bitmaps/ocr_sizens"
170 #include "bitmaps/ocr_bummer"
171 #include "bitmaps/ocr_dragobject"
172 /*#include "bitmaps/ocr_sizeall"*/
173 /*#include "bitmaps/ocr_icocur"*/
174 #include "bitmaps/ocr_no"
175 #include "bitmaps/ocr_appstarting"
176 #include "bitmaps/ocr_help"
178 /* Cursor are not all contiguous (go figure...) */
179 #define OCR_FIRST0 OCR_BUMMER
180 #define OCR_LAST0 OCR_DRAGOBJECT
181 #define OCR_BASE0 0
183 #define OCR_FIRST1 OCR_NORMAL
184 #define OCR_LAST1 OCR_UP
185 #define OCR_BASE1 (OCR_BASE0 + OCR_LAST0 - OCR_FIRST0 + 1)
187 #define OCR_FIRST2 OCR_SIZE
188 #define OCR_LAST2 OCR_SIZENS
189 #define OCR_BASE2 (OCR_BASE1 + OCR_LAST1 - OCR_FIRST1 + 1)
191 #define OCR_FIRST3 OCR_NO
192 #define OCR_LAST3 OCR_NO
193 #define OCR_BASE3 (OCR_BASE2 + OCR_LAST2 - OCR_FIRST2 + 1)
195 #define OCR_FIRST4 OCR_APPSTARTING
196 #define OCR_LAST4 OCR_APPSTARTING
197 #define OCR_BASE4 (OCR_BASE3 + OCR_LAST3 - OCR_FIRST3 + 1)
199 #define OCR_FIRST5 OCR_HELP
200 #define OCR_LAST5 OCR_HELP
201 #define OCR_BASE5 (OCR_BASE4 + OCR_LAST4 - OCR_FIRST4 + 1)
203 #define NB_CURSORS (OCR_BASE5 + OCR_LAST5 - OCR_FIRST5 + 1)
204 static char **OBM_Cursors_Data[NB_CURSORS] =
206 ocr_bummer, /* OCR_BUMMER */
207 ocr_dragobject, /* OCR_DRAGOBJECT */
208 ocr_normal, /* OCR_NORMAL */
209 ocr_ibeam, /* OCR_IBEAM */
210 ocr_wait, /* OCR_WAIT */
211 ocr_cross, /* OCR_CROSS */
212 ocr_up, /* OCR_UP */
213 ocr_size, /* OCR_SIZE */
214 ocr_icon, /* OCR_ICON */
215 ocr_sizenwse, /* OCR_SIZENWSE */
216 ocr_sizenesw, /* OCR_SIZENESW */
217 ocr_sizewe, /* OCR_SIZEWE */
218 ocr_sizens, /* OCR_SIZENS */
219 #if 0
220 ocr_sizeall, /* OCR_SIZEALL */
221 ocr_icocur /* OCR_ICOCUR */
222 #endif
223 ocr_no, /* OCR_NO */
224 ocr_appstarting, /* OCR_APPSTARTING */
225 ocr_help /* OCR_HELP */
228 static HGLOBAL16 OBM_Cursors[NB_CURSORS];
231 /* All the colors used in the xpm files must be included in this */
232 /* list, to make sure that the loaded bitmaps only use colors from */
233 /* the Windows colormap. Note: the PALETTEINDEX() are not really */
234 /* palette indexes, but system colors that will be converted to */
235 /* indexes later on. */
237 #if 0
238 static const struct
240 char * name;
241 COLORREF color;
242 } OBM_SymbolicColors[] =
243 #endif
244 static XpmColorSymbol OBM_Colors[] =
246 { "black", NULL, (Pixel)RGB(0,0,0) },
247 { "white", NULL, (Pixel)RGB(255,255,255) },
248 { "red", NULL, (Pixel)RGB(255,0,0) },
249 { "green", NULL, (Pixel)RGB(0,255,0) },
250 { "blue", NULL, (Pixel)RGB(0,0,255) },
251 { "yellow", NULL, (Pixel)RGB(255,255,0) },
252 { "cyan", NULL, (Pixel)RGB(0,255,255) },
253 { "dkyellow", NULL, (Pixel)RGB(128,128,0) },
254 { "purple", NULL, (Pixel)RGB(128,0,128) },
255 { "ltgray", NULL, (Pixel)RGB(192,192,192) },
256 { "dkgray", NULL, (Pixel)RGB(128,128,128) },
257 { "foldercol", NULL, (Pixel)RGB(0,191,191) },
258 { "button_face", NULL, (Pixel)PALETTEINDEX(COLOR_BTNFACE) },
259 { "button_shadow", NULL, (Pixel)PALETTEINDEX(COLOR_BTNSHADOW) },
260 { "button_highlight", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
261 { "button_edge", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
262 { "button_text", NULL, (Pixel)PALETTEINDEX(COLOR_BTNTEXT) },
263 { "window_frame", NULL, (Pixel)PALETTEINDEX(COLOR_WINDOWFRAME) }
266 #define NB_COLOR_SYMBOLS (sizeof(OBM_Colors)/sizeof(OBM_Colors[0]))
268 /* These are the symbolic colors for monochrome bitmaps */
269 /* This is needed to make sure that black is always 0 and */
270 /* white always 1, as required by Windows. */
272 static XpmColorSymbol OBM_BlackAndWhite[2] =
274 { "black", NULL, 0 },
275 { "white", NULL, 0xffffffff }
278 /* This structure holds the arguments for OBM_CreateBitmaps() */
279 typedef struct
281 char **data; /* In: bitmap data */
282 BOOL32 color; /* In: color or monochrome */
283 BOOL32 need_mask; /* In: do we need a mask? */
284 HBITMAP16 bitmap; /* Out: resulting bitmap */
285 HBITMAP16 mask; /* Out: resulting mask (if needed) */
286 POINT32 hotspot; /* Out: bitmap hotspot */
287 } OBM_BITMAP_DESCR;
290 /***********************************************************************
291 * OBM_InitColorSymbols
293 static BOOL32 OBM_InitColorSymbols()
295 static BOOL32 initialized = FALSE;
296 int i;
298 if (initialized) return TRUE; /* Already initialised */
299 initialized = TRUE;
301 for (i = 0; i < NB_COLOR_SYMBOLS; i++)
303 if (OBM_Colors[i].pixel & 0xff000000) /* PALETTEINDEX */
304 OBM_Colors[i].pixel = COLOR_ToPhysical( NULL,
305 GetSysColor32(OBM_Colors[i].pixel & 0xff));
306 else /* RGB*/
307 OBM_Colors[i].pixel = COLOR_ToPhysical( NULL, OBM_Colors[i].pixel);
309 return TRUE;
313 /***********************************************************************
314 * OBM_MakeBitmap
316 * Allocate a GDI bitmap.
318 static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
319 WORD bpp, Pixmap pixmap )
321 HBITMAP16 hbitmap;
322 BITMAPOBJ * bmpObjPtr;
323 X11DRV_PHYSBITMAP *pbitmap;
325 if (!pixmap) return 0;
327 hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
328 if (!hbitmap) return 0;
330 bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LOCK( hbitmap );
331 bmpObjPtr->size.cx = width;
332 bmpObjPtr->size.cy = height;
333 bmpObjPtr->bitmap.bmType = 0;
334 bmpObjPtr->bitmap.bmWidth = width;
335 bmpObjPtr->bitmap.bmHeight = height;
336 bmpObjPtr->bitmap.bmWidthBytes = BITMAP_GetWidthBytes( width, bpp );
337 bmpObjPtr->bitmap.bmPlanes = 1;
338 bmpObjPtr->bitmap.bmBitsPixel = bpp;
339 bmpObjPtr->bitmap.bmBits = NULL;
340 bmpObjPtr->dib = NULL;
342 pbitmap = X11DRV_AllocBitmap(bmpObjPtr);
344 pbitmap->pixmap = pixmap;
346 GDI_HEAP_UNLOCK( hbitmap );
347 return hbitmap;
351 /***********************************************************************
352 * OBM_CreateBitmaps
354 * Create the 2 bitmaps from XPM data.
356 * The Xlib critical section must be entered before calling this function.
358 static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
360 Pixmap pixmap, pixmask;
361 XpmAttributes *attrs;
362 int err;
364 attrs = (XpmAttributes *)HEAP_xalloc( GetProcessHeap(), 0,
365 XpmAttributesSize() );
366 attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
367 attrs->colormap = COLOR_GetColormap();
368 attrs->depth = descr->color ? screenDepth : 1;
369 attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
370 attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
372 err = XpmCreatePixmapFromData( display, rootWindow, descr->data,
373 &pixmap, &pixmask, attrs );
375 if (err != XpmSuccess)
377 HeapFree( GetProcessHeap(), 0, attrs );
378 return FALSE;
380 descr->hotspot.x = attrs->x_hotspot;
381 descr->hotspot.y = attrs->y_hotspot;
382 descr->bitmap = OBM_MakeBitmap( attrs->width, attrs->height,
383 attrs->depth, pixmap );
384 if (descr->need_mask)
385 descr->mask = OBM_MakeBitmap( attrs->width, attrs->height,
386 1, pixmask );
387 HeapFree( GetProcessHeap(), 0, attrs );
388 if (!descr->bitmap)
390 if (pixmap) XFreePixmap( display, pixmap );
391 if (pixmask) XFreePixmap( display, pixmask );
392 if (descr->bitmap) GDI_FreeObject( descr->bitmap );
393 if (descr->need_mask && descr->mask) GDI_FreeObject( descr->mask );
394 return FALSE;
396 else return TRUE;
400 /***********************************************************************
401 * OBM_LoadBitmap
403 static HBITMAP16 OBM_LoadBitmap( WORD id )
405 OBM_BITMAP_DESCR descr;
407 if ((id < OBM_FIRST) || (id > OBM_LAST)) return 0;
408 id -= OBM_FIRST;
410 if (!OBM_InitColorSymbols()) return 0;
412 descr.data = OBM_Pixmaps_Data[id].data;
413 descr.color = OBM_Pixmaps_Data[id].color;
414 descr.need_mask = FALSE;
416 EnterCriticalSection( &X11DRV_CritSection );
417 if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
419 LeaveCriticalSection( &X11DRV_CritSection );
420 WARN(bitmap, "Error creating OEM bitmap %d\n", OBM_FIRST+id );
421 return 0;
423 LeaveCriticalSection( &X11DRV_CritSection );
424 return descr.bitmap;
428 /***********************************************************************
429 * OBM_LoadCursorIcon
431 static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor )
433 OBM_BITMAP_DESCR descr;
434 HGLOBAL16 handle;
435 CURSORICONINFO *pInfo;
436 BITMAPOBJ *bmpXor, *bmpAnd;
437 int sizeXor, sizeAnd;
439 if (fCursor)
441 if ((id >= OCR_FIRST1) && (id <= OCR_LAST1))
442 id = OCR_BASE1 + id - OCR_FIRST1;
443 else if ((id >= OCR_FIRST2) && (id <= OCR_LAST2))
444 id = OCR_BASE2 + id - OCR_FIRST2;
445 else if ((id >= OCR_FIRST0) && (id <= OCR_LAST0))
446 id = OCR_BASE0 + id - OCR_FIRST0;
447 else if ((id >= OCR_FIRST3) && (id <= OCR_LAST3))
448 id = OCR_BASE3 + id - OCR_FIRST3;
449 else if ((id >= OCR_FIRST4) && (id <= OCR_LAST4))
450 id = OCR_BASE4 + id - OCR_FIRST4;
451 else if ((id >= OCR_FIRST5) && (id <= OCR_LAST5))
452 id = OCR_BASE5 + id - OCR_FIRST5;
453 else return 0;
454 if (OBM_Cursors[id]) return OBM_Cursors[id];
456 else
458 if ((id < OIC_FIRST) || (id > OIC_LAST)) return 0;
459 id -= OIC_FIRST;
462 if (!OBM_InitColorSymbols()) return 0;
464 descr.data = fCursor ? OBM_Cursors_Data[id] : OBM_Icons_Data[id];
465 descr.color = !fCursor;
466 descr.need_mask = TRUE;
468 EnterCriticalSection( &X11DRV_CritSection );
469 if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
471 LeaveCriticalSection( &X11DRV_CritSection );
472 WARN(cursor, "Error creating OEM cursor/icon %d\n", id );
473 return 0;
475 LeaveCriticalSection( &X11DRV_CritSection );
477 bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( descr.bitmap, BITMAP_MAGIC );
478 bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( descr.mask, BITMAP_MAGIC );
479 sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes;
480 sizeAnd = bmpXor->bitmap.bmHeight *
481 BITMAP_GetWidthBytes( bmpXor->bitmap.bmWidth, 1 );
483 if (!(handle = GlobalAlloc16( GMEM_MOVEABLE,
484 sizeof(CURSORICONINFO) + sizeXor + sizeAnd)))
486 DeleteObject32( descr.bitmap );
487 DeleteObject32( descr.mask );
488 return 0;
491 pInfo = (CURSORICONINFO *)GlobalLock16( handle );
492 pInfo->ptHotSpot.x = descr.hotspot.x;
493 pInfo->ptHotSpot.y = descr.hotspot.y;
494 pInfo->nWidth = bmpXor->bitmap.bmWidth;
495 pInfo->nHeight = bmpXor->bitmap.bmHeight;
496 pInfo->nWidthBytes = bmpXor->bitmap.bmWidthBytes;
497 pInfo->bPlanes = bmpXor->bitmap.bmPlanes;
498 pInfo->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel;
500 if (descr.mask)
502 X11DRV_PHYSBITMAP *pbitmapAnd = bmpAnd->DDBitmap->physBitmap;
503 /* Invert the mask */
505 TSXSetFunction( display, BITMAP_monoGC, GXinvert );
506 TSXFillRectangle( display, pbitmapAnd->pixmap, BITMAP_monoGC, 0, 0,
507 bmpAnd->bitmap.bmWidth, bmpAnd->bitmap.bmHeight );
508 TSXSetFunction( display, BITMAP_monoGC, GXcopy );
510 /* Set the masked pixels to black */
512 if (bmpXor->bitmap.bmBitsPixel != 1)
514 X11DRV_PHYSBITMAP *pbitmapXor = bmpXor->DDBitmap->physBitmap;
515 TSXSetForeground( display, BITMAP_colorGC,
516 COLOR_ToPhysical( NULL, RGB(0,0,0) ));
517 TSXSetBackground( display, BITMAP_colorGC, 0 );
518 TSXSetFunction( display, BITMAP_colorGC, GXor );
519 TSXCopyPlane(display, pbitmapAnd->pixmap, pbitmapXor->pixmap, BITMAP_colorGC,
520 0, 0, bmpXor->bitmap.bmWidth, bmpXor->bitmap.bmHeight,
521 0, 0, 1 );
522 TSXSetFunction( display, BITMAP_colorGC, GXcopy );
526 if (descr.mask) GetBitmapBits32( descr.mask, sizeAnd, (char *)(pInfo + 1));
527 else memset( (char *)(pInfo + 1), 0xff, sizeAnd );
528 GetBitmapBits32( descr.bitmap, sizeXor, (char *)(pInfo + 1) + sizeAnd );
530 DeleteObject32( descr.bitmap );
531 DeleteObject32( descr.mask );
533 if (fCursor) OBM_Cursors[id] = handle;
534 return handle;
537 /***********************************************************************
538 * X11DRV_LoadOEMResource
541 HANDLE32 X11DRV_LoadOEMResource(WORD resid, WORD type)
543 switch(type) {
544 case OEM_BITMAP:
545 return OBM_LoadBitmap(resid);
547 case OEM_CURSOR:
548 return OBM_LoadCursorIcon(resid, TRUE);
550 case OEM_ICON:
551 return OBM_LoadCursorIcon(resid, FALSE);
553 default:
554 ERR(x11drv, "Unknown type\n");
556 return 0;
560 /***********************************************************************
561 * X11DRV_OBM_Init
563 * Initializes the OBM_Pixmaps_Data and OBM_Icons_Data struct
565 BOOL32 X11DRV_OBM_Init(void)
567 if (TWEAK_WineLook == WIN31_LOOK) {
568 OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd;
569 OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced;
570 OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom;
571 OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce;
572 OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close;
573 OBM_Pixmaps_Data[OBM_RESTORE - OBM_FIRST].data = obm_restore;
574 OBM_Pixmaps_Data[OBM_RESTORED - OBM_FIRST].data = obm_restored;
576 OBM_Icons_Data[OIC_HAND - OIC_FIRST] = oic_hand;
577 OBM_Icons_Data[OIC_QUES - OIC_FIRST] = oic_ques;
578 OBM_Icons_Data[OIC_BANG - OIC_FIRST] = oic_bang;
579 OBM_Icons_Data[OIC_NOTE - OIC_FIRST] = oic_note;
581 else {
582 OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd_95;
583 OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced_95;
584 OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom_95;
585 OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce_95;
586 OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close_95;
587 OBM_Pixmaps_Data[OBM_RESTORE - OBM_FIRST].data = obm_restore_95;
588 OBM_Pixmaps_Data[OBM_RESTORED - OBM_FIRST].data = obm_restored_95;
590 OBM_Icons_Data[OIC_HAND - OIC_FIRST] = oic_hand_95;
591 OBM_Icons_Data[OIC_QUES - OIC_FIRST] = oic_ques_95;
592 OBM_Icons_Data[OIC_BANG - OIC_FIRST] = oic_bang_95;
593 OBM_Icons_Data[OIC_NOTE - OIC_FIRST] = oic_note_95;
596 return 1;