From 64effed4381ed0738c5df19fca761123c08da674 Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Fri, 10 Jul 2015 14:01:38 +0000 Subject: [PATCH] Added new mouse events git-svn-id: svn://kolibrios.org@5572 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/lib/kolibri.h | 50 +++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index 9afcaa86bf..415f38733e 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -32,6 +32,11 @@ char program_path[4096]; #define BT_HIDE 0x40000000 #define BT_NOFRAME 0x20000000 +//Button mouse +#define MOUSE_LEFT 100b +#define MOUSE_RIGHT 001b +#define MOUSE_CENTER 010b + //ASCII KEYS #define ASCII_KEY_BS 008 #define ASCII_KEY_TAB 009 @@ -57,9 +62,23 @@ char program_path[4096]; dword w, h, data; }; +/** + * The structure of the mouse + * x - coordinate X + * ó - coordinate Ó + * xx and yy - time coordinates + * lkm - left mouse button + * pkm - right mouse button + * mkm - mouse wheel + * key - keycode button + * tmp - time keycode + * down - key event press + * up - key release events + * move - event mouse movements + */ :struct mouse { - signed x,y,lkm,mkm,pkm,hor,vert; + signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,hor,vert,down,up,move; void get(); }; @@ -80,6 +99,7 @@ char program_path[4096]; $int 0x40 $mov ebx, eax $mov ecx, eax + key = EAX; $and eax, 0x00000001 $shr ebx, 1 $and ebx, 0x00000001 @@ -88,6 +108,34 @@ char program_path[4096]; lkm = EAX; pkm = EBX; mkm = ECX; + + //when you release the mouse button + if((down)&&!(key)){ + up = true; + down = false; + + //returns the key code + key = tmp; + lkm = 1&tmp; + pkm = 2&tmp; + pkm >>= 1; + mkm = 4&tmp; + mkm >>= 2; + } + + //when you press the mouse button + else { + up = false; + down = key; + if(down)tmp=key; + if((xx!=x)||(yy!=y)){ + move = true; + xx = x; + yy = y; + } + else move = false; + } + EAX = 37; //áªà®«« EBX = 7; $int 0x40