9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] Mouse clipping patch
Date: Mon, 12 Jul 2021 22:36:27 -0400	[thread overview]
Message-ID: <8CE29EA89CBA8F74C1D4D8EEF2528473@eigenstate.org> (raw)
In-Reply-To: <CAA85C879ggSM=fPu+CcgToakbhMh2Rk=A5gn3AWsPUqUYGFckQ@mail.gmail.com>

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?


  reply	other threads:[~2021-07-13 10:13 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 [this message]
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
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=8CE29EA89CBA8F74C1D4D8EEF2528473@eigenstate.org \
    --to=ori@eigenstate.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).