submission: Take over virtual_keyboard handling
This commit is contained in:
@ -39,6 +39,7 @@
|
||||
|
||||
#include "wayland.h"
|
||||
|
||||
#include "eek/eek-keyboard.h"
|
||||
#include "eek/eek-xml-layout.h"
|
||||
#include "src/server-context-service.h"
|
||||
|
||||
@ -73,6 +74,8 @@ struct _EekboardContextServicePrivate {
|
||||
// Maybe TODO: it's used only for fetching layout type.
|
||||
// Maybe let UI push the type to this structure?
|
||||
ServerContextService *ui; // unowned reference
|
||||
/// Needed for keymap changes after keyboard updates
|
||||
struct submission *submission; // unowned
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (EekboardContextService, eekboard_context_service, G_TYPE_OBJECT);
|
||||
@ -222,10 +225,12 @@ eekboard_context_service_update_layout(EekboardContextService *context, enum squ
|
||||
LevelKeyboard *previous_keyboard = context->priv->keyboard;
|
||||
context->priv->keyboard = keyboard;
|
||||
|
||||
// The keymap will get set even if the window is hidden.
|
||||
// It's not perfect,
|
||||
// but simpler than adding a check in the window showing procedure
|
||||
eekboard_context_service_set_keymap(context, keyboard);
|
||||
// Update the keymap if necessary.
|
||||
// Done directly here instead of in "keyboard" update handler
|
||||
// to keep keymap-related actions close together.
|
||||
if (context->priv->submission) {
|
||||
submission_set_keyboard(context->priv->submission, keyboard);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT(context), "keyboard");
|
||||
|
||||
@ -262,12 +267,6 @@ static void
|
||||
eekboard_context_service_constructed (GObject *object)
|
||||
{
|
||||
EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE (object);
|
||||
context->virtual_keyboard = zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(
|
||||
squeek_wayland->virtual_keyboard_manager,
|
||||
squeek_wayland->seat);
|
||||
if (!context->virtual_keyboard) {
|
||||
g_error("Programmer error: Failed to receive a virtual keyboard instance");
|
||||
}
|
||||
update_layout_and_type(context);
|
||||
}
|
||||
|
||||
@ -363,14 +362,6 @@ eekboard_context_service_get_keyboard (EekboardContextService *context)
|
||||
return context->priv->keyboard;
|
||||
}
|
||||
|
||||
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
||||
const LevelKeyboard *keyboard)
|
||||
{
|
||||
zwp_virtual_keyboard_v1_keymap(context->virtual_keyboard,
|
||||
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
|
||||
keyboard->keymap_fd, keyboard->keymap_len);
|
||||
}
|
||||
|
||||
void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
|
||||
uint32_t hint, uint32_t purpose)
|
||||
{
|
||||
@ -394,7 +385,13 @@ eekboard_context_service_get_overlay(EekboardContextService *context) {
|
||||
return context->priv->overlay;
|
||||
}
|
||||
|
||||
EekboardContextService *eekboard_context_service_new()
|
||||
EekboardContextService *eekboard_context_service_new(void)
|
||||
{
|
||||
return g_object_new (EEKBOARD_TYPE_CONTEXT_SERVICE, NULL);
|
||||
}
|
||||
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission) {
|
||||
context->priv->submission = submission;
|
||||
if (context->priv->submission) {
|
||||
submission_set_keyboard(context->priv->submission, context->priv->keyboard);
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,8 @@
|
||||
#ifndef EEKBOARD_CONTEXT_SERVICE_H
|
||||
#define EEKBOARD_CONTEXT_SERVICE_H 1
|
||||
|
||||
#include <eek/eek.h>
|
||||
#include "src/submission.h"
|
||||
#include "src/layout.h"
|
||||
|
||||
#include "virtual-keyboard-unstable-v1-client-protocol.h"
|
||||
#include "text-input-unstable-v3-client-protocol.h"
|
||||
@ -58,8 +59,6 @@ struct _EekboardContextService {
|
||||
GObject parent;
|
||||
|
||||
EekboardContextServicePrivate *priv;
|
||||
|
||||
struct zwp_virtual_keyboard_v1 *virtual_keyboard;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -84,10 +83,10 @@ struct _EekboardContextServiceClass {
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
EekboardContextService *eekboard_context_service_new();
|
||||
GType eekboard_context_service_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
EekboardContextService *eekboard_context_service_new(void);
|
||||
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission);
|
||||
void eekboard_context_service_destroy (EekboardContextService *context);
|
||||
LevelKeyboard *eekboard_context_service_get_keyboard(EekboardContextService *context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user