GnuCash
Contact   Instructions
Bug 796755 - buggy window handling at startup
Summary: buggy window handling at startup
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: User Interface General (show other bugs)
Version: 3.2
Hardware: PC Linux
: Normal minor
Target Milestone: ---
Assignee: ui
QA Contact: ui
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-13 12:06 EDT by Vincent Lefevre
Modified: 2018-07-16 13:47 EDT (History)
3 users (show)

See Also:


Attachments

Description Vincent Lefevre 2018-07-13 12:06:13 EDT
With GnuCash 3.x, the window handling at startup is buggy. This can be noticed with fvwm at least. Instead of opening the main window, GnuCash first opens a small window, which may require manual placement (thus annoying and confusing). This small window will actually never appear, making the manual placement completely useless.
Comment 1 John Ralls 2018-07-13 14:05:17 EDT
GnuCash (optionally) opens three separate windows at startup: A splash screen that includes a status bar to provide "User entertainment" during the rather long program load and often long database load; a Tip of the Day window displaying a selected "tip", and finally the main window. The first two can be disabled in Preferences.

The main window's size, contents, and location should be stored when you either switch databases or quit GnuCash and restored the next time you open that database.

Is the "small window" one of those three or some other artifact?
Comment 2 Vincent Lefevre 2018-07-13 18:42:58 EDT
The splash screen appears normally and the Tip of the Day window is disabled.

I've looked with xtrace, and it seems that the "small window" may be the main window before it is resized. I get the following:

1531518657.895 000:<:10e5: 48: Request(1): CreateWindow depth=0x18 window=0x03a0031a parent=0x000002ec x=0 y=0 width=800 height=600 border-width=0 class=InputOutput(0x0001) visual=0x0000002b value-list={background-pixel=0x00000000 border-pixel=0x00000000 bit-gravity=NorthWest(0x01) colormap=0x03a00002}
[...]
1531518657.933 000:>:1171: Event PropertyNotify(28) window=0x03a0031a atom=0x1eb(unrecognized atom) time=0x26fa5295 state=NewValue(0x00)
1531518657.967 000:<:1172:  4: Request(36): GrabServer 
1531518657.967 000:<:1173: 12: XInputExtension-Request(131,40): XIQueryPointer window=0x000002ec device=2
1531518659.759 000:>:1173: Event Generic(35) XInputExtension(131) Enter(7) deviceid=0x02 time=0x26fa59b7 sourceid=0x0b mode=Normal(0x00) detail=Nonlinear(0x03) root=0x000002ec event=0x03a00003 child=0x00000000 root_x=1428.000000 root_y=713.000000 event_x=1.000000 event_y=4.000000 same_screen=true(0x01) focus=false(0x00) mods={base_mods=0x00000000 latched_mods=0x00000000 locked_mods=0x00000000 effective_mods=0x00000000}; group={base_group=0x00 latched_group=0x00 locked_group=0x00 effective_group=0x00}; masks=0x00000000;
1531518659.807 000:>:1173: Event Generic(35) XInputExtension(131) Leave(8) deviceid=0x02 time=0x26fa59e7 sourceid=0x0b mode=Normal(0x00) detail=Nonlinear(0x03) root=0x000002ec event=0x03a00003 child=0x00000000 root_x=1620.000000 root_y=703.000000 event_x=193.000000 event_y=-6.000000 same_screen=true(0x01) focus=false(0x00) mods={base_mods=0x00000000 latched_mods=0x00000000 locked_mods=0x00000000 effective_mods=0x00000000}; group={base_group=0x00 latched_group=0x00 locked_group=0x00 effective_group=0x00}; masks=0x00000000;
1531518663.343 000:>:1173: Event ReparentNotify(21) event=0x03a0031a window=0x03a0031a parent=0x004ba4fa x=0 y=0 override-redirect=false(0x00)
[...]
1531518663.379 000:<:117d: 20: Request(12): ConfigureWindow window=0x03a0031a values={width=1469 height=1768}
[...]
1531518663.379 000:>:117d: Event (generated) ConfigureNotify(22) event=0x03a0031a window=0x03a0031a above-sibling=0x004ba4f9 x=258 y=28 width=1469 height=1768 border-width=0 override-redirect=false(0x00)

It seems that GnuCash tries to place the window / make it visible too early.

x=258 y=28 width=1469 height=1768 is the correct window position and size.
Comment 3 John Ralls 2018-07-15 12:56:27 EDT
> It seems that GnuCash tries to place the window / make it visible too early.

Yes, I think that's the case. Can you try:

--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -637,6 +637,8 @@ cleanup:
     if (page_type)
         g_free(page_type);
     g_free(page_group);
+
+    gtk_widget_show(GTK_WIDGET(window));
 }


@@ -721,7 +723,6 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
             DEBUG("first window %p.", active_windows->data);
         window = gnc_main_window_new();
     }
-    gtk_widget_show(GTK_WIDGET(window));

     priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
Comment 4 Vincent Lefevre 2018-07-15 22:14:26 EDT
I confirm that this fixes the problem. Thanks.
Comment 5 John Ralls 2018-07-15 23:25:50 EDT
Hmm, I somehow managed to move the gtk_widget_show to the wrong cleanup routine. Would you please test
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -721,7 +721,6 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
             DEBUG("first window %p.", active_windows->data);
         window = gnc_main_window_new();
     }
-    gtk_widget_show(GTK_WIDGET(window));

     priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);

@@ -906,6 +905,7 @@ cleanup:
     if (error)
         g_error_free(error);
     g_free(window_group);
+    gtk_widget_show(GTK_WIDGET(window));
 }
Comment 6 Vincent Lefevre 2018-07-16 05:43:12 EDT
This one is OK too for me.
Comment 7 John Ralls 2018-07-16 13:47:14 EDT
Thanks, pushed. It will be in 3.3.

Note You need to log in before you can comment on or make changes to this bug.