1 /*****************************************************************************
2  * win32touch.c: touch gestures recognition
3  *****************************************************************************
4  * Copyright © 2013-2014 VideoLAN
5  *
6  * Authors: Ludovic Fauvet <etix@videolan.org>
7  *          Jean-Baptiste Kempf <jb@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23 
24 #ifndef VLC_GESTURE_H_
25 #define VLC_GESTURE_H_
26 
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30 
31 #if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
32 # undef _WIN32_WINNT
33 # define _WIN32_WINNT _WIN32_WINNT_WIN7
34 #endif
35 #define WINVER _WIN32_WINNT_WIN7
36 
37 #include <vlc_common.h>
38 
39 #ifndef WM_GESTURE
40 # define WM_GESTURE 0x0119
41 #endif
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 enum {
48     GESTURE_ACTION_UNDEFINED = 0,
49     GESTURE_ACTION_VOLUME,
50     GESTURE_ACTION_JUMP,
51     GESTURE_ACTION_BRIGHTNESS
52 };
53 
54 
55 typedef struct win32_gesture_sys_t {
56     DWORD       i_type;                 /* Gesture ID */
57     int         i_action;               /* GESTURE_ACTION */
58 
59     int         i_beginx;               /* Start X position */
60     int         i_beginy;               /* Start Y position */
61     int         i_lasty;                /* Last known Y position for PAN */
62     double      f_lastzoom;             /* Last zoom factor */
63 
64     ULONGLONG   i_ullArguments;         /* Base values to compare between 2 zoom gestures */
65     bool        b_2fingers;             /* Did we detect 2 fingers? */
66 
67     BOOL (*DecodeGestureImpl)( vlc_object_t *p_this, struct win32_gesture_sys_t *p_gesture, const GESTUREINFO* p_gi );
68 
69     HINSTANCE   huser_dll;              /* user32.dll */
70     BOOL (WINAPI * OurCloseGestureInfoHandle)(HGESTUREINFO hGestureInfo);
71     BOOL (WINAPI * OurGetGestureInfo)(HGESTUREINFO hGestureInfo, PGESTUREINFO pGestureInfo);
72 } win32_gesture_sys_t;
73 
74 
75 BOOL InitGestures( HWND hwnd, win32_gesture_sys_t **p_gesture, bool b_isProjected );
76 
77 LRESULT DecodeGesture( vlc_object_t *p_intf, win32_gesture_sys_t *p_gesture,
78         HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
79 
80 void CloseGestures( win32_gesture_sys_t *p_gesture );
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif
87