aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Pedro CĂ´rte-Real <pedro@pedrocr.net>2019-07-28 12:19:34 +0100
committerLibravatar Drew DeVault <sir@cmpwn.com>2020-01-08 10:27:20 -0500
commit1f4b3c91d4ee4ee0948d8d6699cf6b0127a0f79b (patch)
treecae415dcef9d2201d948d6200545cec5e34a4c61
parentMake sure we don't calculate fractional pixel gaps (diff)
downloadsway-1f4b3c91d4ee4ee0948d8d6699cf6b0127a0f79b.tar.gz
sway-1f4b3c91d4ee4ee0948d8d6699cf6b0127a0f79b.tar.zst
sway-1f4b3c91d4ee4ee0948d8d6699cf6b0127a0f79b.zip
Make all the container dimensions integers
Containers are always fixed to the pixel grid so position and size them with integers instead of doubles. Functionally this should be no different since rounding down is already being done on things like layout. But it makes it clear what the intention is and avoids bugs where fractional pixels are used. The translating and moving code is still using doubles because the cursors can have fractional pixels and thus the code is plumbed that way. But that could also probably be changed easily by doing the integer conversions earlier and plumbing with int.
-rw-r--r--include/sway/tree/container.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 62c6556b..b31c6e7c 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -41,8 +41,8 @@ enum wlr_direction;
41struct sway_container_state { 41struct sway_container_state {
42 // Container properties 42 // Container properties
43 enum sway_container_layout layout; 43 enum sway_container_layout layout;
44 double x, y; 44 int x, y;
45 double width, height; 45 int width, height;
46 46
47 enum sway_fullscreen_mode fullscreen_mode; 47 enum sway_fullscreen_mode fullscreen_mode;
48 48
@@ -60,8 +60,8 @@ struct sway_container_state {
60 bool border_left; 60 bool border_left;
61 bool border_right; 61 bool border_right;
62 62
63 double content_x, content_y; 63 int content_x, content_y;
64 double content_width, content_height; 64 int content_width, content_height;
65}; 65};
66 66
67struct sway_container { 67struct sway_container {
@@ -83,10 +83,10 @@ struct sway_container {
83 // For C_ROOT, this has no meaning 83 // For C_ROOT, this has no meaning
84 // For other types, this is the position in layout coordinates 84 // For other types, this is the position in layout coordinates
85 // Includes borders 85 // Includes borders
86 double x, y; 86 int x, y;
87 double width, height; 87 int width, height;
88 double saved_x, saved_y; 88 int saved_x, saved_y;
89 double saved_width, saved_height; 89 int saved_width, saved_height;
90 90
91 // The share of the space of parent container this container occupies 91 // The share of the space of parent container this container occupies
92 double width_fraction; 92 double width_fraction;
@@ -98,14 +98,14 @@ struct sway_container {
98 double child_total_height; 98 double child_total_height;
99 99
100 // These are in layout coordinates. 100 // These are in layout coordinates.
101 double content_x, content_y; 101 int content_x, content_y;
102 int content_width, content_height; 102 int content_width, content_height;
103 103
104 // In most cases this is the same as the content x and y, but if the view 104 // In most cases this is the same as the content x and y, but if the view
105 // refuses to resize to the content dimensions then it can be smaller. 105 // refuses to resize to the content dimensions then it can be smaller.
106 // These are in layout coordinates. 106 // These are in layout coordinates.
107 double surface_x, surface_y; 107 int surface_x, surface_y;
108 double surface_width, surface_height; 108 int surface_width, surface_height;
109 109
110 enum sway_fullscreen_mode fullscreen_mode; 110 enum sway_fullscreen_mode fullscreen_mode;
111 111