[PATCH 1/1] build: Add missing math.h includes

Nicholas Vinson nvinson234 at gmail.com
Tue May 21 00:37:24 CEST 2024


Commit 0f786ce451297f8d26d41dc8492c10db08d8f87f added a math.h include
statement to libxfce4panel/xfce-panel-image.c to fix issue #833.
However, libm functions are used in more files than just
xfce-panel-image.c.

Therefore, add math.h include to other files that use math functions.

Signed-off-by: Nicholas Vinson <nvinson234 at gmail.com>
Fixes: https://bugs.gentoo.org/932303
---
 panel/panel-base-window.c        | 4 +++-
 panel/panel-itembar.c            | 4 ++++
 panel/panel-preferences-dialog.c | 4 +++-
 plugins/clock/clock-analog.c     | 4 ++++
 plugins/clock/clock-binary.c     | 4 +++-
 plugins/clock/clock-lcd.c        | 4 ++++
 plugins/clock/clock.c            | 4 ++++
 plugins/systray/systray-box.c    | 4 ++++
 8 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index 5e0f3a68..832520be 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -35,7 +35,9 @@
 #define gtk_layer_is_supported() FALSE
 #endif
 
-
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
 
 #define PANEL_BASE_CSS ".xfce4-panel.background { border-style: solid; }" \
                        ".xfce4-panel.background button { background: transparent; padding: 0; }" \
diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c
index 4ffcb5ba..11ccf5d1 100644
--- a/panel/panel-itembar.c
+++ b/panel/panel-itembar.c
@@ -29,6 +29,10 @@
 #include "libxfce4panel/libxfce4panel.h"
 #include "libxfce4panel/xfce-panel-plugin-provider.h"
 
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
 #define IS_HORIZONTAL(itembar) ((itembar)->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
 #define HIGHLIGHT_SIZE 2
 
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 9a54e9ab..dfcc67db 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -37,7 +37,9 @@
 #include <libxfce4ui/libxfce4ui.h>
 #include <libxfce4util/libxfce4util.h>
 
-
+#ifdef HAVE_MATH_H
+#include<math.h>
+#endif
 
 static void
 panel_preferences_dialog_finalize (GObject *object);
diff --git a/plugins/clock/clock-analog.c b/plugins/clock/clock-analog.c
index ae4ae21f..50196352 100644
--- a/plugins/clock/clock-analog.c
+++ b/plugins/clock/clock-analog.c
@@ -27,6 +27,10 @@
 
 #include <cairo/cairo.h>
 
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
 #define CLOCK_SCALE 0.08
 #define TICKS_TO_RADIANS(x) (G_PI - (G_PI / 30.0) * (x))
 #define HOURS_TO_RADIANS(x, y) (G_PI - (G_PI / 6.0) * (((x) > 12 ? (x) - 12 : (x)) + (y) / 60.0))
diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c
index 5ac4151a..36fe31c7 100644
--- a/plugins/clock/clock-binary.c
+++ b/plugins/clock/clock-binary.c
@@ -27,7 +27,9 @@
 
 #include <cairo/cairo.h>
 
-
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
 
 static void
 xfce_clock_binary_set_property (GObject *object,
diff --git a/plugins/clock/clock-lcd.c b/plugins/clock/clock-lcd.c
index 97e041d5..8b7454df 100644
--- a/plugins/clock/clock-lcd.c
+++ b/plugins/clock/clock-lcd.c
@@ -27,6 +27,10 @@
 
 #include <cairo/cairo.h>
 
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
 #define RELATIVE_SPACE (0.10)
 #define RELATIVE_DIGIT (5 * RELATIVE_SPACE)
 #define RELATIVE_DOTS (3 * RELATIVE_SPACE)
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 472ff8f1..ee1d4402 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -39,6 +39,10 @@
 #include <gtk/gtk.h>
 #include <libxfce4ui/libxfce4ui.h>
 
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
 /* TRANSLATORS: adjust this accordingly for your locale format */
 #define DEFAULT_TOOLTIP_FORMAT NC_ ("Date", "%A %d %B %Y")
 
diff --git a/plugins/systray/systray-box.c b/plugins/systray/systray-box.c
index 1fc22c92..f808acb9 100644
--- a/plugins/systray/systray-box.c
+++ b/plugins/systray/systray-box.c
@@ -27,6 +27,10 @@
 #include "common/panel-debug.h"
 #include "common/panel-private.h"
 
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
 #define SPACING (2)
 #define OFFSCREEN (-9999)
 
-- 
2.45.1



More information about the Xfce4-dev mailing list