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

wineandroid: Directly use win32u for user calls.

parent 6b8b9811
...@@ -312,7 +312,7 @@ static struct native_win_data *get_ioctl_native_win_data( const struct ioctl_hea ...@@ -312,7 +312,7 @@ static struct native_win_data *get_ioctl_native_win_data( const struct ioctl_hea
static int get_ioctl_win_parent( HWND parent ) static int get_ioctl_win_parent( HWND parent )
{ {
if (parent != GetDesktopWindow() && !GetAncestor( parent, GA_PARENT )) if (parent != NtUserGetDesktopWindow() && !NtUserGetAncestor( parent, GA_PARENT ))
return HandleToLong( HWND_MESSAGE ); return HandleToLong( HWND_MESSAGE );
return HandleToLong( parent ); return HandleToLong( parent );
} }
...@@ -522,7 +522,7 @@ static void CALLBACK register_native_window_callback( ULONG_PTR arg1, ULONG_PTR ...@@ -522,7 +522,7 @@ static void CALLBACK register_native_window_callback( ULONG_PTR arg1, ULONG_PTR
if (!data || data->parent == win) if (!data || data->parent == win)
{ {
pANativeWindow_release( win ); pANativeWindow_release( win );
if (data) PostMessageW( hwnd, WM_ANDROID_REFRESH, opengl, 0 ); if (data) NtUserPostMessage( hwnd, WM_ANDROID_REFRESH, opengl, 0 );
TRACE( "%p -> %p win %p (unchanged)\n", hwnd, data, win ); TRACE( "%p -> %p win %p (unchanged)\n", hwnd, data, win );
return; return;
} }
...@@ -535,7 +535,7 @@ static void CALLBACK register_native_window_callback( ULONG_PTR arg1, ULONG_PTR ...@@ -535,7 +535,7 @@ static void CALLBACK register_native_window_callback( ULONG_PTR arg1, ULONG_PTR
win->perform( win, NATIVE_WINDOW_SET_BUFFERS_FORMAT, data->buffer_format ); win->perform( win, NATIVE_WINDOW_SET_BUFFERS_FORMAT, data->buffer_format );
win->setSwapInterval( win, data->swap_interval ); win->setSwapInterval( win, data->swap_interval );
unwrap_java_call(); unwrap_java_call();
PostMessageW( hwnd, WM_ANDROID_REFRESH, opengl, 0 ); NtUserPostMessage( hwnd, WM_ANDROID_REFRESH, opengl, 0 );
TRACE( "%p -> %p win %p\n", hwnd, data, win ); TRACE( "%p -> %p win %p\n", hwnd, data, win );
} }
...@@ -1169,7 +1169,7 @@ static DWORD CALLBACK device_thread( void *arg ) ...@@ -1169,7 +1169,7 @@ static DWORD CALLBACK device_thread( void *arg )
init_java_thread( java_vm ); init_java_thread( java_vm );
create_desktop_window( GetDesktopWindow() ); create_desktop_window( NtUserGetDesktopWindow() );
RtlInitUnicodeString( &nameW, driver_nameW ); RtlInitUnicodeString( &nameW, driver_nameW );
if ((status = IoCreateDriver( &nameW, init_android_driver ))) if ((status = IoCreateDriver( &nameW, init_android_driver )))
...@@ -1559,7 +1559,7 @@ struct ANativeWindow *create_ioctl_window( HWND hwnd, BOOL opengl, float scale ) ...@@ -1559,7 +1559,7 @@ struct ANativeWindow *create_ioctl_window( HWND hwnd, BOOL opengl, float scale )
req.hdr.hwnd = HandleToLong( win->hwnd ); req.hdr.hwnd = HandleToLong( win->hwnd );
req.hdr.opengl = win->opengl; req.hdr.opengl = win->opengl;
req.parent = get_ioctl_win_parent( GetAncestor( hwnd, GA_PARENT )); req.parent = get_ioctl_win_parent( NtUserGetAncestor( hwnd, GA_PARENT ));
req.scale = scale; req.scale = scale;
android_ioctl( IOCTL_CREATE_WINDOW, &req, sizeof(req), NULL, NULL ); android_ioctl( IOCTL_CREATE_WINDOW, &req, sizeof(req), NULL, NULL );
......
...@@ -62,15 +62,19 @@ static const struct user_driver_funcs android_drv_funcs; ...@@ -62,15 +62,19 @@ static const struct user_driver_funcs android_drv_funcs;
void init_monitors( int width, int height ) void init_monitors( int width, int height )
{ {
static const WCHAR trayW[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0}; static const WCHAR trayW[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0};
UNICODE_STRING name;
RECT rect; RECT rect;
HWND hwnd = FindWindowW( trayW, NULL ); HWND hwnd;
RtlInitUnicodeString( &name, trayW );
hwnd = NtUserFindWindowEx( 0, 0, &name, NULL, 0 );
virtual_screen_rect.right = width; virtual_screen_rect.right = width;
virtual_screen_rect.bottom = height; virtual_screen_rect.bottom = height;
monitor_rc_work = virtual_screen_rect; monitor_rc_work = virtual_screen_rect;
if (!hwnd || !IsWindowVisible( hwnd )) return; if (!hwnd || !NtUserIsWindowVisible( hwnd )) return;
if (!GetWindowRect( hwnd, &rect )) return; if (!NtUserGetWindowRect( hwnd, &rect )) return;
if (rect.top) monitor_rc_work.bottom = rect.top; if (rect.top) monitor_rc_work.bottom = rect.top;
else monitor_rc_work.top = rect.bottom; else monitor_rc_work.top = rect.bottom;
TRACE( "found tray %p %s work area %s\n", hwnd, TRACE( "found tray %p %s work area %s\n", hwnd,
...@@ -170,7 +174,7 @@ static void fetch_display_metrics(void) ...@@ -170,7 +174,7 @@ static void fetch_display_metrics(void)
SERVER_START_REQ( get_window_rectangles ) SERVER_START_REQ( get_window_rectangles )
{ {
req->handle = wine_server_user_handle( GetDesktopWindow() ); req->handle = wine_server_user_handle( NtUserGetDesktopWindow() );
req->relative = COORDS_CLIENT; req->relative = COORDS_CLIENT;
if (!wine_server_call( req )) if (!wine_server_call( req ))
{ {
......
...@@ -180,7 +180,7 @@ static BOOL refresh_context( struct wgl_context *ctx ) ...@@ -180,7 +180,7 @@ static BOOL refresh_context( struct wgl_context *ctx )
{ {
TRACE( "refreshing hwnd %p context %p surface %p\n", ctx->hwnd, ctx->context, ctx->surface ); TRACE( "refreshing hwnd %p context %p surface %p\n", ctx->hwnd, ctx->context, ctx->surface );
p_eglMakeCurrent( display, ctx->surface, ctx->surface, ctx->context ); p_eglMakeCurrent( display, ctx->surface, ctx->surface, ctx->context );
RedrawWindow( ctx->hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE ); NtUserRedrawWindow( ctx->hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE );
} }
return ret; return ret;
} }
...@@ -207,17 +207,17 @@ void update_gl_drawable( HWND hwnd ) ...@@ -207,17 +207,17 @@ void update_gl_drawable( HWND hwnd )
} }
} }
release_gl_drawable( gl ); release_gl_drawable( gl );
RedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE ); NtUserRedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE );
} }
} }
static BOOL set_pixel_format( HDC hdc, int format, BOOL allow_change ) static BOOL set_pixel_format( HDC hdc, int format, BOOL allow_change )
{ {
struct gl_drawable *gl; struct gl_drawable *gl;
HWND hwnd = WindowFromDC( hdc ); HWND hwnd = NtUserWindowFromDC( hdc );
int prev = 0; int prev = 0;
if (!hwnd || hwnd == GetDesktopWindow()) if (!hwnd || hwnd == NtUserGetDesktopWindow())
{ {
WARN( "not a proper window DC %p/%p\n", hdc, hwnd ); WARN( "not a proper window DC %p/%p\n", hdc, hwnd );
return FALSE; return FALSE;
...@@ -255,7 +255,7 @@ static struct wgl_context *create_context( HDC hdc, struct wgl_context *share, c ...@@ -255,7 +255,7 @@ static struct wgl_context *create_context( HDC hdc, struct wgl_context *share, c
struct gl_drawable *gl; struct gl_drawable *gl;
struct wgl_context *ctx; struct wgl_context *ctx;
if (!(gl = get_gl_drawable( WindowFromDC( hdc ), hdc ))) return NULL; if (!(gl = get_gl_drawable( NtUserWindowFromDC( hdc ), hdc ))) return NULL;
ctx = HeapAlloc( GetProcessHeap(), 0, sizeof(*ctx) ); ctx = HeapAlloc( GetProcessHeap(), 0, sizeof(*ctx) );
...@@ -348,10 +348,10 @@ static BOOL android_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct ...@@ -348,10 +348,10 @@ static BOOL android_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct
return TRUE; return TRUE;
} }
draw_hwnd = WindowFromDC( draw_hdc ); draw_hwnd = NtUserWindowFromDC( draw_hdc );
if ((draw_gl = get_gl_drawable( draw_hwnd, draw_hdc ))) if ((draw_gl = get_gl_drawable( draw_hwnd, draw_hdc )))
{ {
read_gl = get_gl_drawable( WindowFromDC( read_hdc ), read_hdc ); read_gl = get_gl_drawable( NtUserWindowFromDC( read_hdc ), read_hdc );
draw_surface = draw_gl->surface ? draw_gl->surface : draw_gl->pbuffer; draw_surface = draw_gl->surface ? draw_gl->surface : draw_gl->pbuffer;
read_surface = read_gl->surface ? read_gl->surface : read_gl->pbuffer; read_surface = read_gl->surface ? read_gl->surface : read_gl->pbuffer;
TRACE( "%p/%p context %p surface %p/%p\n", TRACE( "%p/%p context %p surface %p/%p\n",
...@@ -500,7 +500,7 @@ static int WINAPI android_wglGetPixelFormat( HDC hdc ) ...@@ -500,7 +500,7 @@ static int WINAPI android_wglGetPixelFormat( HDC hdc )
struct gl_drawable *gl; struct gl_drawable *gl;
int ret = 0; int ret = 0;
if ((gl = get_gl_drawable( WindowFromDC( hdc ), hdc ))) if ((gl = get_gl_drawable( NtUserWindowFromDC( hdc ), hdc )))
{ {
ret = gl->format; ret = gl->format;
/* offscreen formats can't be used with traditional WGL calls */ /* offscreen formats can't be used with traditional WGL calls */
...@@ -540,7 +540,7 @@ static BOOL WINAPI android_wglMakeCurrent( HDC hdc, struct wgl_context *ctx ) ...@@ -540,7 +540,7 @@ static BOOL WINAPI android_wglMakeCurrent( HDC hdc, struct wgl_context *ctx )
return TRUE; return TRUE;
} }
hwnd = WindowFromDC( hdc ); hwnd = NtUserWindowFromDC( hdc );
if ((gl = get_gl_drawable( hwnd, hdc ))) if ((gl = get_gl_drawable( hwnd, hdc )))
{ {
EGLSurface surface = gl->surface ? gl->surface : gl->pbuffer; EGLSurface surface = gl->surface ? gl->surface : gl->pbuffer;
......
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