Commit 475c51bd authored by Jeremy White's avatar Jeremy White
Browse files

Apply Spice style to the spice-video-dummy

Do this using the spice_indent script which uses indent to apply
current Spice styles (as per Frediano Ziglio on 2019-05-01).

This also includes a fixup from Frediano which provides braces
around all ifs and removes extra parens from returns.
parent 0980d14b
......@@ -5,21 +5,38 @@
# x11spice code largely conform to the Spice Project Coding Style.
# It's preserved here as a form of documentation.
# Note: Spice is now relaxed about function declarations,
# and allow either style, e.g.
# char *func() or
#
# char *
# func()
# That requires calling indent with some thoughtfulness
# By default, it will break procedure types onto newlines
# if you have a file that does not do that, you may want
# to add
# --dont-break-procedure-type
# to your invocation.
if [ ! -f "$1" ] ; then
echo Error: specify a filename to process with indent
echo Usage:
echo 'spice_indent <filename> [ extra-options ]'
exit 1
fi
fname="$1"
shift
indent "$1" \
indent "$fname" \
--no-space-after-function-call-names \
--dont-break-procedure-type \
--braces-after-func-def-line \
--braces-on-if-line \
--braces-on-struct-decl-line \
--line-length 100 \
--no-space-after-parentheses \
--no-tabs \
--case-indentation 4 \
--case-indentation 0 \
--tab-size 4\
--indent-label 0\
--indent-level 4\
......@@ -28,6 +45,7 @@ indent "$1" \
--space-after-while \
--space-after-casts \
--space-after-if \
--cuddle-else \
-T agent_t \
-T SpiceCharDeviceInstance \
-T SpiceChannelEventInfo \
......@@ -64,3 +82,5 @@ indent "$1" \
-T xdummy_t \
-T x11spice_server_t \
-T test_t \
-T Bool \
"$@"
......@@ -29,15 +29,13 @@ extern void DUMMYShowCursor(ScrnInfoPtr pScrn);
extern void DUMMYHideCursor(ScrnInfoPtr pScrn);
/* globals */
typedef struct _color
{
typedef struct _color {
int red;
int green;
int blue;
} dummy_colors;
typedef struct dummyRec
{
typedef struct dummyRec {
/* options */
OptionInfoPtr Options;
Bool swCursor;
......@@ -50,10 +48,9 @@ typedef struct dummyRec
int cursorFG, cursorBG;
dummy_colors colors[1024];
Bool (*CreateWindow)() ; /* wrapped CreateWindow */
Bool (*CreateWindow)(); /* wrapped CreateWindow */
Bool prop;
} DUMMYRec, *DUMMYPtr;
/* The privates of the DUMMY driver */
#define DUMMYPTR(p) ((DUMMYPtr)((p)->driverPrivate))
......@@ -17,7 +17,7 @@ dummyShowCursor(ScrnInfoPtr pScrn)
DUMMYPtr dPtr = DUMMYPTR(pScrn);
/* turn cursor on */
dPtr->DummyHWCursorShown = TRUE;
dPtr->DummyHWCursorShown = TRUE;
}
static void
......@@ -26,7 +26,7 @@ dummyHideCursor(ScrnInfoPtr pScrn)
DUMMYPtr dPtr = DUMMYPTR(pScrn);
/*
* turn cursor off
* turn cursor off
*
*/
dPtr->DummyHWCursorShown = FALSE;
......@@ -47,7 +47,7 @@ static void
dummySetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
DUMMYPtr dPtr = DUMMYPTR(pScrn);
dPtr->cursorFG = fg;
dPtr->cursorBG = bg;
}
......@@ -61,11 +61,11 @@ static Bool
dummyUseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
{
DUMMYPtr dPtr = DUMMYPTR(xf86ScreenToScrn(pScr));
return(!dPtr->swCursor);
return (!dPtr->swCursor);
}
#if 0
static unsigned char*
static unsigned char *
dummyRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
return NULL;
......@@ -79,7 +79,9 @@ DUMMYCursorInit(ScreenPtr pScreen)
xf86CursorInfoPtr infoPtr;
infoPtr = xf86CreateCursorInfoRec();
if(!infoPtr) return FALSE;
if (!infoPtr) {
return FALSE;
}
dPtr->CursorInfo = infoPtr;
......@@ -94,9 +96,6 @@ DUMMYCursorInit(ScreenPtr pScreen)
infoPtr->ShowCursor = dummyShowCursor;
infoPtr->UseHWCursor = dummyUseHWCursor;
/* infoPtr->RealizeCursor = dummyRealizeCursor; */
return(xf86InitCursor(pScreen, infoPtr));
}
return (xf86InitCursor(pScreen, infoPtr));
}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment