9front - general discussion about 9front
 help / color / mirror / Atom feed
From: nature <nature@blazebone.com>
To: 9front@9front.org
Subject: [9front] [PATCH] vncv: allow the use of the Mod4 (Super) key
Date: Sat, 09 Apr 2022 10:29:11 +0000	[thread overview]
Message-ID: <D2BFDCC663AA711DFA467F7129AF236E@blazebone.com> (raw)

---
diff 909205036de4762628fdcdd295e209309817a604 791504479da68d9de858d83d336d3cd7a9c3e1bb
--- a/sys/src/cmd/vnc/kbdv.c	Tue Apr  5 01:09:49 2022
+++ b/sys/src/cmd/vnc/kbdv.c	Sat Apr  9 12:29:11 2022
@@ -6,7 +6,8 @@
 	Xshift = 0xFFE1,
 	Xctl = 0xFFE3,
 	Xmeta = 0xFFE7,
-	Xalt = 0xFFE9
+	Xalt = 0xFFE9,
+	Xsuper = 0xFFEB,
 };
 
 static struct {
@@ -45,6 +46,7 @@
 	{Kshift, Xshift},
 	{Kalt, Xalt},
 	{Kaltgr, Xmeta},
+	{Kmod4, Xsuper},
 	{Kctl, Xctl},
 };
 
@@ -95,7 +97,7 @@
 {
 	char buf[256], k[10];
 	ulong ks;
-	int ctlfd, fd, kr, kn, w, shift, ctl, alt;
+	int ctlfd, fd, kr, kn, w, shift, ctl, alt, super;
 	Rune r;
 
 	snprint(buf, sizeof buf, "%s/cons", display->devdir);
@@ -108,7 +110,7 @@
 	write(ctlfd, "rawon", 5);
 
 	kn = 0;
-	shift = alt = ctl = 0;
+	shift = alt = ctl = super = 0;
 	for(;;){
 		while(!fullrune(k, kn)){
 			kr = read(fd, k+kn, sizeof k - kn);
@@ -134,6 +136,10 @@
 			shift = !shift;
 			keyevent(v, Xshift, shift);
 			break;
+		case Kmod4:
+			super = !super;
+			keyevent(v, Xsuper, super);
+			break;
 		default:
 			if(r == ks && r < 0x1A){	/* control key */
 				keyevent(v, Xctl, 1);
@@ -176,6 +182,10 @@
 				keyevent(v, Xshift, 0);
 				shift = 0;
 			}
+			if(super){
+				keyevent(v, Xsuper, 0);
+				super = 0;
+			}
 			break;
 		}
 	}
@@ -228,6 +238,7 @@
 					if((r == Kshift) ||
 					   utfrune(buf+1, Kctl) || 
 					   utfrune(buf+1, Kalt) ||
+					   utfrune(buf+1, Kmod4) ||
 					   utfrune(buf+1, Kaltgr))
 						keyevent(v, runetovnc(r), 1);
 			}
@@ -241,7 +252,10 @@
 			}
 			break;
 		case 'c':
-			if(utfrune(buf2+1, Kctl) || utfrune(buf2+1, Kalt) || utfrune(buf2+1, Kaltgr))
+			if(utfrune(buf2+1, Kctl) ||
+			   utfrune(buf2+1, Kalt) ||
+			   utfrune(buf2+1, Kmod4) ||
+			   utfrune(buf2+1, Kaltgr))
 				continue;
 			chartorune(&r, buf+1);
 			keyevent(v, runetovnc(r), 1);

             reply	other threads:[~2022-04-09 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09 10:29 nature [this message]
2022-04-16 17:01 ` ori

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=D2BFDCC663AA711DFA467F7129AF236E@blazebone.com \
    --to=nature@blazebone.com \
    --cc=9front@9front.org \
    --subject='Re: [9front] [PATCH] vncv: allow the use of the Mod4 (Super) key' \
    /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

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