summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2019-08-03 07:48:43 -0500
committerepoch <epoch@hacking.allowed.org>2019-08-03 07:48:43 -0500
commit18fbe373c1f3f3b0762cc57b0b1588cdaef92ada (patch)
tree87be9e6f2f9d7c07acbe87f18d4e438929f99d5e /src
parentc614c2dcc97a14364b75e8b4a63cdd1140f52ecf (diff)
downloadhackvr-18fbe373c1f3f3b0762cc57b0b1588cdaef92ada.tar.gz
hackvr-18fbe373c1f3f3b0762cc57b0b1588cdaef92ada.zip
made mouse presses redraw. new function not worth mentioning
Diffstat (limited to 'src')
-rw-r--r--src/mouse_x11.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mouse_x11.c b/src/mouse_x11.c
index 6cb1490..c70ea1a 100644
--- a/src/mouse_x11.c
+++ b/src/mouse_x11.c
@@ -8,24 +8,34 @@ extern struct global global;
extern struct gra_global gra_global;
extern struct x11_global x11_global;
+int mouse_init() {
+ return x11_global.fd;
+}
+
int mouse_event_handler() {//this returns HVM_ key + for buttondown and - for buttonup... set the mousex and mousey in here?
XEvent e;
Window root,child;//just dimmies
unsigned int mask;//just dummies
char motion_notify=0;
+ char redrawplzkthx=0;
cs_t mouse;
cs_t rmouse;
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
gra_global.mousemap[e.xbutton.button-1]=1;
+ redrawplzkthx=1;
break;
case ButtonRelease:
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;
case MotionNotify:
motion_notify=1;
+ redrawplzkthx=1;
break;
+ default://fuck if I know
+ break;
}
}
if(motion_notify) {
@@ -37,6 +47,9 @@ int mouse_event_handler() {//this returns HVM_ key + for buttondown and - for bu
//but just so I can get it out of the graphics code...
//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));
+ }
+ if(redrawplzkthx) {
+ redraw();
return 1;
}
return 0;