You are totally at the mercy of your window manager for this, and the key issue here is:
without being maximized
So we are left with a number of hacks, because basically maximization and resizing are two separate things, in order that you might be able to remember where it was when it is unmaximized.
So before I show you this hideous hack, I urge you to consider using proper maximization and just be happy with it.
So here goes:
import gtk
# Even I am ashamed by this
# Set up a one-time signal handler to detect size changes
def _on_size_req(win, req):
x, y, w, h = win.get_allocation()
print x, y, w, h # just to prove to you its working
win.disconnect(win.connection_id)
win.unmaximize()
win.window.move_resize(x, y, w, h)
# Create the window, connect the signal, then maximise it
w = gtk.Window()
w.show_all()
w.connection_id = w.connect('size-request', _on_size_req)
# Maximizing will fire the signal handler just once,
# unmaximize, and then resize to the previously set size for maximization.
w.maximize()
# run this monstrosity
gtk.main()