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
4f4ede56
Commit
4f4ede56
authored
Jun 09, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Synchronize keyboard lock state.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
86b82b8f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
0 deletions
+66
-0
android.h
dlls/wineandroid.drv/android.h
+2
-0
keyboard.c
dlls/wineandroid.drv/keyboard.c
+63
-0
window.c
dlls/wineandroid.drv/window.c
+1
-0
No files found.
dlls/wineandroid.drv/android.h
View file @
4f4ede56
...
...
@@ -81,6 +81,7 @@ enum android_window_messages
extern
HWND
get_capture_window
(
void
)
DECLSPEC_HIDDEN
;
extern
void
init_monitors
(
int
width
,
int
height
)
DECLSPEC_HIDDEN
;
extern
void
update_keyboard_lock_state
(
WORD
vkey
,
UINT
state
)
DECLSPEC_HIDDEN
;
/* JNI entry points */
extern
void
desktop_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
width
,
jint
height
)
DECLSPEC_HIDDEN
;
...
...
@@ -125,6 +126,7 @@ union event_data
{
enum
event_type
type
;
HWND
hwnd
;
UINT
lock_state
;
INPUT
input
;
}
kbd
;
};
...
...
dlls/wineandroid.drv/keyboard.c
View file @
4f4ede56
...
...
@@ -33,6 +33,7 @@
#include "android.h"
#include "wine/unicode.h"
#include "wine/server.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
keyboard
);
...
...
@@ -653,6 +654,67 @@ static const char* vkey_to_name( UINT vkey )
return
NULL
;
}
static
BOOL
get_async_key_state
(
BYTE
state
[
256
]
)
{
BOOL
ret
;
SERVER_START_REQ
(
get_key_state
)
{
req
->
tid
=
0
;
req
->
key
=
-
1
;
wine_server_set_reply
(
req
,
state
,
256
);
ret
=
!
wine_server_call
(
req
);
}
SERVER_END_REQ
;
return
ret
;
}
static
void
send_keyboard_input
(
HWND
hwnd
,
WORD
vkey
,
WORD
scan
,
DWORD
flags
)
{
INPUT
input
;
input
.
type
=
INPUT_KEYBOARD
;
input
.
u
.
ki
.
wVk
=
vkey
;
input
.
u
.
ki
.
wScan
=
scan
;
input
.
u
.
ki
.
dwFlags
=
flags
;
input
.
u
.
ki
.
time
=
0
;
input
.
u
.
ki
.
dwExtraInfo
=
0
;
__wine_send_input
(
hwnd
,
&
input
);
}
/***********************************************************************
* update_keyboard_lock_state
*/
void
update_keyboard_lock_state
(
WORD
vkey
,
UINT
state
)
{
BYTE
keystate
[
256
];
if
(
!
get_async_key_state
(
keystate
))
return
;
if
(
!
(
keystate
[
VK_CAPITAL
]
&
0x01
)
!=
!
(
state
&
AMETA_CAPS_LOCK_ON
)
&&
vkey
!=
VK_CAPITAL
)
{
TRACE
(
"adjusting CapsLock state (%02x)
\n
"
,
keystate
[
VK_CAPITAL
]
);
send_keyboard_input
(
0
,
VK_CAPITAL
,
0x3a
,
0
);
send_keyboard_input
(
0
,
VK_CAPITAL
,
0x3a
,
KEYEVENTF_KEYUP
);
}
if
(
!
(
keystate
[
VK_NUMLOCK
]
&
0x01
)
!=
!
(
state
&
AMETA_NUM_LOCK_ON
)
&&
(
vkey
&
0xff
)
!=
VK_NUMLOCK
)
{
TRACE
(
"adjusting NumLock state (%02x)
\n
"
,
keystate
[
VK_NUMLOCK
]
);
send_keyboard_input
(
0
,
VK_NUMLOCK
,
0x45
,
KEYEVENTF_EXTENDEDKEY
);
send_keyboard_input
(
0
,
VK_NUMLOCK
,
0x45
,
KEYEVENTF_EXTENDEDKEY
|
KEYEVENTF_KEYUP
);
}
if
(
!
(
keystate
[
VK_SCROLL
]
&
0x01
)
!=
!
(
state
&
AMETA_SCROLL_LOCK_ON
)
&&
vkey
!=
VK_SCROLL
)
{
TRACE
(
"adjusting ScrollLock state (%02x)
\n
"
,
keystate
[
VK_SCROLL
]
);
send_keyboard_input
(
0
,
VK_SCROLL
,
0x46
,
0
);
send_keyboard_input
(
0
,
VK_SCROLL
,
0x46
,
KEYEVENTF_KEYUP
);
}
}
/***********************************************************************
* keyboard_event
*
...
...
@@ -671,6 +733,7 @@ jboolean keyboard_event( JNIEnv *env, jobject obj, jint win, jint action, jint k
}
data
.
type
=
KEYBOARD_EVENT
;
data
.
kbd
.
hwnd
=
LongToHandle
(
win
);
data
.
kbd
.
lock_state
=
state
;
data
.
kbd
.
input
.
type
=
INPUT_KEYBOARD
;
data
.
kbd
.
input
.
u
.
ki
.
wVk
=
keycode_to_vkey
[
keycode
];
data
.
kbd
.
input
.
u
.
ki
.
wScan
=
vkey_to_scancode
[
data
.
kbd
.
input
.
u
.
ki
.
wVk
];
...
...
dlls/wineandroid.drv/window.c
View file @
4f4ede56
...
...
@@ -482,6 +482,7 @@ static int process_events( DWORD mask )
TRACE
(
"KEYDOWN hwnd %p vkey %x '%c' scancode %x
\n
"
,
event
->
data
.
kbd
.
hwnd
,
event
->
data
.
kbd
.
input
.
u
.
ki
.
wVk
,
event
->
data
.
kbd
.
input
.
u
.
ki
.
wVk
,
event
->
data
.
kbd
.
input
.
u
.
ki
.
wScan
);
update_keyboard_lock_state
(
event
->
data
.
kbd
.
input
.
u
.
ki
.
wVk
,
event
->
data
.
kbd
.
lock_state
);
__wine_send_input
(
0
,
&
event
->
data
.
kbd
.
input
);
break
;
...
...
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