GTK windows positioning and sizing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GTK windows positioning and sizing

Jo Blow
On windows, GTK is totally fubar'ed. I've spent about 3 days wasting my life trying to simply save and restore the positions of a window. It should be as easy as getPosition and setPosition and getSize and resize. It would be nice if the people that actually wrote the windows code worked together and even tested it out.

First, there is a bug in move because the x coordinate for top level windows is being treated as being centered, the y coordinate is not. resize does take in to account the titlebar height so, if the screen height is 1000 and you do a resize(-, 1000) your window is actually extending outside the screen. This would be fine if you could actually get the correct size but different methods to get the sizes include the titlebar and border.

Thanks guys, I appreciate it! I know it must be hard to do things right and windows is shit anyways... no one uses it.

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
LRN
Reply | Threaded
Open this post in threaded view
|

Re: GTK windows positioning and sizing

LRN
On 9/20/2017 2:07 PM, Jo Blow wrote:
> On windows, GTK is totally fubar'ed. I've spent about 3 days wasting my
> life trying to simply save and restore the positions of a window. It should
> be as easy as getPosition and setPosition and getSize and resize. It would
> be nice if the people that actually wrote the windows code worked together
> and even tested it out.
>

For me, this worked (pseudocode, for simplicity's sake):

window_size_allocate_cb()
{
  gtk_window_get_size (&saved_size)
}

window_configure_event_cb()
{
  gtk_window_get_position (&saved_position)
}

window_state_event_cb ()
{
  fulled = ev->new_window_state & GDK_WINDOW_STATE_FULLSCREEN ? TRUE : FALSE;
  maxed = ev->new_window_state & GDK_WINDOW_STATE_MAXIMIZED ? TRUE : FALSE;
}

somewhere else
{
  gtk_window_resize (saved_size);
  gtk_window_move (saved_position);

  if (maxed)
    gtk_window_maximize ();
}

Unless you have a HiDPI display, in which case there's a bug[1] filed for this.
And unless something broke in there in the last few months that i haven't noticed.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=788053

--
O< ascii ribbon - stop html email! - http://arc.pasp.de/

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list

0x8DADE9276759BA74.asc (3K) Download Attachment
signature.asc (836 bytes) Download Attachment