aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2013-06-01 13:06:53 +0200
committerChristoph Lohmann <20h@r-36.net>2013-06-01 13:06:53 +0200
commit405fd89ac1d333be79325417c973a07ccad67453 (patch)
tree5e887eb5906c5088b602ab494948508faf8a866e
parent8315dc417982936186837edfac24420d0d0e516e (diff)
downloadst-405fd89ac1d333be79325417c973a07ccad67453.tar.gz
st-405fd89ac1d333be79325417c973a07ccad67453.tar.bz2
Implementing mouse focus and all events.
-rw-r--r--st.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/st.c b/st.c
index 3fcf543..321b58d 100644
--- a/st.c
+++ b/st.c
@@ -118,6 +118,7 @@ enum term_mode {
MODE_8BIT = 8192,
MODE_BLINK = 16384,
MODE_FBLINK = 32768,
+ MODE_FOCUS = 65536,
};
enum escape_state {
@@ -1782,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;
+ 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;
@@ -1807,6 +1815,9 @@ tsetmode(bool priv, bool set, int *args, int narg) {
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",
@@ -3309,9 +3320,13 @@ focus(XEvent *ev) {
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;
+ if(IS_SET(MODE_FOCUS))
+ ttywrite("\033[O", 3);
}
}