aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/src/kdrive.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /xorg-server/hw/kdrive/src/kdrive.c
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/hw/kdrive/src/kdrive.c')
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.c1205
1 files changed, 571 insertions, 634 deletions
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c
index 78b0017a6..79f888096 100644
--- a/xorg-server/hw/kdrive/src/kdrive.c
+++ b/xorg-server/hw/kdrive/src/kdrive.c
@@ -46,198 +46,192 @@
#include <signal.h>
typedef struct _kdDepths {
- CARD8 depth;
- CARD8 bpp;
+ CARD8 depth;
+ CARD8 bpp;
} KdDepths;
-KdDepths kdDepths[] = {
- { 1, 1 },
- { 4, 4 },
- { 8, 8 },
- { 15, 16 },
- { 16, 16 },
- { 24, 32 },
- { 32, 32 }
+KdDepths kdDepths[] = {
+ {1, 1},
+ {4, 4},
+ {8, 8},
+ {15, 16},
+ {16, 16},
+ {24, 32},
+ {32, 32}
};
#define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
#define KD_DEFAULT_BUTTONS 5
-DevPrivateKeyRec kdScreenPrivateKeyRec;
-unsigned long kdGeneration;
-
-Bool kdVideoTest;
-unsigned long kdVideoTestTime;
-Bool kdEmulateMiddleButton;
-Bool kdRawPointerCoordinates;
-Bool kdDisableZaphod;
-Bool kdAllowZap;
-Bool kdEnabled;
-int kdSubpixelOrder;
-int kdVirtualTerminal = -1;
-Bool kdSwitchPending;
-char *kdSwitchCmd;
-DDXPointRec kdOrigin;
-Bool kdHasPointer = FALSE;
-Bool kdHasKbd = FALSE;
-
-static Bool kdCaughtSignal = FALSE;
+DevPrivateKeyRec kdScreenPrivateKeyRec;
+unsigned long kdGeneration;
+
+Bool kdVideoTest;
+unsigned long kdVideoTestTime;
+Bool kdEmulateMiddleButton;
+Bool kdRawPointerCoordinates;
+Bool kdDisableZaphod;
+Bool kdAllowZap;
+Bool kdEnabled;
+int kdSubpixelOrder;
+int kdVirtualTerminal = -1;
+Bool kdSwitchPending;
+char *kdSwitchCmd;
+DDXPointRec kdOrigin;
+Bool kdHasPointer = FALSE;
+Bool kdHasKbd = FALSE;
+
+static Bool kdCaughtSignal = FALSE;
/*
* Carry arguments from InitOutput through driver initialization
* to KdScreenInit
*/
-KdOsFuncs *kdOsFuncs;
+KdOsFuncs *kdOsFuncs;
void
-KdDisableScreen (ScreenPtr pScreen)
+KdDisableScreen(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
if (!pScreenPriv->enabled)
- return;
+ return;
if (!pScreenPriv->closed)
- SetRootClip (pScreen, FALSE);
- KdDisableColormap (pScreen);
+ SetRootClip(pScreen, FALSE);
+ KdDisableColormap(pScreen);
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
- (*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
- if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor)
- (*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
+ (*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
+ if (!pScreenPriv->screen->softCursor &&
+ pScreenPriv->card->cfuncs->disableCursor)
+ (*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
if (pScreenPriv->card->cfuncs->dpms)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
pScreenPriv->enabled = FALSE;
- if(pScreenPriv->card->cfuncs->disable)
+ if (pScreenPriv->card->cfuncs->disable)
(*pScreenPriv->card->cfuncs->disable) (pScreen);
}
static void
-KdDoSwitchCmd (const char *reason)
+KdDoSwitchCmd(const char *reason)
{
- if (kdSwitchCmd)
- {
- char *command;
-
- if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1)
- return;
- system (command);
- free(command);
+ if (kdSwitchCmd) {
+ char *command;
+
+ if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1)
+ return;
+ system(command);
+ free(command);
}
}
void
-KdSuspend (void)
+KdSuspend(void)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (kdEnabled)
- {
- for (card = kdCardInfo; card; card = card->next)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- if (screen->mynum == card->selected && screen->pScreen)
- KdDisableScreen (screen->pScreen);
- if (card->driver && card->cfuncs->restore)
- (*card->cfuncs->restore) (card);
- }
- KdDisableInput ();
- KdDoSwitchCmd ("suspend");
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (kdEnabled) {
+ for (card = kdCardInfo; card; card = card->next) {
+ for (screen = card->screenList; screen; screen = screen->next)
+ if (screen->mynum == card->selected && screen->pScreen)
+ KdDisableScreen(screen->pScreen);
+ if (card->driver && card->cfuncs->restore)
+ (*card->cfuncs->restore) (card);
+ }
+ KdDisableInput();
+ KdDoSwitchCmd("suspend");
}
}
void
-KdDisableScreens (void)
+KdDisableScreens(void)
{
- KdSuspend ();
- if (kdEnabled)
- {
+ KdSuspend();
+ if (kdEnabled) {
if (kdOsFuncs->Disable)
(*kdOsFuncs->Disable) ();
- kdEnabled = FALSE;
+ kdEnabled = FALSE;
}
}
Bool
-KdEnableScreen (ScreenPtr pScreen)
+KdEnableScreen(ScreenPtr pScreen)
{
- KdScreenPriv (pScreen);
+ KdScreenPriv(pScreen);
if (pScreenPriv->enabled)
- return TRUE;
- if(pScreenPriv->card->cfuncs->enable)
- if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
- return FALSE;
+ return TRUE;
+ if (pScreenPriv->card->cfuncs->enable)
+ if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
+ return FALSE;
pScreenPriv->enabled = TRUE;
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
pScreenPriv->card->selected = pScreenPriv->screen->mynum;
- if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor)
- (*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
+ if (!pScreenPriv->screen->softCursor &&
+ pScreenPriv->card->cfuncs->enableCursor)
+ (*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
- (*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
- KdEnableColormap (pScreen);
- SetRootClip (pScreen, TRUE);
+ (*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
+ KdEnableColormap(pScreen);
+ SetRootClip(pScreen, TRUE);
if (pScreenPriv->card->cfuncs->dpms)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
return TRUE;
}
void
-KdResume (void)
+KdResume(void)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (kdEnabled)
- {
- KdDoSwitchCmd ("resume");
- for (card = kdCardInfo; card; card = card->next)
- {
- if(card->cfuncs->preserve)
- (*card->cfuncs->preserve) (card);
- for (screen = card->screenList; screen; screen = screen->next)
- if (screen->mynum == card->selected && screen->pScreen)
- KdEnableScreen (screen->pScreen);
- }
- KdEnableInput ();
- KdReleaseAllKeys ();
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (kdEnabled) {
+ KdDoSwitchCmd("resume");
+ for (card = kdCardInfo; card; card = card->next) {
+ if (card->cfuncs->preserve)
+ (*card->cfuncs->preserve) (card);
+ for (screen = card->screenList; screen; screen = screen->next)
+ if (screen->mynum == card->selected && screen->pScreen)
+ KdEnableScreen(screen->pScreen);
+ }
+ KdEnableInput();
+ KdReleaseAllKeys();
}
}
void
-KdEnableScreens (void)
+KdEnableScreens(void)
{
- if (!kdEnabled)
- {
- kdEnabled = TRUE;
+ if (!kdEnabled) {
+ kdEnabled = TRUE;
if (kdOsFuncs->Enable)
(*kdOsFuncs->Enable) ();
}
- KdResume ();
+ KdResume();
}
void
-KdProcessSwitch (void)
+KdProcessSwitch(void)
{
if (kdEnabled)
- KdDisableScreens ();
+ KdDisableScreens();
else
- KdEnableScreens ();
+ KdEnableScreens();
}
#ifndef _MSC_VER
void
AbortDDX(enum ExitCode error)
{
- KdDisableScreens ();
- if (kdOsFuncs)
- {
- if (kdEnabled && kdOsFuncs->Disable)
- (*kdOsFuncs->Disable) ();
+ KdDisableScreens();
+ if (kdOsFuncs) {
+ if (kdEnabled && kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
if (kdOsFuncs->Fini)
(*kdOsFuncs->Fini) ();
- KdDoSwitchCmd ("stop");
+ KdDoSwitchCmd("stop");
}
if (kdCaughtSignal)
@@ -245,59 +239,57 @@ AbortDDX(enum ExitCode error)
}
void
-ddxGiveUp (enum ExitCode error)
+ddxGiveUp(enum ExitCode error)
{
- AbortDDX (error);
+ AbortDDX(error);
}
#endif
-Bool kdDumbDriver;
-Bool kdSoftCursor;
+Bool kdDumbDriver;
+Bool kdSoftCursor;
char *
-KdParseFindNext (char *cur, const char *delim, char *save, char *last)
+KdParseFindNext(char *cur, const char *delim, char *save, char *last)
{
- while (*cur && !strchr (delim, *cur))
- {
- *save++ = *cur++;
+ while (*cur && !strchr(delim, *cur)) {
+ *save++ = *cur++;
}
*save = 0;
*last = *cur;
if (*cur)
- cur++;
+ cur++;
return cur;
}
Rotation
-KdAddRotation (Rotation a, Rotation b)
+KdAddRotation(Rotation a, Rotation b)
{
- Rotation rotate = (a & RR_Rotate_All) * (b & RR_Rotate_All);
- Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
+ Rotation rotate = (a & RR_Rotate_All) * (b & RR_Rotate_All);
+ Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
if (rotate > RR_Rotate_270)
- rotate /= (RR_Rotate_270 * RR_Rotate_90);
+ rotate /= (RR_Rotate_270 * RR_Rotate_90);
return reflect | rotate;
}
Rotation
-KdSubRotation (Rotation a, Rotation b)
+KdSubRotation(Rotation a, Rotation b)
{
- Rotation rotate = (a & RR_Rotate_All) * 16 / (b & RR_Rotate_All);
- Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
+ Rotation rotate = (a & RR_Rotate_All) * 16 / (b & RR_Rotate_All);
+ Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
if (rotate > RR_Rotate_270)
- rotate /= (RR_Rotate_270 * RR_Rotate_90);
+ rotate /= (RR_Rotate_270 * RR_Rotate_90);
return reflect | rotate;
}
void
-KdParseScreen (KdScreenInfo *screen,
- char *arg)
+KdParseScreen(KdScreenInfo * screen, char *arg)
{
- char delim;
- char save[1024];
- int i;
- int pixels, mm;
+ char delim;
+ char save[1024];
+ int i;
+ int pixels, mm;
screen->dumb = kdDumbDriver;
screen->softCursor = kdSoftCursor;
@@ -311,39 +303,35 @@ KdParseScreen (KdScreenInfo *screen,
screen->rate = 0;
screen->fb.depth = 0;
if (!arg)
- return;
- if (strlen (arg) >= sizeof (save))
- return;
-
- for (i = 0; i < 2; i++)
- {
- arg = KdParseFindNext (arg, "x/@XY", save, &delim);
- if (!save[0])
- return;
-
- pixels = atoi(save);
- mm = 0;
-
- if (delim == '/')
- {
- arg = KdParseFindNext (arg, "x@XY", save, &delim);
- if (!save[0])
- return;
- mm = atoi(save);
- }
-
- if (i == 0)
- {
- screen->width = pixels;
- screen->width_mm = mm;
- }
- else
- {
- screen->height = pixels;
- screen->height_mm = mm;
- }
- if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
- return;
+ return;
+ if (strlen(arg) >= sizeof(save))
+ return;
+
+ for (i = 0; i < 2; i++) {
+ arg = KdParseFindNext(arg, "x/@XY", save, &delim);
+ if (!save[0])
+ return;
+
+ pixels = atoi(save);
+ mm = 0;
+
+ if (delim == '/') {
+ arg = KdParseFindNext(arg, "x@XY", save, &delim);
+ if (!save[0])
+ return;
+ mm = atoi(save);
+ }
+
+ if (i == 0) {
+ screen->width = pixels;
+ screen->width_mm = mm;
+ }
+ else {
+ screen->height = pixels;
+ screen->height_mm = mm;
+ }
+ if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
+ return;
}
kdOrigin.x += screen->width;
@@ -352,55 +340,49 @@ KdParseScreen (KdScreenInfo *screen,
kdSoftCursor = FALSE;
kdSubpixelOrder = SubPixelUnknown;
- if (delim == '@')
- {
- arg = KdParseFindNext (arg, "xXY", save, &delim);
- if (save[0])
- {
- int rotate = atoi (save);
- if (rotate < 45)
- screen->randr = RR_Rotate_0;
- else if (rotate < 135)
- screen->randr = RR_Rotate_90;
- else if (rotate < 225)
- screen->randr = RR_Rotate_180;
- else if (rotate < 315)
- screen->randr = RR_Rotate_270;
- else
- screen->randr = RR_Rotate_0;
- }
+ if (delim == '@') {
+ arg = KdParseFindNext(arg, "xXY", save, &delim);
+ if (save[0]) {
+ int rotate = atoi(save);
+
+ if (rotate < 45)
+ screen->randr = RR_Rotate_0;
+ else if (rotate < 135)
+ screen->randr = RR_Rotate_90;
+ else if (rotate < 225)
+ screen->randr = RR_Rotate_180;
+ else if (rotate < 315)
+ screen->randr = RR_Rotate_270;
+ else
+ screen->randr = RR_Rotate_0;
+ }
}
- if (delim == 'X')
- {
- arg = KdParseFindNext (arg, "xY", save, &delim);
- screen->randr |= RR_Reflect_X;
+ if (delim == 'X') {
+ arg = KdParseFindNext(arg, "xY", save, &delim);
+ screen->randr |= RR_Reflect_X;
}
- if (delim == 'Y')
- {
- arg = KdParseFindNext (arg, "xY", save, &delim);
- screen->randr |= RR_Reflect_Y;
+ if (delim == 'Y') {
+ arg = KdParseFindNext(arg, "xY", save, &delim);
+ screen->randr |= RR_Reflect_Y;
}
- arg = KdParseFindNext (arg, "x/,", save, &delim);
- if (save[0])
- {
- screen->fb.depth = atoi(save);
- if (delim == '/')
- {
- arg = KdParseFindNext (arg, "x,", save, &delim);
- if (save[0])
- screen->fb.bitsPerPixel = atoi (save);
- }
- else
- screen->fb.bitsPerPixel = 0;
+ arg = KdParseFindNext(arg, "x/,", save, &delim);
+ if (save[0]) {
+ screen->fb.depth = atoi(save);
+ if (delim == '/') {
+ arg = KdParseFindNext(arg, "x,", save, &delim);
+ if (save[0])
+ screen->fb.bitsPerPixel = atoi(save);
+ }
+ else
+ screen->fb.bitsPerPixel = 0;
}
- if (delim == 'x')
- {
- arg = KdParseFindNext (arg, "x", save, &delim);
- if (save[0])
- screen->rate = atoi(save);
+ if (delim == 'x') {
+ arg = KdParseFindNext(arg, "x", save, &delim);
+ if (save[0])
+ screen->rate = atoi(save);
}
}
@@ -416,162 +398,154 @@ KdParseScreen (KdScreenInfo *screen,
*/
void
-KdParseRgba (char *rgba)
+KdParseRgba(char *rgba)
{
- if (!strcmp (rgba, "rgb"))
- kdSubpixelOrder = SubPixelHorizontalRGB;
- else if (!strcmp (rgba, "bgr"))
- kdSubpixelOrder = SubPixelHorizontalBGR;
- else if (!strcmp (rgba, "vrgb"))
- kdSubpixelOrder = SubPixelVerticalRGB;
- else if (!strcmp (rgba, "vbgr"))
- kdSubpixelOrder = SubPixelVerticalBGR;
- else if (!strcmp (rgba, "none"))
- kdSubpixelOrder = SubPixelNone;
+ if (!strcmp(rgba, "rgb"))
+ kdSubpixelOrder = SubPixelHorizontalRGB;
+ else if (!strcmp(rgba, "bgr"))
+ kdSubpixelOrder = SubPixelHorizontalBGR;
+ else if (!strcmp(rgba, "vrgb"))
+ kdSubpixelOrder = SubPixelVerticalRGB;
+ else if (!strcmp(rgba, "vbgr"))
+ kdSubpixelOrder = SubPixelVerticalBGR;
+ else if (!strcmp(rgba, "none"))
+ kdSubpixelOrder = SubPixelNone;
else
- kdSubpixelOrder = SubPixelUnknown;
+ kdSubpixelOrder = SubPixelUnknown;
}
void
-KdUseMsg (void)
+KdUseMsg(void)
{
ErrorF("\nTinyX Device Dependent Usage:\n");
- ErrorF("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP[xFREQ]] Specify screen characteristics\n");
- ErrorF("-rgba rgb/bgr/vrgb/vbgr/none Specify subpixel ordering for LCD panels\n");
- ErrorF("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n");
- ErrorF("-keybd driver [,,options] Specify the keyboard driver and its options\n");
+ ErrorF
+ ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP[xFREQ]] Specify screen characteristics\n");
+ ErrorF
+ ("-rgba rgb/bgr/vrgb/vbgr/none Specify subpixel ordering for LCD panels\n");
+ ErrorF
+ ("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n");
+ ErrorF
+ ("-keybd driver [,,options] Specify the keyboard driver and its options\n");
ErrorF("-zaphod Disable cursor screen switching\n");
ErrorF("-2button Emulate 3 button mouse\n");
ErrorF("-3button Disable 3 button mouse emulation\n");
- ErrorF("-rawcoord Don't transform pointer coordinates on rotation\n");
+ ErrorF
+ ("-rawcoord Don't transform pointer coordinates on rotation\n");
ErrorF("-dumb Disable hardware acceleration\n");
ErrorF("-softCursor Force software cursor\n");
ErrorF("-videoTest Start the server, pause momentarily and exit\n");
- ErrorF("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
+ ErrorF
+ ("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
ErrorF("-switchCmd Command to execute on vt switch\n");
ErrorF("-zap Terminate server on Ctrl+Alt+Backspace\n");
- ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
+ ErrorF
+ ("vtxx Use virtual terminal xx instead of the next available\n");
}
int
-KdProcessArgument (int argc, char **argv, int i)
+KdProcessArgument(int argc, char **argv, int i)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (!strcmp (argv[i], "-screen"))
- {
- if ((i+1) < argc)
- {
- card = KdCardInfoLast ();
- if (!card)
- {
- InitCard (0);
- card = KdCardInfoLast ();
- }
- if (card) {
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, argv[i+1]);
- } else
- ErrorF("No matching card found!\n");
- }
- else
- UseMsg ();
- return 2;
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (!strcmp(argv[i], "-screen")) {
+ if ((i + 1) < argc) {
+ card = KdCardInfoLast();
+ if (!card) {
+ InitCard(0);
+ card = KdCardInfoLast();
+ }
+ if (card) {
+ screen = KdScreenInfoAdd(card);
+ KdParseScreen(screen, argv[i + 1]);
+ }
+ else
+ ErrorF("No matching card found!\n");
+ }
+ else
+ UseMsg();
+ return 2;
}
- if (!strcmp (argv[i], "-zaphod"))
- {
- kdDisableZaphod = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-zaphod")) {
+ kdDisableZaphod = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-zap"))
- {
- kdAllowZap = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-zap")) {
+ kdAllowZap = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-3button"))
- {
- kdEmulateMiddleButton = FALSE;
- return 1;
+ if (!strcmp(argv[i], "-3button")) {
+ kdEmulateMiddleButton = FALSE;
+ return 1;
}
- if (!strcmp (argv[i], "-2button"))
- {
- kdEmulateMiddleButton = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-2button")) {
+ kdEmulateMiddleButton = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-rawcoord"))
- {
- kdRawPointerCoordinates = 1;
- return 1;
+ if (!strcmp(argv[i], "-rawcoord")) {
+ kdRawPointerCoordinates = 1;
+ return 1;
}
- if (!strcmp (argv[i], "-dumb"))
- {
- kdDumbDriver = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-dumb")) {
+ kdDumbDriver = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-softCursor"))
- {
- kdSoftCursor = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-softCursor")) {
+ kdSoftCursor = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-videoTest"))
- {
- kdVideoTest = TRUE;
- return 1;
+ if (!strcmp(argv[i], "-videoTest")) {
+ kdVideoTest = TRUE;
+ return 1;
}
- if (!strcmp (argv[i], "-origin"))
- {
- if ((i+1) < argc)
- {
- char *x = argv[i+1];
- char *y = strchr (x, ',');
- if (x)
- kdOrigin.x = atoi (x);
- else
- kdOrigin.x = 0;
- if (y)
- kdOrigin.y = atoi(y+1);
- else
- kdOrigin.y = 0;
- }
- else
- UseMsg ();
- return 2;
+ if (!strcmp(argv[i], "-origin")) {
+ if ((i + 1) < argc) {
+ char *x = argv[i + 1];
+ char *y = strchr(x, ',');
+
+ if (x)
+ kdOrigin.x = atoi(x);
+ else
+ kdOrigin.x = 0;
+ if (y)
+ kdOrigin.y = atoi(y + 1);
+ else
+ kdOrigin.y = 0;
+ }
+ else
+ UseMsg();
+ return 2;
}
- if (!strcmp (argv[i], "-rgba"))
- {
- if ((i+1) < argc)
- KdParseRgba (argv[i+1]);
- else
- UseMsg ();
- return 2;
+ if (!strcmp(argv[i], "-rgba")) {
+ if ((i + 1) < argc)
+ KdParseRgba(argv[i + 1]);
+ else
+ UseMsg();
+ return 2;
}
- if (!strcmp (argv[i], "-switchCmd"))
- {
- if ((i+1) < argc)
- kdSwitchCmd = argv[i+1];
- else
- UseMsg ();
- return 2;
+ if (!strcmp(argv[i], "-switchCmd")) {
+ if ((i + 1) < argc)
+ kdSwitchCmd = argv[i + 1];
+ else
+ UseMsg();
+ return 2;
}
- if (!strncmp (argv[i], "vt", 2) &&
- sscanf (argv[i], "vt%2d", &kdVirtualTerminal) == 1)
- {
- return 1;
+ if (!strncmp(argv[i], "vt", 2) &&
+ sscanf(argv[i], "vt%2d", &kdVirtualTerminal) == 1) {
+ return 1;
}
- if (!strcmp (argv[i], "-mouse") ||
- !strcmp (argv[i], "-pointer")) {
+ if (!strcmp(argv[i], "-mouse") || !strcmp(argv[i], "-pointer")) {
if (i + 1 >= argc)
UseMsg();
KdAddConfigPointer(argv[i + 1]);
- kdHasPointer = TRUE;
+ kdHasPointer = TRUE;
return 2;
}
- if (!strcmp (argv[i], "-keybd")) {
+ if (!strcmp(argv[i], "-keybd")) {
if (i + 1 >= argc)
UseMsg();
KdAddConfigKeyboard(argv[i + 1]);
- kdHasKbd = TRUE;
+ kdHasKbd = TRUE;
return 2;
}
@@ -584,116 +558,110 @@ KdProcessArgument (int argc, char **argv, int i)
*/
void
-KdOsInit (KdOsFuncs *pOsFuncs)
+KdOsInit(KdOsFuncs * pOsFuncs)
{
kdOsFuncs = pOsFuncs;
- if (pOsFuncs)
- {
- if (serverGeneration == 1)
- {
- KdDoSwitchCmd ("start");
+ if (pOsFuncs) {
+ if (serverGeneration == 1) {
+ KdDoSwitchCmd("start");
if (pOsFuncs->Init)
(*pOsFuncs->Init) ();
- }
+ }
}
}
Bool
-KdAllocatePrivates (ScreenPtr pScreen)
+KdAllocatePrivates(ScreenPtr pScreen)
{
- KdPrivScreenPtr pScreenPriv;
+ KdPrivScreenPtr pScreenPriv;
if (kdGeneration != serverGeneration)
- kdGeneration = serverGeneration;
+ kdGeneration = serverGeneration;
if (!dixRegisterPrivateKey(&kdScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
- pScreenPriv = calloc(1, sizeof (*pScreenPriv));
+ pScreenPriv = calloc(1, sizeof(*pScreenPriv));
if (!pScreenPriv)
- return FALSE;
- KdSetScreenPriv (pScreen, pScreenPriv);
+ return FALSE;
+ KdSetScreenPriv(pScreen, pScreenPriv);
return TRUE;
}
Bool
-KdCreateScreenResources (ScreenPtr pScreen)
+KdCreateScreenResources(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
+ KdCardInfo *card = pScreenPriv->card;
Bool ret;
pScreen->CreateScreenResources = pScreenPriv->CreateScreenResources;
- if(pScreen->CreateScreenResources)
- ret = (*pScreen->CreateScreenResources) (pScreen);
+ if (pScreen->CreateScreenResources)
+ ret = (*pScreen->CreateScreenResources) (pScreen);
else
- ret= -1;
+ ret = -1;
pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = KdCreateScreenResources;
if (ret && card->cfuncs->createRes)
- ret = (*card->cfuncs->createRes) (pScreen);
+ ret = (*card->cfuncs->createRes) (pScreen);
return ret;
}
Bool
-KdCloseScreen (int index, ScreenPtr pScreen)
+KdCloseScreen(int index, ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- KdCardInfo *card = pScreenPriv->card;
- Bool ret;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdCardInfo *card = pScreenPriv->card;
+ Bool ret;
pScreenPriv->closed = TRUE;
pScreen->CloseScreen = pScreenPriv->CloseScreen;
- if(pScreen->CloseScreen)
+ if (pScreen->CloseScreen)
ret = (*pScreen->CloseScreen) (index, pScreen);
else
- ret = TRUE;
+ ret = TRUE;
if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
- (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
+ (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
if (screen->mynum == card->selected)
- KdDisableScreen (pScreen);
+ KdDisableScreen(pScreen);
/*
* Restore video hardware when last screen is closed
*/
- if (screen == card->screenList)
- {
- if (kdEnabled && card->cfuncs->restore)
- (*card->cfuncs->restore) (card);
+ if (screen == card->screenList) {
+ if (kdEnabled && card->cfuncs->restore)
+ (*card->cfuncs->restore) (card);
}
if (!pScreenPriv->screen->dumb && card->cfuncs->finiAccel)
- (*card->cfuncs->finiAccel) (pScreen);
+ (*card->cfuncs->finiAccel) (pScreen);
if (!pScreenPriv->screen->softCursor && card->cfuncs->finiCursor)
- (*card->cfuncs->finiCursor) (pScreen);
+ (*card->cfuncs->finiCursor) (pScreen);
- if(card->cfuncs->scrfini)
+ if (card->cfuncs->scrfini)
(*card->cfuncs->scrfini) (screen);
/*
* Clean up card when last screen is closed, DIX closes them in
* reverse order, thus we check for when the first in the list is closed
*/
- if (screen == card->screenList)
- {
- if(card->cfuncs->cardfini)
- (*card->cfuncs->cardfini) (card);
- /*
- * Clean up OS when last card is closed
- */
- if (card == kdCardInfo)
- {
- if (kdEnabled)
- {
- kdEnabled = FALSE;
- if(kdOsFuncs->Disable)
- (*kdOsFuncs->Disable) ();
- }
- }
+ if (screen == card->screenList) {
+ if (card->cfuncs->cardfini)
+ (*card->cfuncs->cardfini) (card);
+ /*
+ * Clean up OS when last card is closed
+ */
+ if (card == kdCardInfo) {
+ if (kdEnabled) {
+ kdEnabled = FALSE;
+ if (kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
+ }
+ }
}
pScreenPriv->screen->pScreen = 0;
@@ -703,112 +671,107 @@ KdCloseScreen (int index, ScreenPtr pScreen)
}
Bool
-KdSaveScreen (ScreenPtr pScreen, int on)
+KdSaveScreen(ScreenPtr pScreen, int on)
{
KdScreenPriv(pScreen);
- int dpmsState;
+ int dpmsState;
if (!pScreenPriv->card->cfuncs->dpms)
- return FALSE;
+ return FALSE;
dpmsState = pScreenPriv->dpmsState;
switch (on) {
case SCREEN_SAVER_OFF:
- dpmsState = KD_DPMS_NORMAL;
- break;
+ dpmsState = KD_DPMS_NORMAL;
+ break;
case SCREEN_SAVER_ON:
- if (dpmsState == KD_DPMS_NORMAL)
- dpmsState = KD_DPMS_NORMAL+1;
- break;
+ if (dpmsState == KD_DPMS_NORMAL)
+ dpmsState = KD_DPMS_NORMAL + 1;
+ break;
case SCREEN_SAVER_CYCLE:
- if (dpmsState < KD_DPMS_MAX)
- dpmsState++;
- break;
+ if (dpmsState < KD_DPMS_MAX)
+ dpmsState++;
+ break;
case SCREEN_SAVER_FORCER:
- break;
+ break;
}
- if (dpmsState != pScreenPriv->dpmsState)
- {
- if (pScreenPriv->enabled)
- (*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState);
- pScreenPriv->dpmsState = dpmsState;
+ if (dpmsState != pScreenPriv->dpmsState) {
+ if (pScreenPriv->enabled)
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState);
+ pScreenPriv->dpmsState = dpmsState;
}
return TRUE;
}
static Bool
-KdCreateWindow (WindowPtr pWin)
+KdCreateWindow(WindowPtr pWin)
{
#ifndef PHOENIX
- if (!pWin->parent)
- {
- KdScreenPriv(pWin->drawable.pScreen);
-
- if (!pScreenPriv->enabled)
- {
- RegionEmpty(&pWin->borderClip);
- RegionBreak(&pWin->clipList);
- }
+ if (!pWin->parent) {
+ KdScreenPriv(pWin->drawable.pScreen);
+
+ if (!pScreenPriv->enabled) {
+ RegionEmpty(&pWin->borderClip);
+ RegionBreak(&pWin->clipList);
+ }
}
#endif
- return fbCreateWindow (pWin);
+ return fbCreateWindow(pWin);
}
void
-KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
+KdSetSubpixelOrder(ScreenPtr pScreen, Rotation randr)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int subpixel_order = screen->subpixel_order;
- Rotation subpixel_dir;
- int i;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int subpixel_order = screen->subpixel_order;
+ Rotation subpixel_dir;
+ int i;
static struct {
- int subpixel_order;
- Rotation direction;
+ int subpixel_order;
+ Rotation direction;
} orders[] = {
- { SubPixelHorizontalRGB, RR_Rotate_0 },
- { SubPixelHorizontalBGR, RR_Rotate_180 },
- { SubPixelVerticalRGB, RR_Rotate_270 },
- { SubPixelVerticalBGR, RR_Rotate_90 },
- };
+ {
+ SubPixelHorizontalRGB, RR_Rotate_0}, {
+ SubPixelHorizontalBGR, RR_Rotate_180}, {
+ SubPixelVerticalRGB, RR_Rotate_270}, {
+ SubPixelVerticalBGR, RR_Rotate_90},};
static struct {
- int bit;
- int normal;
- int reflect;
+ int bit;
+ int normal;
+ int reflect;
} reflects[] = {
- { RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR },
- { RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB },
- { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR },
- { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB },
- };
+ {
+ RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR}, {
+ RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB}, {
+ RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR}, {
+ RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB},};
/* map subpixel to direction */
for (i = 0; i < 4; i++)
- if (orders[i].subpixel_order == subpixel_order)
- break;
- if (i < 4)
- {
- subpixel_dir = KdAddRotation (randr & RR_Rotate_All, orders[i].direction);
-
- /* map back to subpixel order */
- for (i = 0; i < 4; i++)
- if (orders[i].direction & subpixel_dir)
- {
- subpixel_order = orders[i].subpixel_order;
- break;
- }
- /* reflect */
- for (i = 0; i < 4; i++)
- if ((randr & reflects[i].bit) &&
- reflects[i].normal == subpixel_order)
- {
- subpixel_order = reflects[i].reflect;
- break;
- }
+ if (orders[i].subpixel_order == subpixel_order)
+ break;
+ if (i < 4) {
+ subpixel_dir =
+ KdAddRotation(randr & RR_Rotate_All, orders[i].direction);
+
+ /* map back to subpixel order */
+ for (i = 0; i < 4; i++)
+ if (orders[i].direction & subpixel_dir) {
+ subpixel_order = orders[i].subpixel_order;
+ break;
+ }
+ /* reflect */
+ for (i = 0; i < 4; i++)
+ if ((randr & reflects[i].bit) &&
+ reflects[i].normal == subpixel_order) {
+ subpixel_order = reflects[i].reflect;
+ break;
+ }
}
- PictureSetSubpixelOrder (pScreen, subpixel_order);
+ PictureSetSubpixelOrder(pScreen, subpixel_order);
}
/* Pass through AddScreen, which doesn't take any closure */
@@ -817,34 +780,33 @@ static KdScreenInfo *kdCurrentScreen;
Bool
KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
{
- KdScreenInfo *screen = kdCurrentScreen;
- KdCardInfo *card = screen->card;
- KdPrivScreenPtr pScreenPriv;
+ KdScreenInfo *screen = kdCurrentScreen;
+ KdCardInfo *card = screen->card;
+ KdPrivScreenPtr pScreenPriv;
+
/*
* note that screen->fb is set up for the nominal orientation
* of the screen; that means if randr is rotated, the values
* there should reflect a rotated frame buffer (or shadow).
*/
- Bool rotated = (screen->randr & (RR_Rotate_90|RR_Rotate_270)) != 0;
- int width, height, *width_mmp, *height_mmp;
+ Bool rotated = (screen->randr & (RR_Rotate_90 | RR_Rotate_270)) != 0;
+ int width, height, *width_mmp, *height_mmp;
- KdAllocatePrivates (pScreen);
+ KdAllocatePrivates(pScreen);
pScreenPriv = KdGetScreenPriv(pScreen);
- if (!rotated)
- {
- width = screen->width;
- height = screen->height;
- width_mmp = &screen->width_mm;
- height_mmp = &screen->height_mm;
+ if (!rotated) {
+ width = screen->width;
+ height = screen->height;
+ width_mmp = &screen->width_mm;
+ height_mmp = &screen->height_mm;
}
- else
- {
- width = screen->height;
- height = screen->width;
- width_mmp = &screen->height_mm;
- height_mmp = &screen->width_mm;
+ else {
+ width = screen->height;
+ height = screen->width;
+ width_mmp = &screen->height_mm;
+ height_mmp = &screen->width_mm;
}
screen->pScreen = pScreen;
pScreenPriv->screen = screen;
@@ -855,41 +817,37 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
pScreen->y = screen->origin.y;
if (!monitorResolution)
- monitorResolution = 75;
+ monitorResolution = 75;
/*
* This is done in this order so that backing store wraps
* our GC functions; fbFinishScreenInit initializes MI
* backing store
*/
- if (!fbSetupScreen (pScreen,
- screen->fb.frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb.pixelStride,
- screen->fb.bitsPerPixel))
- {
- return FALSE;
+ if (!fbSetupScreen(pScreen,
+ screen->fb.frameBuffer,
+ width, height,
+ monitorResolution, monitorResolution,
+ screen->fb.pixelStride, screen->fb.bitsPerPixel)) {
+ return FALSE;
}
/*
* Set colormap functions
*/
- pScreen->InstallColormap = KdInstallColormap;
- pScreen->UninstallColormap = KdUninstallColormap;
+ pScreen->InstallColormap = KdInstallColormap;
+ pScreen->UninstallColormap = KdUninstallColormap;
pScreen->ListInstalledColormaps = KdListInstalledColormaps;
- pScreen->StoreColors = KdStoreColors;
-
- pScreen->SaveScreen = KdSaveScreen;
- pScreen->CreateWindow = KdCreateWindow;
-
- if (!fbFinishScreenInit (pScreen,
- screen->fb.frameBuffer,
- width, height,
- monitorResolution, monitorResolution,
- screen->fb.pixelStride,
- screen->fb.bitsPerPixel))
- {
- return FALSE;
+ pScreen->StoreColors = KdStoreColors;
+
+ pScreen->SaveScreen = KdSaveScreen;
+ pScreen->CreateWindow = KdCreateWindow;
+
+ if (!fbFinishScreenInit(pScreen,
+ screen->fb.frameBuffer,
+ width, height,
+ monitorResolution, monitorResolution,
+ screen->fb.pixelStride, screen->fb.bitsPerPixel)) {
+ return FALSE;
}
/*
@@ -897,44 +855,44 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
* Rounding errors are annoying
*/
if (*width_mmp)
- pScreen->mmWidth = *width_mmp;
+ pScreen->mmWidth = *width_mmp;
else
- *width_mmp = pScreen->mmWidth;
+ *width_mmp = pScreen->mmWidth;
if (*height_mmp)
- pScreen->mmHeight = *height_mmp;
+ pScreen->mmHeight = *height_mmp;
else
- *height_mmp = pScreen->mmHeight;
+ *height_mmp = pScreen->mmHeight;
/*
* Plug in our own block/wakeup handlers.
* miScreenInit installs NoopDDA in both places
*/
- pScreen->BlockHandler = KdBlockHandler;
- pScreen->WakeupHandler = KdWakeupHandler;
+ pScreen->BlockHandler = KdBlockHandler;
+ pScreen->WakeupHandler = KdWakeupHandler;
- if (!fbPictureInit (pScreen, 0, 0))
- return FALSE;
+ if (!fbPictureInit(pScreen, 0, 0))
+ return FALSE;
if (card->cfuncs->initScreen)
- if (!(*card->cfuncs->initScreen) (pScreen))
- return FALSE;
+ if (!(*card->cfuncs->initScreen) (pScreen))
+ return FALSE;
if (!screen->dumb && card->cfuncs->initAccel)
- if (!(*card->cfuncs->initAccel) (pScreen))
- screen->dumb = TRUE;
+ if (!(*card->cfuncs->initAccel) (pScreen))
+ screen->dumb = TRUE;
if (card->cfuncs->finishInitScreen)
- if (!(*card->cfuncs->finishInitScreen) (pScreen))
- return FALSE;
+ if (!(*card->cfuncs->finishInitScreen) (pScreen))
+ return FALSE;
#if 0
- fbInitValidateTree (pScreen);
+ fbInitValidateTree(pScreen);
#endif
/*
* Wrap CloseScreen, the order now is:
- * KdCloseScreen
- * miBSCloseScreen
- * fbCloseScreen
+ * KdCloseScreen
+ * miBSCloseScreen
+ * fbCloseScreen
*/
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = KdCloseScreen;
@@ -943,78 +901,70 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
pScreen->CreateScreenResources = KdCreateScreenResources;
if (screen->softCursor ||
- !card->cfuncs->initCursor ||
- !(*card->cfuncs->initCursor) (pScreen))
- {
- /* Use MI for cursor display and event queueing. */
- screen->softCursor = TRUE;
- miDCInitialize(pScreen, &kdPointerScreenFuncs);
+ !card->cfuncs->initCursor || !(*card->cfuncs->initCursor) (pScreen)) {
+ /* Use MI for cursor display and event queueing. */
+ screen->softCursor = TRUE;
+ miDCInitialize(pScreen, &kdPointerScreenFuncs);
}
-
- if (!fbCreateDefColormap (pScreen))
- {
- return FALSE;
+ if (!fbCreateDefColormap(pScreen)) {
+ return FALSE;
}
- KdSetSubpixelOrder (pScreen, screen->randr);
+ KdSetSubpixelOrder(pScreen, screen->randr);
/*
* Enable the hardware
*/
- if (!kdEnabled)
- {
- kdEnabled = TRUE;
- if(kdOsFuncs->Enable)
- (*kdOsFuncs->Enable) ();
+ if (!kdEnabled) {
+ kdEnabled = TRUE;
+ if (kdOsFuncs->Enable)
+ (*kdOsFuncs->Enable) ();
}
- if (screen->mynum == card->selected)
- {
- if(card->cfuncs->preserve)
- (*card->cfuncs->preserve) (card);
- if(card->cfuncs->enable)
- if (!(*card->cfuncs->enable) (pScreen))
- return FALSE;
- pScreenPriv->enabled = TRUE;
- if (!screen->softCursor && card->cfuncs->enableCursor)
- (*card->cfuncs->enableCursor) (pScreen);
- KdEnableColormap (pScreen);
- if (!screen->dumb && card->cfuncs->enableAccel)
- (*card->cfuncs->enableAccel) (pScreen);
+ if (screen->mynum == card->selected) {
+ if (card->cfuncs->preserve)
+ (*card->cfuncs->preserve) (card);
+ if (card->cfuncs->enable)
+ if (!(*card->cfuncs->enable) (pScreen))
+ return FALSE;
+ pScreenPriv->enabled = TRUE;
+ if (!screen->softCursor && card->cfuncs->enableCursor)
+ (*card->cfuncs->enableCursor) (pScreen);
+ KdEnableColormap(pScreen);
+ if (!screen->dumb && card->cfuncs->enableAccel)
+ (*card->cfuncs->enableAccel) (pScreen);
}
return TRUE;
}
void
-KdInitScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv)
+KdInitScreen(ScreenInfo * pScreenInfo,
+ KdScreenInfo * screen, int argc, char **argv)
{
- KdCardInfo *card = screen->card;
+ KdCardInfo *card = screen->card;
(*card->cfuncs->scrinit) (screen);
if (!card->cfuncs->initAccel)
- screen->dumb = TRUE;
+ screen->dumb = TRUE;
if (!card->cfuncs->initCursor)
- screen->softCursor = TRUE;
+ screen->softCursor = TRUE;
}
static Bool
-KdSetPixmapFormats (ScreenInfo *pScreenInfo)
+KdSetPixmapFormats(ScreenInfo * pScreenInfo)
{
- CARD8 depthToBpp[33]; /* depth -> bpp map */
- KdCardInfo *card;
- KdScreenInfo *screen;
- int i;
- int bpp;
+ CARD8 depthToBpp[33]; /* depth -> bpp map */
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+ int i;
+ int bpp;
PixmapFormatRec *format;
for (i = 1; i <= 32; i++)
- depthToBpp[i] = 0;
+ depthToBpp[i] = 0;
/*
* Generate mappings between bitsPerPixel and depth,
@@ -1022,148 +972,135 @@ KdSetPixmapFormats (ScreenInfo *pScreenInfo)
* restrictions on equivalent formats for the same
* depth on different screens
*/
- for (card = kdCardInfo; card; card = card->next)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- {
- bpp = screen->fb.bitsPerPixel;
- if (bpp == 24)
- bpp = 32;
- if (!depthToBpp[screen->fb.depth])
- depthToBpp[screen->fb.depth] = bpp;
- else if (depthToBpp[screen->fb.depth] != bpp)
- return FALSE;
- }
+ for (card = kdCardInfo; card; card = card->next) {
+ for (screen = card->screenList; screen; screen = screen->next) {
+ bpp = screen->fb.bitsPerPixel;
+ if (bpp == 24)
+ bpp = 32;
+ if (!depthToBpp[screen->fb.depth])
+ depthToBpp[screen->fb.depth] = bpp;
+ else if (depthToBpp[screen->fb.depth] != bpp)
+ return FALSE;
+ }
}
/*
* Fill in additional formats
*/
for (i = 0; i < NUM_KD_DEPTHS; i++)
- if (!depthToBpp[kdDepths[i].depth])
- depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp;
+ if (!depthToBpp[kdDepths[i].depth])
+ depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp;
- pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
pScreenInfo->numPixmapFormats = 0;
- for (i = 1; i <= 32; i++)
- {
- if (depthToBpp[i])
- {
- format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
- format->depth = i;
- format->bitsPerPixel = depthToBpp[i];
- format->scanlinePad = BITMAP_SCANLINE_PAD;
- }
+ for (i = 1; i <= 32; i++) {
+ if (depthToBpp[i]) {
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
+ format->depth = i;
+ format->bitsPerPixel = depthToBpp[i];
+ format->scanlinePad = BITMAP_SCANLINE_PAD;
+ }
}
return TRUE;
}
static void
-KdAddScreen (ScreenInfo *pScreenInfo,
- KdScreenInfo *screen,
- int argc,
- char **argv)
+KdAddScreen(ScreenInfo * pScreenInfo,
+ KdScreenInfo * screen, int argc, char **argv)
{
- int i;
+ int i;
+
/*
* Fill in fb visual type masks for this screen
*/
- for (i = 0; i < pScreenInfo->numPixmapFormats; i++)
- {
- unsigned long visuals;
- Pixel rm, gm, bm;
-
- visuals = 0;
- rm = gm = bm = 0;
- if (pScreenInfo->formats[i].depth == screen->fb.depth)
- {
- visuals = screen->fb.visuals;
- rm = screen->fb.redMask;
- gm = screen->fb.greenMask;
- bm = screen->fb.blueMask;
- }
- fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
- visuals,
- 8,
- rm, gm, bm);
+ for (i = 0; i < pScreenInfo->numPixmapFormats; i++) {
+ unsigned long visuals;
+ Pixel rm, gm, bm;
+
+ visuals = 0;
+ rm = gm = bm = 0;
+ if (pScreenInfo->formats[i].depth == screen->fb.depth) {
+ visuals = screen->fb.visuals;
+ rm = screen->fb.redMask;
+ gm = screen->fb.greenMask;
+ bm = screen->fb.blueMask;
+ }
+ fbSetVisualTypesAndMasks(pScreenInfo->formats[i].depth,
+ visuals, 8, rm, gm, bm);
}
kdCurrentScreen = screen;
- AddScreen (KdScreenInit, argc, argv);
+ AddScreen(KdScreenInit, argc, argv);
}
-#if 0 /* This function is not used currently */
+#if 0 /* This function is not used currently */
int
-KdDepthToFb (ScreenPtr pScreen, int depth)
+KdDepthToFb(ScreenPtr pScreen, int depth)
{
KdScreenPriv(pScreen);
for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb.frameBuffer; fb++)
- if (pScreenPriv->screen->fb.depth == depth)
- return fb;
+ if (pScreenPriv->screen->fb.depth == depth)
+ return fb;
}
#endif
static int
-KdSignalWrapper (int signum)
+KdSignalWrapper(int signum)
{
kdCaughtSignal = TRUE;
- return 1; /* use generic OS layer cleanup & abort */
+ return 1; /* use generic OS layer cleanup & abort */
}
void
-KdInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
+KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
- if (!kdCardInfo)
- {
- InitCard (0);
- if (!(card = KdCardInfoLast ()))
- FatalError("No matching cards found!\n");
- screen = KdScreenInfoAdd (card);
- KdParseScreen (screen, 0);
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (!kdCardInfo) {
+ InitCard(0);
+ if (!(card = KdCardInfoLast()))
+ FatalError("No matching cards found!\n");
+ screen = KdScreenInfoAdd(card);
+ KdParseScreen(screen, 0);
}
/*
* Initialize all of the screens for all of the cards
*/
- for (card = kdCardInfo; card; card = card->next)
- {
- int ret=1;
- if(card->cfuncs->cardinit)
- ret=(*card->cfuncs->cardinit) (card);
- if (ret)
- {
- for (screen = card->screenList; screen; screen = screen->next)
- KdInitScreen (pScreenInfo, screen, argc, argv);
- }
+ for (card = kdCardInfo; card; card = card->next) {
+ int ret = 1;
+
+ if (card->cfuncs->cardinit)
+ ret = (*card->cfuncs->cardinit) (card);
+ if (ret) {
+ for (screen = card->screenList; screen; screen = screen->next)
+ KdInitScreen(pScreenInfo, screen, argc, argv);
+ }
}
/*
* Merge the various pixmap formats together, this can fail
* when two screens share depth but not bitsPerPixel
*/
- if (!KdSetPixmapFormats (pScreenInfo))
- return;
+ if (!KdSetPixmapFormats(pScreenInfo))
+ return;
/*
* Add all of the screens
*/
for (card = kdCardInfo; card; card = card->next)
- for (screen = card->screenList; screen; screen = screen->next)
- KdAddScreen (pScreenInfo, screen, argc, argv);
+ for (screen = card->screenList; screen; screen = screen->next)
+ KdAddScreen(pScreenInfo, screen, argc, argv);
OsRegisterSigWrapper(KdSignalWrapper);
}
@@ -1181,7 +1118,7 @@ DPMSSet(ClientPtr client, int level)
}
Bool
-DPMSSupported (void)
+DPMSSupported(void)
{
return FALSE;
}