Index: xc/ChangeLog =================================================================== RCS file: /cvs/xorg/xc/ChangeLog,v retrieving revision 1.377 diff -u -2 -0 -r1.377 ChangeLog --- xc/ChangeLog 17 Sep 2004 22:24:34 -0000 1.377 +++ xc/ChangeLog 18 Sep 2004 00:21:22 -0000 @@ -1,21 +1,37 @@ 2004-09-17 Roland Mainz + * xc/config/cf/X11.tmpl + * xc/programs/xrx/Imakefile + * xc/programs/xrx/plugin/Imakefile + * xc/programs/xrx/plugin/Main.c + * xc/programs/xrx/plugin/PProcess.c + * xc/programs/xrx/xnest-plugin/Imakefile + * xc/programs/xrx/xnest-plugin/NewNDest.c + * xc/programs/xrx/xnest-plugin/SetWin.c + * xc/programs/xrx/xnest-plugin/XnestDis.c + Bugzilla #1372: Initial part of repairing XRX/Broadway support. + This patch fixes both the libxrx.so plugin and the Xnest-based + libxrxnest.so plugin and making them compatible to newer versions + of Mozilla and removing the backwards compatibility hacks for old + Netscape3.x versions with statically linked Motif. + +2004-09-17 Roland Mainz * xc/programs/scripts/Imakefile * xc/programs/scripts/xauth_switch_to_sun-des-1.cpp Bugzilla #1407: Adding simple helper script which switches the current user authentification from MIT-MAGIC-COOKIE-1 to SUN-DES-1 if this authentification is available. 2004-09-16 Eric Anholt * extras/Mesa/src/mesa/tnl/t_vtx_x86_gcc.S: Bugzilla #1079: Add missing check for CYGWIN for adding underscores to symbol names in assembler. Merged upstream, and should be brought in in the next import. (Alexander Gottwald) 2004-09-16 Eric Anholt * programs/Xserver/hw/xfree86/drivers/ati/radeon.h: * programs/Xserver/hw/xfree86/drivers/ati/radeon_render.c: (R200SubsequentCPUToScreenTexture): Bugzilla #1170: Fix an overcounting of DMA in BEGIN_RING that wasn't harmful. Index: xc/config/cf/X11.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/X11.tmpl,v retrieving revision 1.35 diff -u -2 -0 -r1.35 X11.tmpl --- xc/config/cf/X11.tmpl 3 Sep 2004 16:18:18 -0000 1.35 +++ xc/config/cf/X11.tmpl 18 Sep 2004 00:21:23 -0000 @@ -456,41 +456,41 @@ #ifndef BuildXineramaLibrary #define BuildXineramaLibrary (BuildXinerama && !BuildServersOnly) #endif #ifndef BuildDmxDevelTools #define BuildDmxDevelTools NO #endif #ifndef BuildDmxLibrary #define BuildDmxLibrary (BuildDmx && \ (!BuildServersOnly || BuildDmxDevelTools)) #endif #ifndef BuildXCSecurity #define BuildXCSecurity YES #endif #ifndef BuildAppgroup #define BuildAppgroup YES #endif #ifndef BuildCup #define BuildCup YES #endif #ifndef HasPlugin -#define HasPlugin NO +#define HasPlugin YES #endif #ifndef BuildPlugin #define BuildPlugin HasPlugin #endif #ifndef XpRasterDDX #define XpRasterDDX YES #endif #ifndef XpColorPclDDX #define XpColorPclDDX YES #endif #ifndef XpMonoPclDDX #define XpMonoPclDDX YES #endif #ifndef XpPostScriptDDX #define XpPostScriptDDX YES #endif #ifndef XpPdfDDX #define XpPdfDDX YES #endif #ifndef XpSvgDDX Index: xc/programs/xrx/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xrx/Imakefile,v retrieving revision 1.3 diff -u -2 -0 -r1.3 Imakefile --- xc/programs/xrx/Imakefile 25 Aug 2004 00:30:42 -0000 1.3 +++ xc/programs/xrx/Imakefile 18 Sep 2004 00:21:43 -0000 @@ -1,20 +1,10 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ XCOMM $XdotOrg: xc/programs/xrx/Imakefile,v 1.3 2004/08/25 00:30:42 kem Exp $ - - -XCOMM $XFree86$ - -#ifdef deprecated #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" -#if BuildPlugin && !defined(VendorHasX11R6_3libXext) -LIBXPLUGINDIR = libxplugin -#endif - - SUBDIRS = $(LIBXPLUGINDIR) plugin + SUBDIRS = helper plugin xnest-plugin MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) -#endif Index: xc/programs/xrx/plugin/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xrx/plugin/Imakefile,v retrieving revision 1.2 diff -u -2 -0 -r1.2 Imakefile --- xc/programs/xrx/plugin/Imakefile 23 Apr 2004 19:55:03 -0000 1.2 +++ xc/programs/xrx/plugin/Imakefile 18 Sep 2004 00:21:43 -0000 @@ -1,180 +1,54 @@ -XCOMM $Xorg: Imakefile,v 1.4 2001/02/20 15:51:17 pookie Exp $ - - - - -XCOMM $XFree86: xc/programs/xrx/plugin/Imakefile,v 1.12tsi Exp $ +XCOMM $Xorg: Imakefile,v 1.5 2005/09/160 00:51:17 gisburn Exp $ #if HasSharedLibraries XCOMM This isn't an option we must build a shared lib #define DoSharedLib YES #define LibHeaders NO #define LibName xrx #define SoRev SOXRXREV -SharedLibReferences(xrx,xrx,$(RXSRC),SOXRXREV,6.3) +SharedLibReferences(xrx,xrx,$(RXSRC),SOXRXREV,6.8) RXSRC = ../rx RX_INCLUDES = -I$(RXSRC) #if HasBSD44Sockets SOCKET_DEFINES = -DBSD44SOCKETS #endif -/* Netscape be damned. Allow fresh (re-)installs to proceed correctly */ -#if UseInstalledX11 - -#ifdef SGIArchitecture -#if OSMajorVersion == 5 && OSMinorVersion < 3 || OSMajorVersion == 6 && OSMinorVersion < 2 - XT_DEFINES = -DXUSE_XTREGISTERWINDOW -#endif -/* Even though we want to build the distribution with -n32, Navigator 3.0 - * binaries are still built on IRIX 5.2, which means we need to use the - * old style object format. This is a hack because this Imakefile gets - * included too late to do this properly, that is to say that the - * CCOPTIONS in Imake.tmpl gets the -n32 options that we don't want, - * but the CCOPTIONS in Library.tmpl does get set correctly, and over- - * rides the value. So it works, but it's not pretty. - */ -#undef sgiCCOptions -#define sgiCCOptions -xansi -#ifdef Mips64Architecture - SHLIBLDFLAGS = -shared -#endif - LD = ld -#endif - -#ifdef SunArchitecture -VENDOR_INCLUDES = -I/usr/openwin/include -#if OSMajorVersion < 5 || OSMajorVersion == 5 && OSMinorVersion < 6 - XT_DEFINES = -DXUSE_XTREGISTERWINDOW -#endif -#if !HasGcc -/* - * Based on Xmd.h 2.6 appears to be no more than R6pl11, so we need this. - * Hopefully Sun will fix this in 2.7. - */ -#undef DefaultCCOptions -#define DefaultCCOptions -Xc -#endif -#if OSMajorVersion == 4 -FUNCPROTO_DEFINES = -DXFUNCPROTO_NOT_AVAILABLE -#endif -#endif - -#ifdef HPArchitecture -/* Even though HP ships R6 in 10.20, Netscape 3.x is built on HPUX 9 and is - * linked against X11R5 libraries, so we continue to use _XtRegisterWindow - * until such time as Netscape releases a version that is linked with X11R6. - */ - XT_DEFINES = -DXUSE_XTREGISTERWINDOW -#if OSMajorVersion < 10 || (OSMajorVersion == 10 && OSMinorVersion < 2) - TOP_INCLUDES = -I/usr/include -I$(BUILDINCDIR) -#else - TOP_INCLUDES = -I/usr/include/X11R5 -I$(BUILDINCDIR) -#endif -#endif - -#if defined(AlphaArchitecture) && defined(OSF1Architecture) -#if OSMajorVersion < 4 - XT_DEFINES = -DXUSE_XTREGISTERWINDOW -#endif -#endif - -#ifdef IBMArchitecture -/* No clue when IBM might ship R6 */ - XT_DEFINES = -DXUSE_XTREGISTERWINDOW -#endif - -#endif /* UseInstalledX11 */ - +XCOMM -DPLUGIN_TRACE can be added to the following definition to debug PLUGIN_DEFINES = -DXP_UNIX PLUGIN_INCLUDES = -I./include DEFINES = StrcasecmpDefines -DNETSCAPE_PLUGIN $(PLUGIN_DEFINES) $(XT_DEFINES) $(SOCKET_DEFINES) $(FUNCPROTO_DEFINES) INCLUDES = -I. $(PLUGIN_INCLUDES) $(RX_INCLUDES) $(VENDOR_INCLUDES) PARAMS_SRCS = PRead.c PParse.c BuildReq.c PARAMS_OBJS = PRead.o PParse.o BuildReq.o XMISC_SRCS = XUrls.c XAuth.c XDpyName.c Prefs.c XMISC_OBJS = XUrls.o XAuth.o XDpyName.o Prefs.o SRCS = Main.c SetWin.c PProcess.c NewNDest.c Global.c stubs.c \ $(PARAMS_SRCS) $(XMISC_SRCS) OBJS = Main.o SetWin.o PProcess.o NewNDest.o Global.o stubs.o \ $(PARAMS_OBJS) $(XMISC_OBJS) -#if UseInstalledX11 - -XCOMM we need to link in the right libraries so it will work no matter -XCOMM which libraries Netscape itself is using. -#if !VendorHasX11R6_3libXext -X11R6_3_EXTENSIONS = ../libxplugin/libxplugin.a -#ifdef SunArchitecture -PLUGIN_LDOPTIONS = -L/usr/openwin/lib -CCENVSETUP = -#if OSMajorVersion == 5 && OSMinorVersion > 5 -RXICELIB = $(ICELIB) -#endif -#if OSMajorVersion == 4 - EXTENSIONLIB = -#endif -#endif -#ifdef HPArchitecture -#if OSMajorVersion < 10 || (OSMajorVersion == 10 && OSMinorVersion < 2) - LDPRELIBS = -L/usr/lib/X11 -#else - LDPRELIBS = -L/usr/lib/X11R5 -#endif -#endif -#ifdef IBMArchitecture - XTOOLONLYLIB = -lXm -lXt - EXTENSIONLIB = -lXext - XONLYLIB = -lX11 - RXICELIB = $(ICELIB) - LDPOSTLIBS = - LDPRELIBS = -#endif -#ifdef SequentArchitecture - RXICELIB = $(ICELIB) - XONLYLIB = -lX11 -lsocket -PLUGIN_LDOPTIONS = $(LDPRELIBS) -#endif -#else -PLUGIN_LDOPTIONS = $(LDPRELIBS) -#endif - -/* Sun and HP don't ship it yet, SGI has it inside libXt. */ -#if defined(AlphaArchitecture) && defined(OSF1Architecture) -RXICELIB = $(ICELIB) -#endif - -#else /* UseInstalledX11 */ -PLUGIN_LDOPTIONS = $(LDPRELIBS) -#endif /* UseInstalledX11 */ - - REQUIREDLIBS = $(X11R6_3_EXTENSIONS) $(PLUGIN_LDOPTIONS) $(RXICELIB) $(XTOOLONLYLIB) $(XLIB) + REQUIREDLIBS = $(LDPRELIB) XawClientLibs $(XTOOLONLYLIB) $(XPLIB) $(XLIB) #include LinkFile(PRead.c,$(RXSRC)/PRead.c) LinkFile(PParse.c,$(RXSRC)/PParse.c) LinkFile(BuildReq.c,$(RXSRC)/BuildReq.c) LinkFile(XUrls.c,$(RXSRC)/XUrls.c) LinkFile(XAuth.c,$(RXSRC)/XAuth.c) LinkFile(XDpyName.c,$(RXSRC)/XDpyName.c) LinkFile(Prefs.c,$(RXSRC)/Prefs.c) DependTarget() InstallManPage(libxrx,$(MANDIR)) -#ifdef IBMArchitecture -install:: shr.o - $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) shr.o $(DESTDIR)$(SHLIBDIR)/lib$(LIBNAME).so - $(RM) $(DESTDIR)$(SHLIBDIR)/lib$(LIBNAME).a -#endif - #endif /* HasSharedLibraries */ Index: xc/programs/xrx/plugin/Main.c =================================================================== RCS file: /cvs/xorg/xc/programs/xrx/plugin/Main.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 Main.c --- xc/programs/xrx/plugin/Main.c 23 Apr 2004 19:55:03 -0000 1.2 +++ xc/programs/xrx/plugin/Main.c 18 Sep 2004 00:21:43 -0000 @@ -35,45 +35,54 @@ /* -*- Mode: C; tab-width: 4; -*- */ /****************************************************************************** * Copyright 1996 Netscape Communications. All rights reserved. ******************************************************************************/ /* * UnixShell.c * * Netscape Client Plugin API * - Function that need to be implemented by plugin developers * * This file defines a "Template" plugin that plugin developers can use * as the basis for a real plugin. This shell just provides empty * implementations of all functions that the plugin can implement * that will be called by Netscape (the NPP_xxx methods defined in * npapi.h). * * dp Suresh * */ -#include -#include + #include "RxPlugin.h" -#include "X11/StringDefs.h" +#include +#ifdef USE_MOTIF +extern WidgetClass xmLabelGadgetClass; +extern WidgetClass xmPushButtonGadgetClass; +#else +#include +#include +#endif /* USE_MOTIF */ + +#include +#include /*********************************************************************** * Utility functions to deal with list of arguments ***********************************************************************/ /* Free list of arguments */ static void FreeArgs(char* argn[], char* argv[], int argc) { int i; if (argc != 0) { for (i = 0; i < argc; i++) { NPN_MemFree(argn[i]); NPN_MemFree(argv[i]); } NPN_MemFree(argn); NPN_MemFree(argv); } } @@ -363,125 +372,117 @@ #endif /* perform GET request * throwing away the response. */ (void) NPN_GetURL(This->instance, This->query, NULL); This->parse_reply = 1; /* we want to print out the answer */ } void StartCB(Widget widget, XtPointer client_data, XtPointer call_data) { PluginInstance* This = (PluginInstance*) client_data; #if 0 XtUnmapWidget(widget); #endif XtDestroyWidget(widget); StartApplication(This); } -#if defined(linux) || (defined(sun) && !defined(SVR4)) -/* deficient linux linker semantics */ -static WidgetClass xmLabelGadgetClass; -static WidgetClass xmPushButtonGadgetClass; -#else -extern WidgetClass xmLabelGadgetClass; -extern WidgetClass xmPushButtonGadgetClass; -#endif void RxpSetStatusWidget(PluginInstance* This, PluginState state) { Arg args[5]; int n; XrmDatabase db; char* return_type; XrmValue return_value; if (This->status_widget) { XtDestroyWidget(This->status_widget); This->status_widget = NULL; } if (This->plugin_widget == NULL) return; db = XtDatabase (XtDisplay (This->plugin_widget)); if (!XrmGetResource (db, "RxPlugin_BeenHere", "RxPlugin_BeenHere", &return_type, &return_value)) { XrmPutStringResource (&db, "*Rx_Loading.labelString", "Loading..."); XrmPutStringResource (&db, "*Rx_Starting.labelString", "Starting..."); XrmPutStringResource (&db, "*Rx_Start.labelString", "Start"); XrmPutStringResource (&db, "RxPlugin_BeenHere", "YES"); } -#if defined(linux) || (defined(sun) && !defined(SVR4)) - /* - lame loader semantics mean we have to go fishing around to - come up with widget class records so we can create some widgets. - - Names of widgets changed in 4.x, so look for those names too - for linux. - - If Microsoft ever does IE for Linux we'll have to figure out - those names too. - */ - if (xmLabelGadgetClass == NULL) { - Widget w; - - w = XtNameToWidget (This->toplevel_widget, "*topLeftArea.urlLabel"); - if (w == NULL) - w = XtNameToWidget (This->toplevel_widget, "*urlBar.urlLocationLabel"); - xmLabelGadgetClass = XtClass (w); - w = XtNameToWidget (This->toplevel_widget, "*toolBar.abort"); - if (w == NULL) - w = XtNameToWidget (This->toplevel_widget, "*PopupMenu.openCustomUrl"); - xmPushButtonGadgetClass = XtClass (w); - } -#endif n = 0; XtSetArg(args[n], "shadowThickness", 1); n++; XtSetArg(args[n], XtNwidth, This->width); n++; XtSetArg(args[n], XtNheight, This->height); n++; +#ifdef USE_MOTIF if (state == LOADING) { /* create a label */ This->status_widget = XtCreateManagedWidget("Rx_Loading", xmLabelGadgetClass, This->plugin_widget, args, n); #ifndef NO_STARTING_STATE } else if (state == STARTING) { /* create a label */ This->status_widget = XtCreateManagedWidget("Rx_Starting", xmLabelGadgetClass, This->plugin_widget, args, n); #endif } else if (state == WAITING) { /* create a push button */ This->status_widget = XtCreateManagedWidget("Rx_Start", xmPushButtonGadgetClass, This->plugin_widget, args, n); XtAddCallback(This->status_widget, "activateCallback", StartCB, This); } else if (state == RUNNING) { /* nothing else to be done */ } +#else + if (state == LOADING) { + /* create a label */ + This->status_widget = + XtCreateManagedWidget("Rx_Loading", labelWidgetClass, + This->plugin_widget, args, n); +#ifndef NO_STARTING_STATE + } else if (state == STARTING) { + /* create a label */ + This->status_widget = + XtCreateManagedWidget("Rx_Starting", labelWidgetClass, + This->plugin_widget, args, n); +#endif + } else if (state == WAITING) { + /* create a push button */ + This->status_widget = + XtCreateManagedWidget("Rx_Start", commandWidgetClass, + This->plugin_widget, args, n); + XtAddCallback(This->status_widget, XtNcallback, StartCB, This); + } else if (state == RUNNING) { + /* nothing else to be done */ + } +#endif /* USE_MOTIF */ This->state = state; } NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) { PluginInstance* This; RxStreamBuf *streambuf = (RxStreamBuf *) stream->pdata; char **rx_argn, **rx_argv; int rx_argc; RxParams params; RxReturnParams return_params; NPError status = NPERR_NO_ERROR; if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; This = (PluginInstance*) instance->pdata; Index: xc/programs/xrx/plugin/PProcess.c =================================================================== RCS file: /cvs/xorg/xc/programs/xrx/plugin/PProcess.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 PProcess.c --- xc/programs/xrx/plugin/PProcess.c 23 Apr 2004 19:55:03 -0000 1.2 +++ xc/programs/xrx/plugin/PProcess.c 18 Sep 2004 00:21:43 -0000 @@ -669,51 +669,53 @@ toplevel windows */ XtAddRawEventHandler(This->plugin_widget, EnterWindowMask | LeaveWindowMask, False, CrossingHandler, (XtPointer) This); for (i = 0; i < This->nclient_windows; i++) { XtRegisterDrawable (RxGlobal.dpy, This->client_windows[i].win, This->plugin_widget); } } /*********************************************************************** * The instance is gone. Remove Event Handlers so that they aren't * called with a reference to the old instance. ***********************************************************************/ void RxpTeardown (PluginInstance* This) { if (This->toplevel_widget != NULL) { +#if 0 /* this crashes mozilla/firefox */ /* ConfigureNotify on top level */ XtRemoveRawEventHandler (This->toplevel_widget, StructureNotifyMask, False, StructureNotifyHandler, (XtPointer) This); XtRemoveRawEventHandler (This->toplevel_widget, NoEventMask, True, RxpWmDelWinHandler, (XtPointer) This); +#endif #if 0 XmRemoveWMProtocolCallback (This->toplevel_widget, RxGlobal.wm_delete_window, RxpWmDelWinHandler, (XtPointer) This); #endif } } /*********************************************************************** * Process the given RxParams and make the RxReturnParams ***********************************************************************/ static int ProcessUIParams(PluginInstance* This, Boolean trusted, Boolean use_fwp, Boolean use_lbx, RxParams *in, RxReturnParams *out, char **x_ui_auth_ret) { XSecurityAuthorization dum; int dummy; Index: xc/programs/xrx/xnest-plugin/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xrx/xnest-plugin/Imakefile,v retrieving revision 1.1.1.1 diff -u -2 -0 -r1.1.1.1 Imakefile --- xc/programs/xrx/xnest-plugin/Imakefile 14 Nov 2003 16:49:23 -0000 1.1.1.1 +++ xc/programs/xrx/xnest-plugin/Imakefile 18 Sep 2004 00:21:43 -0000 @@ -1,64 +1,41 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ +XCOMM $Xorg: Imakefile,v 1.4 2004/09/16 00:55:03 gisburn Exp $ XCOMM This isn't an option we must build a shared lib #define DoSharedLib YES #define LibHeaders NO #define LibName xrxnest #define SoRev SOXRXREV -SharedLibReferences(xrxnest,xrxnest,$(RXSRC),SOXRXREV,6.3) +SharedLibReferences(xrxnest,xrxnest,$(RXSRC),SOXRXREV,6.8) RXSRC = ../rx RX_INCLUDES = -I$(RXSRC) PLUGINSRC = ../plugin #if HasBSD44Sockets SOCKET_DEFINES = -DBSD44SOCKETS #endif -#ifdef SGIArchitecture -#if OSMajorVersion == 5 && OSMinorVersion < 3 || OSMajorVersion == 6 && OSMinorV -ersion < 2 - XT_DEFINES = -DXUSE_XTREGISTERWINDOW -#endif -/* Even though we want to build the distribution with -n32, Navigator 3.0 - * binaries are still built on IRIX 5.2, which means we need to use the - * old style object format. This is a hack because this Imakefile gets - * included too late to do this properly, that is to say that the - * CCOPTIONS in Imake.tmpl gets the -n32 options that we don't want, - * but the CCOPTIONS in Library.tmpl does get set correctly, and over- - * rides the value. So it works, but it's not pretty. - */ -#undef sgiCCOptions -#define sgiCCOptions -xansi -#ifdef Mips64Architecture - SHLIBLDFLAGS = -shared -#endif - LD = ld -#endif - -#ifdef SunArchitecture -VENDOR_INCLUDES = -I/usr/openwin/include -#endif - XCOMM -DPLUGIN_TRACE can be added to the following definition to debug PLUGIN_DEFINES = -DXP_UNIX PLUGIN_INCLUDES = -I$(PLUGINSRC) -I$(PLUGINSRC)/include DEFINES = -DNETSCAPE_PLUGIN $(PLUGIN_DEFINES) -DNO_STARTING_STATE $(SOCKET_DEFINES) INCLUDES = -I. $(PLUGIN_INCLUDES) $(RX_INCLUDES) $(VENDOR_INCLUDES) # most objects are the same as the ones for the standard plugin PLUGIN_OBJS = $(PLUGINSRC)/PRead.o $(PLUGINSRC)/PParse.o \ $(PLUGINSRC)/BuildReq.o $(PLUGINSRC)/XUrls.o SRCS = Main.c SetWin.c PProcess.c NewNDest.c XnestDis.c OBJS = Main.o SetWin.o PProcess.o NewNDest.o XnestDis.o \ $(PLUGINSRC)/stubs.o $(PLUGIN_OBJS) + REQUIREDLIBS = $(LDPRELIB) XawClientLibs $(XTOOLONLYLIB) $(XPLIB) $(XLIB) + #include LinkFile(Main.c,$(PLUGINSRC)/Main.c) DependTarget() Index: xc/programs/xrx/xnest-plugin/NewNDest.c =================================================================== RCS file: /cvs/xorg/xc/programs/xrx/xnest-plugin/NewNDest.c,v retrieving revision 1.1.1.1 diff -u -2 -0 -r1.1.1.1 NewNDest.c --- xc/programs/xrx/xnest-plugin/NewNDest.c 14 Nov 2003 16:49:23 -0000 1.1.1.1 +++ xc/programs/xrx/xnest-plugin/NewNDest.c 18 Sep 2004 00:21:43 -0000 @@ -42,24 +42,31 @@ void NPP_Shutdown(void) { } /*********************************************************************** * Functions to init and free private members ***********************************************************************/ void RxpNew(PluginInstance *This) { This->window = None; This->child_pid = 0; This->toplevel_widget = NULL; } void RxpDestroy(PluginInstance *This) { + int status; + /* kill child process */ - kill(This->child_pid, SIGKILL); + kill(This->child_pid, SIGTERM); + + /* ... and fetch the status (to avoid dead process childs + * floating around) */ + waitpid(This->child_pid, &status, 0); + RxpFreeXnestDisplayNumber(This->display_num); } Index: xc/programs/xrx/xnest-plugin/SetWin.c =================================================================== RCS file: /cvs/xorg/xc/programs/xrx/xnest-plugin/SetWin.c,v retrieving revision 1.1.1.1 diff -u -2 -0 -r1.1.1.1 SetWin.c --- xc/programs/xrx/xnest-plugin/SetWin.c 14 Nov 2003 16:49:23 -0000 1.1.1.1 +++ xc/programs/xrx/xnest-plugin/SetWin.c 18 Sep 2004 00:21:43 -0000 @@ -48,50 +48,49 @@ * npapi.h). * * dp Suresh * */ #include "RxPlugin.h" #include /*********************************************************************** * Sometimes the plugin widget gets stupidly destroyed, that is whenever * Netscape relayouts the page. This callback reparents the Xnest * window to the root window so it does not get destroyed as well. * Eventually the NPP_SetWindow function should be called and we'll * reparent it back under the plugin. ***********************************************************************/ static void DestroyCB (Widget widget, XtPointer client_data, XtPointer call_data) { PluginInstance* This = (PluginInstance*) client_data; - int i; #ifdef PLUGIN_TRACE fprintf (stderr, "DestroyCB, This: 0x%x\n", This); #endif This->plugin_widget = NULL; This->status_widget = NULL; if (This->dont_reparent == RxFalse) { XUnmapWindow(XtDisplay(widget), This->window); XReparentWindow(XtDisplay(widget), This->window, - RootWindowOfScreen(XtScreen(widget)), 0, 0); + XRootWindowOfScreen(XtScreen(widget)), 0, 0); This->dont_reparent = RxTrue; } else This->dont_reparent = RxFalse; /* * not worth removing event handlers on this widget since it's * about to be destroyed anyway. */ } /*********************************************************************** * Sometimes the plugin widget gets stupidly resized, because of poor * geometry when its child (that is the status widget) gets destroyed. * So this callback resizes it back to the right size. * Note that this could lead to an endless battle, but it appears that * it doesn't so far... ***********************************************************************/ static void ResizeCB (Widget widget, XtPointer client_data, XtPointer call_data) { @@ -160,54 +159,57 @@ XtAddCallback (This->plugin_widget, XtNdestroyCallback, DestroyCB, (XtPointer) This); XtAddCallback (This->plugin_widget, "resizeCallback", ResizeCB, (XtPointer) This); if (This->window == None) { This->window = XCreateSimpleWindow(display, (Window)window->window, 0, 0, window->width, window->height, 0, 0, 0); XMapWindow(display, This->window); This->display_num = RxpXnestDisplayNumber(); #ifdef PLUGIN_TRACE fprintf(stderr, "Windows: %ld %ld\n", (Window) window->window, XtWindow(This->window)); #endif pid = fork(); if (pid == 0) { /* child process */ - static char *argv[] = { - "Xnest", - "-ac", /* no access control (sic!) */ - ":00", /* display number */ - "-parent", - "01234567890123456789", /* parent window id */ - NULL - }; - close(ConnectionNumber(display)); - - sprintf(argv[2], ":%d", This->display_num); - sprintf(argv[4], "%ld", This->window); + char buffer1[64], + buffer2[64]; + char *xnest_argv[6]; + + xnest_argv[0] = "Xnest"; + xnest_argv[1] = "-ac"; /* no access control (sic!) */ + xnest_argv[2] = buffer1; /* display number */ + xnest_argv[3] = "-parent"; + xnest_argv[4] = buffer2; /* parent window id */ + xnest_argv[5] = NULL; + + close(XConnectionNumber(display)); + + sprintf(xnest_argv[2], ":%d", This->display_num); + sprintf(xnest_argv[4], "%ld", This->window); /* exec Xnest */ - execvp("Xnest", argv); + execvp("Xnest", xnest_argv); perror("Xnest"); return NPERR_GENERIC_ERROR; } else { /* parent process */ /* store child pid so we can kill it later on */ This->child_pid = pid; } } else { /* Xnest is either under the RootWindow or the old widget */ XReparentWindow(display, This->window, (Window)window->window, 0, 0); if (This->dont_reparent == RxTrue) XMapWindow(display, This->window); if (This->state != RUNNING) RxpSetStatusWidget(This, This->state); } if (This->dont_reparent != RxFalse) /* can be True or Undef */ This->dont_reparent = RxFalse; else This->dont_reparent = RxTrue; } Index: xc/programs/xrx/xnest-plugin/XnestDis.c =================================================================== RCS file: /cvs/xorg/xc/programs/xrx/xnest-plugin/XnestDis.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 XnestDis.c --- xc/programs/xrx/xnest-plugin/XnestDis.c 23 Apr 2004 19:55:04 -0000 1.2 +++ xc/programs/xrx/xnest-plugin/XnestDis.c 18 Sep 2004 00:21:43 -0000 @@ -17,62 +17,91 @@ ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* $XFree86$ */ #include "RxPlugin.h" /*********************************************************************** * Utility functions and global variable to manage display numbers ***********************************************************************/ -/* maximum numbers of concurrent instances */ -#define MAX_PLUGINS 10 +/* maximum numbers of concurrent instances (per machine) */ +#define MAX_PLUGINS 128 -/* start from 5 to avoid possible conflict with multi-display X server */ -#define XNEST_OFFSET 5 +/* start from 80 to avoid possible conflict with multi-display X server + * like SunRay,LTSP, etc.*/ +#define XNEST_OFFSET 80 /* global allowing to know which display numbers are in use */ -static int16 xnest_display_numbers[MAX_PLUGINS]; +static char xnest_display_numbers[MAX_PLUGINS]; void RxpInitXnestDisplayNumbers() { - memset(xnest_display_numbers, 0, sizeof(int16) * MAX_PLUGINS); + memset(xnest_display_numbers, 0, sizeof(char) * MAX_PLUGINS); +} + +static +Bool IsDisplayNumFree(int id) +{ + char fnamebuf[256]; + struct stat sbuf; + int res; + + /* /tmp/.X%d-lock is more or less the official way... */ + sprintf(fnamebuf, "/tmp/.X%d-lock", id); + res = stat(fnamebuf, &sbuf); + if (res == 0) + return False; + + /* ... but then we have to test for the old stuff, too... ;-( */ + sprintf(fnamebuf, "/tmp/.X11-pipe/X%d", id); + res = stat(fnamebuf, &sbuf); + if (res == 0) + return False; + + sprintf(fnamebuf, "/tmp/.X11-unix/X%d", id); + res = stat(fnamebuf, &sbuf); + if (res == 0) + return False; + + return True; } /* function returning first display number available */ int RxpXnestDisplayNumber() { int i; for (i = 0; i < MAX_PLUGINS; i++) - if (xnest_display_numbers[i] == 0) { + if ((xnest_display_numbers[i] == 0) && + IsDisplayNumFree(i + XNEST_OFFSET)) { xnest_display_numbers[i] = 1; return i + XNEST_OFFSET; } /* no more available */ return -1; } /* function returning first display number available */ void RxpFreeXnestDisplayNumber(int i) { xnest_display_numbers[i - XNEST_OFFSET] = 0; } /* function returning display name with specified display number */ char * RxpXnestDisplay(int display_number) { static char name[1024]; char *display_name, *dpy_name, *display_num, *screen_num;