Commit 3ea8de26 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

winex11: Use our own structure for mode information.

parent 3509c891
......@@ -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_mode_count; i++)
{
if ( (screen_width == dd_modes[i].dwWidth) &&
(screen_height == dd_modes[i].dwHeight) &&
(dwBpp == dd_modes[i].dwBPP))
if ( (screen_width == dd_modes[i].width) &&
(screen_height == dd_modes[i].height) &&
(dwBpp == dd_modes[i].bpp))
return i;
}
ERR("In unknown mode, returning default\n");
......@@ -88,17 +87,17 @@ static int X11DRV_desktop_GetCurrentMode(void)
static LONG X11DRV_desktop_SetCurrentMode(int mode)
{
DWORD dwBpp = screen_bpp;
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);
/* Ignore the depth mismatch
*
* Some (older) applications require a specific bit depth, this will allow them
* to run. X11drv performs a color depth conversion if needed.
*/
}
TRACE("Resizing Wine desktop window to %dx%d\n", dd_modes[mode].dwWidth, dd_modes[mode].dwHeight);
X11DRV_resize_desktop(dd_modes[mode].dwWidth, dd_modes[mode].dwHeight);
TRACE("Resizing Wine desktop window to %dx%d\n", dd_modes[mode].width, dd_modes[mode].height);
X11DRV_resize_desktop(dd_modes[mode].width, dd_modes[mode].height);
return DISP_CHANGE_SUCCESSFUL;
}
......
......@@ -40,7 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11settings);
* This is done because the array of DDHALMODEINFO structures must be
* created for use by DirectDraw anyway.
*/
static LPDDHALMODEINFO dd_modes = NULL;
static struct x11drv_mode_info *dd_modes = NULL;
static unsigned int dd_mode_count = 0;
static unsigned int dd_max_modes = 0;
/* All Windows drivers seen so far either support 32 bit depths, or 24 bit depths, but never both. So if we have
......@@ -58,11 +58,11 @@ static const char *handler_name;
* Set the handlers for resolution changing functions
* and initialize the master list of modes
*/
LPDDHALMODEINFO X11DRV_Settings_SetHandlers(const char *name,
int (*pNewGCM)(void),
LONG (*pNewSCM)(int),
unsigned int nmodes,
int reserve_depths)
struct x11drv_mode_info *X11DRV_Settings_SetHandlers(const char *name,
int (*pNewGCM)(void),
LONG (*pNewSCM)(int),
unsigned int nmodes,
int reserve_depths)
{
handler_name = name;
pGetCurrentMode = pNewGCM;
......@@ -79,7 +79,7 @@ LPDDHALMODEINFO X11DRV_Settings_SetHandlers(const char *name,
TRACE("Destroying old display modes array\n");
HeapFree(GetProcessHeap(), 0, dd_modes);
}
dd_modes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DDHALMODEINFO) * dd_max_modes);
dd_modes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dd_modes) * dd_max_modes);
dd_mode_count = 0;
TRACE("Initialized new display modes array\n");
return dd_modes;
......@@ -88,7 +88,7 @@ LPDDHALMODEINFO X11DRV_Settings_SetHandlers(const char *name,
/* Add one mode to the master list */
void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigned int bpp, unsigned int freq)
{
LPDDHALMODEINFO info = &(dd_modes[dd_mode_count]);
struct x11drv_mode_info *info = &dd_modes[dd_mode_count];
DWORD dwBpp = screen_bpp;
if (dd_mode_count >= 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 */
......
......@@ -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;
......
......@@ -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 <default Hz>\n",
dd_modes[mode].dwWidth, dd_modes[mode].dwHeight);
TRACE("Resizing X display to %dx%d <default Hz>\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;
}
......
......@@ -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<real_xf86vm_mode_count; i++)
{
convert_modeinfo(real_xf86vm_modes[i]);
......
......@@ -29,7 +29,6 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "ddrawi.h"
void X11DRV_XF86VM_Init(void) DECLSPEC_HIDDEN;
void X11DRV_XF86VM_Cleanup(void) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment