Rob Bradford wrote:
From: Rob Bradford <[email protected]> Add a probe_area request to the wl_shell_surface interface along with a visible_area event to communicate the result of the probe. The intention of this request and event is to allow the client to try and refine the placement of popup windows that would otherwise be unusable. --- protocol/wayland.xml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/protocol/wayland.xml b/protocol/wayland.xml index edb8a03..023067a 100644 --- a/protocol/wayland.xml +++ b/protocol/wayland.xml @@ -874,6 +874,46 @@ to the client owning the popup surface. </description> </event> + + <request name="probe_area">
I think this needs to take the extra argument that popup takes, which is used to determine if the window is above/below the panel.
+ </description> + <arg name="x" type="int"/> + <arg name="y" type="int"/> + <arg name="width" type="int"/> + <arg name="height" type="int"/> + <arg name="result" type="new_id" interface="wl_probe_result"/> + </request> + </interface> + + <interface name="wl_probe_result" version="1"> + <event name="visible_area"> + <description summary="the area that would be visible for a proposed transient surface"> + This event is fired in response to the probe_area request on the + object returned for that request. It returns the visible area that + the surface would occupy when taking into consideration the + output's edges. If the width or height is zero this indicates that the + window would not be visible at all in that dimension. In that case the + x and y values represent the distance to the edge of the viewable + area.
May want to either say that negative sizes indicate empty, or that negative sizes are not allowed to be returned. Basically I think it should be the shell's responsibility to return positive width and height.
In your sample implementation the x/y is the maximum of the top-left of the visible area and the top-left of the rectangle passed to the request. Your intention to return the nearest point on the edge of the visible rectangle is a good one, however.
I think you better check what the sample implementation does for rotated outputs. Arbitrary transforms are a pain. IMHO the caller does not literally want the unclipped rectangle and a rectangle with the same area and center and matching for 90 degree rotations will work and popups will appear pretty good on rotated clients. This (assuming I extracted it correctly from some sample code I had) returns the rectangle for the affine transform matrix (ac0,bd0,XY1):
w' = hypot(aw,ch) h' = hypot(bw,dh) x' = a(x+w/2)+c(y+h/2)+X-w'/2 y' = b(x+w/2)+d(y+h/2)+Y-h'/2 _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
