[vte/vte-next: 44/114] Store background saturation as double
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 44/114] Store background saturation as double
- Date: Mon, 30 May 2011 17:10:26 +0000 (UTC)
commit 8b8facb7d0c758608c4896381b8743d2a8322b85
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 c908733..0277441 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -7807,7 +7807,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;
@@ -10774,7 +10774,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);
@@ -12287,7 +12287,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;
@@ -12325,8 +12325,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;
@@ -12410,21 +12409,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]