2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
4 * This file is a modified version of BSD licensed file and
5 * licensed under the Flora License, Version 1.1 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * Please, see the COPYING file for the original copyright owner and
22 /* E_Zone is a child object of E_Container. There is one zone per screen
23 * in a xinerama setup. Each zone has one or more desktops.
29 # define LOG_TAG "E17"
32 static void _e_zone_free(E_Zone *zone);
33 static void _e_zone_cb_bg_mouse_down(void *data,
37 static void _e_zone_cb_bg_mouse_up(void *data,
41 static void _e_zone_event_zone_desk_count_set_free(void *data,
43 static Eina_Bool _e_zone_cb_mouse_in(void *data,
46 static Eina_Bool _e_zone_cb_mouse_out(void *data,
49 static Eina_Bool _e_zone_cb_mouse_down(void *data,
52 static Eina_Bool _e_zone_cb_mouse_up(void *data,
55 static Eina_Bool _e_zone_cb_mouse_move(void *data,
58 static Eina_Bool _e_zone_cb_desk_after_show(void *data,
61 static Eina_Bool _e_zone_cb_edge_timer(void *data);
62 static void _e_zone_event_move_resize_free(void *data,
64 static void _e_zone_event_add_free(void *data,
66 static void _e_zone_event_del_free(void *data,
68 static void _e_zone_object_del_attach(void *o);
69 static E_Zone_Edge _e_zone_detect_edge(E_Zone *zone,
71 static void _e_zone_edge_move_resize(E_Zone *zone);
72 static void _e_zone_border_geometry_update(E_Zone *zone);
73 #ifdef _F_ZONE_WINDOW_ROTATION_
74 static void _e_zone_event_rotation_change_begin_free(void *data,
76 static void _e_zone_event_rotation_change_cancel_free(void *data,
78 static void _e_zone_event_rotation_change_end_free(void *data,
82 EAPI int E_EVENT_ZONE_DESK_COUNT_SET = 0;
83 EAPI int E_EVENT_POINTER_WARP = 0;
84 EAPI int E_EVENT_ZONE_MOVE_RESIZE = 0;
85 EAPI int E_EVENT_ZONE_ADD = 0;
86 EAPI int E_EVENT_ZONE_DEL = 0;
87 EAPI int E_EVENT_ZONE_EDGE_IN = 0;
88 EAPI int E_EVENT_ZONE_EDGE_OUT = 0;
89 EAPI int E_EVENT_ZONE_EDGE_MOVE = 0;
90 #ifdef _F_ZONE_WINDOW_ROTATION_
91 EAPI int E_EVENT_ZONE_ROTATION_CHANGE = 0; /* deprecated */
92 EAPI int E_EVENT_ZONE_ROTATION_CHANGE_BEGIN = 0;
93 EAPI int E_EVENT_ZONE_ROTATION_CHANGE_CANCEL = 0;
94 EAPI int E_EVENT_ZONE_ROTATION_CHANGE_END = 0;
97 #define E_ZONE_FLIP_LEFT(zone) (((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || ((zone)->desk_x_current > 0)) && (zone)->edge.left)
98 #define E_ZONE_FLIP_RIGHT(zone) (((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || (((zone)->desk_x_current + 1) < (zone)->desk_x_count)) && (zone)->edge.right)
99 #define E_ZONE_FLIP_UP(zone) (((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || ((zone)->desk_y_current > 0)) && (zone)->edge.top)
100 #define E_ZONE_FLIP_DOWN(zone) (((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || (((zone)->desk_y_current + 1) < (zone)->desk_y_count)) && (zone)->edge.bottom)
102 #define E_ZONE_CORNER_RATIO 0.025;
107 E_EVENT_ZONE_DESK_COUNT_SET = ecore_event_type_new();
108 E_EVENT_POINTER_WARP = ecore_event_type_new();
109 E_EVENT_ZONE_MOVE_RESIZE = ecore_event_type_new();
110 E_EVENT_ZONE_ADD = ecore_event_type_new();
111 E_EVENT_ZONE_DEL = ecore_event_type_new();
112 E_EVENT_ZONE_EDGE_IN = ecore_event_type_new();
113 E_EVENT_ZONE_EDGE_OUT = ecore_event_type_new();
114 E_EVENT_ZONE_EDGE_MOVE = ecore_event_type_new();
115 #ifdef _F_ZONE_WINDOW_ROTATION_
116 E_EVENT_ZONE_ROTATION_CHANGE = ecore_event_type_new(); /* deprecated */
117 E_EVENT_ZONE_ROTATION_CHANGE_BEGIN = ecore_event_type_new();
118 E_EVENT_ZONE_ROTATION_CHANGE_CANCEL = ecore_event_type_new();
119 E_EVENT_ZONE_ROTATION_CHANGE_END = ecore_event_type_new();
125 e_zone_shutdown(void)
131 e_zone_all_edge_flip_eval(void)
133 Eina_List *l, *ll, *lll;
138 EINA_LIST_FOREACH(e_manager_list(), l, man)
140 EINA_LIST_FOREACH(man->containers, ll, con)
142 EINA_LIST_FOREACH(con->zones, lll, zone)
144 e_zone_edge_flip_eval(zone);
151 _e_zone_black_new(E_Zone *zone)
156 if (zone->black_ecore_evas) return;
157 zone->black_ecore_evas = e_canvas_new(zone->container->win,
158 zone->x, zone->y, 1, 1, 1, 1,
160 e_canvas_add(zone->black_ecore_evas);
161 ecore_evas_layer_set(zone->black_ecore_evas, 6);
162 zone->black_evas = ecore_evas_get(zone->black_ecore_evas);
164 o = evas_object_rectangle_add(zone->black_evas);
165 evas_object_move(o, 0, 0);
166 evas_object_resize(o, zone->w, zone->h);
167 evas_object_color_set(o, 0, 0, 0, 255);
170 ecore_evas_name_class_set(zone->black_ecore_evas, "E", "Black_Window");
171 snprintf(name, sizeof(name), "Enlightenment Black Zone (%d)", zone->num);
172 ecore_evas_title_set(zone->black_ecore_evas, name);
176 _e_zone_black_free(E_Zone *zone)
178 if (!zone->black_ecore_evas) return;
179 e_canvas_del(zone->black_ecore_evas);
180 ecore_evas_free(zone->black_ecore_evas);
181 zone->black_ecore_evas = NULL;
186 _e_zone_black_get(E_Zone *zone)
189 if (!zone->black_ecore_evas) return;
190 if (zone->black_need == 1)
192 ecore_evas_move(zone->black_ecore_evas, zone->x, zone->y);
193 ecore_evas_resize(zone->black_ecore_evas, zone->w, zone->h);
198 _e_zone_black_unget(E_Zone *zone)
201 if (!zone->black_ecore_evas) return;
202 if (zone->black_need == 0)
204 ecore_evas_move(zone->black_ecore_evas, zone->x, zone->y);
205 ecore_evas_resize(zone->black_ecore_evas, 1, 1);
210 e_zone_new(E_Container *con,
220 E_Event_Zone_Add *ev;
223 zone = E_OBJECT_ALLOC(E_Zone, E_ZONE_TYPE, _e_zone_free);
224 if (!zone) return NULL;
226 zone->container = con;
234 e_zone_useful_geometry_dirty(zone);
236 //printf("@@@@@@@@@@ e_zone_new: %i %i | %i %i %ix%i = %p\n", num, id, x, y, w, h, zone);
239 eina_list_append(zone->handlers,
240 ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN,
241 _e_zone_cb_mouse_in, zone));
243 eina_list_append(zone->handlers,
244 ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT,
245 _e_zone_cb_mouse_out, zone));
247 eina_list_append(zone->handlers,
248 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
249 _e_zone_cb_mouse_down, zone));
251 eina_list_append(zone->handlers,
252 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
253 _e_zone_cb_mouse_up, zone));
255 eina_list_append(zone->handlers,
256 ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
257 _e_zone_cb_mouse_move, zone));
259 eina_list_append(zone->handlers,
260 ecore_event_handler_add(E_EVENT_DESK_AFTER_SHOW,
261 _e_zone_cb_desk_after_show, zone));
263 snprintf(name, sizeof(name), "Zone %d", zone->num);
264 zone->name = eina_stringshare_add(name);
266 con->zones = eina_list_append(con->zones, zone);
268 o = evas_object_rectangle_add(con->bg_evas);
269 zone->bg_clip_object = o;
270 evas_object_move(o, x, y);
271 evas_object_resize(o, w, h);
272 evas_object_color_set(o, 255, 255, 255, 255);
275 o = evas_object_rectangle_add(con->bg_evas);
276 zone->bg_event_object = o;
277 evas_object_clip_set(o, zone->bg_clip_object);
278 evas_object_move(o, x, y);
279 evas_object_resize(o, w, h);
280 evas_object_color_set(o, 0, 0, 0, 0);
281 evas_object_repeat_events_set(o, 1);
283 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_zone_cb_bg_mouse_down, zone);
284 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_zone_cb_bg_mouse_up, zone);
286 /* TODO: config the ecore_evas type. */
288 zone->desk_x_count = 0;
289 zone->desk_y_count = 0;
290 zone->desk_x_current = 0;
291 zone->desk_y_current = 0;
292 e_zone_desk_count_set(zone, e_config->zone_desks_x_count,
293 e_config->zone_desks_y_count);
295 e_object_del_attach_func_set(E_OBJECT(zone), _e_zone_object_del_attach);
297 _e_zone_black_new(zone);
299 ev = E_NEW(E_Event_Zone_Add, 1);
301 e_object_ref(E_OBJECT(ev->zone));
302 ecore_event_add(E_EVENT_ZONE_ADD, ev, _e_zone_event_add_free, NULL);
304 e_zone_all_edge_flip_eval();
309 e_zone_name_set(E_Zone *zone,
312 E_OBJECT_CHECK(zone);
313 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
315 if (zone->name) eina_stringshare_del(zone->name);
316 zone->name = eina_stringshare_add(name);
320 e_zone_move(E_Zone *zone,
324 E_Event_Zone_Move_Resize *ev;
326 E_OBJECT_CHECK(zone);
327 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
329 if ((x == zone->x) && (y == zone->y)) return;
332 evas_object_move(zone->bg_object, x, y);
333 evas_object_move(zone->bg_event_object, x, y);
334 evas_object_move(zone->bg_clip_object, x, y);
336 ev = E_NEW(E_Event_Zone_Move_Resize, 1);
338 e_object_ref(E_OBJECT(ev->zone));
339 ecore_event_add(E_EVENT_ZONE_MOVE_RESIZE, ev, _e_zone_event_move_resize_free, NULL);
341 _e_zone_edge_move_resize(zone);
342 e_zone_bg_reconfigure(zone);
343 if (zone->black_need > 0)
345 ecore_evas_move(zone->black_ecore_evas, zone->x, zone->y);
346 ecore_evas_resize(zone->black_ecore_evas, zone->w, zone->h);
348 _e_zone_border_geometry_update(zone);
352 e_zone_resize(E_Zone *zone,
356 E_Event_Zone_Move_Resize *ev;
358 E_OBJECT_CHECK(zone);
359 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
361 if ((w == zone->w) && (h == zone->h)) return;
364 evas_object_resize(zone->bg_object, w, h);
365 evas_object_resize(zone->bg_event_object, w, h);
366 evas_object_resize(zone->bg_clip_object, w, h);
368 ev = E_NEW(E_Event_Zone_Move_Resize, 1);
370 e_object_ref(E_OBJECT(ev->zone));
371 ecore_event_add(E_EVENT_ZONE_MOVE_RESIZE, ev,
372 _e_zone_event_move_resize_free, NULL);
374 _e_zone_edge_move_resize(zone);
375 e_zone_bg_reconfigure(zone);
376 if (zone->black_need > 0)
378 ecore_evas_move(zone->black_ecore_evas, zone->x, zone->y);
379 ecore_evas_resize(zone->black_ecore_evas, zone->w, zone->h);
381 _e_zone_border_geometry_update(zone);
385 e_zone_move_resize(E_Zone *zone,
391 E_Event_Zone_Move_Resize *ev;
393 E_OBJECT_CHECK(zone);
394 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
396 if ((x == zone->x) && (y == zone->y) && (w == zone->w) && (h == zone->h))
404 evas_object_move(zone->bg_object, x, y);
405 evas_object_move(zone->bg_event_object, x, y);
406 evas_object_move(zone->bg_clip_object, x, y);
407 evas_object_resize(zone->bg_object, w, h);
408 evas_object_resize(zone->bg_event_object, w, h);
409 evas_object_resize(zone->bg_clip_object, w, h);
411 ev = E_NEW(E_Event_Zone_Move_Resize, 1);
413 e_object_ref(E_OBJECT(ev->zone));
414 ecore_event_add(E_EVENT_ZONE_MOVE_RESIZE, ev,
415 _e_zone_event_move_resize_free, NULL);
417 _e_zone_edge_move_resize(zone);
419 e_zone_bg_reconfigure(zone);
420 if (zone->black_need > 0)
422 ecore_evas_move(zone->black_ecore_evas, zone->x, zone->y);
423 ecore_evas_resize(zone->black_ecore_evas, zone->w, zone->h);
425 _e_zone_border_geometry_update(zone);
429 e_zone_fullscreen_set(E_Zone *zone,
432 E_OBJECT_CHECK(zone);
433 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
435 if ((!zone->fullscreen) && (on))
437 _e_zone_black_get(zone);
438 ecore_evas_show(zone->black_ecore_evas);
439 e_container_window_raise(zone->container, zone->black_win, 150);
440 zone->fullscreen = 1;
442 else if ((zone->fullscreen) && (!on))
444 ecore_evas_hide(zone->black_ecore_evas);
445 zone->fullscreen = 0;
446 _e_zone_black_unget(zone);
451 e_zone_current_get(E_Container *con)
456 E_OBJECT_CHECK_RETURN(con, NULL);
457 E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
462 ecore_x_pointer_xy_get(con->win, &x, &y);
463 EINA_LIST_FOREACH(con->zones, l, zone)
465 if (E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h))
469 if (!con->zones) return NULL;
470 return (E_Zone *)eina_list_data_get(con->zones);
474 e_zone_bg_reconfigure(E_Zone *zone)
476 E_OBJECT_CHECK(zone);
477 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
479 e_bg_zone_update(zone, E_BG_TRANSITION_CHANGE);
483 e_zone_flip_coords_handle(E_Zone *zone,
487 E_Event_Zone_Edge *zev;
488 E_Binding_Edge *binding;
496 E_OBJECT_CHECK(zone);
497 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
499 if (!e_config->edge_flip_dragging || zone->flip.switching) return;
500 /* if we have only 1 row we can flip up/down even if we have xinerama */
501 if (eina_list_count(zone->container->zones) > 1)
507 zones = zone->container->zones;
508 next_zone = (E_Zone *)eina_list_data_get(zones);
511 zones = eina_list_next(zones);
512 EINA_LIST_FOREACH(eina_list_next(zones), zones, next_zone)
514 if (next_zone->x != cx) one_col = 0;
515 if (next_zone->y != cy) one_row = 0;
518 if (eina_list_count(zone->container->manager->containers) > 1)
520 if (!E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h))
522 if ((one_row) && (y == 0))
523 edge = E_ZONE_EDGE_TOP;
524 else if ((one_col) && (x == (zone->w - 1)))
525 edge = E_ZONE_EDGE_RIGHT;
526 else if ((one_row) && (y == (zone->h - 1)))
527 edge = E_ZONE_EDGE_BOTTOM;
528 else if ((one_col) && (x == 0))
529 edge = E_ZONE_EDGE_LEFT;
534 e_shelf_toggle(zone->flip.es, 0);
535 zone->flip.es = NULL;
538 EINA_LIST_FOREACH(e_shelf_list(), l, es)
540 if (es->zone != zone) continue;
541 switch (es->gadcon->orient)
543 case E_GADCON_ORIENT_TOP:
544 case E_GADCON_ORIENT_CORNER_TL:
545 case E_GADCON_ORIENT_CORNER_TR:
546 if (edge == E_ZONE_EDGE_TOP) ok = 1;
549 case E_GADCON_ORIENT_BOTTOM:
550 case E_GADCON_ORIENT_CORNER_BL:
551 case E_GADCON_ORIENT_CORNER_BR:
552 if (edge == E_ZONE_EDGE_BOTTOM) ok = 1;
555 case E_GADCON_ORIENT_LEFT:
556 case E_GADCON_ORIENT_CORNER_LT:
557 case E_GADCON_ORIENT_CORNER_LB:
558 if (edge == E_ZONE_EDGE_LEFT) ok = 1;
561 case E_GADCON_ORIENT_RIGHT:
562 case E_GADCON_ORIENT_CORNER_RT:
563 case E_GADCON_ORIENT_CORNER_RB:
564 if (edge == E_ZONE_EDGE_RIGHT) ok = 1;
573 if (!E_INSIDE(x, y, es->x, es->y, es->w, es->h))
577 e_shelf_toggle(zone->flip.es, 0);
580 e_shelf_toggle(es, 1);
584 case E_ZONE_EDGE_LEFT:
585 if (E_ZONE_FLIP_LEFT(zone)) ok = 1;
588 case E_ZONE_EDGE_TOP:
589 if (E_ZONE_FLIP_UP(zone)) ok = 1;
592 case E_ZONE_EDGE_RIGHT:
593 if (E_ZONE_FLIP_RIGHT(zone)) ok = 1;
596 case E_ZONE_EDGE_BOTTOM:
597 if (E_ZONE_FLIP_DOWN(zone)) ok = 1;
605 binding = e_bindings_edge_get("desk_flip_in_direction", edge, 0);
606 if (!binding) binding = e_bindings_edge_get("desk_flip_by", edge, 0);
607 if (binding && (!binding->timer))
609 zev = E_NEW(E_Event_Zone_Edge, 1);
615 zone->flip.bind = binding;
616 zone->flip.switching = 1;
617 binding->timer = ecore_timer_add(((double)binding->delay), _e_zone_cb_edge_timer, zone);
622 e_zone_desk_count_set(E_Zone *zone,
627 E_Desk *desk, *new_desk;
629 E_Event_Zone_Desk_Count_Set *ev;
631 int x, y, xx, yy, moved, nx, ny;
633 E_OBJECT_CHECK(zone);
634 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
641 /* Orphaned window catcher; in case desk count gets reset */
643 if (zone->desk_x_current >= xx) moved = 1;
644 if (zone->desk_y_current >= yy) moved = 1;
647 nx = zone->desk_x_current;
648 ny = zone->desk_y_current;
649 if (zone->desk_x_current >= xx) nx = xx - 1;
650 if (zone->desk_y_current >= yy) ny = yy - 1;
651 e_desk_show(e_desk_at_xy_get(zone, nx, ny));
654 new_desks = malloc(xx * yy * sizeof(E_Desk *));
655 for (x = 0; x < xx; x++)
657 for (y = 0; y < yy; y++)
659 if ((x < zone->desk_x_count) && (y < zone->desk_y_count))
660 desk = zone->desks[x + (y * zone->desk_x_count)];
662 desk = e_desk_new(zone, x, y);
663 new_desks[x + (y * xx)] = desk;
667 /* catch windoes that have fallen off the end if we got smaller */
668 if (xx < zone->desk_x_count)
670 for (y = 0; y < zone->desk_y_count; y++)
672 new_desk = zone->desks[xx - 1 + (y * zone->desk_x_count)];
673 for (x = xx; x < zone->desk_x_count; x++)
675 desk = zone->desks[x + (y * zone->desk_x_count)];
677 bl = e_container_border_list_first(zone->container);
678 while ((bd = e_container_border_list_next(bl)))
680 if (bd->desk == desk)
681 e_border_desk_set(bd, new_desk);
683 e_container_border_list_free(bl);
684 e_object_del(E_OBJECT(desk));
688 if (yy < zone->desk_y_count)
690 for (x = 0; x < zone->desk_x_count; x++)
692 new_desk = zone->desks[x + ((yy - 1) * zone->desk_x_count)];
693 for (y = yy; y < zone->desk_y_count; y++)
695 desk = zone->desks[x + (y * zone->desk_x_count)];
697 bl = e_container_border_list_first(zone->container);
698 while ((bd = e_container_border_list_next(bl)))
700 if (bd->desk == desk)
701 e_border_desk_set(bd, new_desk);
703 e_container_border_list_free(bl);
704 e_object_del(E_OBJECT(desk));
708 if (zone->desks) free(zone->desks);
709 zone->desks = new_desks;
711 zone->desk_x_count = xx;
712 zone->desk_y_count = yy;
713 e_config->zone_desks_x_count = xx;
714 e_config->zone_desks_y_count = yy;
715 e_config_save_queue();
717 /* Cannot call desk_current_get until the zone desk counts have been set
718 * or else we end up with a "white background" because desk_current_get will
721 desk = e_desk_current_get(zone);
728 e_zone_edge_flip_eval(zone);
730 ev = E_NEW(E_Event_Zone_Desk_Count_Set, 1);
733 e_object_ref(E_OBJECT(ev->zone));
734 ecore_event_add(E_EVENT_ZONE_DESK_COUNT_SET, ev,
735 _e_zone_event_zone_desk_count_set_free, NULL);
739 e_zone_desk_count_get(E_Zone *zone,
743 E_OBJECT_CHECK(zone);
744 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
746 if (x_count) *x_count = zone->desk_x_count;
747 if (y_count) *y_count = zone->desk_y_count;
751 e_zone_desk_flip_by(E_Zone *zone,
755 E_OBJECT_CHECK(zone);
756 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
758 dx = zone->desk_x_current + dx;
759 dy = zone->desk_y_current + dy;
760 e_zone_desk_flip_to(zone, dx, dy);
761 e_zone_edge_flip_eval(zone);
765 e_zone_desk_flip_to(E_Zone *zone,
771 E_OBJECT_CHECK(zone);
772 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
774 if (e_config->desk_flip_wrap)
776 x = x % zone->desk_x_count;
777 y = y % zone->desk_y_count;
778 if (x < 0) x += zone->desk_x_count;
779 if (y < 0) y += zone->desk_y_count;
784 else if (x >= zone->desk_x_count)
785 x = zone->desk_x_count - 1;
787 else if (y >= zone->desk_y_count)
788 y = zone->desk_y_count - 1;
790 desk = e_desk_at_xy_get(zone, x, y);
791 if (desk) e_desk_show(desk);
792 e_zone_edge_flip_eval(zone);
796 e_zone_desk_linear_flip_by(E_Zone *zone,
799 E_OBJECT_CHECK(zone);
800 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
802 dx = zone->desk_x_current +
803 (zone->desk_y_current * zone->desk_x_count) + dx;
804 dx = dx % (zone->desk_x_count * zone->desk_y_count);
806 dx += (zone->desk_x_count * zone->desk_y_count);
807 e_zone_desk_linear_flip_to(zone, dx);
808 e_zone_edge_flip_eval(zone);
812 e_zone_desk_linear_flip_to(E_Zone *zone,
817 E_OBJECT_CHECK(zone);
818 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
820 y = x / zone->desk_x_count;
821 x = x - (y * zone->desk_x_count);
822 e_zone_desk_flip_to(zone, x, y);
823 e_zone_edge_flip_eval(zone);
827 e_zone_edge_enable(void)
829 Eina_List *l, *ll, *lll;
834 EINA_LIST_FOREACH(e_manager_list(), l, man)
836 EINA_LIST_FOREACH(man->containers, ll, con)
838 EINA_LIST_FOREACH(con->zones, lll, zone)
840 if (zone->edge.left) ecore_x_window_show(zone->edge.left);
841 if (zone->edge.right) ecore_x_window_show(zone->edge.right);
842 if (zone->edge.top) ecore_x_window_show(zone->edge.top);
843 if (zone->edge.bottom) ecore_x_window_show(zone->edge.bottom);
844 if (zone->corner.left_top) ecore_x_window_show(zone->corner.left_top);
845 if (zone->corner.top_left) ecore_x_window_show(zone->corner.top_left);
846 if (zone->corner.top_right) ecore_x_window_show(zone->corner.top_right);
847 if (zone->corner.right_top) ecore_x_window_show(zone->corner.right_top);
848 if (zone->corner.right_bottom) ecore_x_window_show(zone->corner.right_bottom);
849 if (zone->corner.bottom_right) ecore_x_window_show(zone->corner.bottom_right);
850 if (zone->corner.bottom_left) ecore_x_window_show(zone->corner.bottom_left);
851 if (zone->corner.left_bottom) ecore_x_window_show(zone->corner.left_bottom);
852 e_zone_edge_flip_eval(zone);
859 e_zone_edge_disable(void)
861 Eina_List *l, *ll, *lll;
866 EINA_LIST_FOREACH(e_manager_list(), l, man)
868 EINA_LIST_FOREACH(man->containers, ll, con)
870 EINA_LIST_FOREACH(con->zones, lll, zone)
872 if (zone->edge.left) ecore_x_window_hide(zone->edge.left);
873 if (zone->edge.right) ecore_x_window_hide(zone->edge.right);
874 if (zone->edge.top) ecore_x_window_hide(zone->edge.top);
875 if (zone->edge.bottom) ecore_x_window_hide(zone->edge.bottom);
876 if (zone->corner.left_top) ecore_x_window_hide(zone->corner.left_top);
877 if (zone->corner.top_left) ecore_x_window_hide(zone->corner.top_left);
878 if (zone->corner.top_right) ecore_x_window_hide(zone->corner.top_right);
879 if (zone->corner.right_top) ecore_x_window_hide(zone->corner.right_top);
880 if (zone->corner.right_bottom) ecore_x_window_hide(zone->corner.right_bottom);
881 if (zone->corner.bottom_right) ecore_x_window_hide(zone->corner.bottom_right);
882 if (zone->corner.bottom_left) ecore_x_window_hide(zone->corner.bottom_left);
883 if (zone->corner.left_bottom) ecore_x_window_hide(zone->corner.left_bottom);
890 e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool t, Eina_Bool b)
892 #define NEED_FLIP_EDGE(x) \
893 (e_bindings_edge_flippable_get(x) || e_bindings_edge_non_flippable_get(x))
894 #define NEED_EDGE(x) \
895 (e_bindings_edge_non_flippable_get(x))
896 #define CHECK_EDGE(v, ed, win) \
899 if (NEED_FLIP_EDGE(ed)) { if (zone->edge.win) ecore_x_window_show(zone->edge.win); } \
900 else if (zone->edge.win) ecore_x_window_hide(zone->edge.win); \
903 if (NEED_EDGE(ed)) { if (zone->edge.win) ecore_x_window_show(zone->edge.win); } \
904 else if (zone->edge.win) ecore_x_window_hide(zone->edge.win); \
908 CHECK_EDGE(l, E_ZONE_EDGE_LEFT, left);
909 CHECK_EDGE(r, E_ZONE_EDGE_RIGHT, right);
910 CHECK_EDGE(t, E_ZONE_EDGE_TOP, top);
911 CHECK_EDGE(b, E_ZONE_EDGE_BOTTOM, bottom);
913 #define CHECK_CORNER(v1, v2, ed, win1, win2) \
914 if ((!v1) && (!v2)) { \
915 if (NEED_EDGE(ed)) { \
916 if (zone->corner.win1) ecore_x_window_show(zone->corner.win1); \
917 if (zone->corner.win2) ecore_x_window_show(zone->corner.win2); \
920 if (zone->corner.win1) ecore_x_window_hide(zone->corner.win1); \
921 if (zone->corner.win2) ecore_x_window_hide(zone->corner.win2); \
925 if (NEED_FLIP_EDGE(ed)) { \
926 if (zone->corner.win1) ecore_x_window_show(zone->corner.win1); \
927 if (zone->corner.win2) ecore_x_window_show(zone->corner.win2); \
930 if (zone->corner.win1) ecore_x_window_hide(zone->corner.win1); \
931 if (zone->corner.win2) ecore_x_window_hide(zone->corner.win2); \
935 CHECK_CORNER(l, t, E_ZONE_EDGE_TOP_LEFT, left_top, top_left);
936 CHECK_CORNER(r, t, E_ZONE_EDGE_TOP_RIGHT, right_top, top_right);
937 CHECK_CORNER(l, b, E_ZONE_EDGE_BOTTOM_LEFT, left_bottom, bottom_left);
938 CHECK_CORNER(r, b, E_ZONE_EDGE_BOTTOM_RIGHT, right_bottom, bottom_right);
942 e_zone_exists_direction(E_Zone *zone, E_Zone_Edge edge)
947 EINA_LIST_FOREACH(zone->container->zones, l, z2)
949 if (zone == z2) continue;
953 case E_ZONE_EDGE_TOP_LEFT:
954 if (((E_SPANS_COMMON(0, zone->x + zone->w, z2->x, z2->w)) &&
955 (z2->y < zone->y)) ||
956 ((E_SPANS_COMMON(0, zone->y + zone->h, z2->y, z2->h)) &&
960 case E_ZONE_EDGE_TOP:
961 if ((E_SPANS_COMMON(zone->x, zone->w, z2->x, z2->w)) &&
965 case E_ZONE_EDGE_TOP_RIGHT:
966 if (((E_SPANS_COMMON(zone->x, 99999, z2->x, z2->w)) &&
967 (z2->y < zone->y)) ||
968 ((E_SPANS_COMMON(0, zone->y + zone->h, z2->y, z2->h)) &&
969 (z2->x >= (zone->x + zone->w))))
973 case E_ZONE_EDGE_LEFT:
974 if ((E_SPANS_COMMON(zone->y, zone->h, z2->y, z2->h)) &&
979 case E_ZONE_EDGE_RIGHT:
980 if ((E_SPANS_COMMON(zone->y, zone->h, z2->y, z2->h)) &&
981 (z2->x >= (zone->x + zone->w)))
985 case E_ZONE_EDGE_BOTTOM_LEFT:
986 if (((E_SPANS_COMMON(0, zone->x + zone->w, z2->x, z2->w)) &&
987 (z2->y >= (zone->y + zone->h))) ||
988 ((E_SPANS_COMMON(zone->y, 99999, z2->y, z2->h)) &&
992 case E_ZONE_EDGE_BOTTOM:
993 if ((E_SPANS_COMMON(zone->x, zone->w, z2->x, z2->w)) &&
994 (z2->y >= (zone->y + zone->h)))
997 case E_ZONE_EDGE_BOTTOM_RIGHT:
998 if (((E_SPANS_COMMON(zone->x, 99999, z2->x, z2->w)) &&
999 (z2->y >= (zone->y + zone->h))) ||
1000 ((E_SPANS_COMMON(zone->y, 99999, z2->y, z2->h)) &&
1015 e_zone_edge_flip_eval(E_Zone *zone)
1017 Eina_Bool lf, rf, tf, bf;
1019 lf = rf = tf = bf = EINA_TRUE;
1020 if (zone->desk_x_count <= 1) lf = rf = EINA_FALSE;
1021 else if (!e_config->desk_flip_wrap)
1023 if (zone->desk_x_current == 0) lf = EINA_FALSE;
1024 if (zone->desk_x_current == (zone->desk_x_count - 1)) rf = EINA_FALSE;
1026 if (zone->desk_y_count <= 1) tf = bf = EINA_FALSE;
1027 else if (!e_config->desk_flip_wrap)
1029 if (zone->desk_y_current == 0) tf = EINA_FALSE;
1030 if (zone->desk_y_current == (zone->desk_y_count - 1)) bf = EINA_FALSE;
1032 e_zone_edges_desk_flip_capable(zone, lf, rf, tf, bf);
1036 e_zone_edge_new(E_Zone_Edge edge)
1038 Eina_List *l, *ll, *lll;
1044 // configurably disallow edge bindings when we have more than 1 root
1045 // window (ie pure old multihead) since we don't know which direction
1046 // other root windows are in
1047 if ((!e_config->multiscreen_flip) && (eina_list_count(e_manager_list()) > 1)) return;
1048 EINA_LIST_FOREACH(e_manager_list(), l, man)
1050 EINA_LIST_FOREACH(man->containers, ll, con)
1052 EINA_LIST_FOREACH(con->zones, lll, zone)
1054 // don't allow bindings on edges that are on the boundary
1056 if (e_zone_exists_direction(zone, edge)) continue;
1057 cw = zone->w * E_ZONE_CORNER_RATIO;
1058 ch = zone->h * E_ZONE_CORNER_RATIO;
1061 case E_ZONE_EDGE_NONE:
1065 case E_ZONE_EDGE_LEFT:
1066 if (!zone->edge.left)
1068 zone->edge.left = ecore_x_window_input_new(con->win,
1069 zone->x, zone->y + ch, 1,
1071 ecore_x_window_show(zone->edge.left);
1075 case E_ZONE_EDGE_RIGHT:
1076 if (!zone->edge.right)
1078 zone->edge.right = ecore_x_window_input_new(con->win,
1079 zone->x + zone->w - 1,
1080 zone->y + ch, 1, zone->h - 2 * ch);
1081 ecore_x_window_show(zone->edge.right);
1085 case E_ZONE_EDGE_TOP:
1086 if (!zone->edge.top)
1088 zone->edge.top = ecore_x_window_input_new(con->win,
1089 zone->x + 1 + cw, zone->y,
1090 zone->w - 2 * cw - 2, 1);
1091 ecore_x_window_show(zone->edge.top);
1095 case E_ZONE_EDGE_BOTTOM:
1096 if (!zone->edge.bottom)
1098 zone->edge.bottom = ecore_x_window_input_new(con->win,
1099 zone->x + 1 + cw, zone->y + zone->h - 1,
1100 zone->w - 2 - 2 * cw, 1);
1101 ecore_x_window_show(zone->edge.bottom);
1105 case E_ZONE_EDGE_TOP_LEFT:
1106 if (!zone->corner.left_top)
1108 zone->corner.left_top = ecore_x_window_input_new(con->win,
1109 zone->x, zone->y, 1, ch);
1110 ecore_x_window_show(zone->corner.left_top);
1112 if (!zone->corner.top_left)
1114 zone->corner.top_left = ecore_x_window_input_new(con->win,
1115 zone->x + 1, zone->y, cw, 1);
1116 ecore_x_window_show(zone->corner.top_left);
1120 case E_ZONE_EDGE_TOP_RIGHT:
1121 if (!zone->corner.top_right)
1123 zone->corner.top_right = ecore_x_window_input_new(con->win,
1124 zone->x + zone->w - cw - 2,
1126 ecore_x_window_show(zone->corner.top_right);
1128 if (!zone->corner.right_top)
1130 zone->corner.right_top = ecore_x_window_input_new(con->win,
1131 zone->x + zone->w - 1,
1133 ecore_x_window_show(zone->corner.right_top);
1137 case E_ZONE_EDGE_BOTTOM_RIGHT:
1138 if (!zone->corner.right_bottom)
1140 zone->corner.right_bottom = ecore_x_window_input_new(con->win,
1141 zone->x + zone->w - 1,
1142 zone->y + zone->h - ch, 1, ch);
1143 ecore_x_window_show(zone->corner.right_bottom);
1145 if (!zone->corner.bottom_right)
1147 zone->corner.bottom_right = ecore_x_window_input_new(con->win,
1148 zone->x + zone->w - cw - 2,
1149 zone->y + zone->h - 1, cw, 1);
1151 ecore_x_window_show(zone->corner.bottom_right);
1155 case E_ZONE_EDGE_BOTTOM_LEFT:
1156 if (!zone->corner.bottom_left)
1158 zone->corner.bottom_left = ecore_x_window_input_new(con->win,
1160 zone->y + zone->h - 1, cw, 1);
1161 ecore_x_window_show(zone->corner.bottom_left);
1163 if (!zone->corner.left_bottom)
1165 zone->corner.left_bottom = ecore_x_window_input_new(con->win,
1166 zone->x, zone->y + zone->h - ch,
1168 ecore_x_window_show(zone->corner.left_bottom);
1172 if (e_config->fullscreen_flip)
1173 e_zone_edge_win_layer_set(zone, 250);
1175 e_zone_edge_win_layer_set(zone, 200);
1182 e_zone_edge_free(E_Zone_Edge edge)
1184 Eina_List *l, *ll, *lll;
1189 EINA_LIST_FOREACH(e_manager_list(), l, man)
1191 EINA_LIST_FOREACH(man->containers, ll, con)
1193 EINA_LIST_FOREACH(con->zones, lll, zone)
1197 case E_ZONE_EDGE_NONE:
1201 case E_ZONE_EDGE_LEFT:
1202 if (zone->edge.left) ecore_x_window_free(zone->edge.left);
1203 zone->edge.left = 0;
1206 case E_ZONE_EDGE_RIGHT:
1207 if (zone->edge.right) ecore_x_window_free(zone->edge.right);
1208 zone->edge.right = 0;
1211 case E_ZONE_EDGE_TOP:
1212 if (zone->edge.top) ecore_x_window_free(zone->edge.top);
1216 case E_ZONE_EDGE_BOTTOM:
1217 if (zone->edge.bottom) ecore_x_window_free(zone->edge.bottom);
1218 zone->edge.bottom = 0;
1221 case E_ZONE_EDGE_TOP_LEFT:
1222 if (zone->corner.left_top) ecore_x_window_free(zone->corner.left_top);
1223 if (zone->corner.top_left) ecore_x_window_free(zone->corner.top_left);
1224 zone->corner.left_top = 0;
1225 zone->corner.top_left = 0;
1228 case E_ZONE_EDGE_TOP_RIGHT:
1229 if (zone->corner.top_right) ecore_x_window_free(zone->corner.top_right);
1230 if (zone->corner.right_top) ecore_x_window_free(zone->corner.right_top);
1231 zone->corner.top_right = 0;
1232 zone->corner.right_top = 0;
1235 case E_ZONE_EDGE_BOTTOM_RIGHT:
1236 if (zone->corner.right_bottom) ecore_x_window_free(zone->corner.right_bottom);
1237 if (zone->corner.bottom_right) ecore_x_window_free(zone->corner.bottom_right);
1238 zone->corner.right_bottom = 0;
1239 zone->corner.bottom_right = 0;
1242 case E_ZONE_EDGE_BOTTOM_LEFT:
1243 if (zone->corner.bottom_left) ecore_x_window_free(zone->corner.bottom_left);
1244 if (zone->corner.left_bottom) ecore_x_window_free(zone->corner.left_bottom);
1245 zone->corner.bottom_left = 0;
1246 zone->corner.left_bottom = 0;
1255 e_zone_edge_win_layer_set(E_Zone *zone,
1258 if (zone->corner.left_bottom) e_container_window_raise(zone->container, zone->corner.left_bottom, layer);
1259 if (zone->corner.left_top) e_container_window_raise(zone->container, zone->corner.left_top, layer);
1260 if (zone->corner.top_left) e_container_window_raise(zone->container, zone->corner.top_left, layer);
1261 if (zone->corner.top_right) e_container_window_raise(zone->container, zone->corner.top_right, layer);
1262 if (zone->corner.right_top) e_container_window_raise(zone->container, zone->corner.right_top, layer);
1263 if (zone->corner.right_bottom) e_container_window_raise(zone->container, zone->corner.right_bottom, layer);
1264 if (zone->corner.bottom_right) e_container_window_raise(zone->container, zone->corner.bottom_right, layer);
1265 if (zone->corner.bottom_left) e_container_window_raise(zone->container, zone->corner.bottom_left, layer);
1267 if (zone->edge.left) e_container_window_raise(zone->container, zone->edge.left, layer);
1268 if (zone->edge.right) e_container_window_raise(zone->container, zone->edge.right, layer);
1269 if (zone->edge.top) e_container_window_raise(zone->container, zone->edge.top, layer);
1270 if (zone->edge.bottom) e_container_window_raise(zone->container, zone->edge.bottom, layer);
1274 _e_zone_useful_geometry_calc(E_Zone *zone)
1276 const E_Shelf *shelf;
1278 int x0, x1, yy0, yy1;
1284 shelves = e_shelf_list_all();
1285 EINA_LIST_FREE(shelves, shelf)
1287 E_Config_Shelf_Desk *sd;
1288 E_Gadcon_Orient orient;
1292 if (shelf->zone != zone)
1297 if (shelf->cfg->overlap)
1300 if (shelf->cfg->autohide)
1302 orient = shelf->cfg->orient;
1304 if (shelf->cfg->desk_show_mode)
1307 EINA_LIST_FOREACH(shelf->cfg->desk_list, ll, sd)
1310 if ((sd->x == zone->desk_x_current) && (sd->y == zone->desk_y_current))
1321 orient = shelf->gadcon->orient;
1325 /* these are non-edje orientations */
1326 case E_GADCON_ORIENT_FLOAT:
1327 case E_GADCON_ORIENT_HORIZ:
1328 case E_GADCON_ORIENT_VERT:
1331 case E_GADCON_ORIENT_TOP:
1332 case E_GADCON_ORIENT_CORNER_TL:
1333 case E_GADCON_ORIENT_CORNER_TR:
1338 case E_GADCON_ORIENT_BOTTOM:
1339 case E_GADCON_ORIENT_CORNER_BL:
1340 case E_GADCON_ORIENT_CORNER_BR:
1341 if (yy1 > zone->h - shelf->h)
1342 yy1 = zone->h - shelf->h;
1346 case E_GADCON_ORIENT_LEFT:
1347 case E_GADCON_ORIENT_CORNER_LT:
1348 case E_GADCON_ORIENT_CORNER_LB:
1353 case E_GADCON_ORIENT_RIGHT:
1354 case E_GADCON_ORIENT_CORNER_RT:
1355 case E_GADCON_ORIENT_CORNER_RB:
1356 if (x1 > zone->w - shelf->w)
1357 x1 = zone->w - shelf->w;
1364 zone->useful_geometry.x = zone->x + x0;
1365 zone->useful_geometry.y = zone->y + yy0;
1366 zone->useful_geometry.w = x1 - x0;
1367 zone->useful_geometry.h = yy1 - yy0;
1368 zone->useful_geometry.dirty = 0;
1372 * Get (or calculate) the useful (or free, without any shelves) area.
1375 e_zone_useful_geometry_get(E_Zone *zone,
1384 E_OBJECT_CHECK(zone);
1385 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
1387 if (!zone->useful_geometry.dirty)
1389 EINA_LIST_FOREACH(e_shelf_list(), l, shelf)
1391 if (!shelf->cfg) continue;
1392 if (shelf->cfg->desk_show_mode)
1394 _e_zone_useful_geometry_calc(zone);
1400 _e_zone_useful_geometry_calc(zone);
1402 if (x) *x = zone->useful_geometry.x;
1403 if (y) *y = zone->useful_geometry.y;
1404 if (w) *w = zone->useful_geometry.w;
1405 if (h) *h = zone->useful_geometry.h;
1409 * Mark as dirty so e_zone_useful_geometry_get() will need to recalculate.
1411 * Call this function when shelves are added or important properties changed.
1414 e_zone_useful_geometry_dirty(E_Zone *zone)
1416 E_Event_Zone_Move_Resize *ev;
1418 E_OBJECT_CHECK(zone);
1419 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
1421 ev = E_NEW(E_Event_Zone_Move_Resize, 1);
1423 e_object_ref(E_OBJECT(ev->zone));
1424 ecore_event_add(E_EVENT_ZONE_MOVE_RESIZE, ev, _e_zone_event_move_resize_free, NULL);
1426 zone->useful_geometry.dirty = 1;
1427 zone->useful_geometry.x = -1;
1428 zone->useful_geometry.y = -1;
1429 zone->useful_geometry.w = -1;
1430 zone->useful_geometry.h = -1;
1433 #ifdef _F_ZONE_WINDOW_ROTATION_
1435 e_zone_rotation_set(E_Zone *zone,
1438 E_Event_Zone_Rotation_Change_Begin *ev;
1440 E_OBJECT_CHECK(zone);
1441 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
1444 SECURE_SLOGD("[ROTATION] ZONE_ROT_SET, wm_win_rotation_set:%d, wait_for_done:%d, block_count:%d, "
1445 "curr_rot:%d, req_rot:%d",
1446 e_config->wm_win_rotation, zone->rot.wait_for_done, zone->rot.block_count,
1447 zone->rot.curr, rot);
1450 if (!e_config->wm_win_rotation) return;
1452 ELBF(ELBT_ROT, 0, zone->num, "SET ROT a%d", rot);
1454 if ((zone->rot.wait_for_done) ||
1455 (zone->rot.block_count > 0))
1457 zone->rot.next = rot;
1458 zone->rot.pending = EINA_TRUE;
1461 if (zone->rot.curr == rot) return;
1463 zone->rot.prev = zone->rot.curr;
1464 zone->rot.curr = rot;
1465 zone->rot.wait_for_done = EINA_TRUE;
1467 ev = E_NEW(E_Event_Zone_Rotation_Change_Begin, 1);
1471 e_object_ref(E_OBJECT(ev->zone));
1472 ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_BEGIN,
1473 ev, _e_zone_event_rotation_change_begin_free, NULL);
1476 ELBF(ELBT_ROT, 0, zone->num, "CHANGE ROT a%d", zone->rot.curr);
1480 e_zone_rotation_get(E_Zone *zone)
1482 E_OBJECT_CHECK(zone);
1483 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
1484 return zone->rot.curr;
1488 e_zone_rotation_block_set(E_Zone *zone, const char *name_hint, Eina_Bool set)
1490 E_Event_Zone_Rotation_Change_Begin *ev;
1492 E_OBJECT_CHECK_RETURN(zone, EINA_FALSE);
1493 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, EINA_FALSE);
1495 if (set) zone->rot.block_count++;
1496 else zone->rot.block_count--;
1498 ELBF(ELBT_ROT, 0, zone->num, "[%s ROT] count: %d, from %s",
1499 set ? "PAUSE" : "RESUME", zone->rot.block_count, name_hint);
1501 if (zone->rot.block_count <= 0)
1503 zone->rot.block_count = 0;
1505 // e_border_rotation_list_clear(zone, EINA_FALSE);
1506 if (zone->rot.pending)
1508 zone->rot.prev = zone->rot.curr;
1509 zone->rot.curr = zone->rot.next;
1510 zone->rot.wait_for_done = EINA_TRUE;
1511 zone->rot.pending = EINA_FALSE;
1513 ev = E_NEW(E_Event_Zone_Rotation_Change_Begin, 1);
1517 e_object_ref(E_OBJECT(ev->zone));
1518 ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_BEGIN,
1519 ev, _e_zone_event_rotation_change_begin_free, NULL);
1522 ELBF(ELBT_ROT, 0, zone->num, "CHANGE ROT(pending) a%d", zone->rot.curr);
1530 e_zone_rotation_update_done(E_Zone *zone)
1532 E_Event_Zone_Rotation_Change_End *ev;
1534 E_OBJECT_CHECK(zone);
1535 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
1536 if (!e_config->wm_win_rotation) return;
1538 ELBF(ELBT_ROT, 0, zone->num, "DONE ROT a%d", zone->rot.curr);
1540 ev = E_NEW(E_Event_Zone_Rotation_Change_End, 1);
1544 e_object_ref(E_OBJECT(ev->zone));
1545 ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_END,
1546 ev, _e_zone_event_rotation_change_end_free, NULL);
1549 zone->rot.wait_for_done = EINA_FALSE;
1550 if ((zone->rot.pending) &&
1551 (zone->rot.block_count == 0))
1553 zone->rot.prev = zone->rot.curr;
1554 zone->rot.curr = zone->rot.next;
1555 zone->rot.wait_for_done = EINA_TRUE;
1556 zone->rot.pending = EINA_FALSE;
1558 E_Event_Zone_Rotation_Change_Begin *ev2;
1559 ev2 = E_NEW(E_Event_Zone_Rotation_Change_Begin, 1);
1563 e_object_ref(E_OBJECT(ev2->zone));
1564 ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_BEGIN,
1565 ev2, _e_zone_event_rotation_change_begin_free, NULL);
1568 ELBF(ELBT_ROT, 0, zone->num, "CHANGE ROT(pending) a%d", zone->rot.curr);
1573 e_zone_rotation_update_cancel(E_Zone *zone)
1575 E_Event_Zone_Rotation_Change_Cancel *ev;
1577 E_OBJECT_CHECK(zone);
1578 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
1579 if (!e_config->wm_win_rotation) return;
1581 zone->rot.wait_for_done = EINA_FALSE;
1582 if (zone->rot.pending)
1584 zone->rot.prev = zone->rot.curr;
1585 zone->rot.curr = zone->rot.next;
1586 zone->rot.pending = EINA_FALSE;
1589 ELBF(ELBT_ROT, 0, zone->num, "CANCEL ROT a%d", zone->rot.curr);
1591 ev = E_NEW(E_Event_Zone_Rotation_Change_Cancel, 1);
1595 e_object_ref(E_OBJECT(ev->zone));
1596 ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_CANCEL,
1597 ev, _e_zone_event_rotation_change_cancel_free, NULL);
1602 /* local subsystem functions */
1604 _e_zone_free(E_Zone *zone)
1609 //printf("@@@@@@@@@@ e_zone_free: %i %i | %i %i %ix%i = %p\n", zone->num, zone->id, zone->x, zone->y, zone->w, zone->h, zone);
1610 /* Delete the edge windows if they exist */
1611 if (zone->edge.top) ecore_x_window_free(zone->edge.top);
1612 if (zone->edge.bottom) ecore_x_window_free(zone->edge.bottom);
1613 if (zone->edge.left) ecore_x_window_free(zone->edge.left);
1614 if (zone->edge.right) ecore_x_window_free(zone->edge.right);
1615 if (zone->corner.left_bottom) ecore_x_window_free(zone->corner.left_bottom);
1616 if (zone->corner.left_top) ecore_x_window_free(zone->corner.left_top);
1617 if (zone->corner.top_left) ecore_x_window_free(zone->corner.top_left);
1618 if (zone->corner.top_right) ecore_x_window_free(zone->corner.top_right);
1619 if (zone->corner.right_top) ecore_x_window_free(zone->corner.right_top);
1620 if (zone->corner.right_bottom) ecore_x_window_free(zone->corner.right_bottom);
1621 if (zone->corner.bottom_right) ecore_x_window_free(zone->corner.bottom_right);
1622 if (zone->corner.bottom_left) ecore_x_window_free(zone->corner.bottom_left);
1624 /* Delete the object event callbacks */
1625 evas_object_event_callback_del(zone->bg_event_object,
1626 EVAS_CALLBACK_MOUSE_DOWN,
1627 _e_zone_cb_bg_mouse_down);
1628 evas_object_event_callback_del(zone->bg_event_object,
1629 EVAS_CALLBACK_MOUSE_UP,
1630 _e_zone_cb_bg_mouse_up);
1632 if (zone->black_ecore_evas)
1634 e_canvas_del(zone->black_ecore_evas);
1635 ecore_evas_free(zone->black_ecore_evas);
1636 zone->black_ecore_evas = NULL;
1638 if (zone->cur_mouse_action)
1640 e_object_unref(E_OBJECT(zone->cur_mouse_action));
1641 zone->cur_mouse_action = NULL;
1644 /* remove handlers */
1645 E_FREE_LIST(zone->handlers, ecore_event_handler_del);
1647 con = zone->container;
1648 if (zone->name) eina_stringshare_del(zone->name);
1649 con->zones = eina_list_remove(con->zones, zone);
1650 evas_object_del(zone->bg_event_object);
1651 evas_object_del(zone->bg_clip_object);
1652 evas_object_del(zone->bg_object);
1653 if (zone->prev_bg_object) evas_object_del(zone->prev_bg_object);
1654 if (zone->transition_object) evas_object_del(zone->transition_object);
1657 for (x = 0; x < zone->desk_x_count; x++)
1659 for (y = 0; y < zone->desk_y_count; y++)
1660 e_object_del(E_OBJECT(zone->desks[x + (y * zone->desk_x_count)]));
1664 _e_zone_black_free(zone);
1670 _e_zone_cb_bg_mouse_down(void *data,
1671 Evas *evas __UNUSED__,
1672 Evas_Object *obj __UNUSED__,
1673 void *event_info __UNUSED__)
1678 if (e_menu_grab_window_get()) return;
1680 if (!zone->cur_mouse_action)
1682 if (ecore_event_current_type_get() == ECORE_EVENT_MOUSE_BUTTON_DOWN)
1684 Ecore_Event_Mouse_Button *ev2;
1686 ev2 = ecore_event_current_event_get();
1687 zone->cur_mouse_action =
1688 e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_ZONE,
1689 E_OBJECT(zone), ev2);
1690 if (zone->cur_mouse_action)
1692 if ((!zone->cur_mouse_action->func.end_mouse) &&
1693 (!zone->cur_mouse_action->func.end))
1694 zone->cur_mouse_action = NULL;
1695 if (zone->cur_mouse_action)
1696 e_object_ref(E_OBJECT(zone->cur_mouse_action));
1703 _e_zone_cb_bg_mouse_up(void *data,
1704 Evas *evas __UNUSED__,
1705 Evas_Object *obj __UNUSED__,
1706 void *event_info __UNUSED__)
1711 if (zone->cur_mouse_action)
1713 if (ecore_event_current_type_get() == ECORE_EVENT_MOUSE_BUTTON_UP)
1715 Ecore_Event_Mouse_Button *ev2;
1717 ev2 = ecore_event_current_event_get();
1718 if (zone->cur_mouse_action->func.end_mouse)
1719 zone->cur_mouse_action->func.end_mouse(E_OBJECT(zone), "", ev2);
1720 else if (zone->cur_mouse_action->func.end)
1721 zone->cur_mouse_action->func.end(E_OBJECT(zone), "");
1723 e_object_unref(E_OBJECT(zone->cur_mouse_action));
1724 zone->cur_mouse_action = NULL;
1728 if (ecore_event_current_type_get() == ECORE_EVENT_MOUSE_BUTTON_UP)
1730 Ecore_Event_Mouse_Button *ev2;
1732 ev2 = ecore_event_current_event_get();
1733 e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_ZONE,
1734 E_OBJECT(zone), ev2);
1740 _e_zone_event_zone_desk_count_set_free(void *data __UNUSED__,
1743 E_Event_Zone_Desk_Count_Set *e;
1746 e_object_unref(E_OBJECT(e->zone));
1751 _e_zone_cb_mouse_in(void *data,
1752 int type __UNUSED__,
1755 Ecore_X_Event_Mouse_In *ev;
1756 E_Event_Zone_Edge *zev;
1763 edge = _e_zone_detect_edge(zone, ev->win);
1764 if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
1766 zev = E_NEW(E_Event_Zone_Edge, 1);
1769 zev->x = ev->root.x;
1770 zev->y = ev->root.y;
1771 zev->modifiers = ev->modifiers;
1772 ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL);
1773 e_bindings_edge_in_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
1775 return ECORE_CALLBACK_PASS_ON;
1779 _e_zone_cb_mouse_out(void *data,
1780 int type __UNUSED__,
1783 Ecore_X_Event_Mouse_Out *ev;
1784 E_Event_Zone_Edge *zev;
1791 edge = _e_zone_detect_edge(zone, ev->win);
1792 if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
1794 zev = E_NEW(E_Event_Zone_Edge, 1);
1797 zev->x = ev->root.x;
1798 zev->y = ev->root.y;
1799 zev->modifiers = ev->modifiers;
1800 ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
1801 e_bindings_edge_out_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
1802 return ECORE_CALLBACK_PASS_ON;
1806 _e_zone_cb_mouse_down(void *data,
1807 int type __UNUSED__,
1810 Ecore_Event_Mouse_Button *ev;
1811 E_Event_Zone_Edge *zev;
1818 edge = _e_zone_detect_edge(zone, ev->window);
1819 if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
1821 zev = E_NEW(E_Event_Zone_Edge, 1);
1824 zev->x = ev->root.x;
1825 zev->y = ev->root.y;
1826 zev->button = ev->buttons;
1827 zev->modifiers = ev->modifiers;
1828 ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
1829 e_bindings_edge_down_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
1830 return ECORE_CALLBACK_PASS_ON;
1834 _e_zone_cb_mouse_up(void *data,
1835 int type __UNUSED__,
1838 Ecore_Event_Mouse_Button *ev;
1839 E_Event_Zone_Edge *zev;
1846 edge = _e_zone_detect_edge(zone, ev->window);
1847 if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
1849 zev = E_NEW(E_Event_Zone_Edge, 1);
1852 zev->x = ev->root.x;
1853 zev->y = ev->root.y;
1854 zev->button = ev->buttons;
1855 zev->modifiers = ev->modifiers;
1856 ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
1857 e_bindings_edge_up_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
1858 return ECORE_CALLBACK_PASS_ON;
1862 _e_zone_cb_mouse_move(void *data,
1863 int type __UNUSED__,
1866 Ecore_Event_Mouse_Move *ev;
1867 E_Event_Zone_Edge *zev;
1874 edge = _e_zone_detect_edge(zone, ev->window);
1875 if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
1877 zev = E_NEW(E_Event_Zone_Edge, 1);
1880 zev->x = ev->root.x;
1881 zev->y = ev->root.y;
1882 zev->modifiers = ev->modifiers;
1883 ecore_event_add(E_EVENT_ZONE_EDGE_MOVE, zev, NULL, NULL);
1884 return ECORE_CALLBACK_PASS_ON;
1888 _e_zone_cb_desk_after_show(void *data,
1889 int type __UNUSED__,
1892 E_Event_Desk_Show *ev;
1897 if (ev->desk->zone != zone) return ECORE_CALLBACK_PASS_ON;
1899 zone->flip.switching = 0;
1900 return ECORE_CALLBACK_PASS_ON;
1904 _e_zone_cb_edge_timer(void *data)
1910 act = e_action_find(zone->flip.bind->action);
1913 E_FREE(zone->flip.ev);
1914 return ECORE_CALLBACK_CANCEL;
1917 if (act->func.go_edge)
1918 act->func.go_edge(E_OBJECT(zone), zone->flip.bind->params, zone->flip.ev);
1919 else if (act->func.go)
1920 act->func.go(E_OBJECT(zone), zone->flip.bind->params);
1922 zone->flip.bind->timer = NULL;
1924 E_FREE(zone->flip.ev);
1925 return ECORE_CALLBACK_CANCEL;
1929 _e_zone_event_move_resize_free(void *data __UNUSED__,
1932 E_Event_Zone_Move_Resize *e;
1935 e_object_unref(E_OBJECT(e->zone));
1940 _e_zone_event_add_free(void *data __UNUSED__,
1943 E_Event_Zone_Add *e;
1946 e_object_unref(E_OBJECT(e->zone));
1951 _e_zone_event_del_free(void *data __UNUSED__,
1954 E_Event_Zone_Del *e;
1957 e_object_unref(E_OBJECT(e->zone));
1962 _e_zone_object_del_attach(void *o)
1965 E_Event_Zone_Del *ev;
1968 ev = E_NEW(E_Event_Zone_Del, 1);
1970 e_object_ref(E_OBJECT(ev->zone));
1971 ecore_event_add(E_EVENT_ZONE_DEL, ev, _e_zone_event_del_free, NULL);
1975 _e_zone_detect_edge(E_Zone *zone,
1978 E_Zone_Edge edge = E_ZONE_EDGE_NONE;
1980 if (win == zone->edge.left)
1981 edge = E_ZONE_EDGE_LEFT;
1982 else if (win == zone->edge.top)
1983 edge = E_ZONE_EDGE_TOP;
1984 else if (win == zone->edge.right)
1985 edge = E_ZONE_EDGE_RIGHT;
1986 else if (win == zone->edge.bottom)
1987 edge = E_ZONE_EDGE_BOTTOM;
1988 else if ((win == zone->corner.left_top) ||
1989 (win == zone->corner.top_left))
1990 edge = E_ZONE_EDGE_TOP_LEFT;
1991 else if ((win == zone->corner.right_top) ||
1992 (win == zone->corner.top_right))
1993 edge = E_ZONE_EDGE_TOP_RIGHT;
1994 else if ((win == zone->corner.right_bottom) ||
1995 (win == zone->corner.bottom_right))
1996 edge = E_ZONE_EDGE_BOTTOM_RIGHT;
1997 else if ((win == zone->corner.left_bottom) ||
1998 (win == zone->corner.bottom_left))
1999 edge = E_ZONE_EDGE_BOTTOM_LEFT;
2004 _e_zone_edge_move_resize(E_Zone *zone)
2009 cw = zone->w * E_ZONE_CORNER_RATIO;
2010 ch = zone->h * E_ZONE_CORNER_RATIO;
2012 if (zone->corner.left_bottom)
2013 ecore_x_window_move_resize(zone->corner.left_bottom,
2014 zone->x, zone->y + zone->h - ch, 1, ch);
2015 if (zone->edge.left)
2016 ecore_x_window_move_resize(zone->edge.left,
2017 zone->x, zone->y + ch, 1, zone->h - 2 * ch);
2018 if (zone->corner.left_top)
2019 ecore_x_window_move_resize(zone->corner.left_top,
2020 zone->x, zone->y, 1, ch);
2022 if (zone->corner.top_left)
2023 ecore_x_window_move_resize(zone->corner.top_left,
2024 zone->x + 1, zone->y, cw, 1);
2026 ecore_x_window_move_resize(zone->edge.top,
2027 zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1);
2028 if (zone->corner.top_right)
2029 ecore_x_window_move_resize(zone->corner.top_right,
2030 zone->x + zone->w - cw - 2, zone->y, cw, 1);
2032 if (zone->corner.right_top)
2033 ecore_x_window_move_resize(zone->corner.right_top,
2034 zone->x + zone->w - 1, zone->y, 1, ch);
2035 if (zone->edge.right)
2036 ecore_x_window_move_resize(zone->edge.right,
2037 zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch);
2038 if (zone->corner.right_bottom)
2039 ecore_x_window_move_resize(zone->corner.right_bottom,
2040 zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch);
2042 if (zone->corner.bottom_right)
2043 ecore_x_window_move_resize(zone->corner.bottom_right,
2044 zone->x + 1, zone->y + zone->h - 1, cw, 1);
2045 if (zone->edge.bottom)
2046 ecore_x_window_move_resize(zone->edge.bottom,
2047 zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1);
2048 if (zone->corner.bottom_left)
2049 ecore_x_window_move_resize(zone->corner.bottom_left,
2050 zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1);
2054 _e_zone_border_geometry_update(E_Zone *zone)
2056 Eina_List *borders, *l;
2058 unsigned int zgeom[4];
2064 borders = e_border_client_list();
2065 EINA_LIST_FOREACH(borders, l, bd)
2067 if (bd->zone == zone)
2068 ecore_x_window_prop_card32_set(bd->client.win,
2069 E_ATOM_ZONE_GEOMETRY,
2074 #ifdef _F_ZONE_WINDOW_ROTATION_
2076 _e_zone_event_rotation_change_begin_free(void *data __UNUSED__,
2079 E_Event_Zone_Rotation_Change_Begin *e = ev;
2080 e_object_unref(E_OBJECT(e->zone));
2085 _e_zone_event_rotation_change_cancel_free(void *data __UNUSED__,
2088 E_Event_Zone_Rotation_Change_Cancel *e = ev;
2089 e_object_unref(E_OBJECT(e->zone));
2094 _e_zone_event_rotation_change_end_free(void *data __UNUSED__,
2097 E_Event_Zone_Rotation_Change_End *e = ev;
2098 e_object_unref(E_OBJECT(e->zone));