File: Initialise-ibus-within-the-class-constructor.patch

package info (click to toggle)
budgie-desktop 10.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,560 kB
  • sloc: ansic: 8,439; xml: 844; sh: 126; makefile: 42
file content (117 lines) | stat: -rw-r--r-- 3,371 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Forwarded: https://github.com/BuddiesOfBudgie/budgie-desktop/pull/168
Authord: David Mohammed <fossfreedom@ubuntu.com>
Last-Update: 2023-02-23
Description: [PATCH] Initialise ibus within the class constructor to prevent
 crashes with the new gnomekbd and cleanup

---
 src/wm/keyboard.vala | 54 +++++++++++++++++++++++++++++---------------
 1 file changed, 36 insertions(+), 18 deletions(-)

--- a/src/wm/keyboard.vala
+++ b/src/wm/keyboard.vala
@@ -50,6 +50,7 @@
 			if (e_variant != null && e_variant.length > 0) {
 				this.variant = e_variant;
 			}
+
 			this.layout = engine.layout;
 			this.ibus_engine = id;
 		}
@@ -77,8 +78,9 @@
 		private bool is_keyboard_held = false;
 
 		public static void init (Budgie.BudgieWM? wm) {
-			if (instance != null)
+			if (instance != null) {
 				return;
+			}
 
 			instance = new KeyboardManager (wm);
 
@@ -98,23 +100,24 @@
 			var schema = new Settings("org.gnome.desktop.wm.keybindings");
 			wm.get_display().add_keybinding("switch-input-source", schema, Meta.KeyBindingFlags.NONE, switch_input_source);
 			wm.get_display().add_keybinding("switch-input-source-backward", schema, Meta.KeyBindingFlags.NONE, switch_input_source_backward);
+
+			xkb = new Gnome.XkbInfo();
+			/* Only hook things up when ibus is setup, whether it failed or not */
+			ibus_manager = new IBusManager(this);
+			ibus_manager.ready.connect(on_ibus_ready);
+			ibus_manager.do_init();
 		}
 
 		construct {
 			var schema = GLib.SettingsSchemaSource.get_default ().lookup ("org.gnome.desktop.input-sources", true);
-			if (schema == null)
+			if (schema == null) {
 				return;
+			}
 
 			settings = new GLib.Settings.full (schema, null, null);
 			Signal.connect (settings, "changed", (Callback) set_keyboard_layout, this);
 
 			set_keyboard_layout ("current");
-
-			xkb = new Gnome.XkbInfo();
-			/* Only hook things up when ibus is setup, whether it failed or not */
-			ibus_manager = new IBusManager(this);
-			ibus_manager.ready.connect(on_ibus_ready);
-			ibus_manager.do_init();
 		}
 
 		[CCode (instance_pos = -1)]
@@ -139,6 +142,7 @@
 			if (sources == null || sources.length == 0) {
 				return;
 			}
+
 			current_source = (current_source+1) % sources.length;
 			this.hold_keyboard();
 			this.apply_layout(current_source);
@@ -152,6 +156,7 @@
 			if (sources == null || sources.length == 0) {
 				return;
 			}
+
 			current_source = (current_source-1) % sources.length;
 			this.hold_keyboard();
 			this.apply_layout(current_source);
@@ -210,6 +215,7 @@
 						message("Error adding source %s|%s: %s", id, type, e.message);
 						continue;
 					}
+
 					sources.append_val(source);
 				}
 			}
@@ -257,6 +263,7 @@
 			if (idx > sources.length) {
 				idx = 0;
 			}
+
 			this.current_source = idx;
 			Meta.Display display = wm.get_display();
 			Meta.Context ctx = display.get_context();
@@ -329,11 +336,13 @@
 		private void apply_ibus() {
 			string engine_name;
 			InputSource? current = sources.index(current_source);
+
 			if (current != null && current.ibus_engine != null) {
 				engine_name = current.ibus_engine;
 			} else {
 				engine_name = DEFAULT_ENGINE;
 			}
+
 			this.ibus_manager.set_engine(engine_name);
 		}
 
@@ -345,6 +354,7 @@
 			if (!is_keyboard_held) {
 				return;
 			}
+
 			wm.get_display().ungrab_keyboard(wm.get_display().get_current_time());
 			is_keyboard_held = false;
 		}