xfreerdp: add /monitor-list option

This commit is contained in:
Marc-André Moreau 2013-04-28 17:10:43 -04:00
parent 1cfda17da9
commit 24573ef08d
5 changed files with 66 additions and 3 deletions

View File

@ -1560,6 +1560,11 @@ xfInfo* freerdp_client_new(int argc, char** argv)
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
if (settings->ListMonitors)
{
xf_list_monitors(xfi);
}
return xfi;
}

View File

@ -37,6 +37,50 @@
/* See MSDN Section on Multiple Display Monitors: http://msdn.microsoft.com/en-us/library/dd145071 */
int xf_list_monitors(xfInfo* xfi)
{
#ifdef WITH_XINERAMA
Display* display;
int i, nmonitors = 0;
int ignored, ignored2;
XineramaScreenInfo* screen = NULL;
display = XOpenDisplay(NULL);
if (XineramaQueryExtension(display, &ignored, &ignored2))
{
if (XineramaIsActive(display))
{
screen = XineramaQueryScreens(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);
}
}
XCloseDisplay(display);
#else
Screen* screen;
Display* display;
display = XOpenDisplay(NULL);
screen = ScreenOfDisplay(display, DefaultScreen(display));
printf(" * [0] %dx%d\t+%d+%d\n", WidthOfScreen(screen), HeightOfScreen(screen), 0, 0);
XCloseDisplay(display);
#endif
return 0;
}
BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings)
{
int i;

View File

@ -43,6 +43,7 @@ typedef struct _VIRTUAL_SCREEN VIRTUAL_SCREEN;
#include "xf_interface.h"
#include "xfreerdp.h"
int xf_list_monitors(xfInfo* xfi);
BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings);
#endif /* __XF_MONITOR_H */

View File

@ -48,8 +48,9 @@ COMMAND_LINE_ARGUMENT_A args[] =
{ "kbd-subtype", COMMAND_LINE_VALUE_REQUIRED, "<subtype id>", NULL, NULL, -1, NULL, "Keyboard subtype" },
{ "kbd-fn-key", COMMAND_LINE_VALUE_REQUIRED, "<function key count>", NULL, NULL, -1, NULL, "Keyboard function key count" },
{ "admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "console", "Admin (or console) session" },
{ "multimon", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "Multi-monitor" },
{ "workarea", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Work area" },
{ "multimon", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "Use multiple monitors" },
{ "workarea", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Use available work area" },
{ "monitor-list", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT, NULL, NULL, NULL, -1, NULL, "List detected monitors" },
{ "t", COMMAND_LINE_VALUE_REQUIRED, "<title>", NULL, NULL, -1, "title", "Window title" },
{ "decorations", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueTrue, -1, NULL, "Window decorations" },
{ "smart-sizing", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Scale remote desktop to window size" },
@ -985,6 +986,13 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
printf("\n");
}
arg = CommandLineFindArgumentA(args, "monitor-list");
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
{
settings->ListMonitors = TRUE;
}
return COMMAND_LINE_STATUS_PRINT;
}
@ -1084,6 +1092,10 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
{
settings->Workarea = TRUE;
}
CommandLineSwitchCase(arg, "monitor-list")
{
settings->ListMonitors = TRUE;
}
CommandLineSwitchCase(arg, "t")
{
settings->WindowTitle = _strdup(arg->Value);

View File

@ -811,7 +811,8 @@ struct rdp_settings
ALIGN64 BOOL ForceMultimon; /* 389 */
ALIGN64 UINT32 DesktopPosX; /* 390 */
ALIGN64 UINT32 DesktopPosY; /* 391 */
UINT64 padding0448[448 - 392]; /* 392 */
ALIGN64 BOOL ListMonitors; /* 392 */
UINT64 padding0448[448 - 393]; /* 393 */
/* Client Message Channel Data */
UINT64 padding0512[512 - 448]; /* 448 */