GNOME Bugzilla – Bug 593686
Add meta_screen_get_monitors()
Last modified: 2009-08-31 22:58:13 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.)
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?)
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 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 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.
Created attachment 142162 [details] [review] Add meta_screen_get_n_monitors() and meta_screen_get_monitor_geometry()
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 ()) ?
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 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.