fix(x11): engage fcitx by default so dmenu text-input dialogs work
Text-input dialogs (Wi-Fi SSID/Passphrase, search queries, config prompts, etc.) invoke dmenu with -p but never -t, so the XIM/fcitx routing that was gated solely by use_text_input was never enabled and fcitx never activated on dmenu input; on the numeric keypad only raw digits could be entered, making the dialogs non-functional. Decouple the fcitx/IME routing from the -t flag via a new engage_ime flag (default on) while keeping use_text_input for its output/selection semantics, and skip routing Enter to fcitx when a menu list is present so menu selection is never stolen by the T9 commit. XFilterEvent already returns False when fcitx is toggled off via the mode switcher, so the dialogs now respect the Fcitx mode switcher automatically.
This commit is contained in:
Binary file not shown.
Binary file not shown.
+10
-10
@@ -77,7 +77,8 @@ static size_t items_cap = 0;
|
||||
static struct item *matches, *matchend;
|
||||
static struct item *prev, *curr, *next, *sel, *nav;
|
||||
static int mon = -1, screen;
|
||||
static int use_text_input = 0;
|
||||
static int use_text_input = 0; /* selection/output mode: with -t, Shift inverts item vs typed text */
|
||||
static int engage_ime = 1; /* engage fcitx (XIM) for text entry by default so the T9 input method activates on dmenu prompts */
|
||||
static int initialindex = 0;
|
||||
static int managed = 0;
|
||||
static int curpos = 0, oldcurlen = 0;
|
||||
@@ -236,8 +237,7 @@ reset_session_defaults(int case_insensitive, const char *new_prompt)
|
||||
free_items();
|
||||
topbar = 1;
|
||||
centered = 0;
|
||||
lines = default_lines;
|
||||
use_text_input = 0;
|
||||
use_text_input = 0; /* reset selection/output mode; fcitx routing (engage_ime) stays on */
|
||||
initialindex = 0;
|
||||
fstrncmp = case_insensitive ? strncasecmp : strncmp;
|
||||
fstrstr = case_insensitive ? cistrstr : strstr;
|
||||
@@ -2175,7 +2175,7 @@ show_menu(void)
|
||||
}
|
||||
|
||||
inputw = MIN(inputw, mw / 3);
|
||||
if (xic && use_text_input) {
|
||||
if (xic && engage_ime) {
|
||||
char *r = Xutf8ResetIC(xic);
|
||||
if (r)
|
||||
XFree(r);
|
||||
@@ -2216,7 +2216,7 @@ show_menu(void)
|
||||
grabkeyboard();
|
||||
if (!daemon_mode)
|
||||
grabfocus();
|
||||
if (xic && use_text_input)
|
||||
if (xic && engage_ime)
|
||||
XSetICFocus(xic);
|
||||
XFlush(dpy);
|
||||
} else {
|
||||
@@ -2226,7 +2226,7 @@ show_menu(void)
|
||||
initial_released = (query_trigger_keys_down() == 0);
|
||||
XRaiseWindow(dpy, win);
|
||||
drawmenu();
|
||||
if (xic && use_text_input)
|
||||
if (xic && engage_ime)
|
||||
XSetICFocus(xic);
|
||||
XFlush(dpy);
|
||||
}
|
||||
@@ -2244,7 +2244,7 @@ hide_menu(void)
|
||||
soft_pending = 0;
|
||||
soft_deadline = 0;
|
||||
|
||||
if (xic && use_text_input) {
|
||||
if (xic && engage_ime) {
|
||||
char *r = Xutf8ResetIC(xic);
|
||||
if (r)
|
||||
XFree(r);
|
||||
@@ -2505,12 +2505,12 @@ process_x11_events(void)
|
||||
if (!initial_released || dmenu_now_ms() < start_ignore)
|
||||
continue;
|
||||
}
|
||||
if (use_text_input && !issoftkey(ev.xkey.keycode)) {
|
||||
if (engage_ime && !issoftkey(ev.xkey.keycode) && !(is_enter && items)) {
|
||||
ev.xkey.window = win;
|
||||
if (XFilterEvent(&ev, None))
|
||||
continue;
|
||||
}
|
||||
} else if (use_text_input && XFilterEvent(&ev, None)) {
|
||||
} else if (engage_ime && XFilterEvent(&ev, None)) {
|
||||
continue;
|
||||
}
|
||||
switch (ev.type) {
|
||||
@@ -2533,7 +2533,7 @@ process_x11_events(void)
|
||||
if (menu_active || !daemon_mode) {
|
||||
if (!daemon_mode && ev.xfocus.window != win)
|
||||
grabfocus();
|
||||
if (xic && use_text_input)
|
||||
if (xic && engage_ime)
|
||||
XSetICFocus(xic);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user