2017-05-31 09:15:17 +00:00
|
|
|
/*
|
|
|
|
* Android driver definitions
|
|
|
|
*
|
|
|
|
* Copyright 2013 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_ANDROID_H
|
|
|
|
#define __WINE_ANDROID_H
|
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
2022-06-04 12:02:53 +00:00
|
|
|
#include <pthread.h>
|
2017-05-31 09:15:17 +00:00
|
|
|
#include <jni.h>
|
2017-05-31 09:47:49 +00:00
|
|
|
#include <android/log.h>
|
2017-06-08 08:16:41 +00:00
|
|
|
#include <android/input.h>
|
2017-06-02 09:37:16 +00:00
|
|
|
#include <android/native_window_jni.h>
|
2017-05-31 09:15:17 +00:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2022-06-03 20:17:36 +00:00
|
|
|
#include "ntgdi.h"
|
2017-05-31 09:15:17 +00:00
|
|
|
#include "wine/gdi_driver.h"
|
2022-06-04 13:22:23 +00:00
|
|
|
#include "unixlib.h"
|
2017-06-02 09:46:21 +00:00
|
|
|
#include "android_native.h"
|
2017-05-31 09:15:17 +00:00
|
|
|
|
|
|
|
|
2017-05-31 09:47:49 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* Android interface
|
|
|
|
*/
|
|
|
|
|
2023-11-29 19:51:07 +00:00
|
|
|
#define DECL_FUNCPTR(f) extern typeof(f) * p##f
|
2017-05-31 09:47:49 +00:00
|
|
|
DECL_FUNCPTR( __android_log_print );
|
2017-06-02 09:37:16 +00:00
|
|
|
DECL_FUNCPTR( ANativeWindow_fromSurface );
|
|
|
|
DECL_FUNCPTR( ANativeWindow_release );
|
2017-05-31 09:47:49 +00:00
|
|
|
#undef DECL_FUNCPTR
|
|
|
|
|
|
|
|
|
2017-06-22 19:39:08 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* OpenGL driver
|
|
|
|
*/
|
|
|
|
|
2023-11-29 19:51:07 +00:00
|
|
|
extern pthread_mutex_t drawable_mutex;
|
|
|
|
extern void update_gl_drawable( HWND hwnd );
|
|
|
|
extern void destroy_gl_drawable( HWND hwnd );
|
|
|
|
extern struct opengl_funcs *get_wgl_driver( UINT version );
|
2017-06-22 19:39:08 +00:00
|
|
|
|
|
|
|
|
2017-06-01 07:39:20 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* Android pseudo-device
|
|
|
|
*/
|
|
|
|
|
2023-11-29 19:51:07 +00:00
|
|
|
extern void start_android_device(void);
|
|
|
|
extern void register_native_window( HWND hwnd, struct ANativeWindow *win, BOOL client );
|
|
|
|
extern struct ANativeWindow *create_ioctl_window( HWND hwnd, BOOL opengl, float scale );
|
|
|
|
extern struct ANativeWindow *grab_ioctl_window( struct ANativeWindow *window );
|
|
|
|
extern void release_ioctl_window( struct ANativeWindow *window );
|
|
|
|
extern void destroy_ioctl_window( HWND hwnd, BOOL opengl );
|
2017-06-02 09:34:23 +00:00
|
|
|
extern int ioctl_window_pos_changed( HWND hwnd, const RECT *window_rect, const RECT *client_rect,
|
|
|
|
const RECT *visible_rect, UINT style, UINT flags,
|
2023-11-29 19:51:07 +00:00
|
|
|
HWND after, HWND owner );
|
|
|
|
extern int ioctl_set_window_parent( HWND hwnd, HWND parent, float scale );
|
|
|
|
extern int ioctl_set_capture( HWND hwnd );
|
2018-11-26 15:11:44 +00:00
|
|
|
extern int ioctl_set_cursor( int id, int width, int height,
|
2023-11-29 19:51:07 +00:00
|
|
|
int hotspotx, int hotspoty, const unsigned int *bits );
|
2017-06-01 07:39:20 +00:00
|
|
|
|
|
|
|
|
2017-05-31 09:15:17 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* USER driver
|
|
|
|
*/
|
|
|
|
|
2023-11-29 19:51:07 +00:00
|
|
|
extern pthread_mutex_t win_data_mutex;
|
|
|
|
extern INT ANDROID_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size );
|
|
|
|
extern UINT ANDROID_MapVirtualKeyEx( UINT code, UINT maptype, HKL hkl );
|
|
|
|
extern SHORT ANDROID_VkKeyScanEx( WCHAR ch, HKL hkl );
|
|
|
|
extern void ANDROID_SetCursor( HWND hwnd, HCURSOR handle );
|
|
|
|
extern BOOL ANDROID_CreateDesktop( const WCHAR *name, UINT width, UINT height );
|
|
|
|
extern BOOL ANDROID_CreateWindow( HWND hwnd );
|
|
|
|
extern void ANDROID_DestroyWindow( HWND hwnd );
|
|
|
|
extern BOOL ANDROID_ProcessEvents( DWORD mask );
|
|
|
|
extern LRESULT ANDROID_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp );
|
2022-04-07 13:27:15 +00:00
|
|
|
extern void ANDROID_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha,
|
2023-11-29 19:51:07 +00:00
|
|
|
DWORD flags );
|
|
|
|
extern void ANDROID_SetParent( HWND hwnd, HWND parent, HWND old_parent );
|
|
|
|
extern void ANDROID_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw );
|
|
|
|
extern void ANDROID_SetCapture( HWND hwnd, UINT flags );
|
|
|
|
extern void ANDROID_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style );
|
|
|
|
extern UINT ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp );
|
2022-04-07 13:27:15 +00:00
|
|
|
extern BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
|
2023-11-29 19:51:07 +00:00
|
|
|
const RECT *window_rect );
|
|
|
|
extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp );
|
2022-04-07 13:27:15 +00:00
|
|
|
extern BOOL ANDROID_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
|
|
|
|
const RECT *window_rect, const RECT *client_rect,
|
2023-11-29 19:51:07 +00:00
|
|
|
RECT *visible_rect, struct window_surface **surface );
|
2022-04-07 13:27:15 +00:00
|
|
|
extern void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
|
|
|
|
const RECT *window_rect, const RECT *client_rect,
|
|
|
|
const RECT *visible_rect, const RECT *valid_rects,
|
2023-11-29 19:51:07 +00:00
|
|
|
struct window_surface *surface );
|
2021-11-11 13:13:16 +00:00
|
|
|
|
2022-06-04 13:27:59 +00:00
|
|
|
/* unixlib interface */
|
|
|
|
|
2023-11-29 19:51:07 +00:00
|
|
|
extern NTSTATUS android_dispatch_ioctl( void *arg );
|
|
|
|
extern NTSTATUS android_java_init( void *arg );
|
|
|
|
extern NTSTATUS android_java_uninit( void *arg );
|
|
|
|
extern NTSTATUS android_register_window( void *arg );
|
2022-06-06 23:50:48 +00:00
|
|
|
extern PNTAPCFUNC register_window_callback;
|
2022-06-04 13:27:59 +00:00
|
|
|
|
2023-11-29 19:51:07 +00:00
|
|
|
extern unsigned int screen_width;
|
|
|
|
extern unsigned int screen_height;
|
|
|
|
extern RECT virtual_screen_rect;
|
|
|
|
extern MONITORINFOEXW default_monitor;
|
2017-05-31 09:15:17 +00:00
|
|
|
|
2017-06-06 06:33:09 +00:00
|
|
|
enum android_window_messages
|
|
|
|
{
|
2023-12-11 19:26:59 +00:00
|
|
|
WM_ANDROID_REFRESH = WM_WINE_FIRST_DRIVER_MSG,
|
2017-06-06 06:33:09 +00:00
|
|
|
};
|
|
|
|
|
2023-11-29 19:51:07 +00:00
|
|
|
extern void init_gralloc( const struct hw_module_t *module );
|
|
|
|
extern HWND get_capture_window(void);
|
|
|
|
extern void init_monitors( int width, int height );
|
|
|
|
extern void set_screen_dpi( DWORD dpi );
|
|
|
|
extern void update_keyboard_lock_state( WORD vkey, UINT state );
|
2017-05-31 09:15:17 +00:00
|
|
|
|
2017-05-31 09:47:49 +00:00
|
|
|
/* JNI entry points */
|
2023-11-29 19:51:07 +00:00
|
|
|
extern void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height );
|
|
|
|
extern void config_changed( JNIEnv *env, jobject obj, jint dpi );
|
2017-06-22 17:36:54 +00:00
|
|
|
extern void surface_changed( JNIEnv *env, jobject obj, jint win, jobject surface,
|
2023-11-29 19:51:07 +00:00
|
|
|
jboolean client );
|
2017-06-08 08:16:41 +00:00
|
|
|
extern jboolean motion_event( JNIEnv *env, jobject obj, jint win, jint action,
|
2023-11-29 19:51:07 +00:00
|
|
|
jint x, jint y, jint state, jint vscroll );
|
2017-06-08 14:44:20 +00:00
|
|
|
extern jboolean keyboard_event( JNIEnv *env, jobject obj, jint win, jint action,
|
2023-11-29 19:51:07 +00:00
|
|
|
jint keycode, jint state );
|
2017-05-31 09:47:49 +00:00
|
|
|
|
2017-05-31 09:49:12 +00:00
|
|
|
enum event_type
|
|
|
|
{
|
|
|
|
DESKTOP_CHANGED,
|
2017-06-12 17:12:30 +00:00
|
|
|
CONFIG_CHANGED,
|
2017-06-02 09:37:16 +00:00
|
|
|
SURFACE_CHANGED,
|
2017-06-08 08:16:41 +00:00
|
|
|
MOTION_EVENT,
|
2017-06-08 14:44:20 +00:00
|
|
|
KEYBOARD_EVENT,
|
2017-05-31 09:49:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
union event_data
|
|
|
|
{
|
|
|
|
enum event_type type;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
enum event_type type;
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
} desktop;
|
2017-06-02 09:37:16 +00:00
|
|
|
struct
|
2017-06-12 17:12:30 +00:00
|
|
|
{
|
|
|
|
enum event_type type;
|
|
|
|
unsigned int dpi;
|
|
|
|
} cfg;
|
|
|
|
struct
|
2017-06-02 09:37:16 +00:00
|
|
|
{
|
|
|
|
enum event_type type;
|
|
|
|
HWND hwnd;
|
|
|
|
ANativeWindow *window;
|
2017-06-22 17:36:54 +00:00
|
|
|
BOOL client;
|
2017-06-02 09:37:16 +00:00
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
} surface;
|
2017-06-08 08:16:41 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
enum event_type type;
|
|
|
|
HWND hwnd;
|
|
|
|
INPUT input;
|
|
|
|
} motion;
|
2017-06-08 14:44:20 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
enum event_type type;
|
|
|
|
HWND hwnd;
|
2017-06-09 07:21:52 +00:00
|
|
|
UINT lock_state;
|
2017-06-08 14:44:20 +00:00
|
|
|
INPUT input;
|
|
|
|
} kbd;
|
2017-05-31 09:49:12 +00:00
|
|
|
};
|
|
|
|
|
2023-11-29 19:51:07 +00:00
|
|
|
int send_event( const union event_data *data );
|
2017-05-31 09:49:12 +00:00
|
|
|
|
2020-12-08 11:45:18 +00:00
|
|
|
extern JavaVM **p_java_vm;
|
|
|
|
extern jobject *p_java_object;
|
|
|
|
extern unsigned short *p_java_gdt_sel;
|
2017-05-31 09:15:17 +00:00
|
|
|
|
2022-06-03 19:54:54 +00:00
|
|
|
/* string helpers */
|
|
|
|
|
|
|
|
static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
|
|
|
|
{
|
|
|
|
while (len--) *dst++ = (unsigned char)*src++;
|
|
|
|
}
|
|
|
|
|
2017-05-31 09:15:17 +00:00
|
|
|
#endif /* __WINE_ANDROID_H */
|