Skip to content

Commit

Permalink
Fix control get text, e.g. in win matching criteria control argument
Browse files Browse the repository at this point in the history
was broken since last gi-repo update, not in previous release
fixes #74
  • Loading branch information
phil294 committed Mar 22, 2024
1 parent b76359f commit 264553d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/run/display/at-spi.cr
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,14 @@ module Run
parent.select_child(child_i) if parent
end
def get_text(accessible)
text = accessible.text_iface.text(0, -1).gsub('', "").strip()
text = accessible.name.gsub('', "").strip() if text.empty?
# the null pointer check is missing so this needs some improved handling. TODO: probably should be fixed in atspi shard instead?
_txt_iface = LibAtspi.atspi_accessible_get_text(accessible.to_unsafe)
if ! _txt_iface.null?
text = ::Atspi::AbstractText.new(_txt_iface, GICrystal::Transfer::Full).text(0, -1).gsub('', "").strip()
end
if text.nil? || text.empty?
text = accessible.name.gsub('', "").strip()
end
text.empty? ? nil : text
end
def set_text(accessible, text)
Expand Down

0 comments on commit 264553d

Please sign in to comment.