Corrected operand sizes for the "enter" instruction.
[wine.git] / graphics / x11drv / oembitmap.c
bloba63cd2eee27066be2e82684677537367cad1c78b
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 "monitor.h"
33 #include "tweak.h"
34 #include "x11drv.h"
36 /* Include OEM pixmaps */
37 #include "bitmaps/obm_lfarrowi"
38 #include "bitmaps/obm_rgarrowi"
39 #include "bitmaps/obm_dnarrowi"
40 #include "bitmaps/obm_uparrowi"
41 #include "bitmaps/obm_combo"
42 #include "bitmaps/obm_mnarrow"
43 #include "bitmaps/obm_lfarrowd"
44 #include "bitmaps/obm_rgarrowd"
45 #include "bitmaps/obm_dnarrowd"
46 #include "bitmaps/obm_uparrowd"
47 #include "bitmaps/obm_restored"
48 #include "bitmaps/obm_restore"
49 #include "bitmaps/obm_lfarrow"
50 #include "bitmaps/obm_rgarrow"
51 #include "bitmaps/obm_dnarrow"
52 #include "bitmaps/obm_uparrow"
53 #include "bitmaps/obm_old_restore"
54 #include "bitmaps/obm_old_zoom"
55 #include "bitmaps/obm_old_reduce"
56 #include "bitmaps/obm_btncorners"
57 #include "bitmaps/obm_checkboxes"
58 #include "bitmaps/obm_check"
59 #include "bitmaps/obm_btsize"
60 #include "bitmaps/obm_old_lfarrow"
61 #include "bitmaps/obm_old_rgarrow"
62 #include "bitmaps/obm_old_dnarrow"
63 #include "bitmaps/obm_old_uparrow"
64 #include "bitmaps/obm_size"
65 #include "bitmaps/obm_old_close"
66 #include "bitmaps/obm_trtype"
67 #include "bitmaps/obm_radiocheck"
69 #include "bitmaps/obm_zoomd"
70 #include "bitmaps/obm_reduced"
71 #include "bitmaps/obm_zoom"
72 #include "bitmaps/obm_reduce"
73 #include "bitmaps/obm_close"
74 #include "bitmaps/obm_zoomd_95"
75 #include "bitmaps/obm_reduced_95"
76 #include "bitmaps/obm_zoom_95"
77 #include "bitmaps/obm_reduce_95"
78 #include "bitmaps/obm_close_95"
79 #include "bitmaps/obm_closed_95"
80 #include "bitmaps/obm_restore_95"
81 #include "bitmaps/obm_restored_95"
83 DECLARE_DEBUG_CHANNEL(bitmap)
84 DECLARE_DEBUG_CHANNEL(cursor)
85 DECLARE_DEBUG_CHANNEL(x11drv)
88 #define OBM_FIRST OBM_CLOSED /* First OEM bitmap */
89 #define OBM_LAST OBM_OLD_CLOSE /* Last OEM bitmap */
91 static struct
93 char** data; /* Pointer to bitmap data */
94 BOOL color; /* Is it a color bitmap? */
95 } OBM_Pixmaps_Data[OBM_LAST-OBM_FIRST+1] = {
96 { obm_closed_95,TRUE}, /* OBM_CLOSED */
97 { obm_radiocheck, FALSE }, /* OBM_RADIOCHECK */
98 { obm_trtype, TRUE }, /* OBM_TRTYPE */
99 { obm_lfarrowi, TRUE }, /* OBM_LFARROWI */
100 { obm_rgarrowi, TRUE }, /* OBM_RGARROWI */
101 { obm_dnarrowi, TRUE }, /* OBM_DNARROWI */
102 { obm_uparrowi, TRUE }, /* OBM_UPARROWI */
103 { obm_combo, FALSE }, /* OBM_COMBO */
104 { obm_mnarrow, FALSE }, /* OBM_MNARROW */
105 { obm_lfarrowd, TRUE }, /* OBM_LFARROWD */
106 { obm_rgarrowd, TRUE }, /* OBM_RGARROWD */
107 { obm_dnarrowd, TRUE }, /* OBM_DNARROWD */
108 { obm_uparrowd, TRUE }, /* OBM_UPARROWD */
109 { obm_restored, TRUE }, /* OBM_RESTORED */
110 { obm_zoomd, TRUE }, /* OBM_ZOOMD */
111 { obm_reduced, TRUE }, /* OBM_REDUCED */
112 { obm_restore, TRUE }, /* OBM_RESTORE */
113 { obm_zoom, TRUE }, /* OBM_ZOOM */
114 { obm_reduce, TRUE }, /* OBM_REDUCE */
115 { obm_lfarrow, TRUE }, /* OBM_LFARROW */
116 { obm_rgarrow, TRUE }, /* OBM_RGARROW */
117 { obm_dnarrow, TRUE }, /* OBM_DNARROW */
118 { obm_uparrow, TRUE }, /* OBM_UPARROW */
119 { obm_close, TRUE }, /* OBM_CLOSE */
120 { obm_old_restore, FALSE }, /* OBM_OLD_RESTORE */
121 { obm_old_zoom, FALSE }, /* OBM_OLD_ZOOM */
122 { obm_old_reduce, FALSE }, /* OBM_OLD_REDUCE */
123 { obm_btncorners, FALSE }, /* OBM_BTNCORNERS */
124 { obm_checkboxes, FALSE }, /* OBM_CHECKBOXES */
125 { obm_check, FALSE }, /* OBM_CHECK */
126 { obm_btsize, FALSE }, /* OBM_BTSIZE */
127 { obm_old_lfarrow, FALSE }, /* OBM_OLD_LFARROW */
128 { obm_old_rgarrow, FALSE }, /* OBM_OLD_RGARROW */
129 { obm_old_dnarrow, FALSE }, /* OBM_OLD_DNARROW */
130 { obm_old_uparrow, FALSE }, /* OBM_OLD_UPARROW */
131 { obm_size, FALSE }, /* OBM_SIZE */
132 { obm_old_close, FALSE }, /* OBM_OLD_CLOSE */
136 /* Include OEM icons */
137 #include "bitmaps/oic_sample"
138 #include "bitmaps/oic_hand"
139 #include "bitmaps/oic_ques"
140 #include "bitmaps/oic_bang"
141 #include "bitmaps/oic_note"
142 #include "bitmaps/oic_portrait"
143 #include "bitmaps/oic_landscape"
144 #include "bitmaps/oic_wineicon"
145 #include "bitmaps/oic_hand_95"
146 #include "bitmaps/oic_ques_95"
147 #include "bitmaps/oic_bang_95"
148 #include "bitmaps/oic_note_95"
149 #include "bitmaps/oic_folder"
150 #include "bitmaps/oic_folder2"
151 #include "bitmaps/oic_floppy"
152 #include "bitmaps/oic_cdrom"
153 #include "bitmaps/oic_hdisk"
154 #include "bitmaps/oic_network"
156 #define OIC_FIRST OIC_SAMPLE /* First OEM icon */
157 #define OIC_LAST OIC_NETWORK /* Last OEM icon */
159 static char **OBM_Icons_Data[OIC_LAST-OIC_FIRST+1] =
161 oic_sample, /* OIC_SAMPLE */
162 oic_hand, /* OIC_HAND */
163 oic_ques, /* OIC_QUES */
164 oic_bang, /* OIC_BANG */
165 oic_note, /* OIC_NOTE */
166 oic_portrait, /* OIC_PORTRAIT */
167 oic_landscape, /* OIC_LANDSCAPE */
168 oic_wineicon, /* OIC_WINEICON */
169 oic_folder, /* OIC_FOLDER */
170 oic_folder2, /* OIC_FOLDER2 */
171 oic_floppy, /* OIC_FLOPPY */
172 oic_cdrom, /* OIC_CDROM */
173 oic_hdisk, /* OIC_HDISK */
174 oic_network /* OIC_NETWORK */
178 /* Include OEM cursors */
179 #include "bitmaps/ocr_normal"
180 #include "bitmaps/ocr_ibeam"
181 #include "bitmaps/ocr_wait"
182 #include "bitmaps/ocr_cross"
183 #include "bitmaps/ocr_up"
184 #include "bitmaps/ocr_size"
185 #include "bitmaps/ocr_icon"
186 #include "bitmaps/ocr_sizenwse"
187 #include "bitmaps/ocr_sizenesw"
188 #include "bitmaps/ocr_sizewe"
189 #include "bitmaps/ocr_sizens"
190 #include "bitmaps/ocr_bummer"
191 #include "bitmaps/ocr_dragobject"
192 /*#include "bitmaps/ocr_sizeall"*/
193 /*#include "bitmaps/ocr_icocur"*/
194 #include "bitmaps/ocr_no"
195 #include "bitmaps/ocr_appstarting"
196 #include "bitmaps/ocr_help"
198 /* Cursor are not all contiguous (go figure...) */
199 #define OCR_FIRST0 OCR_BUMMER
200 #define OCR_LAST0 OCR_DRAGOBJECT
201 #define OCR_BASE0 0
203 #define OCR_FIRST1 OCR_NORMAL
204 #define OCR_LAST1 OCR_UP
205 #define OCR_BASE1 (OCR_BASE0 + OCR_LAST0 - OCR_FIRST0 + 1)
207 #define OCR_FIRST2 OCR_SIZE
208 #define OCR_LAST2 OCR_SIZEALL
209 #define OCR_BASE2 (OCR_BASE1 + OCR_LAST1 - OCR_FIRST1 + 1)
211 #define OCR_FIRST3 OCR_NO
212 #define OCR_LAST3 OCR_NO
213 #define OCR_BASE3 (OCR_BASE2 + OCR_LAST2 - OCR_FIRST2 + 1)
215 #define OCR_FIRST4 OCR_APPSTARTING
216 #define OCR_LAST4 OCR_APPSTARTING
217 #define OCR_BASE4 (OCR_BASE3 + OCR_LAST3 - OCR_FIRST3 + 1)
219 #define OCR_FIRST5 OCR_HELP
220 #define OCR_LAST5 OCR_HELP
221 #define OCR_BASE5 (OCR_BASE4 + OCR_LAST4 - OCR_FIRST4 + 1)
223 #define NB_CURSORS (OCR_BASE5 + OCR_LAST5 - OCR_FIRST5 + 1)
224 static char **OBM_Cursors_Data[NB_CURSORS] =
226 ocr_bummer, /* OCR_BUMMER */
227 ocr_dragobject, /* OCR_DRAGOBJECT */
228 ocr_normal, /* OCR_NORMAL */
229 ocr_ibeam, /* OCR_IBEAM */
230 ocr_wait, /* OCR_WAIT */
231 ocr_cross, /* OCR_CROSS */
232 ocr_up, /* OCR_UP */
233 ocr_size, /* OCR_SIZE */
234 ocr_icon, /* OCR_ICON */
235 ocr_sizenwse, /* OCR_SIZENWSE */
236 ocr_sizenesw, /* OCR_SIZENESW */
237 ocr_sizewe, /* OCR_SIZEWE */
238 ocr_sizens, /* OCR_SIZENS */
239 ocr_size, /* OCR_SIZEALL */ /* Re-used the same one as OCR_SIZE for now */
240 #if 0
241 ocr_icocur /* OCR_ICOCUR */
242 #endif
243 ocr_no, /* OCR_NO */
244 ocr_appstarting, /* OCR_APPSTARTING */
245 ocr_help /* OCR_HELP */
248 static HGLOBAL16 OBM_Cursors[NB_CURSORS];
251 /* All the colors used in the xpm files must be included in this */
252 /* list, to make sure that the loaded bitmaps only use colors from */
253 /* the Windows colormap. Note: the PALETTEINDEX() are not really */
254 /* palette indexes, but system colors that will be converted to */
255 /* indexes later on. */
257 #ifdef HAVE_LIBXXPM
258 static XpmColorSymbol
259 #else /* defined(HAVE_LIBXXPM) */
260 static struct
262 char *name;
263 char *value;
264 Pixel pixel;
266 #endif /* defined(HAVE_LIBXXPM) */
267 OBM_Colors[] =
269 { "black", NULL, (Pixel)RGB(0,0,0) },
270 { "white", NULL, (Pixel)RGB(255,255,255) },
271 { "red", NULL, (Pixel)RGB(255,0,0) },
272 { "green", NULL, (Pixel)RGB(0,255,0) },
273 { "blue", NULL, (Pixel)RGB(0,0,255) },
274 { "yellow", NULL, (Pixel)RGB(255,255,0) },
275 { "cyan", NULL, (Pixel)RGB(0,255,255) },
276 { "dkyellow", NULL, (Pixel)RGB(128,128,0) },
277 { "purple", NULL, (Pixel)RGB(128,0,128) },
278 { "ltgray", NULL, (Pixel)RGB(192,192,192) },
279 { "dkgray", NULL, (Pixel)RGB(128,128,128) },
280 { "button_face", NULL, (Pixel)PALETTEINDEX(COLOR_BTNFACE) },
281 { "button_shadow", NULL, (Pixel)PALETTEINDEX(COLOR_BTNSHADOW) },
282 { "button_highlight", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
283 { "button_edge", NULL, (Pixel)PALETTEINDEX(COLOR_BTNHIGHLIGHT) },
284 { "button_text", NULL, (Pixel)PALETTEINDEX(COLOR_BTNTEXT) },
285 { "window_frame", NULL, (Pixel)PALETTEINDEX(COLOR_WINDOWFRAME) }
288 #define NB_COLOR_SYMBOLS (sizeof(OBM_Colors)/sizeof(OBM_Colors[0]))
290 /* These are the symbolic colors for monochrome bitmaps */
291 /* This is needed to make sure that black is always 0 and */
292 /* white always 1, as required by Windows. */
294 #ifdef HAVE_LIBXXPM
295 static XpmColorSymbol OBM_BlackAndWhite[2] =
297 { "black", NULL, 0 },
298 { "white", NULL, 0xffffffff }
300 #endif /* defined(HAVE_LIBXXPM) */
303 /* This structure holds the arguments for OBM_CreateBitmaps() */
304 typedef struct
306 char **data; /* In: bitmap data */
307 BOOL color; /* In: color or monochrome */
308 BOOL need_mask; /* In: do we need a mask? */
309 HBITMAP16 bitmap; /* Out: resulting bitmap */
310 HBITMAP16 mask; /* Out: resulting mask (if needed) */
311 POINT hotspot; /* Out: bitmap hotspot */
312 } OBM_BITMAP_DESCR;
315 /***********************************************************************
316 * OBM_InitColorSymbols
318 static BOOL OBM_InitColorSymbols()
320 static BOOL initialized = FALSE;
321 int i;
323 if (initialized) return TRUE; /* Already initialised */
324 initialized = TRUE;
326 for (i = 0; i < NB_COLOR_SYMBOLS; i++)
328 if (OBM_Colors[i].pixel & 0xff000000) /* PALETTEINDEX */
329 OBM_Colors[i].pixel = X11DRV_PALETTE_ToPhysical( NULL,
330 GetSysColor(OBM_Colors[i].pixel & 0xff));
331 else /* RGB*/
332 OBM_Colors[i].pixel = X11DRV_PALETTE_ToPhysical( NULL, OBM_Colors[i].pixel);
334 return TRUE;
338 /***********************************************************************
339 * OBM_MakeBitmap
341 * Allocate a GDI bitmap.
343 #ifdef HAVE_LIBXXPM
344 static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
345 WORD bpp, Pixmap pixmap )
347 HBITMAP16 hbitmap;
348 BITMAPOBJ * bmpObjPtr;
349 X11DRV_PHYSBITMAP *pbitmap;
351 if (!pixmap) return 0;
353 hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
354 if (!hbitmap) return 0;
356 bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LOCK( hbitmap );
357 bmpObjPtr->size.cx = width;
358 bmpObjPtr->size.cy = height;
359 bmpObjPtr->bitmap.bmType = 0;
360 bmpObjPtr->bitmap.bmWidth = width;
361 bmpObjPtr->bitmap.bmHeight = height;
362 bmpObjPtr->bitmap.bmWidthBytes = BITMAP_GetWidthBytes( width, bpp );
363 bmpObjPtr->bitmap.bmPlanes = 1;
364 bmpObjPtr->bitmap.bmBitsPixel = bpp;
365 bmpObjPtr->bitmap.bmBits = NULL;
366 bmpObjPtr->dib = NULL;
368 pbitmap = X11DRV_AllocBitmap(bmpObjPtr);
370 pbitmap->pixmap = pixmap;
372 GDI_HEAP_UNLOCK( hbitmap );
373 return hbitmap;
375 #endif /* defined(HAVE_LIBXXPM) */
377 /***********************************************************************
378 * OBM_CreateBitmaps
380 * Create the 2 bitmaps from XPM data.
382 * The Xlib critical section must be entered before calling this function.
384 static BOOL OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
386 #ifdef HAVE_LIBXXPM
387 Pixmap pixmap, pixmask;
388 XpmAttributes *attrs;
389 int err;
391 attrs = (XpmAttributes *)HEAP_xalloc( GetProcessHeap(), 0,
392 XpmAttributesSize() );
393 attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
394 attrs->colormap = X11DRV_PALETTE_PaletteXColormap;
395 attrs->depth = descr->color ? MONITOR_GetDepth(&MONITOR_PrimaryMonitor) : 1;
396 attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
397 attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
399 err = XpmCreatePixmapFromData( display, X11DRV_GetXRootWindow(), descr->data,
400 &pixmap, &pixmask, attrs );
402 if (err != XpmSuccess)
404 HeapFree( GetProcessHeap(), 0, attrs );
405 return FALSE;
407 descr->hotspot.x = attrs->x_hotspot;
408 descr->hotspot.y = attrs->y_hotspot;
409 descr->bitmap = OBM_MakeBitmap( attrs->width, attrs->height,
410 attrs->depth, pixmap );
411 if (descr->need_mask)
412 descr->mask = OBM_MakeBitmap( attrs->width, attrs->height,
413 1, pixmask );
414 HeapFree( GetProcessHeap(), 0, attrs );
415 if (!descr->bitmap)
417 if (pixmap) XFreePixmap( display, pixmap );
418 if (pixmask) XFreePixmap( display, pixmask );
419 if (descr->bitmap) GDI_FreeObject( descr->bitmap );
420 if (descr->need_mask && descr->mask) GDI_FreeObject( descr->mask );
421 return FALSE;
423 else return TRUE;
424 #else /* defined(HAVE_LIBXXPM) */
425 FIXME_(x11drv)(
426 "Xpm support not in the binary, "
427 "please install Xpm and recompile\n"
429 return FALSE;
430 #endif /* defined(HAVE_LIBXXPM) */
434 /***********************************************************************
435 * OBM_LoadBitmap
437 static HBITMAP16 OBM_LoadBitmap( WORD id )
439 OBM_BITMAP_DESCR descr;
441 if ((id < OBM_FIRST) || (id > OBM_LAST)) return 0;
442 id -= OBM_FIRST;
444 if (!OBM_InitColorSymbols()) return 0;
446 descr.data = OBM_Pixmaps_Data[id].data;
447 descr.color = OBM_Pixmaps_Data[id].color;
448 descr.need_mask = FALSE;
450 EnterCriticalSection( &X11DRV_CritSection );
451 if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
453 LeaveCriticalSection( &X11DRV_CritSection );
454 WARN_(bitmap)("Error creating OEM bitmap %d\n", OBM_FIRST+id );
455 return 0;
457 LeaveCriticalSection( &X11DRV_CritSection );
458 return descr.bitmap;
462 /***********************************************************************
463 * OBM_LoadCursorIcon
465 static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL fCursor )
467 OBM_BITMAP_DESCR descr;
468 HGLOBAL16 handle;
469 CURSORICONINFO *pInfo;
470 BITMAPOBJ *bmpXor, *bmpAnd;
471 int sizeXor, sizeAnd;
473 if (fCursor)
475 if ((id >= OCR_FIRST1) && (id <= OCR_LAST1))
476 id = OCR_BASE1 + id - OCR_FIRST1;
477 else if ((id >= OCR_FIRST2) && (id <= OCR_LAST2))
478 id = OCR_BASE2 + id - OCR_FIRST2;
479 else if ((id >= OCR_FIRST0) && (id <= OCR_LAST0))
480 id = OCR_BASE0 + id - OCR_FIRST0;
481 else if ((id >= OCR_FIRST3) && (id <= OCR_LAST3))
482 id = OCR_BASE3 + id - OCR_FIRST3;
483 else if ((id >= OCR_FIRST4) && (id <= OCR_LAST4))
484 id = OCR_BASE4 + id - OCR_FIRST4;
485 else if ((id >= OCR_FIRST5) && (id <= OCR_LAST5))
486 id = OCR_BASE5 + id - OCR_FIRST5;
487 else return 0;
488 if (OBM_Cursors[id]) return OBM_Cursors[id];
490 else
492 if ((id < OIC_FIRST) || (id > OIC_LAST)) return 0;
493 id -= OIC_FIRST;
496 if (!OBM_InitColorSymbols()) return 0;
498 descr.data = fCursor ? OBM_Cursors_Data[id] : OBM_Icons_Data[id];
499 descr.color = !fCursor;
500 descr.need_mask = TRUE;
502 EnterCriticalSection( &X11DRV_CritSection );
503 if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
505 LeaveCriticalSection( &X11DRV_CritSection );
506 WARN_(cursor)("Error creating OEM cursor/icon %d\n", id );
507 return 0;
509 LeaveCriticalSection( &X11DRV_CritSection );
511 bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( descr.bitmap, BITMAP_MAGIC );
512 bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( descr.mask, BITMAP_MAGIC );
513 sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes;
514 sizeAnd = bmpXor->bitmap.bmHeight *
515 BITMAP_GetWidthBytes( bmpXor->bitmap.bmWidth, 1 );
517 if (!(handle = GlobalAlloc16( GMEM_MOVEABLE,
518 sizeof(CURSORICONINFO) + sizeXor + sizeAnd)))
520 DeleteObject( descr.bitmap );
521 DeleteObject( descr.mask );
522 return 0;
525 pInfo = (CURSORICONINFO *)GlobalLock16( handle );
526 pInfo->ptHotSpot.x = descr.hotspot.x;
527 pInfo->ptHotSpot.y = descr.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 (descr.mask)
536 X11DRV_PHYSBITMAP *pbitmapAnd = bmpAnd->DDBitmap->physBitmap;
537 /* Invert the mask */
539 TSXSetFunction( display, BITMAP_monoGC, GXinvert );
540 TSXFillRectangle( display, pbitmapAnd->pixmap, BITMAP_monoGC, 0, 0,
541 bmpAnd->bitmap.bmWidth, bmpAnd->bitmap.bmHeight );
542 TSXSetFunction( display, BITMAP_monoGC, GXcopy );
544 /* Set the masked pixels to black */
546 if (bmpXor->bitmap.bmBitsPixel != 1)
548 X11DRV_PHYSBITMAP *pbitmapXor = bmpXor->DDBitmap->physBitmap;
549 TSXSetForeground( display, BITMAP_colorGC,
550 X11DRV_PALETTE_ToPhysical( NULL, RGB(0,0,0) ));
551 TSXSetBackground( display, BITMAP_colorGC, 0 );
552 TSXSetFunction( display, BITMAP_colorGC, GXor );
553 TSXCopyPlane(display, pbitmapAnd->pixmap, pbitmapXor->pixmap, BITMAP_colorGC,
554 0, 0, bmpXor->bitmap.bmWidth, bmpXor->bitmap.bmHeight,
555 0, 0, 1 );
556 TSXSetFunction( display, BITMAP_colorGC, GXcopy );
560 if (descr.mask) GetBitmapBits( descr.mask, sizeAnd, (char *)(pInfo + 1));
561 else memset( (char *)(pInfo + 1), 0xff, sizeAnd );
562 GetBitmapBits( descr.bitmap, sizeXor, (char *)(pInfo + 1) + sizeAnd );
564 DeleteObject( descr.bitmap );
565 DeleteObject( descr.mask );
567 if (fCursor) OBM_Cursors[id] = handle;
568 return handle;
571 /***********************************************************************
572 * X11DRV_LoadOEMResource
575 HANDLE X11DRV_LoadOEMResource(WORD resid, WORD type)
577 switch(type) {
578 case OEM_BITMAP:
579 return OBM_LoadBitmap(resid);
581 case OEM_CURSOR:
582 return OBM_LoadCursorIcon(resid, TRUE);
584 case OEM_ICON:
585 return OBM_LoadCursorIcon(resid, FALSE);
587 default:
588 ERR_(x11drv)("Unknown type\n");
590 return 0;
594 /***********************************************************************
595 * X11DRV_OBM_Init
597 * Initializes the OBM_Pixmaps_Data and OBM_Icons_Data struct
599 BOOL X11DRV_OBM_Init(void)
601 if (TWEAK_WineLook == WIN31_LOOK) {
602 OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd;
603 OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced;
604 OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom;
605 OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce;
606 OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close;
607 OBM_Pixmaps_Data[OBM_RESTORE - OBM_FIRST].data = obm_restore;
608 OBM_Pixmaps_Data[OBM_RESTORED - OBM_FIRST].data = obm_restored;
610 OBM_Icons_Data[OIC_HAND - OIC_FIRST] = oic_hand;
611 OBM_Icons_Data[OIC_QUES - OIC_FIRST] = oic_ques;
612 OBM_Icons_Data[OIC_BANG - OIC_FIRST] = oic_bang;
613 OBM_Icons_Data[OIC_NOTE - OIC_FIRST] = oic_note;
615 else {
616 OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd_95;
617 OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced_95;
618 OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom_95;
619 OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce_95;
620 OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close_95;
621 OBM_Pixmaps_Data[OBM_RESTORE - OBM_FIRST].data = obm_restore_95;
622 OBM_Pixmaps_Data[OBM_RESTORED - OBM_FIRST].data = obm_restored_95;
624 OBM_Icons_Data[OIC_HAND - OIC_FIRST] = oic_hand_95;
625 OBM_Icons_Data[OIC_QUES - OIC_FIRST] = oic_ques_95;
626 OBM_Icons_Data[OIC_BANG - OIC_FIRST] = oic_bang_95;
627 OBM_Icons_Data[OIC_NOTE - OIC_FIRST] = oic_note_95;
630 return 1;
633 #endif /* !defined(X_DISPLAY_MISSING) */