Skip to content

Commit

Permalink
add wm-class option
Browse files Browse the repository at this point in the history
  • Loading branch information
David Barth committed Mar 26, 2013
1 parent 10a9207 commit 96290ef
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
23 changes: 17 additions & 6 deletions client/X11/xf_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 */
Expand Down
5 changes: 5 additions & 0 deletions client/common/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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)
{

Expand Down
3 changes: 2 additions & 1 deletion include/freerdp/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 96290ef

Please sign in to comment.