This patch is adding a checkbox option in the expert panel
to be able to disable the Alt-Tab window switching panel from the pref GUI.

Please test, i experienced some weird things with the inotify stuff,
sometime a wmaker hot restart is needed to force reload the conf.

thanks,
david

---
 WPrefs.app/Expert.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index e939df0..0ed0e14 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -31,6 +31,7 @@ static const struct {

  enum {
  OPTION_WMAKER,
+ OPTION_WMAKER_ARRAY,
  OPTION_USERDEF
  } class;

@@ -50,6 +51,9 @@ static const struct {
  { N_("Use SaveUnder in window frames, icons, menus and other objects."),
   /* default: */ False, OPTION_WMAKER, "UseSaveUnders" },

+ { N_("Disable Alt-Tab window switching panel."),
+  /* default: */ False, OPTION_WMAKER_ARRAY, "SwitchPanelImages" },
+
  { N_("Disable confirmation panel for the Kill command."),
   /* default: */ False, OPTION_WMAKER, "DontConfirmKill" },

@@ -96,7 +100,7 @@ typedef struct _Panel {
 #define ICON_FILE "expert"


-static void createPanel(Panel * p)
+static void createPanel(Panel *p)
 {
  _Panel *panel = (_Panel *) p;
  WMScrollView *sv;
@@ -134,6 +138,15 @@ static void createPanel(Panel * p)
  state = expert_options[i].def_state;
  break;

+ case OPTION_WMAKER_ARRAY: {
+ char *str = GetStringForKey(expert_options[i].op_name);
+ if (str && strcasecmp(str, "None") == 0)
+ state = True;
+ else
+ state = expert_options[i].def_state;
+ }
+ break;
+
  case OPTION_USERDEF:
  state = WMGetUDBoolForKey(udb, expert_options[i].op_name);
  break;
@@ -141,7 +154,7 @@ static void createPanel(Panel * p)
  default:
 #ifdef DEBUG
  wwarning("export_options[%d].class = %d, this should not happen\n",
-         i, expert_options[i].class);
+ i, expert_options[i].class);
 #endif
  state = expert_options[i].def_state;
  break;
@@ -154,7 +167,7 @@ static void createPanel(Panel * p)
  WMRealizeWidget(panel->box);
 }

-static void storeDefaults(_Panel * panel)
+static void storeDefaults(_Panel *panel)
 {
  WMUserDefaults *udb = WMGetStandardUserDefaults();
  int i;
@@ -165,6 +178,17 @@ static void storeDefaults(_Panel * panel)
  SetBoolForKey(WMGetButtonSelected(panel->swi[i]), expert_options[i].op_name);
  break;

+ case OPTION_WMAKER_ARRAY:
+ if (WMGetButtonSelected(panel->swi[i]))
+ SetStringForKey("None", expert_options[i].op_name);
+ else {
+ /* check if the array was not manually modified */
+ char *str = GetStringForKey(expert_options[i].op_name);
+ if (str && strcasecmp(str, "None") == 0)
+ RemoveObjectForKey(expert_options[i].op_name);
+ }
+ break;
+
  case OPTION_USERDEF:
  WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[i]),
expert_options[i].op_name);
  break;
-- 
1.8.3.2

Attachment: 0001-WPrefs-add-expert-option-to-disable-switch-panel.patch
Description: Binary data

Reply via email to