diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-04-14 19:14:53 +0300 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-04-23 15:09:49 +0300 |
commit | 0267f1cf497043a04a5367a33a0d66ae5e879705 (patch) | |
tree | bdd04f95e294e73b44cf19add63d3528fe09a0f7 /src/komposedesktopwidget.cpp | |
parent | 22875e8865b87e40646015e882a444b8bf6965ac (diff) | |
download | kompose-0267f1cf497043a04a5367a33a0d66ae5e879705.tar.gz kompose-0267f1cf497043a04a5367a33a0d66ae5e879705.zip |
Added Ctrl+[movement keys] for keyboard navigation between desktops.
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src/komposedesktopwidget.cpp')
-rw-r--r-- | src/komposedesktopwidget.cpp | 68 |
1 files changed, 48 insertions, 20 deletions
diff --git a/src/komposedesktopwidget.cpp b/src/komposedesktopwidget.cpp index 4c1bbde..0f3c567 100644 --- a/src/komposedesktopwidget.cpp +++ b/src/komposedesktopwidget.cpp @@ -31,6 +31,7 @@ #include <tqpainter.h> #include <tqapplication.h> #include <tqdragobject.h> +#include <tqobjectlist.h> #include <tqtooltip.h> #include <tdelocale.h> @@ -109,48 +110,75 @@ void KomposeDesktopWidget::initFonts() // return (double)deskRect.width() / (double)deskRect.height(); // } +void KomposeDesktopWidget::setHighlight() +{ + highlight = true; + repaint(); +} + +void KomposeDesktopWidget::clearHighlight() +{ + highlight = false; + repaint(); +} + +void KomposeDesktopWidget::setInactive() +{ + if( hasFocus() ) + clearFocus(); +} + +void KomposeDesktopWidget::setActive() +{ + // Focus first window (if there is one) + const TQObjectList *lst = children(); + + if ( lst ) + { + TQObjectListIterator it( *lst ); + TQWidget *widget; + while ( (widget = (TQWidget*)it.current() ) ) + { + if (widget->inherits("KomposeTaskWidget")) + { + widget->setFocus(); + break; + } + ++it; + } + } + + emit activated(this); +} void KomposeDesktopWidget::leaveEvent ( TQEvent * ) { - // Unset highlight if cursor moves out of our rect + unsetCursor(); + + // Mark desktop as inactive if cursor moves out of our rect // but not if it enters a child widget TQRect deskRect; deskRect.setTopLeft(mapToGlobal( TQPoint(0,0) )); deskRect.setWidth(width()); deskRect.setHeight(height()); if ( !deskRect.contains( TQCursor::pos() ) ) - highlight = false; - - unsetCursor(); - repaint(); + setInactive(); } void KomposeDesktopWidget::enterEvent ( TQEvent * ) { - setFocus(); setCursor( KCursor::handCursor() ); - highlight = true; - repaint(); + setActive(); } void KomposeDesktopWidget::focusInEvent ( TQFocusEvent * ) { - highlight = true; - repaint(); + setActive(); } void KomposeDesktopWidget::focusOutEvent ( TQFocusEvent * ) { - // Unset highlight if cursor moves out of our rect - // but not if it enters a child widget - TQRect deskRect; - deskRect.setTopLeft(mapToGlobal( TQPoint(0,0) )); - deskRect.setWidth(width()); - deskRect.setHeight(height()); - if ( !deskRect.contains( TQCursor::pos() ) ) - highlight = false; - - repaint(); + setInactive(); } void KomposeDesktopWidget::mouseReleaseEvent ( TQMouseEvent * e ) |