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};
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)
{
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)
{
}
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;
}
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;
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)
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);
}
_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);
}