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