diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def index d146b7e19f..514597a650 100644 --- a/libgimpwidgets/gimpwidgets.def +++ b/libgimpwidgets/gimpwidgets.def @@ -357,6 +357,7 @@ EXPORTS gimp_scale_entry_new gimp_scale_entry_set_logarithmic gimp_scale_entry_set_sensitive + gimp_screen_get_color_profile gimp_scrolled_preview_freeze gimp_scrolled_preview_get_type gimp_scrolled_preview_set_policy diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c index 54a409d575..865abff642 100644 --- a/libgimpwidgets/gimpwidgetsutils.c +++ b/libgimpwidgets/gimpwidgetsutils.c @@ -470,25 +470,27 @@ gimp_widget_track_monitor (GtkWidget *widget, track_monitor_hierarchy_changed (widget, NULL, track_data); } +/** + * gimp_screen_get_color_profile: + * @screen: a #GdkScreen + * @monitor: the monitor number + * + * This function returns the #GimpColorProfile of monitor number @monitor + * of @screen, or %NULL if there is no profile configured. + * + * Since: 2.10 + * + * Return value: the monitor's #GimpColorProfile, or %NULL. + **/ GimpColorProfile * -gimp_widget_get_color_profile (GtkWidget *widget) +gimp_screen_get_color_profile (GdkScreen *screen, + gint monitor) { GimpColorProfile *profile = NULL; - GdkScreen *screen; - gint monitor; - g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), NULL); - - if (widget) - { - screen = gtk_widget_get_screen (widget); - monitor = gimp_widget_get_monitor (widget); - } - else - { - screen = gdk_screen_get_default (); - monitor = 0; - } + g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); + g_return_val_if_fail (monitor >= 0, NULL); + g_return_val_if_fail (monitor < gdk_screen_get_n_monitors (screen), NULL); #if defined GDK_WINDOWING_X11 { @@ -579,6 +581,28 @@ gimp_widget_get_color_profile (GtkWidget *widget) return profile; } +GimpColorProfile * +gimp_widget_get_color_profile (GtkWidget *widget) +{ + GdkScreen *screen; + gint monitor; + + g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), NULL); + + if (widget) + { + screen = gtk_widget_get_screen (widget); + monitor = gimp_widget_get_monitor (widget); + } + else + { + screen = gdk_screen_get_default (); + monitor = 0; + } + + return gimp_screen_get_color_profile (screen, monitor); +} + static GimpColorProfile * get_display_profile (GtkWidget *widget, GimpColorConfig *config) diff --git a/libgimpwidgets/gimpwidgetsutils.h b/libgimpwidgets/gimpwidgetsutils.h index 9955293e5e..66c168fca1 100644 --- a/libgimpwidgets/gimpwidgetsutils.h +++ b/libgimpwidgets/gimpwidgetsutils.h @@ -50,6 +50,8 @@ void gimp_widget_track_monitor (GtkWidget *widget, GCallback monitor_changed_callback, gpointer user_data); +GimpColorProfile * gimp_screen_get_color_profile (GdkScreen *screen, + gint monitor); GimpColorProfile * gimp_widget_get_color_profile (GtkWidget *widget); GimpColorTransform * gimp_widget_get_color_transform (GtkWidget *widget,