Browse Source

More deanon.

I don't know the right way to do the mouse bits, see what you think.

But it works, or seems to.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 8 years ago
parent
commit
b906b87d7b

+ 7 - 1
sys/include/mouse.h

@@ -14,6 +14,9 @@ typedef struct	Cursor Cursor;
 typedef struct	Menu Menu;
 typedef struct 	Mousectl Mousectl;
 
+/* as a way to get sort-of anon structs, we make the Mouse and Mousectl structs
+ * interchangeable.
+ */
 struct	Mouse
 {
 	int	buttons;	/* bit array: LMR=124 */
@@ -23,7 +26,10 @@ struct	Mouse
 
 struct Mousectl
 {
-	Mouse;
+	//Mouse;
+	int	buttons;	/* bit array: LMR=124 */
+	Point	xy;
+	uint32_t	msec;
 	Channel	*c;	/* chan(Mouse) */
 	Channel	*resizec;	/* chan(int)[2] */
 			/* buffered in case client is waiting for a mouse action before handling resize */

+ 0 - 1
sys/src/libdraw/klibdraw.json

@@ -1,7 +1,6 @@
 {
 	"KernelLibdraw": {
 		"Cflags": [
-			"-fplan9-extensions",
 			"-Werror"
 		],
 		"Include": [

+ 0 - 1
sys/src/libdraw/libdraw.json

@@ -1,7 +1,6 @@
 {
 	"Libdraw": {
 		"Cflags": [
-			"-fplan9-extensions",
 			"-Werror"
 		],
 		"Include": [

+ 4 - 3
sys/src/libdraw/mouse.c

@@ -29,7 +29,7 @@ closemouse(Mousectl *mc)
 
 	postnote(PNPROC, mc->pid, "kill");
 
-	do; while(nbrecv(mc->c, &mc->Mouse) > 0);
+	do; while(nbrecv(mc->c, (Mouse *)mc) > 0);
 
 	close(mc->mfd);
 	close(mc->cfd);
@@ -44,7 +44,7 @@ readmouse(Mousectl *mc)
 {
 	if(mc->image)
 		flushimage(mc->image->display, 1);
-	if(recv(mc->c, &mc->Mouse) < 0){
+	if(recv(mc->c, (Mouse *)mc) < 0){
 		fprint(2, "readmouse: %r\n");
 		return -1;
 	}
@@ -90,8 +90,9 @@ _ioproc(void *arg)
 			 * mc->Mouse is updated after send so it doesn't have wrong value if we block during send.
 			 * This means that programs should receive into mc->Mouse (see readmouse() above) if
 			 * they want full synchrony.
-			 */
 			mc->Mouse = m;
+			 */
+			*(Mouse *)mc = m;
 			break;
 		}
 	}

+ 0 - 1
sys/src/libframe/libframe.json

@@ -1,7 +1,6 @@
 {
 	"libframe": {
 		"Cflags": [
-		    "-fplan9-extensions",
 			"-Werror"
 		],
 		"Include": [