From 75d4dc408a0b81653766a29f4751927124d60caf Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 26 Jan 2022 20:21:07 +0200 Subject: [PATCH] generic: adjust to Katie changes Signed-off-by: Ivailo Monev --- kscreensaver/kdesavers/banner.cpp | 2 +- kwin/effects/zoom/zoom.cpp | 56 -------- kwin/effects/zoom/zoom.h | 18 --- kwin/effects/zoom/zoom.kcfg | 9 -- kwin/effects/zoom/zoom_config.cpp | 6 - kwin/effects/zoom/zoom_config.ui | 46 ------- .../plasmacomponents/qrangemodel.cpp | 4 - plasma/shells/plasma-desktop/CMakeLists.txt | 2 - .../accessibility/accessiblefactory.cpp | 23 ---- .../accessibility/accessiblefactory.h | 8 -- .../accessibility/accessibleplasmaview.cpp | 144 --------------------- .../accessibility/accessibleplasmaview.h | 98 -------------- plasma/shells/plasma-desktop/main.cpp | 6 - 13 files changed, 1 insertion(+), 421 deletions(-) delete mode 100644 plasma/shells/plasma-desktop/accessibility/accessiblefactory.cpp delete mode 100644 plasma/shells/plasma-desktop/accessibility/accessiblefactory.h delete mode 100644 plasma/shells/plasma-desktop/accessibility/accessibleplasmaview.cpp delete mode 100644 plasma/shells/plasma-desktop/accessibility/accessibleplasmaview.h diff --git a/kscreensaver/kdesavers/banner.cpp b/kscreensaver/kdesavers/banner.cpp index 9e61b33b..264ac559 100644 --- a/kscreensaver/kdesavers/banner.cpp +++ b/kscreensaver/kdesavers/banner.cpp @@ -547,7 +547,7 @@ void KBannerSaver::paintEvent(QPaintEvent *event) QPainter p(this); p.fillRect(rect(), Qt::black); - if ( xpos < -messageWidth) { + if (xpos < -messageWidth) { xpos = width(); ypos = (fsize + (int) ((double)(height() - 3 * fsize) * krnd->getDouble())); } diff --git a/kwin/effects/zoom/zoom.cpp b/kwin/effects/zoom/zoom.cpp index 359b8ff0..e415aebf 100644 --- a/kwin/effects/zoom/zoom.cpp +++ b/kwin/effects/zoom/zoom.cpp @@ -54,10 +54,7 @@ ZoomEffect::ZoomEffect() , polling(false) , zoomFactor(1.25) , mouseTracking(MouseTrackingProportional) - , enableFocusTracking(false) - , followFocus(true) , mousePointer(MousePointerScale) - , focusDelay(350) // in milliseconds , imageWidth(0) , imageHeight(0) , isMouseHidden(false) @@ -94,12 +91,6 @@ ZoomEffect::ZoomEffect() a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down)); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomDown())); - // TODO: these two actions don't belong into the effect. They need to be moved into KWin core - a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToFocus")); - a->setText(i18n("Move Mouse to Focus")); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F5)); - connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToFocus())); - a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToCenter")); a->setText(i18n("Move Mouse to Center")); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6)); @@ -201,21 +192,6 @@ void ZoomEffect::reconfigure(ReconfigureFlags) mousePointer = MousePointerType(ZoomConfig::mousePointer()); // Track moving of the mouse. mouseTracking = MouseTrackingType(ZoomConfig::mouseTracking()); - // Enable tracking of the focused location. - bool _enableFocusTracking = ZoomConfig::enableFocusTracking(); - if (enableFocusTracking != _enableFocusTracking) { - enableFocusTracking = _enableFocusTracking; - if (QDBusConnection::sessionBus().isConnected()) { - if (enableFocusTracking) - QDBusConnection::sessionBus().connect("org.kde.kaccessibleapp", "/Adaptor", "org.kde.kaccessibleapp.Adaptor", "focusChanged", this, SLOT(focusChanged(int,int,int,int,int,int))); - else - QDBusConnection::sessionBus().disconnect("org.kde.kaccessibleapp", "/Adaptor", "org.kde.kaccessibleapp.Adaptor", "focusChanged", this, SLOT(focusChanged(int,int,int,int,int,int))); - } - } - // When the focus changes, move the zoom area to the focused location. - followFocus = ZoomConfig::enableFollowFocus(); - // The time in milliseconds to wait before a focus-event takes away a mouse-move. - focusDelay = qMax(uint(0), ZoomConfig::focusDelay()); // The factor the zoom-area will be moved on touching an edge on push-mode or using the navigation KAction's. moveFactor = qMax(0.1, ZoomConfig::moveFactor()); if (source_zoom < 0) { @@ -291,22 +267,6 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) break; } } - - // use the focusPoint if focus tracking is enabled - if (enableFocusTracking && followFocus) { - bool acceptFocus = true; - if (mouseTracking != MouseTrackingDisabled && focusDelay > 0) { - // Wait some time for the mouse before doing the switch. This serves as threshold - // to prevent the focus from jumping around to much while working with the mouse. - const int msecs = lastMouseEvent.msecsTo(lastFocusEvent); - acceptFocus = msecs > focusDelay; - } - if (acceptFocus) { - data.setXTranslation(- int(focusPoint.x() * (zoom - 1.0))); - data.setYTranslation(- int(focusPoint.y() * (zoom - 1.0))); - prevPoint = focusPoint; - } - } } effects->paintScreen(mask, region, data); @@ -452,11 +412,6 @@ void ZoomEffect::moveZoomDown() moveZoom(0, 1); } -void ZoomEffect::moveMouseToFocus() -{ - QCursor::setPos(focusPoint.x(), focusPoint.y()); -} - void ZoomEffect::moveMouseToCenter() { QRect r(0, 0, displayWidth(), displayHeight()); @@ -475,17 +430,6 @@ void ZoomEffect::slotMouseChanged(const QPoint& pos, const QPoint& old, Qt::Mous } } -void ZoomEffect::focusChanged(int px, int py, int rx, int ry, int rwidth, int rheight) -{ - if (zoom == 1.0) - return; - focusPoint = (px >= 0 && py >= 0) ? QPoint(px, py) : QPoint(rx + qMax(0, (qMin(displayWidth(), rwidth) / 2) - 60), ry + qMax(0, (qMin(displayHeight(), rheight) / 2) - 60)); - if (enableFocusTracking) { - lastFocusEvent = QTime::currentTime(); - effects->addRepaintFull(); - } -} - bool ZoomEffect::isActive() const { return zoom != 1.0 || zoom != target_zoom; diff --git a/kwin/effects/zoom/zoom.h b/kwin/effects/zoom/zoom.h index 33999050..f6f5c6cb 100644 --- a/kwin/effects/zoom/zoom.h +++ b/kwin/effects/zoom/zoom.h @@ -40,9 +40,6 @@ class ZoomEffect Q_PROPERTY(qreal zoomFactor READ configuredZoomFactor) Q_PROPERTY(int mousePointer READ configuredMousePointer) Q_PROPERTY(int mouseTracking READ configuredMouseTracking) - Q_PROPERTY(bool enableFocusTracking READ isEnableFocusTracking) - Q_PROPERTY(bool followFocus READ isFollowFocus) - Q_PROPERTY(int focusDelay READ configuredFocusDelay) Q_PROPERTY(qreal moveFactor READ configuredMoveFactor) Q_PROPERTY(qreal targetZoom READ targetZoom) public: @@ -63,15 +60,6 @@ public: int configuredMouseTracking() const { return mouseTracking; } - bool isEnableFocusTracking() const { - return enableFocusTracking; - } - bool isFollowFocus() const { - return followFocus; - } - int configuredFocusDelay() const { - return focusDelay; - } qreal configuredMoveFactor() const { return moveFactor; } @@ -87,10 +75,8 @@ private slots: void moveZoomRight(); void moveZoomUp(); void moveZoomDown(); - void moveMouseToFocus(); void moveMouseToCenter(); void timelineFrameChanged(int frame); - void focusChanged(int px, int py, int rx, int ry, int rwidth, int rheight); void slotMouseChanged(const QPoint& pos, const QPoint& old, Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons, Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers); @@ -107,14 +93,10 @@ private: double zoomFactor; enum MouseTrackingType { MouseTrackingProportional = 0, MouseTrackingCentred = 1, MouseTrackingPush = 2, MouseTrackingDisabled = 3 }; MouseTrackingType mouseTracking; - bool enableFocusTracking; - bool followFocus; enum MousePointerType { MousePointerScale = 0, MousePointerKeep = 1, MousePointerHide = 2 }; MousePointerType mousePointer; - int focusDelay; QPoint cursorPoint; QPoint cursorHotSpot; - QPoint focusPoint; QPoint prevPoint; QTime lastMouseEvent; QTime lastFocusEvent; diff --git a/kwin/effects/zoom/zoom.kcfg b/kwin/effects/zoom/zoom.kcfg index b1df40fd..039cbc0a 100644 --- a/kwin/effects/zoom/zoom.kcfg +++ b/kwin/effects/zoom/zoom.kcfg @@ -14,15 +14,6 @@ 0 - - false - - - true - - - 350 - 20.0 diff --git a/kwin/effects/zoom/zoom_config.cpp b/kwin/effects/zoom/zoom_config.cpp index 599c10b3..61bd5f48 100644 --- a/kwin/effects/zoom/zoom_config.cpp +++ b/kwin/effects/zoom/zoom_config.cpp @@ -98,12 +98,6 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) : a->setProperty("isConfigurationAction", true); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down)); - a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToFocus")); - a->setIcon(KIcon("view-restore")); - a->setText(i18n("Move Mouse to Focus")); - a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F5)); - a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToCenter")); a->setIcon(KIcon("view-restore")); a->setText(i18n("Move Mouse to Center")); diff --git a/kwin/effects/zoom/zoom_config.ui b/kwin/effects/zoom/zoom_config.ui index 1a746f75..936254b9 100644 --- a/kwin/effects/zoom/zoom_config.ui +++ b/kwin/effects/zoom/zoom_config.ui @@ -57,32 +57,6 @@ - - - - - - - Enable tracking of the focused location. This needs QAccessible to be enabled per application ("export QT_ACCESSIBILITY=1"). - - - Enable Focus Tracking - - - - - - - false - - - When the focus changes, move the zoom area to the focused location. - - - Follow Focus - - - @@ -187,26 +161,6 @@ kcfg_ZoomFactor kcfg_MousePointer kcfg_MouseTracking - kcfg_EnableFocusTracking - kcfg_EnableFollowFocus - - - kcfg_EnableFocusTracking - toggled(bool) - kcfg_EnableFollowFocus - setEnabled(bool) - - - 152 - 73 - - - 152 - 98 - - - - diff --git a/plasma/declarativeimports/plasmacomponents/qrangemodel.cpp b/plasma/declarativeimports/plasmacomponents/qrangemodel.cpp index 0d2ea406..d11ad735 100644 --- a/plasma/declarativeimports/plasmacomponents/qrangemodel.cpp +++ b/plasma/declarativeimports/plasmacomponents/qrangemodel.cpp @@ -55,10 +55,6 @@ \ingroup qt-components */ -#ifndef QT_NO_ACCESSIBILITY -#include -#endif - #include #include "qrangemodel.h" diff --git a/plasma/shells/plasma-desktop/CMakeLists.txt b/plasma/shells/plasma-desktop/CMakeLists.txt index 17180a7e..2306cb90 100644 --- a/plasma/shells/plasma-desktop/CMakeLists.txt +++ b/plasma/shells/plasma-desktop/CMakeLists.txt @@ -5,8 +5,6 @@ include_directories(${CMAKE_SOURCE_DIR}/libs ) set(plasma_SRCS - accessibility/accessiblefactory.cpp - accessibility/accessibleplasmaview.cpp scripting/desktopscriptengine.cpp scripting/panel.cpp checkbox.cpp diff --git a/plasma/shells/plasma-desktop/accessibility/accessiblefactory.cpp b/plasma/shells/plasma-desktop/accessibility/accessiblefactory.cpp deleted file mode 100644 index cfebab99..00000000 --- a/plasma/shells/plasma-desktop/accessibility/accessiblefactory.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "accessiblefactory.h" - -#include - -#include "panelview.h" -#include "desktopview.h" -#include "plasmaapp.h" - - -QAccessibleInterface* Plasma::accessibleInterfaceFactory(const QString &key, QObject *object) -{ - Q_UNUSED(key) - - if (Plasma::Applet *applet = qobject_cast(object)) - return new AccessiblePlasmaApplet(applet); - if (PanelView *view = qobject_cast(object)) - return new AccessiblePlasmaPanelView(view); - if (Plasma::View *view = qobject_cast(object)) - return new AccessiblePlasmaView(view); - if (PlasmaApp *app = qobject_cast(object)) - return new AccessiblePlasmaApp(app); - return 0; -} diff --git a/plasma/shells/plasma-desktop/accessibility/accessiblefactory.h b/plasma/shells/plasma-desktop/accessibility/accessiblefactory.h deleted file mode 100644 index d1dc0a0d..00000000 --- a/plasma/shells/plasma-desktop/accessibility/accessiblefactory.h +++ /dev/null @@ -1,8 +0,0 @@ - -#include "accessibility/accessibleplasmaview.h" - -namespace Plasma { - -QAccessibleInterface* accessibleInterfaceFactory(const QString &key, QObject *object); - -} diff --git a/plasma/shells/plasma-desktop/accessibility/accessibleplasmaview.cpp b/plasma/shells/plasma-desktop/accessibility/accessibleplasmaview.cpp deleted file mode 100644 index 5ae01637..00000000 --- a/plasma/shells/plasma-desktop/accessibility/accessibleplasmaview.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - Copyright (C) 2012 Frederik Gladhorn * - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - -#include "accessibleplasmaview.h" -#include -#include - -using namespace Plasma; - -AccessiblePlasmaView::AccessiblePlasmaView(Plasma::View *view, QAccessible::Role role) - : QAccessibleWidgetEx(view, role) -{} - -QString AccessiblePlasmaView::text ( QAccessible::Text t, int child ) const -{ - if (child == 0 && t == QAccessible::Name) - return QString("Plasma Desktop"); - return QAccessibleWidgetEx::text ( t, child ); -} - -int AccessiblePlasmaView::childCount() const -{ - return view()->containment() ? view()->containment()->applets().size() : 0; -} - -int AccessiblePlasmaView::indexOfChild ( const QAccessibleInterface* child ) const -{ - return QAccessibleWidgetEx::indexOfChild ( child ); -} - -int AccessiblePlasmaView::navigate ( QAccessible::RelationFlag rel, int entry, QAccessibleInterface** target ) const -{ - *target = 0; - switch (rel) { - case QAccessible::Child: - // FIXME check if valid - *target = new AccessiblePlasmaApplet(view()->containment()->applets().at(entry - 1)); - return 0; - default: - break; - } - - return QAccessibleWidgetEx::navigate ( rel, entry, target ); -} - - -AccessiblePlasmaPanelView::AccessiblePlasmaPanelView ( View* view) - : AccessiblePlasmaView ( view, QAccessible::Pane ) -{} - -QString AccessiblePlasmaPanelView::text ( QAccessible::Text t, int child ) const -{ - if (child == 0 && t == QAccessible::Name) - return QString("Plasma Panel"); - return QAccessibleWidgetEx::text ( t, child ); -} - -AccessiblePlasmaApp::AccessiblePlasmaApp(PlasmaApp *app) - : QAccessibleApplication(), m_app(app) -{} - -int AccessiblePlasmaApp::childCount() const -{ - // FIXME: return actual desktops or somesuch - return QAccessibleApplication::childCount(); -} - -// int AccessiblePlasmaApp::navigate(QAccessible::RelationFlag , int , QAccessibleInterface** ) const -// { -// -// return QAccessibleApplication::navigate(, , ); -// } - -AccessiblePlasmaApplet::AccessiblePlasmaApplet(Applet* applet) - : QAccessibleObjectEx(applet) -{} - -QString AccessiblePlasmaApplet::text(QAccessible::Text t, int child) const -{ - if (t == QAccessible::Name) - return applet()->name(); - return QString(); -} - -int AccessiblePlasmaApplet::childCount() const -{ - return 0; -} -int AccessiblePlasmaApplet::childAt(int x, int y) const -{ - return -1; -} -int AccessiblePlasmaApplet::indexOfChild(const QAccessibleInterface* ) const -{ - return -1; -} -int AccessiblePlasmaApplet::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface** iface) const -{ - return -1; -} -QRect AccessiblePlasmaApplet::rect(int child) const -{ - // FIXME check if this is sensible - return applet()->screenRect(); -} -QVariant AccessiblePlasmaApplet::invokeMethodEx(QAccessible::Method method, int child, const QVariantList& params) -{ - return QVariant(); -} -QAccessible::Role AccessiblePlasmaApplet::role(int child) const -{ - return QAccessible::Pane; -} -QAccessible::Relation AccessiblePlasmaApplet::relationTo(int child, const QAccessibleInterface* other, int otherChild) const -{ - return QAccessible::Unrelated; -} -QAccessible::State AccessiblePlasmaApplet::state(int child) const -{ - // FIXME - return 0; -} - - - - - - diff --git a/plasma/shells/plasma-desktop/accessibility/accessibleplasmaview.h b/plasma/shells/plasma-desktop/accessibility/accessibleplasmaview.h deleted file mode 100644 index db67fb53..00000000 --- a/plasma/shells/plasma-desktop/accessibility/accessibleplasmaview.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2012 Frederik Gladhorn - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - -#ifndef ACCESSIBLEPLASMAVIEW_H -#define ACCESSIBLEPLASMAVIEW_H - -#include -#include - -#include - -#include "desktopview.h" -#include "panelview.h" -#include "plasmaapp.h" - - -class AccessiblePlasmaView : public QAccessibleWidgetEx -{ -public: - AccessiblePlasmaView(Plasma::View *view, QAccessible::Role role = QAccessible::Window); - - int childCount() const; - int indexOfChild ( const QAccessibleInterface* child ) const; - int navigate ( QAccessible::RelationFlag rel, int entry, QAccessibleInterface** target ) const; - - QString text ( Text t, int child ) const; - -private: - inline Plasma::View *view() const - { - return static_cast(object()); - } -}; - -class AccessiblePlasmaPanelView : public AccessiblePlasmaView -{ -public: - AccessiblePlasmaPanelView (Plasma::View* view); - QString text ( QAccessible::Text t, int child ) const; - -private: - inline PanelView *view() const - { - return static_cast(object()); - } -}; - -class AccessiblePlasmaApp : public QAccessibleApplication -{ -public: - AccessiblePlasmaApp(PlasmaApp *app); - - int childCount() const; -// int navigate(RelationFlag , int , QAccessibleInterface** ) const; - -private: - PlasmaApp *m_app; -}; - -class AccessiblePlasmaApplet : public QAccessibleObjectEx -{ -public: - AccessiblePlasmaApplet(Plasma::Applet *applet); - virtual int childCount() const; - virtual int indexOfChild(const QAccessibleInterface* ) const; - - virtual int childAt(int x, int y) const; - virtual QVariant invokeMethodEx(Method method, int child, const QVariantList& params); - virtual int navigate(RelationFlag relation, int index, QAccessibleInterface** iface) const; - virtual Relation relationTo(int child, const QAccessibleInterface* other, int otherChild) const; - virtual Role role(int child) const; - virtual State state(int child) const; - virtual QString text(Text t, int child) const; - - virtual QRect rect(int child) const; - - inline Plasma::Applet *applet() const { - return static_cast(object()); - } -}; - -#endif // ACCESSIBLEPLASMAVIEW_H diff --git a/plasma/shells/plasma-desktop/main.cpp b/plasma/shells/plasma-desktop/main.cpp index c2f9fded..ce2dd650 100644 --- a/plasma/shells/plasma-desktop/main.cpp +++ b/plasma/shells/plasma-desktop/main.cpp @@ -40,8 +40,6 @@ #include #include -#include "accessibility/accessiblefactory.h" - static const char description[] = I18N_NOOP( "The KDE desktop, panels and widgets workspace application." ); QString plasmaLocale; @@ -118,10 +116,6 @@ int main(int argc, char **argv) QApplication::setWindowIcon(KIcon("plasma")); app->disableSessionManagement(); // autostarted -#ifndef QT_NO_ACCESSIBILITY - QAccessible::installFactory(Plasma::accessibleInterfaceFactory); -#endif - int rc = app->exec(); delete app; return rc; -- 2.11.0