[metacity] libmetacity-private: don't include common.h



commit 32e41f952d0d9660f24ae541de7d4083737dae2b
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Jan 28 20:36:12 2016 +0200

    libmetacity-private: don't include common.h

 libmetacity/Makefile.am        |    4 +++
 libmetacity/meta-frame-flags.h |   49 ++++++++++++++++++++++++++++++++++++++++
 libmetacity/meta-frame-type.h  |   39 +++++++++++++++++++++++++++++++
 src/Makefile.am                |    1 -
 src/core/prefs.c               |    2 +-
 src/include/common.h           |   37 ------------------------------
 src/include/prefs.h            |    1 +
 src/include/ui.h               |    2 +
 src/ui/preview-widget.c        |    2 +-
 src/ui/theme-viewer.c          |   20 ++++++++--------
 src/ui/theme.c                 |   22 +++++++++---------
 src/ui/theme.h                 |    6 +++-
 12 files changed, 122 insertions(+), 63 deletions(-)
---
diff --git a/libmetacity/Makefile.am b/libmetacity/Makefile.am
index 4966489..2e0adda 100644
--- a/libmetacity/Makefile.am
+++ b/libmetacity/Makefile.am
@@ -14,6 +14,8 @@ libmetacity_la_SOURCES = \
        meta-color-spec.h \
        meta-frame-borders.c \
        meta-frame-borders.h \
+       meta-frame-flags.h \
+       meta-frame-type.h \
        meta-gradient.c \
        meta-gradient.h \
        meta-gradient-private.h \
@@ -58,6 +60,8 @@ libmetacity_include_HEADERS = \
        meta-color.h \
        meta-color-spec.h \
        meta-frame-borders.h \
+       meta-frame-flags.h \
+       meta-frame-type.h \
        meta-gradient.h \
        meta-gradient-spec.h \
        meta-theme.h \
diff --git a/libmetacity/meta-frame-flags.h b/libmetacity/meta-frame-flags.h
new file mode 100644
index 0000000..e943d88
--- /dev/null
+++ b/libmetacity/meta-frame-flags.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ *
+ * 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/>.
+ */
+
+#ifndef META_FRAME_FLAGS_H
+#define META_FRAME_FLAGS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+  META_FRAME_ALLOWS_DELETE            = 1 << 0,
+  META_FRAME_ALLOWS_MENU              = 1 << 1,
+  META_FRAME_ALLOWS_APPMENU           = 1 << 2,
+  META_FRAME_ALLOWS_MINIMIZE          = 1 << 3,
+  META_FRAME_ALLOWS_MAXIMIZE          = 1 << 4,
+  META_FRAME_ALLOWS_VERTICAL_RESIZE   = 1 << 5,
+  META_FRAME_ALLOWS_HORIZONTAL_RESIZE = 1 << 6,
+  META_FRAME_HAS_FOCUS                = 1 << 7,
+  META_FRAME_SHADED                   = 1 << 8,
+  META_FRAME_STUCK                    = 1 << 9,
+  META_FRAME_MAXIMIZED                = 1 << 10,
+  META_FRAME_ALLOWS_SHADE             = 1 << 11,
+  META_FRAME_ALLOWS_MOVE              = 1 << 12,
+  META_FRAME_FULLSCREEN               = 1 << 13,
+  META_FRAME_IS_FLASHING              = 1 << 14,
+  META_FRAME_ABOVE                    = 1 << 15,
+  META_FRAME_TILED_LEFT               = 1 << 16,
+  META_FRAME_TILED_RIGHT              = 1 << 17
+} MetaFrameFlags;
+
+G_END_DECLS
+
+#endif
diff --git a/libmetacity/meta-frame-type.h b/libmetacity/meta-frame-type.h
new file mode 100644
index 0000000..43bdd05
--- /dev/null
+++ b/libmetacity/meta-frame-type.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ *
+ * 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/>.
+ */
+
+#ifndef META_FRAME_TYPE_H
+#define META_FRAME_TYPE_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+  META_FRAME_TYPE_NORMAL,
+  META_FRAME_TYPE_DIALOG,
+  META_FRAME_TYPE_MODAL_DIALOG,
+  META_FRAME_TYPE_UTILITY,
+  META_FRAME_TYPE_MENU,
+  META_FRAME_TYPE_BORDER,
+  META_FRAME_TYPE_ATTACHED,
+  META_FRAME_TYPE_LAST
+} MetaFrameType;
+
+G_END_DECLS
+
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 38bfa26..0943ef8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -130,7 +130,6 @@ libmetacity_private_la_LIBADD  = @METACITY_LIBS@ $(top_builddir)/libmetacity/lib
 libmetacityincludedir = $(includedir)/metacity/metacity-private
 
 libmetacityinclude_HEADERS =                   \
-       include/common.h                        \
        ui/theme.h
 
 metacity_theme_viewer_SOURCES=  \
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 7b9400c..b547dfb 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -1121,7 +1121,7 @@ button_layout_equal (const MetaButtonLayout *a,
   int i;
 
   i = 0;
-  while (i < MAX_BUTTONS_PER_CORNER)
+  while (i < META_BUTTON_FUNCTION_LAST)
     {
       if (a->left_buttons[i] != b->left_buttons[i])
         return FALSE;
diff --git a/src/include/common.h b/src/include/common.h
index 1c117d3..7f9e3e7 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -30,34 +30,11 @@
 #include <X11/Xlib.h>
 #include <glib.h>
 #include <gtk/gtk.h>
-#include <libmetacity/meta-button-layout.h>
 
 typedef struct _MetaResizePopup MetaResizePopup;
 
 typedef enum
 {
-  META_FRAME_ALLOWS_DELETE            = 1 << 0,
-  META_FRAME_ALLOWS_MENU              = 1 << 1,
-  META_FRAME_ALLOWS_APPMENU           = 1 << 2,
-  META_FRAME_ALLOWS_MINIMIZE          = 1 << 3,
-  META_FRAME_ALLOWS_MAXIMIZE          = 1 << 4,
-  META_FRAME_ALLOWS_VERTICAL_RESIZE   = 1 << 5,
-  META_FRAME_ALLOWS_HORIZONTAL_RESIZE = 1 << 6,
-  META_FRAME_HAS_FOCUS                = 1 << 7,
-  META_FRAME_SHADED                   = 1 << 8,
-  META_FRAME_STUCK                    = 1 << 9,
-  META_FRAME_MAXIMIZED                = 1 << 10,
-  META_FRAME_ALLOWS_SHADE             = 1 << 11,
-  META_FRAME_ALLOWS_MOVE              = 1 << 12,
-  META_FRAME_FULLSCREEN               = 1 << 13,
-  META_FRAME_IS_FLASHING              = 1 << 14,
-  META_FRAME_ABOVE                    = 1 << 15,
-  META_FRAME_TILED_LEFT               = 1 << 16,
-  META_FRAME_TILED_RIGHT              = 1 << 17
-} MetaFrameFlags;
-
-typedef enum
-{
   META_MENU_OP_NONE        = 0,
   META_MENU_OP_DELETE      = 1 << 0,
   META_MENU_OP_MINIMIZE    = 1 << 1,
@@ -167,18 +144,6 @@ typedef enum
 
 typedef enum
 {
-  META_FRAME_TYPE_NORMAL,
-  META_FRAME_TYPE_DIALOG,
-  META_FRAME_TYPE_MODAL_DIALOG,
-  META_FRAME_TYPE_UTILITY,
-  META_FRAME_TYPE_MENU,
-  META_FRAME_TYPE_BORDER,
-  META_FRAME_TYPE_ATTACHED,
-  META_FRAME_TYPE_LAST
-} MetaFrameType;
-
-typedef enum
-{
   /* Create gratuitous divergence from regular
    * X mod bits, to be sure we find bugs
    */
@@ -229,8 +194,6 @@ typedef enum
   META_SIDE_BOTTOM          = META_DIRECTION_BOTTOM
 } MetaSide;
 
-#define MAX_BUTTONS_PER_CORNER META_BUTTON_FUNCTION_LAST
-
 /* should investigate changing these to whatever most apps use */
 #define META_ICON_WIDTH 96
 #define META_ICON_HEIGHT 96
diff --git a/src/include/prefs.h b/src/include/prefs.h
index 1cfaa03..529d8c0 100644
--- a/src/include/prefs.h
+++ b/src/include/prefs.h
@@ -26,6 +26,7 @@
 /* This header is a "common" one between the UI and core side */
 #include "common.h"
 #include "types.h"
+#include <libmetacity/meta-button-layout.h>
 #include <pango/pango-font.h>
 #include <gdesktop-enums.h>
 
diff --git a/src/include/ui.h b/src/include/ui.h
index bf154ec..abb679f 100644
--- a/src/include/ui.h
+++ b/src/include/ui.h
@@ -30,6 +30,8 @@
 #include <glib.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <libmetacity/meta-frame-borders.h>
+#include <libmetacity/meta-frame-flags.h>
+#include <libmetacity/meta-frame-type.h>
 
 /* This is between GTK_PRIORITY_RESIZE (+10) and GDK_PRIORITY_REDRAW (+20) */
 #define META_PRIORITY_RESIZE    (G_PRIORITY_HIGH_IDLE + 15)
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index bf77d42..d45771a 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -71,7 +71,7 @@ meta_preview_init (MetaPreview *preview)
   gtk_widget_set_has_window (GTK_WIDGET (preview), FALSE);
 
   i = 0;
-  while (i < MAX_BUTTONS_PER_CORNER)
+  while (i < META_BUTTON_FUNCTION_LAST)
     {
       preview->button_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
       preview->button_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
diff --git a/src/ui/theme-viewer.c b/src/ui/theme-viewer.c
index 2a0619e..b1f2932 100644
--- a/src/ui/theme-viewer.c
+++ b/src/ui/theme-viewer.c
@@ -43,9 +43,9 @@
  * we have a special case for the "no buttons on either side" case.
  */
 #ifndef ALLOW_DUPLICATE_BUTTONS
-#define BUTTON_LAYOUT_COMBINATIONS (MAX_BUTTONS_PER_CORNER + 1 + 1)
+#define BUTTON_LAYOUT_COMBINATIONS (META_BUTTON_FUNCTION_LAST + 1 + 1)
 #else
-#define BUTTON_LAYOUT_COMBINATIONS ((MAX_BUTTONS_PER_CORNER+1)*(MAX_BUTTONS_PER_CORNER+1))
+#define BUTTON_LAYOUT_COMBINATIONS ((META_BUTTON_FUNCTION_LAST+1)*(META_BUTTON_FUNCTION_LAST+1))
 #endif
 
 enum
@@ -660,7 +660,7 @@ init_layouts (void)
       int j;
 
       j = 0;
-      while (j < MAX_BUTTONS_PER_CORNER)
+      while (j < META_BUTTON_FUNCTION_LAST)
         {
           different_layouts[i].left_buttons[j] = META_BUTTON_FUNCTION_LAST;
           different_layouts[i].right_buttons[j] = META_BUTTON_FUNCTION_LAST;
@@ -671,7 +671,7 @@ init_layouts (void)
 
 #ifndef ALLOW_DUPLICATE_BUTTONS
   i = 0;
-  while (i <= MAX_BUTTONS_PER_CORNER)
+  while (i <= META_BUTTON_FUNCTION_LAST)
     {
       int j;
 
@@ -681,7 +681,7 @@ init_layouts (void)
           different_layouts[i].right_buttons[j] = (MetaButtonFunction) j;
           ++j;
         }
-      while (j < MAX_BUTTONS_PER_CORNER)
+      while (j < META_BUTTON_FUNCTION_LAST)
         {
           different_layouts[i].left_buttons[j-i] = (MetaButtonFunction) j;
           ++j;
@@ -704,23 +704,23 @@ init_layouts (void)
   left = 0;
   i = 0;
 
-  while (left < MAX_BUTTONS_PER_CORNER)
+  while (left < META_BUTTON_FUNCTION_LAST)
     {
       int right;
 
       right = 0;
 
-      while (right < MAX_BUTTONS_PER_CORNER)
+      while (right < META_BUTTON_FUNCTION_LAST)
         {
           int j;
 
-          static MetaButtonFunction left_functions[MAX_BUTTONS_PER_CORNER] = {
+          static MetaButtonFunction left_functions[META_BUTTON_FUNCTION_LAST] = {
             META_BUTTON_FUNCTION_MENU,
             META_BUTTON_FUNCTION_MINIMIZE,
             META_BUTTON_FUNCTION_MAXIMIZE,
             META_BUTTON_FUNCTION_CLOSE
           };
-          static MetaButtonFunction right_functions[MAX_BUTTONS_PER_CORNER] = {
+          static MetaButtonFunction right_functions[META_BUTTON_FUNCTION_LAST] = {
             META_BUTTON_FUNCTION_MINIMIZE,
             META_BUTTON_FUNCTION_MAXIMIZE,
             META_BUTTON_FUNCTION_CLOSE,
@@ -1055,7 +1055,7 @@ run_theme_benchmark (void)
   layout = create_title_layout (widget);
 
   i = 0;
-  while (i < MAX_BUTTONS_PER_CORNER)
+  while (i < META_BUTTON_FUNCTION_LAST)
     {
       button_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
       button_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
diff --git a/src/ui/theme.c b/src/ui/theme.c
index a58eb54..9a5a860 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -589,8 +589,8 @@ rect_for_function (MetaFrameGeometry *fgeom,
 }
 
 static gboolean
-strip_button (MetaButtonSpace *func_rects[MAX_BUTTONS_PER_CORNER],
-              GdkRectangle    *bg_rects[MAX_BUTTONS_PER_CORNER],
+strip_button (MetaButtonSpace *func_rects[META_BUTTON_FUNCTION_LAST],
+              GdkRectangle    *bg_rects[META_BUTTON_FUNCTION_LAST],
               int             *n_rects,
               MetaButtonSpace *to_strip)
 {
@@ -777,12 +777,12 @@ meta_frame_layout_calc_geometry (MetaFrameLayout        *layout,
   /* the left/right rects in order; the max # of rects
    * is the number of button functions
    */
-  MetaButtonSpace *left_func_rects[MAX_BUTTONS_PER_CORNER];
-  MetaButtonSpace *right_func_rects[MAX_BUTTONS_PER_CORNER];
-  GdkRectangle *left_bg_rects[MAX_BUTTONS_PER_CORNER];
-  gboolean left_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
-  GdkRectangle *right_bg_rects[MAX_BUTTONS_PER_CORNER];
-  gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
+  MetaButtonSpace *left_func_rects[META_BUTTON_FUNCTION_LAST];
+  MetaButtonSpace *right_func_rects[META_BUTTON_FUNCTION_LAST];
+  GdkRectangle *left_bg_rects[META_BUTTON_FUNCTION_LAST];
+  gboolean left_buttons_has_spacer[META_BUTTON_FUNCTION_LAST];
+  GdkRectangle *right_bg_rects[META_BUTTON_FUNCTION_LAST];
+  gboolean right_buttons_has_spacer[META_BUTTON_FUNCTION_LAST];
 
   meta_frame_layout_sync_with_style (layout, style_info, flags, theme);
 
@@ -843,7 +843,7 @@ meta_frame_layout_calc_geometry (MetaFrameLayout        *layout,
   if (!layout->hide_buttons)
     {
       /* Try to fill in rects */
-      for (i = 0; i < MAX_BUTTONS_PER_CORNER && button_layout->left_buttons[i] != META_BUTTON_FUNCTION_LAST; 
i++)
+      for (i = 0; i < META_BUTTON_FUNCTION_LAST && button_layout->left_buttons[i] != 
META_BUTTON_FUNCTION_LAST; i++)
         {
           left_func_rects[n_left] = rect_for_function (fgeom, flags,
                                                        button_layout->left_buttons[i],
@@ -858,7 +858,7 @@ meta_frame_layout_calc_geometry (MetaFrameLayout        *layout,
             }
         }
 
-      for (i = 0; i < MAX_BUTTONS_PER_CORNER && button_layout->right_buttons[i] != 
META_BUTTON_FUNCTION_LAST; i++)
+      for (i = 0; i < META_BUTTON_FUNCTION_LAST && button_layout->right_buttons[i] != 
META_BUTTON_FUNCTION_LAST; i++)
         {
           right_func_rects[n_right] = rect_for_function (fgeom, flags,
                                                          button_layout->right_buttons[i],
@@ -874,7 +874,7 @@ meta_frame_layout_calc_geometry (MetaFrameLayout        *layout,
         }
     }
 
-  for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
+  for (i = 0; i < META_BUTTON_FUNCTION_LAST; i++)
     {
       left_bg_rects[i] = NULL;
       right_bg_rects[i] = NULL;
diff --git a/src/ui/theme.h b/src/ui/theme.h
index caf4e05..1b218fd 100644
--- a/src/ui/theme.h
+++ b/src/ui/theme.h
@@ -22,9 +22,11 @@
 #ifndef THEME_H
 #define THEME_H
 
-#include "common.h"
 #include <gtk/gtk.h>
+#include <libmetacity/meta-button-layout.h>
 #include <libmetacity/meta-frame-borders.h>
+#include <libmetacity/meta-frame-flags.h>
+#include <libmetacity/meta-frame-type.h>
 #include <libmetacity/meta-theme.h>
 
 /**
@@ -85,7 +87,7 @@ struct _MetaFrameGeometry
   MetaButtonSpace unabove_rect;
   MetaButtonSpace unstick_rect;
 
-#define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
+#define MAX_MIDDLE_BACKGROUNDS (META_BUTTON_FUNCTION_LAST - 2)
   GdkRectangle left_left_background;
   GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
   GdkRectangle left_right_background;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]