Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
749e1b05
Commit
749e1b05
authored
Jun 16, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Move default key messages implementation from user32.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
parent
03959880
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
89 deletions
+81
-89
defwnd.c
dlls/user32/defwnd.c
+1
-89
defwnd.c
dlls/win32u/defwnd.c
+80
-0
No files found.
dlls/user32/defwnd.c
View file @
749e1b05
...
...
@@ -36,15 +36,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
win
);
/* bits in the dwKeyData */
#define KEYDATA_ALT 0x2000
#define KEYDATA_PREVSTATE 0x4000
#define DRAG_FILE 0x454C4946
static
short
iF10Key
=
0
;
static
short
iMenuSysKey
=
0
;
/***********************************************************************
* DEFWND_HandleWindowPosChanged
*
...
...
@@ -169,12 +162,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
DEFWND_HandleWindowPosChanged
(
hwnd
,
(
const
WINDOWPOS
*
)
lParam
);
break
;
case
WM_LBUTTONDOWN
:
case
WM_RBUTTONDOWN
:
case
WM_MBUTTONDOWN
:
iF10Key
=
iMenuSysKey
=
0
;
break
;
case
WM_RBUTTONUP
:
{
POINT
pt
;
...
...
@@ -222,69 +209,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
case
WM_SYSCOMMAND
:
return
NC_HandleSysCommand
(
hwnd
,
wParam
,
lParam
);
case
WM_KEYDOWN
:
if
(
wParam
==
VK_F10
)
iF10Key
=
VK_F10
;
break
;
case
WM_SYSKEYDOWN
:
if
(
HIWORD
(
lParam
)
&
KEYDATA_ALT
)
{
/* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
if
(
(
wParam
==
VK_MENU
||
wParam
==
VK_LMENU
||
wParam
==
VK_RMENU
)
&&
!
iMenuSysKey
)
iMenuSysKey
=
1
;
else
iMenuSysKey
=
0
;
iF10Key
=
0
;
if
(
wParam
==
VK_F4
)
/* try to close the window */
{
HWND
top
=
NtUserGetAncestor
(
hwnd
,
GA_ROOT
);
if
(
!
(
GetClassLongW
(
top
,
GCL_STYLE
)
&
CS_NOCLOSE
))
PostMessageW
(
top
,
WM_SYSCOMMAND
,
SC_CLOSE
,
0
);
}
}
else
if
(
wParam
==
VK_F10
)
{
if
(
NtUserGetKeyState
(
VK_SHIFT
)
&
0x8000
)
SendMessageW
(
hwnd
,
WM_CONTEXTMENU
,
(
WPARAM
)
hwnd
,
-
1
);
iF10Key
=
1
;
}
else
if
(
wParam
==
VK_ESCAPE
&&
(
NtUserGetKeyState
(
VK_SHIFT
)
&
0x8000
))
SendMessageW
(
hwnd
,
WM_SYSCOMMAND
,
SC_KEYMENU
,
' '
);
break
;
case
WM_KEYUP
:
case
WM_SYSKEYUP
:
/* Press and release F10 or ALT */
if
(((
wParam
==
VK_MENU
||
wParam
==
VK_LMENU
||
wParam
==
VK_RMENU
)
&&
iMenuSysKey
)
||
((
wParam
==
VK_F10
)
&&
iF10Key
))
SendMessageW
(
NtUserGetAncestor
(
hwnd
,
GA_ROOT
),
WM_SYSCOMMAND
,
SC_KEYMENU
,
0L
);
iMenuSysKey
=
iF10Key
=
0
;
break
;
case
WM_SYSCHAR
:
{
iMenuSysKey
=
0
;
if
(
wParam
==
'\r'
&&
IsIconic
(
hwnd
))
{
PostMessageW
(
hwnd
,
WM_SYSCOMMAND
,
SC_RESTORE
,
0L
);
break
;
}
if
((
HIWORD
(
lParam
)
&
KEYDATA_ALT
)
&&
wParam
)
{
if
(
wParam
==
'\t'
||
wParam
==
'\x1b'
)
break
;
if
(
wParam
==
' '
&&
(
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
&
WS_CHILD
))
SendMessageW
(
GetParent
(
hwnd
),
msg
,
wParam
,
lParam
);
else
SendMessageW
(
hwnd
,
WM_SYSCOMMAND
,
SC_KEYMENU
,
wParam
);
}
else
/* check for Ctrl-Esc */
if
(
wParam
!=
'\x1b'
)
MessageBeep
(
0
);
break
;
}
case
WM_SHOWWINDOW
:
{
LONG
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
...
...
@@ -310,11 +234,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
break
;
}
case
WM_CANCELMODE
:
iMenuSysKey
=
0
;
NtUserMessageCall
(
hwnd
,
msg
,
wParam
,
lParam
,
0
,
NtUserDefWindowProc
,
FALSE
);
break
;
case
WM_VKEYTOITEM
:
case
WM_CHARTOITEM
:
return
-
1
;
...
...
@@ -485,6 +404,7 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
break
;
case
WM_SETTEXT
:
case
WM_SYSCHAR
:
result
=
NtUserMessageCall
(
hwnd
,
msg
,
wParam
,
lParam
,
0
,
NtUserDefWindowProc
,
TRUE
);
break
;
...
...
@@ -556,14 +476,6 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
}
break
;
case
WM_SYSCHAR
:
{
CHAR
ch
=
LOWORD
(
wParam
);
WCHAR
wch
;
MultiByteToWideChar
(
CP_ACP
,
0
,
&
ch
,
1
,
&
wch
,
1
);
wParam
=
MAKEWPARAM
(
wch
,
HIWORD
(
wParam
)
);
}
/* fall through */
default:
result
=
DEFWND_DefWinProc
(
hwnd
,
msg
,
wParam
,
lParam
);
break
;
...
...
dlls/win32u/defwnd.c
View file @
749e1b05
...
...
@@ -31,6 +31,13 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
win
);
/* bits in the dwKeyData */
#define KEYDATA_ALT 0x2000
#define KEYDATA_PREVSTATE 0x4000
static
short
f10_key
=
0
;
static
short
menu_sys_key
=
0
;
static
BOOL
has_dialog_frame
(
UINT
style
,
UINT
ex_style
)
{
return
(
ex_style
&
WS_EX_DLGMODALFRAME
)
||
((
style
&
WS_DLGFRAME
)
&&
!
(
style
&
WS_THICKFRAME
));
...
...
@@ -2404,6 +2411,7 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
break
;
case
WM_CANCELMODE
:
menu_sys_key
=
0
;
end_menu
(
hwnd
);
if
(
get_capture
()
==
hwnd
)
release_capture
();
break
;
...
...
@@ -2443,6 +2451,78 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
result
=
handle_sys_command
(
hwnd
,
wparam
,
lparam
);
break
;
case
WM_LBUTTONDOWN
:
case
WM_RBUTTONDOWN
:
case
WM_MBUTTONDOWN
:
f10_key
=
menu_sys_key
=
0
;
break
;
case
WM_KEYDOWN
:
if
(
wparam
==
VK_F10
)
f10_key
=
VK_F10
;
break
;
case
WM_SYSKEYDOWN
:
if
(
HIWORD
(
lparam
)
&
KEYDATA_ALT
)
{
if
((
wparam
==
VK_MENU
||
wparam
==
VK_LMENU
||
wparam
==
VK_RMENU
)
&&
!
menu_sys_key
)
menu_sys_key
=
1
;
else
menu_sys_key
=
0
;
f10_key
=
0
;
if
(
wparam
==
VK_F4
)
/* try to close the window */
{
HWND
top
=
NtUserGetAncestor
(
hwnd
,
GA_ROOT
);
if
(
!
(
get_class_long
(
top
,
GCL_STYLE
,
FALSE
)
&
CS_NOCLOSE
))
NtUserPostMessage
(
top
,
WM_SYSCOMMAND
,
SC_CLOSE
,
0
);
}
}
else
if
(
wparam
==
VK_F10
)
{
if
(
NtUserGetKeyState
(
VK_SHIFT
)
&
0x8000
)
send_message
(
hwnd
,
WM_CONTEXTMENU
,
(
WPARAM
)
hwnd
,
-
1
);
f10_key
=
1
;
}
else
if
(
wparam
==
VK_ESCAPE
&&
(
NtUserGetKeyState
(
VK_SHIFT
)
&
0x8000
))
send_message
(
hwnd
,
WM_SYSCOMMAND
,
SC_KEYMENU
,
' '
);
break
;
case
WM_KEYUP
:
case
WM_SYSKEYUP
:
/* Press and release F10 or ALT */
if
(((
wparam
==
VK_MENU
||
wparam
==
VK_LMENU
||
wparam
==
VK_RMENU
)
&&
menu_sys_key
)
||
(
wparam
==
VK_F10
&&
f10_key
))
send_message
(
NtUserGetAncestor
(
hwnd
,
GA_ROOT
),
WM_SYSCOMMAND
,
SC_KEYMENU
,
0
);
menu_sys_key
=
f10_key
=
0
;
break
;
case
WM_SYSCHAR
:
menu_sys_key
=
0
;
if
(
wparam
==
'\r'
&&
is_iconic
(
hwnd
))
{
NtUserPostMessage
(
hwnd
,
WM_SYSCOMMAND
,
SC_RESTORE
,
0
);
break
;
}
if
((
HIWORD
(
lparam
)
&
KEYDATA_ALT
)
&&
wparam
)
{
WCHAR
wch
;
if
(
ansi
)
{
char
ch
=
wparam
;
win32u_mbtowc
(
&
ansi_cp
,
&
wch
,
1
,
&
ch
,
1
);
}
else
wch
=
wparam
;
if
(
wch
==
'\t'
||
wch
==
'\x1b'
)
break
;
if
(
wch
==
' '
&&
(
get_window_long
(
hwnd
,
GWL_STYLE
)
&
WS_CHILD
))
send_message
(
get_parent
(
hwnd
),
msg
,
wch
,
lparam
);
else
send_message
(
hwnd
,
WM_SYSCOMMAND
,
SC_KEYMENU
,
wch
);
}
else
if
(
wparam
!=
'\x1b'
)
/* Ctrl-Esc */
message_beep
(
0
);
break
;
case
WM_KEYF1
:
{
HELPINFO
hi
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment