--- np2/macosx/mackbd.cpp 2003/10/19 14:56:15 1.3 +++ np2/macosx/mackbd.cpp 2003/11/13 18:58:04 1.11 @@ -6,6 +6,11 @@ #include "pccore.h" #include "iocore.h" +#if defined(NP2GCC) +#include "mousemng.h" +#include "menu.h" +#include "sysmng.h" +#endif #define NC 0xff @@ -24,8 +29,8 @@ static const BYTE keymac[128] = { 0x24,0x26,0x28,0x30,0x32,0x2e,0x2f,0x31, // TAB, SPC, , BS, , ESC, , apl ; 0x30 0x0f,0x34, NC,0x0e, NC,0x00, NC, NC, - // sft, ctl, alt, cps, , , , ; 0x38 - 0x70,0x74,0x73,0x79, NC, NC, NC, NC, + // sft, cps, alt, ctl, , , , ; 0x38 + 0x70,0x79,0x73,0x74, NC, NC, NC, NC, // for CW // , [.], , [*], , , [+], ; 0x40 NC,0x50, NC,0x45, NC, NC,0x49, NC, // , , , , ret, , [-], clr ; 0x48 @@ -59,7 +64,7 @@ static const BYTE keymac2[128] = { NC, NC, NC, NC, NC, NC, NC, NC, // TAB, SPC, , BS, , ESC, , apl ; 0x30 NC, NC, NC, NC, NC, NC, NC, NC, - // sft, ctl, alt, cps, , , , ; 0x38 + // sft, cps, alt, ctl, , , , ; 0x38 NC, NC, NC, NC, NC, NC, NC, NC, // , [.], , [*], , , [+], ; 0x40 NC, NC, NC, NC, NC, NC, NC, NC, @@ -88,6 +93,7 @@ void mackbd_initialize(void) { ZeroMemory(&keymap, sizeof(keymap)); } +#if 0 void mackbd_callback(void) { UINT32 tick; @@ -127,28 +133,69 @@ void mackbd_callback(void) { } } } +#endif + +static const BYTE f12keys[] = { + 0x61, 0x60, 0x4d, 0x4f}; + + +static BYTE getf12key(void) { + + UINT key; + + key = np2oscfg.F12COPY - 1; + if (key < (sizeof(f12keys)/sizeof(BYTE))) { + return(f12keys[key]); + } + else { + return(NC); + } +} -void mackbd_f12down(int keycode) { +void mackbd_keydown(int keycode) { if (keycode == 0x6f) { - if (np2oscfg.F12COPY == 1) { - keystat_senddata(0x61); - } - else if (np2oscfg.F12COPY == 2) { - keystat_senddata(0x60); + if (np2oscfg.F12COPY) { + keystat_senddata(getf12key()); + } +#if defined(NP2GCC) + else { + mousemng_toggle(MOUSEPROC_SYSTEM); + menu_setmouse(np2oscfg.MOUSE_SW ^ 1); + sysmng_update(SYS_UPDATECFG); } +#endif + } + else { + BYTE data; + data = keymac[keycode]; + if (data != NC) { + keystat_senddata(data); + } } } -void mackbd_f12up(int keycode) { +void mackbd_keyup(int keycode) { if (keycode == 0x6f) { - if (np2oscfg.F12COPY == 1) { - keystat_senddata(0x61 | 0x80); - } - else if (np2oscfg.F12COPY == 2) { - keystat_senddata(0x60 | 0x80); + if (np2oscfg.F12COPY) { + keystat_senddata(getf12key() | 0x80); } + } + else { + BYTE data; + data = keymac[keycode]; + if (data != NC) { + keystat_senddata(data | 0x80); + } } } +void mackbd_resetf12(void) { + + UINT i; + + for (i=0; i<(sizeof(f12keys)/sizeof(BYTE)); i++) { + keystat_forcerelease(f12keys[i]); + } +}