[gnome-calculator] math-display: Inhibit the OSK
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] math-display: Inhibit the OSK
- Date: Mon, 29 Mar 2021 17:34:55 +0000 (UTC)
commit 5b9f97fe31de2ac11954fd048fafacd20ea3db85
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Jan 13 08:35:34 2020 +0100
math-display: Inhibit the OSK
This drop the OSK in all modes but the keyboard mode, as it duplicates
the in-window buttons, and hinders the usability on touchscreens. This
also prevents adding emojis and drops spellchecking as they aren't
relevant to a calculator.
src/math-display.vala | 8 ++++++++
src/math-window.vala | 1 +
2 files changed, 9 insertions(+)
---
diff --git a/src/math-display.vala b/src/math-display.vala
index e19f4f39..760fd397 100644
--- a/src/math-display.vala
+++ b/src/math-display.vala
@@ -58,6 +58,8 @@ public class MathDisplay : Gtk.Box
source_view.set_pixels_below_lines (2);
source_view.set_justification (Gtk.Justification.LEFT);
+ set_enable_osk (false);
+
source_view.set_name ("displayitem");
source_view.set_size_request (20, 20);
source_view.get_accessible ().set_role (Atk.Role.EDITBAR);
@@ -99,6 +101,12 @@ public class MathDisplay : Gtk.Box
equation.notify["error-token-end"].connect ((pspec) => { error_status_changed_cb (); });
}
+ public void set_enable_osk (bool enable_osk)
+ {
+ const Gtk.InputHints hints = Gtk.InputHints.NO_EMOJI | Gtk.InputHints.NO_SPELLCHECK;
+ source_view.set_input_hints (enable_osk ? hints : hints | Gtk.InputHints.INHIBIT_OSK);
+ }
+
public void grabfocus () /* Editbar grabs focus when an instance of gnome-calculator is created */
{
source_view.grab_focus ();
diff --git a/src/math-window.vala b/src/math-window.vala
index 122aacbf..7e0cb0f2 100644
--- a/src/math-window.vala
+++ b/src/math-window.vala
@@ -125,6 +125,7 @@ public class MathWindow : Hdy.ApplicationWindow
converter.show ();
}
+ display.set_enable_osk (remove_buttons);
resize (1, 1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]