Commit 9f03d8f3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move WM_NCPAINT handling from user32.

parent 952affea
......@@ -123,7 +123,6 @@ extern void MENU_EndMenu(HWND) DECLSPEC_HIDDEN;
extern HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu ) DECLSPEC_HIDDEN;
/* nonclient area */
extern LRESULT NC_HandleNCPaint( HWND hwnd , HRGN clip) DECLSPEC_HIDDEN;
extern LRESULT NC_HandleNCActivate( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
extern void NC_HandleNCCalcSize( HWND hwnd, WPARAM wParam, RECT *winRect ) DECLSPEC_HIDDEN;
extern LRESULT NC_HandleNCHitTest( HWND hwnd, POINT pt ) DECLSPEC_HIDDEN;
......
......@@ -159,9 +159,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
{
switch(msg)
{
case WM_NCPAINT:
return NC_HandleNCPaint( hwnd, (HRGN)wParam );
case WM_NCMOUSEMOVE:
return NC_HandleNCMouseMove( hwnd, wParam, lParam );
......@@ -422,15 +419,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
case WM_QUERYENDSESSION:
return 1;
case WM_SETICON:
{
LRESULT res = NtUserMessageCall( hwnd, msg, wParam, lParam,
0, NtUserDefWindowProc, FALSE );
if( (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CAPTION) == WS_CAPTION )
NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */
return res;
}
case WM_HELP:
SendMessageW( GetParent(hwnd), msg, wParam, lParam );
break;
......@@ -590,8 +578,6 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case WM_SETTEXT:
result = NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, TRUE );
if (result && (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CAPTION) == WS_CAPTION)
NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */
break;
case WM_IME_CHAR:
......@@ -767,12 +753,6 @@ LRESULT WINAPI DefWindowProcW(
}
break;
case WM_SETTEXT:
result = NtUserMessageCall( hwnd, msg, wParam, lParam, 0, NtUserDefWindowProc, FALSE );
if (result && (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CAPTION) == WS_CAPTION)
NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */
break;
case WM_IME_CHAR:
PostMessageW( hwnd, WM_CHAR, wParam, lParam );
break;
......
......@@ -1074,29 +1074,6 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip )
}
/***********************************************************************
* NC_HandleNCPaint
*
* Handle a WM_NCPAINT message. Called from DefWindowProc().
*/
LRESULT NC_HandleNCPaint( HWND hwnd , HRGN clip)
{
HWND parent = NtUserGetAncestor( hwnd, GA_PARENT );
DWORD dwStyle = GetWindowLongW( hwnd, GWL_STYLE );
if( dwStyle & WS_VISIBLE )
{
NC_DoNCPaint( hwnd, clip );
if (parent == GetDesktopWindow())
PostMessageW( parent, WM_PARENTNOTIFY, WM_NCPAINT, (LPARAM)hwnd );
}
return 0;
}
/***********************************************************************
* NC_HandleNCActivate
*
......
......@@ -145,6 +145,8 @@ static const struct user_callbacks user_funcs =
ImmProcessKey,
ImmTranslateMessage,
NtWaitForMultipleObjects,
MENU_DrawMenuBar,
SCROLL_DrawNCScrollBar,
free_win_ptr,
MENU_GetSysMenu,
MENU_IsMenuActive,
......@@ -164,6 +166,12 @@ static NTSTATUS WINAPI User32CopyImage( const struct copy_image_params *params,
return HandleToUlong( ret );
}
static NTSTATUS WINAPI User32DrawText( const struct draw_text_params *params, ULONG size )
{
size -= FIELD_OFFSET( struct draw_text_params, str );
return DrawTextW( params->hdc, params->str, size / sizeof(WCHAR), params->rect, params->flags );
}
static NTSTATUS WINAPI User32LoadImage( const struct load_image_params *params, ULONG size )
{
HANDLE ret = LoadImageW( params->hinst, params->name, params->type,
......@@ -198,6 +206,7 @@ static const void *kernel_callback_table[NtUserCallCount] =
User32CallWindowProc,
User32CallWindowsHook,
User32CopyImage,
User32DrawText,
User32FreeCachedClipboardData,
User32LoadDriver,
User32LoadImage,
......
......@@ -966,6 +966,11 @@ BOOL WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD *pre
dc->attr->rop_mode = value;
break;
case NtGdiSetTextAlign:
prev = dc->attr->text_align;
dc->attr->text_align = value;
break;
default:
WARN( "unknown method %u\n", method );
ret = FALSE;
......
......@@ -6573,3 +6573,25 @@ BOOL WINAPI NtGdiGetCharWidthInfo( HDC hdc, struct char_width_info *info )
release_dc_ptr(dc);
return ret;
}
/***********************************************************************
* DrawTextW (win32u.so)
*/
INT WINAPI DrawTextW( HDC hdc, const WCHAR *str, INT count, RECT *rect, UINT flags )
{
struct draw_text_params *params;
ULONG ret_len, size;
void *ret_ptr;
int ret;
if (count == -1) count = wcslen( str );
size = FIELD_OFFSET( struct draw_text_params, str[count] );
if (!(params = malloc( size ))) return 0;
params->hdc = hdc;
params->rect = rect;
params->flags = flags;
if (count) memcpy( params->str, str, count * sizeof(WCHAR) );
ret = KeUserModeCallback( NtUserDrawText, params, size, &ret_ptr, &ret_len );
free( params );
return ret;
}
......@@ -824,7 +824,7 @@ static BOOL set_menu_item_info( MENUITEM *menu, const MENUITEMINFOW *info )
}
/* see GetMenuState */
static UINT get_menu_state( HMENU handle, UINT item_id, UINT flags )
UINT get_menu_state( HMENU handle, UINT item_id, UINT flags )
{
POPUPMENU *menu;
UINT state, pos;
......
......@@ -36,6 +36,8 @@ struct user_callbacks
BOOL (WINAPI *pImmProcessKey)(HWND, HKL, UINT, LPARAM, DWORD);
BOOL (WINAPI *pImmTranslateMessage)(HWND, UINT, WPARAM, LPARAM);
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
UINT (CDECL *draw_menu)( HDC hDC, LPRECT lprect, HWND hwnd );
void (CDECL *draw_nc_scrollbar)( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical );
void (CDECL *free_win_ptr)( struct tagWND *win );
HMENU (CDECL *get_sys_menu)( HWND hwnd, HMENU popup );
HWND (CDECL *is_menu_active)(void);
......
......@@ -4499,7 +4499,7 @@ static int get_system_metrics_for_dpi( int index, unsigned int dpi )
}
}
static COLORREF get_sys_color( int index )
COLORREF get_sys_color( int index )
{
COLORREF ret = 0;
......@@ -4508,7 +4508,7 @@ static COLORREF get_sys_color( int index )
return ret;
}
static HBRUSH get_55aa_brush(void)
HBRUSH get_55aa_brush(void)
{
static const WORD pattern[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
static HBRUSH brush_55aa;
......@@ -4546,7 +4546,7 @@ HBRUSH get_sys_color_brush( unsigned int index )
return system_colors[index].brush;
}
static HPEN get_sys_color_pen( unsigned int index )
HPEN get_sys_color_pen( unsigned int index )
{
if (index >= ARRAY_SIZE( system_colors )) return 0;
......
......@@ -394,6 +394,7 @@ extern BOOL draw_menu_bar( HWND hwnd ) DECLSPEC_HIDDEN;
extern HMENU get_menu( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL get_menu_info( HMENU handle, MENUINFO *info ) DECLSPEC_HIDDEN;
extern INT get_menu_item_count( HMENU handle ) DECLSPEC_HIDDEN;
extern UINT get_menu_state( HMENU handle, UINT item_id, UINT flags ) DECLSPEC_HIDDEN;
extern BOOL set_window_menu( HWND hwnd, HMENU handle ) DECLSPEC_HIDDEN;
/* message.c */
......@@ -411,12 +412,15 @@ extern LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM
/* sysparams.c */
extern BOOL enable_thunk_lock DECLSPEC_HIDDEN;
extern HBRUSH get_55aa_brush(void) DECLSPEC_HIDDEN;
extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN;
extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
extern BOOL get_monitor_info( HMONITOR handle, MONITORINFO *info ) DECLSPEC_HIDDEN;
extern UINT get_win_monitor_dpi( HWND hwnd ) DECLSPEC_HIDDEN;
extern RECT get_primary_monitor_rect( UINT dpi ) DECLSPEC_HIDDEN;
extern COLORREF get_sys_color( int index ) DECLSPEC_HIDDEN;
extern HBRUSH get_sys_color_brush( unsigned int index ) DECLSPEC_HIDDEN;
extern HPEN get_sys_color_pen( unsigned int index ) DECLSPEC_HIDDEN;
extern UINT get_system_dpi(void) DECLSPEC_HIDDEN;
extern int get_system_metrics( int index ) DECLSPEC_HIDDEN;
extern UINT get_thread_dpi(void) DECLSPEC_HIDDEN;
......
......@@ -115,6 +115,7 @@ enum
NtGdiSetDCPenColor,
NtGdiSetGraphicsMode,
NtGdiSetROP2,
NtGdiSetTextAlign,
};
/* NtGdiGetDCDword parameter, not compatible with Windows */
......
......@@ -33,6 +33,7 @@ enum
NtUserCallWinProc,
NtUserCallWindowsHook,
NtUserCopyImage,
NtUserDrawText,
NtUserFreeCachedClipboardData,
NtUserLoadDriver,
NtUserLoadImage,
......@@ -158,6 +159,16 @@ struct copy_image_params
UINT flags;
};
/* NtUserDrawText params */
struct draw_text_params
{
HDC hdc;
int count;
RECT *rect; /* FIXME: Use NtCallbackReturn instead */
UINT flags;
WCHAR str[1];
};
/* NtUserFreeCachedClipboardData params */
struct free_cached_data_params
{
......
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