Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
FAQ: fix a typo, patch -> path
[st.git]
/
x.c
diff --git
a/x.c
b/x.c
index
120e495
..
8a16faa
100644
(file)
--- a/
x.c
+++ b/
x.c
@@
-48,7
+48,7
@@
typedef struct {
/* X modifiers */
#define XK_ANY_MOD UINT_MAX
#define XK_NO_MOD 0
/* X modifiers */
#define XK_ANY_MOD UINT_MAX
#define XK_NO_MOD 0
-#define XK_SWITCH_MOD (1<<13)
+#define XK_SWITCH_MOD (1<<13
|1<<14
)
/* function definitions used in config.h */
static void clipcopy(const Arg *);
/* function definitions used in config.h */
static void clipcopy(const Arg *);
@@
-156,7
+156,7
@@
static void xresize(int, int);
static void xhints(void);
static int xloadcolor(int, const char *, Color *);
static int xloadfont(Font *, FcPattern *);
static void xhints(void);
static int xloadcolor(int, const char *, Color *);
static int xloadfont(Font *, FcPattern *);
-static void xloadfonts(char *, double);
+static void xloadfonts(c
onst c
har *, double);
static void xunloadfont(Font *);
static void xunloadfonts(void);
static void xsetenv(void);
static void xunloadfont(Font *);
static void xunloadfonts(void);
static void xsetenv(void);
@@
-387,7
+387,9
@@
mousereport(XEvent *e)
button = 3;
} else {
button -= Button1;
button = 3;
} else {
button -= Button1;
- if (button >= 3)
+ if (button >= 7)
+ button += 128 - 7;
+ else if (button >= 3)
button += 64 - 3;
}
if (e->xbutton.type == ButtonPress) {
button += 64 - 3;
}
if (e->xbutton.type == ButtonPress) {
@@
-797,6
+799,19
@@
xloadcols(void)
loaded = 1;
}
loaded = 1;
}
+int
+xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b)
+{
+ if (!BETWEEN(x, 0, dc.collen))
+ return 1;
+
+ *r = dc.col[x].color.red >> 8;
+ *g = dc.col[x].color.green >> 8;
+ *b = dc.col[x].color.blue >> 8;
+
+ return 0;
+}
+
int
xsetcolorname(int x, const char *name)
{
int
xsetcolorname(int x, const char *name)
{
@@
-950,7
+965,7
@@
xloadfont(Font *f, FcPattern *pattern)
}
void
}
void
-xloadfonts(char *fontstr, double fontsize)
+xloadfonts(c
onst c
har *fontstr, double fontsize)
{
FcPattern *pattern;
double fontval;
{
FcPattern *pattern;
double fontval;
@@
-958,7
+973,7
@@
xloadfonts(char *fontstr, double fontsize)
if (fontstr[0] == '-')
pattern = XftXlfdParse(fontstr, False, False);
else
if (fontstr[0] == '-')
pattern = XftXlfdParse(fontstr, False, False);
else
- pattern = FcNameParse((FcChar8 *)fontstr);
+ pattern = FcNameParse((
const
FcChar8 *)fontstr);
if (!pattern)
die("can't open font %s\n", fontstr);
if (!pattern)
die("can't open font %s\n", fontstr);
@@
-1586,8
+1601,9
@@
xseticontitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
XTextProperty prop;
DEFAULT(p, opt_title);
- Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
- &prop);
+ if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+ &prop) != Success)
+ return;
XSetWMIconName(xw.dpy, xw.win, &prop);
XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmiconname);
XFree(prop.value);
XSetWMIconName(xw.dpy, xw.win, &prop);
XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmiconname);
XFree(prop.value);
@@
-1599,8
+1615,9
@@
xsettitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
XTextProperty prop;
DEFAULT(p, opt_title);
- Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
- &prop);
+ if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+ &prop) != Success)
+ return;
XSetWMName(xw.dpy, xw.win, &prop);
XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname);
XFree(prop.value);
XSetWMName(xw.dpy, xw.win, &prop);
XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname);
XFree(prop.value);