aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-03-05 16:38:44 +0100
committerMattias Andrée <m@maandree.se>2025-03-05 16:38:44 +0100
commit844a48da2d670be95a62a582aab73ad8145040e2 (patch)
tree1c20cd1646706d6af03bce48822568c5602a8616
parentUse colour temperature table from libred (diff)
downloadredshift-ng-844a48da2d670be95a62a582aab73ad8145040e2.tar.gz
redshift-ng-844a48da2d670be95a62a582aab73ad8145040e2.tar.bz2
redshift-ng-844a48da2d670be95a62a582aab73ad8145040e2.tar.xz
Unify header files (so far most)
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r--src/Makefile9
-rw-r--r--src/colorramp.c4
-rw-r--r--src/colorramp.h43
-rw-r--r--src/common.h111
-rw-r--r--src/gamma-coopgamma.c7
-rw-r--r--src/gamma-coopgamma.h29
-rw-r--r--src/gamma-drm.c3
-rw-r--r--src/gamma-drm.h28
-rw-r--r--src/gamma-dummy.h27
-rw-r--r--src/gamma-quartz.h27
-rw-r--r--src/gamma-randr.c4
-rw-r--r--src/gamma-randr.h27
-rw-r--r--src/gamma-vidmode.c4
-rw-r--r--src/gamma-vidmode.h27
-rw-r--r--src/gamma-w32gdi.h27
-rw-r--r--src/hooks.c3
-rw-r--r--src/hooks.h29
-rw-r--r--src/location-corelocation.h27
-rw-r--r--src/location-geoclue2.c4
-rw-r--r--src/location-geoclue2.h27
-rw-r--r--src/location-manual.c2
-rw-r--r--src/location-manual.h27
-rw-r--r--src/pipeutils.h28
-rw-r--r--src/redshift.c42
-rw-r--r--src/signals.c21
-rw-r--r--src/signals.h38
-rw-r--r--src/systemtime.c2
-rw-r--r--src/systemtime.h27
28 files changed, 138 insertions, 516 deletions
diff --git a/src/Makefile b/src/Makefile
index c906e20..b2841d3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,6 +3,7 @@
CONFIGFILE = config.mk
include $(CONFIGFILE)
+
OBJ =\
colorramp.o\
config-ini.o\
@@ -21,10 +22,16 @@ OBJ =\
solar.o\
systemtime.o
-HDR = $(OBJ:.o=.h)
+HDR =\
+ common.h\
+ solar.h\
+ redshift.h\
+ options.h\
+ config-ini.h
PACKAGE_STRING = redshift-ng 1.13
+
all: redshift
$(OBJ): $(HDR)
diff --git a/src/colorramp.c b/src/colorramp.c
index 2c94477..a9db111 100644
--- a/src/colorramp.c
+++ b/src/colorramp.c
@@ -19,12 +19,10 @@
Copyright (c) 2016, 2025 Mattias Andrée <m@maandree.se>
*/
-#include <stdint.h>
#include <math.h>
#include <libred.h>
-#include "colorramp.h"
-#include "redshift.h"
+#include "common.h"
/* Helper macro used in the fill functions */
#define F(Y, WP, C) pow((Y) * setting->brightness * (WP), 1.0/setting->gamma[C])
diff --git a/src/colorramp.h b/src/colorramp.h
deleted file mode 100644
index c224db5..0000000
--- a/src/colorramp.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* colorramp.h -- color temperature calculation header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2010-2014 Jon Lund Steffensen <jonlst@gmail.com>
- Copyright (c) 2016 Mattias Andrée <m@maandree.se>
-*/
-
-#ifndef REDSHIFT_COLORRAMP_H
-#define REDSHIFT_COLORRAMP_H
-
-#include <stdint.h>
-
-#include "redshift.h"
-
-#define LIST_RAMPS_STOP_VALUE_TYPES\
- X(u8, uint8_t, UINT8_MAX + 1ULL, UINT8_MAX, 8)\
- X(u16, uint16_t, UINT16_MAX + 1ULL, UINT16_MAX, 16)\
- X(u32, uint32_t, UINT32_MAX + 1ULL, UINT32_MAX, 32)\
- X(u64, uint64_t, UINT64_MAX, UINT64_MAX, 64)\
- X(float, float, 1, 1, -1)\
- X(double, double, 1, 1, -2)
-
-#define X(SUFFIX, TYPE, MAX, TRUE_MAX, DEPTH)\
- void colorramp_fill_##SUFFIX(TYPE *gamma_r, TYPE *gamma_g, TYPE *gamma_b,\
- size_t size_r, size_t size_g, size_t size_b,\
- const color_setting_t *setting);
-LIST_RAMPS_STOP_VALUE_TYPES
-#undef X
-
-#endif /* ! REDSHIFT_COLORRAMP_H */
diff --git a/src/common.h b/src/common.h
new file mode 100644
index 0000000..79ff387
--- /dev/null
+++ b/src/common.h
@@ -0,0 +1,111 @@
+/* common.h -- Common header file for Redshift source files
+ This file is part of Redshift.
+
+ Redshift 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 3 of the License, or
+ (at your option) any later version.
+
+ Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright (c) 2009-2017 Jon Lund Steffensen <jonlst@gmail.com>
+ Copyright (c) 2014, 2015, 2016, 2025 Mattias Andrée <m@maandree.se>
+*/
+#ifndef REDSHIFT_COMMON_H
+#define REDSHIFT_COMMON_H
+
+#include "redshift.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#if !defined(__WIN32__)
+# include <signal.h>
+#endif
+
+
+#define LIST_RAMPS_STOP_VALUE_TYPES\
+ X(u8, uint8_t, UINT8_MAX + 1ULL, UINT8_MAX, 8)\
+ X(u16, uint16_t, UINT16_MAX + 1ULL, UINT16_MAX, 16)\
+ X(u32, uint32_t, UINT32_MAX + 1ULL, UINT32_MAX, 32)\
+ X(u64, uint64_t, UINT64_MAX, UINT64_MAX, 64)\
+ X(float, float, 1, 1, -1)\
+ X(double, double, 1, 1, -2)
+
+#define X(SUFFIX, TYPE, MAX, TRUE_MAX, DEPTH)\
+ void colorramp_fill_##SUFFIX(TYPE *gamma_r, TYPE *gamma_g, TYPE *gamma_b,\
+ size_t size_r, size_t size_g, size_t size_b,\
+ const color_setting_t *setting);
+LIST_RAMPS_STOP_VALUE_TYPES
+#undef X
+
+
+void hooks_signal_period_change(period_t prev_period,
+ period_t period);
+
+
+int pipeutils_create_nonblocking(int pipefds[2]);
+
+void pipeutils_signal(int write_fd);
+void pipeutils_handle_signal(int read_fd);
+
+
+#if !defined(__WIN32__)
+extern volatile sig_atomic_t exiting;
+extern volatile sig_atomic_t disable;
+#else
+extern int exiting;
+extern int disable;
+#endif
+
+int signals_install_handlers(void);
+
+
+int systemtime_get_time(double *now);
+void systemtime_msleep(unsigned int msecs);
+
+
+extern const gamma_method_t dummy_gamma_method;
+
+#ifdef ENABLE_COOPGAMMA
+extern const gamma_method_t coopgamma_gamma_method;
+#endif
+
+#ifdef ENABLE_RANDR
+extern const gamma_method_t randr_gamma_method;
+#endif
+
+#ifdef ENABLE_VIDMODE
+extern const gamma_method_t vidmode_gamma_method;
+#endif
+
+#ifdef ENABLE_DRM
+extern const gamma_method_t drm_gamma_method;
+#endif
+
+#ifdef ENABLE_QUARTZ
+extern const gamma_method_t quartz_gamma_method;
+#endif
+
+#ifdef ENABLE_W32GDI
+extern const gamma_method_t w32gdi_gamma_method;
+#endif
+
+
+extern const location_provider_t manual_location_provider;
+
+#ifdef ENABLE_GEOCLUE2
+extern const location_provider_t geoclue2_location_provider;
+#endif
+
+#ifdef ENABLE_CORELOCATION
+extern const location_provider_t corelocation_location_provider;
+#endif
+
+
+#endif
diff --git a/src/gamma-coopgamma.c b/src/gamma-coopgamma.c
index 41a9d2b..d389e34 100644
--- a/src/gamma-coopgamma.c
+++ b/src/gamma-coopgamma.c
@@ -20,7 +20,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#else
-# define PACKAGE "redshift"
+# define PACKAGE "redshift-ng"
#endif
#include <errno.h>
@@ -37,8 +37,9 @@
# define _(s) s
#endif
-#include "gamma-coopgamma.h"
-#include "colorramp.h"
+#include "common.h"
+
+#include <libcoopgamma.h>
typedef struct {
diff --git a/src/gamma-coopgamma.h b/src/gamma-coopgamma.h
deleted file mode 100644
index a46f863..0000000
--- a/src/gamma-coopgamma.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* gamma-coopgamma.h -- coopgamma gamma adjustment header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2016, 2025 Mattias Andrée <m@maandree.se>
-*/
-
-#ifndef REDSHIFT_GAMMA_COOPGAMMA_H
-#define REDSHIFT_GAMMA_COOPGAMMA_H
-
-#include <libcoopgamma.h>
-
-#include "redshift.h"
-
-extern const gamma_method_t coopgamma_gamma_method;
-
-#endif /* ! REDSHIFT_GAMMA_COOPGAMMA_H */
diff --git a/src/gamma-drm.c b/src/gamma-drm.c
index dec7074..30d1f23 100644
--- a/src/gamma-drm.c
+++ b/src/gamma-drm.c
@@ -45,8 +45,7 @@
#include <xf86drm.h>
#include <xf86drmMode.h>
-#include "gamma-drm.h"
-#include "colorramp.h"
+#include "common.h"
typedef struct {
diff --git a/src/gamma-drm.h b/src/gamma-drm.h
deleted file mode 100644
index 96ee10c..0000000
--- a/src/gamma-drm.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* gamma-drm.h -- DRM gamma adjustment header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2014 Mattias Andrée <m@maandree.se>
- Copyright (c) 2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_GAMMA_DRM_H
-#define REDSHIFT_GAMMA_DRM_H
-
-#include "redshift.h"
-
-extern const gamma_method_t drm_gamma_method;
-
-#endif /* ! REDSHIFT_GAMMA_DRM_H */
diff --git a/src/gamma-dummy.h b/src/gamma-dummy.h
deleted file mode 100644
index c610d94..0000000
--- a/src/gamma-dummy.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* gamma-dummy.h -- No-op gamma adjustment header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2013-2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_GAMMA_DUMMY_H
-#define REDSHIFT_GAMMA_DUMMY_H
-
-#include "redshift.h"
-
-extern const gamma_method_t dummy_gamma_method;
-
-#endif /* ! REDSHIFT_GAMMA_DUMMY_H */
diff --git a/src/gamma-quartz.h b/src/gamma-quartz.h
deleted file mode 100644
index 9a40137..0000000
--- a/src/gamma-quartz.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* gamma-quartz.h -- Quartz (OSX) gamma adjustment header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2014-2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_GAMMA_QUARTZ_H
-#define REDSHIFT_GAMMA_QUARTZ_H
-
-#include "redshift.h"
-
-extern const gamma_method_t quartz_gamma_method;
-
-#endif /* ! REDSHIFT_GAMMA_QUARTZ_H */
diff --git a/src/gamma-randr.c b/src/gamma-randr.c
index 358ab58..4a2c907 100644
--- a/src/gamma-randr.c
+++ b/src/gamma-randr.c
@@ -37,9 +37,7 @@
#include <xcb/xcb.h>
#include <xcb/randr.h>
-#include "gamma-randr.h"
-#include "redshift.h"
-#include "colorramp.h"
+#include "common.h"
#define RANDR_VERSION_MAJOR 1
diff --git a/src/gamma-randr.h b/src/gamma-randr.h
deleted file mode 100644
index 0545d2f..0000000
--- a/src/gamma-randr.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* gamma-randr.h -- X RANDR gamma adjustment header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2010-2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_GAMMA_RANDR_H
-#define REDSHIFT_GAMMA_RANDR_H
-
-#include "redshift.h"
-
-extern const gamma_method_t randr_gamma_method;
-
-#endif /* ! REDSHIFT_GAMMA_RANDR_H */
diff --git a/src/gamma-vidmode.c b/src/gamma-vidmode.c
index 1ea585e..f718ccc 100644
--- a/src/gamma-vidmode.c
+++ b/src/gamma-vidmode.c
@@ -36,9 +36,7 @@
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>
-#include "gamma-vidmode.h"
-#include "redshift.h"
-#include "colorramp.h"
+#include "common.h"
typedef struct {
diff --git a/src/gamma-vidmode.h b/src/gamma-vidmode.h
deleted file mode 100644
index 6bad207..0000000
--- a/src/gamma-vidmode.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* gamma-vidmode.h -- X VidMode gamma adjustment header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2010-2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_GAMMA_VIDMODE_H
-#define REDSHIFT_GAMMA_VIDMODE_H
-
-#include "redshift.h"
-
-extern const gamma_method_t vidmode_gamma_method;
-
-#endif /* ! REDSHIFT_GAMMA_VIDMODE_H */
diff --git a/src/gamma-w32gdi.h b/src/gamma-w32gdi.h
deleted file mode 100644
index ac6eb10..0000000
--- a/src/gamma-w32gdi.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* gamma-w32gdi.h -- Windows GDI gamma adjustment header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2010-2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_GAMMA_W32GDI_H
-#define REDSHIFT_GAMMA_W32GDI_H
-
-#include "redshift.h"
-
-extern const gamma_method_t w32gdi_gamma_method;
-
-#endif /* ! REDSHIFT_GAMMA_W32GDI_H */
diff --git a/src/hooks.c b/src/hooks.c
index d051c4b..cb14f60 100644
--- a/src/hooks.c
+++ b/src/hooks.c
@@ -26,8 +26,7 @@
# include <pwd.h>
#endif
-#include "hooks.h"
-#include "redshift.h"
+#include "common.h"
#define MAX_HOOK_PATH 4096
diff --git a/src/hooks.h b/src/hooks.h
deleted file mode 100644
index fd1c2f0..0000000
--- a/src/hooks.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* hooks.h -- Hooks triggered by events
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2014 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_HOOKS_H
-#define REDSHIFT_HOOKS_H
-
-#include "redshift.h"
-
-void hooks_signal_period_change(period_t prev_period,
- period_t period);
-
-
-#endif /* ! REDSHIFT_HOOKS_H */
diff --git a/src/location-corelocation.h b/src/location-corelocation.h
deleted file mode 100644
index 4af302c..0000000
--- a/src/location-corelocation.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* location-corelocation.h -- CoreLocation (OSX) location provider header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2014-2017 Jon Lund Steffense <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_LOCATION_CORELOCATION_H
-#define REDSHIFT_LOCATION_CORELOCATION_H
-
-#include "redshift.h"
-
-extern const location_provider_t corelocation_location_provider;
-
-#endif /* ! REDSHIFT_LOCATION_CORELOCATION_H */
diff --git a/src/location-geoclue2.c b/src/location-geoclue2.c
index 06015c5..c6c2bda 100644
--- a/src/location-geoclue2.c
+++ b/src/location-geoclue2.c
@@ -28,9 +28,7 @@
#include <glib/gprintf.h>
#include <gio/gio.h>
-#include "location-geoclue2.h"
-#include "redshift.h"
-#include "pipeutils.h"
+#include "common.h"
#ifdef ENABLE_NLS
# include <libintl.h>
diff --git a/src/location-geoclue2.h b/src/location-geoclue2.h
deleted file mode 100644
index a7189a7..0000000
--- a/src/location-geoclue2.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* location-geoclue2.h -- Geoclue2 location provider header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2014-2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_LOCATION_GEOCLUE2_H
-#define REDSHIFT_LOCATION_GEOCLUE2_H
-
-#include "redshift.h"
-
-extern const location_provider_t geoclue2_location_provider;
-
-#endif /* ! REDSHIFT_LOCATION_GEOCLUE2_H */
diff --git a/src/location-manual.c b/src/location-manual.c
index db3a8a9..7ab9162 100644
--- a/src/location-manual.c
+++ b/src/location-manual.c
@@ -27,7 +27,7 @@
#include <string.h>
#include <errno.h>
-#include "location-manual.h"
+#include "common.h"
#ifdef ENABLE_NLS
# include <libintl.h>
diff --git a/src/location-manual.h b/src/location-manual.h
deleted file mode 100644
index c7ef2ad..0000000
--- a/src/location-manual.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* location-manual.h -- Manual location provider header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2010-2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_LOCATION_MANUAL_H
-#define REDSHIFT_LOCATION_MANUAL_H
-
-#include "redshift.h"
-
-extern const location_provider_t manual_location_provider;
-
-#endif /* ! REDSHIFT_LOCATION_MANUAL_H */
diff --git a/src/pipeutils.h b/src/pipeutils.h
deleted file mode 100644
index 69c3350..0000000
--- a/src/pipeutils.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* pipeutils.h -- Utilities for using pipes as signals
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2017 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_PIPEUTILS_H
-#define REDSHIFT_PIPEUTILS_H
-
-int pipeutils_create_nonblocking(int pipefds[2]);
-
-void pipeutils_signal(int write_fd);
-void pipeutils_handle_signal(int read_fd);
-
-#endif /* ! REDSHIFT_PIPEUTILS_H */
diff --git a/src/redshift.c b/src/redshift.c
index d2e79f6..60e2441 100644
--- a/src/redshift.c
+++ b/src/redshift.c
@@ -59,12 +59,9 @@ int poll(struct pollfd *fds, int nfds, int timeout) { abort(); return -1; }
# define gettext(s) s
#endif
-#include "redshift.h"
+#include "common.h"
#include "config-ini.h"
#include "solar.h"
-#include "systemtime.h"
-#include "hooks.h"
-#include "signals.h"
#include "options.h"
/* pause() is not defined on windows platform but is not needed either.
@@ -73,43 +70,6 @@ int poll(struct pollfd *fds, int nfds, int timeout) { abort(); return -1; }
# define pause()
#endif
-#include "gamma-dummy.h"
-
-#ifdef ENABLE_COOPGAMMA
-# include "gamma-coopgamma.h"
-#endif
-
-#ifdef ENABLE_DRM
-# include "gamma-drm.h"
-#endif
-
-#ifdef ENABLE_RANDR
-# include "gamma-randr.h"
-#endif
-
-#ifdef ENABLE_VIDMODE
-# include "gamma-vidmode.h"
-#endif
-
-#ifdef ENABLE_QUARTZ
-# include "gamma-quartz.h"
-#endif
-
-#ifdef ENABLE_WINGDI
-# include "gamma-w32gdi.h"
-#endif
-
-
-#include "location-manual.h"
-
-#ifdef ENABLE_GEOCLUE2
-# include "location-geoclue2.h"
-#endif
-
-#ifdef ENABLE_CORELOCATION
-# include "location-corelocation.h"
-#endif
-
#undef CLAMP
#define CLAMP(lo,mid,up) (((lo) > (mid)) ? (lo) : (((mid) < (up)) ? (mid) : (up)))
diff --git a/src/signals.c b/src/signals.c
index e2aa219..262e8f5 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -18,19 +18,10 @@
Copyright (c) 2015 Mattias Andrée <m@maandree.se>
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdio.h>
-#if defined(HAVE_SIGNAL_H) && !defined(__WIN32__)
-# include <signal.h>
-#endif
+#include "common.h"
-#include "signals.h"
-
-#if defined(HAVE_SIGNAL_H) && !defined(__WIN32__)
+#if !defined(__WIN32__)
volatile sig_atomic_t exiting = 0;
volatile sig_atomic_t disable = 0;
@@ -50,18 +41,18 @@ sigdisable(int signo)
disable = 1;
}
-#else /* ! HAVE_SIGNAL_H || __WIN32__ */
+#else
int disable = 0;
int exiting = 0;
-#endif /* ! HAVE_SIGNAL_H || __WIN32__ */
+#endif
int
signals_install_handlers(void)
{
-#if defined(HAVE_SIGNAL_H) && !defined(__WIN32__)
+#if !defined(__WIN32__)
struct sigaction sigact;
sigset_t sigset;
int r;
@@ -112,7 +103,7 @@ signals_install_handlers(void)
perror("sigaction");
return -1;
}
-#endif /* HAVE_SIGNAL_H && ! __WIN32__ */
+#endif
return 0;
}
diff --git a/src/signals.h b/src/signals.h
deleted file mode 100644
index 0b0af53..0000000
--- a/src/signals.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* signals.h -- Signal processing header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2009-2015 Jon Lund Steffensen <jonlst@gmail.com>
- Copyright (c) 2015 Mattias Andrée <m@maandree.se>
-*/
-#ifndef REDSHIFT_SIGNALS_H
-#define REDSHIFT_SIGNALS_H
-
-
-#if defined(HAVE_SIGNAL_H) && !defined(__WIN32__)
-
-extern volatile sig_atomic_t exiting;
-extern volatile sig_atomic_t disable;
-
-#else /* ! HAVE_SIGNAL_H || __WIN32__ */
-extern int exiting;
-extern int disable;
-#endif /* ! HAVE_SIGNAL_H || __WIN32__ */
-
-
-int signals_install_handlers(void);
-
-
-#endif /* REDSHIFT_SIGNALS_H */
diff --git a/src/systemtime.c b/src/systemtime.c
index 9a971fa..f8b4794 100644
--- a/src/systemtime.c
+++ b/src/systemtime.c
@@ -31,7 +31,7 @@
# include <windows.h>
#endif
-#include "systemtime.h"
+#include "common.h"
/* Return current time in T as the number of seconds since the epoch. */
diff --git a/src/systemtime.h b/src/systemtime.h
deleted file mode 100644
index 184e41d..0000000
--- a/src/systemtime.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* systemtime.h -- Portable system time header
- This file is part of Redshift.
-
- Redshift 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 3 of the License, or
- (at your option) any later version.
-
- Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
-
- Copyright (c) 2010-2014 Jon Lund Steffensen <jonlst@gmail.com>
-*/
-
-#ifndef REDSHIFT_SYSTEMTIME_H
-#define REDSHIFT_SYSTEMTIME_H
-
-
-int systemtime_get_time(double *now);
-void systemtime_msleep(unsigned int msecs);
-
-#endif /* ! REDSHIFT_SYSTEMTIME_H */