Menu

#526 On Windows, maximize does not work correctly.

Current-devel-SVN
closed
windows (1)
5
2015-08-25
2015-05-08
No

On Windows, you can maximize the main Xiphos window, but when you close Xiphos then open it again it is not maximized, and is off centred.

The problem exists on Windows 7 and 8.1 (haven't tested on Windows 8, but it is most likely the same)

Discussion

  • Sam Cantrell

    Sam Cantrell - 2015-06-03

    Testing

    I tested this on Windows 7 with Xiphos 4.0.2, as well as on Debian 8 with the latest svn compiled:

    1) On Windows 7, if I close Xiphos when the window is maximized, and then restart the program, the window is off-centered from the top-left corner, as Christopher reported.

    2) On Debian, if I close Xiphos when the window is maximized, and then restart the program, the window is maximized.

    Problem

    Windows and Linux are saving different values when Xiphos is shutting down. On Windows 7, settings.xml is saved with app_x and app_y values of -8, whereas on the Debian virtual machine, it has an app_x value of 0 and an app_y value of 26 (I'm using Xfce and have a top bar, causing the vertical offset).

    When the function frontend_display from gnome2/xiphos.c is called, it takes the negative app_x and app_y values and makes them both 10, which is causing the slight offset from the top left corner that I'm seeing.

    void frontend_display(const char *tabs)
    {
        /* [SNIPPED] */
    
        /*
         * a little paranoia:
         * clamp geometry values to a reasonable bound.
         * sometimes xiphos gets insane reconfig events as it dies,
         * especially if it's due to just shutting linux down.
         */
        if (settings.app_x < 0)
                settings.app_x = 10;
        if (settings.app_x > (screen_width - 100))
                settings.app_x = screen_width - 100;
        if (settings.app_y < 0)
                settings.app_y = 10;
        if (settings.app_y > (screen_height - 100))
                settings.app_y = screen_height - 100;
    
        gtk_window_move(GTK_WINDOW(widgets.app), settings.app_x,
                settings.app_y);
    
        /* [SNIPPED] */
    }
    

    An attempt at a solution

    First I tried editing settings.xml on my Windows machine to have an app_x and app_y value of 0 before starting Xiphos, to see if that would create the window maximized. While the window took up the whole screen, it was not maximized, and extended slightly below the taskbar (see attached screenshot). Thus, I don't believe this solution would work.

    A better solution?

    The Gtk 2 & 3 documentation reference gtk_window_maximize for maximizing a window. If we creating a boolean value in the settings.xml for tracking whether the main program window was maximized on exit, we could then properly maximize the window on restart.

     

    Last edit: Sam Cantrell 2015-06-03
  • Karl Kleinpaste

    Karl Kleinpaste - 2015-08-25
    • status: open --> closed
    • assigned_to: Karl Kleinpaste
    • Group: Current-stable-SVN --> Current-devel-SVN
    • Priority: 1 --> 5
     
  • Karl Kleinpaste

    Karl Kleinpaste - 2015-08-25

    i sought to implement the better solution...but it's available in gtk3 only: gtk_window_is_maximized, which i want to use to save maximization state, is not available in gtk2, which is where win32/64 is built. significantly, there isn't even a maximize property on the window in gtk2. so i've also changed the "<0" test to set 0 instead of 10. it's not quite right, but it's a good bit closer.

     

Log in to post a comment.