From: "Rodolfo García Peñas (kix)" <[email protected]>
The new struct wks_nfo includes the global information
for the workspaces. All information related with the workspaces
should be included here.
The first variable moved is workspace_name_font, included in this
patch. This variable was included in the screen info, but the
screen and the font used in the workspace name don't have any
relationship.
---
src/defaults.c | 10 +++++-----
src/main.c | 4 ++++
src/screen.h | 2 --
src/workspace.c | 9 +++++----
src/workspace.h | 4 +++-
5 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/defaults.c b/src/defaults.c
index 02f01a3..67ca62a 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -76,6 +76,7 @@ extern WDDomain *WDWindowMaker;
extern WDDomain *WDWindowAttributes;
extern WDDomain *WDRootMenu;
extern int wScreenCount;
+extern wks_info wks_nfo;
extern WShortKey wKeyBindings[WKBD_LAST];
typedef struct _WDefaultEntry WDefaultEntry;
@@ -2584,15 +2585,14 @@ static int setClipTitleFont(WScreen * scr,
WDefaultEntry * entry, void *tdata, v
return REFRESH_ICON_FONT;
}
-static int setLargeDisplayFont(WScreen * scr, WDefaultEntry * entry, void
*tdata, void *foo)
+static int setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, void
*tdata, void *foo)
{
WMFont *font = tdata;
- if (scr->workspace_name_font) {
- WMReleaseFont(scr->workspace_name_font);
- }
+ if (wks_nfo.workspace_name_font)
+ WMReleaseFont(wks_nfo.workspace_name_font);
- scr->workspace_name_font = font;
+ wks_nfo.workspace_name_font = font;
return 0;
}
diff --git a/src/main.c b/src/main.c
index 69a68e2..18f6002 100644
--- a/src/main.c
+++ b/src/main.c
@@ -56,6 +56,7 @@
#include "dialog.h"
#include "main.h"
#include "monitor.h"
+#include "workspace.h"
#include <WINGs/WUtil.h>
@@ -129,6 +130,9 @@ Atom _XA_WM_IGNORE_FOCUS_EVENTS;
/* cursors */
Cursor wCursor[WCUR_LAST];
+/* Workspace information */
+wks_info wks_nfo;
+
/* last event timestamp for XSetInputFocus */
Time LastTimestamp = CurrentTime;
/* timestamp on the last time we did XSetInputFocus() */
diff --git a/src/screen.h b/src/screen.h
index 8dbddee..02694ec 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -163,8 +163,6 @@ typedef struct _WScreen {
needs to be a core font so we can
use it with a XORing GC */
- WMFont *workspace_name_font;
-
WMColor *select_color;
WMColor *select_text_color;
/* foreground colors */
diff --git a/src/workspace.c b/src/workspace.c
index bb75d6b..1776b27 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -62,6 +62,7 @@
extern int ignore_wks_change;
extern XContext wVEdgeContext;
extern WShortKey wKeyBindings[WKBD_LAST];
+extern wks_info wks_nfo;
static WMPropList *dWorkspaces = NULL;
static WMPropList *dClip, *dName;
@@ -280,8 +281,8 @@ static void showWorkspaceName(WScreen * scr, int workspace)
data = wmalloc(sizeof(WorkspaceNameData));
data->back = NULL;
- w = WMWidthOfString(scr->workspace_name_font, name, len);
- h = WMFontHeight(scr->workspace_name_font);
+ w = WMWidthOfString(wks_nfo.workspace_name_font, name, len);
+ h = WMFontHeight(wks_nfo.workspace_name_font);
#ifdef XINERAMA
head = wGetHeadForPointerLocation(scr);
@@ -353,7 +354,7 @@ static void showWorkspaceName(WScreen * scr, int workspace)
for (x = 0; x <= 4; x++) {
for (y = 0; y <= 4; y++) {
- WMDrawString(scr->wmscreen, text, scr->white,
scr->workspace_name_font, x, y, name, len);
+ WMDrawString(scr->wmscreen, text, scr->white,
wks_nfo.workspace_name_font, x, y, name, len);
}
}
@@ -367,7 +368,7 @@ static void showWorkspaceName(WScreen * scr, int workspace)
XFillRectangle(dpy, text, WMColorGC(scr->black), 0, 0, w + 4, h + 4);
- WMDrawString(scr->wmscreen, text, scr->white, scr->workspace_name_font,
2, 2, name, len);
+ WMDrawString(scr->wmscreen, text, scr->white,
wks_nfo.workspace_name_font, 2, 2, name, len);
#ifdef SHAPE
XShapeCombineMask(dpy, scr->workspace_name, ShapeBounding, 0, 0, mask,
ShapeSet);
diff --git a/src/workspace.h b/src/workspace.h
index 69d1b18..55c7aaf 100644
--- a/src/workspace.h
+++ b/src/workspace.h
@@ -22,7 +22,9 @@
#ifndef WMWORKSPACE_H_
#define WMWORKSPACE_H_
-
+typedef struct wks_info {
+ WMFont *workspace_name_font;
+} wks_info;
typedef struct WWorkspace {
char *name;
--
1.7.10.4
--
To unsubscribe, send mail to [email protected].