Bug#228768: updated patch for 2.8.1

Sanchez the Cactus Sanchez the Cactus <sanchezthecactus@yahoo.com>, 228768@bugs.debian.org
Fri, 14 May 2004 10:39:41 -0700 (PDT)


--0-72691717-1084556381=:39211
Content-Type: text/plain; charset=us-ascii
Content-Id: 
Content-Disposition: inline

updated the patch to work with 2.8.1

is there any way this could get included in the packages?  It doesn't break
default behavior, but provides a gconf key to change the behavior for those who
care.

Thanks,
-Joe


	
		
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/
--0-72691717-1084556381=:39211
Content-Type: text/x-patch; name="metacity-2.8.1-patch-raise_on_click.diff"
Content-Description: metacity-2.8.1-patch-raise_on_click.diff
Content-Disposition: inline; filename="metacity-2.8.1-patch-raise_on_click.diff"

diff -Nru metacity-2.8.1-old/src/display.c metacity-2.8.1/src/display.c
--- metacity-2.8.1-old/src/display.c	2004-02-15 20:38:22.000000000 +0100
+++ metacity-2.8.1/src/display.c	2004-03-03 14:44:19.000000000 +0100
@@ -1340,7 +1340,10 @@
                    * in click to focus mode? The debate rages.
                    * Feel free to change TRUE to FALSE or vice versa
                    */
-                  if (TRUE /* meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK */) 
+                  /*if (FALSE meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK ) */
+                  
+                  /* Kbyte Fix, raise on clicking depends by an metacity option */
+                  if(meta_prefs_get_raise_on_click ())
                     {
                       meta_window_raise (window);
                       
diff -Nru metacity-2.8.1-old/src/metacity.schemas.in metacity-2.8.1/src/metacity.schemas.in
--- metacity-2.8.1-old/src/metacity.schemas.in	2003-06-27 16:49:56.000000000 +0200
+++ metacity-2.8.1/src/metacity.schemas.in	2004-03-03 14:09:06.000000000 +0100
@@ -95,6 +95,20 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/metacity/general/raise_on_click</key>
+      <applyto>/apps/metacity/general/raise_on_click</applyto>
+      <owner>metacity</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Raise current window if click event occurs</short>
+         <long>
+          If true the focused window will be automatically raised.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/metacity/general/auto_raise_delay</key>
       <applyto>/apps/metacity/general/auto_raise_delay</applyto>
       <owner>metacity</owner>
diff -Nru metacity-2.8.1-old/src/prefs.c metacity-2.8.1/src/prefs.c
--- metacity-2.8.1-old/src/prefs.c	2003-06-27 16:49:56.000000000 +0200
+++ metacity-2.8.1/src/prefs.c	2004-03-03 14:30:56.000000000 +0100
@@ -51,7 +51,8 @@
 #define KEY_APPLICATION_BASED "/apps/metacity/general/application_based"
 #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_RAISE_ON_CLICK "/apps/metacity/general/raise_on_click"
 
 #define KEY_COMMAND_PREFIX "/apps/metacity/keybinding_commands/command_"
 #define KEY_SCREEN_BINDINGS_PREFIX "/apps/metacity/global_keybindings"
@@ -84,7 +85,8 @@
 static gboolean auto_raise_delay = 500;
 static gboolean provide_visual_bell = TRUE;
 static gboolean bell_is_audible = TRUE;
 static gboolean reduced_resources = FALSE;
+static gboolean raise_on_click = FALSE;

 static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_INVALID;
 static MetaButtonLayout button_layout = {
@@ -118,6 +120,7 @@
 static gboolean update_action_double_click_titlebar (const char *value);
 static gboolean update_auto_raise          (gboolean   value);
 static gboolean update_auto_raise_delay    (int        value);
+static gboolean update_raise_on_click     (gboolean    value);
 static gboolean update_button_layout      (const char *value);
 static gboolean update_window_binding     (const char *name,
                                            const char *value);
@@ -288,7 +291,7 @@
   char *str_val;
   int int_val;
   gboolean bool_val, bool_val_2;
-  
+   
   if (default_client != NULL)
     return;
   
@@ -329,7 +332,11 @@
   cleanup_error (&err);
   update_auto_raise_delay (int_val);
   
-
+  bool_val = gconf_client_get_bool (default_client, KEY_RAISE_ON_CLICK,
+                 &err);
+  cleanup_error (&err);
+  update_raise_on_click (bool_val);                 
+  
   str_val = gconf_client_get_string (default_client, KEY_THEME,
                                      &err);
   cleanup_error (&err);
@@ -654,6 +661,22 @@
         queue_changed (META_PREF_AUTO_RAISE_DELAY);
     
     }
+  else if (strcmp (key, KEY_RAISE_ON_CLICK) == 0)
+    {
+      gboolean b;
+
+      if (value && value->type != GCONF_VALUE_BOOL)
+        {
+          meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
+                        KEY_RAISE_ON_CLICK);
+          goto out;
+        }
+
+      b = value ? gconf_value_get_bool (value) : raise_on_click;
+
+      if (update_raise_on_click (b))
+        queue_changed (META_PREF_RAISE_ON_CLICK);
+    }    
   else if (str_has_prefix (key, KEY_COMMAND_PREFIX))
     {
       const char *str;
@@ -1220,6 +1243,16 @@
   return old != auto_raise;
 }
 
+static gboolean
+update_raise_on_click (gboolean value)
+{
+  gboolean old = raise_on_click;
+
+  raise_on_click = value;
+
+  return old != raise_on_click;
+}
+
 #define MAX_REASONABLE_AUTO_RAISE_DELAY 10000
   
 static gboolean
@@ -1280,6 +1313,9 @@
     case META_PREF_AUTO_RAISE:
       return "AUTO_RAISE";
       
+    case META_PREF_RAISE_ON_CLICK:
+      return "RAISE_ON_CLICK";
+      
     case META_PREF_AUTO_RAISE_DELAY:
       return "AUTO_RAISE_DELAY";
 
@@ -1968,6 +2004,12 @@
   return auto_raise;
 }
 
+gboolean
+meta_prefs_get_raise_on_click ()
+{
+	return raise_on_click;
+}
+
 int
 meta_prefs_get_auto_raise_delay ()
 {
diff -Nru metacity-2.8.1-old/src/prefs.h metacity-2.8.1/src/prefs.h
--- metacity-2.8.1-old/src/prefs.h	2003-06-27 16:49:56.000000000 +0200
+++ metacity-2.8.1/src/prefs.h	2004-03-03 13:59:06.000000000 +0100
@@ -45,8 +45,9 @@
   META_PREF_WORKSPACE_NAMES,
   META_PREF_VISUAL_BELL,
   META_PREF_AUDIBLE_BELL,
   META_PREF_VISUAL_BELL_TYPE,
-  META_PREF_REDUCED_RESOURCES
+  META_PREF_REDUCED_RESOURCES,
+  META_PREF_RAISE_ON_CLICK
 } MetaPreference;
 
 typedef void (* MetaPrefsChangedFunc) (MetaPreference pref,
@@ -70,7 +71,8 @@
 gboolean                    meta_prefs_get_disable_workarounds (void);
 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_raise_on_click     (void);
 
 const char*                 meta_prefs_get_command            (int i);
 

--0-72691717-1084556381=:39211--