2022-05-01 11:37:01 +00:00
|
|
|
/*
|
|
|
|
* winex11.drv entry points
|
|
|
|
*
|
|
|
|
* Copyright 2022 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2022-05-03 23:38:52 +00:00
|
|
|
#include "x11drv_dll.h"
|
2022-05-01 20:47:30 +00:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2022-05-01 11:37:01 +00:00
|
|
|
|
|
|
|
HMODULE x11drv_module = 0;
|
2022-05-01 10:41:31 +00:00
|
|
|
static unixlib_handle_t x11drv_handle;
|
|
|
|
NTSTATUS (CDECL *x11drv_unix_call)( enum x11drv_funcs code, void *params );
|
2022-05-01 11:37:01 +00:00
|
|
|
|
2022-05-01 20:47:30 +00:00
|
|
|
|
2022-05-02 23:07:17 +00:00
|
|
|
typedef NTSTATUS (*callback_func)( UINT arg );
|
|
|
|
static const callback_func callback_funcs[] =
|
|
|
|
{
|
|
|
|
x11drv_dnd_drop_event,
|
|
|
|
x11drv_dnd_leave_event,
|
2022-05-03 21:10:15 +00:00
|
|
|
x11drv_ime_get_cursor_pos,
|
|
|
|
x11drv_ime_set_composition_status,
|
|
|
|
x11drv_ime_set_cursor_pos,
|
|
|
|
x11drv_ime_set_open_status,
|
|
|
|
x11drv_ime_update_association,
|
2022-05-02 23:07:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
C_ASSERT( ARRAYSIZE(callback_funcs) == client_funcs_count );
|
|
|
|
|
|
|
|
static NTSTATUS WINAPI x11drv_callback( void *arg, ULONG size )
|
|
|
|
{
|
|
|
|
struct client_callback_params *params = arg;
|
|
|
|
return callback_funcs[params->id]( params->arg );
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef NTSTATUS (WINAPI *kernel_callback)( void *params, ULONG size );
|
|
|
|
static const kernel_callback kernel_callbacks[] =
|
|
|
|
{
|
|
|
|
x11drv_callback,
|
|
|
|
x11drv_dnd_enter_event,
|
|
|
|
x11drv_dnd_position_event,
|
|
|
|
x11drv_dnd_post_drop,
|
2022-05-03 21:10:15 +00:00
|
|
|
x11drv_ime_set_composition_string,
|
|
|
|
x11drv_ime_set_result,
|
2022-05-03 22:10:36 +00:00
|
|
|
x11drv_systray_change_owner,
|
2022-05-02 23:07:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
C_ASSERT( NtUserDriverCallbackFirst + ARRAYSIZE(kernel_callbacks) == client_func_last );
|
|
|
|
|
2022-05-03 22:45:01 +00:00
|
|
|
|
2022-05-01 11:37:01 +00:00
|
|
|
BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
|
|
|
|
{
|
2022-05-02 23:07:17 +00:00
|
|
|
void **callback_table;
|
2022-05-01 10:41:31 +00:00
|
|
|
struct init_params params =
|
|
|
|
{
|
|
|
|
NtWaitForMultipleObjects,
|
|
|
|
foreign_window_proc,
|
|
|
|
};
|
2022-05-02 23:07:17 +00:00
|
|
|
|
2022-05-01 11:37:01 +00:00
|
|
|
if (reason != DLL_PROCESS_ATTACH) return TRUE;
|
|
|
|
|
|
|
|
DisableThreadLibraryCalls( instance );
|
|
|
|
x11drv_module = instance;
|
2022-05-01 10:41:31 +00:00
|
|
|
if (NtQueryVirtualMemory( GetCurrentProcess(), instance, MemoryWineUnixFuncs,
|
|
|
|
&x11drv_handle, sizeof(x11drv_handle), NULL ))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (__wine_unix_call( x11drv_handle, unix_init, ¶ms )) return FALSE;
|
2022-05-02 23:07:17 +00:00
|
|
|
|
|
|
|
callback_table = NtCurrentTeb()->Peb->KernelCallbackTable;
|
|
|
|
memcpy( callback_table + NtUserDriverCallbackFirst, kernel_callbacks, sizeof(kernel_callbacks) );
|
2022-05-01 10:41:31 +00:00
|
|
|
|
|
|
|
show_systray = params.show_systray;
|
|
|
|
x11drv_unix_call = params.unix_call;
|
2022-05-02 23:07:17 +00:00
|
|
|
return TRUE;
|
2022-05-01 11:37:01 +00:00
|
|
|
}
|
2022-05-01 22:07:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* wine_create_desktop (winex11.@)
|
|
|
|
*/
|
|
|
|
BOOL CDECL wine_create_desktop( UINT width, UINT height )
|
|
|
|
{
|
|
|
|
struct create_desktop_params params = { .width = width, .height = height };
|
2022-05-02 19:15:10 +00:00
|
|
|
return X11DRV_CALL( create_desktop, ¶ms );
|
2022-05-01 22:07:10 +00:00
|
|
|
}
|
2022-05-02 18:12:01 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* AttachEventQueueToTablet (winex11.@)
|
|
|
|
*/
|
|
|
|
int CDECL X11DRV_AttachEventQueueToTablet( HWND owner )
|
|
|
|
{
|
2022-05-02 19:15:10 +00:00
|
|
|
return X11DRV_CALL( tablet_attach_queue, owner );
|
2022-05-02 18:12:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetCurrentPacket (winex11.@)
|
|
|
|
*/
|
|
|
|
int CDECL X11DRV_GetCurrentPacket( void *packet )
|
|
|
|
{
|
2022-05-02 19:15:10 +00:00
|
|
|
return X11DRV_CALL( tablet_get_packet, packet );
|
2022-05-02 18:12:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* LoadTabletInfo (winex11.@)
|
|
|
|
*/
|
|
|
|
BOOL CDECL X11DRV_LoadTabletInfo( HWND hwnd )
|
|
|
|
{
|
2022-05-02 19:15:10 +00:00
|
|
|
return X11DRV_CALL( tablet_load_info, hwnd );
|
2022-05-02 18:12:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* WTInfoW (winex11.@)
|
|
|
|
*/
|
|
|
|
UINT CDECL X11DRV_WTInfoW( UINT category, UINT index, void *output )
|
|
|
|
{
|
|
|
|
struct tablet_info_params params;
|
|
|
|
params.category = category;
|
|
|
|
params.index = index;
|
|
|
|
params.output = output;
|
2022-05-02 19:15:10 +00:00
|
|
|
return X11DRV_CALL( tablet_info, ¶ms );
|
2022-05-02 18:12:01 +00:00
|
|
|
}
|