Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
st.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implementing mouse focus and all events.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
2eb007b
..
321b58d
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-118,6
+118,7
@@
enum term_mode {
MODE_8BIT = 8192,
MODE_BLINK = 16384,
MODE_FBLINK = 32768,
MODE_8BIT = 8192,
MODE_BLINK = 16384,
MODE_FBLINK = 32768,
+ MODE_FOCUS = 65536,
};
enum escape_state {
};
enum escape_state {
@@
-780,7
+781,7
@@
getbuttoninfo(XEvent *e) {
sel.oe.x = x2col(e->xbutton.x);
sel.oe.y = y2row(e->xbutton.y);
sel.oe.x = x2col(e->xbutton.x);
sel.oe.y = y2row(e->xbutton.y);
- if (sel.ob.y < sel.oe.y
+ if(sel.ob.y < sel.oe.y
|| (sel.ob.y == sel.oe.y && sel.ob.x < sel.oe.x)) {
selsnap(sel.snap, &sel.ob.x, &sel.ob.y, -1);
selsnap(sel.snap, &sel.oe.x, &sel.oe.y, +1);
|| (sel.ob.y == sel.oe.y && sel.ob.x < sel.oe.x)) {
selsnap(sel.snap, &sel.ob.x, &sel.ob.y, -1);
selsnap(sel.snap, &sel.oe.x, &sel.oe.y, +1);
@@
-788,7
+789,6
@@
getbuttoninfo(XEvent *e) {
selsnap(sel.snap, &sel.oe.x, &sel.oe.y, -1);
selsnap(sel.snap, &sel.ob.x, &sel.ob.y, +1);
}
selsnap(sel.snap, &sel.oe.x, &sel.oe.y, -1);
selsnap(sel.snap, &sel.ob.x, &sel.ob.y, +1);
}
-
selsort();
sel.type = SEL_REGULAR;
selsort();
sel.type = SEL_REGULAR;
@@
-1099,7
+1099,7
@@
brelease(XEvent *e) {
selcopy();
}
sel.mode = 0;
selcopy();
}
sel.mode = 0;
- term.dirty[sel.oe.y] = 1;
+ tsetdirt(sel.nb.y, sel.ne.y);
}
}
}
}
@@
-1783,6
+1783,13
@@
tsetmode(bool priv, bool set, int *args, int narg) {
MODBIT(term.mode, set, MODE_MOUSEMOTION);
MODBIT(term.mode, 0, MODE_MOUSEBTN);
break;
MODBIT(term.mode, set, MODE_MOUSEMOTION);
MODBIT(term.mode, 0, MODE_MOUSEBTN);
break;
+ case 1003: /* 1003: enable all mouse reports */
+ MODBIT(term.mode, set, MODE_MOUSEMOTION);
+ MODBIT(term.mode, set, MODE_MOUSEBTN);
+ break;
+ case 1004:
+ MODBIT(term.mode, set, MODE_FOCUS);
+ break;
case 1006:
MODBIT(term.mode, set, MODE_MOUSESGR);
break;
case 1006:
MODBIT(term.mode, set, MODE_MOUSESGR);
break;
@@
-1808,6
+1815,9
@@
tsetmode(bool priv, bool set, int *args, int narg) {
case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
break;
case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
break;
+ case 9: /* X10 compatibility mode */
+ case 1001: /* mouse highlight mode; can hang the
+ terminal when implemented. */
default:
fprintf(stderr,
"erresc: unknown private set/reset mode %d\n",
default:
fprintf(stderr,
"erresc: unknown private set/reset mode %d\n",
@@
-3310,9
+3320,13
@@
focus(XEvent *ev) {
XSetICFocus(xw.xic);
xw.state |= WIN_FOCUSED;
xseturgency(0);
XSetICFocus(xw.xic);
xw.state |= WIN_FOCUSED;
xseturgency(0);
+ if(IS_SET(MODE_FOCUS))
+ ttywrite("\033[I", 3);
} else {
XUnsetICFocus(xw.xic);
xw.state &= ~WIN_FOCUSED;
} else {
XUnsetICFocus(xw.xic);
xw.state &= ~WIN_FOCUSED;
+ if(IS_SET(MODE_FOCUS))
+ ttywrite("\033[O", 3);
}
}
}
}