backing out linux build bustage. see bug #6331

This commit is contained in:
donm%netscape.com 1999-05-13 18:24:31 +00:00
Родитель 955042c9de
Коммит 9ae1f6b61f
3 изменённых файлов: 75 добавлений и 73 удалений

Просмотреть файл

@ -21,17 +21,24 @@
#include "plevent.h" #include "plevent.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsIEventQueueService.h" #include "nsIEventQueueService.h"
#include "nsICmdLineService.h"
#include "nsXPComCIID.h" #include "nsXPComCIID.h"
#include <stdlib.h> #include <stdlib.h>
#include "nsIWidget.h" #include "nsIWidget.h"
//#define CMDLINEARGS
#ifdef CMDLINEARGS
#include "nsICmdLineService.h"
#endif
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
#ifdef CMDLINEARGS
static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID); static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
static NS_DEFINE_IID(kICmdLineServiceIID, NS_ICOMMANDLINE_SERVICE_IID); static NS_DEFINE_IID(kICmdLineServiceIID, NS_ICOMMANDLINE_SERVICE_IID);
#endif
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// //
@ -83,31 +90,32 @@ static void event_processor_callback(gpointer data,
// //
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#ifdef CMDLINEARGS
NS_METHOD nsAppShell::Create(int *bac, char **bav) NS_METHOD nsAppShell::Create(int *bac, char **bav)
#else
NS_METHOD nsAppShell::Create(int *argc, char **argv)
#endif
{ {
gchar *home; gchar *home;
gchar *path; gchar *path;
#ifdef CMDLINEARGS
int *argc; int *argc;
char **argv; char **argv;
// why do i get an error if this is defined here?? nsICmdLineService *cmdLineArgs=nsnull;
// nsICmdLineService *cmdLineArgs=nsnull; nsresult rv = NS_OK;
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsICmdLineService, cmdLineArgs, kCmdLineServiceCID, &rv); NS_WITH_SERVICE(nsICmdLineService, cmdLineArgs, kCmdLineServiceCID, &rv);
if (NS_SUCCEEDED(rv)) if (NS_FAILED(rv)) return rv;
{
rv = cmdLineArgs->GetArgc(argc);
if(NS_FAILED(rv))
argc = bac;
rv = cmdLineArgs->GetArgv(&argv); rv = cmdLineArgs->GetArgc(argc);
if(NS_FAILED(rv)) if(NS_FAILED(rv)) return rv;
argv = bav;
} else {
argc = bac;
argv = bav;
}
rv = cmdLineArgs->GetArgv(&argv);
if(NS_FAILED(rv)) return rv;
#endif
gtk_set_locale (); gtk_set_locale ();
gtk_init (argc, &argv); gtk_init (argc, &argv);
@ -117,12 +125,12 @@ NS_METHOD nsAppShell::Create(int *bac, char **bav)
gdk_rgb_init(); gdk_rgb_init();
home = g_get_home_dir(); home = g_get_home_dir();
if ((char*)nsnull != home) { if ( (char *) NULL != home ) {
path = g_strdup_printf("%s%c%s", home, G_DIR_SEPARATOR, ".gtkrc"); path = g_strdup_printf("%s%c%s", home, G_DIR_SEPARATOR, ".gtkrc");
if ((char *)nsnull != path) { if ( (char *) NULL != path ) {
gtk_rc_parse(path); gtk_rc_parse(path);
g_free(path); g_free( path );
} }
} }
return NS_OK; return NS_OK;
@ -175,7 +183,7 @@ NS_METHOD nsAppShell::Run()
// If a queue already present use it. // If a queue already present use it.
if (EQueue) if (EQueue)
goto done; goto done;
// Create the event queue for the thread // Create the event queue for the thread
rv = mEventQService->CreateThreadEventQueue(); rv = mEventQService->CreateThreadEventQueue();
@ -186,8 +194,8 @@ NS_METHOD nsAppShell::Run()
//Get the event queue for the thread //Get the event queue for the thread
rv = mEventQService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue); rv = mEventQService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue);
if (NS_OK != rv) { if (NS_OK != rv) {
NS_ASSERTION("Could not obtain the thread event queue", PR_FALSE); NS_ASSERTION("Could not obtain the thread event queue", PR_FALSE);
return rv; return rv;
} }
@ -226,9 +234,10 @@ NS_METHOD nsAppShell::Exit()
void* nsAppShell::GetNativeData(PRUint32 aDataType) void* nsAppShell::GetNativeData(PRUint32 aDataType)
{ {
if (aDataType == NS_NATIVE_SHELL) { if (aDataType == NS_NATIVE_SHELL) {
// this isn't accually used, but if it was, we need to gtk_widget_ref() it. // this isn't accually used, but if it was, we need to gtk_widget_ref() it.
// return mTopLevel;
// return mTopLevel;
} }
return nsnull; return nsnull;
} }
@ -240,66 +249,59 @@ NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *& aEvent)
aEvent = 0; aEvent = 0;
aRealEvent = PR_FALSE; aRealEvent = PR_FALSE;
event = gdk_event_peek(); event = gdk_event_peek();
if ( (GdkEvent *) NULL != event ) {
if ((GdkEvent *) nsnull != event ) { aRealEvent = PR_TRUE;
aRealEvent = PR_TRUE; aEvent = event;
aEvent = event;
} else } else
g_main_iteration (PR_TRUE); g_main_iteration (TRUE);
return NS_OK; return NS_OK;
} }
NS_METHOD nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void *aEvent) NS_METHOD nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void *aEvent)
{ {
if ( aRealEvent == PR_TRUE ) if ( aRealEvent == PR_TRUE )
g_main_iteration (PR_TRUE); g_main_iteration (TRUE);
return NS_OK; return NS_OK;
} }
NS_METHOD nsAppShell::EventIsForModalWindow(PRBool aRealEvent, NS_METHOD nsAppShell::EventIsForModalWindow(PRBool aRealEvent, void *aEvent,
void *aEvent, nsIWidget *aWidget, PRBool *aForWindow)
nsIWidget *aWidget,
PRBool *aForWindow)
{ {
PRBool isInWindow, isMouseEvent; PRBool isInWindow, isMouseEvent;
GdkEventAny *msg = (GdkEventAny *) aEvent; GdkEventAny *msg = (GdkEventAny *) aEvent;
if (aRealEvent == PR_FALSE) { if (aRealEvent == PR_FALSE) {
*aForWindow = PR_FALSE; *aForWindow = PR_FALSE;
return NS_OK; return NS_OK;
} }
isInWindow = PR_FALSE; isInWindow = PR_FALSE;
if (aWidget != nsnull) { if (aWidget != nsnull) {
// Get Native Window for dialog window // Get Native Window for dialog window
GdkWindow *win; GdkWindow *win;
win = (GdkWindow *)aWidget->GetNativeData(NS_NATIVE_WINDOW); win = (GdkWindow *)aWidget->GetNativeData(NS_NATIVE_WINDOW);
// Find top most window of event window // Find top most window of event window
GdkWindow *eWin = msg->window; GdkWindow *eWin = msg->window;
if (nsnull != eWin) { if (NULL != eWin) {
if (win == eWin) { if (win == eWin) {
isInWindow = PR_TRUE; isInWindow = PR_TRUE;
} }
} }
} }
isMouseEvent = PR_FALSE; isMouseEvent = PR_FALSE;
switch (msg->type) switch (msg->type) {
{ case GDK_MOTION_NOTIFY:
case GDK_MOTION_NOTIFY: case GDK_BUTTON_PRESS:
case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS:
case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS:
case GDK_3BUTTON_PRESS: case GDK_BUTTON_RELEASE:
case GDK_BUTTON_RELEASE: isMouseEvent = PR_TRUE;
isMouseEvent = PR_TRUE;
default:
isMouseEvent = PR_FALSE;
} }
*aForWindow = isInWindow == PR_TRUE || *aForWindow = isInWindow == PR_TRUE ||
isMouseEvent == PR_FALSE ? PR_TRUE : PR_FALSE; isMouseEvent == PR_FALSE ? PR_TRUE : PR_FALSE;
gdk_event_free( (GdkEvent *) aEvent ); gdk_event_free( (GdkEvent *) aEvent );
return NS_OK; return NS_OK;

Просмотреть файл

@ -40,21 +40,21 @@ class nsAppShell : public nsIAppShell
// nsIAppShellInterface // nsIAppShellInterface
NS_IMETHOD Create(int* argc, char ** argv); NS_IMETHOD Create(int* argc, char ** argv);
NS_IMETHOD Run(); NS_IMETHOD Run();
NS_IMETHOD Spinup(); NS_IMETHOD Spinup();
NS_IMETHOD Spindown(); NS_IMETHOD Spindown();
NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent); NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent);
NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent); NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent);
NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent, NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent,
nsIWidget *aWidget, PRBool *aForWindow); nsIWidget *aWidget, PRBool *aForWindow);
NS_IMETHOD Exit(); NS_IMETHOD Exit();
NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener); NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener);
virtual void *GetNativeData(PRUint32 aDataType); virtual void* GetNativeData(PRUint32 aDataType);
private: private:
nsDispatchListener *mDispatchListener; nsDispatchListener *mDispatchListener;
protected: protected:
nsIEventQueueService *mEventQService; nsIEventQueueService * mEventQService;
}; };
#endif // nsAppShell_h__ #endif // nsAppShell_h__

Просмотреть файл

@ -86,7 +86,7 @@ struct nsKeyConverter nsKeycodes[] = {
{ NS_VK_SUBTRACT, GDK_KP_Subtract }, { NS_VK_SUBTRACT, GDK_KP_Subtract },
{ NS_VK_DECIMAL, GDK_KP_Decimal }, { NS_VK_DECIMAL, GDK_KP_Decimal },
{ NS_VK_DIVIDE, GDK_KP_Divide }, { NS_VK_DIVIDE, GDK_KP_Divide },
{ NS_VK_RETURN, GDK_KP_Enter }, { NS_VK_RETURN, GDK_KP_Enter },
{ NS_VK_COMMA, GDK_comma }, { NS_VK_COMMA, GDK_comma },
{ NS_VK_PERIOD, GDK_period }, { NS_VK_PERIOD, GDK_period },