~smspillaz/compiz-core/compiz-core.fix_894639

« back to all changes in this revision

Viewing changes to gtk/window-decorator/settings.c

  • Committer: Sam Spilsbury
  • Date: 2011-10-26 23:18:47 UTC
  • mfrom: (2879.1.9 compiz-core)
  • Revision ID: sam.spilsbury@canonical.com-20111026231847-brgt5gqfqlaas1wp
Merge lp:~compiz-team/compiz-core/compiz-core.fix_873344_873364 

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    if (result != Success)
47
47
        return FALSE;
48
48
 
49
 
    if (n == 4)
 
49
    if (n == 8)
50
50
    {
51
51
        long *data      = (long *) prop_data;
52
 
        gdouble radius  = data[0];
53
 
        gdouble opacity = data[1];
54
 
        gint x_off      = data[2];
55
 
        gint y_off      = data[3];
 
52
        gdouble aradius  = data[0];
 
53
        gdouble aopacity = data[1];
 
54
        gint ax_off      = data[2];
 
55
        gint ay_off      = data[3];
56
56
 
 
57
        gdouble iradius  = data[4];
 
58
        gdouble iopacity = data[5];
 
59
        gint ix_off      = data[6];
 
60
        gint iy_off      = data[7];
57
61
        /* Radius and Opacity are multiplied by 1000 to keep precision,
58
62
         * divide by that much to get our real radius and opacity
59
63
         */
60
 
        radius /= 1000;
61
 
        opacity /= 1000;
62
 
 
63
 
        changed = radius != settings->shadow_radius   ||
64
 
                  opacity != settings->shadow_opacity ||
65
 
                  x_off != settings->shadow_offset_x  ||
66
 
                  y_off != settings->shadow_offset_y;
67
 
 
68
 
        settings->shadow_radius = (gdouble) MAX (0.0, MIN (radius, 48.0));
69
 
        settings->shadow_opacity = (gdouble) MAX (0.0, MIN (opacity, 6.0));
70
 
        settings->shadow_offset_x = (gint) MAX (-16, MIN (x_off, 16));
71
 
        settings->shadow_offset_y = (gint) MAX (-16, MIN (y_off, 16));
 
64
        aradius /= 1000;
 
65
        aopacity /= 1000;
 
66
        iradius /= 1000;
 
67
        iopacity /= 1000;
 
68
 
 
69
        changed = aradius != settings->active_shadow_radius   ||
 
70
                  aopacity != settings->active_shadow_opacity ||
 
71
                  ax_off != settings->active_shadow_offset_x  ||
 
72
                  ay_off != settings->active_shadow_offset_y ||
 
73
                  iradius != settings->inactive_shadow_radius   ||
 
74
                  iopacity != settings->inactive_shadow_opacity ||
 
75
                  ix_off != settings->inactive_shadow_offset_x  ||
 
76
                  iy_off != settings->inactive_shadow_offset_y;
 
77
 
 
78
        settings->active_shadow_radius = (gdouble) MAX (0.0, MIN (aradius, 48.0));
 
79
        settings->active_shadow_opacity = (gdouble) MAX (0.0, MIN (aopacity, 6.0));
 
80
        settings->active_shadow_offset_x = (gint) MAX (-16, MIN (ax_off, 16));
 
81
        settings->active_shadow_offset_y = (gint) MAX (-16, MIN (ay_off, 16));
 
82
        settings->inactive_shadow_radius = (gdouble) MAX (0.0, MIN (iradius, 48.0));
 
83
        settings->inactive_shadow_opacity = (gdouble) MAX (0.0, MIN (iopacity, 6.0));
 
84
        settings->inactive_shadow_offset_x = (gint) MAX (-16, MIN (ix_off, 16));
 
85
        settings->inactive_shadow_offset_y = (gint) MAX (-16, MIN (iy_off, 16));
72
86
    }
73
87
 
74
88
    XFree (prop_data);
83
97
        
84
98
        XTextPropertyToStringList (&shadow_color_xtp, &t_data, &ret_count);
85
99
        
86
 
        if (ret_count == 1)
 
100
        if (ret_count == 2)
87
101
        {
88
102
            int c[4];
89
103
 
90
104
            if (sscanf (t_data[0], "#%2x%2x%2x%2x",
91
105
                        &c[0], &c[1], &c[2], &c[3]) == 4)
92
106
            {
93
 
                settings->shadow_color[0] = c[0] << 8 | c[0];
94
 
                settings->shadow_color[1] = c[1] << 8 | c[1];
95
 
                settings->shadow_color[2] = c[2] << 8 | c[2];
 
107
                settings->active_shadow_color[0] = c[0] << 8 | c[0];
 
108
                settings->active_shadow_color[1] = c[1] << 8 | c[1];
 
109
                settings->active_shadow_color[2] = c[2] << 8 | c[2];
 
110
                changed = TRUE;
 
111
            }
 
112
 
 
113
            if (sscanf (t_data[1], "#%2x%2x%2x%2x",
 
114
                        &c[0], &c[1], &c[2], &c[3]) == 4)
 
115
            {
 
116
                settings->inactive_shadow_color[0] = c[0] << 8 | c[0];
 
117
                settings->inactive_shadow_color[1] = c[1] << 8 | c[1];
 
118
                settings->inactive_shadow_color[2] = c[2] << 8 | c[2];
96
119
                changed = TRUE;
97
120
            }
98
121
        }
107
130
 
108
131
#ifdef USE_GCONF
109
132
static gboolean
 
133
use_tooltips_changed (GConfClient *client)
 
134
{
 
135
    gboolean      new_use_tooltips;
 
136
    gboolean      use_tooltips = settings->use_tooltips;
 
137
 
 
138
    new_use_tooltips = gconf_client_get_bool (client,
 
139
                                              USE_TOOLTIPS_KEY,
 
140
                                              NULL);
 
141
 
 
142
    if (new_use_tooltips != use_tooltips)
 
143
    {
 
144
        settings->use_tooltips = new_use_tooltips;
 
145
        return TRUE;
 
146
    }
 
147
 
 
148
    return FALSE;
 
149
}
 
150
 
 
151
static gboolean
 
152
mutter_draggable_border_width_changed (GConfClient *client)
 
153
{
 
154
    int      new_width;
 
155
    int      width = settings->mutter_draggable_border_width;
 
156
 
 
157
    new_width = gconf_client_get_int (client,
 
158
                                      MUTTER_DRAGGABLE_BORDER_WIDTH_KEY,
 
159
                                      NULL);
 
160
 
 
161
    if (new_width != width)
 
162
    {
 
163
        settings->mutter_draggable_border_width = new_width;
 
164
        return TRUE;
 
165
    }
 
166
 
 
167
    return FALSE;
 
168
}
 
169
 
 
170
static gboolean
 
171
mutter_attach_modal_dialogs_changed (GConfClient *client)
 
172
{
 
173
    gboolean      new_attach;
 
174
    gboolean      attach = settings->mutter_attach_modal_dialogs;
 
175
 
 
176
    new_attach = gconf_client_get_bool (client,
 
177
                                            MUTTER_ATTACH_MODAL_DIALOGS_KEY,
 
178
                                                NULL);
 
179
 
 
180
    if (new_attach != attach)
 
181
    {
 
182
        settings->mutter_attach_modal_dialogs = new_attach;
 
183
        return TRUE;
 
184
    }
 
185
 
 
186
    return FALSE;
 
187
}
 
188
 
 
189
static gboolean
110
190
blur_settings_changed (GConfClient *client)
111
191
{
112
192
    gchar *type;
184
264
        theme_get_event_window_position = meta_get_event_window_position;
185
265
        theme_get_button_position       = meta_get_button_position;
186
266
        theme_get_title_scale           = meta_get_title_scale;
 
267
        theme_get_shadow                = meta_get_shadow;
187
268
    }
188
269
    else
189
270
    {
193
274
        theme_get_event_window_position = get_event_window_position;
194
275
        theme_get_button_position       = get_button_position;
195
276
        theme_get_title_scale           = get_title_scale;
 
277
        theme_get_shadow                = cairo_get_shadow;
196
278
    }
197
279
 
198
280
    return TRUE;
203
285
    theme_get_event_window_position = get_event_window_position;
204
286
    theme_get_button_position       = get_button_position;
205
287
    theme_get_title_scale           = get_title_scale;
 
288
    theme_get_shadow                = cairo_get_shadow;
206
289
 
207
290
    return FALSE;
208
291
#endif
486
569
        if (theme_opacity_changed (client))
487
570
            changed = TRUE;
488
571
    }
 
572
    else if (strcmp (key, MUTTER_DRAGGABLE_BORDER_WIDTH_KEY) == 0)
 
573
    {
 
574
        if (mutter_draggable_border_width_changed (client))
 
575
            changed = TRUE;
 
576
    }
 
577
    else if (strcmp (key, MUTTER_ATTACH_MODAL_DIALOGS_KEY) == 0)
 
578
    {
 
579
        if (mutter_attach_modal_dialogs_changed (client))
 
580
            changed = TRUE;
 
581
    }
 
582
    else if (strcmp (key, USE_TOOLTIPS_KEY) == 0)
 
583
    {
 
584
        if (use_tooltips_changed (client))
 
585
            changed = TRUE;
 
586
    }
489
587
 
490
588
    if (changed)
491
589
        decorations_changed (data);
510
608
                          GCONF_CLIENT_PRELOAD_ONELEVEL,
511
609
                          NULL);
512
610
 
 
611
    gconf_client_add_dir (gconf,
 
612
                          MUTTER_GCONF_DIR,
 
613
                          GCONF_CLIENT_PRELOAD_ONELEVEL,
 
614
                          NULL);
 
615
 
513
616
    g_signal_connect (G_OBJECT (gconf),
514
617
                      "value_changed",
515
618
                      G_CALLBACK (value_changed),
537
640
    wheel_action_changed (gconf);
538
641
    blur_settings_changed (gconf);
539
642
 
 
643
    mutter_draggable_border_width_changed (gconf);
 
644
    mutter_attach_modal_dialogs_changed (gconf);
 
645
    use_tooltips_changed (gconf);
 
646
 
540
647
    g_object_unref (gconf);
541
648
#endif
542
 
    
 
649
 
543
650
    shadow_property_changed (screen);
544
651
 
545
652
    return TRUE;