Fix Bantam Apps menu entry, st XIM focus, and fcitx5-t9 InputContextDestroyed crash
This commit is contained in:
@@ -267,11 +267,10 @@ T9Engine::T9Engine(fcitx::Instance* instance)
|
||||
fcitx::EventType::InputContextDestroyed,
|
||||
fcitx::EventWatcherPhase::PreInputMethod,
|
||||
[this](fcitx::Event& event) {
|
||||
auto& icEvent = static_cast<fcitx::InputContextEvent&>(event);
|
||||
if (auto* ic = icEvent.inputContext()) {
|
||||
if (auto* state = ic->propertyFor(&factory)) {
|
||||
state->onFocusChange();
|
||||
}
|
||||
FCITX_UNUSED(event);
|
||||
if (sharedMode == T9Mode::Ctrl) {
|
||||
sharedMode = T9Mode::Lower;
|
||||
writeStatusIndicator("[abc]");
|
||||
}
|
||||
});
|
||||
writeStatusIndicator("[abc]");
|
||||
@@ -938,9 +937,14 @@ void T9State::cancelCommit() {
|
||||
}
|
||||
|
||||
void T9State::resetUI() {
|
||||
if (!ic) {
|
||||
return;
|
||||
}
|
||||
ic->inputPanel().reset();
|
||||
ic->updatePreedit();
|
||||
ic->updateUserInterface(fcitx::UserInterfaceComponent::InputPanel);
|
||||
if (ic->hasFocus()) {
|
||||
ic->updatePreedit();
|
||||
ic->updateUserInterface(fcitx::UserInterfaceComponent::InputPanel);
|
||||
}
|
||||
}
|
||||
|
||||
void T9State::showStatusBanner(const std::string& msg) {
|
||||
|
||||
+25
-2
@@ -1558,6 +1558,14 @@ add_parsed_choice_line(const char *line)
|
||||
trim_inplace(cmd);
|
||||
if (!label[0] || !cmd[0])
|
||||
return;
|
||||
for (size_t i = 0; i < items_count; i++) {
|
||||
if (items[i].text && strcmp(items[i].text, label) == 0)
|
||||
return;
|
||||
if (items[i].text && strstr(label, "Themes") && strstr(items[i].text, "Themes"))
|
||||
return;
|
||||
if (items[i].text && strstr(label, "Bantam") && strstr(items[i].text, "Bantam"))
|
||||
return;
|
||||
}
|
||||
int loop = (strchr(loop_str, '1') != NULL) ? 1 : 0;
|
||||
if (strncmp(cmd, "sxmo_appmenu.sh ", 16) == 0) {
|
||||
const char *sub = cmd + 16;
|
||||
@@ -1751,9 +1759,24 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
||||
} else if (strcmp(menu_name, "applications") == 0) {
|
||||
reset_session_defaults(1, "Apps");
|
||||
append_active_call_entries();
|
||||
snprintf(label, sizeof(label), "%s Themes", ICON_THM);
|
||||
add_menu_item(label, "@plugin:themes", 0);
|
||||
const char *home = getenv("HOME");
|
||||
char bpath[256];
|
||||
snprintf(bpath, sizeof(bpath), "%s/.local/bin/bantam", (home && home[0]) ? home : "/home/user");
|
||||
if (access("/usr/bin/bantam", X_OK) == 0 || access("/usr/local/bin/bantam", X_OK) == 0 || access(bpath, X_OK) == 0) {
|
||||
snprintf(label, sizeof(label), "%s Bantam", ICON_TRM);
|
||||
add_menu_item(label, "cd \"$HOME\" && sxmo_terminal.sh bantam", 0);
|
||||
}
|
||||
load_cache_or_hook("sxmo_apps.cache", "sxmo_hook_apps.sh");
|
||||
snprintf(label, sizeof(label), "%s Themes", ICON_THM);
|
||||
int has_themes = 0;
|
||||
for (size_t i = 0; i < items_count; i++) {
|
||||
if (items[i].text && strstr(items[i].text, "Themes")) {
|
||||
has_themes = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has_themes)
|
||||
add_menu_item(label, "@plugin:themes", 0);
|
||||
snprintf(label, sizeof(label), "%s System Menu", ICON_MNU);
|
||||
add_menu_item(label, "@menu:sys", 1);
|
||||
snprintf(label, sizeof(label), "%s Close Menu", ICON_CLS);
|
||||
|
||||
@@ -1118,11 +1118,14 @@ ximopen(Display *dpy)
|
||||
xw.ime.xic = XCreateIC(xw.ime.xim, XNInputStyle,
|
||||
XIMPreeditNothing | XIMStatusNothing,
|
||||
XNClientWindow, xw.win,
|
||||
XNFocusWindow, xw.win,
|
||||
XNDestroyCallback, &icdestroy,
|
||||
NULL);
|
||||
}
|
||||
if (xw.ime.xic == NULL)
|
||||
fprintf(stderr, "XCreateIC: Could not create input context.\n");
|
||||
else if (win.mode & MODE_FOCUSED)
|
||||
XSetICFocus(xw.ime.xic);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1981,6 +1984,8 @@ run(void)
|
||||
if (ev.type == ConfigureNotify) {
|
||||
w = ev.xconfigure.width;
|
||||
h = ev.xconfigure.height;
|
||||
} else if (ev.type == FocusIn || ev.type == FocusOut) {
|
||||
focus(&ev);
|
||||
}
|
||||
} while (ev.type != MapNotify);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user