From 3ea8de2637bd2d1bf08af74a180ef26b7e03ee0b Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 3 Jul 2012 12:59:43 +0200 Subject: [PATCH] winex11: Use our own structure for mode information. --- dlls/winex11.drv/desktop.c | 17 ++++++------ dlls/winex11.drv/settings.c | 52 ++++++++++++++++--------------------- dlls/winex11.drv/x11drv.h | 19 +++++++++----- dlls/winex11.drv/xrandr.c | 33 ++++++++++++----------- dlls/winex11.drv/xvidmode.c | 31 ++++++++++------------ dlls/winex11.drv/xvidmode.h | 1 - 6 files changed, 73 insertions(+), 80 deletions(-) diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index acba18b32b6..81a64b1089a 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -26,13 +26,12 @@ /* avoid conflict with field names in included win32 headers */ #undef Status -#include "ddrawi.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(x11drv); /* data for resolution changing */ -static LPDDHALMODEINFO dd_modes; +static struct x11drv_mode_info *dd_modes; static unsigned int dd_mode_count; static unsigned int max_width; @@ -76,9 +75,9 @@ static int X11DRV_desktop_GetCurrentMode(void) DWORD dwBpp = screen_bpp; for (i=0; i= dd_max_modes) { @@ -96,16 +96,10 @@ void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigne return; } if (bpp == 0) bpp = dwBpp; - info->dwWidth = width; - info->dwHeight = height; - info->wRefreshRate = freq; - info->lPitch = 0; - info->dwBPP = bpp; - info->wFlags = 0; - info->dwRBitMask = 0; - info->dwGBitMask = 0; - info->dwBBitMask = 0; - info->dwAlphaBitMask = 0; + info->width = width; + info->height = height; + info->refresh_rate = freq; + info->bpp = bpp; TRACE("initialized mode %d: %dx%dx%d @%d Hz (%s)\n", dd_mode_count, width, height, bpp, freq, handler_name); dd_mode_count++; @@ -125,8 +119,8 @@ void X11DRV_Settings_AddDepthModes(void) { for (i=0; i < existing_modes; i++) { - X11DRV_Settings_AddOneMode(dd_modes[i].dwWidth, dd_modes[i].dwHeight, - depths[j], dd_modes[i].wRefreshRate); + X11DRV_Settings_AddOneMode(dd_modes[i].width, dd_modes[i].height, + depths[j], dd_modes[i].refresh_rate); } } } @@ -295,10 +289,10 @@ BOOL CDECL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmo } if (n < dd_mode_count) { - devmode->dmPelsWidth = dd_modes[n].dwWidth; - devmode->dmPelsHeight = dd_modes[n].dwHeight; - devmode->dmBitsPerPel = dd_modes[n].dwBPP; - devmode->dmDisplayFrequency = dd_modes[n].wRefreshRate; + devmode->dmPelsWidth = dd_modes[n].width; + devmode->dmPelsHeight = dd_modes[n].height; + devmode->dmBitsPerPel = dd_modes[n].bpp; + devmode->dmDisplayFrequency = dd_modes[n].refresh_rate; devmode->dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFLAGS; if (devmode->dmDisplayFrequency) @@ -401,23 +395,23 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, { if (devmode->dmFields & DM_BITSPERPEL) { - if (dwBpp != dd_modes[i].dwBPP) + if (dwBpp != dd_modes[i].bpp) continue; } if (devmode->dmFields & DM_PELSWIDTH) { - if (devmode->dmPelsWidth != dd_modes[i].dwWidth) + if (devmode->dmPelsWidth != dd_modes[i].width) continue; } if (devmode->dmFields & DM_PELSHEIGHT) { - if (devmode->dmPelsHeight != dd_modes[i].dwHeight) + if (devmode->dmPelsHeight != dd_modes[i].height) continue; } - if ((devmode->dmFields & DM_DISPLAYFREQUENCY) && (dd_modes[i].wRefreshRate != 0) && + if ((devmode->dmFields & DM_DISPLAYFREQUENCY) && (dd_modes[i].refresh_rate != 0) && devmode->dmDisplayFrequency != 0) { - if (devmode->dmDisplayFrequency != dd_modes[i].wRefreshRate) + if (devmode->dmDisplayFrequency != dd_modes[i].refresh_rate) continue; } /* we have a valid mode */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a4a4f0de72f..0bfbc6fbfc6 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -56,7 +56,6 @@ typedef int Status; #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "ddrawi.h" #include "wine/gdi_driver.h" #include "wine/list.h" @@ -643,17 +642,25 @@ extern int X11DRV_check_error(void) DECLSPEC_HIDDEN; extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect ) DECLSPEC_HIDDEN; extern void xinerama_init( unsigned int width, unsigned int height ) DECLSPEC_HIDDEN; +struct x11drv_mode_info +{ + unsigned int width; + unsigned int height; + unsigned int bpp; + unsigned int refresh_rate; +}; + extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) DECLSPEC_HIDDEN; extern void X11DRV_resize_desktop(unsigned int width, unsigned int height) DECLSPEC_HIDDEN; extern void X11DRV_Settings_AddDepthModes(void) DECLSPEC_HIDDEN; extern void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigned int bpp, unsigned int freq) DECLSPEC_HIDDEN; unsigned int X11DRV_Settings_GetModeCount(void) DECLSPEC_HIDDEN; void X11DRV_Settings_Init(void) DECLSPEC_HIDDEN; -LPDDHALMODEINFO X11DRV_Settings_SetHandlers(const char *name, - int (*pNewGCM)(void), - LONG (*pNewSCM)(int), - unsigned int nmodes, - int reserve_depths) DECLSPEC_HIDDEN; +struct x11drv_mode_info *X11DRV_Settings_SetHandlers(const char *name, + int (*pNewGCM)(void), + LONG (*pNewSCM)(int), + unsigned int nmodes, + int reserve_depths) DECLSPEC_HIDDEN; /* XIM support */ extern BOOL X11DRV_InitXIM( const char *input_style ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 0aea4631ca3..f8134fbf255 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -34,7 +34,6 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" -#include "ddrawi.h" #include "wine/library.h" #include "wine/debug.h" @@ -59,7 +58,7 @@ extern int usexrandr; static int xrandr_event, xrandr_error, xrandr_major, xrandr_minor; -static LPDDHALMODEINFO dd_modes; +static struct x11drv_mode_info *dd_modes; static unsigned int dd_mode_count; static XRRScreenSize *real_xrandr_sizes; static short **real_xrandr_rates; @@ -150,9 +149,9 @@ static int X11DRV_XRandR_GetCurrentMode(void) wine_tsx11_unlock(); for (i = 0; i < real_xrandr_modes_count; i++) { - if ( (dd_modes[i].dwWidth == real_xrandr_sizes[size].width ) && - (dd_modes[i].dwHeight == real_xrandr_sizes[size].height) && - (dd_modes[i].wRefreshRate == rate ) ) + if ( (dd_modes[i].width == real_xrandr_sizes[size].width ) && + (dd_modes[i].height == real_xrandr_sizes[size].height) && + (dd_modes[i].refresh_rate == rate ) ) { res = i; break; @@ -183,26 +182,26 @@ static LONG X11DRV_XRandR_SetCurrentMode(int mode) size = pXRRConfigCurrentConfiguration (sc, &rot); mode = mode%real_xrandr_modes_count; - TRACE("Changing Resolution to %dx%d @%d Hz\n", - dd_modes[mode].dwWidth, - dd_modes[mode].dwHeight, - dd_modes[mode].wRefreshRate); + TRACE("Changing Resolution to %dx%d @%d Hz\n", + dd_modes[mode].width, + dd_modes[mode].height, + dd_modes[mode].refresh_rate); for (i = 0; i < real_xrandr_sizes_count; i++) { - if ( (dd_modes[mode].dwWidth == real_xrandr_sizes[i].width ) && - (dd_modes[mode].dwHeight == real_xrandr_sizes[i].height) ) + if ( (dd_modes[mode].width == real_xrandr_sizes[i].width ) && + (dd_modes[mode].height == real_xrandr_sizes[i].height) ) { size = i; if (real_xrandr_rates_count[i]) { for (j=0; j < real_xrandr_rates_count[i]; j++) { - if (dd_modes[mode].wRefreshRate == real_xrandr_rates[i][j]) + if (dd_modes[mode].refresh_rate == real_xrandr_rates[i][j]) { rate = real_xrandr_rates[i][j]; - TRACE("Resizing X display to %dx%d @%d Hz\n", - dd_modes[mode].dwWidth, dd_modes[mode].dwHeight, rate); + TRACE("Resizing X display to %dx%d @%d Hz\n", + dd_modes[mode].width, dd_modes[mode].height, rate); stat = pXRRSetScreenConfigAndRate (gdi_display, sc, root, size, rot, rate, CurrentTime); break; @@ -211,8 +210,8 @@ static LONG X11DRV_XRandR_SetCurrentMode(int mode) } else { - TRACE("Resizing X display to %dx%d \n", - dd_modes[mode].dwWidth, dd_modes[mode].dwHeight); + TRACE("Resizing X display to %dx%d \n", + dd_modes[mode].width, dd_modes[mode].height); stat = pXRRSetScreenConfig (gdi_display, sc, root, size, rot, CurrentTime); } break; @@ -222,7 +221,7 @@ static LONG X11DRV_XRandR_SetCurrentMode(int mode) wine_tsx11_unlock(); if (stat == RRSetConfigSuccess) { - X11DRV_resize_desktop( dd_modes[mode].dwWidth, dd_modes[mode].dwHeight ); + X11DRV_resize_desktop( dd_modes[mode].width, dd_modes[mode].height ); return DISP_CHANGE_SUCCESSFUL; } diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c index e279b70cd6c..f452da26cb5 100644 --- a/dlls/winex11.drv/xvidmode.c +++ b/dlls/winex11.drv/xvidmode.c @@ -55,7 +55,7 @@ static int xf86vm_gammaramp_size; static BOOL xf86vm_use_gammaramp; #endif /* X_XF86VidModeSetGammaRamp */ -static LPDDHALMODEINFO dd_modes; +static struct x11drv_mode_info *dd_modes; static unsigned int dd_mode_count; static XF86VidModeModeInfo** real_xf86vm_modes; static unsigned int real_xf86vm_mode_count; @@ -90,23 +90,18 @@ static void convert_modeinfo( const XF86VidModeModeInfo *mode) X11DRV_Settings_AddOneMode(mode->hdisplay, mode->vdisplay, 0, rate); } -static void convert_modeline(int dotclock, const XF86VidModeModeLine *mode, LPDDHALMODEINFO info, unsigned int bpp) +static void convert_modeline(int dotclock, const XF86VidModeModeLine *mode, + struct x11drv_mode_info *info, unsigned int bpp) { - info->dwWidth = mode->hdisplay; - info->dwHeight = mode->vdisplay; + info->width = mode->hdisplay; + info->height = mode->vdisplay; if (mode->htotal!=0 && mode->vtotal!=0) - info->wRefreshRate = dotclock * 1000 / (mode->htotal * mode->vtotal); + info->refresh_rate = dotclock * 1000 / (mode->htotal * mode->vtotal); else - info->wRefreshRate = 0; + info->refresh_rate = 0; TRACE(" width=%d, height=%d, refresh=%d\n", - info->dwWidth, info->dwHeight, info->wRefreshRate); - info->lPitch = 0; - info->dwBPP = bpp; - info->wFlags = 0; - info->dwRBitMask = 0; - info->dwGBitMask = 0; - info->dwBBitMask = 0; - info->dwAlphaBitMask = 0; + info->width, info->height, info->refresh_rate); + info->bpp = bpp; } static int XVidModeErrorHandler(Display *dpy, XErrorEvent *event, void *arg) @@ -119,7 +114,7 @@ static int X11DRV_XF86VM_GetCurrentMode(void) XF86VidModeModeLine line; int dotclock; unsigned int i; - DDHALMODEINFO cmode; + struct x11drv_mode_info cmode; DWORD dwBpp = screen_bpp; TRACE("Querying XVidMode current mode\n"); @@ -140,9 +135,9 @@ static LONG X11DRV_XF86VM_SetCurrentMode(int mode) { DWORD dwBpp = screen_bpp; /* only set modes from the original color depth */ - if (dwBpp != dd_modes[mode].dwBPP) + if (dwBpp != dd_modes[mode].bpp) { - FIXME("Cannot change screen BPP from %d to %d\n", dwBpp, dd_modes[mode].dwBPP); + FIXME("Cannot change screen BPP from %d to %d\n", dwBpp, dd_modes[mode].bpp); } mode = mode % real_xf86vm_mode_count; @@ -240,7 +235,7 @@ void X11DRV_XF86VM_Init(void) X11DRV_XF86VM_SetCurrentMode, nmodes, 1); - /* convert modes to DDHALMODEINFO format */ + /* convert modes to x11drv_mode_info format */ for (i=0; i