Revert "fix: coredump when popup exist and close window"

since the popup is under root top, so the node will always exist, so
refresh is safe

This reverts commit d3bedbd63704c8a4f695a6a650e8440ae5c9593b.
This commit is contained in:
ShootingStarDragons 2024-01-21 21:25:36 +08:00 committed by Access
parent c3e59098a8
commit be9a30d555

View file

@ -118,7 +118,7 @@ static void handle_im_destroy(struct wl_listener *listener, void *data) {
} }
static void relay_send_im_state(struct sway_input_method_relay *relay, static void relay_send_im_state(struct sway_input_method_relay *relay,
struct wlr_text_input_v3 *input, bool need_refresh) { struct wlr_text_input_v3 *input) {
struct wlr_input_method_v2 *input_method = relay->input_method; struct wlr_input_method_v2 *input_method = relay->input_method;
if (!input_method) { if (!input_method) {
sway_log(SWAY_INFO, "Sending IM_DONE but im is gone"); sway_log(SWAY_INFO, "Sending IM_DONE but im is gone");
@ -139,9 +139,6 @@ static void relay_send_im_state(struct sway_input_method_relay *relay,
} }
struct sway_input_popup *popup; struct sway_input_popup *popup;
wl_list_for_each(popup, &relay->input_popups, link) { wl_list_for_each(popup, &relay->input_popups, link) {
if (!need_refresh) {
popup->scene_tree = NULL;
}
// send_text_input_rectangle is called in this function // send_text_input_rectangle is called in this function
input_popup_update(popup); input_popup_update(popup);
} }
@ -157,7 +154,7 @@ static void handle_text_input_enable(struct wl_listener *listener, void *data) {
return; return;
} }
wlr_input_method_v2_send_activate(text_input->relay->input_method); wlr_input_method_v2_send_activate(text_input->relay->input_method);
relay_send_im_state(text_input->relay, text_input->input, false); relay_send_im_state(text_input->relay, text_input->input);
} }
static void handle_text_input_commit(struct wl_listener *listener, static void handle_text_input_commit(struct wl_listener *listener,
@ -173,7 +170,7 @@ static void handle_text_input_commit(struct wl_listener *listener,
sway_log(SWAY_INFO, "Text input committed, but input method is gone"); sway_log(SWAY_INFO, "Text input committed, but input method is gone");
return; return;
} }
relay_send_im_state(text_input->relay, text_input->input, true); relay_send_im_state(text_input->relay, text_input->input);
} }
static void relay_disable_text_input(struct sway_input_method_relay *relay, static void relay_disable_text_input(struct sway_input_method_relay *relay,
@ -183,7 +180,7 @@ static void relay_disable_text_input(struct sway_input_method_relay *relay,
return; return;
} }
wlr_input_method_v2_send_deactivate(relay->input_method); wlr_input_method_v2_send_deactivate(relay->input_method);
relay_send_im_state(relay, text_input->input, false); relay_send_im_state(relay, text_input->input);
} }
static void handle_text_input_disable(struct wl_listener *listener, static void handle_text_input_disable(struct wl_listener *listener,
@ -425,7 +422,6 @@ static void handle_im_focused_surface_unmap(
struct sway_input_popup *popup = struct sway_input_popup *popup =
wl_container_of(listener, popup, focused_surface_unmap); wl_container_of(listener, popup, focused_surface_unmap);
//input_popup_send_outputs(popup, surface_send_leave_iterator); //input_popup_send_outputs(popup, surface_send_leave_iterator);
popup->scene_tree = NULL;
input_popup_update(popup); input_popup_update(popup);
} }