summaryrefslogtreecommitdiffstats
path: root/x.c
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-02-06 02:14:51 +0100
committersalmonik <raisersoft@proton.me>2026-02-06 02:14:51 +0100
commit931e5010d51d1640c61034ada767715a544fa40b (patch)
tree46bd0b5c046a4aaf14c7a571425a745d2d12be2b /x.c
parentscrollback (diff)
downloadst-931e5010d51d1640c61034ada767715a544fa40b.tar.gz
st-931e5010d51d1640c61034ada767715a544fa40b.zip
apply scrollback patch and urlclick patch
Diffstat (limited to '')
-rw-r--r--x.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/x.c b/x.c
index d50c0c4..fbb7891 100644
--- a/x.c
+++ b/x.c
@@ -193,6 +193,7 @@ static void usage(void);
193 193
194static void (*handler[LASTEvent])(XEvent *) = { 194static void (*handler[LASTEvent])(XEvent *) = {
195 [KeyPress] = kpress, 195 [KeyPress] = kpress,
196 [KeyRelease] = kpress,
196 [ClientMessage] = cmessage, 197 [ClientMessage] = cmessage,
197 [ConfigureNotify] = resize, 198 [ConfigureNotify] = resize,
198 [VisibilityNotify] = visibility, 199 [VisibilityNotify] = visibility,
@@ -455,6 +456,15 @@ mouseaction(XEvent *e, uint release)
455 /* ignore Button<N>mask for Button<N> - it's set on release */ 456 /* ignore Button<N>mask for Button<N> - it's set on release */
456 uint state = e->xbutton.state & ~buttonmask(e->xbutton.button); 457 uint state = e->xbutton.state & ~buttonmask(e->xbutton.button);
457 458
459 if (release == 0 &&
460 e->xbutton.button == Button1 &&
461 (match(ControlMask, state) ||
462 match(ControlMask, state & ~forcemousemod))) {
463 followurl(evrow(e), evcol(e));
464 return 1;
465 }
466
467
458 for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { 468 for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
459 if (ms->release == release && 469 if (ms->release == release &&
460 ms->button == e->xbutton.button && 470 ms->button == e->xbutton.button &&
@@ -1498,7 +1508,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
1498 XftDrawGlyphFontSpec(xw.draw, fg, specs, len); 1508 XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
1499 1509
1500 /* Render underline and strikethrough. */ 1510 /* Render underline and strikethrough. */
1501 if (base.mode & ATTR_UNDERLINE) { 1511 if (base.mode & ATTR_UNDERLINE || base.mode & ATTR_URL) {
1502 XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1, 1512 XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1,
1503 width, 1); 1513 width, 1);
1504 } 1514 }
@@ -1880,6 +1890,18 @@ kpress(XEvent *ev)
1880 } else { 1890 } else {
1881 len = XLookupString(e, buf, sizeof buf, &ksym, NULL); 1891 len = XLookupString(e, buf, sizeof buf, &ksym, NULL);
1882 } 1892 }
1893
1894 /* 0. highlight URLs when control held */
1895 if (ksym == XK_Control_L) {
1896 highlighturls();
1897 } else if (ev->type == KeyRelease && e->keycode == XKeysymToKeycode(e->display, XK_Control_L)) {
1898 unhighlighturls();
1899 }
1900
1901 /* KeyRelease not relevant to shortcuts */
1902 if (ev->type == KeyRelease)
1903 return;
1904
1883 /* 1. shortcuts */ 1905 /* 1. shortcuts */
1884 for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) { 1906 for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
1885 if (ksym == bp->keysym && match(bp->mod, e->state)) { 1907 if (ksym == bp->keysym && match(bp->mod, e->state)) {