main/buttons.c

changeset 45
71b4c3d1b429
parent 41
7639cfa6aec0
child 54
7b134c27fadb
--- a/main/buttons.c	Thu May 02 11:53:03 2019 +0200
+++ b/main/buttons.c	Wed May 08 13:46:30 2019 +0200
@@ -9,13 +9,12 @@
 sButton				Buttons[MAXBUTTONS];	///< 40 buttons on a screen.
 int				level = 1;		///< Keyboard level.
 
-extern uint8_t			VNC_pointer_button;	///< Mouse buttons mask
-extern uint16_t			VNC_pointer_x;		///< Mouse coordinate X
-extern uint16_t			VNC_pointer_y;		///< Mouse coordinate Y
-
 const char 			*mashTypes[] = { "Infusion", "Temperature", "Decoction" };
 const char			*SSR2Types[] = { "Uit", "HLT of MLT", "HLT en MLT", "Idle" };
 
+uint8_t				WS_pressed = 0;		///< Websocket button received
+uint16_t			WS_pointer_x = 0;	///< Websocket coordinate x
+uint16_t			WS_pointer_y = 0;	///< Websocket coordinate y
 
 #define	EDIT_TYPE_TEXT		0			///< Editor type is text
 #define	EDIT_TYPE_INT		1			///< Editor type is integer
@@ -138,11 +137,12 @@
 	return rc;
     }
 
-    if (VNC_pointer_button & 0x07) {
+    if (WS_pressed) {
 	v_pressed = true;
-	vx = VNC_pointer_x;
-	vy = VNC_pointer_y;
-	return -1;
+        vx = WS_pointer_x;
+        vy = WS_pointer_y;
+	WS_pressed = 0;
+        return -1;
     } else if (v_pressed) {
 	rc = Buttons_Search(vx, vy);
 	v_pressed = false;
@@ -155,6 +155,15 @@
 
 
 
+void WS_touched(int x, int y)
+{
+    WS_pointer_x = x;
+    WS_pointer_y = y;
+    WS_pressed = 1;
+}
+
+
+
 static const uint8_t alphalow_tab[] = { 'q','w','e','r','t','y','u','i','o','p',
 					'a','s','d','f','g','h','j','k','l',
 					'z','x','c','v','b','n','m' };

mercurial