9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] enable button 6 in devmouse and kbdfs
@ 2021-02-25 18:47 james palmer
  2021-02-25 19:32 ` james palmer
  2021-02-25 19:40 ` james palmer
  0 siblings, 2 replies; 4+ messages in thread
From: james palmer @ 2021-02-25 18:47 UTC (permalink / raw)
  To: 9front mailing list

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

hi there,

probably as a holdover from the ipaq port,
rio listens for button 6 and sends it to the keyboard set with the arguments.
bitsy/keyboard uses this to show/hide itself.

this is useful to me to toggle the keyboard when i am using my thinkpad x41t in tablet mode.
i have patched devmouse to let button 6 through and kbdfs to let it be bound to a key in the kbmap.
i hope this is useful to the small subset of 9front users with tablet/touchscreen devices.

thanks
- james

[-- Attachment #2.1: Type: text/plain, Size: 333 bytes --]

from postmaster@1ess:
The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Disposition: attachment;filename="button6.diff"
	Content-Type: text/x-patch; name="button6.diff"
	Content-Transfer-Encoding: BASE64

[-- Attachment #2.2: button6.diff.suspect --]
[-- Type: application/octet-stream, Size: 1365 bytes --]

diff -r b2bea92dffd4 sys/src/9/port/devmouse.c
--- a/sys/src/9/port/devmouse.c	Sat Feb 20 21:02:07 2021 -0800
+++ b/sys/src/9/port/devmouse.c	Thu Feb 25 18:39:16 2021 +0000
@@ -273,8 +273,8 @@
 		iunlock(&mouse);
 
 		b = buttonmap[m.buttons&7];
-		/* put buttons 4 and 5 back in */
-		b |= m.buttons & (3<<3);
+		/* put buttons 4 and 5 and 6 back in */
+		b |= m.buttons & (4<<3);
 		if (scrollswap)
 			if (b == 8)
 				b = 16;
diff -r b2bea92dffd4 sys/src/cmd/aux/kbdfs/kbdfs.c
--- a/sys/src/cmd/aux/kbdfs/kbdfs.c	Sat Feb 20 21:02:07 2021 -0800
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c	Thu Feb 25 18:39:16 2021 +0000
@@ -626,7 +626,7 @@
 
 	nb = 0;
 	while(recv(keychan, &key) > 0){
-		if(key.r >= Kmouse+1 && key.r <= Kmouse+5){
+		if(key.r >= Kmouse+1 && key.r <= Kmouse+6){
 			if(msinfd >= 0)
 				send(mctlchan, &key);
 			continue;
@@ -859,7 +859,7 @@
 			continue;
 		}
 
-		if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+5){
+		if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+6){
 			i = 1<<(key.r-(Kmouse+1));
 			if(key.down)
 				mouseb |= i;
@@ -1226,7 +1226,7 @@
 					r -= 0x40;
 				else
 					goto Badarg;
-			}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '5'))
+			}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '6'))
 				r = Kmouse+lp[1]-'0';
 			else if(*lp>='0' && *lp<='9') /* includes 0x... */
 				r = strtoul(lp, &lp, 0);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] enable button 6 in devmouse and kbdfs
  2021-02-25 18:47 [9front] enable button 6 in devmouse and kbdfs james palmer
@ 2021-02-25 19:32 ` james palmer
  2021-02-25 19:57   ` james palmer
  2021-02-25 19:40 ` james palmer
  1 sibling, 1 reply; 4+ messages in thread
From: james palmer @ 2021-02-25 19:32 UTC (permalink / raw)
  To: 9front mailing list

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

i failed to bitmask. 
(4<<3) should be (7<<3) to not break button 4 and 5.
attached is the fixed patch.

- james

[-- Attachment #2.1: Type: text/plain, Size: 333 bytes --]

from postmaster@1ess:
The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Disposition: attachment;filename="button6.diff"
	Content-Type: text/x-patch; name="button6.diff"
	Content-Transfer-Encoding: BASE64

[-- Attachment #2.2: button6.diff.suspect --]
[-- Type: application/octet-stream, Size: 1365 bytes --]

diff -r b2bea92dffd4 sys/src/9/port/devmouse.c
--- a/sys/src/9/port/devmouse.c	Sat Feb 20 21:02:07 2021 -0800
+++ b/sys/src/9/port/devmouse.c	Thu Feb 25 18:39:16 2021 +0000
@@ -273,8 +273,8 @@
 		iunlock(&mouse);
 
 		b = buttonmap[m.buttons&7];
-		/* put buttons 4 and 5 back in */
-		b |= m.buttons & (3<<3);
+		/* put buttons 4 and 5 and 6 back in */
+		b |= m.buttons & (4<<3);
 		if (scrollswap)
 			if (b == 8)
 				b = 16;
diff -r b2bea92dffd4 sys/src/cmd/aux/kbdfs/kbdfs.c
--- a/sys/src/cmd/aux/kbdfs/kbdfs.c	Sat Feb 20 21:02:07 2021 -0800
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c	Thu Feb 25 18:39:16 2021 +0000
@@ -626,7 +626,7 @@
 
 	nb = 0;
 	while(recv(keychan, &key) > 0){
-		if(key.r >= Kmouse+1 && key.r <= Kmouse+5){
+		if(key.r >= Kmouse+1 && key.r <= Kmouse+6){
 			if(msinfd >= 0)
 				send(mctlchan, &key);
 			continue;
@@ -859,7 +859,7 @@
 			continue;
 		}
 
-		if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+5){
+		if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+6){
 			i = 1<<(key.r-(Kmouse+1));
 			if(key.down)
 				mouseb |= i;
@@ -1226,7 +1226,7 @@
 					r -= 0x40;
 				else
 					goto Badarg;
-			}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '5'))
+			}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '6'))
 				r = Kmouse+lp[1]-'0';
 			else if(*lp>='0' && *lp<='9') /* includes 0x... */
 				r = strtoul(lp, &lp, 0);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] enable button 6 in devmouse and kbdfs
  2021-02-25 18:47 [9front] enable button 6 in devmouse and kbdfs james palmer
  2021-02-25 19:32 ` james palmer
@ 2021-02-25 19:40 ` james palmer
  1 sibling, 0 replies; 4+ messages in thread
From: james palmer @ 2021-02-25 19:40 UTC (permalink / raw)
  To: 9front mailing list

[-- Attachment #1: Type: text/plain, Size: 14 bytes --]

wrong file :/

[-- Attachment #2.1: Type: text/plain, Size: 333 bytes --]

from postmaster@1ess:
The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Disposition: attachment;filename="button6.diff"
	Content-Type: text/x-patch; name="button6.diff"
	Content-Transfer-Encoding: BASE64

[-- Attachment #2.2: button6.diff.suspect --]
[-- Type: application/octet-stream, Size: 1365 bytes --]

diff -r b2bea92dffd4 sys/src/9/port/devmouse.c
--- a/sys/src/9/port/devmouse.c	Sat Feb 20 21:02:07 2021 -0800
+++ b/sys/src/9/port/devmouse.c	Thu Feb 25 18:39:16 2021 +0000
@@ -273,8 +273,8 @@
 		iunlock(&mouse);
 
 		b = buttonmap[m.buttons&7];
-		/* put buttons 4 and 5 back in */
-		b |= m.buttons & (3<<3);
+		/* put buttons 4 and 5 and 6 back in */
+		b |= m.buttons & (4<<3);
 		if (scrollswap)
 			if (b == 8)
 				b = 16;
diff -r b2bea92dffd4 sys/src/cmd/aux/kbdfs/kbdfs.c
--- a/sys/src/cmd/aux/kbdfs/kbdfs.c	Sat Feb 20 21:02:07 2021 -0800
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c	Thu Feb 25 18:39:16 2021 +0000
@@ -626,7 +626,7 @@
 
 	nb = 0;
 	while(recv(keychan, &key) > 0){
-		if(key.r >= Kmouse+1 && key.r <= Kmouse+5){
+		if(key.r >= Kmouse+1 && key.r <= Kmouse+6){
 			if(msinfd >= 0)
 				send(mctlchan, &key);
 			continue;
@@ -859,7 +859,7 @@
 			continue;
 		}
 
-		if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+5){
+		if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+6){
 			i = 1<<(key.r-(Kmouse+1));
 			if(key.down)
 				mouseb |= i;
@@ -1226,7 +1226,7 @@
 					r -= 0x40;
 				else
 					goto Badarg;
-			}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '5'))
+			}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '6'))
 				r = Kmouse+lp[1]-'0';
 			else if(*lp>='0' && *lp<='9') /* includes 0x... */
 				r = strtoul(lp, &lp, 0);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] enable button 6 in devmouse and kbdfs
  2021-02-25 19:32 ` james palmer
@ 2021-02-25 19:57   ` james palmer
  0 siblings, 0 replies; 4+ messages in thread
From: james palmer @ 2021-02-25 19:57 UTC (permalink / raw)
  To: 9front mailing list

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

Quoth james@biobuf.link:
> attached is the fixed patch.

or not. sigrid informed me that i broke scrollswap.
yet another revised version attached.
button 6 works and scrollswap works.

- james

[-- Attachment #2.1: Type: text/plain, Size: 335 bytes --]

from postmaster@1ess:
The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Disposition: attachment;filename="button6.patch"
	Content-Type: text/x-patch; name="button6.patch"
	Content-Transfer-Encoding: BASE64

[-- Attachment #2.2: button6.patch.suspect --]
[-- Type: application/octet-stream, Size: 1312 bytes --]

diff -r b2bea92dffd4 sys/src/9/port/devmouse.c
--- a/sys/src/9/port/devmouse.c	Sat Feb 20 21:02:07 2021 -0800
+++ b/sys/src/9/port/devmouse.c	Thu Feb 25 19:53:04 2021 +0000
@@ -280,6 +280,9 @@
 				b = 16;
 			else if (b == 16)
 				b = 8;
+		/* put button 6 back in */
+		b |=  m.buttons & (4<<3); 
+
 		sprint(buf, "m%11d %11d %11d %11ld ",
 			m.xy.x, m.xy.y, b, m.msec);
 
diff -r b2bea92dffd4 sys/src/cmd/aux/kbdfs/kbdfs.c
--- a/sys/src/cmd/aux/kbdfs/kbdfs.c	Sat Feb 20 21:02:07 2021 -0800
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c	Thu Feb 25 19:53:04 2021 +0000
@@ -626,7 +626,7 @@
 
 	nb = 0;
 	while(recv(keychan, &key) > 0){
-		if(key.r >= Kmouse+1 && key.r <= Kmouse+5){
+		if(key.r >= Kmouse+1 && key.r <= Kmouse+6){
 			if(msinfd >= 0)
 				send(mctlchan, &key);
 			continue;
@@ -859,7 +859,7 @@
 			continue;
 		}
 
-		if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+5){
+		if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+6){
 			i = 1<<(key.r-(Kmouse+1));
 			if(key.down)
 				mouseb |= i;
@@ -1226,7 +1226,7 @@
 					r -= 0x40;
 				else
 					goto Badarg;
-			}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '5'))
+			}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '6'))
 				r = Kmouse+lp[1]-'0';
 			else if(*lp>='0' && *lp<='9') /* includes 0x... */
 				r = strtoul(lp, &lp, 0);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-25 20:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-25 18:47 [9front] enable button 6 in devmouse and kbdfs james palmer
2021-02-25 19:32 ` james palmer
2021-02-25 19:57   ` james palmer
2021-02-25 19:40 ` james palmer

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).