Skip to content

Commit 46d7246

Browse files
committed
ShellClients: Introduce an IBusCandidateWindow
1 parent a51700e commit 46d7246

4 files changed

Lines changed: 39 additions & 6 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2026 elementary, Inc. (https://elementary.io)
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*
5+
* Authored by: Leonhard Kargl <leo.kargl@proton.me>
6+
*/
7+
8+
public class Gala.IBusCandidateWindow : PositionedWindow {
9+
public InputMethod im { get; construct; }
10+
11+
public IBusCandidateWindow (InputMethod im, Meta.Window window) {
12+
Object (im: im, window: window);
13+
}
14+
15+
construct {
16+
im.notify["cursor-location"].connect (position_window);
17+
}
18+
19+
protected override void get_window_position (Mtk.Rectangle window_rect, out int x, out int y) {
20+
x = (int) (im.cursor_location.origin.x + im.cursor_location.size.width);
21+
y = (int) (im.cursor_location.origin.y + im.cursor_location.size.height);
22+
}
23+
}

src/ShellClients/ShellClientsManager.vala

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88
public class Gala.ShellClientsManager : Object, GestureTarget {
99
private static ShellClientsManager instance;
1010

11-
public static void init (WindowManager wm) {
11+
public static void init (WindowManager wm, InputMethod im) {
1212
if (instance != null) {
1313
return;
1414
}
1515

16-
instance = new ShellClientsManager (wm);
16+
instance = new ShellClientsManager (wm, im);
1717
}
1818

1919
public static unowned ShellClientsManager? get_instance () {
2020
return instance;
2121
}
2222

2323
public WindowManager wm { get; construct; }
24+
public InputMethod im { get; construct; }
2425

2526
private NotificationsClient notifications_client;
2627
private ManagedClient[] protocol_clients = {};
@@ -29,9 +30,10 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
2930

3031
private GLib.HashTable<Meta.Window, PanelWindow> panel_windows = new GLib.HashTable<Meta.Window, PanelWindow> (null, null);
3132
private GLib.HashTable<Meta.Window, ExtendedBehaviorWindow> positioned_windows = new GLib.HashTable<Meta.Window, ExtendedBehaviorWindow> (null, null);
33+
private IBusCandidateWindow? ibus_candidate_window = null;
3234

33-
private ShellClientsManager (WindowManager wm) {
34-
Object (wm: wm);
35+
private ShellClientsManager (WindowManager wm, InputMethod im) {
36+
Object (wm: wm, im: im);
3537
}
3638

3739
construct {
@@ -244,6 +246,12 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
244246
positioned_windows[window].make_modal (dim);
245247
}
246248

249+
public void make_ibus_candidate_window (Meta.Window window) requires (ibus_candidate_window == null) {
250+
ibus_candidate_window = new IBusCandidateWindow (im, window);
251+
252+
window.unmanaged.connect_after (() => ibus_candidate_window = null);
253+
}
254+
247255
public void propagate (UpdateType update_type, GestureAction action, double progress) {
248256
foreach (var window in positioned_windows.get_values ()) {
249257
window.propagate (update_type, action, progress);
@@ -258,7 +266,8 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
258266
return (
259267
(window in positioned_windows && positioned_windows[window].modal) ||
260268
(window in panel_windows) ||
261-
NotificationStack.is_notification (window)
269+
NotificationStack.is_notification (window) ||
270+
window == ibus_candidate_window?.window
262271
);
263272
}
264273

src/WindowManager.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ namespace Gala {
138138
input_method = new InputMethod (get_display ());
139139
Clutter.get_default_backend ().set_input_method (input_method);
140140

141-
ShellClientsManager.init (this);
141+
ShellClientsManager.init (this, input_method);
142142
BlurManager.init (this);
143143
daemon_manager = new DaemonManager (get_display ());
144144

src/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ gala_bin_sources = files(
4646
'HotCorners/HotCornerManager.vala',
4747
'ShellClients/ExtendedBehaviorWindow.vala',
4848
'ShellClients/HideTracker.vala',
49+
'ShellClients/IBusCandidateWindow.vala',
4950
'ShellClients/ManagedClient.vala',
5051
'ShellClients/NotificationsClient.vala',
5152
'ShellClients/PanelWindow.vala',

0 commit comments

Comments
 (0)