Please ignore my last message, some errors slipped through, this one should
be OK :)

On Wed, May 4, 2011 at 15:07, Tim Gouma <gotini...@gmail.com> wrote:

> Hereby I sent my updated patch. I can't test the windows code, so I hope
> this works :)
>
>
> On Fri, Apr 29, 2011 at 19:24, Mads Kiilerich <m...@kiilerich.com> wrote:
>
>> Tim Gouma wrote, On 04/29/2011 05:20 PM:
>>
>>  Hi!
>>>
>>> I made an patch for FreeRDP to support alternative window titles
>>> configurable via a command line option.
>>>
>>> I don't know if this is the right way to deliver the patch, following
>>> your code standards (although I tried to adapt the style of the other code)
>>> or if this is the best way to do it. This is my first time coding anything
>>> in this language (C?).
>>>
>>> So see for yourself what you are going to do with this patch, I thought
>>> it would be useful to post here.
>>>
>>
>> We unfortunately have some code duplication between xfreerdp and wfreerdp.
>> I think it would be great if it could be kept as aligned as possible so it
>> would be easier to consolidate eventually, so I would prefer if you could
>> update the stuff in win/wfreerdp as well.
>>
>> 'printf("komt ie:' should probably be something else if it should be there
>> at all.
>>
>> /Mads
>>
>
>
diff --git a/X11/xf_types.h b/X11/xf_types.h
index 6a29e47..8f0849e 100644
--- a/X11/xf_types.h
+++ b/X11/xf_types.h
@@ -52,6 +52,7 @@ struct xf_info
 	int percentscreen;
 	int keyboard_layout_id;
 	int decoration;
+	char window_title[64];
 
 	/* X11 stuff */
 	Window embed;
diff --git a/X11/xf_win.c b/X11/xf_win.c
index 3e4c94d..f0175f9 100644
--- a/X11/xf_win.c
+++ b/X11/xf_win.c
@@ -1299,7 +1299,9 @@ xf_post_connect(xfInfo * xfi)
 	}
 
 	char win_title[64];
-	if (xfi->settings->tcp_port_rdp == 3389)
+	if (strlen(xfi->window_title) > 0)
+		snprintf(win_title, sizeof(win_title), "%s", xfi->window_title);
+	else if (xfi->settings->tcp_port_rdp == 3389)
 		snprintf(win_title, sizeof(win_title), "%s - freerdp", xfi->settings->server);
 	else
 		snprintf(win_title, sizeof(win_title), "%s:%d - freerdp", xfi->settings->server, xfi->settings->tcp_port_rdp);
diff --git a/X11/xfreerdp.c b/X11/xfreerdp.c
index a1cd6c8..39e5e3d 100644
--- a/X11/xfreerdp.c
+++ b/X11/xfreerdp.c
@@ -108,6 +108,7 @@ out_args(void)
 		"\t-c: directory\n"
 		"\t-g: geometry, using format WxH or X%, default is 1024x768\n"
 		"\t-t: alternative port number, default is 3389\n"
+		"\t-T: set window title\n"
 		"\t-n: hostname\n"
 		"\t-o: console audio\n"
 		"\t-0: console session\n"
@@ -311,6 +312,17 @@ process_params(xfInfo * xfi, int argc, char ** argv, int * pindex)
 			}
 			settings->tcp_port_rdp = atoi(argv[*pindex]);
 		}
+		else if (strcmp("-T", argv[*pindex]) == 0)
+		{
+			*pindex = *pindex + 1;
+			if (*pindex == argc)
+			{
+				printf("missing window title\n");
+				exit(XF_EXIT_WRONG_PARAM);
+			}
+			strncpy(xfi->window_title, argv[*pindex], sizeof(xfi->window_title) - 1);
+			xfi->window_title[sizeof(xfi->window_title) - 1] = 0;
+		}
 		else if (strcmp("-n", argv[*pindex]) == 0)
 		{
 			*pindex = *pindex + 1;
diff --git a/win/wfreerdp/wf_types.h b/win/wfreerdp/wf_types.h
index 4bb7f38..4d82fab 100644
--- a/win/wfreerdp/wf_types.h
+++ b/win/wfreerdp/wf_types.h
@@ -47,6 +47,7 @@ struct wf_info
 	int fs_toggle;
 	int fullscreen;
 	int percentscreen;
+	char window_title[64];
 
 	/* Windows stuff */
 	HWND hwnd;
diff --git a/win/wfreerdp/wf_win.cpp b/win/wfreerdp/wf_win.cpp
index c2177ea..9e8bad6 100644
--- a/win/wfreerdp/wf_win.cpp
+++ b/win/wfreerdp/wf_win.cpp
@@ -1190,7 +1190,9 @@ wf_post_connect(wfInfo * wfi)
 
 	width = wfi->inst->settings->width;
 	height = wfi->inst->settings->height;
-	if (wfi->settings->tcp_port_rdp == 3389)
+	if (strlen(wfi->window_title) > 0)
+		_snwprintf(win_title, sizeof(win_title), "%s", wfi->window_title);
+	else if (wfi->settings->tcp_port_rdp == 3389)
 		_snwprintf(win_title, sizeof(win_title) / sizeof(win_title[0]), L"%S - freerdp", wfi->settings->server);
 	else
 		_snwprintf(win_title, sizeof(win_title) / sizeof(win_title[0]), L"%S:%d - freerdp", wfi->settings->server, wfi->settings->tcp_port_rdp);
diff --git a/win/wfreerdp/wfreerdp.cpp b/win/wfreerdp/wfreerdp.cpp
index 25c49d8..02ce621 100644
--- a/win/wfreerdp/wfreerdp.cpp
+++ b/win/wfreerdp/wfreerdp.cpp
@@ -102,6 +102,7 @@ out_args(void)
 		"\t-c: directory\n"
 		"\t-g: geometry, using format WxH or X%, default is 800x600\n"
 		"\t-t: alternative port number, default is 3389\n"
+		"\t-T: set window title\n"
 		"\t-n: hostname\n"
 		"\t-o: console audio\n"
 		"\t-0: console session\n"
@@ -255,6 +256,17 @@ process_params(wfInfo * wfi, int argc, char ** argv, int * pindex)
 			}
 			settings->tcp_port_rdp = atoi(argv[*pindex]);
 		}
+		else if (strcmp("-T", argv[*pindex]) == 0)
+		{
+			*pindex = *pindex + 1;
+			if (*pindex == argc)
+			{
+				printf("missing window title\n");
+				exit(XF_EXIT_WRONG_PARAM);
+			}
+			strncpy(wfi->window_title, argv[*pindex], sizeof(wfi->window_title) - 1);
+			wfi->window_title[sizeof(wfi->window_title) - 1] = 0;
+		}
 		else if (strcmp("-n", argv[*pindex]) == 0)
 		{
 			*pindex = *pindex + 1;
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Freerdp-devel mailing list
Freerdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Reply via email to