Re: SetSize vs GetSize
Robin Dunn <[email protected]> Wed, 24 Apr 2019 09:21:06 -0700 (PDT)
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_998_581303315.1556122867006 Content-Type: multipart/alternative; boundary="----=_Part_999_1251901829.1556122867006" ------=_Part_999_1251901829.1556122867006 Content-Type: text/plain; charset="UTF-8" Yep, using the client size is the right thing to do here. The issue is that on X-windows systems the frame decorations (title bar, borders, etc.) are implemented by the window manager and are influenced by the active themes or whatnot. There are protocols where the client application (the GTK libs in our case) can ask for the WM to get or set the overall size, but the various WMs are free to interpret that request however they want, or even not at all. So there are inconsistencies. Even if you had found the magic to make it work reliably for you with calculating and using deltas, it's possible that it would not have worked the same for a different user. -- Robin On Wednesday, April 24, 2019 at 8:10:48 AM UTC-7, Demetrios Tsillas wrote: > > Nevermind I just discovered GetClientSize/SetClientSize which do what I > want. > > On Wednesday, April 24, 2019 at 10:55:09 AM UTC-4, Demetrios Tsillas wrote: >> >> My app wants to remember its last geometry so it can restore itself to >> the last position and size if it is restarted. >> >> So OnClose I GetSize and GetPosition and save the results in an init file. >> >> OnStart I read this init file and SetSize and SetPosition to restore the >> geometry. >> >> But here's the problem: it appears every time I do this the window gets a >> little bigger. >> >> The reason is that if I SetSize (x, y) and GetSize => (x', y') x' - x > 0 >> and y' - y > 0. >> >> On Linux x' - x = 8 and y' - y = 32. >> >> Is there a natural way for me to do the right thing? >> >> I guess I can do the above math OnStart and use the differences to adjust >> the saved values OnClose. >> >> Just wondering if there's a cleaner way. >> >> thanks!!! >> -Jim. >> >> -- You received this message because you are subscribed to the Google Groups "wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. ------=_Part_999_1251901829.1556122867006 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Yep, using the client size is the right thing to do here.= =C2=A0<div><br></div><div>The issue is that on X-windows systems the frame = decorations (title bar, borders, etc.) are implemented by the window manage= r and are influenced by the active themes or whatnot. There are protocols w= here the client application (the GTK libs in our case) can ask for the WM t= o get or set the overall size, but the various WMs are free to interpret th= at request however they want, or even not at all. So there are inconsistenc= ies. Even if you had found the magic to make it work reliably for you with = calculating and using deltas, it's possible that it would not have work= ed the same for a different user.</div><div><br></div><div>--</div><div>Rob= in</div><div><br></div><div><br><br>On Wednesday, April 24, 2019 at 8:10:48= AM UTC-7, Demetrios Tsillas wrote:<blockquote class=3D"gmail_quote" style= =3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: = 1ex;"><div dir=3D"ltr">Nevermind I just discovered GetClientSize/SetClientS= ize which do what I want.<br><br>On Wednesday, April 24, 2019 at 10:55:09 A= M UTC-4, Demetrios Tsillas wrote:<blockquote class=3D"gmail_quote" style=3D= "margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><d= iv dir=3D"ltr">My app wants to remember its last geometry so it can restore= itself to the last position and size if it is restarted.<div><br></div><di= v>So OnClose I GetSize and GetPosition and save the results in an init file= .</div><div><br></div><div>OnStart I read this init file and SetSize and Se= tPosition to restore the geometry.</div><div><br></div><div>But here's = the problem: it appears every time I do this the window gets a little bigge= r.</div><div><br></div><div>The reason is that if I SetSize (x, y) and GetS= ize =3D> (x', y') x' - x > 0 and y' - y > 0.</div>= <div><br></div><div>On Linux x' - x =3D 8 and y' - y =3D 32.</div><= div><br></div><div>Is there a natural way for me to do the right thing?</di= v><div><br></div><div>I guess I can do the above math OnStart and use the d= ifferences to adjust the saved values OnClose.</div><div><br></div><div>Jus= t wondering if there's a cleaner way.</div><div><br></div><div>thanks!!= !</div><div>-Jim.</div><div><br></div></div></blockquote></div></blockquote= ></div></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;wxPython-dev" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">wxPyth= [email protected]</a>.<br /> For more options, visit <a href=3D"https://groups.google.com/d/optout">http= s://groups.google.com/d/optout</a>.<br /> ------=_Part_999_1251901829.1556122867006-- ------=_Part_998_581303315.1556122867006--