/* This is a table of all keyvals. Each keycode gets KEYVALS_PER_KEYCODE entries. *TThereis1keyvalpermodifier(Nothing,Shift,Alt,Shift+Alt);
*/ static guint *keyval_array = NULL;
/* Keys only in JIS layout. *Therationaleofthesekeycodesis<HIToolbox/Events.h>inCarbon.
*/ conststaticstruct {
guint keycode;
guint keyval;
} jis_keys[] = { #if0 /* Although These keys are also defined in <HIToolbox/Events.h>, they can be *translatedbyUCKeyTranslatecorrectly.
*/
{ 0x5D, GDK_KEY_yen },
{ 0x5E, GDK_KEY_underscore },
{ 0x5F, GDK_KEY_comma }, #endif /* These keys are unexpectedly translated to Space key by UCKeyTranslate, *andthereisnosuitableucsvalueforthemtoaddtospecial_ucs_table. *Soweshouldtranslatethemparticularly.
*/
{ 0x66 /* 102 */, GDK_KEY_Eisu_toggle },
{ 0x68 /* 104 */, GDK_KEY_Hiragana }
};
/* FIXME: Theoretically, we can get multiple UTF-16 *values;weshouldconvertthemtoproperunicodeand *figureoutwhethertherearereallykeyboardlayouts *thatgiveusmorethanonecharacterforone *keypress.
*/ if (err == noErr && nChars == 1)
{ int k;
gboolean found = FALSE;
/* A few <Shift><Option>keys return two characters, *thefirstofwhichisU+00a0,whichisn't *interesting;sowereturnthesecond.More *sophisticatedhandlingisthejobofa *GtkIMContext. * *Ifstateisn'tzero,itmeansthatit'sadead *keyofsomesort.Someofthoseareenumeratedin *thespecial_ucs_tablewiththehighnibblesetto *ftopushitintotheprivateuserange.Herewe *dothesame.
*/ if (state != 0)
chars[nChars - 1] |= 0xf000;
uc = chars[nChars - 1];
for (k = 0; k < G_N_ELEMENTS (special_ucs_table); k++)
{ if (special_ucs_table[k].ucs_value == uc)
{
p[j] = special_ucs_table[k].keyval;
found = TRUE; break;
}
}
static guint
translate_keysym (guint hardware_keycode, int group,
GdkModifierType state, int *effective_group, int *effective_level)
{ int level;
guint tmp_keyval;
/* What sort of key event is this? Returns one of *GDK_KEY_PRESS,GDK_KEY_RELEASE,GDK_NOTHING(shouldbeignored)
*/
GdkEventType
_gdk_macos_keymap_get_event_type (NSEvent *event)
{ unsignedshort keycode; unsignedint flags;
switch ((int)[event type])
{ case NSEventTypeKeyDown: return GDK_KEY_PRESS; case NSEventTypeKeyUp: return GDK_KEY_RELEASE; case NSEventTypeFlagsChanged: break; default:
g_assert_not_reached ();
}
/* For flags-changed events, we have to find the special key that caused the
* event, and see if it's in the modifier mask. */
keycode = [event keyCode];
flags = [event modifierFlags];
for (guint i = 0; i < G_N_ELEMENTS (modifier_keys); i++)
{ if (modifier_keys[i].keycode == keycode)
{ if (flags & modifier_keys[i].modmask) return GDK_KEY_PRESS; else return GDK_KEY_RELEASE;
}
}
/* Some keypresses (eg: Expose' activations) seem to trigger flags-changed
* events for no good reason. Ignore them! */ return0;
}
gboolean
_gdk_macos_keymap_is_modifier (guint keycode)
{ for (guint i = 0; i < G_N_ELEMENTS (modifier_keys); i++)
{ if (modifier_keys[i].modmask == 0) break;
if (modifier_keys[i].keycode == keycode) returnTRUE;
}
if (key >= GDK_KEY_space && key <= GDK_KEY_asciitilde) return key;
switch (key)
{ case GDK_KEY_BackSpace: return NSBackspaceCharacter; case GDK_KEY_Delete: return NSDeleteFunctionKey; case GDK_KEY_Pause: return NSPauseFunctionKey; case GDK_KEY_Scroll_Lock: return NSScrollLockFunctionKey; case GDK_KEY_Sys_Req: return NSSysReqFunctionKey; case GDK_KEY_Home: return NSHomeFunctionKey; case GDK_KEY_Left: case GDK_KEY_leftarrow: return NSLeftArrowFunctionKey; case GDK_KEY_Up: case GDK_KEY_uparrow: return NSUpArrowFunctionKey; case GDK_KEY_Right: case GDK_KEY_rightarrow: return NSRightArrowFunctionKey; case GDK_KEY_Down: case GDK_KEY_downarrow: return NSDownArrowFunctionKey; case GDK_KEY_Page_Up: return NSPageUpFunctionKey; case GDK_KEY_Page_Down: return NSPageDownFunctionKey; case GDK_KEY_End: return NSEndFunctionKey; case GDK_KEY_Begin: return NSBeginFunctionKey; case GDK_KEY_Select: return NSSelectFunctionKey; case GDK_KEY_Print: return NSPrintFunctionKey; case GDK_KEY_Execute: return NSExecuteFunctionKey; case GDK_KEY_Insert: return NSInsertFunctionKey; case GDK_KEY_Undo: return NSUndoFunctionKey; case GDK_KEY_Redo: return NSRedoFunctionKey; case GDK_KEY_Menu: return NSMenuFunctionKey; case GDK_KEY_Find: return NSFindFunctionKey; case GDK_KEY_Help: return NSHelpFunctionKey; case GDK_KEY_Break: return NSBreakFunctionKey; case GDK_KEY_Mode_switch: return NSModeSwitchFunctionKey; case GDK_KEY_F1: return NSF1FunctionKey; case GDK_KEY_F2: return NSF2FunctionKey; case GDK_KEY_F3: return NSF3FunctionKey; case GDK_KEY_F4: return NSF4FunctionKey; case GDK_KEY_F5: return NSF5FunctionKey; case GDK_KEY_F6: return NSF6FunctionKey; case GDK_KEY_F7: return NSF7FunctionKey; case GDK_KEY_F8: return NSF8FunctionKey; case GDK_KEY_F9: return NSF9FunctionKey; case GDK_KEY_F10: return NSF10FunctionKey; case GDK_KEY_F11: return NSF11FunctionKey; case GDK_KEY_F12: return NSF12FunctionKey; case GDK_KEY_F13: return NSF13FunctionKey; case GDK_KEY_F14: return NSF14FunctionKey; case GDK_KEY_F15: return NSF15FunctionKey; case GDK_KEY_F16: return NSF16FunctionKey; case GDK_KEY_F17: return NSF17FunctionKey; case GDK_KEY_F18: return NSF18FunctionKey; case GDK_KEY_F19: return NSF19FunctionKey; case GDK_KEY_F20: return NSF20FunctionKey; case GDK_KEY_F21: return NSF21FunctionKey; case GDK_KEY_F22: return NSF22FunctionKey; case GDK_KEY_F23: return NSF23FunctionKey; case GDK_KEY_F24: return NSF24FunctionKey; case GDK_KEY_F25: return NSF25FunctionKey; case GDK_KEY_F26: return NSF26FunctionKey; case GDK_KEY_F27: return NSF27FunctionKey; case GDK_KEY_F28: return NSF28FunctionKey; case GDK_KEY_F29: return NSF29FunctionKey; case GDK_KEY_F30: return NSF30FunctionKey; case GDK_KEY_F31: return NSF31FunctionKey; case GDK_KEY_F32: return NSF32FunctionKey; case GDK_KEY_F33: return NSF33FunctionKey; case GDK_KEY_F34: return NSF34FunctionKey; case GDK_KEY_F35: return NSF35FunctionKey; default: break;
}
return'\0';
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.4 Sekunden
(vorverarbeitet am 2026-07-02)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.