Bug 563462 - Remove Photon bits from widget/ r=vlad
authorRob Arnold <robarnold@cmu.edu>
Wed, 12 May 2010 14:31:23 -0400
changeset 42220 e754ea37b4c45e46590726be9488888d6679e318
parent 42219 dd135aa06b4eff154de9184c688f2bb433259975
child 42221 b0e6cec6c89094a6147a3169755f3bb87a9c2e5e
push idunknown
push userunknown
push dateunknown
reviewersvlad
bugs563462
milestone1.9.3a5pre
Bug 563462 - Remove Photon bits from widget/ r=vlad
widget/src/Makefile.in
widget/src/photon/Makefile.in
widget/src/photon/PtRawDrawContainer.cpp
widget/src/photon/PtRawDrawContainer.h
widget/src/photon/nsAppShell.cpp
widget/src/photon/nsAppShell.h
widget/src/photon/nsBidiKeyboard.cpp
widget/src/photon/nsBidiKeyboard.h
widget/src/photon/nsClipboard.cpp
widget/src/photon/nsClipboard.h
widget/src/photon/nsDragService.cpp
widget/src/photon/nsDragService.h
widget/src/photon/nsFilePicker.cpp
widget/src/photon/nsFilePicker.h
widget/src/photon/nsLookAndFeel.cpp
widget/src/photon/nsLookAndFeel.h
widget/src/photon/nsScreenManagerPh.cpp
widget/src/photon/nsScreenManagerPh.h
widget/src/photon/nsScreenPh.cpp
widget/src/photon/nsScreenPh.h
widget/src/photon/nsSound.cpp
widget/src/photon/nsSound.h
widget/src/photon/nsToolkit.cpp
widget/src/photon/nsToolkit.h
widget/src/photon/nsWidget.cpp
widget/src/photon/nsWidget.h
widget/src/photon/nsWidgetFactory.cpp
widget/src/photon/nsWindow.cpp
widget/src/photon/nsWindow.h
widget/src/xpwidgets/Makefile.in
widget/src/xremoteclient/Makefile.in
widget/src/xremoteclient/PhRemoteClient.cpp
widget/src/xremoteclient/PhRemoteClient.h
widget/src/xremoteclient/XRemoteClientFactory.cpp
widget/src/xremoteclient/mozilla-xremote-client.cpp
--- a/widget/src/Makefile.in
+++ b/widget/src/Makefile.in
@@ -63,14 +63,10 @@ endif
 #
 ifdef MOZ_ENABLE_GTK2
 DIRS		+= gtk2
 ifdef MOZ_X11
 DIRS		+= gtkxtbin
 endif
 endif
 
-ifdef MOZ_ENABLE_PHOTON
-DIRS		+= photon
-endif
-
 include $(topsrcdir)/config/rules.mk
 
deleted file mode 100644
--- a/widget/src/photon/Makefile.in
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= widget
-LIBRARY_NAME	= widget_photon
-EXPORT_LIBRARY = 1
-IS_COMPONENT	= 1
-MODULE_NAME	= nsWidgetPhModule
-LIBXUL_LIBRARY = 1
-
-			  
-CPPSRCS		= \
-		PtRawDrawContainer.cpp \
-		nsAppShell.cpp \
-		nsClipboard.cpp \
-		nsLookAndFeel.cpp \
-		nsToolkit.cpp \
-		nsWidget.cpp \
-		nsWidgetFactory.cpp \
-		nsWindow.cpp \
-		nsBidiKeyboard.cpp \
-		nsFilePicker.cpp \
-		nsSound.cpp \
-		$(NULL)
-
-# always include the PHOTON_DND in the build - the bookmarks in firefox require it
-PHOTON_DND=1
-ifdef PHOTON_DND
-CPPSRCS += nsDragService.cpp
-endif
-
-SHARED_LIBRARY_LIBS = $(DIST)/lib/libxpwidgets_s.a
-
-EXTRA_DSO_LDOPTS = $(MOZ_COMPONENT_LIBS) \
-		$(TK_LIBS) \
-		-lgkgfx \
-		$(NULL)
-
-include $(topsrcdir)/config/rules.mk
-
-DEFINES		+=  -D_IMPL_NS_WIDGET -I$(srcdir)/../xpwidgets -I$(srcdir) 
-CXXFLAGS	+= $(TK_CFLAGS)
-
-ifdef PHOTON_DND
-CXXFLAGS += -DPHOTON_DND
-endif
-
-export::
-	$(INSTALL) $(srcdir)/nsClipboard.h $(DIST)/include/widget
deleted file mode 100644
--- a/widget/src/photon/PtRawDrawContainer.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#include "PtRawDrawContainer.h"
-#include <stdio.h>
-
-/* prototype declarations */
-PtWidgetClass_t *CreateRawDrawContainerClass( void );
-
-/* widget class pointer - class structure, create function */
-PtWidgetClassRef_t WRawDrawContainer = { NULL, CreateRawDrawContainerClass };
-PtWidgetClassRef_t *PtRawDrawContainer = &WRawDrawContainer; 
-
-//
-// Defaults function
-//
-static void raw_draw_container_dflts( PtWidget_t *widget )
-{
-  widget->flags |= ( Pt_OPAQUE );
-}
-
-//
-// Draw function
-//
-static void raw_draw_container_draw( PtWidget_t *widget, PhTile_t *damage )
-{
-  RawDrawContainerWidget	*rdc = ( RawDrawContainerWidget * ) widget;
-  rdc->draw_f( widget, damage );
-}
-
-//
-// Class creation function
-//
-PtWidgetClass_t *CreateRawDrawContainerClass( void )
-{
-	// define our resources
-	static PtResourceRec_t resources[] = {
-		{ RDC_DRAW_FUNC, Pt_CHANGE_INVISIBLE, 0, 
-			Pt_ARG_IS_POINTER( RawDrawContainerWidget, draw_f ), 0 }
-		};
-
-	// set up our class member values
-	static PtArg_t args[] = {
-		{ Pt_SET_VERSION, 110},
-		{ Pt_SET_STATE_LEN, sizeof( RawDrawContainerWidget ) },
-		{ Pt_SET_DFLTS_F, (long)raw_draw_container_dflts },
-		{ Pt_SET_DRAW_F, (long)raw_draw_container_draw },
-		{ Pt_SET_FLAGS, Pt_RECTANGULAR | Pt_OPAQUE, Pt_RECTANGULAR | Pt_OPAQUE },
-		{ Pt_SET_NUM_RESOURCES, sizeof( resources ) / sizeof( resources[0] ) },
-		{ Pt_SET_RESOURCES, (long)resources, sizeof( resources ) / sizeof( resources[0] ) },
-		};
-
-	// create the widget class
-	return( PtRawDrawContainer->wclass = PtCreateWidgetClass(
-		PtContainer, 0, sizeof( args )/sizeof( args[0] ), args ) );
-}
deleted file mode 100644
--- a/widget/src/photon/PtRawDrawContainer.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* PtRawDrawContainer.h - widget header file */
-
-#include <Pt.h>
-
-/* widget resources */
-#define RDC_DRAW_FUNC		Pt_RESOURCE( Pt_USER( 0 ), 0 )
-
-/* widget instance structure */
-typedef struct raw_draw_container_widget
-{
-	PtContainerWidget_t	container;
-  void (*draw_f)( PtWidget_t *, PhTile_t * );
-}	RawDrawContainerWidget;
-
-/* widget class pointer */
-extern PtWidgetClassRef_t *PtRawDrawContainer;
-
deleted file mode 100644
--- a/widget/src/photon/nsAppShell.cpp
+++ /dev/null
@@ -1,313 +0,0 @@
-/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "prmon.h"
-#include "plhash.h"
-#include "nsCOMPtr.h"
-#include "nsAppShell.h"
-#include "nsIAppShell.h"
-#include "nsIServiceManager.h"
-#include "nsIEventQueueService.h"
-
-#include <stdlib.h>
-
-#include "nsIWidget.h"
-#include "nsCRT.h"
-
-#include <Pt.h>
-#include <errno.h>
-
-/* Global Definitions */
-PRBool nsAppShell::gExitMainLoop = PR_FALSE;
-
-static PLHashTable *sQueueHashTable = nsnull;
-static PLHashTable *sCountHashTable = nsnull;
-
-// Set our static member
-PRBool nsAppShell::mPtInited = PR_FALSE;
-
-//-------------------------------------------------------------------------
-//
-// XPCOM CIDs
-//
-//-------------------------------------------------------------------------
-static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
-
-//-------------------------------------------------------------------------
-//
-// nsAppShell constructor
-//
-//-------------------------------------------------------------------------
-nsAppShell::nsAppShell()  
-{
-  mEventQueue  = nsnull;
-  mFD          = -1;
-}
-
-//-------------------------------------------------------------------------
-//
-// nsAppShell destructor
-//
-//-------------------------------------------------------------------------
-nsAppShell::~nsAppShell()
-{
-  if (mFD != -1)
-  {
-    int err=PtAppRemoveFd(NULL,mFD);
-
-    if (err==-1)
-    {
-	  NS_WARNING("nsAppShell::~EventQueueTokenQueue Run Error calling PtAppRemoveFd");
-#ifdef DEBUG
-	  printf("nsAppShell::~EventQueueTokenQueue Run Error calling PtAppRemoveFd mFD=<%d> errno=<%d>\n", mFD, errno);
-#endif
-    }  
-    mFD = -1;
-  }
-}
-
-
-//-------------------------------------------------------------------------
-//
-// nsISupports implementation macro
-//
-//-------------------------------------------------------------------------
-NS_IMPL_ISUPPORTS1(nsAppShell, nsIAppShell)
-
-//-------------------------------------------------------------------------
-//
-// Enter a message handler loop
-//
-//-------------------------------------------------------------------------
-
-static int event_processor_callback(int fd, void *data, unsigned mode)
-{
-	nsIEventQueue *eventQueue = (nsIEventQueue*)data;
-	PtHold();
-	if (eventQueue)
-	   eventQueue->ProcessPendingEvents();
-	PtRelease();
-  return Pt_CONTINUE;
-}
-
-
-//-------------------------------------------------------------------------
-//
-// Create the application shell
-//
-//-------------------------------------------------------------------------
-
-NS_IMETHODIMP nsAppShell::Create(int *bac, char **bav)
-{
-	/*
-	This used to be done in the init function of nsToolkit. It was moved here because the phoenix
-	browser may ( when -ProfileManager is used ) create/ListenToEventQueue of an nsAppShell before
-	the toolkit is initialized and ListenToEventQueue relies on the Pt being already initialized
-	*/
-	if( !mPtInited )
-	{
-		PtInit( NULL );
-		PtChannelCreate(); // Force use of pulses
-		mPtInited = PR_TRUE;
-	}
-
-  return NS_OK;
-}
-
-//-------------------------------------------------------------------------
-//
-// Spinup - do any preparation necessary for running a message loop
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsAppShell::Spinup()
-{
-  nsresult   rv = NS_OK;
-
-  // Get the event queue service
-  nsCOMPtr<nsIEventQueueService> eventQService = do_GetService(kEventQueueServiceCID, &rv);
-
-  if (NS_FAILED(rv)) {
-    NS_ASSERTION("Could not obtain event queue service", PR_FALSE);
-    return rv;
-  }
-
-  //Get the event queue for the thread.
-	rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(mEventQueue));
-
-  // If we got an event queue, use it.
-  if (mEventQueue)
-    goto done;
-
-  // otherwise create a new event queue for the thread
-  rv = eventQService->CreateThreadEventQueue();
-  if (NS_FAILED(rv)) {
-    NS_ASSERTION("Could not create the thread event queue", PR_FALSE);
-    return rv;
-  }
-
-  // Ask again nicely for the event queue now that we have created one.
-	rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(mEventQueue));
-
-  // XXX shouldn't this be automatic?
- done:
-  ListenToEventQueue(mEventQueue, PR_TRUE);
-
-  return rv;
-}
-
-//-------------------------------------------------------------------------
-//
-// Spindown - do any cleanup necessary for finishing a message loop
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsAppShell::Spindown()
-{
-  if (mEventQueue) {
-    ListenToEventQueue(mEventQueue, PR_FALSE);
-    mEventQueue->ProcessPendingEvents();
-    mEventQueue = nsnull;
-  }
-
-  return NS_OK;
-}
-
-/* This routine replaces the standard PtMainLoop() for Photon */
-/* We had to replace it to provide a mechanism (ExitMainLoop) to exit */
-/* the loop. */
-
-void MyMainLoop( void ) 
-{
-	nsAppShell::gExitMainLoop = PR_FALSE;
-	while (! nsAppShell::gExitMainLoop)
-	{
-		PtProcessEvent();
-	}
-
-#ifdef DEBUG
-    printf("nsAppShell: MyMainLoop exiting!\n");
-#endif
-}
-
-//-------------------------------------------------------------------------
-//
-// Run
-//
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsAppShell::Run()
-{
-  if (!mEventQueue)
-    Spinup();
-
-  if (!mEventQueue)
-    return NS_ERROR_NOT_INITIALIZED;
-
-  // kick up gtk_main.  this won't return until gtk_main_quit is called
-  MyMainLoop();
-
-  Spindown();
-
-  return NS_OK; 
-}
-
-//-------------------------------------------------------------------------
-//
-// Exit a message handler loop
-//
-//-------------------------------------------------------------------------
-
-NS_METHOD nsAppShell::Exit()
-{
-  gExitMainLoop = PR_TRUE;
-  return NS_OK;
-}
-
-
-#define NUMBER_HASH_KEY(_num) ((PLHashNumber) _num)
-
-static PLHashNumber
-IntHashKey(PRInt32 key)
-{
-  return NUMBER_HASH_KEY(key);
-}
-
-NS_IMETHODIMP nsAppShell::ListenToEventQueue(nsIEventQueue *aQueue,
-                                             PRBool aListen)
-{
-
-  if (!sQueueHashTable) {
-    sQueueHashTable = PL_NewHashTable(3, (PLHashFunction)IntHashKey,
-                                      PL_CompareValues, PL_CompareValues, 0, 0);
-  }
-  if (!sCountHashTable) {
-    sCountHashTable = PL_NewHashTable(3, (PLHashFunction)IntHashKey,
-                                      PL_CompareValues, PL_CompareValues, 0, 0);
-  }
-
-  if (aListen) {
-    /* add listener */
-    PRInt32 key = aQueue->GetEventQueueSelectFD();
-
-    /* only add if we arn't already in the table */
-    if (!PL_HashTableLookup(sQueueHashTable, (void *)(key))) {
-			PRInt32 tag = PtAppAddFd( NULL, aQueue->GetEventQueueSelectFD(), (Pt_FD_READ | Pt_FD_NOPOLL | Pt_FD_DRAIN ),
-							event_processor_callback, aQueue );
-
-      if (tag >= 0) {
-        PL_HashTableAdd(sQueueHashTable, (void *)(key), (void *)(key));
-      }
-    }
-    /* bump up the count */
-    int count = (int)(PL_HashTableLookup(sCountHashTable, (void *)(key)));
-    PL_HashTableAdd(sCountHashTable, (void *)(key), (void *)(count+1));
-  } else {
-    /* remove listener */
-    PRInt32 key = aQueue->GetEventQueueSelectFD();
-
-    int count = (int)(PL_HashTableLookup(sCountHashTable, (void *)(key)));
-    if (count - 1 == 0) {
-      int tag = (int)(PL_HashTableLookup(sQueueHashTable, (void *)(key)));
-      if (tag > 0) {
-      	PtAppRemoveFd(NULL, key);
-        PL_HashTableRemove(sQueueHashTable, (void *)(key));
-      }
-    }
-    PL_HashTableAdd(sCountHashTable, (void *)(key), (void *)(count-1));
-
-  }
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/widget/src/photon/nsAppShell.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsAppShell_h__
-#define nsAppShell_h__
-
-#include "nsIAppShell.h"
-#include "nsIEventQueue.h"
-
-#include <Pt.h>
-
-/**
- * Native Photon Application shell wrapper
- */
-class nsAppShell : public nsIAppShell
-{
-public:
-  nsAppShell(); 
-  virtual ~nsAppShell();
-
-  NS_DECL_ISUPPORTS
-
-	NS_IMETHOD Create(int *argc, char **argv);
-	NS_IMETHOD Run(void);
-	NS_IMETHOD Spinup(void);
-	NS_IMETHOD Spindown(void);
-	NS_IMETHOD ListenToEventQueue(nsIEventQueue * aQueue, PRBool aListen);
-	inline NS_IMETHOD GetNativeEvent(PRBool & aRealEvent, void * & aEvent)
-		{
-		aRealEvent = PR_FALSE;
-		aEvent = 0;
-		return NS_OK;
-		}
-
-	inline NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent)
-		{
-		PtProcessEvent();
-//		PtFlush();
-		return NS_OK;
-		}
-
-	NS_IMETHOD Exit(void);
-
-public:
-  static PRBool  gExitMainLoop;
-
-private:
-	nsCOMPtr<nsIEventQueue> mEventQueue;
-  int	mFD;
-	static PRBool mPtInited;
-
-};
-
-#endif // nsAppShell_h__
deleted file mode 100644
--- a/widget/src/photon/nsBidiKeyboard.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsBidiKeyboard.h"
-
-NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard)
-
-nsBidiKeyboard::nsBidiKeyboard() : nsIBidiKeyboard()
-{
-}
-
-nsBidiKeyboard::~nsBidiKeyboard()
-{
-}
-
-NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL)
-{
-  *aIsRTL = PR_FALSE;
-#ifdef IBMBIDI
-  // XXX Insert platform specific code to determine keyboard direction
-#endif
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel)
-{
-#ifdef IBMBIDI
-  // XXX Insert platform specific code to set keyboard language
-#endif
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
deleted file mode 100644
--- a/widget/src/photon/nsBidiKeyboard.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is IBM code.
- *
- * The Initial Developer of the Original Code is
- * IBM.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Simon Montagu
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef __nsBidiKeyboard
-#define __nsBidiKeyboard
-#include "nsIBidiKeyboard.h"
-
-class nsBidiKeyboard : public nsIBidiKeyboard
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIBIDIKEYBOARD
-
-  nsBidiKeyboard();
-  virtual ~nsBidiKeyboard();
-  /* additional members */
-};
-
-
-#endif // __nsBidiKeyboard
deleted file mode 100644
--- a/widget/src/photon/nsClipboard.cpp
+++ /dev/null
@@ -1,597 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1999-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Stuart Parmenter <pavlov@netscape.com>
- *   Mike Pinkerton <pinkerton@netscape.com>
- *   Dan Rosen <dr@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsClipboard.h"
-
-#include <Pt.h>
-
-#include "nsCOMPtr.h"
-#include "nsCRT.h"
-#include "nsISupportsArray.h"
-#include "nsISupportsPrimitives.h"
-#include "nsReadableUtils.h"
-
-#include "nsIComponentManager.h"
-#include "nsIServiceManager.h"
-#include "nsWidgetsCID.h"
-#include "nsXPIDLString.h"
-#include "nsReadableUtils.h"
-#include "nsPrimitiveHelpers.h"
-
-#include "nsTextFormatter.h"
-
-#include "nsIServiceManager.h"
-#include "nsICharsetConverterManager.h"
-
-#include "prtime.h"
-#include "prthread.h"
-
-// unicode conversion
-#include "nsIPlatformCharset.h"
-#include "nsICharsetConverterManager.h"
-
-//#define DEBUG_CLIPBOARD
-
-
-// Define this to enable the obsolete X cut buffer mechanism
-// In general, a bad idea (see http://www.jwz.org/doc/x-cut-and-paste.html)
-// but it might have its uses for backwards compatibility.
-
-NS_IMPL_ISUPPORTS1(nsClipboard, nsIClipboard)
-
-#define Ph_CLIPBOARD_TYPE_MOZ_BOOKMARK	"BOOK"
-#define Ph_CLIPBOARD_TYPE_IMAGE			"IMAG"
-#define Ph_CLIPBOARD_TYPE_HTML			"HTML"
-
-//-------------------------------------------------------------------------
-//
-// nsClipboard constructor
-//
-//-------------------------------------------------------------------------
-nsClipboard::nsClipboard()
-{
-#ifdef DEBUG_CLIPBOARD
-  printf("nsClipboard::nsClipboard()\n");
-#endif /* DEBUG_CLIPBOARD */
-
-  mIgnoreEmptyNotification = PR_FALSE;
-  mGlobalTransferable = nsnull;
-  mSelectionTransferable = nsnull;
-  mGlobalOwner = nsnull;
-  mSelectionOwner = nsnull;
-  mInputGroup = 1;
-}
-
-//-------------------------------------------------------------------------
-//
-// nsClipboard destructor
-//
-//-------------------------------------------------------------------------
-nsClipboard::~nsClipboard()
-{
-#ifdef DEBUG_CLIPBOARD
-  printf("nsClipboard::~nsClipboard()\n");  
-#endif /* DEBUG_CLIPBOARD */
-}
-
-/**
-  * Sets the transferable object
-  *
-  */
-NS_IMETHODIMP nsClipboard::SetData(nsITransferable * aTransferable,
-                                   nsIClipboardOwner * anOwner,
-                                   PRInt32 aWhichClipboard)
-{
-	if (aWhichClipboard == kSelectionClipboard)
-		return (NS_ERROR_FAILURE);
-
-	if ((aTransferable == mGlobalTransferable.get() && anOwner == mGlobalOwner.get() && 
-			aWhichClipboard == kGlobalClipboard ) || (aTransferable == mSelectionTransferable.get() && 
-			anOwner == mSelectionOwner.get() && aWhichClipboard == kSelectionClipboard))
-	{
-		return NS_OK;
-	}
-
-  nsresult rv;
-  if (!mPrivacyHandler) {
-    rv = NS_NewClipboardPrivacyHandler(getter_AddRefs(mPrivacyHandler));
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-  rv = mPrivacyHandler->PrepareDataForClipboard(aTransferable);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-	EmptyClipboard(aWhichClipboard);
-
-	switch (aWhichClipboard) 
-	{
-		case kSelectionClipboard:
-			mSelectionOwner = anOwner;
-			mSelectionTransferable = aTransferable;
-			break;
-		case kGlobalClipboard:
-			mGlobalOwner = anOwner;
-			mGlobalTransferable = aTransferable;
-			break;
-	}
-
-	return SetNativeClipboardData(aWhichClipboard);
-}
-
-/**
-  * Gets the transferable object
-  *
-  */
-NS_IMETHODIMP nsClipboard::GetData(nsITransferable * aTransferable, PRInt32 aWhichClipboard)
-{
-	if (aWhichClipboard == kSelectionClipboard)
-		return (NS_ERROR_FAILURE);
-	if (nsnull != aTransferable)
-		return GetNativeClipboardData(aTransferable, aWhichClipboard);
-	else 
-	{
-#ifdef DEBUG_CLIPBOARD
-		printf("  nsClipboard::GetData(), aTransferable is NULL.\n");
-#endif
-	}
-
-	return NS_ERROR_FAILURE;
-}
-
-
-/**
-  * 
-  *
-  */
-NS_IMETHODIMP nsClipboard::EmptyClipboard(PRInt32 aWhichClipboard)
-{
-	if (mIgnoreEmptyNotification)
-		return NS_OK;
-
-	if (aWhichClipboard == kSelectionClipboard)
-		return (NS_ERROR_FAILURE);
-
-	switch(aWhichClipboard) 
-	{
-		case kSelectionClipboard:
-			return NS_ERROR_FAILURE;
-			if (mSelectionOwner) 
-			{
-				mSelectionOwner->LosingOwnership(mSelectionTransferable);
-				mSelectionOwner = nsnull;
-			}
-			mSelectionTransferable = nsnull;
-			break;
-		case kGlobalClipboard:
-			if (mGlobalOwner) 
-			{
-				mGlobalOwner->LosingOwnership(mGlobalTransferable);
-				mGlobalOwner = nsnull;
-			}
-			mGlobalTransferable = nsnull;
-			break;
-	}
-
-	return NS_OK;
-}
-
-NS_IMETHODIMP nsClipboard::SupportsSelectionClipboard(PRBool *_retval)
-{
-  NS_ENSURE_ARG_POINTER(_retval);
-
-  *_retval = PR_FALSE; // we support the selection clipboard on unix.
-  return NS_ERROR_FAILURE;
-}
-
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard)
-{
-	mIgnoreEmptyNotification = PR_TRUE;
-	if (aWhichClipboard == kSelectionClipboard)
-		return (NS_ERROR_FAILURE);
-
-#ifdef DEBUG_CLIPBOARD
-	printf("  nsClipboard::SetNativeClipboardData(%i)\n", aWhichClipboard);
-#endif /* DEBUG_CLIPBOARD */
-
-		nsCOMPtr<nsITransferable> transferable(GetTransferable(aWhichClipboard));
-
-	// make sure we have a good transferable
-	if (nsnull == transferable) 
-	{
-#ifdef DEBUG_CLIPBOARD
-		printf("nsClipboard::SetNativeClipboardData(): no transferable!\n");
-#endif
-		return NS_ERROR_FAILURE;
-	}
-
-	// get flavor list that includes all flavors that can be written (including ones 
-	// obtained through conversion)
-	nsCOMPtr<nsISupportsArray> flavorList;
-	nsresult errCode = transferable->FlavorsTransferableCanExport ( getter_AddRefs(flavorList) );
-	if ( NS_FAILED(errCode) )
-		return NS_ERROR_FAILURE;
-
-	PRUint32 cnt, index = 0;
-	flavorList->Count(&cnt);
-	PhClipHeader *cliphdr = (PhClipHeader *) calloc( cnt, sizeof( PhClipHeader ));
-	if( !cliphdr ) return NS_ERROR_FAILURE;
-
-	for ( PRUint32 k=0; k<cnt; ++k )
-	{
-		void      *data = nsnull;
-		PRUint32   dataLen;
-	
-		nsCOMPtr<nsISupports> genericFlavor;
-		flavorList->GetElementAt ( k, getter_AddRefs(genericFlavor) );
-		nsCOMPtr<nsISupportsCString> currentFlavor ( do_QueryInterface(genericFlavor) );
-		if ( currentFlavor ) 
-		{
-			nsXPIDLCString flavorStr;
-			currentFlavor->ToString(getter_Copies(flavorStr));
-
-     	nsresult err = GetFormat( flavorStr, cliphdr[index].type );
-			if( err != NS_OK ) 
-				continue;
-
-			// Get data out of transferable.
-			nsCOMPtr<nsISupports> genericDataWrapper;
-			transferable->GetTransferData( flavorStr, getter_AddRefs(genericDataWrapper), &dataLen );
-			nsPrimitiveHelpers::CreateDataFromPrimitive ( flavorStr, genericDataWrapper, &data, dataLen );
-
-			if( !strcmp(cliphdr[index].type, Ph_CLIPBOARD_TYPE_TEXT) ||
-					!strcmp(cliphdr[index].type, Ph_CLIPBOARD_TYPE_HTML) ||
-					!strcmp(cliphdr[index].type, Ph_CLIPBOARD_TYPE_MOZ_BOOKMARK) )
-			{
-				PRUnichar* castedUnicode = reinterpret_cast<PRUnichar*>(data);
-				char *utf8String = ToNewUTF8String(nsDependentString(castedUnicode, dataLen/2));
-				nsMemory::Free(reinterpret_cast<char*>(data));
-
-				if( !strcmp(cliphdr[index].type, Ph_CLIPBOARD_TYPE_TEXT) )
-				{
-					/* we have to create a null terminated string, because
-						PhClipboardCopyString does that and some other applications
-						rely on the null terminated thing
-					*/
-					PRInt32 len = strlen(utf8String);
-					char *temp = ( char * ) nsMemory::Alloc( len + 1 );
-					memcpy( temp, utf8String, len );
-					temp[len] = 0;
-					nsMemory::Free(reinterpret_cast<char*>(utf8String));
-
-        	cliphdr[index].length = len+1;
-        	cliphdr[index].data = temp;
-				}
-			else {
-				cliphdr[index].length = strlen(utf8String);
-				cliphdr[index].data = utf8String;
-				}
-			}
-   	index++;	
-		}
-	}
-
-	PhClipboardCopy( mInputGroup, index, cliphdr );
-	for( PRUint32 k=0; k<index; k++)
-		nsMemory::Free(reinterpret_cast<char*>(cliphdr[k].data));
-
-	free( cliphdr );
-
- 	mIgnoreEmptyNotification = PR_FALSE;
-
- 	return NS_OK;
-}
-
-
-//-------------------------------------------------------------------------
-//
-// The blocking Paste routine
-//
-//-------------------------------------------------------------------------
-NS_IMETHODIMP
-nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, 
-                                    PRInt32 aWhichClipboard)
-{
-	if (aWhichClipboard == kSelectionClipboard)
-		return (NS_ERROR_FAILURE);
-
-#ifdef DEBUG_CLIPBOARD
-	printf("nsClipboard::GetNativeClipboardData(%i)\n", aWhichClipboard);
-#endif /* DEBUG_CLIPBOARD */
-
-  	// make sure we have a good transferable
-	if (nsnull == aTransferable) 
-  	{
-#ifdef DEBUG_CLIPBOARD
-    printf("  GetNativeClipboardData: Transferable is null!\n");
-#endif
-    	return NS_ERROR_FAILURE;
-  	}
-
-	// get flavor list that includes all acceptable flavors (including ones obtained through
-	// conversion)
-	nsCOMPtr<nsISupportsArray> flavorList;
-	nsresult errCode = aTransferable->FlavorsTransferableCanImport ( getter_AddRefs(flavorList) );
-	if ( NS_FAILED(errCode) )
-		return NS_ERROR_FAILURE;
-
-	// Walk through flavors and see which flavor matches the one being pasted:
-	PRUint32 cnt;
-	flavorList->Count(&cnt);
-	nsCAutoString foundFlavor;
-
-	if (cnt > 0) 
-	{
-  	void         *clipPtr;
-  	PhClipHeader *cliphdr;
-  	char         *data = nsnull, type[8];
-  	PRUint32      dataLen;
-
-  	clipPtr = PhClipboardPasteStart( mInputGroup );
-  	if(!clipPtr) return NS_ERROR_FAILURE;
-
-	/*
-		Look at the timestamps of the data in the clipboard and eliminate the flavours if they are not synchronized.
-		We can have a HTML flavour from a previous copy and a TEXT flavour from a more recent copy from another application
-		( from instance from ped or pterm ). The HTML flavour and TEXT flavour are desynchronized and we have
-		to use only the most recent one */
-		unsigned long *dont_use_flavour = ( unsigned long * ) calloc( cnt, sizeof( unsigned long ) );
-		if( !dont_use_flavour ) {
-			PhClipboardPasteFinish( clipPtr );
-			return NS_ERROR_FAILURE;
-			}
-
-		unsigned long max_time = 0;
-		PRUint32 i;
-
-		for ( i = 0; i < cnt; ++i ) 
-		{
-			nsCOMPtr<nsISupports> genericFlavor;
-			flavorList->GetElementAt ( i, getter_AddRefs(genericFlavor) );
-			nsCOMPtr<nsISupportsCString> currentFlavor ( do_QueryInterface(genericFlavor) );
-			if ( currentFlavor ) 
-			{
-				nsXPIDLCString flavorStr;
-				currentFlavor->ToString ( getter_Copies(flavorStr) );
-
-				nsresult err = GetFormat( flavorStr, type );
-				if (err != NS_OK) 
-					continue;
-
-			dont_use_flavour[i] = GetFlavourTimestamp( type );
-			if( dont_use_flavour[i] > max_time ) max_time = dont_use_flavour[i];
-			}
-		}
-
-		for ( i = 0; i < cnt; ++i )
-		{
-		if( abs( dont_use_flavour[i] - max_time ) >= 4 )
-			dont_use_flavour[i] = 1; /* this flavour is desynchronized */
-		else dont_use_flavour[i] = 0; /* this flavour is ok */
-		}
-
-		for ( i = 0; i < cnt; ++i ) 
-		{
-			if( dont_use_flavour[i] ) continue; /* this flavour is desynchronized */
-			nsCOMPtr<nsISupports> genericFlavor;
-			flavorList->GetElementAt ( i, getter_AddRefs(genericFlavor) );
-			nsCOMPtr<nsISupportsCString> currentFlavor ( do_QueryInterface(genericFlavor) );
-			if ( currentFlavor ) 
-			{
-				nsXPIDLCString flavorStr;
-				currentFlavor->ToString ( getter_Copies(flavorStr) );
-
-				nsresult err = GetFormat( flavorStr, type );
-				if (err != NS_OK) 
-					continue;
-
-				cliphdr = PhClipboardPasteType( clipPtr, type );
-				if (cliphdr) 
-				{
-					data = (char*)cliphdr->data;
-
-					if( !strcmp(type, Ph_CLIPBOARD_TYPE_TEXT) )
-						/* for the Ph_CLIPBOARD_TYPE_TEXT, we null terminate the data, since PhClipboardCopyString() does that */
-						dataLen = cliphdr->length - 1;
-					else dataLen = cliphdr->length;
-
-
-					if( !strcmp(type, Ph_CLIPBOARD_TYPE_TEXT) ||
-							!strcmp(type, Ph_CLIPBOARD_TYPE_HTML) ||
-							!strcmp(type, Ph_CLIPBOARD_TYPE_MOZ_BOOKMARK) )
-					{
-						nsresult rv;
-						PRInt32 outUnicodeLen;
-						PRUnichar *unicodeData = nsnull;
-
-    				// get the decoder
-    				nsCOMPtr<nsIUnicodeDecoder> decoder;
-    				nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
-    				rv = ccm->GetUnicodeDecoderRaw("UTF-8", getter_AddRefs(decoder));
-
-    				if( NS_SUCCEEDED(rv) )
-							{
-
-    					decoder->GetMaxLength(data, dataLen, &outUnicodeLen);   // |outUnicodeLen| is number of chars
-    					if (outUnicodeLen) {
-      					unicodeData = reinterpret_cast<PRUnichar*>(nsMemory::Alloc((outUnicodeLen + 1) * sizeof(PRUnichar)));
-      					if ( unicodeData ) {
-        					PRInt32 numberTmp = dataLen;
-        					rv = decoder->Convert(data, &numberTmp, unicodeData, &outUnicodeLen);
-#ifdef DEBUG_CLIPBOARD
-        					if (numberTmp != dataLen)
-        					  printf("didn't consume all the bytes\n");
-#endif
-
-        					(unicodeData)[outUnicodeLen] = '\0';    // null terminate. Convert() doesn't do it for us
-      						}
-								} // if valid length
-
-
-    					data = reinterpret_cast<char*>(unicodeData);
-    					dataLen = outUnicodeLen * 2;
-
-							nsCOMPtr<nsISupports> genericDataWrapper;
-							nsPrimitiveHelpers::CreatePrimitiveForData( flavorStr, data, dataLen, getter_AddRefs(genericDataWrapper) );
-							aTransferable->SetTransferData( flavorStr, genericDataWrapper, dataLen );
-
-							/* free the allocated memory */
-							nsMemory::Free( unicodeData );
-
-     					break;
-							}
-					}
-    		}
-			}
-		}
-
-		free( dont_use_flavour );
-		PhClipboardPasteFinish( clipPtr );
-	}
-
-	return NS_OK;
-}
-
-NS_IMETHODIMP
-nsClipboard::HasDataMatchingFlavors(const char** aFlavorList,
-                                    PRUint32 aLength,
-                                    PRInt32 aWhichClipboard,
-                                    PRBool * outResult)
-{
-	if (aWhichClipboard == kSelectionClipboard)
-		return (NS_ERROR_FAILURE);
-  // XXX this doesn't work right.  need to fix it.
-  
-  // Note to implementor...(from pink the clipboard bitch).
-  //
-  // If a client asks for unicode, first check if unicode is present. If not, then 
-  // check for plain text. If it's there, say "yes" as we will do the conversion
-  // in GetNativeClipboardData(). From this point on, no client will
-  // ever ask for text/plain explicitly. If they do, you must ASSERT!
-#ifdef DEBUG_CLIPBOARD
-	printf("  nsClipboard::HasDataMatchingFlavors()\n  {\n");
-#endif
-
-  nsresult res = NS_OK;
-  * outResult = PR_FALSE;
-
- // Walk through flavors and see which flavor matches the one being pasted:
-  nsCAutoString foundFlavor;
-  if (aLength > 0) {
-    void         *clipPtr;
-		char					type[8];
-    PhClipHeader *cliphdr;
-
-    clipPtr = PhClipboardPasteStart( 1 );
-    if(nsnull == clipPtr)
-        return res;
-
-    for ( PRUint32 i = 0; i < aLength; ++i ) {
-      nsresult err = GetFormat( aFlavorList[i], type );
-      if (err != NS_OK) continue;
-
-      cliphdr = PhClipboardPasteType( clipPtr, type );
-      if (cliphdr)
-      {
-        res = NS_OK;
-        *outResult = PR_TRUE;
-        break;
-      }
-    }
-    PhClipboardPasteFinish( clipPtr );
-  }
-
-  return res;
-}
-
-
-nsresult nsClipboard::GetFormat(const char* aMimeStr, char *format ) 
-{
- 	nsDependentCString mimeStr(aMimeStr);
-	int ret = NS_OK;
-
- 	if( mimeStr.Equals(kUnicodeMime) || mimeStr.Equals(kTextMime) )
-   	strcpy( format, Ph_CLIPBOARD_TYPE_TEXT );
- 	else if( mimeStr.Equals(kHTMLMime) )
-   	strcpy( format, Ph_CLIPBOARD_TYPE_HTML );
- 	else if (mimeStr.Equals("moz/bookmarkclipboarditem"))
-   	strcpy( format, Ph_CLIPBOARD_TYPE_MOZ_BOOKMARK );
-	else ret = NS_ERROR_FAILURE;
-	return ret;
-}
-
-/* inline */
-nsITransferable *nsClipboard::GetTransferable(PRInt32 aWhichClipboard)
-{
-  nsITransferable *transferable = nsnull;
-  switch (aWhichClipboard)
-  {
-  case kGlobalClipboard:
-    transferable = mGlobalTransferable;
-    break;
-  case kSelectionClipboard:
-    break;
-  }
-  return transferable;
-}
-
-unsigned long nsClipboard::GetFlavourTimestamp( char *type)
-{
-	char fname[512];
-	extern struct _Ph_ctrl *_Ph_;
-
-  strcpy( fname, "/var/clipboard/" );
-  if( access( fname, X_OK ) != 0 )
-		return 0;
-
-	struct stat buf;
-	if( fstat( _Ph_->fd, &buf ) != 0 )
-		return 0;
-
-  if(gethostname(&fname[strlen(fname)],PATH_MAX-40)!=0)
-    strcpy(&fname[strlen(fname)],"localhost");
-
-  sprintf( &fname[strlen(fname)], "/%08x/%d.%s",buf.st_uid, mInputGroup, type );
-	struct stat st;
-	if( stat( fname, &st ) != 0 )
-		return 0;
-
-	return st.st_mtime;
-}
deleted file mode 100644
--- a/widget/src/photon/nsClipboard.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1999-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Stuart Parmenter <pavlov@netscape.com>
- *   Mike Pinkerton   <pinkerton@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsClipboard_h__
-#define nsClipboard_h__
-
-#include <Pt.h>
-
-#include "nsIClipboard.h"
-#include "nsITransferable.h"
-#include "nsIClipboardOwner.h"
-#include "nsClipboardPrivacyHandler.h"
-#include "nsAutoPtr.h"
-#include <nsCOMPtr.h>
-
-class nsITransferable;
-class nsIClipboardOwner;
-class nsIWidget;
-
-/**
- * Native Clipboard wrapper
- */
-
-class nsClipboard : public nsIClipboard
-{
-
-public:
-  nsClipboard();
-  virtual ~nsClipboard();
-
-  //nsISupports
-  NS_DECL_ISUPPORTS
-
-  // nsIClipboard
-  NS_DECL_NSICLIPBOARD
-
-  NS_IMETHOD SetInputGroup(PRInt32 aInputGroup)
-  {
-    mInputGroup = aInputGroup;
-    return NS_OK;
-  }
-
-
-protected:
-  NS_IMETHOD SetNativeClipboardData(PRInt32 aWhichClipboard);
-  NS_IMETHOD GetNativeClipboardData(nsITransferable * aTransferable, 
-                                    PRInt32 aWhichClipboard );
-nsresult GetFormat(const char* aMimeStr, char *format );
-
-  PRBool  mIgnoreEmptyNotification;
-	inline nsITransferable *GetTransferable(PRInt32 aWhichClipboard);
-
-private:
-  unsigned long GetFlavourTimestamp( char *type );
-  nsCOMPtr<nsIClipboardOwner> mSelectionOwner;
-  nsCOMPtr<nsIClipboardOwner> mGlobalOwner;
-  nsCOMPtr<nsITransferable>   mSelectionTransferable;
-  nsCOMPtr<nsITransferable>   mGlobalTransferable;
-  nsRefPtr<nsClipboardPrivacyHandler> mPrivacyHandler;
-
-  // Used for communicating pasted data
-  // from the asynchronous X routines back to a blocking paste:
-  PRBool mBlocking;
-  // Used for keeping track of the current input group
-  PRInt32 mInputGroup;
-};
-
-#endif // nsClipboard_h__
deleted file mode 100644
--- a/widget/src/photon/nsDragService.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsDragService.h"
-#include "nsITransferable.h"
-#include "nsString.h"
-#include "nsClipboard.h"
-#include "nsIRegion.h"
-#include "nsISupportsPrimitives.h"
-#include "nsPrimitiveHelpers.h"
-#include "nsCOMPtr.h"
-#include "nsXPIDLString.h"
-
-#include "nsWidgetsCID.h"
-
-char *nsDragService::mDndEvent = NULL;
-int nsDragService::mDndEventLen;
-
-#define kMimeCustom			"text/_moz_htmlcontext"
-
-nsDragService::nsDragService()
-{
-  mDndWidget = nsnull;
-  mDndEvent = nsnull;
-	mNativeCtrl = nsnull;
-	mRawData = nsnull;
-	mFlavourStr = nsnull;
-	mTransportFile = nsnull;
-}
-
-nsDragService::~nsDragService()
-{
-	if( mNativeCtrl ) PtReleaseTransportCtrl( mNativeCtrl );
-	if( mFlavourStr ) free( mFlavourStr );
-	if( mTransportFile ) {
-		unlink( mTransportFile );
-		free( mTransportFile );
-		}
-}
-
-NS_IMETHODIMP nsDragService::SetNativeDndData( PtWidget_t *widget, PhEvent_t *event ) {
-	mDndWidget = widget;
-	if( !mDndEvent ) {
-		mDndEventLen = sizeof( PhEvent_t ) + event->num_rects * sizeof( PhRect_t ) + event->data_len;
-		mDndEvent = ( char * ) malloc( mDndEventLen );
-		}
-	memcpy( mDndEvent, (char*)event, mDndEventLen );
-	return NS_OK;
-	}
-
-NS_IMETHODIMP nsDragService::SetDropData( char *data ) {
-
-	if( mRawData ) free( mRawData );
-
-	/* data is the filename used for passing the data */
-	FILE *fp = fopen( data, "r" );
-	PRUint32 n;
-	fread( &n, sizeof( PRUint32 ), 1, fp );
-	mRawData = ( char * ) malloc( n );
-	if( !mRawData ) { fclose( fp ); return NS_ERROR_FAILURE; }
-
-	fseek( fp, 0, SEEK_SET );
-	fread( mRawData, 1, n, fp );
-	fclose( fp );
-
-  return NS_OK;
-  }
-
-
-/* remove this function with the one from libph.so, when it becomes available */
-int CancelDrag( PhRid_t rid, unsigned input_group )
-{
-  struct dragevent {
-      PhEvent_t hdr;
-      PhDragEvent_t drag;
-      } ev;
-  memset( &ev, 0, sizeof(ev) );
-  ev.hdr.type = Ph_EV_DRAG;
-  ev.hdr.emitter.rid = Ph_DEV_RID;
-  ev.hdr.flags = Ph_EVENT_INCLUSIVE | Ph_EMIT_TOWARD;
-  ev.hdr.data_len = sizeof( ev.drag );
-  ev.hdr.subtype = Ph_EV_DRAG_COMPLETE;
-  ev.hdr.input_group = input_group;
-  ev.drag.rid = rid;
-  return PhEmit( &ev.hdr, NULL, &ev.drag );
-} 
-
-
-//-------------------------------------------------------------------------
-NS_IMETHODIMP
-nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode,
-                                  nsISupportsArray * aArrayTransferables,
-                                  nsIScriptableRegion * aRegion,
-                                  PRUint32 aActionType)
-{
-#ifdef DEBUG
-	printf( "nsDragService::InvokeDragSession\n" );
-#endif
-  nsresult rv = nsBaseDragService::InvokeDragSession(aDOMNode,
-                                                     aArrayTransferables,
-                                                     aRegion, aActionType);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if(!aArrayTransferables) return NS_ERROR_INVALID_ARG;
-
-	/*  this will also addref the transferables since we're going to hang onto this beyond the length of this call */
-	mSourceDataItems = aArrayTransferables;
-
-  PRUint32 numDragItems = 0;
-  mSourceDataItems->Count(&numDragItems);
-  if ( ! numDragItems ) return NS_ERROR_FAILURE;
-
-	/* cancel a previous drag ( PhInitDrag ) if one is in place */
-	CancelDrag( PtWidgetRid( mDndWidget ), ((PhEvent_t*)mDndEvent)->input_group );
-
-	mActionType = aActionType;
-
-	PRUint32 pDataLen = sizeof( PRUint32 ) + sizeof( PRUint32 ), totalItems = 0;
-	char *pdata = ( char * ) malloc( pDataLen ); /* we reserve space for a total size and totalItems */
-	if( !pdata ) return NS_ERROR_FAILURE;
-
-
-  for(PRUint32 itemIndex = 0; itemIndex < numDragItems; ++itemIndex) {
-    nsCOMPtr<nsISupports> genericItem;
-    mSourceDataItems->GetElementAt(itemIndex, getter_AddRefs(genericItem));
-    nsCOMPtr<nsITransferable> currItem (do_QueryInterface(genericItem));
-    if(currItem) {
-      nsCOMPtr <nsISupportsArray> flavorList;
-      currItem->FlavorsTransferableCanExport(getter_AddRefs(flavorList));
-      if(flavorList) {
-        PRUint32 numFlavors;
-        flavorList->Count( &numFlavors );
-        for( PRUint32 flavorIndex = 0; flavorIndex < numFlavors ; ++flavorIndex ) {
-          nsCOMPtr<nsISupports> genericWrapper;
-          flavorList->GetElementAt (flavorIndex, getter_AddRefs(genericWrapper));
-          nsCOMPtr<nsISupportsCString> currentFlavor;
-          currentFlavor = do_QueryInterface(genericWrapper);
-          if(currentFlavor) {
-            nsXPIDLCString flavorStr;
-            currentFlavor->ToString ( getter_Copies(flavorStr) );
-						const char *FlavourStr = ( const char * ) flavorStr;
-						nsCOMPtr<nsISupports> data;
-						PRUint32 tmpDataLen = 0;
-						rv = currItem->GetTransferData( FlavourStr, getter_AddRefs(data), &tmpDataLen );
-						if( NS_SUCCEEDED( rv ) ) {
-							/* insert FlavourStr, data into the PtTransportCtrl_t */
-							int len = sizeof( PRUint32 ) + sizeof( PRUint32 ) + strlen( FlavourStr ) + 1 + tmpDataLen;
-							/* we reserve space for itemIndex|tmpDataLen|flavorStr|data */
-							len = ( ( len + 3 ) / 4 ) * 4;
-							pdata = ( char * ) realloc( pdata, len + pDataLen );
-							if( pdata ) {
-								char *p = pdata + pDataLen;
-								PRUint32 *d = ( PRUint32 * ) p;
-								d[0] = itemIndex; /* copy itemIndex*/
-								d[1] = tmpDataLen; /* copy PRUint32 tmpDataLen */
-								strcpy( p + sizeof( PRUint32 ) + sizeof( PRUint32 ), FlavourStr ); /* copy flavorStr */
-	
-								void *mem_data;
-								nsPrimitiveHelpers::CreateDataFromPrimitive ( FlavourStr, data, &mem_data, tmpDataLen );
-	
-								memcpy( p + sizeof( PRUint32 ) + sizeof( PRUint32 ) + strlen( FlavourStr ) + 1, mem_data, tmpDataLen ); /* copy the data */
-								pDataLen += len;
-								totalItems++;
-								}
-							}
-						}
-          }
-        }
-      }
-    }
-
-	if( totalItems ) {
-		PRUint32 *p = ( PRUint32 * ) pdata;
-		p[0] = pDataLen;
-		p[1] = totalItems;
-		mNativeCtrl = PtCreateTransportCtrl( );
-
-		if( !mTransportFile ) mTransportFile = strdup( (char*) tmpnam( NULL ) );
-
-		FILE *fp = fopen( mTransportFile, "w" );
-		fwrite( pdata, 1, pDataLen, fp );
-		fclose( fp );
-		free( pdata );
-
-		PtTransportType( mNativeCtrl, "Mozilla", "dnddata", 1, Ph_TRANSPORT_INLINE, "string", (void*)mTransportFile, 0, 0 );
-		PtInitDnd( mNativeCtrl, mDndWidget, (PhEvent_t*)mDndEvent, NULL, 0 );
-		}
-
-  return NS_OK;
-}
-
-
-
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsDragService::GetNumDropItems (PRUint32 * aNumItems)
-{
-  *aNumItems = 1;
-  return NS_OK;
-}
-
-
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsDragService::GetData (nsITransferable * aTransferable, PRUint32 aItemIndex ) {
-	nsresult rv = NS_ERROR_FAILURE;
-	nsCOMPtr<nsISupports> genericDataWrapper;
-
-	if( mRawData ) {
-		PRUint32 *d = ( PRUint32 * ) mRawData, totalItems = d[1];
-		PRUint32 i, pdataLen = sizeof( PRUint32 ) + sizeof( PRUint32 );
-
-		/* search for aItemIndex */
-		for( i=0; i<totalItems; i++ ) {
-			char *p = mRawData + pdataLen;
-			PRUint32 *d = ( PRUint32 * ) p;
-
-			char *flavorStr = p + sizeof( PRUint32 ) + sizeof( PRUint32 );
-			PRUint32 this_len = sizeof( PRUint32 ) + sizeof( PRUint32 ) + strlen( flavorStr ) + 1 + d[1];
-			this_len = ( ( this_len + 3 ) / 4 ) * 4;
-			char *raw_data = flavorStr + strlen( flavorStr ) + 1;
-
-			if( d[0] == aItemIndex && !strcmp( mFlavourStr, flavorStr ) ) {
-				nsPrimitiveHelpers::CreatePrimitiveForData( flavorStr, raw_data, d[1], getter_AddRefs( genericDataWrapper ) );
-				rv = aTransferable->SetTransferData( flavorStr, genericDataWrapper, d[1] );
-				break;
-				}
-
-			pdataLen += this_len;
-			}
-		}
-	return rv;
-	}
-
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBool *_retval)
-{
-  if (!aDataFlavor || !_retval)
-    return NS_ERROR_FAILURE;
-
-	// set this to no by default
-	*_retval = PR_FALSE;
-
-	const char *ask;
-	if( !strcmp( aDataFlavor, kMimeCustom ) )  ask = kHTMLMime;
-	else ask = aDataFlavor;
-
-	if(!mSourceDataItems) return NS_OK;
-	PRUint32 numDragItems = 0;
-	mSourceDataItems->Count(&numDragItems);
-	for(PRUint32 itemIndex = 0; itemIndex < numDragItems; ++itemIndex) {
-  	nsCOMPtr<nsISupports> genericItem;
-  	mSourceDataItems->GetElementAt(itemIndex, getter_AddRefs(genericItem));
-  	nsCOMPtr<nsITransferable> currItem (do_QueryInterface(genericItem));
-  	if(currItem) {
-  	  nsCOMPtr <nsISupportsArray> flavorList;
-  	  currItem->FlavorsTransferableCanExport(getter_AddRefs(flavorList));
-  	  if(flavorList) {
-  	    PRUint32 numFlavors;
-  	    flavorList->Count( &numFlavors );
-  	    for( PRUint32 flavorIndex = 0; flavorIndex < numFlavors ; ++flavorIndex ) {
-  	      nsCOMPtr<nsISupports> genericWrapper;
-  	      flavorList->GetElementAt (flavorIndex, getter_AddRefs(genericWrapper));
-  		    nsCOMPtr<nsISupportsCString> currentFlavor;
-  	      currentFlavor = do_QueryInterface(genericWrapper);
- 		      if(currentFlavor) {
-  	        nsXPIDLCString flavorStr;
-  	        currentFlavor->ToString ( getter_Copies(flavorStr) );
-						if(strcmp(flavorStr, ask) == 0) {
-  						*_retval = PR_TRUE;
-							if( mFlavourStr ) free( mFlavourStr );
-							mFlavourStr = strdup( ask );
-							}
-						}
-					}
-				}
-			}
-		}
-
-  return NS_OK;
-}
-
-void
-nsDragService::SourceEndDrag(void)
-{
-  // this just releases the list of data items that we provide
-  mSourceDataItems = 0;
-}
deleted file mode 100644
--- a/widget/src/photon/nsDragService.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsDragService_h__
-#define nsDragService_h__
-
-#include <Pt.h>
-
-#include "nsBaseDragService.h"
-
-
-
-/**
- * Native Photon DragService wrapper
- */
-
-class nsDragService : public nsBaseDragService
-{
-
-public:
-  nsDragService();
-  virtual ~nsDragService();
-  
-	/* photon dependent stuff */
-  NS_IMETHOD SetNativeDndData( PtWidget_t * widget, PhEvent_t *event );
-
-
-  // nsIDragService
-  NS_IMETHOD InvokeDragSession (nsIDOMNode *aDOMNode, nsISupportsArray * anArrayTransferables,
-                                nsIScriptableRegion * aRegion, PRUint32 aActionType);
-
-  // nsIDragSession
-  NS_IMETHOD GetData (nsITransferable * aTransferable, PRUint32 anItem);
-  NS_IMETHOD GetNumDropItems (PRUint32 * aNumItems);
-  NS_IMETHOD IsDataFlavorSupported(const char *aDataFlavor, PRBool *_retval);
-	NS_IMETHOD SetDropData( char *data );
-	void SourceEndDrag(void);
-
-	PRUint32 mActionType;
-
-private:
-  PtWidget_t *mDndWidget;
-	static char *mDndEvent;
-	static int mDndEventLen;
-	nsCOMPtr<nsISupportsArray> mSourceDataItems;
-
-	PtTransportCtrl_t *mNativeCtrl;
-	char *mRawData, *mFlavourStr, *mTransportFile;
-};
-
-#endif // nsDragService_h__
deleted file mode 100644
--- a/widget/src/photon/nsFilePicker.cpp
+++ /dev/null
@@ -1,347 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Mozilla browser.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Adrian Mardare <amardare@qnx.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-#include "nsCOMPtr.h"
-#include "nsReadableUtils.h"
-#include "nsNetUtil.h"
-#include "nsWindow.h"
-#include "nsIServiceManager.h"
-#include "nsIPlatformCharset.h"
-#include "nsFilePicker.h"
-#include "nsILocalFile.h"
-#include "nsIURL.h"
-#include "nsIStringBundle.h"
-#include "nsEnumeratorUtils.h"
-#include "nsCRT.h"
-
-NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker)
-
-char nsFilePicker::mLastUsedDirectory[PATH_MAX+1] = { 0 };
-
-#define MAX_EXTENSION_LENGTH PATH_MAX
-
-//-------------------------------------------------------------------------
-//
-// nsFilePicker constructor
-//
-//-------------------------------------------------------------------------
-nsFilePicker::nsFilePicker()
-  : mParentWidget(nsnull)
-  , mUnicodeEncoder(nsnull)
-  , mUnicodeDecoder(nsnull)
-{
-  char *path = getenv("HOME");
-  if (path) {
-    nsCOMPtr<nsILocalFile> displayDirectory = do_CreateInstance("@mozilla.org/file/local;1");
-    if (displayDirectory) {
-      nsresult rv = displayDirectory->InitWithNativePath(nsDependentCString(path));
-      PRBool cond;
-      if (NS_SUCCEEDED(rv) &&
-          NS_SUCCEEDED(displayDirectory->Exists(&cond)) &&
-          cond &&
-          NS_SUCCEEDED(displayDirectory->IsDirectory(&cond)) &&
-          cond)
-        mDisplayDirectory = displayDirectory;
-    }
-  }
-}
-
-//-------------------------------------------------------------------------
-//
-// nsFilePicker destructor
-//
-//-------------------------------------------------------------------------
-nsFilePicker::~nsFilePicker()
-{
-  NS_IF_RELEASE(mUnicodeEncoder);
-  NS_IF_RELEASE(mUnicodeDecoder);
-}
-
-//-------------------------------------------------------------------------
-//
-// Show - Display the file dialog
-//
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsFilePicker::Show(PRInt16 *aReturnVal)
-{
-	PRInt32 flags = 0;
-	char *btn1;
-
-	NS_ENSURE_ARG_POINTER(aReturnVal);
-
-  if (mMode == modeGetFolder) {
-		flags |= Pt_FSR_SELECT_DIRS|Pt_FSR_NO_SELECT_FILES;
-		btn1 = "&Select";
-  }
-  else if (mMode == modeOpen) {
-		btn1 = "&Open";
-  }
-  else if (mMode == modeSave) {
-		flags |= Pt_FSR_NO_FCHECK;
-		btn1 = "&Save";
-  }
-	else if( mMode == modeOpenMultiple ) {
-		flags |= Pt_FSR_MULTIPLE;
-		btn1 = "&Select";
-		}
-  else {
-    printf("nsFilePicker::Show() wrong mode");
-    return PR_FALSE;
-  }
-
-  char *title = ToNewUTF8String( mTitle );
-
-  nsCAutoString initialDir;
-  if (mDisplayDirectory)
-    mDisplayDirectory->GetNativePath(initialDir);
-  // If no display directory, re-use the last one.
-  if(initialDir.IsEmpty()) {
-    // Allocate copy of last used dir.
-    initialDir = mLastUsedDirectory;
-  }
-
-  if( !mDefault.IsEmpty() ) {
-    initialDir.AppendWithConversion( NS_LITERAL_STRING( "/" ) );
-    initialDir.AppendWithConversion( mDefault );
-  }
-
-	nsCAutoString extensionBuffer('*');
-	if( !mFilterList.IsEmpty() ) {
-		char *text = ToNewUTF8String( mFilterList );
-		if( text ) {
-			extensionBuffer.Truncate(0);
-
-			/* eliminate the ';' and the duplicates */
-			char buffer[MAX_EXTENSION_LENGTH+1], buf[MAX_EXTENSION_LENGTH+1], *q, *delims = "; ", *dummy;
-			strcpy( buffer, text );
-			q = strtok_r( buffer, delims, &dummy );
-			while( q ) {
-				sprintf( buf, "%s ", q );
-				if ( !strstr(extensionBuffer.get(), buf ) )
-					extensionBuffer.Append(buf);
-				q = strtok_r( NULL, delims, &dummy );
-				}
-
-			nsMemory::Free( text );
-			}
-		}
-	else if (!mDefaultExtension.IsEmpty()) {
-		// Someone was cool and told us what to do
-		char *convertedExt = ToNewUTF8String( mDefaultExtension );
-		if (!convertedExt) {
-			LossyCopyUTF16toASCII(mDefaultExtension, extensionBuffer);
-			}
-		else {
-			extensionBuffer.Assign(convertedExt);
-			nsMemory::Free( convertedExt );
-			}
-		}
-
-	PtFileSelectionInfo_t info;
-	memset( &info, 0, sizeof( info ) );
-
-	if( PtFileSelection( mParentWidget, NULL, title, initialDir.get(),
-		extensionBuffer.get(), btn1, "&Cancel", "nsd", &info, flags ) ) {
-			if (title) nsMemory::Free( title );
-			return NS_ERROR_FAILURE;
-			}
-
-	*aReturnVal = returnOK;
-
-	if( info.ret == Pt_FSDIALOG_BTN2 ) {
-		*aReturnVal = returnCancel;
-		}
-	else if( mMode != modeOpenMultiple ) {
-		mFile.SetLength(0);
-		mFile.Append( info.path );
-
-		if( mMode == modeSave ) {
-			nsCOMPtr<nsILocalFile> file(do_CreateInstance("@mozilla.org/file/local;1"));
-			NS_ENSURE_TRUE(file, NS_ERROR_FAILURE);
-
-			file->InitWithNativePath( mFile );
-			
-			PRBool exists = PR_FALSE;
-			file->Exists(&exists);
-			if (exists)
-				*aReturnVal = returnReplace;
-			}
-		}
-	else { /* here mMode is modeOpenMultiple */
-		PtFileSelectorInfo_t *minfo = info.minfo;
-		if( minfo ) {
-			nsresult rv;
-
-			for( int i=0; i<minfo->nitems; i++ ) {
-				nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1", &rv);
-				NS_ENSURE_SUCCESS(rv,rv);
-	
-				nsCString s ( minfo->multipath[i] );
-				rv = file->InitWithNativePath( s );
-				NS_ENSURE_SUCCESS(rv,rv);
-	
-				rv = mFiles.AppendObject(file);
-				NS_ENSURE_SUCCESS(rv,rv);
-				}
-
-			PtFSFreeInfo( &info ); /* clean the info structure if the multiple mode is set */
-			}
-		}
-
-  PL_strncpyz( mLastUsedDirectory, info.path, PATH_MAX+1 );
-  if (!mDisplayDirectory)
-    mDisplayDirectory = do_CreateInstance("@mozilla.org/file/local;1");
-  if (mDisplayDirectory)
-    mDisplayDirectory->InitWithNativePath( nsDependentCString(mLastUsedDirectory) );
-
-  if( title ) nsMemory::Free( title );
-		
-  return NS_OK;
-
-// TODO: implement filters
-}
-
-
-
-NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile)
-{
-  NS_ENSURE_ARG_POINTER(aFile);
-
-  if (mFile.IsEmpty())
-      return NS_OK;
-
-  nsCOMPtr<nsILocalFile> file(do_CreateInstance("@mozilla.org/file/local;1"));
-    
-  NS_ENSURE_TRUE(file, NS_ERROR_FAILURE);
-
-  file->InitWithNativePath(mFile);
-
-  NS_ADDREF(*aFile = file);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsFilePicker::GetFiles(nsISimpleEnumerator **aFiles)
-{
- 	NS_ENSURE_ARG_POINTER(aFiles);
- 	return NS_NewArrayEnumerator(aFiles, mFiles);
-}
-
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsFilePicker::GetFileURL(nsIURI **aFileURL)
-{
-  *aFileURL = nsnull;
-  nsCOMPtr<nsILocalFile> file;
-  nsresult rv = GetFile(getter_AddRefs(file));
-  if (!file)
-    return rv;
-
-  return NS_NewFileURI(aFileURL, file);
-}
-
-//-------------------------------------------------------------------------
-//
-// Get the file + path
-//
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsFilePicker::SetDefaultString(const nsAString& aString)
-{
-  mDefault = aString;
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsFilePicker::GetDefaultString(nsAString& aString)
-{
-  return NS_ERROR_FAILURE;
-}
-
-//-------------------------------------------------------------------------
-//
-// The default extension to use for files
-//
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsFilePicker::GetDefaultExtension(nsAString& aExtension)
-{
-  aExtension = mDefaultExtension;
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsFilePicker::SetDefaultExtension(const nsAString& aExtension)
-{
-	mDefaultExtension = aExtension;
-  return NS_OK;
-}
-
-//-------------------------------------------------------------------------
-void nsFilePicker::InitNative(nsIWidget *aParent,
-                              const nsAString& aTitle,
-                              PRInt16 aMode)
-{
-	mParentWidget = (PtWidget_t *)aParent->GetNativeData(NS_NATIVE_WIDGET);
-  mTitle.SetLength(0);
-  mTitle.Append(aTitle);
-  mMode = aMode;
-}
-
-
-NS_IMETHODIMP
-nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter)
-{
-  mFilterList.Append(aFilter);
-	mFilterList.Append(PRUnichar(' '));
-
-  return NS_OK;
-}
-
-
-//-------------------------------------------------------------------------
-//
-// Set the filter index
-//
-//-------------------------------------------------------------------------
-NS_IMETHODIMP nsFilePicker::GetFilterIndex(PRInt32 *aFilterIndex)
-{
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsFilePicker::SetFilterIndex(PRInt32 aFilterIndex)
-{
-  return NS_OK;
-}
deleted file mode 100644
--- a/widget/src/photon/nsFilePicker.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Mozilla browser.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Adrian Mardare <amardare@qnx.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsFilePicker_h__
-#define nsFilePicker_h__
-
-#include "nsICharsetConverterManager.h"
-#include "nsBaseFilePicker.h"
-#include "nsString.h"
-#include "nsIFileChannel.h"
-#include "nsILocalFile.h"
-#include "nsCOMArray.h"
-
-#include <Pt.h>
-
-//
-// Native Photon FileSelector wrapper
-//
-
-class nsFilePicker : public nsBaseFilePicker
-{
-public:
-  nsFilePicker(); 
-  virtual ~nsFilePicker();
-
-  NS_DECL_ISUPPORTS
-
-  // nsIFilePicker (less what's in nsBaseFilePicker)
-  NS_IMETHOD GetDefaultString(nsAString& aDefaultString);
-  NS_IMETHOD SetDefaultString(const nsAString& aDefaultString);
-  NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension);
-  NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension);
-	NS_IMETHOD GetFilterIndex(PRInt32 *aFilterIndex);
-	NS_IMETHOD SetFilterIndex(PRInt32 aFilterIndex);
-  NS_IMETHOD GetFile(nsILocalFile * *aFile);
-  NS_IMETHOD GetFileURL(nsIURI * *aFileURL);
-  NS_IMETHOD Show(PRInt16 *_retval); 
-  NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter);
-	NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles);
-
-protected:
-  // method from nsBaseFilePicker
-  virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle,
-                          PRInt16 aMode);
-
-
-  void GetFilterListArray(nsString& aFilterList);
-
-	PtWidget_t						 *mParentWidget;
-  nsString               mTitle;
-  PRInt16                mMode;
-  nsCString              mFile;
-  nsString               mDefault;
-	nsString               mDefaultExtension;
-  nsString               mFilterList;
-  nsIUnicodeEncoder*     mUnicodeEncoder;
-  nsIUnicodeDecoder*     mUnicodeDecoder;
-  PRInt16                mSelectedType;
-	nsCOMArray<nsILocalFile> mFiles;
-
-	static char            mLastUsedDirectory[];
-};
-
-#endif // nsFilePicker_h__
deleted file mode 100644
--- a/widget/src/photon/nsLookAndFeel.cpp
+++ /dev/null
@@ -1,444 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsLookAndFeel.h"
-#include <Pt.h>
-#include "nsFont.h"
-
-#define PH_TO_NS_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff) 
-
-nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
-{
-}
-
-nsLookAndFeel::~nsLookAndFeel()
-{
-}
-
-nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor)
-{
-  nsresult res = NS_OK;
-
-  /*
-   * There used to be an entirely separate list of these colors in
-   * nsDeviceContextPh::GetSystemAttribute.  The colors given there
-   * were a bit different from these.  If these are inaccurate, it might
-   * be worth looking at cvs history for the ones there to see if they
-   * were better.
-   */
-
-  switch (aID) 
-  {
-	  case eColor_WindowBackground:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-	  case eColor_WindowForeground:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-	  case eColor_WidgetBackground:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-	  case eColor_WidgetForeground:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-	  case eColor_WidgetSelectBackground:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-	  case eColor_WidgetSelectForeground:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-	  case eColor_Widget3DHighlight:
-		aColor = PH_TO_NS_RGB(Pg_WHITE);
-		break;
-	  case eColor_Widget3DShadow:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-	  case eColor_TextBackground:
-		aColor = PH_TO_NS_RGB(Pg_WHITE);
-		break;
-	  case eColor_TextForeground: 
-		aColor = PH_TO_NS_RGB(Pg_BLACK);
-		break;
-    case eColor_TextSelectBackground:
-    case eColor_IMESelectedRawTextBackground:
-    case eColor_IMESelectedConvertedTextBackground:
-      aColor = PH_TO_NS_RGB(Pg_BLACK);
-      break;
-    case eColor_TextSelectForeground:
-    case eColor_IMESelectedRawTextForeground:
-    case eColor_IMESelectedConvertedTextForeground:
-      aColor = PH_TO_NS_RGB(Pg_WHITE);
-      break;
-    case eColor_IMERawInputBackground:
-    case eColor_IMEConvertedTextBackground:
-      aColor = NS_TRANSPARENT;
-      break;
-    case eColor_IMERawInputForeground:
-    case eColor_IMEConvertedTextForeground:
-      aColor = NS_SAME_AS_FOREGROUND_COLOR;
-      break;
-    case eColor_IMERawInputUnderline:
-    case eColor_IMEConvertedTextUnderline:
-      aColor = NS_SAME_AS_FOREGROUND_COLOR;
-      break;
-    case eColor_IMESelectedRawTextUnderline:
-    case eColor_IMESelectedConvertedTextUnderline:
-      aColor = NS_TRANSPARENT;
-      break;
-    case eColor_SpellCheckerUnderline:
-      aColor = NS_RGB(0xff, 0, 0);
-      break;
-
-		// css2  http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
-	  case eColor_activeborder:
-		aColor = PH_TO_NS_RGB(Pg_BLACK);
-		break;
-	  case eColor_activecaption:
-		aColor = PH_TO_NS_RGB(Pg_YELLOW);
-		break;
-	  case eColor_appworkspace:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-	  case eColor_background:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-	  case eColor_captiontext:
-		aColor = PH_TO_NS_RGB(Pg_BLACK);
-		break;
-	  case eColor_graytext:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-	  case eColor_highlight:
-	  case eColor__moz_html_cellhighlight:
-	  case eColor__moz_menuhover:
-		aColor = PH_TO_NS_RGB(0x9ba9c9); // bill blue
-		break;
-	  case eColor_highlighttext:
-	  case eColor__moz_html_cellhighlighttext:
-	  case eColor__moz_menuhovertext:
-		aColor = PH_TO_NS_RGB(Pg_BLACK);
-		break;
-	  case eColor_inactiveborder:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-	  case eColor_inactivecaption:
-		aColor = PH_TO_NS_RGB(Pg_GREY);
-		break;
-	  case eColor_inactivecaptiontext:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-	  case eColor_infobackground:
-		aColor = PH_TO_NS_RGB(Pg_BALLOONCOLOR); // popup yellow
-		break;
-	  case eColor_infotext:
-		aColor = PH_TO_NS_RGB(Pg_BLACK);
-		break;
-	  case eColor_menu:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-	  case eColor_menutext:
-		aColor = PH_TO_NS_RGB(Pg_BLACK);
-		break;
-	  case eColor_scrollbar:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-	  case eColor_threedface:
-	  case eColor_buttonface:
-	  case eColor__moz_buttonhoverface:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-
-	  case eColor_buttonhighlight:
-	  case eColor_threedhighlight:
-		aColor = PH_TO_NS_RGB(Pg_WHITE);
-		break;
-
-	  case eColor_buttontext:
-	  case eColor__moz_buttonhovertext:
-		aColor = PH_TO_NS_RGB(Pg_BLACK);
-		break;
-
-	  case eColor_buttonshadow:
-	  case eColor_threedshadow: // i think these should be the same
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-
-	  case eColor_threeddarkshadow:
-		aColor = PH_TO_NS_RGB(Pg_DGREY);
-		break;
-
-	  case eColor_threedlightshadow:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-
-	  case eColor_window:
-		aColor = PH_TO_NS_RGB(Pg_WHITE);
-		break;
-
-	  case eColor_windowframe:
-		aColor = PH_TO_NS_RGB(Pg_LGREY);
-		break;
-
-	  case eColor_windowtext:
-		aColor = PH_TO_NS_RGB(Pg_BLACK);
-		break;
-
-	  case eColor__moz_eventreerow:
-	  case eColor__moz_oddtreerow:
-	  case eColor__moz_field:
-		aColor = PH_TO_NS_RGB(Pg_WHITE);
-		break;
-
-	case eColor__moz_fieldtext:
-	  aColor = PH_TO_NS_RGB(Pg_BLACK);
-	  break;
-
-	case eColor__moz_dialog:
-	case eColor__moz_cellhighlight:
-	  aColor = PH_TO_NS_RGB(Pg_LGREY);
-	  break;
-
-	case eColor__moz_dialogtext:
-	case eColor__moz_cellhighlighttext:
-	  aColor = PH_TO_NS_RGB(Pg_BLACK);
-	  break;
-
-	case eColor__moz_dragtargetzone:
-	  aColor = PH_TO_NS_RGB(Pg_LGREY);
-	  break;
-
-	case eColor__moz_buttondefault:
-	  aColor = PH_TO_NS_RGB(Pg_DGREY);
-	  break;
-
-  	default:
-    aColor = PH_TO_NS_RGB(Pg_WHITE);
-    break;
-  }
-
-  return res;
-}
-  
-NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
-{
-
-
-  nsresult res = nsXPLookAndFeel::GetMetric(aID, aMetric);
-  if (NS_SUCCEEDED(res))
-      return res;
-
-  res = NS_OK;
-
-  /*
-   * There used to be an entirely separate list of these metrics in
-   * nsDeviceContextPh::GetSystemAttribute.  The metrics given there
-   * were a bit different from these.  If these are inaccurate, it might
-   * be worth looking at cvs history for the ones there to see if they
-   * were better.
-   */
-
-  switch (aID) 
-  {
-  case eMetric_WindowTitleHeight:
-    aMetric = 0;
-    break;
-  case eMetric_WindowBorderWidth:
-    aMetric = 1;
-    break;
-  case eMetric_WindowBorderHeight:
-    aMetric = 1;
-    break;
-  case eMetric_Widget3DBorder:
-    aMetric = 2;
-    break;
-  case eMetric_TextFieldHeight:
-  	aMetric = 20;
-    break;
-  case eMetric_TextFieldBorder:
-    aMetric = 1;
-    break;
-  case eMetric_TextVerticalInsidePadding:
-    aMetric = 0;
-    break;
-  case eMetric_TextShouldUseVerticalInsidePadding:
-    aMetric = 0;
-    break;
-  case eMetric_TextHorizontalInsideMinimumPadding:
-    aMetric = 0;
-    break;
-  case eMetric_TextShouldUseHorizontalInsideMinimumPadding:
-    aMetric = 0;
-    break;
-  case eMetric_ButtonHorizontalInsidePaddingNavQuirks:
-  	aMetric = 10;
-    break;
-  case eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks:
-  	aMetric = 8;
-    break;
-  case eMetric_CheckboxSize:
-    aMetric = 10;
-    break;
-  case eMetric_RadioboxSize:
-    aMetric = 10;
-    break;
-  case eMetric_ListShouldUseHorizontalInsideMinimumPadding:
-    aMetric = 0;
-    break;
-  case eMetric_ListHorizontalInsideMinimumPadding:
-    aMetric = 0;
-    break;
-  case eMetric_ListShouldUseVerticalInsidePadding:
-    aMetric = 0;
-    break;
-  case eMetric_ListVerticalInsidePadding:
-    aMetric = 0;
-    break;
-  case eMetric_CaretBlinkTime:
-    aMetric = 500;
-    break;
-  case eMetric_CaretWidth:
-    aMetric = 1;
-    break;
-	case eMetric_ShowCaretDuringSelection:
-		aMetric = 0;
-		break;
-	case eMetric_SelectTextfieldsOnKeyFocus:
-		// Select textfield content when focused by kbd
-		// used by nsEventStateManager::sTextfieldSelectModel
-		aMetric = 1;
-		break;
-  case eMetric_SubmenuDelay:
-    aMetric = 200;
-    break;
-	case eMetric_MenusCanOverlapOSBar:
-		// we want XUL popups to be able to overlap the task bar.
-		aMetric = 1;
-		break;
-  case eMetric_TreeOpenDelay:
-    aMetric = 1000;
-    break;
-  case eMetric_TreeCloseDelay:
-    aMetric = 1000;
-    break;
-  case eMetric_TreeLazyScrollDelay:
-    aMetric = 150;
-    break;
-  case eMetric_TreeScrollDelay:
-    aMetric = 100;
-    break;
-  case eMetric_TreeScrollLinesMax:
-    aMetric = 3;
-    break;
-  case eMetric_DWMCompositor:
-  case eMetric_WindowsClassic:
-  case eMetric_WindowsDefaultTheme:
-  case eMetric_TouchEnabled:
-    aMetric = 0;
-    res = NS_ERROR_NOT_IMPLEMENTED;
-    break;
-  case eMetric_MacGraphiteTheme:
-  case eMetric_MaemoClassic:
-    aMetric = 0;
-    res = NS_ERROR_NOT_IMPLEMENTED;
-    break;
-  case eMetric_IMERawInputUnderlineStyle:
-  case eMetric_IMEConvertedTextUnderlineStyle:
-    aMetric = NS_UNDERLINE_STYLE_SOLID;
-    break;
-  case eMetric_IMESelectedRawTextUnderlineStyle:
-  case eMetric_IMESelectedConvertedTextUnderline:
-    aMetric = NS_UNDERLINE_STYLE_NONE;
-    break;
-  case eMetric_SpellCheckerUnderlineStyle:
-    aMetric = NS_UNDERLINE_STYLE_WAVY;
-    break;
-
-  default:
-    aMetric = 0;
-    res     = NS_ERROR_FAILURE;
-  }
-
-  return res;
-}
-
-NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricFloatID aID, float & aMetric)
-{
-
-  nsresult res = nsXPLookAndFeel::GetMetric(aID, aMetric);
-  if (NS_SUCCEEDED(res))
-      return res;
-
-  res = NS_OK;
-
-  switch (aID) {
-  case eMetricFloat_TextFieldVerticalInsidePadding:
-    aMetric = 0.25f;
-    break;
-  case eMetricFloat_TextFieldHorizontalInsidePadding:
-    aMetric = 0.95f; // large number on purpose so minimum padding is used
-    break;
-  case eMetricFloat_TextAreaVerticalInsidePadding:
-    aMetric = 0.40f;    
-    break;
-  case eMetricFloat_TextAreaHorizontalInsidePadding:
-    aMetric = 0.40f; // large number on purpose so minimum padding is used
-    break;
-  case eMetricFloat_ListVerticalInsidePadding:
-    aMetric = 0.10f;
-    break;
-  case eMetricFloat_ListHorizontalInsidePadding:
-    aMetric = 0.40f;
-    break;
-  case eMetricFloat_ButtonVerticalInsidePadding:
-    aMetric = 0.25f;
-    break;
-  case eMetricFloat_ButtonHorizontalInsidePadding:
-    aMetric = 0.25f;
-    break;
-  case eMetricFloat_IMEUnderlineRelativeSize:
-    aMetric = 1.0f;
-    break;
-  case eMetricFloat_SpellCheckerUnderlineRelativeSize:
-    aMetric = 1.0f;
-    break;
-  default:
-    aMetric = -1.0;
-    res = NS_ERROR_FAILURE;
-  }
- 
-  return res;
-}
deleted file mode 100644
--- a/widget/src/photon/nsLookAndFeel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef __nsLookAndFeel
-#define __nsLookAndFeel
-#include "nsXPLookAndFeel.h"
-
-class nsLookAndFeel: public nsXPLookAndFeel {
-public:
-  nsLookAndFeel();
-  virtual ~nsLookAndFeel();
-
-  nsresult NativeGetColor(const nsColorID aID, nscolor &aColor);
-  NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
-  NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
-};
-
-#endif
deleted file mode 100644
--- a/widget/src/photon/nsScreenManagerPh.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsScreenManagerPh.h"
-#include "nsScreenPh.h"
-
-#include "nsPhGfxLog.h"
-
-nsScreenManagerPh :: nsScreenManagerPh( ) {
-  // nothing else to do. I guess we could cache a bunch of information
-  // here, but we want to ask the device at runtime in case anything
-  // has changed.
-	}
-
-
-nsScreenManagerPh :: ~nsScreenManagerPh( ) {
-	}
-
-
-// addref, release, QI
-NS_IMPL_ISUPPORTS1(nsScreenManagerPh, nsIScreenManager)
-
-
-//
-// CreateNewScreenObject
-//
-// Utility routine. Creates a new screen object from the given device handle
-//
-// NOTE: For this "single-monitor" impl, we just always return the cached primary
-//        screen. This should change when a multi-monitor impl is done.
-//
-nsIScreen* nsScreenManagerPh :: CreateNewScreenObject( ) {
-  nsIScreen* retval = nsnull;
-  if( !mCachedMainScreen ) mCachedMainScreen = new nsScreenPh( );
-  NS_IF_ADDREF(retval = mCachedMainScreen.get());
-  return retval;
-	}
-
-//
-// ScreenForRect 
-//
-// Returns the screen that contains the rectangle. If the rect overlaps
-// multiple screens, it picks the screen with the greatest area of intersection.
-//
-// The coordinates are in pixels (not twips) and in screen coordinates.
-//
-NS_IMETHODIMP nsScreenManagerPh :: ScreenForRect ( PRInt32 /*inLeft*/, PRInt32 /*inTop*/, PRInt32 /*inWidth*/, PRInt32 /*inHeight*/, nsIScreen **outScreen ) {
-  GetPrimaryScreen( outScreen );
-  return NS_OK;
-	}
-
-//
-// GetPrimaryScreen
-//
-// The screen with the menubar/taskbar. This shouldn't be needed very
-// often.
-//
-NS_IMETHODIMP nsScreenManagerPh :: GetPrimaryScreen( nsIScreen * *aPrimaryScreen ) {
-  *aPrimaryScreen = CreateNewScreenObject();    // addrefs  
-  return NS_OK;
-	}
-
-//
-// GetNumberOfScreens
-//
-// Returns how many physical screens are available.
-//
-NS_IMETHODIMP nsScreenManagerPh :: GetNumberOfScreens( PRUint32 *aNumberOfScreens ) {
-  *aNumberOfScreens = 1;
-  return NS_OK;
-	}
-
deleted file mode 100644
--- a/widget/src/photon/nsScreenManagerPh.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsScreenManagerPh_h___
-#define nsScreenManagerPh_h___
-
-#include "nsIScreenManager.h"
-#include "nsIScreen.h"
-#include "nsCOMPtr.h"
-
-//------------------------------------------------------------------------
-
-class nsScreenManagerPh : public nsIScreenManager
-{
-public:
-  nsScreenManagerPh ( );
-  virtual ~nsScreenManagerPh();
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSISCREENMANAGER
-
-private:
-
-  nsIScreen* CreateNewScreenObject ( ) ;
-
-    // cache the primary screen object to avoid memory allocation every time
-  nsCOMPtr<nsIScreen> mCachedMainScreen;
-
-};
-
-#endif  // nsScreenManagerPh_h___ 
deleted file mode 100644
--- a/widget/src/photon/nsScreenPh.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsScreenPh.h"
-
-#include <Pt.h>
-#include "nsPhGfxLog.h"
-
-nsScreenPh :: nsScreenPh ( ) {
-  PhSysInfo_t       SysInfo;
-  PhRect_t          rect;
-  char              *p;
-  int               inp_grp;
-  PhRid_t           rid;
-  PhRegion_t        region;
-  
-	p = NULL;
-
-	/* Initialize the data members */
-	/* Get the Screen Size and Depth*/
-	p = getenv("PHIG");
-	if( p ) inp_grp = atoi(p);
-	else inp_grp = 1;
-
-	PhQueryRids( 0, 0, inp_grp, Ph_INPUTGROUP_REGION, 0, 0, 0, &rid, 1 );
-	PhRegionQuery( rid, &region, &rect, NULL, 0 );
-	inp_grp = region.input_group;
-	PhWindowQueryVisible( Ph_QUERY_IG_POINTER, 0, inp_grp, &rect );
-	mWidth  = rect.lr.x - rect.ul.x + 1;
-	mHeight = rect.lr.y - rect.ul.y + 1;  
-
-	/* Get the System Info for the RID */
-	if( PhQuerySystemInfo(rid, NULL, &SysInfo ) ) {
-		/* Make sure the "color_bits" field is valid */
-		if( SysInfo.gfx.valid_fields & Ph_GFX_COLOR_BITS ) mPixelDepth = SysInfo.gfx.color_bits;
-		}
-	}
-
-nsScreenPh :: ~nsScreenPh( ) { }
-
-// addref, release, QI
-NS_IMPL_ISUPPORTS1(nsScreenPh, nsIScreen)
-
-NS_IMETHODIMP nsScreenPh :: GetPixelDepth( PRInt32 *aPixelDepth ) {
-	*aPixelDepth = mPixelDepth;
-	return NS_OK;
-	} // GetPixelDepth
-
-
-NS_IMETHODIMP nsScreenPh :: GetColorDepth( PRInt32 *aColorDepth ) {
-  return GetPixelDepth ( aColorDepth );
-	}
-
-NS_IMETHODIMP nsScreenPh :: GetRect( PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight ) {
-  *outTop = 0;
-  *outLeft = 0;
-  *outWidth = mWidth;
-  *outHeight = mHeight;
-  return NS_OK;
-	}
-
-NS_IMETHODIMP nsScreenPh :: GetAvailRect( PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight ) {
-  *outTop = 0;
-  *outLeft = 0;
-  *outWidth = mWidth;
-  *outHeight = mHeight;
-  return NS_OK;
-	}
deleted file mode 100644
--- a/widget/src/photon/nsScreenPh.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsScreenPh_h___
-#define nsScreenPh_h___
-
-#include "nsIScreen.h"
-
-//------------------------------------------------------------------------
-
-class nsScreenPh : public nsIScreen
-{
-public:
-  nsScreenPh ( );
-  virtual ~nsScreenPh();
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSISCREEN
-
-private:
-  PRInt32 mWidth;
-  PRInt32 mHeight;
-  PRInt32 mPixelDepth;
-};
-
-#endif  // nsScreenPh_h___ 
deleted file mode 100644
--- a/widget/src/photon/nsSound.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Pierre Phaneuf <pp@ludusdesign.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-#include "nscore.h"
-#include "plstr.h"
-#include "prlink.h"
-
-#include "nsSound.h"
-#include "nsString.h"
-
-#include "nsIURL.h"
-#include "nsNetUtil.h"
-#include "nsCOMPtr.h"
-
-#include <Pt.h>
-
-NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver)
-
-////////////////////////////////////////////////////////////////////////
-nsSound::nsSound()
-{
-  mInited = PR_FALSE;
-}
-
-nsSound::~nsSound()
-{
-}
-
-nsresult nsSound::Init()
-{
-  if (mInited) return NS_OK;
-
-  mInited = PR_TRUE;
-  return NS_OK;
-}
-
-NS_METHOD nsSound::Beep()
-{
-  ::PtBeep();
-  return NS_OK;
-}
-
-NS_METHOD nsSound::Play(nsIURL *aURL)
-{
-  NS_NOTYETIMPLEMENTED("nsSound::Play");
-
-#ifdef DEBUG
-printf( "\n\n\nnsSound::Play\n\n" );
-#endif
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader,
-                                        nsISupports *context,
-                                        nsresult aStatus,
-                                        PRUint32 stringLen,
-                                        const PRUint8 *stringData)
-{
-  nsresult rv = NS_ERROR_FAILURE;
-
-#ifdef DEBUG
-printf( "\n\n\nnsSound::OnStreamComplete stringData=%s\n\n", stringData );
-#endif
-
-  if (NS_FAILED(aStatus))
-    return NS_ERROR_FAILURE;
-
-  return rv;
-}
-
-static void child_exit( void *data, int status ) { }
-
-NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
-{
-  NS_ConvertUTF16toUTF8 utf8SoundAlias(aSoundAlias);
-
-#ifdef DEBUG
-printf( "\n\n\nnsSound::PlaySystemSound aSoundAlias=%s\n\n",
-        utf8SoundAlias.get() );
-#endif
-
-  const char *soundfile;
-
-  if( NS_IsMozAliasSound(aSoundAlias) ) {
-    NS_WARNING("nsISound::playSystemSound is called with \"_moz_\" events, they are obsolete, use nsISound::playEventSound instead");
-    if ( aSoundAlias.Equals(NS_SYSSOUND_MAIL_BEEP) )
-      soundfile = "/usr/share/mozilla/gotmail.wav";
-    else
-      return NS_OK;
-  } else {
-    /* the aSoundAlias is the fullpath to the soundfile */
-    if( !access( utf8SoundAlias.get(), F_OK ) )
-      soundfile = utf8SoundAlias.get();
-    else
-      soundfile = "/usr/share/mozilla/rest.wav";
-  }
-
-  const char* argv[] = { "/opt/Mozilla/mozilla/wave", soundfile, NULL };
-  PtSpawn( "/opt/Mozilla/mozilla/wave", ( const char ** ) argv,
-           NULL, NULL, child_exit, NULL, NULL );
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsSound::PlayEventSound(PRUint32 aEventId)
-{
-  if (aEventId != EVENT_NEW_MAIL_RECEIVED) {
-    return NS_OK;
-  }
-
-  soundfile = "/usr/share/mozilla/gotmail.wav";
-  const char* argv[] = { "/opt/Mozilla/mozilla/wave",
-                         "/usr/share/mozilla/gotmail.wav", NULL };
-  PtSpawn( "/opt/Mozilla/mozilla/wave", ( const char ** ) argv,
-           NULL, NULL, child_exit, NULL, NULL );
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/widget/src/photon/nsSound.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef __nsSound_h__
-#define __nsSound_h__
-
-#include "nsISound.h"
-#include "nsIStreamLoader.h"
-
-
-class nsSound : public nsISound, 
-                public nsIStreamLoaderObserver
-{
- public: 
-
-  nsSound();
-  virtual ~nsSound();
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSISOUND
-  NS_DECL_NSISTREAMLOADEROBSERVER
-
-private:
-  PRBool mInited;
-};
-
-#endif /* __nsSound_h__ */
deleted file mode 100644
--- a/widget/src/photon/nsToolkit.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsToolkit.h"
-#include "nscore.h"
-#include "nsWidgetAtoms.h"
-
-//
-// Static thread local storage index of the Toolkit 
-// object associated with a given thread...
-//
-static PRUintn gToolkitTLSIndex = 0;
-
-NS_IMPL_ISUPPORTS1(nsToolkit,nsIToolkit)
-
-//-------------------------------------------------------------------------
-//
-// constructor
-//
-//-------------------------------------------------------------------------
-nsToolkit::nsToolkit()  
-{
-}
-
-
-//-------------------------------------------------------------------------
-//
-// destructor
-//
-//-------------------------------------------------------------------------
-nsToolkit::~nsToolkit()
-{
-  // Remove the TLS reference to the toolkit...
-  PR_SetThreadPrivate(gToolkitTLSIndex, nsnull);
-}
-
-
-//-------------------------------------------------------------------------
-//
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsToolkit::Init(PRThread *aThread)
-{
-  nsWidgetAtoms::RegisterAtoms();
-
-  return NS_OK;
-}
-
-//-------------------------------------------------------------------------
-//
-// Return the nsIToolkit for the current thread.  If a toolkit does not
-// yet exist, then one will be created...
-//
-//-------------------------------------------------------------------------
-NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult)
-{
-  nsIToolkit* toolkit = nsnull;
-  nsresult rv = NS_OK;
-  PRStatus status;
-
-  // Create the TLS index the first time through...
-  if (0 == gToolkitTLSIndex) {
-    status = PR_NewThreadPrivateIndex(&gToolkitTLSIndex, NULL);
-    if (PR_FAILURE == status) {
-      rv = NS_ERROR_FAILURE;
-    }
-  }
-
-  if (NS_SUCCEEDED(rv)) {
-    toolkit = (nsIToolkit*)PR_GetThreadPrivate(gToolkitTLSIndex);
-
-    //
-    // Create a new toolkit for this thread...
-    //
-    if (!toolkit) {
-      toolkit = new nsToolkit();
-
-      if (!toolkit) {
-        rv = NS_ERROR_OUT_OF_MEMORY;
-      } else {
-        NS_ADDREF(toolkit);
-        toolkit->Init(PR_GetCurrentThread());
-        //
-        // The reference stored in the TLS is weak.  It is removed in the
-        // nsToolkit destructor...
-        //
-        PR_SetThreadPrivate(gToolkitTLSIndex, (void*)toolkit);
-      }
-    } else {
-      NS_ADDREF(toolkit);
-    }
-    *aResult = toolkit;
-  }
-
-  return rv;
-}
deleted file mode 100644
--- a/widget/src/photon/nsToolkit.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef TOOLKIT_H      
-#define TOOLKIT_H
-
-#include <Pt.h>
-#include "nsIToolkit.h"
-
-class nsToolkit : public nsIToolkit
-{
-
-public:
-  nsToolkit();
-  virtual ~nsToolkit();
-
-  NS_DECL_ISUPPORTS
-
-  NS_IMETHOD   Init( PRThread *aThread );
-};
-
-
-#endif  // TOOLKIT_H
deleted file mode 100644
--- a/widget/src/photon/nsWidget.cpp
+++ /dev/null
@@ -1,1276 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Jerry.Kirk@Nexwarecorp.com
- *   Michael.Kedl@Nexwarecorp.com
- *   Dale.Stansberry@Nexwarecorop.com
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-#include "nsWidget.h"
-
-#include "nsIAppShell.h"
-#include "nsIComponentManager.h"
-#include "nsIDeviceContext.h"
-#include "nsIFontMetrics.h"
-#include "nsILookAndFeel.h"
-#include "nsToolkit.h"
-#include "nsWidgetsCID.h"
-#include "nsGfxCIID.h"
-#include <Pt.h>
-#include "PtRawDrawContainer.h"
-#include "nsIRollupListener.h"
-#include "nsIServiceManager.h"
-#include "nsWindow.h"
-#ifdef PHOTON_DND
-#include "nsDragService.h"
-#endif
-#include "nsReadableUtils.h"
-
-#include "nsClipboard.h"
-
-#include <errno.h>
-#include <photon/PtServer.h>
-
-static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
-static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
-
-// BGR, not RGB - REVISIT
-#define NSCOLOR_TO_PHCOLOR(g,n) \
-  g.red=NS_GET_B(n); \
-  g.green=NS_GET_G(n); \
-  g.blue=NS_GET_R(n);
-
-////////////////////////////////////////////////////////////////////
-//
-// Define and Initialize global variables
-//
-////////////////////////////////////////////////////////////////////
-
-
-//
-// Keep track of the last widget being "dragged"
-//
-nsILookAndFeel     *nsWidget::sLookAndFeel = nsnull;
-#ifdef PHOTON_DND
-nsIDragService     *nsWidget::sDragService = nsnull;
-#endif
-nsClipboard        *nsWidget::sClipboard = nsnull;
-PRUint32            nsWidget::sWidgetCount = 0;
-nsWidget*						nsWidget::sFocusWidget = 0;
-
-nsWidget::nsWidget()
-{
-  if (!sLookAndFeel) {
-    CallGetService(kLookAndFeelCID, &sLookAndFeel);
-  }
-
-  if( sLookAndFeel )
-    sLookAndFeel->GetColor( nsILookAndFeel::eColor_WindowBackground, mBackground );
-
-#ifdef PHOTON_DND
-	if( !sDragService ) {
-		nsresult rv;
-		nsCOMPtr<nsIDragService> s;
-		s = do_GetService( "@mozilla.org/widget/dragservice;1", &rv );
-		sDragService = ( nsIDragService * ) s;
-		if( NS_FAILED( rv ) ) sDragService = 0;
-		}
-#endif
-
-	if( !sClipboard ) {
-		nsresult rv;
-		nsCOMPtr<nsClipboard> s;
-		s = do_GetService( kCClipboardCID, &rv );
-		sClipboard = ( nsClipboard * ) s;
-		if( NS_FAILED( rv ) ) sClipboard = 0;
-		}
-
-  mWidget = nsnull;
-  mParent = nsnull;
-  mShown = PR_FALSE;
-  mBounds.x = 0;
-  mBounds.y = 0;
-  mBounds.width = 0;
-  mBounds.height = 0;
-  mIsDestroying = PR_FALSE;
-  mOnDestroyCalled = PR_FALSE;
-  mIsToplevel = PR_FALSE;
-  mListenForResizes = PR_FALSE;
-  sWidgetCount++;
-}
-
-
-nsWidget::~nsWidget( ) {
-
-	if( sFocusWidget == this ) sFocusWidget = 0;
-
-  // it's safe to always call Destroy() because it will only allow itself to be called once
-  Destroy();
-
-  if( !sWidgetCount-- ) {
-    NS_IF_RELEASE( sLookAndFeel );
-  	}
-	}
-
-//-------------------------------------------------------------------------
-//
-// nsISupport stuff
-//
-//-------------------------------------------------------------------------
-NS_IMPL_ISUPPORTS_INHERITED0(nsWidget, nsBaseWidget)
-
-NS_METHOD nsWidget::WidgetToScreen( const nsRect& aOldRect, nsRect& aNewRect ) {
-  if( mWidget ) {
-    /* This is NOT correct */
-    aNewRect.x = aOldRect.x;
-    aNewRect.y = aOldRect.y;
-  	}
-  return NS_OK;
-	}
-
-// nsWidget::ScreenToWidget - Not Implemented
-NS_METHOD nsWidget::ScreenToWidget( const nsRect& aOldRect, nsRect& aNewRect ) {
-  return NS_OK;
-	}
-
-//-------------------------------------------------------------------------
-//
-// Close this nsWidget
-//
-//-------------------------------------------------------------------------
-
-NS_IMETHODIMP nsWidget::Destroy( void ) {
-
- // make sure we don't call this more than once.
-  if( mIsDestroying ) return NS_OK;
-
-  // ok, set our state
-  mIsDestroying = PR_TRUE;
-
-  // call in and clean up any of our base widget resources
-  // are released
-  nsBaseWidget::Destroy();
-
-  // destroy our native windows
-  DestroyNative();
-
-  // make sure to call the OnDestroy if it hasn't been called yet
-  if( mOnDestroyCalled == PR_FALSE ) OnDestroy();
-
-  // make sure no callbacks happen
-  mEventCallback = nsnull;
-
-  return NS_OK;
-	}
-
-// this is the function that will destroy the native windows for this widget.
-
-/* virtual */
-void nsWidget::DestroyNative( void ) {
-  if( mWidget ) {
-    // prevent the widget from causing additional events
-    mEventCallback = nsnull;
-	  //EnableDamage( mWidget, PR_FALSE );
-	  PtDestroyWidget( mWidget );
-	  //EnableDamage( mWidget, PR_TRUE );
-    mWidget = nsnull;
-  	}
-	}
-
-// make sure that we clean up here
-
-void nsWidget::OnDestroy( ) {
-  mOnDestroyCalled = PR_TRUE;
-  // release references to children, device context, toolkit + app shell
-  nsBaseWidget::OnDestroy();
-  DispatchStandardEvent(NS_DESTROY);
-	}
-
-//-------------------------------------------------------------------------
-//
-// Hide or show this component
-//
-//-------------------------------------------------------------------------
-
-NS_METHOD nsWidget::Show( PRBool bState ) {
-
-  if( !mWidget ) return NS_OK; // Will be null durring printing
-
-  PtArg_t   arg;
-
-  if( bState ) {
-
-		if( mWindowType != eWindowType_child ) {
-
-		  if (PtWidgetIsRealized(mWidget)) {
-			  mShown = PR_TRUE; 
-			  return NS_OK;
-		  	}
-
-		  //EnableDamage( mWidget, PR_FALSE );
-		  PtRealizeWidget(mWidget);
-
-		  if( mWidget->rid == -1 ) {
-			  //EnableDamage( mWidget, PR_TRUE );
-			  NS_ERROR("nsWidget::Show mWidget's rid == -1\n");
-			  mShown = PR_FALSE; 
-			  return NS_ERROR_FAILURE;
-		  	}
-
-		  PtSetArg(&arg, Pt_ARG_FLAGS, 0, Pt_DELAY_REALIZE);
-		  PtSetResources(mWidget, 1, &arg);
-		  //EnableDamage( mWidget, PR_TRUE );
-		  PtDamageWidget(mWidget);
-#ifdef Ph_REGION_NOTIFY			
-		  PhRegion_t region;
-		  PtWidget_t *mWgt;
-		  mWgt = (PtWidget_t*) GetNativeData( NS_NATIVE_WIDGET );
-		  region.flags = Ph_REGION_NOTIFY | Ph_FORCE_BOUNDARY;
-		  region.rid = PtWidgetRid(mWgt);
-		  PhRegionChange(Ph_REGION_FLAGS, 0, &region, NULL, NULL);
-#endif
-		}
-		else {
-			PtWidgetToFront( mWidget );
-			if( !mShown || !( mWidget->flags & Pt_REALIZED ) ) PtRealizeWidget( mWidget );
-			}
-  	}
-  else {
-		if( mWindowType != eWindowType_child ) {
-      //EnableDamage( mWidget, PR_FALSE );
-      PtUnrealizeWidget(mWidget);
-
-      //EnableDamage( mWidget, PR_TRUE );
-
-      PtSetArg(&arg, Pt_ARG_FLAGS, Pt_DELAY_REALIZE, Pt_DELAY_REALIZE);
-      PtSetResources(mWidget, 1, &arg);
-			}
-		else {
-			//EnableDamage( mWidget, PR_FALSE );
-			PtWidgetToBack( mWidget );
-			if( mShown ) PtUnrealizeWidget( mWidget );
-			//EnableDamage( mWidget, PR_TRUE );
-			}
-  	}
-
-  mShown = bState;
-  return NS_OK;
-	}
-
-
-// nsWidget::SetModal - Not Implemented
-NS_IMETHODIMP nsWidget::SetModal( PRBool aModal ) {
-  return NS_ERROR_FAILURE;
-	}
-
-//-------------------------------------------------------------------------
-//
-// Move this component
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsWidget::Move( PRInt32 aX, PRInt32 aY ) {
-
-	if( ( mBounds.x == aX ) && ( mBounds.y == aY ) ) return NS_OK; 
-
-	mBounds.x = aX;
-	mBounds.y = aY;
-	
-	if( mWidget ) {
-		if(( mWidget->area.pos.x != aX ) || ( mWidget->area.pos.y != aY )) {
-			PhPoint_t pos = { aX, aY };
-			PtSetResource( mWidget, Pt_ARG_POS, &pos, 0 );
-		}
-	}
-  return NS_OK;
-}
-
-
-NS_METHOD nsWidget::Resize( PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint ) {
-
-	if( ( mBounds.width == aWidth ) && ( mBounds.height == aHeight ) ) 
-	   return NS_OK;
-
-  mBounds.width  = aWidth;
-  mBounds.height = aHeight;
-
-  if( mWidget ) {
-		PhDim_t dim = { aWidth, aHeight };
-		//EnableDamage( mWidget, PR_FALSE );
-		PtSetResource( mWidget, Pt_ARG_DIM, &dim, 0 );
-		//EnableDamage( mWidget, PR_TRUE );
-		}
-
-	return NS_OK;
-}
-
-
-//-------------------------------------------------------------------------
-//
-// Send a resize message to the listener
-//
-//-------------------------------------------------------------------------
-PRBool nsWidget::OnResize( nsRect &aRect ) {
-
-  PRBool result = PR_FALSE;
-
-  // call the event callback
-  if( mEventCallback ) {
-		nsSizeEvent event(PR_TRUE, 0, nsnull);
-
-	  InitEvent(event, NS_SIZE);
-
-		nsRect *foo = new nsRect(0, 0, aRect.width, aRect.height);
-		event.windowSize = foo;
-
-		event.refPoint.x = 0;
-		event.refPoint.y = 0;
-		event.mWinWidth = aRect.width;
-		event.mWinHeight = aRect.height;
-  
-		NS_ADDREF_THIS();
-		result = DispatchWindowEvent(&event);
-		NS_RELEASE_THIS();
-		delete foo;
-		}
-
-	return result;
-	}
-
-//------
-// Move
-//------
-PRBool nsWidget::OnMove( PRInt32 aX, PRInt32 aY ) {
-  nsGUIEvent event(PR_TRUE, 0, nsnull);
-  InitEvent(event, NS_MOVE);
-  event.refPoint.x = aX;
-  event.refPoint.y = aY;
-  return DispatchWindowEvent(&event);
-	}
-
-
-//-------------------------------------------------------------------------
-//
-// Set this component font
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsWidget::SetFont( const nsFont &aFont ) {
-
-  nsIFontMetrics* mFontMetrics;
-  mContext->GetMetricsFor(aFont, mFontMetrics);
-
-	if( mFontMetrics ) {
-		PtArg_t arg;
-
-		nsFontHandle aFontHandle;
-		mFontMetrics->GetFontHandle(aFontHandle);
-		nsString *aString;
-		aString = (nsString *) aFontHandle;
-		char *str = ToNewCString(*aString);
-
-		PtSetArg( &arg, Pt_ARG_TEXT_FONT, str, 0 );
-		PtSetResources( mWidget, 1, &arg );
-
-		delete [] str;
-		NS_RELEASE(mFontMetrics);
-		}
-	return NS_OK;
-	}
-
-//-------------------------------------------------------------------------
-//
-// Set this component cursor
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsWidget::SetCursor( nsCursor aCursor ) {
-
-  // Only change cursor if it's changing
-  if( aCursor != mCursor ) {
-
-  	unsigned short curs = Ph_CURSOR_POINTER;
-  	PgColor_t color = Ph_CURSOR_DEFAULT_COLOR;
-
-	switch( aCursor ) {
-		case eCursor_nw_resize:
-			curs = Ph_CURSOR_DRAG_TL;
-			break;
-		case eCursor_se_resize:
-			curs = Ph_CURSOR_DRAG_BR;
-			break;
-		case eCursor_ne_resize:
-			curs = Ph_CURSOR_DRAG_TL;
-			break;
-		case eCursor_sw_resize:
-			curs = Ph_CURSOR_DRAG_BL;
-			break;
-
-		case eCursor_crosshair:
-			curs = Ph_CURSOR_CROSSHAIR;
-			break;
-
-		case eCursor_copy:
-		case eCursor_alias:
-		case eCursor_context_menu:
-			// XXX: No suitable cursor, needs implementing
-			break;
-
-		case eCursor_cell:
-			// XXX: No suitable cursor, needs implementing
-			break;
-
-		case eCursor_spinning:
-			// XXX: No suitable cursor, needs implementing
-			break;
-
-		case eCursor_move:
-		  curs = Ph_CURSOR_MOVE;
-		  break;
-	  
-		case eCursor_help:
-		  curs = Ph_CURSOR_QUESTION_POINT;
-		  break;
-	  
-		case eCursor_grab:
-		case eCursor_grabbing:
-		  curs = Ph_CURSOR_FINGER;
-		  break;
-	  
-		case eCursor_select:
-		  curs = Ph_CURSOR_INSERT;
-		  color = Pg_BLACK;
-		  break;
-	  
-		case eCursor_wait:
-		  curs = Ph_CURSOR_LONG_WAIT;
-		  break;
-
-		case eCursor_hyperlink:
-		  curs = Ph_CURSOR_FINGER;
-		  break;
-
-		case eCursor_standard:
-		  curs = Ph_CURSOR_POINTER;
-		  break;
-
-		case eCursor_n_resize:
-		case eCursor_s_resize:
-		  curs = Ph_CURSOR_DRAG_VERTICAL;
-		  break;
-
-		case eCursor_w_resize:
-		case eCursor_e_resize:
-		  curs = Ph_CURSOR_DRAG_HORIZONTAL;
-		  break;
-
-		case eCursor_zoom_in:
-		case eCursor_zoom_out:
-		  // XXX: No suitable cursor, needs implementing
-		  break;
-
-		case eCursor_not_allowed:
-		case eCursor_no_drop:
-		  curs = Ph_CURSOR_DONT;
-		  break;
-
-		case eCursor_col_resize:
-		  // XXX: not 100% appropriate perhaps
-		  curs = Ph_CURSOR_DRAG_HORIZONTAL;
-		  break;
-
-		case eCursor_row_resize:
-		  // XXX: not 100% appropriate perhaps
-		  curs = Ph_CURSOR_DRAG_VERTICAL;
-		  break;
-
-		case eCursor_vertical_text:
-		  curs = Ph_CURSOR_INSERT;
-		  color = Pg_BLACK;
-		  break;
-
-		case eCursor_all_scroll:
-		  // XXX: No suitable cursor, needs implementing
-		  break;
-
-		case eCursor_nesw_resize:
-		  curs = Ph_CURSOR_DRAG_FOREDIAG;
-		  break;
-
-		case eCursor_nwse_resize:
-		  curs = Ph_CURSOR_DRAG_BACKDIAG;
-		  break;
-
-		case eCursor_ns_resize:
-		  curs = Ph_CURSOR_DRAG_VERTICAL;
-		  break;
-
-		case eCursor_ew_resize:
-		  curs = Ph_CURSOR_DRAG_HORIZONTAL;
-		  break;
-
-		case eCursor_none:
-		  // XXX: No suitable cursor, needs implementing
-		  break;
-
-		default:
-		  NS_ERROR("Invalid cursor type");
-		  break;
-  		}
-
-  	if( mWidget ) {
-  	  PtArg_t args[2];
-
-			PtSetArg( &args[0], Pt_ARG_CURSOR_TYPE, curs, 0 );
-			PtSetArg( &args[1], Pt_ARG_CURSOR_COLOR, color, 0 );
-			PtSetResources( mWidget, 2, args );
-  		}
-		mCursor = aCursor;
-		}
-
-	return NS_OK;
-	}
-
-
-NS_METHOD nsWidget::Invalidate( const nsRect & aRect, PRBool aIsSynchronous ) {
-
-  if( !mWidget ) return NS_OK; // mWidget will be null during printing
-  if( !PtWidgetIsRealized( mWidget ) ) return NS_OK;
-
-	PhRect_t prect;
-	prect.ul.x = aRect.x;
-	prect.ul.y = aRect.y;
-	prect.lr.x = prect.ul.x + aRect.width - 1;
-	prect.lr.y = prect.ul.y + aRect.height - 1;
-	if( ! ( mWidget->class_rec->flags & Pt_DISJOINT ) )
-		PhTranslateRect( &prect, &mWidget->area.pos );
-	PtDamageExtent( mWidget, &prect );
-	if( aIsSynchronous ) PtFlush( );
-	return NS_OK;
-	}
-
-NS_IMETHODIMP nsWidget::InvalidateRegion( const nsIRegion *aRegion, PRBool aIsSynchronous ) {
-	PhTile_t *tiles = NULL;
-	aRegion->GetNativeRegion( ( void*& ) tiles );
-	if( tiles ) {
-		PhTranslateTiles( tiles, &mWidget->area.pos );
-		PtDamageTiles( mWidget, tiles );
-		if( aIsSynchronous ) PtFlush( );
-		}
-  return NS_OK;
-	}
-
-nsresult nsWidget::CreateWidget(nsIWidget *aParent,
-                                nsNativeWidget aNativeParent,
-                                const nsRect &aRect,
-                                EVENT_CALLBACK aHandleEventFunction,
-                                nsIDeviceContext *aContext,
-                                nsIAppShell *aAppShell,
-                                nsIToolkit *aToolkit,
-                                nsWidgetInitData *aInitData)
-{
-
-  PtWidget_t *parentWidget = nsnull;
-
-
-
-  if( aNativeParent ) {
-    parentWidget = (PtWidget_t*)aNativeParent;
-    // we've got a native parent so listen for resizes
-    mListenForResizes = PR_TRUE;
-  	}
-  else if( aParent ) {
-    parentWidget = (PtWidget_t*) (aParent->GetNativeData(NS_NATIVE_WIDGET));
-		mListenForResizes = aInitData ? aInitData->mListenForResizes : PR_FALSE;
-  	}
-
-	if( aInitData->mWindowType == eWindowType_child && !parentWidget ) return NS_ERROR_FAILURE;
-
-  nsIWidget *baseParent = aInitData &&
-                            (aInitData->mWindowType == eWindowType_dialog ||
-                             aInitData->mWindowType == eWindowType_toplevel ||
-                             aInitData->mWindowType == eWindowType_invisible) ?
-                          nsnull : aParent;
-
-  BaseCreate( baseParent, aRect, aHandleEventFunction, aContext, aAppShell, aToolkit, aInitData );
-
-  mParent = aParent;
-  mBounds = aRect;
-
-  CreateNative (parentWidget);
-
-	if( aRect.width > 1 && aRect.height > 1 ) Resize(aRect.width, aRect.height, PR_FALSE);
-
-  if( mWidget ) {
-    SetInstance(mWidget, this);
-    PtAddCallback( mWidget, Pt_CB_GOT_FOCUS, GotFocusCallback, this );
-    PtAddCallback( mWidget, Pt_CB_LOST_FOCUS, LostFocusCallback, this );
-    PtAddCallback( mWidget, Pt_CB_IS_DESTROYED, DestroyedCallback, this );
-#ifdef PHOTON_DND
-    PtAddCallback( mWidget, Pt_CB_DND, DndCallback, this );
-#endif
-  	}
-
-  DispatchStandardEvent(NS_CREATE);
-
-  return NS_OK;
-	}
-
-
-//-------------------------------------------------------------------------
-//
-// Invokes callback and ProcessEvent method on Event Listener object
-//
-//-------------------------------------------------------------------------
-
-NS_IMETHODIMP nsWidget::DispatchEvent( nsGUIEvent *aEvent, nsEventStatus &aStatus ) {
-
-  NS_ADDREF(aEvent->widget);
-
-  if( nsnull != mMenuListener ) {
-    if( NS_MENU_EVENT == aEvent->eventStructType )
-      aStatus = mMenuListener->MenuSelected(static_cast<nsMenuEvent&>(*aEvent));
-  	}
-
-  aStatus = nsEventStatus_eIgnore;
-
-///* ATENTIE */ printf( "mEventCallback call (%d %d) this=%p\n", aEvent->point.x, aEvent->point.y, this );
-
-  if( nsnull != mEventCallback ) aStatus = (*mEventCallback)(aEvent);
-
-  // Dispatch to event listener if event was not consumed
-  if( (aStatus != nsEventStatus_eIgnore) && (nsnull != mEventListener) )
-    aStatus = mEventListener->ProcessEvent(*aEvent);
-
-   NS_IF_RELEASE(aEvent->widget);
-
-  return NS_OK;
-	}
-
-//==============================================================
-void nsWidget::InitMouseEvent(PhPointerEvent_t *aPhButtonEvent,
-                              nsWidget * aWidget,
-                              nsMouseEvent &anEvent,
-                              PRUint32   aEventType,
-                              PRInt16    aButton)
-{
-  anEvent.message = aEventType;
-  anEvent.widget  = aWidget;
-
-  if (aPhButtonEvent != nsnull) {
-    anEvent.time =      PR_IntervalNow();
-    anEvent.isShift =   ( aPhButtonEvent->key_mods & Pk_KM_Shift ) ? PR_TRUE : PR_FALSE;
-    anEvent.isControl = ( aPhButtonEvent->key_mods & Pk_KM_Ctrl )  ? PR_TRUE : PR_FALSE;
-    anEvent.isAlt =     ( aPhButtonEvent->key_mods & Pk_KM_Alt )   ? PR_TRUE : PR_FALSE;
-		anEvent.isMeta =		PR_FALSE;
-    anEvent.refPoint.x =   aPhButtonEvent->pos.x; 
-    anEvent.refPoint.y =   aPhButtonEvent->pos.y;
-    anEvent.clickCount = aPhButtonEvent->click_count;
-    anEvent.button = aButton;
-  	}
-	}
-
-//-------------------------------------------------------------------------
-//
-// Deal with all sort of mouse event
-//
-//-------------------------------------------------------------------------
-PRBool nsWidget::DispatchMouseEvent( nsMouseEvent& aEvent ) {
-
-  PRBool result = PR_FALSE;
-
-  // call the event callback
-  if (nsnull != mEventCallback) {
-    result = DispatchWindowEvent(&aEvent);
-    return result;
-  }
-
-  return result;
-}
-
-struct nsKeyConverter {
-  PRUint32       vkCode; // Platform independent key code
-  unsigned long  keysym; // Photon key_sym key code
-};
-
-static struct nsKeyConverter nsKeycodes[] = {
-  { NS_VK_PAGE_UP,    Pk_Pg_Up },
-  { NS_VK_PAGE_DOWN,  Pk_Pg_Down },
-  { NS_VK_UP,         Pk_Up },
-  { NS_VK_DOWN,       Pk_Down },
-  { NS_VK_TAB,        Pk_Tab },
-  { NS_VK_TAB,        Pk_KP_Tab },
-  { NS_VK_HOME,       Pk_Home },
-  { NS_VK_END,        Pk_End },
-  { NS_VK_LEFT,       Pk_Left },
-  { NS_VK_RIGHT,      Pk_Right },
-  { NS_VK_DELETE,     Pk_Delete },
-  { NS_VK_CANCEL,     Pk_Cancel },
-  { NS_VK_BACK,       Pk_BackSpace },
-  { NS_VK_CLEAR,      Pk_Clear },
-  { NS_VK_RETURN,     Pk_Return },
-  { NS_VK_SHIFT,      Pk_Shift_L },
-  { NS_VK_SHIFT,      Pk_Shift_R },
-  { NS_VK_CONTROL,    Pk_Control_L },
-  { NS_VK_CONTROL,    Pk_Control_R },
-  { NS_VK_ALT,        Pk_Alt_L },
-  { NS_VK_ALT,        Pk_Alt_R },
-  { NS_VK_INSERT,     Pk_Insert },
-  { NS_VK_PAUSE,      Pk_Pause },
-  { NS_VK_CAPS_LOCK,  Pk_Caps_Lock },
-  { NS_VK_ESCAPE,     Pk_Escape },
-  { NS_VK_PRINTSCREEN,Pk_Print },
-  { NS_VK_RETURN,     Pk_KP_Enter },
-  { NS_VK_INSERT,     Pk_KP_0 },
-  { NS_VK_END,        Pk_KP_1 },
-  { NS_VK_DOWN,       Pk_KP_2 },
-  { NS_VK_PAGE_DOWN,  Pk_KP_3 },
-  { NS_VK_LEFT,       Pk_KP_4 },
-  { NS_VK_NUMPAD5,    Pk_KP_5 },
-  { NS_VK_RIGHT,      Pk_KP_6 },
-  { NS_VK_HOME,       Pk_KP_7 },
-  { NS_VK_UP,         Pk_KP_8 },
-  { NS_VK_PAGE_UP,    Pk_KP_9 },
-  { NS_VK_COMMA,      Pk_KP_Separator }
-  };
-
-
-// Input keysym is in photon format; output is in NS_VK format
-PRUint32 nsWidget::nsConvertKey( PhKeyEvent_t *aPhKeyEvent ) {
-
-	unsigned long keysym, keymods;
-
-  const int length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter);
-
-	keymods = aPhKeyEvent->key_mods;
-	if( aPhKeyEvent->key_flags & Pk_KF_Sym_Valid )
-		keysym = aPhKeyEvent->key_sym;
-	else if( aPhKeyEvent->key_flags & Pk_KF_Cap_Valid )
-		keysym = aPhKeyEvent->key_cap;
-	else return 0;
-	
-  // First, try to handle alphanumeric input, not listed in nsKeycodes:
-  if (keysym >= Pk_a && keysym <= Pk_z)
-     return keysym - Pk_a + NS_VK_A;
-
-  if (keysym >= Pk_A && keysym <= Pk_Z)
-     return keysym - Pk_A + NS_VK_A;
-
-  if (keysym >= Pk_0 && keysym <= Pk_9)
-     return keysym - Pk_0 + NS_VK_0;
-		  
-  if (keysym >= Pk_F1 && keysym <= Pk_F24) {
-     return keysym - Pk_F1 + NS_VK_F1;
-  	}
-
-	if( keymods & Pk_KM_Num_Lock ) {
-  	if( keysym >= Pk_KP_0 && keysym <= Pk_KP_9 )
-     	return keysym - Pk_0 + NS_VK_0;
-		}
-
-  for (int i = 0; i < length; i++) {
-    if( nsKeycodes[i].keysym == keysym ) {
-      return (nsKeycodes[i].vkCode);
-    	}
-  	}
-
-  return((int) 0);
-	}
-
-PRBool  nsWidget::DispatchKeyEvent( PhKeyEvent_t *aPhKeyEvent ) {
-  NS_ASSERTION(aPhKeyEvent, "nsWidget::DispatchKeyEvent a NULL PhKeyEvent was passed in");
-
-  if( !(aPhKeyEvent->key_flags & (Pk_KF_Cap_Valid|Pk_KF_Sym_Valid) ) ) {
-		//printf("nsWidget::DispatchKeyEvent throwing away invalid key: Modifiers Valid=<%d,%d,%d> this=<%p>\n",
-		//(aPhKeyEvent->key_flags & Pk_KF_Scan_Valid), (aPhKeyEvent->key_flags & Pk_KF_Sym_Valid), (aPhKeyEvent->key_flags & Pk_KF_Cap_Valid), this );
-		return PR_FALSE;
-		}
-
-  if ( PtIsFocused(mWidget) != 2) {
-     //printf("nsWidget::DispatchKeyEvent Not on focus leaf! PtIsFocused(mWidget)=<%d>\n", PtIsFocused(mWidget));
-     return PR_FALSE;
-  	}
-  
-  if ( ( aPhKeyEvent->key_cap == Pk_Shift_L )
-       || ( aPhKeyEvent->key_cap == Pk_Shift_R )
-       || ( aPhKeyEvent->key_cap == Pk_Control_L )
-       || ( aPhKeyEvent->key_cap ==  Pk_Control_R )
-       || ( aPhKeyEvent->key_cap ==  Pk_Num_Lock )
-       || ( aPhKeyEvent->key_cap ==  Pk_Scroll_Lock )
-     )
-    return PR_TRUE;
-
-  nsWindow *w = (nsWindow *) this;
-
-  w->AddRef();
- 
-  if (aPhKeyEvent->key_flags & Pk_KF_Key_Down) {
-		nsKeyEvent keyDownEvent(PR_TRUE, NS_KEY_DOWN, w);
-		InitKeyEvent(aPhKeyEvent, keyDownEvent);
-		PRBool noDefault = w->OnKey(keyDownEvent);
-
-		nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, w);
-		InitKeyPressEvent(aPhKeyEvent, keyPressEvent);
-		if (noDefault) {  // If prevent default set for keydown, do same for keypress
-			keyPressEvent.flags = NS_EVENT_FLAG_NO_DEFAULT;
-		}
-		w->OnKey(keyPressEvent);
-  	}
-  else if (aPhKeyEvent->key_flags & Pk_KF_Key_Repeat) {
-		nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, w);
-		InitKeyPressEvent(aPhKeyEvent, keyPressEvent);
-		w->OnKey(keyPressEvent);
-  	}
-  else if (PkIsKeyDown(aPhKeyEvent->key_flags) == 0) {
-		nsKeyEvent kevent(PR_TRUE, NS_KEY_UP, w);
-		InitKeyEvent(aPhKeyEvent, kevent);
-		w->OnKey(kevent);
-  	}
-
-  w->Release();
-
-  return PR_TRUE;
-	}
-
-inline void nsWidget::InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, nsKeyEvent &anEvent )
-{
-	anEvent.keyCode = 	nsConvertKey( aPhKeyEvent );
-	anEvent.time = 			PR_IntervalNow();
-	anEvent.isShift =   ( aPhKeyEvent->key_mods & Pk_KM_Shift ) ? PR_TRUE : PR_FALSE;
-	anEvent.isControl = ( aPhKeyEvent->key_mods & Pk_KM_Ctrl )  ? PR_TRUE : PR_FALSE;
-	anEvent.isAlt =     ( aPhKeyEvent->key_mods & Pk_KM_Alt )   ? PR_TRUE : PR_FALSE;
-	anEvent.isMeta =    PR_FALSE;
-}
-
-/* similar to PhKeyToMb */
-inline int key_sym_displayable(const PhKeyEvent_t *kevent)
-{
-  if(kevent->key_flags & Pk_KF_Sym_Valid) {
-    unsigned long const sym = kevent->key_sym;
-    if  ( sym >= 0xF000
-      ? sym >= 0xF100 && ( sizeof(wchar_t) > 2 || sym < 0x10000 )
-      : ( sym & ~0x9F ) != 0 // exclude 0...0x1F and 0x80...0x9F
-        ) return 1;
-  }
-  return 0;
-}
-
-/* similar to PhKeyToMb */
-inline int key_cap_displayable(const PhKeyEvent_t *kevent)
-{
-  if(kevent->key_flags & Pk_KF_Cap_Valid) {
-    unsigned long const cap = kevent->key_cap;
-    if  ( cap >= 0xF000
-      ? cap >= 0xF100 && ( sizeof(wchar_t) > 2 || cap < 0x10000 )
-      : ( cap & ~0x9F ) != 0 // exclude 0...0x1F and 0x80...0x9F
-        ) return 1;
-  }
-  return 0;
-}
-
-inline void nsWidget::InitKeyPressEvent(PhKeyEvent_t *aPhKeyEvent, nsKeyEvent &anEvent )
-{
-	anEvent.isShift =   ( aPhKeyEvent->key_mods & Pk_KM_Shift ) ? PR_TRUE : PR_FALSE;
-	anEvent.isControl = ( aPhKeyEvent->key_mods & Pk_KM_Ctrl )  ? PR_TRUE : PR_FALSE;
-	anEvent.isAlt =     ( aPhKeyEvent->key_mods & Pk_KM_Alt )   ? PR_TRUE : PR_FALSE;
-	anEvent.isMeta =    PR_FALSE;
-
-	if( key_sym_displayable( aPhKeyEvent ) ) anEvent.charCode = aPhKeyEvent->key_sym;
-	else {
-		/* in photon Ctrl<something> or Alt<something> is not a displayable character, but
-			mozilla wants the keypress event as a charCode+isControl+isAlt, instead of a keyCode */
-		if( ( anEvent.isControl || anEvent.isAlt ) && key_cap_displayable( aPhKeyEvent ) )
-			anEvent.charCode = aPhKeyEvent->key_cap;
-		else anEvent.keyCode = nsConvertKey( aPhKeyEvent );
-		}
-
-	anEvent.time = 			PR_IntervalNow();
-}
-
-// used only once
-inline PRBool nsWidget::HandleEvent( PtWidget_t *widget, PtCallbackInfo_t* aCbInfo ) {
-  PRBool  result = PR_TRUE; // call the default nsWindow proc
-  PhEvent_t* event = aCbInfo->event;
-
-	if (event->processing_flags & Ph_CONSUMED) return PR_TRUE;
-
-	switch ( event->type ) {
-
-      case Ph_EV_PTR_MOTION_NOBUTTON:
-       	{
-	    	PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-	    	nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);
-
-        if( ptrev ) {
-
-					if( ptrev->flags & Ph_PTR_FLAG_Z_ONLY ) break; // sometimes z presses come out of nowhere */
-
-///* ATENTIE */ printf( "Ph_EV_PTR_MOTION_NOBUTTON (%d %d)\n", ptrev->pos.x, ptrev->pos.y );
-
-        	ScreenToWidgetPos( ptrev->pos );
- 	      	InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE );
-        	result = DispatchMouseEvent(theMouseEvent);
-        	}
-       	}
-	    	break;
-
-      case Ph_EV_BUT_PRESS:
-       {
-
-	    	PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-   		  nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);
-
-				/* there should be no reason to do this - mozilla should figure out how to call SetFocus */
-				/* this though fixes the problem with the plugins capturing the focus */
-				PtWidget_t *disjoint = PtFindDisjoint( widget );
- 				if( PtWidgetIsClassMember( disjoint, PtServer ) )
-					PtContainerGiveFocus( widget, aCbInfo->event );
-
-        if( ptrev ) {
-          ScreenToWidgetPos( ptrev->pos );
-
-          if( ptrev->buttons & Ph_BUTTON_SELECT ) // Normally the left mouse button
-						InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_BUTTON_DOWN,
-							       nsMouseEvent::eLeftButton);
-          else if( ptrev->buttons & Ph_BUTTON_MENU ) // the right button
-						InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_BUTTON_DOWN,
-	  						       nsMouseEvent::eRightButton);
-          else // middle button
-						InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_BUTTON_DOWN,
-							       nsMouseEvent::eMiddleButton);
-
-		  		result = DispatchMouseEvent(theMouseEvent);
-
-					// if we're a right-button-up we're trying to popup a context menu. send that event to gecko also
-					if( ptrev->buttons & Ph_BUTTON_MENU ) {
-						nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull,
-                                                      nsMouseEvent::eReal);
-						InitMouseEvent(ptrev, this, contextMenuEvent, NS_CONTEXTMENU,
-							       nsMouseEvent::eRightButton);
-						result = DispatchMouseEvent( contextMenuEvent );
-						}
-      	  }
-
-      	 }
-		break;		
-		
-		case Ph_EV_BUT_RELEASE:
-		  {
-			  PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-			  nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull,
-                                         nsMouseEvent::eReal);
-			  
-			  // Update the current input group for clipboard mouse events
-			  // (mozilla only). Note that for mozserver the mouse based
-			  // (eg. Edit->Copy/Paste menu) events don't come through here.
-			  // They are sent by the voyager client app via libPtWeb.so to
-			  // do_command() in mozserver.cpp.
-			  if (sClipboard)
-			  	sClipboard->SetInputGroup(event->input_group);
-
-			  if (event->subtype==Ph_EV_RELEASE_REAL || event->subtype==Ph_EV_RELEASE_PHANTOM) {
-				  if (ptrev) {
-					  ScreenToWidgetPos( ptrev->pos );
-					  if ( ptrev->buttons & Ph_BUTTON_SELECT ) // Normally the left mouse button
-						 InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_BUTTON_UP,
-						 	        nsMouseEvent::eLeftButton);
-					  else if( ptrev->buttons & Ph_BUTTON_MENU ) // the right button
-						 InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_BUTTON_UP,
-						 	        nsMouseEvent::eRightButton);
-					  else // middle button
-						 InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE__BUTTON_UP,
-						 	        nsMouseEvent::eMiddleButton);
-					  
-					  result = DispatchMouseEvent(theMouseEvent);
-				  }
-			  }
-			  else if (event->subtype==Ph_EV_RELEASE_OUTBOUND) {
-				  PhRect_t rect = {{0,0},{0,0}};
-				  PhRect_t boundary = {{-10000,-10000},{10000,10000}};
-				  PhInitDrag( PtWidgetRid(mWidget), ( Ph_DRAG_KEY_MOTION | Ph_DRAG_TRACK | Ph_TRACK_DRAG),&rect, &boundary, aCbInfo->event->input_group , NULL, NULL, NULL, NULL, NULL);
-			  }
-		  }
-	    break;
-
-		case Ph_EV_PTR_MOTION_BUTTON:
-      	{
-        PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-	    	nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);
-
-        if( ptrev ) {
-
-					if( ptrev->flags & Ph_PTR_FLAG_Z_ONLY ) break; // sometimes z presses come out of nowhere */
-
-#ifdef PHOTON_DND
-					if( sDragService ) {
-						nsDragService *d;
-						nsIDragService *s = sDragService;
-						d = ( nsDragService * )s;
-						d->SetNativeDndData( widget, event );
-						}
-#endif
-
-          ScreenToWidgetPos( ptrev->pos );
- 	      	InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE );
-          result = DispatchMouseEvent(theMouseEvent);
-        	}
-      	}
-      	break;
-
-      case Ph_EV_KEY:
-        // Update the current input group for clipboard key events. This
-        // covers both mozserver and mozilla.
-        if (sClipboard)
-          sClipboard->SetInputGroup(event->input_group);
-				result = DispatchKeyEvent( (PhKeyEvent_t*) PhGetData( event ) );
-        break;
-
-      case Ph_EV_DRAG:
-	    	{
-          nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);
-
-          switch(event->subtype) {
-
-		  			case Ph_EV_DRAG_COMPLETE: 
-            	{  
- 		      		nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull,
-                                               nsMouseEvent::eReal);
-              PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event );
-              ScreenToWidgetPos( ptrev2->pos );
-              InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_BUTTON_UP,
-                             nsMouseEvent::eLeftButton);
-              result = DispatchMouseEvent(theMouseEvent);
-            	}
-							break;
-		  			case Ph_EV_DRAG_MOTION_EVENT: {
-      		    PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event );
-      		    ScreenToWidgetPos( ptrev2->pos );
-  	  		    InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_MOVE );
-      		    result = DispatchMouseEvent(theMouseEvent);
-							}
-							break;
-		  			}
-					}
-        break;
-
-      case Ph_EV_BOUNDARY:
-				PRUint32 evtype;
-
-        switch( event->subtype ) {
-          case Ph_EV_PTR_ENTER:
-					case Ph_EV_PTR_ENTER_FROM_CHILD:
-						evtype = NS_MOUSE_ENTER;
-            break;
-					case Ph_EV_PTR_LEAVE_TO_CHILD:
-          case Ph_EV_PTR_LEAVE:
-						evtype = NS_MOUSE_EXIT;
-            break;
-          default:
-						evtype = 0;
-            break;
-        	}
-
-				if( evtype != 0 ) {
-					PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
-					nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull,
-                                               nsMouseEvent::eReal);
-					ScreenToWidgetPos( ptrev->pos );
-					InitMouseEvent( ptrev, this, theMouseEvent, evtype );
-					result = DispatchMouseEvent( theMouseEvent );
-					}
-        break;
-    	}
-
-  return result;
-	}
-
-
-
-//-------------------------------------------------------------------------
-//
-// the nsWidget raw event callback for all nsWidgets in this toolkit
-//
-//-------------------------------------------------------------------------
-int nsWidget::RawEventHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) {
-
-  // Get the window which caused the event and ask it to process the message
-  nsWidget *someWidget = (nsWidget*) data;
-
-  if( someWidget && someWidget->mIsDestroying == PR_FALSE && someWidget->HandleEvent( widget, cbinfo ) )
-		return Pt_END; // Event was consumed
-
-  return Pt_CONTINUE;
-	}
-
-
-int nsWidget::GotFocusCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) 
-{
-  nsWidget *pWidget = (nsWidget *) data;
-
-	if( PtWidgetIsClass( widget, PtWindow ) ) {
-		if( pWidget->mEventCallback ) {
-			/* the WM_ACTIVATE code */
-			pWidget->DispatchStandardEvent(NS_ACTIVATE);
-			return Pt_CONTINUE;
-			}
-		}
-
-  return Pt_CONTINUE;
-}
-
-int nsWidget::LostFocusCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) 
-{
-  return Pt_CONTINUE;
-}
-
-int nsWidget::DestroyedCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) {
-  nsWidget *pWidget = (nsWidget *) data;
-  if( !pWidget->mIsDestroying ) pWidget->OnDestroy();
-  return Pt_CONTINUE;
-	}
-
-#ifdef PHOTON_DND
-void nsWidget::ProcessDrag( PhEvent_t *event, PRUint32 aEventType, PhPoint_t *pos ) {
-	nsCOMPtr<nsIDragSession> currSession;
-	sDragService->GetCurrentSession ( getter_AddRefs(currSession) );
-	if( !currSession ) return;
-
-	int action = nsIDragService::DRAGDROP_ACTION_NONE;
-	nsDragService *d = ( nsDragService * ) sDragService;
-	
-  if( d->mActionType & nsIDragService::DRAGDROP_ACTION_MOVE )
-    action = nsIDragService::DRAGDROP_ACTION_MOVE;
-  else if( d->mActionType & nsIDragService::DRAGDROP_ACTION_LINK )
-    action = nsIDragService::DRAGDROP_ACTION_LINK;
-  else if( d->mActionType & nsIDragService::DRAGDROP_ACTION_COPY )
-    action = nsIDragService::DRAGDROP_ACTION_COPY;
-
-	currSession->SetDragAction( action );
-
-	DispatchDragDropEvent( event, aEventType, pos );
-
-	int old_subtype = event->subtype;
-	event->subtype = Ph_EV_DND_ENTER;
-
-	PRBool canDrop;
-	currSession->GetCanDrop(&canDrop);
-	if(!canDrop) {
-		static PhCharacterCursorDescription_t nodrop_cursor = {  { Ph_CURSOR_NOINPUT, sizeof(PhCharacterCursorDescription_t) }, PgRGB( 255, 255, 224 ) };
-		PhAckDnd( event, Ph_EV_DND_MOTION, ( PhCursorDescription_t * ) &nodrop_cursor );
-		}
-	else {
-		static PhCharacterCursorDescription_t drop_cursor = { { Ph_CURSOR_PASTE, sizeof(PhCharacterCursorDescription_t) }, PgRGB( 255, 255, 224 ) };
-		PhAckDnd( event, Ph_EV_DND_MOTION, ( PhCursorDescription_t * ) &drop_cursor );
-		}
-
-	event->subtype = old_subtype;
-
-	// Clear the cached value
-	currSession->SetCanDrop(PR_FALSE);
-	}
-
-void nsWidget::DispatchDragDropEvent( PhEvent_t *phevent, PRUint32 aEventType, PhPoint_t *pos ) {
-  nsEventStatus status;
-  nsDragEvent event(PR_TRUE, 0, nsnull);
-
-  InitEvent( event, aEventType );
-
-  event.refPoint.x = pos->x;
-  event.refPoint.y = pos->y;
-
-	PhDndEvent_t *dnd = ( PhDndEvent_t * ) PhGetData( phevent );
-  event.isControl = ( dnd->key_mods & Pk_KM_Ctrl ) ? PR_TRUE : PR_FALSE;
-  event.isShift   = ( dnd->key_mods & Pk_KM_Shift ) ? PR_TRUE : PR_FALSE;
-  event.isAlt     = ( dnd->key_mods & Pk_KM_Alt ) ? PR_TRUE : PR_FALSE;
-  event.isMeta    = PR_FALSE;
-
-	event.widget = this;
-
-///* ATENTIE */ printf("DispatchDragDropEvent pos=%d %d widget=%p\n", event.refPoint.x, event.refPoint.y, this );
-
-  DispatchEvent( &event, status );
-	}
-
-int nsWidget::DndCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) {
-	nsWidget *pWidget = (nsWidget *) data;
-	PtDndCallbackInfo_t *cbdnd = (  PtDndCallbackInfo_t * ) cbinfo->cbdata;
-
-	static PtDndFetch_t dnd_data_template = { "Mozilla", "dnddata", Ph_TRANSPORT_INLINE, Pt_DND_SELECT_MOTION,
-                        NULL, NULL, NULL, NULL, NULL };
-
-///* ATENTIE */ printf( "In nsWidget::DndCallback subtype=%d\n", cbinfo->reason_subtype );
-
-	PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( cbinfo->event );
-//printf("Enter pos=%d %d\n", ptrev->pos.x, ptrev->pos.y );
-	pWidget->ScreenToWidgetPos( ptrev->pos );
-//printf("After trans pos=%d %d pWidget=%p\n", ptrev->pos.x, ptrev->pos.y, pWidget );
-
-
-	switch( cbinfo->reason_subtype ) {
-		case Ph_EV_DND_ENTER: {
-			sDragService->StartDragSession();
-			pWidget->ProcessDrag( cbinfo->event, NS_DRAGDROP_ENTER, &ptrev->pos );
-
-			PtDndSelect( widget, &dnd_data_template, 1, NULL, NULL, cbinfo );
-			}
-			break;
-
-		case Ph_EV_DND_MOTION: {
-			sDragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
-			pWidget->ProcessDrag( cbinfo->event, NS_DRAGDROP_OVER, &ptrev->pos );
-			}
-			break;
-		case Ph_EV_DND_DROP:
-			nsDragService *d;
-			d = ( nsDragService * )sDragService;
-			if( d->SetDropData( (char*)cbdnd->data ) != NS_OK ) break;
-			pWidget->ProcessDrag( cbinfo->event, NS_DRAGDROP_DROP, &ptrev->pos );
-			sDragService->EndDragSession(PR_TRUE);
-			((nsDragService*) sDragService)->SourceEndDrag();
-			break;
-
-		case Ph_EV_DND_LEAVE:
-			pWidget->ProcessDrag( cbinfo->event, NS_DRAGDROP_EXIT, &ptrev->pos );
-			sDragService->EndDragSession(PR_FALSE);
-			break;
-
-		case Ph_EV_DND_CANCEL:
-			pWidget->ProcessDrag( cbinfo->event, NS_DRAGDROP_EXIT, &ptrev->pos );
-			sDragService->EndDragSession(PR_TRUE);
-			((nsDragService*) sDragService)->SourceEndDrag();
-			break;
-		}
-
-	return Pt_CONTINUE;
-	}
-#endif /* PHOTON_DND */
deleted file mode 100644
--- a/widget/src/photon/nsWidget.h
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsWidget_h__
-#define nsWidget_h__
-
-#include "nsBaseWidget.h"
-#include "nsIRegion.h"
-#ifdef PHOTON_DND
-#include "nsIDragService.h"
-#endif
-#include "nsClipboard.h"
-
-class nsILookAndFeel;
-class nsIAppShell;
-class nsIToolkit;
-
-#include <Pt.h>
-
-class nsWidget;
-
-#define NS_TO_PH_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
-#define PH_TO_NS_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
-
-/**
- * Base of all Photon native widgets.
- */
-
-class nsWidget : public nsBaseWidget
-{
-public:
-  nsWidget();
-  virtual ~nsWidget();
-
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIWidget
-
-  inline NS_IMETHOD            Create(nsIWidget *aParent,
-                               nsNativeWidget aNativeParent,
-                               const nsRect &aRect,
-                               EVENT_CALLBACK aHandleEventFunction,
-                               nsIDeviceContext *aContext,
-                               nsIAppShell *aAppShell = nsnull,
-                               nsIToolkit *aToolkit = nsnull,
-                               nsWidgetInitData *aInitData = nsnull);
-
-  NS_IMETHOD Destroy(void);
-  inline nsIWidget* GetParent(void)
-		{
-		if( mIsDestroying ) return nsnull;
-		nsIWidget* result = mParent;
-		if( mParent ) NS_ADDREF( result );
-		return result;
-		}
-
-  virtual void OnDestroy();
-
-  NS_IMETHOD SetModal(PRBool aModal);
-  NS_IMETHOD Show(PRBool state);
-  inline NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener, nsIMenuRollup *aMenuRollup,
-                                        PRBool aDoCapture, PRBool aConsumeRollupEvent)
-  { return NS_OK; }
-
-  inline NS_IMETHOD IsVisible(PRBool &aState) { aState = mShown; return NS_OK; }
-
-  inline NS_IMETHOD ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY) { return NS_OK; }
-  NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
-  NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
-  inline NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
-		{
-		Move(aX,aY);
-		Resize(aWidth,aHeight,aRepaint);
-		return NS_OK;
-		}
-
-  inline NS_IMETHOD Enable(PRBool aState)
-		{
-		if( mWidget ) PtSetResource( mWidget, Pt_ARG_FLAGS, aState ? 0 : Pt_BLOCKED, Pt_BLOCKED );
-		return NS_OK;
-		}
-
-  inline NS_IMETHOD IsEnabled(PRBool *aState)
-		{
-		if(PtWidgetFlags(mWidget) & Pt_BLOCKED) *aState = PR_FALSE;
-		else *aState = PR_TRUE;
-		return NS_OK;
-		}
-
-  PRBool OnResize(nsSizeEvent event);
-  virtual PRBool OnResize(nsRect &aRect);
-  virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
-
-  inline nsIFontMetrics *GetFont(void) { return nsnull; }
-  NS_IMETHOD SetFont(const nsFont &aFont);
-
-  inline NS_IMETHOD SetBackgroundColor(const nscolor &aColor)
-		{
-		nsBaseWidget::SetBackgroundColor( aColor );
-		if( mWidget ) PtSetResource( mWidget, Pt_ARG_FILL_COLOR, NS_TO_PH_RGB( aColor ), 0 );
-		return NS_OK;
-		}
-
-  NS_IMETHOD SetCursor(nsCursor aCursor);
-
-  inline NS_IMETHOD SetColorMap(nsColorMap *aColorMap) { return NS_OK; }
-
-  inline void* GetNativeData(PRUint32 aDataType) { return (void *)mWidget; }
-
-  NS_IMETHOD WidgetToScreen(const nsRect &aOldRect, nsRect &aNewRect);
-  NS_IMETHOD ScreenToWidget(const nsRect &aOldRect, nsRect &aNewRect);
-
-  // Use this to set the name of a widget for normal widgets.. not the same as the nsWindow version
-  inline NS_IMETHOD SetTitle(const nsAString& aTitle) { return NS_OK; }
-
-  inline void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY) { }
-
-  // the following are nsWindow specific, and just stubbed here
-  inline NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) { return NS_OK; }
-  inline NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy) { return NS_OK; }
- 
-  inline NS_IMETHOD SetMenuBar(nsIMenuBar *aMenuBar) { return NS_ERROR_FAILURE; }
-  inline NS_IMETHOD ShowMenuBar(PRBool aShow) { return NS_ERROR_FAILURE; }
-  // *could* be done on a widget, but that would be silly wouldn't it?
-  NS_IMETHOD CaptureMouse(PRBool aCapture) { return NS_ERROR_FAILURE; }
-
-
-  NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
-  NS_IMETHOD InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSynchronous);
-  inline NS_IMETHOD Update(void)
-		{
-		/* if the widget has been invalidated or damaged then re-draw it */
-		PtFlush();
-		return NS_OK;
-		}
-
-  NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
-
-  inline void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull)
-		{
-		if( aPoint == nsnull ) {
-		  event.refPoint.x = 0;
-		  event.refPoint.y = 0;
-		  }
-		else {
-		  event.refPoint.x = aPoint->x;
-		  event.refPoint.y = aPoint->y;
-		  }
-		event.widget = this;
-		event.time = PR_IntervalNow();
-		event.message = aEventType;
-		}
-
-  // Utility functions
-
-  inline PRBool     ConvertStatus(nsEventStatus aStatus)
-		{
-		return aStatus == nsEventStatus_eConsumeNoDefault;
-		}
-
-  PRBool     DispatchMouseEvent(nsMouseEvent& aEvent);
-  inline PRBool     DispatchStandardEvent(PRUint32 aMsg)
-		{
-		nsGUIEvent event(PR_TRUE, 0, nsnull);
-		InitEvent(event, aMsg);
-		return DispatchWindowEvent(&event);
-		}
-
-  // are we a "top level" widget?
-  PRBool     mIsToplevel;
-
-  // Set/Get the Pt_ARG_USER_DATA associated with each PtWidget_t *
-  // this is always set to the "this" that owns the PtWidget_t
-  static inline void SetInstance( PtWidget_t *pWidget, nsWidget * inst ) { PtSetResource( pWidget, Pt_ARG_POINTER, (void *)inst, 0 ); }
-  static inline nsWidget*  GetInstance( PtWidget_t *pWidget )
-		{
-		nsWidget *data;
-		PtGetResource( pWidget, Pt_ARG_POINTER, &data, 0 );
-		return data;
-		}
-
-protected:
-  NS_IMETHOD CreateNative(PtWidget_t *parentWindow) { return NS_OK; }
-
-  inline PRBool DispatchWindowEvent(nsGUIEvent* event)
-		{
-		nsEventStatus status;
-		DispatchEvent(event, status);
-		return ConvertStatus(status);
-		}
-
-#ifdef PHOTON_DND
-	void DispatchDragDropEvent( PhEvent_t *phevent, PRUint32 aEventType, PhPoint_t *pos );
-	void ProcessDrag( PhEvent_t *event, PRUint32 aEventType, PhPoint_t *pos );
-#endif
-
-  // this is the "native" destroy code that will destroy any
-  // native windows / widgets for this logical widget
-  virtual void DestroyNative(void);
-
-  //////////////////////////////////////////////////////////////////
-  //
-  // Photon event support methods
-  //
-  //////////////////////////////////////////////////////////////////
-  static int      RawEventHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-  inline PRBool		HandleEvent( PtWidget_t *, PtCallbackInfo_t* aCbInfo );
-  PRBool          DispatchKeyEvent(PhKeyEvent_t *aPhKeyEvent);
-
-  inline void ScreenToWidgetPos( PhPoint_t &pt )
-		{
-		// pt is in screen coordinates - convert it to be relative to ~this~ widgets origin
-		short x, y;
-		PtGetAbsPosition( mWidget, &x, &y );
-		pt.x -= x; pt.y -= y;
-		}
-
-	inline void InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, nsKeyEvent &anEvent );
-	inline void InitKeyPressEvent(PhKeyEvent_t *aPhKeyEvent, nsKeyEvent &anEvent );
-  void InitMouseEvent( PhPointerEvent_t * aPhButtonEvent,
-                       nsWidget         * aWidget,
-                       nsMouseEvent     & anEvent,
-                       PRUint32         aEventType,
-                       PRInt16          aButton);
-
-
-  /* Convert Photon key codes to Mozilla key codes */
-  PRUint32 nsConvertKey( PhKeyEvent_t *aPhKeyEvent );
-
-#if 0
-  //Enable/Disable Photon Damage		  
-	inline void EnableDamage( PtWidget_t *widget, PRBool enable )
-		{
-		PtWidget_t *top = PtFindDisjoint( widget );
-		if( top ) {
-			if( PR_TRUE == enable ) PtEndFlux( top );
-			else PtStartFlux( top );
-			}
-		}
-#endif
-
-
-  //////////////////////////////////////////////////////////////////
-  //
-  // Photon widget callbacks
-  //
-  //////////////////////////////////////////////////////////////////
-  static int  GotFocusCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-  static int  LostFocusCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-  static int  DestroyedCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-#ifdef PHOTON_DND
-  static int  DndCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-#endif
-
-  PtWidget_t          *mWidget;
-  nsIWidget						*mParent;
-  PRBool mShown;
-
-  PRBool       mListenForResizes;
-   
-  // Focus used global variable
-  static nsWidget* sFocusWidget; //Current Focus Widget
-  
-  static nsILookAndFeel *sLookAndFeel;
-#ifdef PHOTON_DND
-	static nsIDragService *sDragService;
-#endif
-	static nsClipboard *sClipboard;
-  static PRUint32 sWidgetCount;
-};
-
-#endif /* nsWidget_h__ */
deleted file mode 100644
--- a/widget/src/photon/nsWidgetFactory.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Christopher Blizzzard <blizzard@mozilla.org>
- *   Stuart Parmenter <pavlov@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsIGenericFactory.h"
-#include "nsIModule.h"
-#include "nsCOMPtr.h"
-#include "nsWidgetsCID.h"
-
-#include "nsWindow.h"
-#include "nsAppShell.h"
-#include "nsToolkit.h"
-#include "nsLookAndFeel.h"
-#include "nsTransferable.h"
-#include "nsClipboard.h"
-#include "nsClipboardHelper.h"
-#include "nsHTMLFormatConverter.h"
-#ifdef PHOTON_DND
-#include "nsDragService.h"
-#endif
-#include "nsSound.h"
-#ifdef IBMBIDI
-#include "nsBidiKeyboard.h"
-#endif
-
-#include "nsFilePicker.h"
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
-NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
-#ifdef PHOTON_DND
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
-#endif
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
-
-#ifdef IBMBIDI
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
-#endif
-
-static const nsModuleComponentInfo components[] =
-{
-  { "Ph nsWindow",
-    NS_WINDOW_CID,
-    "@mozilla.org/widgets/window/ph;1",
-    nsWindowConstructor },
-  { "Ph Child nsWindow",
-    NS_CHILD_CID,
-    "@mozilla.org/widgets/child_window/ph;1",
-    ChildWindowConstructor },
-  { "Ph AppShell",
-    NS_APPSHELL_CID,
-    "@mozilla.org/widget/appshell/ph;1",
-    nsAppShellConstructor },
-  { "Ph Toolkit",
-    NS_TOOLKIT_CID,
-    "@mozilla.org/widget/toolkit/ph;1",
-    nsToolkitConstructor },
-  { "Ph Look And Feel",
-    NS_LOOKANDFEEL_CID,
-    "@mozilla.org/widget/lookandfeel;1",
-    nsLookAndFeelConstructor },
-  { "Transferrable",
-    NS_TRANSFERABLE_CID,
-    "@mozilla.org/widget/transferable;1",
-    nsTransferableConstructor },
-  { "Ph Clipboard",
-    NS_CLIPBOARD_CID,
-    "@mozilla.org/widget/clipboard;1",
-    nsClipboardConstructor },
-  { "Clipboard Helper",
-    NS_CLIPBOARDHELPER_CID,
-    "@mozilla.org/widget/clipboardhelper;1",
-    nsClipboardHelperConstructor },
-  { "HTML Format Converter",
-    NS_HTMLFORMATCONVERTER_CID,
-    "@mozilla.org/widget/htmlformatconverter;1",
-    nsHTMLFormatConverterConstructor },
-#ifdef PHOTON_DND
-  { "Ph Drag Service",
-    NS_DRAGSERVICE_CID,
-    "@mozilla.org/widget/dragservice;1",
-    nsDragServiceConstructor },
-#endif
-  { "Ph Sound",
-    NS_SOUND_CID,
-    "@mozilla.org/sound;1",
-    nsSoundConstructor },
-#ifdef IBMBIDI
-    { "Gtk Bidi Keyboard",
-    NS_BIDIKEYBOARD_CID,
-    "@mozilla.org/widget/bidikeyboard;1",
-    nsBidiKeyboardConstructor },
-#endif // IBMBIDI
-
-  { "Photon File Picker",
-    NS_FILEPICKER_CID,
-    "@mozilla.org/filepicker;1",
-    nsFilePickerConstructor },
-};
-
-static void
-nsWidgetPhModuleDtor(nsIModule *self)
-{
-//	nsPhIMEHelper::Shutdown();
-}
-
-NS_IMPL_NSGETMODULE_WITH_DTOR(nsWidgetPhModule,
-							components,
-							nsWidgetPhModuleDtor)
deleted file mode 100644
--- a/widget/src/photon/nsWindow.cpp
+++ /dev/null
@@ -1,1021 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Jerry.Kirk@Nexwarecorp.com
- *   Dale.Stansberry@Nexwarecorop.com
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-#include <Pt.h>
-#include <photon/PtServer.h>
-#include "PtRawDrawContainer.h"
-#include "nsCRT.h"
-
-#include "nsWindow.h"
-#include "nsWidgetsCID.h"
-#include "nsIFontMetrics.h"
-#include "nsFont.h"
-#include "nsGUIEvent.h"
-#include "nsIRenderingContext.h"
-#include "nsIRegion.h"
-#include "nsRect.h"
-#include "nsTransform2D.h"
-#include "nsGfxCIID.h"
-#include "nsToolkit.h"
-#include "nsIPrefBranch.h"
-#include "nsIPrefService.h"
-
-#include "nsClipboard.h"
-#include "nsIRollupListener.h"
-#include "nsIMenuRollup.h"
-
-#include "nsIServiceManager.h"
-#include "nsIAppShell.h"
-#include "nsIDocShell.h"
-
-#include "nsIViewManager.h"
-#include "nsIXULWindow.h"
-#include "nsIDocShellTreeItem.h"
-#include "nsIWindowMediator.h"
-#include "nsIPresShell.h"
-#include "nsReadableUtils.h"
-
-static PhTile_t *GetWindowClipping( PtWidget_t *aWidget );
-
-nsIRollupListener *nsWindow::gRollupListener = nsnull;
-nsIMenuRollup     *nsWindow::gMenuRollup = nsnull;
-nsIWidget         *nsWindow::gRollupWidget = nsnull;
-static PtWidget_t	*gMenuRegion;
-
-/* avoid making a costly PhWindowQueryVisible call */
-static PhRect_t gConsoleRect;
-static PRBool gConsoleRectValid = PR_FALSE;
-#define QueryVisible( )	{\
-													if( gConsoleRectValid == PR_FALSE ) { \
-															PhWindowQueryVisible( Ph_QUERY_IG_POINTER, 0, 1, &gConsoleRect ); \
-															gConsoleRectValid = PR_TRUE;\
-															} \
-													}
-
-//-------------------------------------------------------------------------
-//
-// nsWindow constructor
-//
-//-------------------------------------------------------------------------
-nsWindow::nsWindow() 
-{
-  mClientWidget    = nsnull;
-  mIsTooSmall      = PR_FALSE;
-  mIsDestroying    = PR_FALSE;
-  mBorderStyle     = eBorderStyle_default;
-  mWindowType      = eWindowType_child;
-	mLastMenu				 = nsnull;
-}
-
-//-------------------------------------------------------------------------
-//
-// nsWindow destructor
-//
-//-------------------------------------------------------------------------
-nsWindow::~nsWindow()
-{
-	nsWindow *p = (nsWindow*)mParent;
-	if( p && p->mLastMenu == mWidget ) p->mLastMenu = nsnull;
-
-  // always call destroy.  if it's already been called, there's no harm
-  // since it keeps track of when it's already been called.
-  Destroy();
-}
-
-PRBool nsWindow::IsChild() const
-{
-  return PR_FALSE;
-}
-
-NS_IMETHODIMP nsWindow::WidgetToScreen( const nsRect& aOldRect, nsRect& aNewRect ) {
-
-	PhPoint_t pos, offset;
-	PtWidget_t *disjoint = PtFindDisjoint( mWidget );
-
-	QueryVisible( );
-
-	PtGetAbsPosition( disjoint, &pos.x, &pos.y );
-	PtWidgetOffset( mWidget, &offset );
-	aNewRect.x = pos.x + offset.x + aOldRect.x - gConsoleRect.ul.x;
-	aNewRect.y = pos.y + offset.y + aOldRect.y - gConsoleRect.ul.y;
-
-	aNewRect.width = aOldRect.width;
-	aNewRect.height = aOldRect.height;
-
-  return NS_OK;
-	}
-
-void nsWindow::DestroyNative(void)
-{
-  if ( mClientWidget )
-  {
-    PtDestroyWidget(mClientWidget );  
-    mClientWidget = nsnull;
-  }
-  // destroy all of the children that are nsWindow() classes
-  // preempting the gdk destroy system.
-  if( mWidget ) DestroyNativeChildren();
-
-  // Call the base class to actually PtDestroy mWidget.
-  nsWidget::DestroyNative();
-}
-
-// this function will walk the list of children and destroy them.
-// the reason why this is here is that because of the superwin code
-// it's very likely that we will never get notification of the
-// the destruction of the child windows.  so, we have to beat the
-// layout engine to the punch.  CB 
-
-void nsWindow::DestroyNativeChildren(void)
-{
-  for(PtWidget_t *w=PtWidgetChildFront( mWidget ); w; w=PtWidgetBrotherBehind( w )) 
-  {
-	  if( w->flags & Pt_DESTROYED ) continue;
-	  nsWindow *childWindow = static_cast<nsWindow *>(GetInstance(w));
-		if( childWindow && !childWindow->mIsDestroying) childWindow->Destroy();
-  }
-}
-
-NS_IMETHODIMP nsWindow::CaptureRollupEvents( nsIRollupListener * aListener,
-                                             nsIMenuRollup * aMenuRollup,
-                                             PRBool aDoCapture,
-                                             PRBool aConsumeRollupEvent )
-{
-  PtWidget_t *grabWidget;
-  grabWidget = mWidget;
-
-  if (aDoCapture) {
-    gRollupListener = nsnull;
-    NS_IF_RELEASE(gRollupWidget);
-    gRollupListener = aListener;
-    NS_IF_RELEASE(gMenuRollup);
-    gMenuRollup = aMenuRollup;
-    NS_IF_ADDREF(aMenuRollup);
-    gRollupWidget = this;
-    NS_ADDREF(this);
-	
-		/* Realize the gMenuRegion to capture events outside of the application's canvas when menus are displayed */
-		/* Menus+submenus have the same parent. If the parent has mLastMenu set and realized, then use its region as "infront" */
-		/* If not, then this widget ( mWidget ) becomes the mLastMenu and gets recorded into the parent */
-		/* Different windows have different mLastMenu's */
-		if( mWindowType == eWindowType_popup && !( PtWidgetFlags( gMenuRegion ) & Pt_REALIZED ) && mParent ) {
-
-			PtWidget_t *pw = ((nsWindow*)mParent)->mLastMenu;
-
-			if( pw && ( PtWidgetFlags( pw ) & Pt_REALIZED ) && PtWidgetRid( pw ) > 0 )
-				PtSetResource( gMenuRegion, Pt_ARG_REGION_INFRONT, PtWidgetRid( pw ), 0 );
-			else {
-				if( !PtWidgetIsRealized( mWidget ) ) PtRealizeWidget( mWidget );
-				PtSetResource( gMenuRegion, Pt_ARG_REGION_INFRONT, PtWidgetRid( mWidget ), 0 );
-				((nsWindow*)mParent)->mLastMenu = mWidget;
-				}
-
-			PtRealizeWidget( gMenuRegion );
-			}
-  	}
-	else {
-    gRollupListener = nsnull;
-    NS_IF_RELEASE(gMenuRollup);
-    NS_IF_RELEASE(gRollupWidget);
-		gRollupWidget = nsnull;
-
-		if( mWindowType == eWindowType_popup && ( PtWidgetFlags( gMenuRegion ) & Pt_REALIZED ) )
-			PtUnrealizeWidget( gMenuRegion );
-  	}
-  
-  return NS_OK;
-}
-
-//-------------------------------------------------------------------------
-//
-// Create the native widget
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsWindow::CreateNative( PtWidget_t *parentWidget ) {
-  PtArg_t   arg[25];
-  int       arg_count = 0;
-  PhPoint_t pos;
-  PhDim_t   dim;
-  unsigned  long render_flags;
-  nsresult  result = NS_ERROR_FAILURE;
-
-  pos.x = mBounds.x;
-  pos.y = mBounds.y;
-  dim.w = mBounds.width;
-  dim.h = mBounds.height;
-
-  switch( mWindowType )
-  {
-  case eWindowType_popup :
-    mIsToplevel = PR_TRUE;
-    break;
-  case eWindowType_toplevel :
-  case eWindowType_invisible :
-    mIsToplevel = PR_TRUE;
-    break;
-  case eWindowType_dialog :
-    mIsToplevel = PR_TRUE;
-    break;
-  case eWindowType_plugin :
-  case eWindowType_child :
-    mIsToplevel = PR_FALSE;
-    break;
-  }
-	
-  if ( mWindowType == eWindowType_child ||
-       mWindowType == eWindowType_plugin )
-  {
-	arg_count = 0;
-    PtSetArg( &arg[arg_count++], Pt_ARG_POS, &pos, 0 );
-    PtSetArg( &arg[arg_count++], Pt_ARG_DIM, &dim, 0 );
-    PtSetArg( &arg[arg_count++], Pt_ARG_RESIZE_FLAGS, 0, Pt_RESIZE_XY_BITS );
-    PtSetArg( &arg[arg_count++], Pt_ARG_FLAGS, 0 , Pt_HIGHLIGHTED|Pt_GETS_FOCUS );
-    PtSetArg( &arg[arg_count++], Pt_ARG_BORDER_WIDTH, 0, 0 );
-    PtSetArg( &arg[arg_count++], Pt_ARG_FILL_COLOR, Pg_RED, 0 );
-    PtSetArg( &arg[arg_count++], RDC_DRAW_FUNC, RawDrawFunc, 0 );
-    mWidget = PtCreateWidget( PtRawDrawContainer, parentWidget, arg_count, arg );
-  }
-  else
-  {
-    // No border or decorations is the default
-    render_flags = 0; // Ph_WM_RENDER_RESIZE;
-
-    if( mWindowType != eWindowType_popup ) {
-
-      #define PH_BORDER_STYLE_ALL  \
-        Ph_WM_RENDER_TITLE | \
-        Ph_WM_RENDER_CLOSE | \
-        Ph_WM_RENDER_BORDER | \
-        Ph_WM_RENDER_RESIZE | \
-        Ph_WM_RENDER_MAX | \
-        Ph_WM_RENDER_MIN | \
-        Ph_WM_RENDER_MENU
-
-
-      if( mBorderStyle & eBorderStyle_all )	render_flags |= PH_BORDER_STYLE_ALL;
-      else
-      {
-        if( mBorderStyle & eBorderStyle_border )		render_flags |= Ph_WM_RENDER_BORDER;
-        if( mBorderStyle & eBorderStyle_title )			render_flags |= ( Ph_WM_RENDER_TITLE | Ph_WM_RENDER_BORDER );
-        if( mBorderStyle & eBorderStyle_close )			render_flags |= Ph_WM_RENDER_CLOSE;
-        if( mBorderStyle & eBorderStyle_menu )			render_flags |= Ph_WM_RENDER_MENU;
-        if( mBorderStyle & eBorderStyle_resizeh )		render_flags |= Ph_WM_RENDER_RESIZE;
-        if( mBorderStyle & eBorderStyle_minimize )		render_flags |= Ph_WM_RENDER_MIN;
-        if( mBorderStyle & eBorderStyle_maximize )		render_flags |= Ph_WM_RENDER_MAX;
-      }
-    }
-	arg_count = 0;
-    if (mWindowType == eWindowType_dialog)
-    {
-    	// center on parent
-    	if (parentWidget)
-    	{
-    		PtCalcAbsPosition(parentWidget, NULL, &dim, &pos);
-	    	PtSetArg( &arg[arg_count++], Pt_ARG_POS, &pos, 0 );
-    	}
-	}
-    else if ((mWindowType == eWindowType_toplevel) && parentWidget)
-    {
-			QueryVisible( );
-      pos.x += gConsoleRect.ul.x;
-      pos.y += gConsoleRect.ul.y;
-    	PtSetArg( &arg[arg_count++], Pt_ARG_POS, &pos, 0 );
-    }
-
-    PtSetArg( &arg[arg_count++], Pt_ARG_DIM, &dim, 0 );
-    PtSetArg( &arg[arg_count++], Pt_ARG_RESIZE_FLAGS, 0, Pt_RESIZE_XY_BITS );
-
-    /* Create Pop-up Menus as a PtRegion */
-
-    if (!parentWidget)
-      PtSetParentWidget( nsnull );
-		
-    if( mWindowType == eWindowType_popup ) {
-
-			/* the gMenuRegion is used to capture events outside of the application's canvas when menus are displayed */
-			if( !gMenuRegion ) {
-				PtArg_t args[10];
-				PtSetParentWidget( NULL );
-				PtSetArg( &args[0], Pt_ARG_REGION_PARENT, 0, 0 );
-	  		PtSetArg( &args[1], Pt_ARG_FILL_COLOR, Pg_TRANSPARENT, 0);
-				PhArea_t area = { { 0, 0 }, { SHRT_MAX, SHRT_MAX } };
-				PtSetArg( &args[2], Pt_ARG_AREA, &area, 0 );
-				PtSetArg( &args[3], Pt_ARG_REGION_SENSE, Ph_EV_BUT_PRESS, Ph_EV_BUT_PRESS );
-				PtSetArg( &args[4], Pt_ARG_REGION_FLAGS, Ph_FORCE_BOUNDARY, Ph_FORCE_BOUNDARY );
-				PtSetArg( &args[5], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_POINTER, 0 );
-				gMenuRegion = PtCreateWidget( PtRegion, NULL, 6, args );
-				PtAddEventHandler( gMenuRegion, Ph_EV_BUT_PRESS, MenuRegionCallback, this );
-				}
-
-	  	int	fields = Ph_REGION_PARENT|Ph_REGION_HANDLE| Ph_REGION_FLAGS|Ph_REGION_ORIGIN|Ph_REGION_EV_SENSE|Ph_REGION_EV_OPAQUE|Ph_REGION_RECT;
-	  	int sense =  Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_BUT_REPEAT;
-			PtCallback_t cb_destroyed = { MenuRegionDestroyed, NULL };
-
-      PtSetArg( &arg[arg_count++], Pt_ARG_REGION_FIELDS,   fields, fields );
-      PtSetArg( &arg[arg_count++], Pt_ARG_REGION_PARENT,   Ph_ROOT_RID, 0 );
-      PtSetArg( &arg[arg_count++], Pt_ARG_REGION_SENSE,    sense | Ph_EV_DRAG|Ph_EV_EXPOSE, sense | Ph_EV_DRAG|Ph_EV_EXPOSE);
-      PtSetArg( &arg[arg_count++], Pt_ARG_REGION_OPAQUE,   sense | Ph_EV_DRAG|Ph_EV_EXPOSE|Ph_EV_DRAW|Ph_EV_BLIT, sense |Ph_EV_DRAG|Ph_EV_EXPOSE|Ph_EV_DRAW|Ph_EV_BLIT);
-      PtSetArg( &arg[arg_count++], Pt_ARG_FLAGS, Pt_DELAY_REALIZE, Pt_GETS_FOCUS | Pt_DELAY_REALIZE);
-			PtSetArg( &arg[arg_count++], Pt_CB_DESTROYED, &cb_destroyed, 0 );
-      mWidget = PtCreateWidget( PtRegion, parentWidget, arg_count, arg);
-
-    	// Must also create the client-area widget
-      arg_count = 0;
-      PtSetArg( &arg[arg_count++], Pt_ARG_ANCHOR_FLAGS, Pt_ANCHOR_ALL, ~0 );
-      PtSetArg( &arg[arg_count++], Pt_ARG_BORDER_WIDTH, 0 , 0 );
-      PtSetArg( &arg[arg_count++], Pt_ARG_MARGIN_WIDTH, 0 , 0 );
-      PhRect_t anch_offset = {{0, 0},{0, 0}};
-      PtSetArg( &arg[arg_count++], Pt_ARG_ANCHOR_OFFSETS, &anch_offset, 0 );
-
-      PtSetArg( &arg[arg_count++], RDC_DRAW_FUNC, RawDrawFunc, 0 );
-      PtSetArg( &arg[arg_count++], Pt_ARG_FLAGS, 0, (Pt_HIGHLIGHTED | Pt_GETS_FOCUS));
-      mClientWidget = PtCreateWidget( PtRawDrawContainer, mWidget, arg_count, arg );
-     }
-	else {
-		/* Dialog and TopLevel Windows */
-		PtSetArg( &arg[arg_count++], Pt_ARG_FLAGS, Pt_DELAY_REALIZE, Pt_DELAY_REALIZE);
-		PtSetArg( &arg[arg_count++], Pt_ARG_WINDOW_RENDER_FLAGS, render_flags, -1 );
-		PtSetArg( &arg[arg_count++], Pt_ARG_WINDOW_MANAGED_FLAGS, 0, Ph_WM_CLOSE );
-		PtSetArg( &arg[arg_count++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Ph_WM_CLOSE|Ph_WM_CONSWITCH|Ph_WM_FOCUS, ~0 );
-		PtSetArg( &arg[arg_count++], Pt_ARG_FILL_COLOR, Pg_TRANSPARENT, 0 );
-
-		PtRawCallback_t cb_raw = { Ph_EV_INFO, EvInfo, NULL };
-		PtCallback_t cb_resize = { ResizeHandler, NULL };
-		PtCallback_t cb_window = { WindowWMHandler, this };
-
-		PtSetArg( &arg[arg_count++], Pt_CB_RESIZE, &cb_resize, NULL );
-		PtSetArg( &arg[arg_count++], Pt_CB_RAW, &cb_raw, NULL );
-		PtSetArg( &arg[arg_count++], Pt_CB_WINDOW, &cb_window, 0 );
-		mWidget = PtCreateWidget( PtWindow, parentWidget, arg_count, arg );
-		}
-  }
-
-  if( mWidget ) {
-	  SetInstance( mWidget, this );
-	  if( mClientWidget ) SetInstance( mClientWidget, this );
-	  if( mWindowType == eWindowType_child ||
-	      mWindowType == eWindowType_plugin ) {
-      	PtAddCallback(mWidget, Pt_CB_RESIZE, ResizeHandler, nsnull ); 
-      	PtAddEventHandler( mWidget,
-      	  Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON |
-      	  Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY|Ph_EV_DRAG
-      	  , RawEventHandler, this );
-	
-    		PtArg_t arg;
-    		PtRawCallback_t callback;
-		
-				callback.event_mask = ( Ph_EV_KEY ) ;
-				callback.event_f = RawEventHandler;
-				callback.data = this;
-				PtSetArg( &arg, Pt_CB_FILTER, &callback, 0 );
-				PtSetResources( mWidget, 1, &arg );
-    		}
-    else if( mWindowType == eWindowType_popup ) {
-      		PtAddEventHandler( mClientWidget,
-      			 	Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON | 
-      		  	Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY,
-      			  RawEventHandler, this );
-
-      		PtAddEventHandler( mWidget, Ph_EV_DRAG, RawEventHandler, this );
-
-      		PtArg_t arg;
-      		PtRawCallback_t callback;
-		
-					callback.event_mask = ( Ph_EV_KEY ) ;
-					callback.event_f = RawEventHandler;
-					callback.data = this;
-					PtSetArg( &arg, Pt_CB_FILTER, &callback, 0 );
-					PtSetResources( mClientWidget, 1, &arg );
-			
-    		  PtAddCallback(mClientWidget, Pt_CB_RESIZE, ResizeHandler, nsnull ); 
-					}
-    else if( !parentWidget ) {
-       if( mClientWidget ) PtAddCallback(mClientWidget, Pt_CB_RESIZE, ResizeHandler, nsnull );
-    	}
-
-    // call the event callback to notify about creation
-    DispatchStandardEvent( NS_CREATE );
-
-    result = NS_OK;
-  	}
-
-  /* force SetCursor to actually set the cursor, even though our internal state indicates that we already
-     have the standard cursor */
-  mCursor = eCursor_wait;
-  SetCursor( mCursor );
-
-  return result;
-	}
-
-
-//-------------------------------------------------------------------------
-//
-// Return some native data according to aDataType
-//
-//-------------------------------------------------------------------------
-void *nsWindow::GetNativeData(PRUint32 aDataType)
-{
-  switch(aDataType)
-  {
-  case NS_NATIVE_WINDOW:
-    if( !mWidget )	return (void *)mWidget;
-
-  case NS_NATIVE_WIDGET:
-		if (mClientWidget)	return (void *) mClientWidget;
-		else	return (void *) mWidget;
-  }
-  	  	
-  return nsWidget::GetNativeData(aDataType);
-}
-
-//-------------------------------------------------------------------------
-//
-// Scroll the bits of a window
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsWindow::Scroll( PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect ) {
-	PtWidget_t  *widget = (PtWidget_t *)GetNativeData(NS_NATIVE_WIDGET);
-
-	/* If aDx and aDy are 0 then skip it or if widget == null */
-	if( ( !aDx && !aDy ) || (!widget )) return NS_OK;
-
-	PtStartFlux( widget );
-
-	PtWidget_t *w;
-	for( w=PtWidgetChildFront( widget ); w; w=PtWidgetBrotherBehind( w )) {
-		PtArg_t arg;
-		PhPoint_t  p;
-		p.x = w->area.pos.x + aDx;
-		p.y = w->area.pos.y + aDy;
-
-		PtSetArg( &arg, Pt_ARG_POS, &p, 0 );
-		PtSetResources( w, 1, &arg ) ;
-
-		nsWindow *pWin = (nsWindow *) GetInstance(w);
-		if (pWin) {
-			pWin->mBounds.x += aDx;
-			pWin->mBounds.y += aDy;
-			}
-		}
-
-	PtEndFlux( widget);
-
-	PhRect_t source = {{widget->area.pos.x, widget->area.pos.y},{widget->area.pos.x+ widget->area.size.w-1, widget->area.pos.y + widget->area.size.h-1}};
-	PhPoint_t point = { aDx, aDy };
-
-	if( !widget->damage_list )
-		PtBlit( widget, &source, &point );
-	else {
-		/* first noticed as a scrolling problem in netscape email */
-		/* the scrolling should be clipped out by the rectangles given by Invalidate(). These are accumulated in widget->damage_list */
-		PhTile_t original = { source, NULL }, *clip;
-
-		clip = PhGetTile();
-		clip->rect = source;
-		clip->next = NULL;
-		clip = PhClipTilings( clip, widget->damage_list, NULL );
-
-		if( clip ) {
-			PtClippedBlit( widget, &original, &point, clip );
-			PhFreeTiles( clip );
-			}
-		}
-  
-	return NS_OK;
-	}
-
-NS_METHOD nsWindow::ScrollWidgets( PRInt32 aDx, PRInt32 aDy ) {
-	PtWidget_t  *widget = (PtWidget_t *)GetNativeData(NS_NATIVE_WIDGET);
-
-	if( ( !aDx && !aDy ) || (!widget )) return NS_OK;
-
-	PtStartFlux( widget );
-
-	PtWidget_t *w;
-	for( w=PtWidgetChildFront( widget ); w; w=PtWidgetBrotherBehind( w )) {
-		PtArg_t arg;
-		PhPoint_t  p;
-		p.x = w->area.pos.x + aDx;
-		p.y = w->area.pos.y + aDy;
-		PtSetArg( &arg, Pt_ARG_POS, &p, 0 );
-		PtSetResources( w, 1, &arg ) ;
-
-		nsWindow *pWin = (nsWindow *) GetInstance(w);
-		if (pWin) {
-			pWin->mBounds.x += aDx;
-			pWin->mBounds.y += aDy;
-			}
-		}
-
-	PtEndFlux( widget);
-	return NS_OK;    
-	}
-
-NS_METHOD nsWindow::SetTitle( const nsAString& aTitle ) {
-  if( mWidget ) {
-  	char * title = ToNewUTF8String(aTitle);
-    PtSetResource( mWidget, Pt_ARG_WINDOW_TITLE, title, 0 );
-  	if (title) nsCRT::free(title);
-		}
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
-{
-	PRBool nNeedToShow = PR_FALSE;
-	
-	if( aWidth == mBounds.width && aHeight == mBounds.height ) return NS_OK;
-	
-	mBounds.width  = aWidth;
-	mBounds.height = aHeight;
-	
-	// code to keep the window from showing before it has been moved or resized
-	// if we are resized to 1x1 or less, we will hide the window.  Show(TRUE) will be ignored until a larger resize has happened
-	if( aWidth <= 1 || aHeight <= 1 ) {
-		aWidth = aHeight = 1;
-		mIsTooSmall = PR_TRUE;
-		}
-	else {
-		if( mIsTooSmall ) {
-			// if we are not shown, we don't want to force a show here, so check and see if Show(TRUE) has been called
-			nNeedToShow = mShown;
-			mIsTooSmall = PR_FALSE;
-			}
-		}
-	
-	PhDim_t  dim = { aWidth, aHeight };
-	
-	if( mWidget ) {
-		// center the dialog
-		if( mWindowType == eWindowType_dialog ) {
-			PhPoint_t p;
-			QueryVisible( );
-			PtCalcAbsPosition( NULL, NULL, &dim, &p );
-			p.x -= gConsoleRect.ul.x;
-			p.y -= gConsoleRect.ul.y;
-			Move(p.x, p.y); // the move should be in coordinates assuming the console is 0, 0
-			}
-		if( aRepaint == PR_FALSE )  PtStartFlux(mWidget);
-		PtSetResource( mWidget, Pt_ARG_DIM, &dim, 0 );
-		if( aRepaint == PR_FALSE ) PtEndFlux(mWidget);
-
-		/* ATENTIE Remove when wojtek fixes PR:22930 in the photon library */
-		if( PtWidgetClass( mWidget ) == PtRegion ) PtSetResource( mWidget, Pt_ARG_REGION_OPAQUE, 0, Ph_EV_KEY );
-		}
-
-	if( mIsToplevel || mListenForResizes ) {
-		nsSizeEvent sevent(PR_TRUE, 0, nsnull);
-		sevent.message = NS_SIZE;
-		sevent.widget = this;
-		
-		sevent.windowSize = new nsRect (0, 0, aWidth, aHeight); 	
-		
-		sevent.refPoint.x = 0;
-		sevent.refPoint.y = 0;
-		sevent.mWinWidth = aWidth;
-		sevent.mWinHeight = aHeight;
-		// XXX fix this
-		sevent.time = 0;
-		AddRef();
-		DispatchWindowEvent(&sevent);
-		Release();
-		delete sevent.windowSize;
-		}
-	if( nNeedToShow ) Show(PR_TRUE);
-	return NS_OK;
-}
-
-int nsWindow::WindowWMHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) 
-{
-	PhWindowEvent_t *we = (PhWindowEvent_t *) cbinfo->cbdata;
-	switch( we->event_f ) {
-		case Ph_WM_CLOSE:
-		  {
-				nsWindow * win = (nsWindow*) data;
-			  NS_ADDREF(win);
-			  
-			  // dispatch an "onclose" event. to delete immediately, call win->Destroy()
-			  nsGUIEvent event(PR_TRUE, 0, nsnull);
-			  nsEventStatus status;
-			  
-			  event.message = NS_XUL_CLOSE;
-			  event.widget  = win;
-			  
-			  event.time = 0;
-			  event.refPoint.x = 0;
-			  event.refPoint.y = 0;
-			  
-			  win->DispatchEvent(&event, status);
-			  
-			  NS_RELEASE(win);
-		  }
-		break;
-
-		case Ph_WM_CONSWITCH:
-			gConsoleRectValid = PR_FALSE; /* force a call tp PhWindowQueryVisible() next time, since we might have moved this window into a different console */
-      /* rollup the menus */
-      if( gRollupWidget && gRollupListener ) gRollupListener->Rollup(nsnull, nsnull);
-			break;
-
-		case Ph_WM_FOCUS:
-			if( we->event_state == Ph_WM_EVSTATE_FOCUSLOST ) {
-      	/* rollup the menus */
-      	if( gRollupWidget && gRollupListener ) gRollupListener->Rollup(nsnull, nsnull);
-
-				if( sFocusWidget ) sFocusWidget->DispatchStandardEvent(NS_DEACTIVATE);
-				}
-			break;
-	}
-	
-	return Pt_CONTINUE;
-}
-
-void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage )
-{
-  nsWindow  * pWin = (nsWindow*) GetInstance( pWidget );
-  nsresult    result;
-  PhTile_t  * dmg = NULL;
-  nsPaintEvent pev(PR_TRUE, 0, nsnull);
-  PhRect_t   extent;
-
-  if( !pWin || !pWin->mContext ) return;
-
-	if ( pWin->mEventCallback ) {
-		PhPoint_t  offset;
-		nsRect     nsDmg;
-
-		// Ok...  The damage rect is in window coordinates and is not neccessarily clipped to
-		// the widgets canvas. Mozilla wants the paint coords relative to the parent widget, not the window.
-		PtWidgetExtent(pWidget, &extent);
-		PtWidgetOffset(pWidget, &offset);
-		/* Build a List of Tiles that might be in front of me.... */
-		PhTile_t *new_damage, *clip_tiles, *intersect;
-		/* Intersect the Damage tile list w/ the clipped out list and see what's left! */
-		new_damage = PhRectsToTiles(&damage->rect, 1);
-		PhDeTranslateTiles(new_damage, &offset);
-		clip_tiles = GetWindowClipping( pWidget );
-		if (clip_tiles) {
-			new_damage = PhClipTilings( new_damage, clip_tiles, NULL);
-			PhFreeTiles(clip_tiles);
-		}
-		clip_tiles = PhRectsToTiles(&extent, 1);
-		intersect = PhIntersectTilings( new_damage, clip_tiles, NULL);
-		if ( intersect == NULL ) return;
-		PhDeTranslateTiles(intersect, &extent.ul);
-		PhFreeTiles(clip_tiles);
-		PhFreeTiles(new_damage);
-		new_damage = intersect;
-		
-		pWin->InitEvent(pev, NS_PAINT);
-		pev.region = nsnull;
-		pev.renderingContext = nsnull;
-		pev.renderingContext = pWin->GetRenderingContext();
-		for( dmg = new_damage; dmg; dmg = dmg->next ) {
-			nsDmg.x = dmg->rect.ul.x;
-			nsDmg.y = dmg->rect.ul.y;
-			nsDmg.width = dmg->rect.lr.x - dmg->rect.ul.x + 1;
-			nsDmg.height = dmg->rect.lr.y - dmg->rect.ul.y + 1;
-
-			if( (nsDmg.width <= 0 ) || (nsDmg.height <= 0 ) ) /* Move to the next Damage Tile */
-				continue;
-
-			/* Re-Setup Paint Event */
-			pWin->InitEvent(pev, NS_PAINT);
-			pev.refPoint.x = nsDmg.x;
-			pev.refPoint.y = nsDmg.y;
-			pev.rect = &nsDmg;
-			pev.region = nsnull;
-
-			if( pev.renderingContext ) {
-				nsIRegion *ClipRegion = pWin->GetRegion( );
-				ClipRegion->SetTo( nsDmg.x, nsDmg.y, nsDmg.width, nsDmg.height );
-				pev.renderingContext->SetClipRegion( static_cast<const nsIRegion &>(*(ClipRegion)), nsClipCombine_kReplace );
-
-				NS_RELEASE( ClipRegion );
-				
-				/* You can turn off most drawing if you take this out */
-				result = pWin->DispatchWindowEvent(&pev);
-			}
-		}
-		NS_RELEASE(pev.renderingContext);
-		PhFreeTiles( new_damage );
-	}
-}
-
-static PhTile_t *GetWindowClipping( PtWidget_t *aWidget ) {
-	PtWidget_t *w;
-	PhTile_t *clip_tiles = NULL, *last = NULL;
-	PhRect_t w_extent;
-
-	PtWidgetExtent( aWidget, &w_extent);
-	
-	for( w = PtWidgetChildFront( aWidget ); w; w=PtWidgetBrotherBehind( w ) ) {
-		long flags = PtWidgetFlags( w );
-		if( (flags & Pt_REALIZED) && (flags & Pt_OPAQUE) && !PtIsDisjoint(w) ) {
-			PhTile_t *tile = PhGetTile( );
-			if( !tile ) return NULL;
-
-			tile->rect.ul.x = w->area.pos.x + w_extent.ul.x;
-			tile->rect.ul.y = w->area.pos.y + w_extent.ul.y;
-			tile->rect.lr.x = tile->rect.ul.x + w->area.size.w - 1;
-			tile->rect.lr.y = tile->rect.ul.y + w->area.size.h - 1;
-
-			tile->next = NULL;
-			if( !clip_tiles ) clip_tiles = tile;
-			if( last ) last->next = tile;
-			last = tile;
-			}
-		}
-	return clip_tiles;
-	}
-
-int nsWindow::ResizeHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo )
-{
-  nsWindow *someWindow = (nsWindow *) GetInstance(widget);
-  if( someWindow ) {
-  	PtContainerCallback_t *cb = (PtContainerCallback_t *) cbinfo->cbdata;
-  	PhRect_t *extents = &cb->new_size;
-  	nsRect rect;
-		rect.x = extents->ul.x;
-    rect.y = extents->ul.y;
-    rect.width = extents->lr.x - rect.x + 1;
-    rect.height = extents->lr.y - rect.y + 1;
-
-    if( someWindow->mBounds.width == rect.width && someWindow->mBounds.height == rect.height )
-		  return Pt_CONTINUE;
-
-    someWindow->mBounds.width  = rect.width;
-    someWindow->mBounds.height = rect.height;
-
-    /* This enables the resize holdoff */
-    if( PtWidgetIsRealized( widget ) ) someWindow->OnResize( rect );
-  	}
-	return Pt_CONTINUE;
-}
-
-
-/* catch an Ph_EV_INFO event when the graphics mode has changed */
-int nsWindow::EvInfo( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) {
-
-	if( cbinfo->event && cbinfo->event->type == Ph_EV_INFO && cbinfo->event->subtype == Ph_OFFSCREEN_INVALID ) {
-		nsresult rv;
-		
-		nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
-		if (NS_SUCCEEDED(rv)) {
-			 PRBool displayInternalChange = PR_FALSE;
-			 pPrefs->GetBoolPref("browser.display.internaluse.graphics_changed", &displayInternalChange);
-			 pPrefs->SetBoolPref("browser.display.internaluse.graphics_changed", !displayInternalChange);
-		}
-		nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
-		NS_ENSURE_TRUE(windowMediator, NS_ERROR_FAILURE);
-
-		nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
-		NS_ENSURE_SUCCESS(windowMediator->GetXULWindowEnumerator(nsnull, getter_AddRefs(windowEnumerator)), NS_ERROR_FAILURE);
-
-		PRBool more;
-		windowEnumerator->HasMoreElements(&more);
-		while(more) {
-			nsCOMPtr<nsISupports> nextWindow = nsnull;
-			windowEnumerator->GetNext(getter_AddRefs(nextWindow));
-			nsCOMPtr<nsIXULWindow> xulWindow(do_QueryInterface(nextWindow));
-			NS_ENSURE_TRUE(xulWindow, NS_ERROR_FAILURE);
-	
-			nsCOMPtr<nsIDocShell> docShell;
-			xulWindow->GetDocShell(getter_AddRefs(docShell));
-
-			nsCOMPtr<nsIPresShell> presShell;
-			docShell->GetPresShell( getter_AddRefs(presShell) );
-
-			nsIViewManager* viewManager = presShell->GetViewManager();
-			NS_ENSURE_TRUE(viewManager, NS_ERROR_FAILURE);
-
-			windowEnumerator->HasMoreElements(&more);
-			}
-
-		PtDamageWidget( widget );
-		}
-	return Pt_CONTINUE;
-	}
-
-//-------------------------------------------------------------------------
-//
-// Move this component
-//
-//-------------------------------------------------------------------------
-NS_METHOD nsWindow::Move( PRInt32 aX, PRInt32 aY ) {
-
-	if( mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog ) {
-		SetSizeMode(nsSizeMode_Normal);
-		}
-
-	if( mWindowType != eWindowType_popup && (mBounds.x == aX) && (mBounds.y == aY) )
-		return NS_OK;
-
-	mBounds.x = aX;
-	mBounds.y = aY;
-
-	switch( mWindowType ) {
-		case eWindowType_popup:
-			{
-			PhPoint_t offset, total_offset = { 0, 0 };
-    
-			PtWidget_t *parent, *disjoint = PtFindDisjoint( mWidget->parent );
-
-			while( disjoint ) {
-				PtGetAbsPosition( disjoint, &offset.x, &offset.y );
-				total_offset.x += offset.x;
-				total_offset.y += offset.y;
-				if( PtWidgetIsClass( disjoint, PtWindow ) || PtWidgetIsClass( disjoint, PtServer ) ) break; /* Stop at the first PtWindow */
-				parent = PtWidgetParent(disjoint);
-				if( parent ) disjoint = PtFindDisjoint( parent );
-				else {
-					disjoint = parent;
-					break;
-					}           
-				}
-
-			aX += total_offset.x;
-			aY += total_offset.y;
-
-			/* Add the Offset if the widget is offset from its parent.. */
-			PtWidgetOffset( mWidget->parent, &offset );
-			aX += offset.x;
-			aY += offset.y;
-			}
-			break;
-
-		case eWindowType_dialog:
-		case eWindowType_toplevel:
-			/* Offset to the current virtual console */
-			QueryVisible( );
-			aX += gConsoleRect.ul.x;
-			aY += gConsoleRect.ul.y;
-			break;
-		}
-
-  if( mWidget ) {
-    if(( mWidget->area.pos.x != aX ) || ( mWidget->area.pos.y != aY )) {
-      PhPoint_t pos = { aX, aY };
-      PtSetResource( mWidget, Pt_ARG_POS, &pos, 0 );
-
-			/* ATENTIE Remove when wojtek fixes PR:22930 in the photon library */
-			if( PtWidgetClass( mWidget ) == PtRegion ) PtSetResource( mWidget, Pt_ARG_REGION_OPAQUE, 0, Ph_EV_KEY );
-    	}
-  	}
-
-	return NS_OK;
-	}
-
-int nsWindow::MenuRegionCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) {
-	if( gRollupWidget && gRollupListener ) {
-		/* rollup the menu */
-		gRollupListener->Rollup(nsnull, nsnull);
-		}
-	return Pt_CONTINUE;
-	}
-
-NS_IMETHODIMP nsWindow::SetModal( PRBool aModal ) {
-  nsresult res = NS_ERROR_FAILURE;
- 
-  if (!mWidget)
-	return NS_ERROR_FAILURE;
-
-  PtWidget_t *toplevel = PtFindDisjoint(mWidget);
-  if( !toplevel ) return NS_ERROR_FAILURE;
-
-  if( aModal ) {
-	  PtModalStart();
-	  res = NS_OK;
-  	}
-  else {
-		PtModalEnd();
-    res = NS_OK;
-  	}
-
-  return res;
-	}
-
-
-inline nsIRegion *nsWindow::GetRegion()
-{
-  nsIRegion *region = NULL;
-  nsresult res;
-
-  static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);
-
-  res = CallCreateInstance( kRegionCID, &region );
-  if (NS_SUCCEEDED(res)) region->Init();
-
-  NS_ASSERTION(NULL != region, "Null region context");
-  
-  return region;  
-}
-
-/*
-	widget is a PtRegion representing the native widget for a menu - reset the mParent->mLastMenu
-	since it points to an widget being destroyed
-*/
-int nsWindow::MenuRegionDestroyed( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo )
-{
-	nsWindow *pWin = (nsWindow *) GetInstance( widget );
-	if( pWin ) {
-		nsWindow *parent = ( nsWindow * ) pWin->mParent;
-		if( parent && parent->mLastMenu == widget )
-			parent->mLastMenu = nsnull;
-		}
-	return Pt_CONTINUE;
-}
-
-NS_IMETHODIMP nsWindow::SetFocus(PRBool aRaise)
-{
-	sFocusWidget = this;
-
-	if( PtIsFocused( mWidget ) == 2 ) return NS_OK;
-
-	if( mWidget ) {
-		PtWidget_t *disjoint;
-		disjoint = PtFindDisjoint( mWidget );
-		if( PtWidgetIsClass( disjoint, PtWindow ) ) {
-			if( !( PtWindowGetState( disjoint ) & Ph_WM_STATE_ISFOCUS ) ) {
-				nsWindow *pWin = (nsWindow *) GetInstance( disjoint );
-				pWin->GetAttention( -1 );
-				}
-			}
-		PtContainerGiveFocus( mWidget, NULL );
-		}
-	return NS_OK;
-}
-
-NS_IMETHODIMP nsWindow::MakeFullScreen(PRBool aFullScreen)
-{
-	/* we can use static data here because there can be only one full-screen window at a time */
-	static unsigned short old_render_flags;
-	static PhPoint_t old_pos;
-
-	PtArg_t args[3];
-
-	if( aFullScreen ) {
-		unsigned short p, *pflags;
-		PhArea_t area;
-
-		PtSetArg( &args[0], Pt_ARG_WINDOW_RENDER_FLAGS, &pflags, 0 );
-		PtGetResources( mWidget, 1, args );
-		p = old_render_flags = *pflags; // save the render flags
-		p &= ~(Ph_WM_RENDER_TITLE|Ph_WM_RENDER_BORDER);
-
-		PtWidgetArea( mWidget, &area );
-		old_pos = area.pos;
-
-		QueryVisible( );
-		PtSetArg( &args[0], Pt_ARG_POS, &gConsoleRect.ul, 0 );
-		PtSetArg( &args[1], Pt_ARG_WINDOW_RENDER_FLAGS, p, -1 );
-		PtSetArg( &args[2], Pt_ARG_WINDOW_STATE, Ph_WM_STATE_ISFRONT, Ph_WM_STATE_ISFRONT );
-		PtSetResources( mWidget, 3, args );
-		}
-	else {
-		PtSetArg( &args[0], Pt_ARG_POS, &old_pos, 0 );
-		PtSetArg( &args[1], Pt_ARG_WINDOW_RENDER_FLAGS, old_render_flags, -1 ); /* restore the render flags to the previous value */
-		PtSetArg( &args[2], Pt_ARG_WINDOW_STATE, Ph_WM_STATE_ISNORMAL, Ph_WM_STATE_ISFRONT|Ph_WM_STATE_ISNORMAL );
-		PtSetResources( mWidget, 3, args );
-		}
-
-	return nsBaseWidget::MakeFullScreen( aFullScreen );
-}
deleted file mode 100644
--- a/widget/src/photon/nsWindow.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsWindow_h__
-#define nsWindow_h__
-
-
-
-#include "nsISupports.h"
-
-#include "nsWidget.h"
-
-#include "nsString.h"
-
-#include <Pt.h>
-
-class nsFont;
-class nsIAppShell;
-
-#define NSRGB_2_COLOREF(color)				RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color))
-
-/**
- * Native Photon window wrapper. 
- */
-
-class nsWindow : public nsWidget
-{
-
-public:
-  // nsIWidget interface
-
-  nsWindow();
-  virtual ~nsWindow();
-
-  NS_IMETHOD           WidgetToScreen(const nsRect &aOldRect, nsRect &aNewRect);
-
-  virtual void*        GetNativeData(PRUint32 aDataType);
-
-  NS_IMETHOD           Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
-  NS_IMETHOD           ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
-  inline NS_IMETHOD    ScrollRect(nsRect &aSrcRect, PRInt32 aDx, PRInt32 aDy)
-		{
-		NS_WARNING("nsWindow::ScrollRect Not Implemented\n");
-		return NS_OK;
-		}
-
-  NS_IMETHOD           SetTitle(const nsAString& aTitle);
- 
-  NS_IMETHOD           Move(PRInt32 aX, PRInt32 aY);
-
-  NS_IMETHOD           Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
-  NS_IMETHOD           Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
-		{
-		Move(aX,aY);
-		Resize(aWidth,aHeight,aRepaint);
-		return NS_OK;
-		}
-
-  NS_IMETHOD           CaptureRollupEvents(nsIRollupListener * aListener,
-                                           nsIMenuRollup * aMenuRollup,
-                                           PRBool aDoCapture,
-                                           PRBool aConsumeRollupEvent);
-
-	NS_IMETHOD SetFocus(PRBool aRaise);
-
-  inline NS_IMETHOD    GetAttention(PRInt32 aCycleCount)
-		{
-		if( mWidget ) PtWindowToFront( mWidget );
-		return NS_OK;
-		}
-
-  virtual PRBool       IsChild() const;
-
-
-  // Utility methods
-  inline PRBool         OnKey(nsKeyEvent &aEvent)
-		{
-		if( mEventCallback ) return DispatchWindowEvent(&aEvent);
-		return PR_FALSE;
-		}
-
-  inline NS_IMETHOD			GetClientBounds( nsRect &aRect )
-		{
-		aRect.x = 0;
-		aRect.y = 0;
-		aRect.width = mBounds.width;
-		aRect.height = mBounds.height;
-		return NS_OK;
-		}
-
-  NS_IMETHOD            SetModal(PRBool aModal);
-	NS_IMETHOD            MakeFullScreen(PRBool aFullScreen);
-
- // Native draw function... like doPaint()
- static void            RawDrawFunc( PtWidget_t *pWidget, PhTile_t *damage );
-
- inline nsIRegion              *GetRegion();
-
-private:
-  // this is the "native" destroy code that will destroy any
-  // native windows / widgets for this logical widget
-  virtual void          DestroyNative(void);
-  void                  DestroyNativeChildren(void);
-
-  static int            MenuRegionCallback(PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo);  
-
-  NS_IMETHOD            CreateNative(PtWidget_t *parentWidget);
-
-  static int            ResizeHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-	static int            EvInfo( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-  static int            WindowWMHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-  static int            MenuRegionDestroyed( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo );
-
-  inline NS_IMETHOD     ModalEventFilter(PRBool aRealEvent, void *aEvent, PRBool *aForWindow)
-		{
-		*aForWindow = PR_TRUE;
-		return NS_OK;
-		}
-
-private:
-  PtWidget_t *mClientWidget, *mLastMenu;
-  PRBool mIsTooSmall;
-  PRBool mIsDestroying;
-	static nsIRollupListener *gRollupListener;
-	static nsIMenuRollup* gMenuRollup;
-	static nsIWidget *gRollupWidget;
-};
-
-//
-// A child window is a window with different style
-//
-class ChildWindow : public nsWindow {
-  public:
-    ChildWindow()
-			{
-			mBorderStyle     = eBorderStyle_none;
-			mWindowType      = eWindowType_child;
-			}
-    ~ChildWindow() { }
-	inline PRBool IsChild() const { return PR_TRUE; }
-};
-
-#endif // Window_h__
--- a/widget/src/xpwidgets/Makefile.in
+++ b/widget/src/xpwidgets/Makefile.in
@@ -70,17 +70,17 @@ CPPSRCS		= \
 		nsClipboardPrivacyHandler.cpp \
 		nsAccelerometer.cpp \
 		$(NULL)
 
 ifneq (,$(filter beos os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
 CPPSRCS += nsBaseClipboard.cpp
 endif
 
-ifneq (,$(filter beos qt gtk2 os2 cocoa photon windows,$(MOZ_WIDGET_TOOLKIT)))
+ifneq (,$(filter beos qt gtk2 os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
 CPPSRCS += nsBaseFilePicker.cpp
 endif
 
 ifneq (,$(filter qt gtk2 windows cocoa,$(MOZ_WIDGET_TOOLKIT)))
 CPPSRCS += nsNativeTheme.cpp
 endif
 
 LOCAL_INCLUDES	+= \
--- a/widget/src/xremoteclient/Makefile.in
+++ b/widget/src/xremoteclient/Makefile.in
@@ -48,53 +48,33 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= xremoteclient
 LIBRARY_NAME = xremote_client_s
 FORCE_STATIC_LIB = 1
 
 
 DEFINES += -DXPCOM_GLUE
 
-ifdef MOZ_ENABLE_PHOTON
-	CPPSRCS		+= PhRemoteClient.cpp
-else
-	CPPSRCS		+= XRemoteClient.cpp
-endif
+CPPSRCS		+= XRemoteClient.cpp
 
 EXTRA_DSO_LDOPTS = \
 		$(XLIBS) $(XLDFLAGS)  \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
 
-ifdef MOZ_ENABLE_PHOTON
-	EXTRA_DSO_LDOPTS += -lph
-endif
-
 PROGRAM         = mozilla-xremote-client$(BIN_SUFFIX)
 
 PROGOBJS        = mozilla-xremote-client.$(OBJ_SUFFIX) \
 		XRemoteClient_standalone.$(OBJ_SUFFIX) \
 		$(NULL)
 
 LIBS            = \
 		$(NSPR_LIBS) \
 		$(XLDFLAGS) $(XLIBS)
 
-ifdef MOZ_ENABLE_PHOTON
-	LIBS += -lph
-ifdef MOZ_DEBUG
-	LIBS += -lxpcom
-endif
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 ifeq ($(OS_ARCH), OpenVMS)
 DEFINES		+= -DGENERIC_MOTIF_REDEFINES
 endif
 
-ifndef MOZ_ENABLE_PHOTON
 XRemoteClient_standalone.$(OBJ_SUFFIX): XRemoteClient.cpp
 	$(CXX) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $<
-else
-XRemoteClient_standalone.$(OBJ_SUFFIX): PhRemoteClient.cpp
-	$(CXX) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $<
-endif
deleted file mode 100644
--- a/widget/src/xremoteclient/PhRemoteClient.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard and Jamie Zawinski.
- * Portions created by the Initial Developer are Copyright (C) 1994-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Adrian Mardare ( amardare@qnx.com )
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "PhRemoteClient.h"
-#include "prmem.h"
-#include "prprf.h"
-#include "plstr.h"
-#include "prsystem.h"
-#include "prlog.h"
-#include "prenv.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <strings.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <Pt.h>
-
-#define MOZ_REMOTE_MSG_TYPE					100
-
-XRemoteClient::XRemoteClient()
-{
-	mInitialized = PR_FALSE;
-}
-
-XRemoteClient::~XRemoteClient()
-{
-  if (mInitialized)
-    Shutdown();
-}
-
-nsresult
-XRemoteClient::Init (void)
-{
-
-  if (mInitialized)
-    return NS_OK;
-
-	/* we have to initialize the toolkit since we use PtConnection stuff to send messages */
-	PtInit( NULL );
-
-  mInitialized = PR_TRUE;
-
-  return NS_OK;
-}
-
-nsresult
-XRemoteClient::SendCommand (const char *aProgram, const char *aUsername,
-                            const char *aProfile, const char *aCommand,
-							const char* aDesktopStartupID,
-                            char **aResponse, PRBool *aWindowFound)
-{
-  *aWindowFound = PR_TRUE;
-
-	char RemoteServerName[128];
-
-	sprintf( RemoteServerName, "%s_RemoteServer", aProgram ? aProgram : "mozilla" );
-
-	PtConnectionClient_t *cnt = PtConnectionFindName( RemoteServerName, 0, 0 );
-	if( !cnt ) {
-		/* no window has registered for the remote service */
-		*aWindowFound = PR_FALSE;
-		return NS_OK;
-		}
-
-	if( PtConnectionSend( cnt, MOZ_REMOTE_MSG_TYPE, aCommand, NULL, strlen( aCommand ), 0 ) < 0 )
-		return NS_ERROR_FAILURE;
-
-  return NS_OK;
-}
-
-nsresult
-XRemoteClient::SendCommandLine (const char *aProgram, const char *aUsername,
-                                const char *aProfile,
-                                PRInt32 argc, char **argv,
-								const char* aDesktopStartupID,
-                                char **aResponse, PRBool *aWindowFound)
-{
-  return NS_ERROR_FAILURE;
-}
-
-void
-XRemoteClient::Shutdown (void)
-{
-
-  if (!mInitialized)
-    return;
-
-  // shut everything down
-  mInitialized = PR_FALSE;
-
-  return;
-}
deleted file mode 100644
--- a/widget/src/xremoteclient/PhRemoteClient.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Adrian Mardare ( amardare@qnx.com )
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-#include "nsRemoteClient.h"
-
-class XRemoteClient : public nsRemoteClient
-{
- public:
-  XRemoteClient();
-  ~XRemoteClient();
-
-  virtual nsresult Init();
-  virtual nsresult SendCommand(const char *aProgram, const char *aUsername,
-                               const char *aProfile, const char *aCommand,
-							   const char* aDesktopStartupID,
-                               char **aResponse, PRBool *aSucceeded);
-  virtual nsresult SendCommandLine(const char *aProgram, const char *aUsername,
-                                   const char *aProfile,
-                                   PRInt32 argc, char **argv,
-								   const char* aDesktopStartupID,
-                                   char **aResponse, PRBool *aSucceeded);
-  void Shutdown();
-
- private:
-	PRBool mInitialized;
-};
--- a/widget/src/xremoteclient/XRemoteClientFactory.cpp
+++ b/widget/src/xremoteclient/XRemoteClientFactory.cpp
@@ -38,21 +38,17 @@
 { 0xcfae5900,                                        \
   0x1dd1,                                            \
   0x11b2,                                            \
   { 0x95, 0xd0, 0xad, 0x45, 0x4c, 0x23, 0x3d, 0xc6 } \
 }
 
 /* cfae5900-1dd1-11b2-95d0-ad454c233dc6 */
 
-#ifdef MOZ_WIDGET_PHOTON
-#include "PhRemoteClient.h"
-#else
 #include "XRemoteClient.h"
-#endif
 
 #include "nsXRemoteClientCID.h"
 #include "nsIGenericFactory.h"
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(XRemoteClient)
 
 static const nsModuleComponentInfo components[] =
 {
--- a/widget/src/xremoteclient/mozilla-xremote-client.cpp
+++ b/widget/src/xremoteclient/mozilla-xremote-client.cpp
@@ -35,21 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <plgetopt.h>
-#ifdef MOZ_WIDGET_PHOTON
-#include "PhRemoteClient.h"
-#else
 #include "XRemoteClient.h"
-#endif
 
 static void print_usage(void);
 
 int main(int argc, char **argv)
 {
   nsresult rv;
   XRemoteClient client;
   char *browser = 0;