Merge remote-tracking branch 'upstream/master' into rail

This commit is contained in:
roman-b 2011-08-21 04:44:18 +03:00
commit 7b6dad86ca
11 changed files with 155 additions and 24 deletions

View File

@ -30,6 +30,13 @@ add_executable(xfreerdp
xf_window.h xf_window.h
xfreerdp.c xfreerdp.c
xfreerdp.h) xfreerdp.h)
find_package(Xinerama)
if(XINERAMA_FOUND)
add_definitions(-DWITH_XINERAMA)
include_directories(${XINERAMA_INCLUDE_DIRS})
target_link_libraries(xfreerdp ${XINERAMA_LIBRARIES})
endif()
target_link_libraries(xfreerdp freerdp-core) target_link_libraries(xfreerdp freerdp-core)
target_link_libraries(xfreerdp freerdp-gdi) target_link_libraries(xfreerdp freerdp-gdi)

View File

@ -101,6 +101,17 @@ void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window)
window->windowWidth, window->windowHeight); window->windowWidth, window->windowHeight);
} }
void xf_rail_SetWindowText(rdpRail* rail, rdpWindow* window)
{
xfInfo* xfi;
xfWindow* xfw;
xfi = (xfInfo*) rail->extra;
xfw = (xfWindow*) window->extra;
XStoreName(xfi->display, xfw->handle, window->title);
}
void xf_rail_DestroyWindow(rdpRail* rail, rdpWindow* window) void xf_rail_DestroyWindow(rdpRail* rail, rdpWindow* window)
{ {
xfWindow* xfw; xfWindow* xfw;
@ -113,6 +124,7 @@ void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail)
rail->extra = (void*) xfi; rail->extra = (void*) xfi;
rail->CreateWindow = xf_rail_CreateWindow; rail->CreateWindow = xf_rail_CreateWindow;
rail->MoveWindow = xf_rail_MoveWindow; rail->MoveWindow = xf_rail_MoveWindow;
rail->SetWindowText = xf_rail_SetWindowText;
rail->DestroyWindow = xf_rail_DestroyWindow; rail->DestroyWindow = xf_rail_DestroyWindow;
} }
@ -144,21 +156,22 @@ void xf_process_rail_get_sysparams_event(xfInfo* xfi, rdpChanMan* chanman, RDP_E
freerdp_chanman_send_event(chanman, new_event); freerdp_chanman_send_event(chanman, new_event);
} }
const char* error_code_names[] =
{
"RAIL_EXEC_S_OK",
"RAIL_EXEC_E_HOOK_NOT_LOADED",
"RAIL_EXEC_E_DECODE_FAILED",
"RAIL_EXEC_E_NOT_IN_ALLOWLIST",
"RAIL_EXEC_E_FILE_NOT_FOUND",
"RAIL_EXEC_E_FAIL",
"RAIL_EXEC_E_SESSION_LOCKED"
};
void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event)
{ {
RAIL_EXEC_RESULT_ORDER * exec_result; RAIL_EXEC_RESULT_ORDER* exec_result;
const char* error_code_names[] =
{
"RAIL_EXEC_S_OK",
"RAIL_EXEC_E_HOOK_NOT_LOADED",
"RAIL_EXEC_E_DECODE_FAILED",
"RAIL_EXEC_E_NOT_IN_ALLOWLIST",
"RAIL_EXEC_E_FILE_NOT_FOUND",
"RAIL_EXEC_E_FAIL",
"RAIL_EXEC_E_SESSION_LOCKED"
};
exec_result = (RAIL_EXEC_RESULT_ORDER *)event->user_data; exec_result = (RAIL_EXEC_RESULT_ORDER*) event->user_data;
if (exec_result->execResult != RAIL_EXEC_S_OK) if (exec_result->execResult != RAIL_EXEC_S_OK)
{ {

View File

@ -273,6 +273,9 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h
Pixmap surface; Pixmap surface;
XSizeHints* size_hints; XSizeHints* size_hints;
if ((width * height) < 1)
return;
size_hints = XAllocSizeHints(); size_hints = XAllocSizeHints();
if (size_hints) if (size_hints)

View File

@ -20,6 +20,10 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef WITH_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#include <errno.h> #include <errno.h>
#include <pthread.h> #include <pthread.h>
#include <locale.h> #include <locale.h>
@ -115,6 +119,11 @@ boolean xf_pre_connect(freerdp* instance)
xfInfo* xfi; xfInfo* xfi;
rdpSettings* settings; rdpSettings* settings;
#ifdef WITH_XINERAMA
int n, ignored, ignored2;
XineramaScreenInfo* screen_info = NULL;
#endif
xfi = (xfInfo*) xzalloc(sizeof(xfInfo)); xfi = (xfInfo*) xzalloc(sizeof(xfInfo));
SET_XFI(instance, xfi); SET_XFI(instance, xfi);
@ -176,6 +185,47 @@ boolean xf_pre_connect(freerdp* instance)
settings->height = xfi->workArea.height; settings->height = xfi->workArea.height;
} }
if (settings->fullscreen != True && settings->workarea != True)
return True;
#ifdef WITH_XINERAMA
if (XineramaQueryExtension(xfi->display, &ignored, &ignored2))
{
if (XineramaIsActive(xfi->display))
{
screen_info = XineramaQueryScreens(xfi->display, &settings->num_monitors);
if (settings->num_monitors > 16)
settings->num_monitors = 0;
if (settings->num_monitors)
{
for (n = 0; n < settings->num_monitors; n++)
{
if (settings->workarea)
{
settings->monitors[n].x = screen_info[n].x_org;
settings->monitors[n].y = screen_info[n].y_org;
settings->monitors[n].width = screen_info[n].width;
settings->monitors[n].height = xfi->workArea.height;
}
else
{
settings->monitors[n].x = screen_info[n].x_org;
settings->monitors[n].y = screen_info[n].y_org;
settings->monitors[n].width = screen_info[n].width;
settings->monitors[n].height = screen_info[n].height;
}
settings->monitors[n].is_primary = screen_info[n].x_org == 0 && screen_info[n].y_org == 0;
}
}
XFree(screen_info);
}
}
#endif
return True; return True;
} }

49
cmake/FindXinerama.cmake Normal file
View File

@ -0,0 +1,49 @@
# - Find XINERAMA
# Find the XINERAMA libraries
#
# This module defines the following variables:
# XINERAMA_FOUND - True if XINERAMA_INCLUDE_DIR & XINERAMA_LIBRARY are found
# XINERAMA_LIBRARIES - Set when XINERAMA_LIBRARY is found
# XINERAMA_INCLUDE_DIRS - Set when XINERAMA_INCLUDE_DIR is found
#
# XINERAMA_INCLUDE_DIR - where to find Xinerama.h, etc.
# XINERAMA_LIBRARY - the XINERAMA library
#
#=============================================================================
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# 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.
#=============================================================================
find_path(XINERAMA_INCLUDE_DIR NAMES Xinerama.h
PATH_SUFFIXES X11/extensions
DOC "The Xinerama include directory"
)
find_library(XINERAMA_LIBRARY NAMES Xinerama
DOC "The Xinerama library"
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XINERAMA DEFAULT_MSG XINERAMA_LIBRARY XINERAMA_INCLUDE_DIR)
if(XINERAMA_FOUND)
set( XINERAMA_LIBRARIES ${XINERAMA_LIBRARY} )
set( XINERAMA_INCLUDE_DIRS ${XINERAMA_INCLUDE_DIR} )
endif()
mark_as_advanced(XINERAMA_INCLUDE_DIR XINERAMA_LIBRARY)

View File

@ -198,7 +198,7 @@ void test_gcc_write_client_network_data(void)
settings = settings_new(); settings = settings_new();
settings->num_channels = 3; settings->num_channels = 3;
memset(settings->channels, 0, sizeof(struct rdp_chan) * settings->num_channels); memset(settings->channels, 0, sizeof(rdpChan) * settings->num_channels);
strcpy(settings->channels[0].name, "rdpdr"); strcpy(settings->channels[0].name, "rdpdr");
settings->channels[0].options = 0x80800000; settings->channels[0].options = 0x80800000;

View File

@ -34,6 +34,7 @@ typedef struct rdp_rail rdpRail;
typedef void (*railCreateWindow)(rdpRail* rail, rdpWindow* window); typedef void (*railCreateWindow)(rdpRail* rail, rdpWindow* window);
typedef void (*railDestroyWindow)(rdpRail* rail, rdpWindow* window); typedef void (*railDestroyWindow)(rdpRail* rail, rdpWindow* window);
typedef void (*railMoveWindow)(rdpRail* rail, rdpWindow* window); typedef void (*railMoveWindow)(rdpRail* rail, rdpWindow* window);
typedef void (*railSetWindowText)(rdpRail* rail, rdpWindow* window);
struct rdp_rail struct rdp_rail
{ {
@ -43,6 +44,7 @@ struct rdp_rail
railCreateWindow CreateWindow; railCreateWindow CreateWindow;
railDestroyWindow DestroyWindow; railDestroyWindow DestroyWindow;
railMoveWindow MoveWindow; railMoveWindow MoveWindow;
railSetWindowText SetWindowText;
}; };
FREERDP_API void rail_register_update_callbacks(rdpRail* rail, rdpUpdate* update); FREERDP_API void rail_register_update_callbacks(rdpRail* rail, rdpUpdate* update);

View File

@ -125,8 +125,10 @@ struct rdp_chan
char name[8]; /* ui sets */ char name[8]; /* ui sets */
int options; /* ui sets */ int options; /* ui sets */
int chan_id; /* core sets */ int chan_id; /* core sets */
boolean joined; /* client has joined the channel */
void * handle; /* just for ui */ void * handle; /* just for ui */
}; };
typedef struct rdp_chan rdpChan;
struct rdp_ext_set struct rdp_ext_set
{ {
@ -185,7 +187,7 @@ struct rdp_settings
uint32 redirected_session_id; uint32 redirected_session_id;
int num_channels; int num_channels;
struct rdp_chan channels[16]; rdpChan channels[16];
int num_monitors; int num_monitors;
struct rdp_monitor monitors[16]; struct rdp_monitor monitors[16];

View File

@ -210,13 +210,13 @@ static struct chan_data* freerdp_chanman_find_chan_data_by_name(rdpChanMan* chan
return NULL; return NULL;
} }
/* returns struct rdp_chan for the channel id passed in */ /* returns rdpChan for the channel id passed in */
static struct rdp_chan* freerdp_chanman_find_rdp_chan_by_id(rdpChanMan* chan_man, static rdpChan* freerdp_chanman_find_rdp_chan_by_id(rdpChanMan* chan_man,
rdpSettings* settings, int chan_id, int* pindex) rdpSettings* settings, int chan_id, int* pindex)
{ {
int lindex; int lindex;
int lcount; int lcount;
struct rdp_chan* lrdp_chan; rdpChan* lrdp_chan;
lcount = settings->num_channels; lcount = settings->num_channels;
for (lindex = 0; lindex < lcount; lindex++) for (lindex = 0; lindex < lcount; lindex++)
@ -234,13 +234,13 @@ static struct rdp_chan* freerdp_chanman_find_rdp_chan_by_id(rdpChanMan* chan_man
return NULL; return NULL;
} }
/* returns struct rdp_chan for the channel name passed in */ /* returns rdpChan for the channel name passed in */
static struct rdp_chan* freerdp_chanman_find_rdp_chan_by_name(rdpChanMan* chan_man, static rdpChan* freerdp_chanman_find_rdp_chan_by_name(rdpChanMan* chan_man,
rdpSettings* settings, const char* chan_name, int* pindex) rdpSettings* settings, const char* chan_name, int* pindex)
{ {
int lindex; int lindex;
int lcount; int lcount;
struct rdp_chan* lrdp_chan; rdpChan* lrdp_chan;
lcount = settings->num_channels; lcount = settings->num_channels;
for (lindex = 0; lindex < lcount; lindex++) for (lindex = 0; lindex < lcount; lindex++)
@ -271,7 +271,7 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF
int index; int index;
struct lib_data* llib; struct lib_data* llib;
struct chan_data* lchan; struct chan_data* lchan;
struct rdp_chan* lrdp_chan; rdpChan* lrdp_chan;
PCHANNEL_DEF lchan_def; PCHANNEL_DEF lchan_def;
chan_man = g_init_chan_man; chan_man = g_init_chan_man;
@ -745,7 +745,7 @@ int freerdp_chanman_data(freerdp* instance, int chan_id, void* data, int data_si
int flags, int total_size) int flags, int total_size)
{ {
rdpChanMan* chan_man; rdpChanMan* chan_man;
struct rdp_chan* lrdp_chan; rdpChan* lrdp_chan;
struct chan_data* lchan_data; struct chan_data* lchan_data;
int index; int index;
@ -828,7 +828,7 @@ FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, RDP_EVENT* even
static void freerdp_chanman_process_sync(rdpChanMan* chan_man, freerdp* instance) static void freerdp_chanman_process_sync(rdpChanMan* chan_man, freerdp* instance)
{ {
struct chan_data* lchan_data; struct chan_data* lchan_data;
struct rdp_chan* lrdp_chan; rdpChan* lrdp_chan;
struct sync_data* item; struct sync_data* item;
while (chan_man->sync_data_list->head != NULL) while (chan_man->sync_data_list->head != NULL)

View File

@ -32,7 +32,7 @@ boolean vchan_send(rdpVchan* vchan, uint16 channel_id, uint8* data, int size)
{ {
STREAM* s; STREAM* s;
uint32 flags; uint32 flags;
struct rdp_chan* channel = NULL; rdpChan* channel = NULL;
int i; int i;
int chunk_size; int chunk_size;

View File

@ -162,7 +162,12 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window)
if (window->fieldFlags & WINDOW_ORDER_FIELD_TITLE) if (window->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
{ {
if (window->title != NULL)
xfree(window->title);
window->title = freerdp_uniconv_in(rail->uniconv, window->titleInfo.string, window->titleInfo.length); window->title = freerdp_uniconv_in(rail->uniconv, window->titleInfo.string, window->titleInfo.length);
IFCALL(rail->SetWindowText, rail, window);
} }
if (window->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET) if (window->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)