peircej / jbrout

Automatically exported from code.google.com/p/jbrout
0 stars 0 forks source link

[feature request] remember window state (maximized) #173

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
JBrout remembers well the window size, but it doesn't remember that the window 
was maximized.
I saw that with the 0.3.284 under Windows and Linux.
So a little feature request to ask the remembering of the window state.

Original issue reported on code.google.com by p...@gmx.fr on 15 Oct 2010 at 9:20

GoogleCodeExporter commented 8 years ago
I found how to do it.
All changes are in jbrout.py, i did it with the 0.3.284 (but i give the line 
numbers for the r314).

In the init of class Window(GladeApp) (line 929 for example)
self.main_widget.connect('window-state-event', self.on_window_state_event)

Just after setting the size of the app (line 1203)
        if JBrout.conf["maximizedWindow"]:
            self.main_widget.maximize()

And a new def (i put it line 2284)
    def on_window_state_event(self, widget, event):
        if event.new_window_state & gtk.gdk.WINDOW_STATE_MAXIMIZED:
            JBrout.conf["maximizedWindow"] = True
        else:
            JBrout.conf["maximizedWindow"] = False

Tested under linux, to be tested under windows.

Original comment by p...@gmx.fr on 25 Oct 2010 at 11:33

GoogleCodeExporter commented 8 years ago
In addition to remembering the maxed state, here is a fix to remember the size 
of the last non-maxed state (like other good softwares).
The code i gave in last comment (lines "929" and "1203" (in r314)) is still 
valid.
I updated on_window_state_event (smaller code) and on_window_size_allocate 
(which was on line 2357 (in r320) but doing nothing).

    def on_window_state_event(self, widget, event): # remember maximized state
        JBrout.conf["maximizedWindow"] = bool(event.new_window_state & gtk.gdk.WINDOW_STATE_MAXIMIZED)

    def on_window_size_allocate(self, widget, *args):
        if not JBrout.conf["maximizedWindow"]: # save size only if not maximized
            JBrout.conf["width"],JBrout.conf["height"] = self.main_widget.get_size()
            JBrout.conf["x_pos"],JBrout.conf["y_pos"] = self.main_widget.get_position()

In on_window_delete_event, remove lines 2318-2319 (in r320)
        JBrout.conf["width"],JBrout.conf["height"] = self.main_widget.get_size()
        JBrout.conf["x_pos"],JBrout.conf["y_pos"] = self.main_widget.get_position()

Original comment by p...@gmx.fr on 7 Nov 2010 at 3:45

GoogleCodeExporter commented 8 years ago
I strongly suggest WONTFIX on this bug. All this should be done by window 
manager. I am sorry if you use window manager which doesn't work as they 
should. However, in my opinion, programs shouldn't compensate for it.

Original comment by matej.c...@gmail.com on 4 Dec 2010 at 8:52

GoogleCodeExporter commented 8 years ago
I'm not sure it's a window manager task to remember the state of each program.
Which window manager do that?
The window manager of Windows XP and Ubuntu don't do it.

Original comment by p...@gmx.fr on 5 Dec 2010 at 11:24

GoogleCodeExporter commented 8 years ago
Metacity (current default window manager in Gnome) does remember the previous 
state of windows. Read http://git.gnome.org/browse/metacity/tree/README for 
more.

Original comment by matej.c...@gmail.com on 5 Dec 2010 at 11:41

GoogleCodeExporter commented 8 years ago

Original comment by matej.c...@gmail.com on 12 Aug 2013 at 10:23

GoogleCodeExporter commented 8 years ago

Original comment by matej.c...@gmail.com on 31 Aug 2014 at 11:21