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