зеркало из https://github.com/mozilla/gecko-dev.git
Exorcise gAppContext.
This commit is contained in:
Родитель
a33aa62ba2
Коммит
3b6962781f
|
@ -74,7 +74,7 @@ EXTRA_DSO_LDOPTS+= \
|
||||||
$(MKSHLIB_UNFORCE_ALL) \
|
$(MKSHLIB_UNFORCE_ALL) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXTRA_DSO_LDOPTS += $(TK_LIBS)
|
EXTRA_DSO_LDOPTS += -L$(DIST)/bin -lxlibrgb $(TK_LIBS)
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,10 @@
|
||||||
#include <X11/Xmu/Editres.h>
|
#include <X11/Xmu/Editres.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOZ_USING_XLIBRGB
|
|
||||||
#include "xlibrgb.h"
|
#include "xlibrgb.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "nsIPref.h"
|
#include "nsIPref.h"
|
||||||
|
|
||||||
XtAppContext gAppContext;
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// XPCOM CIDs
|
// XPCOM CIDs
|
||||||
|
@ -101,16 +97,13 @@ NS_METHOD nsAppShell::Create(int* bac, char ** bav)
|
||||||
NULL, // args
|
NULL, // args
|
||||||
0); // num_args
|
0); // num_args
|
||||||
|
|
||||||
// XXX This is BAD -- needs to be fixed
|
xlib_set_xt_app_context(mAppContext);
|
||||||
gAppContext = mAppContext;
|
|
||||||
|
|
||||||
#ifdef MOZ_USING_XLIBRGB
|
|
||||||
xlib_rgb_init(XtDisplay(mTopLevel), XtScreen(mTopLevel));
|
xlib_rgb_init(XtDisplay(mTopLevel), XtScreen(mTopLevel));
|
||||||
|
|
||||||
printf("xlib_rgb_init(display=%p,screen=%p)\n",
|
printf("xlib_rgb_init(display=%p,screen=%p)\n",
|
||||||
XtDisplay(mTopLevel),
|
XtDisplay(mTopLevel),
|
||||||
XtScreen(mTopLevel));
|
XtScreen(mTopLevel));
|
||||||
#endif
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +164,7 @@ done:
|
||||||
|
|
||||||
printf("Calling XtAppAddInput() with event queue\n");
|
printf("Calling XtAppAddInput() with event queue\n");
|
||||||
|
|
||||||
XtAppAddInput(gAppContext,
|
XtAppAddInput(mAppContext,
|
||||||
EQueue->GetEventQueueSelectFD(),
|
EQueue->GetEventQueueSelectFD(),
|
||||||
(XtPointer) XtInputReadMask,
|
(XtPointer) XtInputReadMask,
|
||||||
event_processor_callback,
|
event_processor_callback,
|
||||||
|
|
|
@ -53,8 +53,8 @@ class nsAppShell : public nsIAppShell
|
||||||
NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent, nsIWidget *aWidget,
|
NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent, nsIWidget *aWidget,
|
||||||
PRBool *aForWindow);
|
PRBool *aForWindow);
|
||||||
|
|
||||||
// Public global
|
|
||||||
//static XtAppContext gAppContext;
|
XtAppContext GetAppContext() { return mAppContext; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsAppShell_h__
|
#endif // nsAppShell_h__
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
#include <Xm/FileSB.h>
|
#include <Xm/FileSB.h>
|
||||||
#include "nsXtEventHandler.h"
|
#include "nsXtEventHandler.h"
|
||||||
#include "nsStringUtil.h"
|
#include "nsStringUtil.h"
|
||||||
|
#include "nsAppShell.h"
|
||||||
extern XtAppContext gAppContext;
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsFileWidget)
|
NS_IMPL_ADDREF(nsFileWidget)
|
||||||
NS_IMPL_RELEASE(nsFileWidget)
|
NS_IMPL_RELEASE(nsFileWidget)
|
||||||
|
@ -35,6 +34,7 @@ nsFileWidget::nsFileWidget() : nsWindow(), nsIFileWidget()
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mNumberOfFilters = 0;
|
mNumberOfFilters = 0;
|
||||||
|
mAppContext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_METHOD nsFileWidget::Create(nsIWidget *aParent,
|
NS_METHOD nsFileWidget::Create(nsIWidget *aParent,
|
||||||
|
@ -64,6 +64,8 @@ NS_METHOD nsFileWidget:: Create(nsIWidget *aParent,
|
||||||
mTitle.Append(aTitle);
|
mTitle.Append(aTitle);
|
||||||
mMode = aMode;
|
mMode = aMode;
|
||||||
|
|
||||||
|
mAppContext = ((nsAppShell *) aAppShell)->GetAppContext();
|
||||||
|
|
||||||
Widget parentWidget = nsnull;
|
Widget parentWidget = nsnull;
|
||||||
|
|
||||||
if (aParent) {
|
if (aParent) {
|
||||||
|
@ -157,11 +159,10 @@ PRBool nsFileWidget::Show()
|
||||||
{
|
{
|
||||||
XtManageChild(mWidget);
|
XtManageChild(mWidget);
|
||||||
|
|
||||||
// XXX Kludge: gAppContext is a global set in nsAppShell
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
mIOwnEventLoop = PR_TRUE;
|
mIOwnEventLoop = PR_TRUE;
|
||||||
while (mIOwnEventLoop) {
|
while (mIOwnEventLoop) {
|
||||||
XtAppNextEvent(gAppContext, &event);
|
XtAppNextEvent(mAppContext, &event);
|
||||||
XtDispatchEvent(&event);
|
XtDispatchEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,9 +91,11 @@ class nsFileWidget : public nsWindow, public nsIFileWidget
|
||||||
const nsString* mTitles;
|
const nsString* mTitles;
|
||||||
const nsString* mFilters;
|
const nsString* mFilters;
|
||||||
nsString mDefault;
|
nsString mDefault;
|
||||||
|
XtAppContext mAppContext;
|
||||||
|
|
||||||
void GetFilterListArray(nsString& aFilterList);
|
void GetFilterListArray(nsString& aFilterList);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsFileWidget_h__
|
#endif // nsFileWidget_h__
|
||||||
|
|
|
@ -51,9 +51,6 @@ static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||||
NS_IMPL_ADDREF(nsWindow)
|
NS_IMPL_ADDREF(nsWindow)
|
||||||
NS_IMPL_RELEASE(nsWindow)
|
NS_IMPL_RELEASE(nsWindow)
|
||||||
|
|
||||||
extern XtAppContext gAppContext;
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// nsWindow constructor
|
// nsWindow constructor
|
||||||
|
@ -85,6 +82,7 @@ nsWindow::nsWindow():
|
||||||
mPreferredWidth = 0;
|
mPreferredWidth = 0;
|
||||||
mPreferredHeight = 0;
|
mPreferredHeight = 0;
|
||||||
mFont = nsnull;
|
mFont = nsnull;
|
||||||
|
mAppContext = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -381,6 +379,8 @@ void nsWindow::CreateWindow(nsNativeWidget aNativeParent,
|
||||||
nsIToolkit *aToolkit,
|
nsIToolkit *aToolkit,
|
||||||
nsWidgetInitData *aInitData)
|
nsWidgetInitData *aInitData)
|
||||||
{
|
{
|
||||||
|
mAppContext = ((nsAppShell *) aAppShell)->GetAppContext();
|
||||||
|
|
||||||
// keep a reference to the device context
|
// keep a reference to the device context
|
||||||
if (aContext) {
|
if (aContext) {
|
||||||
mContext = aContext;
|
mContext = aContext;
|
||||||
|
@ -1566,7 +1566,7 @@ void nsWindow_Refresh_Callback(XtPointer call_data)
|
||||||
pevent.rect = (nsRect *)&bounds;
|
pevent.rect = (nsRect *)&bounds;
|
||||||
widgetWindow->OnPaint(pevent);
|
widgetWindow->OnPaint(pevent);
|
||||||
|
|
||||||
XtAppAddTimeOut(gAppContext, 50, (XtTimerCallbackProc)nsWindow_ResetResize_Callback, widgetWindow);
|
XtAppAddTimeOut(widgetWindow->mAppContext, 50, (XtTimerCallbackProc)nsWindow_ResetResize_Callback, widgetWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1602,7 +1602,7 @@ extern "C" void nsWindow_ResizeWidget(Widget w)
|
||||||
// resizing. This is only needed for main (shell)
|
// resizing. This is only needed for main (shell)
|
||||||
// windows. This should be replaced with code that actually
|
// windows. This should be replaced with code that actually
|
||||||
// Compresses the event queue.
|
// Compresses the event queue.
|
||||||
XtAppAddTimeOut(gAppContext, 250, (XtTimerCallbackProc)nsWindow_Refresh_Callback, win);
|
XtAppAddTimeOut(win->mAppContext, 250, (XtTimerCallbackProc)nsWindow_Refresh_Callback, win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,8 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Widget mWidget;
|
Widget mWidget;
|
||||||
|
XtAppContext mAppContext;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EVENT_CALLBACK mEventCallback;
|
EVENT_CALLBACK mEventCallback;
|
||||||
nsIDeviceContext *mContext;
|
nsIDeviceContext *mContext;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче