add wm-class option

This commit is contained in:
David Barth 2013-03-26 15:47:39 +01:00
parent 10a92074c5
commit 96290efd76
3 changed files with 24 additions and 7 deletions

View File

@ -359,7 +359,10 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height,
if (class_hints != NULL)
{
class_hints->res_name = "xfreerdp";
class_hints->res_class = "xfreerdp";
if (xfi->instance->settings->WmClass != NULL)
class_hints->res_class = xfi->instance->settings->WmClass;
else
class_hints->res_class = "xfreerdp";
XSetClassHint(xfi->display, window->handle, class_hints);
XFree(class_hints);
}
@ -515,14 +518,22 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
if (class_hints != NULL)
{
char* class;
class = malloc(sizeof(rail_window_class));
snprintf(class, sizeof(rail_window_class), "RAIL:%08X", id);
char* class = NULL;
if (xfi->instance->settings->WmClass != NULL)
class_hints->res_class = xfi->instance->settings->WmClass;
else {
class = malloc(sizeof(rail_window_class));
snprintf(class, sizeof(rail_window_class), "RAIL:%08X", id);
class_hints->res_class = class;
}
class_hints->res_name = "RAIL";
class_hints->res_class = class;
XSetClassHint(xfi->display, window->handle, class_hints);
XFree(class_hints);
free(class);
if (class)
free(class);
}
/* Set the input mode hint for the WM */

View File

@ -124,6 +124,7 @@ COMMAND_LINE_ARGUMENT_A args[] =
{ "async-input", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous input" },
{ "async-update", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous update" },
{ "async-channels", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous channels (unstable)" },
{ "wm-class", COMMAND_LINE_VALUE_REQUIRED, "<class name>", NULL, NULL, -1, NULL, "set the WM_CLASS hint for the window instance" },
{ "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1, NULL, "print version" },
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "print help" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
@ -1511,6 +1512,10 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
{
settings->AsyncChannels = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchCase(arg, "wm-class")
{
settings->WmClass = _strdup(arg->Value);
}
CommandLineSwitchDefault(arg)
{

View File

@ -682,7 +682,8 @@ struct rdp_settings
ALIGN64 BOOL AsyncUpdate; /* 1545 */
ALIGN64 BOOL AsyncChannels; /* 1546 */
ALIGN64 BOOL ToggleFullscreen; /* 1547 */
UINT64 padding1600[1600 - 1548]; /* 1548 */
ALIGN64 char* WmClass; /* 1548 */
UINT64 padding1600[1600 - 1549]; /* 1549 */
/* Miscellaneous */
ALIGN64 BOOL SoftwareGdi; /* 1601 */