pinosaur
/
st.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
compose key patch. thx federico luna.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
c9d0fb8
..
d1b90ef
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-107,6
+107,8
@@
typedef struct {
Colormap cmap;
Window win;
Pixmap buf;
Colormap cmap;
Window win;
Pixmap buf;
+ XIM xim;
+ XIC xic;
int scr;
int w; /* window width */
int h; /* window height */
int scr;
int w; /* window width */
int h; /* window height */
@@
-114,7
+116,7
@@
typedef struct {
int bufh; /* pixmap height */
int ch; /* char height */
int cw; /* char width */
int bufh; /* pixmap height */
int ch; /* char height */
int cw; /* char width */
- int
has
focus;
+ int focus;
int vis; /* is visible */
} XWindow;
int vis; /* is visible */
} XWindow;
@@
-1043,7
+1045,7
@@
tputc(char c) {
tnewline();
break;
case '\a':
tnewline();
break;
case '\a':
- if(!xw.
has
focus)
+ if(!xw.focus)
xseturgency(1);
break;
case '\033':
xseturgency(1);
break;
case '\033':
@@
-1228,6
+1230,13
@@
xinit(void) {
| CWColormap,
&attrs);
xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr));
| CWColormap,
&attrs);
xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr));
+
+
+ /* input methods */
+ xw.xim = XOpenIM(xw.dis, NULL, NULL, NULL);
+ xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing
+ | XIMStatusNothing, XNClientWindow, xw.win,
+ XNFocusWindow, xw.win, NULL);
/* gc */
dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL);
/* gc */
dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL);
@@
-1286,7
+1295,7
@@
xdrawcursor(void) {
xclear(oldx, oldy, oldx, oldy);
/* draw the new one */
xclear(oldx, oldy, oldx, oldy);
/* draw the new one */
- if(!(term.c.state & CURSOR_HIDE) && xw.
has
focus) {
+ if(!(term.c.state & CURSOR_HIDE) && xw.focus) {
xdraws(&g.c, g, term.c.x, term.c.y, 1);
oldx = term.c.x, oldy = term.c.y;
}
xdraws(&g.c, g, term.c.x, term.c.y, 1);
oldx = term.c.x, oldy = term.c.y;
}
@@
-1388,7
+1397,7
@@
xseturgency(int add) {
void
focus(XEvent *ev) {
void
focus(XEvent *ev) {
- if((xw.
has
focus = ev->type == FocusIn))
+ if((xw.focus = ev->type == FocusIn))
xseturgency(0);
draw(SCREEN_UPDATE);
}
xseturgency(0);
draw(SCREEN_UPDATE);
}
@@
-1411,10
+1420,11
@@
kpress(XEvent *ev) {
int len;
int meta;
int shift;
int len;
int meta;
int shift;
+ Status status;
meta = e->state & Mod1Mask;
shift = e->state & ShiftMask;
meta = e->state & Mod1Mask;
shift = e->state & ShiftMask;
- len = X
LookupString(e, buf, sizeof(buf), &ksym, NULL
);
+ len = X
mbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status
);
if((customkey = kmap(ksym)))
ttywrite(customkey, strlen(customkey));
if((customkey = kmap(ksym)))
ttywrite(customkey, strlen(customkey));
@@
-1484,6
+1494,8
@@
run(void) {
}
while(XPending(xw.dis)) {
XNextEvent(xw.dis, &ev);
}
while(XPending(xw.dis)) {
XNextEvent(xw.dis, &ev);
+ if (XFilterEvent(&ev, xw.win))
+ continue;
if(handler[ev.type])
(handler[ev.type])(&ev);
}
if(handler[ev.type])
(handler[ev.type])(&ev);
}