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 593686 - Add meta_screen_get_monitors()
Add meta_screen_get_monitors()
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks: 593060
 
 
Reported: 2009-08-31 15:44 UTC by Dan Winship
Modified: 2009-08-31 22:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Refer to monitors as "monitors" rather than "xineramas" (92.81 KB, patch)
2009-08-31 15:45 UTC, Dan Winship
accepted-commit_now Details | Review
Add meta_screen_get_monitors() (2.07 KB, patch)
2009-08-31 15:48 UTC, Dan Winship
reviewed Details | Review
Add meta_screen_get_n_monitors() and meta_screen_get_monitor_geometry() (1.86 KB, patch)
2009-08-31 20:22 UTC, Dan Winship
reviewed Details | Review
Add meta_screen_get_n_monitors() and meta_screen_get_monitor_geometry() (2.46 KB, patch)
2009-08-31 22:29 UTC, Dan Winship
accepted-commit_now Details | Review

Description Dan Winship 2009-08-31 15:44:44 UTC
Expose mutter's idea of the current multihead state. (In particular, by doing this rather than using gdk's methods, we allow plugins to share in the fun of MUTTER_DEBUG_XINERAMA.)
Comment 1 Dan Winship 2009-08-31 15:45:55 UTC
Created attachment 142134 [details] [review]
Refer to monitors as "monitors" rather than "xineramas"

Fix wacky metacity terminology to be less wacky. (And prepare for eventual
xrandr port?)
Comment 2 Dan Winship 2009-08-31 15:48:21 UTC
Created attachment 142136 [details] [review]
Add meta_screen_get_monitors()

This just exposes a list of rectangles. Mutter uses MetaRectangle internally,
but that's not a gtype type, so it can't be used from gnome-shell. So I
just convert to GdkRectangle here. Alternatively, we could return MetaRectangle
here and have a wrapper in gnome-shell to convert.

Also, we could add a big compile-time assertion checking that MetaRectangle
and GdkRectangle really are compatible if you want. Or put a warning above
the definition of MetaRectangle.
Comment 3 Owen Taylor 2009-08-31 18:02:42 UTC
Comment on attachment 142134 [details] [review]
Refer to monitors as "monitors" rather than "xineramas"

Yay! Looks good. (Will make patch merging from metacity a little harder perhaps, a small price to pay for getting rid of this weirdness.)
Comment 4 Owen Taylor 2009-08-31 18:08:59 UTC
Comment on attachment 142136 [details] [review]
Add meta_screen_get_monitors()

I think I'd prefer either:

 A) Register MetaRectangle as boxed

Or, B) - mirror the GDK API:

gint          gdk_screen_get_n_monitors        (GdkScreen *screen);
void          gdk_screen_get_monitor_geometry  (GdkScreen *screen,
                                                gint       monitor_num,
                                               GdkRectangle *dest);

So avoid returning a list of MetaRectangle altogether. The second encounters our out-caller-allocates problem, but can be worked around in gnome-shell without making the Mutter API funny.
Comment 5 Dan Winship 2009-08-31 20:22:07 UTC
Created attachment 142162 [details] [review]
Add meta_screen_get_n_monitors() and meta_screen_get_monitor_geometry()
Comment 6 Owen Taylor 2009-08-31 22:19:04 UTC
Comment on attachment 142162 [details] [review]
Add meta_screen_get_n_monitors() and meta_screen_get_monitor_geometry()

+  g_return_if_fail (monitor < screen->n_monitor_infos);

For a signed integer probably should be >= 0 && ...

Can I be a pain and ask for a) doc comments b) g_return_if_fail (META_IS_SCREEN ()) ?
Comment 7 Dan Winship 2009-08-31 22:29:09 UTC
Created attachment 142171 [details] [review]
Add meta_screen_get_n_monitors() and meta_screen_get_monitor_geometry()

With comments and more return_if_fails.
Comment 8 Owen Taylor 2009-08-31 22:34:07 UTC
Comment on attachment 142171 [details] [review]
Add meta_screen_get_n_monitors() and meta_screen_get_monitor_geometry()

You have a leftover gdk/gdk.h include. Otherwise looks good.