From d52f9ad0ffcd70d5003cb8237d768f9575bbbb1d Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Sun, 27 Nov 2022 17:32:07 -0500 Subject: [PATCH] minimum xic support for minigui input proxy --- minigui.d | 2 ++ simpledisplay.d | 26 +++++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/minigui.d b/minigui.d index c3a3d5a..9c23bca 100644 --- a/minigui.d +++ b/minigui.d @@ -8171,6 +8171,8 @@ class Window : Widget { dispatchCharEvent(e); }, ); + + this.inputProxy.populateXic(); // done //+/ } diff --git a/simpledisplay.d b/simpledisplay.d index efbf9b1..1733a5a 100644 --- a/simpledisplay.d +++ b/simpledisplay.d @@ -14764,17 +14764,7 @@ mixin DynamicLoad!(XRandr, "Xrandr", 2, XRandrLibrarySuccessfullyLoaded) XRandrL // input context //TODO: create this only for top-level windows, and reuse that? - if (XDisplayConnection.xim !is null) { - xic = XCreateIC(XDisplayConnection.xim, - /*XNInputStyle*/"inputStyle".ptr, XIMPreeditNothing|XIMStatusNothing, - /*XNClientWindow*/"clientWindow".ptr, window, - /*XNFocusWindow*/"focusWindow".ptr, window, - null); - if (xic is null) { - import core.stdc.stdio : stderr, fprintf; - fprintf(stderr, "XCreateIC failed for window %u\n", cast(uint)window); - } - } + populateXic(); if (sdpyWindowClassStr is null) loadBinNameToWindowClassName(); if (sdpyWindowClassStr is null) sdpyWindowClass = "DSimpleWindow"; @@ -14947,6 +14937,20 @@ mixin DynamicLoad!(XRandr, "Xrandr", 2, XRandrLibrarySuccessfullyLoaded) XRandrL } } + void populateXic() { + if (XDisplayConnection.xim !is null) { + xic = XCreateIC(XDisplayConnection.xim, + /*XNInputStyle*/"inputStyle".ptr, XIMPreeditNothing|XIMStatusNothing, + /*XNClientWindow*/"clientWindow".ptr, window, + /*XNFocusWindow*/"focusWindow".ptr, window, + null); + if (xic is null) { + import core.stdc.stdio : stderr, fprintf; + fprintf(stderr, "XCreateIC failed for window %u\n", cast(uint)window); + } + } + } + void selectDefaultInput(bool forceIncludeMouseMotion) { auto mask = EventMask.ExposureMask | EventMask.KeyPressMask |