]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: add <core><gap>
authorJohan Malm <jgm323@gmail.com>
Sun, 22 Aug 2021 13:32:19 +0000 (14:32 +0100)
committerJohan Malm <jgm323@gmail.com>
Sun, 22 Aug 2021 13:32:19 +0000 (14:32 +0100)
Specify the distance in pixels between views and output edges when using
movement actions such as MoveToEdge

docs/labwc-config.5.scd
docs/rc.xml
include/config/rcxml.h
src/config/rcxml.c
src/view.c

index 7e7934d81d078db542138a36ff53855a8d9a3de5..494c58e073f1e2d15f8ac93e92142f00f4626447 100644 (file)
@@ -24,6 +24,10 @@ Configuration must be wrapped in a <labwc_config> root-node.
        that it is not always possible to turn off client side decorations.
        Default is server.
 
+*<core><gap>*
+       The gap in pixels between views and output edges when using movement
+       actions, for example MoveToEdge. Default is 0.
+
 # FOCUS
 
 *<focus><followMouse>* [yes|no]
index 0d61c7f48eab7cc88617fa90d03b907c83e55354..7ec6c6d7555aa8aa3a9562bba6be6e90a478ee06 100644 (file)
@@ -2,7 +2,7 @@
 <labwc_config>
 
   <core>
-    <decoration>server</decoration>
+    <gap>10</gap>
   </core>
 
   <theme>
index 0743330145fcac346ca9cbd55eca22c065e4fba6..958aedfea908941090167492282df7720ecd5044 100644 (file)
@@ -9,6 +9,7 @@
 
 struct rcxml {
        bool xdg_shell_server_side_deco;
+       int gap;
        bool focus_follow_mouse;
        bool raise_on_focus;
        char *theme_name;
index fefd9baabd40edc6d5e15c9683e6a0325f8f3a95..f21122efa7ed59f2f0cee8185cfc7e9d2b9eedbc 100644 (file)
@@ -167,6 +167,8 @@ entry(xmlNode *node, char *nodename, char *content)
                } else {
                        rc.xdg_shell_server_side_deco = true;
                }
+       } else if (!strcmp(nodename, "gap.core")) {
+               rc.gap = atoi(content);
        } else if (!strcmp(nodename, "name.theme")) {
                rc.theme_name = strdup(content);
        } else if (!strcmp(nodename, "cornerradius.theme")) {
index 14e53d074c2f83a58ae8bb91cbbd3a285c2b1bb1..6cd8e691df38e312ae11331eb7ef9e8a2f548a46 100644 (file)
@@ -135,7 +135,6 @@ view_border(struct view *view)
        return border;
 }
 
-#define GAP (3)
 void
 view_move_to_edge(struct view *view, const char *direction)
 {
@@ -149,17 +148,17 @@ view_move_to_edge(struct view *view, const char *direction)
 
        int x = 0, y = 0;
        if (!strcasecmp(direction, "left")) {
-               x = usable.x + border.left + GAP;
+               x = usable.x + border.left + rc.gap;
                y = view->y;
        } else if (!strcasecmp(direction, "up")) {
                x = view->x;
-               y = usable.y + border.top + GAP;
+               y = usable.y + border.top + rc.gap;
        } else if (!strcasecmp(direction, "right")) {
-               x = usable.x + usable.width - view->w - border.right - GAP;
+               x = usable.x + usable.width - view->w - border.right - rc.gap;
                y = view->y;
        } else if (!strcasecmp(direction, "down")) {
                x = view->x;
-               y = usable.y + usable.height - view->h - border.bottom - GAP;
+               y = usable.y + usable.height - view->h - border.bottom - rc.gap;
        }
        view_move(view, x, y);
 }