Merge lp:~marcobiscaro2112/unity/fixes-754214 into lp:unity

Proposed by Marco Biscaro
Status: Merged
Merged at revision: 1213
Proposed branch: lp:~marcobiscaro2112/unity/fixes-754214
Merge into: lp:unity
Diff against target: 101 lines (+23/-3)
4 files modified
src/PluginAdapter.cpp (+7/-2)
src/PluginAdapter.h (+5/-1)
src/unityshell.cpp (+4/-0)
unityshell.xml.in (+7/-0)
To merge this branch: bzr merge lp:~marcobiscaro2112/unity/fixes-754214
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+62305@code.launchpad.net

Description of the change

A new option to configure the automaximize value is now present.

This does *not* introduce new code paths, it just turns the hardcoded value (75%) in an option that can be configured through ccsm.

To post a comment you must log in.
1197. By Marco Biscaro

Removing debug info.

Revision history for this message
Neil J. Patel (njpatel) wrote :

Looks good, seems to work well. Approved and merged, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PluginAdapter.cpp'
2--- src/PluginAdapter.cpp 2011-05-24 11:29:34 +0000
3+++ src/PluginAdapter.cpp 2011-05-25 14:27:06 +0000
4@@ -24,7 +24,6 @@
5 PluginAdapter * PluginAdapter::_default = 0;
6
7 #define MAXIMIZABLE (CompWindowActionMaximizeHorzMask & CompWindowActionMaximizeVertMask & CompWindowActionResizeMask)
8-#define COVERAGE_AREA_BEFORE_AUTOMAXIMIZE 0.75
9
10 #define MWM_HINTS_FUNCTIONS (1L << 0)
11 #define MWM_HINTS_DECORATIONS (1L << 1)
12@@ -57,6 +56,7 @@
13 _grab_show_action = 0;
14 _grab_hide_action = 0;
15 _grab_toggle_action = 0;
16+ _coverage_area_before_automaximize = 0;
17 }
18
19 PluginAdapter::~PluginAdapter()
20@@ -617,7 +617,7 @@
21 // not mapped yet
22 const XSizeHints& hints = window->sizeHints ();
23 covering_part = (float)(window->serverWidth () * window->serverHeight ()) / (float)(screen_width * screen_height);
24- if ((covering_part < COVERAGE_AREA_BEFORE_AUTOMAXIMIZE) || (covering_part > 1.0) ||
25+ if ((covering_part < _coverage_area_before_automaximize) || (covering_part > 1.0) ||
26 (hints.flags & PMaxSize && (screen_width > hints.max_width || screen_height > hints.max_height)))
27 {
28 g_debug ("MaximizeIfBigEnough: %s window size doesn't fit", win_wmclass.c_str());
29@@ -683,3 +683,8 @@
30 /* Initiate the first available action with the arguments */
31 _grab_toggle_action->initiate () (_grab_toggle_action, 0, argument);
32 }
33+
34+void
35+PluginAdapter::SetCoverageAreaBeforeAutomaximize (float area) {
36+ _coverage_area_before_automaximize = area;
37+}
38
39=== modified file 'src/PluginAdapter.h'
40--- src/PluginAdapter.h 2011-04-26 00:57:23 +0000
41+++ src/PluginAdapter.h 2011-05-25 14:27:06 +0000
42@@ -112,6 +112,8 @@
43 void MaximizeIfBigEnough (CompWindow *window);
44
45 nux::Geometry GetWindowGeometry (guint32 xid);
46+
47+ void SetCoverageAreaBeforeAutomaximize (float area);
48
49 protected:
50 PluginAdapter(CompScreen *screen);
51@@ -130,7 +132,9 @@
52 CompAction *_grab_show_action;
53 CompAction *_grab_hide_action;
54 CompAction *_grab_toggle_action;
55-
56+
57+ float _coverage_area_before_automaximize;
58+
59 static PluginAdapter *_default;
60 };
61
62
63=== modified file 'src/unityshell.cpp'
64--- src/unityshell.cpp 2011-05-04 13:18:37 +0000
65+++ src/unityshell.cpp 2011-05-25 14:27:06 +0000
66@@ -763,6 +763,9 @@
67 case UnityshellOptions::DashBlurExperimental:
68 PlacesSettings::GetDefault ()->SetDashBlurType ((PlacesSettings::DashBlurType)optionGetDashBlurExperimental ());
69 break;
70+ case UnityshellOptions::AutomaximizeValue:
71+ PluginAdapter::Default ()->SetCoverageAreaBeforeAutomaximize (optionGetAutomaximizeValue () / 100.0f);
72+ break;
73 default:
74 break;
75 }
76@@ -936,6 +939,7 @@
77 optionSetPanelFirstMenuInitiate (boost::bind (&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3));
78 optionSetPanelFirstMenuTerminate(boost::bind (&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3));
79 optionSetLauncherRevealEdgeInitiate (boost::bind (&UnityScreen::launcherRevealEdgeInitiate, this, _1, _2, _3));
80+ optionSetAutomaximizeValueNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
81
82 for (unsigned int i = 0; i < G_N_ELEMENTS (_ubus_handles); i++)
83 _ubus_handles[i] = 0;
84
85=== modified file 'unityshell.xml.in'
86--- unityshell.xml.in 2011-04-11 08:01:24 +0000
87+++ unityshell.xml.in 2011-05-25 14:27:06 +0000
88@@ -203,6 +203,13 @@
89 <_name>Static Blur</_name>
90 </desc>
91 </option>
92+ <option name="automaximize_value" type="int">
93+ <_short>Automaximize value</_short>
94+ <_long>The minimum value to trigger automaximize.</_long>
95+ <min>1</min>
96+ <max>100</max>
97+ <default>75</default>
98+ </option>
99 </group>
100 </options>
101 </plugin>