xfreerdp: make client interface fully opaque

This commit is contained in:
Marc-André Moreau 2013-04-28 00:23:36 -04:00
parent fc3f75d867
commit e55b0ab64f
14 changed files with 241 additions and 213 deletions

View File

@ -21,8 +21,7 @@ set(MODULE_PREFIX "FREERDP_CLIENT_X11")
include_directories(..)
set(${MODULE_PREFIX}_SRCS
xfreerdp.c
xfreerdp.h)
xfreerdp.c)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})

View File

@ -1,25 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* X11 Client
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __XFREERDP_H
#define __XFREERDP_H
#endif /* __XFREERDP_H */

View File

@ -21,6 +21,7 @@
#define __XF_CLIPRDR_H
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman);
void xf_cliprdr_uninit(xfInfo* xfi);

View File

@ -23,6 +23,7 @@
#include "xf_keyboard.h"
#include "xf_interface.h"
#include "xfreerdp.h"
BOOL xf_event_process(freerdp* instance, XEvent* event);
void xf_event_SendClientEvent(xfInfo *xfi, xfWindow* window, Atom atom, unsigned int numArgs, ...);

View File

@ -23,6 +23,7 @@
#include <freerdp/gdi/gdi.h>
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_gdi_register_update_callbacks(rdpUpdate* update);

View File

@ -21,6 +21,7 @@
#define __XF_GRAPHICS_H
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_register_graphics(rdpGraphics* graphics);

View File

@ -74,6 +74,8 @@
#include "xf_graphics.h"
#include "xf_keyboard.h"
#include "xfreerdp.h"
static long xv_port = 0;
static const size_t password_size = 512;
@ -1457,6 +1459,21 @@ int freerdp_client_stop(xfInfo* xfi)
return 0;
}
freerdp* freerdp_client_get_instance(cfInfo* cfi)
{
return cfi->instance;
}
HANDLE freerdp_client_get_thread(cfInfo* cfi)
{
return cfi->thread;
}
rdpClient* freerdp_client_get_interface(cfInfo* cfi)
{
return cfi->client;
}
xfInfo* freerdp_client_new(int argc, char** argv)
{
int index;

View File

@ -36,196 +36,10 @@
typedef struct xf_info xfInfo;
#include "xf_window.h"
#include "xf_monitor.h"
#ifdef __cplusplus
extern "C" {
#endif
struct xf_WorkArea
{
UINT32 x;
UINT32 y;
UINT32 width;
UINT32 height;
};
typedef struct xf_WorkArea xfWorkArea;
struct xf_pointer
{
rdpPointer pointer;
Cursor cursor;
};
typedef struct xf_pointer xfPointer;
struct xf_bitmap
{
rdpBitmap bitmap;
Pixmap pixmap;
};
typedef struct xf_bitmap xfBitmap;
struct xf_glyph
{
rdpGlyph glyph;
Pixmap pixmap;
};
typedef struct xf_glyph xfGlyph;
struct xf_context
{
rdpContext _p;
xfInfo* xfi;
rdpSettings* settings;
};
typedef struct xf_context xfContext;
struct xf_info
{
freerdp* instance;
xfContext* context;
rdpContext* _context;
rdpClient* client;
rdpSettings* settings;
GC gc;
int bpp;
int xfds;
int depth;
int width;
int height;
int srcBpp;
GC gc_mono;
Screen* screen;
XImage* image;
Pixmap primary;
Pixmap drawing;
Visual* visual;
Display* display;
Drawable drawable;
Pixmap bitmap_mono;
Colormap colormap;
int screen_number;
int scanline_pad;
BOOL big_endian;
BOOL fullscreen;
BOOL grab_keyboard;
BOOL unobscured;
BOOL debug;
xfWindow* window;
xfWorkArea workArea;
int current_desktop;
BOOL remote_app;
BOOL disconnect;
HCLRCONV clrconv;
HANDLE mutex;
HANDLE thread;
BOOL UseXThreads;
HGDI_DC hdc;
BYTE* primary_buffer;
BOOL frame_begin;
UINT16 frame_x1;
UINT16 frame_y1;
UINT16 frame_x2;
UINT16 frame_y2;
BOOL focused;
BOOL mouse_active;
BOOL suppress_output;
BOOL fullscreen_toggle;
UINT32 keyboard_layout_id;
BOOL pressed_keys[256];
XModifierKeymap* modifier_map;
XSetWindowAttributes attribs;
BOOL complex_regions;
VIRTUAL_SCREEN vscreen;
BYTE* bmp_codec_none;
BYTE* bmp_codec_nsc;
void* rfx_context;
void* nsc_context;
void* xv_context;
void* clipboard_context;
Atom _NET_WM_ICON;
Atom _MOTIF_WM_HINTS;
Atom _NET_CURRENT_DESKTOP;
Atom _NET_WORKAREA;
Atom _NET_WM_STATE;
Atom _NET_WM_STATE_FULLSCREEN;
Atom _NET_WM_STATE_SKIP_TASKBAR;
Atom _NET_WM_STATE_SKIP_PAGER;
Atom _NET_WM_WINDOW_TYPE;
Atom _NET_WM_WINDOW_TYPE_NORMAL;
Atom _NET_WM_WINDOW_TYPE_DIALOG;
Atom _NET_WM_WINDOW_TYPE_UTILITY;
Atom _NET_WM_WINDOW_TYPE_POPUP;
Atom _NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
Atom _NET_WM_MOVERESIZE;
Atom _NET_MOVERESIZE_WINDOW;
Atom WM_STATE;
Atom WM_PROTOCOLS;
Atom WM_DELETE_WINDOW;
};
void xf_create_window(xfInfo* xfi);
void xf_toggle_fullscreen(xfInfo* xfi);
BOOL xf_post_connect(freerdp* instance);
enum XF_EXIT_CODE
{
/* section 0-15: protocol-independent codes */
XF_EXIT_SUCCESS = 0,
XF_EXIT_DISCONNECT = 1,
XF_EXIT_LOGOFF = 2,
XF_EXIT_IDLE_TIMEOUT = 3,
XF_EXIT_LOGON_TIMEOUT = 4,
XF_EXIT_CONN_REPLACED = 5,
XF_EXIT_OUT_OF_MEMORY = 6,
XF_EXIT_CONN_DENIED = 7,
XF_EXIT_CONN_DENIED_FIPS = 8,
XF_EXIT_USER_PRIVILEGES = 9,
XF_EXIT_FRESH_CREDENTIALS_REQUIRED = 10,
XF_EXIT_DISCONNECT_BY_USER = 11,
/* section 16-31: license error set */
XF_EXIT_LICENSE_INTERNAL = 16,
XF_EXIT_LICENSE_NO_LICENSE_SERVER = 17,
XF_EXIT_LICENSE_NO_LICENSE = 18,
XF_EXIT_LICENSE_BAD_CLIENT_MSG = 19,
XF_EXIT_LICENSE_HWID_DOESNT_MATCH = 20,
XF_EXIT_LICENSE_BAD_CLIENT = 21,
XF_EXIT_LICENSE_CANT_FINISH_PROTOCOL = 22,
XF_EXIT_LICENSE_CLIENT_ENDED_PROTOCOL = 23,
XF_EXIT_LICENSE_BAD_CLIENT_ENCRYPTION = 24,
XF_EXIT_LICENSE_CANT_UPGRADE = 25,
XF_EXIT_LICENSE_NO_REMOTE_CONNECTIONS = 26,
/* section 32-127: RDP protocol error set */
XF_EXIT_RDP = 32,
/* section 128-254: xfreerdp specific exit codes */
XF_EXIT_PARSE_ARGUMENTS = 128,
XF_EXIT_MEMORY = 129,
XF_EXIT_PROTOCOL = 130,
XF_EXIT_CONN_FAILED = 131,
XF_EXIT_UNKNOWN = 255,
};
void xf_lock_x11(xfInfo* xfi, BOOL display);
void xf_unlock_x11(xfInfo* xfi, BOOL display);
DWORD xf_exit_code_from_disconnect_reason(DWORD reason);
/**
* Client Interface
*/
@ -238,6 +52,10 @@ FREERDP_API int freerdp_client_global_uninit();
FREERDP_API int freerdp_client_start(cfInfo* cfi);
FREERDP_API int freerdp_client_stop(cfInfo* cfi);
FREERDP_API freerdp* freerdp_client_get_instance(cfInfo* cfi);
FREERDP_API HANDLE freerdp_client_get_thread(cfInfo* cfi);
FREERDP_API rdpClient* freerdp_client_get_interface(cfInfo* cfi);
FREERDP_API cfInfo* freerdp_client_new(int argc, char** argv);
FREERDP_API void freerdp_client_free(cfInfo* cfi);

View File

@ -23,6 +23,7 @@
#include <freerdp/locale/keyboard.h>
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_kbd_init(xfInfo* xfi);
void xf_kbd_clear(xfInfo* xfi);

View File

@ -41,6 +41,7 @@ struct _VIRTUAL_SCREEN
typedef struct _VIRTUAL_SCREEN VIRTUAL_SCREEN;
#include "xf_interface.h"
#include "xfreerdp.h"
BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings);

View File

@ -21,6 +21,7 @@
#define __XF_RAIL_H
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_rail_paint(xfInfo* xfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom);
void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail);

View File

@ -21,6 +21,7 @@
#define __XF_TSMF_H
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_tsmf_init(xfInfo* xfi, long xv_port);
void xf_tsmf_uninit(xfInfo* xfi);

View File

@ -28,6 +28,7 @@ typedef struct xf_localmove xfLocalMove;
typedef struct xf_window xfWindow;
#include "xf_interface.h"
#include "xfreerdp.h"
// Extended ICCM flags http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0

210
client/X11/xfreerdp.h Normal file
View File

@ -0,0 +1,210 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* X11 Client
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __XFREERDP_H
#define __XFREERDP_H
#include "xf_window.h"
#include "xf_monitor.h"
struct xf_WorkArea
{
UINT32 x;
UINT32 y;
UINT32 width;
UINT32 height;
};
typedef struct xf_WorkArea xfWorkArea;
struct xf_pointer
{
rdpPointer pointer;
Cursor cursor;
};
typedef struct xf_pointer xfPointer;
struct xf_bitmap
{
rdpBitmap bitmap;
Pixmap pixmap;
};
typedef struct xf_bitmap xfBitmap;
struct xf_glyph
{
rdpGlyph glyph;
Pixmap pixmap;
};
typedef struct xf_glyph xfGlyph;
struct xf_context
{
rdpContext _p;
xfInfo* xfi;
rdpSettings* settings;
};
typedef struct xf_context xfContext;
struct xf_info
{
freerdp* instance;
xfContext* context;
rdpContext* _context;
rdpClient* client;
rdpSettings* settings;
GC gc;
int bpp;
int xfds;
int depth;
int width;
int height;
int srcBpp;
GC gc_mono;
Screen* screen;
XImage* image;
Pixmap primary;
Pixmap drawing;
Visual* visual;
Display* display;
Drawable drawable;
Pixmap bitmap_mono;
Colormap colormap;
int screen_number;
int scanline_pad;
BOOL big_endian;
BOOL fullscreen;
BOOL grab_keyboard;
BOOL unobscured;
BOOL debug;
xfWindow* window;
xfWorkArea workArea;
int current_desktop;
BOOL remote_app;
BOOL disconnect;
HCLRCONV clrconv;
HANDLE mutex;
HANDLE thread;
BOOL UseXThreads;
HGDI_DC hdc;
BYTE* primary_buffer;
BOOL frame_begin;
UINT16 frame_x1;
UINT16 frame_y1;
UINT16 frame_x2;
UINT16 frame_y2;
BOOL focused;
BOOL mouse_active;
BOOL suppress_output;
BOOL fullscreen_toggle;
UINT32 keyboard_layout_id;
BOOL pressed_keys[256];
XModifierKeymap* modifier_map;
XSetWindowAttributes attribs;
BOOL complex_regions;
VIRTUAL_SCREEN vscreen;
BYTE* bmp_codec_none;
BYTE* bmp_codec_nsc;
void* rfx_context;
void* nsc_context;
void* xv_context;
void* clipboard_context;
Atom _NET_WM_ICON;
Atom _MOTIF_WM_HINTS;
Atom _NET_CURRENT_DESKTOP;
Atom _NET_WORKAREA;
Atom _NET_WM_STATE;
Atom _NET_WM_STATE_FULLSCREEN;
Atom _NET_WM_STATE_SKIP_TASKBAR;
Atom _NET_WM_STATE_SKIP_PAGER;
Atom _NET_WM_WINDOW_TYPE;
Atom _NET_WM_WINDOW_TYPE_NORMAL;
Atom _NET_WM_WINDOW_TYPE_DIALOG;
Atom _NET_WM_WINDOW_TYPE_UTILITY;
Atom _NET_WM_WINDOW_TYPE_POPUP;
Atom _NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
Atom _NET_WM_MOVERESIZE;
Atom _NET_MOVERESIZE_WINDOW;
Atom WM_STATE;
Atom WM_PROTOCOLS;
Atom WM_DELETE_WINDOW;
};
void xf_create_window(xfInfo* xfi);
void xf_toggle_fullscreen(xfInfo* xfi);
BOOL xf_post_connect(freerdp* instance);
enum XF_EXIT_CODE
{
/* section 0-15: protocol-independent codes */
XF_EXIT_SUCCESS = 0,
XF_EXIT_DISCONNECT = 1,
XF_EXIT_LOGOFF = 2,
XF_EXIT_IDLE_TIMEOUT = 3,
XF_EXIT_LOGON_TIMEOUT = 4,
XF_EXIT_CONN_REPLACED = 5,
XF_EXIT_OUT_OF_MEMORY = 6,
XF_EXIT_CONN_DENIED = 7,
XF_EXIT_CONN_DENIED_FIPS = 8,
XF_EXIT_USER_PRIVILEGES = 9,
XF_EXIT_FRESH_CREDENTIALS_REQUIRED = 10,
XF_EXIT_DISCONNECT_BY_USER = 11,
/* section 16-31: license error set */
XF_EXIT_LICENSE_INTERNAL = 16,
XF_EXIT_LICENSE_NO_LICENSE_SERVER = 17,
XF_EXIT_LICENSE_NO_LICENSE = 18,
XF_EXIT_LICENSE_BAD_CLIENT_MSG = 19,
XF_EXIT_LICENSE_HWID_DOESNT_MATCH = 20,
XF_EXIT_LICENSE_BAD_CLIENT = 21,
XF_EXIT_LICENSE_CANT_FINISH_PROTOCOL = 22,
XF_EXIT_LICENSE_CLIENT_ENDED_PROTOCOL = 23,
XF_EXIT_LICENSE_BAD_CLIENT_ENCRYPTION = 24,
XF_EXIT_LICENSE_CANT_UPGRADE = 25,
XF_EXIT_LICENSE_NO_REMOTE_CONNECTIONS = 26,
/* section 32-127: RDP protocol error set */
XF_EXIT_RDP = 32,
/* section 128-254: xfreerdp specific exit codes */
XF_EXIT_PARSE_ARGUMENTS = 128,
XF_EXIT_MEMORY = 129,
XF_EXIT_PROTOCOL = 130,
XF_EXIT_CONN_FAILED = 131,
XF_EXIT_UNKNOWN = 255,
};
void xf_lock_x11(xfInfo* xfi, BOOL display);
void xf_unlock_x11(xfInfo* xfi, BOOL display);
DWORD xf_exit_code_from_disconnect_reason(DWORD reason);
#endif /* __XFREERDP_H */