Reformat all C files.
I'll push a formatting guide at some point. There may still be outstanding changes, but please feel free to resolve those as you arrive a them. To the best of my knowledge, there is no changes to the actual code content, but the formatter does have the occasional bug. If you run into an issue, please fix it!
This commit is contained in:
+107
-99
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 Window.c $NHDT-Date: 1430899134 2015/05/06 07:58:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $ */
|
||||
/* NetHack 3.6 Window.c $NHDT-Date: 1431192774 2015/05/09 17:32:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
|
||||
/* NetHack 3.6 Window.c $Date: 2009/05/06 10:55:43 $ $Revision: 1.4 $ */
|
||||
/* SCCS Id: @(#)Window.c 3.5 1993/02/02 */
|
||||
/* Copyright (c) Dean Luick, 1992 */
|
||||
@@ -10,10 +10,10 @@
|
||||
*/
|
||||
|
||||
#ifndef SYSV
|
||||
#define PRESERVE_NO_SYSV /* X11 include files may define SYSV */
|
||||
#define PRESERVE_NO_SYSV /* X11 include files may define SYSV */
|
||||
#endif
|
||||
|
||||
#ifdef MSDOS /* from compiler */
|
||||
#ifdef MSDOS /* from compiler */
|
||||
#define SHORT_FILENAMES
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#include <X11/StringDefs.h>
|
||||
|
||||
#ifdef PRESERVE_NO_SYSV
|
||||
# ifdef SYSV
|
||||
# undef SYSV
|
||||
# endif
|
||||
# undef PRESERVE_NO_SYSV
|
||||
#ifdef SYSV
|
||||
#undef SYSV
|
||||
#endif
|
||||
#undef PRESERVE_NO_SYSV
|
||||
#endif
|
||||
|
||||
#include "xwindowp.h"
|
||||
@@ -40,60 +40,63 @@ static XtResource resources[] = {
|
||||
#define offset(field) XtOffset(WindowWidget, window.field)
|
||||
/* {name, class, type, size, offset, default_type, default_addr}, */
|
||||
{ nhStr(XtNrows), nhStr(XtCRows), XtRDimension, sizeof(Dimension),
|
||||
offset(rows), XtRImmediate, (XtPointer) 21},
|
||||
offset(rows), XtRImmediate, (XtPointer) 21 },
|
||||
{ nhStr(XtNcolumns), nhStr(XtCColumns), XtRDimension, sizeof(Dimension),
|
||||
offset(columns), XtRImmediate, (XtPointer) 80},
|
||||
offset(columns), XtRImmediate, (XtPointer) 80 },
|
||||
{ nhStr(XtNforeground), XtCForeground, XtRPixel, sizeof(Pixel),
|
||||
offset(foreground), XtRString, (XtPointer) XtDefaultForeground },
|
||||
offset(foreground), XtRString, (XtPointer) XtDefaultForeground },
|
||||
|
||||
{ nhStr(XtNblack), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(black), XtRString, (XtPointer) "black"},
|
||||
{ nhStr(XtNred), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(red), XtRString, (XtPointer) "red" },
|
||||
{ nhStr(XtNgreen), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(green), XtRString, (XtPointer) "pale green" },
|
||||
{ nhStr(XtNbrown), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(brown), XtRString, (XtPointer) "brown" },
|
||||
{ nhStr(XtNblue), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(blue), XtRString, (XtPointer) "blue" },
|
||||
{ nhStr(XtNmagenta), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(magenta), XtRString, (XtPointer) "magenta" },
|
||||
{ nhStr(XtNcyan), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(cyan), XtRString, (XtPointer) "light cyan" },
|
||||
{ nhStr(XtNgray), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(gray), XtRString, (XtPointer) "gray" },
|
||||
{ nhStr(XtNorange), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(orange), XtRString, (XtPointer) "orange" },
|
||||
{ nhStr(XtNblack), XtCColor, XtRPixel, sizeof(Pixel), offset(black),
|
||||
XtRString, (XtPointer) "black" },
|
||||
{ nhStr(XtNred), XtCColor, XtRPixel, sizeof(Pixel), offset(red),
|
||||
XtRString, (XtPointer) "red" },
|
||||
{ nhStr(XtNgreen), XtCColor, XtRPixel, sizeof(Pixel), offset(green),
|
||||
XtRString, (XtPointer) "pale green" },
|
||||
{ nhStr(XtNbrown), XtCColor, XtRPixel, sizeof(Pixel), offset(brown),
|
||||
XtRString, (XtPointer) "brown" },
|
||||
{ nhStr(XtNblue), XtCColor, XtRPixel, sizeof(Pixel), offset(blue),
|
||||
XtRString, (XtPointer) "blue" },
|
||||
{ nhStr(XtNmagenta), XtCColor, XtRPixel, sizeof(Pixel), offset(magenta),
|
||||
XtRString, (XtPointer) "magenta" },
|
||||
{ nhStr(XtNcyan), XtCColor, XtRPixel, sizeof(Pixel), offset(cyan),
|
||||
XtRString, (XtPointer) "light cyan" },
|
||||
{ nhStr(XtNgray), XtCColor, XtRPixel, sizeof(Pixel), offset(gray),
|
||||
XtRString, (XtPointer) "gray" },
|
||||
{ nhStr(XtNorange), XtCColor, XtRPixel, sizeof(Pixel), offset(orange),
|
||||
XtRString, (XtPointer) "orange" },
|
||||
{ nhStr(XtNbright_green), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(bright_green), XtRString, (XtPointer) "green" },
|
||||
{ nhStr(XtNyellow), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(yellow), XtRString, (XtPointer) "yellow" },
|
||||
offset(bright_green), XtRString, (XtPointer) "green" },
|
||||
{ nhStr(XtNyellow), XtCColor, XtRPixel, sizeof(Pixel), offset(yellow),
|
||||
XtRString, (XtPointer) "yellow" },
|
||||
{ nhStr(XtNbright_blue), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(bright_blue), XtRString, (XtPointer) "royal blue" },
|
||||
offset(bright_blue), XtRString, (XtPointer) "royal blue" },
|
||||
{ nhStr(XtNbright_magenta), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(bright_magenta), XtRString, (XtPointer) "violet" },
|
||||
offset(bright_magenta), XtRString, (XtPointer) "violet" },
|
||||
{ nhStr(XtNbright_cyan), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(bright_cyan), XtRString, (XtPointer) "cyan" },
|
||||
{ nhStr(XtNwhite), XtCColor, XtRPixel, sizeof(Pixel),
|
||||
offset(white), XtRString, (XtPointer) "white" },
|
||||
offset(bright_cyan), XtRString, (XtPointer) "cyan" },
|
||||
{ nhStr(XtNwhite), XtCColor, XtRPixel, sizeof(Pixel), offset(white),
|
||||
XtRString, (XtPointer) "white" },
|
||||
|
||||
{ nhStr(XtNfont), XtCFont, XtRFontStruct, sizeof(XFontStruct *),
|
||||
offset(font), XtRString, (XtPointer) XtDefaultFont },
|
||||
{ nhStr(XtNexposeCallback), XtCCallback, XtRCallback, sizeof(XtCallbackList),
|
||||
offset(expose_callback), XtRCallback, (char *)0 },
|
||||
offset(font), XtRString, (XtPointer) XtDefaultFont },
|
||||
{ nhStr(XtNexposeCallback), XtCCallback, XtRCallback,
|
||||
sizeof(XtCallbackList), offset(expose_callback), XtRCallback,
|
||||
(char *) 0 },
|
||||
{ nhStr(XtNcallback), XtCCallback, XtRCallback, sizeof(XtCallbackList),
|
||||
offset(input_callback), XtRCallback, (char *)0 },
|
||||
{ nhStr(XtNresizeCallback), XtCCallback, XtRCallback, sizeof(XtCallbackList),
|
||||
offset(resize_callback), XtRCallback, (char *)0 },
|
||||
offset(input_callback), XtRCallback, (char *) 0 },
|
||||
{ nhStr(XtNresizeCallback), XtCCallback, XtRCallback,
|
||||
sizeof(XtCallbackList), offset(resize_callback), XtRCallback,
|
||||
(char *) 0 },
|
||||
#undef offset
|
||||
};
|
||||
|
||||
/* ARGSUSED */
|
||||
static void no_op(w, event, params, num_params)
|
||||
Widget w; /* unused */
|
||||
XEvent *event; /* unused */
|
||||
String *params; /* unused */
|
||||
Cardinal *num_params; /* unused */
|
||||
static void
|
||||
no_op(w, event, params, num_params)
|
||||
Widget w; /* unused */
|
||||
XEvent *event; /* unused */
|
||||
String *params; /* unused */
|
||||
Cardinal *num_params; /* unused */
|
||||
{
|
||||
nhUse(w);
|
||||
nhUse(event);
|
||||
@@ -103,20 +106,19 @@ static void no_op(w, event, params, num_params)
|
||||
return;
|
||||
}
|
||||
|
||||
static XtActionsRec actions[] =
|
||||
{
|
||||
{ nhStr("no-op"), no_op },
|
||||
static XtActionsRec actions[] = {
|
||||
{ nhStr("no-op"), no_op },
|
||||
};
|
||||
|
||||
static char translations[] =
|
||||
"<BtnDown>: input() \
|
||||
static char translations[] = "<BtnDown>: input() \
|
||||
";
|
||||
|
||||
/* ARGSUSED */
|
||||
static void Redisplay(w, event, region)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
Region region; /* unused */
|
||||
static void
|
||||
Redisplay(w, event, region)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
Region region; /* unused */
|
||||
{
|
||||
nhUse(region);
|
||||
|
||||
@@ -125,57 +127,63 @@ static void Redisplay(w, event, region)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void Resize(w)
|
||||
Widget w;
|
||||
static void
|
||||
Resize(w)
|
||||
Widget w;
|
||||
{
|
||||
XtCallCallbacks(w, XtNresizeCallback, (caddr_t) 0);
|
||||
}
|
||||
|
||||
|
||||
WindowClassRec windowClassRec = {
|
||||
{ /* core fields */
|
||||
/* superclass */ (WidgetClass) &widgetClassRec,
|
||||
/* class_name */ nhStr("Window"),
|
||||
/* widget_size */ sizeof(WindowRec),
|
||||
/* class_initialize */ 0,
|
||||
/* class_part_initialize */ 0,
|
||||
/* class_inited */ FALSE,
|
||||
/* initialize */ 0,
|
||||
/* initialize_hook */ 0,
|
||||
/* realize */ XtInheritRealize,
|
||||
/* actions */ actions,
|
||||
/* num_actions */ XtNumber(actions),
|
||||
/* resources */ resources,
|
||||
/* num_resources */ XtNumber(resources),
|
||||
/* xrm_class */ NULLQUARK,
|
||||
/* compress_motion */ TRUE,
|
||||
/* compress_exposure */ TRUE,
|
||||
/* compress_enterleave */ TRUE,
|
||||
/* visible_interest */ FALSE,
|
||||
/* destroy */ 0,
|
||||
/* resize */ Resize,
|
||||
/* expose */ Redisplay,
|
||||
/* set_values */ 0,
|
||||
/* set_values_hook */ 0,
|
||||
/* set_values_almost */ XtInheritSetValuesAlmost,
|
||||
/* get_values_hook */ 0,
|
||||
/* accept_focus */ 0,
|
||||
/* version */ XtVersion,
|
||||
/* callback_private */ 0,
|
||||
/* tm_table */ translations,
|
||||
/* query_geometry */ XtInheritQueryGeometry,
|
||||
/* display_accelerator */ XtInheritDisplayAccelerator,
|
||||
/* extension */ 0
|
||||
},
|
||||
{ /* window fields */
|
||||
/* empty */ 0
|
||||
}
|
||||
{ /* core fields */
|
||||
/* superclass */ (WidgetClass) &widgetClassRec,
|
||||
/* class_name */ nhStr("Window"),
|
||||
/* widget_size */ sizeof(WindowRec),
|
||||
/* class_initialize */ 0,
|
||||
/* class_part_initialize */ 0,
|
||||
/* class_inited */ FALSE,
|
||||
/* initialize */ 0,
|
||||
/* initialize_hook */ 0,
|
||||
/* realize */ XtInheritRealize,
|
||||
/* actions */ actions,
|
||||
/* num_actions */ XtNumber(actions),
|
||||
/* resources */ resources,
|
||||
/* num_resources */ XtNumber(resources),
|
||||
/* xrm_class */ NULLQUARK,
|
||||
/* compress_motion */ TRUE,
|
||||
/* compress_exposure */ TRUE,
|
||||
/* compress_enterleave */ TRUE,
|
||||
/* visible_interest */ FALSE,
|
||||
/* destroy */ 0,
|
||||
/* resize */ Resize,
|
||||
/* expose */ Redisplay,
|
||||
/* set_values */ 0,
|
||||
/* set_values_hook */ 0,
|
||||
/* set_values_almost */ XtInheritSetValuesAlmost,
|
||||
/* get_values_hook */ 0,
|
||||
/* accept_focus */ 0,
|
||||
/* version */ XtVersion,
|
||||
/* callback_private */ 0,
|
||||
/* tm_table */ translations,
|
||||
/* query_geometry */ XtInheritQueryGeometry,
|
||||
/* display_accelerator */ XtInheritDisplayAccelerator,
|
||||
/* extension */ 0 },
|
||||
{ /* window fields */
|
||||
/* empty */ 0 }
|
||||
};
|
||||
|
||||
WidgetClass windowWidgetClass = (WidgetClass)&windowClassRec;
|
||||
WidgetClass windowWidgetClass = (WidgetClass) &windowClassRec;
|
||||
|
||||
Font
|
||||
WindowFont(w) Widget w; { return ((WindowWidget)w)->window.font->fid; }
|
||||
WindowFont(w)
|
||||
Widget w;
|
||||
{
|
||||
return ((WindowWidget) w)->window.font->fid;
|
||||
}
|
||||
|
||||
XFontStruct *
|
||||
WindowFontStruct(w) Widget w; { return ((WindowWidget)w)->window.font; }
|
||||
WindowFontStruct(w)
|
||||
Widget w;
|
||||
{
|
||||
return ((WindowWidget) w)->window.font;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user