9front - general discussion about 9front
 help / color / mirror / Atom feed
From: "José Miguel Sánchez García" <soy.jmi2k@gmail.com>
To: 9front@9front.org
Subject: Re: [9front] Mouse clipping patch
Date: Tue, 13 Jul 2021 05:14:40 +0200	[thread overview]
Message-ID: <CAA85C87qdQe6Bj6E4XvGwgOd7_cgQOJ4Yiv8tRhL4pEzzMTqQQ@mail.gmail.com> (raw)
In-Reply-To: <8CE29EA89CBA8F74C1D4D8EEF2528473@eigenstate.org>

Let's see if I can do this quote thing correctly:

First of all: I'm aware of some bugs (and you pointed out others)!
I'll send the corrected patchset tomorrow.
The naming scheme is a bit messy as a result of a dropped feature.
I'll improve it too.

> Don't do this to vncv! Not grabbing the mouse makes it
> much more usable.

I'm aware of someone who will respectfully disagree :-)

> For the other programs that can use it, I assume the
> patches will follow up once we're happy with this patch
> set?

Sure, they'll come later. I wanted to keep them separated from these.

> Not sure that this is necessary. Your mouse being
> constrained to the window is probably enough hint.

Keep in mind that the border changes not only for the window currently
grabbing the window, but for any non-current window "grabbing" it too
(even if it doesn't apply because it's not focused). The different
border color serves as an indicator that, when you focus it, it will
grab your mouse. It might avoid an unpleasant surprise. However, if
you feel like it's redundant, it can be easily removed.

> But also, do we need to do it? Is there any case
> where we want to constrain the grab to anything
> other than the whole window? What if the ctl
> messages were just
>
>         trap
>         release
>
> with no further parameters?

The point of allowing arbitrary clip rects is to make the grabbing
program unaware of the existence of a window manager. Rio itself would
be an example of a program which doesn't grab the whole "window" (the
whole screen), but only subrects of it. In order to maintain an
uniform interface which works regardless of the presence of rio or
not, I've decided to go down the simplest route and just allow any
subrect of the whole screen to be clipped. It didn't require more code
or more complex handling, and it even allows future programs to take
advantage of this feature.

Hope it makes sense!

On Tue, Jul 13, 2021 at 4:53 AM <ori@eigenstate.org> wrote:
>
> Quoth José Miguel Sánchez García <soy.jmi2k@gmail.com>:
> > think about vncv, qwx's quake ports, screenlock
>
> Don't do this to vncv! Not grabbing the mouse makes it
> much more usable.
>
> For the other programs that can use it, I assume the
> patches will follow up once we're happy with this patch
> set?
>
> > - Windows holding the mouse have a different border color,
> > so they can be clearly identified.
>
> Not sure that this is necessary. Your mouse being
> constrained to the window is probably enough hint.
>
> > +                     write(mousectl->mctlfd, x->data, cnt);
>
> This will hide all errors from the write, so
> a malformed mousectl message will get silently
> dropped.
>
> > +extern int           clipmouse(Mousectl*, Rectangle);
> > +extern void          releasemouse(Mousectl*);
>
> This naming lacks symmetry.
>
> How about constrainmouse()/releasemouse()?
> Or if you feel cute: mousetrap()/mouserelease()?
>
> Same with the ctl messages: trap/release, or clip/unclip?
>
> > +                     grabr.min.x = strtol(x->data+4, &p, 0);
> > +                     if(p == nil){
>
> This isn't how strtol behaves -- if it can't convert
> the number, it leaves p untouched. you need to do:
>
>         grabr.min.x = strtol(p, &e, 0);
>         if(p == e || *e != ' ')
>                 // error
>         p = e;
>
> You can probably clean it up a bit with tokenize(),
> and then ensure that *e == '\0':
>
>         if(tokenize(x->data+4, coords, 4) != 4)
>                 error()
>         n = strtol(coords[0], &e, 0);
>         if(*e != 0)
>                 error()
>
> But also, do we need to do it? Is there any case
> where we want to constrain the grab to anything
> other than the whole window? What if the ctl
> messages were just
>
>         trap
>         release
>
> with no further parameters?
>

  parent reply	other threads:[~2021-07-13  3:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 19:50 José Miguel Sánchez García
2021-07-13  2:36 ` ori
2021-07-13  2:45   ` ori
2021-07-13 14:03     ` Stuart Morrow
2021-08-11  0:56       ` Stuart Morrow
2021-07-13  3:14   ` José Miguel Sánchez García [this message]
2021-07-13  8:25     ` hiro
2021-07-13 10:27       ` José Miguel Sánchez García
2021-07-13 14:05         ` Stuart Morrow
     [not found]           ` <CAFSF3XPhDeKiKXdsL0Abnderm45Uc2GCPYsi6ygSaBkf7gDBmA@mail.gmail.com>
2021-07-13 15:09             ` José Miguel Sánchez García
2021-07-13 15:34               ` José Miguel Sánchez García
2021-07-14 12:04                 ` Stuart Morrow
2021-07-15  2:06                   ` Xiao-Yong Jin
2021-07-13 15:11             ` Stuart Morrow
2021-07-13 16:16               ` José Miguel Sánchez García
2021-07-13 16:27                 ` Stuart Morrow
2021-07-13 17:42                   ` José Miguel Sánchez García
2021-07-13 21:20                     ` hiro
2021-07-13 21:57                     ` ori
2021-07-14 11:55                       ` Stuart Morrow
2021-07-13 17:26                 ` Xiao-Yong Jin
2021-07-13 17:45                   ` Stuart Morrow
2021-07-13 18:29                   ` José Miguel Sánchez García
2021-07-13 21:32                     ` hiro
2021-07-13 21:22                   ` Benjamin Purcell
2021-07-13 16:21               ` hiro
2021-07-13 16:29             ` ori
2021-07-14  8:42               ` hiro
2021-07-14 11:52                 ` Stuart Morrow
2021-07-14 12:17                   ` hiro
2021-07-15  3:13                     ` ori
2021-07-14 12:53                   ` José Miguel Sánchez García
2021-07-15  7:36                     ` hiro
2021-07-14 14:26                 ` ori
2021-07-13 15:27           ` kvik
2021-07-13 16:28             ` ori
2021-07-13 12:00     ` José Miguel Sánchez García
2021-07-13 12:43   ` kvik
2021-07-13 13:36     ` hiro
2021-07-13 13:40       ` hiro
2021-07-14 22:57 ` ori
2021-07-15  7:40   ` hiro

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=CAA85C87qdQe6Bj6E4XvGwgOd7_cgQOJ4Yiv8tRhL4pEzzMTqQQ@mail.gmail.com \
    --to=soy.jmi2k@gmail.com \
    --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).