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
8dc11a3a
Commit
8dc11a3a
authored
Jun 08, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Add support for keyboard events.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
db742a49
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
0 deletions
+41
-0
Makefile.in
dlls/wineandroid.drv/Makefile.in
+1
-0
WineActivity.java
dlls/wineandroid.drv/WineActivity.java
+15
-0
android.h
dlls/wineandroid.drv/android.h
+9
-0
init.c
dlls/wineandroid.drv/init.c
+1
-0
keyboard.c
dlls/wineandroid.drv/keyboard.c
+0
-0
window.c
dlls/wineandroid.drv/window.c
+15
-0
No files found.
dlls/wineandroid.drv/Makefile.in
View file @
8dc11a3a
...
...
@@ -4,6 +4,7 @@ IMPORTS = user32 gdi32 ntoskrnl
C_SRCS
=
\
device.c
\
init.c
\
keyboard.c
\
window.c
IN_SRCS
=
\
...
...
dlls/wineandroid.drv/WineActivity.java
View file @
8dc11a3a
...
...
@@ -31,6 +31,7 @@ import android.os.Bundle;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
android.view.InputDevice
;
import
android.view.KeyEvent
;
import
android.view.MotionEvent
;
import
android.view.Surface
;
import
android.view.TextureView
;
...
...
@@ -54,6 +55,7 @@ public class WineActivity extends Activity
public
native
void
wine_desktop_changed
(
int
width
,
int
height
);
public
native
void
wine_surface_changed
(
int
hwnd
,
Surface
surface
);
public
native
boolean
wine_motion_event
(
int
hwnd
,
int
action
,
int
x
,
int
y
,
int
state
,
int
vscroll
);
public
native
boolean
wine_keyboard_event
(
int
hwnd
,
int
action
,
int
keycode
,
int
state
);
private
final
String
LOGTAG
=
"wine"
;
private
ProgressDialog
progress_dialog
;
...
...
@@ -389,6 +391,8 @@ public class WineActivity extends Activity
setSurfaceTextureListener
(
this
);
setVisibility
(
VISIBLE
);
setOpaque
(
false
);
setFocusable
(
true
);
setFocusableInTouchMode
(
true
);
}
public
WineWindow
get_window
()
...
...
@@ -450,6 +454,17 @@ public class WineActivity extends Activity
return
wine_motion_event
(
window
.
hwnd
,
event
.
getAction
(),
pos
[
0
],
pos
[
1
],
event
.
getButtonState
(),
0
);
}
public
boolean
dispatchKeyEvent
(
KeyEvent
event
)
{
Log
.
i
(
LOGTAG
,
String
.
format
(
"view key event win %08x action %d keycode %d (%s)"
,
window
.
hwnd
,
event
.
getAction
(),
event
.
getKeyCode
(),
event
.
keyCodeToString
(
event
.
getKeyCode
()
)));;
boolean
ret
=
wine_keyboard_event
(
window
.
hwnd
,
event
.
getAction
(),
event
.
getKeyCode
(),
event
.
getMetaState
()
);
if
(!
ret
)
ret
=
super
.
dispatchKeyEvent
(
event
);
return
ret
;
}
}
// The top-level desktop view group
...
...
dlls/wineandroid.drv/android.h
View file @
8dc11a3a
...
...
@@ -87,12 +87,15 @@ extern void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height )
extern
void
surface_changed
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jobject
surface
)
DECLSPEC_HIDDEN
;
extern
jboolean
motion_event
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jint
action
,
jint
x
,
jint
y
,
jint
state
,
jint
vscroll
)
DECLSPEC_HIDDEN
;
extern
jboolean
keyboard_event
(
JNIEnv
*
env
,
jobject
obj
,
jint
win
,
jint
action
,
jint
keycode
,
jint
state
)
DECLSPEC_HIDDEN
;
enum
event_type
{
DESKTOP_CHANGED
,
SURFACE_CHANGED
,
MOTION_EVENT
,
KEYBOARD_EVENT
,
};
union
event_data
...
...
@@ -118,6 +121,12 @@ union event_data
HWND
hwnd
;
INPUT
input
;
}
motion
;
struct
{
enum
event_type
type
;
HWND
hwnd
;
INPUT
input
;
}
kbd
;
};
int
send_event
(
const
union
event_data
*
data
);
...
...
dlls/wineandroid.drv/init.c
View file @
8dc11a3a
...
...
@@ -392,6 +392,7 @@ static const JNINativeMethod methods[] =
{
"wine_desktop_changed"
,
"(II)V"
,
desktop_changed
},
{
"wine_surface_changed"
,
"(ILandroid/view/Surface;)V"
,
surface_changed
},
{
"wine_motion_event"
,
"(IIIIII)Z"
,
motion_event
},
{
"wine_keyboard_event"
,
"(IIII)Z"
,
keyboard_event
},
};
#define DECL_FUNCPTR(f) typeof(f) * p##f = NULL
...
...
dlls/wineandroid.drv/keyboard.c
0 → 100644
View file @
8dc11a3a
This diff is collapsed.
Click to expand it.
dlls/wineandroid.drv/window.c
View file @
8dc11a3a
...
...
@@ -405,6 +405,9 @@ static int process_events( DWORD mask )
}
else
if
(
mask
&
QS_MOUSEMOVE
)
break
;
continue
;
/* skip it */
case
KEYBOARD_EVENT
:
if
(
mask
&
QS_KEY
)
break
;
continue
;
/* skip it */
default:
if
(
mask
&
QS_SENDMESSAGE
)
break
;
continue
;
/* skip it */
...
...
@@ -470,6 +473,18 @@ static int process_events( DWORD mask )
}
break
;
case
KEYBOARD_EVENT
:
if
(
event
->
data
.
kbd
.
input
.
u
.
ki
.
dwFlags
&
KEYEVENTF_KEYUP
)
TRACE
(
"KEYUP 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
);
else
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
);
__wine_send_input
(
0
,
&
event
->
data
.
kbd
.
input
);
break
;
default:
FIXME
(
"got event %u
\n
"
,
event
->
data
.
type
);
}
...
...
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