Changes for qnx/photon platform only. They should not affect building/runtime other platforms.

Define PHOTON_DND to enable/disable photon's nsDragService from the default build.
This commit is contained in:
amardare%qnx.com 2004-05-21 20:07:20 +00:00
parent 40118c7513
commit 37838c73cd
4 changed files with 33 additions and 3 deletions

View File

@ -65,7 +65,6 @@ REQUIRES = xpcom \
$(NULL)
CPPSRCS = \
nsDragService.cpp \
PtRawDrawContainer.cpp \
nsAppShell.cpp \
nsClipboard.cpp \
@ -84,6 +83,10 @@ REQUIRES += xremoteservice
CPPSRCS += nsPhMozRemoteHelper.cpp
endif
ifdef PHOTON_DND
CPPSRCS += nsDragService.cpp
endif
SHARED_LIBRARY_LIBS = $(DIST)/lib/libxpwidgets_s.a
EXTRA_DSO_LDOPTS = $(MOZ_COMPONENT_LIBS) \

View File

@ -54,7 +54,9 @@
#include "nsIRollupListener.h"
#include "nsIServiceManager.h"
#include "nsWindow.h"
#ifdef PHOTON_DND
#include "nsDragService.h"
#endif
#include "nsReadableUtils.h"
#include "nsIPref.h"
@ -81,7 +83,9 @@ static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
// Keep track of the last widget being "dragged"
//
nsILookAndFeel *nsWidget::sLookAndFeel = nsnull;
#ifdef PHOTON_DND
nsIDragService *nsWidget::sDragService = nsnull;
#endif
PRUint32 nsWidget::sWidgetCount = 0;
PRBool nsWidget::sJustGotActivated = PR_FALSE;
PRBool nsWidget::sJustGotDeactivated = PR_FALSE;
@ -100,6 +104,7 @@ nsWidget::nsWidget()
if( sLookAndFeel )
sLookAndFeel->GetColor( nsILookAndFeel::eColor_WindowBackground, mBackground );
#ifdef PHOTON_DND
if( !sDragService ) {
nsresult rv;
nsCOMPtr<nsIDragService> s;
@ -107,6 +112,7 @@ nsWidget::nsWidget()
sDragService = ( nsIDragService * ) s;
if( NS_FAILED( rv ) ) sDragService = 0;
}
#endif
mWidget = nsnull;
mParent = nsnull;
@ -624,7 +630,9 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
PtAddCallback( mWidget, Pt_CB_GOT_FOCUS, GotFocusCallback, this );
PtAddCallback( mWidget, Pt_CB_LOST_FOCUS, LostFocusCallback, this );
PtAddCallback( mWidget, Pt_CB_IS_DESTROYED, DestroyedCallback, this );
// PtAddCallback( mWidget, Pt_CB_DND, DndCallback, this );
#ifdef PHOTON_DND
PtAddCallback( mWidget, Pt_CB_DND, DndCallback, this );
#endif
}
DispatchStandardEvent(NS_CREATE);
@ -1029,12 +1037,14 @@ inline PRBool nsWidget::HandleEvent( PtWidget_t *widget, PtCallbackInfo_t* aCbIn
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 );
@ -1066,13 +1076,14 @@ inline PRBool nsWidget::HandleEvent( PtWidget_t *widget, PtCallbackInfo_t* aCbIn
PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event );
ScreenToWidgetPos( ptrev2->pos );
#ifdef PHOTON_DND
if( sDragService ) {
nsDragService *d;
nsIDragService *s = sDragService;
d = ( nsDragService * )s;
d->SetNativeDndData( widget, event );
}
#endif
InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_MOVE );
result = DispatchMouseEvent(theMouseEvent);
}
@ -1176,6 +1187,7 @@ int nsWidget::DestroyedCallback( PtWidget_t *widget, void *data, PtCallbackInfo_
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) );
@ -1270,3 +1282,4 @@ int nsWidget::DndCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbi
return Pt_CONTINUE;
}
#endif /* PHOTON_DND */

View File

@ -41,7 +41,9 @@
#include "nsBaseWidget.h"
#include "nsIKBStateControl.h"
#include "nsIRegion.h"
#ifdef PHOTON_DND
#include "nsIDragService.h"
#endif
class nsILookAndFeel;
class nsIAppShell;
@ -288,8 +290,10 @@ protected:
return ConvertStatus(status);
}
#ifdef PHOTON_DND
void DispatchDragDropEvent( 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
@ -343,7 +347,9 @@ protected:
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;
@ -358,7 +364,9 @@ protected:
static PRBool sJustGotActivated; //For getting rid of the ASSERT ERROR due to reducing suppressing of focus.
static nsILookAndFeel *sLookAndFeel;
#ifdef PHOTON_DND
static nsIDragService *sDragService;
#endif
static PRUint32 sWidgetCount;
};

View File

@ -50,7 +50,9 @@
#include "nsClipboard.h"
#include "nsClipboardHelper.h"
#include "nsHTMLFormatConverter.h"
#ifdef PHOTON_DND
#include "nsDragService.h"
#endif
#include "nsSound.h"
#ifdef IBMBIDI
#include "nsBidiKeyboard.h"
@ -71,7 +73,9 @@ 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)
@ -121,10 +125,12 @@ static nsModuleComponentInfo components[] =
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",