GNOME Bugzilla – Bug 698786
window: add a maximized property to GtkWindow
Last modified: 2014-01-14 07:18:41 UTC
See attached patch; Benjamin agrees this is a good idea.
Created attachment 242363 [details] [review] window: add a maximized property to GtkWindow With proper notifications, plus an accessor method for that state. This allows client to just listen to notify::maximized instead of tracking window-state-event.
Review of attachment 242363 [details] [review]: do we use get_maximized() or is_maximized()? it's a read-only property, there is no actual setter, and it's a computed value.
(In reply to comment #2) > do we use get_maximized() or is_maximized()? it's a read-only property, there > is no actual setter, and it's a computed value. No strong preference here. When a property is involved, I usually prefer to call the C function that returns its value "get_$property_name". I see your point about that being read-only though. Should the property be renamed to is-maximized as well?
Looking for prior art, we do have gtk_window_is_active and GtkWindow::is-active
Created attachment 242841 [details] [review] window: add an is-maximized property to GtkWindow -- Renamed the property to is-maximized, and the method accordingly.
Review of attachment 242841 [details] [review]: looks generally okay to me, with a minor issue. ::: gtk/gtkwindow.c @@ +1222,2 @@ { GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); needs validation of the argument.
Created attachment 242847 [details] [review] window: add an is-maximized property to GtkWindow -- Indeed - here's a revised version with a type check.
Review of attachment 242847 [details] [review]: ::: gtk/gtkwindow.c @@ +6540,3 @@ + if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) + g_object_notify (G_OBJECT (widget), "maximized"); "is-maximized"
Created attachment 266041 [details] [review] window: add an is-maximized property to GtkWindow --- Fix review comment and rebase to master.
Attachment 266041 [details] pushed as 1977857 - window: add an is-maximized property to GtkWindow
Just out of curiosity what is the use case for this api? Every time I had to track window state to e.g. save it and restore it, I also had to check whether the window is fullscreen or if it is sticky etc. My concern is that we expose an api that's misleading for developers: they'll see this function and just handle this case and there is no clear way to handle those other cases, so people will just ignore them and we'll have more broken apps.