From 6090ab1119ce7947c66d56d168989877f54a29b1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 8 Jun 2021 20:50:55 +0200 Subject: nxdialog: rework comments --- nxdialog/bin/nxdialog | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nxdialog/bin/nxdialog b/nxdialog/bin/nxdialog index ab0dbf17f..8713b77c1 100755 --- a/nxdialog/bin/nxdialog +++ b/nxdialog/bin/nxdialog @@ -8,7 +8,7 @@ # shebang line. # Copyright (C) 2008 Google Inc. -# Copyright (C) 2019 Ulrich Sibiller +# Copyright (C) 2019-2021 Ulrich Sibiller # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ # Google project "neatx" (https://code.google.com/archive/p/neatx/). # List of changes: # - pulled in the few parts of the neatx python modules that are actually -# to make it a standlone script +# required to make it a standlone script # - added usage output # - dropped logging code, print errors to stderr # - can handle the "yesno" dialog type # - added missing docstrings # - pylint improvements -# - removed neatx entry from the pulldoww menu +# - removed neatx entry from the pulldown menu # - use PyGObject instead of PyGtk and thus Gtk3 # - replace optparse by argparse # - make code compatible to python2 and python3. @@ -46,11 +46,8 @@ # nxcomp library assumes this script is located in /usr/NX/bin/nxclient # # Examples: -# nxdialog --dialog yesno --message "message text" --caption "message title" --parent 0 -# nxdialog --dialog pulldown --message "message text" --caption "message title" \ -# --window 0x123456 --parent 0 -# -# pylint: disable=fixme, broad-except +# nxdialog --dialog yesno --message "text" --caption "title" --parent 0 +# nxdialog --dialog pulldown --message "text" --caption "title" --window 0x123456 --parent 0 from __future__ import print_function -- cgit v1.2.3 From e23efeb1138ab70a25153f20f3b6d9ef08194429 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 8 Jun 2021 20:51:12 +0200 Subject: nxdialog: use os.linesep to make it work on other systems --- nxdialog/bin/nxdialog | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nxdialog/bin/nxdialog b/nxdialog/bin/nxdialog index 8713b77c1..4ef19dffc 100755 --- a/nxdialog/bin/nxdialog +++ b/nxdialog/bin/nxdialog @@ -290,7 +290,7 @@ class NxDialogProgram(object): raise except Exception as expt: - sys.stderr.write("Caught exception: %s\n" % (expt)) + sys.stderr.write("Caught exception: %s" % (expt) + os.linesep) sys.exit(EXIT_FAILURE) @staticmethod @@ -363,23 +363,23 @@ class NxDialogProgram(object): """ Disconnect/terminate NX session upon user's request. """ if not self.options.dialog_type: - sys.stderr.write("Dialog type not supplied via --dialog\n") + sys.stderr.write("Dialog type not supplied via --dialog" + os.linesep) sys.exit(EXIT_FAILURE) dlgtype = self.options.dialog_type if dlgtype not in VALID_DLG_TYPES: - sys.stderr.write("Invalid dialog type '%s'\n" % (dlgtype)) + sys.stderr.write("Invalid dialog type '%s'" % (dlgtype) + os.linesep) sys.exit(EXIT_FAILURE) if dlgtype in (DLG_TYPE_PULLDOWN, DLG_TYPE_YESNOSUSPEND, DLG_TYPE_YESNO) and self.options.agentpid is None: - sys.stderr.write("Agent pid not supplied via --parent\n") + sys.stderr.write("Agent pid not supplied via --parent" + os.linesep) sys.exit(EXIT_FAILURE) if dlgtype == DLG_TYPE_PULLDOWN and not self.options.window: - sys.stderr.write("Window id not supplied via --window\n") + sys.stderr.write("Window id not supplied via --window" + os.linesep) sys.exit(EXIT_FAILURE) if self.options.caption: @@ -397,5 +397,4 @@ class NxDialogProgram(object): self.show_dialog(message_caption, message_text) - NxDialogProgram().main() -- cgit v1.2.3 From 2e99e623457ebf0425c9c64a48131627c7826443 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 18 Oct 2021 22:17:48 +0200 Subject: Args.c: remove some empty lines --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index e2dc8c083..1a613ff38 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -268,7 +268,6 @@ int ddxProcessArgument(int argc, char *argv[], int i) if (envOptions != NULL) { nxagentParseOptionString(envOptions); - SAFE_free(envOptions); } @@ -1154,7 +1153,6 @@ static void nxagentParseSingleOption(char *name, char *value) fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'fullscreen'.\n", validateString(value)); } - return; } else if (!strcmp(name, "shpix")) @@ -1189,7 +1187,6 @@ static void nxagentParseSingleOption(char *name, char *value) fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'shmem'.\n", validateString(value)); } - return; } else if (!strcmp(name, "composite")) @@ -1531,7 +1528,6 @@ static void nxagentParseSingleOption(char *name, char *value) } *argv[0] = '-'; - memcpy(argv[0] + 1, name, size); } -- cgit v1.2.3 From 4bdf03addf2e6e3f0c8ad432df4a4df7a9e62266 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 18 Oct 2021 22:10:43 +0200 Subject: Args.c: fix wrong comment --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 1a613ff38..1341840c7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -187,9 +187,8 @@ int ddxProcessArgument(int argc, char *argv[], int i) /* * The flavour can never change, so only set it once. * - * FIXME: ddxProcessArgument() is called once for every command line - * argument, with argv[0] being the argument and not the program - * name! We should move this check somewhere else. + * ddxProcessArgument() is called once for every command line + * argument, with argv[i] being the argument, i > 0. argv[0] is the program name. */ if (nxagentProgName == NULL) { -- cgit v1.2.3 From 5a6928f86a2b7ee7e416fde592940dab862b714a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 18 Oct 2021 22:18:06 +0200 Subject: Args.c: remove superfluous SAFE_free() call --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 1341840c7..174873e51 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -697,8 +697,6 @@ int ddxProcessArgument(int argc, char *argv[], int i) #ifdef TEST fprintf(stderr, "%s: changing nxagentKeyboard from [null/null] to [clone].\n", __func__); #endif - - SAFE_free(nxagentKeyboard); nxagentKeyboard = strdup("clone"); } else -- cgit v1.2.3 From 3ab28297ce6aa46dfc5f023a405e0ed8247aa881 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 18 Oct 2021 22:54:32 +0200 Subject: Imakefiles: whitespace fixes --- nx-X11/programs/Xserver/Imakefile | 12 ++--- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 55 +++++++++++----------- .../programs/Xserver/hw/nxagent/compext/Imakefile | 18 +++---- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 390ad538b..72ed8484c 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -31,10 +31,10 @@ NULL = #include -/* On most systems the linker requires the libraries in dependency order. +/* On most systems the linker requires the libraries in dependency order. But we have no real order because there are cycles. We fix this by adding - some libraries twice on the commandline. dependLib will add the - dependency library to the commandline if the link order is important */ + some libraries twice on the commandline. dependLib will add the + dependency library to the commandline if the link order is important */ #if 1 /* This is currently enabled for all systems */ #define dependLib(x) x #else @@ -43,7 +43,7 @@ NULL = #if defined(XorgVersion) /* Do not strip server binaries */ -INSTPGMFLAGS = +INSTPGMFLAGS = #endif #define PreFbLibs $(DIX) $(OS) $(XPDDX) @@ -136,7 +136,7 @@ INSTPGMFLAGS = FB = fb/LibraryTargetName(fb) DAMAGE = miext/damage/LibraryTargetName(damage) SHADOW = miext/shadow/LibraryTargetName(shadow) - LAYER = miext/layer/LibraryTargetName(layer) + LAYER = miext/layer/LibraryTargetName(layer) #if !HasFfs && (defined(mingwArchitecture) || defined(cygwinArchitecture)) /* Order of libraries is important when linking in mingw or * cygwin. libmi.a requires ffs from libdix.a. So it is added @@ -147,7 +147,7 @@ INSTPGMFLAGS = #endif MIINITEXTOBJ = mi/miinitext.o DIX = dix/LibraryTargetName(dix) -#if UsbMouseSupport +#if UsbMouseSupport #if !HasLibUsb USB = $(XF86OSSRC)/bsd/libusb/LibraryTargetName(usb) #else diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index 4e48f62f5..710bfba80 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -1,10 +1,9 @@ #include - NULL = SUBDIRS = compext \ - $(NULL) + $(NULL) SRCS = \ NXwindow.c \ @@ -17,9 +16,9 @@ SRCS = \ NXglyph.c \ NXpicture.c \ NXshm.c \ - NXglxext.c \ - NXxvdisp.c \ - NXresource.c \ + NXglxext.c \ + NXxvdisp.c \ + NXresource.c \ NXmitrap.c \ Args.c \ Binder.c \ @@ -73,9 +72,9 @@ OBJS = \ NXglyph.o \ NXpicture.o \ NXshm.o \ - NXglxext.o \ - NXxvdisp.o \ - NXresource.o \ + NXglxext.o \ + NXxvdisp.o \ + NXresource.o \ NXmitrap.o \ Args.o \ Binder.o \ @@ -240,26 +239,26 @@ NX_DEFINES = \ #endif DEFINES = \ - -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \ - -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI \ - -DNXAGENT_SERVER \ - -DNXAGENT_RENDER_CLEANUP \ - -DNXAGENT_FIXKEYS \ - -DNXAGENT_CLIPBOARD \ - -DNXAGENT_WAKEUP=1000 \ - -DNXAGENT_ONSTART \ - -DNXAGENT_ARTSD \ - -UNX_DEBUG_INPUT \ - -DRANDR_10_INTERFACE=1 \ - -DRANDR_12_INTERFACE=1 \ - -DRANDR_13_INTERFACE=1 \ - -DRANDR_14_INTERFACE=1 \ - -DRANDR_15_INTERFACE=1 \ - -DPANORAMIX \ - -UDEBUG_TREE \ - -DX2GO \ - -DSYSTEMFONTDIR=\"$(SYSTEMFONTDIR)\" \ - $(NULL) + -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \ + -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI \ + -DNXAGENT_SERVER \ + -DNXAGENT_RENDER_CLEANUP \ + -DNXAGENT_FIXKEYS \ + -DNXAGENT_CLIPBOARD \ + -DNXAGENT_WAKEUP=1000 \ + -DNXAGENT_ONSTART \ + -DNXAGENT_ARTSD \ + -UNX_DEBUG_INPUT \ + -DRANDR_10_INTERFACE=1 \ + -DRANDR_12_INTERFACE=1 \ + -DRANDR_13_INTERFACE=1 \ + -DRANDR_14_INTERFACE=1 \ + -DRANDR_15_INTERFACE=1 \ + -DPANORAMIX \ + -UDEBUG_TREE \ + -DX2GO \ + -DSYSTEMFONTDIR=\"$(SYSTEMFONTDIR)\" \ + $(NULL) all:: $(OBJS) diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile index 407baab80..ea34def78 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile @@ -30,16 +30,16 @@ OBJS = \ Z.o \ $(NULL) - INCLUDES = -I$(SERVERSRC)/include \ - -I$(XBUILDINCDIR) \ - -I../../../../../lib/include/X11 \ - `pkg-config --cflags-only-I pixman-1` \ - $$(pkg-config --exists 'zlib' >/dev/null 2>&1 && pkg-config --cflags-only-I 'zlib') \ - `pkg-config --cflags-only-I libpng` \ - $(NULL) +INCLUDES = -I$(SERVERSRC)/include \ + -I$(XBUILDINCDIR) \ + -I../../../../../lib/include/X11 \ + `pkg-config --cflags-only-I pixman-1` \ + $$(pkg-config --exists 'zlib' >/dev/null 2>&1 && pkg-config --cflags-only-I 'zlib') \ + `pkg-config --cflags-only-I libpng` \ + $(NULL) - LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln \ - $(NULL) +LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln \ + $(NULL) NormalLibraryObjectRule() NormalLibraryTarget(compext,$(OBJS)) -- cgit v1.2.3 From cf5bb486de8b720ab39f7d2930485937e3cd0138 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 25 Oct 2021 20:38:45 +0200 Subject: Screen.c: Fix wrong format specifier --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 31b8b68a3..0c1d55f42 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -375,7 +375,7 @@ FIXME: We'll check for ReparentNotify and LeaveNotify events after XEvent e; #ifdef TEST - fprintf(stderr, "%d: WARNING! Going to wait for the ReparentNotify event [%d].\n", __func__, i); + fprintf(stderr, "%s: WARNING! Going to wait for the ReparentNotify event [%d].\n", __func__, i); #endif if (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, ReparentNotify, &e)) -- cgit v1.2.3 From 5323e2ceac684f0f688e81fd1dcda29a30204dc4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 25 Oct 2021 20:42:25 +0200 Subject: Screen.c, Window.c: use "None" everywhere for FullscreenWindow --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 0c1d55f42..7998f35f0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -988,7 +988,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) nxagentChangeOption(Fullscreen, False); nxagentChangeOption(AllScreens, False); - nxagentFullscreenWindow = 0; + nxagentFullscreenWindow = None; resetAgentPosition = True; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 6f98ee57b..b2560a660 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -2579,7 +2579,7 @@ void nxagentMapDefaultWindows(void) * Ensure that the fullscreen window gets the focus. */ - if (nxagentFullscreenWindow != 0) + if (nxagentFullscreenWindow != None) { XSetInputFocus(nxagentDisplay, nxagentFullscreenWindow, RevertToParent, CurrentTime); -- cgit v1.2.3 From 70fde4c748a0466343d308c79ecd4853499b58f1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 28 Oct 2021 18:19:00 +0200 Subject: Clipboard.c: fix/reformat some comments --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 72ca6ac64..f0cef595c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -1251,10 +1251,12 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X) if (!nxagentOption(TextClipboard)) { - /* Optimization: if we have a current target cache check if the + /* + * Optimization: if we have a current target cache check if the * requested target is supported by the owner. If not we can take * a shortcut and deny the request immediately without doing any - * further communication. */ + * further communication. + */ if (targetCache[index].type == FOR_REMOTE && targetCache[index].forRemote) { XlibAtom *targets = targetCache[index].forRemote; @@ -1373,7 +1375,7 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X) } /* - * Selete property before sending the request to the client as + * Delete property before sending the request to the client as * required by ICCCM. */ DeleteProperty(lastSelectionOwner[index].windowPtr, clientCutProperty); @@ -1389,8 +1391,10 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X) x.u.selectionRequest.requestor, x.u.selectionRequest.selection, NameForLocalAtom(x.u.selectionRequest.selection)); #endif - /* No reply to the Xserver yet - we will do that once the answer - of the above sendEventToClient arrives. */ + /* + * No reply to the Xserver yet - we will do that once the answer + * of the above sendEventToClient arrives. + */ } else { @@ -1492,7 +1496,7 @@ static void transferSelectionFromXServer(int index, int resource) } else { - /* Collect the property and store it with index "resource" */ + /* Collect the property and store it with index "free_resource" */ result = NXCollectProperty(nxagentDisplay, free_resource, serverWindow, @@ -1581,8 +1585,10 @@ static void transferSelectionFromXServer(int index, int resource) setClientSelectionStage(index, SelectionStageWaitData); - /* We've seen situations where you had to move the mouse or press a - key to let the transfer complete. Flushing here fixed it */ + /* + * We've seen situations where you had to move the mouse or press a + * key to let the transfer complete. Flushing here fixed it + */ NXFlushDisplay(nxagentDisplay, NXFlushLink); break; -- cgit v1.2.3