summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-08 12:05:36 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-08 21:38:12 +0300
commit700e87eab8ab1bcd0c9e2c063c9b83c2345d0788 (patch)
tree78a2cdc5d35634b490c240f8e71cfa6ad6557252
parent3b5562274cb6584d251652e796ef3e9c1ebb9bcd (diff)
downloadmetacity-700e87eab8ab1bcd0c9e2c063c9b83c2345d0788.tar.gz
libmetacity: add `shadow` and `resize` borders
-rw-r--r--libmetacity/meta-frame-borders.c21
-rw-r--r--libmetacity/meta-frame-borders.h11
-rw-r--r--libmetacity/meta-theme-gtk.c22
-rw-r--r--libmetacity/meta-theme-metacity.c20
4 files changed, 48 insertions, 26 deletions
diff --git a/libmetacity/meta-frame-borders.c b/libmetacity/meta-frame-borders.c
index 603ae858..24ac70cc 100644
--- a/libmetacity/meta-frame-borders.c
+++ b/libmetacity/meta-frame-borders.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2016 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,11 +20,21 @@
#include "meta-frame-borders.h"
+static void
+clear_border (GtkBorder *border)
+{
+ border->left = 0;
+ border->right = 0;
+ border->top = 0;
+ border->bottom = 0;
+}
+
void
-meta_frame_borders_clear (MetaFrameBorders *self)
+meta_frame_borders_clear (MetaFrameBorders *borders)
{
- self->visible.top = self->invisible.top = self->total.top = 0;
- self->visible.bottom = self->invisible.bottom = self->total.bottom = 0;
- self->visible.left = self->invisible.left = self->total.left = 0;
- self->visible.right = self->invisible.right = self->total.right = 0;
+ clear_border (&borders->visible);
+ clear_border (&borders->shadow);
+ clear_border (&borders->resize);
+ clear_border (&borders->invisible);
+ clear_border (&borders->total);
}
diff --git a/libmetacity/meta-frame-borders.h b/libmetacity/meta-frame-borders.h
index 71df5e8c..599ceb76 100644
--- a/libmetacity/meta-frame-borders.h
+++ b/libmetacity/meta-frame-borders.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2016 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,18 +25,14 @@ G_BEGIN_DECLS
typedef struct
{
- /* The frame border is made up of two pieces - an inner visible portion
- * and an outer portion that is invisible but responds to events.
- */
GtkBorder visible;
+ GtkBorder shadow;
+ GtkBorder resize;
GtkBorder invisible;
-
- /* For convenience, we have a "total" border which is equal to the sum
- * of the two borders above. */
GtkBorder total;
} MetaFrameBorders;
-void meta_frame_borders_clear (MetaFrameBorders *self);
+void meta_frame_borders_clear (MetaFrameBorders *borders);
G_END_DECLS
diff --git a/libmetacity/meta-theme-gtk.c b/libmetacity/meta-theme-gtk.c
index 6081affc..bd3e3431 100644
--- a/libmetacity/meta-theme-gtk.c
+++ b/libmetacity/meta-theme-gtk.c
@@ -254,33 +254,35 @@ meta_theme_gtk_get_frame_borders (MetaThemeImpl *impl,
borders->visible.right = layout->gtk.frame_border.right;
borders->visible.bottom = layout->gtk.frame_border.bottom;
- borders->invisible = layout->gtk.shadow_border;
+ borders->shadow = layout->gtk.shadow_border;
if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
{
- borders->invisible.left = MAX (borders->invisible.left,
- layout->invisible_resize_border.left);
-
- borders->invisible.right = MAX (borders->invisible.right,
- layout->invisible_resize_border.right);
+ borders->resize.left = layout->invisible_resize_border.left;
+ borders->resize.right = layout->invisible_resize_border.right;
}
if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
{
- borders->invisible.bottom = MAX (borders->invisible.bottom,
- layout->invisible_resize_border.bottom);
+ borders->resize.bottom = layout->invisible_resize_border.bottom;
if (type != META_FRAME_TYPE_ATTACHED)
- borders->invisible.top = MAX (borders->invisible.top,
- layout->invisible_resize_border.top);
+ borders->resize.top = layout->invisible_resize_border.top;
}
+ borders->invisible.left = MAX (borders->shadow.left, borders->resize.left);
+ borders->invisible.right = MAX (borders->shadow.right, borders->resize.right);
+ borders->invisible.bottom = MAX (borders->shadow.bottom, borders->resize.bottom);
+ borders->invisible.top = MAX (borders->shadow.top, borders->resize.top);
+
borders->total.left = borders->invisible.left + borders->visible.left;
borders->total.right = borders->invisible.right + borders->visible.right;
borders->total.bottom = borders->invisible.bottom + borders->visible.bottom;
borders->total.top = borders->invisible.top + borders->visible.top;
scale_border (&borders->visible, scale);
+ scale_border (&borders->shadow, scale);
+ scale_border (&borders->resize, scale);
scale_border (&borders->invisible, scale);
scale_border (&borders->total, scale);
}
diff --git a/libmetacity/meta-theme-metacity.c b/libmetacity/meta-theme-metacity.c
index 06aadc0f..8235a920 100644
--- a/libmetacity/meta-theme-metacity.c
+++ b/libmetacity/meta-theme-metacity.c
@@ -4661,26 +4661,38 @@ meta_theme_metacity_get_frame_borders (MetaThemeImpl *impl,
borders->visible.right = layout->metacity.right_width;
borders->visible.bottom = layout->metacity.bottom_height;
+ borders->shadow.top = 0;
+ borders->shadow.left = 0;
+ borders->shadow.right = 0;
+ borders->shadow.bottom = 0;
+
if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
{
- borders->invisible.left = layout->invisible_resize_border.left;
- borders->invisible.right = layout->invisible_resize_border.right;
+ borders->resize.left = layout->invisible_resize_border.left;
+ borders->resize.right = layout->invisible_resize_border.right;
}
if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
{
- borders->invisible.bottom = layout->invisible_resize_border.bottom;
+ borders->resize.bottom = layout->invisible_resize_border.bottom;
if (type != META_FRAME_TYPE_ATTACHED)
- borders->invisible.top = layout->invisible_resize_border.top;
+ borders->resize.top = layout->invisible_resize_border.top;
}
+ borders->invisible.left = MAX (borders->shadow.left, borders->resize.left);
+ borders->invisible.right = MAX (borders->shadow.right, borders->resize.right);
+ borders->invisible.bottom = MAX (borders->shadow.bottom, borders->resize.bottom);
+ borders->invisible.top = MAX (borders->shadow.top, borders->resize.top);
+
borders->total.left = borders->invisible.left + borders->visible.left;
borders->total.right = borders->invisible.right + borders->visible.right;
borders->total.bottom = borders->invisible.bottom + borders->visible.bottom;
borders->total.top = borders->invisible.top + borders->visible.top;
scale_border (&borders->visible, scale);
+ scale_border (&borders->shadow, scale);
+ scale_border (&borders->resize, scale);
scale_border (&borders->invisible, scale);
scale_border (&borders->total, scale);
}