[gnome-color-manager] Add a GConf key to switch between CLUT (defautl) or _ICC_PROFILE profile operation
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Add a GConf key to switch between CLUT (defautl) or _ICC_PROFILE profile operation
- Date: Mon, 9 Nov 2009 16:08:09 +0000 (UTC)
commit 4f02d95c59cfcb4d2ef56d626247c5d79d1aec5c
Author: Richard Hughes <richard hughsie com>
Date: Mon Nov 9 16:07:18 2009 +0000
Add a GConf key to switch between CLUT (defautl) or _ICC_PROFILE profile operation
data/gcm-prefs.ui | 620 +++++++++++++++++++++++------------
data/gnome-color-manager.schemas.in | 12 +
src/gcm-prefs.c | 101 ++++++
src/gcm-utils.c | 79 ++++--
src/gcm-xserver.c | 100 ++++++
src/gcm-xserver.h | 5 +
6 files changed, 691 insertions(+), 226 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index 88606d5..0025dbd 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -14,342 +14,552 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkNotebook" id="notebook_prefs">
<property name="visible">True</property>
- <property name="spacing">9</property>
- <property name="homogeneous">True</property>
+ <property name="can_focus">True</property>
<child>
- <object class="GtkVBox" id="vbox_devices">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="border_width">9</property>
+ <property name="spacing">9</property>
+ <property name="homogeneous">True</property>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <object class="GtkVBox" id="vbox_devices">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkTreeView" id="treeview_devices">
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="headers_visible">False</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview_devices">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">9</property>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">9</property>
<child>
- <object class="GtkLabel" id="label_profile">
+ <object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
- <property name="label" translatable="yes">Color Profile:</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <child>
+ <object class="GtkLabel" id="label_profile">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color Profile:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="combobox_profile">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
<child>
- <object class="GtkTable" id="table_details">
+ <object class="GtkComboBox" id="combobox_profile">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">3</property>
- <property name="row_spacing">3</property>
<child>
- <object class="GtkHBox" id="hbox5">
+ <object class="GtkTable" id="table_details">
<property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">3</property>
+ <property name="row_spacing">3</property>
<child>
- <object class="GtkLabel" id="label_title_vendor">
+ <object class="GtkHBox" id="hbox5">
<property name="visible">True</property>
- <property name="label" translatable="yes">Vendor:</property>
+ <child>
+ <object class="GtkLabel" id="label_title_vendor">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Vendor:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label_title_copyright">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">License:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
- </object>
- </child>
- <child>
- <object class="GtkHBox" id="hbox10">
- <property name="visible">True</property>
<child>
- <object class="GtkLabel" id="label_title_copyright">
+ <object class="GtkHBox" id="hbox11">
<property name="visible">True</property>
- <property name="label" translatable="yes">License:</property>
+ <child>
+ <object class="GtkLabel" id="label_vendor">
+ <property name="visible">True</property>
+ <property name="label">The hardware vendor</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox11">
- <property name="visible">True</property>
<child>
- <object class="GtkLabel" id="label_vendor">
+ <object class="GtkHBox" id="hbox12">
<property name="visible">True</property>
- <property name="label">The hardware vendor</property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
+ <child>
+ <object class="GtkLabel" id="label_copyright">
+ <property name="visible">True</property>
+ <property name="label">Usually non-free</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkExpander" id="expander1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<child>
- <object class="GtkHBox" id="hbox12">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">3</property>
+ <property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label_copyright">
+ <object class="GtkHScale" id="hscale_gamma">
<property name="visible">True</property>
- <property name="label">Usually non-free</property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
+ <property name="can_focus">True</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="value_pos">right</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label_gamma">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Gamma:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkHScale" id="hscale_brightness">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="digits">0</property>
+ <property name="value_pos">right</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHScale" id="hscale_contrast">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="digits">0</property>
+ <property name="value_pos">right</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label_brightness">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Brightness:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label_contrast">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Contrast:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Fine tuning:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkButton" id="button_calibrate">
+ <property name="label" translatable="yes">_Calibrate</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_reset">
+ <property name="label" translatable="yes">_Reset to defaults</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label_devices">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Devices</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox">
+ <property name="visible">True</property>
+ <property name="border_width">9</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">9</property>
+ <child>
+ <object class="GtkHBox" id="hbox_display">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Display:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">3</property>
+ <child>
+ <object class="GtkRadioButton" id="radiobutton_ouput_global">
+ <property name="label" translatable="yes">Apply _global display correction</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="radiobutton_ouput_atom">
+ <property name="label" translatable="yes">_Use profile when viewing images</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_ouput_global</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox13">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Rendering intent:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkExpander" id="expander1">
+ <object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkTable" id="table1">
+ <object class="GtkHBox" id="hbox14">
<property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">3</property>
- <property name="row_spacing">6</property>
+ <property name="spacing">9</property>
+ <property name="homogeneous">True</property>
<child>
- <object class="GtkHScale" id="hscale_gamma">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="restrict_to_fill_level">False</property>
- <property name="fill_level">1</property>
- <property name="value_pos">right</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox7">
+ <object class="GtkHBox" id="hbox15">
<property name="visible">True</property>
<child>
- <object class="GtkLabel" id="label_gamma">
+ <object class="GtkLabel" id="label_rendering_display">
<property name="visible">True</property>
- <property name="label" translatable="yes">Gamma:</property>
+ <property name="label" translatable="yes">Display:</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
- </child>
- <child>
- <object class="GtkHScale" id="hscale_brightness">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="restrict_to_fill_level">False</property>
- <property name="fill_level">1</property>
- <property name="digits">0</property>
- <property name="value_pos">right</property>
- </object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHScale" id="hscale_contrast">
+ <object class="GtkComboBox" id="combobox_rendering_display">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="restrict_to_fill_level">False</property>
- <property name="fill_level">1</property>
- <property name="digits">0</property>
- <property name="value_pos">right</property>
+ <property name="sensitive">False</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="expand">False</property>
+ <property name="position">1</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox16">
+ <property name="visible">True</property>
+ <property name="spacing">9</property>
+ <property name="homogeneous">True</property>
<child>
- <object class="GtkHBox" id="hbox8">
+ <object class="GtkHBox" id="hbox17">
<property name="visible">True</property>
<child>
- <object class="GtkLabel" id="label_brightness">
+ <object class="GtkLabel" id="label_rendering_softproof">
<property name="visible">True</property>
- <property name="label" translatable="yes">Brightness:</property>
+ <property name="label" translatable="yes">Softproof:</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox9">
+ <object class="GtkComboBox" id="combobox_rendering_softproof">
<property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label_contrast">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Contrast:</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="sensitive">False</property>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="expand">False</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Fine tuning:</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkButton" id="button_calibrate">
- <property name="label" translatable="yes">_Calibrate</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button_reset">
- <property name="label" translatable="yes">_Reset to defaults</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">4</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label_defaults">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Defaults</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
</packing>
</child>
</object>
diff --git a/data/gnome-color-manager.schemas.in b/data/gnome-color-manager.schemas.in
index 464e419..bdb848b 100644
--- a/data/gnome-color-manager.schemas.in
+++ b/data/gnome-color-manager.schemas.in
@@ -17,6 +17,18 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/gnome-color-manager/global_display_correction</key>
+ <applyto>/apps/gnome-color-manager/global_display_correction</applyto>
+ <owner>gnome-color-manager</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>If the display should be globally corrected or left to applications.</short>
+ <long>If set to TRUE then the video LUT is set with the display profile and applications will have nothing to read from __ICC_PROFILE</long>
+ </locale>
+ </schema>
+
</schemalist>
</gconfschemafile>
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 530bf55..eecdf02 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -26,6 +26,7 @@
#include <glib/gstdio.h>
#include <gudev/gudev.h>
#include <libgnomeui/gnome-rr.h>
+#include <gconf/gconf-client.h>
#include "egg-debug.h"
@@ -45,6 +46,7 @@ static GcmClient *gcm_client = NULL;
static gboolean setting_up_device = FALSE;
static GtkWidget *info_bar = NULL;
static guint loading_refcount = 0;
+static GConfClient *gconf_client = NULL;
enum {
GPM_DEVICES_COLUMN_ID,
@@ -1026,6 +1028,64 @@ out:
}
/**
+ * gcm_prefs_reset_devices_idle_cb:
+ **/
+static gboolean
+gcm_prefs_reset_devices_idle_cb (gpointer user_data)
+{
+ GPtrArray *array = NULL;
+ GcmDevice *device;
+ GcmDeviceType type;
+ GError *error = NULL;
+ gboolean ret;
+ guint i;
+
+ /* set for each output */
+ array = gcm_client_get_devices (gcm_client);
+ for (i=0; i<array->len; i++) {
+ device = g_ptr_array_index (array, i);
+ g_object_get (device,
+ "type", &type,
+ NULL);
+
+ /* not a xrandr panel */
+ if (type != GCM_DEVICE_TYPE_DISPLAY)
+ continue;
+
+ /* set gamma for device */
+ ret = gcm_utils_set_gamma_for_device (device, &error);
+ if (!ret) {
+ egg_warning ("failed to set gamma: %s", error->message);
+ g_error_free (error);
+ break;
+ }
+ }
+ g_ptr_array_unref (array);
+ return FALSE;
+}
+
+/**
+ * gcm_prefs_radio_cb:
+ **/
+static void
+gcm_prefs_radio_cb (GtkWidget *widget, gpointer user_data)
+{
+ const gchar *name;
+ gboolean ret = FALSE;
+
+ /* find out what button was pressed */
+ name = gtk_widget_get_name (widget);
+ if (g_strcmp0 (name, "radiobutton_ouput_global") == 0)
+ ret = TRUE;
+
+ /* save new preference */
+ gconf_client_set_bool (gconf_client, "/apps/gnome-color-manager/global_display_correction", ret, NULL);
+
+ /* set the new setting */
+ g_idle_add ((GSourceFunc) gcm_prefs_reset_devices_idle_cb, NULL);
+}
+
+/**
* main:
**/
int
@@ -1040,6 +1100,7 @@ main (int argc, char **argv)
guint xid = 0;
GError *error = NULL;
GMainLoop *loop;
+ gboolean ret;
GtkTreeSelection *selection;
const gchar *subsystems[] = {"usb", NULL};
GtkWidget *info_bar_label;
@@ -1142,6 +1203,25 @@ main (int argc, char **argv)
g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (gcm_prefs_profile_combo_changed_cb), NULL);
+ /* setup rendering lists */
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_rendering_display"));
+ gcm_prefs_set_combo_simple_text (widget);
+ gtk_widget_set_sensitive (widget, FALSE);
+// g_signal_connect (G_OBJECT (widget), "changed",
+// G_CALLBACK (gcm_prefs_profile_combo_changed_cb), NULL);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Perceptual");
+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_rendering_softproof"));
+ gcm_prefs_set_combo_simple_text (widget);
+ gtk_widget_set_sensitive (widget, FALSE);
+// g_signal_connect (G_OBJECT (widget), "changed",
+// G_CALLBACK (gcm_prefs_profile_combo_changed_cb), NULL);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Perceptual");
+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
+
+
+
/* set ranges */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "hscale_gamma"));
gtk_range_set_range (GTK_RANGE (widget), 0.1f, 5.0f);
@@ -1204,6 +1284,25 @@ main (int argc, char **argv)
g_signal_connect (widget, "value-changed",
G_CALLBACK (gcm_prefs_slider_changed_cb), NULL);
+ /* setup defaults */
+ gconf_client = gconf_client_get_default ();
+ ret = gconf_client_get_bool (gconf_client, "/apps/gnome-color-manager/global_display_correction", NULL);
+ if (ret) {
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "radiobutton_ouput_global"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ } else {
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "radiobutton_ouput_atom"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ }
+
+ /* now connect radiobuttons */
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "radiobutton_ouput_global"));
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (gcm_prefs_radio_cb), NULL);
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "radiobutton_ouput_atom"));
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (gcm_prefs_radio_cb), NULL);
+
/* do all this after the window has been set up */
g_idle_add (gcm_prefs_startup_idle_cb, NULL);
@@ -1219,6 +1318,8 @@ out:
gnome_rr_screen_destroy (rr_screen);
if (client != NULL)
g_object_unref (client);
+ if (gconf_client != NULL)
+ g_object_unref (gconf_client);
if (builder != NULL)
g_object_unref (builder);
if (profiles_array != NULL)
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index aab7fa2..c18abbe 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -27,6 +27,7 @@
#include <libgnomeui/gnome-rr.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/xf86vmode.h>
+#include <gconf/gconf-client.h>
#include "gcm-utils.h"
#include "gcm-clut.h"
@@ -225,8 +226,14 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
gchar *output_name;
gchar *id = NULL;
guint size;
+ gboolean use_global;
+ gboolean leftmost_screen = FALSE;
GcmDeviceType type;
GnomeRRScreen *rr_screen = NULL;
+ GConfClient *gconf_client = NULL;
+
+ /* use gconf to decide to set LUT or set ATOMs */
+ gconf_client = gconf_client_get_default ();
/* get details about the device */
g_object_get (device,
@@ -265,51 +272,81 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
goto out;
}
+ /* get gamma table size */
size = gcm_utils_get_gamma_size (crtc, error);
if (size == 0)
goto out;
/* create CLUT */
clut = gcm_clut_new ();
- g_object_set (clut,
- "profile", profile,
- "gamma", gamma,
- "brightness", brightness,
- "contrast", contrast,
- "size", size,
- NULL);
- /* load */
- ret = gcm_clut_load_from_profile (clut, error);
- if (!ret)
- goto out;
+ /* only set the CLUT if we're not seting the atom */
+ use_global = gconf_client_get_bool (gconf_client, "/apps/gnome-color-manager/global_display_correction", NULL);
+ if (use_global) {
+ g_object_set (clut,
+ "profile", profile,
+ "gamma", gamma,
+ "brightness", brightness,
+ "contrast", contrast,
+ "size", size,
+ NULL);
+
+ /* load this new profile */
+ ret = gcm_clut_load_from_profile (clut, error);
+ if (!ret)
+ goto out;
+ } else {
+ /* we're using a dummy clut */
+ g_object_set (clut,
+ "size", size,
+ NULL);
+ }
/* actually set the gamma */
ret = gcm_utils_set_gamma_for_crtc (crtc, clut, error);
if (!ret)
goto out;
- /* no profile to set */
- if (profile == NULL)
- goto out;
-
- /* set the per-output profile atoms */
+ /* set per output and per-screen atoms */
xserver = gcm_xserver_new ();
- ret = gcm_xserver_set_output_profile (xserver, output_name, profile, error);
- if (!ret)
- goto out;
/* is the monitor our primary monitor */
gnome_rr_output_get_position (output, &x, &y);
- if (x == 0 && y == 0 && profile != NULL) {
- ret = gcm_xserver_set_root_window_profile (xserver, profile, error);
+ leftmost_screen = (x == 0 && y == 0);
+
+ /* either remove the atoms or set them */
+ if (use_global || profile == NULL) {
+
+ /* remove the output atom if there's nothing to show */
+ ret = gcm_xserver_remove_output_profile (xserver, output_name, error);
if (!ret)
goto out;
+
+ /* primary screen */
+ if (leftmost_screen) {
+ ret = gcm_xserver_remove_root_window_profile (xserver, error);
+ if (!ret)
+ goto out;
+ }
+ } else {
+ /* set the per-output and per screen profile atoms */
+ ret = gcm_xserver_set_output_profile (xserver, output_name, profile, error);
+ if (!ret)
+ goto out;
+
+ /* primary screen */
+ if (leftmost_screen) {
+ ret = gcm_xserver_set_root_window_profile (xserver, profile, error);
+ if (!ret)
+ goto out;
+ }
}
out:
g_free (id);
g_free (profile);
g_free (output_name);
+ if (gconf_client != NULL)
+ g_object_unref (gconf_client);
if (rr_screen != NULL)
gnome_rr_screen_destroy (rr_screen);
if (clut != NULL)
diff --git a/src/gcm-xserver.c b/src/gcm-xserver.c
index e01ed62..f0ea0e1 100644
--- a/src/gcm-xserver.c
+++ b/src/gcm-xserver.c
@@ -221,6 +221,51 @@ out:
}
/**
+ * gcm_xserver_remove_root_window_profile:
+ * @xserver: a valid %GcmXserver instance
+ * @error: a %GError that is set in the result of an error, or %NULL
+ * Return value: %TRUE for success.
+ *
+ * Removes the ICC profile data from the XServer.
+ **/
+gboolean
+gcm_xserver_remove_root_window_profile (GcmXserver *xserver, GError **error)
+{
+ const gchar *atom_name;
+ Atom atom = None;
+ gint rc;
+ gboolean ret = TRUE;
+ GcmXserverPrivate *priv = xserver->priv;
+
+ g_return_val_if_fail (GCM_IS_XSERVER (xserver), FALSE);
+
+ egg_debug ("removing root window ICC profile atom");
+
+ /* get the atom name */
+ atom_name = "_ICC_PROFILE";
+
+ /* get the value */
+ gdk_error_trap_push ();
+ atom = gdk_x11_get_xatom_by_name_for_display (priv->display_gdk, atom_name);
+ rc = XDeleteProperty(priv->display, priv->window, atom);
+ gdk_error_trap_pop ();
+
+ /* this fails with BadRequest if the atom was not set */
+ if (rc == BadRequest)
+ rc = Success;
+
+ /* did the call fail */
+ if (rc != Success) {
+ ret = FALSE;
+ if (error != NULL)
+ *error = g_error_new (1, 0, "failed to delete %s root window atom with rc %i", atom_name, rc);
+ goto out;
+ }
+out:
+ return ret;
+}
+
+/**
* gcm_xserver_get_output_profile_data:
*
* @xserver: a valid %GcmXserver instance
@@ -405,6 +450,61 @@ out:
}
/**
+ * gcm_xserver_remove_output_profile:
+ * @xserver: a valid %GcmXserver instance
+ * @output_name: the output name, e.g. "LVDS1"
+ * @error: a %GError that is set in the result of an error, or %NULL
+ * Return value: %TRUE for success.
+ *
+ * Sets the ICC profile data to the specified output.
+ **/
+gboolean
+gcm_xserver_remove_output_profile (GcmXserver *xserver, const gchar *output_name, GError **error)
+{
+ gboolean ret = FALSE;
+ const gchar *atom_name;
+ gint rc;
+ gint i;
+ Atom atom = None;
+ XRROutputInfo *output;
+ XRRScreenResources *resources = NULL;
+ GcmXserverPrivate *priv = xserver->priv;
+
+ g_return_val_if_fail (GCM_IS_XSERVER (xserver), FALSE);
+
+ /* get the atom name */
+ atom_name = "_ICC_PROFILE";
+
+ /* get the value */
+ gdk_error_trap_push ();
+ atom = gdk_x11_get_xatom_by_name_for_display (priv->display_gdk, atom_name);
+ resources = XRRGetScreenResources (priv->display, priv->window);
+ for (i = 0; i < resources->noutput; ++i) {
+ output = XRRGetOutputInfo (priv->display, resources, resources->outputs[i]);
+ if (g_strcmp0 (output->name, output_name) == 0) {
+ egg_debug ("found %s, removing atom", output_name);
+ XRRDeleteOutputProperty (priv->display, resources->outputs[i], atom);
+ }
+ XRRFreeOutputInfo (output);
+ }
+ rc = gdk_error_trap_pop ();
+
+ /* did the call fail */
+ if (rc != Success) {
+ if (error != NULL)
+ *error = g_error_new (1, 0, "failed to remove output %s atom with rc %i", atom_name, rc);
+ goto out;
+ }
+
+ /* success */
+ ret = TRUE;
+out:
+ if (resources != NULL)
+ XRRFreeScreenResources (resources);
+ return ret;
+}
+
+/**
* gcm_xserver_get_property:
**/
static void
diff --git a/src/gcm-xserver.h b/src/gcm-xserver.h
index 807e2d5..bf9a25c 100644
--- a/src/gcm-xserver.h
+++ b/src/gcm-xserver.h
@@ -69,6 +69,8 @@ gboolean gcm_xserver_set_root_window_profile_data (GcmXserver *xserver,
gboolean gcm_xserver_set_root_window_profile (GcmXserver *xserver,
const gchar *filename,
GError **error);
+gboolean gcm_xserver_remove_root_window_profile (GcmXserver *xserver,
+ GError **error);
/* per output */
gboolean gcm_xserver_get_output_profile_data (GcmXserver *xserver,
@@ -85,6 +87,9 @@ gboolean gcm_xserver_set_output_profile (GcmXserver *xserver,
const gchar *output_name,
const gchar *filename,
GError **error);
+gboolean gcm_xserver_remove_output_profile (GcmXserver *xserver,
+ const gchar *output_name,
+ GError **error);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]