PageRenderTime 79ms CodeModel.GetById 14ms app.highlight 60ms RepoModel.GetById 2ms app.codeStats 0ms

/src/ois/src/mac/MacKeyboard.cpp

https://bitbucket.org/cabalistic/ogredeps/
C++ | 478 lines | 300 code | 91 blank | 87 comment | 48 complexity | 37891f668e08ce8d259706aa6445ee3b MD5 | raw file
  1/*
  2 The zlib/libpng License
  3 
  4 Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
  5 
  6 This software is provided 'as-is', without any express or implied warranty. In no event will
  7 the authors be held liable for any damages arising from the use of this software.
  8 
  9 Permission is granted to anyone to use this software for any purpose, including commercial
 10 applications, and to alter it and redistribute it freely, subject to the following
 11 restrictions:
 12 
 13 1. The origin of this software must not be misrepresented; you must not claim that
 14 you wrote the original software. If you use this software in a product,
 15 an acknowledgment in the product documentation would be appreciated but is
 16 not required.
 17 
 18 2. Altered source versions must be plainly marked as such, and must not be
 19 misrepresented as being the original software.
 20 
 21 3. This notice may not be removed or altered from any source distribution.
 22 */
 23
 24#ifndef __LP64__
 25
 26#include "mac/MacKeyboard.h"
 27#include "mac/MacInputManager.h"
 28#include "mac/MacHelpers.h"
 29#include "OISException.h"
 30#include "OISEvents.h"
 31
 32#include <Carbon/Carbon.h>
 33
 34#include <list>
 35#include <string>
 36
 37const EventTypeSpec DownSpec[] = {{kEventClassKeyboard, kEventRawKeyDown},	//non - repeats
 38							{kEventClassKeyboard, kEventRawKeyRepeat}}; //repeats
 39const EventTypeSpec UpSpec = {kEventClassKeyboard, kEventRawKeyUp},
 40			  ModSpec = {kEventClassKeyboard, kEventRawKeyModifiersChanged};
 41
 42const EventTypeSpec AllSpecs[] = {{kEventClassKeyboard, kEventRawKeyDown},
 43						  {kEventClassKeyboard, kEventRawKeyRepeat},
 44						  {kEventClassKeyboard, kEventRawKeyUp},
 45						  {kEventClassKeyboard, kEventRawKeyModifiersChanged}};
 46
 47using namespace OIS;
 48
 49//-------------------------------------------------------------------//
 50MacKeyboard::MacKeyboard( InputManager* creator, bool buffered, bool repeat )
 51	: Keyboard(creator->inputSystemName(), buffered, 0, creator)
 52{
 53	keyDownEventRef = NULL;
 54	keyUpEventRef = NULL;
 55	keyModEventRef = NULL;
 56	
 57	useRepeat = repeat;
 58
 59	// Get a so-called "Univeral procedure pointer" for our callback
 60	keyDownUPP = NewEventHandlerUPP( KeyDownWrapper );
 61	keyUpUPP   = NewEventHandlerUPP( KeyUpWrapper );
 62	keyModUPP  = NewEventHandlerUPP( KeyModWrapper );
 63	
 64	// populate the conversion map
 65	populateKeyConversion();
 66
 67	static_cast<MacInputManager*>(mCreator)->_setKeyboardUsed(true);
 68}
 69
 70//-------------------------------------------------------------------//
 71MacKeyboard::~MacKeyboard()
 72{
 73	// Remove our handlers so that this instance doesn't get called
 74	// after it is deleted
 75	if (keyDownEventRef != NULL)
 76		RemoveEventHandler(keyDownEventRef);
 77		
 78	if (keyUpEventRef != NULL)
 79		RemoveEventHandler(keyUpEventRef);
 80	
 81	if (keyModEventRef != NULL)
 82		RemoveEventHandler(keyModEventRef);
 83	
 84	// dispose of our UPPs
 85	DisposeEventHandlerUPP(keyDownUPP);
 86	DisposeEventHandlerUPP(keyUpUPP);
 87	DisposeEventHandlerUPP(keyModUPP);
 88
 89	//Free the input managers keyboard
 90	static_cast<MacInputManager*>(mCreator)->_setKeyboardUsed(false);
 91}
 92
 93//-------------------------------------------------------------------//
 94void MacKeyboard::_initialize()
 95{
 96	EventTargetRef event = ((MacInputManager*)mCreator)->_getEventTarget();
 97
 98	memset( &KeyBuffer, 0, 256 );
 99	mModifiers = 0;
100	prevModMask = 0;
101	
102	// just in case this gets called after the first time.. better safe
103	if (keyDownEventRef != NULL)
104		RemoveEventHandler(keyDownEventRef);
105		
106	if (keyUpEventRef != NULL)
107		RemoveEventHandler(keyUpEventRef);
108		
109	if (keyModEventRef != NULL)
110		RemoveEventHandler(keyModEventRef);
111   
112	keyDownEventRef = NULL;
113	keyUpEventRef = NULL;
114	keyModEventRef = NULL;
115
116	OSStatus status;
117	// send both elements of downspec array... second index is for repeat events
118	if ( useRepeat )
119		status = InstallEventHandler( event, keyDownUPP, 2, DownSpec, this, &keyDownEventRef );
120	else
121		status = InstallEventHandler( event, keyDownUPP, 1, DownSpec, this, &keyDownEventRef );
122		
123	if (status != noErr)
124		OIS_EXCEPT( E_General, "MacKeyboard::_initialize >> Error loading KeyDown event handler" );
125
126	if (InstallEventHandler( event, keyUpUPP, 1, &UpSpec, this, &keyUpEventRef ) != noErr)
127		OIS_EXCEPT( E_General, "MacKeyboard::_initialize >> Error loading KeyUp event handler" );
128
129	if (InstallEventHandler( event, keyModUPP, 1, &ModSpec, this, &keyModEventRef ) != noErr )
130		OIS_EXCEPT( E_General, "MacKeyboard::_initialize >> Error loading Keymods event handler" );
131}
132
133//-------------------------------------------------------------------//
134bool MacKeyboard::isKeyDown( KeyCode key ) const
135{
136	return (bool)KeyBuffer[key];
137}
138
139
140//-------------------------------------------------------------------//
141void MacKeyboard::capture()
142{
143	// if not buffered just return, we update the unbuffered automatically
144	if ( !mBuffered || !mListener )
145		return;
146
147	// run through our event stack
148	eventStack::iterator cur_it;
149	
150	for (cur_it = pendingEvents.begin(); cur_it != pendingEvents.end(); cur_it++)
151	{
152		
153		if ( (*cur_it).Type == MAC_KEYDOWN || (*cur_it).Type == MAC_KEYREPEAT)
154			mListener->keyPressed( (*cur_it).Event );
155		else if ( (*cur_it).Type == MAC_KEYUP )
156			mListener->keyReleased( (*cur_it).Event );
157	}
158	
159	pendingEvents.clear();
160}
161
162
163//-------------------------------------------------------------------//
164std::string& MacKeyboard::getAsString( KeyCode key )
165{
166    CGKeyCode deviceKeycode = 0;
167    
168    // Convert OIS KeyCode back into device keycode
169    for(VirtualtoOIS_KeyMap::iterator it = keyConversion.begin(); it != keyConversion.end(); ++it)
170    {
171        if(it->second == key)
172            deviceKeycode = it->first;
173    }
174    
175    UniChar unicodeString[1];
176    UniCharCount actualStringLength = 0;
177    
178    CGEventSourceRef sref = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
179    CGEventRef ref = CGEventCreateKeyboardEvent(sref, deviceKeycode, true);
180    CGEventKeyboardGetUnicodeString(ref, sizeof(unicodeString) / sizeof(*unicodeString), &actualStringLength, unicodeString);
181//    NSLog([NSString stringWithFormat:@"%C\n", unicodeString[0]]);
182    getString = unicodeString[0];
183    CFRelease(ref);
184    CFRelease(sref);
185
186	return getString;
187}
188
189//-------------------------------------------------------------------//
190void MacKeyboard::setBuffered( bool buffered )
191{
192	mBuffered = buffered;
193}
194
195#include <iostream>
196//-------------------------------------------------------------------//
197void MacKeyboard::_keyDownCallback( EventRef theEvent )
198{
199	
200	UInt32 virtualKey;
201	
202	unsigned int time = (unsigned int)GetEventTime(theEvent);
203	
204	GetEventParameter(theEvent,
205					'kcod',			// get it in virtual keycode
206					typeUInt32, NULL,	// desired return type
207					sizeof(UInt32), NULL, 	// bufsize
208					&virtualKey );
209	
210	KeyCode kc = keyConversion[virtualKey];
211
212	// record what kind of text we should pass the KeyEvent
213	UniChar text[10];
214	char macChar;
215	
216	// TODO clean this up
217	if (mTextMode == Unicode)
218	{
219		//get string size
220		UInt32 stringsize;
221		//status = GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, 0, &stringsize, NULL);
222		//status = GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, sizeof(UniChar)*10, NULL, &text );
223		GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, sizeof(UniChar) * 10, &stringsize, &text );
224//		std::cout << "String length: " << stringsize << std::endl;
225		
226		//wstring unitext;
227		//for (int i=0;i<10;i++) unitext += (wchar_t)text[i];
228		//wcout << "Unicode out: " << unitext << endl;
229		
230		if(stringsize > 0)
231		{
232			// for each unicode char, send an event
233			stringsize--; // no termination char
234			for ( int i = 0; i < stringsize; i++ )
235			{
236				injectEvent( kc, time, MAC_KEYDOWN, (unsigned int)text[i] );
237			}
238		}
239	} 
240	else if (mTextMode == Ascii)
241	{
242		 
243		GetEventParameter( theEvent, 'kchr', typeChar, NULL, sizeof(char), NULL, &macChar );
244		injectEvent( kc, time, MAC_KEYDOWN, (unsigned int)macChar );
245	}
246	else
247	{
248		injectEvent( kc, time, MAC_KEYDOWN );
249	}
250}
251
252//-------------------------------------------------------------------//
253void MacKeyboard::_keyUpCallback( EventRef theEvent )
254{
255	UInt32 virtualKey;
256	
257	GetEventParameter( theEvent, kEventParamKeyCode, typeUInt32,
258								NULL, sizeof(UInt32), NULL, &virtualKey );
259	
260	KeyCode kc = keyConversion[virtualKey];
261	injectEvent( kc, (int)GetEventTime(theEvent), MAC_KEYUP );
262	
263}
264
265//-------------------------------------------------------------------//
266void MacKeyboard::_modChangeCallback( EventRef theEvent )
267{
268	UInt32 mods;
269	
270	GetEventParameter( theEvent, kEventParamKeyModifiers,
271								typeUInt32, NULL, sizeof(UInt32), NULL, &mods );
272	
273	// find the changed bit
274	UInt32 change = prevModMask ^ mods;
275	MacEventType newstate = ((change & prevModMask) > 0) ? MAC_KEYUP : MAC_KEYDOWN;
276	unsigned int time = (int)GetEventTime( theEvent );
277	
278	//cout << "preMask: " << hex << prevModMask << endl;
279	//cout << "ModMask: " << hex << mods << endl;
280	//cout << "Change:  " << hex << (change & prevModMask) << endl << endl;
281	
282	// TODO test modifiers on a full keyboard to check if different mask for left/right
283	switch (change)
284	{
285		case (shiftKey): // shift
286			mModifiers &= (newstate == MAC_KEYDOWN) ? Shift : ~Shift;
287			injectEvent( KC_LSHIFT, time, newstate );
288			//injectEvent( KC_RSHIFT, time, newstate );
289			break;
290			
291		case (optionKey): // option (alt)
292			mModifiers &= (newstate == MAC_KEYDOWN) ? Alt : ~Alt;
293			//injectEvent( KC_RMENU, time, newstate );
294			injectEvent( KC_LMENU, time, newstate );
295			break;
296			
297		case (controlKey): // Ctrl
298			mModifiers &= (newstate == MAC_KEYDOWN) ? Ctrl : ~Ctrl;
299			//injectEvent( KC_RCONTROL, time, newstate );
300			injectEvent( KC_LCONTROL, time, newstate );
301			break;
302	
303		case (cmdKey): // apple
304			//injectEvent( KC_RWIN, time, newstate );
305			injectEvent( KC_LWIN, time, newstate );
306			break;
307	
308		case (kEventKeyModifierFnMask): // fn key
309			injectEvent( KC_APPS, time, newstate );
310			break;
311			
312		case (kEventKeyModifierNumLockMask): // numlock
313			injectEvent( KC_NUMLOCK, time, newstate );
314			break;
315			
316		case (alphaLock): // caps lock
317			injectEvent( KC_CAPITAL, time, newstate );
318			break;
319	}
320	
321	prevModMask = mods;
322}
323
324//-------------------------------------------------------------------//
325void MacKeyboard::injectEvent( KeyCode kc, unsigned int time, MacEventType type, unsigned int txt )
326{
327	// set to 1 if this is either a keydown or repeat
328	KeyBuffer[kc] = ( type == MAC_KEYUP ) ? 0 : 1;
329	
330	if ( mBuffered && mListener )
331		pendingEvents.push_back( MacKeyStackEvent( KeyEvent(this, kc, txt), type) );
332}
333
334
335//-------------------------------------------------------------------//
336void MacKeyboard::copyKeyStates( char keys[256] ) const
337{
338	memcpy( keys, KeyBuffer, 256 );
339}
340
341
342
343//-------------------------------------------------------------------//
344void MacKeyboard::populateKeyConversion()
345{
346	// TODO finish the key mapping
347	
348	// Virtual Key Map to KeyCode
349	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x12, KC_1));
350	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x13, KC_2));
351	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x14, KC_3));
352	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x15, KC_4));
353	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x17, KC_5));
354	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x16, KC_6));
355	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x1A, KC_7));
356	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x1C, KC_8));
357	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x19, KC_9));
358	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x1D, KC_0));
359	
360	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x33, KC_BACK));  // might be wrong
361	
362	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x1B, KC_MINUS));
363	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x18, KC_EQUALS));
364	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x31, KC_SPACE));
365	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x2B, KC_COMMA));
366	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x2F, KC_PERIOD));
367	
368	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x2A, KC_BACKSLASH));
369	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x2C, KC_SLASH));
370	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x21, KC_LBRACKET));
371	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x1E, KC_RBRACKET));
372	
373	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x35, KC_ESCAPE));
374	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x39, KC_CAPITAL));
375	
376	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x30, KC_TAB));
377	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x24, KC_RETURN));  // double check return/enter
378	
379	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_colon, KC_COLON));	 // no colon?
380	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x29, KC_SEMICOLON));
381	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x27, KC_APOSTROPHE));
382	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x32, KC_GRAVE));
383	
384	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x0B, KC_B));
385	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x00, KC_A));
386	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x08, KC_C));
387	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x02, KC_D));
388	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x0E, KC_E));
389	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x03, KC_F));
390	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x05, KC_G));
391	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x04, KC_H));
392	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x22, KC_I));
393	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x26, KC_J));
394	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x28, KC_K));
395	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x25, KC_L));
396	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x2E, KC_M));
397	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x2D, KC_N));
398	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x1F, KC_O));
399	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x23, KC_P));
400	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x0C, KC_Q));
401	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x0F, KC_R));
402	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x01, KC_S));
403	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x11, KC_T));
404	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x20, KC_U));
405	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x09, KC_V));
406	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x0D, KC_W));
407	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x07, KC_X));
408	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x10, KC_Y));
409	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x06, KC_Z));
410	
411	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x7A, KC_F1));
412	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x78, KC_F2));
413	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x63, KC_F3));
414	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x76, KC_F4));
415	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x60, KC_F5));
416	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x61, KC_F6));
417	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x62, KC_F7));
418	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x64, KC_F8));
419	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x65, KC_F9));
420	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x6D, KC_F10));
421	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x67, KC_F11));
422	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x6F, KC_F12));
423	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x69, KC_F13));
424	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x6B, KC_F14));
425	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x71, KC_F15));
426	
427	//Keypad
428	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x52, KC_NUMPAD0));
429	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x53, KC_NUMPAD1));
430	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x54, KC_NUMPAD2));
431	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x55, KC_NUMPAD3));
432	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x56, KC_NUMPAD4));
433	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x57, KC_NUMPAD5));
434	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x58, KC_NUMPAD6));
435	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x59, KC_NUMPAD7));
436	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x5B, KC_NUMPAD8));
437	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x5C, KC_NUMPAD9));
438	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x45, KC_ADD));
439	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x4E, KC_SUBTRACT));
440	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x41, KC_DECIMAL));
441	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x51, KC_NUMPADEQUALS));
442	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x4B, KC_DIVIDE));
443	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x43, KC_MULTIPLY));
444	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x4C, KC_NUMPADENTER));
445	
446	//Keypad with numlock off
447	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x73, KC_NUMPAD7));  // not sure of these
448	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Up, KC_NUMPAD8)); // check on a non-laptop
449	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Page_Up, KC_NUMPAD9));
450	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Left, KC_NUMPAD4));
451	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Begin, KC_NUMPAD5));
452	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Right, KC_NUMPAD6));
453	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_End, KC_NUMPAD1));
454	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Down, KC_NUMPAD2));
455	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Page_Down, KC_NUMPAD3));
456	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Insert, KC_NUMPAD0));
457	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_KP_Delete, KC_DECIMAL));
458	
459	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x7E, KC_UP));
460	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x7D, KC_DOWN));
461	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x7B, KC_LEFT));
462	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x7C, KC_RIGHT));
463	
464	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x74, KC_PGUP));
465	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x79, KC_PGDOWN));
466	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x73, KC_HOME));
467	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x77, KC_END));
468	
469	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_Print, KC_SYSRQ));		// ??
470	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_Scroll_Lock, KC_SCROLL)); // ??
471	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_Pause, KC_PAUSE));		// ??
472	
473	
474	//keyConversion.insert(VirtualtoOIS_KeyMap::value_type(XK_Insert, KC_INSERT));	  // ??
475	keyConversion.insert(VirtualtoOIS_KeyMap::value_type(0x75, KC_DELETE)); // del under help key?
476}
477
478#endif