After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 518846 - Restore toplevel maximized window
Restore toplevel maximized window
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.12.x
Other Windows
: Normal normal
: ---
Assigned To: Cody Russell
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-02-26 14:11 UTC by Carl
Modified: 2008-03-23 15:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test program (5.12 KB, text/x-csrc)
2008-02-28 11:18 UTC, Carl
Details
XML menu needed to be load by main prog (578 bytes, text/xml)
2008-02-28 11:19 UTC, Carl
Details

Description Carl 2008-02-26 14:11:32 UTC
Please describe the problem:
Open popup window from maximized main one imply restore of main window to his original size. 

Steps to reproduce:
1. First toplevel window must but miximized or fullscreen mode.
2. Application need to have menu tearoffs enable. Use tearoffs, window detach from the menu and main maximized window is restored. It's like you checked the restore button on decoration window.
3. We use also gtk_window_get_transient_for() and same problem happen when we call this fonction for a popup window.


Actual results:
Maximised windows is restored.

Expected results:
Maximised windows don't change.

Does this happen every time?
YES

Other information:
I don't have time to compile by myself library but I give my point of view without check. I suppose the problem can be solve by it. 

--- gdkevents-win32.c.orig      2008-02-26 14:28:41.000000000 +0100
+++ gdkevents-win32.c   2008-02-26 14:29:05.000000000 +0100
@@ -1305,7 +1305,7 @@
       if (GDK_WINDOW_IS_MAPPED (window))
         {
           if (!hide_window)
-            ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
+            ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
           else
             ShowWindow (GDK_WINDOW_HWND (window), SW_MINIMIZE);
         }

In fact, recursive calls make all windows to restore instead of just keep their size. Prehaps SW_SHOW, SW_SHOWNA, SW_SHOWNOACTIVATE can be better but you have to choose what you really need. (refer to http://msdn2.microsoft.com/en-us/library/ms633548(VS.85).aspx)
Comment 1 Cody Russell 2008-02-27 18:10:10 UTC
Can you write a very simple test program that shows the problem?
Comment 2 Carl 2008-02-28 11:18:36 UTC
Created attachment 106150 [details]
test program
Comment 3 Carl 2008-02-28 11:19:23 UTC
Created attachment 106151 [details]
XML menu needed to be load by main prog
Comment 4 Carl 2008-02-28 11:21:00 UTC
First, it's lot of pain to report a bug :)
Anyway, I have stole a little program onto forum and adapted fast to reproduce the bug.

So, don't care about good use of gtk_window_set_transient_for() or not. It's just a way to reproduce bug.

Compile it and run it with the xml file menu in same directory. Start program and maximize window (usally you have button at rigth corner :D). DON'T RESIZE yourself the windwos because restore function will be hidden.

First test to do is tearoff. Open a menu and use tearoff to detach -> enjoy restore main window

Remaximize and press on "Ouvrir" (open icon on tools bar or menu fichier -> ouvrir) -> enjoy restore main window

Comment 5 Cody Russell 2008-02-28 15:38:12 UTC
Thanks a lot Carl!  I'll look into this.
Comment 6 Cody Russell 2008-03-23 15:38:45 UTC
2008-03-23  Cody Russell  <bratsche@gnome.org>

        * gdk/win32/gdkevents-win32.c (show_window_recurse):
        Check window state for GDK_WINDOW_STATE_ICONIFIED before doing
        ShowWindow (SW_RESTORE).  This fixes a problem where tearing off
        menus from a maximized window would force the window to restore
        its size. (#518846)