summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-21 13:15:48 -0400
committerraveit65 <[email protected]>2019-06-16 18:12:44 +0200
commit860f7a6dbc81272c561a1b8d045e5ff61ea0e66a (patch)
treeb81ee0c5ff3402451009294690e204d0d242e794
parentcfd49bdf68ef48fcd53a084c74626372fc169688 (diff)
downloadmarco-860f7a6dbc81272c561a1b8d045e5ff61ea0e66a.tar.bz2
marco-860f7a6dbc81272c561a1b8d045e5ff61ea0e66a.tar.xz
MetaFrameBorders: Add meta_frame_borders_clear
Just a quick little commit to help clean things up for when we add invisible borders. Additionally, do a little housekeeping in preview-widget as well. https://bugzilla.gnome.org/show_bug.cgi?id=644930 NOTE: Patch copied from metacity and adapted for marco. upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/7d519b3f
-rw-r--r--src/Makefile.am2
-rw-r--r--src/core/common.c34
-rw-r--r--src/include/common.h3
-rw-r--r--src/ui/preview-widget.c22
-rw-r--r--src/ui/preview-widget.h1
-rw-r--r--src/ui/theme.c16
-rw-r--r--src/ui/ui.c5
7 files changed, 49 insertions, 34 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6a5f8ed3..508f6e00 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,6 +83,7 @@ marco_SOURCES = \
core/workspace.h \
core/xprops.c \
include/xprops.h \
+ core/common.c \
include/common.h \
include/core.h \
include/ui.h \
@@ -117,6 +118,7 @@ libmarco_private_la_SOURCES = \
ui/gradient.h \
core/util.c \
include/util.h \
+ core/common.c \
include/common.h \
ui/preview-widget.c \
ui/preview-widget.h \
diff --git a/src/core/common.c b/src/core/common.c
new file mode 100644
index 00000000..c7fe1012
--- /dev/null
+++ b/src/core/common.c
@@ -0,0 +1,34 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity X window decorations */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2003, 2004 Red Hat, Inc.
+ * Copyright (C) 2005 Elijah Newren
+ *
+ * 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 the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include "common.h"
+
+void
+meta_frame_borders_clear (MetaFrameBorders *self)
+{
+ self->visible.top = 0;
+ self->visible.bottom = 0;
+ self->visible.left = 0;
+ self->visible.right = 0;
+}
diff --git a/src/include/common.h b/src/include/common.h
index fce641c1..03b6ca29 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -310,6 +310,9 @@ struct _MetaFrameBorders
GtkBorder visible;
};
+/* sets all dimensions to zero */
+void meta_frame_borders_clear (MetaFrameBorders *self);
+
/* should investigate changing these to whatever most apps use */
#define META_ICON_WIDTH 48
#define META_ICON_HEIGHT 48
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index 1db34950..e5573c6e 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -98,10 +98,7 @@ meta_preview_init (MetaPreview *preview)
META_FRAME_ALLOWS_SHADE |
META_FRAME_ALLOWS_MOVE;
- preview->borders.visible.left = -1;
- preview->borders.visible.right = -1;
- preview->borders.visible.top = -1;
- preview->borders.visible.bottom = -1;
+ preview->borders_cached = FALSE;
}
GtkWidget*
@@ -172,23 +169,17 @@ ensure_info (MetaPreview *preview)
pango_font_description_free (font_desc);
}
- if (preview->borders.visible.top < 0)
+ if (!preview->borders_cached)
{
if (preview->theme)
- {
meta_theme_get_frame_borders (preview->theme,
preview->type,
preview->text_height,
preview->flags,
&preview->borders);
- }
else
- {
- preview->borders.visible.top = 0;
- preview->borders.visible.bottom = 0;
- preview->borders.visible.left = 0;
- preview->borders.visible.right = 0;
- }
+ meta_frame_borders_clear (&preview->borders);
+ preview->borders_cached = TRUE;
}
}
@@ -364,10 +355,7 @@ clear_cache (MetaPreview *preview)
preview->layout = NULL;
}
- preview->borders.visible.left = -1;
- preview->borders.visible.right = -1;
- preview->borders.visible.top = -1;
- preview->borders.visible.bottom = -1;
+ preview->borders_cached = FALSE;
}
void
diff --git a/src/ui/preview-widget.h b/src/ui/preview-widget.h
index 11818588..898a226d 100644
--- a/src/ui/preview-widget.h
+++ b/src/ui/preview-widget.h
@@ -51,6 +51,7 @@ struct _MetaPreview
int text_height;
MetaFrameBorders borders;
+ guint borders_cached : 1;
MetaButtonLayout button_layout;
};
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 20cf6913..d673134c 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -219,11 +219,6 @@ meta_frame_layout_new (void)
layout->right_width = -1;
layout->bottom_height = -1;
- layout->invisible_border.left = 10;
- layout->invisible_border.right = 10;
- layout->invisible_border.bottom = 10;
- layout->invisible_border.top = 10;
-
init_border (&layout->title_border);
layout->title_vertical_pad = -1;
@@ -430,10 +425,8 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
if (flags & META_FRAME_FULLSCREEN)
{
- borders->visible.top = 0;
- borders->visible.bottom = 0;
- borders->visible.left = 0;
- borders->visible.right = 0;
+ meta_frame_borders_clear (borders);
+ return;
}
}
@@ -5658,10 +5651,7 @@ meta_theme_get_frame_borders (MetaTheme *theme,
style = theme_get_style (theme, type, flags);
- borders->visible.top = 0;
- borders->visible.left = 0;
- borders->visible.right = 0;
- borders->visible.bottom = 0;
+ meta_frame_borders_clear (borders);
/* Parser is not supposed to allow this currently */
if (style == NULL)
diff --git a/src/ui/ui.c b/src/ui/ui.c
index fdb9733a..a03747f2 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -682,10 +682,7 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
}
else
{
- borders->visible.top = 0;
- borders->visible.bottom = 0;
- borders->visible.left = 0;
- borders->visible.right = 0;
+ meta_frame_borders_clear (borders);
}
if (style != NULL)