Merge lp:~damiannohales/plank/window-border-margin into lp:plank

Proposed by Damián Nohales
Status: Needs review
Proposed branch: lp:~damiannohales/plank/window-border-margin
Merge into: lp:plank
Diff against target: 112 lines (+25/-4)
4 files modified
lib/DockRenderer.vala (+1/-0)
lib/Drawing/DockTheme.vala (+9/-0)
lib/PositionManager.vala (+9/-4)
lib/Widgets/DockWindow.vala (+6/-0)
To merge this branch: bzr merge lp:~damiannohales/plank/window-border-margin
Reviewer Review Type Date Requested Status
Rico Tzschichholz Needs Fixing
Review via email: mp+223290@code.launchpad.net

Description of the change

This adds the WindowBorderMargin setting to the dock, that allows to the user to add an extra spacing between the window border and the dock.

To post a comment you must log in.
Revision history for this message
Rico Tzschichholz (ricotz) wrote :

This sounds reasonable if a theme defines a negative TopPadding. Considering that this should be a parameter in *dock.theme* not in settings. ;-)

So please move it to DockTheme as TopMargin. You should be able to contain the needed changes to DockTheme.vala, DockPreferences.vala and PositionManager.vala.

review: Needs Fixing
Revision history for this message
Damián Nohales (damiannohales) wrote :

> This sounds reasonable if a theme defines a negative TopPadding. Considering
> that this should be a parameter in *dock.theme* not in settings. ;-)
>
> So please move it to DockTheme as TopMargin. You should be able to contain the
> needed changes to DockTheme.vala, DockPreferences.vala and
> PositionManager.vala.

You are describing my first try when implementing this :P

I changed it to a setting because the plank settings also defines "outside" alignment stuff, but is ok, let's move it to the theme.

Revision history for this message
Damián Nohales (damiannohales) wrote :

I've overwritten the branch with the fixed commit.

1034. By Rico Tzschichholz

positionmanager: Precalculate top_offset to have it include TopPadding

This avoids doing this over and over again in several places.

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

Do not trigger setting the struts unconditionally.

TopMargin should taken into account as follow:
* only in case of HideMode==HideType.NONE
* ignore it for non-compositing, so there is no "spacing"
  if the (solid) background covers the item-regions
* don't have it influence the cursor-region or item-regions

Please rebase it on the current trunk.

review: Needs Fixing
1035. By Rico Tzschichholz

Make sure to update visibile-items in prepare

Not pinned items doesnt show up initially.

Regression caused by r1029

Revision history for this message
Damián Nohales (damiannohales) wrote :

> Do not trigger setting the struts unconditionally.
>
> TopMargin should taken into account as follow:
> * only in case of HideMode==HideType.NONE
> * ignore it for non-compositing, so there is no "spacing"
> if the (solid) background covers the item-regions
> * don't have it influence the cursor-region or item-regions
>
> Please rebase it on the current trunk.

I think a don't understand the 3rd point, could you explain?

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

I mean this margin should not change the size of areas which are used to determine whether the mouse cursor interacts with the dock or not. This doesn't mean it isn't needed to calculate them.

1036. By Damián Nohales

Add TopMargin theme option

This option allows to add an extra margin between
the window border and the top of the dock.

Revision history for this message
Damián Nohales (damiannohales) wrote :

Updated, but I still don't understand how this can affect the calculation of the cursor/items region, because the TopMargin parameter is only used in PositionManager::get_struts method.

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

I am not speaking about your current implementation in specific. Putting things directly in the struts-calcution is elegant, but this might change if you follow the other requirements.

Unmerged revisions

1036. By Damián Nohales

Add TopMargin theme option

This option allows to add an extra margin between
the window border and the top of the dock.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/DockRenderer.vala'
--- lib/DockRenderer.vala 2014-05-20 15:36:44 +0000
+++ lib/DockRenderer.vala 2014-06-26 15:05:18 +0000
@@ -161,6 +161,7 @@
161 reset_position_manager_timer = 0;161 reset_position_manager_timer = 0;
162 controller.position_manager.reset_caches (theme);162 controller.position_manager.reset_caches (theme);
163 controller.position_manager.update_regions ();163 controller.position_manager.update_regions ();
164 controller.window.update_struts ();
164 165
165 return false;166 return false;
166 });167 });
167168
=== modified file 'lib/Drawing/DockTheme.vala'
--- lib/Drawing/DockTheme.vala 2013-10-07 10:25:43 +0000
+++ lib/Drawing/DockTheme.vala 2014-06-26 15:05:18 +0000
@@ -40,6 +40,9 @@
40 40
41 [Description(nick = "bottom-padding", blurb = "The padding on the bottom dock edge, in tenths of a percent of IconSize.")]41 [Description(nick = "bottom-padding", blurb = "The padding on the bottom dock edge, in tenths of a percent of IconSize.")]
42 public double BottomPadding { get; set; }42 public double BottomPadding { get; set; }
43
44 [Description(nick = "top-margin", blurb = "The distance between the window border and the dock, in tenths of a percent of IconSize.")]
45 public double TopMargin { get; set; }
43 46
44 [Description(nick = "item-padding", blurb = "The padding between items on the dock, in tenths of a percent of IconSize.")]47 [Description(nick = "item-padding", blurb = "The padding between items on the dock, in tenths of a percent of IconSize.")]
45 public double ItemPadding { get; set; }48 public double ItemPadding { get; set; }
@@ -120,6 +123,7 @@
120 HorizPadding = 0.0;123 HorizPadding = 0.0;
121 TopPadding = -11.0;124 TopPadding = -11.0;
122 BottomPadding = 2.5;125 BottomPadding = 2.5;
126 TopMargin = 0.0;
123 ItemPadding = 2.0;127 ItemPadding = 2.0;
124 IndicatorSize = 5.0;128 IndicatorSize = 5.0;
125 IconShadowSize = 1.0;129 IconShadowSize = 1.0;
@@ -542,6 +546,11 @@
542 if (BottomPadding < 0)546 if (BottomPadding < 0)
543 BottomPadding = 0;547 BottomPadding = 0;
544 break;548 break;
549
550 case "TopMargin":
551 if (TopMargin < 0.0)
552 TopMargin = 0.0;
553 break;
545 554
546 case "ItemPadding":555 case "ItemPadding":
547 if (ItemPadding < 0)556 if (ItemPadding < 0)
548557
=== modified file 'lib/PositionManager.vala'
--- lib/PositionManager.vala 2014-06-17 07:25:12 +0000
+++ lib/PositionManager.vala 2014-06-26 15:05:18 +0000
@@ -213,6 +213,10 @@
213 */213 */
214 public int BottomPadding { get; private set; }214 public int BottomPadding { get; private set; }
215 /**215 /**
216 * Theme-based top margin, scaled by icon size.
217 */
218 public int TopMargin { get; private set; }
219 /**
216 * Theme-based item padding, scaled by icon size.220 * Theme-based item padding, scaled by icon size.
217 */221 */
218 public int ItemPadding { get; private set; }222 public int ItemPadding { get; private set; }
@@ -308,6 +312,7 @@
308 HorizPadding = (int) (theme.HorizPadding * scaled_icon_size);312 HorizPadding = (int) (theme.HorizPadding * scaled_icon_size);
309 TopPadding = (int) (theme.TopPadding * scaled_icon_size);313 TopPadding = (int) (theme.TopPadding * scaled_icon_size);
310 BottomPadding = (int) (theme.BottomPadding * scaled_icon_size);314 BottomPadding = (int) (theme.BottomPadding * scaled_icon_size);
315 TopMargin = (int) (theme.TopMargin * scaled_icon_size);
311 ItemPadding = (int) (theme.ItemPadding * scaled_icon_size);316 ItemPadding = (int) (theme.ItemPadding * scaled_icon_size);
312 UrgentBounceHeight = (int) (theme.UrgentBounceHeight * IconSize);317 UrgentBounceHeight = (int) (theme.UrgentBounceHeight * IconSize);
313 LineWidth = theme.LineWidth;318 LineWidth = theme.LineWidth;
@@ -1070,22 +1075,22 @@
1070 switch (controller.prefs.Position) {1075 switch (controller.prefs.Position) {
1071 default:1076 default:
1072 case PositionType.BOTTOM:1077 case PositionType.BOTTOM:
1073 struts [Struts.BOTTOM] = (VisibleDockHeight + controller.window.get_screen ().get_height () - monitor_geo.y - monitor_geo.height) * window_scale_factor;1078 struts [Struts.BOTTOM] = (VisibleDockHeight + TopMargin + controller.window.get_screen ().get_height () - monitor_geo.y - monitor_geo.height) * window_scale_factor;
1074 struts [Struts.BOTTOM_START] = monitor_geo.x * window_scale_factor;1079 struts [Struts.BOTTOM_START] = monitor_geo.x * window_scale_factor;
1075 struts [Struts.BOTTOM_END] = (monitor_geo.x + monitor_geo.width) * window_scale_factor - 1;1080 struts [Struts.BOTTOM_END] = (monitor_geo.x + monitor_geo.width) * window_scale_factor - 1;
1076 break;1081 break;
1077 case PositionType.TOP:1082 case PositionType.TOP:
1078 struts [Struts.TOP] = (monitor_geo.y + VisibleDockHeight) * window_scale_factor;1083 struts [Struts.TOP] = (monitor_geo.y + VisibleDockHeight + TopMargin) * window_scale_factor;
1079 struts [Struts.TOP_START] = monitor_geo.x * window_scale_factor;1084 struts [Struts.TOP_START] = monitor_geo.x * window_scale_factor;
1080 struts [Struts.TOP_END] = (monitor_geo.x + monitor_geo.width) * window_scale_factor - 1;1085 struts [Struts.TOP_END] = (monitor_geo.x + monitor_geo.width) * window_scale_factor - 1;
1081 break;1086 break;
1082 case PositionType.LEFT:1087 case PositionType.LEFT:
1083 struts [Struts.LEFT] = (monitor_geo.x + VisibleDockWidth) * window_scale_factor;1088 struts [Struts.LEFT] = (monitor_geo.x + VisibleDockWidth + TopMargin) * window_scale_factor;
1084 struts [Struts.LEFT_START] = monitor_geo.y * window_scale_factor;1089 struts [Struts.LEFT_START] = monitor_geo.y * window_scale_factor;
1085 struts [Struts.LEFT_END] = (monitor_geo.y + monitor_geo.height) * window_scale_factor - 1;1090 struts [Struts.LEFT_END] = (monitor_geo.y + monitor_geo.height) * window_scale_factor - 1;
1086 break;1091 break;
1087 case PositionType.RIGHT:1092 case PositionType.RIGHT:
1088 struts [Struts.RIGHT] = (VisibleDockWidth + controller.window.get_screen ().get_width () - monitor_geo.x - monitor_geo.width) * window_scale_factor;1093 struts [Struts.RIGHT] = (VisibleDockWidth + TopMargin + controller.window.get_screen ().get_width () - monitor_geo.x - monitor_geo.width) * window_scale_factor;
1089 struts [Struts.RIGHT_START] = monitor_geo.y * window_scale_factor;1094 struts [Struts.RIGHT_START] = monitor_geo.y * window_scale_factor;
1090 struts [Struts.RIGHT_END] = (monitor_geo.y + monitor_geo.height) * window_scale_factor - 1;1095 struts [Struts.RIGHT_END] = (monitor_geo.y + monitor_geo.height) * window_scale_factor - 1;
1091 break;1096 break;
10921097
=== modified file 'lib/Widgets/DockWindow.vala'
--- lib/Widgets/DockWindow.vala 2014-04-12 14:58:48 +0000
+++ lib/Widgets/DockWindow.vala 2014-06-26 15:05:18 +0000
@@ -684,6 +684,12 @@
684 get_window ().input_shape_combine_region (new Region.rectangle (rect), 0, 0);684 get_window ().input_shape_combine_region (new Region.rectangle (rect), 0, 0);
685 }685 }
686 }686 }
687
688 public void update_struts ()
689 {
690 if (screen.is_composited() && controller.prefs.HideMode == HideType.NONE)
691 set_struts();
692 }
687 693
688 void set_struts ()694 void set_struts ()
689 {695 {

Subscribers

People subscribed via source and target branches

to status/vote changes: