-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: hackvr
action: commit
revision:
path_from:
revision_from: a56b739dcde3cba228a5be6150bbfa525a56eebb:
path_to:
revision_to:

git.thebackupbox.net

hackvr

git://git.thebackupbox.net/hackvr

commit a56b739dcde3cba228a5be6150bbfa525a56eebb
Author: epoch <epoch@hacking.allowed.org>
Date:   Mon Jan 27 18:00:00 2020 -0600

    added scroll-wheel handling for X11 mouse and removed camera rotation from mouse movement

diff --git a/src/mouse_x11.c b/src/mouse_x11.c

index c70ea1a23f0c2c6f6a71723ea02e1080f23173fe..

index ..0c4f1e994299a0cf98ff3ce70a1e092203b18ce9 100644

--- a/src/mouse_x11.c
+++ b/src/mouse_x11.c
@@ -4,7 +4,7 @@
 #include "graphics_c2.h"
 #include "graphics_x11.h"

-extern struct global global;
+extern struct hvr_global global;
 extern struct gra_global gra_global;
 extern struct x11_global x11_global;

@@ -20,13 +20,22 @@ int mouse_event_handler() {//this returns HVM_ key + for buttondown and - for bu
   char redrawplzkthx=0;
   cs_t mouse;
   cs_t rmouse;
+//  char cmd[512];
   while(XCheckMaskEvent(x11_global.dpy,HV_MOUSE_X11_EVENT_MASK,&e)) {//we want to collapse mouse stuff to one for each loop.
     switch(e.type) {
-      case ButtonPress: //e.xbutton.button == 1 for first button. we don't need to start at 1. let's start at 0 with the -1
+      case ButtonPress: //e.xbutton.button == 1 for first button. we don't need to start at 1. let's start at 0 with the -1 //scroll wheel up is 3, down is 4
+        if(e.xbutton.button == 4) {//scroll wheel up
+          selfcommand("epoch move forward\n");//need to implement this syntax in hackvr
+        }
+        if(e.xbutton.button == 5) {//scroll wheel down
+          selfcommand("epoch move backward\n");
+        }
+        printf("# button press %d\n",e.xbutton.button-1);
         gra_global.mousemap[e.xbutton.button-1]=1;
         redrawplzkthx=1;
         break;
       case ButtonRelease:
+        printf("# button release %d\n",e.xbutton.button-1);
         gra_global.mousemap[e.xbutton.button-1]=-1;//we can trigger on -1 or on 1 then set back to 0 to prevent double-trigger
         redrawplzkthx=1;
         break;
@@ -45,6 +54,9 @@ int mouse_event_handler() {//this returns HVM_ key + for buttondown and - for bu
     //return 1;
     //we're not going to set camera based on mousex and y here.
     //but just so I can get it out of the graphics code...
+    //self-command myself to rotate myself?
+    //snprintf(cmd,sizeof(cmd),"%s rotate +%d +%d +%d\n",global.user,3,11,1);
+    //selfcommand(cmd);
     //global.camera.r.x.d=((gra_global.height/2) - gra_global.mouse.y);
     //global.camera.r.y.d=(gra_global.mouse.x - (gra_global.width/2));
   }

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 17:00:06 2024