From 57398cc26d66ec78cc65d4e9b23d0519406ff4e8 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 17 Jul 2024 21:07:37 +0200 Subject: Update for libgamma 0.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- DEPENDENCIES | 4 ++-- libgamma-error.hh | 8 ++++---- libgamma-facade.cc | 40 +++++++++++++++++++++------------------- libgamma-method.cc | 14 +++++++------- libgamma-method.hh | 28 ++++++++++++++-------------- libgammamm.a | Bin 48418 -> 50438 bytes 6 files changed, 48 insertions(+), 46 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index b349ec5..cc53a49 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,13 +1,13 @@ RUNTIME DEPENDENCIES: - libgamma>=0.3 + libgamma>=0.7.4 libc++ (gcc-libc) libc (glibc) BUILD DEPENDENCIES: - libgamma>=0.3 + libgamma>=0.7.4 libc++ (gcc-libc) libc (glibc) c++11 (gcc) diff --git a/libgamma-error.hh b/libgamma-error.hh index ec252c7..63189ee 100644 --- a/libgamma-error.hh +++ b/libgamma-error.hh @@ -82,13 +82,13 @@ namespace libgamma const GroupGid & operator =(const libgamma_gid_t &value) const { - libgamma_group_gid = value; + libgamma_group_gid_set(value); return *this; } operator libgamma_gid_t() const { - return libgamma_group_gid; + return libgamma_group_gid_get(); } }; @@ -108,13 +108,13 @@ namespace libgamma const GroupName & operator =(const char *value) const { - libgamma_group_name = value; + libgamma_group_name_set(value); return *this; } operator const char *() const { - return libgamma_group_name; + return libgamma_group_name_get(); } }; diff --git a/libgamma-facade.cc b/libgamma-facade.cc index dfb07f3..c68400a 100644 --- a/libgamma-facade.cc +++ b/libgamma-facade.cc @@ -21,15 +21,17 @@ namespace libgamma std::vector list_methods(int operation) { - int *methods = (int*)malloc(LIBGAMMA_METHOD_COUNT * sizeof(int)); - size_t n, i; + int *methods = (int *)malloc(LIBGAMMA_METHOD_COUNT * sizeof(int)); + size_t n, m, i; std::vector rc; n = libgamma_list_methods(methods, LIBGAMMA_METHOD_COUNT, operation); if (n > LIBGAMMA_METHOD_COUNT) { free(methods); - methods = (int*)malloc(n * sizeof(int)); - libgamma_list_methods(methods, n, operation); + methods = (int *)malloc(n * sizeof(int)); + m = libgamma_list_methods(methods, n, operation); + if (m < n) + n = m; } for (i = 0; i < n; i++) @@ -61,8 +63,8 @@ namespace libgamma void method_capabilities(MethodCapabilities *output, int method) { - libgamma_method_capabilities_t caps; - libgamma_method_capabilities(&caps, method); + struct libgamma_method_capabilities caps; + libgamma_method_capabilities(&caps, sizeof(caps), method); *output = MethodCapabilities(&caps); } @@ -76,7 +78,7 @@ namespace libgamma std::string * method_default_site(int method) { - char *cstr = libgamma_method_default_site(method); + const char *cstr = libgamma_method_default_site(method); if (cstr == nullptr) return nullptr; return new std::string(cstr); @@ -172,7 +174,7 @@ namespace libgamma void gamma_ramps8_initialise(GammaRamps *ramps, size_t red, size_t blue, size_t green) { - libgamma_gamma_ramps8_t native; + struct libgamma_gamma_ramps8 native; int r; native.red_size = ramps->red.size = red; native.green_size = ramps->green.size = green; @@ -198,7 +200,7 @@ namespace libgamma void gamma_ramps16_initialise(GammaRamps *ramps, size_t red, size_t blue, size_t green) { - libgamma_gamma_ramps16_t native; + struct libgamma_gamma_ramps16 native; int r; native.red_size = ramps->red.size = red; native.green_size = ramps->green.size = green; @@ -224,7 +226,7 @@ namespace libgamma void gamma_ramps32_initialise(GammaRamps *ramps, size_t red, size_t blue, size_t green) { - libgamma_gamma_ramps32_t native; + struct libgamma_gamma_ramps32 native; int r; native.red_size = ramps->red.size = red; native.green_size = ramps->green.size = green; @@ -250,7 +252,7 @@ namespace libgamma void gamma_ramps64_initialise(GammaRamps *ramps, size_t red, size_t blue, size_t green) { - libgamma_gamma_ramps64_t native; + struct libgamma_gamma_ramps64 native; int r; native.red_size = ramps->red.size = red; native.green_size = ramps->green.size = green; @@ -276,7 +278,7 @@ namespace libgamma void gamma_rampsf_initialise(GammaRamps *ramps, size_t red, size_t blue, size_t green) { - libgamma_gamma_rampsf_t native; + struct libgamma_gamma_rampsf native; int r; native.red_size = ramps->red.size = red; native.green_size = ramps->green.size = green; @@ -302,7 +304,7 @@ namespace libgamma void gamma_rampsd_initialise(GammaRamps *ramps, size_t red, size_t blue, size_t green) { - libgamma_gamma_rampsd_t native; + struct libgamma_gamma_rampsd native; int r; native.red_size = ramps->red.size = red; native.green_size = ramps->green.size = green; @@ -328,7 +330,7 @@ namespace libgamma GammaRamps * gamma_ramps8_create(size_t red, size_t blue, size_t green) { - libgamma_gamma_ramps8_t ramps; + struct libgamma_gamma_ramps8 ramps; int r; ramps.red_size = red; ramps.green_size = green; @@ -351,7 +353,7 @@ namespace libgamma GammaRamps * gamma_ramps16_create(size_t red, size_t blue, size_t green) { - libgamma_gamma_ramps16_t ramps; + struct libgamma_gamma_ramps16 ramps; int r; ramps.red_size = red; ramps.green_size = green; @@ -374,7 +376,7 @@ namespace libgamma GammaRamps * gamma_ramps32_create(size_t red, size_t blue, size_t green) { - libgamma_gamma_ramps32_t ramps; + struct libgamma_gamma_ramps32 ramps; int r; ramps.red_size = red; ramps.green_size = green; @@ -397,7 +399,7 @@ namespace libgamma GammaRamps * gamma_ramps64_create(size_t red, size_t blue, size_t green) { - libgamma_gamma_ramps64_t ramps; + struct libgamma_gamma_ramps64 ramps; int r; ramps.red_size = red; ramps.green_size = green; @@ -420,7 +422,7 @@ namespace libgamma GammaRamps * gamma_rampsf_create(size_t red, size_t blue, size_t green) { - libgamma_gamma_rampsf_t ramps; + struct libgamma_gamma_rampsf ramps; int r; ramps.red_size = red; ramps.green_size = green; @@ -443,7 +445,7 @@ namespace libgamma GammaRamps * gamma_rampsd_create(size_t red, size_t blue, size_t green) { - libgamma_gamma_rampsd_t ramps; + struct libgamma_gamma_rampsd ramps; int r; ramps.red_size = red; ramps.green_size = green; diff --git a/libgamma-method.cc b/libgamma-method.cc index 2dfee76..5447964 100644 --- a/libgamma-method.cc +++ b/libgamma-method.cc @@ -35,7 +35,7 @@ namespace libgamma * * @param caps The information in the native structure */ - MethodCapabilities::MethodCapabilities(libgamma_method_capabilities_t *caps) : + MethodCapabilities::MethodCapabilities(const struct libgamma_method_capabilities *caps) : crtc_information(caps->crtc_information), default_site_known(caps->default_site_known), multiple_sites(caps->multiple_sites), @@ -158,7 +158,7 @@ namespace libgamma * * @param info The information in the native structure */ - CRTCInformation::CRTCInformation(libgamma_crtc_information_t *info) : + CRTCInformation::CRTCInformation(libgamma_crtc_information *info) : edid(info->edid), edid_length(info->edid_length), edid_error(info->edid_error), @@ -341,7 +341,7 @@ namespace libgamma cstr = (char *)malloc((strlen(cstr_) + 1) * sizeof(char)); memcpy(cstr, cstr_, (strlen(cstr_) + 1) * sizeof(char)); } - this->native = (libgamma_site_state_t*)malloc(sizeof(libgamma_site_state_t)); + this->native = (libgamma_site_state*)malloc(sizeof(libgamma_site_state)); r = libgamma_site_initialise(this->native, method, cstr); if (r < 0) { int saved_errno = errno; @@ -401,7 +401,7 @@ namespace libgamma native(nullptr) { int r; - this->native = (libgamma_partition_state_t*)malloc(sizeof(libgamma_partition_state_t)); + this->native = (libgamma_partition_state*)malloc(sizeof(libgamma_partition_state)); r = libgamma_partition_initialise(this->native, site->native, partition); if (r < 0) { int saved_errno = errno; @@ -458,7 +458,7 @@ namespace libgamma native(nullptr) { int r; - this->native = (libgamma_crtc_state_t *)malloc(sizeof(libgamma_crtc_state_t)); + this->native = (libgamma_crtc_state *)malloc(sizeof(libgamma_crtc_state)); r = libgamma_crtc_initialise(this->native, partition->native, crtc); if (r < 0) { int saved_errno = errno; @@ -500,8 +500,8 @@ namespace libgamma bool CRTC::information(CRTCInformation *output, int32_t fields) { - libgamma_crtc_information_t info; - int r = libgamma_get_crtc_information(&info, this->native, fields); + libgamma_crtc_information info; + int r = libgamma_get_crtc_information(&info, sizeof(info), this->native, fields); *output = CRTCInformation(&info); return r != 0; } diff --git a/libgamma-method.hh b/libgamma-method.hh index 4f9339d..26c3f04 100644 --- a/libgamma-method.hh +++ b/libgamma-method.hh @@ -72,7 +72,7 @@ namespace libgamma * * @param caps The information in the native structure */ - MethodCapabilities(libgamma_method_capabilities_t *caps); + MethodCapabilities(const struct libgamma_method_capabilities *caps); /** * Copy constructor @@ -95,7 +95,7 @@ namespace libgamma /** - * OR of the CRTC information fields in `libgamma_crtc_information_t` + * OR of the CRTC information fields in `libgamma_crtc_information` * that may (but can fail) be read successfully */ int32_t crtc_information; @@ -146,20 +146,20 @@ namespace libgamma /** * Whether the `red_gamma_size`, `green_gamma_size` and `blue_gamma_size` - * fields in `libgamma_crtc_information_t` will always have the same + * fields in `libgamma_crtc_information` will always have the same * values as each other for the adjustment method */ bool identical_gamma_sizes; /** * Whether the `red_gamma_size`, `green_gamma_size` and `blue_gamma_size` - * fields in `libgamma_crtc_information_t` will always be filled with the + * fields in `libgamma_crtc_information` will always be filled with the * same value for the adjustment method */ bool fixed_gamma_size; /** - * Whether the `gamma_depth` field in `libgamma_crtc_information_t` + * Whether the `gamma_depth` field in `libgamma_crtc_information` * will always be filled with the same value for the adjustment method */ bool fixed_gamma_depth; @@ -179,13 +179,13 @@ namespace libgamma /** * Types for connectors */ - typedef libgamma_connector_type_t ConnectorType; + typedef libgamma_connector_type ConnectorType; /** * Orders for subpixels; currently the possible values are * very biased to LCD, Plasma and monochrome monitors */ - typedef libgamma_subpixel_order_t SubpixelOrder; + typedef libgamma_subpixel_order SubpixelOrder; /** @@ -204,7 +204,7 @@ namespace libgamma * * @param info The information in the native structure */ - CRTCInformation(libgamma_crtc_information_t *info); + CRTCInformation(libgamma_crtc_information *info); /** * Copy constructor @@ -675,7 +675,7 @@ namespace libgamma /** * The state in the native structure */ - libgamma_site_state_t *native; + libgamma_site_state *native; }; @@ -738,7 +738,7 @@ namespace libgamma /** * The state in the native structure */ - libgamma_partition_state_t *native; + libgamma_partition_state *native; }; @@ -786,7 +786,7 @@ namespace libgamma bool information(CRTCInformation *output, int32_t fields); #define LIBGAMMAMM_GET_GAMMA__(AFFIX)\ - libgamma_gamma_ramps##AFFIX##_t ramps_;\ + struct libgamma_gamma_ramps##AFFIX ramps_;\ int r;\ ramps_.red = ramps->red.ramp;\ ramps_.green = ramps->green.ramp;\ @@ -865,7 +865,7 @@ namespace libgamma #undef LIBGAMMAMM_GET_GAMMA__ #define LIBGAMMAMM_SET_GAMMA__(AFFIX)\ - libgamma_gamma_ramps##AFFIX##_t ramps_;\ + struct libgamma_gamma_ramps##AFFIX ramps_;\ int r;\ ramps_.red = ramps->red.ramp;\ ramps_.green = ramps->green.ramp;\ @@ -873,7 +873,7 @@ namespace libgamma ramps_.red_size = ramps->red.size;\ ramps_.green_size = ramps->green.size;\ ramps_.blue_size = ramps->blue.size;\ - r = libgamma_crtc_set_gamma_ramps##AFFIX(this->native, ramps_);\ + r = libgamma_crtc_set_gamma_ramps##AFFIX(this->native, &ramps_);\ if (r)\ throw create_error(r) @@ -959,7 +959,7 @@ namespace libgamma /** * The state in the native structure */ - libgamma_crtc_state_t *native; + libgamma_crtc_state *native; }; #ifdef __GNUC__ diff --git a/libgammamm.a b/libgammamm.a index 46f7a87..9051f9b 100644 Binary files a/libgammamm.a and b/libgammamm.a differ -- cgit v1.2.3-70-g09d2