diff options
author | zachir <zachir@librem.one> | 2023-02-21 14:30:34 -0600 |
---|---|---|
committer | zachir <zachir@librem.one> | 2023-02-21 14:30:34 -0600 |
commit | ee4eee0e05b567fe72f94eabcec9656a096625bc (patch) | |
tree | af857dbbee2fae2f7ff2674750c0871b24c753b5 /patches/dmenu-mousesupporthoverbgcol-5.0.diff | |
parent | 0e8723fdc24c099954f6356f22d1a1df47eddb20 (diff) | |
parent | 96e4a549ce8b3da7d5d339a94487bb2849520ae7 (diff) |
merge master to version 5.25.2
Diffstat (limited to 'patches/dmenu-mousesupporthoverbgcol-5.0.diff')
-rw-r--r-- | patches/dmenu-mousesupporthoverbgcol-5.0.diff | 184 |
1 files changed, 0 insertions, 184 deletions
diff --git a/patches/dmenu-mousesupporthoverbgcol-5.0.diff b/patches/dmenu-mousesupporthoverbgcol-5.0.diff deleted file mode 100644 index 1fb7d41..0000000 --- a/patches/dmenu-mousesupporthoverbgcol-5.0.diff +++ /dev/null @@ -1,184 +0,0 @@ -Only in .: config.h -diff -up ../dmenu-5.0/dmenu.c ./dmenu.c ---- ../dmenu-5.0/dmenu.c Wed Sep 2 18:37:07 2020 -+++ ./dmenu.c Wed Nov 4 15:25:27 2020 -@@ -501,6 +501,156 @@ draw: - } - - static void -+buttonpress(XEvent *e) -+{ -+ struct item *item; -+ XButtonPressedEvent *ev = &e->xbutton; -+ int x = 0, y = 0, h = bh, w; -+ -+ if (ev->window != win) -+ return; -+ -+ /* right-click: exit */ -+ if (ev->button == Button3) -+ exit(1); -+ -+ if (prompt && *prompt) -+ x += promptw; -+ -+ /* input field */ -+ w = (lines > 0 || !matches) ? mw - x : inputw; -+ -+ /* left-click on input: clear input, -+ * NOTE: if there is no left-arrow the space for < is reserved so -+ * add that to the input width */ -+ if (ev->button == Button1 && -+ ((lines <= 0 && ev->x >= 0 && ev->x <= x + w + -+ ((!prev || !curr->left) ? TEXTW("<") : 0)) || -+ (lines > 0 && ev->y >= y && ev->y <= y + h))) { -+ insert(NULL, -cursor); -+ drawmenu(); -+ return; -+ } -+ /* middle-mouse click: paste selection */ -+ if (ev->button == Button2) { -+ XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, -+ utf8, utf8, win, CurrentTime); -+ drawmenu(); -+ return; -+ } -+ /* scroll up */ -+ if (ev->button == Button4 && prev) { -+ sel = curr = prev; -+ calcoffsets(); -+ drawmenu(); -+ return; -+ } -+ /* scroll down */ -+ if (ev->button == Button5 && next) { -+ sel = curr = next; -+ calcoffsets(); -+ drawmenu(); -+ return; -+ } -+ if (ev->button != Button1) -+ return; -+ /* disabled below, needs to be fixed */ -+ /* -+ if (ev->state & ~ControlMask) -+ return; -+ */ -+ if (lines > 0) { -+ /* vertical list: (ctrl)left-click on item */ -+ w = mw - x; -+ for (item = curr; item != next; item = item->right) { -+ y += h; -+ if (ev->y >= y && ev->y <= (y + h)) { -+ puts(item->text); -+ if (!(ev->state & ControlMask)) -+ exit(0); -+ sel = item; -+ if (sel) { -+ sel->out = 1; -+ drawmenu(); -+ } -+ return; -+ } -+ } -+ } else if (matches) { -+ /* left-click on left arrow */ -+ x += inputw; -+ w = TEXTW("<"); -+ if (prev && curr->left) { -+ if (ev->x >= x && ev->x <= x + w) { -+ sel = curr = prev; -+ calcoffsets(); -+ drawmenu(); -+ return; -+ } -+ } -+ /* horizontal list: (ctrl)left-click on item */ -+ for (item = curr; item != next; item = item->right) { -+ x += w; -+ w = MIN(TEXTW(item->text), mw - x - TEXTW(">")); -+ if (ev->x >= x && ev->x <= x + w) { -+ puts(item->text); -+ if (!(ev->state & ControlMask)) -+ exit(0); -+ sel = item; -+ if (sel) { -+ sel->out = 1; -+ drawmenu(); -+ } -+ return; -+ } -+ } -+ /* left-click on right arrow */ -+ w = TEXTW(">"); -+ x = mw - w; -+ if (next && ev->x >= x && ev->x <= x + w) { -+ sel = curr = next; -+ calcoffsets(); -+ drawmenu(); -+ return; -+ } -+ } -+} -+ -+static void -+mousemove(XEvent *e) -+{ -+ struct item *item; -+ XPointerMovedEvent *ev = &e->xmotion; -+ int x = 0, y = 0, h = bh, w; -+ -+ if (lines > 0) { -+ w = mw - x; -+ for (item = curr; item != next; item = item->right) { -+ y += h; -+ if (ev->y >= y && ev->y <= (y + h)) { -+ sel = item; -+ calcoffsets(); -+ drawmenu(); -+ return; -+ } -+ } -+ } else if (matches) { -+ x += inputw; -+ w = TEXTW("<"); -+ for (item = curr; item != next; item = item->right) { -+ x += w; -+ w = MIN(TEXTW(item->text), mw - x - TEXTW(">")); -+ if (ev->x >= x && ev->x <= x + w) { -+ sel = item; -+ calcoffsets(); -+ drawmenu(); -+ return; -+ } -+ } -+ } -+} -+ -+static void - paste(void) - { - char *p, *q; -@@ -561,6 +711,12 @@ run(void) - break; - cleanup(); - exit(1); -+ case ButtonPress: -+ buttonpress(&ev); -+ break; -+ case MotionNotify: -+ mousemove(&ev); -+ break; - case Expose: - if (ev.xexpose.count == 0) - drw_map(drw, win, 0, 0, mw, mh); -@@ -658,7 +814,8 @@ setup(void) - /* create menu window */ - swa.override_redirect = True; - swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; -- swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; -+ swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | -+ ButtonPressMask | PointerMotionMask; - win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, - CopyFromParent, CopyFromParent, CopyFromParent, - CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); |