diff options
-rw-r--r-- | graphics.c | 4 | ||||
-rw-r--r-- | guifs.h | 24 | ||||
-rw-r--r-- | guispec.c | 1 | ||||
-rw-r--r-- | layout.c | 1 | ||||
-rw-r--r-- | main.c | 16 | ||||
-rw-r--r-- | props.c | 1 |
6 files changed, 26 insertions, 21 deletions
@@ -172,14 +172,14 @@ guiproc(void *) mousexy = mouse->Mouse.xy; if(!root) break; - if(mouseevent(mouse->Mouse.buttons)) + if(mouseevent(mouse->Mouse)) resized(0); break; case Akeyboard: if(!root) break; if(keyboardevent(r)) - resized(1); + resized(0); break; } } @@ -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 @@ -2,6 +2,7 @@ #include <libc.h> #include <draw.h> #include <thread.h> +#include <mouse.h> #include "guifs.h" @@ -2,6 +2,7 @@ #include <libc.h> #include <draw.h> #include <thread.h> +#include <mouse.h> #include "guifs.h" @@ -4,6 +4,7 @@ #include <thread.h> #include <9p.h> #include <draw.h> +#include <mouse.h> #include "guifs.h" @@ -23,7 +24,6 @@ enum { Qclone, Qevent, Qtype, - Qwait, Qprops, Qprop, @@ -33,7 +33,6 @@ enum { Fclone, Fevent, Ftype, - Fwait, Fprops, Fmax, }; @@ -101,7 +100,6 @@ mkqid(int type) case Qclone: case Qevent: case Qtype: - case Qwait: q.type = QTFILE; break; } @@ -159,7 +157,6 @@ newgui(GuiElement *parent) g->qevent = mkqid(Qevent); g->qtype = mkqid(Qtype); g->qprops = mkqid(Qprops); - g->qwait = mkqid(Qwait); g->events = chancreate(sizeof(char *), 0); @@ -239,8 +236,6 @@ fswalk1(Fid *fid, char *name, Qid *qid) *qid = g->qtype; else if(strcmp(name, "props") == 0) *qid = g->qprops; - else if(strcmp(name, "wait") == 0) - *qid = g->qwait; else if(child = findchild(g, name)){ fid->aux = child; *qid = child->qid; @@ -290,7 +285,6 @@ fsopen(Req *r) case Qevent: case Qclone: case Qprops: - case Qwait: if(r->ifcall.mode != OREAD){ err = Eperm; goto Lend; @@ -379,11 +373,6 @@ dirtreegen(int n, Dir *d, void *aux) d->name = estrdup9p("type"); d->qid = g->qtype; break; - case Fwait: - d->mode = 0444; - d->name = estrdup9p("wait"); - d->qid = g->qwait; - break; case Fprops: d->mode = 0555|DMDIR; d->name = estrdup9p("props"); @@ -500,9 +489,6 @@ Lgotevent: currentsize = g->currentevents ? strlen(g->currentevents) : 0; runlock(&g->lock); readstr(r, buf); break; - case Qwait: - /* intentionally left blank */ - return; case Qprops: dirread9p(r, proptreegen, g); break; @@ -5,6 +5,7 @@ #include <fcall.h> #include <thread.h> #include <9p.h> +#include <mouse.h> #include "guifs.h" |