[vte/vte-next: 44/47] Store background saturation as double
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 44/47] Store background saturation as double
- Date: Tue, 3 May 2011 00:08:39 +0000 (UTC)
commit 453ef8d4610698b9260fde80d80ec78fc5f8c6fb
Author: Christian Persch <chpe gnome org>
Date: Tue May 3 00:15:19 2011 +0200
Store background saturation as double
src/vte-private.h | 3 +--
src/vte.c | 20 +++++++++-----------
2 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 5076f83..e1afe13 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -62,7 +62,6 @@ G_BEGIN_DECLS
/* More color defines in ring.h */
#define VTE_SCROLLBACK_INIT 100
-#define VTE_SATURATION_MAX 10000
#define VTE_DEFAULT_CURSOR GDK_XTERM
#define VTE_MOUSING_CURSOR GDK_LEFT_PTR
#define VTE_TAB_MAX 999
@@ -370,7 +369,7 @@ struct _VteTerminalPrivate {
GdkPixbuf *bg_pixbuf;
char *bg_file;
GdkRGBA bg_tint_color;
- guint16 bg_saturation; /* out of VTE_SATURATION_MAX */
+ double bg_saturation; /* 0.0 .. 1.0 */
/* Key modifiers. */
GdkModifierType modifiers;
diff --git a/src/vte.c b/src/vte.c
index e650a85..be43124 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -7809,7 +7809,7 @@ vte_terminal_init(VteTerminal *terminal)
pvt->bg_tint_color.green = 0.;
pvt->bg_tint_color.blue = 0.;
pvt->bg_tint_color.alpha = 1.;
- pvt->bg_saturation = 0.4 * VTE_SATURATION_MAX;
+ pvt->bg_saturation = 0.4;
pvt->selection_block_mode = FALSE;
pvt->has_fonts = FALSE;
pvt->root_pixmap_changed_tag = 0;
@@ -10776,7 +10776,7 @@ vte_terminal_get_property (GObject *object,
g_value_set_object (value, pvt->bg_pixbuf);
break;
case PROP_BACKGROUND_SATURATION:
- g_value_set_double (value, (double) pvt->bg_saturation / (double) VTE_SATURATION_MAX);
+ g_value_set_double (value, pvt->bg_saturation);
break;
case PROP_BACKGROUND_TINT_COLOR:
g_value_set_boxed (value, &pvt->bg_tint_color);
@@ -12289,7 +12289,7 @@ vte_terminal_im_append_menuitems(VteTerminal *terminal, GtkMenuShell *menushell)
static gboolean
vte_terminal_background_update(VteTerminal *terminal)
{
- double saturation;
+ double saturation;
const PangoColor *entry;
GdkColor color;
GdkRGBA rgba;
@@ -12327,8 +12327,7 @@ vte_terminal_background_update(VteTerminal *terminal)
/* If we're transparent, and either have no root image or are being
* told to update it, get a new copy of the root window. */
- saturation = (double) terminal->pvt->bg_saturation;
- saturation /= VTE_SATURATION_MAX;
+ saturation = terminal->pvt->bg_saturation;
if (terminal->pvt->bg_transparent) {
if (terminal->pvt->root_pixmap_changed_tag == 0) {
VteBg *bg;
@@ -12412,21 +12411,20 @@ void
vte_terminal_set_background_saturation(VteTerminal *terminal, double saturation)
{
VteTerminalPrivate *pvt;
- guint v;
g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(saturation >= 0.0 && saturation <= 1.0);
pvt = terminal->pvt;
- v = CLAMP(saturation * VTE_SATURATION_MAX, 0, VTE_SATURATION_MAX);
- if (v == pvt->bg_saturation)
+ if (saturation == pvt->bg_saturation)
return;
_vte_debug_print(VTE_DEBUG_MISC,
- "Setting background saturation to %d/%d.\n",
- v, VTE_SATURATION_MAX);
+ "Setting background saturation to %.3f\n",
+ saturation);
- pvt->bg_saturation = v;
+ pvt->bg_saturation = saturation;
g_object_notify(G_OBJECT (terminal), "background-saturation");
vte_terminal_queue_background_update(terminal);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]