Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Bug in Qt (?), Qt apps freks out if hildon-desktop is restarted

    Reply
    Page 2 of 3 | Prev |   1   2   3   | Next
    Wikiwide | # 11 | 2010-11-25, 10:07 | Report

    Originally Posted by Diph View Post
    What does the hildon-desktop theme option do?

    hildon-desktop -theme theme : Load the specified theme
    The same as personalization app?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    lunat | # 12 | 2010-11-25, 10:55 | Report

    the fact that it behaves the way you describe it with any theme change is good clue that what you search simple doesn't exist. at least nobody seems to bother if so.

    not only qtapps stay alive but with every theme change a part of the old theme stays. guess that rules out a qt problem. as it seems to be generic.
    well if you find something you might want to tell the themes maintainers about it. would be a great improvement to change themes without rebooting.

    otherwise the issue looks quite familiar to me.
    what i have to offer you concerning this is:
    a) processgroups
    b) lsof, fuser and the like

    yes, busybox is crappy. you will want some working tools if you are looking into this...
    as a sidenote you might get into real fun if you look closer at it.

    Originally Posted by d-iivil View Post
    I don't want to replicate the behaviour, but it would indeed be nice to know how the personalisation_app is doing the things.

    I already tried scanning the DBus and there's no (extra) activity there.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by lunat; 2010-11-25 at 11:07.
    The Following User Says Thank You to lunat For This Useful Post:
    d-iivil

     
    d-iivil | # 13 | 2010-11-25, 13:16 | Report

    Originally Posted by Diph View Post
    What does the hildon-desktop theme option do?

    hildon-desktop -theme theme : Load the specified theme
    Doesn't seem to do anything. The command can't be entered while hildon-desktop is running, and shutting down it first brings us back to original problem (Qt apps won't survive the hildon-home restart if they are running). Even after I've shut down the hildon-home with dsmetool and then bring it back to life with -theme argument, nothing is changed. I've tried to offer it these:
    -theme name_of_the_theme
    -theme /path/to/the/theme

    Edit | Forward | Quote | Quick Reply | Thanks

     
    nicolai | # 14 | 2010-11-25, 13:31 | Report

    Hi D-Iivil,
    why do you think the personalisation_app can do something that
    your app cannot?
    I mean, if you do
    Originally Posted by d-iivil View Post
    At least for me the following behaviour is reproducable:
    - open some Qt application which has at least one QComboBox or some menus on top bar to tap to
    - run "killall hildon-desktop" or "dsmetool -k /usr/bin/hildon-desktop; dsmetool -t -U user /usr/bin/hildon-desktop"
    - change theme with hildon buildin theme chooser
    is the behavior differently?

    Nicolai

    Edit | Forward | Quote | Quick Reply | Thanks

     
    d-iivil | # 15 | 2010-11-25, 16:24 | Report

    Originally Posted by nicolai View Post
    Hi D-Iivil,
    why do you think the personalisation_app can do something that
    your app cannot?
    I mean, if you do


    is the behavior differently?

    Nicolai
    I find it too much trouble for the user if he needs to go swap themes back and forth just to be able to see his new icons...

    There_must_be_a_way to clear those caches and silently reload hildon-desktop without opening the personalisation_app.

    Edit: didn't catch your actual question. Yes, the outcome is different. Qt apps (or any other) won't freak out when using personalisation_app.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to d-iivil For This Useful Post:
    nicolai

     
    jstokes | # 16 | 2010-11-26, 11:05 | Report

    Why not just reapply the theme? personalisation_app also comes with a command line counterpart. Otherwise, just read the source of any GTK+ theme switching app: Considering you're dealing with windows, it's unlikely D-Bus will play a part, look at X's Atoms, Properties and stuff. Perhaps http://code.google.com/p/gtk-theme-s...rc/utils.c#160 may be enough

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to jstokes For This Useful Post:
    d-iivil

     
    d-iivil | # 17 | 2010-11-27, 18:48 | Report

    Originally Posted by jstokes View Post
    Why not just reapply the theme? personalisation_app also comes with a command line counterpart. Otherwise, just read the source of any GTK+ theme switching app: Considering you're dealing with windows, it's unlikely D-Bus will play a part, look at X's Atoms, Properties and stuff. Perhaps http://code.google.com/p/gtk-theme-s...rc/utils.c#160 may be enough
    I'd be very very intrested in those personalisation_app's command line options. Do you have more info about those? I've tried to offer it many kinds of switches with no response at all (well, best I've got is segfault :P).

    Edit: forgot to mention that I've already tried to compile some standard gtk-theme-switchers with success, but unfortunately none of those will actually change anything. I guess it needs some hildon specific stuff which I don't have a glue

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by d-iivil; 2010-11-27 at 19:27.

     
    nicolai | # 18 | 2011-03-16, 15:40 | Report

    Originally Posted by d-iivil View Post
    I'd be very very intrested in those personalisation_app's command line options. Do you have more info about those? I've tried to offer it many kinds of switches with no response at all (well, best I've got is segfault :P).

    Edit: forgot to mention that I've already tried to compile some standard gtk-theme-switchers with success, but unfortunately none of those will actually change anything. I guess it needs some hildon specific stuff which I don't have a glue
    Have you tried matchbox-remote?
    For example
    /usr/bin/personalisation /usr/share/themes/beta
    /usr/bin/matchbox-remote -t beta

    switches to the theme "beta".

    regards
    Nicolai

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to nicolai For This Useful Post:
    d-iivil

     
    ivgalvez | # 19 | 2011-03-16, 15:48 | Report

    It's also problematic with DrLaunch:
    http://talk.maemo.org/showpost.php?p...&postcount=198

    Edit | Forward | Quote | Quick Reply | Thanks

     
    jstokes | # 20 | 2011-04-18, 18:23 | Report

    Originally Posted by d-iivil View Post
    Do you have more info about those?
    Hi,

    I've come back to this after a while, sorry for abandoning the thread!

    I've only tested this in Scratchbox (strace etc. on personalisation_app worked wonders ), but hopefully, it should work for refreshing the theme. If it doesn't work, you may have to switch to another theme because the underlying components realise that you're reapplying the same theme; if that's the case, I don't know what to do

    PHP Code:
    #include <stdlib.h>
    #include <string.h>
    #include <libgen.h>
    #include <X11/Xatom.h>
    #include <gdk/gdkx.h>
    #include <gtk/gtk.h>

    struct _theme_info
    {
        
    gchar *base_path;
        
    gchar *theme_name;
    };

    static 
    gboolean current_theme_info (struct _theme_info *theme_info)
    {
        
    #define THEME_DIR "/etc/hildon/theme"
        #define INDEX_THEME_FILE G_DIR_SEPARATOR_S "index.theme"
        #define STD_INDEX_LOC THEME_DIR INDEX_THEME_FILE

        
    gboolean retval = FALSE;
        
    gchar *linkdest1 = NULL, *linkdest2 = NULL;
        
    GKeyFile *theme_key = g_key_file_new();

        if ((!
    g_file_test (STD_INDEX_LOC, G_FILE_TEST_EXISTS)) || (!g_key_file_load_from_file (theme_key, STD_INDEX_LOC, G_KEY_FILE_NONE, NULL)) || !(theme_info->theme_name = g_key_file_get_string (theme_key, "Desktop Entry", "Name", NULL)))
            goto 
    getout;

        
    linkdest1 = g_file_read_link (THEME_DIR, NULL);
        if (!
    linkdest1) goto getout;

        
    linkdest2 = g_file_read_link (linkdest1, NULL); /* Is it a folder that's symlinked to another, like: default->alpha? */
        
    theme_info->base_path = g_path_get_basename (linkdest2 ? linkdest2 : linkdest1);

        
    retval = theme_info->base_path != NULL;

    getout:
        
    g_free (linkdest2);
        
    g_free (linkdest1);
        
    g_key_file_free (theme_key);

        return 
    retval;

    #undef STD_INDEX_LOC
    #undef INDEX_THEME_FILE
    #undef THEME_DIR
    }

    static 
    gboolean update_symbolic_link (const gchar *newtheme)
    {
        
    gboolean retval = FALSE;

        if (
    newtheme)
        {
            
    gint exit_status;
            
    gchar *cmdline;

            
    cmdline = g_strdup_printf ("%s %s/%s", "/usr/bin/personalisation", "/usr/share/themes", newtheme);
            
    retval = g_spawn_command_line_sync (cmdline, NULL, NULL, &exit_status, NULL) || exit_status != 0;
            
    g_free (cmdline);
        }
        
        return 
    retval;
    }

    static 
    void send_refresh_signal (void)
    {
        
    GdkEventClient event;

        
    event.type = GDK_CLIENT_EVENT;
        
    event.send_event = TRUE;
        
    event.window = NULL;
        
    event.message_type = gdk_atom_intern ("_GTK_READ_RCFILES", FALSE);
        
    event.data_format = 8;

        
    gdk_event_send_clientmessage_toall ((GdkEvent *) &event);
    }

    static 
    void refresh_matchbox (const gchar *base_path)
    {
        
    Display *disp = XOpenDisplay (getenv ("DISPLAY"));
        
    Atom _MB_THEME = XInternAtom (disp, "_MB_THEME", False);

        if (
    _MB_THEME != None)
        {
            
    Window root = DefaultRootWindow(disp);
            
    XChangeProperty (disp, root, _MB_THEME, XA_STRING, 8, PropModeReplace, (unsigned char*) base_path, strlen (base_path));

            
    Atom _MB_COMMAND = XInternAtom (disp, "_MB_COMMAND", False);
            if (
    _MB_COMMAND != None)
            {
                
    XEvent ev = { '\0', };

                
    ev.xclient.type = ClientMessage;
                
    ev.xclient.window = root;
                
    ev.xclient.message_type = _MB_COMMAND;
                
    ev.xclient.format = 8;
                
    ev.xclient.data.l[0] = 1;
                
                
    XSendEvent(disp, root, False, SubstructureRedirectMask|SubstructureNotifyMask, &ev);
            }
            
            
    XSync (disp, True);
        }
        
        
    XCloseDisplay (disp);
    }

    int main (int argc, char *argv[])
    {
        
    struct _theme_info theme_info;
        
    gtk_init (&argc, &argv);
        
        
    g_assert (current_theme_info(&theme_info));

        if (!
    update_symbolic_link (theme_info.base_path))
            return 
    1; /* Fails in my SB - "invalid cross-device link */

        
    GtkSettings *settings = gtk_settings_get_default();
        
    gtk_settings_set_string_property (settings, "gtk-theme-name", theme_info.theme_name, basename(argv[0]));
        
    //g_object_notify (G_OBJECT (settings), "gtk-theme-name");
        
    gtk_rc_reset_styles (settings);

        
    send_refresh_signal();

        
    gchar *maemo_launcher_pid_s;
        if (
    g_file_get_contents ("/tmp/maemo-launcher.pid", &maemo_launcher_pid_s, NULL, NULL))
        {
            
    pid_t maemo_launcher_pid = (pid_t) atoi (maemo_launcher_pid_s);
            if (
    maemo_launcher_pid > 0) kill (maemo_launcher_pid, SIGHUP);
            
    g_free (maemo_launcher_pid_s);
        }
        
        
    refresh_matchbox (theme_info.base_path);

        
    g_free (theme_info.base_path);
        
    g_free (theme_info.theme_name);

        return 
    0;
    } 
    Just using gtk+-2.0 for pkg-config works to compile it

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by jstokes; 2011-04-18 at 18:30.
    The Following 2 Users Say Thank You to jstokes For This Useful Post:
    d-iivil, MohammadAG

     
    Page 2 of 3 | Prev |   1   2   3   | Next
vBulletin® Version 3.8.8
Normal Logout