[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: [XaraXtreme-dev] Executing Default Web Browser?

Is wxGTK/samples/html/test good enough? It calls wxLaunchBrowser when you select "open current page with default browser" and fails exactly like our help browser.

Indeed as I found out 2 minutes after posting (such is the way of

I have filed wxWidgets bug 1490838

OK, how about this (slightly less horrible than looking around
for files).

See if the current session manager is gnome (as opposed to KDE).
If it's gnome, execute "gnome-www-default-browser". KDE can do
something similar if it exists. Else fall back to the
wxLaunchDefaultBrowser route.

IE if we detect a session manager we know about, run a suitable
bit of code.

Code to check the session manager (Leio's) included below.

Does this sound a sensible aprroach?


Prints session managers vendorname (e.g, GnomeSM)
gcc -Wall -O2 -o smvendor smvendor.c -lX11 -lSM
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/SM/SMlib.h>

main (int argc, char **argv)
        Display     *dpy;
        SmcConn     smc_conn;
        char        *vendor;
        char        *client_id_ret;
        dpy = XOpenDisplay(NULL);

        smc_conn = SmcOpenConnection(NULL, NULL,
                                     999, 999,
                                     0 /* mask */, NULL /* callbacks */,
                                     NULL, &client_id_ret, 0, NULL);

        vendor = SmcVendor(smc_conn);
        printf("Session manager vendor: %s\n", vendor);

        SmcCloseConnection(smc_conn, 0, NULL);

        return 0;