color-manager: Take over color device management from gsd-color
Previously, gsd-color handled adding color devices. It got information
about those via the GnomeRR API, which is part of libgnome-desktop.
libgnome-desktop itself got this information from the
org.gnome.Mutter.DisplayConfig.GetResources() D-Bus method, implemented
by mutter.
Now, mutter itself will add all the monitor color devices itself,
without having to go via gsd-color.
We sometimes need to delete colord devices synchronously, in certain
race conditions when we add and remove devices very quickly (e.g. in
tests). However, we cannot use libcolord's 'sync' API variants, as it
has a nested takes-all main loop as a way to invoke the sync call. This
effectively means we end up sometimes not return from this function in a
timely manner, causing wierd issues.
Instead, create our own sync helper, that uses a separate context that
we temporarly push as the thread-default one.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2021-10-27 20:47:06 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* 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_COLOR_DEVICE_H
|
|
|
|
#define META_COLOR_DEVICE_H
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
2021-11-29 19:44:56 +00:00
|
|
|
#include <gio/gio.h>
|
color-manager: Take over color device management from gsd-color
Previously, gsd-color handled adding color devices. It got information
about those via the GnomeRR API, which is part of libgnome-desktop.
libgnome-desktop itself got this information from the
org.gnome.Mutter.DisplayConfig.GetResources() D-Bus method, implemented
by mutter.
Now, mutter itself will add all the monitor color devices itself,
without having to go via gsd-color.
We sometimes need to delete colord devices synchronously, in certain
race conditions when we add and remove devices very quickly (e.g. in
tests). However, we cannot use libcolord's 'sync' API variants, as it
has a nested takes-all main loop as a way to invoke the sync call. This
effectively means we end up sometimes not return from this function in a
timely manner, causing wierd issues.
Instead, create our own sync helper, that uses a separate context that
we temporarly push as the thread-default one.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2021-10-27 20:47:06 +00:00
|
|
|
|
|
|
|
#include "backends/meta-backend-types.h"
|
2021-11-29 19:02:34 +00:00
|
|
|
#include "core/util-private.h"
|
color-manager: Take over color device management from gsd-color
Previously, gsd-color handled adding color devices. It got information
about those via the GnomeRR API, which is part of libgnome-desktop.
libgnome-desktop itself got this information from the
org.gnome.Mutter.DisplayConfig.GetResources() D-Bus method, implemented
by mutter.
Now, mutter itself will add all the monitor color devices itself,
without having to go via gsd-color.
We sometimes need to delete colord devices synchronously, in certain
race conditions when we add and remove devices very quickly (e.g. in
tests). However, we cannot use libcolord's 'sync' API variants, as it
has a nested takes-all main loop as a way to invoke the sync call. This
effectively means we end up sometimes not return from this function in a
timely manner, causing wierd issues.
Instead, create our own sync helper, that uses a separate context that
we temporarly push as the thread-default one.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2021-10-27 20:47:06 +00:00
|
|
|
|
|
|
|
#define META_TYPE_COLOR_DEVICE (meta_color_device_get_type ())
|
|
|
|
G_DECLARE_FINAL_TYPE (MetaColorDevice, meta_color_device,
|
|
|
|
META, COLOR_DEVICE,
|
|
|
|
GObject)
|
|
|
|
|
|
|
|
MetaColorDevice * meta_color_device_new (MetaColorManager *color_manager,
|
|
|
|
MetaMonitor *monitor);
|
|
|
|
|
|
|
|
void meta_color_device_destroy (MetaColorDevice *color_device);
|
|
|
|
|
|
|
|
void meta_color_device_update_monitor (MetaColorDevice *color_device,
|
|
|
|
MetaMonitor *monitor);
|
|
|
|
|
2021-12-01 17:57:52 +00:00
|
|
|
META_EXPORT_TEST
|
color-manager: Take over color device management from gsd-color
Previously, gsd-color handled adding color devices. It got information
about those via the GnomeRR API, which is part of libgnome-desktop.
libgnome-desktop itself got this information from the
org.gnome.Mutter.DisplayConfig.GetResources() D-Bus method, implemented
by mutter.
Now, mutter itself will add all the monitor color devices itself,
without having to go via gsd-color.
We sometimes need to delete colord devices synchronously, in certain
race conditions when we add and remove devices very quickly (e.g. in
tests). However, we cannot use libcolord's 'sync' API variants, as it
has a nested takes-all main loop as a way to invoke the sync call. This
effectively means we end up sometimes not return from this function in a
timely manner, causing wierd issues.
Instead, create our own sync helper, that uses a separate context that
we temporarly push as the thread-default one.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2021-10-27 20:47:06 +00:00
|
|
|
const char * meta_color_device_get_id (MetaColorDevice *color_device);
|
|
|
|
|
2021-11-29 19:02:34 +00:00
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaMonitor * meta_color_device_get_monitor (MetaColorDevice *color_device);
|
|
|
|
|
2021-11-29 19:44:56 +00:00
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaColorProfile * meta_color_device_get_device_profile (MetaColorDevice *color_device);
|
|
|
|
|
2021-12-01 17:57:52 +00:00
|
|
|
META_EXPORT_TEST
|
|
|
|
MetaColorProfile * meta_color_device_get_assigned_profile (MetaColorDevice *color_device);
|
|
|
|
|
2021-11-29 19:44:56 +00:00
|
|
|
void meta_color_device_generate_profile (MetaColorDevice *color_device,
|
|
|
|
const char *file_path,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
MetaColorProfile * meta_color_device_generate_profile_finish (MetaColorDevice *color_device,
|
|
|
|
GAsyncResult *res,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
META_EXPORT_TEST
|
|
|
|
gboolean meta_color_device_is_ready (MetaColorDevice *color_device);
|
|
|
|
|
2021-12-06 10:51:22 +00:00
|
|
|
void meta_color_device_update (MetaColorDevice *color_device,
|
|
|
|
unsigned int temperature);
|
2021-12-03 23:49:25 +00:00
|
|
|
|
2022-08-09 20:56:04 +00:00
|
|
|
META_EXPORT_TEST
|
|
|
|
void meta_set_color_efivar_test_path (const char *path);
|
|
|
|
|
color-manager: Take over color device management from gsd-color
Previously, gsd-color handled adding color devices. It got information
about those via the GnomeRR API, which is part of libgnome-desktop.
libgnome-desktop itself got this information from the
org.gnome.Mutter.DisplayConfig.GetResources() D-Bus method, implemented
by mutter.
Now, mutter itself will add all the monitor color devices itself,
without having to go via gsd-color.
We sometimes need to delete colord devices synchronously, in certain
race conditions when we add and remove devices very quickly (e.g. in
tests). However, we cannot use libcolord's 'sync' API variants, as it
has a nested takes-all main loop as a way to invoke the sync call. This
effectively means we end up sometimes not return from this function in a
timely manner, causing wierd issues.
Instead, create our own sync helper, that uses a separate context that
we temporarly push as the thread-default one.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2021-10-27 20:47:06 +00:00
|
|
|
#endif /* META_COLOR_DEVICE_H */
|