2 * winex11.drv entry points
4 * Copyright 2022 Jacek Caban for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "x11drv_dll.h"
22 #include "wine/debug.h"
25 HMODULE x11drv_module
= 0;
28 typedef NTSTATUS (*callback_func
)( UINT arg
);
29 static const callback_func callback_funcs
[] =
31 x11drv_dnd_drop_event
,
32 x11drv_dnd_leave_event
,
35 C_ASSERT( ARRAYSIZE(callback_funcs
) == client_funcs_count
);
37 static NTSTATUS WINAPI
x11drv_callback( void *arg
, ULONG size
)
39 struct client_callback_params
*params
= arg
;
40 return callback_funcs
[params
->id
]( params
->arg
);
43 typedef NTSTATUS (WINAPI
*kernel_callback
)( void *params
, ULONG size
);
44 static const kernel_callback kernel_callbacks
[] =
47 x11drv_dnd_enter_event
,
48 x11drv_dnd_position_event
,
50 x11drv_systray_change_owner
,
53 C_ASSERT( NtUserDriverCallbackFirst
+ ARRAYSIZE(kernel_callbacks
) == client_func_last
);
56 BOOL WINAPI
DllMain( HINSTANCE instance
, DWORD reason
, void *reserved
)
58 void **callback_table
;
59 struct init_params params
=
65 if (reason
!= DLL_PROCESS_ATTACH
) return TRUE
;
67 DisableThreadLibraryCalls( instance
);
68 x11drv_module
= instance
;
69 if (__wine_init_unix_call()) return FALSE
;
70 if (X11DRV_CALL( init
, ¶ms
)) return FALSE
;
72 callback_table
= NtCurrentTeb()->Peb
->KernelCallbackTable
;
73 memcpy( callback_table
+ NtUserDriverCallbackFirst
, kernel_callbacks
, sizeof(kernel_callbacks
) );
77 /***********************************************************************
78 * AttachEventQueueToTablet (winex11.@)
80 int CDECL
X11DRV_AttachEventQueueToTablet( HWND owner
)
82 return X11DRV_CALL( tablet_attach_queue
, owner
);
85 /***********************************************************************
86 * GetCurrentPacket (winex11.@)
88 int CDECL
X11DRV_GetCurrentPacket( void *packet
)
90 return X11DRV_CALL( tablet_get_packet
, packet
);
93 /***********************************************************************
94 * LoadTabletInfo (winex11.@)
96 BOOL CDECL
X11DRV_LoadTabletInfo( HWND hwnd
)
98 return X11DRV_CALL( tablet_load_info
, hwnd
);
101 /***********************************************************************
102 * WTInfoW (winex11.@)
104 UINT CDECL
X11DRV_WTInfoW( UINT category
, UINT index
, void *output
)
106 struct tablet_info_params params
;
107 params
.category
= category
;
108 params
.index
= index
;
109 params
.output
= output
;
110 return X11DRV_CALL( tablet_info
, ¶ms
);