Web lists-archives.com

Re: GTK windows positioning and sizing




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/

Attachment: 0x8DADE9276759BA74.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list