Merge branch 'main' into text-input-v3-wlroots0.20

This commit is contained in:
DreamMaoMao 2026-03-08 13:16:34 +08:00 committed by GitHub
commit 44043697c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 12026 additions and 4033 deletions

View file

@ -68,7 +68,7 @@ void dwl_im_relay_set_focus(struct dwl_input_method_relay *relay,
/*------------------协议内部代码------------------------------*/
Monitor *output_from_wlr_output(struct wlr_output *wlr_output) {
Monitor *m;
Monitor *m = NULL;
wl_list_for_each(m, &mons, link) {
if (m->wlr_output == wlr_output) {
return m;
@ -77,15 +77,6 @@ Monitor *output_from_wlr_output(struct wlr_output *wlr_output) {
return NULL;
}
Monitor *output_nearest_to(int lx, int ly) {
double closest_x, closest_y;
wlr_output_layout_closest_point(output_layout, NULL, lx, ly, &closest_x,
&closest_y);
return output_from_wlr_output(
wlr_output_layout_output_at(output_layout, closest_x, closest_y));
}
bool output_is_usable(Monitor *m) { return m && m->wlr_output->enabled; }
static bool
@ -222,10 +213,10 @@ static void update_popup_position(struct dwl_input_method_popup *popup) {
struct wlr_xdg_surface *xdg_surface;
struct wlr_layer_surface_v1 *layer_surface;
struct wlr_scene_tree *tree;
Monitor *output;
Monitor *output = NULL;
struct wlr_xdg_positioner_rules pointer_rules;
struct wlr_box output_box;
int lx, ly;
int32_t lx, ly;
struct wlr_box popup_box;
if (!text_input || !relay->focused_surface ||
@ -255,7 +246,7 @@ static void update_popup_position(struct dwl_input_method_popup *popup) {
cursor_rect = (struct wlr_box){0};
}
output = output_nearest_to(cursor_rect.x, cursor_rect.y);
output = get_monitor_nearest_to(cursor_rect.x, cursor_rect.y);
if (!output_is_usable(output)) {
return;
}
@ -489,6 +480,7 @@ static void handle_text_input_enable(struct wl_listener *listener, void *data) {
update_popups_position(relay);
send_state_to_input_method(relay);
}
wlr_text_input_v3_send_done(text_input->input);
}
static void handle_text_input_disable(struct wl_listener *listener,