android.h 5.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/*
 * 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>
#include <jni.h>
28
#include <android/log.h>
29
#include <android/input.h>
30
#include <android/native_window_jni.h>
31 32 33 34 35 36

#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/gdi_driver.h"
37
#include "android_native.h"
38 39


40 41 42 43 44 45
/**************************************************************************
 * Android interface
 */

#define DECL_FUNCPTR(f) extern typeof(f) * p##f DECLSPEC_HIDDEN
DECL_FUNCPTR( __android_log_print );
46 47
DECL_FUNCPTR( ANativeWindow_fromSurface );
DECL_FUNCPTR( ANativeWindow_release );
48 49 50
#undef DECL_FUNCPTR


51 52 53 54
/**************************************************************************
 * OpenGL driver
 */

55
extern void update_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
56 57 58 59
extern void destroy_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
extern struct opengl_funcs *get_wgl_driver( UINT version ) DECLSPEC_HIDDEN;


60 61 62 63 64
/**************************************************************************
 * Android pseudo-device
 */

extern void start_android_device(void) DECLSPEC_HIDDEN;
65
extern void register_native_window( HWND hwnd, struct ANativeWindow *win, BOOL client ) DECLSPEC_HIDDEN;
66
extern struct ANativeWindow *create_ioctl_window( HWND hwnd, BOOL opengl, float scale ) DECLSPEC_HIDDEN;
67 68
extern struct ANativeWindow *grab_ioctl_window( struct ANativeWindow *window ) DECLSPEC_HIDDEN;
extern void release_ioctl_window( struct ANativeWindow *window ) DECLSPEC_HIDDEN;
69
extern void destroy_ioctl_window( HWND hwnd, BOOL opengl ) DECLSPEC_HIDDEN;
70 71 72
extern int ioctl_window_pos_changed( HWND hwnd, const RECT *window_rect, const RECT *client_rect,
                                     const RECT *visible_rect, UINT style, UINT flags,
                                     HWND after, HWND owner ) DECLSPEC_HIDDEN;
73
extern int ioctl_set_window_parent( HWND hwnd, HWND parent, float scale ) DECLSPEC_HIDDEN;
74
extern int ioctl_set_capture( HWND hwnd ) DECLSPEC_HIDDEN;
75 76
extern int ioctl_set_cursor( int id, int width, int height,
                             int hotspotx, int hotspoty, const unsigned int *bits ) DECLSPEC_HIDDEN;
77 78


79 80 81 82 83 84 85 86 87
/**************************************************************************
 * USER driver
 */

extern unsigned int screen_width DECLSPEC_HIDDEN;
extern unsigned int screen_height DECLSPEC_HIDDEN;
extern RECT virtual_screen_rect DECLSPEC_HIDDEN;
extern MONITORINFOEXW default_monitor DECLSPEC_HIDDEN;

88 89 90 91 92
enum android_window_messages
{
    WM_ANDROID_REFRESH = 0x80001000,
};

93
extern void init_gralloc( const struct hw_module_t *module ) DECLSPEC_HIDDEN;
94
extern HWND get_capture_window(void) DECLSPEC_HIDDEN;
95
extern void init_monitors( int width, int height ) DECLSPEC_HIDDEN;
96
extern void set_screen_dpi( DWORD dpi ) DECLSPEC_HIDDEN;
97
extern void update_keyboard_lock_state( WORD vkey, UINT state ) DECLSPEC_HIDDEN;
98

99 100
/* JNI entry points */
extern void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height ) DECLSPEC_HIDDEN;
101
extern void config_changed( JNIEnv *env, jobject obj, jint dpi ) DECLSPEC_HIDDEN;
102 103
extern void surface_changed( JNIEnv *env, jobject obj, jint win, jobject surface,
                             jboolean client ) DECLSPEC_HIDDEN;
104 105
extern jboolean motion_event( JNIEnv *env, jobject obj, jint win, jint action,
                              jint x, jint y, jint state, jint vscroll ) DECLSPEC_HIDDEN;
106 107
extern jboolean keyboard_event( JNIEnv *env, jobject obj, jint win, jint action,
                                jint keycode, jint state ) DECLSPEC_HIDDEN;
108

109 110 111
enum event_type
{
    DESKTOP_CHANGED,
112
    CONFIG_CHANGED,
113
    SURFACE_CHANGED,
114
    MOTION_EVENT,
115
    KEYBOARD_EVENT,
116 117 118 119 120 121 122 123 124 125 126
};

union event_data
{
    enum event_type type;
    struct
    {
        enum event_type type;
        unsigned int    width;
        unsigned int    height;
    } desktop;
127
    struct
128 129 130 131 132
    {
        enum event_type type;
        unsigned int    dpi;
    } cfg;
    struct
133 134 135 136
    {
        enum event_type type;
        HWND            hwnd;
        ANativeWindow  *window;
137
        BOOL            client;
138 139 140
        unsigned int    width;
        unsigned int    height;
    } surface;
141 142 143 144 145 146
    struct
    {
        enum event_type type;
        HWND            hwnd;
        INPUT           input;
    } motion;
147 148 149 150
    struct
    {
        enum event_type type;
        HWND            hwnd;
151
        UINT            lock_state;
152 153
        INPUT           input;
    } kbd;
154 155
};

156
int send_event( const union event_data *data ) DECLSPEC_HIDDEN;
157

158 159 160 161
extern JavaVM *wine_get_java_vm(void);
extern jobject wine_get_java_object(void);

#endif  /* __WINE_ANDROID_H */