Hi
I think these are fine because they are all part of the same number, I
don't like stuff like:
if (b & MOUSE_MASK_WHEEL) {
if (b & MOUSE_SHIFT)
Since they are both bits in b they should have the same prefix.
Possibly s/MASK/BIT/ or s/MASK// would be better but meh, I think it's
okay as it is.
On Fri, Apr 11, 2014 at 06:08:05PM +0200, Marcel Partap wrote:
> Rationale:
> ?? remove _MASK_ from SHIFT/META/CTRL for consistency with "Key modifier
> bits" KEYC_ESCAPE/KEYC_CTRL/KEYC_SHIFT
> ?? rename MOUSE_MASK_BUTTONS to MOUSE_MASK_BUTTON: only receiving single
> button events
> ?? comment rename button masks => event masks: drag and wheel are more events
> than they are buttons
> ---
> input-keys.c | 2 +-
> tmux.h | 12 +++++++-----
> tty-keys.c | 12 ++++++------
> 3 files changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/input-keys.c b/input-keys.c
> index 1df8e98..fc63aaa 100644
> --- a/input-keys.c
> +++ b/input-keys.c
> @@ -208,7 +208,7 @@ input_mouse(struct window_pane *wp, struct session *s,
> struct mouse_event *m)
>
> /* Mouse wheel used while shift is pressed, or when alternate screen is
> * active and not mouse aware. */
> - if (m->event == MOUSE_EVENT_WHEEL && (m->xb & MOUSE_MASK_SHIFT ||
> + if (m->event == MOUSE_EVENT_WHEEL && (m->xb & MOUSE_SHIFT ||
> (wp->saved_grid != NULL && !(wp->screen->mode & ALL_MOUSE_MODES))))
> {
> for (i = 0; i < m->scroll; i++) {
> if (m->wheel == MOUSE_WHEEL_UP)
> diff --git a/tmux.h b/tmux.h
> index dacda66..76927ae 100644
> --- a/tmux.h
> +++ b/tmux.h
> @@ -1115,14 +1115,16 @@ struct tty_term {
> };
> LIST_HEAD(tty_terms, tty_term);
>
> -/* Mouse button masks. */
> -#define MOUSE_MASK_BUTTONS 3
> -#define MOUSE_MASK_SHIFT 4
> -#define MOUSE_MASK_META 8
> -#define MOUSE_MASK_CTRL 16
> +/* Mouse event masks. */
> +#define MOUSE_MASK_BUTTON 3
> #define MOUSE_MASK_DRAG 32
> #define MOUSE_MASK_WHEEL 64
>
> +/* Mouse modifier key states. */
> +#define MOUSE_SHIFT 4
> +#define MOUSE_META 8
> +#define MOUSE_CTRL 16
> +
> /* Mouse wheel states. */
> #define MOUSE_WHEEL_UP 0
> #define MOUSE_WHEEL_DOWN 1
> diff --git a/tty-keys.c b/tty-keys.c
> index 42f2da4..3e97636 100644
> --- a/tty-keys.c
> +++ b/tty-keys.c
> @@ -749,22 +749,22 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t
> len, size_t *size)
> m->x = x;
> m->y = y;
> if (b & MOUSE_MASK_WHEEL) {
> - if (b & MOUSE_MASK_SHIFT)
> + if (b & MOUSE_SHIFT)
> m->scroll = 1;
> else
> m->scroll = 3;
> - if (b & MOUSE_MASK_META)
> + if (b & MOUSE_META)
> m->scroll *= 3;
> - if (b & MOUSE_MASK_CTRL)
> + if (b & MOUSE_CTRL)
> m->scroll *= 3;
>
> - b &= MOUSE_MASK_BUTTONS;
> + b &= MOUSE_MASK_BUTTON;
> if (b == 0)
> m->wheel = MOUSE_WHEEL_UP;
> else if (b == 1)
> m->wheel = MOUSE_WHEEL_DOWN;
> m->event = MOUSE_EVENT_WHEEL;
> - } else if ((b & MOUSE_MASK_BUTTONS) == 3) {
> + } else if ((b & MOUSE_MASK_BUTTON) == 3) {
> if (~m->event & MOUSE_EVENT_DRAG && x == m->x && y == m->y)
> m->event = MOUSE_EVENT_CLICK;
> else
> @@ -782,7 +782,7 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t
> len, size_t *size)
> m->sy = y;
> m->event = MOUSE_EVENT_DOWN;
> }
> - m->button = (b & MOUSE_MASK_BUTTONS);
> + m->button = (b & MOUSE_MASK_BUTTON);
> }
>
> return (0);
> --
> 1.9.1
>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees
> _______________________________________________
> tmux-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users