Make win variable internal to x.c

There was only a single reference to the `win` variable in st.c, so
exporting that to x.c allows us to rid ourselves of another extern.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
master
Devin J. Pohly 7 years ago
parent 416dd25727
commit 323d38da20
  1. 6
      st.c
  2. 1
      st.h
  3. 1
      win.h
  4. 11
      x.c

@ -170,7 +170,6 @@ static char *base64dec(const char *);
static ssize_t xwrite(int, const char *, size_t); static ssize_t xwrite(int, const char *, size_t);
/* Globals */ /* Globals */
TermWindow win;
Term term; Term term;
Selection sel; Selection sel;
int cmdfd; int cmdfd;
@ -1683,11 +1682,8 @@ csihandle(void)
case ' ': case ' ':
switch (csiescseq.mode[1]) { switch (csiescseq.mode[1]) {
case 'q': /* DECSCUSR -- Set Cursor Style */ case 'q': /* DECSCUSR -- Set Cursor Style */
DEFAULT(csiescseq.arg[0], 1); if (xsetcursor(csiescseq.arg[0]))
if (!BETWEEN(csiescseq.arg[0], 0, 6)) {
goto unknown; goto unknown;
}
win.cursor = csiescseq.arg[0];
break; break;
default: default:
goto unknown; goto unknown;

@ -201,7 +201,6 @@ void *xrealloc(void *, size_t);
char *xstrdup(char *); char *xstrdup(char *);
/* Globals */ /* Globals */
extern TermWindow win;
extern Term term; extern Term term;
extern Selection sel; extern Selection sel;
extern int cmdfd; extern int cmdfd;

@ -14,5 +14,6 @@ void xhints(void);
void xloadcols(void); void xloadcols(void);
int xsetcolorname(int, const char *); int xsetcolorname(int, const char *);
void xsettitle(char *); void xsettitle(char *);
int xsetcursor(int);
void xsetpointermotion(int); void xsetpointermotion(int);
void xsetsel(char *, Time); void xsetsel(char *, Time);

11
x.c

@ -187,6 +187,7 @@ static void (*handler[LASTEvent])(XEvent *) = {
static DC dc; static DC dc;
static XWindow xw; static XWindow xw;
static XSelection xsel; static XSelection xsel;
static TermWindow win;
enum window_state { enum window_state {
WIN_VISIBLE = 1, WIN_VISIBLE = 1,
@ -1615,6 +1616,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 void
xseturgency(int add) xseturgency(int add)
{ {

Loading…
Cancel
Save