Compare commits

..

No commits in common. 'master' and 'anysize' have entirely different histories.

@ -5,8 +5,8 @@
* *
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/ */
static char *font = "Liberation Mono:pixelsize=14:antialias=true:autohint=true"; static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
static int borderpx = 3; static int borderpx = 2;
/* /*
* What program is execed by st depends of these precedence rules: * What program is execed by st depends of these precedence rules:
@ -96,24 +96,24 @@ unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */ /* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = { static const char *colorname[] = {
/* 8 normal colors */ /* 8 normal colors */
"#282828", "black",
"#cc241d", "red3",
"#98971a", "green3",
"#d79921", "yellow3",
"#458588", "blue2",
"#b16286", "magenta3",
"#689d61", "cyan3",
"#a89984", "gray90",
/* 8 bright colors */ /* 8 bright colors */
"#928374", "gray50",
"#fb4934", "red",
"#b8bb26", "green",
"#fabd2f", "yellow",
"#83a598", "#5c5cff",
"#d3869b", "magenta",
"#8ec07c", "cyan",
"#ebdbb2", "white",
[255] = 0, [255] = 0,
@ -191,9 +191,9 @@ static Shortcut shortcuts[] = {
{ ControlMask, XK_Print, toggleprinter, {.i = 0} }, { ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} }, { ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ TERMMOD, XK_K, zoom, {.f = +1} }, { TERMMOD, XK_Prior, zoom, {.f = +1} },
{ TERMMOD, XK_J, zoom, {.f = -1} }, { TERMMOD, XK_Next, zoom, {.f = -1} },
{ TERMMOD, XK_L, zoomreset, {.f = 0} }, { TERMMOD, XK_Home, zoomreset, {.f = 0} },
{ TERMMOD, XK_C, clipcopy, {.i = 0} }, { TERMMOD, XK_C, clipcopy, {.i = 0} },
{ TERMMOD, XK_V, clippaste, {.i = 0} }, { TERMMOD, XK_V, clippaste, {.i = 0} },
{ TERMMOD, XK_Y, selpaste, {.i = 0} }, { TERMMOD, XK_Y, selpaste, {.i = 0} },
@ -221,6 +221,7 @@ static Shortcut shortcuts[] = {
* this table sequentially, so any XK_ANY_MOD must be in the last * this table sequentially, so any XK_ANY_MOD must be in the last
* position for a key. * position for a key.
*/ */
/* /*
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF) * If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
* to be mapped below, add them to this array. * to be mapped below, add them to this array.

32
x.c

@ -104,11 +104,6 @@ typedef struct {
Draw draw; Draw draw;
Visual *vis; Visual *vis;
XSetWindowAttributes attrs; XSetWindowAttributes attrs;
/* Here, we use the term *pointer* to differentiate the cursor
* one sees when hovering the mouse over the terminal from, e.g.,
* a green rectangle where text would be entered. */
Cursor vpointer, bpointer; /* visible and hidden pointers */
int pointerisvisible;
int scr; int scr;
int isfixed; /* is fixed geometry? */ int isfixed; /* is fixed geometry? */
int l, t; /* left and top offset */ int l, t; /* left and top offset */
@ -706,13 +701,6 @@ brelease(XEvent *e)
void void
bmotion(XEvent *e) bmotion(XEvent *e)
{ {
if (!xw.pointerisvisible) {
XDefineCursor(xw.dpy, xw.win, xw.vpointer);
xw.pointerisvisible = 1;
if (!IS_SET(MODE_MOUSEMANY))
xsetpointermotion(0);
}
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) { if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) {
mousereport(e); mousereport(e);
return; return;
@ -1117,10 +1105,10 @@ void
xinit(int cols, int rows) xinit(int cols, int rows)
{ {
XGCValues gcvalues; XGCValues gcvalues;
Cursor cursor;
Window parent; Window parent;
pid_t thispid = getpid(); pid_t thispid = getpid();
XColor xmousefg, xmousebg; XColor xmousefg, xmousebg;
Pixmap blankpm;
if (!(xw.dpy = XOpenDisplay(NULL))) if (!(xw.dpy = XOpenDisplay(NULL)))
die("can't open display\n"); die("can't open display\n");
@ -1184,9 +1172,8 @@ xinit(int cols, int rows)
} }
/* white cursor, black outline */ /* white cursor, black outline */
xw.pointerisvisible = 1; cursor = XCreateFontCursor(xw.dpy, mouseshape);
xw.vpointer = XCreateFontCursor(xw.dpy, mouseshape); XDefineCursor(xw.dpy, xw.win, cursor);
XDefineCursor(xw.dpy, xw.win, xw.vpointer);
if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) { if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
xmousefg.red = 0xffff; xmousefg.red = 0xffff;
@ -1200,10 +1187,7 @@ xinit(int cols, int rows)
xmousebg.blue = 0x0000; xmousebg.blue = 0x0000;
} }
XRecolorCursor(xw.dpy, xw.vpointer, &xmousefg, &xmousebg); XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg);
blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1);
xw.bpointer = XCreatePixmapCursor(xw.dpy, blankpm, blankpm,
&xmousefg, &xmousebg, 0, 0);
xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
@ -1712,8 +1696,6 @@ unmap(XEvent *ev)
void void
xsetpointermotion(int set) xsetpointermotion(int set)
{ {
if (!set && !xw.pointerisvisible)
return;
MODBIT(xw.attrs.event_mask, set, PointerMotionMask); MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs); XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
} }
@ -1833,12 +1815,6 @@ kpress(XEvent *ev)
Status status; Status status;
Shortcut *bp; Shortcut *bp;
if (xw.pointerisvisible) {
XDefineCursor(xw.dpy, xw.win, xw.bpointer);
xsetpointermotion(1);
xw.pointerisvisible = 0;
}
if (IS_SET(MODE_KBDLOCK)) if (IS_SET(MODE_KBDLOCK))
return; return;

Loading…
Cancel
Save