diff --git a/.gitignore b/.gitignore index e82f26244..b8e76d44e 100644 --- a/.gitignore +++ b/.gitignore @@ -80,6 +80,7 @@ xcode Release Win32 build/ +*.orig default.log *Amplifier XE* 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 2aa4c8a66..629fdfa34 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -125,6 +125,7 @@ COMMAND_LINE_ARGUMENT_A args[] = { "async-update", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous update" }, { "async-transport", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous transport (unstable)" }, { "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 } @@ -1516,6 +1517,10 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin { settings->AsyncTransport = 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 dcc52062b..4b5e3f3e7 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -946,7 +946,8 @@ struct rdp_settings ALIGN64 BOOL AsyncChannels; /* 1546 */ ALIGN64 BOOL AsyncTransport; /* 1547 */ ALIGN64 BOOL ToggleFullscreen; /* 1548 */ - UINT64 padding1600[1600 - 1549]; /* 1549 */ + ALIGN64 char* WmClass; /* 1549 */ + UINT64 padding1600[1600 - 1550]; /* 1550 */ /* Miscellaneous */ ALIGN64 BOOL SoftwareGdi; /* 1601 */ 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