Skip to content
Commits on Source (2)
......@@ -39,6 +39,7 @@ compiz (2:0.9.13.1+hypra+18.04.20180302-1~bpo9+1+hypra7.8) UNRELEASED; urgency=m
colorfilter plugin.
* 0003-colorfilter-French-translation-update.patch: New patch to
update the French translation for the previous two.
* 19_ezoom-focus-position: New patch to fix zoom area when focusing a window.
-- Samuel Thibault <sthibault@debian.org> Tue, 15 May 2018 11:26:46 +0200
......
Consider the caret position when focusing editable fields
This allows to have a consistent position upon focus of such fields
that have a finer granularity than a plain block.
--- a/plugins/focuspoll/src/accessibilitywatcher.cpp
+++ b/plugins/focuspoll/src/accessibilitywatcher.cpp
@@ -357,10 +357,15 @@ AccessibilityWatcher::registerEvent (con
res->w = size.get ()->width;
res->h = size.get ()->height;
}
+
+ // getting the states on event
+ auto stateSet = unique_gobject (atspi_accessible_get_state_set (event->source));
+
+ auto text = unique_gobject (atspi_accessible_get_text (event->source));
// let's get the caret offset, and then its position for a caret event
- if (strcmp (type, "caret") == 0)
+ if (strcmp (type, "caret") == 0 ||
+ (text.get () && atspi_state_set_contains (stateSet.get (), ATSPI_STATE_EDITABLE)))
{
- auto text = unique_gobject (atspi_accessible_get_text (event->source));
if (!text.get ())
{
delete (res);
@@ -369,7 +374,7 @@ AccessibilityWatcher::registerEvent (con
auto offset = atspi_text_get_caret_offset (text.get (), NULL);
// if we are not at the beginning of the text, take the extent of the character under caret
// otherwise keep the whole widget
- if (event->detail1)
+ if (offset)
{
auto size = unique_gmem (atspi_text_get_character_extents (text.get (), offset, ATSPI_COORD_TYPE_SCREEN, NULL));
res->x = size.get ()->x;
@@ -390,14 +395,16 @@ AccessibilityWatcher::registerEvent (con
res->h = size.get ()->height;
}
// when result is obviously not a caret size
- if (strcmp (event->type, "object:text-caret-moved") == 0 && (res->w > A11YWATCHER_MAX_CARET_WIDTH || res->h > A11YWATCHER_MAX_CARET_HEIGHT))
+ if ((strcmp (event->type, "object:text-caret-moved") == 0 ||
+ strcmp (type, "caret") != 0) &&
+ (res->w > A11YWATCHER_MAX_CARET_WIDTH || res->h > A11YWATCHER_MAX_CARET_HEIGHT))
{
auto size = unique_gmem (atspi_text_get_character_extents (text.get (), offset, ATSPI_COORD_TYPE_SCREEN, NULL));
res->x = size.get ()->x;
res->y = size.get ()->y;
res->w = size.get ()->width;
res->h = size.get ()->height;
- if (strcmp (type, "caret") == 0 && strcmp (event->type, "object:text-caret-moved") == 0 && (res->w > A11YWATCHER_MAX_CARET_WIDTH || res->h > A11YWATCHER_MAX_CARET_HEIGHT))
+ if (res->w > A11YWATCHER_MAX_CARET_WIDTH || res->h > A11YWATCHER_MAX_CARET_HEIGHT)
{
res->x = 0;
res->y = 0;
@@ -408,7 +415,8 @@ AccessibilityWatcher::registerEvent (con
if (res->x == 0 && res->y == 0 &&
(strcmp (event->type, "object:text-changed:insert") == 0 ||
strcmp (event->type, "object:text-changed:removed") == 0 ||
- strcmp (event->type, "object:text-caret-moved") == 0)) {
+ strcmp (event->type, "object:text-caret-moved") == 0 ||
+ strcmp (type, "caret") != 0)) {
res->x = res->xAlt;
res->y = res->yAlt;
res->w = res->wAlt;
@@ -416,8 +424,6 @@ AccessibilityWatcher::registerEvent (con
}
}
- // getting the states on event
- auto stateSet = unique_gobject (atspi_accessible_get_state_set (event->source));
if (atspi_state_set_contains (stateSet.get (), ATSPI_STATE_FOCUSED))
{
res->focused = true;
@@ -560,7 +566,15 @@ AccessibilityWatcher::appSpecificFilter
focusList.push_back (focus);
return true;
}
- if (strcmp (focus->type, "caret") == 0 && !(focus->x == 0 && focus->y == 0) &&
+ auto text = unique_gobject (atspi_accessible_get_text (event->source));
+ bool isEditableText = false;
+ if (text.get ())
+ {
+ auto stateSet = unique_gobject (atspi_accessible_get_state_set (event->source));
+ isEditableText = atspi_state_set_contains (stateSet.get (), ATSPI_STATE_EDITABLE);
+ }
+ if ((strcmp (focus->type, "caret") == 0 || isEditableText) &&
+ !(focus->x == 0 && focus->y == 0) &&
!(focus->x < -2000 || focus->y < -2000))
{
focusList.push_back (focus);
@@ -569,7 +583,7 @@ AccessibilityWatcher::appSpecificFilter
if (!noAltCaret)
{
getAlternativeCaret (focus, event);
- if (strcmp (focus->type, "caret") == 0 &&
+ if ((strcmp (focus->type, "caret") == 0 || isEditableText) &&
!(focus->xAlt == 0 && focus->yAlt == 0) &&
!(focus->xAlt < screenWidth * -1 || focus->yAlt < screenHeight * -1)
)
......@@ -30,3 +30,4 @@
0001-colorfilter-Add-an-option-to-enable-filtering-at-sta.patch
0002-colorfilter-Add-an-option-to-disable-cumulative-filt.patch
0003-colorfilter-French-translation-update.patch
19_ezoom-focus-position