rpms/openoffice.org/devel workspace.swffixes.patch, NONE, 1.1 openoffice.org.spec, 1.1708, 1.1709

Caolan McNamara caolanm at fedoraproject.org
Sat Dec 6 16:17:13 UTC 2008


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11502

Modified Files:
	openoffice.org.spec 
Added Files:
	workspace.swffixes.patch 
Log Message:
add workspace.swffixes.patch

workspace.swffixes.patch:

--- NEW FILE workspace.swffixes.patch ---
Index: util/extensions/source/plugin/base/makefile.mk
diff -u util/extensions/source/plugin/base/makefile.mk:1.14 util/extensions/source/plugin/base/makefile.mk:1.14.90.2
--- util/extensions/source/plugin/base/makefile.mk:1.14	Fri Apr 11 03:21:51 2008
+++ util/extensions/source/plugin/base/makefile.mk	Thu Oct 23 10:55:24 2008
@@ -55,6 +55,11 @@
 CFLAGSCXX+=$(OBJCXXFLAGS)
 .ENDIF  # "$(GUIBASE)"=="aqua"
 
+.IF "$(GUIBASE)" == "unx" && "$(ENABLE_GTK)" == "TRUE"
+PKGCONFIG_MODULES=gtk+-2.0
+.INCLUDE : pkg_config.mk
+.ENDIF
+
 SLOFILES=		\
 				$(SLO)$/plctrl.obj		\
 				$(SLO)$/service.obj		\
Index: util/extensions/source/plugin/inc/plugin/unx/mediator.hxx
diff -u util/extensions/source/plugin/inc/plugin/unx/mediator.hxx:1.8 util/extensions/source/plugin/inc/plugin/unx/mediator.hxx:1.8.90.1
--- util/extensions/source/plugin/inc/plugin/unx/mediator.hxx:1.8	Fri Apr 11 03:26:34 2008
+++ util/extensions/source/plugin/inc/plugin/unx/mediator.hxx	Tue Oct 14 10:55:28 2008
@@ -33,7 +33,6 @@
 #include <string.h>
 #include <stdarg.h>
 #include <tools/string.hxx>
-#include <tools/list.hxx>
 #include <tools/link.hxx>
 #include <vos/pipe.hxx>
 #include <vos/mutex.hxx>
@@ -43,6 +42,8 @@
 #include <stdio.h>
 #endif
 
+#include <vector>
+
 struct MediatorMessage
 {
 	ULONG	m_nID;
@@ -83,8 +84,6 @@
 	void	Rewind() { m_pRun = NULL; }
 };
 
-DECLARE_LIST( MediatorMessageList, MediatorMessage* )
-
 class MediatorListener;
 
 class Mediator
@@ -93,7 +92,7 @@
 protected:
     int									m_nSocket;
 
-	MediatorMessageList					m_aMessageQueue;
+    std::vector<MediatorMessage*>		m_aMessageQueue;
 	NAMESPACE_VOS(OMutex)				m_aQueueMutex;
 	NAMESPACE_VOS(OMutex)				m_aSendMutex;
 	// only one thread can send a message at any given time
Index: util/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
diff -u util/extensions/source/plugin/inc/plugin/unx/plugcon.hxx:1.13 util/extensions/source/plugin/inc/plugin/unx/plugcon.hxx:1.13.90.3
--- util/extensions/source/plugin/inc/plugin/unx/plugcon.hxx:1.13	Fri Apr 11 03:26:53 2008
+++ util/extensions/source/plugin/inc/plugin/unx/plugcon.hxx	Wed Oct 15 09:29:35 2008
@@ -34,7 +34,7 @@
 #include <string.h>
 
 #include <list>
-#include <tools/list.hxx>
+#include <vector>
 #include <plugin/unx/mediator.hxx>
 
 #if defined SOLARIS
@@ -82,6 +82,25 @@
 #include <npsdk/npupp.h>
 }
 #include <npapi.h>
+
+#if NP_VERSION_MINOR < 17
+// compatibility hack: compile with older NPN api header, but define
+// some later introduced constants
+// for gcc 3
+#define NP_ABI_MASK 0x10000000
+#define NPNVSupportsXEmbedBool ((NPNVariable)14)
+#define NPPVpluginNeedsXEmbed  ((NPPVariable)14)
+#define NPNVToolkit            ((int)(13 | NP_ABI_MASK))
+#define NPNVGtk12 1
+#define NPNVGtk2  2
+#endif
+#endif
+
+#ifdef ENABLE_GTK
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#else
+#define GtkWidget void
 #endif
 
 #undef Window
@@ -104,6 +123,11 @@
 	void*						pShell;
 	void*						pWidget;
     void*						pForm;
+    
+    GtkWidget*                  pGtkWindow;
+    GtkWidget*                  pGtkWidget;
+    
+    bool                        bShouldUseXEmbed;
 
 	int nArg;
 	char** argn;
@@ -119,24 +143,18 @@
 	~ConnectorInstance();
 };
 
-class PluginConnector;
-
-DECLARE_LIST( NPStreamList, NPStream* )
-DECLARE_LIST( InstanceList, ConnectorInstance* )
-DECLARE_LIST( PluginConnectorList, PluginConnector* )
-
 class PluginConnector : public Mediator
 {
 protected:
 	NAMESPACE_VOS(OMutex)               m_aUserEventMutex;
 
-	static PluginConnectorList          allConnectors;
+	static std::vector<PluginConnector*>  allConnectors;
 	
 	DECL_LINK( NewMessageHdl, Mediator* );
 	DECL_LINK( WorkOnNewMessageHdl, Mediator* );
 	
-	NPStreamList	m_aNPWrapStreams;
-	InstanceList	m_aInstances;
+    std::vector<NPStream*>              m_aNPWrapStreams;
+    std::vector<ConnectorInstance*>     m_aInstances;
 	
 	ULONG	FillBuffer( char*&, const char*, ULONG, va_list );
 public:
@@ -155,7 +173,7 @@
 	UINT32	GetStreamID( NPStream* pStream );
 	UINT32	GetNPPID( NPP );
 
-    NPStreamList& getStreamList() { return m_aNPWrapStreams; }
+    std::vector<NPStream*>& getStreamList() { return m_aNPWrapStreams; }
 
 	NPError GetNPError( MediatorMessage* pMes )
 	{
@@ -170,6 +188,9 @@
 		LINK( this, PluginConnector, WorkOnNewMessageHdl ).
 			Call( (Mediator*)this );
 	}
+    
+    ConnectorInstance* getInstance( NPP );
+    ConnectorInstance* getInstanceById( UINT32 );
 };
 
 enum CommandAtoms
Index: util/extensions/source/plugin/unx/makefile.mk
diff -u util/extensions/source/plugin/unx/makefile.mk:1.15 util/extensions/source/plugin/unx/makefile.mk:1.15.90.3
--- util/extensions/source/plugin/unx/makefile.mk:1.15	Fri Apr 11 03:27:46 2008
+++ util/extensions/source/plugin/unx/makefile.mk	Thu Oct 16 05:35:09 2008
@@ -33,6 +33,7 @@
 PRJNAME=extensions
 TARGET=plunx
 TARGETTYPE=CUI
+ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  ..$/util$/makefile.pmk
 
@@ -57,6 +58,12 @@
 CDEFS+=-DDISABLE_XAW
 .ENDIF
 
+.IF "$(ENABLE_GTK)" == "TRUE"
+CDEFS+=-DENABLE_GTK
+PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0
+.INCLUDE : pkg_config.mk
+.ENDIF
+
 SLOFILES=\
 	$(SLO)$/nppapi.obj		\
 	$(SLO)$/sysplug.obj		\
@@ -89,6 +96,19 @@
 .ENDIF
 .ENDIF
 
+.IF "$(ENABLE_GTK)" == "TRUE"
+# libs for gtk plugin
+APP1STDLIBS+=$(PKGCONFIG_LIBS:s/ -lpangoxft-1.0//)
+# hack for faked SO environment
+.IF "$(PKGCONFIG_ROOT)"!=""
+.IF "$(OS)" == "SOLARIS"
+# don't ask, it's ugly
+DIRECT :=-z nodefs $(DIRECT)
+.ENDIF
+.ENDIF          # "$(PKGCONFIG_ROOT)"!=""
+.ENDIF
+    
+
 APP1DEF=	$(MISC)$/$(TARGET).def
 
 .ENDIF # $(WITH_MOZILLA) != "NO"
Index: util/extensions/source/plugin/unx/mediator.cxx
diff -u util/extensions/source/plugin/unx/mediator.cxx:1.11 util/extensions/source/plugin/unx/mediator.cxx:1.11.90.1
--- util/extensions/source/plugin/unx/mediator.cxx:1.11	Fri Apr 11 03:28:10 2008
+++ util/extensions/source/plugin/unx/mediator.cxx	Tue Oct 14 10:55:28 2008
@@ -70,8 +70,11 @@
 	}
     else
         close( m_nSocket );
-	while( m_aMessageQueue.Count() )
-		delete m_aMessageQueue.Remove( (ULONG)0 );
+    for( std::vector< MediatorMessage* >::iterator it = m_aMessageQueue.begin();
+         it != m_aMessageQueue.end(); ++it )
+    {
+		delete *it;
+    }
 }
 
 
@@ -107,7 +110,7 @@
     if( ! m_pListener )
         return FALSE;
 
-	ULONG nItems = m_aMessageQueue.Count();
+	size_t nItems = m_aMessageQueue.size();
 
 	if( ! nTimeOut && nItems > 0 )
 		return TRUE;
@@ -116,11 +119,11 @@
 	aValue.Seconds = nTimeOut/1000;
 	aValue.Nanosec = ( nTimeOut % 1000 ) * 1000;
 
-	while( m_aMessageQueue.Count() == nItems )
+	while( m_aMessageQueue.size() == nItems )
 	{
 		m_aNewMessageCdtn.wait( & aValue );
 		m_aNewMessageCdtn.reset();
-		if( nTimeOut && m_aMessageQueue.Count() == nItems )
+		if( nTimeOut && m_aMessageQueue.size() == nItems )
 			return FALSE;
 	}
 	return TRUE;
@@ -133,12 +136,16 @@
 	{
 		{
 			NAMESPACE_VOS(OGuard) aGuard( m_aQueueMutex );
-			for( ULONG i = 0; i < m_aMessageQueue.Count(); i++ )
+			for( size_t i = 0; i < m_aMessageQueue.size(); i++ )
 			{
-				ULONG nID = m_aMessageQueue.GetObject( i )->m_nID;
+                MediatorMessage* pMessage = m_aMessageQueue[ i ];
+				ULONG nID = pMessage->m_nID;
 				if(  ( nID & 0xff000000 ) &&
 					 ( ( nID & 0x00ffffff ) == nMessageID ) )
-					return m_aMessageQueue.Remove( i );
+                {
+					m_aMessageQueue.erase( m_aMessageQueue.begin() + i );
+                    return pMessage;
+                }
 			}
 		}
 		WaitForMessage( 10 );
@@ -154,9 +161,15 @@
 			// guard must be after WaitForMessage, else the listener
 			// cannot insert a new one -> deadlock
 			NAMESPACE_VOS(OGuard) aGuard( m_aQueueMutex );
-			for( ULONG i = 0; i < m_aMessageQueue.Count(); i++ )
-				if( ! ( m_aMessageQueue.GetObject( i )->m_nID & 0xff000000 ) )
-					return m_aMessageQueue.Remove( i );
+			for( size_t i = 0; i < m_aMessageQueue.size(); i++ )
+            {
+                MediatorMessage* pMessage = m_aMessageQueue[ i ];
+				if( ! ( pMessage->m_nID & 0xff000000 ) )
+                {
+                    m_aMessageQueue.erase( m_aMessageQueue.begin() + i );
+					return pMessage;
+                }
+            }
 			if( ! bWait )
 				return NULL;
 		}
@@ -201,7 +214,7 @@
                         aGuard( m_pMediator->m_aQueueMutex );
                     MediatorMessage* pMessage =
                         new MediatorMessage( nHeader[ 0 ], nHeader[ 1 ], pBuffer );
-                    m_pMediator->m_aMessageQueue.Insert( pMessage, LIST_APPEND );
+                    m_pMediator->m_aMessageQueue.push_back( pMessage );
                 }
                 m_pMediator->m_aNewMessageCdtn.set();
                 m_pMediator->m_aNewMessageHdl.Call( m_pMediator );
Index: util/extensions/source/plugin/unx/npnapi.cxx
diff -u util/extensions/source/plugin/unx/npnapi.cxx:1.11 util/extensions/source/plugin/unx/npnapi.cxx:1.11.128.3
--- util/extensions/source/plugin/unx/npnapi.cxx:1.11	Mon Jan 14 06:53:25 2008
+++ util/extensions/source/plugin/unx/npnapi.cxx	Wed Oct 15 09:29:36 2008
@@ -20,6 +20,7 @@
 extern int wakeup_fd[];
 extern Widget topLevel, topBox;
 extern Display* pAppDisplay;
+extern Display* pXtAppDisplay;
 extern int nAppArguments;
 extern char** pAppArguments;
 
@@ -62,7 +63,15 @@
 	if( ! pMes )
 		return NPERR_GENERIC_ERROR;
 
-	pConnector->getStreamList().Remove( stream );
+    for( std::vector< NPStream* >::iterator it = pConnector->getStreamList().begin();
+         it != pConnector->getStreamList().end(); ++it )
+    {
+        if( *it == stream )
+        {
+            pConnector->getStreamList().erase( it );
+            break;
+        }
+    }
 	delete [] stream->url;
 	delete stream;
 	// returns NPError
@@ -164,7 +173,7 @@
 		pStream->lastmodified = pMes->GetUINT32();
         pStream->ndata = pStream->pdata = pStream->notifyData = NULL;
         
-		pConnector->getStreamList().Insert( pStream, LIST_APPEND );
+		pConnector->getStreamList().push_back( pStream );
 		*stream = pStream;
 	}
 
@@ -353,13 +362,13 @@
 	medDebug( 1, "NPN_ReloadPlugins: SNI\n" );
 }
 
-static NPError l_NPN_GetValue( NPP /*instance*/, NPNVariable variable, void* value )
+static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value )
 {
 	switch( variable )
 	{
 		case NPNVxDisplay:
-			*((Display**)value) = pAppDisplay;
-			medDebug( 1, "Display requested\n" );
+            *((Display**)value) = pXtAppDisplay;
+            medDebug( 1, "Display requested\n" );
 			break;
 		case NPNVxtAppContext:
 			*((XtAppContext*)value) = app_context;
@@ -380,8 +389,21 @@
             *(NPBool*)value = false;
 			medDebug( 1, "offline browsing requested\n" );
             break;
+        case NPNVSupportsXEmbedBool:
+            // asking xembed
+            *(int*)value = true;
+			medDebug( 1, "xembed requested\n" );
+            break;
+        case NPNVToolkit:
+            #ifdef ENABLE_GTK
+            *(int*)value = NPNVGtk2;
+            #else
+            *(int*)value = 0;
+            #endif
+			medDebug( 1, "toolkit requested\n" );
+            break;
  		default:
-			medDebug( 1, "unknown NPNVariable %d requested\n", variable );
+			medDebug( 1, "unknown NPNVariable %x requested\n", variable );
             return NPERR_INVALID_PARAM;
 	}
 	return NPERR_NO_ERROR;
@@ -468,7 +490,7 @@
 NPError (*pNP_Initialize)(NPNetscapeFuncs*,NPPluginFuncs*)		= NULL;
 NPError (*pNP_Shutdown)()										= NULL;
 
-PluginConnectorList PluginConnector::allConnectors;
+std::vector< PluginConnector* > PluginConnector::allConnectors;
 
 PluginConnector::PluginConnector( int nSocket ) :
 		Mediator( nSocket )
@@ -493,11 +515,11 @@
 			case eNPP_DestroyStream:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID		= pMessage->GetUINT32();
-				NPStream* pStream	= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream	= m_aNPWrapStreams[ nFileID ];
 				NPError aReason		= GetNPError( pMessage );
-                m_aNPWrapStreams.Remove( pStream );
+                m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID );
 
 				aReason = aPluginFuncs.destroystream( instance, pStream, aReason );
 				Respond( pMessage->m_nID,
@@ -511,15 +533,16 @@
 			case eNPP_Destroy:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				ConnectorInstance* pInst= m_aInstances.GetObject( nInstance );
+				ConnectorInstance* pInst= m_aInstances[ nInstance ];
 
                 // some plugin rely on old netscapes behaviour
                 // to first destroy the widget and then destroy
                 // the instance, so mimic that behaviour here
-                XtDestroyWidget( (Widget)pInst->pShell );
+                if( pInst->pShell )
+                    XtDestroyWidget( (Widget)pInst->pShell );
                 
                 pInst->pWidget = pInst->pShell = NULL;
-
+                
                 // the other side will call eNPP_DestroyPhase2 after this
                 NPError aReason = NPERR_NO_ERROR;
                 Respond( pMessage->m_nID, (char*)&aReason, sizeof( aReason ), NULL );
@@ -529,7 +552,7 @@
             {
                 // now really destroy the instance
 				UINT32 nInstance	= pMessage->GetUINT32();
-				ConnectorInstance* pInst= m_aInstances.GetObject( nInstance );
+				ConnectorInstance* pInst= m_aInstances[ nInstance ];
 				NPP instance		= pInst->instance;
 				NPSavedData* pSave = NULL;
 
@@ -548,7 +571,15 @@
 							 "0000", 4,
 							 NULL );
 
-				delete m_aInstances.Remove( nInstance );
+                #ifdef ENABLE_GTK
+                if( pInst->pGtkWindow )
+                    g_object_unref( G_OBJECT(pInst->pGtkWindow) );
+                if( pInst->pGtkWidget )
+                    g_object_unref( G_OBJECT(pInst->pGtkWidget) );
+                #endif
+
+				m_aInstances.erase( m_aInstances.begin() + nInstance );
+                delete pInst;
 				delete instance;
                 medDebug( 1, "destroyed instance (returning %d)\n", aRet );
 			}
@@ -556,7 +587,7 @@
 			case eNPP_NewStream:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				char* pType				= pMessage->GetString();
 				NPStream* pStream		= new NPStream;
 				pStream->url			= pMessage->GetString();
@@ -564,7 +595,7 @@
 				pStream->lastmodified	= pMessage->GetUINT32();
                 pStream->pdata = pStream->ndata = pStream->notifyData = NULL;
 				NPBool* pSeekable		= (NPBool*)pMessage->GetBytes();
-				m_aNPWrapStreams.Insert( pStream, LIST_APPEND );
+				m_aNPWrapStreams.push_back( pStream );
 				uint16 nStype = NP_ASFILE;
 				NPError aRet = aPluginFuncs.newstream( instance, pType, pStream,
                                                        *pSeekable, &nStype );
@@ -598,7 +629,7 @@
 										   pArgn, nArgnBytes,
 										   pArgv, nArgvBytes,
 										   pSavedData, nSaveBytes );
-				m_aInstances.Insert( pInst, LIST_APPEND );
+				m_aInstances.push_back( pInst );
 				NPError aRet;
 				aRet = aPluginFuncs.newp( pInst->pMimeType, instance, *pMode, *pArgc,
                                           pInst->nArg ? pInst->argn : NULL,
@@ -613,6 +644,22 @@
                 for( int i = 0; i < pInst->nArg; i++ )
                     medDebug( 1, "   \"%s\"=\"%s\"\n", pInst->argn[i], pInst->argv[i] );
 #endif
+
+                #ifdef ENABLE_GTK
+                // check if XEMBED is to be used
+                // ask for Bool. there seems to be no clear definition whether the
+                // return value should be an int or unsigned char
+                // int can hold both and will be nonzero in case of "true"
+                if( aPluginFuncs.getvalue )
+                {
+                    int bNeedsXEmbed = 0;
+                    NPError error = aPluginFuncs.getvalue( instance, NPPVpluginNeedsXEmbed, (void *)&bNeedsXEmbed );
+                    if( error == NPERR_NO_ERROR )
+                        pInst->bShouldUseXEmbed = (bNeedsXEmbed != 0);
+                    medDebug( 1, "should use xembed = %s\n", pInst->bShouldUseXEmbed ? "true" : "false" );
+                }
+                #endif
+                
 				Respond( pMessage->m_nID,
 						 (char*)&aRet, sizeof( aRet ),
 						 NULL );
@@ -624,52 +671,95 @@
 			case eNPP_SetWindow:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				ConnectorInstance* pInst= m_aInstances.GetObject( nInstance );
+				ConnectorInstance* pInst= m_aInstances[ nInstance ];
 				NPWindow* pWindow		= (NPWindow*)pMessage->GetBytes();
-				if( ! pInst->pWidget )
-				{
-                    static bool bFirstWindow = true;
-                    
-                    if( bFirstWindow )
+                
+                if( pWindow->width < 1 )
+                    pWindow->width = 1;
+                if( pWindow->height < 1 )
+                    pWindow->height = 1;
+
+                #ifdef ENABLE_GTK
+                if( pInst->bShouldUseXEmbed )
+                {
+                    if( ! pInst->pGtkWidget )
                     {
-                        bFirstWindow = false;
-                        pInst->pShell	= topLevel;
-                        pInst->pWidget	= topBox;
-                        medDebug( 1, "reusing app window\n" );
+                        medDebug( 1, "creating gtk plug and socket\n" );
+                        
+                        pInst->pGtkWindow = gtk_plug_new((GdkNativeWindow)pWindow->window);
+                        gtk_widget_show( pInst->pGtkWindow );
+                        pInst->pGtkWidget = gtk_socket_new();
+                        gtk_widget_show( pInst->pGtkWidget );
+                        gtk_container_add( GTK_CONTAINER(pInst->pGtkWindow), pInst->pGtkWidget );
+                        gtk_widget_show_all( pInst->pGtkWindow );
+                        pInst->window.window = (void *)gtk_socket_get_id( GTK_SOCKET(pInst->pGtkWidget ) );
+
+                        XSync( pAppDisplay, False );
+
+                        XMapWindow( pAppDisplay, GDK_WINDOW_XWINDOW(pInst->pGtkWindow->window) );
+
+                        XSync( pAppDisplay, False );
                     }
-                    else
+                    
+                    // update widget size; alas out parent is not yet really XEMBED conformant
+                    gtk_widget_set_size_request( pInst->pGtkWidget, pWindow->width, pWindow->height );
+                    gtk_window_resize( GTK_WINDOW(pInst->pGtkWindow), pWindow->width, pWindow->height );
+                    
+                    GdkScreen* pGdkScreen = gtk_widget_get_screen( pInst->pGtkWidget );
+                    Screen* pScreen = ScreenOfDisplay( pAppDisplay, gdk_screen_get_number( pGdkScreen ) );
+
+                    pInst->window.x					= 0;
+                    pInst->window.y					= 0;
+                    pInst->window.width				= pWindow->width;
+                    pInst->window.height			= pWindow->height;
+                    pInst->window.clipRect.left		= 0;
+                    pInst->window.clipRect.top		= 0;
+                    pInst->window.clipRect.right	= pWindow->width;
+                    pInst->window.clipRect.bottom	= pWindow->height;
+                    pInst->window.ws_info			= &pInst->ws_info;
+                    pInst->window.type				= NPWindowTypeWindow;
+                    pInst->ws_info.type				= NP_SETWINDOW;
+                    pInst->ws_info.display			= pAppDisplay;
+                    pInst->ws_info.visual			= DefaultVisualOfScreen( pScreen );
+                    pInst->ws_info.colormap			= DefaultColormapOfScreen( pScreen );
+                    pInst->ws_info.depth			= DefaultDepthOfScreen( pScreen );
+                }
+                else
+                #endif
+                {
+                    if( ! pInst->pWidget )
                     {
                         pInst->pWidget = CreateNewShell( &(pInst->pShell), (XLIB_Window)pWindow->window );					
                     }
+    
+                    // fill in NPWindow and NPCallbackStruct
+                    pInst->window.window			= (void*)XtWindow( (Widget)pInst->pWidget );
+                    pInst->window.x					= 0;
+                    pInst->window.y					= 0;
+                    pInst->window.width				= pWindow->width;
+                    pInst->window.height			= pWindow->height;
+                    pInst->window.clipRect.left		= 0;
+                    pInst->window.clipRect.top		= 0;
+                    pInst->window.clipRect.right	= pWindow->width;
+                    pInst->window.clipRect.bottom	= pWindow->height;
+                    pInst->window.ws_info			= &pInst->ws_info;
+                    pInst->window.type				= NPWindowTypeWindow;
+                    pInst->ws_info.type				= NP_SETWINDOW;
+                    pInst->ws_info.display			= XtDisplay( (Widget)pInst->pWidget );
+                    pInst->ws_info.visual			= DefaultVisualOfScreen( XtScreen( (Widget)pInst->pWidget ) );
+                    pInst->ws_info.colormap			= DefaultColormapOfScreen( XtScreen( (Widget)pInst->pWidget ) );
+                    pInst->ws_info.depth			= DefaultDepthOfScreen( XtScreen( (Widget)pInst->pWidget ) );
+    
+                    XtResizeWidget( (Widget)pInst->pShell,
+                                    pInst->window.width,
+                                    pInst->window.height,
+                                    0 );
+                    XtResizeWidget( (Widget)pInst->pWidget,
+                                    pInst->window.width,
+                                    pInst->window.height,
+                                    0 );
                 }
 
-                // fill in NPWindow and NPCallbackStruct
-				pInst->window.window			= (void*)XtWindow( (Widget)pInst->pWidget );
-                pInst->window.x					= 0;
-                pInst->window.y					= 0;
-                pInst->window.width				= pWindow->width;
-                pInst->window.height			= pWindow->height;
-                pInst->window.clipRect.left		= 0;
-                pInst->window.clipRect.top		= 0;
-                pInst->window.clipRect.right	= pWindow->width;
-                pInst->window.clipRect.bottom	= pWindow->height;
-                pInst->window.ws_info			= &pInst->ws_info;
-                pInst->window.type				= NPWindowTypeWindow;
-                pInst->ws_info.type				= NP_SETWINDOW;
-                pInst->ws_info.display			= XtDisplay( (Widget)pInst->pWidget );
-                pInst->ws_info.visual			= DefaultVisualOfScreen( XtScreen( (Widget)pInst->pWidget ) );
-                pInst->ws_info.colormap			= DefaultColormapOfScreen( XtScreen( (Widget)pInst->pWidget ) );
-                pInst->ws_info.depth			= DefaultDepthOfScreen( XtScreen( (Widget)pInst->pWidget ) );
-
-				XtResizeWidget( (Widget)pInst->pShell,
-								pInst->window.width,
-								pInst->window.height,
-								0 );
-				XtResizeWidget( (Widget)pInst->pWidget,
-								pInst->window.width,
-								pInst->window.height,
-								0 );
-
 				NPError aRet = aPluginFuncs.setwindow( pInst->instance, &pInst->window );
 				medDebug( 1, "pluginapp: NPP_SetWindow returns %d\n", (int) aRet );
 				Respond( pMessage->m_nID,
@@ -681,9 +771,9 @@
 			case eNPP_StreamAsFile:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID			= pMessage->GetUINT32();
-				NPStream* pStream		= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream		= m_aNPWrapStreams[ nFileID ];
 				char* fname				= pMessage->GetString();
 				medDebug( 1, "pluginapp: NPP_StreamAsFile %s\n", fname );
 				aPluginFuncs.asfile( instance, pStream, fname );
@@ -693,7 +783,7 @@
 			case eNPP_URLNotify:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				char* url				= pMessage->GetString();
 				NPReason* pReason		= (NPReason*)pMessage->GetBytes();
 				void** notifyData		= (void**)pMessage->GetBytes();
@@ -706,9 +796,9 @@
 			case eNPP_WriteReady:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID			= pMessage->GetUINT32();
-				NPStream* pStream		= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream		= m_aNPWrapStreams[ nFileID ];
 				int32 nRet = aPluginFuncs.writeready( instance, pStream );
                 
                 medDebug( 1, "pluginapp: NPP_WriteReady( %p, %p ) (stream id = %d) returns %d\n",
@@ -722,9 +812,9 @@
 			case eNPP_Write:
 			{
 				UINT32 nInstance		= pMessage->GetUINT32();
-				NPP instance			= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance			= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID			= pMessage->GetUINT32();
-				NPStream* pStream		= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream		= m_aNPWrapStreams[ nFileID ];
 				int32 offset			= pMessage->GetUINT32();
 				ULONG len;
 				char* buffer			= (char*)pMessage->GetBytes( len );
Index: util/extensions/source/plugin/unx/nppapi.cxx
diff -u util/extensions/source/plugin/unx/nppapi.cxx:1.7 util/extensions/source/plugin/unx/nppapi.cxx:1.7.128.1
--- util/extensions/source/plugin/unx/nppapi.cxx:1.7	Mon Jan 14 06:53:38 2008
+++ util/extensions/source/plugin/unx/nppapi.cxx	Tue Oct 14 10:55:28 2008
@@ -16,25 +16,40 @@
 #include <plugin/impl.hxx>
 #include <vcl/svapp.hxx>
 
-PluginConnectorList PluginConnector::allConnectors;
+std::vector<PluginConnector*> PluginConnector::allConnectors;
 
 PluginConnector::PluginConnector( int nSocket ) :
 		Mediator( nSocket )
 {
-	allConnectors.Insert( this, LIST_APPEND );
+	allConnectors.push_back( this );
 	SetNewMessageHdl( LINK( this, PluginConnector, NewMessageHdl ) );
 }
 
 PluginConnector::~PluginConnector()
 {
 	NAMESPACE_VOS(OGuard) aGuard( m_aUserEventMutex );
-	allConnectors.Remove( this );
+    for( std::vector< PluginConnector* >::iterator it = allConnectors.begin();
+         it != allConnectors.end(); ++it )
+    {
+        if( *it == this )
+        {
+            allConnectors.erase( it );
+            break;
+        }
+    }
 }
 
 IMPL_LINK( PluginConnector, NewMessageHdl, Mediator*, /*pMediator*/ )
 {
 	NAMESPACE_VOS(OGuard) aGuard( m_aUserEventMutex );
-	if( allConnectors.GetPos( this ) == LIST_ENTRY_NOTFOUND )
+    bool bFound = false;
+    for( std::vector< PluginConnector* >::iterator it = allConnectors.begin();
+         it != allConnectors.end() && bFound == false; ++it )
+    {
+        if( *it == this )
+            bFound = true;
+    }
+	if( ! bFound )
 		return 0;
     Application::PostUserEvent( LINK( this, PluginConnector, WorkOnNewMessageHdl ) );
 	return 0;
@@ -42,7 +57,14 @@
 
 IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ )
 {
-	if( allConnectors.GetPos( this ) == LIST_ENTRY_NOTFOUND )
+    bool bFound = false;
+    for( std::vector< PluginConnector* >::iterator it = allConnectors.begin();
+         it != allConnectors.end() && bFound == false; ++it )
+    {
+        if( *it == this )
+            bFound = true;
+    }
+	if( ! bFound )
 		return 0;
 /*
     {
@@ -62,7 +84,7 @@
 			case eNPN_GetURL:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pUrl			= pMessage->GetString();
 				char* pWindow		= pMessage->GetString();
 				NPError aRet = NPN_GetURL( instance, pUrl, pWindow );
@@ -75,7 +97,7 @@
 			case eNPN_GetURLNotify:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pUrl			= pMessage->GetString();
 				char* pWindow		= pMessage->GetString();
 				void** pNotifyData	= (void**)pMessage->GetBytes();
@@ -91,23 +113,23 @@
 			case eNPN_DestroyStream:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID		= pMessage->GetUINT32();
 				char* pUrl			= pMessage->GetString();
 				NPError* pReason	= (NPError*)pMessage->GetBytes();
 				NPError aRet = NPERR_FILE_NOT_FOUND;
-				if( nFileID < m_aNPWrapStreams.Count() )
+				if( nFileID < static_cast<UINT32>(m_aNPWrapStreams.size()) )
 				{
-					if( ! strcmp( m_aNPWrapStreams.GetObject( nFileID )->url, pUrl ) )
+					if( ! strcmp( m_aNPWrapStreams[ nFileID ]->url, pUrl ) )
 					{
 						aRet =
-							NPN_DestroyStream( instance, m_aNPWrapStreams.GetObject( nFileID ),
+							NPN_DestroyStream( instance, m_aNPWrapStreams[ nFileID ],
 											   *pReason );
-						m_aNPWrapStreams.Remove( nFileID );
+						m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID );
 					}
 					else
 						medDebug( 1, "StreamID %d has incoherent urls %s and %s\n",
-								  nFileID, pUrl, m_aNPWrapStreams.GetObject( nFileID )->url );
+								  nFileID, pUrl, m_aNPWrapStreams[ nFileID ]->url );
 				}
 				else
 					medDebug( 1, "Nonexistent StreamID %d\n", nFileID );
@@ -122,7 +144,7 @@
 			case eNPN_NewStream:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				NPMIMEType pType	= pMessage->GetString();
 				char* pTarget		= pMessage->GetString();
 
@@ -142,7 +164,7 @@
 				}
 				else
                 {
-					m_aNPWrapStreams.Insert( pStream, LIST_APPEND );
+					m_aNPWrapStreams.push_back( pStream );
 
                     ULONG nLen = strlen( pStream->url );
                     Respond( pMessage->m_nID,
@@ -160,7 +182,7 @@
 			case eNPN_PostURLNotify:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pUrl		= pMessage->GetString();
 				char* pTarget	= pMessage->GetString();
 				UINT32 nLen		= pMessage->GetUINT32();
@@ -180,7 +202,7 @@
 			case eNPN_PostURL:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pUrl		= pMessage->GetString();
 				char* pWindow	= pMessage->GetString();
 				UINT32 nLen		= pMessage->GetUINT32();
@@ -198,7 +220,7 @@
 			case eNPN_RequestRead:
 			{
 				UINT32 nFileID		= pMessage->GetUINT32();
-				NPStream* pStream	= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream	= m_aNPWrapStreams[ nFileID ];
 				UINT32 nRanges		= pMessage->GetUINT32();
 				UINT32* pArray		= (UINT32*)pMessage->GetBytes();
 				// build ranges table
@@ -225,7 +247,7 @@
 			case eNPN_Status:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				char* pString	= pMessage->GetString();
 				NPN_Status( instance, pString );
 				delete [] pString;
@@ -246,9 +268,9 @@
 			case eNPN_Write:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				UINT32 nFileID		= pMessage->GetUINT32();
-				NPStream* pStream	= m_aNPWrapStreams.GetObject( nFileID );
+				NPStream* pStream	= m_aNPWrapStreams[ nFileID ];
 				INT32 nLen			= pMessage->GetUINT32();
 				void* pBuffer		= pMessage->GetBytes();
 				INT32 nRet = NPN_Write( instance, pStream, nLen, pBuffer );
@@ -262,7 +284,7 @@
 			case eNPN_UserAgent:
 			{
 				UINT32 nInstance	= pMessage->GetUINT32();
-				NPP instance		= m_aInstances.GetObject( nInstance )->instance;
+				NPP instance		= m_aInstances[ nInstance ]->instance;
 				const char* pAnswer = NPN_UserAgent( instance );
 				Respond( pMessage->m_nID,
 						 (char*)pAnswer, strlen( pAnswer ),
@@ -338,7 +360,7 @@
 				  &nFileID, sizeof( nFileID ),
 				  &reason, sizeof( reason ),
 				  NULL );
-	m_aNPWrapStreams.Remove( stream );
+	m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID );
 	if( ! pMes )
 		return NPERR_GENERIC_ERROR;
 
@@ -368,12 +390,11 @@
 NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
 				 char* argn[], char* argv[], NPSavedData *saved )
 {
-	m_aInstances.Insert(
+	m_aInstances.push_back(
 		new ConnectorInstance( instance, pluginType, 0,
 							   NULL, 0, NULL, 0,
 							   saved ? (char*)saved->buf : NULL,
-							   saved ? saved->len : 0 ),
-		LIST_APPEND );
+							   saved ? saved->len : 0 ) );
 
 	char *pArgnBuf, *pArgvBuf;
 	int nArgnLen = 0, nArgvLen = 0;
@@ -433,7 +454,7 @@
 	NPError aRet = NPERR_GENERIC_ERROR;
 	GET_INSTANCE_RET( aRet );
 
-	m_aNPWrapStreams.Insert( stream, LIST_APPEND );
+	m_aNPWrapStreams.push_back( stream );
 	MediatorMessage* pMes = 
 		Transact( eNPP_NewStream,
 				  POST_INSTANCE(),
Index: util/extensions/source/plugin/unx/npwrap.cxx
diff -u util/extensions/source/plugin/unx/npwrap.cxx:1.16 util/extensions/source/plugin/unx/npwrap.cxx:1.16.90.5
--- util/extensions/source/plugin/unx/npwrap.cxx:1.16	Fri Apr 11 03:28:32 2008
+++ util/extensions/source/plugin/unx/npwrap.cxx	Wed Oct 15 09:50:08 2008
@@ -33,6 +33,7 @@
 #include <errno.h>
 #include <dlfcn.h>
 #include <unistd.h>
+#include <sys/poll.h>
 #include <fcntl.h>
 #include <signal.h>
 
@@ -46,6 +47,7 @@
 int			nAppArguments = 0;
 char**		pAppArguments = NULL;
 Display*	pAppDisplay = NULL;
+Display*    pXtAppDisplay = NULL;
 
 extern oslModule pPluginLib;
 extern NPError (*pNP_Shutdown)();
@@ -71,7 +73,8 @@
     {
         return 0;
     }
-
+    
+    #ifndef ENABLE_GTK
     static void ThreadEventHandler( XtPointer /*client_data*/, int* /*source*/, XtInputId* id )
     {
         char buf[256];
@@ -99,6 +102,7 @@
             }
         }
     }
+    #endif
 }
 
 
@@ -129,16 +133,17 @@
         XtNheight, 200,
   		(char *)NULL );
     XtRealizeWidget( shell );
+    XtRealizeWidget( newWidget );
 
     medDebug( 1, "Reparenting new widget %x to %x\n", XtWindow( newWidget ), aParentWindow );
-    XReparentWindow( pAppDisplay,
+    XReparentWindow( pXtAppDisplay,
                      XtWindow( shell ),
                      aParentWindow,
                      0, 0 );
     XtMapWidget( shell );
     XtMapWidget( newWidget );
-    XRaiseWindow( pAppDisplay, XtWindow( shell ) ); 
-    XSync( pAppDisplay, False );
+    XRaiseWindow( pXtAppDisplay, XtWindow( shell ) ); 
+    XSync( pXtAppDisplay, False );
 
 	return newWidget;
 }
@@ -146,12 +151,12 @@
 void* CreateNewShell( void** pShellReturn, XLIB_Window aParentWindow )
 {
     XLIB_String n, c;
-    XtGetApplicationNameAndClass(pAppDisplay, &n, &c);
+    XtGetApplicationNameAndClass(pXtAppDisplay, &n, &c);
 
 	Widget newShell =
 		XtVaAppCreateShell( "pane", c,
 							topLevelShellWidgetClass,
-							pAppDisplay,
+							pXtAppDisplay,
                             XtNwidth, 200,
                             XtNheight, 200,
                             XtNoverrideRedirect, True,
@@ -175,7 +180,7 @@
     oslModule pLib = osl_loadModule( sFileURL.pData, SAL_LOADMODULE_LAZY );
 	if( ! pLib )
     {
-        medDebug( 1, "could not open %s\n", pPath );
+        medDebug( 1, "could not open %s: %s\n", pPath, dlerror() );
     }
     return pLib;
 }
@@ -184,13 +189,13 @@
 static void CheckPlugin( const char* pPath )
 {
     oslModule pLib = LoadModule( pPath );
-
+    
 	char*(*pNP_GetMIMEDescription)() = (char*(*)())
         osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" );
 	if( pNP_GetMIMEDescription )
         printf( "%s\n", pNP_GetMIMEDescription() );
     else
-        medDebug( 1, "could not symbol NP_GetMIMEDescription\n" );
+        medDebug( 1, "could not get symbol NP_GetMIMEDescription %s\n", dlerror() );
 
     osl_unloadModule( pLib );
 }
@@ -221,6 +226,88 @@
     _exit(nSig);
 }
 
+#ifdef ENABLE_GTK
+
+static gboolean noClosure( gpointer )
+{
+    return TRUE;
+}
+
+// Xt events
+static gboolean prepareXtEvent( GSource*, gint* )
+{
+    int nMask = XtAppPending( app_context );
+    return (nMask & XtIMAll) != 0;
+}
+
+static gboolean checkXtEvent( GSource* )
+{
+    int nMask = XtAppPending( app_context );
+    return (nMask & XtIMAll) != 0;
+}
+
+static gboolean dispatchXtEvent( GSource*, GSourceFunc, gpointer )
+{
+    XtAppProcessEvent( app_context, XtIMAll );
+    return TRUE;
+}
+
+static GSourceFuncs aXtEventFuncs =
+{
+  prepareXtEvent,
+  checkXtEvent,
+  dispatchXtEvent,
+  NULL,
+  noClosure,
+  NULL
+};
+
+static gboolean prepareWakeupEvent( GSource*, gint* )
+{
+    struct pollfd aPoll = { wakeup_fd[0], POLLIN, 0 };
+    poll( &aPoll, 1, 0 );    
+    return (aPoll.revents & POLLIN ) != 0;
+}
+
+static gboolean checkWakeupEvent( GSource* pSource )
+{
+    gint nDum = 0;
+    return prepareWakeupEvent( pSource, &nDum );
+}
+
+static gboolean dispatchWakeupEvent( GSource*, GSourceFunc, gpointer )
+{
+    char buf[256];
+    // clear pipe
+    int len, nLast = -1;
+    
+    while( (len = read( wakeup_fd[0], buf, sizeof( buf ) ) ) > 0 )
+        nLast = len-1;
+    if( ( nLast == -1  || buf[nLast] != 'x' ) && pConnector )
+        pConnector->CallWorkHandler();
+    else
+    {
+        XtAppSetExitFlag( app_context );
+        bPluginAppQuit = true;
+
+        delete pConnector;
+        pConnector = NULL;
+    }
+    
+    return TRUE;
+}
+
+static GSourceFuncs aWakeupEventFuncs = {
+  prepareWakeupEvent,
+  checkWakeupEvent,
+  dispatchWakeupEvent,
+  NULL,
+  noClosure,
+  NULL
+};
+
+#endif // GTK
+
 }
 
 int main( int argc, char **argv)
@@ -241,7 +328,7 @@
         pBaseName--;
     LoadAdditionalLibs( pBaseName );
 
-    if( argc < 3 )
+    if( argc == 2 )
     {
         CheckPlugin(argv[1]);
         exit(0);
@@ -289,37 +376,63 @@
 		exit(255);
 	}
     int nSocket = atol( argv[1] );
+    
+    #ifdef ENABLE_GTK
+    g_thread_init(NULL);
+    gtk_init(&argc, &argv);
+    #endif
 
  	pConnector = new PluginConnector( nSocket );
  	pConnector->SetConnectionLostHdl( Link( NULL, GlobalConnectionLostHdl ) );
 
 	XtSetLanguageProc( NULL, NULL, NULL );
 
-    topLevel = XtVaOpenApplication(
-        &app_context,       /* Application context */
-        "SOPlugin",         /* Application class */
-        NULL, 0,            /* command line option list */
-        &argc, argv,        /* command line args */
-        NULL,               /* for missing app-defaults file */
-        topLevelShellWidgetClass,
-        XtNoverrideRedirect, True,
-        (char *)NULL);      /* terminate varargs list */
-	pAppDisplay = XtDisplay( topLevel );
+    XtToolkitInitialize();
+    app_context = XtCreateApplicationContext();
+    pXtAppDisplay = XtOpenDisplay( app_context, NULL, "SOPlugin", "SOPlugin", NULL, 0, &argc, argv );
 
+
+    #ifdef ENABLE_GTK
+    // integrate Xt events into GTK event loop
+    GPollFD aXtPollDesc, aWakeupPollDesc;
+
+    GSource* pXTSource = g_source_new( &aXtEventFuncs, sizeof(GSource) );
+    if( !pXTSource )
+    {
+        medDebug( 1, "could not get Xt GSource" );
+        return 1;
+    }
+    
+    g_source_set_priority( pXTSource, GDK_PRIORITY_EVENTS );
+    g_source_set_can_recurse( pXTSource, TRUE );
+    g_source_attach( pXTSource, NULL );
+    aXtPollDesc.fd = ConnectionNumber( pXtAppDisplay );
+    aXtPollDesc.events = G_IO_IN;
+    aXtPollDesc.revents = 0;
+    g_source_add_poll( pXTSource, &aXtPollDesc );
+    
+    // Initialize wakeup events listener
+    GSource *pWakeupSource = g_source_new( &aWakeupEventFuncs, sizeof(GSource) );
+    if ( pWakeupSource == NULL )
+    {
+        medDebug( 1, "could not get wakeup source" );
+        return 1;
+    }
+    g_source_set_priority( pWakeupSource, GDK_PRIORITY_EVENTS);
+    g_source_attach( pWakeupSource, NULL );
+    aWakeupPollDesc.fd = wakeup_fd[0];
+    aWakeupPollDesc.events = G_IO_IN;
+    aWakeupPollDesc.revents = 0;
+    g_source_add_poll( pWakeupSource, &aWakeupPollDesc );
+
+    pAppDisplay = gdk_x11_display_get_xdisplay( gdk_display_get_default() );
+    #else
+    pAppDisplay = pXtAppDisplay;
     XtAppAddInput( app_context,
                    wakeup_fd[0],
                    (XtPointer)XtInputReadMask,
                    ThreadEventHandler, NULL );
-
-	/*
-	 *  Create windows for widgets and map them.
-	 */
-    int nWindow;
-	sscanf( argv[3], "%d", &nWindow );
-	char pText[1024];
-	sprintf( pText, "starting plugin %s ...", pAppArguments[2] );
-	topBox = createSubWidget( pText, topLevel, (XLIB_Window)nWindow );
-
+    #endif
 
  	// send that we are ready to go
     MediatorMessage* pMessage =
@@ -351,7 +464,11 @@
     // of XtAppMainLoop
     do
     {
+        #ifdef ENABLE_GTK
+        g_main_context_iteration( NULL, TRUE );
+        #else
         XtAppProcessEvent( app_context, XtIMAll );
+        #endif
     } while( ! XtAppGetExitFlag( app_context ) && ! bPluginAppQuit );
 
     medDebug( 1, "left plugin app main loop\n" );
Index: util/extensions/source/plugin/unx/plugcon.cxx
diff -u util/extensions/source/plugin/unx/plugcon.cxx:1.8 util/extensions/source/plugin/unx/plugcon.cxx:1.8.90.2
--- util/extensions/source/plugin/unx/plugcon.cxx:1.8	Fri Apr 11 03:28:55 2008
+++ util/extensions/source/plugin/unx/plugcon.cxx	Wed Oct 15 09:29:36 2008
@@ -31,42 +31,65 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_extensions.hxx"
 #include <plugin/unx/plugcon.hxx>
+
 #include <cstdarg>
+#include <vector>
 
 UINT32 PluginConnector::GetStreamID( NPStream* pStream )
 {
-	for( ULONG i = 0; i < m_aNPWrapStreams.Count(); i++ )
-		if( m_aNPWrapStreams.GetObject( i ) == pStream )
-			return i;
+    size_t nLen = m_aNPWrapStreams.size();
+	for( size_t i = 0; i < nLen; i++ )
+		if( m_aNPWrapStreams[ i ] == pStream )
+			return static_cast<UINT32>(i);
 	medDebug( 1, "Error: NPStream has no ID\n" );
 	return UnknownStreamID;
 }
 
 UINT32 PluginConnector::GetNPPID( NPP instance )
 {
-	for( ULONG i=0; i < m_aInstances.Count(); i++ )
-		if( m_aInstances.GetObject( i )->instance == instance )
-			return i;
+    size_t nLen = m_aInstances.size();
+	for( size_t i=0; i <nLen; i++ )
+		if( m_aInstances[ i ]->instance == instance )
+			return static_cast<UINT32>(i);
 	medDebug( 1, "Error: NPP has no ID\n" );
 
 	return UnknownNPPID;
 }
 
+ConnectorInstance* PluginConnector::getInstance( NPP instance )
+{
+    size_t nLen = m_aInstances.size();
+	for( size_t i=0; i <nLen; i++ )
+    {
+        ConnectorInstance* pInst = m_aInstances[i];
+        if( pInst->instance == instance )
+            return pInst;
+    }
+    return NULL;
+}
+
+ConnectorInstance* PluginConnector::getInstanceById( UINT32 nInstanceID )
+{
+    return nInstanceID < static_cast<UINT32>(m_aInstances.size()) ? m_aInstances[ nInstanceID ] : NULL;
+}
+
 struct PtrStruct
 {
 	char* pData;
 	ULONG nBytes;
+    
+    PtrStruct( char* i_pData, ULONG i_nBytes )
+    : pData( i_pData ), nBytes( i_nBytes ) {}
 };
 
-DECLARE_LIST( PtrStructList, PtrStruct* )
-
 ULONG PluginConnector::FillBuffer( char*& rpBuffer,
 								   const char* pFunction,
 								   ULONG nFunctionLen,
 								   va_list ap )
 {
-	PtrStructList aList;
-	PtrStruct* pPtrStruct;
+    std::vector< PtrStruct > aList;
+    aList.reserve( 5 );
+    
 	ULONG nDataSize = nFunctionLen + sizeof( ULONG );
 	char* pNext;
 
@@ -74,11 +97,8 @@
 		pNext = va_arg( ap, char* );
 		if( pNext )
 		{
-			pPtrStruct = new PtrStruct;
-			pPtrStruct->pData = pNext;
-			pPtrStruct->nBytes = va_arg( ap, ULONG );
-			nDataSize += pPtrStruct->nBytes + sizeof(ULONG);
-			aList.Insert( pPtrStruct, LIST_APPEND );
+            aList.push_back( PtrStruct( pNext, va_arg( ap, ULONG ) ) );
+			nDataSize += aList.back().nBytes + sizeof(ULONG);
 		}
 	} while( pNext );
 
@@ -89,13 +109,12 @@
 	memcpy( pRun, pFunction, nFunctionLen );
 	pRun += nFunctionLen;
 
-	while( (pPtrStruct = aList.Remove( (ULONG) 0 )) )
+	for( std::vector<PtrStruct>::const_iterator it = aList.begin(); it != aList.end(); ++it )
 	{
-		memcpy( pRun, &pPtrStruct->nBytes, sizeof( ULONG ) );
+		memcpy( pRun, &it->nBytes, sizeof( ULONG ) );
 		pRun += sizeof( ULONG );
-		memcpy( pRun, pPtrStruct->pData, pPtrStruct->nBytes );
-		pRun += pPtrStruct->nBytes;
-		delete pPtrStruct;
+		memcpy( pRun, it->pData, it->nBytes );
+		pRun += it->nBytes;
 	}
 	return nDataSize;
 }
@@ -157,15 +176,19 @@
 	{
 		{
 			NAMESPACE_VOS(OGuard) aGuard( m_aQueueMutex );
-			for( ULONG i = 0; i < m_aMessageQueue.Count(); i++ )
+			for( size_t i = 0; i < m_aMessageQueue.size(); i++ )
 			{
-				ULONG nID = m_aMessageQueue.GetObject( i )->m_nID;
+                MediatorMessage* pMessage = m_aMessageQueue[ i ];
+				ULONG nID = pMessage->m_nID;
 				if(  ( nID & 0xff000000 ) &&
 					 ( ( nID & 0x00ffffff ) == nMessageID ) )
-					return m_aMessageQueue.Remove( i );
+                {
+                    m_aMessageQueue.erase( m_aMessageQueue.begin() + i );
+					return pMessage;
+                }
 			}
 		}
-		if( m_aMessageQueue.Count() )
+		if( ! m_aMessageQueue.empty() )
 			CallWorkHandler();
 		WaitForMessage( 2000 );
 	}
@@ -180,6 +203,9 @@
 		pShell( NULL ),
 		pWidget( NULL ),
         pForm( NULL ),
+        pGtkWindow( NULL ),
+        pGtkWidget( NULL ),
+        bShouldUseXEmbed( false ),
 		nArg( args ),
 		pArgnBuf( pargnbuf ),
 		pArgvBuf( pargvbuf )
Index: util/extensions/source/plugin/unx/unxmgr.cxx
diff -u util/extensions/source/plugin/unx/unxmgr.cxx:1.14 util/extensions/source/plugin/unx/unxmgr.cxx:1.14.90.1
--- util/extensions/source/plugin/unx/unxmgr.cxx:1.14	Fri Apr 11 03:29:41 2008
+++ util/extensions/source/plugin/unx/unxmgr.cxx	Tue Oct  7 08:44:43 2008
@@ -175,6 +175,57 @@
 	return nDescriptions > 0;
 }
 
+static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDescription* >& rDescriptions )
+{
+    rtl::OStringBuffer aPath( 1024 );
+    aPath.append( rPath );
+    aPath.append( "/pluginreg.dat" );
+    FILE* fp = fopen( aPath.getStr(), "r" );
+    if( fp )
+    {
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "parsing %s\n", aPath.getStr() );
+#endif
+        char aLine[1024];
+        while( fgets( aLine, sizeof( aLine ), fp ) )
+        {
+            int nLineLen = strlen( aLine );
+            int nDotPos;
+            for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- )
+                ;
+            if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' )
+                CheckPlugin( ByteString( aLine, nDotPos ), rDescriptions );
+        }
+        fclose( fp );
+    }
+    
+    // check subdirectories
+    long aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ];
+
+    DIR* pDIR = opendir( rPath.getStr() );
+    struct dirent* pDirEnt = NULL;
+    struct stat aStat;
+    while( pDIR && ! readdir_r( pDIR, (struct dirent*)aBuffer, &pDirEnt ) && pDirEnt )
+    {
+        char* pBaseName = ((struct dirent*)aBuffer)->d_name;
+        if( rtl_str_compare( ".", pBaseName ) && rtl_str_compare( "..", pBaseName ) )
+        {
+            rtl::OStringBuffer aBuf( 1024 );
+            aBuf.append( rPath );
+            aBuf.append( '/' );
+            aBuf.append( pBaseName );
+            
+            if( ! stat( aBuf.getStr(), &aStat ) )
+            {
+                if( S_ISDIR( aStat.st_mode ) )
+                    CheckPluginRegistryFiles( aBuf.makeStringAndClear(), rDescriptions );
+            }
+        }
+    }
+    if( pDIR )
+        closedir( pDIR );
+}
+
 Sequence<PluginDescription> XPluginManager_Impl::getPluginDescriptions() throw()
 {
 	static Sequence<PluginDescription> aDescriptions;
@@ -240,26 +291,10 @@
 		}
 
         // try ~/.mozilla/pluginreg.dat
-        ByteString aMozPluginreg( pHome );
-        aMozPluginreg.Append( "/.mozilla/pluginreg.dat" );
-        FILE* fp = fopen( aMozPluginreg.GetBuffer(), "r" );
-        if( fp )
-        {
-#if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "parsing %s\n", aMozPluginreg.GetBuffer() );
-#endif
-            char aLine[1024];
-            while( fgets( aLine, sizeof( aLine ), fp ) )
-            {
-                int nLineLen = strlen( aLine );
-                int nDotPos;
-                for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- )
-                    ;
-                if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' )
-                    CheckPlugin( ByteString( aLine, nDotPos ), aPlugins );
-            }
-            fclose( fp );
-        }
+        rtl::OStringBuffer aBuf(256);
+        aBuf.append( pHome );
+        aBuf.append( "/.mozilla" );
+        CheckPluginRegistryFiles( aBuf.makeStringAndClear(), aPlugins );
 
         // create return value
 		aDescriptions = Sequence<PluginDescription>( aPlugins.size() );
Index: util/extensions/source/plugin/win/winmgr.cxx
diff -u util/extensions/source/plugin/win/winmgr.cxx:1.16 util/extensions/source/plugin/win/winmgr.cxx:1.16.90.1
--- util/extensions/source/plugin/win/winmgr.cxx:1.16	Fri Apr 11 03:31:37 2008
+++ util/extensions/source/plugin/win/winmgr.cxx	Tue Oct  7 04:13:29 2008
@@ -31,20 +31,21 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_extensions.hxx"
 
-#include <vcl/svapp.hxx>
-#include <tools/fsys.hxx>
-#include <osl/mutex.hxx>
-
-#include <rtl/string.hxx>
-#include <rtl/ustring.hxx>
-#include <rtl/ustrbuf.hxx>
+#include "vcl/svapp.hxx"
+#include "tools/fsys.hxx"
+#include "tools/urlobj.hxx"
+#include "osl/mutex.hxx"
+
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/ustrbuf.hxx"
 
-#include <plugin/impl.hxx>
+#include "plugin/impl.hxx"
 
 #pragma warning (push,1)
 #pragma warning (disable:4005)
 
-    #include <tools/prewin.h>
+    #include "tools/prewin.h"
 
     #include <windows.h>
     #include <string.h>
@@ -53,7 +54,7 @@
     #include <winbase.h>
     #include <objbase.h>
 
-    #include <tools/postwin.h>
+    #include "tools/postwin.h"
 
 #pragma warning (pop)
 
@@ -236,6 +237,52 @@
     }
 }
 //__________________________________________________________________________________________________
+static void add_MozPlugin( HKEY hKey, PluginLocationMap & rPlugins )
+{
+	TCHAR value[MAX_PATH];
+	DWORD dwType, size = sizeof(value);
+
+    size = sizeof(value);
+    if (::RegQueryValueEx(
+        hKey, _T("Path"), NULL, &dwType,
+        (LPBYTE)value, &size ) == ERROR_SUCCESS &&
+        (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
+    {
+		OUString aUPath( OStringToOUString( value, RTL_TEXTENCODING_MS_1252 ) );
+		INetURLObject aURL( aUPath );
+		OString aName( OUStringToOString( aURL.GetName().toAsciiLowerCase(), RTL_TEXTENCODING_MS_1252 ) );
+
+		// no netscape default plugin anymore...
+		// and no double plugin dlls
+		if ( !aName.equals( "npnul32.dll" ) &&
+			 ! aName.equals( "npnrvp.dll" ) &&
+			 rPlugins.find( aName ) == rPlugins.end())
+		{
+			rPlugins[ aName ] = aUPath;
+#if OSL_DEBUG_LEVEL > 1
+            logPlugin( aUPath );
+#endif
+		}
+    }
+}
+static void add_MozillaPlugin( HKEY hKey, PluginLocationMap & rPlugins )
+{
+	TCHAR keyName[MAX_PATH];
+    DWORD dwIndex = 0, size = sizeof (keyName);
+
+    while (::RegEnumKeyEx( hKey, dwIndex, keyName, &size, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS)
+    {
+        size = sizeof (keyName);
+        HKEY hSubKey;
+        if (::RegOpenKeyEx( hKey, keyName, 0, KEY_READ, &hSubKey ) == ERROR_SUCCESS)
+        {
+            add_MozPlugin( hSubKey, rPlugins );
+            ::RegCloseKey( hSubKey );
+        }
+        ++dwIndex;
+    }
+}
+//__________________________________________________________________________________________________
 static void add_NS_Plugins( PluginLocationMap & rPlugins )
 {
 	HKEY hKey;
@@ -255,6 +302,14 @@
         add_NS_lookupRecursive( hKey, rPlugins );
 		::RegCloseKey( hKey );
     }
+    // Mozilla - plugins
+	if (::RegOpenKeyEx(
+        HKEY_LOCAL_MACHINE, _T("Software\\MozillaPlugins"),
+        0, KEY_READ, &hKey ) == ERROR_SUCCESS)
+	{
+        add_MozillaPlugin( hKey, rPlugins );
+		::RegCloseKey( hKey );
+    }
 }
 
 //__________________________________________________________________________________________________


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/devel/openoffice.org.spec,v
retrieving revision 1.1708
retrieving revision 1.1709
diff -u -r1.1708 -r1.1709
--- openoffice.org.spec	5 Dec 2008 13:39:42 -0000	1.1708
+++ openoffice.org.spec	6 Dec 2008 16:16:42 -0000	1.1709
@@ -128,6 +128,7 @@
 Patch55: openoffice.org-3.0.0.ooo96279.swext.mediawiki.proxies.patch
 Patch56: openoffice.org-3.0.0.ooo96391.sw.prefsalwaysmodified.patch
 Patch57: openoffice.org-3.0.1.ooo96906.ucb.symlinks.and.size.patch
+Patch58: workspace.swffixes.patch
 
 %define instdir %{_libdir}
 %define baseinstdir %{instdir}/openoffice.org
@@ -1380,6 +1381,7 @@
 %patch55 -p1 -b .ooo96279.swext.mediawiki.proxies.patch
 %patch56 -p1 -b .ooo96391.sw.prefsalwaysmodified.patch
 %patch57 -p1 -b .ooo96906.ucb.symlinks.and.size.patch
+%patch58 -p1 -b .workspace.swffixes.patch
 
 %build
 echo build start time is `date`, diskspace: `df -h . | tail -n 1`
@@ -3746,7 +3748,9 @@
     unopkg list --shared > /dev/null 2>&1 || :
 
 %changelog
-* Fri Dec 05 2008 Caolán McNamara <caolanm at redhat.com> - 1:3.0.1-12.3
+* Sat Dec 06 2008 Caolán McNamara <caolanm at redhat.com> - 1:3.0.1-12.3
+- rebuild for python
+- Resolves: rhbz#473390 add workspace.swffixes.patch
 - add openoffice.org-3.0.1.ooo96906.ucb.symlinks.and.size.patch
 - rename openoffice.org-2.4.0.ooo87490.sfx2.allprotocols.urlopen.patch to
   upstream workspace.mba31issues01.patch




More information about the fedora-extras-commits mailing list