user32: Implement Get/SetProcessDefaultLayout.

oldstable
Alexandre Julliard 2010-09-02 18:01:01 +02:00
parent 942866f90d
commit 196ec5969d
3 changed files with 74 additions and 48 deletions

View File

@ -199,54 +199,6 @@ VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
}
/******************************************************************************
* GetProcessDefaultLayout [USER32.@]
*
* Gets the default layout for parentless windows.
* Right now, just returns 0 (left-to-right).
*
* RETURNS
* Success: Nonzero
* Failure: Zero
*
* BUGS
* No RTL
*/
BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
{
if ( !pdwDefaultLayout ) {
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
*pdwDefaultLayout = 0;
return TRUE;
}
/******************************************************************************
* SetProcessDefaultLayout [USER32.@]
*
* Sets the default layout for parentless windows.
* Right now, only accepts 0 (left-to-right).
*
* RETURNS
* Success: Nonzero
* Failure: Zero
*
* BUGS
* No RTL
*/
BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
{
if ( dwDefaultLayout == 0 )
return TRUE;
FIXME( "( %08x ): No BiDi\n", dwDefaultLayout );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
}
/***********************************************************************
* SetWindowStationUser (USER32.@)
*/

View File

@ -53,6 +53,8 @@ static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
static int (WINAPI *pGetWindowRgnBox)(HWND,LPRECT);
static BOOL (WINAPI *pGetGUIThreadInfo)(DWORD, GUITHREADINFO*);
static BOOL (WINAPI *pGetProcessDefaultLayout)( DWORD *layout );
static BOOL (WINAPI *pSetProcessDefaultLayout)( DWORD layout );
static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
static DWORD (WINAPI *pGetLayout)(HDC hdc);
@ -4853,6 +4855,43 @@ static void test_CreateWindow(void)
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( hwnd, 0 );
DestroyWindow( hwnd );
if (pGetProcessDefaultLayout && pSetProcessDefaultLayout)
{
DWORD layout;
SetLastError( 0xdeadbeef );
ok( !pGetProcessDefaultLayout( NULL ), "GetProcessDefaultLayout succeeded\n" );
ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
SetLastError( 0xdeadbeef );
ok( pGetProcessDefaultLayout( &layout ),
"GetProcessDefaultLayout failed err %u\n", GetLastError ());
ok( layout == 0, "GetProcessDefaultLayout wrong layout %x\n", layout );
SetLastError( 0xdeadbeef );
ok( pSetProcessDefaultLayout( 7 ),
"SetProcessDefaultLayout failed err %u\n", GetLastError ());
ok( pGetProcessDefaultLayout( &layout ),
"GetProcessDefaultLayout failed err %u\n", GetLastError ());
ok( layout == 7, "GetProcessDefaultLayout wrong layout %x\n", layout );
SetLastError( 0xdeadbeef );
ok( pSetProcessDefaultLayout( LAYOUT_RTL ),
"SetProcessDefaultLayout failed err %u\n", GetLastError ());
ok( pGetProcessDefaultLayout( &layout ),
"GetProcessDefaultLayout failed err %u\n", GetLastError ());
ok( layout == LAYOUT_RTL, "GetProcessDefaultLayout wrong layout %x\n", layout );
hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
0, 0, 100, 100, 0, 0, 0, NULL);
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( hwnd, WS_EX_APPWINDOW | WS_EX_LAYOUTRTL );
DestroyWindow( hwnd );
hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
0, 0, 100, 100, parent, 0, 0, NULL);
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( hwnd, WS_EX_APPWINDOW );
DestroyWindow( hwnd );
pSetProcessDefaultLayout( 0 );
}
else win_skip( "SetProcessDefaultLayout not supported\n" );
}
else win_skip( "SetLayout not supported\n" );
}
@ -6086,6 +6125,8 @@ START_TEST(win)
pMonitorFromPoint = (void *)GetProcAddress( user32, "MonitorFromPoint" );
pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
pGetGUIThreadInfo = (void *)GetProcAddress( user32, "GetGUIThreadInfo" );
pGetProcessDefaultLayout = (void *)GetProcAddress( user32, "GetProcessDefaultLayout" );
pSetProcessDefaultLayout = (void *)GetProcAddress( user32, "SetProcessDefaultLayout" );
pGetLayout = (void *)GetProcAddress( gdi32, "GetLayout" );
pSetLayout = (void *)GetProcAddress( gdi32, "SetLayout" );

View File

@ -40,6 +40,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
#define NB_USER_HANDLES ((LAST_USER_HANDLE - FIRST_USER_HANDLE + 1) >> 1)
#define USER_HANDLE_TO_INDEX(hwnd) ((LOWORD(hwnd) - FIRST_USER_HANDLE) >> 1)
static DWORD process_layout;
/**********************************************************************/
/* helper for Get/SetWindowLong */
@ -1199,6 +1201,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
if (className != (LPCWSTR)DESKTOP_CLASS_ATOM &&
(IS_INTRESOURCE(className) || strcmpiW( className, messageW )))
parent = GetDesktopWindow();
if (process_layout & LAYOUT_RTL) cs->dwExStyle |= WS_EX_LAYOUTRTL;
}
WIN_FixCoordinates(cs, &sw); /* fix default coordinates */
@ -3484,6 +3487,36 @@ BOOL WINAPI UpdateLayeredWindow( HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psi
return UpdateLayeredWindowIndirect( hwnd, &info );
}
/******************************************************************************
* GetProcessDefaultLayout [USER32.@]
*
* Gets the default layout for parentless windows.
*/
BOOL WINAPI GetProcessDefaultLayout( DWORD *layout )
{
if (!layout)
{
SetLastError( ERROR_NOACCESS );
return FALSE;
}
*layout = process_layout;
return TRUE;
}
/******************************************************************************
* SetProcessDefaultLayout [USER32.@]
*
* Sets the default layout for parentless windows.
*/
BOOL WINAPI SetProcessDefaultLayout( DWORD layout )
{
process_layout = layout;
return TRUE;
}
/* 64bit versions */
#ifdef GetWindowLongPtrW