gnome patch

C code posted by Luiz Vitor Martinez Cardoso
created at 25 Jan 22:42

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
diff -Naur metacity-2.18.2/src/effects.c metacity-2.18.2.new/src/effects.c
--- metacity-2.18.2/src/effects.c  2007-04-08 15:46:17.000000000 -0300
+++ metacity-2.18.2.new/src/effects.c  2007-06-30 16:16:13.000000000 -0300
@@ -755,17 +755,18 @@
 
 static void
 run_default_effect_handler (MetaEffect *effect)
-{
+{   
     switch (effect->type)
     {
     case META_EFFECT_MINIMIZE:
-  meta_effects_draw_box_animation (effect->window->screen,
+  if (meta_prefs_get_minimize_animation_box ()) {
+        meta_effects_draw_box_animation (effect->window->screen,
            &(effect->u.minimize.window_rect),
            &(effect->u.minimize.icon_rect),
            META_MINIMIZE_ANIMATION_LENGTH,
            META_BOX_ANIM_SCALE);
+  }
   break;
-
     default:
   break;
     }
diff -Naur metacity-2.18.2/src/metacity.schemas.in metacity-2.18.2.new/src/metacity.schemas.in
--- metacity-2.18.2/src/metacity.schemas.in  2007-04-08 15:46:17.000000000 -0300
+++ metacity-2.18.2.new/src/metacity.schemas.in  2007-06-30 16:15:01.000000000 -0300
@@ -335,6 +335,17 @@
       </locale>
     </schema>
 
+    <schema>
+      <key>/schemas/apps/metacity/general/minimize_animation_box</key>
+      <applyto>/apps/metacity/general/minimize_animation_box</applyto>
+      <owner>metacity</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+         <short>If true, shows a black border when minimize windows</short>
+      </locale>
+    </schema>
+
     <!-- Window Keybindings -->
 
     <schema>
diff -Naur metacity-2.18.2/src/prefs.c metacity-2.18.2.new/src/prefs.c
--- metacity-2.18.2/src/prefs.c  2007-04-08 15:46:17.000000000 -0300
+++ metacity-2.18.2.new/src/prefs.c  2007-06-30 16:14:37.000000000 -0300
@@ -57,6 +57,7 @@
 #define KEY_DISABLE_WORKAROUNDS "/apps/metacity/general/disable_workarounds"
 #define KEY_BUTTON_LAYOUT "/apps/metacity/general/button_layout"
 #define KEY_REDUCED_RESOURCES "/apps/metacity/general/reduced_resources"
+#define KEY_MINIMIZE_ANIMATION_BOX "/apps/metacity/general/minimize_animation_box"
 #define KEY_GNOME_ACCESSIBILITY "/desktop/gnome/interface/accessibility"
 
 #define KEY_COMMAND_PREFIX "/apps/metacity/keybinding_commands/command_"
@@ -100,6 +101,7 @@
 static gboolean provide_visual_bell = FALSE;
 static gboolean bell_is_audible = TRUE;
 static gboolean reduced_resources = FALSE;
+static gboolean minimize_animation_box = TRUE;
 static gboolean gnome_accessibility = FALSE;
 static char *cursor_theme = NULL;
 static int   cursor_size = 24;
@@ -162,6 +164,7 @@
 static gboolean update_workspace_name     (const char  *name,
                                            const char  *value);
 static gboolean update_reduced_resources  (gboolean     value);
+static gboolean update_minimize_animation_box (gboolean  value);
 static gboolean update_gnome_accessibility  (gboolean     value);
 static gboolean update_cursor_theme       (const char *value);
 static gboolean update_cursor_size        (int size);
@@ -489,6 +492,9 @@
   if (get_bool (KEY_REDUCED_RESOURCES, &bool_val))
     update_reduced_resources (bool_val);
 
+  if (get_bool (KEY_MINIMIZE_ANIMATION_BOX, &bool_val))
+    update_minimize_animation_box (bool_val);
+
   str_val = gconf_client_get_string (default_client, KEY_TERMINAL_COMMAND,
                                      &err);
   cleanup_error (&err);
@@ -975,6 +981,23 @@
       if (update_reduced_resources (b))
         queue_changed (META_PREF_REDUCED_RESOURCES);
     }
+  else if (strcmp (key, KEY_MINIMIZE_ANIMATION_BOX) == 0)
+    {
+      gboolean b;
+
+      if (value && value->type != GCONF_VALUE_BOOL)
+        {
+          meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
+                        KEY_MINIMIZE_ANIMATION_BOX);
+          goto out;
+        }
+
+      b = value ? gconf_value_get_bool (value) : minimize_animation_box;
+
+      if (update_minimize_animation_box (b))
+        queue_changed (META_PREF_MINIMIZE_ANIMATION_BOX);
+    }
+
   else if (strcmp (key, KEY_GNOME_ACCESSIBILITY) == 0)
     {
       gboolean b;
@@ -1706,6 +1728,16 @@
 }
 
 static gboolean
+update_minimize_animation_box (gboolean value)
+{
+  gboolean old = minimize_animation_box;
+
+  minimize_animation_box = value;
+
+  return old != minimize_animation_box;
+}
+
+static gboolean
 update_gnome_accessibility (gboolean value)
 {
   gboolean old = gnome_accessibility;
@@ -1788,6 +1820,9 @@
     case META_PREF_REDUCED_RESOURCES:
       return "REDUCED_RESOURCES";
 
+    case META_PREF_MINIMIZE_ANIMATION_BOX:
+      return "MINIMIZE_ANIMATION_BOX";
+
     case META_PREF_GNOME_ACCESSIBILITY:
       return "GNOME_ACCESSIBILTY";
 
@@ -2898,6 +2933,12 @@
 }
 
 gboolean
+meta_prefs_get_minimize_animation_box (void)
+{
+  return minimize_animation_box;
+}
+
+gboolean
 meta_prefs_get_gnome_accessibility ()
 {
   return gnome_accessibility;
diff -Naur metacity-2.18.2/src/prefs.h metacity-2.18.2.new/src/prefs.h
--- metacity-2.18.2/src/prefs.h  2007-04-08 15:46:17.000000000 -0300
+++ metacity-2.18.2.new/src/prefs.h  2007-06-30 16:14:37.000000000 -0300
@@ -53,6 +53,7 @@
   META_PREF_AUDIBLE_BELL,
   META_PREF_VISUAL_BELL_TYPE,
   META_PREF_REDUCED_RESOURCES,
+  META_PREF_MINIMIZE_ANIMATION_BOX,
   META_PREF_GNOME_ACCESSIBILITY,
   META_PREF_CURSOR_THEME,
   META_PREF_CURSOR_SIZE,
@@ -83,6 +84,7 @@
 gboolean                    meta_prefs_get_auto_raise         (void);
 int                         meta_prefs_get_auto_raise_delay   (void);
 gboolean                    meta_prefs_get_reduced_resources  (void);
+gboolean                    meta_prefs_get_minimize_animation_box  (void);
 gboolean                    meta_prefs_get_gnome_accessibility (void);
 
 const char*                 meta_prefs_get_command            (int i);
5.75 KB in 14 ms with coderay