diff --git a/dlls/ddraw/ddraw/dga.c b/dlls/ddraw/ddraw/dga.c index 1a985479fbe..128fa0499ca 100644 --- a/dlls/ddraw/ddraw/dga.c +++ b/dlls/ddraw/ddraw/dga.c @@ -35,7 +35,6 @@ #include "debugtools.h" #include "message.h" #include "options.h" -#include "monitor.h" #define RESTORE_SIGNALS @@ -550,8 +549,8 @@ static HRESULT WINAPI DGA_IDirectDraw2Impl_EnumDisplayModes( } } - ddsfd.dwWidth = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); - ddsfd.dwHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); + ddsfd.dwWidth = GetSystemMetrics(SM_CXSCREEN); + ddsfd.dwHeight = GetSystemMetrics(SM_CYSCREEN); TRACE(" enumerating (%ldx%ldx%d)\n",ddsfd.dwWidth,ddsfd.dwHeight,depths[i]); if (!modescb(&ddsfd,context)) return DD_OK; diff --git a/dlls/ddraw/ddraw/dga2.c b/dlls/ddraw/ddraw/dga2.c index 2c60201b2fd..0229dc1a4e5 100644 --- a/dlls/ddraw/ddraw/dga2.c +++ b/dlls/ddraw/ddraw/dga2.c @@ -19,7 +19,6 @@ #include "debugtools.h" #include "message.h" #include "options.h" -#include "monitor.h" DEFAULT_DEBUG_CHANNEL(ddraw); @@ -89,8 +88,8 @@ void _DGA2_Initialize_FrameBuffer(IDirectDrawImpl *This, int mode) { /* Get the screen dimensions as seen by Wine. * In that case, it may be better to ignore the -desktop mode and return the * real screen size => print a warning */ - This->d->height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); - This->d->width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); + This->d->height = GetSystemMetrics(SM_CYSCREEN); + This->d->width = GetSystemMetrics(SM_CXSCREEN); ddpriv->DGA.fb_addr = ddpriv->dev->data; ddpriv->DGA.fb_memsize = (ddpriv->dev->mode.imageWidth * ddpriv->dev->mode.imageHeight * diff --git a/dlls/ddraw/ddraw/main.c b/dlls/ddraw/ddraw/main.c index ec4861e434c..5d38dce7c7d 100644 --- a/dlls/ddraw/ddraw/main.c +++ b/dlls/ddraw/ddraw/main.c @@ -24,7 +24,6 @@ #include "debugtools.h" #include "message.h" #include "options.h" -#include "monitor.h" DEFAULT_DEBUG_CHANNEL(ddraw); @@ -352,8 +351,8 @@ HRESULT WINAPI IDirectDraw2Impl_EnumDisplayModes( } } - ddsfd.dwWidth = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); - ddsfd.dwHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); + ddsfd.dwWidth = GetSystemMetrics(SM_CXSCREEN); + ddsfd.dwHeight = GetSystemMetrics(SM_CYSCREEN); TRACE(" enumerating (%ldx%ldx%d)\n",ddsfd.dwWidth,ddsfd.dwHeight,depths[i]); if (!modescb(&ddsfd,context)) return DD_OK; diff --git a/dlls/ddraw/ddraw/x11.c b/dlls/ddraw/ddraw/x11.c index 41f525b1b35..e01126a96d1 100644 --- a/dlls/ddraw/ddraw/x11.c +++ b/dlls/ddraw/ddraw/x11.c @@ -23,7 +23,6 @@ #include "debugtools.h" #include "message.h" #include "options.h" -#include "monitor.h" DEFAULT_DEBUG_CHANNEL(ddraw); @@ -676,8 +675,8 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_EnumDisplayModes( ddsfd.dwFlags |= DDSD_REFRESHRATE; ddsfd.u.dwRefreshRate = 60; } - maxWidth = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); - maxHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); + maxWidth = GetSystemMetrics(SM_CXSCREEN); + maxHeight = GetSystemMetrics(SM_CYSCREEN); vi = TSXGetVisualInfo(display, VisualNoMask, &vt, &nvisuals); pf = TSXListPixmapFormats(display, &npixmap); diff --git a/dlls/ddraw/dga.c b/dlls/ddraw/dga.c index d5fbae8fc8e..511d66aee14 100644 --- a/dlls/ddraw/dga.c +++ b/dlls/ddraw/dga.c @@ -37,7 +37,6 @@ #include "spy.h" #include "message.h" #include "options.h" -#include "monitor.h" #include "dga_private.h" @@ -147,8 +146,8 @@ DGA_Create( LPDIRECTDRAW *lplpDD ) { * In that case, it may be better to ignore the -desktop mode and * return the real screen size => print a warning */ - ddraw->d->height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); - ddraw->d->width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); + ddraw->d->height = GetSystemMetrics(SM_CYSCREEN); + ddraw->d->width = GetSystemMetrics(SM_CXSCREEN); if ((ddraw->d->height != height) || (ddraw->d->width != width)) WARN("You seem to be running in -desktop mode. This may prove dangerous in DGA mode...\n"); dgpriv->fb_addr = addr; diff --git a/dlls/ddraw/dga2.c b/dlls/ddraw/dga2.c index 496440257e8..f72a4ca71c2 100644 --- a/dlls/ddraw/dga2.c +++ b/dlls/ddraw/dga2.c @@ -26,7 +26,6 @@ #include "spy.h" #include "message.h" #include "options.h" -#include "monitor.h" #include "dga2_private.h" @@ -140,9 +139,9 @@ DGA2_Create( LPDIRECTDRAW *lplpDD ) { #undef XX DPRINTF("\n"); } - if ((MONITOR_GetHeight(&MONITOR_PrimaryMonitor) == modes[i].viewportHeight) && - (MONITOR_GetWidth(&MONITOR_PrimaryMonitor) == modes[i].viewportWidth) && - (MONITOR_GetDepth(&MONITOR_PrimaryMonitor) == modes[i].depth) + if ((GetSystemMetrics(SM_CYSCREEN) == modes[i].viewportHeight) && + (GetSystemMetrics(SM_CXSCREEN) == modes[i].viewportWidth) && + (X11DRV_GetDepth() == modes[i].depth) ) { mode_to_use = modes[i].num; } diff --git a/dlls/ddraw/direct3d/main.c b/dlls/ddraw/direct3d/main.c index fd9ed2f0d8a..0d4b5941146 100644 --- a/dlls/ddraw/direct3d/main.c +++ b/dlls/ddraw/direct3d/main.c @@ -11,7 +11,6 @@ #include "d3d.h" #include "message.h" #include "options.h" -#include "monitor.h" #include "debugtools.h" #include "d3d_private.h" diff --git a/dlls/ddraw/direct3d/mesa.c b/dlls/ddraw/direct3d/mesa.c index f678cd1fb56..a37071da9b2 100644 --- a/dlls/ddraw/direct3d/mesa.c +++ b/dlls/ddraw/direct3d/mesa.c @@ -11,7 +11,6 @@ #include "d3d.h" #include "message.h" #include "options.h" -#include "monitor.h" #include "debugtools.h" #include "mesa_private.h" diff --git a/dlls/ddraw/helper.c b/dlls/ddraw/helper.c index a867cc684e7..6a30124e31a 100644 --- a/dlls/ddraw/helper.c +++ b/dlls/ddraw/helper.c @@ -26,7 +26,6 @@ #include "spy.h" #include "message.h" #include "options.h" -#include "monitor.h" DEFAULT_DEBUG_CHANNEL(ddraw); diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 251ffd9401a..eeb25f57d22 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -22,7 +22,6 @@ #include "d3d.h" #include "debugtools.h" #include "message.h" -#include "monitor.h" /* This for all the enumeration and creation of D3D-related objects */ #include "ddraw_private.h" diff --git a/dlls/ddraw/x11.c b/dlls/ddraw/x11.c index 4fd2039e0db..a5fb08e44b3 100644 --- a/dlls/ddraw/x11.c +++ b/dlls/ddraw/x11.c @@ -13,7 +13,6 @@ #include "winerror.h" #include "options.h" -#include "monitor.h" #include "debugtools.h" #include "ddraw.h" @@ -80,8 +79,8 @@ static HRESULT X11_Create( LPDIRECTDRAW *lplpDD ) { case 0: MESSAGE("Conversion needed from %d.\n",depth); break; } - ddraw->d->height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); - ddraw->d->width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); + ddraw->d->height = GetSystemMetrics(SM_CYSCREEN); + ddraw->d->width = GetSystemMetrics(SM_CXSCREEN); #ifdef HAVE_LIBXXSHM /* Test if XShm is available. */ if ((x11priv->xshm_active = DDRAW_XSHM_Available())) { diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 4ce5ad86c7e..0a032fd5768 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -45,7 +45,6 @@ #include "user.h" #include "message.h" #include "mouse.h" -#include "sysmetrics.h" #include "winbase.h" #include "winerror.h" #include "windef.h" diff --git a/dlls/gdi/wing.c b/dlls/gdi/wing.c index 595f09c5aa6..490c517daa5 100644 --- a/dlls/gdi/wing.c +++ b/dlls/gdi/wing.c @@ -14,11 +14,10 @@ #include "bitmap.h" #include "debugtools.h" #include "ldt.h" -#include "monitor.h" #include "palette.h" #include "windef.h" -DEFAULT_DEBUG_CHANNEL(wing) +DEFAULT_DEBUG_CHANNEL(wing); typedef enum WING_DITHER_TYPE @@ -53,24 +52,26 @@ HDC16 WINAPI WinGCreateDC16(void) */ BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *bmpi) { + HDC hdc; TRACE("(%p)\n", bmpi); if (!bmpi) return FALSE; + hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL ); bmpi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmpi->bmiHeader.biWidth = 320; bmpi->bmiHeader.biHeight = -1; - bmpi->bmiHeader.biPlanes = 1; - bmpi->bmiHeader.biBitCount = MONITOR_GetDepth(&MONITOR_PrimaryMonitor); + bmpi->bmiHeader.biPlanes = GetDeviceCaps( hdc, PLANES ); + bmpi->bmiHeader.biBitCount = GetDeviceCaps( hdc, BITSPIXEL ); bmpi->bmiHeader.biCompression = BI_RGB; bmpi->bmiHeader.biSizeImage = 0; bmpi->bmiHeader.biXPelsPerMeter = 0; bmpi->bmiHeader.biYPelsPerMeter = 0; bmpi->bmiHeader.biClrUsed = 0; bmpi->bmiHeader.biClrImportant = 0; - + DeleteDC(hdc); return TRUE; - } +} /*********************************************************************** * WinGCreateBitmap16 (WING.1003) @@ -82,7 +83,7 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi, TRACE(": create %ldx%ldx%d bitmap\n", bmpi->bmiHeader.biWidth, bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes); return CreateDIBSection16(hdc, bmpi, 0, bits, 0, 0); - } +} /*********************************************************************** * WinGGetDIBPointer (WING.1004) @@ -129,8 +130,11 @@ UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, */ HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void) { + HDC hdc = CreateCompatibleDC(0); + HPALETTE16 ret = CreateHalftonePalette16(hdc); TRACE("(void)\n"); - return CreateHalftonePalette16(GetDC16(0)); + DeleteDC(hdc); + return ret; } /*********************************************************************** diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c index 3213d693b4d..4aec983c2ad 100644 --- a/dlls/shell32/brsfolder.c +++ b/dlls/shell32/brsfolder.c @@ -5,7 +5,6 @@ #include "heap.h" #include "dlgs.h" #include "win.h" -#include "sysmetrics.h" #include "debugtools.h" #include "winreg.h" #include "authors.h" @@ -22,7 +21,7 @@ #include "shell32_main.h" #include "shellapi.h" -DEFAULT_DEBUG_CHANNEL(shell) +DEFAULT_DEBUG_CHANNEL(shell); #define IDD_TREEVIEW 99 diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 3b247b78e56..7020ebaa07e 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -15,7 +15,6 @@ #include "heap.h" #include "dlgs.h" #include "ldt.h" -#include "sysmetrics.h" #include "debugtools.h" #include "winreg.h" #include "authors.h" diff --git a/dlls/ttydrv/ttydrv_main.c b/dlls/ttydrv/ttydrv_main.c index 2ac0abedf30..de749ce6d5b 100644 --- a/dlls/ttydrv/ttydrv_main.c +++ b/dlls/ttydrv/ttydrv_main.c @@ -11,7 +11,6 @@ #include "clipboard.h" #include "gdi.h" #include "message.h" -#include "monitor.h" #include "user.h" #include "win.h" #include "debugtools.h" @@ -53,6 +52,8 @@ static USER_DRIVER user_driver = int cell_width = 8; int cell_height = 8; +int screen_rows = 50; /* default value */ +int screen_cols = 80; /* default value */ WINDOW *root_window; @@ -61,8 +62,6 @@ WINDOW *root_window; */ static void process_attach(void) { - int rows, cols; - USER_Driver = &user_driver; CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver; WND_Driver = &TTYDRV_WND_Driver; @@ -73,18 +72,9 @@ static void process_attach(void) werase(root_window); wrefresh(root_window); } - getmaxyx(root_window, rows, cols); -#else /* WINE_CURSES */ - rows = 60; /* FIXME: Hardcoded */ - cols = 80; /* FIXME: Hardcoded */ + getmaxyx(root_window, screen_rows, screen_cols); #endif /* WINE_CURSES */ - MONITOR_PrimaryMonitor.rect.left = 0; - MONITOR_PrimaryMonitor.rect.top = 0; - MONITOR_PrimaryMonitor.rect.right = cell_width * cols; - MONITOR_PrimaryMonitor.rect.bottom = cell_height * rows; - MONITOR_PrimaryMonitor.depth = 1; - TTYDRV_GDI_Initialize(); /* load display.dll */ diff --git a/dlls/x11drv/x11drv_main.c b/dlls/x11drv/x11drv_main.c index 39a2a1c2f0a..12801412dd9 100644 --- a/dlls/x11drv/x11drv_main.c +++ b/dlls/x11drv/x11drv_main.c @@ -23,7 +23,6 @@ #include "clipboard.h" #include "debugtools.h" #include "gdi.h" -#include "monitor.h" #include "options.h" #include "user.h" #include "win.h" @@ -69,7 +68,9 @@ static XKeyboardState keyboard_state; Display *display; Screen *screen; Visual *visual; -int screen_depth; +unsigned int screen_width; +unsigned int screen_height; +unsigned int screen_depth; Window root_window; /*********************************************************************** @@ -176,8 +177,8 @@ static void create_desktop( const char *geometry ) #endif /* HAVE_OPENGL */ flags = TSXParseGeometry( geometry, &x, &y, &width, &height ); - MONITOR_PrimaryMonitor.rect.right = width; - MONITOR_PrimaryMonitor.rect.bottom = height; + screen_width = width; + screen_height = height; /* Create window */ win_attr.background_pixel = BlackPixel(display, 0); @@ -292,11 +293,8 @@ static void process_attach(void) if (Options.synchronous) XSetErrorHandler( error_handler ); - MONITOR_PrimaryMonitor.rect.left = 0; - MONITOR_PrimaryMonitor.rect.top = 0; - MONITOR_PrimaryMonitor.rect.right = WidthOfScreen( screen ); - MONITOR_PrimaryMonitor.rect.bottom = HeightOfScreen( screen ); - MONITOR_PrimaryMonitor.depth = screen_depth; + screen_width = WidthOfScreen( screen ); + screen_height = HeightOfScreen( screen ); if (Options.desktopGeometry) { diff --git a/graphics/painting.c b/graphics/painting.c index 3cfe190763d..00f45d8b1ae 100644 --- a/graphics/painting.c +++ b/graphics/painting.c @@ -10,7 +10,6 @@ #include "dc.h" #include "bitmap.h" #include "heap.h" -#include "monitor.h" #include "cache.h" #include "region.h" #include "path.h" diff --git a/graphics/ttydrv/dc.c b/graphics/ttydrv/dc.c index cf50ebe12ba..7c9a8d9cfa3 100644 --- a/graphics/ttydrv/dc.c +++ b/graphics/ttydrv/dc.c @@ -9,12 +9,11 @@ #include "gdi.h" #include "bitmap.h" #include "dc.h" -#include "monitor.h" #include "ttydrv.h" #include "winbase.h" #include "debugtools.h" -DEFAULT_DEBUG_CHANNEL(ttydrv) +DEFAULT_DEBUG_CHANNEL(ttydrv); /**********************************************************************/ @@ -62,15 +61,14 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device, GDI_HEAP_UNLOCK( dc->w.hBitmap ); } else { physDev->window = TTYDRV_GetRootWindow(); - physDev->cellWidth = TTYDRV_GetCellWidth(); - physDev->cellHeight = TTYDRV_GetCellHeight(); - - dc->w.bitsPerPixel = MONITOR_GetDepth(&MONITOR_PrimaryMonitor); + physDev->cellWidth = cell_width; + physDev->cellHeight = cell_height; + dc->w.bitsPerPixel = 1; dc->w.totalExtent.left = 0; dc->w.totalExtent.top = 0; - dc->w.totalExtent.right = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); - dc->w.totalExtent.bottom = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); + dc->w.totalExtent.right = cell_width * screen_cols; + dc->w.totalExtent.bottom = cell_height * screen_rows; dc->w.hVisRgn = CreateRectRgnIndirect( &dc->w.totalExtent ); } diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c index d013535eb9c..521fff0c4d7 100644 --- a/graphics/x11drv/init.c +++ b/graphics/x11drv/init.c @@ -15,11 +15,10 @@ #include "debugtools.h" #include "ldt.h" #include "local.h" -#include "monitor.h" #include "winnt.h" #include "x11drv.h" -DEFAULT_DEBUG_CHANNEL(x11drv) +DEFAULT_DEBUG_CHANNEL(x11drv); static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODEA* initData ); @@ -189,12 +188,12 @@ BOOL X11DRV_GDI_Initialize(void) WidthOfScreen(X11DRV_GetXScreen()), WidthMMOfScreen(X11DRV_GetXScreen()) ); #endif - X11DRV_DevCaps.version = 0x300; - X11DRV_DevCaps.horzSize = WidthMMOfScreen(X11DRV_GetXScreen()) * MONITOR_GetWidth(&MONITOR_PrimaryMonitor) / WidthOfScreen(X11DRV_GetXScreen()); - X11DRV_DevCaps.vertSize = HeightMMOfScreen(X11DRV_GetXScreen()) * MONITOR_GetHeight(&MONITOR_PrimaryMonitor) / HeightOfScreen(X11DRV_GetXScreen()); - X11DRV_DevCaps.horzRes = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); - X11DRV_DevCaps.vertRes = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); - X11DRV_DevCaps.bitsPixel = X11DRV_GetDepth(); + X11DRV_DevCaps.version = 0x300; + X11DRV_DevCaps.horzSize = WidthMMOfScreen(screen) * screen_width / WidthOfScreen(screen); + X11DRV_DevCaps.vertSize = HeightMMOfScreen(screen) * screen_height / HeightOfScreen(screen); + X11DRV_DevCaps.horzRes = screen_width; + X11DRV_DevCaps.vertRes = screen_height; + X11DRV_DevCaps.bitsPixel = screen_depth; /* Resolution will be adjusted during the font init */ @@ -261,12 +260,12 @@ static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, { physDev->drawable = X11DRV_GetXRootWindow(); physDev->gc = TSXCreateGC( display, physDev->drawable, 0, NULL ); - dc->w.bitsPerPixel = X11DRV_GetDepth(); + dc->w.bitsPerPixel = screen_depth; dc->w.totalExtent.left = 0; dc->w.totalExtent.top = 0; - dc->w.totalExtent.right = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); - dc->w.totalExtent.bottom = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); + dc->w.totalExtent.right = screen_width; + dc->w.totalExtent.bottom = screen_height; dc->w.hVisRgn = CreateRectRgnIndirect( &dc->w.totalExtent ); } diff --git a/include/monitor.h b/include/monitor.h deleted file mode 100644 index e7c95c5e6cb..00000000000 --- a/include/monitor.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Monitor definitions - * - */ - -#ifndef __WINE_MONITOR_H -#define __WINE_MONITOR_H - -#include "windef.h" - -typedef struct tagMONITOR -{ - RECT rect; - int depth; -} MONITOR; - -extern MONITOR MONITOR_PrimaryMonitor; - -static int inline MONITOR_GetWidth(MONITOR *pMonitor) -{ - return pMonitor->rect.right - pMonitor->rect.left; -} - -static int inline MONITOR_GetHeight(MONITOR *pMonitor) -{ - return pMonitor->rect.bottom - pMonitor->rect.top; -} - -static int inline MONITOR_GetDepth(MONITOR *pMonitor) -{ - return pMonitor->depth; -} - -#endif /* __WINE_MONITOR_H */ diff --git a/include/sysmetrics.h b/include/sysmetrics.h index fa15d819782..ad922d4b606 100644 --- a/include/sysmetrics.h +++ b/include/sysmetrics.h @@ -10,4 +10,8 @@ extern void SYSMETRICS_Init(void); /* sysmetrics.c */ extern void SYSCOLOR_Init(void); /* syscolor.c */ +/* Wine extensions */ +#define SM_WINE_BPP (SM_CMETRICS+1) /* screen bpp */ +#define SM_WINE_CMETRICS SM_WINE_BPP + #endif /* __WINE_SYSMETRICS_H */ diff --git a/include/ttydrv.h b/include/ttydrv.h index 58412b47a71..c993cb2d51c 100644 --- a/include/ttydrv.h +++ b/include/ttydrv.h @@ -123,9 +123,8 @@ extern BOOL TTYDRV_PALETTE_IsDark(int pixel); extern int cell_width; extern int cell_height; -static inline int TTYDRV_GetCellWidth(void) { return cell_width; } -static inline int TTYDRV_GetCellHeight(void) { return cell_height; } - +extern int screen_rows; +extern int screen_cols; extern WINDOW *root_window; static inline WINDOW *TTYDRV_GetRootWindow(void) { return root_window; } diff --git a/include/x11drv.h b/include/x11drv.h index c15c356559a..501bba36529 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -323,12 +323,14 @@ extern Display *display; extern Screen *screen; extern Visual *visual; extern Window root_window; -extern int screen_depth; +extern unsigned int screen_width; +extern unsigned int screen_height; +extern unsigned int screen_depth; static inline Screen *X11DRV_GetXScreen(void) { return screen; } static inline Visual *X11DRV_GetVisual(void) { return visual; } static inline Window X11DRV_GetXRootWindow(void) { return root_window; } -static inline int X11DRV_GetDepth(void) { return screen_depth; } +static inline unsigned int X11DRV_GetDepth(void) { return screen_depth; } extern BOOL X11DRV_GetScreenSaveActive(void); extern void X11DRV_SetScreenSaveActive(BOOL bActivate); diff --git a/misc/main.c b/misc/main.c index 68ec23a7c74..92de99f9ba6 100644 --- a/misc/main.c +++ b/misc/main.c @@ -28,7 +28,6 @@ #include "version.h" #include "winnls.h" #include "console.h" -#include "monitor.h" #include "gdi.h" #include "user.h" #include "windef.h" diff --git a/windows/multimon.c b/windows/multimon.c index 0d0fef80282..52c574d217b 100644 --- a/windows/multimon.c +++ b/windows/multimon.c @@ -4,7 +4,6 @@ * Copyright 1998 Turchanov Sergey */ -#include "monitor.h" #include "windef.h" #include "wingdi.h" #include "winbase.h" @@ -14,8 +13,6 @@ #define xPRIMARY_MONITOR ((HMONITOR)0x12340042) -MONITOR MONITOR_PrimaryMonitor; - /*********************************************************************** * MonitorFromPoint */ @@ -80,7 +77,9 @@ BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo) (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) && SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0)) { - lpMonitorInfo->rcMonitor = MONITOR_PrimaryMonitor.rect; + SetRect( &lpMonitorInfo->rcMonitor, 0, 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN) ); lpMonitorInfo->rcWork = rcWork; lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY; @@ -105,7 +104,9 @@ BOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo) (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) && SystemParametersInfoW(SPI_GETWORKAREA, 0, &rcWork, 0)) { - lpMonitorInfo->rcMonitor = MONITOR_PrimaryMonitor.rect; + SetRect( &lpMonitorInfo->rcMonitor, 0, 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN) ); lpMonitorInfo->rcWork = rcWork; lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY; @@ -127,7 +128,9 @@ BOOL WINAPI EnumDisplayMonitors( MONITORENUMPROC lpfnEnumProc, LPARAM dwData) { - RECT rcLimit = MONITOR_PrimaryMonitor.rect; + RECT rcLimit; + SetRect( &rcLimit, 0, 0, GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN) ); if (!lpfnEnumProc) return FALSE; diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c index 8180718e442..c397fc31d28 100644 --- a/windows/sysmetrics.c +++ b/windows/sysmetrics.c @@ -6,18 +6,18 @@ */ #include +#include #include "windef.h" #include "wingdi.h" #include "wine/winuser16.h" #include "winbase.h" #include "winuser.h" -#include "monitor.h" #include "options.h" #include "sysmetrics.h" #include "tweak.h" -static short sysMetrics[SM_CMETRICS+1]; +static int sysMetrics[SM_WINE_CMETRICS+1]; /*********************************************************************** * SYSMETRICS_Init @@ -38,10 +38,14 @@ static short sysMetrics[SM_CMETRICS+1]; */ void SYSMETRICS_Init(void) { + HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL ); + assert(hdc); + sysMetrics[SM_CXCURSOR] = 32; sysMetrics[SM_CYCURSOR] = 32; - sysMetrics[SM_CXSCREEN] = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); - sysMetrics[SM_CYSCREEN] = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); + sysMetrics[SM_CXSCREEN] = GetDeviceCaps( hdc, HORZRES ); + sysMetrics[SM_CYSCREEN] = GetDeviceCaps( hdc, VERTRES ); + sysMetrics[SM_WINE_BPP] = GetDeviceCaps( hdc, BITSPIXEL ); if (TWEAK_WineLook > WIN31_LOOK) sysMetrics[SM_CXVSCROLL] = PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16); @@ -168,6 +172,8 @@ void SYSMETRICS_Init(void) sysMetrics[SM_CMONITORS] = 1; sysMetrics[SM_SAMEDISPLAYFORMAT] = 1; sysMetrics[SM_CMETRICS] = SM_CMETRICS; + + DeleteDC( hdc ); } @@ -185,6 +191,6 @@ INT16 WINAPI GetSystemMetrics16( INT16 index ) */ INT WINAPI GetSystemMetrics( INT index ) { - if ((index < 0) || (index > SM_CMETRICS)) return 0; + if ((index < 0) || (index > SM_WINE_CMETRICS)) return 0; else return sysMetrics[index]; } diff --git a/windows/ttydrv/init.c b/windows/ttydrv/init.c index 747a3e62bf8..dedd8605001 100644 --- a/windows/ttydrv/init.c +++ b/windows/ttydrv/init.c @@ -5,7 +5,6 @@ */ #include "clipboard.h" -#include "monitor.h" #include "user.h" #include "win.h" #include "ttydrv.h" diff --git a/windows/user.c b/windows/user.c index 4b363ca909d..4cfa2e17cd5 100644 --- a/windows/user.c +++ b/windows/user.c @@ -24,19 +24,19 @@ #include "toolhelp.h" #include "message.h" #include "module.h" -#include "monitor.h" #include "miscemu.h" #include "shell.h" +#include "sysmetrics.h" #include "callback.h" #include "local.h" #include "process.h" #include "debugtools.h" -DECLARE_DEBUG_CHANNEL(hook) -DECLARE_DEBUG_CHANNEL(local) -DECLARE_DEBUG_CHANNEL(system) -DECLARE_DEBUG_CHANNEL(win) -DECLARE_DEBUG_CHANNEL(win32) +DECLARE_DEBUG_CHANNEL(hook); +DECLARE_DEBUG_CHANNEL(local); +DECLARE_DEBUG_CHANNEL(system); +DECLARE_DEBUG_CHANNEL(win); +DECLARE_DEBUG_CHANNEL(win32); /*********************************************************************** * GetFreeSystemResources (USER.284) @@ -333,9 +333,9 @@ LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags ) MESSAGE("\tflags=");_dump_CDS_flags(flags);MESSAGE("\n"); if (devmode==NULL) FIXME_(system)(" devmode=NULL (return to default mode)\n"); - else if ( (devmode->dmBitsPerPel != MONITOR_GetDepth(&MONITOR_PrimaryMonitor)) - || (devmode->dmPelsHeight != MONITOR_GetHeight(&MONITOR_PrimaryMonitor)) - || (devmode->dmPelsWidth != MONITOR_GetWidth(&MONITOR_PrimaryMonitor)) ) + else if ( (devmode->dmBitsPerPel != GetSystemMetrics(SM_WINE_BPP)) + || (devmode->dmPelsHeight != GetSystemMetrics(SM_CYSCREEN)) + || (devmode->dmPelsWidth != GetSystemMetrics(SM_CXSCREEN)) ) { @@ -363,9 +363,9 @@ LONG WINAPI ChangeDisplaySettingsExA( MESSAGE("\tflags=");_dump_CDS_flags(flags);MESSAGE("\n"); if (devmode==NULL) FIXME_(system)(" devmode=NULL (return to default mode)\n"); - else if ( (devmode->dmBitsPerPel != MONITOR_GetDepth(&MONITOR_PrimaryMonitor)) - || (devmode->dmPelsHeight != MONITOR_GetHeight(&MONITOR_PrimaryMonitor)) - || (devmode->dmPelsWidth != MONITOR_GetWidth(&MONITOR_PrimaryMonitor)) ) + else if ( (devmode->dmBitsPerPel != GetSystemMetrics(SM_WINE_BPP)) + || (devmode->dmPelsHeight != GetSystemMetrics(SM_CYSCREEN)) + || (devmode->dmPelsWidth != GetSystemMetrics(SM_CXSCREEN)) ) { @@ -404,9 +404,9 @@ BOOL WINAPI EnumDisplaySettingsA( TRACE_(system)("(%s,%ld,%p)\n",name,n,devmode); if (n==0) { - devmode->dmBitsPerPel = MONITOR_GetDepth(&MONITOR_PrimaryMonitor); - devmode->dmPelsHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); - devmode->dmPelsWidth = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); + devmode->dmBitsPerPel = GetSystemMetrics(SM_WINE_BPP); + devmode->dmPelsHeight = GetSystemMetrics(SM_CYSCREEN); + devmode->dmPelsWidth = GetSystemMetrics(SM_CXSCREEN); return TRUE; } if ((n-1)