After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 698786 - window: add a maximized property to GtkWindow
window: add a maximized property to GtkWindow
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-04-24 19:52 UTC by Cosimo Cecchi
Modified: 2014-01-14 07:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
window: add a maximized property to GtkWindow (4.86 KB, patch)
2013-04-24 19:52 UTC, Cosimo Cecchi
reviewed Details | Review
window: add an is-maximized property to GtkWindow (7.31 KB, patch)
2013-04-29 20:20 UTC, Cosimo Cecchi
reviewed Details | Review
window: add an is-maximized property to GtkWindow (7.56 KB, patch)
2013-04-29 20:59 UTC, Cosimo Cecchi
reviewed Details | Review
window: add an is-maximized property to GtkWindow (5.73 KB, patch)
2014-01-12 02:37 UTC, Cosimo Cecchi
committed Details | Review

Description Cosimo Cecchi 2013-04-24 19:52:25 UTC
See attached patch; Benjamin agrees this is a good idea.
Comment 1 Cosimo Cecchi 2013-04-24 19:52:28 UTC
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.
Comment 2 Emmanuele Bassi (:ebassi) 2013-04-24 19:57:58 UTC
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.
Comment 3 Cosimo Cecchi 2013-04-27 18:13:03 UTC
(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?
Comment 4 Matthias Clasen 2013-04-29 01:19:06 UTC
Looking for prior art, we do have gtk_window_is_active and GtkWindow::is-active
Comment 5 Cosimo Cecchi 2013-04-29 20:20:59 UTC
Created attachment 242841 [details] [review]
window: add an is-maximized property to GtkWindow

--

Renamed the property to is-maximized, and the method accordingly.
Comment 6 Emmanuele Bassi (:ebassi) 2013-04-29 20:53:59 UTC
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.
Comment 7 Cosimo Cecchi 2013-04-29 20:59:01 UTC
Created attachment 242847 [details] [review]
window: add an is-maximized property to GtkWindow

--

Indeed - here's a revised version with a type check.
Comment 8 Matthias Clasen 2014-01-11 20:13:21 UTC
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"
Comment 9 Cosimo Cecchi 2014-01-12 02:37:14 UTC
Created attachment 266041 [details] [review]
window: add an is-maximized property to GtkWindow

---

Fix review comment and rebase to master.
Comment 10 Matthias Clasen 2014-01-14 04:19:09 UTC
Attachment 266041 [details] pushed as 1977857 - window: add an is-maximized property to GtkWindow
Comment 11 Paolo Borelli 2014-01-14 07:18:41 UTC
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.