Merge lp:~alan-griffiths/miral/simplify-size-increments into lp:miral

Proposed by Alan Griffiths on 2016-08-03
Status: Merged
Approved by: Gerry Boland on 2016-08-03
Approved revision: 252
Merged at revision: 252
Proposed branch: lp:~alan-griffiths/miral/simplify-size-increments
Merge into: lp:miral
Diff against target: 98 lines (+10/-24)
2 files modified
include/miral/window_info.h (+2/-4)
miral/window_info.cpp (+8/-20)
To merge this branch: bzr merge lp:~alan-griffiths/miral/simplify-size-increments
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve on 2016-08-03
Gerry Boland 2016-08-03 Approve on 2016-08-03
Review via email: mp+301909@code.launchpad.net

Commit Message

Simplify width/height increments as "no increment" is logically the same as increment 1

To post a comment you must log in.
Gerry Boland (gerboland) wrote :

LGTM!

review: Approve
Alexandros Frantzis (afrantzis) wrote :

OK.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/miral/window_info.h'
2--- include/miral/window_info.h 2016-06-22 13:38:48 +0000
3+++ include/miral/window_info.h 2016-08-03 14:05:23 +0000
4@@ -84,13 +84,11 @@
5 auto max_height() const -> mir::geometry::Height;
6 void max_height(mir::geometry::Height max_height);
7
8- bool has_width_inc() const;
9 auto width_inc() const -> mir::geometry::DeltaX;
10- void width_inc(mir::optional_value<mir::geometry::DeltaX> width_inc);
11+ void width_inc(mir::geometry::DeltaX width_inc);
12
13- bool has_height_inc() const;
14 auto height_inc() const -> mir::geometry::DeltaY;
15- void height_inc(mir::optional_value<mir::geometry::DeltaY> height_inc);
16+ void height_inc(mir::geometry::DeltaY height_inc);
17
18 bool has_min_aspect() const;
19 auto min_aspect() const -> AspectRatio;
20
21=== modified file 'miral/window_info.cpp'
22--- miral/window_info.cpp 2016-07-22 15:18:34 +0000
23+++ miral/window_info.cpp 2016-08-03 14:05:23 +0000
24@@ -49,8 +49,8 @@
25 mir::geometry::Height max_height;
26 MirOrientationMode preferred_orientation;
27
28- mir::optional_value<mir::geometry::DeltaX> width_inc;
29- mir::optional_value<mir::geometry::DeltaY> height_inc;
30+ mir::geometry::DeltaX width_inc;
31+ mir::geometry::DeltaY height_inc;
32 mir::optional_value<AspectRatio> min_aspect;
33 mir::optional_value<AspectRatio> max_aspect;
34 mir::optional_value<int> output_id;
35@@ -68,8 +68,8 @@
36 max_width{optional_value_or_default(params.max_width(), Width{std::numeric_limits<int>::max()})},
37 max_height{optional_value_or_default(params.max_height(), Height{std::numeric_limits<int>::max()})},
38 preferred_orientation{optional_value_or_default(params.preferred_orientation(), mir_orientation_mode_any)},
39- width_inc{params.width_inc()},
40- height_inc{params.height_inc()},
41+ width_inc{optional_value_or_default(params.width_inc(), DeltaX{1})},
42+ height_inc{optional_value_or_default(params.height_inc(), DeltaY{1})},
43 min_aspect{},
44 max_aspect{}
45 {
46@@ -283,7 +283,6 @@
47 if (max_height() < new_size.height)
48 new_size.height = max_height();
49
50- if (has_width_inc())
51 {
52 auto const width = new_size.width.as_int() - min_width().as_int();
53 auto inc = width_inc().as_int();
54@@ -291,7 +290,6 @@
55 new_size.width = min_width() + DeltaX{inc*(((2L*width + inc)/2)/inc)};
56 }
57
58- if (has_height_inc())
59 {
60 auto const height = new_size.height.as_int() - min_height().as_int();
61 auto inc = height_inc().as_int();
62@@ -472,32 +470,22 @@
63 self->userdata = userdata;
64 }
65
66-bool miral::WindowInfo::has_width_inc() const
67-{
68- return self->width_inc.is_set();
69-}
70-
71 auto miral::WindowInfo::width_inc() const -> mir::geometry::DeltaX
72 {
73- return self->width_inc.value();
74+ return self->width_inc;
75 }
76
77-void miral::WindowInfo::width_inc(mir::optional_value<mir::geometry::DeltaX> width_inc)
78+void miral::WindowInfo::width_inc(DeltaX width_inc)
79 {
80 self->width_inc = width_inc;
81 }
82
83-bool miral::WindowInfo::has_height_inc() const
84-{
85- return self->height_inc.is_set();
86-}
87-
88 auto miral::WindowInfo::height_inc() const -> mir::geometry::DeltaY
89 {
90- return self->height_inc.value();
91+ return self->height_inc;
92 }
93
94-void miral::WindowInfo::height_inc(mir::optional_value<mir::geometry::DeltaY> height_inc)
95+void miral::WindowInfo::height_inc(mir::geometry::DeltaY height_inc)
96 {
97 self->height_inc = height_inc;
98 }

Subscribers

People subscribed via source and target branches