From 96290efd76d1762a4cbf78e09f3ff0e40fa4cf07 Mon Sep 17 00:00:00 2001 From: David Barth Date: Tue, 26 Mar 2013 15:47:39 +0100 Subject: [PATCH 1/2] add wm-class option --- client/X11/xf_window.c | 23 +++++++++++++++++------ client/common/cmdline.c | 5 +++++ include/freerdp/settings.h | 3 ++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 7d9345aa6..96e3a8258 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -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 */ diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 28ab422aa..49b1c8300 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -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, "", 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) { diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index de4ac976f..27733a962 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -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 */ From 6f69b8a22f851343e50f89d589b8502500cc2d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Tue, 26 Mar 2013 15:02:33 -0400 Subject: [PATCH 2/2] wfreerdp: fix build --- winpr/include/winpr/path.h | 8 ++------ winpr/libwinpr/path/shell.c | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/winpr/include/winpr/path.h b/winpr/include/winpr/path.h index c94eb7cf3..d320ee17d 100644 --- a/winpr/include/winpr/path.h +++ b/winpr/include/winpr/path.h @@ -254,10 +254,6 @@ WINPR_API PCWSTR PathGetSharedLibraryExtensionW(unsigned long dwFlags); * Shell Path Functions */ -#ifdef _WIN32 -#include -#endif - #define KNOWN_PATH_HOME 1 #define KNOWN_PATH_TEMP 2 #define KNOWN_PATH_XDG_DATA_HOME 3 @@ -269,7 +265,7 @@ WINPR_API char* GetKnownPath(int id); WINPR_API char* GetKnownSubPath(int id, char* path); WINPR_API char* GetCombinedPath(char* basePath, char* subPath); -#ifndef _WIN32 +//#ifndef _WIN32 WINPR_API BOOL PathFileExistsA(LPCSTR pszPath); WINPR_API BOOL PathFileExistsW(LPCWSTR pszPath); @@ -280,6 +276,6 @@ WINPR_API BOOL PathFileExistsW(LPCWSTR pszPath); #define PathFileExists PathFileExistsA #endif -#endif +//#endif #endif /* WINPR_PATH_H */ diff --git a/winpr/libwinpr/path/shell.c b/winpr/libwinpr/path/shell.c index 36d2c642b..9d111debd 100644 --- a/winpr/libwinpr/path/shell.c +++ b/winpr/libwinpr/path/shell.c @@ -297,7 +297,7 @@ char* GetCombinedPath(char* basePath, char* subPath) return path; } -#ifndef _WIN32 +//#ifndef _WIN32 BOOL PathFileExistsA(LPCSTR pszPath) { @@ -314,4 +314,4 @@ BOOL PathFileExistsW(LPCWSTR pszPath) return FALSE; } -#endif +//#endif