Prepare the RFB sources for the implementation of a new gui based on the

LibVNVServer library. The include files will be used for both guis.
This commit is contained in:
Volker Ruppert 2013-05-30 09:31:21 +00:00
parent 0f2e7ec578
commit dc1dd06794
3 changed files with 35 additions and 29 deletions

View File

@ -109,7 +109,7 @@ static char rfbIPStext[40];
static unsigned short rfbPort;
// Headerbar stuff
unsigned rfbBitmapCount = 0;
static unsigned rfbBitmapCount = 0;
static struct _rfbBitmaps {
char *bmap;
unsigned xdim;
@ -117,7 +117,7 @@ static struct _rfbBitmaps {
} rfbBitmaps[BX_MAX_PIXMAPS];
static unsigned rfbHeaderbarBitmapCount = 0;
struct _rfbHeaderbarBitmaps {
static struct _rfbHeaderbarBitmaps {
unsigned int index;
unsigned int xorigin;
unsigned int yorigin;
@ -180,7 +180,7 @@ static SOCKET sGlobal;
static Bit32u clientEncodingsCount = 0;
static Bit32u *clientEncodings = NULL;
void CDECL ServerThreadInit(void *indata);
void CDECL rfbServerThreadInit(void *indata);
void HandleRfbClient(SOCKET sClient);
int ReadExact(int sock, char *buf, int len);
int WriteExact(int sock, char *buf, int len);
@ -188,10 +188,9 @@ void DrawBitmap(int x, int y, int width, int height, char *bmap, char color, boo
void DrawChar(int x, int y, int width, int height, int fonty, char *bmap, char color, bx_bool gfxchar);
void UpdateScreen(unsigned char *newBits, int x, int y, int width, int height, bool update_client);
void SendUpdate(int x, int y, int width, int height, Bit32u encoding);
void StartThread();
void rfbStartThread();
void rfbKeyPressed(Bit32u key, int press_release);
void rfbMouseMove(int x, int y, int bmask);
void DrawColorPalette();
#if BX_SHOW_IPS && defined(WIN32)
DWORD WINAPI ShowIPSthread(LPVOID);
@ -263,7 +262,7 @@ void bx_rfb_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
keep_alive = 1;
client_connected = 0;
desktop_resizable = 0;
StartThread();
rfbStartThread();
#ifdef WIN32
Sleep(1000);
@ -376,7 +375,7 @@ bool StopWinsock()
}
#endif
void CDECL ServerThreadInit(void *indata)
void CDECL rfbServerThreadInit(void *indata)
{
SOCKET sServer;
SOCKET sClient;
@ -1230,7 +1229,6 @@ void DrawBitmap(int x, int y, int width, int height, char *bmap, char color, boo
newBits[i * 8 + 7] = (bmap[i] & 0x80) ? fgcolor : bgcolor;
}
UpdateScreen(newBits, x, y, width, height, update_client);
//DrawColorPalette();
free(newBits);
}
@ -1279,22 +1277,6 @@ void DrawChar(int x, int y, int width, int height, int fonty, char *bmap, char c
fonty++;
}
UpdateScreen(newBits, x, y, width, height, false);
//DrawColorPalette();
}
void DrawColorPalette()
{
unsigned char bits[100];
int x = 0, y = 0, c;
for (c = 0; c < 256; c++) {
memset(&bits, rfbPalette[c], 100);
UpdateScreen(bits, x, y, 10, 10, false);
x += 10;
if (x > 70) {
y += 10;
x = 0;
}
}
}
void UpdateScreen(unsigned char *newBits, int x, int y, int width, int height, bool update_client)
@ -1359,13 +1341,13 @@ void SendUpdate(int x, int y, int width, int height, Bit32u encoding)
}
}
void StartThread()
void rfbStartThread()
{
#ifdef WIN32
_beginthread(ServerThreadInit, 0, NULL);
_beginthread(rfbServerThreadInit, 0, NULL);
#else
pthread_t thread;
pthread_create(&thread, NULL, (void *(*)(void *))&ServerThreadInit, NULL);
pthread_create(&thread, NULL, (void *(*)(void *))&rfbServerThreadInit, NULL);
#endif
}
@ -1383,7 +1365,7 @@ static Bit32u convertStringToRfbKey(const char *string)
return BX_KEYMAP_UNKNOWN;
}
Bit32u rfb_ascii_to_key_event[0x5f] = {
static Bit32u rfb_ascii_to_key_event[0x5f] = {
// !"#$%&'
BX_KEY_SPACE,
BX_KEY_1,

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2012 The Bochs Project
// Copyright (C) 2001-2013 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -24,6 +24,10 @@
#ifndef BX_RFB_GUI
#define BX_RFB_GUI
#ifdef HAVE_LIBVNCSERVER
#include <rfb/rfb.h>
#endif
// Define the RFB types
typedef Bit32u U32;
typedef Bit16u U16;
@ -32,6 +36,9 @@ typedef Bit32s S32;
typedef Bit16s S16;
typedef Bit8s S8;
#ifndef HAVE_LIBVNCSERVER
// Port range
#define BX_RFB_PORT_MIN 5900
#define BX_RFB_PORT_MAX 5949
@ -393,4 +400,6 @@ typedef union {
rfbServerCutTextMessage sct;
} rfbServerToClientMessage;
#endif // HAVE_LIBVNCSERVER
#endif

View File

@ -21,6 +21,15 @@
// This file includes the rfb key definitions and keyboard mapping stuff
#ifdef HAVE_LIBVNCSERVER
#include <rfb/keysym.h>
#define XK_Oslash 0x00d8
#define XK_ooblique 0x00f8
#else
enum {
XK_space = 0x020,
XK_exclam,
@ -327,6 +336,8 @@ enum {
#define XK_Super_L 0xFFEB
#define XK_Super_R 0xFFEC
#endif
/// key mapping for rfb
typedef struct {
const char *name;
@ -336,6 +347,9 @@ typedef struct {
#define DEF_RFB_KEY(key) \
{ #key, key },
#if defined(HAVE_LIBVNCSERVER) && BX_WITH_RFB && !BX_PLUGINS
extern rfbKeyTabEntry rfb_keytable[];
#else
rfbKeyTabEntry rfb_keytable[] = {
// this include provides all the entries.
DEF_RFB_KEY(XK_space)
@ -630,3 +644,4 @@ rfbKeyTabEntry rfb_keytable[] = {
// one final entry to mark the end
{ NULL, 0 }
};
#endif