On Mon, Sep 19, 2022 at 11:16:51AM +0200, Ulf Brosziewski wrote:
> Is there enough interest in this feature among OpenBSD users? I haven't
> seen many requests for it, if any. Moreover, is it a good idea to configure
> different input methods on this or that hardware just because another OS
> has different defaults?
>
> Just in case the answer to these questions turns out to be "yes", here are
> some remarks on the diff.
I do still believe that there is interest in this feature based on the feedback
I got from other devs. Having it available as a non-default option as kettenis@
said would be good enough.
Below is a revised version of the diff that adds a new mouse.tp.mtbuttons config
option. It can either be enabled via wsconsctl mouse.tp.mtbuttons=1 or by
adding mouse.tp.mtbuttons=1 to your /etc/wsconsctl.conf.
ok?
Index: sys/dev/wscons/wsconsio.h
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.98
diff -u -p -r1.98 wsconsio.h
--- sys/dev/wscons/wsconsio.h 15 Jul 2022 17:57:27 -0000 1.98
+++ sys/dev/wscons/wsconsio.h 5 Feb 2023 15:35:39 -0000
@@ -319,6 +319,7 @@ enum wsmousecfg {
WSMOUSECFG_SWAPSIDES, /* invert soft-button/scroll areas */
WSMOUSECFG_DISABLE, /* disable all output except for
clicks in the top-button area */
+ WSMOUSECFG_MTBUTTONS, /* multi-touch buttons */
/*
* Touchpad options
Index: sys/dev/wscons/wstpad.c
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wstpad.c,v
retrieving revision 1.31
diff -u -p -r1.31 wstpad.c
--- sys/dev/wscons/wstpad.c 9 Jun 2022 22:17:18 -0000 1.31
+++ sys/dev/wscons/wstpad.c 5 Feb 2023 15:35:39 -0000
@@ -72,6 +72,7 @@
enum tpad_handlers {
SOFTBUTTON_HDLR,
TOPBUTTON_HDLR,
+ MTBUTTON_HDLR,
TAP_HDLR,
F2SCROLL_HDLR,
EDGESCROLL_HDLR,
@@ -149,6 +150,7 @@ struct tpad_touch {
#define WSTPAD_HORIZSCROLL (1 << 5)
#define WSTPAD_SWAPSIDES (1 << 6)
#define WSTPAD_DISABLE (1 << 7)
+#define WSTPAD_MTBUTTONS (1 << 8)
#define WSTPAD_MT (1 << 31)
@@ -646,7 +648,17 @@ wstpad_softbuttons(struct wsmouseinput *
}
if (tp->softbutton == 0 && PRIMARYBTN_CLICKED(tp)) {
- tp->softbutton = wstpad_get_sbtn(input, top);
+ if (hdlr == MTBUTTON_HDLR) {
+ switch (tp->contacts) {
+ case 2:
+ tp->softbutton = RIGHTBTN;
+ break;
+ case 3:
+ tp->softbutton = MIDDLEBTN;
+ break;
+ }
+ } else
+ tp->softbutton = wstpad_get_sbtn(input, top);
if (tp->softbutton)
*cmds |= 1 << SOFTBUTTON_DOWN;
}
@@ -1237,12 +1249,14 @@ wstpad_process_input(struct wsmouseinput
cmds = 0;
handlers = tp->handlers;
if (DISABLE(tp))
- handlers &= ((1 << TOPBUTTON_HDLR) | (1 << SOFTBUTTON_HDLR));
+ handlers &= ((1 << TOPBUTTON_HDLR) | (1 << SOFTBUTTON_HDLR) |
+ (1 << MTBUTTON_HDLR));
FOREACHBIT(handlers, hdlr) {
switch (hdlr) {
case SOFTBUTTON_HDLR:
case TOPBUTTON_HDLR:
+ case MTBUTTON_HDLR:
wstpad_softbuttons(input, &cmds, hdlr);
continue;
case TAP_HDLR:
@@ -1621,6 +1635,8 @@ wstpad_configure(struct wsmouseinput *in
tp->handlers = 0;
+ if (tp->features & WSTPAD_MTBUTTONS)
+ tp->handlers |= 1 << MTBUTTON_HDLR;
if (tp->features & WSTPAD_SOFTBUTTONS)
tp->handlers |= 1 << SOFTBUTTON_HDLR;
if (tp->features & WSTPAD_TOPBUTTONS)
@@ -1691,7 +1707,7 @@ wstpad_set_param(struct wsmouseinput *in
return (EINVAL);
switch (key) {
- case WSMOUSECFG_SOFTBUTTONS ... WSMOUSECFG_DISABLE:
+ case WSMOUSECFG_SOFTBUTTONS ... WSMOUSECFG_MTBUTTONS:
switch (key) {
case WSMOUSECFG_SOFTBUTTONS:
flag = WSTPAD_SOFTBUTTONS;
@@ -1717,6 +1733,9 @@ wstpad_set_param(struct wsmouseinput *in
case WSMOUSECFG_DISABLE:
flag = WSTPAD_DISABLE;
break;
+ case WSMOUSECFG_MTBUTTONS:
+ flag = WSTPAD_MTBUTTONS;
+ break;
}
if (val)
tp->features |= flag;
@@ -1785,7 +1804,7 @@ wstpad_get_param(struct wsmouseinput *in
return (EINVAL);
switch (key) {
- case WSMOUSECFG_SOFTBUTTONS ... WSMOUSECFG_DISABLE:
+ case WSMOUSECFG_SOFTBUTTONS ... WSMOUSECFG_MTBUTTONS:
switch (key) {
case WSMOUSECFG_SOFTBUTTONS:
flag = WSTPAD_SOFTBUTTONS;
@@ -1810,6 +1829,9 @@ wstpad_get_param(struct wsmouseinput *in
break;
case WSMOUSECFG_DISABLE:
flag = WSTPAD_DISABLE;
+ break;
+ case WSMOUSECFG_MTBUTTONS:
+ flag = WSTPAD_MTBUTTONS;
break;
}
*pval = !!(tp->features & flag);
Index: sbin/wsconsctl/mouse.c
===================================================================
RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v
retrieving revision 1.20
diff -u -p -r1.20 mouse.c
--- sbin/wsconsctl/mouse.c 19 Aug 2019 21:42:33 -0000 1.20
+++ sbin/wsconsctl/mouse.c 5 Feb 2023 15:35:39 -0000
@@ -57,6 +57,7 @@ struct field mouse_field_tab[] = {
{ "reverse_scrolling", &cfg_revscroll, FMT_CFG, FLG_NORDBACK },
/* touchpad-specific options: */
{ "tp.tapping", &cfg_tapping, FMT_CFG, FLG_NORDBACK },
+ { "tp.mtbuttons", &cfg_mtbuttons, FMT_CFG, FLG_NORDBACK },
{ "tp.scaling", &cfg_scaling, FMT_CFG, FLG_NORDBACK },
{ "tp.swapsides", &cfg_swapsides, FMT_CFG, FLG_NORDBACK },
{ "tp.disable", &cfg_disable, FMT_CFG, FLG_NORDBACK },
Index: sbin/wsconsctl/mousecfg.c
===================================================================
RCS file: /cvs/src/sbin/wsconsctl/mousecfg.c,v
retrieving revision 1.9
diff -u -p -r1.9 mousecfg.c
--- sbin/wsconsctl/mousecfg.c 3 Mar 2021 19:44:37 -0000 1.9
+++ sbin/wsconsctl/mousecfg.c 5 Feb 2023 15:35:39 -0000
@@ -40,7 +40,7 @@
#define TP_FILTER_FIRST WSMOUSECFG_DX_MAX
#define TP_FILTER_LAST WSMOUSECFG_SMOOTHING
#define TP_FEATURES_FIRST WSMOUSECFG_SOFTBUTTONS
-#define TP_FEATURES_LAST WSMOUSECFG_DISABLE
+#define TP_FEATURES_LAST WSMOUSECFG_MTBUTTONS
#define TP_SETUP_FIRST WSMOUSECFG_LEFT_EDGE
#define TP_SETUP_LAST WSMOUSECFG_TAP_THREE_BTNMAP
#define LOG_FIRST WSMOUSECFG_LOG_INPUT
@@ -75,6 +75,12 @@ struct wsmouse_parameters cfg_tapping =
{ WSMOUSECFG_TAP_TWO_BTNMAP, 0 },
{ WSMOUSECFG_TAP_THREE_BTNMAP, 0 }, },
3
+};
+
+struct wsmouse_parameters cfg_mtbuttons = {
+ (struct wsmouse_param[]) {
+ { WSMOUSECFG_MTBUTTONS, 0 }, },
+ 1
};
struct wsmouse_parameters cfg_scaling = {
Index: sbin/wsconsctl/mousecfg.h
===================================================================
RCS file: /cvs/src/sbin/wsconsctl/mousecfg.h,v
retrieving revision 1.4
diff -u -p -r1.4 mousecfg.h
--- sbin/wsconsctl/mousecfg.h 19 Aug 2019 21:42:33 -0000 1.4
+++ sbin/wsconsctl/mousecfg.h 5 Feb 2023 15:35:39 -0000
@@ -17,6 +17,7 @@
*/
extern struct wsmouse_parameters cfg_tapping;
+extern struct wsmouse_parameters cfg_mtbuttons;
extern struct wsmouse_parameters cfg_scaling;
extern struct wsmouse_parameters cfg_edges;
extern struct wsmouse_parameters cfg_swapsides;