winecoreaudio: Remove GetAudioSessionWrapper.
[wine.git] / dlls / wineandroid.drv / android.h
blob2eb6a288a728a5e42decf5bfa32f1832166614f5
1 /*
2 * Android driver definitions
4 * Copyright 2013 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_ANDROID_H
22 #define __WINE_ANDROID_H
24 #include <limits.h>
25 #include <stdarg.h>
26 #include <stdlib.h>
27 #include <pthread.h>
28 #include <jni.h>
29 #include <android/log.h>
30 #include <android/input.h>
31 #include <android/native_window_jni.h>
33 #include "windef.h"
34 #include "winbase.h"
35 #include "ntgdi.h"
36 #include "wine/gdi_driver.h"
37 #include "unixlib.h"
38 #include "android_native.h"
41 /**************************************************************************
42 * Android interface
45 #define DECL_FUNCPTR(f) extern typeof(f) * p##f DECLSPEC_HIDDEN
46 DECL_FUNCPTR( __android_log_print );
47 DECL_FUNCPTR( ANativeWindow_fromSurface );
48 DECL_FUNCPTR( ANativeWindow_release );
49 #undef DECL_FUNCPTR
52 /**************************************************************************
53 * OpenGL driver
56 extern pthread_mutex_t drawable_mutex DECLSPEC_HIDDEN;
57 extern void update_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
58 extern void destroy_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
59 extern struct opengl_funcs *get_wgl_driver( UINT version ) DECLSPEC_HIDDEN;
62 /**************************************************************************
63 * Android pseudo-device
66 extern void start_android_device(void) DECLSPEC_HIDDEN;
67 extern void register_native_window( HWND hwnd, struct ANativeWindow *win, BOOL client ) DECLSPEC_HIDDEN;
68 extern struct ANativeWindow *create_ioctl_window( HWND hwnd, BOOL opengl, float scale ) DECLSPEC_HIDDEN;
69 extern struct ANativeWindow *grab_ioctl_window( struct ANativeWindow *window ) DECLSPEC_HIDDEN;
70 extern void release_ioctl_window( struct ANativeWindow *window ) DECLSPEC_HIDDEN;
71 extern void destroy_ioctl_window( HWND hwnd, BOOL opengl ) DECLSPEC_HIDDEN;
72 extern int ioctl_window_pos_changed( HWND hwnd, const RECT *window_rect, const RECT *client_rect,
73 const RECT *visible_rect, UINT style, UINT flags,
74 HWND after, HWND owner ) DECLSPEC_HIDDEN;
75 extern int ioctl_set_window_parent( HWND hwnd, HWND parent, float scale ) DECLSPEC_HIDDEN;
76 extern int ioctl_set_capture( HWND hwnd ) DECLSPEC_HIDDEN;
77 extern int ioctl_set_cursor( int id, int width, int height,
78 int hotspotx, int hotspoty, const unsigned int *bits ) DECLSPEC_HIDDEN;
81 /**************************************************************************
82 * USER driver
85 extern pthread_mutex_t win_data_mutex DECLSPEC_HIDDEN;
86 extern INT ANDROID_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size ) DECLSPEC_HIDDEN;
87 extern UINT ANDROID_MapVirtualKeyEx( UINT code, UINT maptype, HKL hkl ) DECLSPEC_HIDDEN;
88 extern SHORT ANDROID_VkKeyScanEx( WCHAR ch, HKL hkl ) DECLSPEC_HIDDEN;
89 extern void ANDROID_SetCursor( HWND hwnd, HCURSOR handle ) DECLSPEC_HIDDEN;
90 extern BOOL ANDROID_CreateDesktop( const WCHAR *name, UINT width, UINT height ) DECLSPEC_HIDDEN;
91 extern BOOL ANDROID_CreateWindow( HWND hwnd ) DECLSPEC_HIDDEN;
92 extern void ANDROID_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN;
93 extern BOOL ANDROID_ProcessEvents( DWORD mask ) DECLSPEC_HIDDEN;
94 extern LRESULT ANDROID_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) DECLSPEC_HIDDEN;
95 extern void ANDROID_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha,
96 DWORD flags ) DECLSPEC_HIDDEN;
97 extern void ANDROID_SetParent( HWND hwnd, HWND parent, HWND old_parent ) DECLSPEC_HIDDEN;
98 extern void ANDROID_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) DECLSPEC_HIDDEN;
99 extern void ANDROID_SetCapture( HWND hwnd, UINT flags ) DECLSPEC_HIDDEN;
100 extern void ANDROID_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) DECLSPEC_HIDDEN;
101 extern UINT ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) DECLSPEC_HIDDEN;
102 extern BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
103 const RECT *window_rect ) DECLSPEC_HIDDEN;
104 extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) DECLSPEC_HIDDEN;
105 extern BOOL ANDROID_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
106 const RECT *window_rect, const RECT *client_rect,
107 RECT *visible_rect, struct window_surface **surface ) DECLSPEC_HIDDEN;
108 extern void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
109 const RECT *window_rect, const RECT *client_rect,
110 const RECT *visible_rect, const RECT *valid_rects,
111 struct window_surface *surface ) DECLSPEC_HIDDEN;
113 /* unixlib interface */
115 extern NTSTATUS android_dispatch_ioctl( void *arg ) DECLSPEC_HIDDEN;
116 extern NTSTATUS android_java_init( void *arg ) DECLSPEC_HIDDEN;
117 extern NTSTATUS android_java_uninit( void *arg ) DECLSPEC_HIDDEN;
118 extern NTSTATUS android_register_window( void *arg ) DECLSPEC_HIDDEN;
119 extern PNTAPCFUNC register_window_callback;
121 extern unsigned int screen_width DECLSPEC_HIDDEN;
122 extern unsigned int screen_height DECLSPEC_HIDDEN;
123 extern RECT virtual_screen_rect DECLSPEC_HIDDEN;
124 extern MONITORINFOEXW default_monitor DECLSPEC_HIDDEN;
126 enum android_window_messages
128 WM_ANDROID_REFRESH = 0x80001000,
131 extern void init_gralloc( const struct hw_module_t *module ) DECLSPEC_HIDDEN;
132 extern HWND get_capture_window(void) DECLSPEC_HIDDEN;
133 extern void init_monitors( int width, int height ) DECLSPEC_HIDDEN;
134 extern void set_screen_dpi( DWORD dpi ) DECLSPEC_HIDDEN;
135 extern void update_keyboard_lock_state( WORD vkey, UINT state ) DECLSPEC_HIDDEN;
137 /* JNI entry points */
138 extern void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height ) DECLSPEC_HIDDEN;
139 extern void config_changed( JNIEnv *env, jobject obj, jint dpi ) DECLSPEC_HIDDEN;
140 extern void surface_changed( JNIEnv *env, jobject obj, jint win, jobject surface,
141 jboolean client ) DECLSPEC_HIDDEN;
142 extern jboolean motion_event( JNIEnv *env, jobject obj, jint win, jint action,
143 jint x, jint y, jint state, jint vscroll ) DECLSPEC_HIDDEN;
144 extern jboolean keyboard_event( JNIEnv *env, jobject obj, jint win, jint action,
145 jint keycode, jint state ) DECLSPEC_HIDDEN;
147 enum event_type
149 DESKTOP_CHANGED,
150 CONFIG_CHANGED,
151 SURFACE_CHANGED,
152 MOTION_EVENT,
153 KEYBOARD_EVENT,
156 union event_data
158 enum event_type type;
159 struct
161 enum event_type type;
162 unsigned int width;
163 unsigned int height;
164 } desktop;
165 struct
167 enum event_type type;
168 unsigned int dpi;
169 } cfg;
170 struct
172 enum event_type type;
173 HWND hwnd;
174 ANativeWindow *window;
175 BOOL client;
176 unsigned int width;
177 unsigned int height;
178 } surface;
179 struct
181 enum event_type type;
182 HWND hwnd;
183 INPUT input;
184 } motion;
185 struct
187 enum event_type type;
188 HWND hwnd;
189 UINT lock_state;
190 INPUT input;
191 } kbd;
194 int send_event( const union event_data *data ) DECLSPEC_HIDDEN;
196 extern JavaVM **p_java_vm;
197 extern jobject *p_java_object;
198 extern unsigned short *p_java_gdt_sel;
200 /* string helpers */
202 static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
204 while (len--) *dst++ = (unsigned char)*src++;
207 #endif /* __WINE_ANDROID_H */