~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 4

[PATCH sxmo-dmenu 0/1] Touch-and-Slide Menu Item Highlighting + Release-to-Select

~tetrakist
Details
Message ID
<160930813781.27627.8919990727770782889-0@git.sr.ht>
DKIM signature
missing
Download raw message
This patch allows the user to touch a menu item and then slide up or
down to highlight the desired item, and then select the item upon
release of the touch.

tetrakist (1):
  Perform menu actions on ButtonRelease event rather than ButtonPress.

 dmenu.c | 39 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)

-- 
2.26.2

[PATCH sxmo-dmenu 1/1] Perform menu actions on ButtonRelease event rather than ButtonPress.

~tetrakist
Details
Message ID
<160930813781.27627.8919990727770782889-1@git.sr.ht>
In-Reply-To
<160930813781.27627.8919990727770782889-0@git.sr.ht> (view parent)
DKIM signature
missing
Download raw message
Patch: +36 -3
From: tetrakist <tetrakist@mutandum.com>

---
 dmenu.c | 39 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)

diff --git a/dmenu.c b/dmenu.c
index d34acc7..7ffcc85 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -617,6 +617,36 @@ draw:
	drawmenu();
}

static void
motionnotify(XEvent *e)
{
	struct item *item;
	XMotionEvent *ev = &e->xmotion;
	int x = 0, y = 0, h = bh, w;

	if (ev->window != win){
		return;
	}

	if (ev->state & ~Button1Mask)
		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)) {
				sel = item;
				drawmenu();
				return;
			}
		}
	} 
	return;
}


static void
buttonpress(XEvent *e)
{
@@ -671,7 +701,7 @@ buttonpress(XEvent *e)
	}
	if (ev->button != Button1)
		return;
	if (ev->state & ~ControlMask)
	if (ev->state & ~ControlMask & ~Button1Mask)
		return;
	if (lines > 0) {
		/* vertical list: (ctrl)left-click on item */
@@ -786,7 +816,10 @@ run(void)
		if (XFilterEvent(&ev, None))
			continue;
		switch(ev.type) {
		case ButtonPress:
		case MotionNotify:
			motionnotify(&ev);
			break;
		case ButtonRelease:
			buttonpress(&ev);
			break;
		case Expose:
@@ -900,7 +933,7 @@ setup(void)
	/* create menu window */
	swa.override_redirect = managed ? False : True;
	swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
	swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | ButtonPressMask;
	swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask;
	win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width,
	                    CopyFromParent, CopyFromParent, CopyFromParent,
	                    CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
-- 
2.26.2

Re: [PATCH sxmo-dmenu 1/1] Perform menu actions on ButtonRelease event rather than ButtonPress.

Details
Message ID
<871rf7vn3p.fsf@momi.ca>
In-Reply-To
<160930813781.27627.8919990727770782889-1@git.sr.ht> (view parent)
DKIM signature
missing
Download raw message
I have been using this patch for the past couple of days and it works
perfectly. It especially improves the touch user experience on smaller
ui elements (ie. files).

The only thing left to decide is: do we want to have a environmental
variable that will decide whether this is enabled?

I like the patch as is and dont want to add more environmental variables
but I won't merge until there has been sufficient discussion from the
community.

Thanks for the patch ~tetrakist!
-- 
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt

Re: [PATCH sxmo-dmenu 1/1] Perform menu actions on ButtonRelease event rather than ButtonPress.

Details
Message ID
<20201230091528.25k4sg3ms35fxu63@worker.anaproy.lxd>
In-Reply-To
<871rf7vn3p.fsf@momi.ca> (view parent)
DKIM signature
missing
Download raw message
On 20-12-30 06:12, Anjandev Momi wrote:
> I have been using this patch for the past couple of days and it works
> perfectly. It especially improves the touch user experience on smaller
> ui elements (ie. files).
>
> The only thing left to decide is: do we want to have a environmental
> variable that will decide whether this is enabled?
>
> I like the patch as is and dont want to add more environmental variables
> but I won't merge until there has been sufficient discussion from the
> community.

Great work! I think this patch is a definite improvement over the old behaviour so
I don't think it needs to be made opt-in with an environment variable.

--

Maarten van Gompel (proycon)
https://proycon.anaproy.nl

Re: [PATCH sxmo-dmenu 1/1] Perform menu actions on ButtonRelease event rather than ButtonPress.

Details
Message ID
<1def3ace-9345-45b0-8342-eb9bc5235949@www.fastmail.com>
In-Reply-To
<20201230091528.25k4sg3ms35fxu63@worker.anaproy.lxd> (view parent)
DKIM signature
pass
Download raw message
On Wed, Dec 30, 2020, at 4:15 AM, Maarten van Gompel wrote:
> On 20-12-30 06:12, Anjandev Momi wrote:
> > I have been using this patch for the past couple of days and it works
> > perfectly. It especially improves the touch user experience on smaller
> > ui elements (ie. files).
> >
> > The only thing left to decide is: do we want to have a environmental
> > variable that will decide whether this is enabled?
> >
> > I like the patch as is and dont want to add more environmental variables
> > but I won't merge until there has been sufficient discussion from the
> > community.
> 
> Great work! I think this patch is a definite improvement over the old 
> behaviour so
> I don't think it needs to be made opt-in with an environment variable.
> 
> --
> 
> Maarten van Gompel (proycon)
> https://proycon.anaproy.nl
>

Thanks tetrakist! This is a huge UX gain.. applied.

When you can also please push up to http://git.suckless.org/sites/ so
this is also available to the wider suckless community.

Will hold back on tagging a version number for sxmo-dmenu for now
as work on pipe logic for dmenu is pending (let's figure out what escape
codes we want there) and let's have the next sxmo-dmenu release both
include the work on buttonpress/release & the pipe logic.

Miles
Reply to thread Export thread (mbox)