2 * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <Ecore_Input.h>
21 #include "syspopup_core.h"
23 #include "syspopup_api.h"
24 #include "simple_util.h"
25 #include "syspopup_wayland.h"
27 static Eina_Bool __keydown_cb(void *data, int type, void *event)
29 int id = (int)((intptr_t)data);
30 Ecore_Event_Key *ev = event;
33 return ECORE_CALLBACK_DONE;
35 wl_syspopup_process_keypress(id, ev->keyname);
37 return ECORE_CALLBACK_PASS_ON;
40 static int __efl_rotate_cb(void *d, void *w, void *s)
45 int syspopup_efl_create(const char *popup_name, bundle *b, Evas_Object *parent,
46 syspopup_handler *handler, void *user_data)
49 syspopup_info_t *info;
51 info = _syspopup_info_get(popup_name);
53 _E("Failed to get syspopup info: %s", popup_name);
57 sp = (syspopup *)malloc(sizeof(syspopup));
59 _syspopup_info_free(info);
63 sp->name = strdup(info->name);
64 sp->def_term_fn = handler->def_term_fn;
65 sp->def_timeout_fn = handler->def_timeout_fn;
66 sp->user_data = user_data;
67 sp->win = (void *)parent;
69 sp->dupped_bundle = bundle_dup(b);
70 sp->rotate_cb = __efl_rotate_cb;
72 _syspopup_add_new(sp);
73 _syspopup_set_term_type(sp, info);
74 _syspopup_set_endkey_type(sp, info);
76 sp->internal_data = (void *)elm_win_wl_window_get(parent);
77 if (wl_syspopup_init(sp, info) < 0) {
78 _syspopup_info_free(info);
79 _syspopup_del(sp->id);
83 _syspopup_reset_timeout(sp, info);
84 if (sp->endkey_act != SYSPOPUP_KEYEND_IGNORE) {
85 ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, __keydown_cb,
86 (const void *)((intptr_t)sp->id));
89 _syspopup_info_free(info);
94 int syspopup_efl_reset(bundle *b)
96 return wl_syspopup_reset(b);