Commit 86f9c8b1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserGetTitleBarInfo implementation from user32.

parent 4663446f
...@@ -33,28 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(nonclient); ...@@ -33,28 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(nonclient);
#define SC_ABOUTWINE (SC_SCREENSAVE+1) #define SC_ABOUTWINE (SC_SCREENSAVE+1)
/* Some useful macros */
#define HAS_DLGFRAME(style,exStyle) \
(((exStyle) & WS_EX_DLGMODALFRAME) || \
(((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME)))
#define HAS_THICKFRAME(style,exStyle) \
(((style) & WS_THICKFRAME) && \
!(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
#define HAS_THINFRAME(style) \
(((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP)))
#define HAS_BIGFRAME(style,exStyle) \
(((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \
((exStyle) & WS_EX_DLGMODALFRAME))
#define HAS_STATICOUTERFRAME(style,exStyle) \
(((exStyle) & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == \
WS_EX_STATICEDGE)
#define HAS_MENU(hwnd,style) ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && GetMenu(hwnd))
static void adjust_window_rect( RECT *rect, DWORD style, BOOL menu, DWORD exStyle, NONCLIENTMETRICSW *ncm ) static void adjust_window_rect( RECT *rect, DWORD style, BOOL menu, DWORD exStyle, NONCLIENTMETRICSW *ncm )
{ {
...@@ -164,42 +142,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectExForDpi( LPRECT rect, DWORD style ...@@ -164,42 +142,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectExForDpi( LPRECT rect, DWORD style
} }
/***********************************************************************
* NC_GetInsideRect
*
* Get the 'inside' rectangle of a window, i.e. the whole window rectangle
* but without the borders (if any).
*/
static void NC_GetInsideRect( HWND hwnd, enum coords_relative relative, RECT *rect,
DWORD style, DWORD ex_style )
{
WIN_GetRectangles( hwnd, relative, rect, NULL );
/* Remove frame from rectangle */
if (HAS_THICKFRAME( style, ex_style ))
{
InflateRect( rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) );
}
else if (HAS_DLGFRAME( style, ex_style ))
{
InflateRect( rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME));
}
else if (HAS_THINFRAME( style ))
{
InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) );
}
/* We have additional border information if the window
* is a child (but not an MDI child) */
if ((style & WS_CHILD) && !(ex_style & WS_EX_MDICHILD))
{
if (ex_style & WS_EX_CLIENTEDGE)
InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE));
if (ex_style & WS_EX_STATICEDGE)
InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
}
}
LRESULT NC_HandleNCMouseMove(HWND hwnd, WPARAM wParam, LPARAM lParam) LRESULT NC_HandleNCMouseMove(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
RECT rect; RECT rect;
...@@ -306,70 +248,3 @@ LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) ...@@ -306,70 +248,3 @@ LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
} }
return 0; return 0;
} }
/***********************************************************************
* GetTitleBarInfo (USER32.@)
* TODO: Handle STATE_SYSTEM_PRESSED
*/
BOOL WINAPI GetTitleBarInfo(HWND hwnd, PTITLEBARINFO tbi) {
DWORD dwStyle;
DWORD dwExStyle;
TRACE("(%p %p)\n", hwnd, tbi);
if(!tbi) {
SetLastError(ERROR_NOACCESS);
return FALSE;
}
if(tbi->cbSize != sizeof(TITLEBARINFO)) {
TRACE("Invalid TITLEBARINFO size: %ld\n", tbi->cbSize);
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
NC_GetInsideRect(hwnd, COORDS_SCREEN, &tbi->rcTitleBar, dwStyle, dwExStyle);
tbi->rcTitleBar.bottom = tbi->rcTitleBar.top;
if(dwExStyle & WS_EX_TOOLWINDOW)
tbi->rcTitleBar.bottom += GetSystemMetrics(SM_CYSMCAPTION);
else {
tbi->rcTitleBar.bottom += GetSystemMetrics(SM_CYCAPTION);
tbi->rcTitleBar.left += GetSystemMetrics(SM_CXSIZE);
}
ZeroMemory(tbi->rgstate, sizeof(tbi->rgstate));
/* Does the title bar always have STATE_SYSTEM_FOCUSABLE?
* Under XP it seems to
*/
tbi->rgstate[0] = STATE_SYSTEM_FOCUSABLE;
if(dwStyle & WS_CAPTION) {
tbi->rgstate[1] = STATE_SYSTEM_INVISIBLE;
if(dwStyle & WS_SYSMENU) {
if(!(dwStyle & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX))) {
tbi->rgstate[2] = STATE_SYSTEM_INVISIBLE;
tbi->rgstate[3] = STATE_SYSTEM_INVISIBLE;
}
else {
if(!(dwStyle & WS_MINIMIZEBOX))
tbi->rgstate[2] = STATE_SYSTEM_UNAVAILABLE;
if(!(dwStyle & WS_MAXIMIZEBOX))
tbi->rgstate[3] = STATE_SYSTEM_UNAVAILABLE;
}
if(!(dwExStyle & WS_EX_CONTEXTHELP))
tbi->rgstate[4] = STATE_SYSTEM_INVISIBLE;
if(GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE)
tbi->rgstate[5] = STATE_SYSTEM_UNAVAILABLE;
}
else {
tbi->rgstate[2] = STATE_SYSTEM_INVISIBLE;
tbi->rgstate[3] = STATE_SYSTEM_INVISIBLE;
tbi->rgstate[4] = STATE_SYSTEM_INVISIBLE;
tbi->rgstate[5] = STATE_SYSTEM_INVISIBLE;
}
}
else
tbi->rgstate[0] |= STATE_SYSTEM_INVISIBLE;
return TRUE;
}
...@@ -389,7 +389,7 @@ ...@@ -389,7 +389,7 @@
@ stdcall GetTaskmanWindow () @ stdcall GetTaskmanWindow ()
@ stdcall GetThreadDesktop(long) NtUserGetThreadDesktop @ stdcall GetThreadDesktop(long) NtUserGetThreadDesktop
@ stdcall GetThreadDpiAwarenessContext() @ stdcall GetThreadDpiAwarenessContext()
@ stdcall GetTitleBarInfo(long ptr) @ stdcall GetTitleBarInfo(long ptr) NtUserGetTitleBarInfo
@ stdcall GetTopWindow(long) @ stdcall GetTopWindow(long)
@ stdcall GetTouchInputInfo(long long ptr long) @ stdcall GetTouchInputInfo(long long ptr long)
@ stdcall GetUpdateRect(long ptr long) NtUserGetUpdateRect @ stdcall GetUpdateRect(long ptr long) NtUserGetUpdateRect
......
...@@ -2514,3 +2514,76 @@ LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) ...@@ -2514,3 +2514,76 @@ LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
return default_window_proc( hwnd, msg, wparam, lparam, FALSE ); return default_window_proc( hwnd, msg, wparam, lparam, FALSE );
} }
/***********************************************************************
* NtUserGetTitleBarInfo (win32u.@)
*/
BOOL WINAPI NtUserGetTitleBarInfo( HWND hwnd, TITLEBARINFO *info )
{
DWORD style, ex_style;
TRACE( "(%p %p)\n", hwnd, info );
if (!info)
{
SetLastError( ERROR_NOACCESS );
return FALSE;
}
if (info->cbSize != sizeof(TITLEBARINFO))
{
TRACE( "Invalid TITLEBARINFO size: %d\n", info->cbSize );
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
style = get_window_long( hwnd, GWL_STYLE );
ex_style = get_window_long( hwnd, GWL_EXSTYLE );
get_inside_rect( hwnd, COORDS_SCREEN, &info->rcTitleBar, style, ex_style );
info->rcTitleBar.bottom = info->rcTitleBar.top;
if (ex_style & WS_EX_TOOLWINDOW)
info->rcTitleBar.bottom += get_system_metrics( SM_CYSMCAPTION );
else
{
info->rcTitleBar.bottom += get_system_metrics( SM_CYCAPTION );
info->rcTitleBar.left += get_system_metrics( SM_CXSIZE );
}
memset( info->rgstate, 0, sizeof(info->rgstate) );
info->rgstate[0] = STATE_SYSTEM_FOCUSABLE;
if (style & WS_CAPTION)
{
info->rgstate[1] = STATE_SYSTEM_INVISIBLE;
if (style & WS_SYSMENU)
{
if (!(style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX)))
{
info->rgstate[2] = STATE_SYSTEM_INVISIBLE;
info->rgstate[3] = STATE_SYSTEM_INVISIBLE;
}
else
{
if (!(style & WS_MINIMIZEBOX))
info->rgstate[2] = STATE_SYSTEM_UNAVAILABLE;
if (!(style & WS_MAXIMIZEBOX))
info->rgstate[3] = STATE_SYSTEM_UNAVAILABLE;
}
if (!(ex_style & WS_EX_CONTEXTHELP))
info->rgstate[4] = STATE_SYSTEM_INVISIBLE;
if (get_class_long( hwnd, GCL_STYLE, FALSE ) & CS_NOCLOSE )
info->rgstate[5] = STATE_SYSTEM_UNAVAILABLE;
}
else
{
info->rgstate[2] = STATE_SYSTEM_INVISIBLE;
info->rgstate[3] = STATE_SYSTEM_INVISIBLE;
info->rgstate[4] = STATE_SYSTEM_INVISIBLE;
info->rgstate[5] = STATE_SYSTEM_INVISIBLE;
}
}
else
info->rgstate[0] |= STATE_SYSTEM_INVISIBLE;
return TRUE;
}
...@@ -147,6 +147,7 @@ static void * const syscalls[] = ...@@ -147,6 +147,7 @@ static void * const syscalls[] =
NtUserGetProp, NtUserGetProp,
NtUserGetSystemDpiForProcess, NtUserGetSystemDpiForProcess,
NtUserGetThreadDesktop, NtUserGetThreadDesktop,
NtUserGetTitleBarInfo,
NtUserGetWindowRgnEx, NtUserGetWindowRgnEx,
NtUserInitializeClientPfnArrays, NtUserInitializeClientPfnArrays,
NtUserInternalGetWindowText, NtUserInternalGetWindowText,
......
...@@ -997,7 +997,7 @@ ...@@ -997,7 +997,7 @@
@ stdcall NtUserGetSystemMenu(long long) @ stdcall NtUserGetSystemMenu(long long)
@ stdcall -syscall NtUserGetThreadDesktop(long) @ stdcall -syscall NtUserGetThreadDesktop(long)
@ stub NtUserGetThreadState @ stub NtUserGetThreadState
@ stub NtUserGetTitleBarInfo @ stdcall -syscall NtUserGetTitleBarInfo(long ptr)
@ stub NtUserGetTopLevelWindow @ stub NtUserGetTopLevelWindow
@ stub NtUserGetTouchInputInfo @ stub NtUserGetTouchInputInfo
@ stub NtUserGetTouchValidationStatus @ stub NtUserGetTouchValidationStatus
......
...@@ -134,6 +134,7 @@ ...@@ -134,6 +134,7 @@
SYSCALL_ENTRY( NtUserGetProp ) \ SYSCALL_ENTRY( NtUserGetProp ) \
SYSCALL_ENTRY( NtUserGetSystemDpiForProcess ) \ SYSCALL_ENTRY( NtUserGetSystemDpiForProcess ) \
SYSCALL_ENTRY( NtUserGetThreadDesktop ) \ SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
SYSCALL_ENTRY( NtUserGetTitleBarInfo ) \
SYSCALL_ENTRY( NtUserGetWindowRgnEx ) \ SYSCALL_ENTRY( NtUserGetWindowRgnEx ) \
SYSCALL_ENTRY( NtUserInitializeClientPfnArrays ) \ SYSCALL_ENTRY( NtUserInitializeClientPfnArrays ) \
SYSCALL_ENTRY( NtUserInternalGetWindowText ) \ SYSCALL_ENTRY( NtUserInternalGetWindowText ) \
......
...@@ -850,3 +850,11 @@ NTSTATUS WINAPI wow64_NtUserLockWindowUpdate( UINT *args ) ...@@ -850,3 +850,11 @@ NTSTATUS WINAPI wow64_NtUserLockWindowUpdate( UINT *args )
return NtUserLockWindowUpdate( hwnd ); return NtUserLockWindowUpdate( hwnd );
} }
NTSTATUS WINAPI wow64_NtUserGetTitleBarInfo( UINT *args )
{
HWND hwnd = get_handle( &args );
TITLEBARINFO *info = get_ptr( &args );
return NtUserGetTitleBarInfo( hwnd, info );
}
...@@ -609,6 +609,7 @@ DWORD WINAPI NtUserGetQueueStatus( UINT flags ); ...@@ -609,6 +609,7 @@ DWORD WINAPI NtUserGetQueueStatus( UINT flags );
ULONG WINAPI NtUserGetSystemDpiForProcess( HANDLE process ); ULONG WINAPI NtUserGetSystemDpiForProcess( HANDLE process );
HMENU WINAPI NtUserGetSystemMenu( HWND hwnd, BOOL revert ); HMENU WINAPI NtUserGetSystemMenu( HWND hwnd, BOOL revert );
HDESK WINAPI NtUserGetThreadDesktop( DWORD thread ); HDESK WINAPI NtUserGetThreadDesktop( DWORD thread );
BOOL WINAPI NtUserGetTitleBarInfo( HWND hwnd, TITLEBARINFO *info );
INT WINAPI NtUserGetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase ); INT WINAPI NtUserGetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase );
BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size ); BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size );
BOOL WINAPI NtUserGetUpdateRect( HWND hwnd, RECT *rect, BOOL erase ); BOOL WINAPI NtUserGetUpdateRect( HWND hwnd, RECT *rect, BOOL erase );
......
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