diff options
Diffstat (limited to 'nx-X11/programs/Xserver')
32 files changed, 947 insertions, 370 deletions
diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 6bf7801e7..24e8850d9 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -313,7 +313,7 @@ XPFBLIBS = dix/LibraryTargetName(xpstubs) FONTBASE = $(FONTLIBSRC)/fontbase.o \ $(FONTLIBSRC)/LibraryTargetName(fontbase) #if XserverStaticFontLib - FONT = $(FONTLIBSRC)/LibraryTargetName(Xfont) $(FREETYPE2LIB) + FONT = $(FONTLIBSRC)/LibraryTargetName(NX_Xfont) $(FREETYPE2LIB) #else FONT = $(LDPRELIB) $(XFONTLIB) $(FREETYPE2LIB) #endif @@ -994,7 +994,7 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \ dix/main.o #endif -XPMLIB = -lXpm +XPMLIB = -lNX_Xpm NXAGENT = hw/nxagent/LibraryTargetName(nxagent) NXAGENTLIBS = PreFbLibs $(NXAGENT) FbPostFbLibs $(NXAGENT) $(MI) NXAGENTSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS) $(XPMLIB) @@ -1012,16 +1012,19 @@ $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS) #if defined(SunArchitecture) NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext -L ../../../nxcompshad \ - -lXcomp -lXcompext -lXcompshad -lrt -L/usr/sfw/lib -lXrender -lXfixes \ - -L../../../nx-X11/exports/lib -lXtst -lXdamage -lXrandr -lXcomposite + -lXcomp -lXcompext -lXcompshad -lrt -L/usr/sfw/lib -lNX_Xrender -lNX_Xfixes \ + -L../../../nx-X11/exports/lib -lNX_Xtst -lNX_Xdamage -lNX_Xrandr -lNX_Xcomposite -lNX_Xdmcp \ +`pkg-config --libs libxml-2.0` #elif defined(cygwinArchitecture) NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext \ - -lXcomp -lXcompext -lXrender -lX11 -lXext -lXcomposite -lXfixes \ - -L ../../../nxcompshad -lXcompshad -L../../../nx-X11/exports/lib -lXtst + -lXcomp -lXcompext -lNX_Xrender -lX11 -lNX_Xext -lNX_Xcomposite -lNX_Xfixes \ + -L ../../../nxcompshad -lXcompshad -L../../../nx-X11/exports/lib -lNX_Xtst -lNX_Xdmcp \ +`pkg-config --libs libxml-2.0` #else NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext -L ../../../nxcompshad \ - -lXcomp -lXcompext -lXcompshad -lXrender -lX11 -lXext -lXfixes \ - -L../../../nx-X11/exports/lib -lXtst -lXdamage -lXrandr -lXcomposite + -lXcomp -lXcompext -lXcompshad -lNX_Xrender -lNX_X11 -lNX_Xext -lNX_Xfixes \ + -L../../../nx-X11/exports/lib -lNX_Xtst -lNX_Xdamage -lNX_Xrandr -lNX_Xcomposite -lNX_Xinerama -lNX_Xdmcp \ +`pkg-config --libs libxml-2.0` #endif #endif @@ -1036,18 +1039,20 @@ NX_XSHADOWLIBDIR = $(XTOP)/../nxcompshad NX_XSHADOWLIBTARGET = $(NX_XSHADOWLIBDIR)/$(NX_XSHADOWLIBNAME) NX_XSHADOWCONFIGTARGET = $(NX_XSHADOWLIBDIR)/config.status +CONFIGURE ?= ./configure + $(NX_XSHADOWCONFIGTARGET): cd $(NX_XSHADOWLIBDIR) && \ - ./configure + ${CONFIGURE} #ifdef SunArchitecture $(NX_XSHADOWLIBTARGET): $(NX_XSHADOWCONFIGTARGET) cd $(NX_XSHADOWLIBDIR) && \ - gmake + ${MAKE} #else $(NX_XSHADOWLIBTARGET): $(NX_XSHADOWCONFIGTARGET) cd $(NX_XSHADOWLIBDIR) && \ - make + rm -f *.o && ${MAKE} #endif ServerTarget(nxagent,$(NX_XSHADOWLIBTARGET) $(NXAGENTDIRS),$(NXAGENTOBJS), \ @@ -1073,7 +1078,7 @@ nxagent_static_nolibs: nxagent else exit 0; fi $(CCLINK) -o nxagent_static_nolibs -Wl,-Bstatic $(LDOPTIONS) $(NXAGENTOBJS) \ $(NXAGENTLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER) $(LDLIBS) $(FONTLIBS) \ - $(LDPRELIBS) $(SYSLIBS) -Wl,-Bdynamic -lXext -lX11 $(EXTRA_LOAD_FLAGS) + $(LDPRELIBS) $(SYSLIBS) -Wl,-Bdynamic -lNX_Xext -lNX_X11 $(EXTRA_LOAD_FLAGS) #endif /* NXAgentServer */ #if defined(XnonServer) && XnonServer diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.c b/nx-X11/programs/Xserver/Xext/panoramiX.c index 33faedc57..a1a5b9f1f 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiX.c +++ b/nx-X11/programs/Xserver/Xext/panoramiX.c @@ -1045,16 +1045,7 @@ ProcXineramaIsActive(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; -#if 1 - { - /* The following hack fools clients into thinking that Xinerama - * is disabled even though it is not. */ - extern Bool PanoramiXExtensionDisabledHack; - rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack; - } -#else rep.state = !noPanoramiXExtension; -#endif if (client->swapped) { register int n; swaps (&rep.sequenceNumber, n); diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.h b/nx-X11/programs/Xserver/Xext/panoramiX.h index 5fa4ed35c..4178b985f 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiX.h +++ b/nx-X11/programs/Xserver/Xext/panoramiX.h @@ -44,7 +44,7 @@ Equipment Corporation. #define _PANORAMIX_H_ #include <X11/extensions/panoramiXext.h> -#include "gcstruct.h" +/*#include "gcstruct.h"*/ typedef struct _PanoramiXData { diff --git a/nx-X11/programs/Xserver/Xext/security.c b/nx-X11/programs/Xserver/Xext/security.c index 2139425b4..fc3bb99e6 100644 --- a/nx-X11/programs/Xserver/Xext/security.c +++ b/nx-X11/programs/Xserver/Xext/security.c @@ -86,7 +86,7 @@ extern unsigned char LbxReqCode; #ifdef NXAGENT_SERVER -#define NX_ALTERNATIVEPOLICYFILE "/usr/lib/xserver/SecurityPolicy" +#define NX_ALTERNATIVEPOLICYFILE "/usr/share/nx/SecurityPolicy" #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index ecf04e226..fad0b62d8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -148,6 +148,8 @@ static int nxagentGetDialogName(void); char nxagentVerbose = 0; +char *nxagentKeystrokeFile = NULL; + int ddxProcessArgument(int argc, char *argv[], int i) { /* @@ -672,6 +674,12 @@ int ddxProcessArgument(int argc, char *argv[], int i) return 1; } + if (!strcmp(argv[i], "-norootlessexit")) { + nxagentChangeOption(NoRootlessExit, True); + return 1; + } + + if (!strcmp(argv[i], "-noonce")) { nxagentOnce = False; @@ -1015,6 +1023,20 @@ int ddxProcessArgument(int argc, char *argv[], int i) return 1; } + if (!strcmp(argv[i], "-keystrokefile")) + { + if (i + 1 < argc) + { + if (NULL != (nxagentKeystrokeFile = strdup(argv[i + 1]))) + { + return 2; + } else { + FatalError("malloc failed"); + } + } + return 0; + } + return 0; } @@ -1855,6 +1877,7 @@ void ddxUseMsg() ErrorF("The NX system adds the following arguments:\n"); ErrorF("-forcenx force use of NX protocol messages assuming communication through nxproxy\n"); ErrorF("-timeout int auto-disconnect timeout in seconds (minimum allowed: 60)\n"); + ErrorF("-norootlessexit don't exit if there are no clients in rootless mode\n"); #ifdef RENDER ErrorF("-norender disable the use of the render extension\n"); ErrorF("-nocomposite disable the use of the composite extension\n"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.h b/nx-X11/programs/Xserver/hw/nxagent/Args.h index 8f4d05d6c..85734be23 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.h @@ -83,4 +83,6 @@ extern int nxagentUserDefinedFontPath; extern int nxagentRemoteMajor; +extern char *nxagentKeystrokeFile; + #endif /* __Args_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 2742e147f..d4fa4a979 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -166,7 +166,9 @@ Bool nxagentValidServerTargets(Atom target) if (target == XA_STRING) return True; if (target == serverTEXT) return True; - + /* by dimbor */ + if (target == serverUTF8_STRING) return True; + return False; } @@ -402,7 +404,12 @@ FIXME: Do we need this? lastServerProperty = X->xselectionrequest.property; lastServerRequestor = X->xselectionrequest.requestor; lastServerTarget = X->xselectionrequest.target; - lastServerTime = X->xselectionrequest.time; + + /* by dimbor */ + if (lastServerTarget != XA_STRING) + lastServerTarget = serverUTF8_STRING; + + lastServerTime = X->xselectionrequest.time; x.u.u.type = SelectionRequest; x.u.selectionRequest.time = GetTimeInMillis(); @@ -424,11 +431,12 @@ FIXME: Do we need this? x.u.selectionRequest.selection = CurrentSelections[i].selection; - /* - * x.u.selectionRequest.target = X->xselectionrequest.target; - */ - - x.u.selectionRequest.target = XA_STRING; + /* by dimbor (idea from zahvatov) */ + if (X->xselectionrequest.target != XA_STRING) + x.u.selectionRequest.target = clientUTF8_STRING; + else + x.u.selectionRequest.target = XA_STRING; + x.u.selectionRequest.property = clientCutProperty; (void) TryClientEvents(lastSelectionOwner[i].client, &x, 1, @@ -1218,10 +1226,11 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, Atom xa_STRING[4]; xEvent x; + /* --- Order changed by dimbor (prevent sending COMPOUND_TEXT to client --- */ xa_STRING[0] = XA_STRING; - xa_STRING[1] = clientTEXT; - xa_STRING[2] = clientCOMPOUND_TEXT; - xa_STRING[3] = clientUTF8_STRING; + xa_STRING[1] = clientUTF8_STRING; + xa_STRING[2] = clientTEXT; + xa_STRING[3] = clientCOMPOUND_TEXT; ChangeWindowProperty(pWin, property, diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 9031c25c7..b01d66cb0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -77,6 +77,7 @@ is" without express or implied warranty. #include "NXlib.h" #include NXAGENT_ICON_NAME +#include X2GOAGENT_ICON_NAME /* * Set here the required log level. @@ -1429,22 +1430,10 @@ FIXME: Use of nxagentParentWindow is strongly deprecated. g = pV.green_mask; b = pV.blue_mask; - if (!pV.red_mask || !pV.green_mask || !pV.blue_mask) - { - nxagentLogoBlack = 0x000000; - nxagentLogoRed = 0xff0000; - nxagentLogoWhite = 0xffffff; - } - else - { - for (or=0, off=0x800000; (r&(off>>or)) == 0; or++); - for (og=0, off=0x800000; (g&(off>>og)) == 0; og++); - for (ob=0, off=0x800000; (b&(off>>ob)) == 0; ob++); - - nxagentLogoRed = nxagentLogoColor(0xff0000); - nxagentLogoBlack = nxagentLogoColor(0x000000); - nxagentLogoWhite = 0xffffff; - } + nxagentLogoBlack = 0x000000; + nxagentLogoRed = 0xff0000; + nxagentLogoWhite = 0xffffff; + nxagentLogoGray = 0x222222; #ifdef WATCH @@ -1941,12 +1930,29 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask) Bool success = False; XlibPixmap IconPixmap; XlibPixmap IconShape; + char* agent_icon_name; + char* agentIconData; + + /* + * selecting x2go icon when running as X2Go agent + */ + if(nxagentX2go) + { + agent_icon_name=X2GOAGENT_ICON_NAME; + agentIconData=x2goagentIconData; + } + else + { + agent_icon_name=NXAGENT_ICON_NAME; + agentIconData=nxagentIconData; + } - snprintf(default_path, PATH_MAX-1, "/usr/NX/share/images/%s", NXAGENT_ICON_NAME); + + snprintf(default_path, PATH_MAX-1, "/usr/NX/share/images/%s", agent_icon_name); if ((icon_fp = fopen(default_path, "r")) == NULL) { - icon_fp = nxagentLookForIconFile(NXAGENT_ICON_NAME, "r", icon_path); + icon_fp = nxagentLookForIconFile(agent_icon_name, "r", icon_path); if (icon_fp != NULL) { @@ -1985,7 +1991,7 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask) { status = XpmCreatePixmapFromData(display, DefaultRootWindow(display), - nxagentIconData, + agentIconData, &IconPixmap, &IconShape, NULL); @@ -2678,22 +2684,10 @@ Bool nxagentReconnectDisplay(void *p0) g = pV.green_mask; b = pV.blue_mask; - if (!pV.red_mask || !pV.green_mask || !pV.blue_mask) - { - nxagentLogoBlack = 0x000000; - nxagentLogoRed = 0xff0000; - nxagentLogoWhite = 0xffffff; - } - else - { - for (or=0, off=0x800000; (r&(off>>or)) == 0; or++); - for (og=0, off=0x800000; (g&(off>>og)) == 0; og++); - for (ob=0, off=0x800000; (b&(off>>ob)) == 0; ob++); - - nxagentLogoRed = nxagentLogoColor(0xff0000); - nxagentLogoBlack = nxagentLogoColor(0x000000); - nxagentLogoWhite = 0xffffff; - } + nxagentLogoBlack = 0x000000; + nxagentLogoRed = 0xff0000; + nxagentLogoWhite = 0xffffff; + nxagentLogoGray = 0x222222; useXpmIcon = nxagentMakeIcon(nxagentDisplay, &nxagentIconPixmap, &nxagentIconShape); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c index 43bf85900..31ff4cf25 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Error.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c @@ -497,7 +497,7 @@ char *nxagentGetRootPath(void) return rootPath; } -char *nxagentGetSessionPath() +char *nxagentGetSessionPath(void) { char *rootPath; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.h b/nx-X11/programs/Xserver/hw/nxagent/Error.h index e55fd71a5..51d6171da 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Error.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Error.h @@ -34,4 +34,6 @@ void nxagentStartRedirectToClientsLog(void); void nxagentEndRedirectToClientsLog(void); +char *nxagentGetSessionPath(void); + #endif /* __Error_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index 332816fe0..1fc6bbf8b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -219,7 +219,7 @@ void nxagentBlockHandler(pointer data, struct timeval **timeout, pointer mask) if (nxagentOption(Rootless) && nxagentLastWindowDestroyed && nxagentRootlessDialogPid == 0 && - now > nxagentLastWindowDestroyedTime + 30 * 1000) + now > nxagentLastWindowDestroyedTime + 30 * 1000 && !nxagentOption(NoRootlessExit)) { #ifdef WARNING fprintf(stderr, "nxagentBlockHandler: No application running. Closing the session.\n"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Icons.h b/nx-X11/programs/Xserver/hw/nxagent/Icons.h index 0601584d4..98e879662 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Icons.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Icons.h @@ -24,6 +24,8 @@ #define NXAGENT_ICON_NAME "nxagent.xpm" +#define X2GOAGENT_ICON_NAME "x2go.xpm" + #define NXAGENT_PLACEHOLDER_NAME "nxmissing.xpm" #endif /* __Icons_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index e499b7a11..1f0b735b0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -644,6 +644,10 @@ FIXME: Should use these. pDrawable -> depth != 1 && nxagentOption(DeferLevel) >= 1) { + /* -- changed by dimbor (small "bed-sheets" never need be prevented - always put) --*/ + if (dstHeight > 16) + { + /* -------------------------------------------------------------------------------- */ #ifdef TEST fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on region [%d,%d,%d,%d] " "for drawable at [%p] with drawable pixmap.\n", pRegion -> extents.x1, @@ -654,6 +658,9 @@ FIXME: Should use these. nxagentMarkCorruptedRegion(pDrawable, pRegion); goto nxagentPutImageEnd; + /* --- changed by dimbor ---*/ + } + /* ------------------------- */ } if (pDrawable -> type == DRAWABLE_WINDOW && diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index 96579583b..d812c7f70 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -142,7 +142,8 @@ INCLUDES = -I. -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../ -I../../miext/damage -I../../miext/cw \ -I../../GL/glx -I../../GL/include -I../../../../lib/GL/include -I../../Xext \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ - $(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES) + $(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES) \ + `pkg-config --cflags-only-I libxml-2.0` #ifdef SunArchitecture INCLUDES = -I. -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../../nxcompshad \ -I../../../../extras/Mesa/include \ @@ -152,7 +153,8 @@ INCLUDES = -I. -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../ -I../../GL/glx -I../../GL/include -I../../../../lib/GL/include -I../../Xext \ -I../../miext/damage -I../../miext/cw \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ - $(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES) + $(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES) \ + `pkg-config --cflags-only-I libxml-2.0` #else #ifdef cygwinArchitecture INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ @@ -162,7 +164,8 @@ INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../../nxcompshad \ -I../../../../extras/Mesa/include \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ - $(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES) + $(VFBINCLUDES) $(NXFONTINCLUDES) $(LIBXRANDRINCLUDES) \ + `pkg-config --cflags-only-I libxml-2.0` #endif #endif @@ -206,7 +209,7 @@ DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) \ -UNX_DEBUG_INPUT \ -DRANDR_10_INTERFACE \ -DRANDR_12_INTERFACE \ - -UPANORAMIX \ + -DPANORAMIX \ -UDEBUG_TREE all:: $(OBJS) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index a50e8a5fc..a4c341a2f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -177,6 +177,29 @@ int nxagentSaveUnder; int nxagentDoFullGeneration = 1; + /* + * 1 if agent running as X2goAgent + * 0 if NX Agent + */ +int nxagentX2go; + +/* + * Checking if agent is x2go agent + */ + +void checkX2goAgent() +{ + extern const char *__progname; + if( strcasecmp(__progname,"x2goagent") == 0) + { + fprintf(stderr, "\nrunning as X2Go Agent\n"); + nxagentX2go=1; + } + else + nxagentX2go=0; +} + + /* * Called at X server's initialization. */ @@ -193,6 +216,11 @@ void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) #endif /* + * Check if we running as X2Go Agent + */ + checkX2goAgent(); + + /* * Print our pid and version information. */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.h b/nx-X11/programs/Xserver/hw/nxagent/Init.h index 2dc0f5c02..b516c7b34 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.h @@ -37,6 +37,8 @@ extern int nxagentDoFullGeneration; extern int nxagentBackingStore; extern int nxagentSaveUnder; +extern int nxagentX2go; + extern ServerGrabInfoRec nxagentGrabServerInfo; #endif /* __Init_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index e3b58b6c7..dfafe1ebb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -52,6 +52,7 @@ is" without express or implied warranty. #include "Keyboard.h" #include "Events.h" #include "Options.h" +#include "Error.h" #include "NXlib.h" @@ -136,7 +137,7 @@ extern Status XkbGetControls( #define XKB_ALTERNATE_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb" #endif #ifndef XKB_CONFIG_FILE -#define XKB_CONFIG_FILE "X0-config.keyboard" +#define XKB_CONFIG_FILE "/etc/nxagent/nxagent.keyboard" #endif #ifndef XKB_DFLT_RULES_FILE #define XKB_DFLT_RULES_FILE "xfree86" @@ -985,8 +986,7 @@ XkbError: XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); - nxagentXkbConfigFilePathSize = strlen(XkbBaseDirectory) + - strlen(XKB_CONFIG_FILE) + 1; + nxagentXkbConfigFilePathSize = strlen(XKB_CONFIG_FILE); nxagentXkbConfigFilePath = malloc((nxagentXkbConfigFilePathSize + 1) * sizeof(char)); @@ -995,9 +995,7 @@ XkbError: FatalError("nxagentKeyboardProc: malloc failed."); } - strcpy(nxagentXkbConfigFilePath, XkbBaseDirectory); - strcat(nxagentXkbConfigFilePath, "/"); - strcat(nxagentXkbConfigFilePath, XKB_CONFIG_FILE); + strcpy(nxagentXkbConfigFilePath, XKB_CONFIG_FILE); #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: nxagentXkbConfigFilePath [%s].\n", @@ -1793,6 +1791,42 @@ void nxagentKeycodeConversionSetup(void) } #endif + if (drulesLen != 0) + { + char *sessionpath = nxagentGetSessionPath(); + if (sessionpath != NULL){ + int keyboard_file_path_size = strlen(sessionpath) + strlen("/keyboard"); + char *keyboard_file_path = malloc((keyboard_file_path_size + 1) * sizeof(char)); + FILE *keyboard_file; + if ( keyboard_file_path == NULL) + { + FatalError("nxagentKeyboardProc: malloc failed."); + } + strcpy(keyboard_file_path, sessionpath); + strcat(keyboard_file_path, "/keyboard"); + if ((keyboard_file = fopen(keyboard_file_path, "w")) != NULL) { + if ( drules != NULL ) + fprintf(keyboard_file, "rules=%s\n", drules); + if ( dmodel != NULL ) + fprintf(keyboard_file, "model=%s\n", dmodel); + if ( dlayout != NULL ) + fprintf(keyboard_file, "layout=%s\n", dlayout); + if ( dvariant != NULL ) + fprintf(keyboard_file, "variant=%s\n", dvariant); + if ( doptions != NULL ) + fprintf(keyboard_file, "options=%s\n", doptions); + fclose(keyboard_file); + } + free(keyboard_file_path); + fprintf(stderr, "keyboard file created\n"); + } + fprintf(stderr, "SessionPath not defined\n"); + } + else + { + fprintf(stderr, "Failed to create the keyboard file\n"); + } + if (nxagentOption(ClientOs) == ClientOsLinux && drules != NULL && dmodel != NULL && (strcmp(drules, "evdev") == 0 || diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index 6c6e477ab..694781c7e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -28,8 +28,15 @@ #include "Keystroke.h" #include "Drawable.h" +#include <unistd.h> + +#include <libxml/parser.h> +#include <libxml/tree.h> + extern Bool nxagentWMIsRunning; extern Bool nxagentIpaq; +extern char *nxagentKeystrokeFile; +Bool nxagentKeystrokeFileParsed = False; #ifdef NX_DEBUG_INPUT int nxagentDebugInputDevices = 0; @@ -47,10 +54,369 @@ extern void nxagentDeactivateInputDevicesGrabs(); #undef DEBUG #undef DUMP + +/* this table is used to parse actions given on the command line or in the + * config file, therefore indices have to match the enum in Keystroke.h */ +char * nxagentSpecialKeystrokeNames[] = { + "end_marker", + "close_session", + "switch_all_screens", + "minimize", + "left", + "up", + "right", + "down", + "resize", + "defer", + "ignore", + "force_synchronization", + + "debug_tree", + "regions_on_screen", + "test_input", + "deactivate_input_devices_grab", + + "fullscreen", + "viewport_move_left", + "viewport_move_up", + "viewport_move_right", + "viewport_move_down", + NULL, +}; + +struct nxagentSpecialKeystrokeMap default_map[] = { + /* stroke, modifierMask, modifierAltMeta, keysym */ + {KEYSTROKE_DEBUG_TREE, ControlMask, 1, XK_q}, + {KEYSTROKE_DEBUG_TREE, ControlMask, 1, XK_Q}, + {KEYSTROKE_CLOSE_SESSION, ControlMask, 1, XK_t}, + {KEYSTROKE_CLOSE_SESSION, ControlMask, 1, XK_T}, + {KEYSTROKE_SWITCH_ALL_SCREENS, ControlMask, 1, XK_f}, + {KEYSTROKE_SWITCH_ALL_SCREENS, ControlMask, 1, XK_F}, + {KEYSTROKE_MINIMIZE, ControlMask, 1, XK_m}, + {KEYSTROKE_MINIMIZE, ControlMask, 1, XK_M}, + {KEYSTROKE_LEFT, ControlMask, 1, XK_Left}, + {KEYSTROKE_LEFT, ControlMask, 1, XK_KP_Left}, + {KEYSTROKE_UP, ControlMask, 1, XK_Up}, + {KEYSTROKE_UP, ControlMask, 1, XK_KP_Up}, + {KEYSTROKE_RIGHT, ControlMask, 1, XK_Right}, + {KEYSTROKE_RIGHT, ControlMask, 1, XK_KP_Right}, + {KEYSTROKE_DOWN, ControlMask, 1, XK_Down}, + {KEYSTROKE_DOWN, ControlMask, 1, XK_KP_Down}, + {KEYSTROKE_RESIZE, ControlMask, 1, XK_r}, + {KEYSTROKE_RESIZE, ControlMask, 1, XK_R}, + {KEYSTROKE_DEFER, ControlMask, 1, XK_e}, + {KEYSTROKE_DEFER, ControlMask, 1, XK_E}, + {KEYSTROKE_IGNORE, ControlMask, 1, XK_BackSpace}, + {KEYSTROKE_IGNORE, 0, 0, XK_Terminate_Server}, + {KEYSTROKE_FORCE_SYNCHRONIZATION, ControlMask, 1, XK_j}, + {KEYSTROKE_FORCE_SYNCHRONIZATION, ControlMask, 1, XK_J}, + {KEYSTROKE_REGIONS_ON_SCREEN, ControlMask, 1, XK_a}, + {KEYSTROKE_REGIONS_ON_SCREEN, ControlMask, 1, XK_A}, + {KEYSTROKE_TEST_INPUT, ControlMask, 1, XK_x}, + {KEYSTROKE_TEST_INPUT, ControlMask, 1, XK_X}, + {KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB, ControlMask, 1, XK_y}, + {KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB, ControlMask, 1, XK_Y}, + {KEYSTROKE_FULLSCREEN, ControlMask | ShiftMask, 1, XK_f}, + {KEYSTROKE_FULLSCREEN, ControlMask | ShiftMask, 1, XK_F}, + {KEYSTROKE_VIEWPORT_MOVE_LEFT, ControlMask | ShiftMask, 1, XK_Left}, + {KEYSTROKE_VIEWPORT_MOVE_LEFT, ControlMask | ShiftMask, 1, XK_KP_Left}, + {KEYSTROKE_VIEWPORT_MOVE_UP, ControlMask | ShiftMask, 1, XK_Up}, + {KEYSTROKE_VIEWPORT_MOVE_UP, ControlMask | ShiftMask, 1, XK_KP_Up}, + {KEYSTROKE_VIEWPORT_MOVE_RIGHT, ControlMask | ShiftMask, 1, XK_Right}, + {KEYSTROKE_VIEWPORT_MOVE_RIGHT, ControlMask | ShiftMask, 1, XK_KP_Right}, + {KEYSTROKE_VIEWPORT_MOVE_DOWN, ControlMask | ShiftMask, 1, XK_Down}, + {KEYSTROKE_VIEWPORT_MOVE_DOWN, ControlMask | ShiftMask, 1, XK_KP_Down}, + {KEYSTROKE_END_MARKER, 0, 0, 0}, +}; +struct nxagentSpecialKeystrokeMap *map = default_map; + +static int modifier_matches(unsigned int mask, int compare_alt_meta, unsigned int state) +{ + /* nxagentAltMetaMask needs special handling + * it seems to me its an and-ed mask of all possible meta and alt keys + * somehow... + * + * otherwise this function would be just a simple bitop + */ + int ret = 1; + + if (compare_alt_meta) { + if (! (state & nxagentAltMetaMask)) { + ret = 0; + } + + mask &= ~nxagentAltMetaMask; + } + + /* all modifiers except meta/alt have to match exactly, extra bits are evil */ + if ((mask & state) != mask) { + ret = 0; + } + + return ret; +} + +static int read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystrokeMap *ret) +{ + int successful = 0; + struct nxagentSpecialKeystrokeMap new = {0, 0, 0, 0}; + xmlAttr *attr; + + for (attr = node->properties; attr; attr = attr->next) + { + /* ignore attributes without data (which should never happen anyways) */ + if (attr->children->content == NULL) + { + char *aname = (attr->name)?(attr->name):"unknown"; + fprintf(stderr, "attribute %s with NULL value", aname); + continue; + } + if (strcmp((char *)attr->name, "action") == 0) + { + int i; + for (i = 0; nxagentSpecialKeystrokeNames[i] != NULL; i++) + { + if (strcmp(nxagentSpecialKeystrokeNames[i],(char *)attr->children->content) == 0) + { + /* this relies on the values of enum nxagentSpecialKeystroke and the + * indices of nxagentSpecialKeystrokeNames being in sync */ + new.stroke = i; + break; + } + } + continue; + } + else if (strcmp((char *)attr->name, "key") == 0) + { + new.keysym = XStringToKeysym((char *)attr->children->content); + /* NoSymbol is usually 0, but could there be weird implementations? */ + if (new.keysym == NoSymbol) + { + new.keysym = 0; + } + continue; + } + + /* ignore attributes with value="0" or "false", everything else is interpreted as true */ + if (strcmp((char *)attr->children->content, "0") == 0 || strcmp((char *)attr->children->content, "false") == 0) + continue; + + if (strcmp((char *)attr->name, "Mod1") == 0) + { + new.modifierMask |= Mod1Mask; + } + else if (strcmp((char *)attr->name, "Mod2") == 0) + { + new.modifierMask |= Mod2Mask; + } + else if (strcmp((char *)attr->name, "Mod3") == 0) + { + new.modifierMask |= Mod3Mask; + } + else if (strcmp((char *)attr->name, "Mod4") == 0) + { + new.modifierMask |= Mod4Mask; + } + else if (strcmp((char *)attr->name, "Control") == 0) + { + new.modifierMask |= ControlMask; + } + else if (strcmp((char *)attr->name, "Shift") == 0) + { + new.modifierMask |= ShiftMask; + } + else if (strcmp((char *)attr->name, "Lock") == 0) + { + new.modifierMask |= LockMask; + } + else if (strcmp((char *)attr->name, "AltMeta") == 0) + { + new.modifierAltMeta = 1; + } + } + + if (new.stroke != 0 && new.keysym != 0) + { + /* keysym and stroke are required, everything else is optional */ + successful = 1; + memcpy(ret, &new, sizeof(struct nxagentSpecialKeystrokeMap)); + } + return successful; +} + +/* + * searches a keystroke xml file + * + * search order: + * - '-keystrokefile' commandline parameter + * - $NXAGENT_KEYSTROKEFILE environment variable + * - $HOME/.nx/config/keystroke.cfg + * - /etc/nx/keystroke.cfg + * - hardcoded traditional NX default settings + */ +static void parse_keystroke_file(void) +{ + char *filename = NULL; + + char *homefile = "/.nx/config/keystroke.cfg"; + char *etcfile = "/etc/nx/keystroke.cfg"; + + if (nxagentKeystrokeFile != NULL && access(nxagentKeystrokeFile, R_OK) == 0) + { + filename = strdup(nxagentKeystrokeFile); + if (filename == NULL) + { + fprintf(stderr, "malloc failed"); + exit(EXIT_FAILURE); + } + } + else if ((filename = getenv("NXAGENT_KEYSTROKEFILE")) != NULL && access(filename, R_OK) == 0) + { + filename = strdup(filename); + if (filename == NULL) + { + fprintf(stderr, "malloc failed"); + exit(EXIT_FAILURE); + } + } + else + { + char *homedir = getenv("HOME"); + filename = NULL; + if (homedir != NULL) + { + homedir = strdup(homedir); + if (homedir == NULL) + { + fprintf(stderr, "malloc failed"); +exit(EXIT_FAILURE); + } + filename = calloc(1, strlen(homefile) + strlen(homedir) + 1); + if (filename == NULL) + { + fprintf(stderr, "malloc failed"); + exit(EXIT_FAILURE); + } + strcpy(filename, homedir); + strcpy(filename + strlen(homedir), homefile); + if (homedir) + { + free(homedir); + } + } + + if (access(filename, R_OK) == 0) + { + /* empty */ + } + else if (access(etcfile, R_OK == 0)) + { + if (filename) + free(filename); + filename = strdup(etcfile); + if (filename == NULL) + { + fprintf(stderr, "malloc failed"); + exit(EXIT_FAILURE); + } + } + else + { + if (filename) +free(filename); + filename = NULL; + } + } + + /* now we know which file to read, if any */ + if (filename) + { + xmlDoc *doc = NULL; + xmlNode *root = NULL; + LIBXML_TEST_VERSION + doc = xmlReadFile(filename, NULL, 0); + if (doc != NULL) + { + xmlNode *cur = NULL; + root = xmlDocGetRootElement(doc); + + for (cur = root; cur; cur = cur->next) + { + if (cur->type == XML_ELEMENT_NODE && strcmp((char *)cur->name, "keystrokes") == 0) +{ + xmlNode *bindings = NULL; + int num = 0; + int idx = 0; + + for (bindings = cur->children; bindings; bindings = bindings->next) + { + if (bindings->type == XML_ELEMENT_NODE && strcmp((char *)bindings->name, "keystroke") == 0) + { + num++; + } + } + map = calloc((num + 1), sizeof(struct nxagentSpecialKeystrokeMap)); + if (map == NULL) + { + fprintf(stderr, "malloc failed"); + exit(EXIT_FAILURE); + } + + for (bindings = cur->children; bindings; bindings = bindings->next) + { + if (bindings->type == XML_ELEMENT_NODE && strcmp((char *)bindings->name, "keystroke") == 0) + { + int res = 0; + res = read_binding_from_xmlnode(bindings, &(map[idx])); + if (res) + idx++; + } + } + + map[idx].stroke = KEYSTROKE_END_MARKER; + } + } + + xmlFreeDoc(doc); + xmlCleanupParser(); + } + else + { + #ifdef DEBUG + fprintf("XML parsing for %s failed\n", filename); + #endif + } + free(filename); + } +} + +static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) +{ + KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0); + struct nxagentSpecialKeystrokeMap *cur = map; + + if (! nxagentKeystrokeFileParsed) + { + parse_keystroke_file(); + nxagentKeystrokeFileParsed = True; + } + + enum nxagentSpecialKeystroke ret = KEYSTROKE_NOTHING; + + while ((cur++)->stroke != KEYSTROKE_END_MARKER) { + if (cur->keysym == keysym && modifier_matches(cur->modifierMask, cur->modifierAltMeta, X->state)) { + return cur->stroke; + } + } + + return ret; +} + int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) { KeySym sym; int index = 0; + enum nxagentSpecialKeystroke stroke = find_keystroke(X); *result = doNothing; @@ -87,257 +453,128 @@ int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) return 1; } - if ((X -> state & nxagentAltMetaMask) && - ((X -> state & (ControlMask | ShiftMask)) == ControlMask)) - { - switch (sym) - { + switch (stroke) { + case KEYSTROKE_DEBUG_TREE: #ifdef DEBUG_TREE - - case XK_q: - case XK_Q: - { - *result = doDebugTree; - - break; - } - - #endif /* DEBUG_TREE */ - - case XK_t: - case XK_T: - { - *result = doCloseSession; - - break; - } - case XK_f: - case XK_F: - { - if (nxagentOption(Rootless) == False) - { - *result = doSwitchAllScreens; - } - - break; - } - case XK_m: - case XK_M: - { - if (nxagentOption(Rootless) == False) - { - *result = doMinimize; - } - - break; - } - case XK_Left: - case XK_KP_Left: - { - if (nxagentOption(Rootless) == False && - nxagentOption(DesktopResize) == False) - { - *result = doViewportLeft; - } - - break; - } - case XK_Up: - case XK_KP_Up: - { - if (nxagentOption(Rootless) == False && - nxagentOption(DesktopResize) == False) - { - *result = doViewportUp; - } - - break; + *result = doDebugTree; + #endif + break; + case KEYSTROKE_CLOSE_SESSION: + *result = doCloseSession; + break; + case KEYSTROKE_SWITCH_ALL_SCREENS: + if (nxagentOption(Rootless) == False) { + *result = doSwitchAllScreens; } - case XK_Right: - case XK_KP_Right: - { - if (nxagentOption(Rootless) == False && - nxagentOption(DesktopResize) == False) - { - *result = doViewportRight; - } - - break; + break; + case KEYSTROKE_MINIMIZE: + if (nxagentOption(Rootless) == False) { + *result = doMinimize; } - case XK_Down: - case XK_KP_Down: - { - if (nxagentOption(Rootless) == 0 && - nxagentOption(DesktopResize) == 0) - { - *result = doViewportDown; - } - - break; + break; + case KEYSTROKE_LEFT: + if (nxagentOption(Rootless) == False && + nxagentOption(DesktopResize) == False) { + *result = doViewportLeft; } - case XK_R: - case XK_r: - { - if (nxagentOption(Rootless) == 0) - { - *result = doSwitchResizeMode; - } - - break; + break; + case KEYSTROKE_UP: + if (nxagentOption(Rootless) == False && + nxagentOption(DesktopResize) == False) { + *result = doViewportUp; } - case XK_E: - case XK_e: - { - *result = doSwitchDeferMode; - - break; + break; + case KEYSTROKE_RIGHT: + if (nxagentOption(Rootless) == False && + nxagentOption(DesktopResize) == False) { + *result = doViewportRight; } - case XK_BackSpace: - case XK_Terminate_Server: - { - /* - * Discard Ctrl-Alt-BackSpace key. - */ - - return 1; - - break; + break; + case KEYSTROKE_DOWN: + if (nxagentOption(Rootless) == False && + nxagentOption(DesktopResize) == False) { + *result = doViewportDown; } - - case XK_J: - case XK_j: - { - nxagentForceSynchronization = 1; - - return 1; + break; + case KEYSTROKE_RESIZE: + if (nxagentOption(Rootless) == False) { + *result = doSwitchResizeMode; } - + break; + case KEYSTROKE_DEFER: + *result = doSwitchDeferMode; + break; + case KEYSTROKE_IGNORE: + /* this is used e.g. to ignore C-A-Backspace aka XK_Terminate_Server */ + return 1; + break; + case KEYSTROKE_FORCE_SYNCHRONIZATION: + nxagentForceSynchronization = 1; + break; + case KEYSTROKE_REGIONS_ON_SCREEN: #ifdef DUMP - - case XK_A: - case XK_a: - { - /* - * Used to test the lazy encoding. - */ - - nxagentRegionsOnScreen(); - - return 1; - } - + nxagentRegionsOnScreen(); #endif - + break; + case KEYSTROKE_TEST_INPUT: + /* + * Used to test the input devices state. + */ #ifdef NX_DEBUG_INPUT - - case XK_X: - case XK_x: - { - /* - * Used to test the input devices state. - */ - - if (X -> type == KeyPress) - { - if (nxagentDebugInputDevices == 0) - { - fprintf(stderr, "Info: Turning input devices debug ON.\n"); - - nxagentDebugInputDevices = 1; - } - else - { - fprintf(stderr, "Info: Turning input devices debug OFF.\n"); - - nxagentDebugInputDevices = 0; - - nxagentLastInputDevicesDumpTime = 0; - } + if (X -> type == KeyPress) { + if (nxagentDebugInputDevices == 0) { + fprintf(stderr, "Info: Turning input devices debug ON.\n"); + nxagentDebugInputDevices = 1; + } else { + fprintf(stderr, "Info: Turning input devices debug OFF.\n"); + nxagentDebugInputDevices = 0; + nxagentLastInputDevicesDumpTime = 0; } - - return 1; } - - case XK_Y: - case XK_y: - { - /* - * Used to deactivate input devices grab. - */ - - if (X -> type == KeyPress) - { - nxagentDeactivateInputDevicesGrabs(); - } - - return 1; + return 1; + #endif + break; + case KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB: + #ifdef NX_DEBUG_INPUT + if (X->type == KeyPress) { + nxagentDeactivateInputDevicesGrab(); } - + return 1; #endif - } - } - else if ((X -> state & nxagentAltMetaMask) && - ((X -> state & (ControlMask | ShiftMask)) == (ControlMask | - ShiftMask))) - { - switch (sym) - { - case XK_f: - case XK_F: - { - if (nxagentOption(Rootless) == 0) - { - *result = doSwitchFullscreen; - } - - break; + break; + case KEYSTROKE_FULLSCREEN: + if (nxagentOption(Rootless) == 0) { + *result = doSwitchFullscreen; } - case XK_Left: - case XK_KP_Left: - { - if (nxagentOption(Rootless) == 0 && - nxagentOption(DesktopResize) == 0) - { - *result = doViewportMoveLeft; - } - - break; + break; + case KEYSTROKE_VIEWPORT_MOVE_LEFT: + if (nxagentOption(Rootless) == 0 && + nxagentOption(DesktopResize) == 0) { + *result = doViewportMoveLeft; } - case XK_Up: - case XK_KP_Up: - { - if (nxagentOption(Rootless) == 0 && - nxagentOption(DesktopResize) == 0) - { - *result = doViewportMoveUp; - } - - break; + break; + case KEYSTROKE_VIEWPORT_MOVE_UP: + if (nxagentOption(Rootless) == 0 && + nxagentOption(DesktopResize) == 0) { + *result = doViewportMoveUp; } - case XK_Right: - case XK_KP_Right: - { - if (nxagentOption(Rootless) == 0 && - nxagentOption(DesktopResize) == 0) - { - *result = doViewportMoveRight; - } - - break; + break; + case KEYSTROKE_VIEWPORT_MOVE_RIGHT: + if (nxagentOption(Rootless) == 0 && + nxagentOption(DesktopResize) == 0) { + *result = doViewportMoveRight; } - case XK_Down: - case XK_KP_Down: - { - if (nxagentOption(Rootless) == 0 && - nxagentOption(DesktopResize) == 0) - { - *result = doViewportMoveDown; - } - - break; + break; + case KEYSTROKE_VIEWPORT_MOVE_DOWN: + if (nxagentOption(Rootless) == 0 && + nxagentOption(DesktopResize) == 0) { + *result = doViewportMoveDown; } - } + break; + case KEYSTROKE_NOTHING: /* do nothing. difference to KEYSTROKE_IGNORE is the return value */ + case KEYSTROKE_END_MARKER: /* just to make gcc STFU */ + case KEYSTROKE_MAX: + break; } - return (*result == doNothing) ? 0 : 1; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h index ef71a8851..d9575c875 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h @@ -24,4 +24,51 @@ extern int nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*); unsigned int nxagentAltMetaMask; +/* keep this sorted, do not rely on any numerical value in this enum, and be aware + * that KEYSTROKE_MAX may be used in a malloc */ + +/* also be aware that if changing any numerical values, you also need to change values + * Keystroke.c nxagentSpecialKeystrokeNames */ +enum nxagentSpecialKeystroke { + /* 0 is used as end marker */ + KEYSTROKE_END_MARKER = 0, + KEYSTROKE_CLOSE_SESSION = 1, + KEYSTROKE_SWITCH_ALL_SCREENS = 2, + KEYSTROKE_MINIMIZE = 3, + KEYSTROKE_LEFT = 4, + KEYSTROKE_UP = 5, + KEYSTROKE_RIGHT = 6, + KEYSTROKE_DOWN = 7, + KEYSTROKE_RESIZE = 8, + KEYSTROKE_DEFER = 9, + KEYSTROKE_IGNORE = 10, + KEYSTROKE_FORCE_SYNCHRONIZATION = 11, + + /* stuff used for debugging, probably not useful for most people */ + KEYSTROKE_DEBUG_TREE = 12, + KEYSTROKE_REGIONS_ON_SCREEN = 13, + KEYSTROKE_TEST_INPUT = 14, + KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB = 15, + + KEYSTROKE_FULLSCREEN = 16, + KEYSTROKE_VIEWPORT_MOVE_LEFT = 17, + KEYSTROKE_VIEWPORT_MOVE_UP = 18, + KEYSTROKE_VIEWPORT_MOVE_RIGHT = 19, + KEYSTROKE_VIEWPORT_MOVE_DOWN = 20, + + KEYSTROKE_NOTHING = 21, + + /* insert more here, increment KEYSTROKE_MAX accordingly. + * then update string translation below */ + + KEYSTROKE_MAX=22, +}; + +struct nxagentSpecialKeystrokeMap { + enum nxagentSpecialKeystroke stroke; + unsigned int modifierMask; /* everything except alt/meta */ + int modifierAltMeta; /* modifier combination should include alt/meta */ + KeySym keysym; +}; + #endif /* __Keystroke_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 4f59b8098..77e2bf473 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -1973,6 +1973,23 @@ ProcCreatePixmap(client) client->errorValue = 0; return BadValue; } + if (stuff->width > 32767 || stuff->height > 32767) + { + /* It is allowed to try and allocate a pixmap which is larger than + * 32767 in either dimension. However, all of the framebuffer code + * is buggy and does not reliably draw to such big pixmaps, basically + * because the Region data structure operates with signed shorts + * for the rectangles in it. + * + * Furthermore, several places in the X server computes the + * size in bytes of the pixmap and tries to store it in an + * integer. This integer can overflow and cause the allocated size + * to be much smaller. + * + * So, such big pixmaps are rejected here with a BadAlloc + */ + return BadAlloc; + } if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c index ca5be0b5f..7eac3d8a2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c @@ -56,6 +56,7 @@ void nxagentInitOptions() nxagentOptions.Persistent = 1; nxagentOptions.Rootless = UNDEFINED; nxagentOptions.Fullscreen = UNDEFINED; + nxagentOptions.NoRootlessExit = False; nxagentOptions.X = 0; nxagentOptions.Y = 0; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h index 40cb1790e..0e4869926 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h @@ -381,6 +381,13 @@ typedef struct _AgentOptions int ImageRateLimit; + /* + * True if agent should not exit if there are no + * clients in rootless mode + */ + + int NoRootlessExit; + } AgentOptionsRec; typedef AgentOptionsRec *AgentOptionsPtr; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 29bffaa35..41a1ec02e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -2689,11 +2689,17 @@ void nxagentReconnectPicture(pointer p0, XID x1, void *p2) #endif } - if (!pForm) - { - *pBool = False; - - return; + if (!pForm && pPicture->pSourcePict) + { + /*possible we need to add support for other picture types, for example gradients...*/ + switch(pPicture->pSourcePict->type) + { + case SourcePictTypeSolidFill: + nxagentPicturePriv(pPicture) -> picture = XRenderCreateSolidFill(nxagentDisplay, + (const XRenderColor*) &pPicture->pSourcePict->solidFill.fullColor); + break; + } + return; } #ifdef TEST diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 9957a7dfd..104d431e0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1759,6 +1759,42 @@ N/A nxagentDefaultWindows[pScreen->myNum]); #endif + /* + * Setting WM_CLASS to "X2GoAgent" when running in X2Go Agent mode + * we need it to properly display all window parameters by some WMs + * (for example on Maemo) + */ + if(nxagentX2go) + { + #ifdef TEST + fprintf(stderr, "nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window withid [%ld].\n", + nxagentDefaultWindows[pScreen->myNum]); + #endif + XClassHint hint; + hint.res_name=malloc(strlen("X2GoAgent")+1); + hint.res_class=malloc(strlen("X2GoAgent")+1); + strcpy(hint.res_name,"X2GoAgent"); + strcpy(hint.res_class,"X2GoAgent"); + XSetClassHint(nxagentDisplay,nxagentDefaultWindows[pScreen->myNum],&hint); + free(hint.res_name); + free(hint.res_class); + } else { + #ifdef TEST + fprintf(stderr, "nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window withid [%ld].\n", + nxagentDefaultWindows[pScreen->myNum]); + #endif + + XClassHint hint; + hint.res_name=malloc(strlen("NXAgent")+1); + hint.res_class=malloc(strlen("NXAgent")+1); + strcpy(hint.res_name,"NXAgent"); + strcpy(hint.res_class,"NXAgent"); + XSetClassHint(nxagentDisplay,nxagentDefaultWindows[pScreen->myNum],&hint); + free(hint.res_name); + free(hint.res_class); + } + + if (nxagentOption(Fullscreen)) { nxagentFullscreenWindow = nxagentDefaultWindows[pScreen->myNum]; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 235c48c23..abb0872d1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -35,6 +35,7 @@ #include "Windows.h" #include "Atoms.h" #include "Trap.h" +#include "Init.h" /* * Set here the required log level. @@ -53,6 +54,7 @@ int nxagentLogoDepth; int nxagentLogoWhite; int nxagentLogoRed; int nxagentLogoBlack; +int nxagentLogoGray; void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); @@ -166,6 +168,15 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) XPoint m[12]; int w, h, c, w2, h2; + /* + * Show only X2GO Logo when running as X2Go Agent + */ + if(! nxagentX2go) + { + nxagentPixmapLogo = 0L; + return; + } + #ifdef DEBUG fprintf(stderr, "nxagenShowtLogo: Got called.\n"); #endif @@ -218,75 +229,146 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) XSetForeground(nxagentDisplay, gc, nxagentLogoRed); XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); - rect[0].x = w2-10*c; rect[0].y = h2-8*c; - rect[1].x = w2-10*c; rect[1].y = h2+8*c; - rect[2].x = w2+10*c; rect[2].y = h2+8*c; - rect[3].x = w2+10*c; rect[3].y = h2-8*c; + /* + * Draw X2GO Logo + */ + /* + * Begin 'X'. + */ + + XSetForeground(nxagentDisplay, gc, nxagentLogoGray); + XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); + rect[0].x = w2-7*c; rect[0].y = h2-5*c; + rect[1].x = w2-8*c; rect[1].y = h2-5*c; + rect[2].x = w2-4*c; rect[2].y = h2+3*c; + rect[3].x = w2-3*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "filled red rect\n"); - #endif + rect[0].x = w2-4*c; rect[0].y = h2-5*c; + rect[1].x = w2-3*c; rect[1].y = h2-5*c; + rect[2].x = w2-7*c; rect[2].y = h2+3*c; + rect[3].x = w2-8*c; rect[3].y = h2+3*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2-9*c; rect[0].y = h2-7*c; - rect[1].x = w2-9*c; rect[1].y = h2+7*c; - rect[2].x = w2+9*c; rect[2].y = h2+7*c; - rect[3].x = w2+9*c; rect[3].y = h2-7*c; + /* + * End 'X'. + */ - XSetForeground(nxagentDisplay, gc, nxagentLogoWhite); - XSetBackground(nxagentDisplay, gc, nxagentLogoRed); + /* + * Start '2'. + */ + + rect[0].x = w2-2*c; rect[0].y = h2-5*c; + rect[1].x = w2-1*c; rect[1].y = h2-5*c; + rect[2].x = w2-1*c; rect[2].y = h2-3*c; + rect[3].x = w2-2*c; rect[3].y = h2-3*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + + rect[0].x = w2-2*c; rect[0].y = h2-5*c; + rect[1].x = w2+2*c; rect[1].y = h2-5*c; + rect[2].x = w2+2*c; rect[2].y = h2-4*c; + rect[3].x = w2-2*c; rect[3].y = h2-4*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + rect[0].x = w2+1*c; rect[0].y = h2-5*c; + rect[1].x = w2+2*c; rect[1].y = h2-5*c; + rect[2].x = w2+2*c; rect[2].y = h2-2*c; + rect[3].x = w2+1*c; rect[3].y = h2-2*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + rect[0].x = w2+2*c; rect[0].y = h2-2*c; + rect[1].x = w2+1*c; rect[1].y = h2-2*c; + rect[2].x = w2-2*c; rect[2].y = h2+2*c; + rect[3].x = w2-1*c; rect[3].y = h2+2*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + + + rect[0].x = w2-2*c; rect[0].y = h2+2*c; + rect[1].x = w2+2*c; rect[1].y = h2+2*c; + rect[2].x = w2+2*c; rect[2].y = h2+3*c; + rect[3].x = w2-2*c; rect[3].y = h2+3*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* - * Begin 'M'. + * End '2'. */ - m[0].x = w2-3*c; m[0].y = h2-5*c; - m[1].x = w2+7*c; m[1].y = h2-5*c; - m[2].x = w2+7*c; m[2].y = h2+5*c; - m[3].x = w2+5*c; m[3].y = h2+5*c; - m[4].x = w2+5*c; m[4].y = h2-3*c; - m[5].x = w2+3*c; m[5].y = h2-3*c; - m[6].x = w2+3*c; m[6].y = h2+5*c; - m[7].x = w2+1*c; m[7].y = h2+5*c; - m[8].x = w2+1*c; m[8].y = h2-3*c; - m[9].x = w2-1*c; m[9].y = h2-3*c; - m[10].x = w2-1*c; m[10].y = h2+5*c; - m[11].x = w2-3*c; m[11].y = h2+5*c; + /* + * Start 'G'. + */ - XSetForeground(nxagentDisplay, gc, nxagentLogoRed); - XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); + rect[0].x = w2+3*c; rect[0].y = h2-5*c; + rect[1].x = w2+7*c; rect[1].y = h2-5*c; + rect[2].x = w2+7*c; rect[2].y = h2-4*c; + rect[3].x = w2+3*c; rect[3].y = h2-4*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, m, 12, Nonconvex, CoordModeOrigin); + rect[0].x = w2+3*c; rect[0].y = h2-5*c; + rect[1].x = w2+4*c; rect[1].y = h2-5*c; + rect[2].x = w2+4*c; rect[2].y = h2+3*c; + rect[3].x = w2+3*c; rect[3].y = h2+3*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + rect[0].x = w2+3*c; rect[0].y = h2+2*c; + rect[1].x = w2+7*c; rect[1].y = h2+2*c; + rect[2].x = w2+7*c; rect[2].y = h2+3*c; + rect[3].x = w2+3*c; rect[3].y = h2+3*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + + rect[0].x = w2+6*c; rect[0].y = h2-5*c; + rect[1].x = w2+7*c; rect[1].y = h2-5*c; + rect[2].x = w2+7*c; rect[2].y = h2-3*c; + rect[3].x = w2+6*c; rect[3].y = h2-3*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + + rect[0].x = w2+6*c; rect[0].y = h2-0*c; + rect[1].x = w2+7*c; rect[1].y = h2-0*c; + rect[2].x = w2+7*c; rect[2].y = h2+3*c; + rect[3].x = w2+6*c; rect[3].y = h2+3*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + + rect[0].x = w2+5*c; rect[0].y = h2-1*c; + rect[1].x = w2+7*c; rect[1].y = h2-1*c; + rect[2].x = w2+7*c; rect[2].y = h2+0*c; + rect[3].x = w2+5*c; rect[3].y = h2+0*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* - * End 'M'. + * End 'G'. */ /* - * Begin '!'. + * Start 'O'. */ - rect[0].x = w2-7*c; rect[0].y = h2-5*c; - rect[1].x = w2-5*c; rect[1].y = h2-5*c; - rect[2].x = w2-5*c; rect[2].y = h2+2*c; - rect[3].x = w2-7*c; rect[3].y = h2+2*c; + rect[0].x = w2+8*c; rect[0].y = h2-5*c; + rect[1].x = w2+12*c; rect[1].y = h2-5*c; + rect[2].x = w2+12*c; rect[2].y = h2-4*c; + rect[3].x = w2+8*c; rect[3].y = h2-4*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + rect[0].x = w2+8*c; rect[0].y = h2+3*c; + rect[1].x = w2+12*c; rect[1].y = h2+3*c; + rect[2].x = w2+12*c; rect[2].y = h2+2*c; + rect[3].x = w2+8*c; rect[3].y = h2+2*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2-7*c; rect[0].y = h2+3*c; - rect[1].x = w2-5*c; rect[1].y = h2+3*c; - rect[2].x = w2-5*c; rect[2].y = h2+5*c; - rect[3].x = w2-7*c; rect[3].y = h2+5*c; + rect[0].x = w2+8*c; rect[0].y = h2-5*c; + rect[1].x = w2+9*c; rect[1].y = h2-5*c; + rect[2].x = w2+9*c; rect[2].y = h2+3*c; + rect[3].x = w2+8*c; rect[3].y = h2+3*c; + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + rect[0].x = w2+11*c; rect[0].y = h2-5*c; + rect[1].x = w2+12*c; rect[1].y = h2-5*c; + rect[2].x = w2+12*c; rect[2].y = h2+3*c; + rect[3].x = w2+11*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* - * End 'M'. + * End 'O'. */ + XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); #ifdef NXAGENT_LOGO_DEBUG diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.h b/nx-X11/programs/Xserver/hw/nxagent/Splash.h index f7ba6c2e2..39becaa3d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -33,6 +33,7 @@ extern int nxagentLogoDepth; extern int nxagentLogoWhite; extern int nxagentLogoRed; extern int nxagentLogoBlack; +extern int nxagentLogoGray; extern Window nxagentSplashWindow; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 35a35984a..0a8e8c29b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -176,6 +176,14 @@ static void nxagentReconfigureWindow(pointer, XID, pointer); static int nxagentForceExposure(WindowPtr pWin, pointer ptr); +/* by dimbor */ +typedef struct +{ + CARD32 state; + Window icon; +} +nxagentWMStateRec; + /* * This is currently unused. */ @@ -1858,6 +1866,17 @@ Bool nxagentRealizeWindow(WindowPtr pWin) nxagentAddConfiguredWindow(pWin, CWStackingOrder); nxagentAddConfiguredWindow(pWin, CW_Shape); + /* add by dimbor */ + if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) + { + Atom prop = MakeAtom("WM_STATE", strlen("WM_STATE"), True); + nxagentWMStateRec wmState; + wmState.state = 1; /* NormalState */ + wmState.icon = None; + if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success) + fprintf(stderr, "nxagentRealizeWindow: Additing WM_STATE fail.\n"); + } + #ifdef SHAPE /* @@ -1904,6 +1923,17 @@ Bool nxagentUnrealizeWindow(pWin) return True; } + /* add by dimbor */ + if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) + { + Atom prop = MakeAtom("WM_STATE", strlen("WM_STATE"), True); + nxagentWMStateRec wmState; + wmState.state = 3; /* WithdrawnState */ + wmState.icon = None; + if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success) + fprintf(stderr, "nxagentUnRealizeWindow: Changing WM_STATE failed.\n"); + } + XUnmapWindow(nxagentDisplay, nxagentWindow(pWin)); return True; diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c index d9054b4b6..4b342ebcf 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c +++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c @@ -1137,6 +1137,10 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error) } pPicture->pSourcePict->type = SourcePictTypeSolidFill; pPicture->pSourcePict->solidFill.color = xRenderColorToCard32(*color); + pPicture->pSourcePict->solidFill.fullColor.alpha=color->alpha; + pPicture->pSourcePict->solidFill.fullColor.red=color->red; + pPicture->pSourcePict->solidFill.fullColor.green=color->green; + pPicture->pSourcePict->solidFill.fullColor.blue=color->blue; return pPicture; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXpicturestr.h b/nx-X11/programs/Xserver/hw/nxagent/X/NXpicturestr.h index 0d1a8e1d8..b2679257c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/X/NXpicturestr.h +++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXpicturestr.h @@ -95,6 +95,7 @@ typedef struct _PictTransform { typedef struct _PictSolidFill { unsigned int type; CARD32 color; + xRenderColor fullColor; } PictSolidFill, *PictSolidFillPtr; typedef struct _PictGradientStop { diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXxvdisp.c b/nx-X11/programs/Xserver/hw/nxagent/X/NXxvdisp.c index f6dad312a..cbb3f63e8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/X/NXxvdisp.c +++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXxvdisp.c @@ -275,17 +275,19 @@ ProcXvDispatch(ClientPtr client) case xv_PutVideo: #ifdef PANORAMIX if(!noPanoramiXExtension) - result = (XineramaXvPutVideo(client)); break; + result = (XineramaXvPutVideo(client)); else #endif - result = (ProcXvPutVideo(client)); break; + result = (ProcXvPutVideo(client)); + break; case xv_PutStill: #ifdef PANORAMIX if(!noPanoramiXExtension) - result = (XineramaXvPutStill(client)); break + result = (XineramaXvPutStill(client)); else #endif - result = (ProcXvPutStill(client)); break; + result = (ProcXvPutStill(client)); + break; case xv_GetVideo: result = (ProcXvGetVideo(client)); break; case xv_GetStill: result = (ProcXvGetStill(client)); break; case xv_GrabPort: result = (ProcXvGrabPort(client)); break; @@ -295,35 +297,39 @@ ProcXvDispatch(ClientPtr client) case xv_StopVideo: #ifdef PANORAMIX if(!noPanoramiXExtension) - result = (XineramaXvStopVideo(client)); break; + result = (XineramaXvStopVideo(client)); else #endif - result = (ProcXvStopVideo(client)); break; + result = (ProcXvStopVideo(client)); + break; case xv_SetPortAttribute: #ifdef PANORAMIX if(!noPanoramiXExtension) - result = (XineramaXvSetPortAttribute(client)); break; + result = (XineramaXvSetPortAttribute(client)); else #endif - result = (ProcXvSetPortAttribute(client)); break; + result = (ProcXvSetPortAttribute(client)); + break; case xv_GetPortAttribute: result = (ProcXvGetPortAttribute(client)); break; case xv_QueryBestSize: result = (ProcXvQueryBestSize(client)); break; case xv_QueryPortAttributes: result = (ProcXvQueryPortAttributes(client)); break; case xv_PutImage: #ifdef PANORAMIX if(!noPanoramiXExtension) - result = (XineramaXvPutImage(client)); break; + result = (XineramaXvPutImage(client)); else #endif - result = (ProcXvPutImage(client)); break; + result = (ProcXvPutImage(client)); + break; #ifdef MITSHM case xv_ShmPutImage: #ifdef PANORAMIX if(!noPanoramiXExtension) - result = (XineramaXvShmPutImage(client)); break; + result = (XineramaXvShmPutImage(client)); else #endif - result = (ProcXvShmPutImage(client)); break; + result = (ProcXvShmPutImage(client)); + break; #endif case xv_QueryImageAttributes: result = (ProcXvQueryImageAttributes(client)); break; case xv_ListImageFormats: result = (ProcXvListImageFormats(client)); break; diff --git a/nx-X11/programs/Xserver/hw/xfree86/parser/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/parser/Imakefile index 29708b64b..8513c51fa 100644 --- a/nx-X11/programs/Xserver/hw/xfree86/parser/Imakefile +++ b/nx-X11/programs/Xserver/hw/xfree86/parser/Imakefile @@ -7,7 +7,7 @@ #define DoDebugLib NO #define DoProfileLib NO #define HasSharedData NO -#define LibName xf86config +#define LibName NX_xf86config #define UseDBMalloc NO diff --git a/nx-X11/programs/Xserver/os/oscolor.c b/nx-X11/programs/Xserver/os/oscolor.c index cf79857f4..ea99450bc 100644 --- a/nx-X11/programs/Xserver/os/oscolor.c +++ b/nx-X11/programs/Xserver/os/oscolor.c @@ -53,7 +53,7 @@ SOFTWARE. #include <sys/stat.h> #include <unistd.h> -static char* nxAltRgbPaths[] = {"/usr/NX/share/rgb", "/usr/share/X11/rgb", "/etc/X11/rgb"}; +static char* nxAltRgbPaths[] = {"/usr/share/nx/rgb", "/usr/local/share/nx/rgb", "/usr/NX/share/rgb", "/usr/share/X11/rgb", "/etc/X11/rgb"}; static char _NXRgbPath[1024]; #endif |