On Mon, 09 Sep 2013, Carlos R. Mafra escribió:

> On Thu,  5 Sep 2013 at 21:08:22 +0200, Rodolfo García Peñas (kix) wrote:
> > From: "Rodolfo García Peñas (kix)" <k...@kix.es>
> > 
> > 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;
> 
> This patch is a great idea, but I feel the naming convention is
> on the borderline of too cryptic. Perhaps it's just me, but
> 
> wks_nfo
> 
> is a bit disturbing and distracts a bit while reading the code.
> 
> 
> > --- 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;
> 
> 
> Perhaps 'typedef WWorkspace_info' would make
> more sense? Note the extra "W" like in WWorkspace -- I think
> it is good to have patterns like this. 
> 
> And then we could have
> 
> WWorkspace_info wks_info;
> 
> instead of
> 
> wks_info wks_nfo;
> 
> May I suggest you to rename this? Perhaps it makes more sense to
> redo your last series altogether. Remove the troublesome patch about
> True vs False and do the above renaming.
> 
> Since it's on #next, I can freely substitute the old series by the new
> one with rebase.

Ok, I will try to do it. I don't have problems to change the names, the 
important thing is the idea of using a workspace struct split of the WScreen 
struct.

Take a look about the idea of using two different structs. wks_info contains 
the common info for all workspaces, and workspace, with the info for the 
current workspace (we have multiple workspaces, so we have multiple workspace 
structs). Differences:

- We have only one wks_info struct.
- We have multiple workspace structs. Is an array of workspaces.
- The array of workspaces is in wks_info struct.
- The Dock, Clip and Drawers are 'per-workspace', so are included in the 
workspace variable.
- The workspace_count or the workspace menu is the same for all workspaces, so 
re in the wks_info.
- The background could be different in every workspace, but currently, is set 
using the setbg tool and we cannot use it in the workspace struct, only in the 
wks_info struct.

Thanks for your comments. I will write the changes this evening.

kix


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to