9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Jacob Moody <moody@posixcafe.org>
To: 9front@9front.org
Subject: Re: [9front] [PATCH] Fix shift release events in X11 drawterm with shift:both_capslock xmodmap option
Date: Fri, 28 Jun 2024 19:30:34 -0500	[thread overview]
Message-ID: <0e48ff1e-f33e-49ed-b40c-ea2f442e4c56@posixcafe.org> (raw)
In-Reply-To: <D2C1ZF3C3YRR.2AQJHJN1OMK9S@trbsw.dev>

On 6/28/24 18:53, Timothy Robert Bednarzyk wrote:
> I have recently started using 9front on a couple of different machines
> (including a native installation on my Thinkpad T470) and use drawterm
> on my main laptop (which uses the X11 window manager dwm on Artix Linux)
> to connect to one of them. However, on that laptop, I have the caps lock
> key remapped to be another control key (ctrl:no_caps) and I have it set
> to toggle caps lock when I press both shift keys at the same time
> (shift:both_capslock). As it turns out, when the latter xmodmap option
> is set, XLookupString interprets shift key release events as caps lock
> key release events. This was causing my middle and right mouse buttons
> to effectively be swapped permanently after pressing a shift key even
> once in a drawterm session (although I didn't know why it was happening
> until I did some research and found someone else mentioning them having
> shift-related problems in a different program whenever they were using
> shift:both_capslock).
> 
> I ended up solving this by utilizing the rather strange and unintuitive
> fact that the xkey event's state still has the ShiftMask bit set during
> the release event (even for actual shift key release events, according
> to what I found during my research) and using that to determine whether
> the release event should be interpreted as being for a shift key or for
> the caps lock key. This likely will cause the middle and right mouse
> buttons to unswap if the user is holding down the shift key while
> releasing the caps lock key, but considering how unlikely of a scenario
> that is and the fact that it is only a temporary and mild problem (all
> they would have to do is release and re-press the shift key), I think
> this fix is acceptable enough (unless someone else can think of a better
> solution, which I would greatly appreciate).

Seems reasonable to me. Thanks for debugging this.
My only suggestion would be to axe the "Not having this causes the mouse ...".
What it causes is the shift key to be held down, which then causes the mouse button swapping.
Drawterm itself isn't doing that bit, it's rio.

Thanks,
moody


  reply	other threads:[~2024-06-29  0:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28 23:53 Timothy Robert Bednarzyk
2024-06-29  0:30 ` Jacob Moody [this message]
2024-06-29 11:16   ` Timothy Robert Bednarzyk
2024-06-30 16:53     ` Jacob Moody
2024-06-30 19:22       ` Timothy Robert Bednarzyk
2024-06-29 16:31 ` hiro
2024-06-29 17:19   ` Timothy Robert Bednarzyk
2024-06-30 16:39     ` hiro
2024-06-30 19:08       ` Timothy Robert Bednarzyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e48ff1e-f33e-49ed-b40c-ea2f442e4c56@posixcafe.org \
    --to=moody@posixcafe.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).