pinosaur
/
st.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rely on ttyresize to set tty size
[st.git]
/
x.c
diff --git
a/x.c
b/x.c
index
24f6991
..
7bfa1b7
100644
(file)
--- a/
x.c
+++ b/
x.c
@@
-44,6
+44,11
@@
typedef struct {
signed char crlf; /* crlf mode */
} Key;
signed char crlf; /* crlf mode */
} Key;
+/* X modifiers */
+#define XK_ANY_MOD UINT_MAX
+#define XK_NO_MOD 0
+#define XK_SWITCH_MOD (1<<13)
+
/* function definitions used in config.h */
static void clipcopy(const Arg *);
static void clippaste(const Arg *);
/* function definitions used in config.h */
static void clipcopy(const Arg *);
static void clippaste(const Arg *);
@@
-148,7
+153,7
@@
static void propnotify(XEvent *);
static void selnotify(XEvent *);
static void selclear_(XEvent *);
static void selrequest(XEvent *);
static void selnotify(XEvent *);
static void selclear_(XEvent *);
static void selrequest(XEvent *);
-static void se
lcopy(
Time);
+static void se
tsel(char *,
Time);
static void getbuttoninfo(XEvent *);
static void mousereport(XEvent *);
static char *kmap(KeySym, uint);
static void getbuttoninfo(XEvent *);
static void mousereport(XEvent *);
static char *kmap(KeySym, uint);
@@
-187,6
+192,7
@@
static void (*handler[LASTEvent])(XEvent *) = {
static DC dc;
static XWindow xw;
static XSelection xsel;
static DC dc;
static XWindow xw;
static XSelection xsel;
+static TermWindow win;
enum window_state {
WIN_VISIBLE = 1,
enum window_state {
WIN_VISIBLE = 1,
@@
-270,7
+276,6
@@
zoomabs(const Arg *arg)
xunloadfonts();
xloadfonts(usedfont, arg->f);
cresize(0, 0);
xunloadfonts();
xloadfonts(usedfont, arg->f);
cresize(0, 0);
- ttyresize(win.tw, win.th);
redraw();
xhints();
}
redraw();
xhints();
}
@@
-439,12
+444,6
@@
bpress(XEvent *e)
}
}
}
}
-void
-selcopy(Time t)
-{
- xsetsel(getsel(), t);
-}
-
void
propnotify(XEvent *e)
{
void
propnotify(XEvent *e)
{
@@
-619,7
+618,7
@@
selrequest(XEvent *e)
}
void
}
void
-
x
setsel(char *str, Time t)
+setsel(char *str, Time t)
{
free(sel.primary);
sel.primary = str;
{
free(sel.primary);
sel.primary = str;
@@
-629,6
+628,12
@@
xsetsel(char *str, Time t)
selclear_(NULL);
}
selclear_(NULL);
}
+void
+xsetsel(char *str)
+{
+ setsel(str, CurrentTime);
+}
+
void
brelease(XEvent *e)
{
void
brelease(XEvent *e)
{
@@
-642,7
+647,7
@@
brelease(XEvent *e)
} else if (e->xbutton.button == Button1) {
if (sel.mode == SEL_READY) {
getbuttoninfo(e);
} else if (e->xbutton.button == Button1) {
if (sel.mode == SEL_READY) {
getbuttoninfo(e);
- se
lcopy(
e->xbutton.time);
+ se
tsel(getsel(),
e->xbutton.time);
} else
selclear_(NULL);
sel.mode = SEL_IDLE;
} else
selclear_(NULL);
sel.mode = SEL_IDLE;
@@
-689,6
+694,7
@@
cresize(int width, int height)
tresize(col, row);
xresize(col, row);
tresize(col, row);
xresize(col, row);
+ ttyresize(win.tw, win.th);
}
void
}
void
@@
-1615,6
+1621,16
@@
xsetpointermotion(int set)
XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
}
XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
}
+int
+xsetcursor(int cursor)
+{
+ DEFAULT(cursor, 1);
+ if (!BETWEEN(cursor, 0, 6))
+ return 1;
+ win.cursor = cursor;
+ return 0;
+}
+
void
xseturgency(int add)
{
void
xseturgency(int add)
{
@@
-1778,7
+1794,6
@@
resize(XEvent *e)
return;
cresize(e->xconfigure.width, e->xconfigure.height);
return;
cresize(e->xconfigure.width, e->xconfigure.height);
- ttyresize(win.tw, win.th);
}
void
}
void
@@
-1807,9
+1822,8
@@
run(void)
}
} while (ev.type != MapNotify);
}
} while (ev.type != MapNotify);
- cresize(w, h);
ttynew(opt_line, opt_io, opt_cmd);
ttynew(opt_line, opt_io, opt_cmd);
-
ttyresize(win.tw, win.t
h);
+
cresize(w,
h);
clock_gettime(CLOCK_MONOTONIC, &last);
lastblink = last;
clock_gettime(CLOCK_MONOTONIC, &last);
lastblink = last;