Respond to the input purpose, showing a numeric keypad if requested
This commit is contained in:
		@ -79,6 +79,8 @@ struct _EekboardContextServicePrivate {
 | 
			
		||||
    gboolean repeat_triggered;
 | 
			
		||||
 | 
			
		||||
    GSettings *settings;
 | 
			
		||||
    uint32_t hint;
 | 
			
		||||
    uint32_t purpose;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_PRIVATE (EekboardContextService, eekboard_context_service, G_TYPE_OBJECT);
 | 
			
		||||
@ -353,11 +355,15 @@ settings_update_layout(EekboardContextService *context)
 | 
			
		||||
        keyboard_layout = g_strdup("undefined");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    EekboardContextServicePrivate *priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(context);
 | 
			
		||||
 | 
			
		||||
    if (priv->purpose == ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE)
 | 
			
		||||
        keyboard_layout = g_strdup("numbers");
 | 
			
		||||
 | 
			
		||||
    // generic part follows
 | 
			
		||||
    static guint keyboard_id = 0;
 | 
			
		||||
    EekKeyboard *keyboard = g_hash_table_lookup(context->priv->keyboard_hash,
 | 
			
		||||
                                                GUINT_TO_POINTER(keyboard_id));
 | 
			
		||||
    g_debug("type=%s, layout=%s, keyboard=%p", keyboard_type, keyboard_layout, keyboard);
 | 
			
		||||
    // create a keyboard
 | 
			
		||||
    if (!keyboard) {
 | 
			
		||||
        EekboardContextServiceClass *klass = EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context);
 | 
			
		||||
@ -641,3 +647,15 @@ void eekboard_context_service_set_keymap(EekboardContextService *context,
 | 
			
		||||
        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)
 | 
			
		||||
{
 | 
			
		||||
    EekboardContextServicePrivate *priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(context);
 | 
			
		||||
 | 
			
		||||
    if (priv->hint != hint || priv->purpose != purpose) {
 | 
			
		||||
        priv->hint = hint;
 | 
			
		||||
        priv->purpose = purpose;
 | 
			
		||||
        settings_update_layout(context);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@
 | 
			
		||||
#include <eek/eek.h>
 | 
			
		||||
 | 
			
		||||
#include "virtual-keyboard-unstable-v1-client-protocol.h"
 | 
			
		||||
#include "text-input-unstable-v3-client-protocol.h"
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
@ -104,5 +105,9 @@ gboolean      eekboard_context_service_get_fullscreen
 | 
			
		||||
void eekboard_context_service_set_keymap(EekboardContextService *context,
 | 
			
		||||
                                         const EekKeyboard *keyboard);
 | 
			
		||||
 | 
			
		||||
void eekboard_context_service_set_hint_purpose(EekboardContextService *context,
 | 
			
		||||
                                               uint32_t hint,
 | 
			
		||||
                                               uint32_t purpose);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
#endif  /* EEKBOARD_CONTEXT_SERVICE_H */
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user