Debian Codegraph @

debian/patches/focus-position

raw
1 commit 8de53f9402a02f24caf78fa9e6f1a31605263ee8
2 Author: Colomban Wendling <[email protected]>
3 Date: Thu Jul 30 17:59:52 2020 +0200
4
5 focuspoll: Fix focus position on some situation with ATK >= 2.36
6
7 ATK 2.36 started returning -1 to mean "unknown value", both in
8 functions that otherwise didn't set the value, and for
9 atk_text_get_character_extents() that used to fill with 0s although it
10 wasn't documented.
11
12 diff --git a/src/focuspoll/accessibilitywatcher.cpp b/src/focuspoll/accessibilitywatcher.cpp
13 index 9952755..840763e 100644
14 --- a/src/focuspoll/accessibilitywatcher.cpp
15 +++ b/src/focuspoll/accessibilitywatcher.cpp
16 @@ -595,7 +595,7 @@ AccessibilityWatcher::activityEvent (const AtspiEvent *event, const gchar *type)
17 }
18
19 // still no offset, it's probably a newline and we're at bugzilla #1319273 (with new paragraph obj)
20 - if (res->x == 0 && res->y == 0 &&
21 + if (((res->x == 0 && res->y == 0) || (res->x == -1 && res->y == -1)) &&
22 (strcmp (event->type, "object:text-changed:insert") == 0 ||
23 strcmp (event->type, "object:text-changed:removed") == 0 ||
24 strcmp (event->type, "object:text-caret-moved") == 0 ||
25 @@ -698,7 +698,7 @@ AccessibilityWatcher::appSpecificFilter (FocusInfo *focus, const AtspiEvent* eve
26 focus->w = focus->wAlt;
27 focus->h = focus->hAlt;
28 }
29 - if (!(focus->x == 0 && focus->y == 0))
30 + if (!((focus->x == 0 && focus->y == 0) || (focus->x == -1 && focus->y == -1)))
31 { // prevents compose window loss of tracking in HTML mode (active flag ok, but no focused flag)
32 queueFocus (focus);
33 return true;
34 @@ -743,14 +743,14 @@ AccessibilityWatcher::appSpecificFilter (FocusInfo *focus, const AtspiEvent* eve
35 isEditableText = atspi_state_set_contains (stateSet.get (), ATSPI_STATE_EDITABLE);
36 }
37 if ((strcmp (focus->type, "caret") == 0 || isEditableText) &&
38 - !(focus->x == 0 && focus->y == 0))
39 + !((focus->x == 0 && focus->y == 0) || (focus->x == -1 && focus->y == -1)))
40 {
41 queueFocus (focus);
42 return true;
43 }
44 getAlternativeCaret (focus, event);
45 if ((strcmp (focus->type, "caret") == 0 || isEditableText) &&
46 - !(focus->xAlt == 0 && focus->yAlt == 0))
47 + !((focus->xAlt == 0 && focus->yAlt == 0) || (focus->xAlt == -1 && focus->yAlt == -1)))
48 {
49 focus->x = focus->xAlt;
50 focus->y = focus->yAlt;
51 @@ -865,7 +865,7 @@ AccessibilityWatcher::getAlternativeCaret (FocusInfo *focus, const AtspiEvent* e
52 string = unique_gmem (atspi_text_get_string_at_offset (text.get (), offset - charIndex, ATSPI_TEXT_GRANULARITY_CHAR, NULL));
53 caretChar = string.get ()->content[0];
54 // if we found a caret, check we're at beginning of line (or of text) to extrapolate position
55 - if (size.get ()->x != 0 || size.get ()->y != 0)
56 + if ((size.get ()->x != 0 || size.get ()->y != 0) && (size.get ()->x != -1 || size.get ()->y != -1))
57 {
58 if (offset - charIndex -1 >= 0 && unique_gmem (atspi_text_get_string_at_offset (text.get (), offset - charIndex -1, ATSPI_TEXT_GRANULARITY_CHAR, NULL)).get ()->content[0] == '\n')
59 {