[Xfce4-commits] [xfce/xfwm4] 08/32: Introduce xfwm-common static library
noreply at xfce.org
noreply at xfce.org
Tue Dec 5 09:21:54 CET 2017
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 9d5ac6a4f964ce1b4a12b402486f81c77cd3c5e1
Author: Viktor Odintsev <zakhams at gmail.com>
Date: Sun Jul 2 16:46:26 2017 +0300
Introduce xfwm-common static library
---
Makefile.am | 1 +
common/Makefile.am | 20 +++++++++++++++
settings-dialogs/common.c => common/xfwm-common.c | 30 ++++++++++++++++++++++-
settings-dialogs/common.h => common/xfwm-common.h | 7 ++++--
configure.ac.in | 1 +
settings-dialogs/Makefile.am | 18 ++++++--------
settings-dialogs/tweaks-settings.c | 3 ++-
settings-dialogs/workspace-settings.c | 27 +++-----------------
settings-dialogs/xfwm4-settings.c | 3 ++-
src/Makefile.am | 5 ++++
10 files changed, 76 insertions(+), 39 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 00e880d..0da25ab 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,6 +17,7 @@ SUBDIRS = \
helper-dialog \
icons \
po \
+ common \
settings-dialogs \
src \
themes
diff --git a/common/Makefile.am b/common/Makefile.am
new file mode 100644
index 0000000..5fd949b
--- /dev/null
+++ b/common/Makefile.am
@@ -0,0 +1,20 @@
+AM_CPPFLAGS = \
+ -I${top_srcdir}
+
+noinst_LTLIBRARIES = \
+ libxfwm-common.la
+
+libxfwm_common_la_SOURCES = \
+ xfwm-common.c \
+ xfwm-common.h
+
+libxfwm_common_la_CFLAGS = \
+ $(GTK_CFLAGS) \
+ $(PLATFORM_CFLAGS)
+
+libxfwm_common_la_LIBADD = \
+ $(GTK_LIBS)
+
+libxfwm_common_la_LDFLAGS = \
+ -no-undefined \
+ $(PLATFORM_LDFLAGS)
diff --git a/settings-dialogs/common.c b/common/xfwm-common.c
similarity index 69%
rename from settings-dialogs/common.c
rename to common/xfwm-common.c
index 2868108..b6c9ae2 100644
--- a/settings-dialogs/common.c
+++ b/common/xfwm-common.c
@@ -18,7 +18,10 @@
* MA 02110-1301, USA.
*/
-#include <gtk/gtk.h>
+#include <string.h>
+#include <gdk/gdkx.h>
+
+#include "xfwm-common.h"
@@ -44,3 +47,28 @@ xfwm_widget_reparent (GtkWidget *widget,
}
}
+
+
+void
+xfwm_get_screen_dimensions (gint *width, gint *height)
+{
+#if GTK_CHECK_VERSION(3, 22, 0)
+ GdkDisplay *display;
+ GdkMonitor *monitor;
+ GdkRectangle geometry;
+
+ display = gdk_display_get_default ();
+ monitor = gdk_display_get_primary_monitor (display);
+ gdk_monitor_get_geometry (monitor, &geometry);
+
+ if (width != NULL)
+ *width = geometry.width;
+ if (height != NULL)
+ *height = geometry.height;
+#else
+ if (width != NULL)
+ *width = gdk_screen_width ();
+ if (height != NULL)
+ *height = gdk_screen_height ();
+#endif
+}
diff --git a/settings-dialogs/common.h b/common/xfwm-common.h
similarity index 84%
rename from settings-dialogs/common.h
rename to common/xfwm-common.h
index ea8e59f..eb2ed41 100644
--- a/settings-dialogs/common.h
+++ b/common/xfwm-common.h
@@ -23,7 +23,10 @@
#include <gtk/gtk.h>
-void xfwm_widget_reparent (GtkWidget *widget,
- GtkWidget *new_parent);
+void xfwm_widget_reparent (GtkWidget *widget,
+ GtkWidget *new_parent);
+
+void xfwm_get_screen_dimensions (gint *width,
+ gint *height);
#endif /* !__COMMON_H__ */
diff --git a/configure.ac.in b/configure.ac.in
index 8ab67d8..5774ee8 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -284,6 +284,7 @@ icons/22x22/Makefile
icons/48x48/Makefile
icons/scalable/Makefile
po/Makefile.in
+common/Makefile
settings-dialogs/Makefile
src/Makefile
themes/Makefile
diff --git a/settings-dialogs/Makefile.am b/settings-dialogs/Makefile.am
index 4226a5c..74cb97b 100644
--- a/settings-dialogs/Makefile.am
+++ b/settings-dialogs/Makefile.am
@@ -7,9 +7,7 @@ xfwm4_workspace_settings_SOURCES = \
workspace-settings.c \
xfwm4-workspace-dialog_ui.h \
workspace-resource.c \
- workspace-resource.h \
- common.c \
- common.h
+ workspace-resource.h
xfwm4_workspace_settings_CFLAGS = \
$(GTK_CFLAGS) \
@@ -25,6 +23,7 @@ xfwm4_workspace_settings_CFLAGS = \
-DWNCK_I_KNOW_THIS_IS_UNSTABLE
xfwm4_workspace_settings_LDADD = \
+ $(top_builddir)/common/libxfwm-common.la \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(DBUS_GLIB_LIBS) \
@@ -38,9 +37,7 @@ xfwm4_settings_SOURCES = \
xfwm4-settings.h \
xfwm4-dialog_ui.h \
range-debouncer.c \
- range-debouncer.h \
- common.c \
- common.h
+ range-debouncer.h
xfwm4_settings_CFLAGS = \
$(GTK_CFLAGS) \
@@ -54,6 +51,7 @@ xfwm4_settings_CFLAGS = \
-DLOCALEDIR=\"$(localedir)\"
xfwm4_settings_LDADD = \
+ $(top_builddir)/common/libxfwm-common.la \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(DBUS_GLIB_LIBS) \
@@ -65,9 +63,7 @@ xfwm4_tweaks_settings_SOURCES = \
tweaks-settings.c \
xfwm4-tweaks-dialog_ui.h \
range-debouncer.c \
- range-debouncer.h \
- common.c \
- common.h
+ range-debouncer.h
xfwm4_tweaks_settings_CFLAGS = \
$(GTK_CFLAGS) \
@@ -80,6 +76,7 @@ xfwm4_tweaks_settings_CFLAGS = \
-DLOCALEDIR=\"$(localedir)\"
xfwm4_tweaks_settings_LDADD = \
+ $(top_builddir)/common/libxfwm-common.la \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(DBUS_GLIB_LIBS) \
@@ -87,7 +84,8 @@ xfwm4_tweaks_settings_LDADD = \
$(LIBXFCONF_LIBS)
AM_CPPFLAGS = \
- -I${top_srcdir}
+ -I${top_srcdir} \
+ $(PLATFORM_CPPFLAGS)
if MAINTAINER_MODE
diff --git a/settings-dialogs/tweaks-settings.c b/settings-dialogs/tweaks-settings.c
index 1ed1109..b6691af 100644
--- a/settings-dialogs/tweaks-settings.c
+++ b/settings-dialogs/tweaks-settings.c
@@ -43,9 +43,10 @@
#include <libxfce4ui/libxfce4ui.h>
#include <xfconf/xfconf.h>
+#include <common/xfwm-common.h>
+
#include "xfwm4-tweaks-dialog_ui.h"
#include "range-debouncer.h"
-#include "common.h"
static Window opt_socket_id = 0;
static gboolean opt_version = FALSE;
diff --git a/settings-dialogs/workspace-settings.c b/settings-dialogs/workspace-settings.c
index 911032b..67600a5 100644
--- a/settings-dialogs/workspace-settings.c
+++ b/settings-dialogs/workspace-settings.c
@@ -37,8 +37,9 @@
#include <libxfce4ui/libxfce4ui.h>
#include <xfconf/xfconf.h>
+#include <common/xfwm-common.h>
+
#include "xfwm4-workspace-dialog_ui.h"
-#include "common.h"
#define WORKSPACES_CHANNEL "xfwm4"
@@ -303,28 +304,6 @@ workspace_dialog_setup_names_treeview(GtkBuilder *builder,
static void
-workspace_dialog_get_screen_dimensions (gint *width, gint *height)
-{
-#if GTK_CHECK_VERSION(3, 22, 0)
- GdkDisplay *display;
- GdkMonitor *monitor;
- GdkRectangle geometry;
-
- display = gdk_display_get_default ();
- monitor = gdk_display_get_primary_monitor (display);
- gdk_monitor_get_geometry (monitor, &geometry);
-
- *width = geometry.width;
- *height = geometry.height;
-#else
- *width = gdk_screen_width ();
- *height = gdk_screen_height ();
-#endif
-}
-
-
-
-static void
workspace_dialog_configure_widgets (GtkBuilder *builder,
XfconfChannel *channel)
{
@@ -352,7 +331,7 @@ workspace_dialog_configure_widgets (GtkBuilder *builder,
}
/* Set max margins range */
- workspace_dialog_get_screen_dimensions (&wmax, &hmax);
+ xfwm_get_screen_dimensions (&wmax, &hmax);
wmax /= 4;
hmax /= 4;
diff --git a/settings-dialogs/xfwm4-settings.c b/settings-dialogs/xfwm4-settings.c
index f590f7b..547e449 100644
--- a/settings-dialogs/xfwm4-settings.c
+++ b/settings-dialogs/xfwm4-settings.c
@@ -46,10 +46,11 @@
#include <libxfce4kbd-private/xfce-shortcuts-provider.h>
#include <libxfce4kbd-private/xfce-shortcuts-xfwm4.h>
+#include <common/xfwm-common.h>
+
#include "xfwm4-dialog_ui.h"
#include "xfwm4-settings.h"
#include "range-debouncer.h"
-#include "common.h"
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b3b96f..018cb36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -93,6 +93,7 @@ xfwm4_CFLAGS = \
-DG_LOG_DOMAIN=\"xfwm4\"
xfwm4_LDADD = \
+ $(top_builddir)/common/libxfwm-common.la \
$(GLIB_LIBS) \
$(GTK_LIBS) \
$(COMPOSITOR_LIBS) \
@@ -110,6 +111,10 @@ xfwm4_LDADD = \
$(XINERAMA_LIBS) \
$(MATH_LIBS)
+AM_CPPFLAGS = \
+ -I${top_srcdir} \
+ $(PLATFORM_CPPFLAGS)
+
EXTRA_DIST = \
default_icon.png \
default_icon.svg \
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list