diff options
| author | Quentin Carbonneaux | 2014-07-16 14:34:11 -0400 |
|---|---|---|
| committer | Quentin Carbonneaux | 2014-07-16 14:34:11 -0400 |
| commit | 3d270e7b19513d773e112bc8069de9f7c39cc766 (patch) | |
| tree | 88673205d5d40eba5f65c9e5e041fec248776093 | |
| parent | 2462b94decf44621c999fcdbd3ff64e849bdbbfb (diff) | |
add x11 code for mouse selection
| -rw-r--r-- | gui.h | 3 | ||||
| -rw-r--r-- | main.c | 2 | ||||
| -rw-r--r-- | x11.c | 11 |
3 files changed, 12 insertions, 4 deletions
@@ -39,7 +39,8 @@ struct gevent { enum { GResize, GKey, - GMouse, + GMouseClick, + GMouseSelect, } type; union { @@ -51,7 +51,7 @@ main(int ac, char *av[]) } scrolling = 0; break; - case GMouse: + case GMouseClick: if (e.mouse.button == GBLeft) win_set_cursor(curwin, e.mouse.x, e.mouse.y); break; @@ -56,7 +56,7 @@ init() swa.bit_gravity = NorthWestGravity; XChangeWindowAttributes(d, win, CWBackingStore|CWBitGravity, &swa); XStoreName(d, win, "ED"); - XSelectInput(d, win, StructureNotifyMask|ButtonPressMask|KeyPressMask|ExposureMask); + XSelectInput(d, win, StructureNotifyMask|ButtonPressMask|Button1MotionMask|KeyPressMask|ExposureMask); /* simulate an initial resize and map the window */ ce.type = ConfigureNotify; @@ -193,8 +193,15 @@ nextevent(GEvent *gev) gev->resize.height = h; break; + case MotionNotify: + gev->type = GMouseSelect; + gev->mouse.button = GBLeft; + gev->mouse.x = e.xmotion.x; + gev->mouse.y = e.xmotion.y; + break; + case ButtonPress: - gev->type = GMouse; + gev->type = GMouseClick; switch (e.xbutton.button) { case Button1: |
