From f60e65001bfdd21fd9939b2b0121037682b6522c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Tue, 8 Oct 2013 00:56:29 +0200 Subject: [PATCH] Moved 'workspace_name_font' from the Screen to a Workspace object in the global namespace The new workspace struct 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/WindowMaker.h | 5 +++++ src/defaults.c | 6 +++--- src/screen.h | 2 -- src/workspace.c | 8 ++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 36d52f54..b38419e9 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -481,6 +481,11 @@ extern struct wmaker_global_variables { } timestamp; + /* Workspace related */ + struct { + WMFont *font_for_name; /* used during workspace switch */ + } workspace; + /* definition for X Atoms */ struct { diff --git a/src/defaults.c b/src/defaults.c index 6091b64d..973ed07c 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -2587,10 +2587,10 @@ static int setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, void *tdata, { WMFont *font = tdata; - if (scr->workspace_name_font) - WMReleaseFont(scr->workspace_name_font); + if (w_global.workspace.font_for_name) + WMReleaseFont(w_global.workspace.font_for_name); - scr->workspace_name_font = font; + w_global.workspace.font_for_name = font; return 0; } diff --git a/src/screen.h b/src/screen.h index 8dbddee7..02694ec7 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 5e78c470..aa5c80a5 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -278,8 +278,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(w_global.workspace.font_for_name, name, len); + h = WMFontHeight(w_global.workspace.font_for_name); #ifdef XINERAMA head = wGetHeadForPointerLocation(scr); @@ -351,7 +351,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, w_global.workspace.font_for_name, x, y, name, len); XSetForeground(dpy, scr->mono_gc, 1); XSetBackground(dpy, scr->mono_gc, 0); @@ -363,7 +363,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, w_global.workspace.font_for_name, 2, 2, name, len); #ifdef SHAPE XShapeCombineMask(dpy, scr->workspace_name, ShapeBounding, 0, 0, mask, ShapeSet);