Skip to content

Commit

Permalink
input method v1: update popup position when cursor rectangle changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lilydjwg committed Oct 2, 2024
1 parent 3ce431f commit 729c45d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions plugins/protocols/input-method-v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,13 @@ class wayfire_input_method_v1_panel_surface
{
popup->map();
}

relay->set_popup(popup);
}

~wayfire_input_method_v1_panel_surface()
{
relay->set_popup(nullptr);
if (popup && popup->is_mapped())
{
popup->unmap();
Expand Down Expand Up @@ -773,6 +776,11 @@ class wayfire_input_method_v1 : public wf::plugin_interface_t, public wf::text_i
if (current_im_context && (current_im_context->text_input == im_text_inputs_v3[input].get()))
{
current_im_context->handle_text_input_v3_commit();

if (popup)
{
popup->update_cursor_rect(&input->current.cursor_rectangle);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/wayfire/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class plugin_interface_t
using wayfire_plugin_load_func = wf::plugin_interface_t * (*)();

/** The version of Wayfire's API/ABI */
constexpr uint32_t WAYFIRE_API_ABI_VERSION = 2024'08'26;
constexpr uint32_t WAYFIRE_API_ABI_VERSION = 2024'10'01;

/**
* Each plugin must also provide a function which returns the Wayfire API/ABI
Expand Down
9 changes: 9 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 @@ -7,11 +7,20 @@

namespace wf
{
class text_input_v3_popup;

class text_input_v3_im_relay_interface_t
{
protected:
std::shared_ptr<text_input_v3_popup> popup = nullptr;

public:
virtual wlr_text_input_v3 *find_focused_text_input_v3() = 0;
virtual ~text_input_v3_im_relay_interface_t() = default;
void set_popup(std::shared_ptr<text_input_v3_popup> popup_)
{
popup = popup_;
}
};

/**
Expand Down

0 comments on commit 729c45d

Please sign in to comment.