xfreerdp-server: add xinerama code

This commit is contained in:
Marc-André Moreau 2013-05-01 23:03:05 -04:00
parent 030fad3a65
commit 54096f7b9b
4 changed files with 123 additions and 0 deletions

View File

@ -30,6 +30,8 @@ set(${MODULE_PREFIX}_SRCS
xf_encode.h
xf_update.c
xf_update.h
xf_monitors.c
xf_monitors.h
xf_interface.c
xf_interface.h
xfreerdp.h)
@ -55,10 +57,18 @@ set(XSHM_FEATURE_TYPE "RECOMMENDED")
set(XSHM_FEATURE_PURPOSE "X11 shared memory")
set(XSHM_FEATURE_DESCRIPTION "X11 shared memory extension")
set(XINERAMA_FEATURE_TYPE "RECOMMENDED")
set(XINERAMA_FEATURE_PURPOSE "multi-monitor")
set(XINERAMA_FEATURE_DESCRIPTION "X11 multi-monitor extension")
set(XTEST_FEATURE_TYPE "RECOMMENDED")
set(XTEST_FEATURE_PURPOSE "X11 input event injection")
set(XTEST_FEATURE_DESCRIPTION "X11 input event injection extension")
set(XCURSOR_FEATURE_TYPE "RECOMMENDED")
set(XCURSOR_FEATURE_PURPOSE "cursor")
set(XCURSOR_FEATURE_DESCRIPTION "X11 cursor extension")
set(XFIXES_FEATURE_TYPE "RECOMMENDED")
set(XFIXES_FEATURE_PURPOSE "X11 region")
set(XFIXES_FEATURE_DESCRIPTION "X11 region fix extension")
@ -72,6 +82,8 @@ find_feature(XShm ${XSHM_FEATURE_TYPE} ${XSHM_FEATURE_PURPOSE} ${XSHM_FEATURE_DE
find_feature(XTest ${XTEST_FEATURE_TYPE} ${XTEST_FEATURE_PURPOSE} ${XTEST_FEATURE_DESCRIPTION})
find_feature(Xfixes ${XFIXES_FEATURE_TYPE} ${XFIXES_FEATURE_PURPOSE} ${XFIXES_FEATURE_DESCRIPTION})
find_feature(Xdamage ${XDAMAGE_FEATURE_TYPE} ${XDAMAGE_FEATURE_PURPOSE} ${XDAMAGE_FEATURE_DESCRIPTION})
find_feature(Xcursor ${XCURSOR_FEATURE_TYPE} ${XCURSOR_FEATURE_PURPOSE} ${XCURSOR_FEATURE_DESCRIPTION})
find_feature(Xinerama ${XINERAMA_FEATURE_TYPE} ${XINERAMA_FEATURE_PURPOSE} ${XINERAMA_FEATURE_DESCRIPTION})
if(WITH_XSHM)
add_definitions(-DWITH_XSHM)
@ -84,6 +96,18 @@ if(WITH_XEXT)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XEXT_LIBRARIES})
endif()
if(WITH_XINERAMA)
add_definitions(-DWITH_XINERAMA)
include_directories(${XINERAMA_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XINERAMA_LIBRARIES})
endif()
if(WITH_XCURSOR)
add_definitions(-DWITH_XCURSOR)
include_directories(${XCURSOR_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XCURSOR_LIBRARIES})
endif()
if(WITH_XDAMAGE)
add_definitions(-DWITH_XDAMAGE)
include_directories(${XDAMAGE_INCLUDE_DIRS})

68
server/X11/xf_monitors.c Normal file
View File

@ -0,0 +1,68 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* X11 Server Monitors
*
* Copyright 2013 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef WITH_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#include "xf_monitors.h"
int xf_list_monitors(xfInfo* xfi)
{
#ifdef WITH_XINERAMAZ
int i, nmonitors = 0;
int ignored, ignored2;
XineramaScreenInfo* screen = NULL;
if (XineramaQueryExtension(xfi->display, &ignored, &ignored2))
{
if (XineramaIsActive(xfi->display))
{
screen = XineramaQueryScreens(xfi->display, &nmonitors);
for (i = 0; i < nmonitors; i++)
{
printf(" %s [%d] %dx%d\t+%d+%d\n",
(i == 0) ? "*" : " ", i,
screen[i].width, screen[i].height,
screen[i].x_org, screen[i].y_org);
}
XFree(screen);
}
}
#else
Screen* screen;
screen = ScreenOfDisplay(xfi->display, DefaultScreen(xfi->display));
printf(" * [0] %dx%d\t+%d+%d\n", WidthOfScreen(screen), HeightOfScreen(screen), 0, 0);
#endif
return 0;
}

28
server/X11/xf_monitors.h Normal file
View File

@ -0,0 +1,28 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* X11 Server Monitors
*
* Copyright 2013 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_SERVER_MONITORS_H
#define XFREERDP_SERVER_MONITORS_H
#include "xfreerdp.h"
int xf_list_monitors(xfInfo* xfi);
#endif /* XFREERDP_SERVER_MONITORS_H */

View File

@ -45,6 +45,7 @@
#include "xf_input.h"
#include "xf_encode.h"
#include "xf_update.h"
#include "xf_monitors.h"
#include "makecert.h"
@ -208,6 +209,8 @@ xfInfo* xf_info_init()
exit(1);
}
xf_list_monitors(xfi);
xfi->xfds = ConnectionNumber(xfi->display);
xfi->number = DefaultScreen(xfi->display);
xfi->screen = ScreenOfDisplay(xfi->display, xfi->number);