aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-01-28 16:00:34 +1000
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-28 01:17:21 -0500
commit0a9ff774ad77d5c650c03c0ac3501983f3cb0d19 (patch)
tree08cb652bb05cc7003b30f93f78d62f84e965fe8f /include
parentMerge pull request #3423 from RyanDwyer/fullscreen-global (diff)
downloadsway-0a9ff774ad77d5c650c03c0ac3501983f3cb0d19.tar.gz
sway-0a9ff774ad77d5c650c03c0ac3501983f3cb0d19.tar.zst
sway-0a9ff774ad77d5c650c03c0ac3501983f3cb0d19.zip
Center surface inside container when it's too small
The goal here is to center fullscreen views when they are both too small for the output and refuse to resize to the output's dimensions. It has the side effect of also centering the view when it's too small for its container. Example clients that have this behaviour are emersion's hello-wayland and weston. It works by introducing surface_{x,y,width,height} properties to the container struct. The x and y represent layout-local coordinates where the surface will be rendered. The width and height are only used to track the surface's previous dimensions so we can detect when the client has resized it and recenter and apply damage accordingly. The new surface properties are calculated when a transaction is applied, as well as when a view resizes itself unexpectedly. The latter is done in view_update_size. This function was previously restricted to views which are floating, but can now be called for any views. For views which refuse to resize *smaller* than a particular size, such as gnome-calculator, the surface is still anchored to the top left as per the current behaviour.
Diffstat (limited to 'include')
-rw-r--r--include/sway/tree/container.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index f0d0b3ce..543bd2cc 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -88,9 +88,16 @@ struct sway_container {
88 double saved_x, saved_y; 88 double saved_x, saved_y;
89 double saved_width, saved_height; 89 double saved_width, saved_height;
90 90
91 // These are in layout coordinates.
91 double content_x, content_y; 92 double content_x, content_y;
92 int content_width, content_height; 93 int content_width, content_height;
93 94
95 // In most cases this is the same as the content x and y, but if the view
96 // refuses to resize to the content dimensions then it can be smaller.
97 // These are in layout coordinates.
98 double surface_x, surface_y;
99 double surface_width, surface_height;
100
94 enum sway_fullscreen_mode fullscreen_mode; 101 enum sway_fullscreen_mode fullscreen_mode;
95 102
96 enum sway_container_border border; 103 enum sway_container_border border;