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
working on old repo, merging recent changesets.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
6f292ba
..
c295de6
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-47,6
+47,8
@@
#define ESC_ARG_SIZ 16
#define DRAW_BUF_SIZ 1024
#define UTF_SIZ 4
#define ESC_ARG_SIZ 16
#define DRAW_BUF_SIZ 1024
#define UTF_SIZ 4
+#define XK_NO_MOD UINT_MAX
+#define XK_ANY_MOD 0
#define SERRNO strerror(errno)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SERRNO strerror(errno)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
@@
-124,6
+126,7
@@
typedef struct {
Colormap cmap;
Window win;
Pixmap buf;
Colormap cmap;
Window win;
Pixmap buf;
+ Atom xembed;
XIM xim;
XIC xic;
int scr;
XIM xim;
XIC xic;
int scr;
@@
-268,7
+271,6
@@
static char **opt_cmd = NULL;
static char *opt_title = NULL;
static char *opt_embed = NULL;
static char *opt_class = NULL;
static char *opt_title = NULL;
static char *opt_embed = NULL;
static char *opt_class = NULL;
-static Atom xembedatom;
int
utf8decode(char *s, long *u) {
int
utf8decode(char *s, long *u) {
@@
-1671,7
+1673,7
@@
xinit(void) {
&(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff},
&(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
&(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff},
&(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
- xembedatom = XInternAtom(xw.dpy, "_XEMBED", False);
+ xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
XStoreName(xw.dpy, xw.win, opt_title ? opt_title : "st");
XMapWindow(xw.dpy, xw.win);
XStoreName(xw.dpy, xw.win, opt_title ? opt_title : "st");
XMapWindow(xw.dpy, xw.win);
@@
-1840,9
+1842,12
@@
focus(XEvent *ev) {
char*
kmap(KeySym k, unsigned int state) {
int i;
char*
kmap(KeySym k, unsigned int state) {
int i;
- for(i = 0; i < LEN(key); i++)
- if(key[i].k == k && (key[i].mask == 0 || key[i].mask & state))
+ state &= ~Mod2Mask;
+ for(i = 0; i < LEN(key); i++) {
+ unsigned int mask = key[i].mask;
+ if(key[i].k == k && ((state & mask) == mask || (mask == XK_NO_MOD && !state)))
return (char*)key[i].s;
return (char*)key[i].s;
+ }
return NULL;
}
return NULL;
}
@@
-1898,7
+1903,9
@@
kpress(XEvent *ev) {
void
cmessage(XEvent *e) {
void
cmessage(XEvent *e) {
- if (e->xclient.message_type == xembedatom && e->xclient.format == 32) {
+ /* See xembed specs
+ http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html */
+ if (e->xclient.message_type == xw.xembed && e->xclient.format == 32) {
if (e->xclient.data.l[1] == XEMBED_FOCUS_IN) {
xw.state |= WIN_FOCUSED;
xseturgency(0);
if (e->xclient.data.l[1] == XEMBED_FOCUS_IN) {
xw.state |= WIN_FOCUSED;
xseturgency(0);