diff options
Diffstat (limited to 'modules/gtk3/caribou-gtk-module.vala')
-rw-r--r-- | modules/gtk3/caribou-gtk-module.vala | 56 |
1 files changed, 2 insertions, 54 deletions
diff --git a/modules/gtk3/caribou-gtk-module.vala b/modules/gtk3/caribou-gtk-module.vala index c662878..5c0f062 100644 --- a/modules/gtk3/caribou-gtk-module.vala +++ b/modules/gtk3/caribou-gtk-module.vala @@ -52,12 +52,11 @@ namespace Caribou { Gtk.Widget? widget = window.get_focus(); uint32 timestamp = Gtk.get_current_event_time(); if (widget != null && (widget is Gtk.Entry || widget is Gtk.TextView) && widget is Gtk.Editable) { - Atk.Object focus_object = widget.get_accessible(); Gdk.Window current_window = widget.get_window(); int x=0, y=0, w=0, h=0; - if (current_window != null && !get_acc_geometry (focus_object, out x, out y, out w, out h)) { + if (current_window != null) get_origin_geometry (current_window, out x, out y, out w, out h); - } + try { keyboard.show (timestamp); keyboard.set_entry_location (x, y, w, h); @@ -85,56 +84,5 @@ namespace Caribou { #endif } - private Atk.Object? find_focused_accessible (Atk.Object acc) { - Atk.StateSet state = acc.ref_state_set (); - - bool match = (state.contains_state (Atk.StateType.EDITABLE) && - state.contains_state (Atk.StateType.FOCUSED) && - acc.get_n_accessible_children () == 0); - - if (match) - return acc; - - for (int i=0;i<acc.get_n_accessible_children ();i++) { - Atk.Object child = acc.ref_accessible_child (i); - Atk.Object focused_child = find_focused_accessible (child); - if (focused_child != null) - return focused_child; - } - - return null; - } - - private bool get_acc_geometry (Atk.Object acc, - out int x, out int y, out int w, out int h) { - Atk.Object child = null; - - - if (acc.get_role () == Atk.Role.REDUNDANT_OBJECT) { - /* It is probably Gecko */ - child = Atk.get_focus_object (); - } else { - child = find_focused_accessible (acc); - } - - if (child == null) - return false; - - if (!(child is Atk.Component)) { - stderr.printf ("Accessible is not a component\n"); - return false; - } - - /* We don't want the keyboard on the paragraph in OOo */ - if (child.get_role() == Atk.Role.PARAGRAPH) - child = child.get_parent(); - - Atk.component_get_extents ((Atk.Component) child, - out x, out y, out w, out h, - Atk.CoordType.SCREEN); - - return true; - } - } } |