Skip to content

Commit

Permalink
fixup! start im-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
ammen99 committed Mar 2, 2024
1 parent 0534f8a commit f9b3845
Showing 1 changed file with 22 additions and 37 deletions.
59 changes: 22 additions & 37 deletions plugins/protocols/input-method-v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class wayfire_im_v1_text_input_v3
wayfire_im_v1_text_input_v3(wlr_text_input_v3 *text_input)
{
this->text_input = text_input;
this->client = wl_resource_get_client(text_input->resource);
this->client = wl_resource_get_client(text_input->resource);

on_enable.connect(&text_input->events.enable);
on_disable.connect(&text_input->events.disable);
Expand All @@ -30,7 +30,7 @@ class wayfire_im_v1_text_input_v3
current_focus = nullptr;
}

if (next_client == client && surface != current_focus)
if ((next_client == client) && (surface != current_focus))
{
wlr_text_input_v3_send_enter(text_input, surface);
current_focus = surface;
Expand Down Expand Up @@ -98,7 +98,7 @@ void handle_im_context_preedit_string(wl_client *client, wl_resource *resource,
auto context = static_cast<wayfire_input_method_v1_context*>(wl_resource_get_user_data(resource));
if (context && context->text_input)
{
// wlr_text_input_v3_send_preedit_string(context->text_input, text, commit);
// wlr_text_input_v3_send_preedit_string(context->text_input, text, commit);
}
}

Expand All @@ -110,8 +110,7 @@ void handle_im_context_preedit_styling(wl_client *client, wl_resource *resource,

void handle_im_context_preedit_cursor(wl_client *client, wl_resource *resource,
int32_t index)
{
}
{}

void handle_im_context_delete_surrounding_text(wl_client *client, wl_resource *resource,
int32_t index, uint32_t length)
Expand All @@ -125,64 +124,52 @@ void handle_im_context_delete_surrounding_text(wl_client *client, wl_resource *r

void handle_im_context_cursor_position(wl_client *client, wl_resource *resource,
int32_t index, int32_t anchor)
{
}
{}

void handle_im_context_modifiers_map(wl_client *client, wl_resource *resource,
struct wl_array *map)
{
}
{}

void handle_im_context_keysym(wl_client *client, wl_resource *resource,
uint32_t serial, uint32_t time, uint32_t sym, uint32_t state,
uint32_t modifiers)
{
}

{}

void handle_im_context_grab_keyboard(wl_client *client, wl_resource *resource,
uint32_t keyboard)
{
}
{}

void handle_im_context_key(wl_client *client, wl_resource *resource,
uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
{
}

{}

void handle_im_context_modifiers(wl_client *client, wl_resource *resource,
uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched,
uint32_t mods_locked, uint32_t group)
{
}

{}

void handle_im_context_language(wl_client *client, wl_resource *resource,
uint32_t serial, const char *language)
{
}

{}

void handle_im_context_text_direction(wl_client *client, wl_resource *resource,
uint32_t serial, uint32_t direction)
{
}
{}

static const struct zwp_input_method_context_v1_interface context_implementation = {
.destroy = handle_im_context_destroy,
.commit_string = handle_im_context_commit_string,
.preedit_string = handle_im_context_preedit_string,
.commit_string = handle_im_context_commit_string,
.preedit_string = handle_im_context_preedit_string,
.preedit_styling = handle_im_context_preedit_styling,
.preedit_cursor = handle_im_context_preedit_cursor,
.preedit_cursor = handle_im_context_preedit_cursor,
.delete_surrounding_text = handle_im_context_delete_surrounding_text,
.cursor_position = handle_im_context_cursor_position,
.modifiers_map = handle_im_context_modifiers_map,
.modifiers_map = handle_im_context_modifiers_map,
.keysym = handle_im_context_keysym,
.grab_keyboard = handle_im_context_grab_keyboard,
.key = handle_im_context_key,
.modifiers = handle_im_context_modifiers,
.language = handle_im_context_language,
.language = handle_im_context_language,
.text_direction = handle_im_context_text_direction
};

Expand Down Expand Up @@ -247,6 +234,7 @@ class wayfire_input_method_v1 : public wf::plugin_interface_t
};

// Handlers for text-input-v3

private:
void handle_text_input_v3_created(wlr_text_input_v3 *input)
{
Expand Down Expand Up @@ -278,8 +266,7 @@ class wayfire_input_method_v1 : public wf::plugin_interface_t
}

void handle_text_input_v3_commit(wlr_text_input_v3 *input)
{
}
{}

void handle_text_input_v3_enable(wlr_text_input_v3 *input)
{
Expand All @@ -295,17 +282,15 @@ class wayfire_input_method_v1 : public wf::plugin_interface_t
return;
}


current_im_context = std::make_unique<wayfire_input_method_v1_context>(
input, current_im, &context_implementation);
}

void handle_text_input_v3_disable(wlr_text_input_v3 *input)
{
}

{}

// Implementation of input-method-v1

private:
void bind_client(wl_client *client, uint32_t id)
{
Expand Down Expand Up @@ -341,7 +326,7 @@ class wayfire_input_method_v1 : public wf::plugin_interface_t


std::unique_ptr<wayfire_input_method_v1_context> current_im_context = nullptr;
std::map<wlr_text_input_v3 *, std::unique_ptr<wayfire_im_v1_text_input_v3>> im_text_inputs;
std::map<wlr_text_input_v3*, std::unique_ptr<wayfire_im_v1_text_input_v3>> im_text_inputs;
};

DECLARE_WAYFIRE_PLUGIN(wayfire_input_method_v1);

0 comments on commit f9b3845

Please sign in to comment.