⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keyeventgtk.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 2 页
字号:
        case GDK_a:        case GDK_A:            return VK_A; //  (41) A key case 'a': case 'A': return 0x41;        case GDK_b:        case GDK_B:            return VK_B; //  (42) B key case 'b': case 'B': return 0x42;        case GDK_c:        case GDK_C:            return VK_C; //  (43) C key case 'c': case 'C': return 0x43;        case GDK_d:        case GDK_D:            return VK_D; //  (44) D key case 'd': case 'D': return 0x44;        case GDK_e:        case GDK_E:            return VK_E; //  (45) E key case 'e': case 'E': return 0x45;        case GDK_f:        case GDK_F:            return VK_F; //  (46) F key case 'f': case 'F': return 0x46;        case GDK_g:        case GDK_G:            return VK_G; //  (47) G key case 'g': case 'G': return 0x47;        case GDK_h:        case GDK_H:            return VK_H; //  (48) H key case 'h': case 'H': return 0x48;        case GDK_i:        case GDK_I:            return VK_I; //  (49) I key case 'i': case 'I': return 0x49;        case GDK_j:        case GDK_J:            return VK_J; //  (4A) J key case 'j': case 'J': return 0x4A;        case GDK_k:        case GDK_K:            return VK_K; //  (4B) K key case 'k': case 'K': return 0x4B;        case GDK_l:        case GDK_L:            return VK_L; //  (4C) L key case 'l': case 'L': return 0x4C;        case GDK_m:        case GDK_M:            return VK_M; //  (4D) M key case 'm': case 'M': return 0x4D;        case GDK_n:        case GDK_N:            return VK_N; //  (4E) N key case 'n': case 'N': return 0x4E;        case GDK_o:        case GDK_O:            return VK_O; //  (4F) O key case 'o': case 'O': return 0x4F;        case GDK_p:        case GDK_P:            return VK_P; //  (50) P key case 'p': case 'P': return 0x50;        case GDK_q:        case GDK_Q:            return VK_Q; //  (51) Q key case 'q': case 'Q': return 0x51;        case GDK_r:        case GDK_R:            return VK_R; //  (52) R key case 'r': case 'R': return 0x52;        case GDK_s:        case GDK_S:            return VK_S; //  (53) S key case 's': case 'S': return 0x53;        case GDK_t:        case GDK_T:            return VK_T; //  (54) T key case 't': case 'T': return 0x54;        case GDK_u:        case GDK_U:            return VK_U; //  (55) U key case 'u': case 'U': return 0x55;        case GDK_v:        case GDK_V:            return VK_V; //  (56) V key case 'v': case 'V': return 0x56;        case GDK_w:        case GDK_W:            return VK_W; //  (57) W key case 'w': case 'W': return 0x57;        case GDK_x:        case GDK_X:            return VK_X; //  (58) X key case 'x': case 'X': return 0x58;        case GDK_y:        case GDK_Y:            return VK_Y; //  (59) Y key case 'y': case 'Y': return 0x59;        case GDK_z:        case GDK_Z:            return VK_Z; //  (5A) Z key case 'z': case 'Z': return 0x5A;        case GDK_Meta_L:            return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)        case GDK_Meta_R:            return VK_RWIN; // (5C) Right Windows key (Natural keyboard)            // VK_APPS (5D) Applications key (Natural keyboard)            // VK_SLEEP (5F) Computer Sleep key            // VK_SEPARATOR (6C) Separator key            // VK_SUBTRACT (6D) Subtract key            // VK_DECIMAL (6E) Decimal key            // VK_DIVIDE (6F) Divide key            // handled by key code above        case GDK_Num_Lock:            return VK_NUMLOCK; // (90) NUM LOCK key        case GDK_Scroll_Lock:            return VK_SCROLL; // (91) SCROLL LOCK key            // VK_LSHIFT (A0) Left SHIFT key            // VK_RSHIFT (A1) Right SHIFT key            // VK_LCONTROL (A2) Left CONTROL key            // VK_RCONTROL (A3) Right CONTROL key            // VK_LMENU (A4) Left MENU key            // VK_RMENU (A5) Right MENU key            // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key            // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key            // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key            // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key            // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key            // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key            // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key            // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key            // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key            // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key            // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key            // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key            // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key            // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key            // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key            // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key            // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key            // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key            // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key        case GDK_semicolon:        case GDK_colon:            return VK_OEM_1; //case ';': case ':': return 0xBA;            // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key        case GDK_plus:        case GDK_equal:            return VK_OEM_PLUS; //case '=': case '+': return 0xBB;            // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key        case GDK_comma:        case GDK_less:            return VK_OEM_COMMA; //case ',': case '<': return 0xBC;            // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key        case GDK_minus:        case GDK_underscore:            return VK_OEM_MINUS; //case '-': case '_': return 0xBD;            // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key        case GDK_period:        case GDK_greater:            return VK_OEM_PERIOD; //case '.': case '>': return 0xBE;            // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key        case GDK_slash:        case GDK_question:            return VK_OEM_2; //case '/': case '?': return 0xBF;            // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key        case GDK_asciitilde:        case GDK_quoteleft:            return VK_OEM_3; //case '`': case '~': return 0xC0;            // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key        case GDK_bracketleft:        case GDK_braceleft:            return VK_OEM_4; //case '[': case '{': return 0xDB;            // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key        case GDK_backslash:        case GDK_bar:            return VK_OEM_5; //case '\\': case '|': return 0xDC;            // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key        case GDK_bracketright:        case GDK_braceright:            return VK_OEM_6; // case ']': case '}': return 0xDD;            // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key        case GDK_quoteright:        case GDK_quotedbl:            return VK_OEM_7; // case '\'': case '"': return 0xDE;            // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.            // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard            // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key            // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP            // VK_ATTN (F6) Attn key            // VK_CRSEL (F7) CrSel key            // VK_EXSEL (F8) ExSel key            // VK_EREOF (F9) Erase EOF key            // VK_PLAY (FA) Play key            // VK_ZOOM (FB) Zoom key            // VK_NONAME (FC) Reserved for future use            // VK_PA1 (FD) PA1 key            // VK_OEM_CLEAR (FE) Clear key        case GDK_F1:        case GDK_F2:        case GDK_F3:        case GDK_F4:        case GDK_F5:        case GDK_F6:        case GDK_F7:        case GDK_F8:        case GDK_F9:        case GDK_F10:        case GDK_F11:        case GDK_F12:        case GDK_F13:        case GDK_F14:        case GDK_F15:        case GDK_F16:        case GDK_F17:        case GDK_F18:        case GDK_F19:        case GDK_F20:        case GDK_F21:        case GDK_F22:        case GDK_F23:        case GDK_F24:            return VK_F1 + (keycode - GDK_F1);        default:            return 0;    }}static String singleCharacterString(guint val){    switch (val) {        case GDK_ISO_Enter:        case GDK_KP_Enter:        case GDK_Return:            return String("\r");        default:            gunichar c = gdk_keyval_to_unicode(val);            glong nwc;            gunichar2* uchar16 = g_ucs4_to_utf16(&c, 1, 0, &nwc, 0);            String retVal;            if (uchar16)                retVal = String((UChar*)uchar16, nwc);            else                retVal = String();            g_free(uchar16);            return retVal;    }}// Keep this in sync with the other platform event constructors// TODO: m_gdkEventKey should be refcountedPlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event)    : m_type((event->type == GDK_KEY_RELEASE) ? KeyUp : KeyDown)    , m_text(singleCharacterString(event->keyval))    , m_unmodifiedText(singleCharacterString(event->keyval))    , m_keyIdentifier(keyIdentifierForGdkKeyCode(event->keyval))    , m_autoRepeat(false)    , m_windowsVirtualKeyCode(windowsKeyCodeForKeyEvent(event->keyval))    , m_nativeVirtualKeyCode(event->keyval)    , m_isKeypad(event->keyval >= GDK_KP_Space && event->keyval <= GDK_KP_9)    , m_shiftKey((event->state & GDK_SHIFT_MASK) || (event->keyval == GDK_3270_BackTab))    , m_ctrlKey(event->state & GDK_CONTROL_MASK)    , m_altKey(event->state & GDK_MOD1_MASK)#if GTK_CHECK_VERSION(2,10,0)    , m_metaKey(event->state & GDK_META_MASK)#else    // GDK_MOD2_MASK doesn't always mean meta so we can't use it    , m_metaKey(false)#endif    , m_gdkEventKey(event){}void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode){    // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions.    ASSERT(m_type == KeyDown);    m_type = type;    if (backwardCompatibilityMode)        return;    if (type == RawKeyDown) {        m_text = String();        m_unmodifiedText = String();    } else {        m_keyIdentifier = String();        m_windowsVirtualKeyCode = 0;    }}bool PlatformKeyboardEvent::currentCapsLockState(){    notImplemented();    return false;}GdkEventKey* PlatformKeyboardEvent::gdkEventKey() const{    return m_gdkEventKey;}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -