Introduction
Introduction Statistics Contact Development Disclaimer Help
Merge pull request #2 from siebenmann/mouse-chords - sam - An updated version o…
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 984f79a82438440d89427d683000a4056f6cbd07
parent c0e7b09dcf26f2ce827dfcb1a646809618f74396
Author: Rob King <[email protected]>
Date: Tue, 4 Aug 2015 21:51:22 -0500
Merge pull request #2 from siebenmann/mouse-chords
Add acme/wily like chorded mouse buttons
Diffstat:
libframe/frselect.c | 2 +-
samterm/flayer.c | 12 +++++++++---
samterm/main.c | 23 ++++++++++++++++++++++-
3 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/libframe/frselect.c b/libframe/frselect.c
@@ -42,7 +42,7 @@ frselect(Frame *f, Mouse *m) /* when called, button 1 …
else
f->p0 = p1, f->p1 = p0;
frgetmouse();
- }while(m->buttons & 1);
+ }while((m->buttons & 7) == 1);
}
/* it is assumed p0<=p1 and both were generated by frptofchar() */
void
diff --git a/samterm/flayer.c b/samterm/flayer.c
@@ -236,15 +236,21 @@ flselect(Flayer *l)
int ret = 0;
if(l->visible!=All)
flupfront(l);
+ if(mouse.msec-l->click<Clicktime)
+ ret = 1;
frselect(&l->f, &mouse);
if(l->f.p0==l->f.p1){
- if(mouse.msec-l->click<Clicktime && l->f.p0+l->origin==l->p0){
+ if(ret == 1 && l->f.p0+l->origin==l->p0){
ret = 1;
l->click = 0;
- }else
+ }else {
+ ret = 0;
l->click = mouse.msec;
- }else
+ }
+ }else {
+ ret = 0;
l->click = 0;
+ }
l->p0 = l->f.p0+l->origin, l->p1 = l->f.p1+l->origin;
return ret;
}
diff --git a/samterm/main.c b/samterm/main.c
@@ -21,6 +21,7 @@ long typeesc = -1;
long modified = 0; /* strange lookahead for menus */
char lock = 1;
char hasunlocked = 0;
+int chord = 0;
char *machine = "localhost";
void
@@ -83,7 +84,11 @@ main(int argc, char *argv[])
scr = which && ptinrect(mouse.xy, which->scroll);
if(mouse.buttons)
flushtyping(1);
- if(mouse.buttons&1){
+ if (chord == 1 && !mouse.buttons)
+ chord = 0;
+ if (chord)
+ chord |= mouse.buttons;
+ else if(mouse.buttons&1){
if(nwhich){
if(nwhich!=which)
current(nwhich);
@@ -96,6 +101,8 @@ main(int argc, char *argv[])
t->lock++;
}else if(t!=&cmd)
outcmd();
+ if(mouse.buttons&1)
+ chord = mouse.buttons;
}
}
}else if((mouse.buttons&2) && which){
@@ -111,6 +118,20 @@ main(int argc, char *argv[])
}
mouseunblock();
}
+ if(chord) {
+ t = (Text *)which->user1;
+ if(!t->lock){
+ int w = which-t->l;
+ if(chord&2){
+ cut(t, w, 1, 1);
+ chord &= ~2;
+ }
+ if(chord&4){
+ paste(t, w);
+ chord &= ~4;
+ }
+ }
+ }
}
}
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.