Eina_Bool ret = EINA_FALSE;
struct wl_surface *surface = NULL;
+ EINA_SAFETY_ON_NULL_GOTO(key, err);
+ EINA_SAFETY_ON_TRUE_GOTO((grab_mode < ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN), err);
+ EINA_SAFETY_ON_TRUE_GOTO((grab_mode > ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE), err);
+
if (win)
ewd = win->display;
else
ewd = ecore_wl2_connected_display_get(NULL);
- if (!ewd) goto err;
+ EINA_SAFETY_ON_NULL_GOTO(ewd, err);
while (!ewd->wl.tz_keyrouter)
{
INF("Wait until keyrouter interface is ready");
wl_display_roundtrip(ewd->wl.display);
}
- if (!key) goto err;
- if ((grab_mode < ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN) || (grab_mode > ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE))
- goto err;
INF("win=%p key=%s mod=%d", win, key, grab_mode);
keysym = xkb_keysym_from_name(key, XKB_KEYSYM_NO_FLAGS);
-
if (keysym == XKB_KEY_NoSymbol)
{
WRN("Keysym of key(\"%s\") doesn't exist", key);
- goto err;
+ EINA_SAFETY_ON_TRUE_GOTO(EINA_TRUE, err);
}
//We have to find the way to get keycode from keysym before keymap notify
}
input = ecore_wl2_input_default_input_get(ewd);
+ EINA_SAFETY_ON_NULL_GOTO(input, err);
- if (input)
+ while (!input->caps_update)
{
- while (!input->caps_update)
- {
- INF("Wait until wl_seat_capabilities_update is ready");
- wl_display_roundtrip(ewd->wl.display);
- }
- if (input->wl.keyboard)
- {
- while (!input->xkb.keymap)
- {
- wl_display_roundtrip(ewd->wl.display);
- INF("Wait until keymap event occurs");
- }
- INF("Finish keymap event");
-
- num_keycodes = ecore_wl2_input_keycode_from_keysym(input->xkb.keymap, keysym, &keycodes);
- }
- else
- {
- WRN("This device does not support key");
- goto err;
- }
+ INF("Wait until wl_seat_capabilities_update is ready");
+ wl_display_roundtrip(ewd->wl.display);
}
- if (num_keycodes == 0)
+ EINA_SAFETY_ON_NULL_GOTO(input->wl.keyboard, err);
+
+
+ while (!input->xkb.keymap)
{
- WRN("Keycode of key(\"%s\") doesn't exist", key);
- goto err;
+ wl_display_roundtrip(ewd->wl.display);
+ INF("Wait until keymap event occurs");
}
+ INF("Finish keymap event");
+
+ num_keycodes = ecore_wl2_input_keycode_from_keysym(input->xkb.keymap, keysym, &keycodes);
+ EINA_SAFETY_ON_TRUE_GOTO((num_keycodes == 0), err);
/* Request to grab a key */
if (win)