[wiki] [sites] [dwm][patch] holdbar: fixed flickering caused by repeated key events || Nihal Jere

From: <git_AT_suckless.org>
Date: Tue, 10 Mar 2020 17:33:07 +0100

commit 8a90692b8a7be5bab76a579688bd1aa4ead935c9
Author: Nihal Jere <nihal_AT_nihaljere.xyz>
Date: Tue Mar 10 11:31:44 2020 -0500

    [dwm][patch] holdbar: fixed flickering caused by repeated key events

diff --git a/dwm.suckless.org/patches/holdbar/dwm-holdbar-6.2.diff b/dwm.suckless.org/patches/holdbar/dwm-holdbar-6.2.diff
index bcad100b..1bac03f3 100644
--- a/dwm.suckless.org/patches/holdbar/dwm-holdbar-6.2.diff
+++ b/dwm.suckless.org/patches/holdbar/dwm-holdbar-6.2.diff
_AT_@ -1,13 +1,3 @@
-From 5c1a4a448007664439350ed645206198411eb9d1 Mon Sep 17 00:00:00 2001
-From: hsszyman <hsszyman_AT_gmail.com>
-Date: Wed, 3 Jul 2019 23:32:57 -0400
-Subject: [PATCH] Fixed broken bottom bar and removed key hardcoding
-
----
- config.def.h |  2 ++
- dwm.c        | 40 ++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 42 insertions(+)
-
 diff --git a/config.def.h b/config.def.h
 index 1c0b587..0e19b5d 100644
 --- a/config.def.h
_AT_@ -29,7 +19,7 @@ index 1c0b587..0e19b5d 100644
  
  /* button definitions */
 diff --git a/dwm.c b/dwm.c
-index 4465af1..4237031 100644
+index 4465af1..9437707 100644
 --- a/dwm.c
 +++ b/dwm.c
 _AT_@ -176,6 +176,7 @@ static void grabbuttons(Client *c, int focused);
_AT_@ -72,7 +62,7 @@ index 4465af1..4237031 100644
  	[KeyPress] = keypress,
  	[MappingNotify] = mappingnotify,
  	[MapRequest] = maprequest,
-_AT_@ -275,6 +280,41 @@ static Window root, wmcheckwin;
+_AT_@ -275,6 +280,51 @@ static Window root, wmcheckwin;
  struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
  
  /* function implementations */
_AT_@ -90,7 +80,17 @@ index 4465af1..4237031 100644
 +void
 +keyrelease(XEvent *e)
 +{
-+	if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)){
++	if (XEventsQueued(dpy, QueuedAfterReading)) {
++		XEvent ne;
++		XPeekEvent(dpy, &ne);
++
++		if (ne.type == KeyPress && ne.xkey.time == e->xkey.time &&
++				ne.xkey.keycode == e->xkey.keycode) {
++			XNextEvent(dpy, &ne);
++			return;
++		}
++	}
++	if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)) {
 +		selmon->showbar = 0;
 +		updateholdbarpos(selmon);
 +		XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
_AT_@ -114,6 +114,3 @@ index 4465af1..4237031 100644
  void
  applyrules(Client *c)
  {
--- 
-2.22.0
-
diff --git a/dwm.suckless.org/patches/holdbar/index.md b/dwm.suckless.org/patches/holdbar/index.md
index fdf2a3e5..49b30d93 100644
--- a/dwm.suckless.org/patches/holdbar/index.md
+++ b/dwm.suckless.org/patches/holdbar/index.md
_AT_@ -18,3 +18,4 @@ Download
 Author
 ------
 * Hayden Szymanski <hsszyman_AT_gmail.com>
+* Nihal Jere <nihal_AT_nihaljere.xyz> (fixed flickering)
Received on Tue Mar 10 2020 - 17:33:07 CET

This archive was generated by hypermail 2.3.0 : Tue Mar 10 2020 - 17:36:51 CET