mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 613079 - fix non-libxul build and style fixes - r=dholbert, a=fix-build-nonlibxul
This commit is contained in:
parent
dc5b26314b
commit
81ac2ab66c
@ -91,18 +91,19 @@ CPPSRCS = \
|
||||
nsScriptableRegion.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_X11
|
||||
CPPSRCS += \
|
||||
X11Util.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_X11
|
||||
CPPSRCS += \
|
||||
X11Util.cpp \
|
||||
$(NULL)
|
||||
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
|
||||
endif
|
||||
|
||||
ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(TK_LIBS) \
|
||||
|
@ -41,6 +41,41 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
ScopedXErrorHandler::ErrorEvent* ScopedXErrorHandler::s_xerrorptr;
|
||||
ScopedXErrorHandler::ErrorEvent* ScopedXErrorHandler::sXErrorPtr;
|
||||
|
||||
int
|
||||
ScopedXErrorHandler::ErrorHandler(Display *, XErrorEvent *ev)
|
||||
{
|
||||
sXErrorPtr->mError = *ev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ScopedXErrorHandler::ScopedXErrorHandler()
|
||||
{
|
||||
// let sXErrorPtr point to this object's mXError object, but don't reset this mXError object!
|
||||
// think of the case of nested ScopedXErrorHandler's.
|
||||
mOldXErrorPtr = sXErrorPtr;
|
||||
sXErrorPtr = &mXError;
|
||||
mOldErrorHandler = XSetErrorHandler(ErrorHandler);
|
||||
}
|
||||
|
||||
ScopedXErrorHandler::~ScopedXErrorHandler()
|
||||
{
|
||||
sXErrorPtr = mOldXErrorPtr;
|
||||
XSetErrorHandler(mOldErrorHandler);
|
||||
}
|
||||
|
||||
bool
|
||||
ScopedXErrorHandler::SyncAndGetError(Display *dpy, XErrorEvent *ev)
|
||||
{
|
||||
XSync(dpy, False);
|
||||
bool retval = mXError.mError.error_code != 0;
|
||||
if (ev)
|
||||
*ev = mXError.mError;
|
||||
mXError = ErrorEvent(); // reset
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -54,6 +54,7 @@
|
||||
# error Unknown toolkit
|
||||
#endif
|
||||
|
||||
#include "gfxCore.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -123,12 +124,12 @@ private:
|
||||
* This class is not thread-safe at all. It is assumed that only one thread is using any ScopedXErrorHandler's. Given that it's
|
||||
* not used on Mac, it should be easy to make it thread-safe by using thread-local storage with __thread.
|
||||
*/
|
||||
class ScopedXErrorHandler
|
||||
class NS_GFX ScopedXErrorHandler
|
||||
{
|
||||
// trivial wrapper around XErrorEvent, just adding ctor initializing by zero.
|
||||
struct ErrorEvent
|
||||
{
|
||||
XErrorEvent m_error;
|
||||
XErrorEvent mError;
|
||||
|
||||
ErrorEvent()
|
||||
{
|
||||
@ -137,54 +138,31 @@ class ScopedXErrorHandler
|
||||
};
|
||||
|
||||
// this ScopedXErrorHandler's ErrorEvent object
|
||||
ErrorEvent m_xerror;
|
||||
ErrorEvent mXError;
|
||||
|
||||
// static pointer for use by the error handler
|
||||
static ErrorEvent* s_xerrorptr;
|
||||
static ErrorEvent* sXErrorPtr;
|
||||
|
||||
// what to restore s_xerrorptr to on destruction
|
||||
ErrorEvent* m_oldxerrorptr;
|
||||
// what to restore sXErrorPtr to on destruction
|
||||
ErrorEvent* mOldXErrorPtr;
|
||||
|
||||
// what to restore the error handler to on destruction
|
||||
int (*m_oldErrorHandler)(Display *, XErrorEvent *);
|
||||
int (*mOldErrorHandler)(Display *, XErrorEvent *);
|
||||
|
||||
public:
|
||||
|
||||
static int
|
||||
ErrorHandler(Display *, XErrorEvent *ev)
|
||||
{
|
||||
s_xerrorptr->m_error = *ev;
|
||||
return 0;
|
||||
}
|
||||
ErrorHandler(Display *, XErrorEvent *ev);
|
||||
|
||||
ScopedXErrorHandler()
|
||||
{
|
||||
// let s_xerrorptr point to this object's m_xerror object, but don't reset this m_xerror object!
|
||||
// think of the case of nested ScopedXErrorHandler's.
|
||||
m_oldxerrorptr = s_xerrorptr;
|
||||
s_xerrorptr = &m_xerror;
|
||||
m_oldErrorHandler = XSetErrorHandler(ErrorHandler);
|
||||
}
|
||||
ScopedXErrorHandler();
|
||||
|
||||
~ScopedXErrorHandler()
|
||||
{
|
||||
s_xerrorptr = m_oldxerrorptr;
|
||||
XSetErrorHandler(m_oldErrorHandler);
|
||||
}
|
||||
~ScopedXErrorHandler();
|
||||
|
||||
/** \returns true if a X error occurred since the last time this method was called on this ScopedXErrorHandler object.
|
||||
*
|
||||
* \param ev this optional parameter, if set, will be filled with the XErrorEvent object
|
||||
*/
|
||||
bool SyncAndGetError(Display *dpy, XErrorEvent *ev = nsnull)
|
||||
{
|
||||
XSync(dpy, False);
|
||||
bool retval = m_xerror.m_error.error_code != 0;
|
||||
if (ev)
|
||||
*ev = m_xerror.m_error;
|
||||
m_xerror = ErrorEvent(); // reset
|
||||
return retval;
|
||||
}
|
||||
bool SyncAndGetError(Display *dpy, XErrorEvent *ev = nsnull);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user