Don't set platform input context if it's not properly created.
Prevent xcb applications from failing to launch when IBus is not initialized correctly. Change-Id: I8425403e02d0eb5401f8d8bb0d012b53ab9400d9 Reviewed-on: http://codereview.qt.nokia.com/3044 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Matthew Cattell <matthew.cattell@nokia.com>
This commit is contained in:
parent
1ff94e3148
commit
06f6b71ba4
@ -89,6 +89,11 @@ QIBusPlatformInputContext::~QIBusPlatformInputContext (void)
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QIBusPlatformInputContext::isValid() const
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
void QIBusPlatformInputContext::mouseHandler (int x, QMouseEvent *event)
|
||||
{
|
||||
QPlatformInputContext::mouseHandler (x, event);
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
QIBusPlatformInputContext();
|
||||
~QIBusPlatformInputContext();
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
void mouseHandler(int x, QMouseEvent *event);
|
||||
void reset(void);
|
||||
void update(void);
|
||||
|
@ -99,10 +99,14 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters)
|
||||
m_fontDatabase = new QGenericUnixFontDatabase();
|
||||
m_nativeInterface = new QXcbNativeInterface;
|
||||
|
||||
#if defined(XCB_USE_IBUS)
|
||||
m_inputContext = new QIBusPlatformInputContext;
|
||||
#else
|
||||
m_inputContext = 0;
|
||||
#if defined(XCB_USE_IBUS)
|
||||
QIBusPlatformInputContext *context = new QIBusPlatformInputContext;
|
||||
if (context->isValid()) {
|
||||
m_inputContext = context;
|
||||
} else {
|
||||
delete context;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define XCB_USE_IBUS
|
||||
#if defined(XCB_USE_IBUS)
|
||||
#include "QtPlatformSupport/qibusplatforminputcontext.h"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user