Re: [dev] [dmenu][bug report] Second instance invisible

2023-09-24 Thread viatatribal
>On Sat, 23 Sep 2023 18:27:01 +0100
>Christopher Lang  wrote:

> Are you able to reproduce this problem on your machine with the
> following in .xinitrc?
>   xcompmgr -n -f -I 0.1 -O 0.1 -D 8 &
> 
I was able to reproduce this problem by including that line in .xinitrc. By 
changing values, I could see that if you set -D to 2, the second instance will 
show up, any value above that will make the second instance invisible. By 
removing "-O 0.1", the second instance opens but then becomes invisible.


-- 
Urek "viatatribal" Hohenstaufen 



Re: [dev] [dmenu][bug report] Second instance invisible

2023-09-23 Thread Christopher Lang


Tom Schwindl  writes:

> I too cannot reproduce this with the latest commit "7ab0cb5ef0e1", neither
> on OpenBSD nor on void linux. It would be useful to know which patches you've
> applied and what the contents of your config.h actually are.
>
> Have you already tried to use the current master with default settings?

Please see my response to NRK (https://lists.suckless.org/dev/2309/35430.html)
for updated information about how to reproduce (my .xinitrc was to blame).

When I say my config.h is equal to config.def.h, I mean that my config.h
is the same as config.def.h in the current git master (default settings).
I have no patches applied.



Re: [dev] [dmenu][bug report] Second instance invisible

2023-09-23 Thread Christopher Lang


NRK  writes:

> On Fri, Sep 22, 2023 at 12:22:25PM +0100, Christopher Lang wrote:
>> I'm guessing that when the second dmenu opens, the first one is still
>> fading out and this stops XCreateIC from working as intended?
>
> Worth noting that according to the docs XCreateIC() may return NULL -
> something that isn't checked for in dmenu. Perhaps you're getting a NULL
> ic due to your config? Does the attached patch make any difference?

My config.h is the same as config.def.h and I have no patches (appart
from this one you provided) applied.

>
> - NRK
>
> [2. text/plain; 0001-check-for-XCreateIC-failure.patch]...

The patch makes no difference, XCreateIC must be returning something.

Are you able to reproduce this problem on your machine with the
following in .xinitrc?
  xcompmgr -n -f -I 0.1 -O 0.1 -D 8 &

--
Christopher



Re: [dev] [dmenu][bug report] Second instance invisible

2023-09-22 Thread NRK
On Fri, Sep 22, 2023 at 12:22:25PM +0100, Christopher Lang wrote:
> I'm guessing that when the second dmenu opens, the first one is still
> fading out and this stops XCreateIC from working as intended?

Worth noting that according to the docs XCreateIC() may return NULL -
something that isn't checked for in dmenu. Perhaps you're getting a NULL
ic due to your config? Does the attached patch make any difference?

- NRK
>From defc910ce1fa51e3031af19abae8c70b3b8b8106 Mon Sep 17 00:00:00 2001
From: NRK 
Date: Fri, 22 Sep 2023 23:42:10 +0600
Subject: [PATCH] check for XCreateIC failure

---
 dmenu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dmenu.c b/dmenu.c
index 40f93e0..a38e7b5 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -696,6 +696,8 @@ setup(void)
 
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, win, XNFocusWindow, win, NULL);
+   if (xic == NULL)
+   die("XCreateIC failed");
 
XMapRaised(dpy, win);
if (embed) {
-- 
2.41.0



Re: [dev] [dmenu][bug report] Second instance invisible

2023-09-22 Thread Christopher Lang


NRK  writes:
> On Thu, Sep 21, 2023 at 02:02:12PM +0100, Christopher Lang wrote:
>> I run the following shell command:
>>   seq 2 | dmenu && seq 3 | dmenu
>> The first dmenu instance opens as expected. I hit the enter key and a 1
>> is printed. However, the second dmenu instance does not appear.
>
> Cannot reproduce on my system, tried on unpatched master branch and v5.2.
> The 2nd dmenu instance appears just fine after the first one closes.
>
> If you can consistently reproduce, then attach gdb to the 2nd instance
> (via `gdb --pid`) and try to inspect what might be going wrong compared
> to a non-buggy case.
>
> - NRK

I have discovered that the following line in my .xinitrc was causing the
problem.
  xcompmgr -n -f -I 0.1 -O 0.1 -D 8 &
Specifically, the fading effects (-f,-I,-O,-D). With these disabled,
dmenu works fine.

I tried attaching gdb to the second instance using the method you
described, but it just sits on XNextEvent. And if I start the second
dmenu with gdb already attached (i.e. seq 2 | dmenu && seq 3 | gdb dmenu),
then the additional delay before the second dmenu opening means the
error wont occur.

I'm guessing that when the second dmenu opens, the first one is still
fading out and this stops XCreateIC from working as intended?

--
Christopher



Re: [dev] [dmenu][bug report] Second instance invisible

2023-09-22 Thread Tom Schwindl
On Thu, Sep 21, 2023 at 02:02:12PM +0100, Christopher Lang wrote:
> 
> I have experienced the following bug on both arch linux and void linux.
> dmenu and dwm are both installed with config.h equal to config.def.h.
> 
> I run the following shell command:
>   seq 2 | dmenu && seq 3 | dmenu
> The first dmenu instance opens as expected. I hit the enter key and a 1
> is printed. However, the second dmenu instance does not appear. It
> remains invisible, but still accepts my keyboard input, behaving as if
> it were visible. I hit enter again, what I typed is printed and the
> shell command terminates with exit code 0.
> 

I too cannot reproduce this with the latest commit "7ab0cb5ef0e1", neither
on OpenBSD nor on void linux. It would be useful to know which patches you've
applied and what the contents of your config.h actually are.

Have you already tried to use the current master with default settings?

-- 
Best Regards,
Tom Schwindl



Re: [dev] [dmenu][bug report] Second instance invisible

2023-09-22 Thread NRK
On Thu, Sep 21, 2023 at 02:02:12PM +0100, Christopher Lang wrote:
> I run the following shell command:
>   seq 2 | dmenu && seq 3 | dmenu
> The first dmenu instance opens as expected. I hit the enter key and a 1
> is printed. However, the second dmenu instance does not appear.

Cannot reproduce on my system, tried on unpatched master branch and v5.2.
The 2nd dmenu instance appears just fine after the first one closes.

If you can consistently reproduce, then attach gdb to the 2nd instance
(via `gdb --pid`) and try to inspect what might be going wrong compared
to a non-buggy case.

- NRK



[dev] [dmenu][bug report] Second instance invisible

2023-09-21 Thread Christopher Lang


I have experienced the following bug on both arch linux and void linux.
dmenu and dwm are both installed with config.h equal to config.def.h.

I run the following shell command:
  seq 2 | dmenu && seq 3 | dmenu
The first dmenu instance opens as expected. I hit the enter key and a 1
is printed. However, the second dmenu instance does not appear. It
remains invisible, but still accepts my keyboard input, behaving as if
it were visible. I hit enter again, what I typed is printed and the
shell command terminates with exit code 0.

By trial and error, I found that adding a 'sleep(1);' line into dmenu.c
before the existing XCreateIC call in the setup function will cause the
second dmenu instance to become visible after the 1 seconds
pause. However, if the 'sleep(1);' line is added after the XCreateIC
call, then the second dmenu instance will remain invisible even after
the 1 second. This suggests the problem is related to the creation of
the input context, but I don't know enough about XLib to fix this
problem on my own.

PS. I noticed there is no call to XDestroyIC, is this intentional?

--
Christopher