Skip to content

Commit

Permalink
input method: try to update cursor rectangle on text input commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lilydjwg committed Oct 2, 2024
1 parent 6796b08 commit 3ce431f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/wayfire/unstable/wlr-text-input-v3-popup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ class text_input_v3_popup : public wf::view_interface_t
void map();
void unmap();
void update_geometry();
void update_cursor_rect(wlr_box*);
~text_input_v3_popup();

private:
wf::geometry_t geometry{0, 0, 0, 0};
wlr_box old_cursor_rect{0, 0, 0, 0};
std::shared_ptr<wf::scene::wlr_surface_node_t> main_surface;
std::shared_ptr<wf::scene::translation_node_t> surface_root_node;

Expand Down
11 changes: 11 additions & 0 deletions src/core/seat/input-method-popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ std::string wf::text_input_v3_popup::get_title()
return "input-method-popup";
}

void wf::text_input_v3_popup::update_cursor_rect(wlr_box *cursor_rect)
{
if (old_cursor_rect == *cursor_rect)
{
return;
}

update_geometry();
old_cursor_rect = *cursor_rect;
}

void wf::text_input_v3_popup::update_geometry()
{
auto text_input = this->relay->find_focused_text_input_v3();
Expand Down
5 changes: 5 additions & 0 deletions src/core/seat/input-method-relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ wf::text_input::text_input(wf::input_method_relay *rel, wlr_text_input_v3 *in) :
}

relay->send_im_state(input);

for (auto popup : relay->popup_surfaces)
{
popup->update_cursor_rect(&input->current.cursor_rectangle);
}
});

on_text_input_disable.set_callback([&] (void *data)
Expand Down

0 comments on commit 3ce431f

Please sign in to comment.