Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KMag
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Accessibility
KMag
Commits
88c3e1c5
Commit
88c3e1c5
authored
Jun 28, 2012
by
Amandeep Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made linking libkdea11yclient and keyboard-focus-tracking optional
parent
0bc696d8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
8 deletions
+52
-8
CMakeLists.txt
CMakeLists.txt
+11
-2
focustrackconfig.h.in
focustrackconfig.h.in
+1
-0
kmag.cpp
kmag.cpp
+17
-4
kmag.h
kmag.h
+3
-0
kmagzoomview.cpp
kmagzoomview.cpp
+6
-0
kmagzoomview.h
kmagzoomview.h
+14
-2
No files found.
CMakeLists.txt
View file @
88c3e1c5
...
...
@@ -4,7 +4,12 @@ find_package(KDE4 REQUIRED)
include
(
KDE4Defaults
)
include
(
MacroLibrary
)
find_package
(
LibKdeAccessibilityClient
)
macro_optional_find_package
(
LibKdeAccessibilityClient
)
macro_log_feature
(
LibKdeAccessibilityClient_FOUND
"libkdeaccessibilityclient"
"KDE client-side accessibility library"
"https://projects.kde.org/projects/playground/accessibility/libkdeaccessibilityclient"
FALSE
""
"Required to enable keyboard focus tracking."
)
configure_file
(
"
${
PROJECT_SOURCE_DIR
}
/focustrackconfig.h.in"
"
${
PROJECT_BINARY_DIR
}
/focustrackconfig.h"
)
add_definitions
(
${
QT_DEFINITIONS
}
${
KDE4_DEFINITIONS
}
)
add_definitions
(
-DQT_NO_CAST_FROM_ASCII
)
...
...
@@ -26,10 +31,14 @@ set(kmag_SRCS
kde4_add_executable
(
kmag
${
kmag_SRCS
}
)
target_link_libraries
(
kmag
${
KDE4_KIO_LIBS
}
)
target_link_libraries
(
kmag kdeaccessibilityclient
)
if
(
LibKdeAccessibilityClient_FOUND
)
target_link_libraries
(
kmag kdeaccessibilityclient
)
endif
(
LibKdeAccessibilityClient_FOUND
)
install
(
TARGETS kmag
${
INSTALL_TARGETS_DEFAULT_ARGS
}
)
macro_display_feature_log
()
########### install files ###############
...
...
focustrackconfig.h.in
0 → 100644
View file @
88c3e1c5
#cmakedefine LibKdeAccessibilityClient_FOUND
kmag.cpp
View file @
88c3e1c5
...
...
@@ -182,6 +182,7 @@ void KmagApp::initActions()
m_modeFollowMouse
->
setToolTip
(
i18n
(
"Magnify around the mouse cursor"
));
m_modeFollowMouse
->
setWhatsThis
(
i18n
(
"If selected, the area around the mouse cursor is magnified"
));
#ifdef LibKdeAccessibilityClient_FOUND
m_modeFollowFocus
=
new
KToggleAction
(
KIcon
(
QLatin1String
(
"view-restore"
)),
i18n
(
"&Follow Focus Mode"
),
this
);
actionCollection
()
->
addAction
(
QLatin1String
(
"mode_followfocus"
),
m_modeFollowFocus
);
connect
(
m_modeFollowFocus
,
SIGNAL
(
triggered
(
bool
)),
SLOT
(
slotModeFollowFocus
()));
...
...
@@ -189,6 +190,7 @@ void KmagApp::initActions()
m_modeFollowFocus
->
setIconText
(
i18n
(
"Focus"
));
m_modeFollowFocus
->
setToolTip
(
i18n
(
"Magnify around the keyboard focus"
));
m_modeFollowFocus
->
setWhatsThis
(
i18n
(
"If selected, the area around the keyboard cursor is magnified"
));
#endif
m_modeSelWin
=
new
KToggleAction
(
KIcon
(
QLatin1String
(
"window"
)),
i18n
(
"Se&lection Window Mode"
),
this
);
actionCollection
()
->
addAction
(
QLatin1String
(
"mode_selectionwindow"
),
m_modeSelWin
);
...
...
@@ -330,8 +332,10 @@ void KmagApp::saveOptions()
if
(
m_modeFollowMouse
->
isChecked
())
cg
.
writeEntry
(
"Mode"
,
"followmouse"
);
#ifdef LibKdeAccessibilityClient_FOUND
else
if
(
m_modeFollowFocus
->
isChecked
())
cg
.
writeEntry
(
"Mode"
,
"followfocus"
);
#endif
else
if
(
m_modeWholeScreen
->
isChecked
())
cg
.
writeEntry
(
"Mode"
,
"wholescreen"
);
else
if
(
m_modeSelWin
->
isChecked
())
...
...
@@ -385,8 +389,10 @@ void KmagApp::readOptions()
slotModeWholeScreen
();
else
if
(
mode
==
QLatin1String
(
"selectionwindow"
))
slotModeSelWin
();
#ifdef LibKdeAccessibilityClient_FOUND
else
if
(
mode
==
QLatin1String
(
"followfocus"
))
slotModeFollowFocus
();
#endif
else
slotModeFollowMouse
();
...
...
@@ -640,12 +646,14 @@ void KmagApp::slotToggleRefresh()
void
KmagApp
::
slotModeWholeScreen
()
{
m_zoomView
->
followMouse
(
false
);
m_zoomView
->
followFocus
(
false
);
m_zoomView
->
setSelRectPos
(
QRect
(
0
,
0
,
QApplication
::
desktop
()
->
width
(),
QApplication
::
desktop
()
->
height
()));
m_zoomView
->
showSelRect
(
false
);
m_zoomView
->
setFitToWindow
(
false
);
m_modeFollowMouse
->
setChecked
(
false
);
#ifdef LibKdeAccessibilityClient_FOUND
m_zoomView
->
followFocus
(
false
);
m_modeFollowFocus
->
setChecked
(
false
);
#endif
m_modeWholeScreen
->
setChecked
(
true
);
m_modeSelWin
->
setChecked
(
false
);
}
...
...
@@ -654,11 +662,13 @@ void KmagApp::slotModeWholeScreen()
void
KmagApp
::
slotModeSelWin
()
{
m_zoomView
->
followMouse
(
false
);
m_zoomView
->
followFocus
(
false
);
m_zoomView
->
showSelRect
(
true
);
m_zoomView
->
setFitToWindow
(
false
);
m_modeFollowMouse
->
setChecked
(
false
);
#ifdef LibKdeAccessibilityClient_FOUND
m_zoomView
->
followFocus
(
false
);
m_modeFollowFocus
->
setChecked
(
false
);
#endif
m_modeWholeScreen
->
setChecked
(
false
);
m_modeSelWin
->
setChecked
(
true
);
}
...
...
@@ -667,16 +677,19 @@ void KmagApp::slotModeSelWin()
void
KmagApp
::
slotModeFollowMouse
()
{
m_zoomView
->
followMouse
(
true
);
m_zoomView
->
followFocus
(
false
);
m_zoomView
->
showSelRect
(
false
);
m_zoomView
->
setFitToWindow
(
true
);
m_modeFollowMouse
->
setChecked
(
true
);
#ifdef LibKdeAccessibilityClient_FOUND
m_zoomView
->
followFocus
(
false
);
m_modeFollowFocus
->
setChecked
(
false
);
#endif
m_modeWholeScreen
->
setChecked
(
false
);
m_modeSelWin
->
setChecked
(
false
);
}
#ifdef LibKdeAccessibilityClient_FOUND
void
KmagApp
::
slotModeFollowFocus
()
{
m_zoomView
->
followMouse
(
false
);
...
...
@@ -688,7 +701,7 @@ void KmagApp::slotModeFollowFocus()
m_modeWholeScreen
->
setChecked
(
false
);
m_modeSelWin
->
setChecked
(
false
);
}
#endif
void
KmagApp
::
slotToggleHideCursor
()
{
...
...
kmag.h
View file @
88c3e1c5
...
...
@@ -25,6 +25,7 @@
#define KMAG_H
#include "kmagzoomview.h"
#include "focustrackconfig.h"
// include files for Qt
#include <QtGui/QContextMenuEvent>
...
...
@@ -113,7 +114,9 @@ class KmagApp : public KXmlGuiWindow
void
slotToggleRefresh
();
void
slotModeFollowMouse
();
#ifdef LibKdeAccessibilityClient_FOUND
void
slotModeFollowFocus
();
#endif
void
slotModeWholeScreen
();
void
slotModeSelWin
();
...
...
kmagzoomview.cpp
View file @
88c3e1c5
...
...
@@ -139,8 +139,10 @@ KMagZoomView::KMagZoomView(QWidget *parent, const char *name)
if
(
m_fitToWindow
)
fitToWindow
();
#ifdef LibKdeAccessibilityClient_FOUND
//subscribe to focus events from registry
m_registry
.
subscribeEventListeners
(
KAccessibleClient
::
Registry
::
Focus
);
#endif
}
KMagZoomView
::~
KMagZoomView
()
...
...
@@ -206,6 +208,7 @@ void KMagZoomView::followMouse(bool follow)
}
}
#ifdef LibKdeAccessibilityClient_FOUND
/**
* This function will set/reset keyboard focus following of grab window.
*/
...
...
@@ -236,6 +239,7 @@ void KMagZoomView::focusChanged(const KAccessibleClient::AccessibleObject &objec
m_oldFocus
=
object
.
focusPoint
();
qDebug
()
<<
m_oldFocus
;
}
#endif
/**
* Called when the widget is hidden. Stop refresh when this happens.
...
...
@@ -891,9 +895,11 @@ void KMagZoomView::grabFrame()
if
(
m_followMouse
)
{
// set new center to be the current mouse position
newCenter
=
QCursor
::
pos
();
#ifdef LibKdeAccessibilityClient_FOUND
}
else
if
(
m_followFocus
)
{
// set the new center to the current keyboard cursor position
newCenter
=
m_oldFocus
;
#endif
}
// make sure the mouse position is not taking the grab window outside
...
...
kmagzoomview.h
View file @
88c3e1c5
...
...
@@ -44,6 +44,8 @@
//class KMagSelRect;
#include "kmagselrect.h"
#include "focustrackconfig.h"
/**
* The KMagZoomView class provides the view widget for the KmagApp instance.
*
...
...
@@ -70,9 +72,11 @@ class KMagZoomView : public QAbstractScrollArea
/// Returns the status of followMouse
bool
getFollowMouse
()
const
{
return
m_followMouse
;
}
#ifdef LibKdeAccessibilityClient_FOUND
/// Returns the status of followFocus
bool
getFollowFocus
()
const
{
return
m_followFocus
;
}
#endif
/// Get the status of "show rect. always"
bool
getShowSelRect
()
const
{
return
(
m_selRect
.
getAlwaysVisible
());
}
...
...
@@ -109,8 +113,10 @@ class KMagZoomView : public QAbstractScrollArea
/// Set grab-window-follows-mouse mode
void
followMouse
(
bool
follow
=
true
);
#ifdef LibKdeAccessibilityClient_FOUND
/// Set grab-window-follows-keyboard-focus mode
void
followFocus
(
bool
follow
=
true
);
#endif
/// Shows/Hides the selection marker
void
showSelRect
(
bool
show
=
true
);
...
...
@@ -130,10 +136,11 @@ class KMagZoomView : public QAbstractScrollArea
/// Fits the zoom view to the zoom view window
void
fitToWindow
();
#ifdef LibKdeAccessibilityClient_FOUND
private
slots
:
/// Called from a dbus service when followFocus is true
void
focusChanged
(
const
KAccessibleClient
::
AccessibleObject
&
object
);
#endif
protected:
/// Called when the widget is hidden
void
hideEvent
(
QHideEvent
*
e
);
...
...
@@ -187,8 +194,11 @@ class KMagZoomView : public QAbstractScrollArea
void
setupMatrix
();
private:
#ifdef LibKdeAccessibilityClient_FOUND
/// Global Accessibility Registry
KAccessibleClient
::
Registry
m_registry
;
#endif
/// Stores the pixmap which is recolored from the grabbed one
QPixmap
m_coloredPixmap
;
...
...
@@ -211,8 +221,10 @@ class KMagZoomView : public QAbstractScrollArea
/// Saves the center of the grab window
QPoint
m_oldCenter
;
#ifdef LibKdeAccessibilityClient_FOUND
/// Saves the keyboard focus position
QPoint
m_oldFocus
;
#endif
/// Possible modes for the mouse to be in
enum
KMagMouseMode
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment