Re: gtk_init_with_args behavior



I've been doing it exactly like that in my own program, first getting the UTF-16 from Windows API, then converting to UTF-8 using g_utf16_to_utf8.

IMO, hooking this with gtk_init_with_args is not needed, GTK can use the standard args of the program, passed via "main()" function parameters,

but you will bypass that mechanism completely and use API to fetch UTF-16 process parameters directly from OS.

Regards,

  Miroslav

On 5/20/2018 12:36 PM, Lucky B.C wrote:
Well converting from UTF-16 to UTF-8, if you think it must be done.

On Sat, May 19, 2018 at 10:41 PM, Allin Cottrell <cottrell wfu edu <mailto:cottrell wfu edu>> wrote:

    On Sat, 19 May 2018, Miroslav Rajcic wrote:

        Hi Allin,

        on Windows, it is advisable to use an API to get the command
        line parameters as UTF-16, so you don't lose the letters
        "foreign" to your code page.

        See "CommandLineToArgvW" for more info:


    Thanks, Miroslav, that sounds like what I need. Is there such a
    thing as a standard way to hook this up with gtk_init_with_args?

    I can imagine calling GetCommandLineW, then CommandLineToArgvW,
    but then? If you converted the UTF-16 strings to UTF-8, could you
    then pass the array to gtk_init_with_args?

    Allin Cottrell


        On 5/19/2018 12:06 AM, Allin Cottrell wrote:

            I'm building an application using gtk-2.24.32 for use on
            MS Windows, and have run into a problem which may be
            associated with my call to
            gtk_init_with_args().

            I wonder whether, besides handling the arguments detailed
            in the
            (GOptionEntry *) argument to this function, gtk
            "translates" in some way the remaining program arguments?
            If so, this can be problematic.

            Here's the case in point: a Greek Windows user, running
            Windows in Engish, has named a Desktop subdirectory "test"
            in Greek (that is, tau-epsilon-sigma-tau). In the Windows
            file manager he selects a file in this subdirectory that's
            associated via the registry with my program and
            double-clicks on it. What my program actually gets as a
            residual argument, after calling gtk_init_with_args(), is
            the full path to this file, but with the Greek-letter
            sequence replaced by "test" -- and therefore, of course,
            the file cannot be opened.

            I'm not sure if it's Windows itself that is making this
            substitution or gtk. I'd be grateful if anyone could shed
            any light on the matter.

    _______________________________________________
    gtk-app-devel-list mailing list
    gtk-app-devel-list gnome org <mailto:gtk-app-devel-list gnome org>
    https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
    <https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list>




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