diff --git a/src/xwinman.c b/src/xwinman.c index 1eb2379..6f2a0f0 100644 --- a/src/xwinman.c +++ b/src/xwinman.c @@ -45,9 +45,16 @@ extern int KBDEventFlg; extern u_char *SUNLispKeyMap; #define KEYCODE_OFFSET 7 /* Sun Keycode offset */ +/* bits within the EmRealUtilin word */ +#define KEYSET_LEFT 8 +#define KEYSET_LEFTMIDDLE 9 +#define KEYSET_MIDDLE 10 +#define KEYSET_RIGHTMIDDLE 11 +#define KEYSET_RIGHT 12 +/* Mouse buttons */ #define MOUSE_LEFT 13 -#define MOUSE_MIDDLE 15 #define MOUSE_RIGHT 14 +#define MOUSE_MIDDLE 15 /* bound: return b if it is between a and c otherwise it returns a or c */ int bound(int a, int b, int c) @@ -209,6 +216,16 @@ void getXsignaldata(DspInterface dsp) case Button1: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_LEFT, FALSE); break; case Button2: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_MIDDLE, FALSE); break; case Button3: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, FALSE); break; + case Button4: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFT, FALSE); break; + case Button5: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFTMIDDLE, FALSE); break; +#if 0 + /* Button6 and Button7 are not defined, but these values are generated by + macOS for the left and right scrolling movements. + Leave them out for now, until we've sorted out the up and down scrolling. + */ + case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, FALSE); break; + case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, FALSE); break; +#endif default: break; } DoRing(); @@ -219,6 +236,13 @@ void getXsignaldata(DspInterface dsp) case Button1: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_LEFT, TRUE); break; case Button2: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_MIDDLE, TRUE); break; case Button3: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, TRUE); break; + case Button4: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFT, TRUE); break; + case Button5: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFTMIDDLE, TRUE); break; +#if 0 + /* See above for key press */ + case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, TRUE); break; + case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, TRUE); break; +#endif default: break; } DoRing();