+ {
+ CGFloat frameRight = screenFrame.origin.x + screenFrame.size.width;
+ CGFloat visibleFrameRight = (screenVisibleFrame.origin.x
+ + screenVisibleFrame.size.width);
+ margins.right = frameRight - visibleFrameRight;
+ }
+
+ margins.bottom = screenVisibleFrame.origin.y - screenFrame.origin.y;
+ margins.left = screenVisibleFrame.origin.x - screenFrame.origin.x;
+
+ NSTRACE_MSG ("left:%g right:%g top:%g bottom:%g",
+ margins.left,
+ margins.right,
+ margins.top,
+ margins.bottom);
+
+ return margins;
+}
+
+
+/* A screen margin between 1 and DOCK_IGNORE_LIMIT (inclusive) is
+ assumed to contain a hidden dock. OS X currently use 4 pixels for
+ this, however, to be future compatible, a larger value is used. */
+#define DOCK_IGNORE_LIMIT 6
+
+static struct EmacsMargins
+ns_screen_margins_ignoring_hidden_dock (NSScreen *screen)
+/* The parts of SCREEN used by the operating system, excluding the parts
+reserved for an hidden dock. */
+{
+ NSTRACE ("ns_screen_margins_ignoring_hidden_dock");
+
+ struct EmacsMargins margins = ns_screen_margins(screen);
+
+ /* OS X (currently) reserved 4 pixels along the edge where a hidden
+ dock is located. Unfortunately, it's not possible to find the
+ location and information about if the dock is hidden. Instead,
+ it is assumed that if the margin of an edge is less than
+ DOCK_IGNORE_LIMIT, it contains a hidden dock. */
+ if (margins.left <= DOCK_IGNORE_LIMIT)
+ {
+ margins.left = 0;