From c57201e801c42991aa66204a3bf35ca8753ad420 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Wed, 24 May 2023 15:47:00 +0900 Subject: [PATCH] e_client: remove ECORE_EVENT_KEY_DOWN code Change-Id: Ib70c887aef12bf3a8b05d33b8cd1b6f7367aa337 --- src/bin/e_client.c | 153 ----------------------------------------------------- 1 file changed, 153 deletions(-) diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 9c9a1c8..5a4154b 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -59,7 +59,6 @@ static Eina_Bool comp_grabbed = EINA_FALSE; static Eina_List *handlers = NULL; static Eina_List *hooks = NULL; -static Ecore_Event_Handler *action_handler_key = NULL; static Ecore_Event_Handler *action_handler_mouse = NULL; static Ecore_Timer *action_timer = NULL; static Eina_Rectangle action_orig = {0, 0, 0, 0}; @@ -466,10 +465,7 @@ _e_client_action_finish(void) if (comp_grabbed) _e_client_action_input_win_del(); - if (action_handler_key && action_client) - evas_object_freeze_events_set(action_client->frame, 0); E_FREE_FUNC(action_timer, ecore_timer_del); - E_FREE_FUNC(action_handler_key, ecore_event_handler_del); E_FREE_FUNC(action_handler_mouse, ecore_event_handler_del); if (action_client) { @@ -1481,33 +1477,6 @@ _e_client_action_init(E_Client *ec) action_client = ec; } -static void -_e_client_action_restore_orig(E_Client *ec) -{ - if (action_client != ec) - return; - - evas_object_geometry_set(ec->frame, action_orig.x, action_orig.y, action_orig.w, action_orig.h); -} - -static int -_e_client_key_down_modifier_apply(int modifier, int value) -{ - if (modifier & ECORE_EVENT_MODIFIER_CTRL) - return value * 2; - else if (modifier & ECORE_EVENT_MODIFIER_ALT) - { - value /= 2; - if (value) - return value; - else - return 1; - } - - return value; -} - - static int _e_client_move_begin(E_Client *ec) { @@ -1570,52 +1539,6 @@ _e_client_action_move_timeout_add(void) } static Eina_Bool -_e_client_move_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Event_Key *ev = event; - int x, y; - - if (!comp_grabbed) return ECORE_CALLBACK_RENEW; - if (!action_client) - { - ERR("no action_client!"); - goto stop; - } - - x = action_client->x; - y = action_client->y; - - if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0)) - y -= _e_client_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dy, 1)); - else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0)) - y += _e_client_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dy, 1)); - else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0)) - x -= _e_client_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dx, 1)); - else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0)) - x += _e_client_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dx, 1)); - else if (strcmp(ev->key, "Return") == 0) - goto stop; - else if (strcmp(ev->key, "Escape") == 0) - { - _e_client_action_restore_orig(action_client); - goto stop; - } - else if ((strncmp(ev->key, "Control", sizeof("Control") - 1) != 0) && - (strncmp(ev->key, "Alt", sizeof("Alt") - 1) != 0)) - goto stop; - - evas_object_move(action_client->frame, x, y); - _e_client_action_move_timeout_add(); - - return ECORE_CALLBACK_PASS_ON; - -stop: - if (action_client) _e_client_move_end(action_client); - _e_client_action_finish(); - return ECORE_CALLBACK_DONE; -} - -static Eina_Bool _e_client_move_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { if (!comp_grabbed) return ECORE_CALLBACK_RENEW; @@ -2062,74 +1985,6 @@ _e_client_action_resize_timeout_add(void) } static Eina_Bool -_e_client_resize_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Event_Key *ev = event; - int w, h, dx, dy; - - if (!comp_grabbed) return ECORE_CALLBACK_RENEW; - if (!action_client) - { - ERR("no action_client!"); - goto stop; - } - - w = action_client->w; - h = action_client->h; - - dx = e_config->border_keyboard.resize.dx; - if (dx < action_client->icccm.step_w) - dx = action_client->icccm.step_w; - dx = _e_client_key_down_modifier_apply(ev->modifiers, dx); - if (dx < action_client->icccm.step_w) - dx = action_client->icccm.step_w; - - dy = e_config->border_keyboard.resize.dy; - if (dy < action_client->icccm.step_h) - dy = action_client->icccm.step_h; - dy = _e_client_key_down_modifier_apply(ev->modifiers, dy); - if (dy < action_client->icccm.step_h) - dy = action_client->icccm.step_h; - - if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0)) - h -= dy; - else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0)) - h += dy; - else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0)) - w -= dx; - else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0)) - w += dx; - else if (strcmp(ev->key, "Return") == 0) - goto stop; - else if (strcmp(ev->key, "Escape") == 0) - { - _e_client_action_restore_orig(action_client); - goto stop; - } - else if ((strncmp(ev->key, "Control", sizeof("Control") - 1) != 0) && - (strncmp(ev->key, "Alt", sizeof("Alt") - 1) != 0)) - goto stop; - if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE) - { - if (action_client->zone) - { - w = MIN(w, action_client->zone->w); - h = MIN(h, action_client->zone->h); - } - } - e_client_resize_limit(action_client, &w, &h); - evas_object_resize(action_client->frame, w, h); - _e_client_action_resize_timeout_add(); - - return ECORE_CALLBACK_PASS_ON; - -stop: - if (action_client) _e_client_resize_end(action_client); - _e_client_action_finish(); - return ECORE_CALLBACK_DONE; -} - -static Eina_Bool _e_client_resize_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { if (!comp_grabbed) return ECORE_CALLBACK_RENEW; @@ -5154,14 +5009,12 @@ e_client_mouse_move(E_Client *ec, Evas_Point *output) ec->mouse.current.my = output->y; if (e_client_util_moving_get(ec)) { - if (action_handler_key) return; _e_client_move_handle(ec); if (ec->zone) e_zone_flip_coords_handle(ec->zone, output->x, output->y); } else if (e_client_util_resizing_get(ec)) { - if (action_handler_key) return; _e_client_resize_handle(ec); } else if (ec->drag.start) @@ -6894,9 +6747,6 @@ e_client_act_move_keyboard(E_Client *ec) if (!_e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec)) return; evas_object_freeze_events_set(ec->frame, 1); - if (!action_handler_key) - action_handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_client_move_key_down, NULL); - if (!action_handler_mouse) action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_move_mouse_down, NULL); } @@ -6919,9 +6769,6 @@ e_client_act_resize_keyboard(E_Client *ec) _e_client_action_resize_timeout_add(); evas_object_freeze_events_set(ec->frame, 1); - if (!action_handler_key) - action_handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_client_resize_key_down, NULL); - if (!action_handler_mouse) action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_resize_mouse_down, NULL); } -- 2.7.4