[PATCH 2/2] winebrowser: Open the default browser if called without an argument.

Zebediah Figura zfigura at codeweavers.com
Tue Aug 1 12:00:29 CDT 2017


xdg-open can't handle this, so work around with the following command
(suggested by Vincent Povirk):
gtk-launch `xdg-mime query default x-scheme-handler/http`

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 programs/winebrowser/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/programs/winebrowser/main.c b/programs/winebrowser/main.c
index 3c4b4a32660..5b86cd5f7a2 100644
--- a/programs/winebrowser/main.c
+++ b/programs/winebrowser/main.c
@@ -121,7 +121,7 @@ static int open_http_url( const WCHAR *url )
         { '/','u','s','r','/','b','i','n','/','o','p','e','n',0,0 };
 #else
     static const WCHAR defaultbrowsers[] =
-        {'x','d','g','-','o','p','e','n',0,
+        {'g','t','k','-','l','a','u','n','c','h',' ','`','x','d','g','-','m','i','m','e',' ','q','u','e','r','y',' ','d','e','f','a','u','l','t',' ','x','-','s','c','h','e','m','e','-','h','a','n','d','l','e','r','/','h','t','t','p','`',0,
          'f','i','r','e','f','o','x',0,
          'k','o','n','q','u','e','r','o','r',0,
          'm','o','z','i','l','l','a',0,
@@ -424,6 +424,7 @@ static WCHAR *convert_file_uri(IUri *uri)
 int wmain(int argc, WCHAR *argv[])
 {
     static const WCHAR nohomeW[] = {'-','n','o','h','o','m','e',0};
+    static const WCHAR emptyW[] = {0};
 
     WCHAR *url = argv[1];
     BSTR display_uri = NULL;
@@ -438,8 +439,7 @@ int wmain(int argc, WCHAR *argv[])
         url = argc > 2 ? argv[2] : get_url_from_dde();
 
     if (!url) {
-        WINE_ERR( "Usage: winebrowser URL\n" );
-        return -1;
+        return open_http_url(emptyW);
     }
 
     hres = CreateUri(url, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
-- 
2.13.3




More information about the wine-patches mailing list