[Xfce4-commits] [xfce/xfwm4] 02/03: frame: Allow the top of the frame to be cropped when maximised

noreply at xfce.org noreply at xfce.org
Tue May 21 22:01:27 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit bf41e461abe520d20cf2022e697cd38bc28867e8
Author: Adam K <chkboom at safe-mail.net>
Date:   Tue May 21 12:17:21 2019 +0000

    frame: Allow the top of the frame to be cropped when maximised
    
    Bug: 14470
    
    Themes can take advantage of this with the frame_border_top property.
    Existing themes without that property will not be affected or broken.
    
    Signed-off-by: Adam K <chkboom at safe-mail.net>
---
 src/frame.c    | 38 +++++++++++++++++++++++++++-----------
 src/frame.h    |  1 +
 src/settings.c |  3 +++
 src/settings.h |  1 +
 4 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/src/frame.c b/src/frame.c
index d3ddfec..8bac82f 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -82,6 +82,22 @@ frameDecorationBottom (ScreenInfo *screen_info)
 }
 
 int
+frameBorderTop (Client * c)
+{
+    g_return_val_if_fail (c != NULL, 0);
+    TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+    if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+        && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+        && FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+        && (c->screen_info->params->borderless_maximize))
+    {
+        return c->screen_info->params->frame_border_top;
+    }
+    return 0;
+}
+
+int
 frameLeft (Client * c)
 {
     g_return_val_if_fail (c != NULL, 0);
@@ -121,7 +137,7 @@ frameTop (Client * c)
 
     if (CLIENT_HAS_FRAME (c))
     {
-        return c->screen_info->title[TITLE_3][ACTIVE].height;
+        return frameDecorationTop(c->screen_info) - frameBorderTop (c);
     }
     return 0;
 }
@@ -377,7 +393,7 @@ frameFillTitlePixmap (Client * c, int state, int part, int x, int w, int h, xfwm
     {
         xfwmPixmapFill (&screen_info->title[part][state], top_pm, x, 0, w, h);
     }
-    xfwmPixmapFill (&screen_info->title[part][state], title_pm, x, 0, w, frameTop (c));
+    xfwmPixmapFill (&screen_info->title[part][state], title_pm, x, 0, w, frameDecorationTop(screen_info));
 }
 
 static void
@@ -453,10 +469,10 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap *
          */
         title_height = logical_rect.height;
     }
-    title_y = voffset + (frameTop (c) - title_height) / 2;
-    if (title_y + title_height > frameTop (c))
+    title_y = voffset + (frameDecorationTop(screen_info) - title_height) / 2;
+    if (title_y + title_height > frameDecorationTop(screen_info))
     {
-        title_y = MAX (0, frameTop (c) - title_height);
+        title_y = MAX (0, frameDecorationTop(screen_info) - title_height);
     }
 
     if (!xfwmPixmapNone(&screen_info->top[3][ACTIVE]))
@@ -465,7 +481,7 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap *
     }
     else
     {
-        top_height = frameTop (c) / 10 + 1;
+        top_height = frameDecorationTop(screen_info) / 10 + 1;
         if (top_height > title_y - 1)
         {
              top_height = MAX (title_y - 1, 0);
@@ -533,7 +549,7 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap *
     }
 
     xfwmPixmapCreate (screen_info, top_pm, width, top_height);
-    xfwmPixmapCreate (screen_info, title_pm, width, frameTop (c));
+    xfwmPixmapCreate (screen_info, title_pm, width, frameDecorationTop(screen_info));
 
     surface = xfwmPixmapCreateSurface (title_pm, FALSE);
     cr = cairo_create (surface);
@@ -1098,7 +1114,7 @@ frameDrawWin (Client * c)
                         xfwmWindowSetBG (&c->buttons[button], my_pixmap);
                     }
                     xfwmWindowShow (&c->buttons[button], x,
-                        (frameTop (c) - screen_info->buttons[button][state].height + 1) / 2,
+                        ((frameDecorationTop(screen_info) - screen_info->buttons[button][state].height + 1) / 2) - frameBorderTop (c),
                         screen_info->buttons[button][state].width,
                         screen_info->buttons[button][state].height, TRUE);
                     button_x[button] = x;
@@ -1135,7 +1151,7 @@ frameDrawWin (Client * c)
                     x = x - screen_info->buttons[button][state].width -
                         screen_info->params->button_spacing;
                     xfwmWindowShow (&c->buttons[button], x,
-                        (frameTop (c) - screen_info->buttons[button][state].height + 1) / 2,
+                        ((frameDecorationTop(screen_info) - screen_info->buttons[button][state].height + 1) / 2) - frameBorderTop (c),
                         screen_info->buttons[button][state].width,
                         screen_info->buttons[button][state].height, TRUE);
                     button_x[button] = x;
@@ -1168,8 +1184,8 @@ frameDrawWin (Client * c)
         frameCreateTitlePixmap (c, state, left, right, &frame_pix.pm_title, &frame_pix.pm_sides[SIDE_TOP]);
         xfwmWindowSetBG (&c->title, &frame_pix.pm_title);
         xfwmWindowShow (&c->title,
-            frameTopLeftWidth (c, state), 0, top_width,
-            frameTop (c), (requires_clearing | width_changed));
+            frameTopLeftWidth (c, state), 0 - frameBorderTop (c), top_width,
+            frameDecorationTop(screen_info), (requires_clearing | width_changed));
 
         /* Corners are never resized, we need to update them separately */
         if (requires_clearing)
diff --git a/src/frame.h b/src/frame.h
index 6f34304..9e2fd1e 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -36,6 +36,7 @@ int                      frameDecorationLeft                    (ScreenInfo *);
 int                      frameDecorationRight                   (ScreenInfo *);
 int                      frameDecorationTop                     (ScreenInfo *);
 int                      frameDecorationBottom                  (ScreenInfo *);
+int                      frameCropTop                           (Client *);
 int                      frameLeft                              (Client *);
 int                      frameRight                             (Client *);
 int                      frameTop                               (Client *);
diff --git a/src/settings.c b/src/settings.c
index b223735..7d3db10 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -523,6 +523,7 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
     strncpy (screen_info->params->button_layout, getStringValue ("button_layout", rc), BUTTON_STRING_COUNT);
     screen_info->params->button_spacing = getIntValue ("button_spacing", rc);
     screen_info->params->button_offset = getIntValue ("button_offset", rc);
+    screen_info->params->frame_border_top = getIntValue ("frame_border_top", rc);
     screen_info->params->maximized_offset = getIntValue ("maximized_offset", rc);
     screen_info->params->title_vertical_offset_active =
         getIntValue ("title_vertical_offset_active", rc);
@@ -668,6 +669,7 @@ loadSettings (ScreenInfo *screen_info)
         {"focus_hint", NULL, G_TYPE_BOOLEAN, TRUE},
         {"focus_new", NULL, G_TYPE_BOOLEAN,TRUE},
         {"frame_opacity", NULL, G_TYPE_INT, TRUE},
+        {"frame_border_top", NULL, G_TYPE_INT, TRUE},
         {"full_width_title", NULL, G_TYPE_BOOLEAN, TRUE},
         {"horiz_scroll_opacity", NULL, G_TYPE_BOOLEAN, FALSE},
         {"inactive_opacity", NULL, G_TYPE_INT, TRUE},
@@ -1202,6 +1204,7 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_
                       || (!strcmp (name, "button_spacing"))
                       || (!strcmp (name, "double_click_time"))
                       || (!strcmp (name, "double_click_distance"))
+                      || (!strcmp (name, "frame_border_top"))
                       || (!strcmp (name, "maximized_offset"))
                       || (!strcmp (name, "shadow_delta_height"))
                       || (!strcmp (name, "shadow_delta_width"))
diff --git a/src/settings.h b/src/settings.h
index 334acdd..ad00636 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -176,6 +176,7 @@ struct _XfwmParams
     guint easy_click;
     int focus_delay;
     int frame_opacity;
+    int frame_border_top;
     int inactive_opacity;
     int maximized_offset;
     int move_opacity;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list