From 18fbe373c1f3f3b0762cc57b0b1588cdaef92ada Mon Sep 17 00:00:00 2001 From: epoch Date: Sat, 3 Aug 2019 07:48:43 -0500 Subject: made mouse presses redraw. new function not worth mentioning --- src/mouse_x11.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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; -- cgit v1.2.3