void ScreenOrientationController::setOverride(WebScreenOrientationType type, unsigned short angle) { m_override = true; m_overrideType = type; m_overrideAngle = angle; notifyOrientationChanged(); }
void ScreenOrientationController::pageVisibilityChanged() { notifyDispatcher(); if (!isActiveAndVisible()) return; // The orientation type and angle are tied in a way that if the angle has // changed, the type must have changed. unsigned short currentAngle = screenOrientationAngle(frame()->view()); // FIXME: sendOrientationChangeEvent() currently send an event all the // children of the frame, so it should only be called on the frame on // top of the tree. We would need the embedder to call // sendOrientationChangeEvent on every WebFrame part of a WebView to be // able to remove this. if (frame() == frame()->localFrameRoot() && m_orientation->angle() != currentAngle) notifyOrientationChanged(); }
void ScreenOrientationController::clearOverride() { m_override = false; notifyOrientationChanged(); }
MInputContext::MInputContext(QObject *parent) : QInputContext(parent), active(false), inputPanelState(InputPanelHidden), imServer(0), correctionEnabled(false), styleContainer(0), #ifdef HAVE_MEEGOTOUCH currOrientation(M::Angle0), #endif connectedObject(0), pasteAvailable(false), copyAvailable(false), copyAllowed(true), redirectKeys(false), objectPath(QString("%1%2").arg(DBusCallbackPath).arg(++connectionCount)), currentKeyEventTime(0) { int opcode = -1; int xkbEventBase = -1; int xkbErrorBase = -1; int xkblibMajor = XkbMajorVersion; int xkblibMinor = XkbMinorVersion; if (!XkbLibraryVersion(&xkblibMajor, &xkblibMinor)) { qCritical("%s xkb query version error!", __PRETTY_FUNCTION__); return; } Display* display = QX11Info::display(); if (!XkbQueryExtension(display, &opcode, &xkbEventBase, &xkbErrorBase, &xkblibMajor, &xkblibMinor)) { qCritical("%s xkb query extension error!", __PRETTY_FUNCTION__); return; } sipHideTimer.setSingleShot(true); sipHideTimer.setInterval(SoftwareInputPanelHideTimer); // TODO: sipHideTimer is used not only when focus is lost but also with // CloseSoftwareInputPanel event, so hideOnFocusOut is misleading. connect(&sipHideTimer, SIGNAL(timeout()), SLOT(hideOnFocusOut())); #ifdef HAVE_MEEGOTOUCH // using theming only when there is MComponentData instance, should be // there for meegotouch apps (naturally) and for plain qt with meego style plugin if (MComponentData::instance() != 0) { styleContainer = new MPreeditStyleContainer; styleContainer->initialize("DefaultStyle", "MPreeditStyle", 0); } #endif connectToDBus(); #ifdef HAVE_MEEGOTOUCH connect(MInputMethodState::instance(), SIGNAL(activeWindowOrientationAngleAboutToChange(M::OrientationAngle)), this, SLOT(notifyOrientationAboutToChange(M::OrientationAngle))); connect(MInputMethodState::instance(), SIGNAL(activeWindowOrientationAngleAboutToChange(M::OrientationAngle)), this, SLOT(notifyOrientationAboutToChange(M::OrientationAngle))); connect(MInputMethodState::instance(), SIGNAL(activeWindowOrientationAngleChanged(M::OrientationAngle)), this, SLOT(notifyOrientationChanged(M::OrientationAngle))); connect(MInputMethodState::instance(), SIGNAL(attributeExtensionRegistered(int, QString)), this, SLOT(notifyAttributeExtensionRegistered(int, QString))); connect(MInputMethodState::instance(), SIGNAL(attributeExtensionUnregistered(int)), this, SLOT(notifyAttributeExtensionUnregistered(int))); connect(MInputMethodState::instance(), SIGNAL(toolbarItemAttributeChanged(int, QString, QString, QVariant)), this, SLOT(notifyToolbarItemAttributeChanged(int, QString, QString, QVariant))); connect(MInputMethodState::instance(), SIGNAL(extendedAttributeChanged(int, QString, QString, QString, QVariant)), this, SLOT(notifyExtendedAttributeChanged(int, QString, QString, QString, QVariant))); #endif }
void MInputContext::setFocusWidget(QWidget *focused) { QObject *focusedObject = focused; QGraphicsItem *focusItem = 0; qDebug() << "MInputContext" << "in" << __PRETTY_FUNCTION__ << focused; QInputContext::setFocusWidget(focused); // get detailed focus information from inside qgraphicsview QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(focusWidget()); if (graphicsView && graphicsView->scene()) { focusItem = graphicsView->scene()->focusItem(); if (focusItem) { focusedObject = dynamic_cast<QObject *>(focusItem); } } const QMap<QString, QVariant> stateInformation = getStateInformation(); if (focused) { // for non-null focus widgets, we'll have this context activated if (!active) { imServer->activateContext(); active = true; #ifdef HAVE_MEEGOTOUCH // Notify whatever application's orientation is currently. notifyOrientationChanged(currOrientation); #endif } imServer->updateWidgetInformation(stateInformation, true); // check if copyable text is selected Qt::InputMethodQuery query = Qt::ImCurrentSelection; QVariant queryResult = focused->inputMethodQuery(query); if (queryResult.isValid()) { copyAvailable = !queryResult.toString().isEmpty(); } if (focusItem) { copyAllowed = !(focusItem->inputMethodHints() & Qt::ImhHiddenText); } else { copyAllowed = !(focused->inputMethodHints() & Qt::ImhHiddenText); } pasteAvailable = !QApplication::clipboard()->text().isEmpty(); connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(handleClipboardDataChange()), Qt::UniqueConnection); } else { copyAvailable = false; copyAllowed = false; imServer->updateWidgetInformation(stateInformation, true); disconnect(QApplication::clipboard(), SIGNAL(dataChanged()), this, 0); } // show or hide Copy/Paste button on input method server notifyCopyPasteState(); if (inputPanelState == InputPanelShowPending && focused) { imServer->showInputMethod(); inputPanelState = InputPanelShown; } if (connectedObject) { connectedObject->disconnect(this); connectedObject = 0; } if (focusedObject && focusedObject->metaObject()) { if (focusedObject->metaObject()->indexOfSignal("copyAvailable(bool)") != -1) { // for MTextEdit connect(focusedObject, SIGNAL(copyAvailable(bool)), this, SLOT(handleCopyAvailabilityChange(bool))); connectedObject = focusedObject; } else if (focusedObject->metaObject()->indexOfSignal("selectedTextChanged()") != -1) {