xfreerdp-server: xdamage initialization

This commit is contained in:
Marc-André Moreau 2012-01-02 22:33:35 -05:00
parent 3e029a10e0
commit 3a8c439837
3 changed files with 79 additions and 10 deletions

View File

@ -38,6 +38,13 @@ if(XDAMAGE_FOUND)
target_link_libraries(xfreerdp-server ${XDAMAGE_LIBRARIES})
endif()
find_suggested_package(Xfixes)
if(XFIXES_FOUND)
add_definitions(-DWITH_XFIXES)
include_directories(${XFIXES_INCLUDE_DIRS})
target_link_libraries(xfreerdp-server ${XFIXES_LIBRARIES})
endif()
target_link_libraries(xfreerdp-server freerdp-core)
target_link_libraries(xfreerdp-server freerdp-codec)
target_link_libraries(xfreerdp-server freerdp-utils)

View File

@ -24,11 +24,6 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <sys/select.h>
#ifdef WITH_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
#include <freerdp/utils/sleep.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/thread.h>
@ -41,16 +36,67 @@ extern boolean xf_pcap_dump_realtime;
#include "xf_peer.h"
#ifdef WITH_XDAMAGE
void xf_xdamage_init(xfInfo* xfi)
{
int damage_event;
int damage_error;
int major, minor;
XGCValues values;
if (XDamageQueryExtension(xfi->display, &damage_event, &damage_error) == 0)
{
printf("XDamageQueryExtension failed\n");
return;
}
XDamageQueryVersion(xfi->display, &major, &minor);
if (XDamageQueryVersion(xfi->display, &major, &minor) == 0)
{
printf("XDamageQueryVersion failed\n");
return;
}
else if (major < 1)
{
printf("XDamageQueryVersion failed: major:%d minor:%d\n", major, minor);
return;
}
xfi->xdamage_notify_event = damage_event + XDamageNotify;
xfi->xdamage = XDamageCreate(xfi->display, DefaultRootWindow(xfi->display), XDamageReportDeltaRectangles);
if (xfi->xdamage == None)
{
printf("XDamageCreate failed\n");
return;
}
#ifdef WITH_XFIXES
xfi->xdamage_region = XFixesCreateRegion(xfi->display, NULL, 0);
if (xfi->xdamage_region == None)
{
printf("XFixesCreateRegion failed\n");
XDamageDestroy(xfi->display, xfi->xdamage);
xfi->xdamage = None;
return;
}
#endif
values.subwindow_mode = IncludeInferiors;
xfi->xdamage_gc = XCreateGC(xfi->display, DefaultRootWindow(xfi->display), GCSubwindowMode, &values);
}
#endif
xfInfo* xf_info_init()
{
int i;
xfInfo* xfi;
int pf_count;
int vi_count;
#ifdef WITH_XDAMAGE
int damage_event;
int damage_error;
#endif
XVisualInfo* vi;
XVisualInfo* vis;
XVisualInfo template;
@ -123,8 +169,9 @@ xfInfo* xf_info_init()
xfi->clrconv->alpha = 1;
XSelectInput(xfi->display, DefaultRootWindow(xfi->display), SubstructureNotifyMask);
#ifdef WITH_XDAMAGE
XDamageQueryExtension(xfi->display, &damage_event, &damage_error);
xf_xdamage_init(xfi);
#endif
return xfi;

View File

@ -22,6 +22,14 @@
#include <freerdp/codec/color.h>
#ifdef WITH_XFIXES
#include <X11/extensions/Xfixes.h>
#endif
#ifdef WITH_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
struct xf_info
{
int bpp;
@ -35,6 +43,13 @@ struct xf_info
Display* display;
int scanline_pad;
HCLRCONV clrconv;
#ifdef WITH_XDAMAGE
GC xdamage_gc;
Damage xdamage;
int xdamage_notify_event;
XserverRegion xdamage_region;
#endif
};
typedef struct xf_info xfInfo;