Commit e411d919 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserWindowFromDC implementation from user32.

parent fa77147b
......@@ -35,17 +35,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
struct dce
{
struct list entry; /* entry in global DCE list */
HDC hdc;
HWND hwnd;
HRGN clip_rgn;
DWORD flags;
LONG count; /* usage count; 0 or 1 for cache DCEs, always 1 for window DCEs,
always >= 1 for class DCEs */
};
static struct list dce_list = LIST_INIT(dce_list);
#define DCE_CACHE_SIZE 64
......@@ -1164,22 +1153,6 @@ INT WINAPI ReleaseDC( HWND hwnd, HDC hdc )
}
/**********************************************************************
* WindowFromDC (USER32.@)
*/
HWND WINAPI WindowFromDC( HDC hdc )
{
struct dce *dce;
HWND hwnd = 0;
USER_Lock();
dce = (struct dce *)GetDCHook( hdc, NULL );
if (dce) hwnd = dce->hwnd;
USER_Unlock();
return hwnd;
}
/***********************************************************************
* LockWindowUpdate (USER32.@)
*
......
......@@ -818,7 +818,7 @@
@ stdcall WinHelpA(long str long long)
@ stdcall WinHelpW(long wstr long long)
# @ stub WinOldAppHackoMatic
@ stdcall WindowFromDC(long)
@ stdcall WindowFromDC(long) NtUserWindowFromDC
@ stdcall WindowFromPoint(int64)
@ stdcall WindowFromPhysicalPoint(int64)
# @ stub YieldTask
......
......@@ -151,7 +151,6 @@ static const struct user_callbacks user_funcs =
SendNotifyMessageW,
SetWindowPos,
WaitForInputIdle,
WindowFromDC,
free_dce,
notify_ime,
register_builtin_classes,
......
......@@ -17,6 +17,7 @@ C_SRCS = \
clipping.c \
cursoricon.c \
dc.c \
dce.c \
dib.c \
dibdrv/bitblt.c \
dibdrv/dc.c \
......
/*
* Window painting functions
*
* Copyright 1993, 1994, 1995, 2001, 2004, 2005, 2008 Alexandre Julliard
* Copyright 1996, 1997, 1999 Alex Korobka
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep unix
#endif
#include "ntgdi_private.h"
#include "ntuser_private.h"
/**********************************************************************
* NtUserWindowFromDC (win32u.@)
*/
HWND WINAPI NtUserWindowFromDC( HDC hdc )
{
struct dce *dce;
HWND hwnd = 0;
user_lock();
dce = (struct dce *)GetDCHook( hdc, NULL );
if (dce) hwnd = dce->hwnd;
user_unlock();
return hwnd;
}
......@@ -38,7 +38,6 @@ struct user_callbacks
BOOL (WINAPI *pSendNotifyMessageW)( HWND, UINT, WPARAM, LPARAM );
BOOL (WINAPI *pSetWindowPos)( HWND, HWND, INT, INT, INT, INT, UINT );
DWORD (WINAPI *pWaitForInputIdle)( HANDLE, DWORD );
HWND (WINAPI *pWindowFromDC)( HDC );
void (WINAPI *free_dce)( struct dce *dce, HWND hwnd );
void (CDECL *notify_ime)( HWND hwnd, UINT param );
void (CDECL *register_builtin_classes)(void);
......@@ -196,6 +195,18 @@ typedef struct tagWINDOWPROC
#define MAX_ATOM_LEN 255
/* FIXME: make it private to dce.c */
struct dce
{
struct list entry; /* entry in global DCE list */
HDC hdc;
HWND hwnd;
HRGN clip_rgn;
DWORD flags;
LONG count; /* usage count; 0 or 1 for cache DCEs, always 1 for window DCEs,
always >= 1 for class DCEs */
};
/* Built-in class names (see _Undocumented_Windows_ p.418) */
#define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
#define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */
......
......@@ -516,7 +516,7 @@ HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE hpal, WORD bkg )
if (!bkg && hpal != get_stock_object( DEFAULT_PALETTE ))
{
HWND hwnd = user_callbacks->pWindowFromDC( hdc );
HWND hwnd = NtUserWindowFromDC( hdc );
if (hwnd)
{
/* set primary palette if it's related to current active */
......@@ -582,7 +582,7 @@ UINT realize_palette( HDC hdc )
if (realized && is_primary)
{
/* send palette change notification */
HWND hwnd = user_callbacks->pWindowFromDC( hdc );
HWND hwnd = NtUserWindowFromDC( hdc );
if (hwnd) user_callbacks->pSendMessageTimeoutW( HWND_BROADCAST, WM_PALETTECHANGED,
HandleToUlong(hwnd), 0, SMTO_ABORTIFHUNG,
2000, NULL );
......@@ -591,9 +591,6 @@ UINT realize_palette( HDC hdc )
}
typedef HWND (WINAPI *WindowFromDC_funcptr)( HDC );
typedef BOOL (WINAPI *RedrawWindow_funcptr)( HWND, const RECT *, HRGN, UINT );
/**********************************************************************
* NtGdiUpdateColors (win32u.@)
*
......@@ -607,7 +604,7 @@ BOOL WINAPI NtGdiUpdateColors( HDC hDC )
if (!size) return FALSE;
if (!user_callbacks) return TRUE;
hwnd = user_callbacks->pWindowFromDC( hDC );
hwnd = NtUserWindowFromDC( hDC );
/* Docs say that we have to remap current drawable pixel by pixel
* but it would take forever given the speed of XGet/PutPixel.
......
......@@ -158,6 +158,7 @@ static void * const syscalls[] =
NtUserSetWindowsHookEx,
NtUserUnhookWinEvent,
NtUserUnhookWindowsHookEx,
NtUserWindowFromDC,
};
static BYTE arguments[ARRAY_SIZE(syscalls)];
......
......@@ -1309,7 +1309,7 @@
@ stub NtUserWaitForMsgAndEvent
@ stub NtUserWaitForRedirectionStartComplete
@ stub NtUserWaitMessage
@ stub NtUserWindowFromDC
@ stdcall -syscall NtUserWindowFromDC(long)
@ stub NtUserWindowFromPhysicalPoint
@ stdcall NtUserWindowFromPoint(long long)
@ stub NtUserYieldTask
......
......@@ -142,6 +142,7 @@
SYSCALL_ENTRY( NtUserSetWinEventHook ) \
SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \
SYSCALL_ENTRY( NtUserUnhookWinEvent ) \
SYSCALL_ENTRY( NtUserUnhookWindowsHookEx )
SYSCALL_ENTRY( NtUserUnhookWindowsHookEx ) \
SYSCALL_ENTRY( NtUserWindowFromDC )
#endif /* __WOW64WIN_SYSCALL_H */
......@@ -206,6 +206,13 @@ NTSTATUS WINAPI wow64_NtUserGetWindowRgnEx( UINT *args )
return NtUserGetWindowRgnEx( hwnd, hrgn, unk );
}
NTSTATUS WINAPI wow64_NtUserWindowFromDC( UINT *args )
{
HDC hdc = get_handle( &args );
return HandleToUlong( NtUserWindowFromDC( hdc ));
}
NTSTATUS WINAPI wow64_NtUserBuildHwndList( UINT *args )
{
HDESK desktop = get_handle( &args );
......
......@@ -407,6 +407,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *p
const BLENDFUNCTION *blend, DWORD flags, const RECT *dirty );
WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout );
DWORD WINAPI NtUserWaitForInputIdle( HANDLE process, DWORD timeout, BOOL wow );
HWND WINAPI NtUserWindowFromDC( HDC hdc );
HWND WINAPI NtUserWindowFromPoint( LONG x, LONG y );
#endif /* _NTUSER_ */
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