[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [257] branches/fusegl/fuse
Brought to you by:
fredm
From: <fr...@us...> - 2006-12-20 01:44:56
|
Revision: 257 http://svn.sourceforge.net/fuse-for-macosx/?rev=257&view=rev Author: fredm Date: 2006-12-19 17:44:56 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Enable native keyboard handling. Modified Paths: -------------- branches/fusegl/fuse/TODO branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Added Paths: ----------- branches/fusegl/fuse/ui/cocoa/keysyms.m Removed Paths: ------------- branches/fusegl/fuse/ui/cocoa/keysyms.c Modified: branches/fusegl/fuse/TODO =================================================================== --- branches/fusegl/fuse/TODO 2006-12-19 11:28:44 UTC (rev 256) +++ branches/fusegl/fuse/TODO 2006-12-20 01:44:56 UTC (rev 257) @@ -4,9 +4,9 @@ in threaded Cocoa GL UI) X Switch to Cocoa run loop for Fuse X Add GL renderer +X Add native keyboard processing (removes SDL keyboard input dependency from + Fuse) * Add native CoreAudio sound processing (removes SDL sound dependency from Fuse) -* Add native keyboard processing (removes SDL keyboard input dependency from - Fuse) * Fix menus, preferences etc. * Fix scalers * Add native joystick processing (removes SDL joystick input dependency from Modified: branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj =================================================================== --- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-19 11:28:44 UTC (rev 256) +++ branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-20 01:44:56 UTC (rev 257) @@ -269,10 +269,10 @@ B6CE7F420B2830A300EB65B3 /* cocoajoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = B6CE7F3C0B2830A300EB65B3 /* cocoajoystick.c */; }; B6CE7F430B2830A300EB65B3 /* cocoaui.c in Sources */ = {isa = PBXBuildFile; fileRef = B6CE7F3D0B2830A300EB65B3 /* cocoaui.c */; }; B6CE7F440B2830A300EB65B3 /* cocoaui.h in Headers */ = {isa = PBXBuildFile; fileRef = B6CE7F3E0B2830A300EB65B3 /* cocoaui.h */; }; - B6CE7F450B2830A300EB65B3 /* keysyms.c in Sources */ = {isa = PBXBuildFile; fileRef = B6CE7F3F0B2830A300EB65B3 /* keysyms.c */; }; B6CE7F520B283A0700EB65B3 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = B6CE7F510B283A0700EB65B3 /* main.mm */; }; B6CE7FCD0B28FBD600EB65B3 /* DisplayOpenGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = B6CE7FCB0B28FBD600EB65B3 /* DisplayOpenGLView.h */; }; B6CE7FCE0B28FBD600EB65B3 /* DisplayOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = B6CE7FCC0B28FBD600EB65B3 /* DisplayOpenGLView.m */; }; + B6E0252C0B38AFE500E23A0F /* keysyms.m in Sources */ = {isa = PBXBuildFile; fileRef = B6E0252B0B38AFE500E23A0F /* keysyms.m */; }; B6F047F60952A6D6006D8005 /* tape_se.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6F047F20952A6BA006D8005 /* tape_se.szx */; }; B6F047F70952A6D6006D8005 /* tape_ts2068.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6F047F30952A6BA006D8005 /* tape_ts2068.szx */; }; B6F047F80952A6E3006D8005 /* tape_plus3e.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6F047F00952A69A006D8005 /* tape_plus3e.szx */; }; @@ -491,13 +491,13 @@ B6CE7F3C0B2830A300EB65B3 /* cocoajoystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cocoajoystick.c; sourceTree = "<group>"; }; B6CE7F3D0B2830A300EB65B3 /* cocoaui.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cocoaui.c; sourceTree = "<group>"; }; B6CE7F3E0B2830A300EB65B3 /* cocoaui.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cocoaui.h; sourceTree = "<group>"; }; - B6CE7F3F0B2830A300EB65B3 /* keysyms.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = keysyms.c; sourceTree = "<group>"; }; B6CE7F510B283A0700EB65B3 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; }; B6CE7FCB0B28FBD600EB65B3 /* DisplayOpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DisplayOpenGLView.h; sourceTree = "<group>"; }; B6CE7FCC0B28FBD600EB65B3 /* DisplayOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DisplayOpenGLView.m; sourceTree = "<group>"; }; B6D2989105B061CB00C2AA14 /* MemoryBrowserController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MemoryBrowserController.h; path = controllers/MemoryBrowserController.h; sourceTree = "<group>"; }; B6D2989205B061CB00C2AA14 /* MemoryBrowserController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MemoryBrowserController.m; path = controllers/MemoryBrowserController.m; sourceTree = "<group>"; }; B6D2993105B06AD200C2AA14 /* MemoryBrowser.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = MemoryBrowser.nib; path = nibs/MemoryBrowser.nib; sourceTree = "<group>"; }; + B6E0252B0B38AFE500E23A0F /* keysyms.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = keysyms.m; sourceTree = "<group>"; }; B6E093F40607EEDC008B5DEC /* 256s-0.rom */ = {isa = PBXFileReference; lastKnownFileType = file; name = "256s-0.rom"; path = "../roms/256s-0.rom"; sourceTree = SOURCE_ROOT; }; B6E093F50607EEDC008B5DEC /* 256s-1.rom */ = {isa = PBXFileReference; lastKnownFileType = file; name = "256s-1.rom"; path = "../roms/256s-1.rom"; sourceTree = SOURCE_ROOT; }; B6E093F60607EEDC008B5DEC /* 256s-2.rom */ = {isa = PBXFileReference; lastKnownFileType = file; name = "256s-2.rom"; path = "../roms/256s-2.rom"; sourceTree = SOURCE_ROOT; }; @@ -892,7 +892,7 @@ B6CE7F3C0B2830A300EB65B3 /* cocoajoystick.c */, B6CE7F3D0B2830A300EB65B3 /* cocoaui.c */, B6CE7F3E0B2830A300EB65B3 /* cocoaui.h */, - B6CE7F3F0B2830A300EB65B3 /* keysyms.c */, + B6E0252B0B38AFE500E23A0F /* keysyms.m */, ); path = cocoa; sourceTree = "<group>"; @@ -1439,9 +1439,9 @@ B6CE7F400B2830A300EB65B3 /* cocoadisplay.c in Sources */, B6CE7F420B2830A300EB65B3 /* cocoajoystick.c in Sources */, B6CE7F430B2830A300EB65B3 /* cocoaui.c in Sources */, - B6CE7F450B2830A300EB65B3 /* keysyms.c in Sources */, B6CE7F520B283A0700EB65B3 /* main.mm in Sources */, B6CE7FCE0B28FBD600EB65B3 /* DisplayOpenGLView.m in Sources */, + B6E0252C0B38AFE500E23A0F /* keysyms.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-19 11:28:44 UTC (rev 256) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-20 01:44:56 UTC (rev 257) @@ -30,6 +30,9 @@ #include <OpenGL/glext.h> #include <OpenGL/glu.h> +#include <libspectrum.h> + +#include "input.h" #include "ui/cocoa/cocoadisplay.h" @interface DisplayOpenGLView : NSOpenGLView @@ -40,8 +43,11 @@ Cocoa_Texture screenTex; /* Screen texture */ BOOL screenTexInitialised; + + GHashTable *unicode_keysyms_hash; } +(DisplayOpenGLView *) instance; ++(void) initialize; -(void) createTexture:(Cocoa_Texture*)newScreen; -(void) destroyTexture; @@ -50,6 +56,15 @@ -(id) initWithFrame:(NSRect)frameRect; -(void) awakeFromNib; -+(void) initialize; +-(void) initKeyboard; +-(void) flagsChanged:(NSEvent *)theEvent; +-(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type; +-(void) keyDown:(NSEvent *)theEvent; +-(void) keyUp:(NSEvent *)theEvent; + +- (BOOL) acceptsFirstResponder; +- (BOOL) becomeFirstResponder; +- (BOOL) resignFirstResponder; + @end Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-19 11:28:44 UTC (rev 256) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-20 01:44:56 UTC (rev 257) @@ -33,7 +33,24 @@ #include "event.h" #include "fuse.h" #include "fusepb/main.h" +#include "keyboard.h" +extern keysyms_map_t unicode_keysyms_map[]; + +static int cocoakeyboard_caps_shift_pressed = 0; +static int cocoakeyboard_symbol_shift_pressed = 0; +static input_key unicode_keysym = INPUT_KEY_NONE; + +static input_key +other_keysyms_remap( libspectrum_dword ui_keysym, GHashTable *hash ) +{ + const input_key *ptr; + + ptr = g_hash_table_lookup( hash, &ui_keysym ); + + return ptr ? *ptr : INPUT_KEY_NONE; +} + @implementation DisplayOpenGLView static DisplayOpenGLView *instance = nil; @@ -43,6 +60,44 @@ return instance; } ++(void) initialize +{ + ScalerNameToIdTransformer *sNToITransformer; + MachineScalerIsEnabled *machineScalerIsEnabled; + MachineNameToIdTransformer *mToITransformer; + VolumeSliderToPrefTransformer *vsToPTransformer; + + sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:sNToITransformer + forName:@"ScalerNameToIdTransformer"]; + + machineScalerIsEnabled = [[MachineScalerIsEnabled + machineScalerIsEnabledWithInt:1] + autorelease]; + + [NSValueTransformer setValueTransformer:machineScalerIsEnabled + forName:@"MachineTimexIsEnabled"]; + + machineScalerIsEnabled = [[MachineScalerIsEnabled + machineScalerIsEnabledWithInt:0] + autorelease]; + + [NSValueTransformer setValueTransformer:machineScalerIsEnabled + forName:@"MachineTimexIsDisabled"]; + + mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:mToITransformer + forName:@"MachineNameToIdTransformer"]; + + vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:vsToPTransformer + forName:@"VolumeSliderToPrefTransformer"]; + +} + - (id) initWithFrame:(NSRect)frameRect { // Init pixel format attribs @@ -91,44 +146,8 @@ if( fuse_init( ac, av ) ) { fprintf( stderr, "%s: error initialising -- giving up!\n", fuse_progname ); } -} -+(void) initialize -{ - ScalerNameToIdTransformer *sNToITransformer; - MachineScalerIsEnabled *machineScalerIsEnabled; - MachineNameToIdTransformer *mToITransformer; - VolumeSliderToPrefTransformer *vsToPTransformer; - - sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:sNToITransformer - forName:@"ScalerNameToIdTransformer"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:1] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsEnabled"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:0] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsDisabled"]; - - mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:mToITransformer - forName:@"MachineNameToIdTransformer"]; - - vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:vsToPTransformer - forName:@"VolumeSliderToPrefTransformer"]; - + [self initKeyboard]; } - (void)drawRect:(NSRect)aRect @@ -290,4 +309,120 @@ { } +-(void) initKeyboard +{ + keysyms_map_t *ptr3; + + unicode_keysyms_hash = g_hash_table_new( g_int_hash, g_int_equal ); + + for( ptr3 = (keysyms_map_t *)unicode_keysyms_map; ptr3->ui; ptr3++ ) + g_hash_table_insert( unicode_keysyms_hash, &( ptr3->ui ), + &( ptr3->fuse ) ); +} + +-(void) flagsChanged:(NSEvent *)theEvent +{ + static BOOL optDown = NO; + static BOOL ctrlDown = NO; + static BOOL shiftDown = NO; + int flags = [theEvent modifierFlags]; + BOOL optDownNew = (flags & NSAlternateKeyMask) ? YES : NO; + BOOL ctrlDownNew = (flags & NSControlKeyMask) ? YES : NO; + BOOL shiftDownNew = ( flags & NSShiftKeyMask ) ? YES : NO; + + if( optDown != optDownNew ) { + input_event_t fuse_event; + fuse_event.types.key.spectrum_key = INPUT_KEY_Alt_L; + if( optDownNew == YES ) + fuse_event.type = INPUT_EVENT_KEYPRESS; + else + fuse_event.type = INPUT_EVENT_KEYRELEASE; + input_event( &fuse_event ); + } + + if( ctrlDown != ctrlDownNew ) { + input_event_t fuse_event; + fuse_event.types.key.spectrum_key = INPUT_KEY_Control_L; + if( ctrlDownNew == YES ) + fuse_event.type = INPUT_EVENT_KEYPRESS; + else + fuse_event.type = INPUT_EVENT_KEYRELEASE; + input_event( &fuse_event ); + } + + if( shiftDown != shiftDownNew ) { + input_event_t fuse_event; + fuse_event.types.key.spectrum_key = INPUT_KEY_Shift_L; + if( shiftDownNew == YES ) + fuse_event.type = INPUT_EVENT_KEYPRESS; + else + fuse_event.type = INPUT_EVENT_KEYRELEASE; + input_event( &fuse_event ); + } + + optDown = optDownNew; + ctrlDown = ctrlDownNew; + shiftDown = shiftDownNew; +} + +-(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type +{ + unsigned short keyCode = [theEvent keyCode]; + NSString *characters = [theEvent charactersIgnoringModifiers]; + if ([characters length]) { + input_key fuse_keysym; + input_event_t fuse_event; + + fuse_keysym = keysyms_remap( keyCode ); + if( fuse_keysym == INPUT_KEY_NONE ) { + fuse_keysym = other_keysyms_remap( [characters characterAtIndex:0], + unicode_keysyms_hash ); + if( fuse_keysym != INPUT_KEY_NONE ) { + unicode_keysym = fuse_keysym; + /* record current values of caps and symbol shift. We will temoprarily + * override these for the duration of the unicoded simulated keypresses + */ + if( ( cocoakeyboard_caps_shift_pressed = keyboard_state( KEYBOARD_Caps ) ) ) + { + keyboard_release( KEYBOARD_Caps ); + } + if( ( cocoakeyboard_symbol_shift_pressed = + keyboard_state( KEYBOARD_Symbol ) ) ) { + keyboard_release( KEYBOARD_Symbol ); + } + } + } + + fuse_event.type = type; + fuse_event.types.key.spectrum_key = fuse_keysym; + + input_event( &fuse_event ); + } +} + +-(void) keyDown:(NSEvent *)theEvent +{ + [self keyChange:theEvent type:INPUT_EVENT_KEYPRESS]; +} + +-(void) keyUp:(NSEvent *)theEvent +{ + [self keyChange:theEvent type:INPUT_EVENT_KEYRELEASE]; +} + +- (BOOL)acceptsFirstResponder +{ + return YES; +} + +- (BOOL)becomeFirstResponder +{ + return YES; +} + +- (BOOL)resignFirstResponder +{ + return YES; +} + @end Deleted: branches/fusegl/fuse/ui/cocoa/keysyms.c =================================================================== --- branches/fusegl/fuse/ui/cocoa/keysyms.c 2006-12-19 11:28:44 UTC (rev 256) +++ branches/fusegl/fuse/ui/cocoa/keysyms.c 2006-12-20 01:44:56 UTC (rev 257) @@ -1,172 +0,0 @@ -/* keysyms.c: UI keysym to Fuse input layer keysym mappings - Copyright (c) 2000-2005 Philip Kendall, Matan Ziv-Av, Russell Marks, - Fredrick Meunier, Catalin Mihaila - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 49 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Author contact information: - - E-mail: pak...@sr... - Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England - -*/ - -/* This file is autogenerated from keysyms.dat by keysyms.pl. - Do not edit unless you know what you're doing! */ - -#include <config.h> - -#include "input.h" -#include "keyboard.h" - -/* Map ADC keyboard scancode to Fuse input layer keysym for Spectrum - virtual keyboard */ -const keysyms_map_t keysyms_map[] = { - - { 18, INPUT_KEY_1 }, - { 19, INPUT_KEY_2 }, - { 20, INPUT_KEY_3 }, - { 21, INPUT_KEY_4 }, - { 23, INPUT_KEY_5 }, - { 22, INPUT_KEY_6 }, - { 26, INPUT_KEY_7 }, - { 28, INPUT_KEY_8 }, - { 25, INPUT_KEY_9 }, - { 29, INPUT_KEY_0 }, - { 12, INPUT_KEY_q }, - { 13, INPUT_KEY_w }, - { 14, INPUT_KEY_e }, - { 15, INPUT_KEY_r }, - { 17, INPUT_KEY_t }, - { 16, INPUT_KEY_y }, - { 32, INPUT_KEY_u }, - { 34, INPUT_KEY_i }, - { 31, INPUT_KEY_o }, - { 35, INPUT_KEY_p }, - { 0, INPUT_KEY_a }, - { 1, INPUT_KEY_s }, - { 2, INPUT_KEY_d }, - { 3, INPUT_KEY_f }, - { 5, INPUT_KEY_g }, - { 4, INPUT_KEY_h }, - { 38, INPUT_KEY_j }, - { 40, INPUT_KEY_k }, - { 37, INPUT_KEY_l }, - { 6, INPUT_KEY_z }, - { 7, INPUT_KEY_x }, - { 8, INPUT_KEY_c }, - { 9, INPUT_KEY_v }, - { 11, INPUT_KEY_b }, - { 45, INPUT_KEY_n }, - { 46, INPUT_KEY_m }, - - { 0xff, 0 } /* End marker: DO NOT MOVE! */ - -}; - -/* Map things with no reasonable Unicode value (modifiers etc.) from SDL sym - to Fuse input layer keysym */ -const keysyms_map_t modifier_keysyms_map[] = { -#if 0 - { SDLK_ESCAPE, INPUT_KEY_Escape }, - { SDLK_F1, INPUT_KEY_F1 }, - { SDLK_F2, INPUT_KEY_F2 }, - { SDLK_F3, INPUT_KEY_F3 }, - { SDLK_F4, INPUT_KEY_F4 }, - { SDLK_F5, INPUT_KEY_F5 }, - { SDLK_F6, INPUT_KEY_F6 }, - { SDLK_F7, INPUT_KEY_F7 }, - { SDLK_F8, INPUT_KEY_F8 }, - { SDLK_F9, INPUT_KEY_F9 }, - { SDLK_F10, INPUT_KEY_F10 }, - { SDLK_F11, INPUT_KEY_F11 }, - { SDLK_F12, INPUT_KEY_F12 }, - { SDLK_BACKSPACE, INPUT_KEY_BackSpace }, - { SDLK_TAB, INPUT_KEY_Tab }, - //{ SDLK_CAPSLOCK, INPUT_KEY_Caps_Lock }, - { SDLK_RETURN, INPUT_KEY_Return }, - { SDLK_LSHIFT, INPUT_KEY_Shift_L }, - { SDLK_RSHIFT, INPUT_KEY_Shift_R }, - { SDLK_LCTRL, INPUT_KEY_Control_L }, - { SDLK_LALT, INPUT_KEY_Alt_L }, - { SDLK_LSUPER, INPUT_KEY_Super_L }, - { SDLK_SPACE, INPUT_KEY_space }, - { SDLK_RSUPER, INPUT_KEY_Super_R }, - { SDLK_RALT, INPUT_KEY_Alt_R }, - { SDLK_RCTRL, INPUT_KEY_Control_R }, - { SDLK_MENU, INPUT_KEY_Mode_switch }, - { SDLK_LEFT, INPUT_KEY_Left }, - { SDLK_DOWN, INPUT_KEY_Down }, - { SDLK_UP, INPUT_KEY_Up }, - { SDLK_RIGHT, INPUT_KEY_Right }, - { SDLK_PAGEUP, INPUT_KEY_Page_Up }, - { SDLK_PAGEDOWN, INPUT_KEY_Page_Down }, - { SDLK_HOME, INPUT_KEY_Home }, - { SDLK_END, INPUT_KEY_End }, - { SDLK_KP1, INPUT_KEY_1 }, - { SDLK_KP2, INPUT_KEY_2 }, - { SDLK_KP3, INPUT_KEY_3 }, - { SDLK_KP4, INPUT_KEY_4 }, - { SDLK_KP5, INPUT_KEY_5 }, - { SDLK_KP6, INPUT_KEY_6 }, - { SDLK_KP7, INPUT_KEY_7 }, - { SDLK_KP8, INPUT_KEY_8 }, - { SDLK_KP9, INPUT_KEY_9 }, - { SDLK_KP0, INPUT_KEY_0 }, - { SDLK_KP_PERIOD, INPUT_KEY_period }, - { SDLK_KP_DIVIDE, INPUT_KEY_slash }, - { SDLK_KP_MULTIPLY, INPUT_KEY_star }, - { SDLK_KP_MINUS, INPUT_KEY_minus }, - { SDLK_KP_PLUS, INPUT_KEY_plus }, - { SDLK_KP_ENTER, INPUT_KEY_Return }, - { SDLK_KP_EQUALS, INPUT_KEY_equal }, -#endif - { 0, 0 } /* End marker: DO NOT MOVE! */ - -}; - -/* Map low byte of UCS-2(?) Unicode to Fuse input layer keysym for - non-extended mode Spectrum symbols present on keyboards */ -// Need to have identified these before processing shift et al. -const keysyms_map_t unicode_keysyms_map[] = { - - { '-', INPUT_KEY_minus }, - { '_', INPUT_KEY_underscore }, - { '=', INPUT_KEY_equal }, - { '+', INPUT_KEY_plus }, - { ';', INPUT_KEY_semicolon }, - { ':', INPUT_KEY_colon }, - { '\'', INPUT_KEY_apostrophe }, - { '"', INPUT_KEY_quotedbl }, - { '#', INPUT_KEY_numbersign }, - { ',', INPUT_KEY_comma }, - { '<', INPUT_KEY_less }, - { '.', INPUT_KEY_period }, - { '>', INPUT_KEY_greater }, - { '/', INPUT_KEY_slash }, - { '?', INPUT_KEY_question }, - { '!', INPUT_KEY_exclamation }, - { '@', INPUT_KEY_at }, - { '$', INPUT_KEY_dollar }, - { '%', INPUT_KEY_percent }, - { '&', INPUT_KEY_ampersand }, - { '(', INPUT_KEY_lbracket }, - { ')', INPUT_KEY_rbracket }, - { '^', INPUT_KEY_carat }, - { '*', INPUT_KEY_star }, - - { 0, 0 } /* End marker: DO NOT MOVE! */ - -}; Copied: branches/fusegl/fuse/ui/cocoa/keysyms.m (from rev 253, branches/fusegl/fuse/ui/cocoa/keysyms.c) =================================================================== --- branches/fusegl/fuse/ui/cocoa/keysyms.m (rev 0) +++ branches/fusegl/fuse/ui/cocoa/keysyms.m 2006-12-20 01:44:56 UTC (rev 257) @@ -0,0 +1,157 @@ +/* keysyms.c: UI keysym to Fuse input layer keysym mappings + Copyright (c) 2000-2005 Philip Kendall, Matan Ziv-Av, Russell Marks, + Fredrick Meunier, Catalin Mihaila + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 49 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Author contact information: + + E-mail: pak...@sr... + Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England + +*/ + +/* This file is autogenerated from keysyms.dat by keysyms.pl. + Do not edit unless you know what you're doing! */ + +#import <AppKit/NSEvent.h> + +#include <config.h> + +#include "input.h" +#include "keyboard.h" + +/* Map ADC keyboard scancode to Fuse input layer keysym for Spectrum + virtual keyboard */ +const keysyms_map_t keysyms_map[] = { + + { 53, INPUT_KEY_Escape }, + { 48, INPUT_KEY_Tab }, + { 36, INPUT_KEY_Return }, + /* Start keypad */ + { 83, INPUT_KEY_1 }, + { 84, INPUT_KEY_2 }, + { 85, INPUT_KEY_3 }, + { 86, INPUT_KEY_4 }, + { 87, INPUT_KEY_5 }, + { 88, INPUT_KEY_6 }, + { 89, INPUT_KEY_7 }, + { 91, INPUT_KEY_8 }, + { 92, INPUT_KEY_9 }, + { 82, INPUT_KEY_0 }, + { 65, INPUT_KEY_period }, + { 75, INPUT_KEY_slash }, + { 67, INPUT_KEY_star }, + { 78, INPUT_KEY_minus }, + { 69, INPUT_KEY_plus }, + { 76, INPUT_KEY_Return }, + { 81, INPUT_KEY_equal }, + /* End keypad */ + { 18, INPUT_KEY_1 }, + { 19, INPUT_KEY_2 }, + { 20, INPUT_KEY_3 }, + { 21, INPUT_KEY_4 }, + { 23, INPUT_KEY_5 }, + { 22, INPUT_KEY_6 }, + { 26, INPUT_KEY_7 }, + { 28, INPUT_KEY_8 }, + { 25, INPUT_KEY_9 }, + { 29, INPUT_KEY_0 }, + { 12, INPUT_KEY_q }, + { 13, INPUT_KEY_w }, + { 14, INPUT_KEY_e }, + { 15, INPUT_KEY_r }, + { 17, INPUT_KEY_t }, + { 16, INPUT_KEY_y }, + { 32, INPUT_KEY_u }, + { 34, INPUT_KEY_i }, + { 31, INPUT_KEY_o }, + { 35, INPUT_KEY_p }, + { 0, INPUT_KEY_a }, + { 1, INPUT_KEY_s }, + { 2, INPUT_KEY_d }, + { 3, INPUT_KEY_f }, + { 5, INPUT_KEY_g }, + { 4, INPUT_KEY_h }, + { 38, INPUT_KEY_j }, + { 40, INPUT_KEY_k }, + { 37, INPUT_KEY_l }, + { 6, INPUT_KEY_z }, + { 7, INPUT_KEY_x }, + { 8, INPUT_KEY_c }, + { 9, INPUT_KEY_v }, + { 11, INPUT_KEY_b }, + { 45, INPUT_KEY_n }, + { 46, INPUT_KEY_m }, + { 49, INPUT_KEY_space }, + + { 0xff, 0 } /* End marker: DO NOT MOVE! */ + +}; + +/* Map low byte of UCS-2(?) Unicode to Fuse input layer keysym for + non-extended mode Spectrum symbols present on keyboards */ +const keysyms_map_t unicode_keysyms_map[] = { + + { NSUpArrowFunctionKey, INPUT_KEY_Up }, + { NSDownArrowFunctionKey, INPUT_KEY_Down }, + { NSLeftArrowFunctionKey, INPUT_KEY_Left }, + { NSRightArrowFunctionKey, INPUT_KEY_Right }, + { NSF1FunctionKey, INPUT_KEY_F1 }, + { NSF2FunctionKey, INPUT_KEY_F2 }, + { NSF3FunctionKey, INPUT_KEY_F3 }, + { NSF4FunctionKey, INPUT_KEY_F4 }, + { NSF5FunctionKey, INPUT_KEY_F5 }, + { NSF6FunctionKey, INPUT_KEY_F6 }, + { NSF7FunctionKey, INPUT_KEY_F7 }, + { NSF8FunctionKey, INPUT_KEY_F8 }, + { NSF9FunctionKey, INPUT_KEY_F9 }, + { NSF10FunctionKey, INPUT_KEY_F10 }, + { NSF11FunctionKey, INPUT_KEY_F11 }, + { NSF12FunctionKey, INPUT_KEY_F12 }, + { NSDeleteFunctionKey, INPUT_KEY_BackSpace }, + { NSHomeFunctionKey, INPUT_KEY_Home }, + { NSEndFunctionKey, INPUT_KEY_End }, + { NSPageUpFunctionKey, INPUT_KEY_Page_Up }, + { NSPageDownFunctionKey, INPUT_KEY_Page_Down }, + { NSMenuFunctionKey, INPUT_KEY_Mode_switch }, + { '-', INPUT_KEY_minus }, + { '_', INPUT_KEY_underscore }, + { '=', INPUT_KEY_equal }, + { '+', INPUT_KEY_plus }, + { ';', INPUT_KEY_semicolon }, + { ':', INPUT_KEY_colon }, + { '\'', INPUT_KEY_apostrophe }, + { '"', INPUT_KEY_quotedbl }, + { '#', INPUT_KEY_numbersign }, + { ',', INPUT_KEY_comma }, + { '<', INPUT_KEY_less }, + { '.', INPUT_KEY_period }, + { '>', INPUT_KEY_greater }, + { '/', INPUT_KEY_slash }, + { '?', INPUT_KEY_question }, + { '!', INPUT_KEY_exclamation }, + { '@', INPUT_KEY_at }, + { '$', INPUT_KEY_dollar }, + { '%', INPUT_KEY_percent }, + { '&', INPUT_KEY_ampersand }, + { '(', INPUT_KEY_lbracket }, + { ')', INPUT_KEY_rbracket }, + { '^', INPUT_KEY_carat }, + { '*', INPUT_KEY_star }, + + { 0, 0 } /* End marker: DO NOT MOVE! */ + +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |