MCPcopy Create free account
hub / github.com/InstantWebP2P/peer-vnc / sync

Function sync

front/include/keyboard.js:93–125  ·  view source on GitHub ↗
(evt, keysym)

Source from the content-addressed store, hash-verified

91 state[XK_Meta_L] = false;
92
93 function sync(evt, keysym) {
94 var result = [];
95 function syncKey(keysym) {
96 return {keysym: keysyms.lookup(keysym), type: state[keysym] ? 'keydown' : 'keyup'};
97 }
98
99 if (evt.ctrlKey !== undefined &&
100 evt.ctrlKey !== state[XK_Control_L] && keysym !== XK_Control_L) {
101 state[XK_Control_L] = evt.ctrlKey;
102 result.push(syncKey(XK_Control_L));
103 }
104 if (evt.altKey !== undefined &&
105 evt.altKey !== state[XK_Alt_L] && keysym !== XK_Alt_L) {
106 state[XK_Alt_L] = evt.altKey;
107 result.push(syncKey(XK_Alt_L));
108 }
109 if (evt.altGraphKey !== undefined &&
110 evt.altGraphKey !== state[XK_ISO_Level3_Shift] && keysym !== XK_ISO_Level3_Shift) {
111 state[XK_ISO_Level3_Shift] = evt.altGraphKey;
112 result.push(syncKey(XK_ISO_Level3_Shift));
113 }
114 if (evt.shiftKey !== undefined &&
115 evt.shiftKey !== state[XK_Shift_L] && keysym !== XK_Shift_L) {
116 state[XK_Shift_L] = evt.shiftKey;
117 result.push(syncKey(XK_Shift_L));
118 }
119 if (evt.metaKey !== undefined &&
120 evt.metaKey !== state[XK_Meta_L] && keysym !== XK_Meta_L) {
121 state[XK_Meta_L] = evt.metaKey;
122 result.push(syncKey(XK_Meta_L));
123 }
124 return result;
125 }
126 function syncKeyEvent(evt, down) {
127 var obj = getKeysym(evt);
128 var keysym = obj ? obj.keysym : null;

Callers 2

syncKeyEventFunction · 0.85
ModifierSyncFunction · 0.85

Calls 1

syncKeyFunction · 0.85

Tested by

no test coverage detected