FreeRDP
xf_client.c File Reference
#include <winpr/assert.h>
#include <float.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/XKBlib.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <unistd.h>
#include <string.h>
#include <termios.h>
#include <pthread.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/select.h>
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
#include <freerdp/codec/nsc.h>
#include <freerdp/codec/rfx.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/bitmap.h>
#include <freerdp/utils/signal.h>
#include <freerdp/utils/passphrase.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/file.h>
#include <freerdp/client/cmdline.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/file.h>
#include <winpr/print.h>
#include <winpr/sysinfo.h>
#include "xf_gdi.h"
#include "xf_rail.h"
#include "xf_event.h"
#include "xf_input.h"
#include "xf_cliprdr.h"
#include "xf_disp.h"
#include "xf_video.h"
#include "xf_monitor.h"
#include "xf_graphics.h"
#include "xf_keyboard.h"
#include "xf_channels.h"
#include "xfreerdp.h"
#include <freerdp/log.h>

Macros

#define TAG   CLIENT_TAG("x11")
 
#define MIN_PIXEL_DIFF   0.001
 

Functions

static int _xf_error_handler (Display *d, XErrorEvent *ev)
 
static void xf_check_extensions (xfContext *context)
 
static void xf_window_free (xfContext *xfc)
 
static BOOL xf_get_pixmap_info (xfContext *xfc)
 
void xf_draw_screen_ (xfContext *xfc, int x, int y, int w, int h, const char *fkt, const char *file, int line)
 
static BOOL xf_desktop_resize (rdpContext *context)
 
static BOOL xf_sw_end_paint (rdpContext *context)
 
static BOOL xf_sw_desktop_resize (rdpContext *context)
 
static BOOL xf_hw_end_paint (rdpContext *context)
 
static BOOL xf_hw_desktop_resize (rdpContext *context)
 
static BOOL xf_process_x_events (freerdp *instance)
 
static char * xf_window_get_title (rdpSettings *settings)
 
BOOL xf_create_window (xfContext *xfc)
 
void xf_toggle_fullscreen (xfContext *xfc)
 
BOOL xf_toggle_control (xfContext *xfc)
 
static UINT xf_encomsp_participant_created (EncomspClientContext *context, const ENCOMSP_PARTICIPANT_CREATED_PDU *participantCreated)
 
void xf_encomsp_init (xfContext *xfc, EncomspClientContext *encomsp)
 
void xf_encomsp_uninit (xfContext *xfc, EncomspClientContext *encomsp)
 
void xf_lock_x11_ (xfContext *xfc, const char *fkt)
 
void xf_unlock_x11_ (xfContext *xfc, const char *fkt)
 
static int xf_error_handler (Display *d, XErrorEvent *ev)
 
static BOOL xf_play_sound (rdpContext *context, const PLAY_SOUND_UPDATE *play_sound)
 
static void xf_get_x11_button_map (xfContext *xfc, unsigned char *x11_map)
 
static UINT16 get_flags_for_button (int button)
 
static void xf_button_map_init (xfContext *xfc)
 
static BOOL xf_pre_connect (freerdp *instance)
 
static BOOL xf_post_connect (freerdp *instance)
 
static void xf_post_disconnect (freerdp *instance)
 
static int xf_logon_error_info (freerdp *instance, UINT32 data, UINT32 type)
 
static DWORD WINAPI xf_input_thread (LPVOID arg)
 
static BOOL handle_window_events (freerdp *instance)
 
static DWORD WINAPI xf_client_thread (LPVOID param)
 
DWORD xf_exit_code_from_disconnect_reason (DWORD reason)
 
static void xf_TerminateEventHandler (void *context, TerminateEventArgs *e)
 
static BOOL xfreerdp_client_global_init ()
 
static void xfreerdp_client_global_uninit ()
 
static int xfreerdp_client_start (rdpContext *context)
 
static int xfreerdp_client_stop (rdpContext *context)
 
static Atom get_supported_atom (xfContext *xfc, const char *atomName)
 
static BOOL xfreerdp_client_new (freerdp *instance, rdpContext *context)
 
static void xfreerdp_client_free (freerdp *instance, rdpContext *context)
 
int RdpClientEntry (RDP_CLIENT_ENTRY_POINTS *pEntryPoints)
 

Variables

static int(* _def_error_handler )(Display *, XErrorEvent *)
 
static const button_map xf_button_flags [NUM_BUTTONS_MAPPED]
 

Macro Definition Documentation

◆ MIN_PIXEL_DIFF

#define MIN_PIXEL_DIFF   0.001

◆ TAG

#define TAG   CLIENT_TAG("x11")

FreeRDP: A Remote Desktop Protocol Implementation X11 Client Interface

Copyright 2013 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2013 Corey Clayton can.o.nosp@m.f.tu.nosp@m.na@gm.nosp@m.ail..nosp@m.com Copyright 2014 Thincast Technologies GmbH Copyright 2014 Norbert Federa norbe.nosp@m.rt.f.nosp@m.edera.nosp@m.@thi.nosp@m.ncast.nosp@m..com Copyright 2016 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2016 Thincast Technologies GmbH

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.

Function Documentation

◆ _xf_error_handler()

static int _xf_error_handler ( Display *  d,
XErrorEvent *  ev 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_flags_for_button()

static UINT16 get_flags_for_button ( int  button)
static
Here is the caller graph for this function:

◆ get_supported_atom()

static Atom get_supported_atom ( xfContext *  xfc,
const char *  atomName 
)
static
Here is the caller graph for this function:

◆ handle_window_events()

static BOOL handle_window_events ( freerdp *  instance)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RdpClientEntry()

int RdpClientEntry ( RDP_CLIENT_ENTRY_POINTS pEntryPoints)

Client Interface

Here is the call graph for this function:

◆ xf_button_map_init()

static void xf_button_map_init ( xfContext *  xfc)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_check_extensions()

static void xf_check_extensions ( xfContext *  context)
static
Here is the caller graph for this function:

◆ xf_client_thread()

static DWORD WINAPI xf_client_thread ( LPVOID  param)
static

Main loop for the rdp connection. It will be run from the thread's entry point (thread_func()). It initiates the connection, and will continue to run until the session ends, processing events as they are received.

Parameters
instance- pointer to the rdp_freerdp structure that contains the session's settings
Returns
A code from the enum XF_EXIT_CODE (0 if successful)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_create_window()

BOOL xf_create_window ( xfContext *  xfc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_desktop_resize()

static BOOL xf_desktop_resize ( rdpContext *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_draw_screen_()

void xf_draw_screen_ ( xfContext *  xfc,
int  x,
int  y,
int  w,
int  h,
const char *  fkt,
const char *  file,
int  line 
)
Here is the call graph for this function:

◆ xf_encomsp_init()

void xf_encomsp_init ( xfContext *  xfc,
EncomspClientContext *  encomsp 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_encomsp_participant_created()

static UINT xf_encomsp_participant_created ( EncomspClientContext *  context,
const ENCOMSP_PARTICIPANT_CREATED_PDU *  participantCreated 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_encomsp_uninit()

void xf_encomsp_uninit ( xfContext *  xfc,
EncomspClientContext *  encomsp 
)
Here is the caller graph for this function:

◆ xf_error_handler()

static int xf_error_handler ( Display *  d,
XErrorEvent *  ev 
)
static
Here is the caller graph for this function:

◆ xf_exit_code_from_disconnect_reason()

DWORD xf_exit_code_from_disconnect_reason ( DWORD  reason)
Here is the caller graph for this function:

◆ xf_get_pixmap_info()

static BOOL xf_get_pixmap_info ( xfContext *  xfc)
static
Here is the caller graph for this function:

◆ xf_get_x11_button_map()

static void xf_get_x11_button_map ( xfContext *  xfc,
unsigned char *  x11_map 
)
static
Here is the caller graph for this function:

◆ xf_hw_desktop_resize()

static BOOL xf_hw_desktop_resize ( rdpContext *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_hw_end_paint()

static BOOL xf_hw_end_paint ( rdpContext *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_input_thread()

static DWORD WINAPI xf_input_thread ( LPVOID  arg)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_lock_x11_()

void xf_lock_x11_ ( xfContext *  xfc,
const char *  fkt 
)
Here is the call graph for this function:

◆ xf_logon_error_info()

static int xf_logon_error_info ( freerdp *  instance,
UINT32  data,
UINT32  type 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_play_sound()

static BOOL xf_play_sound ( rdpContext *  context,
const PLAY_SOUND_UPDATE *  play_sound 
)
static
Here is the caller graph for this function:

◆ xf_post_connect()

static BOOL xf_post_connect ( freerdp *  instance)
static

Callback given to freerdp_connect() to perform post-connection operations. It will be called only if the connection was initialized properly, and will continue the initialization based on the newly created connection.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_post_disconnect()

static void xf_post_disconnect ( freerdp *  instance)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_pre_connect()

static BOOL xf_pre_connect ( freerdp *  instance)
static

Callback given to freerdp_connect() to process the pre-connect operations. It will fill the rdp_freerdp structure (instance) with the appropriate options to use for the connection.

Parameters
instance- pointer to the rdp_freerdp structure that contains the connection's parameters, and will be filled with the appropriate informations.
Returns
TRUE if successful. FALSE otherwise. Can exit with error code XF_EXIT_PARSE_ARGUMENTS if there is an error in the parameters.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_process_x_events()

static BOOL xf_process_x_events ( freerdp *  instance)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_sw_desktop_resize()

static BOOL xf_sw_desktop_resize ( rdpContext *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_sw_end_paint()

static BOOL xf_sw_end_paint ( rdpContext *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_TerminateEventHandler()

static void xf_TerminateEventHandler ( void *  context,
TerminateEventArgs *  e 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_toggle_control()

BOOL xf_toggle_control ( xfContext *  xfc)
Here is the caller graph for this function:

◆ xf_toggle_fullscreen()

void xf_toggle_fullscreen ( xfContext *  xfc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_unlock_x11_()

void xf_unlock_x11_ ( xfContext *  xfc,
const char *  fkt 
)
Here is the call graph for this function:

◆ xf_window_free()

static void xf_window_free ( xfContext *  xfc)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xf_window_get_title()

static char* xf_window_get_title ( rdpSettings *  settings)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xfreerdp_client_free()

static void xfreerdp_client_free ( freerdp *  instance,
rdpContext *  context 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xfreerdp_client_global_init()

static BOOL xfreerdp_client_global_init ( )
static

Client Interface

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xfreerdp_client_global_uninit()

static void xfreerdp_client_global_uninit ( )
static
Here is the caller graph for this function:

◆ xfreerdp_client_new()

static BOOL xfreerdp_client_new ( freerdp *  instance,
rdpContext *  context 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xfreerdp_client_start()

static int xfreerdp_client_start ( rdpContext *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xfreerdp_client_stop()

static int xfreerdp_client_stop ( rdpContext *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _def_error_handler

int(* _def_error_handler) (Display *, XErrorEvent *)
static

◆ xf_button_flags

const button_map xf_button_flags[NUM_BUTTONS_MAPPED]
static
Initial value:
= {
{ Button1, PTR_FLAGS_BUTTON1 },
{ Button2, PTR_FLAGS_BUTTON3 },
{ Button3, PTR_FLAGS_BUTTON2 },
{ Button4, PTR_FLAGS_WHEEL | 0x78 },
{ Button5, PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | (0x100 - 0x78) },
{ 6, PTR_FLAGS_HWHEEL | PTR_FLAGS_WHEEL_NEGATIVE | (0x100 - 0x78) },
{ 7, PTR_FLAGS_HWHEEL | 0x78 },
}
PTR_FLAGS_BUTTON2
#define PTR_FLAGS_BUTTON2
Definition: include/freerdp/input.h:45
PTR_FLAGS_WHEEL_NEGATIVE
#define PTR_FLAGS_WHEEL_NEGATIVE
Definition: include/freerdp/input.h:41
PTR_FLAGS_HWHEEL
#define PTR_FLAGS_HWHEEL
Definition: include/freerdp/input.h:39
PTR_FLAGS_BUTTON1
#define PTR_FLAGS_BUTTON1
Definition: include/freerdp/input.h:44
PTR_FLAGS_BUTTON3
#define PTR_FLAGS_BUTTON3
Definition: include/freerdp/input.h:46
PTR_FLAGS_WHEEL
#define PTR_FLAGS_WHEEL
Definition: include/freerdp/input.h:40
PTR_XFLAGS_BUTTON1
#define PTR_XFLAGS_BUTTON1
Definition: include/freerdp/input.h:51
PTR_XFLAGS_BUTTON2
#define PTR_XFLAGS_BUTTON2
Definition: include/freerdp/input.h:52