From 98505a02349bd00b8e43b1666596e03be4c9015c Mon Sep 17 00:00:00 2001 From: Norbert Federa Date: Tue, 14 Apr 2015 17:03:53 +0200 Subject: [PATCH] xfreerdp: removed desktopWidth/desktopHeight vars These were basically unused (from the contexts's point of view) and only served as temporary storage --- client/X11/xf_client.c | 12 +----------- client/X11/xf_monitor.c | 34 +++++++++++++++++----------------- client/X11/xf_monitor.h | 2 +- client/X11/xfreerdp.h | 2 -- 4 files changed, 19 insertions(+), 31 deletions(-) diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index c2f2c8814..f017e849c 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -503,8 +503,6 @@ BOOL xf_create_window(xfContext* xfc) ZeroMemory(&xevent, sizeof(xevent)); - xf_detect_monitors(xfc); - width = xfc->sessionWidth; height = xfc->sessionHeight; @@ -541,12 +539,6 @@ BOOL xf_create_window(xfContext* xfc) sprintf(windowTitle, "FreeRDP: %s:%i", settings->ServerHostname, settings->ServerPort); } - if (xfc->fullscreen) - { - width = xfc->desktopWidth; - height = xfc->desktopHeight; - } - #ifdef WITH_XRENDER if (settings->SmartSizing) { @@ -1016,9 +1008,7 @@ BOOL xf_pre_connect(freerdp* instance) xf_keyboard_init(xfc); - xf_detect_monitors(xfc); - settings->DesktopWidth = xfc->desktopWidth; - settings->DesktopHeight = xfc->desktopHeight; + xf_detect_monitors(xfc, &settings->DesktopWidth, &settings->DesktopHeight); xfc->fullscreen = settings->Fullscreen; xfc->decorations = settings->Decorations; diff --git a/client/X11/xf_monitor.c b/client/X11/xf_monitor.c index a1790f469..4150d0502 100644 --- a/client/X11/xf_monitor.c +++ b/client/X11/xf_monitor.c @@ -115,7 +115,7 @@ BOOL xf_is_monitor_id_active(xfContext* xfc, UINT32 id) return FALSE; } -BOOL xf_detect_monitors(xfContext* xfc) +BOOL xf_detect_monitors(xfContext* xfc, UINT32* pWidth, UINT32* pHeight) { int i; int nmonitors = 0; @@ -134,8 +134,8 @@ BOOL xf_detect_monitors(xfContext* xfc) #endif vscreen = &xfc->vscreen; - xfc->desktopWidth = settings->DesktopWidth; - xfc->desktopHeight = settings->DesktopHeight; + *pWidth = settings->DesktopWidth; + *pHeight = settings->DesktopHeight; /* get mouse location */ if (!XQueryPointer(xfc->display, DefaultRootWindow(xfc->display), @@ -194,26 +194,26 @@ BOOL xf_detect_monitors(xfContext* xfc) if (settings->Fullscreen) { - xfc->desktopWidth = WidthOfScreen(xfc->screen); - xfc->desktopHeight = HeightOfScreen(xfc->screen); + *pWidth = WidthOfScreen(xfc->screen); + *pHeight = HeightOfScreen(xfc->screen); } else if (settings->Workarea) { - xfc->desktopWidth = xfc->workArea.width; - xfc->desktopHeight = xfc->workArea.height; + *pWidth = xfc->workArea.width; + *pHeight = xfc->workArea.height; } else if (settings->PercentScreen) { - xfc->desktopWidth = (xfc->workArea.width * settings->PercentScreen) / 100; - xfc->desktopHeight = (xfc->workArea.height * settings->PercentScreen) / 100; + *pWidth = (xfc->workArea.width * settings->PercentScreen) / 100; + *pHeight = (xfc->workArea.height * settings->PercentScreen) / 100; /* If we have specific monitor information then limit the PercentScreen value * to only affect the current monitor vs. the entire desktop */ if (vscreen->nmonitors > 0) { - settings->DesktopWidth = ((vscreen->monitors[current_monitor].area.right - vscreen->monitors[current_monitor].area.left + 1) * settings->PercentScreen) / 100; - settings->DesktopHeight = ((vscreen->monitors[current_monitor].area.bottom - vscreen->monitors[current_monitor].area.top + 1) * settings->PercentScreen) / 100; + *pWidth = ((vscreen->monitors[current_monitor].area.right - vscreen->monitors[current_monitor].area.left + 1) * settings->PercentScreen) / 100; + *pHeight = ((vscreen->monitors[current_monitor].area.bottom - vscreen->monitors[current_monitor].area.top + 1) * settings->PercentScreen) / 100; } } @@ -245,8 +245,8 @@ BOOL xf_detect_monitors(xfContext* xfc) settings->MonitorDefArray[nmonitors].x = vscreen->monitors[i].area.left; settings->MonitorDefArray[nmonitors].y = vscreen->monitors[i].area.top; - settings->MonitorDefArray[nmonitors].width = MIN(vscreen->monitors[i].area.right - vscreen->monitors[i].area.left + 1, xfc->desktopWidth); - settings->MonitorDefArray[nmonitors].height = MIN(vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1, xfc->desktopHeight); + settings->MonitorDefArray[nmonitors].width = MIN(vscreen->monitors[i].area.right - vscreen->monitors[i].area.left + 1, *pWidth); + settings->MonitorDefArray[nmonitors].height = MIN(vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1, *pHeight); settings->MonitorDefArray[nmonitors].orig_screen = i; nmonitors++; @@ -257,8 +257,8 @@ BOOL xf_detect_monitors(xfContext* xfc) { settings->MonitorDefArray[0].x = vscreen->monitors[current_monitor].area.left; settings->MonitorDefArray[0].y = vscreen->monitors[current_monitor].area.top; - settings->MonitorDefArray[0].width = MIN(vscreen->monitors[current_monitor].area.right - vscreen->monitors[current_monitor].area.left + 1, xfc->desktopWidth); - settings->MonitorDefArray[0].height = MIN(vscreen->monitors[current_monitor].area.bottom - vscreen->monitors[current_monitor].area.top + 1, xfc->desktopHeight); + settings->MonitorDefArray[0].width = MIN(vscreen->monitors[current_monitor].area.right - vscreen->monitors[current_monitor].area.left + 1, *pWidth); + settings->MonitorDefArray[0].height = MIN(vscreen->monitors[current_monitor].area.bottom - vscreen->monitors[current_monitor].area.top + 1, *pHeight); settings->MonitorDefArray[0].orig_screen = current_monitor; nmonitors = 1; @@ -355,8 +355,8 @@ BOOL xf_detect_monitors(xfContext* xfc) } /* Set the desktop width and height according to the bounding rectangle around the active monitors */ - xfc->desktopWidth = vscreen->area.right - vscreen->area.left + 1; - xfc->desktopHeight = vscreen->area.bottom - vscreen->area.top + 1; + *pWidth = vscreen->area.right - vscreen->area.left + 1; + *pHeight = vscreen->area.bottom - vscreen->area.top + 1; } return TRUE; diff --git a/client/X11/xf_monitor.h b/client/X11/xf_monitor.h index 6acbe64d4..8e15a3abe 100644 --- a/client/X11/xf_monitor.h +++ b/client/X11/xf_monitor.h @@ -44,7 +44,7 @@ typedef struct _VIRTUAL_SCREEN VIRTUAL_SCREEN; #include "xfreerdp.h" FREERDP_API int xf_list_monitors(xfContext* xfc); -FREERDP_API BOOL xf_detect_monitors(xfContext* xfc); +FREERDP_API BOOL xf_detect_monitors(xfContext* xfc, UINT32* pWidth, UINT32* pHeight); FREERDP_API void xf_monitors_free(xfContext* xfc); #endif /* __XF_MONITOR_H */ diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index e5a571c68..fe60cd1c9 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -171,8 +171,6 @@ struct xf_context wArrayList* xevents; char* actionScript; - UINT32 desktopWidth; - UINT32 desktopHeight; XSetWindowAttributes attribs; BOOL complex_regions; VIRTUAL_SCREEN vscreen;