From 493ff551389c5e74e8748b784fb327ae79e0f46a Mon Sep 17 00:00:00 2001
From: David Maciejak <david.maciejak@gmail.com>
Date: Thu, 4 Dec 2014 13:34:56 +0700
Subject: [PATCH 3/4] wmaker: add workspace pager underlying configuration

This path is adding the functions and variables needed for workspace pager preferences.
An option to enable/disable the workspace pager, and one to set a default background image.
---
 WindowMaker/Defaults/WindowMaker.in |  1 +
 src/WindowMaker.h                   |  4 ++++
 src/defaults.c                      | 27 ++++++++++++++++++++++++++-
 src/keybind.h                       |  1 +
 4 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/WindowMaker/Defaults/WindowMaker.in b/WindowMaker/Defaults/WindowMaker.in
index 5b6203b..c68feef 100644
--- a/WindowMaker/Defaults/WindowMaker.in
+++ b/WindowMaker/Defaults/WindowMaker.in
@@ -3,6 +3,7 @@
   PopupSwitchMenu = NO;
   MenuStyle = normal;
   DisableMiniwindows = NO;
+  DisableWorkspacePager = NO;
   OpenTransientOnOwnerWorkspace = NO;
   EdgeResistance = 30;
   WorkspaceBorderSize = 0;
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 0663b54..43dc83e 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -393,6 +393,8 @@ extern struct WPreferences {
 	char sticky_icons;                 /* If miniwindows will be onmipresent */
 	char dont_confirm_kill;            /* do not confirm Kill application */
 	char disable_miniwindows;
+        char disable_workspace_pager;
+
 	char dont_blink;                   /* do not blink icon selection */
 
 	/* Appearance options */
@@ -455,6 +457,8 @@ extern struct WPreferences {
 	RImage *swtileImage;
 	RImage *swbackImage[9];
 
+        union WTexture *wsmbackTexture;
+
 	int show_clip_title;
 
 	struct {
diff --git a/src/defaults.c b/src/defaults.c
index fff239f..f0d0067 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -4,6 +4,8 @@
  *
  *  Copyright (c) 1997-2003 Alfredo K. Kojima
  *  Copyright (c) 1998-2003 Dan Pascu
+ *  Copyright (c) 2014 Window Maker Team
+
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -144,6 +146,7 @@ static WDECallbackUpdate setHightlightText;
 static WDECallbackUpdate setKeyGrab;
 static WDECallbackUpdate setDoubleClick;
 static WDECallbackUpdate setIconPosition;
+static WDECallbackUpdate setWorkspaceMapBackground;
 
 static WDECallbackUpdate setClipTitleFont;
 static WDECallbackUpdate setClipTitleColor;
@@ -348,7 +351,9 @@ WDefaultEntry staticOptionList[] = {
 	{"ClipMergedInDock", "NO", NULL,
 	    NULL, getBool, setClipMergedInDock, NULL, NULL},
 	{"DisableMiniwindows", "NO", NULL,
-	    &wPreferences.disable_miniwindows, getBool, NULL, NULL, NULL}
+            &wPreferences.disable_miniwindows, getBool, NULL, NULL, NULL},
+        {"DisableWorkspacePager", "NO", NULL,
+            &wPreferences.disable_workspace_pager, getBool, NULL, NULL, NULL}
 };
 
 #define NUM2STRING_(x) #x
@@ -598,6 +603,8 @@ WDefaultEntry optionList[] = {
 	    NULL, getColor, setFrameFocusedBorderColor, NULL, NULL},
 	{"FrameSelectedBorderColor", "white", NULL,
 	    NULL, getColor, setFrameSelectedBorderColor, NULL, NULL},
+        {"WorkspaceMapBack", "(solid, black)", NULL,
+            NULL, getTexture, setWorkspaceMapBackground, NULL, NULL},
 
 	/* keybindings */
 
@@ -659,6 +666,8 @@ WDefaultEntry optionList[] = {
 	    NULL, getKeybind, setKeyGrab, NULL, NULL},
 	{"SelectKey", "None", (void *)WKBD_SELECT,
 	    NULL, getKeybind, setKeyGrab, NULL, NULL},
+        {"WorkspaceMapKey", "None", (void *)WKBD_WORKSPACEMAP,
+            NULL, getKeybind, setKeyGrab, NULL, NULL},
 	{"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT,
 	    NULL, getKeybind, setKeyGrab, NULL, NULL},
 	{"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV,
@@ -3242,6 +3251,22 @@ static int updateUsableArea(WScreen * scr, WDefaultEntry * entry, void *bar, voi
 	return 0;
 }
 
+static int setWorkspaceMapBackground(WScreen *scr, WDefaultEntry *entry, void *tdata, void *foo)
+{
+       WTexture **texture = tdata;
+
+       /* Parameter not used, but tell the compiler that it is ok */
+       (void) entry;
+       (void) foo;
+
+       if (wPreferences.wsmbackTexture) {
+               wTextureDestroy(scr, wPreferences.wsmbackTexture);
+       }
+       wPreferences.wsmbackTexture = *texture;
+
+       return REFRESH_WINDOW_TEXTURES;
+}
+
 static int setMenuStyle(WScreen * scr, WDefaultEntry * entry, void *tdata, void *foo)
 {
 	/* Parameter not used, but tell the compiler that it is ok */
diff --git a/src/keybind.h b/src/keybind.h
index 4aaadd4..87a5cdc 100644
--- a/src/keybind.h
+++ b/src/keybind.h
@@ -69,6 +69,7 @@ enum {
 	WKBD_RAISELOWER,
 	WKBD_MOVERESIZE,
 	WKBD_SHADE,
+	WKBD_WORKSPACEMAP,
 	WKBD_FOCUSNEXT,
 	WKBD_FOCUSPREV,
 	WKBD_GROUPNEXT,
-- 
2.1.0

