=== modified file 'lib/DockPreferences.vala' --- lib/DockPreferences.vala 2013-02-03 11:18:05 +0000 +++ lib/DockPreferences.vala 2013-03-19 10:05:46 +0000 @@ -52,7 +52,7 @@ [Description(nick = "position", blurb = "The position for the dock on the monitor.")] public PositionType Position { get; set; } - [Description(nick = "offset", blurb = "The dock's position offset from center (in percent).")] + [Description(nick = "offset", blurb = "The dock's position offset from left/center/right depending on its alignment (in pixel).")] public int Offset { get; set; } [Description(nick = "theme", blurb = "The name of the dock's theme to use.")] @@ -188,10 +188,6 @@ break; case "Offset": - if (Offset < -100) - Offset = -100; - else if (Offset > 100) - Offset = 100; break; case "Theme": === modified file 'lib/PositionManager.vala' --- lib/PositionManager.vala 2012-11-04 15:49:57 +0000 +++ lib/PositionManager.vala 2013-03-19 12:50:34 +0000 @@ -346,21 +346,27 @@ var yoffset = (DockHeight - static_dock_region.height) / 2; if (screen_is_composited) { - xoffset = (int) ((1 + controller.prefs.Offset / 100.0) * xoffset); - yoffset = (int) ((1 + controller.prefs.Offset / 100.0) * yoffset); + var offset = controller.prefs.Offset; switch (controller.prefs.Alignment) { default: case Align.CENTER: + var max_xoffset = (monitor_geo.width - static_dock_region.width) / 2; + var max_yoffset = (monitor_geo.height - static_dock_region.height) / 2; + xoffset += (offset > max_xoffset ? max_xoffset : (offset < -max_xoffset ? -max_xoffset : offset)); + yoffset += (offset > max_yoffset ? max_yoffset : (offset < -max_yoffset ? -max_yoffset : offset)); + break; case Align.FILL: break; case Align.START: - xoffset = 0; - yoffset = (monitor_geo.height - static_dock_region.height); + offset = (offset > 0 ? offset : 0); + xoffset = offset; + yoffset = offset + (monitor_geo.height - static_dock_region.height); break; case Align.END: - xoffset = (monitor_geo.width - static_dock_region.width); - yoffset = 0; + offset = (offset > 0 ? offset : 0); + xoffset = -offset + (monitor_geo.width - static_dock_region.width); + yoffset = -offset; break; } } @@ -661,21 +667,27 @@ var yoffset = 0; if (!screen_is_composited) { - xoffset = (int) ((1 + controller.prefs.Offset / 100.0) * (monitor_geo.width - DockWidth) / 2); - yoffset = (int) ((1 + controller.prefs.Offset / 100.0) * (monitor_geo.height - DockHeight) / 2); + var offset = controller.prefs.Offset; switch (controller.prefs.Alignment) { default: case Align.CENTER: + var max_xoffset = (monitor_geo.width - static_dock_region.width) / 2; + var max_yoffset = (monitor_geo.height - static_dock_region.height) / 2; + xoffset += (offset > max_xoffset ? max_xoffset : (offset < -max_xoffset ? -max_xoffset : offset)); + yoffset += (offset > max_yoffset ? max_yoffset : (offset < -max_yoffset ? -max_yoffset : offset)); + break; case Align.FILL: break; case Align.START: - xoffset = 0; - yoffset = (monitor_geo.height - static_dock_region.height); + offset = (offset > 0 ? offset : 0); + xoffset = offset; + yoffset = offset + (monitor_geo.height - static_dock_region.height); break; case Align.END: - xoffset = (monitor_geo.width - static_dock_region.width); - yoffset = 0; + offset = (offset > 0 ? offset : 0); + xoffset = -offset + (monitor_geo.width - static_dock_region.width); + yoffset = -offset; break; } }