From 9032af968da2691b5fa8e95fbb7d892d75936739 Mon Sep 17 00:00:00 2001
From: speedie
Date: Thu, 11 May 2023 19:53:23 +0200
Subject: [PATCH] don't allow drawing images until KeyRelease event
---
README.html | 3 ---
README.md | 3 ---
libs/event.c | 13 +++++--------
3 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/README.html b/README.html
index cc643f5..b20a397 100644
--- a/README.html
+++ b/README.html
@@ -314,9 +314,6 @@ issues!
MD5() is deprecated as of OpenSSL 3.0, but this would also make it very
easy to have LibreSSL compatibility.
Image support: Ability to display icons, similar to rofi
-Image support: Images take a long time to load sometimes,
-particularly when items are selected using the cursor so what we really
-need is a way to skip over images after a set time limit.
Text drawing: Use cairo for text drawing over Xft.
Lines: Rofi-like newlines in the same entry
diff --git a/README.md b/README.md
index 6ce3624..73b25cb 100644
--- a/README.md
+++ b/README.md
@@ -122,9 +122,6 @@ Pull requests would be greatly appreciated for any of these issues!
is deprecated as of OpenSSL 3.0, but this would also make it very easy to
have LibreSSL compatibility.
- Image support: Ability to display icons, similar to rofi
-- Image support: Images take a long time to load sometimes, particularly when
-items are selected using the cursor so what we really need is a way to
-skip over images after a set time limit.
- Text drawing: Use cairo for text drawing over Xft.
- Lines: Rofi-like newlines in the same entry
- Just need to `XMoveResizeWindow()` as well as `mh += bh` and `y += bh`
diff --git a/libs/event.c b/libs/event.c
index e8365d2..68e61c4 100644
--- a/libs/event.c
+++ b/libs/event.c
@@ -1,8 +1,6 @@
void eventloop(void) {
XEvent ev;
-#if USEIMAGE
int noimg = 0;
-#endif
while (!XNextEvent(dpy, &ev)) {
if (XFilterEvent(&ev, None))
@@ -16,9 +14,7 @@ void eventloop(void) {
exit(1);
case ButtonPress:
buttonpress(&ev);
-#if USEIMAGE
noimg = 0;
-#endif
break;
case MotionNotify: // currently does nothing
break;
@@ -38,6 +34,7 @@ void eventloop(void) {
}
keypress(&ev);
+ noimg = 1;
break;
case SelectionNotify: // paste selection
if (ev.xselection.property == utf8)
@@ -50,6 +47,7 @@ void eventloop(void) {
case KeyRelease:
getcapsstate();
drawmenu();
+ noimg = 0;
break;
}
@@ -70,12 +68,11 @@ void eventloop(void) {
}
// redraw image on X11 event
+ if (!noimg)
#if USEIMAGE
- if (!noimg) {
drawimage();
- } else {
- noimg = 0; // draw it next time
- }
+#else
+ ;
#endif
}
}