Fix XRandr for old systems and MacOSX

We need a recent enough version of XRandr to correctly detect monitor.
Also this patch adds some typo or style fixes.
This commit is contained in:
David Fort 2017-12-08 10:45:50 +01:00
parent 876a7697be
commit 11ee81be60
6 changed files with 17 additions and 13 deletions

View File

@ -199,7 +199,7 @@ if(WITH_XRENDER)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XRENDER_LIBRARIES})
endif()
if(NOT APPLE AND WITH_XRANDR)
if(WITH_XRANDR)
add_definitions(-DWITH_XRANDR)
include_directories(${XRANDR_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XRANDR_LIBRARIES})

View File

@ -41,6 +41,11 @@
#ifdef WITH_XRANDR
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/randr.h>
#if (RANDR_MAJOR * 100 + RANDR_MINOR) > 105
# define USABLE_XRANDR
#endif
#endif
#include "xf_monitor.h"
@ -60,8 +65,9 @@ int xf_list_monitors(xfContext* xfc)
return -1;
}
#ifdef WITH_XRANDR
if (XRRQueryExtension(xfc->display, &major, &minor))
#if defined(USABLE_XRANDR)
if (XRRQueryExtension(xfc->display, &major, &minor) && (XRRQueryVersion(xfc->display, &major, &minor) == True) &&
(major * 100 + minor >= 105))
{
XRRMonitorInfo *monitors = XRRGetMonitors(xfc->display, DefaultRootWindow(xfc->display), 1, &nmonitors);
@ -148,8 +154,9 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
&_dummy_i, &_dummy_i, (void*) &_dummy_i))
mouse_x = mouse_y = 0;
#ifdef WITH_XRANDR
if (XRRQueryExtension(xfc->display, &major, &minor))
#if defined(USABLE_XRANDR)
if (XRRQueryExtension(xfc->display, &major, &minor) && (XRRQueryVersion(xfc->display, &major, &minor) == True) &&
(major * 100 + minor >= 105))
{
XRRMonitorInfo *monitors = XRRGetMonitors(xfc->display, DefaultRootWindow(xfc->display), 1, &vscreen->nmonitors);

View File

@ -3874,8 +3874,7 @@ BOOL rdp_recv_demand_active(rdpRdp* rdp, wStream* s)
return FALSE;
}
rdp->update->secondary->glyph_v2 = (rdp->settings->GlyphSupportLevel >
GLYPH_SUPPORT_FULL) ? TRUE : FALSE;
rdp->update->secondary->glyph_v2 = (rdp->settings->GlyphSupportLevel > GLYPH_SUPPORT_FULL);
return TRUE;
}

View File

@ -604,7 +604,7 @@ BOOL rdp_send_data_pdu(rdpRdp* rdp, wStream* s, BYTE type, UINT16 channel_id)
Stream_SetPosition(s, length);
Stream_SealLength(s);
WLog_DBG(TAG, "%s: sending data (type=0x%x size=%d channelId)", __FUNCTION__, type, Stream_Length(s), channel_id);
WLog_DBG(TAG, "%s: sending data (type=0x%x size=%d channelId=%d)", __FUNCTION__, type, Stream_Length(s), channel_id);
if (transport_write(rdp->transport, s) < 0)
return FALSE;

View File

@ -1032,8 +1032,7 @@ int transport_check_fds(rdpTransport* transport)
* 0: success
* 1: redirection
*/
recv_status = transport->ReceiveCallback(transport, received,
transport->ReceiveExtra);
recv_status = transport->ReceiveCallback(transport, received, transport->ReceiveExtra);
Stream_Release(received);
/* session redirection or activation */

View File

@ -61,8 +61,7 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context,
DesktopWidth = resetGraphics->width;
DesktopHeight = resetGraphics->height;
if ((DesktopWidth != settings->DesktopWidth)
|| (DesktopHeight != settings->DesktopHeight))
if ((DesktopWidth != settings->DesktopWidth) || (DesktopHeight != settings->DesktopHeight))
{
settings->DesktopWidth = DesktopWidth;
settings->DesktopHeight = DesktopHeight;