*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* These colours will be mapped to white on a monochrome screen */
unsigned long LIGHTBLUE, LIGHTGREEN, LIGHTGREY, LIGHTCYAN, LIGHTRED, VIOLET, YELLOW, WHITE;
-static XFontStruct *XLQF(FILE gmx_unused *err, Display *disp, const char *name)
+static XFontStruct* XLQF(FILE gmx_unused* err, Display* disp, const char* name)
{
- XFontStruct *font = XLoadQueryFont(disp, name);
+ XFontStruct* font = XLoadQueryFont(disp, name);
#ifdef DEBUG
if (font != NULL)
{
return font;
}
-static XFontStruct *GetFont(FILE *err, Display *disp, char *name)
+static XFontStruct* GetFont(FILE* err, Display* disp, char* name)
{
- static const char *fontnames[] = {
- "sansb12", "8x13bold", "8x13",
- "9x15", "6x13", "fixed"
- };
-#define MAXNAMES (sizeof(fontnames)/sizeof(fontnames[0]))
- unsigned int i;
- XFontStruct *font;
- int count;
- char **fontlist;
- bool bFont = false;
+ static const char* fontnames[] = { "sansb12", "8x13bold", "8x13", "9x15", "6x13", "fixed" };
+#define MAXNAMES (sizeof(fontnames) / sizeof(fontnames[0]))
+ unsigned int i;
+ XFontStruct* font;
+ int count;
+ char** fontlist;
+ bool bFont = false;
if (name)
{
}
if (!bFont)
{
- fprintf (err, "Cannot load any suitable font\n");
+ fprintf(err, "Cannot load any suitable font\n");
}
return font;
}
-static GC GetGC(Display *disp, XFontStruct *font)
+static GC GetGC(Display* disp, XFontStruct* font)
{
- XGCValues values;
+ XGCValues values;
values.font = font->fid;
values.foreground = WhitePixel(disp, DefaultScreen(disp));
- return XCreateGC(disp, DefaultRootWindow(disp), GCForeground|GCFont, &values);
+ return XCreateGC(disp, DefaultRootWindow(disp), GCForeground | GCFont, &values);
}
-void GetNamedColor(t_x11 *x11, const char *name, unsigned long *col)
+void GetNamedColor(t_x11* x11, const char* name, unsigned long* col)
{
/* If name is found than col set to that colour else col is unchanged */
XColor exact, clr;
}
}
-static t_wlist *GetWList(t_x11 *x11, Window w)
+static t_wlist* GetWList(t_x11* x11, Window w)
{
- t_wlist *curs;
+ t_wlist* curs;
curs = x11->wlist;
while (curs && (curs->w != w))
return curs;
}
-static void MainLoop(t_x11 *x11)
+static void MainLoop(t_x11* x11)
{
- bool bReturn;
- XEvent event;
- t_wlist *curs;
- Window w;
+ bool bReturn;
+ XEvent event;
+ t_wlist* curs;
+ Window w;
- for (bReturn = false; (!bReturn); )
+ for (bReturn = false; (!bReturn);)
{
if (x11->wlist)
{
if (XCheckTypedWindowEvent(x11->disp,w,ConfigureNotify,&config))
curs=NULL; */
break;
- default:
- break;
+ default: break;
}
if (curs)
{
}
}
-static void RegisterCallback(t_x11 *x11, Window w, Window Parent,
- CallBack cb, void *data)
+static void RegisterCallback(t_x11* x11, Window w, Window Parent, CallBack cb, void* data)
{
t_wlist *curs, *item;
}
}
-static void UnRegisterCallback(t_x11 *x11, Window w)
+static void UnRegisterCallback(t_x11* x11, Window w)
{
- t_wlist *curs;
+ t_wlist* curs;
curs = x11->wlist;
if (curs)
}
if (curs->next)
{
- t_wlist *tmp = curs->next;
+ t_wlist* tmp = curs->next;
curs->next = curs->next->next;
sfree(tmp);
}
}
-static void SetInputMask(t_x11 *x11, Window w, unsigned long mask)
+static void SetInputMask(t_x11* x11, Window w, unsigned long mask)
{
- t_wlist *curs;
+ t_wlist* curs;
curs = GetWList(x11, w);
if (curs)
}
}
-static unsigned long GetInputMask(t_x11 *x11, Window w)
+static unsigned long GetInputMask(t_x11* x11, Window w)
{
- t_wlist *curs;
+ t_wlist* curs;
curs = GetWList(x11, w);
if (curs)
}
}
-static void CleanUp(t_x11 *x11)
+static void CleanUp(t_x11* x11)
{
- t_wlist *curs;
+ t_wlist* curs;
curs = x11->wlist;
while (curs)
XCloseDisplay(x11->disp);
}
-static void Flush(t_x11 *x11)
+static void Flush(t_x11* x11)
{
std::fflush(x11->console);
}
-t_x11 *GetX11(int *argc, char *argv[])
+t_x11* GetX11(int* argc, char* argv[])
{
- static const char *v_name[] = {
- "DirectColor", "TrueColor", "PseudoColor",
- "StaticColor", "GrayScale", "StaticGray"
- };
- static int v_class[] = {
- DirectColor, TrueColor, PseudoColor,
- StaticColor, GrayScale, StaticGray
- };
-#define NCLASS (sizeof(v_class)/sizeof(v_class[0]))
-
- XVisualInfo v_info;
- t_x11 *x11;
- int ARGC;
- char **ARGV;
- char *display;
- char *fontname;
- char *title, *FG = nullptr, *BG = nullptr;
- bool bVerbose = false;
- int i;
+ static const char* v_name[] = { "DirectColor", "TrueColor", "PseudoColor",
+ "StaticColor", "GrayScale", "StaticGray" };
+ static int v_class[] = { DirectColor, TrueColor, PseudoColor, StaticColor, GrayScale, StaticGray };
+#define NCLASS (sizeof(v_class) / sizeof(v_class[0]))
+
+ XVisualInfo v_info;
+ t_x11* x11;
+ int ARGC;
+ char** ARGV;
+ char* display;
+ char* fontname;
+ char * title, *FG = nullptr, *BG = nullptr;
+ bool bVerbose = false;
+ int i;
title = gmx_strdup(argv[0]);
{
if (strlen(argv[i]) > 1)
{
- if ((*argc) > i+1)
+ if ((*argc) > i + 1)
{
switch (argv[i][1])
{
- case 'b':
- BG = argv[++i];
- break;
- case 'd':
- display = argv[++i];
- break;
+ case 'b': BG = argv[++i]; break;
+ case 'd': display = argv[++i]; break;
case 'f':
switch (argv[i][2])
{
- case 'o':
- fontname = argv[++i];
- break;
- case 'g':
- FG = argv[++i];
- break;
+ case 'o': fontname = argv[++i]; break;
+ case 'g': FG = argv[++i]; break;
}
break;
case 't':
sfree(title);
title = gmx_strdup(argv[++i]);
break;
- case 'v':
- bVerbose = true;
- break;
- default:
- ARGV[ARGC++] = argv[i];
- break;
+ case 'v': bVerbose = true; break;
+ default: ARGV[ARGC++] = argv[i]; break;
}
}
}
{
x11->console = stderr;
}
- else
- if ((x11->console = std::fopen("/dev/null", "w")) == nullptr)
+ else if ((x11->console = std::fopen("/dev/null", "w")) == nullptr)
{
x11->console = stderr;
}
/* These colours will be mapped to black on a monochrome screen */
x11->fg = BLACK = BLUE = GREEN = CYAN = RED = BROWN = GREY = DARKGREY =
- BlackPixel(x11->disp, x11->screen);
+ BlackPixel(x11->disp, x11->screen);
/* These colours will be mapped to white on a monochrome screen */
- x11->bg =
- LIGHTBLUE = LIGHTGREY = LIGHTGREEN = LIGHTCYAN = LIGHTRED = VIOLET = YELLOW = WHITE =
- WhitePixel(x11->disp, x11->screen);
+ x11->bg = LIGHTBLUE = LIGHTGREY = LIGHTGREEN = LIGHTCYAN = LIGHTRED = VIOLET = YELLOW = WHITE =
+ WhitePixel(x11->disp, x11->screen);
if (x11->depth > 1)
{
/* Not B & W, Look what kind of screen we've got... */
for (i = 0; (i < (int)NCLASS); i++)
{
- if (!XMatchVisualInfo(x11->disp, x11->screen, x11->depth,
- v_class[i], &v_info))
+ if (!XMatchVisualInfo(x11->disp, x11->screen, x11->depth, v_class[i], &v_info))
{
break;
}