libgimpwidgets: add gimp_screen_get_color_profile()

and use it in gimp_widget_get_color_profile(). Will soon be used in
screenshot too.
This commit is contained in:
Michael Natterer 2017-01-31 18:58:27 +01:00
parent 2dbf1b46b2
commit eb9981e5e4
3 changed files with 42 additions and 15 deletions

View File

@ -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

View File

@ -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)

View File

@ -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,