Release 20000326.
[wine/gsoc-2012-control.git] / graphics / x11drv / oembitmap.c
blob6b8ff0626393100bb701b8c7f57ca027d81e9353
1 /*
2 * X11DRV OEM bitmap objects
4 * Copyright 1994, 1995 Alexandre Julliard
6 */
8 #include "config.h"
10 #ifndef X_DISPLAY_MISSING
12 #include "ts_xlib.h"
13 #include "ts_xutil.h"
15 #ifdef HAVE_LIBXXPM
16 #include "ts_xpm.h"
17 #else /* defined(HAVE_LIBXXPM) */
18 typedef unsigned long Pixel;
19 #endif /* defined(HAVE_LIBXXPM) */
21 #include <stdlib.h>
22 #include <string.h>
24 #include "bitmap.h"
25 #include "callback.h"
26 #include "color.h"
27 #include "cursoricon.h"
28 #include "debugtools.h"
29 #include "gdi.h"
30 #include "heap.h"
31 #include "local.h"
32 #include "tweak.h"
33 #include "x11drv.h"
35 /* Include OEM pixmaps */
36 #include "bitmaps/obm_lfarrowi"
37 #include "bitmaps/obm_rgarrowi"
38 #include "bitmaps/obm_dnarrowi"
39 #include "bitmaps/obm_uparrowi"
40 #include "bitmaps/obm_combo"
41 #include "bitmaps/obm_mnarrow"
42 #include "bitmaps/obm_lfarrowd"
43 #include "bitmaps/obm_rgarrowd"
44 #include "bitmaps/obm_dnarrowd"
45 #include "bitmaps/obm_uparrowd"
46 #include "bitmaps/obm_restored"
47 #include "bitmaps/obm_restore"
48 #include "bitmaps/obm_lfarrow"
49 #include "bitmaps/obm_rgarrow"
50 #include "bitmaps/obm_dnarrow"
51 #include "bitmaps/obm_uparrow"
52 #include "bitmaps/obm_old_restore"
53 #include "bitmaps/obm_old_zoom"
54 #include "bitmaps/obm_old_reduce"
55 #include "bitmaps/obm_btncorners"
56 #include "bitmaps/obm_checkboxes"
57 #include "bitmaps/obm_check"
58 #include "bitmaps/obm_btsize"
59 #include "bitmaps/obm_old_lfarrow"
60 #include "bitmaps/obm_old_rgarrow"
61 #include "bitmaps/obm_old_dnarrow"
62 #include "bitmaps/obm_old_uparrow"
63 #include "bitmaps/obm_size"
64 #include "bitmaps/obm_old_close"
65 #include "bitmaps/obm_trtype"
66 #include "bitmaps/obm_radiocheck"
68 #include "bitmaps/obm_zoomd"
69 #include "bitmaps/obm_reduced"
70 #include "bitmaps/obm_zoom"
71 #include "bitmaps/obm_reduce"
72 #include "bitmaps/obm_close"
73 #include "bitmaps/obm_zoomd_95"
74 #include "bitmaps/obm_reduced_95"
75 #include "bitmaps/obm_zoom_95"
76 #include "bitmaps/obm_reduce_95"
77 #include "bitmaps/obm_close_95"
78 #include "bitmaps/obm_closed_95"
79 #include "bitmaps/obm_restore_95"
80 #include "bitmaps/obm_restored_95"
82 DECLARE_DEBUG_CHANNEL(bitmap)
83 DECLARE_DEBUG_CHANNEL(cursor)
84 DECLARE_DEBUG_CHANNEL(x11drv)
87 #define OBM_FIRST OBM_CLOSED /* First OEM bitmap */
88 #define OBM_LAST OBM_OLD_CLOSE /* Last OEM bitmap */
90 static struct
92 char** data; /* Pointer to bitmap data */
93 BOOL color; /* Is it a color bitmap? */
94 } OBM_Pixmaps_Data[OBM_LAST-OBM_FIRST+1] = {
95 { obm_closed_95,TRUE}, /* OBM_CLOSED */
96 { obm_radiocheck, FALSE }, /* OBM_RADIOCHECK */
97 { obm_trtype, TRUE }, /* OBM_TRTYPE */
98 { obm_lfarrowi, TRUE }, /* OBM_LFARROWI */
99 { obm_rgarrowi, TRUE }, /* OBM_RGARROWI */
100 { obm_dnarrowi, TRUE }, /* OBM_DNARROWI */
101 { obm_uparrowi, TRUE }, /* OBM_UPARROWI */
102 { obm_combo, FALSE }, /* OBM_COMBO */
103 { obm_mnarrow, FALSE }, /* OBM_MNARROW */
104 { obm_lfarrowd, TRUE }, /* OBM_LFARROWD */
105 { obm_rgarrowd, TRUE }, /* OBM_RGARROWD */
106 { obm_dnarrowd, TRUE }, /* OBM_DNARROWD */
107 { obm_uparrowd, TRUE }, /* OBM_UPARROWD */
108 { obm_restored, TRUE }, /* OBM_RESTORED */
109 { obm_zoomd, TRUE }, /* OBM_ZOOMD */
110 { obm_reduced, TRUE }, /* OBM_REDUCED */
111 { obm_restore, TRUE }, /* OBM_RESTORE */
112 { obm_zoom, TRUE }, /* OBM_ZOOM */
113 { obm_reduce, TRUE }, /* OBM_REDUCE */
114 { obm_lfarrow, TRUE }, /* OBM_LFARROW */
115 { obm_rgarrow, TRUE }, /* OBM_RGARROW */
116 { obm_dnarrow, TRUE }, /* OBM_DNARROW */
117 { obm_uparrow, TRUE }, /* OBM_UPARROW */
118 { obm_close, TRUE }, /* OBM_CLOSE */
119 { obm_old_restore, FALSE }, /* OBM_OLD_RESTORE */
120 { obm_old_zoom, FALSE }, /* OBM_OLD_ZOOM */
121 { obm_old_reduce, FALSE }, /* OBM_OLD_REDUCE */
122 { obm_btncorners, FALSE }, /* OBM_BTNCORNERS */
123 { obm_checkboxes, FALSE }, /* OBM_CHECKBOXES */
124 { obm_check, FALSE }, /* OBM_CHECK */
125 { obm_btsize, FALSE }, /* OBM_BTSIZE */
126 { obm_old_lfarrow, FALSE }, /* OBM_OLD_LFARROW */
127 { obm_old_rgarrow, FALSE }, /* OBM_OLD_RGARROW */
128 { obm_old_dnarrow, FALSE }, /* OBM_OLD_DNARROW */
129 { obm_old_uparrow, FALSE }, /* OBM_OLD_UPARROW */
130 { obm_size, FALSE }, /* OBM_SIZE */
131 { obm_old_close, FALSE }, /* OBM_OLD_CLOSE */
135 /* Include OEM icons */
136 #include "bitmaps/oic_sample"
137 #include "bitmaps/oic_hand"
138 #include "bitmaps/oic_ques"
139 #include "bitmaps/oic_bang"
140 #include "bitmaps/oic_note"
141 #include "bitmaps/oic_portrait"
142 #include "bitmaps/oic_landscape"
143 #include "bitmaps/oic_wineicon"
144 #include "bitmaps/oic_hand_95"
145 #include "bitmaps/oic_ques_95"
146 #include "bitmaps/oic_bang_95"
147 #include "bitmaps/oic_note_95"
148 #include "bitmaps/oic_folder"
149 #include "bitmaps/oic_folder2"
150 #include "bitmaps/oic_floppy"
151 #include "bitmaps/oic_cdrom"
152 #include "bitmaps/oic_hdisk"
153 #include "bitmaps/oic_network"
155 #define OIC_FIRST OIC_SAMPLE /* First OEM icon */
156 #define OIC_LAST OIC_NETWORK /* Last OEM icon */
158 static char **OBM_Icons_Data[OIC_LAST-OIC_FIRST+1] =
160 oic_sample, /* OIC_SAMPLE */
161 oic_hand, /* OIC_HAND */
162 oic_ques, /* OIC_QUES */
163 oic_bang, /* OIC_BANG */
164 oic_note, /* OIC_NOTE */
165 oic_portrait, /* OIC_PORTRAIT */
166 oic_landscape, /* OIC_LANDSCAPE */
167 oic_wineicon, /* OIC_WINEICON */
168 oic_folder, /* OIC_FOLDER */
169 oic_folder2, /* OIC_FOLDER2 */
170 oic_floppy, /* OIC_FLOPPY */
171 oic_cdrom, /* OIC_CDROM */
172 oic_hdisk, /* OIC_HDISK */
173 oic_network /* OIC_NETWORK */
177 /* Include OEM cursors */
178 #include "bitmaps/ocr_normal"
179 #include "bitmaps/ocr_ibeam"
180 #include "bitmaps/ocr_wait"
181 #include "bitmaps/ocr_cross"
182 #include "bitmaps/ocr_up"
183 #include "bitmaps/ocr_size"
184 #include "bitmaps/ocr_icon"
185 #include "bitmaps/ocr_sizenwse"
186 #include "bitmaps/ocr_sizenesw"
187 #include "bitmaps/ocr_sizewe"
188 #include "bitmaps/ocr_sizens"
189 #include "bitmaps/ocr_bummer"
190 #include "bitmaps/ocr_dragobject"
191 /*#include "bitmaps/ocr_sizeall"*/
192 /*#include "bitmaps/ocr_icocur"*/
193 #include "bitmaps/ocr_no"
194 #include "bitmaps/ocr_appstarting"
195 #include "bitmaps/ocr_help"
197 /* Cursor are not all contiguous (go figure...) */
198 #define OCR_FIRST0 OCR_BUMMER
199 #define OCR_LAST0 OCR_DRAGOBJECT
200 #define OCR_BASE0 0
202 #define OCR_FIRST1 OCR_NORMAL
203 #define OCR_LAST1 OCR_UP
204 #define OCR_BASE1 (OCR_BASE0 + OCR_LAST0 - OCR_FIRST0 + 1)
206 #define OCR_FIRST2 OCR_SIZE
207 #define OCR_LAST2 OCR_SIZEALL
208 #define OCR_BASE2 (OCR_BASE1 + OCR_LAST1 - OCR_FIRST1 + 1)
210 #define OCR_FIRST3 OCR_NO
211 #define OCR_LAST3 OCR_NO
212 #define OCR_BASE3 (OCR_BASE2 + OCR_LAST2 - OCR_FIRST2 + 1)
214 #define OCR_FIRST4 OCR_APPSTARTING
215 #define OCR_LAST4 OCR_APPSTARTING
216 #define OCR_BASE4 (OCR_BASE3 + OCR_LAST3 - OCR_FIRST3 + 1)
218 #define OCR_FIRST5 OCR_HELP
219 #define OCR_LAST5 OCR_HELP
220 #define OCR_BASE5 (OCR_BASE4 + OCR_LAST4 - OCR_FIRST4 + 1)
222 #define NB_CURSORS (OCR_BASE5 + OCR_LAST5 - OCR_FIRST5 + 1)
223 static char **OBM_Cursors_Data[NB_CURSORS] =
225 ocr_bummer, /* OCR_BUMMER */
226 ocr_dragobject, /* OCR_DRAGOBJECT */
227 ocr_normal, /* OCR_NORMAL */
228 ocr_ibeam, /* OCR_IBEAM */
229 ocr_wait, /* OCR_WAIT */
230 ocr_cross, /* OCR_CROSS */
231 ocr_up, /* OCR_UP */
232 ocr_size, /* OCR_SIZE */
233 ocr_icon, /* OCR_ICON */
234 ocr_sizenwse, /* OCR_SIZENWSE */
235 ocr_sizenesw, /* OCR_SIZENESW */
236 ocr_sizewe, /* OCR_SIZEWE */
237 ocr_sizens, /* OCR_SIZENS */
238 ocr_size, /* OCR_SIZEALL */ /* Re-used the same one as OCR_SIZE for now */
239 #if 0
240 ocr_icocur /* OCR_ICOCUR */
241 #endif
242 ocr_no, /* OCR_NO */
243 ocr_appstarting, /* OCR_APPSTARTING */
244 ocr_help /* OCR_HELP */
247 static HGLOBAL16 OBM_Cursors[NB_CURSORS];
250 /* All the colors used in the xpm files must be included in this */
251 /* list, to make sure that the loaded bitmaps only use colors from */
252 /* the Windows colormap. Note: the PALETTEINDEX() are not really */
253 /* palette indexes, but system colors that will be converted to */
254 /* indexes later on. */
256 #ifdef HAVE_LIBXXPM
257 static XpmColorSymbol
258 #else /* defined(HAVE_LIBXXPM) */
259 static struct
261 char *name;
262 char *value;
263 Pixel pixel;
265 #endif /* defined(HAVE_LIBXXPM) */
266 OBM_Colors[] =
268 { "black", NULL, (Pixel)RGB(0,0,0) },
269 { "white", NULL, (Pixel)RGB(255,255,255) },
270 { "red", NULL, (Pixel)RGB(255,0,0) },
271 { "green", NULL, (Pixel)RGB(0,255,0) },
272 { "blue", NULL, (Pixel)RGB(0,0,255) },
273 { "yellow", NULL, (Pixel)RGB(255,255,0) },
274 { "cyan", NULL, (Pixel)RGB(0,255,255) },
275 { "dkyellow", NULL, (Pixel)RGB(128,128,0) },
276 { "purple", NULL, (Pixel)RGB(128,0,128) },
277 { "ltgray", NULL, (Pixel)RGB(192,192,192) },
278 { "dkgray", NULL, (Pixel)RGB(128,128,128) },
279 { "button_face", NULL, (Pixel)PALETTEINDEX(COLOR_BTNFACE) },
280 { "button_shadow", NULL, (Pixel)PALETTEINDEX(COLOR_BTNSHADOW) },
281 { "button_highlight", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
282 { "button_edge", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
283 { "button_text", NULL, (Pixel)PALETTEINDEX(COLOR_BTNTEXT) },
284 { "window_frame", NULL, (Pixel)PALETTEINDEX(COLOR_WINDOWFRAME) }
287 #define NB_COLOR_SYMBOLS (sizeof(OBM_Colors)/sizeof(OBM_Colors[0]))
289 /* These are the symbolic colors for monochrome bitmaps */
290 /* This is needed to make sure that black is always 0 and */
291 /* white always 1, as required by Windows. */
293 #ifdef HAVE_LIBXXPM
294 static XpmColorSymbol OBM_BlackAndWhite[2] =
296 { "black", NULL, 0 },
297 { "white", NULL, 0xffffffff }
299 #endif /* defined(HAVE_LIBXXPM) */
302 /* This structure holds the arguments for OBM_CreateBitmaps() */
303 typedef struct
305 char **data; /* In: bitmap data */
306 BOOL color; /* In: color or monochrome */
307 BOOL need_mask; /* In: do we need a mask? */
308 HBITMAP16 bitmap; /* Out: resulting bitmap */
309 HBITMAP16 mask; /* Out: resulting mask (if needed) */
310 POINT hotspot; /* Out: bitmap hotspot */
311 } OBM_BITMAP_DESCR;
314 /***********************************************************************
315 * OBM_InitColorSymbols
317 static BOOL OBM_InitColorSymbols()
319 static BOOL initialized = FALSE;
320 int i;
322 if (initialized) return TRUE; /* Already initialised */
323 initialized = TRUE;
325 for (i = 0; i < NB_COLOR_SYMBOLS; i++)
327 if (OBM_Colors[i].pixel & 0xff000000) /* PALETTEINDEX */
328 OBM_Colors[i].pixel = X11DRV_PALETTE_ToPhysical( NULL,
329 GetSysColor(OBM_Colors[i].pixel & 0xff));
330 else /* RGB*/
331 OBM_Colors[i].pixel = X11DRV_PALETTE_ToPhysical( NULL, OBM_Colors[i].pixel);
333 return TRUE;
337 /***********************************************************************
338 * OBM_MakeBitmap
340 * Allocate a GDI bitmap.
342 #ifdef HAVE_LIBXXPM
343 static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
344 WORD bpp, Pixmap pixmap )
346 HBITMAP16 hbitmap;
347 BITMAPOBJ * bmpObjPtr;
348 X11DRV_PHYSBITMAP *pbitmap;
350 if (!pixmap) return 0;
352 hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
353 if (!hbitmap) return 0;
355 bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LOCK( hbitmap );
356 bmpObjPtr->size.cx = width;
357 bmpObjPtr->size.cy = height;
358 bmpObjPtr->bitmap.bmType = 0;
359 bmpObjPtr->bitmap.bmWidth = width;
360 bmpObjPtr->bitmap.bmHeight = height;
361 bmpObjPtr->bitmap.bmWidthBytes = BITMAP_GetWidthBytes( width, bpp );
362 bmpObjPtr->bitmap.bmPlanes = 1;
363 bmpObjPtr->bitmap.bmBitsPixel = bpp;
364 bmpObjPtr->bitmap.bmBits = NULL;
365 bmpObjPtr->dib = NULL;
367 pbitmap = X11DRV_AllocBitmap(bmpObjPtr);
369 pbitmap->pixmap = pixmap;
371 GDI_HEAP_UNLOCK( hbitmap );
372 return hbitmap;
374 #endif /* defined(HAVE_LIBXXPM) */
376 /***********************************************************************
377 * OBM_CreateBitmaps
379 * Create the 2 bitmaps from XPM data.
381 * The Xlib critical section must be entered before calling this function.
383 static BOOL OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
385 #ifdef HAVE_LIBXXPM
386 Pixmap pixmap, pixmask;
387 XpmAttributes *attrs;
388 int err;
390 attrs = (XpmAttributes *)HEAP_xalloc( GetProcessHeap(), 0,
391 XpmAttributesSize() );
392 attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
393 attrs->colormap = X11DRV_PALETTE_PaletteXColormap;
394 attrs->depth = descr->color ? X11DRV_GetDepth() : 1;
395 attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
396 attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
398 err = XpmCreatePixmapFromData( display, X11DRV_GetXRootWindow(), descr->data,
399 &pixmap, &pixmask, attrs );
401 if (err != XpmSuccess)
403 HeapFree( GetProcessHeap(), 0, attrs );
404 return FALSE;
406 descr->hotspot.x = attrs->x_hotspot;
407 descr->hotspot.y = attrs->y_hotspot;
408 descr->bitmap = OBM_MakeBitmap( attrs->width, attrs->height,
409 attrs->depth, pixmap );
410 if (descr->need_mask)
411 descr->mask = OBM_MakeBitmap( attrs->width, attrs->height,
412 1, pixmask );
413 HeapFree( GetProcessHeap(), 0, attrs );
414 if (!descr->bitmap)
416 if (pixmap) XFreePixmap( display, pixmap );
417 if (pixmask) XFreePixmap( display, pixmask );
418 if (descr->bitmap) GDI_FreeObject( descr->bitmap );
419 if (descr->need_mask && descr->mask) GDI_FreeObject( descr->mask );
420 return FALSE;
422 else return TRUE;
423 #else /* defined(HAVE_LIBXXPM) */
424 FIXME_(x11drv)(
425 "Xpm support not in the binary, "
426 "please install Xpm and recompile\n"
428 return FALSE;
429 #endif /* defined(HAVE_LIBXXPM) */
433 /***********************************************************************
434 * OBM_LoadBitmap
436 static HBITMAP16 OBM_LoadBitmap( WORD id )
438 OBM_BITMAP_DESCR descr;
440 if ((id < OBM_FIRST) || (id > OBM_LAST)) return 0;
441 id -= OBM_FIRST;
443 if (!OBM_InitColorSymbols()) return 0;
445 descr.data = OBM_Pixmaps_Data[id].data;
446 descr.color = OBM_Pixmaps_Data[id].color;
447 descr.need_mask = FALSE;
449 EnterCriticalSection( &X11DRV_CritSection );
450 if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
452 LeaveCriticalSection( &X11DRV_CritSection );
453 WARN_(bitmap)("Error creating OEM bitmap %d\n", OBM_FIRST+id );
454 return 0;
456 LeaveCriticalSection( &X11DRV_CritSection );
457 return descr.bitmap;
461 /***********************************************************************
462 * OBM_LoadCursorIcon
464 static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL fCursor )
466 OBM_BITMAP_DESCR descr;
467 HGLOBAL16 handle;
468 CURSORICONINFO *pInfo;
469 BITMAPOBJ *bmpXor, *bmpAnd;
470 int sizeXor, sizeAnd;
472 if (fCursor)
474 if ((id >= OCR_FIRST1) && (id <= OCR_LAST1))
475 id = OCR_BASE1 + id - OCR_FIRST1;
476 else if ((id >= OCR_FIRST2) && (id <= OCR_LAST2))
477 id = OCR_BASE2 + id - OCR_FIRST2;
478 else if ((id >= OCR_FIRST0) && (id <= OCR_LAST0))
479 id = OCR_BASE0 + id - OCR_FIRST0;
480 else if ((id >= OCR_FIRST3) && (id <= OCR_LAST3))
481 id = OCR_BASE3 + id - OCR_FIRST3;
482 else if ((id >= OCR_FIRST4) && (id <= OCR_LAST4))
483 id = OCR_BASE4 + id - OCR_FIRST4;
484 else if ((id >= OCR_FIRST5) && (id <= OCR_LAST5))
485 id = OCR_BASE5 + id - OCR_FIRST5;
486 else return 0;
487 if (OBM_Cursors[id]) return OBM_Cursors[id];
489 else
491 if ((id < OIC_FIRST) || (id > OIC_LAST)) return 0;
492 id -= OIC_FIRST;
495 if (!OBM_InitColorSymbols()) return 0;
497 descr.data = fCursor ? OBM_Cursors_Data[id] : OBM_Icons_Data[id];
498 descr.color = !fCursor;
499 descr.need_mask = TRUE;
501 EnterCriticalSection( &X11DRV_CritSection );
502 if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
504 LeaveCriticalSection( &X11DRV_CritSection );
505 WARN_(cursor)("Error creating OEM cursor/icon %d\n", id );
506 return 0;
508 LeaveCriticalSection( &X11DRV_CritSection );
510 bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( descr.bitmap, BITMAP_MAGIC );
511 bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( descr.mask, BITMAP_MAGIC );
512 sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes;
513 sizeAnd = bmpXor->bitmap.bmHeight *
514 BITMAP_GetWidthBytes( bmpXor->bitmap.bmWidth, 1 );
516 if (!(handle = GlobalAlloc16( GMEM_MOVEABLE,
517 sizeof(CURSORICONINFO) + sizeXor + sizeAnd)))
519 DeleteObject( descr.bitmap );
520 DeleteObject( descr.mask );
521 return 0;
524 pInfo = (CURSORICONINFO *)GlobalLock16( handle );
525 pInfo->ptHotSpot.x = descr.hotspot.x;
526 pInfo->ptHotSpot.y = descr.hotspot.y;
527 pInfo->nWidth = bmpXor->bitmap.bmWidth;
528 pInfo->nHeight = bmpXor->bitmap.bmHeight;
529 pInfo->nWidthBytes = bmpXor->bitmap.bmWidthBytes;
530 pInfo->bPlanes = bmpXor->bitmap.bmPlanes;
531 pInfo->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel;
533 if (descr.mask)
535 X11DRV_PHYSBITMAP *pbitmapAnd = bmpAnd->DDBitmap->physBitmap;
536 /* Invert the mask */
538 TSXSetFunction( display, BITMAP_monoGC, GXinvert );
539 TSXFillRectangle( display, pbitmapAnd->pixmap, 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 X11DRV_PHYSBITMAP *pbitmapXor = bmpXor->DDBitmap->physBitmap;
548 TSXSetForeground( display, BITMAP_colorGC,
549 X11DRV_PALETTE_ToPhysical( NULL, RGB(0,0,0) ));
550 TSXSetBackground( display, BITMAP_colorGC, 0 );
551 TSXSetFunction( display, BITMAP_colorGC, GXor );
552 TSXCopyPlane(display, pbitmapAnd->pixmap, pbitmapXor->pixmap, BITMAP_colorGC,
553 0, 0, bmpXor->bitmap.bmWidth, bmpXor->bitmap.bmHeight,
554 0, 0, 1 );
555 TSXSetFunction( display, BITMAP_colorGC, GXcopy );
559 if (descr.mask) GetBitmapBits( descr.mask, sizeAnd, (char *)(pInfo + 1));
560 else memset( (char *)(pInfo + 1), 0xff, sizeAnd );
561 GetBitmapBits( descr.bitmap, sizeXor, (char *)(pInfo + 1) + sizeAnd );
563 DeleteObject( descr.bitmap );
564 DeleteObject( descr.mask );
566 if (fCursor) OBM_Cursors[id] = handle;
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;
632 #endif /* !defined(X_DISPLAY_MISSING) */