eekboard_context: Rename to LayoutHolder
This commit is contained in:
@ -45,7 +45,7 @@
|
||||
typedef struct _EekGtkKeyboardPrivate
|
||||
{
|
||||
EekRenderer *renderer; // owned, nullable
|
||||
EekboardContextService *eekboard_context; // unowned reference
|
||||
LayoutHolder *eekboard_context; // unowned reference
|
||||
struct submission *submission; // unowned reference
|
||||
|
||||
struct squeek_layout_state *layout; // unowned
|
||||
@ -343,7 +343,7 @@ on_notify_keyboard (GObject *object,
|
||||
EekGtkKeyboard *self) {
|
||||
(void)spec;
|
||||
EekGtkKeyboardPrivate *priv = (EekGtkKeyboardPrivate*)eek_gtk_keyboard_get_instance_private (self);
|
||||
priv->keyboard = eekboard_context_service_get_keyboard(EEKBOARD_CONTEXT_SERVICE(object));
|
||||
priv->keyboard = eekboard_context_service_get_keyboard(LAYOUT_HOLDER(object));
|
||||
if (priv->renderer) {
|
||||
eek_renderer_free(priv->renderer);
|
||||
}
|
||||
@ -356,7 +356,7 @@ on_notify_keyboard (GObject *object,
|
||||
* Returns: a #GtkWidget
|
||||
*/
|
||||
GtkWidget *
|
||||
eek_gtk_keyboard_new (EekboardContextService *eekservice,
|
||||
eek_gtk_keyboard_new (LayoutHolder *eekservice,
|
||||
struct submission *submission,
|
||||
struct squeek_layout_state *layout)
|
||||
{
|
||||
|
||||
@ -48,7 +48,7 @@ struct _EekGtkKeyboardClass
|
||||
};
|
||||
|
||||
GType eek_gtk_keyboard_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget *eek_gtk_keyboard_new (EekboardContextService *eekservice, struct submission *submission, struct squeek_layout_state *layout);
|
||||
GtkWidget *eek_gtk_keyboard_new (LayoutHolder *eekservice, struct submission *submission, struct squeek_layout_state *layout);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_GTK_KEYBOARD_H */
|
||||
|
||||
@ -37,7 +37,7 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _EekBounds EekBounds;
|
||||
|
||||
typedef struct _EekboardContextService EekboardContextService;
|
||||
typedef struct _LayoutHolder LayoutHolder;
|
||||
typedef struct _ServerContextService ServerContextService;
|
||||
typedef struct _LevelKeyboard LevelKeyboard;
|
||||
|
||||
|
||||
@ -35,17 +35,17 @@ enum {
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
#define EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEKBOARD_TYPE_CONTEXT_SERVICE, EekboardContextServicePrivate))
|
||||
#define LAYOUT_HOLDER_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEKBOARD_TYPE_LAYOUT_HOLDER, LayoutHolderPrivate))
|
||||
|
||||
struct _EekboardContextServicePrivate {
|
||||
struct _LayoutHolderPrivate {
|
||||
LevelKeyboard *keyboard; // currently used keyboard
|
||||
|
||||
/// Needed for keymap changes after keyboard updates
|
||||
struct submission *submission; // unowned
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (EekboardContextService, eekboard_context_service, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (LayoutHolder, layout_holder, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
eekboard_context_service_set_property (GObject *object,
|
||||
@ -67,7 +67,7 @@ eekboard_context_service_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE(object);
|
||||
LayoutHolder *context = LAYOUT_HOLDER(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_KEYBOARD:
|
||||
@ -82,7 +82,7 @@ eekboard_context_service_get_property (GObject *object,
|
||||
static void
|
||||
eekboard_context_service_dispose (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (eekboard_context_service_parent_class)->
|
||||
G_OBJECT_CLASS (layout_holder_parent_class)->
|
||||
dispose (object);
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ settings_get_layout(GSettings *settings, char **type, char **layout)
|
||||
}
|
||||
|
||||
void
|
||||
eekboard_context_service_use_layout(EekboardContextService *context, struct squeek_layout_state *state) {
|
||||
eekboard_context_service_use_layout(LayoutHolder *context, struct squeek_layout_state *state) {
|
||||
gchar *layout_name = state->overlay_name;
|
||||
|
||||
if (layout_name == NULL) {
|
||||
@ -150,8 +150,8 @@ eekboard_context_service_use_layout(EekboardContextService *context, struct sque
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_context_service_init (EekboardContextService *self) {
|
||||
self->priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(self);
|
||||
layout_holder_init (LayoutHolder *self) {
|
||||
self->priv = LAYOUT_HOLDER_GET_PRIVATE(self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -161,7 +161,7 @@ eekboard_context_service_constructed (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_context_service_class_init (EekboardContextServiceClass *klass)
|
||||
layout_holder_class_init (LayoutHolderClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
@ -186,7 +186,7 @@ eekboard_context_service_class_init (EekboardContextServiceClass *klass)
|
||||
}
|
||||
|
||||
void
|
||||
eekboard_context_service_destroy (EekboardContextService *context)
|
||||
eekboard_context_service_destroy (LayoutHolder *context)
|
||||
{
|
||||
(void)context;
|
||||
}
|
||||
@ -199,12 +199,12 @@ eekboard_context_service_destroy (EekboardContextService *context)
|
||||
* Returns: (transfer none): an #EekKeyboard
|
||||
*/
|
||||
LevelKeyboard *
|
||||
eekboard_context_service_get_keyboard (EekboardContextService *context)
|
||||
eekboard_context_service_get_keyboard (LayoutHolder *context)
|
||||
{
|
||||
return context->priv->keyboard;
|
||||
}
|
||||
|
||||
void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
|
||||
void eekboard_context_service_set_hint_purpose(LayoutHolder *context,
|
||||
uint32_t hint, uint32_t purpose)
|
||||
{
|
||||
if (context->layout->hint != hint || context->layout->purpose != purpose) {
|
||||
@ -215,7 +215,7 @@ void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
|
||||
}
|
||||
|
||||
void
|
||||
eekboard_context_service_set_overlay(EekboardContextService *context, const char* name) {
|
||||
eekboard_context_service_set_overlay(LayoutHolder *context, const char* name) {
|
||||
if (g_strcmp0(context->layout->overlay_name, name)) {
|
||||
g_free(context->layout->overlay_name);
|
||||
context->layout->overlay_name = g_strdup(name);
|
||||
@ -224,19 +224,19 @@ eekboard_context_service_set_overlay(EekboardContextService *context, const char
|
||||
}
|
||||
|
||||
const char*
|
||||
eekboard_context_service_get_overlay(EekboardContextService *context) {
|
||||
eekboard_context_service_get_overlay(LayoutHolder *context) {
|
||||
return context->layout->overlay_name;
|
||||
}
|
||||
|
||||
EekboardContextService *eekboard_context_service_new(struct squeek_layout_state *state)
|
||||
LayoutHolder *eekboard_context_service_new(struct squeek_layout_state *state)
|
||||
{
|
||||
EekboardContextService *context = g_object_new (EEKBOARD_TYPE_CONTEXT_SERVICE, NULL);
|
||||
LayoutHolder *context = g_object_new (EEKBOARD_TYPE_LAYOUT_HOLDER, NULL);
|
||||
context->layout = state;
|
||||
eekboard_context_service_use_layout(context, context->layout);
|
||||
return context;
|
||||
}
|
||||
|
||||
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission) {
|
||||
void eekboard_context_service_set_submission(LayoutHolder *context, struct submission *submission) {
|
||||
context->priv->submission = submission;
|
||||
if (context->priv->submission) {
|
||||
submission_set_keyboard(context->priv->submission, context->priv->keyboard);
|
||||
@ -274,7 +274,7 @@ handle_layout_changed(GSettings *s,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void eek_gsettings_tracker_init(struct gsettings_tracker *tracker, EekboardContextService *context, struct squeek_layout_state *layout)
|
||||
void eek_gsettings_tracker_init(struct gsettings_tracker *tracker, LayoutHolder *context, struct squeek_layout_state *layout)
|
||||
{
|
||||
tracker->layout = layout;
|
||||
tracker->context = context;
|
||||
|
||||
@ -30,35 +30,30 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEKBOARD_CONTEXT_SERVICE_PATH "/org/fedorahosted/Eekboard/Context_%d"
|
||||
#define EEKBOARD_CONTEXT_SERVICE_INTERFACE "org.fedorahosted.Eekboard.Context"
|
||||
|
||||
#define EEKBOARD_TYPE_CONTEXT_SERVICE (eekboard_context_service_get_type())
|
||||
#define EEKBOARD_CONTEXT_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_CONTEXT_SERVICE, EekboardContextService))
|
||||
#define EEKBOARD_TYPE_LAYOUT_HOLDER (layout_holder_get_type())
|
||||
#define LAYOUT_HOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_LAYOUT_HOLDER, LayoutHolder))
|
||||
#define EEKBOARD_CONTEXT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_CONTEXT_SERVICE, EekboardContextServiceClass))
|
||||
#define EEKBOARD_IS_CONTEXT_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_CONTEXT_SERVICE))
|
||||
#define EEKBOARD_IS_CONTEXT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_CONTEXT_SERVICE))
|
||||
#define EEKBOARD_CONTEXT_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_CONTEXT_SERVICE, EekboardContextServiceClass))
|
||||
|
||||
|
||||
typedef struct _EekboardContextServiceClass EekboardContextServiceClass;
|
||||
typedef struct _EekboardContextServicePrivate EekboardContextServicePrivate;
|
||||
typedef struct _LayoutHolderClass LayoutHolderClass;
|
||||
typedef struct _LayoutHolderPrivate LayoutHolderPrivate;
|
||||
|
||||
/**
|
||||
* EekboardContextService:
|
||||
*
|
||||
* Handles layout state, and virtual-keyboard.
|
||||
*
|
||||
* TODO: Restrict to managing keyboard layouts, and maybe button repeats,
|
||||
* and the virtual keyboard protocol.
|
||||
*/
|
||||
struct _EekboardContextService {
|
||||
struct _LayoutHolder {
|
||||
GObject parent;
|
||||
EekboardContextServicePrivate *priv;
|
||||
LayoutHolderPrivate *priv;
|
||||
struct squeek_layout_state *layout; // Unowned
|
||||
};
|
||||
|
||||
struct _EekboardContextServiceClass {
|
||||
struct _LayoutHolderClass {
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
@ -67,29 +62,28 @@ struct _EekboardContextServiceClass {
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eekboard_context_service_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
GType layout_holder_get_type(void) G_GNUC_CONST;
|
||||
|
||||
/// Handles gsettings os-level keyboard layout switches.
|
||||
struct gsettings_tracker {
|
||||
GSettings *gsettings; // Owned reference
|
||||
EekboardContextService *context; // Unowned
|
||||
LayoutHolder *context; // Unowned
|
||||
struct squeek_layout_state *layout; // Unowned
|
||||
};
|
||||
|
||||
void eek_gsettings_tracker_init(struct gsettings_tracker* tracker, EekboardContextService *context, struct squeek_layout_state *layout);
|
||||
void eek_gsettings_tracker_init(struct gsettings_tracker* tracker, LayoutHolder *context, struct squeek_layout_state *layout);
|
||||
|
||||
EekboardContextService *eekboard_context_service_new(struct squeek_layout_state *state);
|
||||
void eekboard_context_service_set_submission(EekboardContextService *context, struct submission *submission);
|
||||
LevelKeyboard *eekboard_context_service_get_keyboard(EekboardContextService *context);
|
||||
LayoutHolder *eekboard_context_service_new(struct squeek_layout_state *state);
|
||||
void eekboard_context_service_set_submission(LayoutHolder *context, struct submission *submission);
|
||||
LevelKeyboard *eekboard_context_service_get_keyboard(LayoutHolder *context);
|
||||
|
||||
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
||||
void eekboard_context_service_set_keymap(LayoutHolder *context,
|
||||
const LevelKeyboard *keyboard);
|
||||
|
||||
void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
|
||||
void eekboard_context_service_set_hint_purpose(LayoutHolder *context,
|
||||
uint32_t hint,
|
||||
uint32_t purpose);
|
||||
void
|
||||
eekboard_context_service_use_layout(EekboardContextService *context, struct squeek_layout_state *layout);
|
||||
eekboard_context_service_use_layout(LayoutHolder *context, struct squeek_layout_state *layout);
|
||||
G_END_DECLS
|
||||
#endif /* EEKBOARD_CONTEXT_SERVICE_H */
|
||||
|
||||
@ -26,7 +26,7 @@ static const struct zwp_input_method_v2_listener input_method_listener = {
|
||||
struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager,
|
||||
struct zwp_virtual_keyboard_manager_v1 *vkmanager,
|
||||
struct wl_seat *seat,
|
||||
EekboardContextService *state) {
|
||||
LayoutHolder *state) {
|
||||
struct zwp_input_method_v2 *im = NULL;
|
||||
if (immanager) {
|
||||
im = zwp_input_method_manager_v2_get_input_method(immanager, seat);
|
||||
|
||||
@ -47,7 +47,7 @@ void squeek_layout_release(struct squeek_layout *layout,
|
||||
struct submission *submission,
|
||||
struct transformation widget_to_layout,
|
||||
uint32_t timestamp,
|
||||
EekboardContextService *manager,
|
||||
LayoutHolder *manager,
|
||||
EekGtkKeyboard *ui_keyboard);
|
||||
void squeek_layout_release_all_only(struct squeek_layout *layout,
|
||||
struct submission *submission,
|
||||
@ -61,7 +61,7 @@ void squeek_layout_drag(struct squeek_layout *layout,
|
||||
struct submission *submission,
|
||||
double x_widget, double y_widget,
|
||||
struct transformation widget_to_layout,
|
||||
uint32_t timestamp, EekboardContextService *manager,
|
||||
uint32_t timestamp, LayoutHolder *manager,
|
||||
EekGtkKeyboard *ui_keyboard);
|
||||
void squeek_layout_draw_all_changed(struct squeek_layout *layout, EekRenderer* renderer, cairo_t *cr, struct submission *submission);
|
||||
void squeek_draw_layout_base_view(struct squeek_layout *layout, EekRenderer* renderer, cairo_t *cr);
|
||||
|
||||
@ -39,7 +39,7 @@ typedef struct _ServerContextServiceClass ServerContextServiceClass;
|
||||
struct _ServerContextService {
|
||||
GObject parent;
|
||||
|
||||
EekboardContextService *state; // unowned
|
||||
LayoutHolder *state; // unowned
|
||||
/// Needed for instantiating the widget
|
||||
struct submission *submission; // unowned
|
||||
struct squeek_layout_state *layout;
|
||||
@ -312,7 +312,7 @@ server_context_service_init (ServerContextService *state) {
|
||||
}
|
||||
|
||||
ServerContextService *
|
||||
server_context_service_new (EekboardContextService *state, struct submission *submission, struct squeek_layout_state *layout, struct ui_manager *uiman)
|
||||
server_context_service_new (LayoutHolder *state, struct submission *submission, struct squeek_layout_state *layout, struct ui_manager *uiman)
|
||||
{
|
||||
ServerContextService *ui = g_object_new (SERVER_TYPE_CONTEXT_SERVICE, NULL);
|
||||
ui->submission = submission;
|
||||
|
||||
@ -37,7 +37,7 @@ typedef struct _ServerContextService ServerContextService;
|
||||
GType server_context_service_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
|
||||
ServerContextService *server_context_service_new(EekboardContextService *state, struct submission *submission, struct squeek_layout_state *layout, struct ui_manager *uiman);
|
||||
ServerContextService *server_context_service_new(LayoutHolder *state, struct submission *submission, struct squeek_layout_state *layout, struct ui_manager *uiman);
|
||||
enum squeek_arrangement_kind server_context_service_get_layout_type(ServerContextService *);
|
||||
void server_context_service_show_keyboard (ServerContextService *context);
|
||||
void server_context_service_hide_keyboard (ServerContextService *context);
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
struct squeekboard {
|
||||
struct squeek_wayland wayland; // Just hooks.
|
||||
DBusHandler *dbus_handler; // Controls visibility of the OSK.
|
||||
EekboardContextService *layout_holder; // Currently used layout & keyboard.
|
||||
LayoutHolder *layout_holder; // Currently used layout & keyboard.
|
||||
ServerContextService *ui_context; // mess, includes the entire UI
|
||||
struct submission *submission; // Wayland text input handling.
|
||||
struct squeek_layout_state layout_choice; // Currently wanted layout.
|
||||
|
||||
@ -10,10 +10,10 @@ struct submission;
|
||||
struct submission* get_submission(struct zwp_input_method_manager_v2 *immanager,
|
||||
struct zwp_virtual_keyboard_manager_v1 *vkmanager,
|
||||
struct wl_seat *seat,
|
||||
EekboardContextService *state);
|
||||
LayoutHolder *state);
|
||||
|
||||
// Defined in Rust
|
||||
struct submission* submission_new(struct zwp_input_method_v2 *im, struct zwp_virtual_keyboard_v1 *vk, EekboardContextService *state);
|
||||
struct submission* submission_new(struct zwp_input_method_v2 *im, struct zwp_virtual_keyboard_v1 *vk, LayoutHolder *state);
|
||||
void submission_set_ui(struct submission *self, ServerContextService *ui_context);
|
||||
void submission_set_keyboard(struct submission *self, LevelKeyboard *keyboard);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user