X11 Button Event not Reported

I have a peculiar problem (aren't they all?). A new program that uses X11 fails to get any ButtonRelease event reported to it after the XNextEvent call. That is, mouse clicks don't work. The program gets others, such as exposure and keyboard events, but not button press or release. Other programs running on the same hardware obviously do get all mouse clicks. Compounding the problem, this failure occurs under Ubuntu and Mint, but all events are reported under Raspbian -- that is, under Raspbian the failure does not occur.

This is the setup instruction:

i = XSelectInput(dpy,win, ExposureMask | KeyPressMask |
        ButtonReleaseMask | KeyReleaseMask);

After issuance i contains 1.

I've read (seemingly relevant parts of) the X11 manual without gaining a clue. I'm hoping that someone else has experienced this problem and found the cause.

Would this question be more appropriate in another group? Which one?

--rLsj

I am no Ubuntu expert, but i remember darkly about Ubuntu and Mint both not using X11 any more but thing called "Wayland". Might it be that it has to do with this?

I hope this helps.

bakunin

Loaded Debian onto my long-suffering, ten-year-old HP Pavilion and, you guessed it, it failed also. That was my last hope. I had to get inventive.

Which I did. And fixed it, although the fix leaves a bad taste. I inserted a call to XGrabButton just before the call to XNextEvent. Now it works, would you believe! Mouse clicks are delivered to the program.

Note that it works under Raspbian without grabbing the button. And absolutely no indication appears in the X11 manual -- or the man pages -- that seems to require it. Other coders might want to take notice.

Might I next find a distro that requires XGrabKey?

Distasteful.

--rLsj

(Note to Moderator: Your "hint" about code tags, "co" over "de", is not informative.)

Moderator comments were removed during original forum migration.

A little follow-on to my last post for coders who might be interested. The XGrabButton call that solves the problem under Debian fails under Raspbian with the message, "trying to access private resources." As usual I have no idea which resources or why they're private. And the "BADACCESS" code returned is not even mentioned on the XGrabButton man page.

It appears there'll be two versions of the program: one for Raspbian with another for Debian and probably everyone else.

--rLsj

1 Like