[PATCH] RESEND programs/explorer: Allow spaces in virtual desktop names via command line /desktop option
Ben Klein
shacklein at gmail.com
Sun Mar 15 20:19:17 CDT 2009
I noticed I left off the component in the subject of a few of my
recent patch submissions. Resend. I'd love to have suggestions on
cleaning this up! :D
2009/3/9 Ben Klein <shacklein at gmail.com>:
> The purpose of this patch should be pretty clear from the subject
> line. Feel free to adjust the comments I've added; it seems like what
> I've done here might not be completely obvious.
-------------- next part --------------
From cde0f703803a6b3849ca342e920b1d663e4541f0 Mon Sep 17 00:00:00 2001
From: Ben Klein <shacklein at gmail.com>
Date: Mon, 9 Mar 2009 15:11:00 +1100
Subject: programs/explorer Allow spaces in virtual desktop names via command line /desktop option
The stripping of spaces from the start of the command line has been moved to
prevent duplication of code in the added lines where cmdline is recalculated.
---
programs/explorer/desktop.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
index 480d245..7bc76e0 100644
--- a/programs/explorer/desktop.c
+++ b/programs/explorer/desktop.c
@@ -264,20 +264,29 @@ void manage_desktop( WCHAR *arg )
WCHAR *p = arg;
const WCHAR *name = NULL;
- /* get the rest of the command line (if any) */
+ /* assume the command line starts after the first space in arg */
while (*p && !isspace(*p)) p++;
if (*p)
- {
- *p++ = 0;
- while (*p && isspace(*p)) p++;
- if (*p) cmdline = p;
- }
+ cmdline = p;
/* parse the desktop option */
/* the option is of the form /desktop=name[,widthxheight] */
if (*arg == '=' || *arg == ',')
{
arg++;
+ /* arguments with spaces are surrounded with '"' */
+ if ((p = strchrW( arg, '"' )))
+ {
+ /* terminate the end of the desktop name */
+ *p = 0;
+ cmdline = ++p;
+ }
+ else if (cmdline)
+ {
+ /* cmdline points to the end of the desktop name argument */
+ *cmdline++ = 0;
+ }
+
name = arg;
if ((p = strchrW( arg, ',' ))) *p++ = 0;
if (!p || !parse_size( p, &width, &height ))
@@ -349,6 +358,8 @@ void manage_desktop( WCHAR *arg )
STARTUPINFOW si;
PROCESS_INFORMATION pi;
+ while (*cmdline && isspace(*cmdline)) cmdline++;
+
memset( &si, 0, sizeof(si) );
si.cb = sizeof(si);
WINE_TRACE( "starting %s\n", wine_dbgstr_w(cmdline) );
--
1.6.1.3
More information about the wine-devel
mailing list