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.
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
=== modified file 'src/PluginAdapter.cpp'
--- src/PluginAdapter.cpp 2011-05-24 11:29:34 +0000
+++ src/PluginAdapter.cpp 2011-05-25 14:27:06 +0000
@@ -24,7 +24,6 @@
24PluginAdapter * PluginAdapter::_default = 0;24PluginAdapter * PluginAdapter::_default = 0;
2525
26#define MAXIMIZABLE (CompWindowActionMaximizeHorzMask & CompWindowActionMaximizeVertMask & CompWindowActionResizeMask)26#define MAXIMIZABLE (CompWindowActionMaximizeHorzMask & CompWindowActionMaximizeVertMask & CompWindowActionResizeMask)
27#define COVERAGE_AREA_BEFORE_AUTOMAXIMIZE 0.75
2827
29#define MWM_HINTS_FUNCTIONS (1L << 0)28#define MWM_HINTS_FUNCTIONS (1L << 0)
30#define MWM_HINTS_DECORATIONS (1L << 1)29#define MWM_HINTS_DECORATIONS (1L << 1)
@@ -57,6 +56,7 @@
57 _grab_show_action = 0;56 _grab_show_action = 0;
58 _grab_hide_action = 0;57 _grab_hide_action = 0;
59 _grab_toggle_action = 0;58 _grab_toggle_action = 0;
59 _coverage_area_before_automaximize = 0;
60}60}
6161
62PluginAdapter::~PluginAdapter()62PluginAdapter::~PluginAdapter()
@@ -617,7 +617,7 @@
617 // not mapped yet617 // not mapped yet
618 const XSizeHints& hints = window->sizeHints ();618 const XSizeHints& hints = window->sizeHints ();
619 covering_part = (float)(window->serverWidth () * window->serverHeight ()) / (float)(screen_width * screen_height);619 covering_part = (float)(window->serverWidth () * window->serverHeight ()) / (float)(screen_width * screen_height);
620 if ((covering_part < COVERAGE_AREA_BEFORE_AUTOMAXIMIZE) || (covering_part > 1.0) ||620 if ((covering_part < _coverage_area_before_automaximize) || (covering_part > 1.0) ||
621 (hints.flags & PMaxSize && (screen_width > hints.max_width || screen_height > hints.max_height)))621 (hints.flags & PMaxSize && (screen_width > hints.max_width || screen_height > hints.max_height)))
622 {622 {
623 g_debug ("MaximizeIfBigEnough: %s window size doesn't fit", win_wmclass.c_str());623 g_debug ("MaximizeIfBigEnough: %s window size doesn't fit", win_wmclass.c_str());
@@ -683,3 +683,8 @@
683 /* Initiate the first available action with the arguments */683 /* Initiate the first available action with the arguments */
684 _grab_toggle_action->initiate () (_grab_toggle_action, 0, argument);684 _grab_toggle_action->initiate () (_grab_toggle_action, 0, argument);
685}685}
686
687void
688PluginAdapter::SetCoverageAreaBeforeAutomaximize (float area) {
689 _coverage_area_before_automaximize = area;
690}
686691
=== modified file 'src/PluginAdapter.h'
--- src/PluginAdapter.h 2011-04-26 00:57:23 +0000
+++ src/PluginAdapter.h 2011-05-25 14:27:06 +0000
@@ -112,6 +112,8 @@
112 void MaximizeIfBigEnough (CompWindow *window);112 void MaximizeIfBigEnough (CompWindow *window);
113113
114 nux::Geometry GetWindowGeometry (guint32 xid);114 nux::Geometry GetWindowGeometry (guint32 xid);
115
116 void SetCoverageAreaBeforeAutomaximize (float area);
115 117
116protected:118protected:
117 PluginAdapter(CompScreen *screen);119 PluginAdapter(CompScreen *screen);
@@ -130,7 +132,9 @@
130 CompAction *_grab_show_action;132 CompAction *_grab_show_action;
131 CompAction *_grab_hide_action;133 CompAction *_grab_hide_action;
132 CompAction *_grab_toggle_action;134 CompAction *_grab_toggle_action;
133 135
136 float _coverage_area_before_automaximize;
137
134 static PluginAdapter *_default;138 static PluginAdapter *_default;
135};139};
136140
137141
=== modified file 'src/unityshell.cpp'
--- src/unityshell.cpp 2011-05-04 13:18:37 +0000
+++ src/unityshell.cpp 2011-05-25 14:27:06 +0000
@@ -763,6 +763,9 @@
763 case UnityshellOptions::DashBlurExperimental:763 case UnityshellOptions::DashBlurExperimental:
764 PlacesSettings::GetDefault ()->SetDashBlurType ((PlacesSettings::DashBlurType)optionGetDashBlurExperimental ());764 PlacesSettings::GetDefault ()->SetDashBlurType ((PlacesSettings::DashBlurType)optionGetDashBlurExperimental ());
765 break;765 break;
766 case UnityshellOptions::AutomaximizeValue:
767 PluginAdapter::Default ()->SetCoverageAreaBeforeAutomaximize (optionGetAutomaximizeValue () / 100.0f);
768 break;
766 default:769 default:
767 break;770 break;
768 }771 }
@@ -936,6 +939,7 @@
936 optionSetPanelFirstMenuInitiate (boost::bind (&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3));939 optionSetPanelFirstMenuInitiate (boost::bind (&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3));
937 optionSetPanelFirstMenuTerminate(boost::bind (&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3));940 optionSetPanelFirstMenuTerminate(boost::bind (&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3));
938 optionSetLauncherRevealEdgeInitiate (boost::bind (&UnityScreen::launcherRevealEdgeInitiate, this, _1, _2, _3));941 optionSetLauncherRevealEdgeInitiate (boost::bind (&UnityScreen::launcherRevealEdgeInitiate, this, _1, _2, _3));
942 optionSetAutomaximizeValueNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
939943
940 for (unsigned int i = 0; i < G_N_ELEMENTS (_ubus_handles); i++)944 for (unsigned int i = 0; i < G_N_ELEMENTS (_ubus_handles); i++)
941 _ubus_handles[i] = 0;945 _ubus_handles[i] = 0;
942946
=== modified file 'unityshell.xml.in'
--- unityshell.xml.in 2011-04-11 08:01:24 +0000
+++ unityshell.xml.in 2011-05-25 14:27:06 +0000
@@ -203,6 +203,13 @@
203 <_name>Static Blur</_name>203 <_name>Static Blur</_name>
204 </desc>204 </desc>
205 </option>205 </option>
206 <option name="automaximize_value" type="int">
207 <_short>Automaximize value</_short>
208 <_long>The minimum value to trigger automaximize.</_long>
209 <min>1</min>
210 <max>100</max>
211 <default>75</default>
212 </option>
206 </group>213 </group>
207 </options>214 </options>
208 </plugin>215 </plugin>