user32: Set the DC layout to mirrored when the window has the WS_EX_LAYOUTRTL style.

This commit is contained in:
Alexandre Julliard 2010-09-02 15:16:39 +02:00
parent d09287619d
commit 30d2079574
2 changed files with 84 additions and 0 deletions

View File

@ -1030,6 +1030,8 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
bUpdateVisRgn = TRUE;
}
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) SetLayout( dce->hdc, LAYOUT_RTL );
dce->hwnd = hwnd;
dce->flags = (dce->flags & ~user_flags) | (flags & user_flags);

View File

@ -424,6 +424,87 @@ static void test_invisible_create(void)
DestroyWindow(hwnd_owndc);
}
static void test_dc_layout(void)
{
DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
DWORD (WINAPI *pGetLayout)(HDC hdc);
HWND hwnd_cache_rtl, hwnd_owndc_rtl, hwnd_classdc_rtl, hwnd_classdc2_rtl;
HDC hdc;
DWORD layout;
HMODULE mod = GetModuleHandleA("gdi32.dll");
pGetLayout = (void *)GetProcAddress( mod, "GetLayout" );
pSetLayout = (void *)GetProcAddress( mod, "SetLayout" );
if (!pGetLayout || !pSetLayout)
{
win_skip( "Don't have SetLayout\n" );
return;
}
hdc = GetDC( hwnd_cache );
pSetLayout( hdc, LAYOUT_RTL );
layout = pGetLayout( hdc );
ReleaseDC( hwnd_cache, hdc );
if (!layout)
{
win_skip( "SetLayout not supported\n" );
return;
}
hwnd_cache_rtl = CreateWindowExA(WS_EX_LAYOUTRTL, "cache_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL );
hwnd_owndc_rtl = CreateWindowExA(WS_EX_LAYOUTRTL, "owndc_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
0, 200, 100, 100, 0, 0, GetModuleHandleA(0), NULL );
hwnd_classdc_rtl = CreateWindowExA(WS_EX_LAYOUTRTL, "classdc_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
200, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL );
hwnd_classdc2_rtl = CreateWindowExA(WS_EX_LAYOUTRTL, "classdc_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
200, 200, 100, 100, 0, 0, GetModuleHandleA(0), NULL );
hdc = GetDC( hwnd_cache_rtl );
layout = pGetLayout( hdc );
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
pSetLayout( hdc, 0 );
ReleaseDC( hwnd_cache_rtl, hdc );
hdc = GetDC( hwnd_owndc_rtl );
layout = pGetLayout( hdc );
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
ReleaseDC( hwnd_cache_rtl, hdc );
hdc = GetDC( hwnd_cache );
layout = pGetLayout( hdc );
ok( layout == 0, "wrong layout %x\n", layout );
ReleaseDC( hwnd_cache, hdc );
hdc = GetDC( hwnd_owndc_rtl );
layout = pGetLayout( hdc );
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
pSetLayout( hdc, 0 );
ReleaseDC( hwnd_owndc_rtl, hdc );
hdc = GetDC( hwnd_owndc_rtl );
layout = pGetLayout( hdc );
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
ReleaseDC( hwnd_owndc_rtl, hdc );
hdc = GetDC( hwnd_classdc_rtl );
layout = pGetLayout( hdc );
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
pSetLayout( hdc, 0 );
ReleaseDC( hwnd_classdc_rtl, hdc );
hdc = GetDC( hwnd_classdc2_rtl );
layout = pGetLayout( hdc );
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
ReleaseDC( hwnd_classdc2_rtl, hdc );
hdc = GetDC( hwnd_classdc );
layout = pGetLayout( hdc );
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
ReleaseDC( hwnd_classdc_rtl, hdc );
DestroyWindow(hwnd_classdc2_rtl);
DestroyWindow(hwnd_classdc_rtl);
DestroyWindow(hwnd_owndc_rtl);
DestroyWindow(hwnd_cache_rtl);
}
static void test_destroyed_window(void)
{
HDC dc;
@ -480,6 +561,7 @@ START_TEST(dce)
test_dc_visrgn();
test_begin_paint();
test_invisible_create();
test_dc_layout();
DestroyWindow(hwnd_classdc2);
DestroyWindow(hwnd_classdc);