improve keyboard

This commit is contained in:
xianjimli 2019-01-15 11:37:34 +08:00
parent f39839dea7
commit c60eab92e7
3 changed files with 6 additions and 2 deletions

View File

@ -1240,8 +1240,7 @@ ret_t widget_on_pointer_down(widget_t* widget, pointer_event_t* e) {
target = widget_find_target(widget, e->x, e->y); target = widget_find_target(widget, e->x, e->y);
if (target != NULL && target->enable) { if (target != NULL && target->enable) {
const char* type = widget_get_type(target); if (!(target->vt->is_keyboard)) {
if (!tk_str_eq(type, WIDGET_TYPE_KEYBOARD)) {
if (!target->focused) { if (!target->focused) {
event_t focus = event_init(EVT_FOCUS, target); event_t focus = event_init(EVT_FOCUS, target);
if (widget->key_target) { if (widget->key_target) {

View File

@ -86,6 +86,10 @@ typedef struct _widget_vtable_t {
* *
*/ */
uint32_t is_designing_window : 1; uint32_t is_designing_window : 1;
/**
* ()
*/
uint32_t is_keyboard: 1;
widget_create_t create; widget_create_t create;
widget_get_prop_t get_prop; widget_get_prop_t get_prop;

View File

@ -47,6 +47,7 @@ static ret_t keyboard_on_destroy(widget_t* widget) {
static const widget_vtable_t s_keyboard_vtable = {.size = sizeof(keyboard_t), static const widget_vtable_t s_keyboard_vtable = {.size = sizeof(keyboard_t),
.type = WIDGET_TYPE_KEYBOARD, .type = WIDGET_TYPE_KEYBOARD,
.is_window = TRUE, .is_window = TRUE,
.is_keyboard = TRUE,
.clone_properties = s_keyboard_properties, .clone_properties = s_keyboard_properties,
.persistent_properties = s_keyboard_properties, .persistent_properties = s_keyboard_properties,
.create = keyboard_create, .create = keyboard_create,