
Hi all,
during my investigation for the cause of bug #195373 [Creating a new document breaks a 3D box] I have found that when a new desktop is created, it isn't automatically set active right away.
Namely, in sp_desktop_widget_new() the function inkscape_add_desktop() is called, but in this function the new desktop is *appended* (instead of *prepended*) to the list of existing desktops. Thus the following 'if' construct
if (DESKTOP_IS_ACTIVE (desktop)) { ... }
is not triggered (except for the very first desktop). I wonder if this is intentional. Well, it probably is, but why? :) Is there any reason why new desktops shouldn't be activated upon creation?
The current behaviour is what's causing bug #195373 since the perspectives in the _old_ desktop/document are updated according to the toggle states of toolbar buttons in the _new_ desktop.
There might be other ways to fix this but the easiest I have found is to simply change
g_slist_append (inkscape->desktops, desktop);
to
g_slist_prepend (inkscape->desktops, desktop);
in line 891 of inkscape.cpp. However, this would render the above-mentioned 'if' construct obsolete and I guess that there was a reason for introducing it in the first place. But since inkscape_add_desktop is not called from any other place except sp_desktop_widget_new() it looks like a rather safe thing to do.
I committed this change to SVN in rev. #17510. Please tell me if there are any objections or concerns that this could break other things. I will then revert it and try to find a different fix. Otherwise this should go into 0.46 as well (I'll file a bug in LaunchPad as soon as I know that it's safe to do).
Thanks, Max