GNOME Bugzilla – Bug 692871
Need to expose output information to make GdkScreen API work
Last modified: 2013-03-27 10:15:11 UTC
Currently the screen dimensions are hardcoded as 8192 x 8192. We need to listen for the output global object and then store the data we receive from that in a useful manner. Some of the GDK APIs we can neatly implement, e.g. gdk_screen_get_monitor_at_point since we have the information we need there. However for something like gdk_screen_get_monitor_at_window we are going to need to track which output a surface is on using the output enter/leave events. However this API call tries to the work based on gdk_screen_get_monitor_at_point and the global position of the window. However the client doesn't know the global position of the window.
It might be worth looking at the callers of gdk_screen_get_monitor_... apis. It think these apis are almost exclusively used for positioning of override-redirect windows - something that has to be done differently in wayland anyway.
Matthias, a good point. But the use case that I found that triggered the filing of this bug is in evince. Where it calls gdk_screen_get_monitor_at_window and then tries to get the geometry of that monitor in order to "fullscreen" onto the monitor that the window is on.
that sounds wrong - simply calling gdk_window_fullscreen should be good enough for that.
Created attachment 235732 [details] [review] [PATCH] wayland: Handle wl_output in GdkWaylandScreen Expose information about outputs in GdkScreen (gdk_screen_get_n_monitors and gdk_screen_get_monitor_*). --- gdk/wayland/gdkdisplay-wayland.c | 30 +--------- gdk/wayland/gdkprivate-wayland.h | 4 ++ gdk/wayland/gdkscreen-wayland.c | 122 +++++++++++++++++++++++++-------------- 3 files changed, 85 insertions(+), 71 deletions(-)
Review of attachment 235732 [details] [review]: So, Jan - this is really close to my WIP (down to the function names and the refactoring into GdkScreen!) on this. The main difference being I handled the multiple output case. So i'm going to pull in your change and then rebase my changes onto it so you get the credit for your hard work.
Rob, is there any more coming here ?
this can be tested with testxinerama in tests/
The fix for bug 696340 also fixes the missing monitor geometry here. testxinerama now reports the right monitor size, at least for my laptop, haven't tried with an external monitor.
Commited commit abe7dc6bb42a80b653b87b5bc051bbb78859ec76 Author: Kristian Høgsberg <krh@bitplanet.net> Date: Tue Mar 26 17:23:31 2013 -0400 wayland: Set screen size to bounding box of all outputs Don't hardcode 8192x8192. We don't get this info from wayland, so we compute it as we receive information about the available wl_outputs. to avoid hardcoding 8192x8192. We still need to handle hotplug, but for static configurations, I think we're all set now. Oh, we need to get the subpixel info from the geometry event and feed that into the g_settings machinery, but I couldn't immediately figure out how to do that.
And I did test this with an external monitor and it worked fine.
Hey Kristian, Matthias, I think that was the only change remaining I had in mind. And along with the other fixes that have gone into master today I think this one can be closed.