Handle keyboard focus change
Call QWindowSystemInterface::handleWindowActivated when a SCREEN_EVENT_PROPERTY event for he SCREEN_PROPERTY_KEYBOARD_FOCUS property is received. Change-Id: Ic2b10c5b793dd4451adac68691296f8265a71160 Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Frank Osterfeld <frank.osterfeld@kdab.com> Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
This commit is contained in:
parent
c2b8ebe9db
commit
c8df30682c
@ -125,6 +125,10 @@ bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType)
|
||||
handleDisplayEvent(event);
|
||||
break;
|
||||
|
||||
case SCREEN_EVENT_PROPERTY:
|
||||
handlePropertyEvent(event);
|
||||
break;
|
||||
|
||||
default:
|
||||
// event ignored
|
||||
qScreenEventDebug() << Q_FUNC_INFO << "unknown event" << qnxType;
|
||||
@ -496,6 +500,48 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event)
|
||||
{
|
||||
errno = 0;
|
||||
int objectType;
|
||||
if (screen_get_event_property_iv(event, SCREEN_PROPERTY_OBJECT_TYPE, &objectType) != 0)
|
||||
qFatal("QQNX: failed to query object type property, errno=%d", errno);
|
||||
|
||||
if (objectType != SCREEN_OBJECT_TYPE_WINDOW)
|
||||
return;
|
||||
|
||||
errno = 0;
|
||||
screen_window_t window = 0;
|
||||
if (screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0)
|
||||
qFatal("QQnx: failed to query window property, errno=%d", errno);
|
||||
|
||||
errno = 0;
|
||||
int property;
|
||||
if (screen_get_event_property_iv(event, SCREEN_PROPERTY_NAME, &property) != 0)
|
||||
qFatal("QQnx: failed to query window property, errno=%d", errno);
|
||||
|
||||
switch (property) {
|
||||
case SCREEN_PROPERTY_KEYBOARD_FOCUS:
|
||||
handleKeyboardFocusPropertyEvent(window);
|
||||
break;
|
||||
default:
|
||||
// event ignored
|
||||
qScreenEventDebug() << Q_FUNC_INFO << "Ignore property event for property: " << property;
|
||||
}
|
||||
}
|
||||
|
||||
void QQnxScreenEventHandler::handleKeyboardFocusPropertyEvent(screen_window_t window)
|
||||
{
|
||||
errno = 0;
|
||||
int focus = 0;
|
||||
if (window && screen_get_window_property_iv(window, SCREEN_PROPERTY_KEYBOARD_FOCUS, &focus) != 0)
|
||||
qFatal("QQnx: failed to query keyboard focus property, errno=%d", errno);
|
||||
|
||||
QWindow *w = focus ? QQnxIntegration::window(window) : 0;
|
||||
|
||||
QWindowSystemInterface::handleWindowActivated(w);
|
||||
}
|
||||
|
||||
#include "moc_qqnxscreeneventhandler.cpp"
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -72,6 +72,8 @@ private:
|
||||
void handleCloseEvent(screen_event_t event);
|
||||
void handleCreateEvent(screen_event_t event);
|
||||
void handleDisplayEvent(screen_event_t event);
|
||||
void handlePropertyEvent(screen_event_t event);
|
||||
void handleKeyboardFocusPropertyEvent(screen_window_t window);
|
||||
|
||||
private:
|
||||
enum {
|
||||
|
Loading…
x
Reference in New Issue
Block a user