From 58363833ce933924ef340eb53f0caa4d0d1f6ae5 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Thu, 15 Feb 2024 22:20:34 +0000 Subject: implement mousedown, mouseup, mouseclick, and mousescroll events --- guifs.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'guifs.h') diff --git a/guifs.h b/guifs.h index abfb81e..1121c3c 100644 --- a/guifs.h +++ b/guifs.h @@ -23,6 +23,17 @@ enum { enum { Horizontal, Vertical, + Up, + Down, +}; + +enum { + Xmousedown, + Xmouseup, + Xmouseclick, + Xmousescroll, + Xkeyboard, + Xmax, }; typedef struct Colour Colour; @@ -67,7 +78,12 @@ struct Prop { }; struct Event { - Rune r; + int type; + union { + Mouse m; + Rune r; + int direction; + }; }; struct GuiSpec { @@ -90,7 +106,6 @@ struct GuiElement { Qid qevent; Qid qtype; Qid qprops; - Qid qwait; int nchildren; GuiElement **children; @@ -100,9 +115,10 @@ struct GuiElement { int nprops; Prop *props; - int listening; /* the user is reading from the 'event' file */ + uvlong listening; /* the user is reading from the 'event' file. Bitmask of which events are wanted */ Channel *events; char *currentevents; + int buttons; Rectangle border; Rectangle rect; @@ -131,5 +147,5 @@ void layouttextbox(GuiElement *, Rectangle); PropVal getprop(GuiElement *, int, int); void setprop(GuiElement *, int, PropVal, int); -int mouseevent(int); +int mouseevent(Mouse); int keyboardevent(Rune); \ No newline at end of file -- cgit v1.2.3