50 #include <QCoreApplication> 51 #include <QAbstractEventDispatcher> 54 #include <bps/event.h> 55 #include <bps/navigator.h> 56 #include <bps/screen.h> 66 , mNavigatorEventHandler(navigatorEventHandler)
67 , mScreenEventHandler(screenEventHandler)
68 , mVirtualKeyboard(virtualKeyboard)
84 #if defined(QBBBPSEVENTFILTER_DEBUG) 87 if (navigator_request_events(0) != BPS_SUCCESS)
88 qWarning(
"QBB: failed to register for navigator events");
103 qWarning(
"QBB: trying to register for screen events, but no handler provided");
108 if (screen_get_display_property_iv(screen->
nativeDisplay(), SCREEN_PROPERTY_ATTACHED, &attached) != BPS_SUCCESS) {
109 qWarning() <<
"QBB: unable to query display attachment";
114 #if defined(QBBBPSEVENTFILTER_DEBUG) 115 qDebug() <<
Q_FUNC_INFO <<
"skipping event registration for non-attached screen";
120 if (screen_request_events(screen->
nativeContext()) != BPS_SUCCESS)
127 qWarning(
"QBB: trying to unregister for screen events, but no handler provided");
131 if (screen_stop_events(screen->
nativeContext()) != BPS_SUCCESS)
137 #if defined(QBBBPSEVENTFILTER_DEBUG) 143 bps_event_t *
event =
static_cast<bps_event_t *
>(message);
149 const int eventDomain = bps_event_get_domain(event);
151 #if defined(QBBBPSEVENTFILTER_DEBUG) 155 if (eventDomain == screen_get_domain()) {
157 qWarning(
"QBB: registered for screen events, but no handler provided");
161 screen_event_t screenEvent = screen_event_get_event(event);
165 if (eventDomain == navigator_get_domain())
176 switch (bps_event_get_code(event)) {
177 case NAVIGATOR_ORIENTATION_CHECK: {
178 const int angle = navigator_event_get_orientation_angle(event);
180 #if defined(QBBBPSEVENTFILTER_DEBUG) 181 qDebug() <<
"QBB: Navigator ORIENTATION CHECK event. angle=" <<
angle;
186 #if defined(QBBBPSEVENTFILTER_DEBUG) 187 qDebug() <<
"QBB: Navigator ORIENTATION CHECK event. result=" << result;
191 navigator_orientation_check_response(event, result);
195 case NAVIGATOR_ORIENTATION: {
196 const int angle = navigator_event_get_orientation_angle(event);
198 #if defined(QBBBPSEVENTFILTER_DEBUG) 199 qDebug() <<
"QBB: Navigator ORIENTATION event. angle=" <<
angle;
204 navigator_done_orientation(event);
208 case NAVIGATOR_SWIPE_DOWN:
209 #if defined(QBBBPSEVENTFILTER_DEBUG) 210 qDebug() <<
"QBB: Navigator SWIPE DOWN event";
217 #if defined(QBBBPSEVENTFILTER_DEBUG) 218 qDebug() <<
"QBB: Navigator EXIT event";
224 case NAVIGATOR_WINDOW_STATE: {
225 #if defined(QBBBPSEVENTFILTER_DEBUG) 229 const navigator_window_state_t state = navigator_event_get_window_state(event);
230 const QByteArray id(navigator_event_get_groupid(event));
233 case NAVIGATOR_WINDOW_FULLSCREEN:
236 case NAVIGATOR_WINDOW_THUMBNAIL:
239 case NAVIGATOR_WINDOW_INVISIBLE:
247 case NAVIGATOR_WINDOW_ACTIVE: {
248 #if defined(QBBBPSEVENTFILTER_DEBUG) 249 qDebug() <<
"QBB: Navigator WINDOW ACTIVE event";
252 const QByteArray id(navigator_event_get_groupid(event));
257 case NAVIGATOR_WINDOW_INACTIVE: {
258 #if defined(QBBBPSEVENTFILTER_DEBUG) 259 qDebug() <<
"QBB: Navigator WINDOW INACTIVE event";
262 const QByteArray id(navigator_event_get_groupid(event));
267 case NAVIGATOR_LOW_MEMORY:
269 <<
"received \"NAVIGATOR_LOW_MEMORY\" event";
273 #if defined(QBBBPSEVENTFILTER_DEBUG) 274 qDebug() <<
"QBB: Unhandled navigator event. code=" << bps_event_get_code(event);
#define QT_END_NAMESPACE
This macro expands to.
void unregisterForScreenEvents(QBBScreen *screen)
QBBScreenEventHandler * mScreenEventHandler
void handleWindowGroupActivated(const QByteArray &id)
screen_context_t nativeContext() const
QBBNavigatorEventHandler * mNavigatorEventHandler
The QByteArray class provides an array of bytes.
QBBVirtualKeyboardBps * mVirtualKeyboard
static QBBBpsEventFilter * sInstance
void handleWindowGroupDeactivated(const QByteArray &id)
bool bpsEventFilter(bps_event_t *event)
The QObject class is the base class of all Qt objects.
void handleWindowGroupStateChanged(const QByteArray &id, Qt::WindowState state)
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
Q_CORE_EXPORT void qDebug(const char *,...)
bool handleEvent(screen_event_t event)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_CORE_EXPORT void qWarning(const char *,...)
static qint64 applicationPid()
Returns the current process ID for the application.
static bool dispatcherEventFilter(void *message)
bool(* EventFilter)(void *message)
Typedef for a function with the signature.
bool handleEvent(bps_event_t *event)
screen_display_t nativeDisplay() const
qreal angle(const QPointF &p1, const QPointF &p2)
bool handleOrientationCheck(int angle)
void installOnEventDispatcher(QAbstractEventDispatcher *dispatcher)
void registerForScreenEvents(QBBScreen *screen)
bool handleNavigatorEvent(bps_event_t *event)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QAbstractEventDispatcher class provides an interface to manage Qt's event queue.
QBBBpsEventFilter(QBBNavigatorEventHandler *navigatorEventHandler, QBBScreenEventHandler *screenEventHandler, QBBVirtualKeyboardBps *virtualKeyboard, QObject *parent=0)
void handleOrientationChange(int angle)