xfreerdp: added support for multiple monitors
This commit is contained in:
parent
4a126a55b0
commit
ec77c8ecbf
@ -31,6 +31,13 @@ add_executable(xfreerdp
|
||||
xfreerdp.c
|
||||
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-gdi)
|
||||
target_link_libraries(xfreerdp freerdp-kbd)
|
||||
|
@ -20,6 +20,10 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#ifdef WITH_XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <locale.h>
|
||||
@ -115,6 +119,11 @@ boolean xf_pre_connect(freerdp* instance)
|
||||
xfInfo* xfi;
|
||||
rdpSettings* settings;
|
||||
|
||||
#ifdef WITH_XINERAMA
|
||||
int n, ignored, ignored2;
|
||||
XineramaScreenInfo* screen_info = NULL;
|
||||
#endif
|
||||
|
||||
xfi = (xfInfo*) xzalloc(sizeof(xfInfo));
|
||||
SET_XFI(instance, xfi);
|
||||
|
||||
@ -176,6 +185,47 @@ boolean xf_pre_connect(freerdp* instance)
|
||||
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;
|
||||
}
|
||||
|
||||
|
49
cmake/FindXinerama.cmake
Normal file
49
cmake/FindXinerama.cmake
Normal 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)
|
||||
|
Loading…
Reference in New Issue
Block a user