The new struct wks_info 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. Signed-off-by: Rodolfo García Peñas (kix) <[email protected]> --- src/defaults.c | 10 +++++----- src/main.c | 4 ++++ src/screen.h | 2 -- src/workspace.c | 15 +++++++-------- src/workspace.h | 6 +++++- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/defaults.c b/src/defaults.c index 22aa716..0767556 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 WWorkspace_info wks_info; extern WShortKey wKeyBindings[WKBD_LAST]; typedef struct _WDefaultEntry WDefaultEntry; @@ -2583,15 +2584,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_info.workspace_name_font) + WMReleaseFont(wks_info.workspace_name_font); - scr->workspace_name_font = font; + wks_info.workspace_name_font = font; return 0; } diff --git a/src/main.c b/src/main.c index 5862389..b28eec1 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> @@ -90,6 +91,9 @@ WDDomain *WDWindowMaker = NULL; WDDomain *WDWindowAttributes = NULL; WDDomain *WDRootMenu = NULL; +/* Workspace information */ +WWorkspace_info wks_info; + #ifdef SHAPE Bool wShapeSupported; int wShapeEventBase; 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 0b3d3d0..ace7d3c 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -61,6 +61,7 @@ extern int ignore_wks_change; extern WShortKey wKeyBindings[WKBD_LAST]; +extern WWorkspace_info wks_info; static WMPropList *dWorkspaces = NULL; static WMPropList *dClip, *dName; @@ -279,8 +280,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_info.workspace_name_font, name, len); + h = WMFontHeight(wks_info.workspace_name_font); #ifdef XINERAMA head = wGetHeadForPointerLocation(scr); @@ -350,11 +351,9 @@ static void showWorkspaceName(WScreen * scr, int workspace) XFillRectangle(dpy, text, WMColorGC(scr->black), 0, 0, w + 4, h + 4); - 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); - } - } + for (x = 0; x <= 4; x++) + for (y = 0; y <= 4; y++) + WMDrawString(scr->wmscreen, text, scr->white, wks_info.workspace_name_font, x, y, name, len); XSetForeground(dpy, scr->mono_gc, 1); XSetBackground(dpy, scr->mono_gc, 0); @@ -366,7 +365,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_info.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..68cd275 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -23,12 +23,16 @@ #define WMWORKSPACE_H_ - typedef struct WWorkspace { char *name; struct WDock *clip; } WWorkspace; +typedef struct WWorkspace_info { + /* Workspace stuff */ + WMFont *workspace_name_font; +} WWorkspace_info; + void wWorkspaceMake(WScreen *scr, int count); int wWorkspaceNew(WScreen *scr); int wGetWorkspaceNumber(WScreen *scr, const char *value); -- 1.8.4.rc3 -- To unsubscribe, send mail to [email protected].
