@@ -1350,6 +1350,9 @@ SetFormatAndEncodings(rfbClient* client)
13501350 if (se -> nEncodings < MAX_ENCODINGS )
13511351 encs [se -> nEncodings ++ ] = rfbClientSwap32IfLE (rfbEncodingXvp );
13521352
1353+ if (se -> nEncodings < MAX_ENCODINGS )
1354+ encs [se -> nEncodings ++ ] = rfbClientSwap32IfLE (rfbEncodingQemuExtendedKeyEvent );
1355+
13531356 /* client extensions */
13541357 for (e = rfbClientExtensions ; e ; e = e -> next )
13551358 if (e -> encodings ) {
@@ -1586,6 +1589,31 @@ SendKeyEvent(rfbClient* client, uint32_t key, rfbBool down)
15861589}
15871590
15881591
1592+ /*
1593+ * SendExtendedKeyEvent.
1594+ */
1595+
1596+ rfbBool
1597+ SendExtendedKeyEvent (rfbClient * client , uint32_t keysym , uint32_t keycode , rfbBool down )
1598+ {
1599+ rfbQemuExtendedKeyEventMsg ke ;
1600+
1601+ /* FIXME: rfbQemuEvent also covers audio events, but this model for checking
1602+ * for supported messages is somewhat limited, so I'll leave this as is for
1603+ * now.
1604+ */
1605+ if (!SupportsClient2Server (client , rfbQemuEvent )) return FALSE;
1606+
1607+ memset (& ke , 0 , sizeof (ke ));
1608+ ke .type = rfbQemuEvent ;
1609+ ke .subtype = 0 ; /* key event subtype */
1610+ ke .down = rfbClientSwap16IfLE (!!down );
1611+ ke .keysym = rfbClientSwap32IfLE (keysym );
1612+ ke .keycode = rfbClientSwap32IfLE (keycode );
1613+ return WriteToRFBServer (client , (char * )& ke , sz_rfbQemuExtendedKeyEventMsg );
1614+ }
1615+
1616+
15891617/*
15901618 * SendClientCutText.
15911619 */
@@ -2073,6 +2101,10 @@ HandleRFBServerMessage(rfbClient* client)
20732101
20742102#endif
20752103
2104+ case rfbEncodingQemuExtendedKeyEvent :
2105+ SetClient2Server (client , rfbQemuEvent );
2106+ break ;
2107+
20762108 default :
20772109 {
20782110 rfbBool handled = FALSE;
0 commit comments