Skip to content

Commit 140f0e3

Browse files
authored
Very rough implementation of EnableMouseInPointer function
#219
1 parent cd0b375 commit 140f0e3

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

EnableMouseInPointer.patch

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
diff -ruN wine_11.0-rc2_staging/dlls/win32u/input.c wine_11.0-rc2_staging_MouseInPointer/dlls/win32u/input.c
2+
--- wine_11.0-rc2_staging/dlls/win32u/input.c 2025-12-29 13:41:41.975181837 +0000
3+
+++ wine_11.0-rc2_staging_MouseInPointer/dlls/win32u/input.c 2025-12-29 13:24:25.348886963 +0000
4+
@@ -2594,9 +2594,14 @@
5+
*/
6+
BOOL WINAPI NtUserEnableMouseInPointer( BOOL enable )
7+
{
8+
- FIXME( "enable %u stub!\n", enable );
9+
- RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED );
10+
- return FALSE;
11+
+ struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
12+
+
13+
+ if ( enable == TRUE )
14+
+ thread_info->mouse_in_pointer = TRUE;
15+
+ else
16+
+ thread_info->mouse_in_pointer = FALSE;
17+
+
18+
+ return thread_info->mouse_in_pointer;
19+
}
20+
21+
/**********************************************************************
22+
@@ -2604,9 +2609,7 @@
23+
*/
24+
BOOL WINAPI NtUserEnableMouseInPointerForThread( void )
25+
{
26+
- FIXME( "stub!\n" );
27+
- RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED );
28+
- return FALSE;
29+
+ return NtUserEnableMouseInPointer(TRUE);
30+
}
31+
32+
/**********************************************************************
33+
@@ -2614,9 +2617,9 @@
34+
*/
35+
BOOL WINAPI NtUserIsMouseInPointerEnabled(void)
36+
{
37+
- FIXME( "stub!\n" );
38+
- RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED );
39+
- return FALSE;
40+
+ struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
41+
+
42+
+ return thread_info->mouse_in_pointer;
43+
}
44+
45+
static BOOL is_captured_by_system(void)
46+
diff -ruN wine_11.0-rc2_staging/dlls/win32u/message.c wine_11.0-rc2_staging_MouseInPointer/dlls/win32u/message.c
47+
--- wine_11.0-rc2_staging/dlls/win32u/message.c 2025-12-29 13:41:40.573798712 +0000
48+
+++ wine_11.0-rc2_staging_MouseInPointer/dlls/win32u/message.c 2025-12-29 13:54:08.510875628 +0000
49+
@@ -4629,9 +4629,38 @@
50+
return put_message_in_queue( &info, NULL );
51+
}
52+
53+
+UINT isMouseButtonPressed = 0;
54+
+
55+
LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
56+
void *result_info, DWORD type, BOOL ansi )
57+
{
58+
+ if ( type == NtUserGetDispatchParams &&
59+
+ (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONUP || msg == WM_MOUSEMOVE) ) {
60+
+ struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
61+
+
62+
+ if ( thread_info->mouse_in_pointer == TRUE ) {
63+
+ if ( msg == WM_LBUTTONDOWN ) {
64+
+ wparam = MAKEWPARAM(1, POINTER_MESSAGE_FLAG_PRIMARY | POINTER_MESSAGE_FLAG_FIRSTBUTTON | POINTER_MESSAGE_FLAG_INCONTACT | POINTER_MESSAGE_FLAG_INRANGE);
65+
+ isMouseButtonPressed = 1;
66+
+ }
67+
+
68+
+ if ( msg == WM_LBUTTONUP ) {
69+
+ wparam = MAKEWPARAM(1, POINTER_MESSAGE_FLAG_PRIMARY | POINTER_MESSAGE_FLAG_INRANGE);
70+
+ isMouseButtonPressed = 0;
71+
+ }
72+
+
73+
+ if ( msg == WM_MOUSEMOVE ) {
74+
+ if ( isMouseButtonPressed ) {
75+
+ wparam = MAKEWPARAM(1, POINTER_MESSAGE_FLAG_PRIMARY | POINTER_MESSAGE_FLAG_FIRSTBUTTON | POINTER_MESSAGE_FLAG_INCONTACT | POINTER_MESSAGE_FLAG_INRANGE);
76+
+ } else {
77+
+ wparam = MAKEWPARAM(1, POINTER_MESSAGE_FLAG_PRIMARY | POINTER_MESSAGE_FLAG_INRANGE);
78+
+ }
79+
+ }
80+
+
81+
+ msg = WM_POINTERUPDATE;
82+
+ }
83+
+ }
84+
+
85+
switch (type)
86+
{
87+
case NtUserScrollBarWndProc:
88+
diff -ruN wine_11.0-rc2_staging/include/ntuser.h wine_11.0-rc2_staging_MouseInPointer/include/ntuser.h
89+
--- wine_11.0-rc2_staging/include/ntuser.h 2025-12-29 13:41:41.963567359 +0000
90+
+++ wine_11.0-rc2_staging_MouseInPointer/include/ntuser.h 2025-12-29 13:24:31.452997883 +0000
91+
@@ -134,6 +134,7 @@
92+
UINT default_imc; /* default input context */
93+
UINT64 client_imm; /* client IMM thread info */
94+
UINT64 wmchar_data; /* client data for WM_CHAR mappings */
95+
+ BOOL mouse_in_pointer;
96+
};
97+
98+
static inline struct ntuser_thread_info *NtUserGetThreadInfo(void)

0 commit comments

Comments
 (0)