client -> server 프로토콜
#define rfbKeyEvent 4 #define rfbPointerEvent 5 |
키보드 이벤트 관련 구조체
/*----------------------------------------------------------------------------- * KeyEvent - key press or release * * Keys are specified using the "keysym" values defined by the X Window System. * For most ordinary keys, the keysym is the same as the corresponding ASCII * value. Other common keys are: * * BackSpace 0xff08 * Tab 0xff09 * Return or Enter 0xff0d * Escape 0xff1b * Insert 0xff63 * Delete 0xffff * Home 0xff50 * End 0xff57 * Page Up 0xff55 * Page Down 0xff56 * Left 0xff51 * Up 0xff52 * Right 0xff53 * Down 0xff54 * F1 0xffbe * F2 0xffbf * ... ... * F12 0xffc9 * Shift 0xffe1 * Control 0xffe3 * Meta 0xffe7 * Alt 0xffe9 */
typedef struct { uint8_t type; /* always rfbKeyEvent */ uint8_t down; /* true if down (press), false if up */ uint16_t pad; uint32_t key; /* key is specified as an X keysym */ } rfbKeyEventMsg;
#define sz_rfbKeyEventMsg 8
typedef struct { uint8_t type; /* always rfbQemuEvent */ uint8_t subtype; /* always 0 */ uint16_t down; uint32_t keysym; /* keysym is specified as an X keysym, may be 0 */ uint32_t keycode; /* keycode is specified as XT key code */ } rfbQemuExtendedKeyEventMsg;
#define sz_rfbQemuExtendedKeyEventMsg 12 |
내용이 부실한데 드래그를 구현하려면 down 이벤트를 보고 해당 버튼의 마스크가 사라질때 까지 보고 있어야 할 듯?
uinput에서 그럼 드래그 어떻게 구현해야 하냐... ㅠㅠ
/*----------------------------------------------------------------------------- * PointerEvent - mouse/pen move and/or button press. */
typedef struct { uint8_t type; /* always rfbPointerEvent */ uint8_t buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */ uint16_t x; uint16_t y; } rfbPointerEventMsg;
#define rfbButton1Mask 1 #define rfbButton2Mask 2 #define rfbButton3Mask 4 #define rfbButton4Mask 8 #define rfbButton5Mask 16 /* RealVNC 335 method */ #define rfbWheelUpMask rfbButton4Mask #define rfbWheelDownMask rfbButton5Mask
#define sz_rfbPointerEventMsg 6 |
[링크 : https://github.com/LibVNC/libvncserver/blob/master/rfb/rfbproto.h]
키보드의 경우 키 다운, 업 이벤트가 오는 것 같고, 반복키 처리를 좀 찾아봐야 할 듯.
마우스는 buttonmask에
static void doptr(int buttonMask, int x, int y, rfbClientPtr cl) {
}
static void dokey(rfbBool down, rfbKeySym key, rfbClientPtr cl) {
} |
[링크 : http:// https://github.com/LibVNC/libvncserver/blob/master/examples/example.c]
키보드 입력관련 선언문
#define XK_VoidSymbol 0xFFFFFF /* void symbol */
#define XK_BackSpace 0xFF08 /* back space, back char */ #define XK_Tab 0xFF09 #define XK_Linefeed 0xFF0A /* Linefeed, LF */ #define XK_Clear 0xFF0B #define XK_Return 0xFF0D /* Return, enter */ #define XK_Pause 0xFF13 /* Pause, hold */ #define XK_Scroll_Lock 0xFF14 #define XK_Sys_Req 0xFF15 #define XK_Escape 0xFF1B #define XK_Delete 0xFFFF /* Delete, rubout */
#define XK_A 0x041 #define XK_B 0x042 #define XK_C 0x043
#define XK_a 0x061 #define XK_b 0x062 #define XK_c 0x063 |
[링크 : https://github.com/LibVNC/libvncserver/blob/master/rfb/keysym.h]
[링크 : https://github.com/LibVNC/libvncserver]
+
relative / absolute mode 관련 참고할 코드
doptr() 에서 현재 좌표 넘어온 것과 이전 마지막 좌표 계산해서 넣는것 외에는
libvncserver 자체에서 상대좌표 모드로 작동하진 않도록 구성되어 있는 것으로 보인다.
[링크 : https://github.com/hanzelpeter/dispmanx_vnc/blob/master/main.c]