Module: wine Branch: master Commit: 5461d505d727411f8de3f7846c5d1e8ed6343247 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5461d505d727411f8de3f7846c...
Author: Stefan Dösinger stefan@codeweavers.com Date: Fri Dec 14 00:39:34 2007 +0100
winex11: Activate the depth-bpp difference.
---
dlls/gdi32/tests/bitmap.c | 6 +----- dlls/user32/tests/sysparams.c | 13 +++---------- dlls/winex11.drv/bitmap.c | 2 -- dlls/winex11.drv/desktop.c | 2 -- dlls/winex11.drv/settings.c | 11 +++++++---- dlls/winex11.drv/x11drv_main.c | 32 +++++++++++++++++++++++++++++++- dlls/winex11.drv/xrandr.c | 1 - dlls/winex11.drv/xvidmode.c | 2 -- 8 files changed, 42 insertions(+), 27 deletions(-)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index 0964f0d..eb6c09d 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -1638,11 +1638,7 @@ static void test_select_object(void) ok(hbm_old != 0, "SelectObject failed, BITSPIXEL: %d, created depth: %d\n", bpp, depths[i]); SelectObject(hdc, hbm_old); } else { - if(bpp == 24 && depths[i] == 32) { - todo_wine ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]); - } else { - ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]); - } + ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]); }
memset(&bm, 0xAA, sizeof(bm)); diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c index 9e4e6b2..b554430 100644 --- a/dlls/user32/tests/sysparams.c +++ b/dlls/user32/tests/sysparams.c @@ -2223,9 +2223,7 @@ static void test_WM_DISPLAYCHANGE(void) continue; }
- if((start_bpp != test_bpps[i] || - (test_bpps[i] == 32 && last_bpp == 24)) && - !(test_bpps[i] == 24 && start_bpp == 32)) { + if(start_bpp != test_bpps[i]) { todo_wine ok(last_bpp == test_bpps[i], "Set bpp %d, but WM_DISPLAYCHANGE reported bpp %d\n", test_bpps[i], last_bpp); } else { ok(last_bpp == test_bpps[i], "Set bpp %d, but WM_DISPLAYCHANGE reported bpp %d\n", test_bpps[i], last_bpp); @@ -2533,13 +2531,8 @@ static void test_EnumDisplaySettings(void)
hdc = GetDC(0); val = GetDeviceCaps(hdc, BITSPIXEL); - if(devmode.dmBitsPerPel == 32 && val == 24) { - todo_wine ok(devmode.dmBitsPerPel == val, "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n", - val, devmode.dmBitsPerPel); - } else { - ok(devmode.dmBitsPerPel == val, "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n", - val, devmode.dmBitsPerPel); - } + ok(devmode.dmBitsPerPel == val, "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n", + val, devmode.dmBitsPerPel);
val = GetDeviceCaps(hdc, NUMCOLORS); if(devmode.dmBitsPerPel <= 8) { diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c index b52b05d..fffcab1 100644 --- a/dlls/winex11.drv/bitmap.c +++ b/dlls/winex11.drv/bitmap.c @@ -124,8 +124,6 @@ BOOL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID bmBit /* check if bpp is compatible with screen depth */ if (!((bitmap.bmBitsPixel == 1) || (bitmap.bmBitsPixel == screen_bpp) || - (bitmap.bmBitsPixel == 24 && screen_bpp == 32) || /* FIXME: Not compatible */ - (bitmap.bmBitsPixel == 32 && screen_bpp == 24) || /* FIXME: Not compatible */ (bitmap.bmBitsPixel == 16 && screen_bpp == 15))) /* TODO: Confirm this */ { ERR("Trying to make bitmap with planes=%d, bpp=%d\n", diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 188cb1e..1e189c8 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -104,7 +104,6 @@ static int X11DRV_desktop_GetCurrentMode(void) { unsigned int i; DWORD dwBpp = screen_bpp; - if (dwBpp == 24) dwBpp = 32; for (i=0; i<dd_mode_count; i++) { if ( (screen_width == dd_modes[i].dwWidth) && @@ -119,7 +118,6 @@ static int X11DRV_desktop_GetCurrentMode(void) static LONG X11DRV_desktop_SetCurrentMode(int mode) { DWORD dwBpp = screen_bpp; - if (dwBpp == 24) dwBpp = 32; if (dwBpp != dd_modes[mode].dwBPP) { FIXME("Cannot change screen BPP from %d to %d\n", dwBpp, dd_modes[mode].dwBPP); diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c index 2db0c7f..ada827e 100644 --- a/dlls/winex11.drv/settings.c +++ b/dlls/winex11.drv/settings.c @@ -44,7 +44,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11settings); static LPDDHALMODEINFO dd_modes = NULL; static unsigned int dd_mode_count = 0; static unsigned int dd_max_modes = 0; -static const unsigned int depths[] = {8, 16, 32}; +/* All Windows drivers seen so far either support 32 bit depths, or 24 bit depths, but never both. So if we have + * a 32 bit framebuffer, report 32 bit bpps, otherwise 24 bit ones. + */ +static const unsigned int depths_24[] = {8, 16, 24}; +static const unsigned int depths_32[] = {8, 16, 32};
/* pointers to functions that actually do the hard stuff */ static int (*pGetCurrentMode)(void); @@ -92,7 +96,6 @@ void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigne ERR("Maximum modes (%d) exceeded\n", dd_max_modes); return; } - if (dwBpp == 24) dwBpp = 32; if (bpp == 0) bpp = dwBpp; info->dwWidth = width; info->dwHeight = height; @@ -115,7 +118,7 @@ void X11DRV_Settings_AddDepthModes(void) int i, j; int existing_modes = dd_mode_count; DWORD dwBpp = screen_bpp; - if (dwBpp == 24) dwBpp = 32; + const DWORD *depths = screen_bpp == 32 ? depths_32 : depths_24;
for (j=0; j<3; j++) { @@ -360,7 +363,7 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, devmode->dmPelsWidth,devmode->dmPelsHeight, devmode->dmBitsPerPel,devmode->dmDisplayFrequency, handler_name);
- dwBpp = (devmode->dmBitsPerPel == 24) ? 32 : devmode->dmBitsPerPel; + dwBpp = devmode->dmBitsPerPel; if (devmode->dmFields & DM_BITSPERPEL) def_mode &= !dwBpp; if (devmode->dmFields & DM_PELSWIDTH) def_mode &= !devmode->dmPelsWidth; if (devmode->dmFields & DM_PELSHEIGHT) def_mode &= !devmode->dmPelsHeight; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 5912a4a..11cd33a 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -492,7 +492,37 @@ static BOOL process_attach(void) XFree(desktop_vi); }
- screen_bpp = screen_depth; /* TODO */ + switch(screen_depth) { + case 8: + screen_bpp = 8; + break; + + case 15: + /* Out tests suggest that windows does not support 15 bpp color depth. + * X11 does, what should we do with these situations? + */ + FIXME("The X server is running at 15 bpp color depth\n"); + screen_bpp = 15; + break; + + case 16: + screen_bpp = 16; + break; + + case 24: + /* This is not necessarily right. X11 always has 24 bits per pixel, but it can run + * with 24 bit framebuffers and 32 bit framebuffers. It doesn't make any difference + * for windowing, but gl applications can get visuals with alpha channels. So we + * should check the framebuffer and/or opengl formats available to find out what the + * framebuffer actually does + */ + screen_bpp = 32; + break; + + default: + FIXME("Unexpected X11 depth %d bpp, what to report to app?\n", screen_depth); + screen_bpp = screen_depth; + }
XInternAtoms( display, (char **)atom_names, NB_XATOMS - FIRST_XATOM, False, X11DRV_Atoms );
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index f2a5229..ad2dc08 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -179,7 +179,6 @@ static LONG X11DRV_XRandR_SetCurrentMode(int mode) unsigned int i; int j; DWORD dwBpp = screen_bpp; - if (dwBpp == 24) dwBpp = 32;
wine_tsx11_lock(); root = RootWindow (gdi_display, DefaultScreen(gdi_display)); diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c index 6b67594..49c48b3 100644 --- a/dlls/winex11.drv/xvidmode.c +++ b/dlls/winex11.drv/xvidmode.c @@ -95,7 +95,6 @@ static int X11DRV_XF86VM_GetCurrentMode(void) unsigned int i; DDHALMODEINFO cmode; DWORD dwBpp = screen_bpp; - if (dwBpp == 24) dwBpp = 32;
TRACE("Querying XVidMode current mode\n"); wine_tsx11_lock(); @@ -114,7 +113,6 @@ static int X11DRV_XF86VM_GetCurrentMode(void) static LONG X11DRV_XF86VM_SetCurrentMode(int mode) { DWORD dwBpp = screen_bpp; - if (dwBpp == 24) dwBpp = 32; /* only set modes from the original color depth */ if (dwBpp != dd_modes[mode].dwBPP) {