diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c index 9287b5f3621..3aee5e05c9c 100644 --- a/graphics/metafiledrv/init.c +++ b/graphics/metafiledrv/init.c @@ -37,6 +37,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = NULL, /* pIntersectClipRect */ NULL, /* pIntersectVisRect */ MFDRV_LineTo, /* pLineTo */ + NULL, /* pLoadOEMResource */ MFDRV_MoveToEx, /* pMoveToEx */ NULL, /* pOffsetClipRgn */ MFDRV_OffsetViewportOrg, /* pOffsetViewportOrg */ diff --git a/graphics/psdrv/init.c b/graphics/psdrv/init.c index c4257265b0e..d09df8fcfe0 100644 --- a/graphics/psdrv/init.c +++ b/graphics/psdrv/init.c @@ -42,6 +42,7 @@ static const DC_FUNCTIONS PSDRV_Funcs = NULL, /* pIntersectClipRect */ NULL, /* pIntersectVisRect */ PSDRV_LineTo, /* pLineTo */ + NULL, /* pLoadOEMResource */ PSDRV_MoveToEx, /* pMoveToEx */ NULL, /* pOffsetClipRgn */ NULL, /* pOffsetViewportOrg (optional) */ diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c index cea6f9d2f99..50389497671 100644 --- a/graphics/win16drv/init.c +++ b/graphics/win16drv/init.c @@ -12,7 +12,6 @@ #include "gdi.h" #include "bitmap.h" #include "heap.h" -#include "color.h" #include "font.h" #include "options.h" #include "xmalloc.h" @@ -66,6 +65,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs = NULL, /* pIntersectClipRect */ NULL, /* pIntersectVisRect */ WIN16DRV_LineTo, /* pLineTo */ + NULL, /* pLoadOEMResource */ WIN16DRV_MoveToEx, /* pMoveToEx */ NULL, /* pOffsetClipRgn */ NULL, /* pOffsetViewportOrgEx */ diff --git a/graphics/win16drv/pen.c b/graphics/win16drv/pen.c index 8271f742774..0dca2f16551 100644 --- a/graphics/win16drv/pen.c +++ b/graphics/win16drv/pen.c @@ -5,7 +5,6 @@ */ #include "pen.h" -#include "color.h" #include "win16drv.h" #include "heap.h" #include "debug.h" diff --git a/graphics/x11drv/Makefile.in b/graphics/x11drv/Makefile.in index daae09fe21b..0d1a1fa5f95 100644 --- a/graphics/x11drv/Makefile.in +++ b/graphics/x11drv/Makefile.in @@ -14,6 +14,7 @@ C_SRCS = \ graphics.c \ init.c \ objects.c \ + oembitmap.c \ pen.c \ text.c \ xfont.c diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c index 4091c4f9e81..38d789c51d4 100644 --- a/graphics/x11drv/init.c +++ b/graphics/x11drv/init.c @@ -42,6 +42,7 @@ static const DC_FUNCTIONS X11DRV_Funcs = NULL, /* pIntersectClipRect */ NULL, /* pIntersectVisRect */ X11DRV_LineTo, /* pLineTo */ + X11DRV_LoadOEMResource, /* pLoadOEMResource */ X11DRV_MoveToEx, /* pMoveToEx */ NULL, /* pOffsetClipRgn */ NULL, /* pOffsetViewportOrg (optional) */ @@ -120,6 +121,8 @@ BOOL32 X11DRV_Init(void) if( !COLOR_Init() ) return FALSE; + if( !X11DRV_OBM_Init() ) return FALSE; + /* Finish up device caps */ #if 0 diff --git a/objects/oembitmap.c b/graphics/x11drv/oembitmap.c similarity index 96% rename from objects/oembitmap.c rename to graphics/x11drv/oembitmap.c index c3c45b9c855..bf6839b8c78 100644 --- a/objects/oembitmap.c +++ b/graphics/x11drv/oembitmap.c @@ -1,5 +1,5 @@ /* - * GDI OEM bitmap objects + * X11DRV OEM bitmap objects * * Copyright 1994, 1995 Alexandre Julliard * @@ -11,6 +11,7 @@ #include "ts_xutil.h" #include "ts_xpm.h" #include "gdi.h" +#include "x11drv.h" #include "bitmap.h" #include "callback.h" #include "color.h" @@ -399,7 +400,7 @@ static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr ) /*********************************************************************** * OBM_LoadBitmap */ -HBITMAP16 OBM_LoadBitmap( WORD id ) +static HBITMAP16 OBM_LoadBitmap( WORD id ) { OBM_BITMAP_DESCR descr; @@ -427,7 +428,7 @@ HBITMAP16 OBM_LoadBitmap( WORD id ) /*********************************************************************** * OBM_LoadCursorIcon */ -HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor ) +static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor ) { OBM_BITMAP_DESCR descr; HGLOBAL16 handle; @@ -533,13 +534,35 @@ HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor ) return handle; } +/*********************************************************************** + * X11DRV_LoadOEMResource + * + */ +HANDLE32 X11DRV_LoadOEMResource(WORD resid, WORD type) +{ + switch(type) { + case OEM_BITMAP: + return OBM_LoadBitmap(resid); + + case OEM_CURSOR: + return OBM_LoadCursorIcon(resid, TRUE); + + case OEM_ICON: + return OBM_LoadCursorIcon(resid, FALSE); + + default: + ERR(x11drv, "Unknown type\n"); + } + return 0; +} + /*********************************************************************** - * OBM_Init + * X11DRV_OBM_Init * * Initializes the OBM_Pixmaps_Data and OBM_Icons_Data struct */ -BOOL32 OBM_Init() +BOOL32 X11DRV_OBM_Init(void) { if (TWEAK_WineLook == WIN31_LOOK) { OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd; diff --git a/include/bitmap.h b/include/bitmap.h index e24e6210a3d..170e145b945 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -76,9 +76,4 @@ extern void DIB_SelectDIBSection( DC *dc, BITMAPOBJ *bmp ); extern void DIB_FixColorsToLoadflags(BITMAPINFO * bmi, UINT32 loadflags, BYTE pix); - /* objects/oembitmap.c */ -extern BOOL32 OBM_Init(void); -extern HBITMAP16 OBM_LoadBitmap( WORD id ); -extern HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor ); - #endif /* __WINE_BITMAP_H */ diff --git a/include/gdi.h b/include/gdi.h index e7717a5c9a3..b3b10cd0c5f 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -188,6 +188,7 @@ typedef struct tagDC_FUNCS INT32 (*pIntersectClipRect)(DC*,INT32,INT32,INT32,INT32); INT32 (*pIntersectVisRect)(DC*,INT32,INT32,INT32,INT32); BOOL32 (*pLineTo)(DC*,INT32,INT32); + HANDLE32 (*pLoadOEMResource)(WORD,WORD); BOOL32 (*pMoveToEx)(DC*,INT32,INT32,LPPOINT32); INT32 (*pOffsetClipRgn)(DC*,INT32,INT32); BOOL32 (*pOffsetViewportOrg)(DC*,INT32,INT32); @@ -233,6 +234,11 @@ typedef struct tagDC_FUNCS INT32 (*pStretchDIBits)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,const void *,const BITMAPINFO *,UINT32,DWORD); } DC_FUNCTIONS; + /* LoadOEMResource types */ +#define OEM_BITMAP 1 +#define OEM_CURSOR 2 +#define OEM_ICON 3 + /* DC hook codes */ #define DCHC_INVALIDVISRGN 0x0001 #define DCHC_DELETEDC 0x0002 diff --git a/include/x11drv.h b/include/x11drv.h index 186227c1dc8..dc9fb224666 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -137,12 +137,15 @@ extern INT32 X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP32 hbitmap, WORD fGet, UINT32 startscan, UINT32 lines, LPSTR bits, LPBITMAPINFO info, UINT32 coloruse ); +extern HANDLE32 X11DRV_LoadOEMResource( WORD id, WORD type ); + /* X11 driver internal functions */ extern BOOL32 X11DRV_BITMAP_Init(void); extern BOOL32 X11DRV_BRUSH_Init(void); extern BOOL32 X11DRV_DIB_Init(void); extern BOOL32 X11DRV_FONT_Init( struct tagDeviceCaps* ); +extern BOOL32 X11DRV_OBM_Init(void); struct tagBITMAPOBJ; extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp ); diff --git a/loader/main.c b/loader/main.c index baed1634d2f..7ec2fa7afc7 100644 --- a/loader/main.c +++ b/loader/main.c @@ -192,10 +192,7 @@ BOOL32 WINAPI MAIN_UserInit(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRes /* Initialize Wine tweaks */ if (!TWEAK_Init()) return FALSE; - /* Initialize OEM Bitmaps */ - if (!OBM_Init()) return FALSE; - - /* Global atom table initialisation */ + /* Global atom table initialisation */ if (!ATOM_Init( USER_HeapSel )) return FALSE; /* Initialize system colors and metrics*/ diff --git a/objects/Makefile.in b/objects/Makefile.in index ef6cf87e9ec..02a4311dfe9 100644 --- a/objects/Makefile.in +++ b/objects/Makefile.in @@ -19,7 +19,6 @@ C_SRCS = \ gdiobj.c \ linedda.c \ metafile.c \ - oembitmap.c \ palette.c \ pen.c \ region.c \ diff --git a/objects/bitmap.c b/objects/bitmap.c index 0f6a72336b7..d10c7c74484 100644 --- a/objects/bitmap.c +++ b/objects/bitmap.c @@ -215,14 +215,13 @@ HBITMAP32 WINAPI CreateCompatibleBitmap32( HDC32 hdc, INT32 width, INT32 height) if ((width >0x1000) || (height > 0x1000)) { FIXME(bitmap,"got bad width %d or height %d, please look for reason\n", width, height ); - return 0; + } else { + hbmpRet = CreateBitmap32( width, height, 1, dc->w.bitsPerPixel, NULL ); + if(dc->funcs->pCreateBitmap) + dc->funcs->pCreateBitmap( hbmpRet ); } - hbmpRet = CreateBitmap32( width, height, 1, dc->w.bitsPerPixel, NULL ); - - if(dc->funcs->pCreateBitmap) - dc->funcs->pCreateBitmap( hbmpRet ); - TRACE(bitmap,"\t\t%04x\n", hbmpRet); + GDI_HEAP_UNLOCK(hdc); return hbmpRet; } @@ -587,8 +586,18 @@ HBITMAP16 WINAPI LoadBitmap16( HINSTANCE16 instance, SEGPTR name ) if (!instance) /* OEM bitmap */ { + HDC32 hdc; + DC *dc; + if (HIWORD((int)name)) return 0; - return OBM_LoadBitmap( LOWORD((int)name) ); + hdc = CreateDC32A( "DISPLAY", NULL, NULL, NULL ); + dc = DC_GetDCPtr( hdc ); + if(dc->funcs->pLoadOEMResource) + hbitmap = dc->funcs->pLoadOEMResource( LOWORD((int)name), + OEM_BITMAP ); + GDI_HEAP_UNLOCK( hdc ); + DeleteDC32( hdc ); + return hbitmap; } if (!(hRsrc = FindResource16( instance, name, RT_BITMAP16 ))) return 0; @@ -625,8 +634,18 @@ HBITMAP32 BITMAP_LoadBitmap32W(HINSTANCE32 instance,LPCWSTR name, if (!(loadflags & LR_LOADFROMFILE)) { if (!instance) /* OEM bitmap */ { - if (HIWORD((int)name)) return 0; - return OBM_LoadBitmap( LOWORD((int)name) ); + HDC32 hdc; + DC *dc; + + if (HIWORD((int)name)) return 0; + hdc = CreateDC32A( "DISPLAY", NULL, NULL, NULL ); + dc = DC_GetDCPtr( hdc ); + if(dc->funcs->pLoadOEMResource) + hbitmap = dc->funcs->pLoadOEMResource( LOWORD((int)name), + OEM_BITMAP ); + GDI_HEAP_UNLOCK( hdc ); + DeleteDC32( hdc ); + return hbitmap; } if (!(hRsrc = FindResource32W( instance, name, RT_BITMAP32W ))) return 0; diff --git a/objects/cursoricon.c b/objects/cursoricon.c index 30a8870f807..79022f28ae1 100644 --- a/objects/cursoricon.c +++ b/objects/cursoricon.c @@ -37,6 +37,8 @@ #include "color.h" #include "bitmap.h" #include "cursoricon.h" +#include "dc.h" +#include "gdi.h" #include "sysmetrics.h" #include "global.h" #include "module.h" @@ -608,19 +610,29 @@ static HGLOBAL16 CURSORICON_Load16( HINSTANCE16 hInstance, SEGPTR name, INT32 width, INT32 height, INT32 colors, BOOL32 fCursor, UINT32 loadflags) { - HGLOBAL16 handle; + HGLOBAL16 handle = 0; HRSRC16 hRsrc; CURSORICONDIRENTRY dirEntry; if (!hInstance) /* OEM cursor/icon */ { + HDC32 hdc; + DC *dc; + if (HIWORD(name)) /* Check for '#xxx' name */ { char *ptr = PTR_SEG_TO_LIN( name ); if (ptr[0] != '#') return 0; if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0; } - return OBM_LoadCursorIcon( LOWORD(name), fCursor ); + hdc = CreateDC32A( "DISPLAY", NULL, NULL, NULL ); + dc = DC_GetDCPtr( hdc ); + if(dc->funcs->pLoadOEMResource) + handle = dc->funcs->pLoadOEMResource( LOWORD(name), fCursor ? + OEM_CURSOR : OEM_ICON); + GDI_HEAP_UNLOCK( hdc ); + DeleteDC32( hdc ); + return handle; } /* Find the best entry in the directory */ @@ -653,7 +665,7 @@ HGLOBAL32 CURSORICON_Load32( HINSTANCE32 hInstance, LPCWSTR name, int width, int height, int colors, BOOL32 fCursor, UINT32 loadflags ) { - HANDLE32 handle, h = 0; + HANDLE32 handle = 0, h = 0; HANDLE32 hRsrc; CURSORICONDIRENTRY dirEntry; LPBYTE bits; @@ -663,6 +675,9 @@ HGLOBAL32 CURSORICON_Load32( HINSTANCE32 hInstance, LPCWSTR name, if (!hInstance) /* OEM cursor/icon */ { WORD resid; + HDC32 hdc; + DC *dc; + if(HIWORD(name)) { LPSTR ansi = HEAP_strdupWtoA(GetProcessHeap(),0,name); @@ -678,7 +693,14 @@ HGLOBAL32 CURSORICON_Load32( HINSTANCE32 hInstance, LPCWSTR name, } } else resid = LOWORD(name); - return OBM_LoadCursorIcon(resid, fCursor); + hdc = CreateDC32A( "DISPLAY", NULL, NULL, NULL ); + dc = DC_GetDCPtr( hdc ); + if(dc->funcs->pLoadOEMResource) + handle = dc->funcs->pLoadOEMResource( resid, fCursor ? + OEM_CURSOR : OEM_ICON ); + GDI_HEAP_UNLOCK( hdc ); + DeleteDC32( hdc ); + return handle; } /* Find the best entry in the directory */