UI: Drop indirection for show/hide functions

This commit is contained in:
Dorota Czaplejewicz
2020-01-09 13:26:40 +00:00
parent 375daa68c8
commit 7e72722a47
4 changed files with 15 additions and 21 deletions

View File

@ -135,13 +135,13 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
return keyboard; return keyboard;
} }
static void void
eekboard_context_service_real_show_keyboard (EekboardContextService *self) eekboard_context_service_real_show_keyboard (EekboardContextService *self)
{ {
self->priv->visible = TRUE; self->priv->visible = TRUE;
} }
static void void
eekboard_context_service_real_hide_keyboard (EekboardContextService *self) eekboard_context_service_real_hide_keyboard (EekboardContextService *self)
{ {
self->priv->visible = FALSE; self->priv->visible = FALSE;
@ -294,9 +294,6 @@ eekboard_context_service_class_init (EekboardContextServiceClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
klass->show_keyboard = eekboard_context_service_real_show_keyboard;
klass->hide_keyboard = eekboard_context_service_real_hide_keyboard;
gobject_class->constructed = eekboard_context_service_constructed; gobject_class->constructed = eekboard_context_service_constructed;
gobject_class->set_property = eekboard_context_service_set_property; gobject_class->set_property = eekboard_context_service_set_property;
gobject_class->get_property = eekboard_context_service_get_property; gobject_class->get_property = eekboard_context_service_get_property;
@ -446,7 +443,7 @@ eekboard_context_service_show_keyboard (EekboardContextService *context)
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context)); g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
if (!context->priv->visible) { if (!context->priv->visible) {
EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->show_keyboard (context); server_context_service_real_show_keyboard (context);
} }
} }
@ -456,7 +453,7 @@ eekboard_context_service_hide_keyboard (EekboardContextService *context)
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context)); g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
if (context->priv->visible) { if (context->priv->visible) {
EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->hide_keyboard (context); server_context_service_real_hide_keyboard (context);
} }
} }

View File

@ -63,8 +63,6 @@ struct _EekboardContextService {
/** /**
* EekboardContextServiceClass: * EekboardContextServiceClass:
* @create_keyboard: virtual function for create a keyboard from string * @create_keyboard: virtual function for create a keyboard from string
* @show_keyboard: virtual function for show a keyboard
* @hide_keyboard: virtual function for hide a keyboard
* @enabled: class handler for #EekboardContextService::enabled signal * @enabled: class handler for #EekboardContextService::enabled signal
* @disabled: class handler for #EekboardContextService::disabled signal * @disabled: class handler for #EekboardContextService::disabled signal
*/ */
@ -75,8 +73,6 @@ struct _EekboardContextServiceClass {
/*< public >*/ /*< public >*/
struct squeek_view *(*create_keyboard) (EekboardContextService *self, struct squeek_view *(*create_keyboard) (EekboardContextService *self,
const gchar *keyboard_type); const gchar *keyboard_type);
void (*show_keyboard) (EekboardContextService *self);
void (*hide_keyboard) (EekboardContextService *self);
/* signals */ /* signals */
void (*enabled) (EekboardContextService *self); void (*enabled) (EekboardContextService *self);
@ -94,6 +90,10 @@ void eekboard_context_service_enable (EekboardContextService *context);
void eekboard_context_service_disable (EekboardContextService *context); void eekboard_context_service_disable (EekboardContextService *context);
void eekboard_context_service_show_keyboard void eekboard_context_service_show_keyboard
(EekboardContextService *context); (EekboardContextService *context);
void
eekboard_context_service_real_show_keyboard (EekboardContextService *self);
void
eekboard_context_service_real_hide_keyboard (EekboardContextService *self);
void eekboard_context_service_hide_keyboard void eekboard_context_service_hide_keyboard
(EekboardContextService *context); (EekboardContextService *context);
void eekboard_context_service_destroy (EekboardContextService *context); void eekboard_context_service_destroy (EekboardContextService *context);

View File

@ -24,7 +24,7 @@
#include "eek/eek-gtk-keyboard.h" #include "eek/eek-gtk-keyboard.h"
#include "eek/layersurface.h" #include "eek/layersurface.h"
#include "wayland.h" #include "wayland.h"
#include "eekboard/eekboard-context-service.h"
#include "server-context-service.h" #include "server-context-service.h"
enum { enum {
@ -238,7 +238,7 @@ make_widget (ServerContextService *context)
gtk_widget_show (context->widget); gtk_widget_show (context->widget);
} }
static void void
server_context_service_real_show_keyboard (EekboardContextService *_context) server_context_service_real_show_keyboard (EekboardContextService *_context)
{ {
ServerContextService *context = SERVER_CONTEXT_SERVICE(_context); ServerContextService *context = SERVER_CONTEXT_SERVICE(_context);
@ -253,8 +253,7 @@ server_context_service_real_show_keyboard (EekboardContextService *_context)
if (!context->widget) if (!context->widget)
make_widget (context); make_widget (context);
EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)-> eekboard_context_service_real_show_keyboard (_context);
show_keyboard (_context);
gtk_widget_show (GTK_WIDGET(context->window)); gtk_widget_show (GTK_WIDGET(context->window));
} }
@ -267,7 +266,7 @@ on_hide (ServerContextService *context)
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
static void void
server_context_service_real_hide_keyboard (EekboardContextService *_context) server_context_service_real_hide_keyboard (EekboardContextService *_context)
{ {
ServerContextService *context = SERVER_CONTEXT_SERVICE(_context); ServerContextService *context = SERVER_CONTEXT_SERVICE(_context);
@ -275,8 +274,7 @@ server_context_service_real_hide_keyboard (EekboardContextService *_context)
if (!context->hiding) if (!context->hiding)
context->hiding = g_timeout_add (200, (GSourceFunc) on_hide, context); context->hiding = g_timeout_add (200, (GSourceFunc) on_hide, context);
EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)-> eekboard_context_service_real_hide_keyboard (_context);
hide_keyboard (_context);
} }
static void static void
@ -331,8 +329,6 @@ server_context_service_class_init (ServerContextServiceClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
context_class->show_keyboard = server_context_service_real_show_keyboard;
context_class->hide_keyboard = server_context_service_real_hide_keyboard;
context_class->destroyed = server_context_service_real_destroyed; context_class->destroyed = server_context_service_real_destroyed;
gobject_class->set_property = server_context_service_set_property; gobject_class->set_property = server_context_service_set_property;

View File

@ -35,7 +35,8 @@ typedef struct _ServerContextService ServerContextService;
EekboardContextService *server_context_service_new (); EekboardContextService *server_context_service_new ();
enum squeek_arrangement_kind server_context_service_get_layout_type(EekboardContextService*); enum squeek_arrangement_kind server_context_service_get_layout_type(EekboardContextService*);
void server_context_service_real_show_keyboard (EekboardContextService *context);
void server_context_service_real_hide_keyboard (EekboardContextService *context);
G_END_DECLS G_END_DECLS
#endif /* SERVER_CONTEXT_SERVICE_H */ #endif /* SERVER_CONTEXT_SERVICE_H */