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 //#define INOUTDEBUG_MOUSE 1
23 //#define INOUTDEBUG_FOCUS 1
25 /* These are compatible with netwm */
35 #define RESIZE_NONE 11
37 /* local subsystem functions */
38 static void _e_border_pri_raise(E_Border *bd);
39 static void _e_border_pri_norm(E_Border *bd);
40 static void _e_border_free(E_Border *bd);
41 static void _e_border_del(E_Border *bd);
43 #ifdef PRINT_LOTS_OF_DEBUG
44 #define E_PRINT_BORDER_INFO(X) \
45 _e_border_print(X, __PRETTY_FUNC__)
47 static void _e_border_print(E_Border *bd,
51 /* FIXME: these likely belong in a separate icccm/client handler */
52 /* and the border needs to become a dumb object that just does what its */
54 static Eina_Bool _e_border_cb_window_show_request(void *data,
57 static Eina_Bool _e_border_cb_window_destroy(void *data,
60 static Eina_Bool _e_border_cb_window_hide(void *data,
63 static Eina_Bool _e_border_cb_window_reparent(void *data,
66 static Eina_Bool _e_border_cb_window_configure_request(void *data,
69 static Eina_Bool _e_border_cb_window_resize_request(void *data,
72 static Eina_Bool _e_border_cb_window_gravity(void *data,
75 static Eina_Bool _e_border_cb_window_stack_request(void *data,
78 static Eina_Bool _e_border_cb_window_property(void *data,
81 static Eina_Bool _e_border_cb_window_colormap(void *data,
84 static Eina_Bool _e_border_cb_window_shape(void *data,
87 static Eina_Bool _e_border_cb_window_focus_in(void *data,
90 static Eina_Bool _e_border_cb_window_focus_out(void *data,
93 static Eina_Bool _e_border_cb_client_message(void *data,
97 static Eina_Bool _e_border_cb_window_state_request(void *data,
100 static Eina_Bool _e_border_cb_window_move_resize_request(void *data,
103 static Eina_Bool _e_border_cb_desktop_change(void *data,
106 static Eina_Bool _e_border_cb_sync_alarm(void *data,
109 static Eina_Bool _e_border_cb_efreet_cache_update(void *data,
112 static Eina_Bool _e_border_cb_config_icon_theme(void *data,
116 static Eina_Bool _e_border_cb_pointer_warp(void *data,
119 static void _e_border_cb_signal_bind(void *data,
121 const char *emission,
123 static Eina_Bool _e_border_cb_mouse_in(void *data,
126 static Eina_Bool _e_border_cb_mouse_out(void *data,
129 static Eina_Bool _e_border_cb_mouse_wheel(void *data,
132 static Eina_Bool _e_border_cb_mouse_down(void *data,
135 static Eina_Bool _e_border_cb_mouse_up(void *data,
138 static Eina_Bool _e_border_cb_mouse_move(void *data,
141 static Eina_Bool _e_border_cb_grab_replay(void *data,
144 static void _e_border_cb_drag_finished(E_Drag *drag,
146 #ifdef _F_USE_DESK_WINDOW_PROFILE_
147 static Eina_Bool _e_border_cb_desk_window_profile_change(void *data,
151 #ifdef _F_ZONE_WINDOW_ROTATION_
152 static Eina_Bool _e_border_cb_zone_rotation_change_begin(void *data,
155 static void _e_border_cb_rotation_sync_job(void *data);
156 static void _e_border_cb_rotation_async_job(void *data);
157 static Eina_Bool _e_border_rotation_change_prepare_timeout(void *data);
158 static void _e_border_rotation_change_request(E_Zone *zone);
159 static void _e_border_rotation_list_flush(Eina_List *list, Eina_Bool flush);
160 static Eina_Bool _e_border_rotation_change_done_timeout(void *data);
161 static void _e_border_rotation_change_done(void);
162 static Eina_Bool _e_border_rotation_geom_get(E_Border *bd,
170 static void _e_border_rotation_list_remove(E_Border *bd);
171 static Eina_Bool _e_border_rotation_pre_resize(E_Border *bd, int rotation, int *x, int *y, int *w, int *h);
172 static int _e_border_rotation_angle_get(E_Border *bd);
173 static Eina_Bool _e_border_rotation_zone_set(E_Zone *zone);
174 static Eina_Bool _e_border_rotatable_check(E_Border *bd, int ang);
175 static Eina_Bool _e_border_is_vkbd(E_Border *bd);
176 static Eina_Bool _e_border_cb_window_configure(void *data,
179 static Eina_Bool _e_border_vkbd_show_prepare_timeout(void *data);
180 static Eina_Bool _e_border_vkbd_hide_prepare_timeout(void *data);
181 static void _e_border_vkbd_show(E_Border *bd);
182 static void _e_border_vkbd_hide(E_Border *bd);
183 static Eina_Bool _e_border_rotation_set_internal(E_Border *bd, int rotation, Eina_Bool *pending);
185 static void _e_border_move_resize_internal(E_Border *bd,
190 Eina_Bool without_border,
193 static void _e_border_eval(E_Border *bd);
194 static void _e_border_eval0(E_Border *bd);
195 static void _e_border_container_layout_hook(E_Container *con);
197 static void _e_border_moveinfo_gather(E_Border *bd,
199 static void _e_border_resize_handle(E_Border *bd);
201 static Eina_Bool _e_border_shade_animator(void *data);
203 static void _e_border_event_border_add_free(void *data,
205 static void _e_border_event_border_remove_free(void *data,
207 static void _e_border_event_border_zone_set_free(void *data,
209 static void _e_border_event_border_desk_set_free(void *data,
211 static void _e_border_event_border_stack_free(void *data,
213 static void _e_border_event_border_icon_change_free(void *data,
215 static void _e_border_event_border_urgent_change_free(void *data,
217 static void _e_border_event_border_focus_in_free(void *data,
219 static void _e_border_event_border_focus_out_free(void *data,
221 static void _e_border_event_border_resize_free(void *data,
223 static void _e_border_event_border_move_free(void *data,
225 static void _e_border_event_border_show_free(void *data,
227 static void _e_border_event_border_hide_free(void *data,
229 static void _e_border_event_border_iconify_free(void *data,
231 static void _e_border_event_border_uniconify_free(void *data,
233 static void _e_border_event_border_stick_free(void *data,
235 static void _e_border_event_border_unstick_free(void *data,
237 static void _e_border_event_border_property_free(void *data,
239 static void _e_border_event_border_fullscreen_free(void *data,
241 static void _e_border_event_border_unfullscreen_free(void *data,
243 #ifdef _F_ZONE_WINDOW_ROTATION_
244 static void _e_border_event_border_rotation_change_begin_free(void *data,
246 static void _e_border_event_border_rotation_change_cancel_free(void *data,
248 static void _e_border_event_border_rotation_change_end_free(void *data,
250 static void _e_border_event_border_rotation_change_begin_send(E_Border *bd);
253 static void _e_border_zone_update(E_Border *bd);
255 static int _e_border_resize_begin(E_Border *bd);
256 static int _e_border_resize_end(E_Border *bd);
257 static void _e_border_resize_update(E_Border *bd);
259 static int _e_border_move_begin(E_Border *bd);
260 static int _e_border_move_end(E_Border *bd);
261 static void _e_border_move_update(E_Border *bd);
263 static Eina_Bool _e_border_cb_ping_poller(void *data);
264 static Eina_Bool _e_border_cb_kill_timer(void *data);
266 static void _e_border_pointer_resize_begin(E_Border *bd);
267 static void _e_border_pointer_resize_end(E_Border *bd);
268 static void _e_border_pointer_move_begin(E_Border *bd);
269 static void _e_border_pointer_move_end(E_Border *bd);
271 static void _e_border_hook_call(E_Border_Hook_Point hookpoint,
274 static void _e_border_client_move_resize_send(E_Border *bd);
276 static void _e_border_frame_replace(E_Border *bd,
279 static void _e_border_shape_input_rectangle_set(E_Border* bd);
280 static void _e_border_show(E_Border *bd);
281 static void _e_border_hide(E_Border *bd);
284 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
285 static void _e_border_latest_stacked_focus (E_Border* bd);
286 static void _e_border_check_stack (E_Border *bd);
287 static void _e_border_focus_top_stack_set (E_Border* bd);
289 #if _F_BORDER_CLIP_TO_ZONE_
290 static void _e_border_shape_input_clip_to_zone(E_Border *bd);
291 #endif /* _F_BORDER_CLIP_TO_ZONE_ */
292 /* local subsystem globals */
293 static Eina_List *handlers = NULL;
294 static Eina_List *borders = NULL;
295 static Eina_Hash *borders_hash = NULL;
296 static E_Border *focused = NULL;
297 static E_Border *focusing = NULL;
298 static Eina_List *focus_next = NULL;
299 static Ecore_X_Time focus_time = 0;
301 static E_Border *bdresize = NULL;
302 static E_Border *bdmove = NULL;
303 static E_Drag *drag_border = NULL;
305 static int grabbed = 0;
307 static Eina_List *focus_stack = NULL;
308 static Eina_List *raise_stack = NULL;
310 static Ecore_X_Randr_Screen_Size screen_size = { -1, -1 };
311 static int screen_size_index = -1;
313 static int focus_track_frozen = 0;
315 static int warp_to = 0;
316 static int warp_to_x = 0;
317 static int warp_to_y = 0;
318 static int warp_x = 0;
319 static int warp_y = 0;
320 static Ecore_X_Window warp_to_win;
321 static Ecore_Timer *warp_timer = NULL;
323 #ifdef _F_ZONE_WINDOW_ROTATION_
324 typedef struct _E_Border_Rotation E_Border_Rotation;
325 typedef struct _E_Border_Rotation_Info E_Border_Rotation_Info;
327 struct _E_Border_Rotation
330 Eina_List *async_list;
332 Eina_Bool wait_prepare_done;
333 Ecore_Timer *prepare_timer;
334 Ecore_Timer *done_timer;
336 Ecore_Job *async_job;
338 Ecore_X_Window vkbd_ctrl_win;
340 E_Border *vkbd_prediction;
342 /* vkbd show/hide preprare */
343 Eina_Bool vkbd_show_prepare_done;
344 Ecore_Timer *vkbd_show_prepare_timer;
345 Ecore_Timer *vkbd_show_timer;
347 Eina_Bool vkbd_hide_prepare_done;
348 Ecore_Timer *vkbd_hide_prepare_timer;
349 Ecore_Timer *vkbd_hide_timer;
355 struct _E_Border_Rotation_Info
360 Eina_Bool win_resize;
363 static E_Border_Rotation rot =
386 EAPI int E_EVENT_BORDER_ADD = 0;
387 EAPI int E_EVENT_BORDER_REMOVE = 0;
388 EAPI int E_EVENT_BORDER_ZONE_SET = 0;
389 EAPI int E_EVENT_BORDER_DESK_SET = 0;
390 EAPI int E_EVENT_BORDER_RESIZE = 0;
391 EAPI int E_EVENT_BORDER_MOVE = 0;
392 EAPI int E_EVENT_BORDER_SHOW = 0;
393 EAPI int E_EVENT_BORDER_HIDE = 0;
394 EAPI int E_EVENT_BORDER_ICONIFY = 0;
395 EAPI int E_EVENT_BORDER_UNICONIFY = 0;
396 EAPI int E_EVENT_BORDER_STICK = 0;
397 EAPI int E_EVENT_BORDER_UNSTICK = 0;
398 EAPI int E_EVENT_BORDER_STACK = 0;
399 EAPI int E_EVENT_BORDER_ICON_CHANGE = 0;
400 EAPI int E_EVENT_BORDER_URGENT_CHANGE = 0;
401 EAPI int E_EVENT_BORDER_FOCUS_IN = 0;
402 EAPI int E_EVENT_BORDER_FOCUS_OUT = 0;
403 EAPI int E_EVENT_BORDER_PROPERTY = 0;
404 EAPI int E_EVENT_BORDER_FULLSCREEN = 0;
405 EAPI int E_EVENT_BORDER_UNFULLSCREEN = 0;
406 #ifdef _F_ZONE_WINDOW_ROTATION_
407 EAPI int E_EVENT_BORDER_ROTATION = 0; /* deprecated */
408 EAPI int E_EVENT_BORDER_ROTATION_CHANGE_BEGIN = 0;
409 EAPI int E_EVENT_BORDER_ROTATION_CHANGE_CANCEL = 0;
410 EAPI int E_EVENT_BORDER_ROTATION_CHANGE_END = 0;
413 #define GRAV_SET(bd, grav) \
414 ecore_x_window_gravity_set(bd->bg_win, grav); \
415 ecore_x_window_gravity_set(bd->client.shell_win, grav); \
416 ecore_x_window_gravity_set(bd->client.win, grav);
419 _e_border_sub_borders_new(E_Border *bd)
421 Eina_List *list = NULL, *l;
425 EINA_LIST_FOREACH(bd->transients, l, child)
427 if (!eina_list_data_find(list, child))
428 list = eina_list_append(list, child);
430 bl = e_container_border_list_first(bd->zone->container);
431 while ((child = e_container_border_list_next(bl)))
433 if (e_object_is_del(E_OBJECT(child))) continue;
434 if (child == bd) continue;
436 if ((bd->client.icccm.client_leader) &&
437 (child->client.icccm.client_leader ==
438 bd->client.icccm.client_leader))
440 printf("bd %s in group with %s\n",
441 e_border_name_get(child),
442 e_border_name_get(bd));
443 if (!eina_list_data_find(list, child))
444 list = eina_list_append(list, child);
448 e_container_border_list_free(bl);
452 /* externally accessible functions */
456 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, _e_border_cb_window_show_request, NULL));
457 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _e_border_cb_window_destroy, NULL));
458 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, _e_border_cb_window_hide, NULL));
459 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_REPARENT, _e_border_cb_window_reparent, NULL));
460 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, _e_border_cb_window_configure_request, NULL));
461 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, _e_border_cb_window_resize_request, NULL));
462 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_GRAVITY, _e_border_cb_window_gravity, NULL));
463 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, _e_border_cb_window_stack_request, NULL));
464 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _e_border_cb_window_property, NULL));
465 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_COLORMAP, _e_border_cb_window_colormap, NULL));
466 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHAPE, _e_border_cb_window_shape, NULL));
467 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, _e_border_cb_window_focus_in, NULL));
468 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, _e_border_cb_window_focus_out, NULL));
469 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _e_border_cb_client_message, NULL));
470 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, _e_border_cb_window_state_request, NULL));
471 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, _e_border_cb_window_move_resize_request, NULL));
472 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_DESKTOP_CHANGE, _e_border_cb_desktop_change, NULL));
473 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_SYNC_ALARM, _e_border_cb_sync_alarm, NULL));
474 #ifdef _F_ZONE_WINDOW_ROTATION_
475 handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, _e_border_cb_window_configure, NULL));
478 ecore_x_passive_grab_replay_func_set(_e_border_cb_grab_replay, NULL);
480 handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_POINTER_WARP, _e_border_cb_pointer_warp, NULL));
481 handlers = eina_list_append(handlers, ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, _e_border_cb_efreet_cache_update, NULL));
482 handlers = eina_list_append(handlers, ecore_event_handler_add(EFREET_EVENT_ICON_CACHE_UPDATE, _e_border_cb_efreet_cache_update, NULL));
483 handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_CONFIG_ICON_THEME, _e_border_cb_config_icon_theme, NULL));
484 #ifdef _F_USE_DESK_WINDOW_PROFILE_
485 handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_DESK_WINDOW_PROFILE_CHANGE, _e_border_cb_desk_window_profile_change, NULL));
487 #ifdef _F_ZONE_WINDOW_ROTATION_
488 handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_ZONE_ROTATION_CHANGE_BEGIN, _e_border_cb_zone_rotation_change_begin, NULL));
491 if (!borders_hash) borders_hash = eina_hash_string_superfast_new(NULL);
493 E_EVENT_BORDER_ADD = ecore_event_type_new();
494 E_EVENT_BORDER_REMOVE = ecore_event_type_new();
495 E_EVENT_BORDER_DESK_SET = ecore_event_type_new();
496 E_EVENT_BORDER_ZONE_SET = ecore_event_type_new();
497 E_EVENT_BORDER_RESIZE = ecore_event_type_new();
498 E_EVENT_BORDER_MOVE = ecore_event_type_new();
499 E_EVENT_BORDER_SHOW = ecore_event_type_new();
500 E_EVENT_BORDER_HIDE = ecore_event_type_new();
501 E_EVENT_BORDER_ICONIFY = ecore_event_type_new();
502 E_EVENT_BORDER_UNICONIFY = ecore_event_type_new();
503 E_EVENT_BORDER_STICK = ecore_event_type_new();
504 E_EVENT_BORDER_UNSTICK = ecore_event_type_new();
505 E_EVENT_BORDER_STACK = ecore_event_type_new();
506 E_EVENT_BORDER_ICON_CHANGE = ecore_event_type_new();
507 E_EVENT_BORDER_URGENT_CHANGE = ecore_event_type_new();
508 E_EVENT_BORDER_FOCUS_IN = ecore_event_type_new();
509 E_EVENT_BORDER_FOCUS_OUT = ecore_event_type_new();
510 E_EVENT_BORDER_PROPERTY = ecore_event_type_new();
511 E_EVENT_BORDER_FULLSCREEN = ecore_event_type_new();
512 E_EVENT_BORDER_UNFULLSCREEN = ecore_event_type_new();
513 #ifdef _F_ZONE_WINDOW_ROTATION_
514 E_EVENT_BORDER_ROTATION = ecore_event_type_new(); /* deprecated */
515 E_EVENT_BORDER_ROTATION_CHANGE_BEGIN = ecore_event_type_new();
516 E_EVENT_BORDER_ROTATION_CHANGE_CANCEL = ecore_event_type_new();
517 E_EVENT_BORDER_ROTATION_CHANGE_END = ecore_event_type_new();
526 e_border_shutdown(void)
528 E_FREE_LIST(handlers, ecore_event_handler_del);
530 if (borders_hash) eina_hash_free(borders_hash);
532 e_int_border_menu_hooks_clear();
538 e_border_new(E_Container *con,
544 Ecore_X_Window_Attributes *att;
545 unsigned int managed, desk[2];
548 bd = E_OBJECT_ALLOC(E_Border, E_BORDER_TYPE, _e_border_free);
549 if (!bd) return NULL;
550 ecore_x_window_shadow_tree_flush();
551 e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del));
555 /* FIXME: ewww - round trip */
556 bd->client.argb = ecore_x_window_argb_get(win);
558 bd->win = ecore_x_window_manager_argb_new(con->win, 0, 0, bd->w, bd->h);
561 bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h);
562 ecore_x_window_shape_events_select(bd->win, 1);
564 e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
565 e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
567 bd->bg_ecore_evas = e_canvas_new(bd->win,
568 0, 0, bd->w, bd->h, 1, 0,
570 ecore_evas_ignore_events_set(bd->bg_ecore_evas, EINA_TRUE);
571 e_canvas_add(bd->bg_ecore_evas);
572 bd->event_win = ecore_x_window_input_new(bd->win, 0, 0, bd->w, bd->h);
573 bd->bg_evas = ecore_evas_get(bd->bg_ecore_evas);
574 ecore_x_window_shape_events_select(bd->bg_win, 1);
575 ecore_evas_name_class_set(bd->bg_ecore_evas, "E", "Frame_Window");
576 ecore_evas_title_set(bd->bg_ecore_evas, "Enlightenment Frame");
578 bd->client.shell_win = ecore_x_window_manager_argb_new(bd->win, 0, 0, 1, 1);
580 bd->client.shell_win = ecore_x_window_override_new(bd->win, 0, 0, 1, 1);
581 ecore_x_window_container_manage(bd->client.shell_win);
582 if (!internal) ecore_x_window_client_manage(win);
583 /* FIXME: Round trip. XCB */
584 /* fetch needed to avoid grabbing the server as window may vanish */
585 att = &bd->client.initial_attributes;
586 if ((!ecore_x_window_attributes_get(win, att)) || (att->input_only))
588 // printf("##- ATTR FETCH FAILED/INPUT ONLY FOR 0x%x - ABORT MANAGE\n", win);
589 e_canvas_del(bd->bg_ecore_evas);
590 ecore_evas_free(bd->bg_ecore_evas);
591 ecore_x_window_free(bd->client.shell_win);
592 e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
593 e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
594 ecore_x_window_free(bd->win);
599 /* printf("##- ON MAP CLIENT 0x%x SIZE %ix%i %i:%i\n",
600 * bd->client.win, bd->client.w, bd->client.h, att->x, att->y); */
602 /* FIXME: if first_map is 1 then we should ignore the first hide event
603 * or ensure the window is already hidden and events flushed before we
604 * create a border for it */
607 // printf("##- FIRST MAP\n");
612 // needed to be 1 for internal windw and on restart.
613 // bd->ignore_first_unmap = 2;
616 bd->client.win = win;
617 bd->zone = e_zone_current_get(con);
619 _e_border_hook_call(E_BORDER_HOOK_NEW_BORDER, bd);
621 bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, _e_border_cb_mouse_in, bd));
622 bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, _e_border_cb_mouse_out, bd));
623 bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_border_cb_mouse_down, bd));
624 bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _e_border_cb_mouse_up, bd));
625 bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _e_border_cb_mouse_move, bd));
626 bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _e_border_cb_mouse_wheel, bd));
628 bd->client.icccm.title = NULL;
629 bd->client.icccm.name = NULL;
630 bd->client.icccm.class = NULL;
631 bd->client.icccm.icon_name = NULL;
632 bd->client.icccm.machine = NULL;
633 bd->client.icccm.min_w = 1;
634 bd->client.icccm.min_h = 1;
635 bd->client.icccm.max_w = 32767;
636 bd->client.icccm.max_h = 32767;
637 bd->client.icccm.base_w = 0;
638 bd->client.icccm.base_h = 0;
639 bd->client.icccm.step_w = -1;
640 bd->client.icccm.step_h = -1;
641 bd->client.icccm.min_aspect = 0.0;
642 bd->client.icccm.max_aspect = 0.0;
643 bd->client.icccm.accepts_focus = 1;
645 bd->client.netwm.pid = 0;
646 bd->client.netwm.name = NULL;
647 bd->client.netwm.icon_name = NULL;
648 bd->client.netwm.desktop = 0;
649 bd->client.netwm.state.modal = 0;
650 bd->client.netwm.state.sticky = 0;
651 bd->client.netwm.state.shaded = 0;
652 bd->client.netwm.state.hidden = 0;
653 bd->client.netwm.state.maximized_v = 0;
654 bd->client.netwm.state.maximized_h = 0;
655 bd->client.netwm.state.skip_taskbar = 0;
656 bd->client.netwm.state.skip_pager = 0;
657 bd->client.netwm.state.fullscreen = 0;
658 bd->client.netwm.state.stacking = E_STACKING_NONE;
659 bd->client.netwm.action.move = 0;
660 bd->client.netwm.action.resize = 0;
661 bd->client.netwm.action.minimize = 0;
662 bd->client.netwm.action.shade = 0;
663 bd->client.netwm.action.stick = 0;
664 bd->client.netwm.action.maximized_h = 0;
665 bd->client.netwm.action.maximized_v = 0;
666 bd->client.netwm.action.fullscreen = 0;
667 bd->client.netwm.action.change_desktop = 0;
668 bd->client.netwm.action.close = 0;
669 bd->client.netwm.type = ECORE_X_WINDOW_TYPE_UNKNOWN;
675 atoms = ecore_x_window_prop_list(bd->client.win, &at_num);
676 bd->client.icccm.fetch.command = 1;
679 Eina_Bool video_parent = EINA_FALSE;
680 Eina_Bool video_position = EINA_FALSE;
683 for (i = 0; i < at_num; i++)
685 if (atoms[i] == ECORE_X_ATOM_WM_NAME)
686 bd->client.icccm.fetch.title = 1;
687 else if (atoms[i] == ECORE_X_ATOM_WM_CLASS)
688 bd->client.icccm.fetch.name_class = 1;
689 else if (atoms[i] == ECORE_X_ATOM_WM_ICON_NAME)
690 bd->client.icccm.fetch.icon_name = 1;
691 else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_MACHINE)
692 bd->client.icccm.fetch.machine = 1;
693 else if (atoms[i] == ECORE_X_ATOM_WM_HINTS)
694 bd->client.icccm.fetch.hints = 1;
695 else if (atoms[i] == ECORE_X_ATOM_WM_NORMAL_HINTS)
696 bd->client.icccm.fetch.size_pos_hints = 1;
697 else if (atoms[i] == ECORE_X_ATOM_WM_PROTOCOLS)
698 bd->client.icccm.fetch.protocol = 1;
699 else if (atoms[i] == ECORE_X_ATOM_MOTIF_WM_HINTS)
700 bd->client.mwm.fetch.hints = 1;
701 else if (atoms[i] == ECORE_X_ATOM_WM_TRANSIENT_FOR)
703 bd->client.icccm.fetch.transient_for = 1;
704 bd->client.netwm.fetch.type = 1;
706 else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_LEADER)
707 bd->client.icccm.fetch.client_leader = 1;
708 else if (atoms[i] == ECORE_X_ATOM_WM_WINDOW_ROLE)
709 bd->client.icccm.fetch.window_role = 1;
710 else if (atoms[i] == ECORE_X_ATOM_WM_STATE)
711 bd->client.icccm.fetch.state = 1;
713 /* netwm, loop again, netwm will ignore some icccm, so we
714 * have to be sure that netwm is checked after */
715 for (i = 0; i < at_num; i++)
717 if (atoms[i] == ECORE_X_ATOM_NET_WM_NAME)
720 bd->client.icccm.fetch.title = 0;
721 bd->client.netwm.fetch.name = 1;
723 else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON_NAME)
726 bd->client.icccm.fetch.icon_name = 0;
727 bd->client.netwm.fetch.icon_name = 1;
729 else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON)
731 bd->client.netwm.fetch.icon = 1;
733 else if (atoms[i] == ECORE_X_ATOM_NET_WM_USER_TIME)
735 bd->client.netwm.fetch.user_time = 1;
737 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT)
739 DBG("ECORE_X_ATOM_NET_WM_STRUT");
740 bd->client.netwm.fetch.strut = 1;
742 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL)
744 DBG("ECORE_X_ATOM_NET_WM_STRUT_PARTIAL");
745 bd->client.netwm.fetch.strut = 1;
747 else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_TYPE)
750 bd->client.mwm.fetch.hints = 0;
752 bd->client.netwm.fetch.type = 1;
754 else if (atoms[i] == ECORE_X_ATOM_NET_WM_STATE)
756 bd->client.netwm.fetch.state = 1;
759 /* other misc atoms */
760 for (i = 0; i < at_num; i++)
762 /* loop to check for own atoms */
763 if (atoms[i] == E_ATOM_WINDOW_STATE)
765 bd->client.e.fetch.state = 1;
767 /* loop to check for qtopia atoms */
768 if (atoms[i] == ATM__QTOPIA_SOFT_MENU)
769 bd->client.qtopia.fetch.soft_menu = 1;
770 else if (atoms[i] == ATM__QTOPIA_SOFT_MENUS)
771 bd->client.qtopia.fetch.soft_menus = 1;
772 /* loop to check for vkbd atoms */
773 else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
774 bd->client.vkbd.fetch.state = 1;
775 else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD)
776 bd->client.vkbd.fetch.vkbd = 1;
777 /* loop to check for illume atoms */
778 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_CONFORMANT)
779 bd->client.illume.conformant.fetch.conformant = 1;
780 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE)
781 bd->client.illume.quickpanel.fetch.state = 1;
782 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL)
783 bd->client.illume.quickpanel.fetch.quickpanel = 1;
784 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR)
785 bd->client.illume.quickpanel.fetch.priority.major = 1;
786 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR)
787 bd->client.illume.quickpanel.fetch.priority.minor = 1;
788 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE)
789 bd->client.illume.quickpanel.fetch.zone = 1;
790 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED)
791 bd->client.illume.drag.fetch.locked = 1;
792 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG)
793 bd->client.illume.drag.fetch.drag = 1;
794 else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
795 bd->client.illume.win_state.fetch.state = 1;
796 else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_PARENT)
797 video_parent = EINA_TRUE;
798 else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_POSITION)
799 video_position = EINA_TRUE;
800 #ifdef _F_USE_DESK_WINDOW_PROFILE_
801 /* loop to check for window profile list atom */
802 else if (atoms[i] == ECORE_X_ATOM_E_PROFILE_LIST)
803 bd->client.e.fetch.profile_list = 1;
805 #ifdef _F_ZONE_WINDOW_ROTATION_
806 /* loop to check for wm rotation */
807 else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED)
809 if (e_config->wm_win_rotation)
810 bd->client.e.fetch.rot.support = 1;
812 else if ((atoms[i] == ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY) ||
813 (atoms[i] == ECORE_X_ATOM_E_WINDOW_ROTATION_90_GEOMETRY) ||
814 (atoms[i] == ECORE_X_ATOM_E_WINDOW_ROTATION_180_GEOMETRY) ||
815 (atoms[i] == ECORE_X_ATOM_E_WINDOW_ROTATION_270_GEOMETRY))
817 if (e_config->wm_win_rotation)
818 bd->client.e.fetch.rot.geom_hint = 1;
820 else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED)
822 if (e_config->wm_win_rotation)
823 bd->client.e.fetch.rot.app_set = 1;
825 else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION)
827 if (e_config->wm_win_rotation)
828 bd->client.e.fetch.rot.preferred_rot = 1;
830 else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST)
832 if (e_config->wm_win_rotation)
833 bd->client.e.fetch.rot.available_rots = 1;
836 #ifdef _F_DEICONIFY_APPROVE_
837 else if (atoms[i] == ECORE_X_ATOM_E_DEICONIFY_APPROVE)
839 bd->client.e.state.deiconify_approve.support = 1;
843 if (video_position && video_parent)
845 bd->client.e.state.video = 1;
846 bd->client.e.fetch.video_parent = 1;
847 bd->client.e.fetch.video_position = 1;
848 ecore_x_window_lower(bd->win);
849 ecore_x_composite_window_events_disable(bd->win);
850 ecore_x_window_ignore_set(bd->win, EINA_TRUE);
851 fprintf(stderr, "We found a video window \\o/ %x\n", win);
856 bd->client.border.changed = 1;
858 bd->client.w = att->w;
859 bd->client.h = att->h;
861 bd->w = bd->client.w;
862 bd->h = bd->client.h;
864 bd->resize_mode = RESIZE_NONE;
866 bd->saved.layer = bd->layer;
867 bd->changes.icon = 1;
868 bd->changes.size = 1;
869 bd->changes.shape = 1;
870 bd->changes.shape_input = 1;
872 bd->offer_resistance = 1;
874 /* just to friggin make java happy - we're DELAYING the reparent until
877 /* ecore_x_window_reparent(win, bd->client.shell_win, 0, 0); */
878 bd->need_reparent = 1;
880 ecore_x_window_border_width_set(win, 0);
881 ecore_x_window_show(bd->event_win);
882 ecore_x_window_show(bd->client.shell_win);
883 bd->shape = e_container_shape_add(con);
888 #ifdef _F_ZONE_WINDOW_ROTATION_
889 bd->client.e.state.rot.preferred_rot = -1;
890 bd->client.e.state.rot.type = E_BORDER_ROTATION_TYPE_NORMAL;
891 bd->client.e.state.rot.changes = -1;
892 bd->client.e.state.rot.pending_show = 0;
893 bd->client.e.state.rot.curr = 0;
894 bd->client.e.state.rot.prev = 0;
897 // bd->zone = e_zone_current_get(con);
898 bd->desk = e_desk_current_get(bd->zone);
899 e_container_border_add(bd);
900 borders = eina_list_append(borders, bd);
901 bd2 = eina_hash_find(borders_hash, e_util_winid_str_get(bd->client.win));
905 WRN("EEEEK! 2 borders with same client window id in them! very bad!\n"
906 "optimisations failing due to bizarre client behavior. will\n"
908 "bd=%p, bd->references=%i, bd->deleted=%i, bd->client.win=%x",
909 bd2, bd2->e_obj_inherit.references, bd2->e_obj_inherit.deleted,
912 ELBF(ELBT_BD, 0, bd->client.win,
913 "ERR! 2 borders with same client win id in them! bd:%p ref:%i deleted:%i",
914 bd2, bd2->e_obj_inherit.references, bd2->e_obj_inherit.deleted);
916 printf("EEEEK! 2 borders with same client window id in them! very bad!\n");
917 printf("optimisations failing due to bizarre client behavior. will\n");
918 printf("work around.\n");
919 printf("bd=%p, bd->references=%i, bd->deleted=%i, bd->client.win=%x\n",
920 bd2, bd2->e_obj_inherit.references, bd2->e_obj_inherit.deleted,
923 ELBF(ELBT_BD, 0, bd->client.win,
924 "ERR! 2 borders with same client win id in them! bd:%p ref:%i deleted:%i",
925 bd2, bd2->e_obj_inherit.references, bd2->e_obj_inherit.deleted);
928 #ifdef _F_ZONE_WINDOW_ROTATION_
929 if ((rot.vkbd) && (rot.vkbd == bd2))
931 ELB(ELBT_BD, "UNSET VKBD", rot.vkbd->client.win);
932 ELBF(ELBT_BD, 1, rot.vkbd->client.win, "VKBD HIDE PREPARE_DONE:%d",
933 rot.vkbd_hide_prepare_done);
935 if (rot.vkbd_hide_prepare_timer)
937 ecore_timer_del(rot.vkbd_hide_prepare_timer);
938 rot.vkbd_hide_prepare_timer = NULL;
940 e_object_unref(E_OBJECT(bd2));
943 _e_border_vkbd_hide(rot.vkbd);
945 if (rot.vkbd_ctrl_win)
947 ELB(ELBT_BD, "SET KBD_OFF", 0);
948 ecore_x_e_virtual_keyboard_state_set
949 (rot.vkbd_ctrl_win, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
951 rot.vkbd_hide_prepare_done = EINA_FALSE;
953 if (rot.vkbd_hide_timer)
954 ecore_timer_del(rot.vkbd_hide_timer);
955 rot.vkbd_hide_timer = NULL;
957 rot.vkbd_show_prepare_done = EINA_FALSE;
958 if (rot.vkbd_show_prepare_timer)
959 ecore_timer_del(rot.vkbd_show_prepare_timer);
960 rot.vkbd_show_prepare_timer = NULL;
961 if (rot.vkbd_show_timer)
962 ecore_timer_del(rot.vkbd_show_timer);
963 rot.vkbd_show_timer = NULL;
968 eina_hash_del(borders_hash, e_util_winid_str_get(bd->client.win), bd2);
969 eina_hash_del(borders_hash, e_util_winid_str_get(bd2->bg_win), bd2);
970 eina_hash_del(borders_hash, e_util_winid_str_get(bd2->win), bd2);
972 eina_hash_add(borders_hash, e_util_winid_str_get(bd->client.win), bd);
973 eina_hash_add(borders_hash, e_util_winid_str_get(bd->bg_win), bd);
974 eina_hash_add(borders_hash, e_util_winid_str_get(bd->win), bd);
976 ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &managed, 1);
977 ecore_x_window_prop_card32_set(win, E_ATOM_CONTAINER, &bd->zone->container->num, 1);
978 ecore_x_window_prop_card32_set(win, E_ATOM_ZONE, &bd->zone->num, 1);
980 unsigned int zgeom[4];
982 zgeom[0] = bd->zone->x;
983 zgeom[1] = bd->zone->y;
984 zgeom[2] = bd->zone->w;
985 zgeom[3] = bd->zone->h;
986 ecore_x_window_prop_card32_set(win, E_ATOM_ZONE_GEOMETRY, zgeom, 4);
988 e_desk_xy_get(bd->desk, &deskx, &desky);
991 ecore_x_window_prop_card32_set(win, E_ATOM_DESK, desk, 2);
992 #ifdef _F_USE_DESK_WINDOW_PROFILE_
993 if (strcmp(bd->desk->window_profile,
994 e_config->desktop_default_window_profile) != 0)
996 ecore_x_e_window_profile_set(bd->client.win,
997 bd->desk->window_profile);
1001 focus_stack = eina_list_append(focus_stack, bd);
1003 bd->pointer = e_pointer_window_new(bd->win, 0);
1008 e_border_res_change_geometry_save(E_Border *bd)
1011 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1013 if (bd->pre_res_change.valid) return;
1014 bd->pre_res_change.valid = 1;
1015 bd->pre_res_change.x = bd->x;
1016 bd->pre_res_change.y = bd->y;
1017 bd->pre_res_change.w = bd->w;
1018 bd->pre_res_change.h = bd->h;
1019 bd->pre_res_change.saved.x = bd->saved.x;
1020 bd->pre_res_change.saved.y = bd->saved.y;
1021 bd->pre_res_change.saved.w = bd->saved.w;
1022 bd->pre_res_change.saved.h = bd->saved.h;
1026 e_border_res_change_geometry_restore(E_Border *bd)
1030 unsigned char valid : 1;
1039 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1040 if (!bd->pre_res_change.valid) return;
1041 if (bd->new_client) return;
1043 ecore_x_window_shadow_tree_flush();
1044 memcpy(&pre_res_change, &bd->pre_res_change, sizeof(pre_res_change));
1048 e_border_unfullscreen(bd);
1049 e_border_fullscreen(bd, e_config->fullscreen_policy);
1051 else if (bd->maximized != E_MAXIMIZE_NONE)
1055 max = bd->maximized;
1056 e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
1057 e_border_maximize(bd, max);
1061 int x, y, w, h, zx, zy, zw, zh;
1063 bd->saved.x = bd->pre_res_change.saved.x;
1064 bd->saved.y = bd->pre_res_change.saved.y;
1065 bd->saved.w = bd->pre_res_change.saved.w;
1066 bd->saved.h = bd->pre_res_change.saved.h;
1068 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
1070 if (bd->saved.w > zw)
1072 if ((bd->saved.x + bd->saved.w) > (zx + zw))
1073 bd->saved.x = zx + zw - bd->saved.w;
1075 if (bd->saved.h > zh)
1077 if ((bd->saved.y + bd->saved.h) > (zy + zh))
1078 bd->saved.y = zy + zh - bd->saved.h;
1080 x = bd->pre_res_change.x;
1081 y = bd->pre_res_change.y;
1082 w = bd->pre_res_change.w;
1083 h = bd->pre_res_change.h;
1088 if ((x + w) > (zx + zw))
1090 if ((y + h) > (zy + zh))
1092 e_border_move_resize(bd, x, y, w, h);
1094 memcpy(&bd->pre_res_change, &pre_res_change, sizeof(pre_res_change));
1098 e_border_zone_set(E_Border *bd,
1101 E_Event_Border_Zone_Set *ev;
1104 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1105 E_OBJECT_CHECK(zone);
1106 E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
1108 if (bd->zone == zone) return;
1110 /* if the window does not lie in the new zone, move it so that it does */
1111 if (!E_INTERSECTS(bd->x, bd->y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h))
1114 /* first guess -- get offset from old zone, and apply to new zone */
1115 x = zone->x + (bd->x - bd->zone->x);
1116 y = zone->y + (bd->y - bd->zone->y);
1118 /* keep window from hanging off bottom and left */
1119 if (x + bd->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + bd->w);
1120 if (y + bd->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + bd->h);
1122 /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */
1123 if (x < zone->x) x = zone->x;
1124 if (y < zone->y) y = zone->y;
1126 if (!E_INTERSECTS(x, y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h))
1128 /* still not in zone at all, so just move it to closest edge */
1129 if (x < zone->x) x = zone->x;
1130 if (x >= zone->x + zone->w) x = zone->x + zone->w - bd->w;
1131 if (y < zone->y) y = zone->y;
1132 if (y >= zone->y + zone->h) y = zone->y + zone->h - bd->h;
1134 e_border_move(bd, x, y);
1139 if (bd->desk->zone != bd->zone)
1140 e_border_desk_set(bd, e_desk_current_get(bd->zone));
1142 ev = E_NEW(E_Event_Border_Zone_Set, 1);
1144 e_object_ref(E_OBJECT(bd));
1145 // e_object_breadcrumb_add(E_OBJECT(bd), "border_zone_set_event");
1147 e_object_ref(E_OBJECT(zone));
1149 ecore_event_add(E_EVENT_BORDER_ZONE_SET, ev, _e_border_event_border_zone_set_free, NULL);
1151 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_ZONE, &bd->zone->num, 1);
1152 // XXXXXXXXXXXXXXXXXXXXXXXXX
1153 // XXX ZZZZZZZZZZZZZZZZZZZzz
1154 // need to adjust this if zone pos/size changes
1156 unsigned int zgeom[4];
1158 zgeom[0] = bd->zone->x;
1159 zgeom[1] = bd->zone->y;
1160 zgeom[2] = bd->zone->w;
1161 zgeom[3] = bd->zone->h;
1162 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_ZONE_GEOMETRY, zgeom, 4);
1164 e_remember_update(bd);
1168 e_border_desk_set(E_Border *bd,
1171 E_Event_Border_Desk_Set *ev;
1175 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1176 E_OBJECT_CHECK(desk);
1177 E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
1178 if (bd->desk == desk) return;
1179 ecore_x_window_shadow_tree_flush();
1182 bd->desk->fullscreen_borders--;
1183 desk->fullscreen_borders++;
1185 old_desk = bd->desk;
1187 e_border_zone_set(bd, desk->zone);
1189 _e_border_hook_call(E_BORDER_HOOK_SET_DESK, bd);
1190 e_hints_window_desktop_set(bd);
1192 ev = E_NEW(E_Event_Border_Desk_Set, 1);
1194 e_object_ref(E_OBJECT(bd));
1195 // e_object_breadcrumb_add(E_OBJECT(bd), "border_desk_set_event");
1196 ev->desk = old_desk;
1197 e_object_ref(E_OBJECT(old_desk));
1198 ecore_event_add(E_EVENT_BORDER_DESK_SET, ev, _e_border_event_border_desk_set_free, NULL);
1200 if (bd->ignore_first_unmap != 1)
1202 if ((bd->desk->visible) || (bd->sticky))
1205 e_border_hide(bd, 1);
1208 if (e_config->transient.desktop)
1212 Eina_List *list = _e_border_sub_borders_new(bd);
1214 EINA_LIST_FOREACH(list, l, child)
1216 e_border_desk_set(child, bd->desk);
1218 eina_list_free(list);
1220 e_remember_update(bd);
1223 #ifdef _F_ZONE_WINDOW_ROTATION_
1225 _e_border_vkbd_state_check(E_Border *bd,
1228 Eina_Bool res = EINA_TRUE;
1229 if (!e_config->wm_win_rotation) return EINA_FALSE;
1230 if ((rot.vkbd) && (rot.vkbd == bd))
1234 if ((rot.vkbd_hide_prepare_done) ||
1235 (rot.vkbd_hide_prepare_timer))
1240 if ((rot.vkbd_show_prepare_done) ||
1241 (rot.vkbd_show_prepare_timer))
1249 _e_border_vkbd_show_timeout(void *data)
1251 E_Border *bd = data;
1252 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_CANCEL;
1253 if ((bd) && ((E_OBJECT(bd)->type) == (E_BORDER_TYPE)))
1255 if (_e_border_vkbd_state_check(bd, EINA_TRUE))
1257 if (rot.vkbd_ctrl_win)
1259 ELB(ELBT_BD, "SET KBD_ON", 0);
1260 ecore_x_e_virtual_keyboard_state_set
1261 (rot.vkbd_ctrl_win, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON);
1266 rot.vkbd_show_prepare_done = EINA_FALSE;
1268 if (rot.vkbd_show_prepare_timer)
1269 ecore_timer_del(rot.vkbd_show_prepare_timer);
1270 rot.vkbd_show_prepare_timer = NULL;
1272 if (rot.vkbd_show_timer)
1273 ecore_timer_del(rot.vkbd_show_timer);
1274 rot.vkbd_show_timer = NULL;
1276 return ECORE_CALLBACK_CANCEL;
1280 _e_border_vkbd_hide_timeout(void *data)
1282 E_Border *bd = data;
1283 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_CANCEL;
1284 if ((bd) && ((E_OBJECT(bd)->type) == (E_BORDER_TYPE)))
1286 if (_e_border_vkbd_state_check(bd, EINA_FALSE))
1288 if (rot.vkbd_ctrl_win)
1290 ELB(ELBT_BD, "SET KBD_OFF", 0);
1291 ecore_x_e_virtual_keyboard_state_set
1292 (rot.vkbd_ctrl_win, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
1295 e_object_unref(E_OBJECT(bd));
1298 rot.vkbd_hide_prepare_done = EINA_FALSE;
1300 if (rot.vkbd_hide_prepare_timer)
1301 ecore_timer_del(rot.vkbd_hide_prepare_timer);
1302 rot.vkbd_hide_prepare_timer = NULL;
1304 if (rot.vkbd_hide_timer)
1305 ecore_timer_del(rot.vkbd_hide_timer);
1306 rot.vkbd_hide_timer = NULL;
1308 return ECORE_CALLBACK_CANCEL;
1312 _e_border_vkbd_show(E_Border *bd)
1314 if (!e_config->wm_win_rotation) return;
1315 rot.vkbd_show_prepare_done = EINA_TRUE;
1316 if (rot.vkbd_show_prepare_timer)
1317 ecore_timer_del(rot.vkbd_show_prepare_timer);
1318 rot.vkbd_show_prepare_timer = NULL;
1319 if (rot.vkbd_show_timer)
1320 ecore_timer_del(rot.vkbd_show_timer);
1321 rot.vkbd_show_timer = NULL;
1322 if ((bd) && (!e_object_is_del(E_OBJECT(bd))))
1325 rot.vkbd_show_timer = ecore_timer_add(0.1f, _e_border_vkbd_show_timeout, bd);
1330 _e_border_vkbd_hide(E_Border *bd)
1332 if (!e_config->wm_win_rotation) return;
1333 rot.vkbd_hide_prepare_done = EINA_TRUE;
1334 if (rot.vkbd_hide_prepare_timer)
1335 ecore_timer_del(rot.vkbd_hide_prepare_timer);
1336 rot.vkbd_hide_prepare_timer = NULL;
1337 if (rot.vkbd_hide_timer)
1338 ecore_timer_del(rot.vkbd_hide_timer);
1339 rot.vkbd_hide_timer = NULL;
1340 if ((bd) && ((E_OBJECT(bd)->type) == (E_BORDER_TYPE)))
1342 ELB(ELBT_BD, "HIDE VKBD", bd->client.win);
1343 e_border_hide(bd, 0);
1344 if (!e_object_is_del(E_OBJECT(bd)))
1346 ELB(ELBT_BD, "DEL VKBD", bd->client.win);
1347 e_object_del(E_OBJECT(bd));
1349 rot.vkbd_hide_timer = ecore_timer_add(0.03f, _e_border_vkbd_hide_timeout, bd);
1354 _e_border_vkbd_show_prepare_timeout(void *data)
1356 E_Border *bd = data;
1357 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_CANCEL;
1358 if ((bd) && (!e_object_is_del(E_OBJECT(bd))))
1360 ELB(ELBT_BD, "TIMEOUT KBD_SHOW_PREPARE", bd->client.win);
1361 _e_border_vkbd_show(bd);
1363 return ECORE_CALLBACK_CANCEL;
1367 _e_border_vkbd_hide_prepare_timeout(void *data)
1369 E_Border *bd = data;
1370 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_CANCEL;
1371 if ((bd) && ((E_OBJECT(bd)->type) == (E_BORDER_TYPE)))
1373 ELB(ELBT_BD, "TIMEOUT KBD_HIDE_PREPARE", bd->client.win);
1374 _e_border_vkbd_hide(bd);
1376 return ECORE_CALLBACK_CANCEL;
1381 e_border_show(E_Border *bd)
1383 E_Event_Border_Show *ev;
1384 unsigned int visible;
1387 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1388 if (bd->visible) return;
1389 #ifdef _F_ZONE_WINDOW_ROTATION_
1390 // newly created window that has to be rotated will be show after rotation done.
1391 // so, skip at this time. it will be called again after GETTING ROT_DONE.
1392 if ((bd->new_client) &&
1393 (bd->client.e.state.rot.changes != -1))
1395 ELB(ELBT_BD, "PENDING SHOW UNTIL GETTING ROT_DONE", bd->client.win);
1396 // if this window is in withdrawn state, set the normal state
1397 // that's because the window in withdrawn state can't render its canvas.
1398 // eventually, this window will not send the message of rotation done,
1399 // even if e17 request to rotation this window.
1400 if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL)
1401 e_hints_window_visible_set(bd);
1403 bd->client.e.state.rot.pending_show = 1;
1406 if ((e_config->wm_win_rotation) &&
1407 (rot.vkbd_ctrl_win) && (rot.vkbd) &&
1409 (!rot.vkbd_show_prepare_done))
1411 ELB(ELBT_BD, "SEND KBD_ON_PREPARE", bd->client.win);
1412 ecore_x_e_virtual_keyboard_on_prepare_request_send(rot.vkbd_ctrl_win);
1413 if (rot.vkbd_show_prepare_timer)
1414 ecore_timer_del(rot.vkbd_show_prepare_timer);
1415 rot.vkbd_show_prepare_timer = ecore_timer_add(1.5f,
1416 _e_border_vkbd_show_prepare_timeout,
1420 ELB(ELBT_BD, "SHOW", bd->client.win);
1422 ecore_x_window_shadow_tree_flush();
1423 e_container_shape_show(bd->shape);
1424 if (!bd->need_reparent)
1425 ecore_x_window_show(bd->client.win);
1426 e_hints_window_visible_set(bd);
1429 bd->changes.visible = 1;
1432 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1);
1433 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1);
1435 ev = E_NEW(E_Event_Border_Show, 1);
1437 e_object_ref(E_OBJECT(bd));
1438 // e_object_breadcrumb_add(E_OBJECT(bd), "border_show_event");
1439 ecore_event_add(E_EVENT_BORDER_SHOW, ev, _e_border_event_border_show_free, NULL);
1441 #ifdef _F_ZONE_WINDOW_ROTATION_
1442 if ((e_config->wm_win_rotation) &&
1443 ((bd->client.e.state.rot.support) ||
1444 (bd->client.e.state.rot.app_set)))
1446 ELB(ELBT_ROT, "CHECK", bd->client.win);
1447 int rotation = _e_border_rotation_angle_get(bd);
1448 if (rotation != -1) e_border_rotation_set(bd, rotation);
1454 e_border_hide(E_Border *bd,
1457 unsigned int visible;
1460 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1462 #ifdef _F_ZONE_WINDOW_ROTATION_
1463 if ((e_config->wm_win_rotation) &&
1464 (rot.vkbd_ctrl_win) && (rot.vkbd) &&
1466 (!rot.vkbd_hide_prepare_done) &&
1469 Eina_Bool need_prepare = EINA_TRUE;
1470 E_Border *child = NULL;
1473 if (e_object_is_del(E_OBJECT(bd->parent)))
1474 need_prepare = EINA_FALSE;
1477 bd->parent->transients = eina_list_remove(bd->parent->transients, bd);
1478 if (bd->parent->modal == bd)
1480 ecore_x_event_mask_unset(bd->parent->client.win, ECORE_X_EVENT_MASK_WINDOW_DAMAGE | ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1481 ecore_x_event_mask_set(bd->parent->client.win, bd->parent->saved.event_mask);
1482 bd->parent->lock_close = 0;
1483 bd->parent->saved.event_mask = 0;
1484 bd->parent->modal = NULL;
1490 need_prepare = EINA_FALSE;
1492 EINA_LIST_FREE(bd->transients, child)
1494 child->parent = NULL;
1497 ELBF(ELBT_BD, 0, bd->client.win, "SEND KBD_OFF_PREPARE:%d", need_prepare);
1501 e_object_ref(E_OBJECT(bd));
1502 ecore_x_e_virtual_keyboard_off_prepare_request_send(rot.vkbd_ctrl_win);
1503 if (rot.vkbd_hide_prepare_timer)
1504 ecore_timer_del(rot.vkbd_hide_prepare_timer);
1505 rot.vkbd_hide_prepare_timer = ecore_timer_add(1.5f,
1506 _e_border_vkbd_hide_prepare_timeout,
1512 e_object_ref(E_OBJECT(bd));
1514 /* In order to clear conformant area properly, WM should send keyboard off prepare request event */
1515 ecore_x_e_virtual_keyboard_off_prepare_request_send(rot.vkbd_ctrl_win);
1517 /* cleanup code from _e_border_vkbd_hide() */
1518 rot.vkbd_hide_prepare_done = EINA_TRUE;
1519 if (rot.vkbd_hide_prepare_timer)
1520 ecore_timer_del(rot.vkbd_hide_prepare_timer);
1521 rot.vkbd_hide_prepare_timer = NULL;
1522 if (rot.vkbd_hide_timer)
1523 ecore_timer_del(rot.vkbd_hide_timer);
1524 rot.vkbd_hide_timer = ecore_timer_add(0.03f, _e_border_vkbd_hide_timeout, bd);
1527 ELBF(ELBT_BD, 0, bd->client.win, "HIDE visible:%d", bd->visible);
1529 if (!bd->visible) goto send_event;
1530 ecore_x_window_shadow_tree_flush();
1532 _e_border_move_end(bd);
1533 if (bd->resize_mode != RESIZE_NONE)
1535 _e_border_pointer_resize_end(bd);
1536 bd->resize_mode = RESIZE_NONE;
1537 _e_border_resize_end(bd);
1540 e_container_shape_hide(bd->shape);
1541 if (!bd->iconic) e_hints_window_hidden_set(bd);
1544 bd->changes.visible = 1;
1546 if (!bd->need_reparent)
1548 if ((bd->focused) ||
1549 (e_grabinput_last_focus_win_get() == bd->client.win))
1551 e_border_focus_set(bd, 0, 1);
1559 con = e_container_current_get(e_manager_current_get());
1560 zone = e_zone_current_get(con);
1561 desk = e_desk_current_get(zone);
1564 (bd->parent->desk == desk) && (bd->parent->modal == bd))
1565 e_border_focus_set(bd->parent, 1, 1);
1566 else if (e_config->focus_revert_on_hide_or_close)
1568 /* When using pointer focus, the border under the
1569 * pointer (if any) gets focused, in sloppy/click
1570 * focus the last focused window on the current
1571 * desk gets focus */
1572 if (e_config->focus_policy == E_FOCUS_MOUSE)
1574 pbd = e_border_under_pointer_get(desk, bd);
1576 e_border_focus_set(pbd, 1, 1);
1578 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
1579 else if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK) &&
1580 (e_config->focus_policy == E_FOCUS_CLICK))
1581 _e_border_latest_stacked_focus(bd);
1585 e_desk_last_focused_focus(desk);
1595 /* Make sure that this border isn't deleted */
1596 bd->await_hide_event++;
1598 if (!e_manager_comp_evas_get(bd->zone->container->manager))
1599 ecore_x_window_hide(bd->client.win);
1604 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1);
1606 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1);
1613 #ifdef _F_ZONE_WINDOW_ROTATION_
1614 _e_border_rotation_list_remove(bd);
1617 E_Event_Border_Hide *ev;
1619 ev = E_NEW(E_Event_Border_Hide, 1);
1621 e_object_ref(E_OBJECT(bd));
1622 // e_object_breadcrumb_add(E_OBJECT(bd), "border_hide_event");
1623 ecore_event_add(E_EVENT_BORDER_HIDE, ev, _e_border_event_border_hide_free, NULL);
1628 _pri_adj(int pid, int set, int adj, Eina_Bool use_adj, Eina_Bool adj_children, Eina_Bool do_children)
1632 if (use_adj) newpri = getpriority(PRIO_PROCESS, pid) + adj;
1633 setpriority(PRIO_PROCESS, pid, newpri);
1634 // shouldnt need to do this as default ionice class is "none" (0), and
1635 // this inherits io priority FROM nice level
1636 // ioprio_set(IOPRIO_WHO_PROCESS, pid,
1637 // IOPRIO_PRIO_VALUE(2, 5));
1641 char *file, buf[PATH_MAX];
1645 // yes - this is /proc specific... so this may not work on some
1646 // os's - works on linux. too bad for others.
1647 files = ecore_file_ls("/proc");
1648 EINA_LIST_FREE(files, file)
1650 if (isdigit(file[0]))
1652 snprintf(buf, sizeof(buf), "/proc/%s/stat", file);
1653 f = fopen(buf, "r");
1658 if (fscanf(f, "%i %*s %*s %i %*s", &pid2, &ppid) == 2)
1664 _pri_adj(pid2, set, adj, EINA_TRUE,
1665 adj_children, do_children);
1667 _pri_adj(pid2, set, adj, use_adj,
1668 adj_children, do_children);
1680 _e_border_pri_raise(E_Border *bd)
1682 if (bd->client.netwm.pid <= 0) return;
1683 if (bd->client.netwm.pid == getpid()) return;
1684 _pri_adj(bd->client.netwm.pid,
1685 e_config->priority - 1, -1, EINA_FALSE,
1686 // EINA_TRUE, EINA_TRUE);
1687 EINA_TRUE, EINA_FALSE);
1688 // printf("WIN: pid %i, title %s (HI!!!!!!!!!!!!!!!!!!)\n",
1689 // bd->client.netwm.pid, e_border_name_get(bd));
1693 _e_border_pri_norm(E_Border *bd)
1695 if (bd->client.netwm.pid <= 0) return;
1696 if (bd->client.netwm.pid == getpid()) return;
1697 _pri_adj(bd->client.netwm.pid,
1698 e_config->priority, 1, EINA_FALSE,
1699 // EINA_TRUE, EINA_TRUE);
1700 EINA_TRUE, EINA_FALSE);
1701 // printf("WIN: pid %i, title %s (NORMAL)\n",
1702 // bd->client.netwm.pid, e_border_name_get(bd));
1706 _e_border_frame_replace(E_Border *bd, Eina_Bool argb)
1709 Ecore_Evas *bg_ecore_evas;
1715 bg_ecore_evas = bd->bg_ecore_evas;
1717 /* unregister old frame window */
1718 eina_hash_del(borders_hash, e_util_winid_str_get(bd->bg_win), bd);
1719 eina_hash_del(borders_hash, e_util_winid_str_get(bd->win), bd);
1721 e_focus_setdown(bd);
1722 e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
1723 e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
1725 if (bd->icon_object)
1726 evas_object_del(bd->icon_object);
1728 evas_object_del(bd->bg_object);
1729 e_canvas_del(bg_ecore_evas);
1730 ecore_evas_free(bg_ecore_evas);
1733 e_object_del(E_OBJECT(bd->pointer));
1735 /* create new frame */
1737 bd->win = ecore_x_window_manager_argb_new(bd->zone->container->win,
1738 bd->x, bd->y, bd->w, bd->h);
1741 bd->win = ecore_x_window_override_new(bd->zone->container->win,
1742 bd->x, bd->y, bd->w, bd->h);
1743 ecore_x_window_shape_events_select(bd->win, 1);
1746 ecore_x_window_configure(bd->win,
1747 ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
1748 ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
1750 win, ECORE_X_WINDOW_STACK_BELOW);
1752 e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
1753 e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
1756 bd->bg_ecore_evas = e_canvas_new(bd->win,
1757 0, 0, bd->w, bd->h, 1, 0,
1760 e_canvas_add(bd->bg_ecore_evas);
1761 ecore_x_window_reparent(bd->event_win, bd->win, 0, 0);
1763 bd->bg_evas = ecore_evas_get(bd->bg_ecore_evas);
1764 ecore_evas_name_class_set(bd->bg_ecore_evas, "E", "Frame_Window");
1765 ecore_evas_title_set(bd->bg_ecore_evas, "Enlightenment Frame");
1767 ecore_x_window_shape_events_select(bd->bg_win, 1);
1769 /* move client with shell win over to new frame */
1770 ecore_x_window_reparent(bd->client.shell_win, bd->win,
1771 bd->client_inset.l, bd->client_inset.t);
1773 bd->pointer = e_pointer_window_new(bd->win, 0);
1775 eina_hash_add(borders_hash, e_util_winid_str_get(bd->bg_win), bd);
1776 eina_hash_add(borders_hash, e_util_winid_str_get(bd->win), bd);
1783 ecore_evas_show(bd->bg_ecore_evas);
1784 ecore_x_window_show(bd->win);
1786 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
1787 ecore_x_window_show(tmp->win);
1790 bd->bg_object = edje_object_add(bd->bg_evas);
1791 snprintf(buf, sizeof(buf), "e/widgets/border/%s/border", bd->client.border.name);
1792 e_theme_edje_object_set(bd->bg_object, "base/theme/borders", buf);
1794 bd->icon_object = e_border_icon_add(bd, bd->bg_evas);
1796 /* cleanup old frame */
1797 ecore_x_window_free(win);
1801 _e_border_client_move_resize_send(E_Border *bd)
1803 if (bd->internal_ecore_evas)
1804 ecore_evas_managed_move(bd->internal_ecore_evas,
1805 bd->x + bd->fx.x + bd->client_inset.l,
1806 bd->y + bd->fx.y + bd->client_inset.t);
1808 ecore_x_icccm_move_resize_send(bd->client.win,
1809 bd->x + bd->fx.x + bd->client_inset.l,
1810 bd->y + bd->fx.y + bd->client_inset.t,
1816 _e_border_pending_move_resize_add(E_Border *bd,
1823 Eina_Bool without_border,
1824 unsigned int serial)
1826 E_Border_Pending_Move_Resize *pnd;
1828 pnd = E_NEW(E_Border_Pending_Move_Resize, 1);
1830 pnd->resize = resize;
1832 pnd->without_border = without_border;
1837 pnd->serial = serial;
1838 bd->pending_move_resize = eina_list_append(bd->pending_move_resize, pnd);
1842 _e_border_move_internal(E_Border *bd,
1845 Eina_Bool without_border)
1847 E_Event_Border_Move *ev;
1850 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1852 ecore_x_window_shadow_tree_flush();
1855 _e_border_pending_move_resize_add(bd, 1, 0, x, y, 0, 0, without_border, 0);
1861 if ((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH)
1863 if (e_config->allow_manip)
1866 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL)
1871 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL)
1876 else if (e_config->allow_manip)
1884 x -= bd->client_inset.l;
1885 y -= bd->client_inset.t;
1887 if (bd->move_intercept_cb)
1890 px = bd->x, py = bd->y;
1891 bd->move_intercept_cb(bd, x, y);
1892 if ((bd->x == px) && (bd->y == py)) return;
1894 else if ((x == bd->x) && (y == bd->y)) return;
1895 bd->pre_res_change.valid = 0;
1899 bd->changes.pos = 1;
1901 if (bd->client.netwm.sync.request)
1903 bd->client.netwm.sync.wait++;
1904 ecore_x_netwm_sync_request_send(bd->client.win, bd->client.netwm.sync.serial++);
1907 _e_border_client_move_resize_send(bd);
1908 _e_border_move_update(bd);
1909 ev = E_NEW(E_Event_Border_Move, 1);
1911 e_object_ref(E_OBJECT(bd));
1912 // e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event");
1913 ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL);
1914 _e_border_zone_update(bd);
1918 * Move window to coordinates that already account border decorations.
1920 * This call will consider given position already accounts border
1921 * decorations, so it will not be considered later. This will just
1922 * work properly with borders that have being evaluated and border
1923 * decorations are known (border->client_inset).
1925 * @parm x horizontal position to place window.
1926 * @parm y vertical position to place window.
1928 * @see e_border_move_without_border()
1931 e_border_move(E_Border *bd,
1938 _e_border_move_internal(bd, x, y, 0);
1943 * Set a callback which will be called just prior to updating the
1944 * move coordinates for a border
1947 e_border_move_intercept_cb_set(E_Border *bd, E_Border_Move_Intercept_Cb cb)
1949 bd->move_intercept_cb = cb;
1953 * Move window to coordinates that do not account border decorations yet.
1955 * This call will consider given position does not account border
1956 * decoration, so these values (border->client_inset) will be
1957 * accounted automatically. This is specially useful when it is a new
1958 * client and has not be evaluated yet, in this case
1959 * border->client_inset will be zeroed and no information is known. It
1960 * will mark pending requests so border will be accounted on
1961 * evalutation phase.
1963 * @parm x horizontal position to place window.
1964 * @parm y vertical position to place window.
1966 * @see e_border_move()
1969 e_border_move_without_border(E_Border *bd,
1976 _e_border_move_internal(bd, x, y, 1);
1980 e_border_center(E_Border *bd)
1984 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1986 e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h);
1987 e_border_move(bd, x + (w - bd->w) / 2, y + (h - bd->h) / 2);
1991 e_border_center_pos_get(E_Border *bd,
1997 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
1999 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
2000 if (x) *x = zx + (zw - bd->w) / 2;
2001 if (y) *y = zy + (zh - bd->h) / 2;
2005 e_border_fx_offset(E_Border *bd,
2010 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2012 if ((x == bd->fx.x) && (y == bd->fx.y)) return;
2016 bd->changes.pos = 1;
2019 if (bd->moving) _e_border_move_update(bd);
2023 _e_border_move_resize_internal(E_Border *bd,
2028 Eina_Bool without_border,
2031 E_Event_Border_Move *mev;
2032 E_Event_Border_Resize *rev;
2035 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2037 ecore_x_window_shadow_tree_flush();
2041 _e_border_pending_move_resize_add(bd, move, 1, x, y, w, h, without_border, 0);
2047 if ((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH)
2049 if (e_config->allow_manip)
2052 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL)
2058 if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL)
2065 if (e_config->allow_manip)
2073 x -= bd->client_inset.l;
2074 y -= bd->client_inset.t;
2075 w += (bd->client_inset.l + bd->client_inset.r);
2076 h += (bd->client_inset.t + bd->client_inset.b);
2079 if ((!move || ((x == bd->x) && (y == bd->y))) &&
2080 (w == bd->w) && (h == bd->h))
2083 bd->pre_res_change.valid = 0;
2086 bd->changes.pos = 1;
2092 bd->client.w = bd->w - (bd->client_inset.l + bd->client_inset.r);
2093 bd->client.h = bd->h - (bd->client_inset.t + bd->client_inset.b);
2095 if ((bd->shaped) || (bd->client.shaped))
2097 bd->need_shape_merge = 1;
2098 bd->need_shape_export = 1;
2100 if (bd->shaped_input)
2102 bd->need_shape_merge = 1;
2105 if (bd->internal_ecore_evas)
2108 bd->changes.size = 1;
2112 if (bdresize && bd->client.netwm.sync.request)
2114 bd->client.netwm.sync.wait++;
2115 /* Don't use x and y as supplied to this function, as it is called with 0, 0
2116 * when no move is intended. The border geometry is set above anyways.
2118 _e_border_pending_move_resize_add(bd, move, 1, bd->x, bd->y, bd->w, bd->h, without_border,
2119 bd->client.netwm.sync.serial);
2120 ecore_x_netwm_sync_request_send(bd->client.win,
2121 bd->client.netwm.sync.serial++);
2126 bd->changes.size = 1;
2130 _e_border_client_move_resize_send(bd);
2132 _e_border_resize_update(bd);
2135 mev = E_NEW(E_Event_Border_Move, 1);
2137 e_object_ref(E_OBJECT(bd));
2138 // e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event");
2139 ecore_event_add(E_EVENT_BORDER_MOVE, mev, _e_border_event_border_move_free, NULL);
2142 rev = E_NEW(E_Event_Border_Resize, 1);
2144 e_object_ref(E_OBJECT(bd));
2145 // e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
2146 ecore_event_add(E_EVENT_BORDER_RESIZE, rev, _e_border_event_border_resize_free, NULL);
2147 _e_border_zone_update(bd);
2151 * Move and resize window to values that already account border decorations.
2153 * This call will consider given values already accounts border
2154 * decorations, so it will not be considered later. This will just
2155 * work properly with borders that have being evaluated and border
2156 * decorations are known (border->client_inset).
2158 * @parm x horizontal position to place window.
2159 * @parm y vertical position to place window.
2160 * @parm w horizontal window size.
2161 * @parm h vertical window size.
2163 * @see e_border_move_resize_without_border()
2166 e_border_move_resize(E_Border *bd,
2175 _e_border_move_resize_internal(bd, x, y, w, h, 0, 1);
2179 * Move and resize window to values that do not account border decorations yet.
2181 * This call will consider given values already accounts border
2182 * decorations, so it will not be considered later. This will just
2183 * work properly with borders that have being evaluated and border
2184 * decorations are known (border->client_inset).
2186 * @parm x horizontal position to place window.
2187 * @parm y vertical position to place window.
2188 * @parm w horizontal window size.
2189 * @parm h vertical window size.
2191 * @see e_border_move_resize()
2194 e_border_move_resize_without_border(E_Border *bd,
2203 _e_border_move_resize_internal(bd, x, y, w, h, 1, 1);
2207 * Resize window to values that already account border decorations.
2209 * This call will consider given size already accounts border
2210 * decorations, so it will not be considered later. This will just
2211 * work properly with borders that have being evaluated and border
2212 * decorations are known (border->client_inset).
2214 * @parm w horizontal window size.
2215 * @parm h vertical window size.
2217 * @see e_border_resize_without_border()
2220 e_border_resize(E_Border *bd,
2227 _e_border_move_resize_internal(bd, 0, 0, w, h, 0, 0);
2230 #ifdef _F_ZONE_WINDOW_ROTATION_
2232 e_border_rotation_set(E_Border *bd, int rotation)
2234 return _e_border_rotation_set_internal(bd, rotation, NULL);
2239 * Resize window to values that do not account border decorations yet.
2241 * This call will consider given size does not account border
2242 * decoration, so these values (border->client_inset) will be
2243 * accounted automatically. This is specially useful when it is a new
2244 * client and has not be evaluated yet, in this case
2245 * border->client_inset will be zeroed and no information is known. It
2246 * will mark pending requests so border will be accounted on
2247 * evalutation phase.
2249 * @parm w horizontal window size.
2250 * @parm h vertical window size.
2252 * @see e_border_resize()
2255 e_border_resize_without_border(E_Border *bd,
2262 _e_border_move_resize_internal(bd, 0, 0, w, h, 1, 0);
2266 e_border_layer_set(E_Border *bd,
2272 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2274 ecore_x_window_shadow_tree_flush();
2276 oldraise = e_config->transient.raise;
2280 bd->saved.layer = layer;
2284 if (e_config->transient.layer)
2288 Eina_List *list = _e_border_sub_borders_new(bd);
2290 /* We need to set raise to one, else the child wont
2291 * follow to the new layer. It should be like this,
2292 * even if the user usually doesn't want to raise
2295 e_config->transient.raise = 1;
2296 EINA_LIST_FOREACH(list, l, child)
2298 e_border_layer_set(child, layer);
2302 e_config->transient.raise = oldraise;
2306 e_border_raise(E_Border *bd)
2308 E_Event_Border_Stack *ev;
2309 E_Border *last = NULL, *child;
2313 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2315 ecore_x_window_shadow_tree_flush();
2317 if (e_config->transient.raise)
2319 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
2320 if (e_config->focus_setting != E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
2323 Eina_List *list = _e_border_sub_borders_new(bd);
2325 EINA_LIST_REVERSE_FOREACH(list, l, child)
2327 /* Don't stack iconic transients. If the user wants these shown,
2328 * thats another option.
2333 e_border_stack_below(child, last);
2338 /* First raise the border to find out which border we will end up above */
2339 above = e_container_border_raise(child);
2343 /* We ended up above a border, now we must stack this border to
2344 * generate the stacking event, and to check if this transient
2345 * has other transients etc.
2347 e_border_stack_above(child, above);
2351 /* If we didn't end up above any border, we are on the bottom! */
2352 e_border_lower(child);
2358 eina_list_free(list);
2359 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
2363 EINA_LIST_FOREACH(bd->transients, l, child)
2365 /* Don't stack iconic transients. If the user wants these shown,
2366 * thats another option.
2370 child->layer = bd->layer;
2371 if (!last) last = child;
2372 e_border_raise (child);
2379 ev = E_NEW(E_Event_Border_Stack, 1);
2381 e_object_ref(E_OBJECT(bd));
2385 e_container_border_stack_below(bd, last);
2387 e_object_ref(E_OBJECT(last));
2388 ev->type = E_STACKING_BELOW;
2394 /* If we don't have any children, raise this border */
2395 above = e_container_border_raise(bd);
2396 e_border_raise_latest_set(bd);
2399 /* We ended up above a border */
2401 e_object_ref(E_OBJECT(above));
2402 ev->type = E_STACKING_ABOVE;
2406 /* No border to raise above, same as a lower! */
2408 ev->type = E_STACKING_ABOVE;
2412 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
2413 e_remember_update(bd);
2417 e_border_lower(E_Border *bd)
2419 E_Event_Border_Stack *ev;
2420 E_Border *last = NULL, *child;
2424 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2426 ecore_x_window_shadow_tree_flush();
2428 if (e_config->transient.lower)
2430 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
2431 if (e_config->focus_setting != E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
2434 Eina_List *list = _e_border_sub_borders_new(bd);
2436 EINA_LIST_REVERSE_FOREACH(list, l, child)
2438 /* Don't stack iconic transients. If the user wants these shown,
2439 * thats another option.
2444 e_border_stack_below(child, last);
2449 /* First lower the border to find out which border we will end up below */
2450 below = e_container_border_lower(child);
2454 /* We ended up below a border, now we must stack this border to
2455 * generate the stacking event, and to check if this transient
2456 * has other transients etc.
2458 e_border_stack_below(child, below);
2462 /* If we didn't end up below any border, we are on top! */
2463 e_border_raise(child);
2469 eina_list_free(list);
2471 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
2475 EINA_LIST_FOREACH(bd->transients, l, child)
2477 /* Don't stack iconic transients. If the user wants these shown,
2478 * thats another option.
2482 child->layer = bd->layer;
2483 e_border_lower (child);
2491 ev = E_NEW(E_Event_Border_Stack, 1);
2493 e_object_ref(E_OBJECT(bd));
2497 e_container_border_stack_below(bd, last);
2499 e_object_ref(E_OBJECT(last));
2500 ev->type = E_STACKING_BELOW;
2506 /* If we don't have any children, lower this border */
2507 below = e_container_border_lower(bd);
2510 /* We ended up below a border */
2512 e_object_ref(E_OBJECT(below));
2513 ev->type = E_STACKING_BELOW;
2517 /* No border to hide under, same as a raise! */
2519 ev->type = E_STACKING_BELOW;
2523 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
2524 e_remember_update(bd);
2528 e_border_stack_above(E_Border *bd,
2531 /* TODO: Should stack above allow the border to change level */
2532 E_Event_Border_Stack *ev;
2533 E_Border *last = NULL, *child;
2537 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2539 ecore_x_window_shadow_tree_flush();
2541 if (e_config->transient.raise)
2543 Eina_List *list = _e_border_sub_borders_new(bd);
2545 EINA_LIST_REVERSE_FOREACH(list, l, child)
2547 /* Don't stack iconic transients. If the user wants these shown,
2548 * thats another option.
2553 e_border_stack_below(child, last);
2555 e_border_stack_above(child, above);
2559 eina_list_free(list);
2562 ev = E_NEW(E_Event_Border_Stack, 1);
2564 e_object_ref(E_OBJECT(bd));
2568 e_container_border_stack_below(bd, last);
2570 e_object_ref(E_OBJECT(last));
2571 ev->type = E_STACKING_BELOW;
2575 e_container_border_stack_above(bd, above);
2577 e_object_ref(E_OBJECT(above));
2578 ev->type = E_STACKING_ABOVE;
2581 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
2582 e_remember_update(bd);
2586 e_border_stack_below(E_Border *bd,
2589 /* TODO: Should stack below allow the border to change level */
2590 E_Event_Border_Stack *ev;
2591 E_Border *last = NULL, *child;
2595 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2597 ecore_x_window_shadow_tree_flush();
2599 if (e_config->transient.lower)
2601 Eina_List *list = _e_border_sub_borders_new(bd);
2603 EINA_LIST_REVERSE_FOREACH(bd->transients, l, child)
2605 /* Don't stack iconic transients. If the user wants these shown,
2606 * thats another option.
2611 e_border_stack_below(child, last);
2613 e_border_stack_below(child, below);
2617 eina_list_free(list);
2620 ev = E_NEW(E_Event_Border_Stack, 1);
2622 e_object_ref(E_OBJECT(bd));
2626 e_container_border_stack_below(bd, last);
2628 e_object_ref(E_OBJECT(last));
2629 ev->type = E_STACKING_BELOW;
2633 e_container_border_stack_below(bd, below);
2635 e_object_ref(E_OBJECT(below));
2636 ev->type = E_STACKING_BELOW;
2639 ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
2640 e_remember_update(bd);
2644 e_border_focus_latest_set(E_Border *bd)
2646 focus_stack = eina_list_remove(focus_stack, bd);
2647 focus_stack = eina_list_prepend(focus_stack, bd);
2651 e_border_raise_latest_set(E_Border *bd)
2653 raise_stack = eina_list_remove(raise_stack, bd);
2654 raise_stack = eina_list_prepend(raise_stack, bd);
2658 * Sets the focus to the given border if necessary
2659 * There are 3 cases of different focus_policy-configurations:
2661 * - E_FOCUS_CLICK: just set the focus, the most simple one
2663 * - E_FOCUS_MOUSE: focus is where the mouse is, so try to
2664 * warp the pointer to the window. If this fails (because
2665 * the pointer is already in the window), just set the focus.
2667 * - E_FOCUS_SLOPPY: focus is where the mouse is or on the
2668 * last window which was focused, if the mouse is on the
2669 * desktop. So, we need to look if there is another window
2670 * under the pointer and warp to pointer to the right
2671 * one if so (also, we set the focus afterwards). In case
2672 * there is no window under pointer, the pointer is on the
2673 * desktop and so we just set the focus.
2676 * This function is to be called when setting the focus was not
2677 * explicitly triggered by the user (by moving the mouse or
2678 * clicking for example), but implicitly (by closing a window,
2679 * the last focused window should get focus).
2683 e_border_focus_set_with_pointer(E_Border *bd)
2685 #ifdef PRINT_LOTS_OF_DEBUG
2686 E_PRINT_BORDER_INFO(bd);
2688 /* note: this is here as it seems there are enough apps that do not even
2689 * expect us to emulate a look of focus but not actually set x input
2690 * focus as we do - so simply abort any focuse set on such windows */
2691 /* be strict about accepting focus hint */
2692 if ((!bd->client.icccm.accepts_focus) &&
2693 (!bd->client.icccm.take_focus)) return;
2694 if (bd->lock_focus_out) return;
2696 e_border_focus_set(bd, 1, 1);
2698 if (e_config->focus_policy == E_FOCUS_CLICK) return;
2699 if (!bd->visible) return;
2701 if (e_config->focus_policy == E_FOCUS_SLOPPY)
2703 if (!e_border_under_pointer_get(bd->desk, bd))
2705 e_border_pointer_warp_to_center(bd);
2710 e_border_pointer_warp_to_center(bd);
2715 e_border_focus_set(E_Border *bd,
2719 E_Border *bd_unfocus = NULL;
2720 Eina_Bool focus_changed = EINA_FALSE;
2723 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2724 /* note: this is here as it seems there are enough apps that do not even
2725 * expect us to emulate a look of focus but not actually set x input
2726 * focus as we do - so simply abort any focuse set on such windows */
2727 /* be strict about accepting focus hint */
2728 if ((!bd->client.icccm.accepts_focus) &&
2729 (!bd->client.icccm.take_focus))
2731 if ((set) && (focus) && (bd->lock_focus_out)) return;
2733 /* dont focus an iconified window. that's silly! */
2738 e_border_uniconify(bd);
2739 if (!focus_track_frozen)
2740 e_border_focus_latest_set(bd);
2743 else if (!bd->visible)
2747 /* FIXME: hack for deskflip animation:
2748 * dont update focus when sliding previous desk */
2749 else if ((!bd->sticky) &&
2750 (bd->desk != e_desk_current_get(bd->desk->zone)))
2756 if ((bd->modal) && (bd->modal != bd) && (bd->modal->visible))
2758 e_border_focus_set(bd->modal, focus, set);
2761 else if ((bd->leader) && (bd->leader->modal) && (bd->leader->modal != bd))
2763 e_border_focus_set(bd->leader->modal, focus, set);
2771 if (bd->visible && bd->changes.visible)
2776 else if ((!bd->focused) ||
2777 (focus_next && (bd != eina_list_data_get(focus_next))))
2781 if ((l = eina_list_data_find_list(focus_next, bd)))
2782 focus_next = eina_list_promote_list(focus_next, l);
2784 focus_next = eina_list_prepend(focus_next, bd);
2786 if ((bd->client.icccm.take_focus) &&
2787 (bd->client.icccm.accepts_focus))
2789 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
2790 /* TODO what if the client didn't take focus ? */
2792 else if (!bd->client.icccm.accepts_focus)
2794 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
2796 else if (!bd->client.icccm.take_focus)
2798 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
2799 /* e_border_focus_set(bd, 1, 0); */
2809 if (focused) bd_unfocus = focused;
2810 if (focusing == bd) focusing = NULL;
2815 EINA_LIST_FOREACH(e_border_client_list(), l, bd2)
2817 if ((bd2->fullscreen) &&
2819 (bd2->zone == bd->zone) &&
2820 ((bd2->desk == bd->desk) ||
2821 (bd2->sticky) || (bd->sticky)))
2823 Eina_Bool unfocus_is_parent = EINA_FALSE;
2824 E_Border *bd_parent;
2826 bd_parent = bd->parent;
2829 if (bd_parent == bd2)
2831 unfocus_is_parent = EINA_TRUE;
2834 bd_parent = bd->parent;
2836 if ((!unfocus_is_parent) &&
2837 (!e_config->allow_above_fullscreen))
2839 e_border_iconify(bd2);
2844 focus_changed = EINA_TRUE;
2850 focus_next = eina_list_remove(focus_next, bd);
2851 if (bd == focusing) focusing = NULL;
2853 if ((bd->focused) &&
2854 ((bd->desk == e_desk_current_get(bd->zone)) || (bd->sticky)))
2856 Eina_Bool wasfocused = EINA_FALSE;
2859 /* should always be the case. anyway */
2863 wasfocused = EINA_TRUE;
2866 if ((set) && (!focus_next) && (!focusing))
2868 e_grabinput_focus(bd->zone->container->bg_win,
2869 E_FOCUS_METHOD_PASSIVE);
2871 if ((bd->fullscreen) && (wasfocused))
2873 Eina_Bool have_vis_child = EINA_FALSE;
2877 EINA_LIST_FOREACH(e_border_client_list(), l, bd2)
2880 (bd2->zone == bd->zone) &&
2881 ((bd2->desk == bd->desk) ||
2882 (bd2->sticky) || (bd->sticky)))
2884 if (bd2->parent == bd)
2886 have_vis_child = EINA_TRUE;
2891 if ((!have_vis_child) &&
2892 (!e_config->allow_above_fullscreen))
2893 e_border_iconify(bd);
2899 (!e_object_is_del(E_OBJECT(bd_unfocus)) &&
2900 (e_object_ref_get(E_OBJECT(bd_unfocus)) > 0)))
2902 E_Event_Border_Focus_Out *ev;
2904 bd_unfocus->focused = 0;
2905 e_focus_event_focus_out(bd_unfocus);
2907 if (bd_unfocus->raise_timer)
2908 ecore_timer_del(bd_unfocus->raise_timer);
2909 bd_unfocus->raise_timer = NULL;
2911 edje_object_signal_emit(bd_unfocus->bg_object, "e,state,unfocused", "e");
2912 if (bd_unfocus->icon_object)
2913 edje_object_signal_emit(bd_unfocus->icon_object, "e,state,unfocused", "e");
2915 ev = E_NEW(E_Event_Border_Focus_Out, 1);
2916 ev->border = bd_unfocus;
2917 e_object_ref(E_OBJECT(bd_unfocus));
2919 ecore_event_add(E_EVENT_BORDER_FOCUS_OUT, ev,
2920 _e_border_event_border_focus_out_free, NULL);
2921 if ((bd_unfocus->fullscreen) &&
2922 (bd != bd_unfocus) &&
2923 (bd->zone == bd_unfocus->zone) &&
2924 ((bd->desk == bd_unfocus->desk) ||
2925 (bd->sticky) || (bd_unfocus->sticky)))
2927 Eina_Bool unfocus_is_parent = EINA_FALSE;
2928 E_Border *bd_parent;
2930 bd_parent = bd->parent;
2933 if (bd_parent == bd_unfocus)
2935 unfocus_is_parent = EINA_TRUE;
2938 bd_parent = bd->parent;
2940 if ((!unfocus_is_parent) && (!e_config->allow_above_fullscreen))
2942 e_border_iconify(bd_unfocus);
2949 E_Event_Border_Focus_In *ev;
2951 e_focus_event_focus_in(bd);
2953 if (!focus_track_frozen)
2954 e_border_focus_latest_set(bd);
2956 e_hints_active_window_set(bd->zone->container->manager, bd);
2958 edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
2959 if (bd->icon_object)
2960 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
2962 ev = E_NEW(E_Event_Border_Focus_In, 1);
2964 e_object_ref(E_OBJECT(bd));
2966 ecore_event_add(E_EVENT_BORDER_FOCUS_IN, ev,
2967 _e_border_event_border_focus_in_free, NULL);
2972 e_border_shade(E_Border *bd,
2975 E_Event_Border_Resize *ev;
2980 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
2981 if ((bd->shaded) || (bd->shading) || (bd->fullscreen) ||
2982 ((bd->maximized) && (!e_config->allow_manip))) return;
2983 if ((bd->client.border.name) &&
2984 (!strcmp("borderless", bd->client.border.name))) return;
2986 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
2987 ecore_x_window_hide(tmp->win);
2989 ecore_x_window_shadow_tree_flush();
2991 bd->shade.x = bd->x;
2992 bd->shade.y = bd->y;
2993 bd->shade.dir = dir;
2995 e_hints_window_shaded_set(bd, 1);
2996 e_hints_window_shade_direction_set(bd, dir);
2998 if (e_config->border_shade_animate)
3000 bd->shade.start = ecore_loop_time_get();
3002 bd->changes.shading = 1;
3005 if (bd->shade.dir == E_DIRECTION_UP ||
3006 bd->shade.dir == E_DIRECTION_LEFT)
3007 ecore_x_window_gravity_set(bd->client.win, ECORE_X_GRAVITY_SW);
3009 ecore_x_window_gravity_set(bd->client.win, ECORE_X_GRAVITY_NE);
3011 bd->shade.anim = ecore_animator_add(_e_border_shade_animator, bd);
3012 edje_object_signal_emit(bd->bg_object, "e,state,shading", "e");
3016 if (bd->shade.dir == E_DIRECTION_UP)
3018 bd->h = bd->client_inset.t + bd->client_inset.b;
3020 else if (bd->shade.dir == E_DIRECTION_DOWN)
3022 bd->h = bd->client_inset.t + bd->client_inset.b;
3023 bd->y = bd->y + bd->client.h;
3024 bd->changes.pos = 1;
3026 else if (bd->shade.dir == E_DIRECTION_LEFT)
3028 bd->w = bd->client_inset.l + bd->client_inset.r;
3030 else if (bd->shade.dir == E_DIRECTION_RIGHT)
3032 bd->w = bd->client_inset.l + bd->client_inset.r;
3033 bd->x = bd->x + bd->client.w;
3034 bd->changes.pos = 1;
3037 if ((bd->shaped) || (bd->client.shaped))
3039 bd->need_shape_merge = 1;
3040 bd->need_shape_export = 1;
3042 if (bd->shaped_input)
3044 bd->need_shape_merge = 1;
3047 bd->changes.size = 1;
3049 bd->changes.shaded = 1;
3051 edje_object_signal_emit(bd->bg_object, "e,state,shaded", "e");
3052 e_border_frame_recalc(bd);
3053 ev = E_NEW(E_Event_Border_Resize, 1);
3055 /* The resize is added in the animator when animation complete */
3056 /* For non-animated, we add it immediately with the new size */
3057 e_object_ref(E_OBJECT(bd));
3058 // e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
3059 ecore_event_add(E_EVENT_BORDER_RESIZE, ev, _e_border_event_border_resize_free, NULL);
3062 e_remember_update(bd);
3066 e_border_unshade(E_Border *bd,
3069 E_Event_Border_Resize *ev;
3074 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
3075 if ((!bd->shaded) || (bd->shading))
3078 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
3079 ecore_x_window_show(tmp->win);
3081 ecore_x_window_shadow_tree_flush();
3083 bd->shade.dir = dir;
3085 e_hints_window_shaded_set(bd, 0);
3086 e_hints_window_shade_direction_set(bd, dir);
3088 if (bd->shade.dir == E_DIRECTION_UP ||
3089 bd->shade.dir == E_DIRECTION_LEFT)
3091 bd->shade.x = bd->x;
3092 bd->shade.y = bd->y;
3096 bd->shade.x = bd->x - bd->client.w;
3097 bd->shade.y = bd->y - bd->client.h;
3099 if (e_config->border_shade_animate)
3101 bd->shade.start = ecore_loop_time_get();
3103 bd->changes.shading = 1;
3106 if (bd->shade.dir == E_DIRECTION_UP)
3108 ecore_x_window_gravity_set(bd->client.win, ECORE_X_GRAVITY_SW);
3109 ecore_x_window_move_resize(bd->client.win, 0,
3110 bd->h - (bd->client_inset.t + bd->client_inset.b) -
3112 bd->client.w, bd->client.h);
3114 else if (bd->shade.dir == E_DIRECTION_LEFT)
3116 ecore_x_window_gravity_set(bd->client.win, ECORE_X_GRAVITY_SW);
3117 ecore_x_window_move_resize(bd->client.win,
3118 bd->w - (bd->client_inset.l + bd->client_inset.r) -
3120 0, bd->client.w, bd->client.h);
3123 ecore_x_window_gravity_set(bd->client.win, ECORE_X_GRAVITY_NE);
3125 bd->shade.anim = ecore_animator_add(_e_border_shade_animator, bd);
3126 edje_object_signal_emit(bd->bg_object, "e,state,unshading", "e");
3130 if (bd->shade.dir == E_DIRECTION_UP)
3132 bd->h = bd->client_inset.t + bd->client.h + bd->client_inset.b;
3134 else if (bd->shade.dir == E_DIRECTION_DOWN)
3136 bd->h = bd->client_inset.t + bd->client.h + bd->client_inset.b;
3137 bd->y = bd->y - bd->client.h;
3138 bd->changes.pos = 1;
3140 else if (bd->shade.dir == E_DIRECTION_LEFT)
3142 bd->w = bd->client_inset.l + bd->client.w + bd->client_inset.r;
3144 else if (bd->shade.dir == E_DIRECTION_RIGHT)
3146 bd->w = bd->client_inset.l + bd->client.w + bd->client_inset.r;
3147 bd->x = bd->x - bd->client.w;
3148 bd->changes.pos = 1;
3150 if ((bd->shaped) || (bd->client.shaped))
3152 bd->need_shape_merge = 1;
3153 bd->need_shape_export = 1;
3155 if (bd->shaped_input)
3157 bd->need_shape_merge = 1;
3160 bd->changes.size = 1;
3162 bd->changes.shaded = 1;
3164 edje_object_signal_emit(bd->bg_object, "e,state,unshaded", "e");
3165 e_border_frame_recalc(bd);
3166 ev = E_NEW(E_Event_Border_Resize, 1);
3168 /* The resize is added in the animator when animation complete */
3169 /* For non-animated, we add it immediately with the new size */
3170 e_object_ref(E_OBJECT(bd));
3171 // e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
3172 ecore_event_add(E_EVENT_BORDER_RESIZE, ev, _e_border_event_border_resize_free, NULL);
3175 e_remember_update(bd);
3179 _e_border_client_inset_calc(E_Border *bd)
3182 Evas_Coord cx, cy, cw, ch;
3186 evas_object_resize(bd->bg_object, 1000, 1000);
3187 edje_object_message_signal_process(bd->bg_object);
3188 edje_object_calc_force(bd->bg_object);
3189 edje_object_part_geometry_get(bd->bg_object, "e.swallow.client", &cx, &cy, &cw, &ch);
3190 bd->client_inset.l = cx;
3191 bd->client_inset.r = 1000 - (cx + cw);
3192 bd->client_inset.t = cy;
3193 bd->client_inset.b = 1000 - (cy + ch);
3197 bd->client_inset.l = 0;
3198 bd->client_inset.r = 0;
3199 bd->client_inset.t = 0;
3200 bd->client_inset.b = 0;
3203 ecore_x_netwm_frame_size_set(bd->client.win,
3204 bd->client_inset.l, bd->client_inset.r,
3205 bd->client_inset.t, bd->client_inset.b);
3206 ecore_x_e_frame_size_set(bd->client.win,
3207 bd->client_inset.l, bd->client_inset.r,
3208 bd->client_inset.t, bd->client_inset.b);
3212 _e_border_maximize(E_Border *bd, E_Maximize max)
3214 int x1, yy1, x2, y2;
3217 #ifdef _F_USE_BOTTOM_TOP_MAXIMIZE
3221 zx = zy = zw = zh = 0;
3223 switch (max & E_MAXIMIZE_TYPE)
3225 case E_MAXIMIZE_NONE:
3229 case E_MAXIMIZE_FULLSCREEN:
3235 edje_object_signal_emit(bd->bg_object, "e,action,maximize,fullscreen", "e");
3236 _e_border_client_inset_calc(bd);
3238 e_border_resize_limit(bd, &w, &h);
3239 /* center x-direction */
3240 x1 = bd->zone->x + (bd->zone->w - w) / 2;
3241 /* center y-direction */
3242 yy1 = bd->zone->y + (bd->zone->h - h) / 2;
3244 #ifdef _F_USE_BOTTOM_TOP_MAXIMIZE
3245 cy = bd->zone->y + (bd->zone->h / 2);
3248 switch (max & E_MAXIMIZE_DIRECTION)
3250 case E_MAXIMIZE_BOTH:
3251 e_border_move_resize(bd, x1, yy1, w, h);
3254 case E_MAXIMIZE_VERTICAL:
3255 e_border_move_resize(bd, bd->x, yy1, bd->w, h);
3258 case E_MAXIMIZE_HORIZONTAL:
3259 e_border_move_resize(bd, x1, bd->y, w, bd->h);
3262 case E_MAXIMIZE_LEFT:
3263 e_border_move_resize(bd, bd->zone->x, bd->zone->y, w / 2, h);
3266 case E_MAXIMIZE_RIGHT:
3267 e_border_move_resize(bd, x1, bd->zone->y, w / 2, h);
3269 #ifdef _F_USE_BOTTOM_TOP_MAXIMIZE
3270 case E_MAXIMIZE_TOP:
3271 e_border_move_resize(bd, bd->zone->x, bd->zone->y, w, h / 2);
3273 case E_MAXIMIZE_BOTTOM:
3274 e_border_move_resize(bd, bd->zone->x, cy, w, h / 2);
3280 case E_MAXIMIZE_SMART:
3281 case E_MAXIMIZE_EXPAND:
3283 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
3295 if (bd->x < zx) // window left not useful coordinates
3297 else if (bd->x + bd->w > zx + zw) // window right not useful coordinates
3298 x1 = zx + zw - bd->w;
3299 else // window normal position
3302 if (bd->y < zy) // window top not useful coordinates
3304 else if (bd->y + bd->h > zy + zh) // window bottom not useful coordinates
3305 yy1 = zy + zh - bd->h;
3306 else // window normal position
3309 switch (max & E_MAXIMIZE_DIRECTION)
3311 case E_MAXIMIZE_BOTH:
3312 e_border_move_resize(bd, zx, zy, zw, zh);
3315 case E_MAXIMIZE_VERTICAL:
3316 e_border_move_resize(bd, x1, zy, w, zh);
3319 case E_MAXIMIZE_HORIZONTAL:
3320 e_border_move_resize(bd, zx, yy1, zw, h);
3323 case E_MAXIMIZE_LEFT:
3324 e_border_move_resize(bd, zx, zy, zw / 2, zh);
3327 case E_MAXIMIZE_RIGHT:
3328 e_border_move_resize(bd, zx + zw / 2, zy, zw / 2, zh);
3332 edje_object_signal_emit(bd->bg_object, "e,action,maximize", "e");
3335 case E_MAXIMIZE_FILL:
3338 x2 = bd->zone->x + bd->zone->w;
3339 y2 = bd->zone->y + bd->zone->h;
3341 /* walk through all shelves */
3342 e_maximize_border_shelf_fill(bd, &x1, &yy1, &x2, &y2, max);
3344 /* walk through all windows */
3345 e_maximize_border_border_fill(bd, &x1, &yy1, &x2, &y2, max);
3351 e_border_resize_limit(bd, &w, &h);
3352 /* center x-direction */
3353 x1 = x1 + (pw - w) / 2;
3354 /* center y-direction */
3355 yy1 = yy1 + (ph - h) / 2;
3357 switch (max & E_MAXIMIZE_DIRECTION)
3359 case E_MAXIMIZE_BOTH:
3360 e_border_move_resize(bd, x1, yy1, w, h);
3363 case E_MAXIMIZE_VERTICAL:
3364 e_border_move_resize(bd, bd->x, yy1, bd->w, h);
3367 case E_MAXIMIZE_HORIZONTAL:
3368 e_border_move_resize(bd, x1, bd->y, w, bd->h);
3371 case E_MAXIMIZE_LEFT:
3372 e_border_move_resize(bd, bd->zone->x, bd->zone->y, w / 2, h);
3375 case E_MAXIMIZE_RIGHT:
3376 e_border_move_resize(bd, x1, bd->zone->y, w / 2, h);
3384 e_border_maximize(E_Border *bd,
3388 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
3390 if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
3392 if ((bd->shaded) || (bd->shading)) return;
3393 ecore_x_window_shadow_tree_flush();
3395 e_border_unfullscreen(bd);
3396 /* Only allow changes in vertical/ horizontal maximization */
3397 if (((bd->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION)) ||
3398 ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH)) return;
3401 bd->need_maximize = 1;
3402 bd->maximized &= ~E_MAXIMIZE_TYPE;
3403 bd->maximized |= max;
3407 bd->pre_res_change.valid = 0;
3408 if (!(bd->maximized & E_MAXIMIZE_HORIZONTAL))
3410 /* Horizontal hasn't been set */
3411 bd->saved.x = bd->x - bd->zone->x;
3412 bd->saved.w = bd->w;
3414 if (!(bd->maximized & E_MAXIMIZE_VERTICAL))
3416 /* Vertical hasn't been set */
3417 bd->saved.y = bd->y - bd->zone->y;
3418 bd->saved.h = bd->h;
3421 bd->saved.zone = bd->zone->num;
3422 e_hints_window_size_set(bd);
3426 _e_border_maximize(bd, max);
3429 /* Remove previous type */
3430 bd->maximized &= ~E_MAXIMIZE_TYPE;
3431 /* Add new maximization. It must be added, so that VERTICAL + HORIZONTAL == BOTH */
3432 bd->maximized |= max;
3434 e_hints_window_maximized_set(bd, bd->maximized & E_MAXIMIZE_HORIZONTAL,
3435 bd->maximized & E_MAXIMIZE_VERTICAL);
3436 e_remember_update(bd);
3440 e_border_unmaximize(E_Border *bd,
3444 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
3445 if (!(max & E_MAXIMIZE_DIRECTION))
3447 CRI("BUG: Unmaximize call without direction!");
3451 if ((bd->shaded) || (bd->shading)) return;
3452 ecore_x_window_shadow_tree_flush();
3453 /* Remove directions not used */
3454 max &= (bd->maximized & E_MAXIMIZE_DIRECTION);
3455 /* Can only remove existing maximization directions */
3457 if (bd->maximized & E_MAXIMIZE_TYPE)
3459 bd->pre_res_change.valid = 0;
3460 bd->need_maximize = 0;
3462 if ((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN)
3466 edje_object_signal_emit(bd->bg_object, "e,action,unmaximize,fullscreen", "e");
3467 _e_border_client_inset_calc(bd);
3470 bd->maximized = E_MAXIMIZE_NONE;
3471 _e_border_move_resize_internal(bd,
3472 bd->zone->x + bd->saved.x,
3473 bd->zone->y + bd->saved.y,
3474 bd->saved.w, bd->saved.h, 0, 1);
3475 bd->saved.x = bd->saved.y = bd->saved.w = bd->saved.h = 0;
3476 e_hints_window_size_unset(bd);
3487 if (max & E_MAXIMIZE_VERTICAL)
3489 /* Remove vertical */
3491 y = bd->saved.y + bd->zone->y;
3492 bd->saved.h = bd->saved.y = 0;
3493 bd->maximized &= ~E_MAXIMIZE_VERTICAL;
3494 bd->maximized &= ~E_MAXIMIZE_LEFT;
3495 bd->maximized &= ~E_MAXIMIZE_RIGHT;
3497 if (max & E_MAXIMIZE_HORIZONTAL)
3499 /* Remove horizontal */
3501 x = bd->saved.x + bd->zone->x;
3502 bd->saved.w = bd->saved.x = 0;
3503 bd->maximized &= ~E_MAXIMIZE_HORIZONTAL;
3506 e_border_resize_limit(bd, &w, &h);
3508 if (!(bd->maximized & E_MAXIMIZE_DIRECTION))
3510 bd->maximized = E_MAXIMIZE_NONE;
3511 _e_border_move_resize_internal(bd, x, y, w, h, 0, 1);
3512 e_hints_window_size_unset(bd);
3513 edje_object_signal_emit(bd->bg_object, "e,action,unmaximize", "e");
3517 _e_border_move_resize_internal(bd, x, y, w, h, 0, 1);
3518 e_hints_window_size_set(bd);
3521 e_hints_window_maximized_set(bd, bd->maximized & E_MAXIMIZE_HORIZONTAL,
3522 bd->maximized & E_MAXIMIZE_VERTICAL);
3524 e_remember_update(bd);
3528 e_border_fullscreen(E_Border *bd,
3529 E_Fullscreen policy)
3531 E_Event_Border_Fullscreen *ev;
3534 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
3536 if ((bd->shaded) || (bd->shading)) return;
3537 ecore_x_window_shadow_tree_flush();
3540 bd->need_fullscreen = 1;
3543 if (!bd->fullscreen)
3545 bd->pre_res_change.valid = 0;
3547 bd->saved.x = bd->x - bd->zone->x;
3548 bd->saved.y = bd->y - bd->zone->y;
3549 bd->saved.w = bd->client.w;
3550 bd->saved.h = bd->client.h;
3551 bd->saved.maximized = bd->maximized;
3552 bd->saved.zone = bd->zone->num;
3555 e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
3556 e_hints_window_size_set(bd);
3558 bd->client_inset.l = 0;
3559 bd->client_inset.r = 0;
3560 bd->client_inset.t = 0;
3561 bd->client_inset.b = 0;
3563 bd->desk->fullscreen_borders++;
3565 /* e_zone_fullscreen_set(bd->zone, 1); */
3566 bd->saved.layer = bd->layer;
3567 if (!e_config->allow_above_fullscreen)
3568 e_border_layer_set(bd, 250);
3570 if ((eina_list_count(bd->zone->container->zones) > 1) ||
3571 (policy == E_FULLSCREEN_RESIZE) || (!ecore_x_randr_query()))
3573 e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
3575 else if (policy == E_FULLSCREEN_ZOOM)
3577 Ecore_X_Randr_Screen_Size_MM *sizes;
3578 int num_sizes, i, best_size_index = 0;
3580 ecore_x_randr_screen_primary_output_current_size_get(bd->zone->container->manager->root,
3582 &screen_size.height,
3584 sizes = ecore_x_randr_screen_primary_output_sizes_get(bd->zone->container->manager->root,
3588 Ecore_X_Randr_Screen_Size best_size = { -1, -1 };
3589 int best_dist = INT_MAX, dist;
3591 for (i = 0; i < num_sizes; i++)
3593 if ((sizes[i].width > bd->w) && (sizes[i].height > bd->h))
3595 dist = (sizes[i].width * sizes[i].height) - (bd->w * bd->h);
3596 if (dist < best_dist)
3598 best_size.width = sizes[i].width;
3599 best_size.height = sizes[i].height;
3601 best_size_index = i;
3605 if (((best_size.width != -1) && (best_size.height != -1)) &&
3606 ((best_size.width != screen_size.width) ||
3607 (best_size.height != screen_size.height)))
3609 if (ecore_x_randr_screen_primary_output_size_set(bd->zone->container->manager->root,
3611 screen_size_index = best_size_index;
3612 e_border_move_resize(bd, 0, 0, best_size.width, best_size.height);
3616 screen_size.width = -1;
3617 screen_size.height = -1;
3618 e_border_move_resize(bd, 0, 0, bd->zone->w, bd->zone->h);
3623 e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
3627 e_hints_window_fullscreen_set(bd, 1);
3628 e_hints_window_size_unset(bd);
3629 bd->client.border.changed = 1;
3632 bd->fullscreen_policy = policy;
3634 ev = E_NEW(E_Event_Border_Fullscreen, 1);
3636 e_object_ref(E_OBJECT(bd));
3637 // e_object_breadcrumb_add(E_OBJECT(bd), "border_fullscreen_event");
3638 ecore_event_add(E_EVENT_BORDER_FULLSCREEN, ev, _e_border_event_border_fullscreen_free, NULL);
3640 e_remember_update(bd);
3644 e_border_unfullscreen(E_Border *bd)
3646 E_Event_Border_Unfullscreen *ev;
3649 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
3650 if ((bd->shaded) || (bd->shading)) return;
3651 ecore_x_window_shadow_tree_flush();
3654 bd->pre_res_change.valid = 0;
3656 bd->need_fullscreen = 0;
3657 bd->desk->fullscreen_borders--;
3659 if ((screen_size.width != -1) && (screen_size.height != -1))
3661 ecore_x_randr_screen_primary_output_size_set(bd->zone->container->manager->root,
3663 screen_size.width = -1;
3664 screen_size.height = -1;
3666 e_border_move_resize(bd,
3667 bd->saved.x + bd->zone->x,
3668 bd->saved.y + bd->zone->y,
3669 bd->saved.w, bd->saved.h);
3671 if (bd->saved.maximized)
3672 e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
3673 bd->saved.maximized);
3675 e_border_layer_set(bd, bd->saved.layer);
3677 e_hints_window_fullscreen_set(bd, 0);
3678 bd->client.border.changed = 1;
3681 bd->fullscreen_policy = 0;
3683 ev = E_NEW(E_Event_Border_Unfullscreen, 1);
3685 e_object_ref(E_OBJECT(bd));
3686 // e_object_breadcrumb_add(E_OBJECT(bd), "border_unfullscreen_event");
3687 ecore_event_add(E_EVENT_BORDER_UNFULLSCREEN, ev, _e_border_event_border_unfullscreen_free, NULL);
3689 e_remember_update(bd);
3693 e_border_iconify(E_Border *bd)
3695 E_Event_Border_Iconify *ev;
3696 unsigned int iconic;
3699 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
3700 if (bd->shading) return;
3701 ecore_x_window_shadow_tree_flush();
3705 e_border_hide(bd, 1);
3706 if (bd->fullscreen) bd->desk->fullscreen_borders--;
3707 edje_object_signal_emit(bd->bg_object, "e,action,iconify", "e");
3710 e_hints_window_iconic_set(bd);
3711 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
3713 ev = E_NEW(E_Event_Border_Iconify, 1);
3715 e_object_ref(E_OBJECT(bd));
3716 // e_object_breadcrumb_add(E_OBJECT(bd), "border_iconify_event");
3717 ecore_event_add(E_EVENT_BORDER_ICONIFY, ev, _e_border_event_border_iconify_free, NULL);
3719 if (e_config->transient.iconify)
3723 Eina_List *list = _e_border_sub_borders_new(bd);
3725 EINA_LIST_FOREACH(list, l, child)
3727 e_border_iconify(child);
3729 eina_list_free(list);
3731 e_remember_update(bd);
3734 #ifdef _F_DEICONIFY_APPROVE_
3736 _e_border_uniconify_timeout(void *data)
3743 if (!e_object_is_del(E_OBJECT(bd)))
3745 ELB(ELBT_BD, "TIMEOUT UNICONIFY_APPROVE", bd->client.win);
3746 bd->client.e.state.deiconify_approve.render_done = 1;
3747 if (bd->client.e.state.deiconify_approve.req_list)
3749 EINA_LIST_FREE(bd->client.e.state.deiconify_approve.req_list, child_bd)
3751 child_bd->client.e.state.deiconify_approve.render_done = 1;
3752 child_bd->client.e.state.deiconify_approve.ancestor = NULL;
3755 bd->client.e.state.deiconify_approve.req_list = NULL;
3756 bd->client.e.state.deiconify_approve.wait_timer = NULL;
3757 e_border_uniconify(bd);
3760 return ECORE_CALLBACK_CANCEL;
3764 _e_border_deiconify_approve_send_pending_end(void *data)
3766 E_Border *bd = (E_Border *)data;
3768 if (e_config->deiconify_approve)
3770 if (!e_object_is_del(E_OBJECT(bd)))
3772 bd->client.e.state.deiconify_approve.pending_job = NULL;
3774 ELBF(ELBT_BD, 0, bd->client.win,
3775 "SEND DEICONIFY_APPROVE. (PENDING_END) ancestor:%x",
3778 ecore_x_client_message32_send(bd->client.win,
3779 ECORE_X_ATOM_E_DEICONIFY_APPROVE,
3780 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3781 bd->client.win, 0, 0, 0, 0);
3783 bd->client.e.state.deiconify_approve.wait_timer = ecore_timer_add(e_config->deiconify_timeout, _e_border_uniconify_timeout, bd);
3789 _e_border_deiconify_approve_send(E_Border *bd, E_Border *bd_ancestor, Eina_Bool pending_ancestor)
3791 if (!bd || !bd_ancestor) return;
3793 if (e_config->deiconify_approve)
3795 if (e_config->transient.iconify)
3799 Eina_List *list = _e_border_sub_borders_new(bd);
3800 EINA_LIST_FOREACH(list, l, child)
3802 Eina_Bool pending = EINA_FALSE;
3803 Eina_Bool p = EINA_FALSE;
3805 #ifdef _F_ZONE_WINDOW_ROTATION_
3806 if ((e_config->wm_win_rotation) &&
3807 ((child->client.e.state.rot.support) ||
3808 (child->client.e.state.rot.app_set)))
3810 ELB(ELBT_ROT, "CHECK_DEICONIFY CHILD", child->client.win);
3811 int rotation = _e_border_rotation_angle_get(bd);
3812 if (rotation != -1) _e_border_rotation_set_internal(bd, rotation, &pending);
3815 if ((pending_ancestor) || (pending)) p = EINA_TRUE;
3817 _e_border_deiconify_approve_send(child, bd_ancestor, p);
3818 if (child->client.e.state.deiconify_approve.support)
3822 ELBF(ELBT_BD, 0, child->client.win,
3823 "SEND DEICONIFY_APPROVE. ancestor:%x pending(%d,%d)",
3824 bd_ancestor->client.win,
3825 pending_ancestor, pending);
3827 ecore_x_client_message32_send(child->client.win,
3828 ECORE_X_ATOM_E_DEICONIFY_APPROVE,
3829 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3830 child->client.win, 0, 0, 0, 0);
3831 child->client.e.state.deiconify_approve.ancestor = bd_ancestor;
3832 bd_ancestor->client.e.state.deiconify_approve.req_list = eina_list_append(bd_ancestor->client.e.state.deiconify_approve.req_list, child);
3836 /* queue a deiconify send job to give the chance to other jobs */
3837 ELBF(ELBT_BD, 0, child->client.win,
3838 "SEND DEICONIFY_APPROVE. (PENDING) ancestor:%x",
3839 bd_ancestor->client.win);
3840 child->client.e.state.deiconify_approve.pending_job = ecore_job_add(_e_border_deiconify_approve_send_pending_end, child);
3844 eina_list_free(list);
3850 _e_border_deiconify_approve_send_all_transient(E_Border *bd)
3852 Eina_Bool pending = EINA_FALSE;
3854 if (e_config->deiconify_approve)
3856 #ifdef _F_ZONE_WINDOW_ROTATION_
3857 if ((e_config->wm_win_rotation) &&
3858 ((bd->client.e.state.rot.support) ||
3859 (bd->client.e.state.rot.app_set)))
3861 ELB(ELBT_ROT, "CHECK_DEICONIFY", bd->client.win);
3862 int rotation = _e_border_rotation_angle_get(bd);
3863 if (rotation != -1) _e_border_rotation_set_internal(bd, rotation, &pending);
3867 if (e_config->transient.iconify)
3869 _e_border_deiconify_approve_send(bd, bd, pending);
3872 if (bd->client.e.state.deiconify_approve.support)
3876 ELBF(ELBT_BD, 0, bd->client.win, "SEND DEICONIFY_APPROVE.");
3877 ecore_x_client_message32_send(bd->client.win,
3878 ECORE_X_ATOM_E_DEICONIFY_APPROVE,
3879 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
3880 bd->client.win, 0, 0, 0, 0);
3881 bd->client.e.state.deiconify_approve.wait_timer = ecore_timer_add(e_config->deiconify_timeout, _e_border_uniconify_timeout, bd);
3885 /* queue a deiconify send job to give the chance to other jobs */
3886 ELBF(ELBT_BD, 0, bd->client.win, "SEND DEICONIFY_APPROVE. (PENDING)");
3887 bd->client.e.state.deiconify_approve.pending_job = ecore_job_add(_e_border_deiconify_approve_send_pending_end, bd);
3895 e_border_uniconify(E_Border *bd)
3898 E_Event_Border_Uniconify *ev;
3899 unsigned int iconic;
3902 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
3904 #ifdef _F_DEICONIFY_APPROVE_
3905 if (e_config->deiconify_approve)
3907 if (bd->client.e.state.deiconify_approve.support)
3909 if (bd->client.e.state.deiconify_approve.wait_timer)
3911 ELB(ELBT_BD, "DEICONIFY_APPROVE WAIT_TIMER is already running", bd->client.win);
3914 if (bd->client.e.state.deiconify_approve.render_done == 0)
3916 ELB(ELBT_BD, "DEICONIFY_APPROVE to all transient", bd->client.win);
3917 _e_border_deiconify_approve_send_all_transient(bd);
3921 bd->client.e.state.deiconify_approve.render_done = 0;
3925 #if _F_ZONE_WINDOW_ROTATION_
3926 if (!bd->client.win)
3928 ELB(ELBT_DFT, "ERR! obj is already deleted", bd->client.win);
3933 if (bd->shading) return;
3934 ecore_x_window_shadow_tree_flush();
3939 if (bd->fullscreen) bd->desk->fullscreen_borders++;
3940 desk = e_desk_current_get(bd->desk->zone);
3941 #ifdef _F_USE_EXTENDED_ICONIFY_
3942 if (e_manager_comp_evas_get(bd->zone->container->manager))
3944 if (bd->await_hide_event > 0)
3945 bd->await_hide_event--;
3948 e_border_desk_set(bd, desk);
3950 edje_object_signal_emit(bd->bg_object, "e,action,uniconify", "e");
3953 ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
3955 ev = E_NEW(E_Event_Border_Uniconify, 1);
3957 e_object_ref(E_OBJECT(bd));
3958 // e_object_breadcrumb_add(E_OBJECT(bd), "border_uniconify_event");
3959 ecore_event_add(E_EVENT_BORDER_UNICONIFY, ev, _e_border_event_border_uniconify_free, NULL);
3961 if (e_config->transient.iconify)
3965 Eina_List *list = _e_border_sub_borders_new(bd);
3967 EINA_LIST_FOREACH(list, l, child)
3969 e_border_uniconify(child);
3971 eina_list_free(list);
3973 e_remember_update(bd);
3977 e_border_stick(E_Border *bd)
3979 E_Event_Border_Stick *ev;
3982 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
3983 if (bd->sticky) return;
3985 e_hints_window_sticky_set(bd, 1);
3988 if (e_config->transient.desktop)
3992 Eina_List *list = _e_border_sub_borders_new(bd);
3994 EINA_LIST_FOREACH(list, l, child)
3997 e_hints_window_sticky_set(child, 1);
3998 e_border_show(child);
4000 eina_list_free(list);
4003 edje_object_signal_emit(bd->bg_object, "e,state,sticky", "e");
4004 ev = E_NEW(E_Event_Border_Stick, 1);
4006 e_object_ref(E_OBJECT(bd));
4007 // e_object_breadcrumb_add(E_OBJECT(bd), "border_stick_event");
4008 ecore_event_add(E_EVENT_BORDER_STICK, ev, _e_border_event_border_stick_free, NULL);
4009 e_remember_update(bd);
4013 e_border_unstick(E_Border *bd)
4015 E_Event_Border_Unstick *ev;
4018 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
4019 /* Set the desk before we unstick the border */
4020 if (!bd->sticky) return;
4022 e_hints_window_sticky_set(bd, 0);
4024 if (e_config->transient.desktop)
4028 Eina_List *list = _e_border_sub_borders_new(bd);
4030 EINA_LIST_FOREACH(list, l, child)
4033 e_hints_window_sticky_set(child, 0);
4035 eina_list_free(list);
4038 edje_object_signal_emit(bd->bg_object, "e,state,unsticky", "e");
4039 ev = E_NEW(E_Event_Border_Unstick, 1);
4041 e_object_ref(E_OBJECT(bd));
4042 // e_object_breadcrumb_add(E_OBJECT(bd), "border_unstick_event");
4043 ecore_event_add(E_EVENT_BORDER_UNSTICK, ev, _e_border_event_border_unstick_free, NULL);
4045 e_border_desk_set(bd, e_desk_current_get(bd->zone));
4046 e_remember_update(bd);
4050 e_border_pinned_set(E_Border *bd,
4058 bd->borderless = set;
4059 bd->user_skip_winlist = set;
4063 stacking = E_STACKING_BELOW;
4068 stacking = E_STACKING_NONE;
4071 e_border_layer_set(bd, layer);
4072 e_hints_window_stacking_set(bd, stacking);
4074 bd->client.border.changed = 1;
4080 e_border_find_by_client_window(Ecore_X_Window win)
4084 bd = eina_hash_find(borders_hash, e_util_winid_str_get(win));
4085 if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
4086 (bd->client.win == win))
4092 e_border_find_all_by_client_window(Ecore_X_Window win)
4096 bd = eina_hash_find(borders_hash, e_util_winid_str_get(win));
4097 if ((bd) && (bd->client.win == win))
4103 e_border_find_by_frame_window(Ecore_X_Window win)
4107 bd = eina_hash_find(borders_hash, e_util_winid_str_get(win));
4108 if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
4109 (bd->bg_win == win))
4115 e_border_find_by_window(Ecore_X_Window win)
4119 bd = eina_hash_find(borders_hash, e_util_winid_str_get(win));
4120 if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
4127 e_border_find_by_alarm(Ecore_X_Sync_Alarm al)
4132 EINA_LIST_FOREACH(borders, l, bd)
4134 if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
4135 (bd->client.netwm.sync.alarm == al))
4142 e_border_focused_get(void)
4148 _e_border_shape_input_rectangle_set(E_Border* bd)
4152 if ((bd->visible) && (bd->shaped_input))
4154 Ecore_X_Rectangle rects[4];
4155 Ecore_X_Window twin, twin2;
4158 twin = ecore_x_window_override_new(bd->zone->container->scratch_win,
4159 0, 0, bd->w, bd->h);
4162 rects[0].width = bd->w;
4163 rects[0].height = bd->client_inset.t;
4165 rects[1].y = bd->client_inset.t;
4166 rects[1].width = bd->client_inset.l;
4167 rects[1].height = bd->h - bd->client_inset.t - bd->client_inset.b;
4168 rects[2].x = bd->w - bd->client_inset.r;
4169 rects[2].y = bd->client_inset.t;
4170 rects[2].width = bd->client_inset.r;
4171 rects[2].height = bd->h - bd->client_inset.t - bd->client_inset.b;
4173 rects[3].y = bd->h - bd->client_inset.b;
4174 rects[3].width = bd->w;
4175 rects[3].height = bd->client_inset.b;
4176 ecore_x_window_shape_input_rectangles_set(twin, rects, 4);
4178 twin2 = ecore_x_window_override_new
4179 (bd->zone->container->scratch_win, 0, 0,
4180 bd->w - bd->client_inset.l - bd->client_inset.r,
4181 bd->h - bd->client_inset.t - bd->client_inset.b);
4184 if ((bd->shading) || (bd->shaded))
4186 if (bd->shade.dir == E_DIRECTION_UP)
4187 y = bd->h - bd->client_inset.t - bd->client_inset.b -
4189 else if (bd->shade.dir == E_DIRECTION_LEFT)
4190 x = bd->w - bd->client_inset.l - bd->client_inset.r -
4193 ecore_x_window_shape_input_window_set_xy(twin2, bd->client.win,
4195 ecore_x_window_shape_input_rectangle_clip(twin2, 0, 0,
4196 bd->w - bd->client_inset.l - bd->client_inset.r,
4197 bd->h - bd->client_inset.t - bd->client_inset.b);
4198 ecore_x_window_shape_input_window_add_xy(twin, twin2,
4200 bd->client_inset.t);
4201 ecore_x_window_shape_input_window_set(bd->win, twin);
4202 ecore_x_window_free(twin2);
4203 ecore_x_window_free(twin);
4207 if (bd->visible) // not shaped input
4209 if (!((bd->comp_hidden) || (bd->tmp_input_hidden > 0)))
4210 ecore_x_composite_window_events_enable(bd->win);
4212 ecore_x_composite_window_events_disable(bd->win);
4216 if (!e_manager_comp_evas_get(bd->zone->container->manager))
4217 ecore_x_composite_window_events_enable(bd->win);
4219 ecore_x_composite_window_events_disable(bd->win);
4225 e_border_idler_before(void)
4234 EINA_LIST_FOREACH(e_manager_list(), ml, man)
4236 EINA_LIST_FOREACH(man->containers, cl, con)
4241 // pass 1 - eval0. fetch properties on new or on change and
4242 // call hooks to decide what to do - maybe move/resize
4243 bl = e_container_border_list_last(con);
4244 while ((bd = e_container_border_list_prev(bl)))
4246 if (bd->changed) _e_border_eval0(bd);
4248 e_container_border_list_free(bl);
4250 // layout hook - this is where a hook gets to figure out what to
4252 _e_border_container_layout_hook(con);
4254 // pass 2 - show windows needing show
4255 bl = e_container_border_list_last(con);
4256 while ((bd = e_container_border_list_prev(bl)))
4258 if ((bd->changes.visible) && (bd->visible) &&
4259 (!bd->new_client) && (!bd->changes.pos) &&
4260 (!bd->changes.size))
4263 bd->changes.visible = 0;
4266 e_container_border_list_free(bl);
4268 // pass 3 - hide windows needing hide and eval (main eval)
4269 bl = e_container_border_list_first(con);
4270 while ((bd = e_container_border_list_next(bl)))
4272 if (e_object_is_del(E_OBJECT(bd))) continue;
4274 if ((bd->changes.visible) && (!bd->visible))
4277 bd->changes.visible = 0;
4280 if (bd->changed) _e_border_eval(bd);
4282 if ((bd->changes.visible) && (bd->visible))
4285 bd->changes.visible = 0;
4288 e_container_border_list_free(bl);
4294 E_Border *bd = NULL, *bd2;
4296 EINA_LIST_FREE(focus_next, bd2)
4297 if ((!bd) && (bd2->visible)) bd = bd2;
4301 /* TODO revert focus when lost here ? */
4307 /* already focused. but anyway dont be so strict, this
4308 fcks up illume setting focus on internal windows */
4313 focus_time = ecore_x_current_time_get();
4317 if ((bd->client.icccm.take_focus) &&
4318 (bd->client.icccm.accepts_focus))
4320 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
4321 /* TODO what if the client didn't take focus ? */
4323 else if (!bd->client.icccm.accepts_focus)
4325 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
4327 else if (!bd->client.icccm.take_focus)
4329 e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
4330 /* e_border_focus_set(bd, 1, 0); */
4334 #ifdef _F_ZONE_WINDOW_ROTATION_
4335 if ((e_config->wm_win_rotation) &&
4338 Ecore_X_Event_Client_Message *msg = NULL;
4340 EINA_LIST_FREE(rot.msgs, msg)
4342 t = msg->message_type;
4343 if (t == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_DONE)
4345 if ((rot.vkbd_ctrl_win) &&
4346 ((Ecore_X_Window)msg->data.l[0] == rot.vkbd_ctrl_win) &&
4349 ELB(ELBT_BD, "GET KBD_ON_PREPARE_DONE", rot.vkbd_ctrl_win);
4350 if (rot.vkbd_show_prepare_timer)
4351 _e_border_vkbd_show(rot.vkbd);
4353 ELB(ELBT_BD, "GET KBD_ON_PREPARE_DONE but skip", rot.vkbd_ctrl_win);
4356 else if (t == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_DONE)
4358 if ((rot.vkbd_ctrl_win) &&
4359 ((Ecore_X_Window)msg->data.l[0] == rot.vkbd_ctrl_win) &&
4362 ELB(ELBT_BD, "GET KBD_OFF_PREPARE_DONE", rot.vkbd_ctrl_win);
4363 if (rot.vkbd_hide_prepare_timer)
4365 _e_border_vkbd_hide(rot.vkbd);
4366 rot.vkbd_hide_prepare_timer = NULL;
4367 e_object_unref(E_OBJECT(rot.vkbd));
4370 ELB(ELBT_BD, "GET KBD_OFF_PREPARE_DONE but skip", rot.vkbd_ctrl_win);
4373 else if (t == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_CONTROL_WINDOW)
4375 rot.vkbd_ctrl_win = msg->data.l[0];
4376 ELB(ELBT_BD, "SET KBD_CONTROL_WIN", rot.vkbd_ctrl_win);
4378 else if (t == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE)
4380 if ((rot.vkbd_ctrl_win) &&
4381 (rot.vkbd_ctrl_win == (Ecore_X_Window)msg->data.l[0]))
4383 ELB(ELBT_ROT, "GET ROT_PREPARE_DONE", rot.vkbd_ctrl_win);
4384 E_Manager *m = e_manager_current_get();
4385 E_Zone *zone = NULL;
4386 if (m) zone = e_util_zone_current_get(m);
4387 if ((zone) && (rot.wait_prepare_done))
4390 _e_border_rotation_change_request(zone);
4391 else if (rot.async_list)
4393 _e_border_rotation_list_flush(rot.async_list, EINA_TRUE);
4394 rot.async_list = NULL;
4396 if (rot.prepare_timer)
4397 ecore_timer_del(rot.prepare_timer);
4398 rot.prepare_timer = NULL;
4399 rot.wait_prepare_done = EINA_FALSE;
4406 rot.fetch = EINA_FALSE;
4412 e_border_client_list(void)
4414 /* FIXME: This should be a somewhat ordered list */
4418 static Ecore_X_Window action_input_win = 0;
4419 static E_Border *action_border = NULL;
4420 static Ecore_Event_Handler *action_handler_key = NULL;
4421 static Ecore_Event_Handler *action_handler_mouse = NULL;
4422 static Ecore_Timer *action_timer = NULL;
4423 static Ecore_X_Rectangle action_orig;
4426 _e_border_show(E_Border *bd)
4431 ecore_evas_show(bd->bg_ecore_evas);
4439 if (!((bd->comp_hidden) || (bd->tmp_input_hidden > 0)))
4441 _e_border_shape_input_rectangle_set(bd);
4443 // ecore_x_composite_window_events_enable(bd->win);
4444 ecore_x_window_ignore_set(bd->win, EINA_FALSE);
4447 ecore_x_window_show(bd->win);
4449 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
4450 ecore_x_window_show(tmp->win);
4454 _e_border_hide(E_Border *bd)
4459 if (!e_manager_comp_evas_get(bd->zone->container->manager))
4461 ecore_x_window_hide(bd->win);
4462 ecore_evas_hide(bd->bg_ecore_evas);
4464 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
4465 ecore_x_window_hide(tmp->win);
4469 ecore_x_composite_window_events_disable(bd->win);
4470 ecore_x_window_ignore_set(bd->win, EINA_TRUE);
4475 _e_border_action_input_win_del(void)
4477 if (!action_input_win)
4480 e_grabinput_release(action_input_win, action_input_win);
4481 ecore_x_window_free(action_input_win);
4482 action_input_win = 0;
4487 _e_border_action_input_win_new(E_Border *bd)
4489 if (!action_input_win)
4491 Ecore_X_Window parent = bd->zone->container->win;
4492 action_input_win = ecore_x_window_input_new(parent, 0, 0, 1, 1);
4493 if (!action_input_win)
4497 ecore_x_window_show(action_input_win);
4498 if (e_grabinput_get(action_input_win, 0, action_input_win))
4501 _e_border_action_input_win_del();
4506 _e_border_action_finish(void)
4508 _e_border_action_input_win_del();
4512 ecore_timer_del(action_timer);
4513 action_timer = NULL;
4516 if (action_handler_key)
4518 ecore_event_handler_del(action_handler_key);
4519 action_handler_key = NULL;
4522 if (action_handler_mouse)
4524 ecore_event_handler_del(action_handler_mouse);
4525 action_handler_mouse = NULL;
4528 action_border = NULL;
4532 _e_border_action_init(E_Border *bd)
4534 action_orig.x = bd->x;
4535 action_orig.y = bd->y;
4536 action_orig.width = bd->w;
4537 action_orig.height = bd->h;
4543 _e_border_action_restore_orig(E_Border *bd)
4545 if (action_border != bd)
4548 e_border_move_resize(bd, action_orig.x, action_orig.y, action_orig.width, action_orig.height);
4552 _e_border_key_down_modifier_apply(int modifier,
4555 if (modifier & ECORE_EVENT_MODIFIER_CTRL)
4557 else if (modifier & ECORE_EVENT_MODIFIER_ALT)
4570 _e_border_action_move_timeout(void *data __UNUSED__)
4572 _e_border_move_end(action_border);
4573 _e_border_action_finish();
4574 return ECORE_CALLBACK_CANCEL;
4578 _e_border_action_move_timeout_add(void)
4581 ecore_timer_del(action_timer);
4582 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_border_action_move_timeout, NULL);
4586 _e_border_move_key_down(void *data __UNUSED__,
4587 int type __UNUSED__,
4590 Ecore_Event_Key *ev = event;
4593 if (ev->event_window != action_input_win)
4594 return ECORE_CALLBACK_PASS_ON;
4597 fputs("ERROR: no action_border!\n", stderr);
4601 x = action_border->x;
4602 y = action_border->y;
4604 if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0))
4605 y -= _e_border_key_down_modifier_apply(ev->modifiers, e_config->border_keyboard.move.dy);
4606 else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0))
4607 y += _e_border_key_down_modifier_apply(ev->modifiers, e_config->border_keyboard.move.dy);
4608 else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0))
4609 x -= _e_border_key_down_modifier_apply(ev->modifiers, e_config->border_keyboard.move.dx);
4610 else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0))
4611 x += _e_border_key_down_modifier_apply(ev->modifiers, e_config->border_keyboard.move.dx);
4612 else if (strcmp(ev->key, "Return") == 0)
4614 else if (strcmp(ev->key, "Escape") == 0)
4616 _e_border_action_restore_orig(action_border);
4619 else if ((strncmp(ev->key, "Control", sizeof("Control") - 1) != 0) &&
4620 (strncmp(ev->key, "Alt", sizeof("Alt") - 1) != 0))
4623 e_border_move(action_border, x, y);
4624 _e_border_action_move_timeout_add();
4626 return ECORE_CALLBACK_PASS_ON;
4629 _e_border_move_end(action_border);
4630 _e_border_action_finish();
4631 return ECORE_CALLBACK_DONE;
4635 _e_border_move_mouse_down(void *data __UNUSED__,
4636 int type __UNUSED__,
4639 Ecore_Event_Mouse_Button *ev = event;
4641 if (ev->event_window != action_input_win)
4642 return ECORE_CALLBACK_PASS_ON;
4645 fputs("ERROR: no action_border!\n", stderr);
4647 _e_border_move_end(action_border);
4648 _e_border_action_finish();
4649 return ECORE_CALLBACK_DONE;
4653 e_border_act_move_keyboard(E_Border *bd)
4658 if (!_e_border_move_begin(bd))
4661 if (!_e_border_action_input_win_new(bd))
4663 _e_border_move_end(bd);
4667 _e_border_action_init(bd);
4668 _e_border_action_move_timeout_add();
4669 _e_border_move_update(bd);
4671 if (action_handler_key)
4672 ecore_event_handler_del(action_handler_key);
4673 action_handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_border_move_key_down, NULL);
4675 if (action_handler_mouse)
4676 ecore_event_handler_del(action_handler_mouse);
4677 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_border_move_mouse_down, NULL);
4681 _e_border_action_resize_timeout(void *data __UNUSED__)
4683 _e_border_resize_end(action_border);
4684 _e_border_action_finish();
4685 return ECORE_CALLBACK_CANCEL;
4689 _e_border_action_resize_timeout_add(void)
4692 ecore_timer_del(action_timer);
4693 action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_border_action_resize_timeout, NULL);
4697 _e_border_resize_key_down(void *data __UNUSED__,
4698 int type __UNUSED__,
4701 Ecore_Event_Key *ev = event;
4704 if (ev->event_window != action_input_win)
4705 return ECORE_CALLBACK_PASS_ON;
4708 fputs("ERROR: no action_border!\n", stderr);
4712 w = action_border->w;
4713 h = action_border->h;
4715 dx = e_config->border_keyboard.resize.dx;
4716 if (dx < action_border->client.icccm.step_w)
4717 dx = action_border->client.icccm.step_w;
4718 dx = _e_border_key_down_modifier_apply(ev->modifiers, dx);
4719 if (dx < action_border->client.icccm.step_w)
4720 dx = action_border->client.icccm.step_w;
4722 dy = e_config->border_keyboard.resize.dy;
4723 if (dy < action_border->client.icccm.step_h)
4724 dy = action_border->client.icccm.step_h;
4725 dy = _e_border_key_down_modifier_apply(ev->modifiers, dy);
4726 if (dy < action_border->client.icccm.step_h)
4727 dy = action_border->client.icccm.step_h;
4729 if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0))
4731 else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0))
4733 else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0))
4735 else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0))
4737 else if (strcmp(ev->key, "Return") == 0)
4739 else if (strcmp(ev->key, "Escape") == 0)
4741 _e_border_action_restore_orig(action_border);
4744 else if ((strncmp(ev->key, "Control", sizeof("Control") - 1) != 0) &&
4745 (strncmp(ev->key, "Alt", sizeof("Alt") - 1) != 0))
4748 e_border_resize_limit(action_border, &w, &h);
4749 e_border_resize(action_border, w, h);
4750 _e_border_action_resize_timeout_add();
4752 return ECORE_CALLBACK_PASS_ON;
4755 _e_border_resize_end(action_border);
4756 _e_border_action_finish();
4757 return ECORE_CALLBACK_DONE;
4761 _e_border_resize_mouse_down(void *data __UNUSED__,
4762 int type __UNUSED__,
4765 Ecore_Event_Mouse_Button *ev = event;
4767 if (ev->event_window != action_input_win)
4768 return ECORE_CALLBACK_PASS_ON;
4771 fputs("ERROR: no action_border!\n", stderr);
4773 _e_border_resize_end(action_border);
4774 _e_border_action_finish();
4775 return ECORE_CALLBACK_DONE;
4779 e_border_act_resize_keyboard(E_Border *bd)
4784 if (!_e_border_resize_begin(bd))
4787 if (!_e_border_action_input_win_new(bd))
4789 _e_border_resize_end(bd);
4793 _e_border_action_init(bd);
4794 _e_border_action_resize_timeout_add();
4795 _e_border_resize_update(bd);
4797 if (action_handler_key)
4798 ecore_event_handler_del(action_handler_key);
4799 action_handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_border_resize_key_down, NULL);
4801 if (action_handler_mouse)
4802 ecore_event_handler_del(action_handler_mouse);
4803 action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_border_resize_mouse_down, NULL);
4807 e_border_act_move_begin(E_Border *bd,
4808 Ecore_Event_Mouse_Button *ev)
4811 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
4812 if ((bd->resize_mode != RESIZE_NONE) || (bd->moving)) return;
4813 if (!_e_border_move_begin(bd))
4816 e_zone_edge_disable();
4818 _e_border_pointer_move_begin(bd);
4823 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->buttons);
4824 _e_border_moveinfo_gather(bd, source);
4829 e_border_act_move_end(E_Border *bd,
4830 Ecore_Event_Mouse_Button *ev __UNUSED__)
4833 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
4834 if (!bd->moving) return;
4836 _e_border_pointer_move_end(bd);
4837 e_zone_edge_enable();
4838 _e_border_move_end(bd);
4839 e_zone_flip_coords_handle(bd->zone, -1, -1);
4843 e_border_act_resize_begin(E_Border *bd,
4844 Ecore_Event_Mouse_Button *ev)
4847 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
4848 if (bd->lock_user_size) return;
4849 if ((bd->resize_mode != RESIZE_NONE) || (bd->moving)) return;
4850 if (!_e_border_resize_begin(bd))
4852 if (bd->mouse.current.mx < (bd->x + bd->w / 2))
4854 if (bd->mouse.current.my < (bd->y + bd->h / 2))
4856 bd->resize_mode = RESIZE_TL;
4857 GRAV_SET(bd, ECORE_X_GRAVITY_SE);
4861 bd->resize_mode = RESIZE_BL;
4862 GRAV_SET(bd, ECORE_X_GRAVITY_NE);
4867 if (bd->mouse.current.my < (bd->y + bd->h / 2))
4869 bd->resize_mode = RESIZE_TR;
4870 GRAV_SET(bd, ECORE_X_GRAVITY_SW);
4874 bd->resize_mode = RESIZE_BR;
4875 GRAV_SET(bd, ECORE_X_GRAVITY_NW);
4878 _e_border_pointer_resize_begin(bd);
4883 snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->buttons);
4884 _e_border_moveinfo_gather(bd, source);
4889 e_border_act_resize_end(E_Border *bd,
4890 Ecore_Event_Mouse_Button *ev __UNUSED__)
4893 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
4894 if (bd->resize_mode != RESIZE_NONE)
4896 _e_border_pointer_resize_end(bd);
4897 bd->resize_mode = RESIZE_NONE;
4898 _e_border_resize_end(bd);
4899 bd->changes.reset_gravity = 1;
4905 e_border_act_menu_begin(E_Border *bd,
4906 Ecore_Event_Mouse_Button *ev,
4910 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
4913 e_int_border_menu_show(bd,
4914 bd->x + bd->fx.x + ev->x - bd->zone->container->x,
4915 bd->y + bd->fx.y + ev->y - bd->zone->container->y, key,
4922 ecore_x_pointer_xy_get(bd->zone->container->win, &x, &y);
4923 e_int_border_menu_show(bd, x, y, key, 0);
4928 e_border_act_close_begin(E_Border *bd)
4931 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
4932 if (bd->lock_close) return;
4933 if (bd->client.icccm.delete_request)
4935 bd->delete_requested = 1;
4936 ecore_x_window_delete_request_send(bd->client.win);
4937 if (bd->client.netwm.ping)
4940 else if (e_config->kill_if_close_not_possible)
4942 e_border_act_kill_begin(bd);
4947 e_border_act_kill_begin(E_Border *bd)
4950 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
4951 if (bd->internal) return;
4952 if (bd->lock_close) return;
4953 if ((bd->client.netwm.pid > 1) && (e_config->kill_process))
4955 kill(bd->client.netwm.pid, SIGINT);
4956 bd->kill_timer = ecore_timer_add(e_config->kill_timer_wait,
4957 _e_border_cb_kill_timer, bd);
4961 if (!bd->internal) ecore_x_kill(bd->client.win);
4966 e_border_icon_add(E_Border *bd,
4971 E_OBJECT_CHECK_RETURN(bd, NULL);
4972 E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, NULL);
4977 if (!bd->internal_icon)
4979 o = e_icon_add(evas);
4980 e_util_icon_theme_set(o, "enlightenment");
4984 if (!bd->internal_icon_key)
4988 ext = strrchr(bd->internal_icon, '.');
4989 if ((ext) && ((!strcmp(ext, ".edj"))))
4991 o = edje_object_add(evas);
4992 if (!edje_object_file_set(o, bd->internal_icon, "icon"))
4993 e_util_icon_theme_set(o, "enlightenment");
4997 o = e_icon_add(evas);
4998 e_icon_file_set(o, bd->internal_icon);
5002 o = e_icon_add(evas);
5003 if (!e_util_icon_theme_set(o, bd->internal_icon))
5004 e_util_icon_theme_set(o, "enlightenment");
5009 o = edje_object_add(evas);
5010 edje_object_file_set(o, bd->internal_icon,
5011 bd->internal_icon_key);
5016 if ((e_config->use_app_icon) && (bd->icon_preference != E_ICON_PREF_USER))
5018 if (bd->client.netwm.icons)
5020 o = e_icon_add(evas);
5021 e_icon_data_set(o, bd->client.netwm.icons[0].data,
5022 bd->client.netwm.icons[0].width,
5023 bd->client.netwm.icons[0].height);
5024 e_icon_alpha_set(o, 1);
5030 if ((bd->desktop) && (bd->icon_preference != E_ICON_PREF_NETWM))
5032 o = e_icon_add(evas);
5035 e_icon_fdo_icon_set(o, bd->desktop->icon);
5039 else if (bd->client.netwm.icons)
5041 o = e_icon_add(evas);
5042 e_icon_data_set(o, bd->client.netwm.icons[0].data,
5043 bd->client.netwm.icons[0].width,
5044 bd->client.netwm.icons[0].height);
5045 e_icon_alpha_set(o, 1);
5050 o = e_icon_add(evas);
5051 e_util_icon_theme_set(o, "unknown");
5056 e_border_button_bindings_ungrab_all(void)
5061 EINA_LIST_FOREACH(borders, l, bd)
5063 e_focus_setdown(bd);
5064 e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
5065 e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
5070 e_border_button_bindings_grab_all(void)
5075 EINA_LIST_FOREACH(borders, l, bd)
5077 e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
5078 e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
5084 e_border_focus_stack_get(void)
5090 e_border_raise_stack_get(void)
5096 e_border_lost_windows_get(E_Zone *zone)
5098 Eina_List *list = NULL, *l;
5100 int loss_overlap = 5;
5102 E_OBJECT_CHECK_RETURN(zone, NULL);
5103 E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
5104 EINA_LIST_FOREACH(borders, l, bd)
5109 if ((bd->zone != zone) ||
5110 (bd->zone->container != zone->container))
5113 if (!E_INTERSECTS(bd->zone->x + loss_overlap,
5114 bd->zone->y + loss_overlap,
5115 bd->zone->w - (2 * loss_overlap),
5116 bd->zone->h - (2 * loss_overlap),
5117 bd->x, bd->y, bd->w, bd->h))
5119 list = eina_list_append(list, bd);
5121 else if ((!E_CONTAINS(bd->zone->x, bd->zone->y,
5122 bd->zone->w, bd->zone->h,
5123 bd->x, bd->y, bd->w, bd->h)) &&
5126 Ecore_X_Rectangle *rect;
5129 rect = ecore_x_window_shape_rectangles_get(bd->win, &num);
5135 for (i = 0; i < num; i++)
5137 if (E_INTERSECTS(bd->zone->x + loss_overlap,
5138 bd->zone->y + loss_overlap,
5139 bd->zone->w - (2 * loss_overlap),
5140 bd->zone->h - (2 * loss_overlap),
5141 rect[i].x, rect[i].y,
5142 (int)rect[i].width, (int)rect[i].height))
5150 list = eina_list_append(list, bd);
5158 e_border_ping(E_Border *bd)
5161 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5162 if (!e_config->ping_clients) return;
5164 ecore_x_netwm_ping_send(bd->client.win);
5165 bd->ping = ecore_loop_time_get();
5166 if (bd->ping_poller) ecore_poller_del(bd->ping_poller);
5167 bd->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
5168 e_config->ping_clients_interval,
5169 _e_border_cb_ping_poller, bd);
5173 e_border_move_cancel(void)
5177 if (bdmove->cur_mouse_action)
5182 e_object_ref(E_OBJECT(bd));
5183 if (bd->cur_mouse_action->func.end_mouse)
5184 bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", NULL);
5185 else if (bd->cur_mouse_action->func.end)
5186 bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
5187 e_object_unref(E_OBJECT(bd->cur_mouse_action));
5188 bd->cur_mouse_action = NULL;
5189 e_object_unref(E_OBJECT(bd));
5192 _e_border_move_end(bdmove);
5197 e_border_resize_cancel(void)
5201 if (bdresize->cur_mouse_action)
5206 e_object_ref(E_OBJECT(bd));
5207 if (bd->cur_mouse_action->func.end_mouse)
5208 bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", NULL);
5209 else if (bd->cur_mouse_action->func.end)
5210 bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
5211 e_object_unref(E_OBJECT(bd->cur_mouse_action));
5212 bd->cur_mouse_action = NULL;
5213 e_object_unref(E_OBJECT(bd));
5217 bdresize->resize_mode = RESIZE_NONE;
5218 _e_border_resize_end(bdresize);
5224 e_border_frame_recalc(E_Border *bd)
5226 if (!bd->bg_object) return;
5228 bd->w -= (bd->client_inset.l + bd->client_inset.r);
5229 bd->h -= (bd->client_inset.t + bd->client_inset.b);
5231 _e_border_client_inset_calc(bd);
5233 bd->w += (bd->client_inset.l + bd->client_inset.r);
5234 bd->h += (bd->client_inset.t + bd->client_inset.b);
5237 bd->changes.size = 1;
5238 if ((bd->shaped) || (bd->client.shaped))
5240 bd->need_shape_merge = 1;
5241 bd->need_shape_export = 1;
5243 if (bd->shaped_input)
5245 bd->need_shape_merge = 1;
5247 _e_border_client_move_resize_send(bd);
5251 e_border_immortal_windows_get(void)
5253 Eina_List *list = NULL, *l;
5256 EINA_LIST_FOREACH(borders, l, bd)
5259 list = eina_list_append(list, bd);
5265 e_border_name_get(const E_Border *bd)
5267 E_OBJECT_CHECK_RETURN(bd, "");
5268 E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, "");
5269 if (bd->client.netwm.name)
5270 return bd->client.netwm.name;
5271 else if (bd->client.icccm.title)
5272 return bd->client.icccm.title;
5277 e_border_signal_move_begin(E_Border *bd,
5279 const char *src __UNUSED__)
5282 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5284 if ((bd->resize_mode != RESIZE_NONE) || (bd->moving)) return;
5285 if (!_e_border_move_begin(bd)) return;
5287 _e_border_pointer_move_begin(bd);
5288 e_zone_edge_disable();
5289 _e_border_moveinfo_gather(bd, sig);
5290 if (bd->cur_mouse_action)
5292 if ((!bd->cur_mouse_action->func.end_mouse) &&
5293 (!bd->cur_mouse_action->func.end))
5294 bd->cur_mouse_action = NULL;
5296 e_object_unref(E_OBJECT(bd->cur_mouse_action));
5298 bd->cur_mouse_action = e_action_find("window_move");
5299 if (bd->cur_mouse_action)
5300 e_object_ref(E_OBJECT(bd->cur_mouse_action));
5304 e_border_signal_move_end(E_Border *bd,
5305 const char *sig __UNUSED__,
5306 const char *src __UNUSED__)
5309 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5310 if (!bd->moving) return;
5312 _e_border_pointer_move_end(bd);
5313 e_zone_edge_enable();
5314 _e_border_move_end(bd);
5315 e_zone_flip_coords_handle(bd->zone, -1, -1);
5319 e_border_resizing_get(E_Border *bd)
5321 E_OBJECT_CHECK_RETURN(bd, 0);
5322 E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, 0);
5323 if (bd->resize_mode == RESIZE_NONE) return 0;
5328 e_border_signal_resize_begin(E_Border *bd,
5331 const char *src __UNUSED__)
5333 Ecore_X_Gravity grav = ECORE_X_GRAVITY_NW;
5334 int resize_mode = RESIZE_BR;
5337 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5339 if ((bd->resize_mode != RESIZE_NONE) || (bd->moving)) return;
5340 if (!_e_border_resize_begin(bd))
5342 if (!strcmp(dir, "tl"))
5344 resize_mode = RESIZE_TL;
5345 grav = ECORE_X_GRAVITY_SE;
5347 else if (!strcmp(dir, "t"))
5349 resize_mode = RESIZE_T;
5350 grav = ECORE_X_GRAVITY_S;
5352 else if (!strcmp(dir, "tr"))
5354 resize_mode = RESIZE_TR;
5355 grav = ECORE_X_GRAVITY_SW;
5357 else if (!strcmp(dir, "r"))
5359 resize_mode = RESIZE_R;
5360 grav = ECORE_X_GRAVITY_W;
5362 else if (!strcmp(dir, "br"))
5364 resize_mode = RESIZE_BR;
5365 grav = ECORE_X_GRAVITY_NW;
5367 else if (!strcmp(dir, "b"))
5369 resize_mode = RESIZE_B;
5370 grav = ECORE_X_GRAVITY_N;
5372 else if (!strcmp(dir, "bl"))
5374 resize_mode = RESIZE_BL;
5375 grav = ECORE_X_GRAVITY_NE;
5377 else if (!strcmp(dir, "l"))
5379 resize_mode = RESIZE_L;
5380 grav = ECORE_X_GRAVITY_E;
5382 bd->resize_mode = resize_mode;
5383 _e_border_pointer_resize_begin(bd);
5384 _e_border_moveinfo_gather(bd, sig);
5386 if (bd->cur_mouse_action)
5388 if ((!bd->cur_mouse_action->func.end_mouse) &&
5389 (!bd->cur_mouse_action->func.end))
5390 bd->cur_mouse_action = NULL;
5392 e_object_unref(E_OBJECT(bd->cur_mouse_action));
5394 bd->cur_mouse_action = e_action_find("window_resize");
5395 if (bd->cur_mouse_action)
5396 e_object_ref(E_OBJECT(bd->cur_mouse_action));
5400 e_border_signal_resize_end(E_Border *bd,
5401 const char *dir __UNUSED__,
5402 const char *sig __UNUSED__,
5403 const char *src __UNUSED__)
5406 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5407 if (bd->resize_mode == RESIZE_NONE) return;
5408 _e_border_resize_handle(bd);
5409 _e_border_pointer_resize_end(bd);
5410 bd->resize_mode = RESIZE_NONE;
5411 _e_border_resize_end(bd);
5412 bd->changes.reset_gravity = 1;
5417 e_border_resize_limit(E_Border *bd,
5424 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
5425 *w -= bd->client_inset.l + bd->client_inset.r;
5426 *h -= bd->client_inset.t + bd->client_inset.b;
5429 if ((bd->client.icccm.base_w >= 0) &&
5430 (bd->client.icccm.base_h >= 0))
5434 tw = *w - bd->client.icccm.base_w;
5435 th = *h - bd->client.icccm.base_h;
5438 a = (double)(tw) / (double)(th);
5439 if ((bd->client.icccm.min_aspect != 0.0) &&
5440 (a < bd->client.icccm.min_aspect))
5442 th = tw / bd->client.icccm.max_aspect;
5443 *h = th + bd->client.icccm.base_h;
5445 else if ((bd->client.icccm.max_aspect != 0.0) &&
5446 (a > bd->client.icccm.max_aspect))
5448 tw = th * bd->client.icccm.max_aspect;
5449 *w = tw + bd->client.icccm.base_w;
5454 a = (double)*w / (double)*h;
5455 if ((bd->client.icccm.min_aspect != 0.0) &&
5456 (a < bd->client.icccm.min_aspect))
5457 *h = *w / bd->client.icccm.min_aspect;
5458 else if ((bd->client.icccm.max_aspect != 0.0) &&
5459 (a > bd->client.icccm.max_aspect))
5460 *w = *h * bd->client.icccm.max_aspect;
5462 if (bd->client.icccm.step_w > 0)
5464 if (bd->client.icccm.base_w >= 0)
5465 *w = bd->client.icccm.base_w +
5466 (((*w - bd->client.icccm.base_w) / bd->client.icccm.step_w) *
5467 bd->client.icccm.step_w);
5469 *w = bd->client.icccm.min_w +
5470 (((*w - bd->client.icccm.min_w) / bd->client.icccm.step_w) *
5471 bd->client.icccm.step_w);
5473 if (bd->client.icccm.step_h > 0)
5475 if (bd->client.icccm.base_h >= 0)
5476 *h = bd->client.icccm.base_h +
5477 (((*h - bd->client.icccm.base_h) / bd->client.icccm.step_h) *
5478 bd->client.icccm.step_h);
5480 *h = bd->client.icccm.min_h +
5481 (((*h - bd->client.icccm.min_h) / bd->client.icccm.step_h) *
5482 bd->client.icccm.step_h);
5488 if (*w > bd->client.icccm.max_w) *w = bd->client.icccm.max_w;
5489 else if (*w < bd->client.icccm.min_w)
5490 *w = bd->client.icccm.min_w;
5491 if (*h > bd->client.icccm.max_h) *h = bd->client.icccm.max_h;
5492 else if (*h < bd->client.icccm.min_h)
5493 *h = bd->client.icccm.min_h;
5495 *w += bd->client_inset.l + bd->client_inset.r;
5496 *h += bd->client_inset.t + bd->client_inset.b;
5499 /* local subsystem functions */
5501 _e_border_free(E_Border *bd)
5503 #ifdef _F_USE_DESK_WINDOW_PROFILE_
5506 if (bd->client.e.state.video_parent && bd->client.e.state.video_parent_border)
5508 bd->client.e.state.video_parent_border->client.e.state.video_child =
5510 (bd->client.e.state.video_parent_border->client.e.state.video_child,
5513 if (bd->client.e.state.video_child)
5517 EINA_LIST_FREE(bd->client.e.state.video_child, tmp)
5519 tmp->client.e.state.video_parent_border = NULL;
5524 efreet_desktop_free(bd->desktop);
5529 ecore_idle_enterer_del(bd->post_job);
5530 bd->post_job = NULL;
5534 e_object_del(E_OBJECT(bd->pointer));
5538 _e_border_resize_end(bd);
5540 _e_border_move_end(bd);
5541 /* TODO: Other states to end before dying? */
5543 if (bd->cur_mouse_action)
5545 e_object_unref(E_OBJECT(bd->cur_mouse_action));
5546 bd->cur_mouse_action = NULL;
5549 E_FREE(bd->shape_rects);
5550 bd->shape_rects_num = 0;
5552 if (bd->dangling_ref_check)
5554 ecore_timer_del(bd->dangling_ref_check);
5555 bd->dangling_ref_check = NULL;
5560 ecore_timer_del(bd->kill_timer);
5561 bd->kill_timer = NULL;
5563 if (bd->ping_poller)
5565 ecore_poller_del(bd->ping_poller);
5566 bd->ping_poller = NULL;
5568 E_FREE_LIST(bd->pending_move_resize, free);
5570 if (bd->shade.anim) ecore_animator_del(bd->shade.anim);
5571 if (bd->border_menu) e_menu_deactivate(bd->border_menu);
5573 if (bd->border_locks_dialog)
5575 e_object_del(E_OBJECT(bd->border_locks_dialog));
5576 bd->border_locks_dialog = NULL;
5578 if (bd->border_remember_dialog)
5580 e_object_del(E_OBJECT(bd->border_remember_dialog));
5581 bd->border_remember_dialog = NULL;
5583 if (bd->border_border_dialog)
5585 e_object_del(E_OBJECT(bd->border_border_dialog));
5586 bd->border_border_dialog = NULL;
5588 if (bd->border_prop_dialog)
5590 e_object_del(E_OBJECT(bd->border_prop_dialog));
5591 bd->border_prop_dialog = NULL;
5594 e_int_border_menu_del(bd);
5599 focus_next = eina_list_remove(focus_next, bd);
5601 if ((focused == bd) ||
5602 (e_grabinput_last_focus_win_get() == bd->client.win))
5604 if ((!focus_next) && (!focusing))
5606 e_grabinput_focus(bd->zone->container->bg_win,
5607 E_FOCUS_METHOD_PASSIVE);
5608 e_hints_active_window_set(bd->zone->container->manager, NULL);
5613 E_FREE_LIST(bd->handlers, ecore_event_handler_del);
5619 bd->remember = NULL;
5620 e_remember_unuse(rem);
5622 if (!bd->already_unparented)
5624 ecore_x_window_reparent(bd->client.win, bd->zone->container->manager->root,
5625 bd->x + bd->client_inset.l, bd->y + bd->client_inset.t);
5626 ecore_x_window_save_set_del(bd->client.win);
5627 bd->already_unparented = 1;
5629 if (bd->group) eina_list_free(bd->group);
5630 if (bd->transients) eina_list_free(bd->transients);
5631 if (bd->stick_desks) eina_list_free(bd->stick_desks);
5632 if (bd->client.netwm.icons)
5635 for (i = 0; i < bd->client.netwm.num_icons; i++)
5636 free(bd->client.netwm.icons[i].data);
5637 free(bd->client.netwm.icons);
5639 if (bd->client.netwm.extra_types)
5640 free(bd->client.netwm.extra_types);
5641 if (bd->client.border.name)
5642 eina_stringshare_del(bd->client.border.name);
5644 eina_stringshare_del(bd->bordername);
5645 if (bd->client.icccm.name)
5646 eina_stringshare_del(bd->client.icccm.name);
5647 if (bd->client.icccm.class)
5649 if (!strcmp(bd->client.icccm.class, "Vmplayer"))
5650 e_bindings_mapping_change_enable(EINA_TRUE);
5651 eina_stringshare_del(bd->client.icccm.class);
5653 if (bd->client.icccm.title)
5654 eina_stringshare_del(bd->client.icccm.title);
5655 if (bd->client.icccm.icon_name)
5656 eina_stringshare_del(bd->client.icccm.icon_name);
5657 if (bd->client.icccm.machine)
5658 eina_stringshare_del(bd->client.icccm.machine);
5659 if (bd->client.icccm.window_role)
5660 eina_stringshare_del(bd->client.icccm.window_role);
5662 if ((bd->client.icccm.command.argc > 0) && (bd->client.icccm.command.argv))
5666 for (i = 0; i < bd->client.icccm.command.argc; i++)
5667 free(bd->client.icccm.command.argv[i]);
5668 free(bd->client.icccm.command.argv);
5670 if (bd->client.netwm.name)
5671 eina_stringshare_del(bd->client.netwm.name);
5672 if (bd->client.netwm.icon_name)
5673 eina_stringshare_del(bd->client.netwm.icon_name);
5674 e_object_del(E_OBJECT(bd->shape));
5675 if (bd->internal_icon) eina_stringshare_del(bd->internal_icon);
5676 if (bd->internal_icon_key) eina_stringshare_del(bd->internal_icon_key);
5677 if (bd->icon_object) evas_object_del(bd->icon_object);
5678 #ifdef _F_USE_DESK_WINDOW_PROFILE_
5679 EINA_LIST_FREE(bd->client.e.state.profiles, str)
5681 if (str) eina_stringshare_del(str);
5683 bd->client.e.state.profiles = NULL;
5684 if (bd->client.e.state.profile)
5685 eina_stringshare_del(bd->client.e.state.profile);
5686 bd->client.e.state.profile = NULL;
5688 #ifdef _F_ZONE_WINDOW_ROTATION_
5689 if (e_config->wm_win_rotation)
5691 bd->client.e.fetch.rot.app_set = 0;
5692 bd->client.e.state.rot.preferred_rot = -1;
5694 if (bd->client.e.state.rot.available_rots)
5695 E_FREE(bd->client.e.state.rot.available_rots);
5697 _e_border_rotation_list_remove(bd);
5698 if ((rot.vkbd) && (rot.vkbd == bd))
5700 ELB(ELBT_BD, "UNSET VKBD", bd->client.win);
5702 if (rot.vkbd_ctrl_win)
5704 ELB(ELBT_BD, "SET KBD_OFF", 0);
5705 ecore_x_e_virtual_keyboard_state_set
5706 (rot.vkbd_ctrl_win, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
5709 rot.vkbd_hide_prepare_done = EINA_FALSE;
5710 if (rot.vkbd_hide_prepare_timer)
5711 ecore_timer_del(rot.vkbd_hide_prepare_timer);
5712 rot.vkbd_hide_prepare_timer = NULL;
5713 if (rot.vkbd_hide_timer)
5714 ecore_timer_del(rot.vkbd_hide_timer);
5715 rot.vkbd_hide_timer = NULL;
5717 rot.vkbd_show_prepare_done = EINA_FALSE;
5718 if (rot.vkbd_show_prepare_timer)
5719 ecore_timer_del(rot.vkbd_show_prepare_timer);
5720 rot.vkbd_show_prepare_timer = NULL;
5721 if (rot.vkbd_show_timer)
5722 ecore_timer_del(rot.vkbd_show_timer);
5723 rot.vkbd_show_timer = NULL;
5725 else if ((rot.vkbd_prediction) &&
5726 (rot.vkbd_prediction == bd))
5727 rot.vkbd_prediction = NULL;
5730 #ifdef _F_DEICONIFY_APPROVE_
5731 if (bd->client.e.state.deiconify_approve.pending_job)
5733 ecore_job_del(bd->client.e.state.deiconify_approve.pending_job);
5734 bd->client.e.state.deiconify_approve.pending_job = NULL;
5737 evas_object_del(bd->bg_object);
5738 e_canvas_del(bd->bg_ecore_evas);
5739 ecore_evas_free(bd->bg_ecore_evas);
5740 ecore_x_window_free(bd->client.shell_win);
5741 e_focus_setdown(bd);
5742 e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
5743 e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
5744 ecore_x_window_free(bd->win);
5746 eina_hash_del(borders_hash, e_util_winid_str_get(bd->client.win), bd);
5747 eina_hash_del(borders_hash, e_util_winid_str_get(bd->bg_win), bd);
5748 eina_hash_del(borders_hash, e_util_winid_str_get(bd->win), bd);
5749 borders = eina_list_remove(borders, bd);
5750 focus_stack = eina_list_remove(focus_stack, bd);
5751 raise_stack = eina_list_remove(raise_stack, bd);
5753 e_container_border_remove(bd);
5759 _e_border_del_dangling_ref_check(void *data)
5765 printf("EEK EEK border still around 1 second after being deleted!\n");
5766 printf("%p, %i, \"%s\" [\"%s\" \"%s\"]\n",
5767 bd, e_object_ref_get(E_OBJECT(bd)), bd->client.icccm.title,
5768 bd->client.icccm.name, bd->client.icccm.class);
5769 // e_object_breadcrumb_debug(E_OBJECT(bd));
5776 _e_border_del(E_Border *bd)
5778 E_Event_Border_Remove *ev;
5781 #ifdef _F_BORDER_HOOK_PATCH_
5782 _e_border_hook_call(E_BORDER_HOOK_DEL_BORDER, bd);
5793 focus_next = eina_list_remove(focus_next, bd);
5795 if (bd->fullscreen) bd->desk->fullscreen_borders--;
5797 if ((drag_border) && (drag_border->data == bd))
5799 e_object_del(E_OBJECT(drag_border));
5802 if (bd->border_menu) e_menu_deactivate(bd->border_menu);
5804 if (bd->border_locks_dialog)
5806 e_object_del(E_OBJECT(bd->border_locks_dialog));
5807 bd->border_locks_dialog = NULL;
5809 if (bd->border_remember_dialog)
5811 e_object_del(E_OBJECT(bd->border_remember_dialog));
5812 bd->border_remember_dialog = NULL;
5814 if (bd->border_border_dialog)
5816 e_object_del(E_OBJECT(bd->border_border_dialog));
5817 bd->border_border_dialog = NULL;
5819 if (bd->border_prop_dialog)
5821 e_object_del(E_OBJECT(bd->border_prop_dialog));
5822 bd->border_prop_dialog = NULL;
5825 e_int_border_menu_del(bd);
5827 if (bd->raise_timer)
5829 ecore_timer_del(bd->raise_timer);
5830 bd->raise_timer = NULL;
5832 if (!bd->already_unparented)
5834 ecore_x_window_reparent(bd->client.win,
5835 bd->zone->container->manager->root,
5836 bd->x + bd->client_inset.l,
5837 bd->y + bd->client_inset.t);
5838 ecore_x_window_save_set_del(bd->client.win);
5839 bd->already_unparented = 1;
5840 // bd->client.win = 0;
5842 bd->already_unparented = 1;
5844 if ((!bd->new_client) && (!stopping))
5846 ev = E_NEW(E_Event_Border_Remove, 1);
5848 e_object_ref(E_OBJECT(bd));
5849 // e_object_breadcrumb_add(E_OBJECT(bd), "border_remove_event");
5850 ecore_event_add(E_EVENT_BORDER_REMOVE, ev, _e_border_event_border_remove_free, NULL);
5855 bd->parent->transients = eina_list_remove(bd->parent->transients, bd);
5856 if (bd->parent->modal == bd)
5858 ecore_x_event_mask_unset(bd->parent->client.win, ECORE_X_EVENT_MASK_WINDOW_DAMAGE | ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
5859 ecore_x_event_mask_set(bd->parent->client.win, bd->parent->saved.event_mask);
5860 bd->parent->lock_close = 0;
5861 bd->parent->saved.event_mask = 0;
5862 bd->parent->modal = NULL;
5866 EINA_LIST_FREE(bd->transients, child)
5868 child->parent = NULL;
5871 #ifdef _F_DEICONIFY_APPROVE_
5872 bd->client.e.state.deiconify_approve.render_done = 0;
5874 E_Border *ancestor_bd;
5875 ancestor_bd = bd->client.e.state.deiconify_approve.ancestor;
5876 if ((ancestor_bd) &&
5877 (!e_object_is_del(E_OBJECT(ancestor_bd))))
5879 ancestor_bd->client.e.state.deiconify_approve.req_list = eina_list_remove(ancestor_bd->client.e.state.deiconify_approve.req_list, bd);
5880 bd->client.e.state.deiconify_approve.ancestor = NULL;
5882 if ((ancestor_bd->client.e.state.deiconify_approve.req_list == NULL) &&
5883 (ancestor_bd->client.e.state.deiconify_approve.render_done))
5885 if (ancestor_bd->client.e.state.deiconify_approve.wait_timer)
5887 ecore_timer_del(ancestor_bd->client.e.state.deiconify_approve.wait_timer);
5888 ancestor_bd->client.e.state.deiconify_approve.wait_timer = NULL;
5889 e_border_uniconify(ancestor_bd);
5894 if (bd->client.e.state.deiconify_approve.wait_timer)
5896 ecore_timer_del(bd->client.e.state.deiconify_approve.wait_timer);
5897 bd->client.e.state.deiconify_approve.wait_timer = NULL;
5900 if (bd->client.e.state.deiconify_approve.req_list)
5902 EINA_LIST_FREE(bd->client.e.state.deiconify_approve.req_list, child)
5904 child->client.e.state.deiconify_approve.render_done = 0;
5905 child->client.e.state.deiconify_approve.ancestor = NULL;
5910 #ifdef _F_ZONE_WINDOW_ROTATION_
5911 if (rot.list) _e_border_rotation_list_remove(bd);
5915 E_Border_Rotation_Info *info = NULL;
5917 EINA_LIST_FOREACH(rot.async_list, l, info)
5920 rot.async_list = eina_list_remove(rot.async_list, info);
5928 bd->leader->group = eina_list_remove(bd->leader->group, bd);
5929 if (bd->leader->modal == bd)
5930 bd->leader->modal = NULL;
5933 EINA_LIST_FREE(bd->group, child)
5935 child->leader = NULL;
5939 #ifdef PRINT_LOTS_OF_DEBUG
5941 _e_border_print(E_Border *bd,
5950 "\tBorderless: %s\n",
5951 bd, bd->client.icccm.name, bd->client.icccm.title,
5952 bd->borderless ? "TRUE" : "FALSE");
5958 _e_border_cb_window_show_request(void *data __UNUSED__,
5959 int ev_type __UNUSED__,
5964 Ecore_X_Event_Window_Show_Request *e;
5967 bd = e_border_find_by_client_window(e->win);
5968 if (!bd) return ECORE_CALLBACK_PASS_ON;
5970 if ((e_config->wm_win_rotation) &&
5971 (rot.vkbd_ctrl_win) && (rot.vkbd) &&
5973 (rot.vkbd_hide_prepare_timer))
5975 con = bd->zone->container;
5976 bd = e_border_new(con, e->win, 0, 0);
5981 if (!bd->lock_client_iconify)
5982 e_border_uniconify(bd);
5986 /* FIXME: make border "urgent" for a bit - it wants attention */
5987 /* e_border_show(bd); */
5988 if (!bd->lock_client_stacking)
5991 return ECORE_CALLBACK_PASS_ON;
5995 _e_border_cb_window_destroy(void *data __UNUSED__,
5996 int ev_type __UNUSED__,
6000 Ecore_X_Event_Window_Destroy *e;
6003 bd = e_border_find_by_client_window(e->win);
6004 if (!bd) return ECORE_CALLBACK_PASS_ON;
6005 ELB(ELBT_BD, "X_WIN_DEL", bd->client.win);
6006 #ifdef _F_ZONE_WINDOW_ROTATION_
6007 if (e_config->wm_win_rotation)
6009 if (bd->client.vkbd.win_type == E_VIRTUAL_KEYBOARD_WINDOW_TYPE_KEYPAD)
6011 ELB(ELBT_BD, "X_DEL_NOTIFY", bd->client.win);
6012 if (!rot.vkbd_hide_prepare_timer)
6014 ELB(ELBT_BD, "HIDE VKBD", bd->client.win);
6015 e_border_hide(bd, 0);
6016 if (!rot.vkbd_hide_prepare_timer)
6018 ELB(ELBT_BD, "DEL VKBD", bd->client.win);
6019 e_object_del(E_OBJECT(bd));
6022 return ECORE_CALLBACK_PASS_ON;
6026 e_border_hide(bd, 0);
6027 e_object_del(E_OBJECT(bd));
6028 return ECORE_CALLBACK_PASS_ON;
6032 _e_border_cb_window_hide(void *data __UNUSED__,
6033 int ev_type __UNUSED__,
6036 E_Border *bd = NULL;
6037 Ecore_X_Event_Window_Hide *e;
6040 // printf("HIDE: %x, event %x send: %i\n", e->win, e->event_win, e->send_event);
6041 // not interested in hide events from windows other than the window in question
6042 if (e->win != e->event_win)
6044 bd = e_border_find_by_client_window(e->win);
6045 if (!bd) return ECORE_CALLBACK_PASS_ON;
6046 if (!e->send_event) return ECORE_CALLBACK_PASS_ON;
6050 (bd->zone->container->manager->root == e->event_win)))
6051 return ECORE_CALLBACK_PASS_ON;
6054 if (!bd) bd = e_border_find_by_client_window(e->win);
6055 // printf(" bd = %p\n", bd);
6058 if (ecore_x_window_visible_get(e->win))
6060 ELB(ELBT_BD, "FORCE UNMAP client window", e->win);
6061 ecore_x_window_hide(e->win);
6063 return ECORE_CALLBACK_PASS_ON;
6066 // printf(" bd->ignore_first_unmap = %i\n", bd->ignore_first_unmap);
6067 if (bd->ignore_first_unmap > 0)
6069 bd->ignore_first_unmap--;
6070 return ECORE_CALLBACK_PASS_ON;
6072 /* Don't delete hidden or iconified windows */
6073 #ifdef _F_USE_EXTENDED_ICONIFY_
6074 if (bd->await_hide_event > 0)
6076 if ((bd->iconic) || (bd->await_hide_event > 0))
6079 // printf(" Don't delete hidden or iconified windows\n");
6080 // printf(" bd->iconic = %i, bd->visible = %i, bd->new_client = %i, bd->await_hide_event = %i\n",
6081 // bd->iconic, bd->visible, bd->new_client, bd->await_hide_event);
6082 if (bd->await_hide_event > 0)
6084 bd->await_hide_event--;
6088 // printf(" hide really\n");
6089 /* Only hide the border if it is visible */
6090 if (bd->visible) e_border_hide(bd, 1);
6095 // printf(" hide2\n");
6096 #ifdef _F_USE_EXTENDED_ICONIFY_
6104 #ifdef _F_ZONE_WINDOW_ROTATION_
6105 if (e_config->wm_win_rotation)
6107 if (bd->client.vkbd.win_type == E_VIRTUAL_KEYBOARD_WINDOW_TYPE_KEYPAD)
6109 ELB(ELBT_BD, "X_UNMAP_NOTIFY", bd->client.win);
6110 if (!rot.vkbd_hide_prepare_timer)
6112 ELB(ELBT_BD, "HIDE VKBD", bd->client.win);
6113 e_border_hide(bd, 0);
6114 if (!rot.vkbd_hide_prepare_timer)
6116 ELB(ELBT_BD, "DEL VKBD", bd->client.win);
6117 e_object_del(E_OBJECT(bd));
6120 return ECORE_CALLBACK_PASS_ON;
6124 e_border_hide(bd, 0);
6125 e_object_del(E_OBJECT(bd));
6127 return ECORE_CALLBACK_PASS_ON;
6131 _e_border_cb_window_reparent(void *data __UNUSED__,
6132 int ev_type __UNUSED__,
6133 void *ev __UNUSED__)
6137 Ecore_X_Event_Window_Reparent *e;
6140 bd = e_border_find_by_client_window(e->win);
6142 if (e->parent == bd->client.shell_win) return 1;
6143 if (ecore_x_window_parent_get(e->win) == bd->client.shell_win)
6147 e_border_hide(bd, 0);
6148 e_object_del(E_OBJECT(bd));
6150 return ECORE_CALLBACK_PASS_ON;
6154 _e_border_cb_window_configure_request(void *data __UNUSED__,
6155 int ev_type __UNUSED__,
6159 Ecore_X_Event_Window_Configure_Request *e;
6162 bd = e_border_find_by_client_window(e->win);
6165 if (e_stolen_win_get(e->win)) return ECORE_CALLBACK_PASS_ON;
6166 if (!e_util_container_window_find(e->win))
6167 ecore_x_window_configure(e->win, e->value_mask,
6168 e->x, e->y, e->w, e->h, e->border,
6169 e->abovewin, e->detail);
6170 return ECORE_CALLBACK_PASS_ON;
6173 if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_X) ||
6174 (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_Y))
6180 if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_X)
6182 if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_Y)
6184 if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W) ||
6185 (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H))
6191 if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W)
6192 w = e->w + bd->client_inset.l + bd->client_inset.r;
6193 if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H)
6194 h = e->h + bd->client_inset.t + bd->client_inset.b;
6195 if ((!bd->lock_client_location) && (!bd->lock_client_size))
6197 if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
6199 bd->saved.x = x - bd->zone->x;
6200 bd->saved.y = y - bd->zone->y;
6205 e_border_move_resize(bd, x, y, w, h);
6207 else if (!bd->lock_client_location)
6209 if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
6211 bd->saved.x = x - bd->zone->x;
6212 bd->saved.y = y - bd->zone->y;
6215 e_border_move(bd, x, y);
6217 else if (!bd->lock_client_size)
6219 if ((bd->shaded) || (bd->shading))
6225 if ((bd->shade.dir == E_DIRECTION_UP) ||
6226 (bd->shade.dir == E_DIRECTION_DOWN))
6228 e_border_resize(bd, w, bd->h);
6233 e_border_resize(bd, bd->w, h);
6239 if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
6245 e_border_resize(bd, w, h);
6251 if (!bd->lock_client_location)
6253 if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
6255 bd->saved.x = x - bd->zone->x;
6256 bd->saved.y = y - bd->zone->y;
6259 e_border_move(bd, x, y);
6263 else if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W) ||
6264 (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H))
6270 if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W)
6271 w = e->w + bd->client_inset.l + bd->client_inset.r;
6272 if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H)
6273 h = e->h + bd->client_inset.t + bd->client_inset.b;
6274 #ifdef _F_ZONE_WINDOW_ROTATION_
6275 if (bd->client.vkbd.win_type == E_VIRTUAL_KEYBOARD_WINDOW_TYPE_NONE)
6277 if (!bd->lock_client_size)
6279 if ((bd->shaded) || (bd->shading))
6285 if ((bd->shade.dir == E_DIRECTION_UP) ||
6286 (bd->shade.dir == E_DIRECTION_DOWN))
6288 e_border_resize(bd, w, bd->h);
6293 e_border_resize(bd, bd->w, h);
6299 if ((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_NONE)
6304 zx = zy = zw = zh = 0;
6307 * This code does resize and move a window on a
6308 * X configure request into an useful geometry.
6309 * This is really useful for size jumping file dialogs.
6314 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
6316 if (e_config->geometry_auto_resize_limit == 1)
6325 e_border_resize(bd, w, h);
6327 if (e_config->geometry_auto_move == 1)
6329 /* z{x,y,w,h} are only set here; FIXME! */
6332 // move window horizontal if resize to not useful geometry
6333 if (bd->x + bd->w > zx + zw)
6334 rx = zx + zw - bd->w;
6335 else if (bd->x < zx)
6338 // move window vertical if resize to not useful geometry
6339 if (bd->y + bd->h > zy + zh)
6340 ry = zy + zh - bd->h;
6341 else if (bd->y < zy)
6344 e_border_move(bd, rx, ry);
6350 if (!bd->lock_client_stacking)
6352 if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE) &&
6353 (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING))
6357 if (e->detail == ECORE_X_WINDOW_STACK_ABOVE)
6359 obd = e_border_find_by_client_window(e->abovewin);
6362 e_border_stack_above(bd, obd);
6366 ecore_x_window_configure(bd->win,
6367 ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
6368 ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
6370 e->abovewin, ECORE_X_WINDOW_STACK_ABOVE);
6371 /* FIXME: need to rebuiuld border list from current stacking */
6374 else if (e->detail == ECORE_X_WINDOW_STACK_BELOW)
6376 obd = e_border_find_by_client_window(e->abovewin);
6379 e_border_stack_below(bd, obd);
6383 ecore_x_window_configure(bd->win,
6384 ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
6385 ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
6387 e->abovewin, ECORE_X_WINDOW_STACK_BELOW);
6388 /* FIXME: need to rebuiuld border list from current stacking */
6391 else if (e->detail == ECORE_X_WINDOW_STACK_TOP_IF)
6395 else if (e->detail == ECORE_X_WINDOW_STACK_BOTTOM_IF)
6399 else if (e->detail == ECORE_X_WINDOW_STACK_OPPOSITE)
6404 else if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE)
6406 if (e->detail == ECORE_X_WINDOW_STACK_ABOVE)
6410 else if (e->detail == ECORE_X_WINDOW_STACK_BELOW)
6414 else if (e->detail == ECORE_X_WINDOW_STACK_TOP_IF)
6418 else if (e->detail == ECORE_X_WINDOW_STACK_BOTTOM_IF)
6422 else if (e->detail == ECORE_X_WINDOW_STACK_OPPOSITE)
6429 /* FIXME: need to send synthetic stacking event too as well as move/resize */
6430 _e_border_client_move_resize_send(bd);
6431 return ECORE_CALLBACK_PASS_ON;
6435 _e_border_cb_window_resize_request(void *data __UNUSED__,
6436 int ev_type __UNUSED__,
6440 Ecore_X_Event_Window_Resize_Request *e;
6443 bd = e_border_find_by_client_window(e->win);
6446 if (e_stolen_win_get(e->win)) return ECORE_CALLBACK_PASS_ON;
6447 ecore_x_window_resize(e->win, e->w, e->h);
6448 return ECORE_CALLBACK_PASS_ON;
6453 w = e->w + bd->client_inset.l + bd->client_inset.r;
6454 h = e->h + bd->client_inset.t + bd->client_inset.b;
6455 if ((bd->shaded) || (bd->shading))
6461 if ((bd->shade.dir == E_DIRECTION_UP) ||
6462 (bd->shade.dir == E_DIRECTION_DOWN))
6464 e_border_resize(bd, w, bd->h);
6469 e_border_resize(bd, bd->w, h);
6474 e_border_resize(bd, w, h);
6477 _e_border_client_move_resize_send(bd);
6478 return ECORE_CALLBACK_PASS_ON;
6482 _e_border_cb_window_gravity(void *data __UNUSED__,
6483 int ev_type __UNUSED__,
6484 void *ev __UNUSED__)
6487 // Ecore_X_Event_Window_Gravity *e;
6490 // bd = e_border_find_by_client_window(e->win);
6491 // if (!bd) return 1;
6496 _e_border_cb_window_stack_request(void *data __UNUSED__,
6497 int ev_type __UNUSED__,
6501 Ecore_X_Event_Window_Stack_Request *e;
6504 bd = e_border_find_by_client_window(e->win);
6507 if (e_stolen_win_get(e->win)) return ECORE_CALLBACK_PASS_ON;
6508 if (!e_util_container_window_find(e->win))
6510 if (e->detail == ECORE_X_WINDOW_STACK_ABOVE)
6511 ecore_x_window_raise(e->win);
6512 else if (e->detail == ECORE_X_WINDOW_STACK_BELOW)
6513 ecore_x_window_lower(e->win);
6515 return ECORE_CALLBACK_PASS_ON;
6517 if (e->detail == ECORE_X_WINDOW_STACK_ABOVE)
6519 else if (e->detail == ECORE_X_WINDOW_STACK_BELOW)
6521 return ECORE_CALLBACK_PASS_ON;
6525 _e_border_cb_window_property(void *data __UNUSED__,
6526 int ev_type __UNUSED__,
6530 Ecore_X_Event_Window_Property *e;
6533 bd = e_border_find_by_client_window(e->win);
6534 if (!bd) return ECORE_CALLBACK_PASS_ON;
6535 if (e->atom == ECORE_X_ATOM_WM_NAME)
6537 if ((!bd->client.netwm.name) &&
6538 (!bd->client.netwm.fetch.name))
6540 bd->client.icccm.fetch.title = 1;
6544 else if (e->atom == ECORE_X_ATOM_NET_WM_NAME)
6546 bd->client.netwm.fetch.name = 1;
6549 else if (e->atom == ECORE_X_ATOM_WM_CLASS)
6551 bd->client.icccm.fetch.name_class = 1;
6554 else if (e->atom == ECORE_X_ATOM_WM_ICON_NAME)
6556 if ((!bd->client.netwm.icon_name) &&
6557 (!bd->client.netwm.fetch.icon_name))
6559 bd->client.icccm.fetch.icon_name = 1;
6563 else if (e->atom == ECORE_X_ATOM_NET_WM_ICON_NAME)
6565 bd->client.netwm.fetch.icon_name = 1;
6568 else if (e->atom == ECORE_X_ATOM_WM_CLIENT_MACHINE)
6570 bd->client.icccm.fetch.machine = 1;
6573 else if (e->atom == ECORE_X_ATOM_WM_PROTOCOLS)
6575 bd->client.icccm.fetch.protocol = 1;
6578 else if (e->atom == ECORE_X_ATOM_WM_HINTS)
6580 bd->client.icccm.fetch.hints = 1;
6583 else if (e->atom == ECORE_X_ATOM_WM_NORMAL_HINTS)
6585 bd->client.icccm.fetch.size_pos_hints = 1;
6588 else if (e->atom == ECORE_X_ATOM_MOTIF_WM_HINTS)
6591 if ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN) &&
6592 (!bd->client.netwm.fetch.type))
6595 bd->client.mwm.fetch.hints = 1;
6601 else if (e->atom == ECORE_X_ATOM_WM_TRANSIENT_FOR)
6603 bd->client.icccm.fetch.transient_for = 1;
6606 else if (e->atom == ECORE_X_ATOM_WM_CLIENT_LEADER)
6608 bd->client.icccm.fetch.client_leader = 1;
6611 else if (e->atom == ECORE_X_ATOM_WM_WINDOW_ROLE)
6613 bd->client.icccm.fetch.window_role = 1;
6616 else if (e->atom == ECORE_X_ATOM_NET_WM_ICON)
6618 bd->client.netwm.fetch.icon = 1;
6621 else if (e->atom == ATM__QTOPIA_SOFT_MENU)
6623 bd->client.qtopia.fetch.soft_menu = 1;
6626 else if (e->atom == ATM__QTOPIA_SOFT_MENUS)
6628 bd->client.qtopia.fetch.soft_menus = 1;
6631 else if (e->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
6633 bd->client.vkbd.fetch.state = 1;
6636 else if (e->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD)
6638 bd->client.vkbd.fetch.vkbd = 1;
6641 else if (e->atom == ECORE_X_ATOM_E_ILLUME_CONFORMANT)
6643 bd->client.illume.conformant.fetch.conformant = 1;
6646 else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE)
6648 bd->client.illume.quickpanel.fetch.state = 1;
6651 else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL)
6653 bd->client.illume.quickpanel.fetch.quickpanel = 1;
6656 else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR)
6658 bd->client.illume.quickpanel.fetch.priority.major = 1;
6661 else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR)
6663 bd->client.illume.quickpanel.fetch.priority.minor = 1;
6666 else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE)
6668 bd->client.illume.quickpanel.fetch.zone = 1;
6671 else if (e->atom == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED)
6673 bd->client.illume.drag.fetch.locked = 1;
6676 else if (e->atom == ECORE_X_ATOM_E_ILLUME_DRAG)
6678 bd->client.illume.drag.fetch.drag = 1;
6681 else if (e->atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
6683 bd->client.illume.win_state.fetch.state = 1;
6687 else if (e->atom == ECORE_X_ATOM_NET_WM_USER_TIME)
6689 bd->client.netwm.fetch.user_time = 1;
6692 else if (e->atom == ECORE_X_ATOM_NET_WM_STRUT)
6694 bd->client.netwm.fetch.strut = 1;
6697 else if (e->atom == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL)
6699 bd->client.netwm.fetch.strut = 1;
6703 else if (e->atom == ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER)
6705 //printf("ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER\n");
6707 else if (e->atom == ECORE_X_ATOM_E_VIDEO_POSITION)
6709 bd->client.e.fetch.video_position = 1;
6712 else if (e->atom == ECORE_X_ATOM_E_VIDEO_PARENT)
6714 bd->client.e.fetch.video_parent = 1;
6717 else if (e->atom == ECORE_X_ATOM_NET_WM_STATE)
6719 bd->client.netwm.fetch.state = 1;
6722 #ifdef _F_USE_DESK_WINDOW_PROFILE_
6723 else if (e->atom == ECORE_X_ATOM_E_PROFILE_LIST)
6725 bd->client.e.fetch.profile_list = 1;
6729 #ifdef _F_ZONE_WINDOW_ROTATION_
6730 else if (e->atom == ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED)
6732 if (e_config->wm_win_rotation)
6734 bd->client.e.fetch.rot.support = 1;
6738 else if ((e->atom == ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY) ||
6739 (e->atom == ECORE_X_ATOM_E_WINDOW_ROTATION_90_GEOMETRY) ||
6740 (e->atom == ECORE_X_ATOM_E_WINDOW_ROTATION_180_GEOMETRY) ||
6741 (e->atom == ECORE_X_ATOM_E_WINDOW_ROTATION_270_GEOMETRY))
6743 if (e_config->wm_win_rotation)
6745 bd->client.e.fetch.rot.geom_hint = 1;
6749 else if (e->atom == ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED)
6751 if (e_config->wm_win_rotation)
6753 bd->client.e.fetch.rot.app_set = 1;
6757 else if (e->atom == ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION)
6759 if (e_config->wm_win_rotation)
6761 bd->client.e.fetch.rot.preferred_rot = 1;
6765 else if (e->atom == ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST)
6767 if (e_config->wm_win_rotation)
6769 bd->client.e.fetch.rot.available_rots = 1;
6775 return ECORE_CALLBACK_PASS_ON;
6779 _e_border_cb_window_colormap(void *data __UNUSED__,
6780 int ev_type __UNUSED__,
6784 Ecore_X_Event_Window_Colormap *e;
6787 bd = e_border_find_by_client_window(e->win);
6788 if (!bd) return ECORE_CALLBACK_PASS_ON;
6789 return ECORE_CALLBACK_PASS_ON;
6793 _e_border_cb_window_shape(void *data __UNUSED__,
6794 int ev_type __UNUSED__,
6798 Ecore_X_Event_Window_Shape *e;
6801 bd = e_border_find_by_client_window(e->win);
6803 if (e->type == ECORE_X_SHAPE_INPUT)
6807 bd->need_shape_merge = 1;
6808 // YYY bd->shaped_input = 1;
6809 bd->changes.shape_input = 1;
6813 return ECORE_CALLBACK_PASS_ON;
6818 bd->changes.shape = 1;
6820 return ECORE_CALLBACK_PASS_ON;
6822 bd = e_border_find_by_window(e->win);
6825 bd->need_shape_export = 1;
6827 return ECORE_CALLBACK_PASS_ON;
6829 bd = e_border_find_by_frame_window(e->win);
6832 bd->need_shape_merge = 1;
6834 return ECORE_CALLBACK_PASS_ON;
6836 return ECORE_CALLBACK_PASS_ON;
6840 _e_border_cb_window_focus_in(void *data __UNUSED__,
6841 int ev_type __UNUSED__,
6845 Ecore_X_Event_Window_Focus_In *e;
6848 bd = e_border_find_by_client_window(e->win);
6849 if (!bd) return ECORE_CALLBACK_PASS_ON;
6850 #ifdef INOUTDEBUG_FOCUS
6855 const char *modes[] = {
6857 "MODE_WHILE_GRABBED",
6861 const char *details[] = {
6865 "DETAIL_NON_LINEAR",
6866 "DETAIL_NON_LINEAR_VIRTUAL",
6868 "DETAIL_POINTER_ROOT",
6869 "DETAIL_DETAIL_NONE"
6873 ct[strlen(ct) - 1] = 0;
6874 DBG("FF ->IN %i 0x%x %s md=%s dt=%s\n",
6879 details[e->detail]);
6881 DBG("%s cb focus in %d %d\n",
6882 e_border_name_get(bd),
6883 bd->client.icccm.accepts_focus,
6884 bd->client.icccm.take_focus);
6887 _e_border_pri_raise(bd);
6888 if (e->mode == ECORE_X_EVENT_MODE_GRAB)
6890 if (e->detail == ECORE_X_EVENT_DETAIL_POINTER) return ECORE_CALLBACK_PASS_ON;
6892 else if (e->mode == ECORE_X_EVENT_MODE_UNGRAB)
6894 if (e->detail == ECORE_X_EVENT_DETAIL_POINTER) return ECORE_CALLBACK_PASS_ON;
6897 /* ignore focus in from !take_focus windows, we just gave it em */
6898 /* if (!bd->client.icccm.take_focus)
6899 * return ECORE_CALLBACK_PASS_ON; */
6901 /* should be equal, maybe some clients dont reply with the proper timestamp ? */
6902 if (e->time >= focus_time)
6903 e_border_focus_set(bd, 1, 0);
6904 return ECORE_CALLBACK_PASS_ON;
6908 _e_border_cb_window_focus_out(void *data __UNUSED__,
6909 int ev_type __UNUSED__,
6913 Ecore_X_Event_Window_Focus_Out *e;
6916 bd = e_border_find_by_client_window(e->win);
6917 if (!bd) return ECORE_CALLBACK_PASS_ON;
6918 #ifdef INOUTDEBUG_FOCUS
6923 const char *modes[] = {
6925 "MODE_WHILE_GRABBED",
6929 const char *details[] = {
6933 "DETAIL_NON_LINEAR",
6934 "DETAIL_NON_LINEAR_VIRTUAL",
6936 "DETAIL_POINTER_ROOT",
6937 "DETAIL_DETAIL_NONE"
6941 ct[strlen(ct) - 1] = 0;
6942 DBG("FF <-OUT %i 0x%x %s md=%s dt=%s",
6947 details[e->detail]);
6949 DBG("%s cb focus out %d %d",
6950 e_border_name_get(bd),
6951 bd->client.icccm.accepts_focus,
6952 bd->client.icccm.take_focus);
6955 _e_border_pri_norm(bd);
6956 if (e->mode == ECORE_X_EVENT_MODE_NORMAL)
6958 if (e->detail == ECORE_X_EVENT_DETAIL_INFERIOR) return ECORE_CALLBACK_PASS_ON;
6959 else if (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)
6960 return ECORE_CALLBACK_PASS_ON;
6961 else if (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL)
6962 return ECORE_CALLBACK_PASS_ON;
6964 else if (e->mode == ECORE_X_EVENT_MODE_GRAB)
6966 if (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR) return ECORE_CALLBACK_PASS_ON;
6967 else if (e->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
6968 return ECORE_CALLBACK_PASS_ON;
6969 else if (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL)
6970 return ECORE_CALLBACK_PASS_ON;
6971 else if (e->detail == ECORE_X_EVENT_DETAIL_ANCESTOR)
6972 return ECORE_CALLBACK_PASS_ON;
6973 else if (e->detail == ECORE_X_EVENT_DETAIL_VIRTUAL)
6974 return ECORE_CALLBACK_PASS_ON;
6976 else if (e->mode == ECORE_X_EVENT_MODE_UNGRAB)
6978 /* for firefox/thunderbird (xul) menu walking */
6979 /* NB: why did i disable this before? */
6980 if (e->detail == ECORE_X_EVENT_DETAIL_INFERIOR) return ECORE_CALLBACK_PASS_ON;
6981 else if (e->detail == ECORE_X_EVENT_DETAIL_POINTER)
6982 return ECORE_CALLBACK_PASS_ON;
6984 else if (e->mode == ECORE_X_EVENT_MODE_WHILE_GRABBED)
6986 if (e->detail == ECORE_X_EVENT_DETAIL_ANCESTOR) return ECORE_CALLBACK_PASS_ON;
6987 else if (e->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
6988 return ECORE_CALLBACK_PASS_ON;
6990 e_border_focus_set(bd, 0, 0);
6991 return ECORE_CALLBACK_PASS_ON;
6994 #if _F_BORDER_CLIP_TO_ZONE_
6996 _e_border_shape_input_clip_to_zone(E_Border *bd)
6998 /* if (!(e_config->window_out_of_vscreen_limits_partly)) return; */
7002 if (!(E_CONTAINS(bd->zone->x, bd->zone->y,
7003 bd->zone->w, bd->zone->h,
7004 bd->x, bd->y, bd->w, bd->h)))
7007 x = bd->x; y = bd->y; w = bd->w; h = bd->h;
7008 E_RECTS_CLIP_TO_RECT(x, y, w, h,
7009 bd->zone->x, bd->zone->y,
7010 bd->zone->w, bd->zone->h);
7013 ecore_x_window_shape_input_rectangle_set(bd->bg_win, x, y, w, h);
7014 ecore_x_window_shape_input_rectangle_set(bd->win, x, y, w, h);
7018 ecore_x_window_shape_input_rectangle_set(bd->bg_win, 0, 0, bd->w, bd->h);
7019 ecore_x_window_shape_input_rectangle_set(bd->win, 0, 0, bd->w, bd->h);
7022 #endif /* _F_BORDER_CLIP_TO_ZONE_ */
7025 _e_border_cb_client_message(void *data __UNUSED__,
7026 int ev_type __UNUSED__,
7029 Ecore_X_Event_Client_Message *e;
7033 #ifdef _F_DEICONIFY_APPROVE_
7034 if (e->message_type == ECORE_X_ATOM_E_DEICONIFY_APPROVE)
7036 if (!e_config->deiconify_approve) return ECORE_CALLBACK_PASS_ON;
7038 bd = e_border_find_by_client_window(e->win);
7041 if (bd->client.e.state.deiconify_approve.support)
7043 if (e->data.l[1] != 1) return ECORE_CALLBACK_PASS_ON;
7044 bd->client.e.state.deiconify_approve.render_done = 1;
7046 E_Border *ancestor_bd;
7047 ancestor_bd = bd->client.e.state.deiconify_approve.ancestor;
7050 ancestor_bd->client.e.state.deiconify_approve.req_list = eina_list_remove(ancestor_bd->client.e.state.deiconify_approve.req_list, bd);
7051 bd->client.e.state.deiconify_approve.ancestor = NULL;
7058 ELBF(ELBT_BD, 0, bd->client.win,
7059 "RECEIVE DEICONIFY_APPROVE.. ancestor:%x", ancestor_bd->client.win);
7061 if ((ancestor_bd->client.e.state.deiconify_approve.req_list == NULL) &&
7062 (ancestor_bd->client.e.state.deiconify_approve.render_done))
7064 if (ancestor_bd->client.e.state.deiconify_approve.wait_timer)
7066 ecore_timer_del(ancestor_bd->client.e.state.deiconify_approve.wait_timer);
7067 ancestor_bd->client.e.state.deiconify_approve.wait_timer = NULL;
7068 e_border_uniconify(ancestor_bd);
7072 ELB(ELBT_BD, "Unset DEICONIFY_APPROVE render_done", ancestor_bd->client.win);
7073 ancestor_bd->client.e.state.deiconify_approve.render_done = 0;
7078 return ECORE_CALLBACK_PASS_ON;
7082 #ifdef _F_ZONE_WINDOW_ROTATION_
7083 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_PASS_ON;
7085 bd = e_border_find_by_client_window(e->win);
7088 if (e_config->wm_win_rotation)
7090 Ecore_X_Event_Client_Message *msg = NULL;
7091 Ecore_X_Atom t = e->message_type;
7092 if ((t == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_DONE) ||
7093 (t == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_DONE) ||
7094 (t == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_CONTROL_WINDOW) ||
7095 (t == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE))
7097 msg = E_NEW(Ecore_X_Event_Client_Message, 1);
7098 if (!msg) return ECORE_CALLBACK_PASS_ON;
7101 msg->message_type = e->message_type;
7102 msg->data.l[0] = e->data.l[0];
7103 msg->data.l[1] = e->data.l[1];
7104 msg->data.l[2] = e->data.l[2];
7105 msg->data.l[3] = e->data.l[3];
7106 msg->data.l[4] = e->data.l[4];
7107 rot.msgs = eina_list_append(rot.msgs, msg);
7109 rot.fetch = EINA_TRUE;
7112 return ECORE_CALLBACK_PASS_ON;
7115 if (e->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE)
7117 ELBF(ELBT_ROT, 0, e->data.l[0], "GET ROT_DONE a%d %dx%d zone_a:%d",
7118 e->data.l[1], e->data.l[2], e->data.l[3], bd->zone->rot.curr);
7120 if (e_config->wm_win_rotation)
7122 if ((int)e->data.l[1] == bd->client.e.state.rot.curr)
7124 _e_border_rotation_list_remove(bd);
7125 if (bd->client.e.state.rot.pending_show)
7127 ELB(ELBT_BD, "SHOW_BD (PEND)", bd->client.win);
7129 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
7130 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
7131 _e_border_check_stack(bd);
7133 bd->client.e.state.rot.pending_show = 0;
7139 return ECORE_CALLBACK_PASS_ON;
7143 _e_border_cb_window_state_request(void *data __UNUSED__,
7144 int ev_type __UNUSED__,
7148 Ecore_X_Event_Window_State_Request *e;
7152 bd = e_border_find_by_client_window(e->win);
7153 if (!bd) return ECORE_CALLBACK_PASS_ON;
7155 for (i = 0; i < 2; i++)
7156 e_hints_window_state_update(bd, e->state[i], e->action);
7158 return ECORE_CALLBACK_PASS_ON;
7162 _e_border_cb_window_move_resize_request(void *data __UNUSED__,
7163 int ev_type __UNUSED__,
7167 Ecore_X_Event_Window_Move_Resize_Request *e;
7170 bd = e_border_find_by_client_window(e->win);
7171 if (!bd) return ECORE_CALLBACK_PASS_ON;
7173 if ((bd->shaded) || (bd->shading) ||
7174 (bd->fullscreen) || (bd->moving) ||
7175 (bd->resize_mode != RESIZE_NONE))
7176 return ECORE_CALLBACK_PASS_ON;
7178 if ((e->button >= 1) && (e->button <= 3))
7180 bd->mouse.last_down[e->button - 1].mx = e->x;
7181 bd->mouse.last_down[e->button - 1].my = e->y;
7182 bd->mouse.last_down[e->button - 1].x = bd->x;
7183 bd->mouse.last_down[e->button - 1].y = bd->y;
7184 bd->mouse.last_down[e->button - 1].w = bd->w;
7185 bd->mouse.last_down[e->button - 1].h = bd->h;
7189 bd->moveinfo.down.x = bd->x;
7190 bd->moveinfo.down.y = bd->y;
7191 bd->moveinfo.down.w = bd->w;
7192 bd->moveinfo.down.h = bd->h;
7194 bd->mouse.current.mx = e->x;
7195 bd->mouse.current.my = e->y;
7196 bd->moveinfo.down.button = e->button;
7197 bd->moveinfo.down.mx = e->x;
7198 bd->moveinfo.down.my = e->y;
7201 if (!bd->lock_user_stacking)
7204 if (e->direction == MOVE)
7206 bd->cur_mouse_action = e_action_find("window_move");
7207 if (bd->cur_mouse_action)
7209 if ((!bd->cur_mouse_action->func.end_mouse) &&
7210 (!bd->cur_mouse_action->func.end))
7211 bd->cur_mouse_action = NULL;
7212 if (bd->cur_mouse_action)
7214 e_object_ref(E_OBJECT(bd->cur_mouse_action));
7215 bd->cur_mouse_action->func.go(E_OBJECT(bd), NULL);
7218 return ECORE_CALLBACK_PASS_ON;
7221 if (!_e_border_resize_begin(bd))
7222 return ECORE_CALLBACK_PASS_ON;
7224 switch (e->direction)
7227 bd->resize_mode = RESIZE_TL;
7228 GRAV_SET(bd, ECORE_X_GRAVITY_SE);
7232 bd->resize_mode = RESIZE_T;
7233 GRAV_SET(bd, ECORE_X_GRAVITY_S);
7237 bd->resize_mode = RESIZE_TR;
7238 GRAV_SET(bd, ECORE_X_GRAVITY_SW);
7242 bd->resize_mode = RESIZE_R;
7243 GRAV_SET(bd, ECORE_X_GRAVITY_W);
7247 bd->resize_mode = RESIZE_BR;
7248 GRAV_SET(bd, ECORE_X_GRAVITY_NW);
7252 bd->resize_mode = RESIZE_B;
7253 GRAV_SET(bd, ECORE_X_GRAVITY_N);
7257 bd->resize_mode = RESIZE_BL;
7258 GRAV_SET(bd, ECORE_X_GRAVITY_NE);
7262 bd->resize_mode = RESIZE_L;
7263 GRAV_SET(bd, ECORE_X_GRAVITY_E);
7267 return ECORE_CALLBACK_PASS_ON;
7270 bd->cur_mouse_action = e_action_find("window_resize");
7271 if (bd->cur_mouse_action)
7273 if ((!bd->cur_mouse_action->func.end_mouse) &&
7274 (!bd->cur_mouse_action->func.end))
7275 bd->cur_mouse_action = NULL;
7277 if (bd->cur_mouse_action)
7278 e_object_ref(E_OBJECT(bd->cur_mouse_action));
7280 return ECORE_CALLBACK_PASS_ON;
7284 _e_border_cb_desktop_change(void *data __UNUSED__,
7285 int ev_type __UNUSED__,
7289 Ecore_X_Event_Desktop_Change *e;
7292 bd = e_border_find_by_client_window(e->win);
7295 if (e->desk == 0xffffffff)
7297 else if ((int)e->desk < (bd->zone->desk_x_count * bd->zone->desk_y_count))
7301 desk = e_desk_at_pos_get(bd->zone, e->desk);
7303 e_border_desk_set(bd, desk);
7308 ecore_x_netwm_desktop_set(e->win, e->desk);
7310 return ECORE_CALLBACK_PASS_ON;
7314 _e_border_cb_sync_alarm(void *data __UNUSED__,
7315 int ev_type __UNUSED__,
7319 Ecore_X_Event_Sync_Alarm *e;
7320 unsigned int serial;
7323 bd = e_border_find_by_alarm(e->alarm);
7324 if (!bd) return ECORE_CALLBACK_PASS_ON;
7326 if (bd->client.netwm.sync.wait)
7327 bd->client.netwm.sync.wait--;
7329 if (ecore_x_sync_counter_query(bd->client.netwm.sync.counter, &serial))
7331 E_Border_Pending_Move_Resize *pnd = NULL;
7333 /* skip pending for which we didn't get a reply */
7334 while (bd->pending_move_resize)
7336 pnd = bd->pending_move_resize->data;
7337 bd->pending_move_resize = eina_list_remove(bd->pending_move_resize, pnd);
7339 if (serial == pnd->serial)
7351 bd->client.w = bd->w - (bd->client_inset.l + bd->client_inset.r);
7352 bd->client.h = bd->h - (bd->client_inset.t + bd->client_inset.b);
7357 bd->changes.size = 1;
7358 bd->changes.pos = 1;
7361 evas_render(bd->bg_evas);
7363 ecore_x_pointer_xy_get(e_manager_current_get()->root,
7364 &bd->mouse.current.mx,
7365 &bd->mouse.current.my);
7367 bd->client.netwm.sync.send_time = ecore_loop_time_get();
7368 _e_border_resize_handle(bd);
7370 return ECORE_CALLBACK_PASS_ON;
7374 _e_border_cb_efreet_cache_update(void *data __UNUSED__,
7375 int ev_type __UNUSED__,
7376 void *ev __UNUSED__)
7381 /* mark all borders for desktop/icon updates */
7382 EINA_LIST_FOREACH(borders, l, bd)
7386 efreet_desktop_free(bd->desktop);
7389 bd->changes.icon = 1;
7393 e_init_status_set(_("Desktop files scan done"));
7396 return ECORE_CALLBACK_PASS_ON;
7400 _e_border_cb_config_icon_theme(void *data __UNUSED__,
7401 int ev_type __UNUSED__,
7402 void *ev __UNUSED__)
7407 /* mark all borders for desktop/icon updates */
7408 EINA_LIST_FOREACH(borders, l, bd)
7410 bd->changes.icon = 1;
7413 return ECORE_CALLBACK_PASS_ON;
7417 _e_border_cb_pointer_warp(void *data __UNUSED__,
7418 int ev_type __UNUSED__,
7421 E_Event_Pointer_Warp *e;
7424 if (!bdmove) return ECORE_CALLBACK_PASS_ON;
7425 e_border_move(bdmove, bdmove->x + (e->curr.x - e->prev.x), bdmove->y + (e->curr.y - e->prev.y));
7426 return ECORE_CALLBACK_PASS_ON;
7430 _e_border_cb_signal_bind(void *data,
7431 Evas_Object *obj __UNUSED__,
7432 const char *emission,
7438 if (e_dnd_active()) return;
7439 e_bindings_signal_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(bd),
7444 _e_border_cb_mouse_in(void *data,
7445 int type __UNUSED__,
7448 Ecore_X_Event_Mouse_In *ev;
7453 #ifdef INOUTDEBUG_MOUSE
7458 const char *modes[] = {
7460 "MODE_WHILE_GRABBED",
7464 const char *details[] = {
7468 "DETAIL_NON_LINEAR",
7469 "DETAIL_NON_LINEAR_VIRTUAL",
7471 "DETAIL_POINTER_ROOT",
7472 "DETAIL_DETAIL_NONE"
7476 ct[strlen(ct) - 1] = 0;
7477 DBG("@@ ->IN 0x%x 0x%x %s md=%s dt=%s",
7478 ev->win, ev->event_win,
7481 details[ev->detail]);
7484 if (grabbed) return ECORE_CALLBACK_PASS_ON;
7485 if (ev->event_win == bd->win)
7487 e_focus_event_mouse_in(bd);
7490 if ((ev->win != bd->win) &&
7491 (ev->win != bd->event_win) &&
7492 (ev->event_win != bd->win) &&
7493 (ev->event_win != bd->event_win))
7494 return ECORE_CALLBACK_PASS_ON;
7496 if (ev->win != bd->event_win) return ECORE_CALLBACK_PASS_ON;
7498 bd->mouse.current.mx = ev->root.x;
7499 bd->mouse.current.my = ev->root.y;
7500 if (!bd->bg_evas_in)
7502 evas_event_feed_mouse_in(bd->bg_evas, ev->time, NULL);
7503 bd->bg_evas_in = EINA_TRUE;
7505 return ECORE_CALLBACK_PASS_ON;
7509 _e_border_cb_mouse_out(void *data,
7510 int type __UNUSED__,
7513 Ecore_X_Event_Mouse_Out *ev;
7518 #ifdef INOUTDEBUG_MOUSE
7523 const char *modes[] = {
7525 "MODE_WHILE_GRABBED",
7529 const char *details[] = {
7533 "DETAIL_NON_LINEAR",
7534 "DETAIL_NON_LINEAR_VIRTUAL",
7536 "DETAIL_POINTER_ROOT",
7537 "DETAIL_DETAIL_NONE"
7541 ct[strlen(ct) - 1] = 0;
7542 DBG("@@ <-OUT 0x%x 0x%x %s md=%s dt=%s",
7543 ev->win, ev->event_win,
7546 details[ev->detail]);
7549 if (grabbed) return ECORE_CALLBACK_PASS_ON;
7550 if (ev->event_win == bd->win)
7553 return ECORE_CALLBACK_PASS_ON;
7554 if ((ev->mode == ECORE_X_EVENT_MODE_UNGRAB) &&
7555 (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR))
7556 return ECORE_CALLBACK_PASS_ON;
7557 if (ev->mode == ECORE_X_EVENT_MODE_GRAB)
7558 return ECORE_CALLBACK_PASS_ON;
7559 if ((ev->mode == ECORE_X_EVENT_MODE_NORMAL) &&
7560 (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR))
7561 return ECORE_CALLBACK_PASS_ON;
7562 e_focus_event_mouse_out(bd);
7565 if ((ev->win != bd->win) &&
7566 (ev->win != bd->event_win) &&
7567 (ev->event_win != bd->win) &&
7568 (ev->event_win != bd->event_win))
7569 return ECORE_CALLBACK_PASS_ON;
7571 if (ev->win != bd->event_win) return ECORE_CALLBACK_PASS_ON;
7573 bd->mouse.current.mx = ev->root.x;
7574 bd->mouse.current.my = ev->root.y;
7577 if (!((evas_event_down_count_get(bd->bg_evas) > 0) &&
7578 (!((ev->mode == ECORE_X_EVENT_MODE_GRAB) &&
7579 (ev->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)))))
7581 if (ev->mode == ECORE_X_EVENT_MODE_GRAB)
7582 evas_event_feed_mouse_cancel(bd->bg_evas, ev->time, NULL);
7583 evas_event_feed_mouse_out(bd->bg_evas, ev->time, NULL);
7584 bd->bg_evas_in = EINA_FALSE;
7587 return ECORE_CALLBACK_PASS_ON;
7591 _e_border_cb_mouse_wheel(void *data,
7592 int type __UNUSED__,
7595 Ecore_Event_Mouse_Wheel *ev;
7600 if ((ev->event_window == bd->win) ||
7601 (ev->event_window == bd->event_win))
7603 bd->mouse.current.mx = ev->root.x;
7604 bd->mouse.current.my = ev->root.y;
7605 if (!bd->cur_mouse_action)
7606 e_bindings_wheel_event_handle(E_BINDING_CONTEXT_WINDOW,
7609 evas_event_feed_mouse_wheel(bd->bg_evas, ev->direction, ev->z, ev->timestamp, NULL);
7610 return ECORE_CALLBACK_PASS_ON;
7614 _e_border_cb_mouse_down(void *data,
7615 int type __UNUSED__,
7618 Ecore_Event_Mouse_Button *ev;
7623 if ((ev->event_window == bd->win) ||
7624 (ev->event_window == bd->event_win))
7626 if ((ev->buttons >= 1) && (ev->buttons <= 3))
7628 bd->mouse.last_down[ev->buttons - 1].mx = ev->root.x;
7629 bd->mouse.last_down[ev->buttons - 1].my = ev->root.y;
7630 bd->mouse.last_down[ev->buttons - 1].x = bd->x + bd->fx.x;
7631 bd->mouse.last_down[ev->buttons - 1].y = bd->y + bd->fx.y;
7632 bd->mouse.last_down[ev->buttons - 1].w = bd->w;
7633 bd->mouse.last_down[ev->buttons - 1].h = bd->h;
7637 bd->moveinfo.down.x = bd->x + bd->fx.x;
7638 bd->moveinfo.down.y = bd->y + bd->fx.y;
7639 bd->moveinfo.down.w = bd->w;
7640 bd->moveinfo.down.h = bd->h;
7642 bd->mouse.current.mx = ev->root.x;
7643 bd->mouse.current.my = ev->root.y;
7644 if (!bd->cur_mouse_action)
7646 bd->cur_mouse_action =
7647 e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_WINDOW,
7649 if (bd->cur_mouse_action)
7651 if ((!bd->cur_mouse_action->func.end_mouse) &&
7652 (!bd->cur_mouse_action->func.end))
7653 bd->cur_mouse_action = NULL;
7654 if (bd->cur_mouse_action)
7655 e_object_ref(E_OBJECT(bd->cur_mouse_action));
7658 e_focus_event_mouse_down(bd);
7660 if (ev->window != ev->event_window)
7664 if ((ev->window != bd->event_win) && (ev->event_window != bd->win))
7668 if ((ev->buttons >= 1) && (ev->buttons <= 3))
7670 bd->mouse.last_down[ev->buttons - 1].mx = ev->root.x;
7671 bd->mouse.last_down[ev->buttons - 1].my = ev->root.y;
7672 bd->mouse.last_down[ev->buttons - 1].x = bd->x + bd->fx.x;
7673 bd->mouse.last_down[ev->buttons - 1].y = bd->y + bd->fx.y;
7674 bd->mouse.last_down[ev->buttons - 1].w = bd->w;
7675 bd->mouse.last_down[ev->buttons - 1].h = bd->h;
7679 bd->moveinfo.down.x = bd->x + bd->fx.x;
7680 bd->moveinfo.down.y = bd->y + bd->fx.y;
7681 bd->moveinfo.down.w = bd->w;
7682 bd->moveinfo.down.h = bd->h;
7684 bd->mouse.current.mx = ev->root.x;
7685 bd->mouse.current.my = ev->root.y;
7690 else if (bd->resize_mode != RESIZE_NONE)
7696 Evas_Button_Flags flags = EVAS_BUTTON_NONE;
7698 if (ev->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
7699 if (ev->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
7700 evas_event_feed_mouse_down(bd->bg_evas, ev->buttons, flags, ev->timestamp, NULL);
7702 return ECORE_CALLBACK_PASS_ON;
7706 _e_border_cb_mouse_up(void *data,
7707 int type __UNUSED__,
7710 Ecore_Event_Mouse_Button *ev;
7715 if ((ev->event_window == bd->win) ||
7716 (ev->event_window == bd->event_win))
7718 if ((ev->buttons >= 1) && (ev->buttons <= 3))
7720 bd->mouse.last_up[ev->buttons - 1].mx = ev->root.x;
7721 bd->mouse.last_up[ev->buttons - 1].my = ev->root.y;
7722 bd->mouse.last_up[ev->buttons - 1].x = bd->x + bd->fx.x;
7723 bd->mouse.last_up[ev->buttons - 1].y = bd->y + bd->fx.y;
7725 bd->mouse.current.mx = ev->root.x;
7726 bd->mouse.current.my = ev->root.y;
7727 /* also we dont pass the same params that went in - then again that */
7728 /* should be ok as we are just ending the action if it has an end */
7729 if (bd->cur_mouse_action)
7731 if (bd->cur_mouse_action->func.end_mouse)
7732 bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", ev);
7733 else if (bd->cur_mouse_action->func.end)
7734 bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
7735 e_object_unref(E_OBJECT(bd->cur_mouse_action));
7736 bd->cur_mouse_action = NULL;
7740 if (!e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(bd), ev))
7741 e_focus_event_mouse_up(bd);
7744 if (ev->window != bd->event_win) return ECORE_CALLBACK_PASS_ON;
7745 if ((ev->buttons >= 1) && (ev->buttons <= 3))
7747 bd->mouse.last_up[ev->buttons - 1].mx = ev->root.x;
7748 bd->mouse.last_up[ev->buttons - 1].my = ev->root.y;
7749 bd->mouse.last_up[ev->buttons - 1].x = bd->x + bd->fx.x;
7750 bd->mouse.last_up[ev->buttons - 1].y = bd->y + bd->fx.y;
7752 bd->mouse.current.mx = ev->root.x;
7753 bd->mouse.current.my = ev->root.y;
7757 evas_event_feed_mouse_up(bd->bg_evas, ev->buttons, EVAS_BUTTON_NONE, ev->timestamp, NULL);
7758 return ECORE_CALLBACK_PASS_ON;
7762 _e_border_stay_within_container(E_Border *bd, int x, int y, int *new_x, int *new_y)
7764 #ifdef _F_BORDER_CLIP_TO_ZONE_
7765 int new_x_max, new_y_max;
7766 int new_x_min, new_y_min;
7767 int margin_x, margin_y;
7769 margin_x = bd->w - 100;
7770 margin_y = bd->h - 100;
7772 new_x_max = bd->zone->x + bd->zone->w - bd->w + margin_x;
7773 new_x_min = bd->zone->x - margin_x;
7774 new_y_max = bd->zone->y + bd->zone->h - bd->h + margin_y;
7775 new_y_min = bd->zone->y - margin_y;
7777 if (x >= new_x_max) *new_x = new_x_max;
7778 else if (x <= new_x_min) *new_x = new_x_min;
7780 if (y >= new_y_max) *new_y = new_y_max;
7781 else if (y <= new_y_min) *new_y = new_y_min;
7786 _e_border_cb_mouse_move(void *data,
7787 int type __UNUSED__,
7790 Ecore_Event_Mouse_Move *ev;
7795 if ((ev->window != bd->event_win) &&
7796 (ev->event_window != bd->win)) return ECORE_CALLBACK_PASS_ON;
7797 bd->mouse.current.mx = ev->root.x;
7798 bd->mouse.current.my = ev->root.y;
7801 int x, y, new_x, new_y;
7803 Eina_List *skiplist = NULL;
7805 // FIXME: remove? sync what for when only moving?
7806 if ((ecore_loop_time_get() - bd->client.netwm.sync.time) > 0.5)
7807 bd->client.netwm.sync.wait = 0;
7808 if ((bd->client.netwm.sync.request) &&
7809 (bd->client.netwm.sync.alarm) &&
7810 (bd->client.netwm.sync.wait > 1)) return ECORE_CALLBACK_PASS_ON;
7812 if ((bd->moveinfo.down.button >= 1) && (bd->moveinfo.down.button <= 3))
7814 x = bd->mouse.last_down[bd->moveinfo.down.button - 1].x +
7815 (bd->mouse.current.mx - bd->moveinfo.down.mx);
7816 y = bd->mouse.last_down[bd->moveinfo.down.button - 1].y +
7817 (bd->mouse.current.my - bd->moveinfo.down.my);
7821 x = bd->moveinfo.down.x +
7822 (bd->mouse.current.mx - bd->moveinfo.down.mx);
7823 y = bd->moveinfo.down.y +
7824 (bd->mouse.current.my - bd->moveinfo.down.my);
7829 #ifdef _F_USE_RESIST_MAGNETIC_EFFECT_
7830 skiplist = eina_list_append(skiplist, bd);
7831 e_resist_container_border_position(bd->zone->container, skiplist,
7832 bd->x, bd->y, bd->w, bd->h,
7834 &new_x, &new_y, &new_w, &new_h);
7835 eina_list_free(skiplist);
7837 _e_border_stay_within_container(bd, x, y, &new_x, &new_y);
7839 /* if (e_config->window_out_of_vscreen_limits_partly) */
7841 _e_border_stay_within_container(bd, x, y, &new_x, &new_y);
7844 skiplist = eina_list_append(skiplist, bd);
7845 e_resist_container_border_position(bd->zone->container, skiplist,
7846 bd->x, bd->y, bd->w, bd->h,
7848 &new_x, &new_y, &new_w, &new_h);
7849 eina_list_free(skiplist);
7852 bd->shelf_fix.x = 0;
7853 bd->shelf_fix.y = 0;
7854 bd->shelf_fix.modified = 0;
7855 e_border_move(bd, new_x, new_y);
7856 e_zone_flip_coords_handle(bd->zone, ev->root.x, ev->root.y);
7858 else if (bd->resize_mode != RESIZE_NONE)
7860 if ((bd->client.netwm.sync.request) &&
7861 (bd->client.netwm.sync.alarm))
7863 if ((ecore_loop_time_get() - bd->client.netwm.sync.send_time) > 0.5)
7865 E_Border_Pending_Move_Resize *pnd;
7867 if (bd->pending_move_resize)
7869 bd->changes.pos = 1;
7870 bd->changes.size = 1;
7872 _e_border_client_move_resize_send(bd);
7874 EINA_LIST_FREE(bd->pending_move_resize, pnd)
7877 bd->client.netwm.sync.wait = 0;
7879 /* sync.wait is incremented when resize_handle sends
7880 * sync-request and decremented by sync-alarm cb. so
7881 * we resize here either on initial resize, timeout or
7882 * when no new resize-request was added by sync-alarm cb.
7884 if (!bd->client.netwm.sync.wait)
7885 _e_border_resize_handle(bd);
7888 _e_border_resize_handle(bd);
7894 if ((bd->drag.x == -1) && (bd->drag.y == -1))
7896 bd->drag.x = ev->root.x;
7897 bd->drag.y = ev->root.y;
7903 dx = bd->drag.x - ev->root.x;
7904 dy = bd->drag.y - ev->root.y;
7905 if (((dx * dx) + (dy * dy)) >
7906 (e_config->drag_resist * e_config->drag_resist))
7909 if (bd->icon_object)
7911 Evas_Object *o = NULL;
7912 Evas_Coord x, y, w, h;
7913 const char *drag_types[] = { "enlightenment/border" };
7915 e_object_ref(E_OBJECT(bd));
7916 evas_object_geometry_get(bd->icon_object,
7918 drag_border = e_drag_new(bd->zone->container,
7919 bd->x + bd->fx.x + x,
7920 bd->y + bd->fx.y + y,
7921 drag_types, 1, bd, -1,
7923 _e_border_cb_drag_finished);
7924 o = e_border_icon_add(bd, drag_border->evas);
7927 /* FIXME: fallback icon for drag */
7928 o = evas_object_rectangle_add(drag_border->evas);
7929 evas_object_color_set(o, 255, 255, 255, 255);
7931 e_drag_object_set(drag_border, o);
7933 e_drag_resize(drag_border, w, h);
7934 e_drag_start(drag_border, bd->drag.x, bd->drag.y);
7940 evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, ev->timestamp, NULL);
7942 return ECORE_CALLBACK_PASS_ON;
7946 _e_border_cb_grab_replay(void *data __UNUSED__,
7950 Ecore_Event_Mouse_Button *ev;
7952 if (type != ECORE_EVENT_MOUSE_BUTTON_DOWN) return ECORE_CALLBACK_DONE;
7954 if ((e_config->pass_click_on)
7955 || (e_config->always_click_to_raise) // this works even if not on click-to-focus
7956 || (e_config->always_click_to_focus) // this works even if not on click-to-focus
7961 bd = e_border_find_by_window(ev->event_window);
7964 if (bd->cur_mouse_action)
7965 return ECORE_CALLBACK_DONE;
7966 if (ev->event_window == bd->win)
7968 if (!e_bindings_mouse_down_find(E_BINDING_CONTEXT_WINDOW,
7969 E_OBJECT(bd), ev, NULL))
7970 return ECORE_CALLBACK_PASS_ON;
7974 return ECORE_CALLBACK_DONE;
7978 _e_border_cb_drag_finished(E_Drag *drag,
7979 int dropped __UNUSED__)
7984 e_object_unref(E_OBJECT(bd));
7988 #ifdef _F_USE_DESK_WINDOW_PROFILE_
7990 _e_border_cb_desk_window_profile_change(void *data __UNUSED__,
7991 int ev_type __UNUSED__,
7994 E_Event_Desk_Window_Profile_Change *e;
7999 EINA_LIST_FOREACH(borders, l, bd)
8001 if ((bd) && (!e_object_is_del(E_OBJECT(bd))))
8003 bd->client.e.fetch.profile_list = 1;
8007 return ECORE_CALLBACK_PASS_ON;
8011 #ifdef _F_ZONE_WINDOW_ROTATION_
8013 _e_border_cb_zone_rotation_change_begin(void *data __UNUSED__,
8014 int ev_type __UNUSED__,
8017 E_Event_Zone_Rotation_Change_Begin *e = ev;
8019 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_PASS_ON;
8020 if ((!e) || (!e->zone)) return ECORE_CALLBACK_PASS_ON;
8022 if (!_e_border_rotation_zone_set(e->zone))
8024 /* there is no border which supports window manager rotation */
8025 e_zone_rotation_update_cancel(e->zone);
8027 return ECORE_CALLBACK_PASS_ON;
8031 _e_border_cb_rotation_sync_job(void *data)
8033 E_Zone *zone = data;
8035 E_Border_Rotation_Info *info = NULL;
8037 ELB(ELBT_ROT, "DO ROTATION SYNC_JOB", zone->id);
8041 EINA_LIST_FOREACH(rot.list, l, info)
8042 _e_border_hook_call(E_BORDER_HOOK_ROTATION_LIST_ADD, info->bd);
8043 if (!rot.wait_prepare_done)
8045 _e_border_rotation_change_request(zone);
8052 ELB(ELBT_ROT, "DEL SYNC_JOB", zone->id);
8053 ecore_job_del(rot.sync_job);
8054 rot.sync_job = NULL;
8059 _e_border_cb_rotation_async_job(void *data)
8061 E_Zone *zone = data;
8063 if (rot.list) goto end;
8065 ELB(ELBT_ROT, "FLUSH ASYNC LIST TO ROT_CHANGE_REQ", zone->id);
8067 if (!rot.wait_prepare_done)
8069 _e_border_rotation_list_flush(rot.async_list, EINA_TRUE);
8070 rot.async_list = NULL;
8077 ELB(ELBT_ROT, "DEL ASYNC_JOB", zone->id);
8078 ecore_job_del(rot.async_job);
8079 rot.async_job = NULL;
8084 _e_border_rotation_change_prepare_timeout(void *data)
8086 E_Zone *zone = data;
8087 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_CANCEL;
8089 ELB(ELBT_ROT, "TIMEOUT ROT_CHANGE_PREPARE", 0);
8091 if ((zone) && (rot.wait_prepare_done))
8095 _e_border_rotation_change_request(zone);
8096 if (rot.prepare_timer)
8097 ecore_timer_del(rot.prepare_timer);
8098 rot.prepare_timer = NULL;
8099 rot.wait_prepare_done = EINA_FALSE;
8102 return ECORE_CALLBACK_CANCEL;
8106 _e_border_rotation_change_request(E_Zone *zone)
8108 if (!e_config->wm_win_rotation) return;
8109 if (!rot.list) return;
8110 if (eina_list_count(rot.list) <= 0) return;
8111 if (zone->rot.block_count) return;
8113 if (rot.prepare_timer) ecore_timer_del(rot.prepare_timer);
8114 rot.prepare_timer = NULL;
8115 rot.wait_prepare_done = EINA_FALSE;
8117 _e_border_rotation_list_flush(rot.list, EINA_FALSE);
8120 ecore_timer_del(rot.done_timer);
8121 ELB(ELBT_ROT, "ADD TIMEOUT ROT_DONE", zone->id);
8122 rot.done_timer = ecore_timer_add(5.0f,
8123 _e_border_rotation_change_done_timeout,
8128 _e_border_rotation_list_flush(Eina_List *list, Eina_Bool flush)
8131 E_Border_Rotation_Info *info =NULL;
8134 EINA_LIST_FOREACH (list, l, info)
8136 if (!info->bd) continue;
8137 if ((info->bd->client.e.state.rot.wait_for_done) &&
8138 (info->bd->client.e.state.rot.wait_done_ang == info->ang)) continue;
8140 _e_border_event_border_rotation_change_begin_send(info->bd);
8143 info->win_resize = _e_border_rotation_pre_resize(info->bd, info->ang, &x, &y, &w, &h);
8144 info->bd->client.e.state.rot.pending_change_request = info->win_resize;
8146 info->x = x; info->y = y;
8147 info->w = w; info->h = h;
8149 ELBF(ELBT_ROT, 1, info->bd->client.win,
8150 "SEND ROT_CHANGE_PREPARE a%d res%d %dx%d",
8151 info->ang, info->win_resize, info->w, info->h);
8153 ecore_x_e_window_rotation_change_prepare_send
8154 (info->bd->client.win, info->ang,
8155 info->win_resize, info->w, info->h);
8157 if (!info->bd->client.e.state.rot.pending_change_request)
8159 ELBF(ELBT_ROT, 1, 0, "SEND ROT_CHANGE_REQUEST");
8160 ecore_x_e_window_rotation_change_request_send(info->bd->client.win,
8162 info->bd->client.e.state.rot.wait_for_done = 1;
8163 info->bd->client.e.state.rot.wait_done_ang = info->ang;
8169 EINA_LIST_FREE(list, info)
8175 e_border_rotation_list_clear(E_Zone *zone, Eina_Bool send_request)
8177 E_Border_Rotation_Info *info = NULL;
8179 if (send_request) _e_border_rotation_change_request(zone);
8182 EINA_LIST_FREE(rot.list, info)
8189 _e_border_rotation_list_remove(E_Border *bd)
8191 Eina_List *l = NULL;
8192 E_Border_Rotation_Info *info = NULL;
8193 E_Event_Border_Rotation_Change_End *ev = NULL;
8194 Eina_Bool found = EINA_FALSE;
8196 if (!e_config->wm_win_rotation) return;
8198 EINA_LIST_FOREACH(rot.list, l, info)
8202 rot.list = eina_list_remove(rot.list, info);
8208 if (bd->client.e.state.rot.wait_for_done)
8210 bd->client.e.state.rot.wait_for_done = 0;
8212 /* if we make the border event in the _e_border_free function,
8213 * then we may meet a crash problem, only work this at least e_border_hide.
8215 if (!e_object_is_del(E_OBJECT(bd)))
8217 ev = E_NEW(E_Event_Border_Rotation_Change_End, 1);
8221 e_object_ref(E_OBJECT(bd));
8222 ecore_event_add(E_EVENT_BORDER_ROTATION_CHANGE_END,
8224 _e_border_event_border_rotation_change_end_free,
8230 (eina_list_count(rot.list) == 0))
8232 _e_border_rotation_change_done();
8238 _e_border_rotation_change_done_timeout(void *data __UNUSED__)
8240 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_CANCEL;
8241 ELB(ELBT_ROT, "TIMEOUT ROT_CHANGE", 0);
8242 _e_border_rotation_change_done();
8243 return ECORE_CALLBACK_CANCEL;
8247 _e_border_rotation_change_done(void)
8249 E_Manager *m = NULL;
8250 E_Border_Rotation_Info *info = NULL;
8252 if (!e_config->wm_win_rotation) return;
8254 if (rot.prepare_timer) ecore_timer_del(rot.prepare_timer);
8255 rot.prepare_timer = NULL;
8257 rot.wait_prepare_done = EINA_FALSE;
8259 if (rot.done_timer) ecore_timer_del(rot.done_timer);
8260 rot.done_timer = NULL;
8262 EINA_LIST_FREE(rot.list, info)
8266 ELB(ELBT_ROT, "TIMEOUT ROT_DONE", info->bd->client.win);
8267 if (info->bd->client.e.state.rot.pending_show)
8269 ELB(ELBT_ROT, "SHOW PEND(TIMEOUT)", info->bd->client.win);
8270 e_border_show(info->bd);
8271 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
8272 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
8273 _e_border_check_stack(info->bd);
8275 info->bd->client.e.state.rot.pending_show = 0;
8277 info->bd->client.e.state.rot.wait_for_done = 0;
8282 _e_border_rotation_list_flush(rot.async_list, EINA_TRUE);
8285 rot.async_list = NULL;
8287 m = e_manager_current_get();
8288 e_manager_comp_screen_unlock(m);
8289 e_zone_rotation_update_done(e_util_zone_current_get(m));
8293 _prev_angle_get(Ecore_X_Window win)
8295 int ret, count = 0, ang = -1;
8296 unsigned char* data = NULL;
8298 ret = ecore_x_window_prop_property_get
8299 (win, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
8300 ECORE_X_ATOM_CARDINAL, 32, &data, &count);
8302 if ((ret) && (data) && (count))
8303 ang = ((int *)data)[0];
8304 if (data) free(data);
8308 /* get proper rotation value using preferred rotation and list of available rotations */
8310 _e_border_rotation_get(E_Border *bd,
8314 int current_ang = bd->client.e.state.rot.curr;
8316 Eina_Bool found = EINA_FALSE;
8317 Eina_Bool found_curr_ang = EINA_FALSE;
8319 if (!e_config->wm_win_rotation) return ang;
8320 if (!bd->client.e.state.rot.app_set) return ang;
8322 if (bd->client.e.state.rot.preferred_rot != -1)
8324 ang = bd->client.e.state.rot.preferred_rot;
8325 ELBF(ELBT_ROT, 0, bd->client.win, "ang:%d base_ang:%d", ang, base_ang);
8327 else if ((bd->client.e.state.rot.available_rots) &&
8328 (bd->client.e.state.rot.count))
8330 for (i = 0; i < bd->client.e.state.rot.count; i++)
8332 if (bd->client.e.state.rot.available_rots[i] == base_ang)
8338 if (bd->client.e.state.rot.available_rots[i] == current_ang)
8339 found_curr_ang = EINA_TRUE;
8342 /* do nothing. this window wants to maintain current state.
8343 * for example, window's available_rots: 0, 90, 270,
8344 * current zone rotation request: 180. the WM does nothing
8349 if ((bd->client.e.state.rot.curr != -1) && (found_curr_ang))
8350 ang = bd->client.e.state.rot.curr;
8352 ang = bd->client.e.state.rot.available_rots[0];
8357 /* In this case, border doesn't have a list of
8358 * available rotations, thus WM should request
8359 * rotation with '0' degree to the application.
8368 _e_border_rotation_angle_get(E_Border *bd)
8370 E_Zone *zone = bd->zone;
8375 if (!e_config->wm_win_rotation) return ret;
8376 if (bd->client.e.state.rot.type != E_BORDER_ROTATION_TYPE_NORMAL) return ret;
8378 ELB(ELBT_ROT, "CHECK ROT", bd->client.win);
8380 // the window with "ECORE_X_WINDOW_TYPE_NORMAL" type
8381 // should follow the state of rotation of zone.
8383 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NORMAL))
8384 will_ang = bd->parent->client.e.state.rot.curr;
8385 else will_ang = zone->rot.curr;
8387 if (bd->client.vkbd.win_type != E_VIRTUAL_KEYBOARD_WINDOW_TYPE_NONE)
8389 ELBF(ELBT_ROT, 1, bd->client.win,
8390 "%s->parent:0x%08x (support:%d app_set:%d ang:%d)",
8391 (rot.vkbd == bd) ? "vkbd" : "prediction",
8392 bd->parent ? bd->parent->client.win : 0,
8393 bd->parent ? bd->parent->client.e.state.rot.support : -1,
8394 bd->parent ? bd->parent->client.e.state.rot.app_set : -1,
8395 bd->parent ? bd->parent->client.e.state.rot.curr : -1);
8399 will_ang = bd->parent->client.e.state.rot.curr;
8400 if ((!bd->parent->client.e.state.rot.support) &&
8401 (!bd->parent->client.e.state.rot.app_set))
8408 if ((!bd->client.e.state.rot.app_set) &&
8409 (!bd->client.e.state.rot.support))
8411 /* hack for magnifier and keyboard popup */
8412 if ((bd->client.vkbd.win_type == E_VIRTUAL_KEYBOARD_WINDOW_TYPE_MAGNIFIER) ||
8413 (bd->client.vkbd.win_type == E_VIRTUAL_KEYBOARD_WINDOW_TYPE_POPUP))
8415 ELB(ELBT_BD, "MAG", bd->client.win);
8417 if ((rot.vkbd) && (rot.vkbd->visible))
8418 will_ang = rot.vkbd->client.e.state.rot.curr;
8422 if (bd->client.e.state.rot.app_set)
8424 /* utility type window should be rotated according to
8425 * rotation of the transient_for window.
8428 (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UTILITY))
8430 will_ang = bd->parent->client.e.state.rot.curr;
8431 if ((!bd->parent->client.e.state.rot.support) &&
8432 (!bd->parent->client.e.state.rot.app_set))
8434 /* if transient_for window doesn't support rotation feature,
8435 * then this window should't be rotated.
8436 * TODO: need to check whether window supports '0' degree or not.
8439 ELBF(ELBT_ROT, 0, bd->client.win,
8440 "GET ROT ang:%d Transient_For:0x%08x Not support rot",
8441 will_ang, bd->parent->client.win);
8445 will_ang = _e_border_rotation_get(bd->parent, will_ang);
8446 ELBF(ELBT_ROT, 0, bd->client.win,
8447 "GET ROT ang:%d Transient_For:0x%08x",
8448 will_ang, bd->parent->client.win);
8453 will_ang = _e_border_rotation_get(bd, will_ang);
8454 ELBF(ELBT_ROT, 0, bd->client.win, "GET ROT ang:%d bd->parent:0x%08x type:%d",
8455 will_ang, bd->parent ? bd->parent->client.win : 0,
8456 bd->client.netwm.type);
8462 _ang = _prev_angle_get(bd->client.win);
8464 bd->client.e.state.rot.curr = _ang;
8465 ELBF(ELBT_ROT, 1, bd->client.win, "prev_ang:%d", _ang);
8468 if (bd->client.e.state.rot.curr != will_ang)
8476 _e_border_rotation_zone_set(E_Zone *zone)
8478 E_Border_List *l = NULL;
8479 E_Border *bd = NULL;
8480 Eina_Bool ret = EINA_FALSE;
8482 if (!e_config->wm_win_rotation) return EINA_FALSE;
8484 l = e_container_border_list_last(zone->container);
8487 /* step 1. make the list needs to be rotated. */
8488 while ((bd = e_container_border_list_prev(l)))
8492 // if this window has parent and window type isn't "ECORE_X_WINDOW_TYPE_NORMAL",
8493 // it will be rotated when parent do rotate itself.
8496 (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NORMAL)) continue;
8498 // default type is "E_BORDER_ROTATION_TYPE_NORMAL",
8499 // but it can be changed to "E_BORDER_ROTATION_TYPE_DEPENDENT" by illume according to its policy.
8500 // if it's not normal type window, will be rotated by illume.
8502 if (bd->client.e.state.rot.type != E_BORDER_ROTATION_TYPE_NORMAL) continue;
8504 if ((!bd->visible) ||
8505 (!E_INTERSECTS(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h,
8506 bd->x, bd->y, bd->w, bd->h))) continue;
8508 if (_e_border_rotatable_check(bd, zone->rot.curr))
8510 ELBF(ELBT_ROT, 0, bd->client.win, "ROT_SET(main) curr:%d != TOBE:%d",
8511 bd->client.e.state.rot.curr, zone->rot.curr);
8513 ret = e_border_rotation_set(bd, zone->rot.curr);
8516 if (l) e_container_border_list_free(l);
8522 _e_border_rotation_set_internal(E_Border *bd, int rotation, Eina_Bool *pending)
8524 E_Zone *zone = bd->zone;
8525 E_Border_Rotation_Info *info = NULL;
8526 Eina_List *list, *l;
8529 if (rotation < 0) return EINA_FALSE;
8530 if (pending) *pending = EINA_FALSE;
8532 /* step 1. check if rotation */
8533 if (!_e_border_rotatable_check(bd, rotation)) return EINA_FALSE;
8535 /* step 2. add to async/sync list */
8536 if ((!zone->rot.block_count) &&
8538 (!E_INTERSECTS(bd->x, bd->y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h))))
8540 // send rotation change request later.
8541 // and no need to wait message of rotation done.
8544 info = E_NEW(E_Border_Rotation_Info, 1);
8545 if (!info) return EINA_FALSE;
8546 ELB(ELBT_ROT, "ADD ASYNC LIST", 0);
8548 info->ang = rotation;
8549 rot.async_list = eina_list_append(rot.async_list, info);
8551 // add job for sending event.
8554 ELB(ELBT_ROT, "ADD ASYNC_JOB", bd->client.win);
8555 rot.async_job = ecore_job_add(_e_border_cb_rotation_async_job, zone);
8561 info = E_NEW(E_Border_Rotation_Info, 1);
8562 if (!info) return EINA_FALSE;
8563 ELB(ELBT_ROT, "ADD SYNC LIST", 0);
8565 info->ang = rotation;
8566 rot.list = eina_list_append(rot.list, info);
8568 // add job for sending event.
8571 ELB(ELBT_ROT, "ADD SYNC_JOB", bd->client.win);
8572 rot.sync_job = ecore_job_add(_e_border_cb_rotation_sync_job, zone);
8575 // if there is windows over 2 that has to be rotated or is existed window needs resizing,
8577 // but, DO NOT lock the screen when rotation block state.
8578 if ((!zone->rot.block_count) &&
8579 ((eina_list_count(rot.list) == 2)))
8580 e_manager_comp_screen_lock(e_manager_current_get());
8583 if (pending) *pending = EINA_TRUE;
8585 /* step 3. search rotatable window in this window's child */
8586 list = _e_border_sub_borders_new(bd);
8587 EINA_LIST_FOREACH(list, l, child)
8589 // the window which type is "ECORE_X_WINDOW_TYPE_NORMAL" will be rotated itself.
8590 // it shouldn't be rotated by rotation state of parent window.
8591 if (child->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) continue;
8592 if (_e_border_rotatable_check(child, rotation))
8594 ELBF(ELBT_ROT, 0, child->client.win, "ROT_SET(child) curr:%d != TOBE:%d",
8595 bd->client.e.state.rot.curr, rotation);
8596 e_border_rotation_set(child, rotation);
8600 /* step 4. if there is vkbd window, send message to prepare rotation */
8601 if (_e_border_is_vkbd(bd))
8603 ELB(ELBT_ROT, "PENDING ROT_REQ UNTIL GET PREP_DONE", rot.vkbd_ctrl_win);
8604 if (rot.prepare_timer)
8605 ecore_timer_del(rot.prepare_timer);
8606 rot.prepare_timer = NULL;
8609 ecore_timer_del(rot.done_timer);
8610 rot.done_timer = NULL;
8612 ELB(ELBT_ROT, "SEND ROT_CHANGE_PREPARE", rot.vkbd_ctrl_win);
8613 ecore_x_e_window_rotation_change_prepare_send(rot.vkbd_ctrl_win,
8616 rot.prepare_timer = ecore_timer_add(4.0f,
8617 _e_border_rotation_change_prepare_timeout,
8620 rot.wait_prepare_done = EINA_TRUE;
8623 bd->client.e.state.rot.prev = bd->client.e.state.rot.curr;
8624 bd->client.e.state.rot.curr = rotation;
8629 // check if border is rotatable in ang.
8631 _e_border_rotatable_check(E_Border *bd, int ang)
8633 Eina_Bool ret = EINA_FALSE;
8635 if (!bd) return ret;
8636 if (ang < 0) return ret;
8637 if ((!bd->client.e.state.rot.support) && (!bd->client.e.state.rot.app_set)) return ret;
8638 if (e_object_is_del(E_OBJECT(bd))) return ret;
8640 // same with current angle of window, then false return.
8641 if (ang == bd->client.e.state.rot.curr) return ret;
8643 /* basically WM allows only fullscreen window to rotate */
8644 if (bd->client.e.state.rot.preferred_rot == -1)
8648 if (bd->client.e.state.rot.app_set)
8650 if (bd->client.e.state.rot.available_rots &&
8651 bd->client.e.state.rot.count)
8653 Eina_Bool found = EINA_FALSE;
8654 for (i = 0; i < bd->client.e.state.rot.count; i++)
8656 if (bd->client.e.state.rot.available_rots[i] == ang)
8661 if (found) ret = EINA_TRUE;
8666 ELB(ELBT_ROT, "DO ROT", 0);
8670 // if it has preferred rotation angle,
8671 // it will be rotated at border's evaluation time.
8673 else if (bd->client.e.state.rot.preferred_rot == ang) ret = EINA_TRUE;
8678 /* check whether virtual keyboard is visible on the zone */
8680 _e_border_is_vkbd(E_Border *bd)
8682 if (!e_config->wm_win_rotation) return EINA_FALSE;
8684 if ((rot.vkbd_ctrl_win) &&
8686 (!e_object_is_del(E_OBJECT(rot.vkbd))) &&
8687 (rot.vkbd->zone == bd->zone) &&
8688 (E_INTERSECTS(bd->zone->x, bd->zone->y,
8689 bd->zone->w, bd->zone->h,
8690 rot.vkbd->x, rot.vkbd->y,
8691 rot.vkbd->w, rot.vkbd->h)))
8699 _e_border_rotation_change_floating_pos(E_Border *bd, int *x, int *y)
8702 int min_title_width=96;
8704 if (!bd) return EINA_FALSE;
8705 if (!x || !y) return EINA_FALSE;
8710 // Portrait -> Landscape, x= pre_x*2, y=pre_y/2
8711 // Landscape -> Portrait, x= pre_x/2, y=pre_y*2
8712 // guaranteeing the minimum size of titlebar shown, min_title_width
8713 // so user can initiate drag&drop action after rotation changed.
8714 if (bd->client.e.state.rot.curr == 0)
8716 if (bd->client.e.state.rot.prev == 90)
8718 new_x = (bd->zone->h - bd->h - bd->y) / 2;
8721 else if (bd->client.e.state.rot.prev == 270)
8724 new_y = (bd->zone->w - bd->w - bd->x) * 2;
8726 else if (bd->client.e.state.rot.prev == 180)
8728 new_x = bd->zone->w - bd->x - bd->w;
8729 new_y = bd->zone->h - bd->y - bd->h;
8732 if(new_x + bd->w < min_title_width)
8734 new_x = min_title_width - bd->w;
8736 else if(new_x > bd->zone->w - min_title_width)
8738 new_x = bd->zone->w - min_title_width;
8741 else if (bd->client.e.state.rot.curr == 90)
8743 if (bd->client.e.state.rot.prev == 0)
8746 new_y = bd->zone->h - (2 * bd->x) - bd->w;
8748 else if (bd->client.e.state.rot.prev == 270)
8750 new_x = bd->zone->w - bd->x - bd->w;
8751 new_y = bd->zone->h - bd->y - bd->h;
8753 else if (bd->client.e.state.rot.prev == 180)
8755 new_x = (bd->zone->h - bd->y - bd->h) / 2;
8756 new_y = bd->zone->h - (2 * (bd->zone->w - bd->x - bd->w)) - bd->w;
8759 if(new_y > bd->zone->h - min_title_width)
8761 new_y = bd->zone->h - min_title_width;
8763 else if(new_y < min_title_width - bd->w)
8765 new_y = min_title_width - bd->w;
8768 else if (bd->client.e.state.rot.curr == 270)
8770 if (bd->client.e.state.rot.prev == 0)
8772 new_x = bd->zone->w - bd->h - (bd->y / 2);
8775 else if (bd->client.e.state.rot.prev == 90)
8777 new_x = bd->zone->w - bd->x - bd->w;
8778 new_y = bd->zone->h - bd->y - bd->h;
8780 else if (bd->client.e.state.rot.prev == 180)
8782 new_x = bd->zone->w - bd->x - bd->w;
8783 new_y = bd->zone->h - bd->y - bd->h;
8785 new_x = bd->zone->w - bd->h - ((bd->zone->h - bd->y - bd->h) / 2);
8786 new_y = (bd->zone->w - bd->x - bd->w) * 2;
8789 if(new_y > bd->zone->h - min_title_width)
8791 new_y = bd->zone->h - min_title_width;
8793 else if( new_y + bd->w < min_title_width)
8795 new_y = min_title_width - bd->w ;
8798 else if (bd->client.e.state.rot.curr == 180)
8800 if (bd->client.e.state.rot.prev == 0)
8802 new_x = bd->zone->w - bd->x - bd->w;
8803 new_y = bd->zone->h - bd->y - bd->h;
8805 else if (bd->client.e.state.rot.prev == 90)
8807 new_x = bd->zone->w - ((bd->zone->h - bd->h - bd->y) / 2) - bd->h;
8808 new_y = bd->zone->h - (2 * bd->x) - bd->w;
8810 else if (bd->client.e.state.rot.prev == 270)
8812 new_x = bd->zone->w - (bd->y / 2) - bd->h;
8813 new_y = bd->zone->h - ((bd->zone->w - bd->w - bd->x) * 2) - bd->w;
8816 if(new_x + bd->w < min_title_width)
8818 new_x = min_title_width - bd->w;
8820 else if(new_x > bd->zone->w - min_title_width)
8822 new_x = bd->zone->w - min_title_width;
8826 ELBF(ELBT_ROT, 0, bd->client.win,
8827 "Floating Mode. ANGLE (%d->%d), POS (%d,%d) -> (%d,%d)",
8828 bd->client.e.state.rot.prev, bd->client.e.state.rot.curr,
8829 bd->x, bd->y, new_x, new_y);
8831 if ((new_x == *x) &&
8843 #define SIZE_EQUAL_TO_ZONE(a, z) \
8844 ((((a)->w) == ((z)->w)) && \
8845 (((a)->h) == ((z)->h)))
8847 _e_border_rotation_pre_resize(E_Border *bd, int rotation, int *x, int *y, int *w, int *h)
8849 E_Zone *zone = bd->zone;
8852 Eina_Bool move = EINA_FALSE;
8853 Eina_Bool hint = EINA_FALSE;
8854 Eina_Bool resize = EINA_FALSE;
8861 if (SIZE_EQUAL_TO_ZONE(bd, zone)) return resize;
8863 ELB(ELBT_ROT, "SIZE DIFF WITH ZONE", 0);
8864 ELBF(ELBT_ROT, 0, bd->client.win, "ORIGIN_SIZE name:%s (%d,%d) %dx%d",
8865 bd->client.icccm.name, bd->x, bd->y, bd->w, bd->h);
8867 hint = _e_border_rotation_geom_get(bd, bd->zone, rotation,
8868 &_x, &_y, &_w, &_h, &move);
8871 _e_border_move_resize_internal(bd, _x, _y, _w, _h, EINA_TRUE, move);
8873 ELBF(ELBT_ROT, 0, bd->client.win, "RESIZE_BY_HINT name:%s (%d,%d) %dx%d",
8874 bd->client.icccm.name, _x, _y, _w, _h);
8878 _x = bd->x; _y = bd->y;
8879 _w = bd->w; _h = bd->h;
8881 if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING)
8882 move = _e_border_rotation_change_floating_pos(bd, &_x, &_y);
8886 rot_dif = bd->client.e.state.rot.prev - rotation;
8887 if (rot_dif < 0) rot_dif = -rot_dif;
8896 _e_border_move_resize_internal(bd, _x, _y, _w, _h,
8897 EINA_TRUE, EINA_TRUE);
8898 ELBF(ELBT_ROT, 0, bd->client.win, "MANUAL_RESIZE name:%s (%d,%d) %dx%d",
8899 bd->client.icccm.name, _x, _y, _w, _h);
8904 if (!resize && move)
8905 _e_border_move_internal(bd, _x, _y, EINA_TRUE);
8920 _e_border_cb_window_configure(void *data __UNUSED__,
8921 int ev_type __UNUSED__,
8924 Ecore_X_Event_Window_Configure *e = ev;
8925 E_Border_Rotation_Info *info = NULL;
8927 Eina_Bool found = EINA_FALSE;
8929 if (!e) return ECORE_CALLBACK_PASS_ON;
8930 if (!e_config->wm_win_rotation) return ECORE_CALLBACK_PASS_ON;
8932 E_Border *bd = e_border_find_by_client_window(e->win);
8933 if (!bd) return ECORE_CALLBACK_PASS_ON;
8935 if (bd->client.e.state.rot.pending_change_request)
8937 if ((e->w == bd->w) && (e->h == bd->h))
8939 ELB(ELBT_BD, "GET CONFIGURE_NOTI (ROTATION)", bd->client.win);
8940 bd->client.e.state.rot.pending_change_request = 0;
8942 if ((bd->client.e.state.rot.wait_for_done) &&
8943 (bd->client.e.state.rot.wait_done_ang == bd->client.e.state.rot.curr)) goto end;
8945 // if this window is rotation dependent window and zone is blocked to rotate,
8946 // then skip here, request will be sent after cancel block.
8947 if ((bd->client.e.state.rot.type == E_BORDER_ROTATION_TYPE_DEPENDENT) &&
8948 (bd->zone->rot.block_count)) goto end;
8950 EINA_LIST_FOREACH(rot.list, l, info)
8951 if (info->bd == bd) found = EINA_TRUE;
8952 // send request message if it's async rotation window,
8953 // even if wait prepare done.
8954 if ((found) && (rot.wait_prepare_done)) goto end;
8956 ELBF(ELBT_ROT, 0, bd->client.win,
8957 "SEND ROT_CHANGE_REQUEST a%d %dx%d",
8958 bd->client.e.state.rot.curr,
8960 ecore_x_e_window_rotation_change_request_send(bd->client.win,
8961 bd->client.e.state.rot.curr);
8962 bd->client.e.state.rot.wait_for_done = 1;
8963 bd->client.e.state.rot.wait_done_ang = bd->client.e.state.rot.curr;
8968 return ECORE_CALLBACK_PASS_ON;
8972 _e_border_rotation_geom_get(E_Border *bd,
8981 if (!e_config->wm_win_rotation) return EINA_FALSE;
8983 Eina_Bool res = EINA_FALSE;
8984 Eina_Bool _move = EINA_TRUE;
8994 if (move) *move = EINA_TRUE;
8996 if (bd->client.e.state.rot.geom_hint)
9001 _w = bd->client.e.state.rot.geom[0].w;
9002 _h = bd->client.e.state.rot.geom[0].h;
9003 if (_w == 0) _w = bd->w;
9004 if (_h == 0) _h = bd->h;
9005 _x = 0; _y = zone->h - _h;
9008 _w = bd->client.e.state.rot.geom[1].w;
9009 _h = bd->client.e.state.rot.geom[1].h;
9010 if (_w == 0) _w = bd->w;
9011 if (_h == 0) _h = bd->h;
9012 _x = zone->w - _w; _y = 0;
9015 _w = bd->client.e.state.rot.geom[2].w;
9016 _h = bd->client.e.state.rot.geom[2].h;
9017 if (_w == 0) _w = bd->w;
9018 if (_h == 0) _h = bd->h;
9022 _w = bd->client.e.state.rot.geom[3].w;
9023 _h = bd->client.e.state.rot.geom[3].h;
9024 if (_w == 0) _w = bd->w;
9025 if (_h == 0) _h = bd->h;
9035 if (!((rot.vkbd) && (rot.vkbd == bd)))
9039 if (move) *move = EINA_FALSE;
9047 _x = 0; _y = 0; _w = 0; _h = 0;
9052 if (move) _move = *move;
9054 ELBF(ELBT_ROT, 1, bd->client.win,
9055 "GET SIZE_HINT[%d] %d,%d %dx%d move:%d",
9056 ang, _x, _y, _w, _h, _move);
9064 _e_border_post_move_resize_job(void *data)
9068 bd = (E_Border *)data;
9074 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
9075 ecore_x_window_move(tmp->win,
9077 bd->client_inset.l +
9079 tmp->client.e.state.video_position.x,
9081 bd->client_inset.t +
9083 tmp->client.e.state.video_position.y);
9085 if (bd->client.e.state.video)
9089 parent = bd->client.e.state.video_parent_border;
9090 ecore_x_window_move(bd->win,
9092 parent->client_inset.l +
9094 bd->client.e.state.video_position.x,
9096 parent->client_inset.t +
9098 bd->client.e.state.video_position.y);
9100 else if ((bd->post_move) && (bd->post_resize))
9102 ecore_x_window_move_resize(bd->win,
9107 else if (bd->post_move)
9109 ecore_x_window_move(bd->win, bd->x + bd->fx.x, bd->y + bd->fx.y);
9111 else if (bd->post_resize)
9113 ecore_x_window_resize(bd->win, bd->w, bd->h);
9116 if (bd->client.e.state.video)
9118 fprintf(stderr, "%x: [%i, %i] [%i, %i]\n",
9120 bd->client.e.state.video_parent_border->x +
9121 bd->client.e.state.video_parent_border->client_inset.l +
9122 bd->client.e.state.video_parent_border->fx.x +
9123 bd->client.e.state.video_position.x,
9124 bd->client.e.state.video_parent_border->y +
9125 bd->client.e.state.video_parent_border->client_inset.t +
9126 bd->client.e.state.video_parent_border->fx.y +
9127 bd->client.e.state.video_position.y,
9135 bd->post_job = NULL;
9141 bd->post_resize = 0;
9142 bd->post_job = NULL;
9143 return ECORE_CALLBACK_CANCEL;
9147 _e_border_container_layout_hook(E_Container *con)
9149 _e_border_hook_call(E_BORDER_HOOK_CONTAINER_LAYOUT, con);
9153 _e_border_eval0(E_Border *bd)
9155 int change_urgent = 0;
9157 #ifdef _F_USE_DESK_WINDOW_PROFILE_
9158 Eina_Bool need_desk_set = EINA_FALSE;
9160 #ifdef _F_ZONE_WINDOW_ROTATION_
9161 Eina_Bool need_rotation_set = EINA_FALSE;
9163 if ((e_config->wm_win_rotation) &&
9164 (bd->client.icccm.fetch.transient_for))
9166 if (((rot.vkbd) && (rot.vkbd == bd)) ||
9167 ((rot.vkbd_prediction) && (rot.vkbd_prediction == bd)))
9169 need_rotation_set = EINA_TRUE;
9170 ELB(ELBT_BD, "UPDATE TRANSIENT_FOR", bd->client.win);
9175 if (e_object_is_del(E_OBJECT(bd)))
9177 CRI("_e_border_eval(%p) with deleted border!\n", bd);
9182 _e_border_hook_call(E_BORDER_HOOK_EVAL_PRE_FETCH, bd);
9184 bd->changes.border = 0;
9186 /* fetch any info queued to be fetched */
9187 if (bd->client.netwm.fetch.state)
9189 e_hints_window_state_get(bd);
9190 bd->client.netwm.fetch.state = 0;
9193 if (bd->client.icccm.fetch.client_leader)
9195 /* TODO: What do to if the client leader isn't mapped yet? */
9196 E_Border *bd_leader = NULL;
9198 bd->client.icccm.client_leader = ecore_x_icccm_client_leader_get(bd->client.win);
9199 if (bd->client.icccm.client_leader)
9200 bd_leader = e_border_find_by_client_window(bd->client.icccm.client_leader);
9203 if (bd->leader != bd_leader)
9205 bd->leader->group = eina_list_remove(bd->leader->group, bd);
9206 if (bd->leader->modal == bd) bd->leader->modal = NULL;
9212 /* If this border is the leader of the group, don't register itself */
9213 if ((bd_leader) && (bd_leader != bd))
9215 bd_leader->group = eina_list_append(bd_leader->group, bd);
9216 bd->leader = bd_leader;
9217 /* Only set the window modal to the leader it there is no parent */
9218 if ((e_config->modal_windows) && (bd->client.netwm.state.modal) &&
9219 ((!bd->parent) || (bd->parent->modal != bd)))
9221 bd->leader->modal = bd;
9222 if (bd->leader->focused)
9223 e_border_focus_set(bd, 1, 1);
9229 EINA_LIST_FOREACH(bd->leader->group, l, child)
9231 if ((child != bd) && (child->focused))
9232 e_border_focus_set(bd, 1, 1);
9237 bd->client.icccm.fetch.client_leader = 0;
9240 if (bd->client.icccm.fetch.title)
9242 char *title = ecore_x_icccm_title_get(bd->client.win);
9243 eina_stringshare_replace(&bd->client.icccm.title, title);
9244 if (title) free(title);
9247 edje_object_part_text_set(bd->bg_object, "e.text.title",
9248 bd->client.icccm.title);
9249 bd->client.icccm.fetch.title = 0;
9252 if (bd->client.netwm.fetch.name)
9255 ecore_x_netwm_name_get(bd->client.win, &name);
9256 eina_stringshare_replace(&bd->client.netwm.name, name);
9257 if (name) free(name);
9260 edje_object_part_text_set(bd->bg_object, "e.text.title",
9261 bd->client.netwm.name);
9262 bd->client.netwm.fetch.name = 0;
9265 if (bd->client.icccm.fetch.name_class)
9267 const char *pname, *pclass;
9268 char *nname, *nclass;
9270 ecore_x_icccm_name_class_get(bd->client.win, &nname, &nclass);
9271 pname = bd->client.icccm.name;
9272 pclass = bd->client.icccm.class;
9273 bd->client.icccm.name = eina_stringshare_add(nname);
9274 bd->client.icccm.class = eina_stringshare_add(nclass);
9275 if (bd->client.icccm.class && (!strcmp(bd->client.icccm.class, "Vmplayer")))
9276 e_bindings_mapping_change_enable(EINA_FALSE);
9277 #ifdef _F_ZONE_WINDOW_ROTATION_
9278 if (e_config->wm_win_rotation)
9280 if ((bd->client.icccm.name) && (bd->client.icccm.class))
9282 if ((!strcmp(bd->client.icccm.name, "Virtual Keyboard")) &&
9283 (!strcmp(bd->client.icccm.class, "ISF")))
9285 ELB(ELBT_BD, "SET VKBD", bd->client.win);
9286 bd->client.vkbd.win_type = E_VIRTUAL_KEYBOARD_WINDOW_TYPE_KEYPAD;
9289 else if ((!strcmp(bd->client.icccm.name, "Prediction Window")) &&
9290 (!strcmp(bd->client.icccm.class, "ISF")))
9292 ELB(ELBT_BD, "SET PREDICTION", bd->client.win);
9293 bd->client.vkbd.win_type = E_VIRTUAL_KEYBOARD_WINDOW_TYPE_PREDICTION;
9294 rot.vkbd_prediction = bd;
9296 else if ((!strcmp(bd->client.icccm.name, "Key Magnifier")) &&
9297 (!strcmp(bd->client.icccm.class, "ISF")))
9299 ELB(ELBT_BD, "SET MAGNIFIER", bd->client.win);
9300 bd->client.vkbd.win_type = E_VIRTUAL_KEYBOARD_WINDOW_TYPE_MAGNIFIER;
9302 else if ((!strcmp(bd->client.icccm.name, "ISF Popup")) &&
9303 (!strcmp(bd->client.icccm.class, "ISF")))
9305 ELB(ELBT_BD, "SET VKBD_POPUP", bd->client.win);
9306 bd->client.vkbd.win_type = E_VIRTUAL_KEYBOARD_WINDOW_TYPE_POPUP;
9311 if (nname) free(nname);
9312 if (nclass) free(nclass);
9314 if (!((bd->client.icccm.name == pname) &&
9315 (bd->client.icccm.class == pclass)))
9316 bd->changes.icon = 1;
9318 if (pname) eina_stringshare_del(pname);
9319 if (pclass) eina_stringshare_del(pclass);
9320 bd->client.icccm.fetch.name_class = 0;
9321 bd->changes.icon = 1;
9324 if (bd->client.icccm.fetch.state)
9326 bd->client.icccm.state = ecore_x_icccm_state_get(bd->client.win);
9327 bd->client.icccm.fetch.state = 0;
9330 if (bd->client.e.fetch.state)
9332 e_hints_window_e_state_get(bd);
9333 bd->client.e.fetch.state = 0;
9336 #ifdef _F_USE_DESK_WINDOW_PROFILE_
9337 if (bd->client.e.fetch.profile_list)
9339 const char **profiles = NULL;
9343 if (bd->client.e.state.profile)
9344 eina_stringshare_del(bd->client.e.state.profile);
9345 EINA_LIST_FREE(bd->client.e.state.profiles, str)
9347 if (str) eina_stringshare_del(str);
9349 bd->client.e.state.profile = NULL;
9350 bd->client.e.state.profiles = NULL;
9351 bd->client.e.state.profile_list = 0;
9353 if (ecore_x_e_window_profile_list_get(bd->client.win,
9356 bd->client.e.state.profile_list = 1;
9357 for (i = 0; i < num; i++)
9359 str = eina_stringshare_add(profiles[i]);
9360 bd->client.e.state.profiles = eina_list_append(bd->client.e.state.profiles, str);
9363 /* We should set desk to contain given border after creating E_BORDER_ADD event.
9364 * If not, e will have an E_BORDER_SHOW event before E_BORDER_ADD event.
9366 need_desk_set = EINA_TRUE;
9370 if (strcmp(bd->desk->window_profile,
9371 e_config->desktop_default_window_profile) != 0)
9373 ecore_x_e_window_profile_set(bd->client.win,
9374 bd->desk->window_profile);
9380 for (i = 0; i < num; i++)
9381 if (profiles[i]) free(profiles[i]);
9385 bd->client.e.fetch.profile_list = 0;
9388 #ifdef _F_ZONE_WINDOW_ROTATION_
9389 if ((e_config->wm_win_rotation) &&
9390 (bd->client.e.fetch.rot.support))
9393 unsigned int support = 0;
9395 ret = ecore_x_window_prop_card32_get
9397 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
9400 bd->client.e.state.rot.support = 0;
9401 if ((ret == 1) && (support == 1))
9402 bd->client.e.state.rot.support = 1;
9404 if (bd->client.e.state.rot.support)
9405 need_rotation_set = EINA_TRUE;
9407 bd->client.e.fetch.rot.support = 0;
9409 if ((e_config->wm_win_rotation) &&
9410 (bd->client.e.fetch.rot.geom_hint))
9412 Eina_Rectangle r[4];
9414 bd->client.e.state.rot.geom_hint = 0;
9415 for (i = 0; i < 4; i++)
9417 r[i].x = bd->client.e.state.rot.geom[i].x;
9418 r[i].y = bd->client.e.state.rot.geom[i].y;
9419 r[i].w = bd->client.e.state.rot.geom[i].w;
9420 r[i].h = bd->client.e.state.rot.geom[i].h;
9422 bd->client.e.state.rot.geom[i].x = 0;
9423 bd->client.e.state.rot.geom[i].y = 0;
9424 bd->client.e.state.rot.geom[i].w = 0;
9425 bd->client.e.state.rot.geom[i].h = 0;
9428 for (i = 0; i < 4; i++)
9430 x = 0; y = 0; w = 0; h = 0;
9431 if (ecore_x_e_window_rotation_geometry_get(bd->client.win, i*90, &x, &y, &w, &h))
9433 bd->client.e.state.rot.geom_hint = 1;
9434 bd->client.e.state.rot.geom[i].x = x;
9435 bd->client.e.state.rot.geom[i].y = y;
9436 bd->client.e.state.rot.geom[i].w = w;
9437 bd->client.e.state.rot.geom[i].h = h;
9439 if (!((r[i].x == x) && (r[i].y == y) &&
9440 (r[i].w == w) && (r[i].h == h)))
9442 need_rotation_set = EINA_TRUE;
9446 bd->client.e.fetch.rot.geom_hint = 0;
9448 if ((e_config->wm_win_rotation) &&
9449 (bd->client.e.fetch.rot.app_set))
9451 ELB(ELBT_ROT, "Fetch ROT_APP_SET", bd->client.win);
9452 unsigned char _prev_app_set = bd->client.e.state.rot.app_set;
9453 bd->client.e.state.rot.app_set = ecore_x_e_window_rotation_app_get(bd->client.win);
9455 if (_prev_app_set != bd->client.e.state.rot.app_set)
9456 need_rotation_set = EINA_TRUE;
9458 bd->client.e.fetch.rot.app_set = 0;
9460 if ((e_config->wm_win_rotation) &&
9461 (bd->client.e.fetch.rot.preferred_rot))
9463 int r = 0, _prev_preferred_rot;
9464 _prev_preferred_rot = bd->client.e.state.rot.preferred_rot;
9465 bd->client.e.state.rot.preferred_rot = -1;
9466 if (ecore_x_e_window_rotation_preferred_rotation_get(bd->client.win, &r))
9468 bd->client.e.state.rot.preferred_rot = r;
9469 ELBF(ELBT_ROT, 0, bd->client.win, "Fetch PREFERRED_ROT:%d", r);
9473 ELB(ELBT_ROT, "Fetch PREFERRED_ROT Del..", bd->client.win);
9476 if (_prev_preferred_rot != bd->client.e.state.rot.preferred_rot)
9477 need_rotation_set = EINA_TRUE;
9479 bd->client.e.fetch.rot.preferred_rot = 0;
9481 if ((e_config->wm_win_rotation) &&
9482 (bd->client.e.fetch.rot.available_rots))
9484 Eina_Bool res, diff = EINA_FALSE;
9486 unsigned int count = 0, i = 0;
9487 int _prev_rots[4] = { -1, };
9489 if (bd->client.e.state.rot.available_rots)
9492 bd->client.e.state.rot.available_rots,
9493 (sizeof(int) * bd->client.e.state.rot.count));
9495 E_FREE(bd->client.e.state.rot.available_rots);
9498 bd->client.e.state.rot.count = 0;
9500 res = ecore_x_e_window_rotation_available_rotations_get(bd->client.win,
9502 if ((res) && (count > 0) && (rots))
9504 bd->client.e.state.rot.available_rots = rots;
9505 bd->client.e.state.rot.count = count;
9507 for (i = 0; i < count; i++)
9509 ELBF(ELBT_ROT, 0, bd->client.win, "Fetch AVAILABLE_ROTS[%d]:%d", i, rots[i]);
9510 if ((!diff) && (_prev_rots[i] != rots[i]))
9512 ELBF(ELBT_ROT, 0, bd->client.win, "count:%d i:%d _prev:%d != rot:%d",
9513 count, i, _prev_rots[i], rots[i]);
9520 ELB(ELBT_ROT, "Fetch AVAILABLE_ROTS Del..", bd->client.win);
9524 if (diff) need_rotation_set = EINA_TRUE;
9525 bd->client.e.fetch.rot.available_rots = 0;
9528 if (bd->client.netwm.fetch.type)
9530 e_hints_window_type_get(bd);
9531 if ((!bd->lock_border) || (!bd->client.border.name))
9532 bd->client.border.changed = 1;
9534 if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK)
9536 if (!bd->client.netwm.state.skip_pager)
9538 bd->client.netwm.state.skip_pager = 1;
9539 bd->client.netwm.update.state = 1;
9541 if (!bd->client.netwm.state.skip_taskbar)
9543 bd->client.netwm.state.skip_taskbar = 1;
9544 bd->client.netwm.update.state = 1;
9547 bd->client.netwm.fetch.type = 0;
9549 if (bd->client.icccm.fetch.machine)
9551 char *machine = ecore_x_icccm_client_machine_get(bd->client.win);
9553 if ((!machine) && (bd->client.icccm.client_leader))
9554 machine = ecore_x_icccm_client_machine_get(bd->client.icccm.client_leader);
9556 eina_stringshare_replace(&bd->client.icccm.machine, machine);
9557 if (machine) free(machine);
9559 bd->client.icccm.fetch.machine = 0;
9562 if (bd->client.icccm.fetch.command)
9564 if ((bd->client.icccm.command.argc > 0) && (bd->client.icccm.command.argv))
9568 for (i = 0; i < bd->client.icccm.command.argc; i++)
9569 free(bd->client.icccm.command.argv[i]);
9570 free(bd->client.icccm.command.argv);
9572 bd->client.icccm.command.argc = 0;
9573 bd->client.icccm.command.argv = NULL;
9574 ecore_x_icccm_command_get(bd->client.win,
9575 &(bd->client.icccm.command.argc),
9576 &(bd->client.icccm.command.argv));
9577 if ((bd->client.icccm.client_leader) &&
9578 (!bd->client.icccm.command.argv))
9579 ecore_x_icccm_command_get(bd->client.icccm.client_leader,
9580 &(bd->client.icccm.command.argc),
9581 &(bd->client.icccm.command.argv));
9582 bd->client.icccm.fetch.command = 0;
9585 if (bd->client.icccm.fetch.hints)
9587 Eina_Bool accepts_focus, is_urgent;
9589 accepts_focus = EINA_TRUE;
9590 is_urgent = EINA_FALSE;
9591 bd->client.icccm.initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
9592 if (ecore_x_icccm_hints_get(bd->client.win,
9594 &bd->client.icccm.initial_state,
9595 &bd->client.icccm.icon_pixmap,
9596 &bd->client.icccm.icon_mask,
9597 &bd->client.icccm.icon_window,
9598 &bd->client.icccm.window_group,
9601 bd->client.icccm.accepts_focus = accepts_focus;
9602 if ((bd->client.icccm.urgent != is_urgent) && ((!bd->focused) || (!is_urgent)))
9604 bd->client.icccm.urgent = is_urgent;
9606 /* If this is a new window, set the state as requested. */
9607 if ((bd->new_client) &&
9608 (bd->client.icccm.initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC))
9610 e_border_iconify(bd);
9611 e_border_hide(bd, 1);
9614 bd->client.icccm.fetch.hints = 0;
9617 if (bd->client.icccm.fetch.size_pos_hints)
9619 Eina_Bool request_pos;
9621 request_pos = EINA_FALSE;
9622 if (ecore_x_icccm_size_pos_hints_get(bd->client.win,
9624 &bd->client.icccm.gravity,
9625 &bd->client.icccm.min_w,
9626 &bd->client.icccm.min_h,
9627 &bd->client.icccm.max_w,
9628 &bd->client.icccm.max_h,
9629 &bd->client.icccm.base_w,
9630 &bd->client.icccm.base_h,
9631 &bd->client.icccm.step_w,
9632 &bd->client.icccm.step_h,
9633 &bd->client.icccm.min_aspect,
9634 &bd->client.icccm.max_aspect))
9636 bd->client.icccm.request_pos = request_pos;
9641 if (bd->client.icccm.min_w > 32767) bd->client.icccm.min_w = 32767;
9642 if (bd->client.icccm.min_h > 32767) bd->client.icccm.min_h = 32767;
9643 if (bd->client.icccm.max_w > 32767) bd->client.icccm.max_w = 32767;
9644 if (bd->client.icccm.max_h > 32767) bd->client.icccm.max_h = 32767;
9645 if (bd->client.icccm.base_w > 32767) bd->client.icccm.base_w = 32767;
9646 if (bd->client.icccm.base_h > 32767) bd->client.icccm.base_h = 32767;
9647 // if (bd->client.icccm.step_w < 1) bd->client.icccm.step_w = 1;
9648 // if (bd->client.icccm.step_h < 1) bd->client.icccm.step_h = 1;
9649 // if doing a resize, fix it up
9650 if (bd->resize_mode != RESIZE_NONE)
9652 int x, y, w, h, new_w, new_h;
9660 e_border_resize_limit(bd, &new_w, &new_h);
9661 if ((bd->resize_mode == RESIZE_TL) ||
9662 (bd->resize_mode == RESIZE_L) ||
9663 (bd->resize_mode == RESIZE_BL))
9665 if ((bd->resize_mode == RESIZE_TL) ||
9666 (bd->resize_mode == RESIZE_T) ||
9667 (bd->resize_mode == RESIZE_TR))
9669 e_border_move_resize(bd, x, y, new_w, new_h);
9671 bd->client.icccm.fetch.size_pos_hints = 0;
9674 if (bd->client.icccm.fetch.protocol)
9677 Ecore_X_WM_Protocol *proto;
9679 proto = ecore_x_window_prop_protocol_list_get(bd->client.win, &num);
9682 for (i = 0; i < num; i++)
9684 if (proto[i] == ECORE_X_WM_PROTOCOL_DELETE_REQUEST)
9685 bd->client.icccm.delete_request = 1;
9686 else if (proto[i] == ECORE_X_WM_PROTOCOL_TAKE_FOCUS)
9687 bd->client.icccm.take_focus = 1;
9688 else if (proto[i] == ECORE_X_NET_WM_PROTOCOL_PING)
9689 bd->client.netwm.ping = 1;
9690 else if (proto[i] == ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST)
9692 bd->client.netwm.sync.request = 1;
9693 if (!ecore_x_netwm_sync_counter_get(bd->client.win,
9694 &bd->client.netwm.sync.counter))
9695 bd->client.netwm.sync.request = 0;
9700 if (bd->client.netwm.ping)
9704 if (bd->ping_poller) ecore_poller_del(bd->ping_poller);
9705 bd->ping_poller = NULL;
9707 bd->client.icccm.fetch.protocol = 0;
9709 if (bd->client.icccm.fetch.transient_for)
9711 /* TODO: What do to if the transient for isn't mapped yet? */
9712 E_Border *bd_parent = NULL;
9713 #ifdef _F_DEICONIFY_APPROVE_
9714 Eina_Bool change_parent = EINA_FALSE;
9717 bd->client.icccm.transient_for = ecore_x_icccm_transient_for_get(bd->client.win);
9718 if (bd->client.icccm.transient_for)
9719 bd_parent = e_border_find_by_client_window(bd->client.icccm.transient_for);
9720 /* If we already have a parent, remove it */
9723 if (bd_parent != bd->parent)
9725 bd->parent->transients = eina_list_remove(bd->parent->transients, bd);
9726 if (bd->parent->modal == bd) bd->parent->modal = NULL;
9732 if ((bd_parent) && (bd_parent != bd) &&
9733 (eina_list_data_find(bd->transients, bd_parent) != bd_parent))
9735 bd_parent->transients = eina_list_append(bd_parent->transients, bd);
9736 bd->parent = bd_parent;
9737 #ifdef _F_DEICONIFY_APPROVE_
9738 change_parent = EINA_TRUE;
9743 e_border_layer_set(bd, bd->parent->layer);
9744 if ((e_config->modal_windows) && (bd->client.netwm.state.modal))
9746 Ecore_X_Window_Attributes attr;
9747 bd->parent->modal = bd;
9748 ecore_x_window_attributes_get(bd->parent->client.win, &attr);
9749 bd->parent->saved.event_mask = attr.event_mask.mine;
9750 bd->parent->lock_close = 1;
9751 ecore_x_event_mask_unset(bd->parent->client.win, attr.event_mask.mine);
9752 ecore_x_event_mask_set(bd->parent->client.win, ECORE_X_EVENT_MASK_WINDOW_DAMAGE | ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
9755 if (e_config->focus_setting == E_FOCUS_NEW_DIALOG ||
9756 (bd->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
9760 #ifdef _F_DEICONIFY_APPROVE_
9763 bd->client.e.state.deiconify_approve.render_done = 0;
9765 E_Border *ancestor_bd;
9766 ancestor_bd = bd->client.e.state.deiconify_approve.ancestor;
9767 if ((ancestor_bd) &&
9768 (!e_object_is_del(E_OBJECT(ancestor_bd))))
9770 ancestor_bd->client.e.state.deiconify_approve.req_list = eina_list_remove(ancestor_bd->client.e.state.deiconify_approve.req_list, bd);
9771 bd->client.e.state.deiconify_approve.ancestor = NULL;
9773 if ((ancestor_bd->client.e.state.deiconify_approve.req_list == NULL) &&
9774 (ancestor_bd->client.e.state.deiconify_approve.render_done))
9776 if (ancestor_bd->client.e.state.deiconify_approve.wait_timer)
9778 ecore_timer_del(ancestor_bd->client.e.state.deiconify_approve.wait_timer);
9779 ancestor_bd->client.e.state.deiconify_approve.wait_timer = NULL;
9780 e_border_uniconify(ancestor_bd);
9786 bd->client.icccm.fetch.transient_for = 0;
9789 if (bd->client.icccm.fetch.window_role)
9791 char *role = ecore_x_icccm_window_role_get(bd->client.win);
9792 eina_stringshare_replace(&bd->client.icccm.window_role, role);
9793 if (role) free(role);
9795 bd->client.icccm.fetch.window_role = 0;
9798 if (bd->client.icccm.fetch.icon_name)
9800 char *icon_name = ecore_x_icccm_icon_name_get(bd->client.win);
9801 eina_stringshare_replace(&bd->client.icccm.icon_name, icon_name);
9802 if (icon_name) free(icon_name);
9804 bd->client.icccm.fetch.icon_name = 0;
9807 if (bd->client.netwm.fetch.icon_name)
9810 ecore_x_netwm_icon_name_get(bd->client.win, &icon_name);
9811 eina_stringshare_replace(&bd->client.netwm.icon_name, icon_name);
9812 if (icon_name) free(icon_name);
9814 bd->client.netwm.fetch.icon_name = 0;
9817 if (bd->client.netwm.fetch.icon)
9820 if (bd->client.netwm.icons)
9822 for (i = 0; i < bd->client.netwm.num_icons; i++)
9824 free(bd->client.netwm.icons[i].data);
9825 bd->client.netwm.icons[i].data = NULL;
9827 free(bd->client.netwm.icons);
9829 bd->client.netwm.icons = NULL;
9830 bd->client.netwm.num_icons = 0;
9831 if (ecore_x_netwm_icons_get(bd->client.win,
9832 &bd->client.netwm.icons,
9833 &bd->client.netwm.num_icons))
9835 // unless the rest of e17 uses border icons OTHER than icon #0
9836 // then free the rest that we don't need anymore.
9837 for (i = 1; i < bd->client.netwm.num_icons; i++)
9839 free(bd->client.netwm.icons[i].data);
9840 bd->client.netwm.icons[i].data = NULL;
9842 bd->client.netwm.num_icons = 1;
9843 bd->changes.icon = 1;
9845 bd->client.netwm.fetch.icon = 0;
9847 if (bd->client.netwm.fetch.user_time)
9849 ecore_x_netwm_user_time_get(bd->client.win, &bd->client.netwm.user_time);
9850 bd->client.netwm.fetch.user_time = 0;
9852 if (bd->client.netwm.fetch.strut)
9854 if (!ecore_x_netwm_strut_partial_get(bd->client.win,
9855 &bd->client.netwm.strut.left,
9856 &bd->client.netwm.strut.right,
9857 &bd->client.netwm.strut.top,
9858 &bd->client.netwm.strut.bottom,
9859 &bd->client.netwm.strut.left_start_y,
9860 &bd->client.netwm.strut.left_end_y,
9861 &bd->client.netwm.strut.right_start_y,
9862 &bd->client.netwm.strut.right_end_y,
9863 &bd->client.netwm.strut.top_start_x,
9864 &bd->client.netwm.strut.top_end_x,
9865 &bd->client.netwm.strut.bottom_start_x,
9866 &bd->client.netwm.strut.bottom_end_x))
9868 ecore_x_netwm_strut_get(bd->client.win,
9869 &bd->client.netwm.strut.left, &bd->client.netwm.strut.right,
9870 &bd->client.netwm.strut.top, &bd->client.netwm.strut.bottom);
9872 bd->client.netwm.strut.left_start_y = 0;
9873 bd->client.netwm.strut.left_end_y = 0;
9874 bd->client.netwm.strut.right_start_y = 0;
9875 bd->client.netwm.strut.right_end_y = 0;
9876 bd->client.netwm.strut.top_start_x = 0;
9877 bd->client.netwm.strut.top_end_x = 0;
9878 bd->client.netwm.strut.bottom_start_x = 0;
9879 bd->client.netwm.strut.bottom_end_x = 0;
9881 bd->client.netwm.fetch.strut = 0;
9883 if (bd->client.qtopia.fetch.soft_menu)
9885 e_hints_window_qtopia_soft_menu_get(bd);
9886 bd->client.qtopia.fetch.soft_menu = 0;
9889 if (bd->client.qtopia.fetch.soft_menus)
9891 e_hints_window_qtopia_soft_menus_get(bd);
9892 bd->client.qtopia.fetch.soft_menus = 0;
9895 if (bd->client.vkbd.fetch.state)
9897 e_hints_window_virtual_keyboard_state_get(bd);
9898 bd->client.vkbd.fetch.state = 0;
9901 if (bd->client.vkbd.fetch.vkbd)
9903 e_hints_window_virtual_keyboard_get(bd);
9904 bd->client.vkbd.fetch.vkbd = 0;
9907 if (bd->client.illume.conformant.fetch.conformant)
9909 bd->client.illume.conformant.conformant =
9910 ecore_x_e_illume_conformant_get(bd->client.win);
9911 bd->client.illume.conformant.fetch.conformant = 0;
9913 if (bd->client.illume.quickpanel.fetch.state)
9915 bd->client.illume.quickpanel.state =
9916 ecore_x_e_illume_quickpanel_state_get(bd->client.win);
9917 bd->client.illume.quickpanel.fetch.state = 0;
9919 if (bd->client.illume.quickpanel.fetch.quickpanel)
9921 bd->client.illume.quickpanel.quickpanel =
9922 ecore_x_e_illume_quickpanel_get(bd->client.win);
9923 bd->client.illume.quickpanel.fetch.quickpanel = 0;
9925 if (bd->client.illume.quickpanel.fetch.priority.major)
9927 bd->client.illume.quickpanel.priority.major =
9928 ecore_x_e_illume_quickpanel_priority_major_get(bd->client.win);
9929 bd->client.illume.quickpanel.fetch.priority.major = 0;
9931 if (bd->client.illume.quickpanel.fetch.priority.minor)
9933 bd->client.illume.quickpanel.priority.minor =
9934 ecore_x_e_illume_quickpanel_priority_minor_get(bd->client.win);
9935 bd->client.illume.quickpanel.fetch.priority.minor = 0;
9937 if (bd->client.illume.quickpanel.fetch.zone)
9939 bd->client.illume.quickpanel.zone =
9940 ecore_x_e_illume_quickpanel_zone_get(bd->client.win);
9941 bd->client.illume.quickpanel.fetch.zone = 0;
9943 if (bd->client.illume.drag.fetch.drag)
9945 bd->client.illume.drag.drag =
9946 ecore_x_e_illume_drag_get(bd->client.win);
9947 bd->client.illume.drag.fetch.drag = 0;
9949 if (bd->client.illume.drag.fetch.locked)
9951 bd->client.illume.drag.locked =
9952 ecore_x_e_illume_drag_locked_get(bd->client.win);
9953 bd->client.illume.drag.fetch.locked = 0;
9955 if (bd->client.illume.win_state.fetch.state)
9957 bd->client.illume.win_state.state =
9958 ecore_x_e_illume_window_state_get(bd->client.win);
9959 bd->client.illume.win_state.fetch.state = 0;
9961 if (bd->changes.shape)
9963 Ecore_X_Rectangle *rects;
9966 bd->changes.shape = 0;
9967 rects = ecore_x_window_shape_rectangles_get(bd->client.win, &num);
9972 /* This doesn't fix the race, but makes it smaller. we detect
9973 * this and if cw and ch != client w/h then mark this as needing
9974 * a shape change again to fixup next event loop.
9976 ecore_x_window_size_get(bd->client.win, &cw, &ch);
9977 if ((cw != bd->client.w) || (ch != bd->client.h))
9978 bd->changes.shape = 1;
9980 (rects[0].x == 0) &&
9981 (rects[0].y == 0) &&
9982 ((int)rects[0].width == cw) &&
9983 ((int)rects[0].height == ch))
9985 if (bd->client.shaped)
9987 bd->client.shaped = 0;
9988 if (!bd->bordername)
9989 bd->client.border.changed = 1;
9994 if (!bd->client.shaped)
9996 bd->client.shaped = 1;
9997 if (!bd->bordername)
9998 bd->client.border.changed = 1;
10005 // FIXME: no rects i think can mean... totally empty window
10006 bd->client.shaped = 0;
10007 if (!bd->bordername)
10008 bd->client.border.changed = 1;
10010 bd->need_shape_merge = 1;
10012 if (bd->changes.shape_input)
10014 Ecore_X_Rectangle *rects;
10017 bd->changes.shape_input = 0;
10018 rects = ecore_x_window_shape_input_rectangles_get(bd->client.win, &num);
10021 int cw = 0, ch = 0;
10023 /* This doesn't fix the race, but makes it smaller. we detect
10024 * this and if cw and ch != client w/h then mark this as needing
10025 * a shape change again to fixup next event loop.
10027 ecore_x_window_size_get(bd->client.win, &cw, &ch);
10028 if ((cw != bd->client.w) || (ch != bd->client.h))
10029 bd->changes.shape_input = 1;
10031 (rects[0].x == 0) &&
10032 (rects[0].y == 0) &&
10033 ((int)rects[0].width == cw) &&
10034 ((int)rects[0].height == ch))
10036 if (bd->shaped_input)
10038 bd->shaped_input = 0;
10039 if (!bd->bordername)
10040 bd->client.border.changed = 1;
10045 if (!bd->shaped_input)
10047 bd->shaped_input = 1;
10048 if (!bd->bordername)
10049 bd->client.border.changed = 1;
10056 bd->shaped_input = 1;
10057 if (!bd->bordername)
10058 bd->client.border.changed = 1;
10060 bd->need_shape_merge = 1;
10062 if (bd->client.mwm.fetch.hints)
10066 bd->client.mwm.exists =
10067 ecore_x_mwm_hints_get(bd->client.win,
10068 &bd->client.mwm.func,
10069 &bd->client.mwm.decor,
10070 &bd->client.mwm.input);
10071 pb = bd->client.mwm.borderless;
10072 bd->client.mwm.borderless = 0;
10073 if (bd->client.mwm.exists)
10075 if ((!(bd->client.mwm.decor & ECORE_X_MWM_HINT_DECOR_ALL)) &&
10076 (!(bd->client.mwm.decor & ECORE_X_MWM_HINT_DECOR_TITLE)) &&
10077 (!(bd->client.mwm.decor & ECORE_X_MWM_HINT_DECOR_BORDER)))
10078 bd->client.mwm.borderless = 1;
10080 if (bd->client.mwm.borderless != pb)
10082 if ((!bd->lock_border) || (!bd->client.border.name))
10083 bd->client.border.changed = 1;
10085 bd->client.mwm.fetch.hints = 0;
10088 if (bd->client.e.fetch.video_parent)
10090 /* unlinking child/parent */
10091 if (bd->client.e.state.video_parent_border != NULL)
10093 bd->client.e.state.video_parent_border->client.e.state.video_child =
10095 (bd->client.e.state.video_parent_border->client.e.state.video_child,
10099 ecore_x_window_prop_card32_get(bd->client.win,
10100 ECORE_X_ATOM_E_VIDEO_PARENT,
10101 &bd->client.e.state.video_parent,
10104 /* linking child/parent */
10105 if (bd->client.e.state.video_parent != 0)
10110 EINA_LIST_FOREACH(borders, l, tmp)
10111 if (tmp->client.win == bd->client.e.state.video_parent)
10113 /* fprintf(stderr, "child added to parent \\o/\n"); */
10114 bd->client.e.state.video_parent_border = tmp;
10115 tmp->client.e.state.video_child = eina_list_append(tmp->client.e.state.video_child,
10117 if (bd->desk != tmp->desk)
10118 e_border_desk_set(bd, tmp->desk);
10123 /* fprintf(stderr, "new parent %x => %p\n", bd->client.e.state.video_parent, bd->client.e.state.video_parent_border); */
10125 if (bd->client.e.state.video_parent_border) bd->client.e.fetch.video_parent = 0;
10128 if (bd->client.e.fetch.video_position && bd->client.e.fetch.video_parent == 0)
10130 unsigned int xy[2];
10132 ecore_x_window_prop_card32_get(bd->client.win,
10133 ECORE_X_ATOM_E_VIDEO_POSITION,
10136 bd->client.e.state.video_position.x = xy[0];
10137 bd->client.e.state.video_position.y = xy[1];
10138 bd->client.e.state.video_position.updated = 1;
10139 bd->client.e.fetch.video_position = 0;
10140 bd->x = bd->client.e.state.video_position.x;
10141 bd->y = bd->client.e.state.video_position.y;
10143 fprintf(stderr, "internal position has been updated [%i, %i]\n", bd->client.e.state.video_position.x, bd->client.e.state.video_position.y);
10145 if (bd->client.netwm.update.state)
10147 e_hints_window_state_set(bd);
10148 /* Some stats might change the border, like modal */
10149 if (((!bd->lock_border) || (!bd->client.border.name)) &&
10150 (!(((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN))))
10152 bd->client.border.changed = 1;
10156 if ((e_config->modal_windows) && (bd->client.netwm.state.modal))
10158 bd->parent->modal = bd;
10159 if (bd->parent->focused)
10160 e_border_focus_set(bd, 1, 1);
10163 else if (bd->leader)
10165 if ((e_config->modal_windows) && (bd->client.netwm.state.modal))
10167 bd->leader->modal = bd;
10168 if (bd->leader->focused)
10169 e_border_focus_set(bd, 1, 1);
10175 EINA_LIST_FOREACH(bd->leader->group, l, child)
10177 if ((child != bd) && (child->focused))
10178 e_border_focus_set(bd, 1, 1);
10183 bd->client.netwm.update.state = 0;
10186 if (bd->new_client)
10188 E_Event_Border_Add *ev;
10189 E_Exec_Instance *inst;
10191 ev = E_NEW(E_Event_Border_Add, 1);
10193 e_object_ref(E_OBJECT(bd));
10194 // e_object_breadcrumb_add(E_OBJECT(bd), "border_add_event");
10195 ecore_event_add(E_EVENT_BORDER_ADD, ev, _e_border_event_border_add_free, NULL);
10197 if ((!bd->lock_border) || (!bd->client.border.name))
10198 bd->client.border.changed = 1;
10203 if ((ecore_x_netwm_startup_id_get(bd->client.win, &str) && (str)) ||
10204 ((bd->client.icccm.client_leader > 0) &&
10205 ecore_x_netwm_startup_id_get(bd->client.icccm.client_leader, &str) && (str))
10208 if (!strncmp(str, "E_START|", 8))
10212 id = atoi(str + 8);
10213 if (id > 0) bd->client.netwm.startup_id = id;
10218 /* It's ok not to have fetch flag, should only be set on startup
10219 * * and not changed. */
10220 if (!ecore_x_netwm_pid_get(bd->client.win, &bd->client.netwm.pid))
10222 if (bd->client.icccm.client_leader)
10224 if (!ecore_x_netwm_pid_get(bd->client.icccm.client_leader, &bd->client.netwm.pid))
10225 bd->client.netwm.pid = -1;
10228 bd->client.netwm.pid = -1;
10231 if (!bd->re_manage)
10233 inst = e_exec_startup_id_pid_instance_find(bd->client.netwm.startup_id,
10234 bd->client.netwm.pid);
10235 if ((inst) && (inst->used == 0))
10241 zone = e_container_zone_number_get(bd->zone->container,
10243 if (zone) e_border_zone_set(bd, zone);
10244 desk = e_desk_at_xy_get(bd->zone, inst->desk_x,
10246 if (desk) e_border_desk_set(bd, desk);
10247 e_exec_instance_found(inst);
10250 if (e_config->window_grouping) // FIXME: We may want to make the border "urgent" so that the user knows it appeared.
10252 E_Border *bdl = NULL;
10257 if (bd->leader) bdl = bd->leader;
10264 bl = e_container_border_list_first(bd->zone->container);
10265 while ((child = e_container_border_list_next(bl)))
10267 if (child == bd) continue;
10268 if (e_object_is_del(E_OBJECT(child))) continue;
10269 if ((bd->client.icccm.client_leader) &&
10270 (child->client.icccm.client_leader ==
10271 bd->client.icccm.client_leader))
10277 e_container_border_list_free(bl);
10282 e_border_zone_set(bd, bdl->zone);
10284 e_border_desk_set(bd, bdl->desk);
10286 e_border_stick(bd);
10292 #ifdef _F_USE_DESK_WINDOW_PROFILE_
10295 E_Container *con = bd->zone->container;
10296 E_Desk *desk = NULL;
10299 EINA_LIST_FOREACH(bd->client.e.state.profiles, l, str)
10301 desk = e_container_desk_window_profile_get(con, str);
10304 if (bd->desk != desk)
10306 bd->client.e.state.profile = eina_stringshare_add(str);
10307 if (bd->zone != desk->zone)
10308 e_border_zone_set(bd, desk->zone);
10309 e_border_desk_set(bd, desk);
10317 /* PRE_POST_FETCH calls e_remember apply for new client */
10318 _e_border_hook_call(E_BORDER_HOOK_EVAL_PRE_POST_FETCH, bd);
10319 _e_border_hook_call(E_BORDER_HOOK_EVAL_POST_FETCH, bd);
10320 _e_border_hook_call(E_BORDER_HOOK_EVAL_PRE_BORDER_ASSIGN, bd);
10322 #ifdef _F_ZONE_WINDOW_ROTATION_
10323 if (e_config->wm_win_rotation)
10325 if ((need_rotation_set) &&
10326 (bd->client.e.state.rot.type == E_BORDER_ROTATION_TYPE_NORMAL))
10328 Eina_Bool hint = EINA_FALSE;
10330 int x, y, w, h, move;
10332 ELB(ELBT_ROT, "NEED ROT", bd->client.win);
10333 bd->client.e.state.rot.changes = _e_border_rotation_angle_get(bd);
10335 if (bd->client.e.state.rot.changes == -1)
10337 ang = bd->client.e.state.rot.curr;
10339 hint = _e_border_rotation_geom_get(bd, bd->zone, ang, &x, &y, &w, &h, &move);
10342 _e_border_move_resize_internal(bd, x, y, w, h, EINA_TRUE, move);
10343 ELBF(ELBT_ROT, 0, bd->client.win, "RESIZE_BY_HINT name:%s (%d,%d) %dx%d",
10344 bd->client.icccm.name, x, y, w, h);
10347 else bd->changed = 1;
10352 if (bd->need_reparent)
10355 ecore_x_window_save_set_add(bd->client.win);
10356 ecore_x_window_reparent(bd->client.win, bd->client.shell_win, 0, 0);
10359 if ((bd->new_client) && (bd->internal) &&
10360 (bd->internal_ecore_evas))
10361 ecore_evas_show(bd->internal_ecore_evas);
10362 ecore_x_window_show(bd->client.win);
10364 bd->need_reparent = 0;
10367 if ((bd->client.border.changed) && (!bd->shaded) &&
10368 (!(((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN))))
10370 const char *bordername;
10372 if (bd->fullscreen)
10373 bordername = "borderless";
10374 else if (bd->bordername)
10375 bordername = bd->bordername;
10376 else if ((bd->client.mwm.borderless) || (bd->borderless))
10377 bordername = "borderless";
10378 else if (((bd->client.icccm.transient_for != 0) ||
10379 (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)) &&
10380 (bd->client.icccm.min_w == bd->client.icccm.max_w) &&
10381 (bd->client.icccm.min_h == bd->client.icccm.max_h))
10382 bordername = "noresize_dialog";
10383 else if ((bd->client.icccm.min_w == bd->client.icccm.max_w) &&
10384 (bd->client.icccm.min_h == bd->client.icccm.max_h))
10385 bordername = "noresize";
10386 else if (bd->client.shaped)
10387 bordername = "shaped";
10388 else if ((!bd->client.icccm.accepts_focus) &&
10389 (!bd->client.icccm.take_focus))
10390 bordername = "nofocus";
10391 else if (bd->client.icccm.urgent)
10392 bordername = "urgent";
10393 else if ((bd->client.icccm.transient_for != 0) ||
10394 (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))
10395 bordername = "dialog";
10396 else if (bd->client.netwm.state.modal)
10397 bordername = "modal";
10398 else if ((bd->client.netwm.state.skip_taskbar) ||
10399 (bd->client.netwm.state.skip_pager))
10400 bordername = "skipped";
10401 else if ((bd->internal) && (bd->client.icccm.class) &&
10402 (!strncmp(bd->client.icccm.class, "e_fwin", 6)))
10403 bordername = "internal_fileman";
10405 bordername = e_config->theme_default_border_style;
10406 if (!bordername) bordername = "default";
10408 if ((!bd->client.border.name) || (strcmp(bd->client.border.name, bordername)))
10414 bd->changes.border = 1;
10415 eina_stringshare_replace(&bd->client.border.name, bordername);
10419 bd->w -= (bd->client_inset.l + bd->client_inset.r);
10420 bd->h -= (bd->client_inset.t + bd->client_inset.b);
10421 bd->changes.size = 1;
10422 evas_object_del(bd->bg_object);
10424 o = edje_object_add(bd->bg_evas);
10425 snprintf(buf, sizeof(buf), "e/widgets/border/%s/border", bd->client.border.name);
10426 ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
10427 if ((!ok) && (strcmp(bd->client.border.name, "borderless")))
10429 if (bd->client.border.name != e_config->theme_default_border_style)
10431 snprintf(buf, sizeof(buf), "e/widgets/border/%s/border", e_config->theme_default_border_style);
10432 ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
10436 ok = e_theme_edje_object_set(o, "base/theme/borders",
10437 "e/widgets/border/default/border");
10440 /* Reset default border style to default */
10441 eina_stringshare_replace(&e_config->theme_default_border_style, "default");
10442 e_config_save_queue();
10450 const char *shape_option, *argb_option;
10455 if ((e_config->use_composite) && (!bd->client.argb))
10457 argb_option = edje_object_data_get(o, "argb");
10458 if ((argb_option) && (!strcmp(argb_option, "1")))
10461 if (use_argb != bd->argb)
10462 _e_border_frame_replace(bd, use_argb);
10469 shape_option = edje_object_data_get(o, "shaped");
10470 if ((shape_option) && (!strcmp(shape_option, "1")))
10474 if (bd->client.netwm.name)
10475 edje_object_part_text_set(o, "e.text.title",
10476 bd->client.netwm.name);
10477 else if (bd->client.icccm.title)
10478 edje_object_part_text_set(o, "e.text.title",
10479 bd->client.icccm.title);
10483 evas_object_del(o);
10484 bd->bg_object = NULL;
10487 _e_border_client_inset_calc(bd);
10489 bd->w += (bd->client_inset.l + bd->client_inset.r);
10490 bd->h += (bd->client_inset.t + bd->client_inset.b);
10491 ecore_evas_shaped_set(bd->bg_ecore_evas, bd->shaped);
10492 bd->changes.size = 1;
10493 /* really needed ? */
10494 ecore_x_window_move(bd->client.shell_win,
10495 bd->client_inset.l,
10496 bd->client_inset.t);
10498 if (bd->maximized != E_MAXIMIZE_NONE)
10500 E_Maximize maximized = bd->maximized;
10502 /* to force possible resizes */
10503 bd->maximized = E_MAXIMIZE_NONE;
10505 _e_border_maximize(bd, maximized);
10507 /* restore maximized state */
10508 bd->maximized = maximized;
10510 e_hints_window_maximized_set(bd, bd->maximized & E_MAXIMIZE_HORIZONTAL,
10511 bd->maximized & E_MAXIMIZE_VERTICAL);
10515 edje_object_signal_callback_add(bd->bg_object, "*", "*",
10516 _e_border_cb_signal_bind, bd);
10519 edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
10520 if (bd->icon_object)
10521 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
10524 edje_object_signal_emit(bd->bg_object, "e,state,shaded", "e");
10526 edje_object_signal_emit(bd->bg_object, "e,state,sticky", "e");
10528 edje_object_signal_emit(bd->bg_object, "e,state,hung", "e");
10529 // FIXME: in eval -do differently
10530 // edje_object_message_signal_process(bd->bg_object);
10531 // e_border_frame_recalc(bd);
10533 evas_object_move(bd->bg_object, 0, 0);
10534 evas_object_resize(bd->bg_object, bd->w, bd->h);
10535 evas_object_show(bd->bg_object);
10538 bd->client.border.changed = 0;
10540 if (bd->icon_object)
10544 evas_object_show(bd->icon_object);
10545 edje_object_part_swallow(bd->bg_object, "e.swallow.icon", bd->icon_object);
10548 evas_object_hide(bd->icon_object);
10552 if (rem_change) e_remember_update(bd);
10556 E_Event_Border_Urgent_Change *ev;
10558 if (bd->client.icccm.urgent)
10559 edje_object_signal_emit(bd->bg_object, "e,state,urgent", "e");
10561 edje_object_signal_emit(bd->bg_object, "e,state,not_urgent", "e");
10563 ev = E_NEW(E_Event_Border_Urgent_Change, 1);
10565 e_object_ref(E_OBJECT(bd));
10566 ecore_event_add(E_EVENT_BORDER_URGENT_CHANGE, ev,
10567 _e_border_event_border_urgent_change_free, NULL);
10570 _e_border_hook_call(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN, bd);
10573 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
10575 _e_border_latest_stacked_focus_check_set(E_Border *bd)
10577 E_Border* temp_bd = NULL;
10578 E_Border* top_focusable_bd = NULL;
10579 Eina_Bool is_fully_obscured = EINA_FALSE;
10580 Ecore_X_XRegion *visible_region = NULL;
10581 Ecore_X_XRegion *win_region = NULL;
10582 Ecore_X_Rectangle visible_rect, win_rect;
10585 // set the entire visible region as a root geometry
10586 visible_rect.x = bd->zone->x;
10587 visible_rect.y = bd->zone->y;
10588 visible_rect.width = bd->zone->w;
10589 visible_rect.height = bd->zone->h;
10591 visible_region = ecore_x_xregion_new();
10592 if (!visible_region) return;
10594 ecore_x_xregion_union_rect(visible_region, visible_region, &visible_rect);
10596 bl = e_container_border_list_last(bd->zone->container);
10597 while ((temp_bd = e_container_border_list_prev(bl)))
10599 if (temp_bd == bd) break;
10601 if (temp_bd == focused) continue;
10602 if ((temp_bd->x >= bd->zone->w) || (temp_bd->y >= bd->zone->h)) continue;
10603 if (((temp_bd->x + temp_bd->w) <= 0) || ((temp_bd->y + temp_bd->h) <= 0)) continue;
10604 if ((!temp_bd->iconic) && (temp_bd->visible) && (temp_bd->desk == bd->desk) &&
10605 (temp_bd->client.icccm.accepts_focus || temp_bd->client.icccm.take_focus) &&
10606 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
10607 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
10608 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
10609 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
10610 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
10612 if (!top_focusable_bd)
10614 top_focusable_bd = temp_bd;
10617 win_rect.x = temp_bd->x;
10618 win_rect.y = temp_bd->y;
10619 win_rect.width = temp_bd->w;
10620 win_rect.height = temp_bd->h;
10622 // if it stick out or is bigger than the entire visible region,
10623 // clip it by the entire visible's geometry.
10624 E_RECTS_CLIP_TO_RECT(win_rect.x, win_rect.y,
10625 win_rect.width, win_rect.height,
10626 visible_rect.x, visible_rect.y,
10627 (int)(visible_rect.width), (int)(visible_rect.height));
10629 if (ecore_x_xregion_rect_contain(visible_region, &win_rect))
10631 win_region = ecore_x_xregion_new();
10634 ecore_x_xregion_union_rect(win_region, win_region, &win_rect);
10635 ecore_x_xregion_subtract(visible_region, visible_region, win_region);
10636 ecore_x_xregion_free(win_region);
10639 if (ecore_x_xregion_is_empty(visible_region))
10641 is_fully_obscured = EINA_TRUE;
10649 if (is_fully_obscured == EINA_TRUE)
10651 e_border_focus_set(top_focusable_bd, 1, 1);
10655 e_border_focus_set(bd, 1, 1);
10658 if (visible_region) ecore_x_xregion_free(visible_region);
10659 e_container_border_list_free(bl);
10663 _e_border_latest_stacked_focus(E_Border *bd)
10666 int root_w, root_h;
10668 root_w = bd->zone->w;
10669 root_h = bd->zone->h;
10672 EINA_LIST_FOREACH(focus_stack, l, temp_bd)
10674 if (bd == temp_bd) continue;
10675 if ((temp_bd->x >= root_w) || (temp_bd->y >= root_h)) continue;
10676 if (((temp_bd->x + temp_bd->w) <= 0) || ((temp_bd->y + temp_bd->h) <= 0)) continue;
10678 if ((!temp_bd->iconic) && (temp_bd->visible) && (temp_bd->desk == bd->desk) &&
10679 (temp_bd->client.icccm.accepts_focus || temp_bd->client.icccm.take_focus) &&
10680 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
10681 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
10682 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
10683 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
10684 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
10686 _e_border_latest_stacked_focus_check_set(temp_bd);
10693 _e_border_check_stack (E_Border *bd)
10695 E_Border* temp_bd = NULL;
10696 E_Border* top_bd = NULL;
10697 int passed_focus = 0;
10699 int root_w = bd->zone->w;
10700 int root_h = bd->zone->h;
10703 bl = e_container_border_list_last(bd->zone->container);
10704 while ((temp_bd = e_container_border_list_prev(bl)))
10706 if ((temp_bd->x >= root_w) || (temp_bd->y >= root_h)) continue;
10707 if (((temp_bd->x + temp_bd->w) <= 0) || ((temp_bd->y + temp_bd->h) <= 0)) continue;
10708 if ((temp_bd != bd) &&
10709 (temp_bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING)) continue;
10711 if ((!temp_bd->iconic) && (temp_bd->visible) && (temp_bd->desk == bd->desk) &&
10712 (temp_bd->client.icccm.accepts_focus || temp_bd->client.icccm.take_focus) &&
10713 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
10714 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
10715 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
10716 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
10717 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
10723 e_border_focus_set_with_pointer(bd);
10730 e_border_focus_set_with_pointer(top_bd);
10739 if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
10741 if (!bd->lock_focus_out)
10743 e_border_focus_latest_set(bd);
10755 if (temp_bd == focused)
10761 e_container_border_list_free(bl);
10765 _e_border_focus_top_stack_set(E_Border* bd)
10768 int root_w, root_h;
10770 root_w = bd->zone->w;
10771 root_h = bd->zone->h;
10774 bl = e_container_border_list_last(bd->zone->container);
10775 while ((temp_bd = e_container_border_list_prev(bl)))
10777 if ((temp_bd->x >= root_w) || (temp_bd->y >= root_h)) continue;
10778 if (((temp_bd->x + temp_bd->w) <= 0) || ((temp_bd->y + temp_bd->h) <= 0)) continue;
10779 if (temp_bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) continue;
10781 if ((!temp_bd->iconic) && (temp_bd->visible) && (temp_bd->desk == bd->desk) &&
10782 (temp_bd->client.icccm.accepts_focus || temp_bd->client.icccm.take_focus) &&
10783 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
10784 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
10785 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
10786 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
10787 (temp_bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
10789 if (!temp_bd->focused)
10791 /* this border is the top of the latest stack */
10792 e_border_focus_set (temp_bd, 1, 1);
10797 e_container_border_list_free(bl);
10802 _e_border_eval(E_Border *bd)
10804 E_Event_Border_Property *event;
10805 E_Border_Pending_Move_Resize *pnd;
10806 int rem_change = 0;
10807 int send_event = 1;
10809 if (e_object_is_del(E_OBJECT(bd)))
10811 CRI("_e_border_eval(%p) with deleted border! - %d\n", bd, bd->new_client);
10816 _e_border_hook_call(E_BORDER_HOOK_EVAL_PRE_NEW_BORDER, bd);
10818 if (bd->new_client)
10820 int zx = 0, zy = 0, zw = 0, zh = 0;
10823 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
10826 * Limit maximum size of windows to useful geometry
10828 // TODO: temoporary limited maximize algorithm
10840 if ((rw != bd->w) || (rh != bd->h))
10844 e_border_resize (bd, bd->w, bd->h);
10850 bd->x -= bd->client_inset.l;
10851 bd->y -= bd->client_inset.t;
10852 bd->changes.pos = 1;
10855 else if ((!bd->placed) && (bd->client.icccm.request_pos))
10858 Ecore_X_Window_Attributes *att;
10861 att = &bd->client.initial_attributes;
10862 bw = att->border * 2;
10863 switch (bd->client.icccm.gravity)
10865 case ECORE_X_GRAVITY_N:
10866 bd->x = (att->x - (bw / 2)) - (bd->client_inset.l / 2);
10870 case ECORE_X_GRAVITY_NE:
10871 bd->x = (att->x - (bw)) - (bd->client_inset.l);
10875 case ECORE_X_GRAVITY_E:
10876 bd->x = (att->x - (bw)) - (bd->client_inset.l);
10877 bd->y = (att->y - (bw / 2)) - (bd->client_inset.t / 2);
10880 case ECORE_X_GRAVITY_SE:
10881 bd->x = (att->x - (bw)) - (bd->client_inset.l);
10882 bd->y = (att->y - (bw)) - (bd->client_inset.t);
10885 case ECORE_X_GRAVITY_S:
10886 bd->x = (att->x - (bw / 2)) - (bd->client_inset.l / 2);
10887 bd->y = (att->y - (bw)) - (bd->client_inset.t);
10890 case ECORE_X_GRAVITY_SW:
10892 bd->y = (att->y - (bw)) - (bd->client_inset.t);
10895 case ECORE_X_GRAVITY_W:
10897 bd->y = (att->y - (bw)) - (bd->client_inset.t);
10900 case ECORE_X_GRAVITY_CENTER:
10901 bd->x = (att->x - (bw / 2)) - (bd->client_inset.l / 2);
10902 bd->y = (att->y - (bw / 2)) - (bd->client_inset.t / 2);
10905 case ECORE_X_GRAVITY_NW:
10912 * This ensures that windows that like to open with a x/y
10913 * position smaller than returned by e_zone_useful_geometry_get()
10914 * are moved to useful positions.
10917 if (e_config->geometry_auto_move)
10925 if (bd->x + bd->w > zx + zw)
10926 bd->x = zx + zw - bd->w;
10928 if (bd->y + bd->h > zy + zh)
10929 bd->y = zy + zh - bd->h;
10932 if (bd->zone && e_container_zone_at_point_get(bd->zone->container, bd->x, bd->y))
10934 bd->changes.pos = 1;
10940 bd->changes.pos = 1;
10946 /* FIXME: special placement for dialogs etc. etc. etc goes
10948 /* FIXME: what if parent is not on this desktop - or zone? */
10949 if ((bd->parent) && (bd->parent->visible))
10951 bd->x = bd->parent->x + ((bd->parent->w - bd->w) / 2);
10952 bd->y = bd->parent->y + ((bd->parent->h - bd->h) / 2);
10953 bd->changes.pos = 1;
10957 else if ((bd->leader) && (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))
10959 /* TODO: Place in center of group */
10962 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
10964 bd->x = zx + ((zw - bd->w) / 2);
10965 bd->y = zy + ((zh - bd->h) / 2);
10966 bd->changes.pos = 1;
10972 Eina_List *skiplist = NULL;
10976 new_x = zx + (rand() % (zw - bd->w));
10980 new_y = zy + (rand() % (zh - bd->h));
10984 if ((e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART) || (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET))
10986 skiplist = eina_list_append(skiplist, bd);
10988 e_place_desk_region_smart(bd->desk, skiplist,
10989 bd->x, bd->y, bd->w, bd->h,
10992 e_place_zone_region_smart(bd->zone, skiplist,
10993 bd->x, bd->y, bd->w, bd->h,
10995 eina_list_free(skiplist);
10997 else if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL)
10999 e_place_zone_manual(bd->zone, bd->w, bd->client_inset.t,
11004 e_place_zone_cursor(bd->zone, bd->x, bd->y, bd->w, bd->h,
11005 bd->client_inset.t, &new_x, &new_y);
11009 bd->changes.pos = 1;
11012 EINA_LIST_FREE(bd->pending_move_resize, pnd)
11014 if ((!bd->lock_client_location) && (pnd->move))
11018 bd->changes.pos = 1;
11020 if (pnd->without_border)
11022 bd->x -= bd->client_inset.l;
11023 bd->y -= bd->client_inset.t;
11026 if ((!bd->lock_client_size) && (pnd->resize))
11028 bd->w = pnd->w + (bd->client_inset.l + bd->client_inset.r);
11029 bd->h = pnd->h + (bd->client_inset.t + bd->client_inset.b);
11030 bd->client.w = pnd->w;
11031 bd->client.h = pnd->h;
11032 bd->changes.size = 1;
11038 /* Recreate state */
11039 e_hints_window_init(bd);
11040 if ((bd->client.e.state.centered) &&
11041 ((!bd->remember) ||
11042 ((bd->remember) && (!(bd->remember->apply & E_REMEMBER_APPLY_POS)))))
11044 bd->x = zx + (zw - bd->w) / 2;
11045 bd->y = zy + (zh - bd->h) / 2;
11046 bd->changes.pos = 1;
11050 _e_border_client_move_resize_send(bd);
11052 /* if the explicit geometry request asks for the app to be
11053 * in another zone - well move it there */
11057 zone = e_container_zone_at_point_get(bd->zone->container,
11058 bd->x + (bd->w / 2),
11059 bd->y + (bd->h / 2));
11061 zone = e_container_zone_at_point_get(bd->zone->container,
11065 zone = e_container_zone_at_point_get(bd->zone->container,
11069 zone = e_container_zone_at_point_get(bd->zone->container,
11071 bd->y + bd->h - 1);
11073 zone = e_container_zone_at_point_get(bd->zone->container,
11075 bd->y + bd->h - 1);
11076 if ((zone) && (zone != bd->zone))
11077 e_border_zone_set(bd, zone);
11081 _e_border_hook_call(E_BORDER_HOOK_EVAL_POST_NEW_BORDER, bd);
11083 /* effect changes to the window border itself */
11084 if ((bd->changes.shading))
11086 /* show at start of unshade (but don't hide until end of shade) */
11088 ecore_x_window_raise(bd->client.shell_win);
11089 bd->changes.shading = 0;
11092 if ((bd->changes.shaded) && (bd->changes.pos) && (bd->changes.size))
11095 ecore_x_window_lower(bd->client.shell_win);
11097 ecore_x_window_raise(bd->client.shell_win);
11098 bd->changes.shaded = 0;
11101 else if ((bd->changes.shaded) && (bd->changes.pos))
11104 ecore_x_window_lower(bd->client.shell_win);
11106 ecore_x_window_raise(bd->client.shell_win);
11107 bd->changes.size = 1;
11108 bd->changes.shaded = 0;
11111 else if ((bd->changes.shaded) && (bd->changes.size))
11114 ecore_x_window_lower(bd->client.shell_win);
11116 ecore_x_window_raise(bd->client.shell_win);
11117 bd->changes.shaded = 0;
11120 else if (bd->changes.shaded)
11123 ecore_x_window_lower(bd->client.shell_win);
11125 ecore_x_window_raise(bd->client.shell_win);
11126 bd->changes.size = 1;
11127 bd->changes.shaded = 0;
11131 if (bd->changes.size)
11133 int x = 0, y = 0, xx = 0, yy = 0;
11135 if ((bd->shaded) && (!bd->shading))
11137 evas_obscured_clear(bd->bg_evas);
11141 xx = bd->w - (bd->client_inset.l + bd->client_inset.r);
11142 yy = bd->h - (bd->client_inset.t + bd->client_inset.b);
11144 evas_obscured_clear(bd->bg_evas);
11145 evas_obscured_rectangle_add(bd->bg_evas,
11146 bd->client_inset.l, bd->client_inset.t, xx, yy);
11150 if (bd->shade.dir == E_DIRECTION_UP)
11152 y = yy - bd->client.h;
11154 else if (bd->shade.dir == E_DIRECTION_LEFT)
11156 x = xx - bd->client.w;
11161 if (bd->client.e.state.video)
11163 if (bd->client.e.state.video_position.updated)
11165 ecore_x_window_move(bd->win,
11166 bd->client.e.state.video_parent_border->x +
11167 bd->client.e.state.video_parent_border->client_inset.l +
11168 bd->client.e.state.video_parent_border->fx.x +
11169 bd->client.e.state.video_position.x,
11170 bd->client.e.state.video_parent_border->y +
11171 bd->client.e.state.video_parent_border->client_inset.t +
11172 bd->client.e.state.video_parent_border->fx.y +
11173 bd->client.e.state.video_position.y);
11174 bd->client.e.state.video_position.updated = 0;
11177 else if (!bd->changes.pos)
11179 if (bd->post_job) ecore_idle_enterer_del(bd->post_job);
11180 bd->post_job = ecore_idle_enterer_add(_e_border_post_move_resize_job, bd);
11181 bd->post_resize = 1;
11188 ecore_x_window_move_resize(bd->win,
11193 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
11194 ecore_x_window_move(tmp->win,
11195 bd->x + bd->fx.x + bd->client_inset.l + tmp->client.e.state.video_position.x,
11196 bd->y + bd->fx.y + bd->client_inset.t + tmp->client.e.state.video_position.y);
11199 ecore_x_window_move_resize(bd->event_win, 0, 0, bd->w, bd->h);
11201 if ((!bd->shaded) || (bd->shading))
11202 ecore_x_window_move_resize(bd->client.shell_win,
11203 bd->client_inset.l, bd->client_inset.t, xx, yy);
11205 if (bd->internal_ecore_evas)
11206 ecore_evas_move_resize(bd->internal_ecore_evas, x, y, bd->client.w, bd->client.h);
11207 else if (!bd->client.e.state.video)
11208 ecore_x_window_move_resize(bd->client.win, x, y, bd->client.w, bd->client.h);
11210 ecore_evas_move_resize(bd->bg_ecore_evas, 0, 0, bd->w, bd->h);
11211 evas_object_resize(bd->bg_object, bd->w, bd->h);
11212 e_container_shape_resize(bd->shape, bd->w, bd->h);
11213 if (bd->changes.pos)
11214 e_container_shape_move(bd->shape, bd->x + bd->fx.x, bd->y + bd->fx.y);
11216 _e_border_client_move_resize_send(bd);
11218 bd->changes.pos = 0;
11219 bd->changes.size = 0;
11222 else if (bd->changes.pos)
11224 if (bd->post_job) ecore_idle_enterer_del(bd->post_job);
11225 bd->post_job = ecore_idle_enterer_add(_e_border_post_move_resize_job, bd);
11228 e_container_shape_move(bd->shape, bd->x + bd->fx.x, bd->y + bd->fx.y);
11230 _e_border_client_move_resize_send(bd);
11232 bd->changes.pos = 0;
11236 if (bd->changes.reset_gravity)
11238 GRAV_SET(bd, ECORE_X_GRAVITY_NW);
11239 bd->changes.reset_gravity = 0;
11243 if (bd->need_shape_merge)
11245 _e_border_shape_input_rectangle_set(bd);
11246 if ((bd->shaped) || (bd->client.shaped))
11248 Ecore_X_Window twin, twin2;
11251 twin = ecore_x_window_override_new
11252 (bd->zone->container->scratch_win, 0, 0, bd->w, bd->h);
11254 ecore_x_window_shape_window_set(twin, bd->bg_win);
11257 Ecore_X_Rectangle rects[4];
11261 rects[0].width = bd->w;
11262 rects[0].height = bd->client_inset.t;
11264 rects[1].y = bd->client_inset.t;
11265 rects[1].width = bd->client_inset.l;
11266 rects[1].height = bd->h - bd->client_inset.t - bd->client_inset.b;
11267 rects[2].x = bd->w - bd->client_inset.r;
11268 rects[2].y = bd->client_inset.t;
11269 rects[2].width = bd->client_inset.r;
11270 rects[2].height = bd->h - bd->client_inset.t - bd->client_inset.b;
11272 rects[3].y = bd->h - bd->client_inset.b;
11273 rects[3].width = bd->w;
11274 rects[3].height = bd->client_inset.b;
11275 ecore_x_window_shape_rectangles_set(twin, rects, 4);
11277 twin2 = ecore_x_window_override_new
11278 (bd->zone->container->scratch_win, 0, 0,
11279 bd->w - bd->client_inset.l - bd->client_inset.r,
11280 bd->h - bd->client_inset.t - bd->client_inset.b);
11283 if ((bd->shading) || (bd->shaded))
11285 if (bd->shade.dir == E_DIRECTION_UP)
11286 y = bd->h - bd->client_inset.t - bd->client_inset.b - bd->client.h;
11287 else if (bd->shade.dir == E_DIRECTION_LEFT)
11288 x = bd->w - bd->client_inset.l - bd->client_inset.r - bd->client.w;
11290 ecore_x_window_shape_window_set_xy(twin2, bd->client.win,
11292 ecore_x_window_shape_rectangle_clip(twin2, 0, 0,
11293 bd->w - bd->client_inset.l - bd->client_inset.r,
11294 bd->h - bd->client_inset.t - bd->client_inset.b);
11295 ecore_x_window_shape_window_add_xy(twin, twin2,
11296 bd->client_inset.l,
11297 bd->client_inset.t);
11298 ecore_x_window_free(twin2);
11299 ecore_x_window_shape_window_set(bd->win, twin);
11300 ecore_x_window_free(twin);
11303 ecore_x_window_shape_mask_set(bd->win, 0);
11304 // bd->need_shape_export = 1;
11305 bd->need_shape_merge = 0;
11308 if (bd->need_shape_export)
11310 Ecore_X_Rectangle *rects, *orects;
11313 rects = ecore_x_window_shape_rectangles_get(bd->win, &num);
11319 if ((num == bd->shape_rects_num) && (bd->shape_rects))
11323 orects = bd->shape_rects;
11325 for (i = 0; i < num; i++)
11327 if (rects[i].x < 0)
11329 rects[i].width -= rects[i].x;
11332 if ((rects[i].x + (int)rects[i].width) > bd->w)
11333 rects[i].width = rects[i].width - rects[i].x;
11334 if (rects[i].y < 0)
11336 rects[i].height -= rects[i].y;
11339 if ((rects[i].y + (int)rects[i].height) > bd->h)
11340 rects[i].height = rects[i].height - rects[i].y;
11342 if ((orects[i].x != rects[i].x) ||
11343 (orects[i].y != rects[i].y) ||
11344 (orects[i].width != rects[i].width) ||
11345 (orects[i].height != rects[i].height))
11354 if (bd->client.shaped)
11355 e_container_shape_solid_rect_set(bd->shape, 0, 0, 0, 0);
11357 e_container_shape_solid_rect_set(bd->shape, bd->client_inset.l, bd->client_inset.t, bd->client.w, bd->client.h);
11358 E_FREE(bd->shape_rects);
11359 bd->shape_rects = rects;
11360 bd->shape_rects_num = num;
11361 e_container_shape_rects_set(bd->shape, rects, num);
11368 E_FREE(bd->shape_rects);
11369 bd->shape_rects = NULL;
11370 bd->shape_rects_num = 0;
11371 e_container_shape_rects_set(bd->shape, NULL, 0);
11373 bd->need_shape_export = 0;
11376 if ((bd->changes.visible) && (bd->visible) && (bd->new_client))
11380 ecore_x_pointer_xy_get(bd->zone->container->win, &x, &y);
11381 if ((!bd->placed) && (!bd->re_manage) &&
11382 (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL) &&
11383 (!((bd->client.icccm.transient_for != 0) ||
11384 (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))) &&
11385 (!bdmove) && (!bdresize))
11387 /* Set this window into moving state */
11389 bd->cur_mouse_action = e_action_find("window_move");
11390 if (bd->cur_mouse_action)
11392 if ((!bd->cur_mouse_action->func.end_mouse) &&
11393 (!bd->cur_mouse_action->func.end))
11394 bd->cur_mouse_action = NULL;
11395 if (bd->cur_mouse_action)
11397 bd->x = x - (bd->w >> 1);
11398 bd->y = y - (bd->client_inset.t >> 1);
11400 bd->changes.pos = 1;
11402 _e_border_client_move_resize_send(bd);
11407 _e_border_show(bd);
11409 if (bd->cur_mouse_action)
11411 bd->moveinfo.down.x = bd->x + bd->fx.x;
11412 bd->moveinfo.down.y = bd->y + bd->fx.y;
11413 bd->moveinfo.down.w = bd->w;
11414 bd->moveinfo.down.h = bd->h;
11415 bd->mouse.current.mx = x;
11416 bd->mouse.current.my = y;
11417 bd->moveinfo.down.button = 0;
11418 bd->moveinfo.down.mx = x;
11419 bd->moveinfo.down.my = y;
11422 e_object_ref(E_OBJECT(bd->cur_mouse_action));
11423 bd->cur_mouse_action->func.go(E_OBJECT(bd), NULL);
11424 if (e_config->border_raise_on_mouse_action)
11425 e_border_raise(bd);
11426 e_border_focus_set(bd, 1, 1);
11428 bd->changes.visible = 0;
11432 if (bd->changes.icon)
11436 efreet_desktop_free(bd->desktop);
11437 bd->desktop = NULL;
11439 if (bd->icon_object)
11441 evas_object_del(bd->icon_object);
11442 bd->icon_object = NULL;
11444 if (bd->remember && bd->remember->prop.desktop_file)
11446 const char *desktop = bd->remember->prop.desktop_file;
11448 bd->desktop = efreet_desktop_get(desktop);
11450 bd->desktop = efreet_util_desktop_name_find(desktop);
11454 if ((bd->client.icccm.name) && (bd->client.icccm.class))
11455 bd->desktop = efreet_util_desktop_wm_class_find(bd->client.icccm.name,
11456 bd->client.icccm.class);
11460 /* libreoffice and maybe others match window class
11461 with .desktop file name */
11462 if (bd->client.icccm.class)
11465 snprintf(buf, sizeof(buf), "%s.desktop", bd->client.icccm.class);
11466 bd->desktop = efreet_util_desktop_file_id_find(buf);
11471 bd->desktop = e_exec_startup_id_pid_find(bd->client.netwm.startup_id,
11472 bd->client.netwm.pid);
11473 if (bd->desktop) efreet_desktop_ref(bd->desktop);
11475 if (!bd->desktop && bd->client.icccm.name)
11477 /* this works for most cases as fallback. useful when app is
11478 run from a shell */
11479 bd->desktop = efreet_util_desktop_exec_find(bd->client.icccm.name);
11481 if (!bd->desktop && bd->client.icccm.transient_for)
11483 E_Border *bd2 = e_border_find_by_client_window(bd->client.icccm.transient_for);
11484 if (bd2 && bd2->desktop)
11486 efreet_desktop_ref(bd2->desktop);
11487 bd->desktop = bd2->desktop;
11492 ecore_x_window_prop_string_set(bd->client.win, E_ATOM_DESKTOP_FILE,
11493 bd->desktop->orig_path);
11496 bd->icon_object = e_border_icon_add(bd, bd->bg_evas);
11497 if ((bd->focused) && (bd->icon_object))
11498 edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
11501 evas_object_show(bd->icon_object);
11502 edje_object_part_swallow(bd->bg_object, "e.swallow.icon", bd->icon_object);
11505 evas_object_hide(bd->icon_object);
11508 E_Event_Border_Icon_Change *ev;
11510 ev = E_NEW(E_Event_Border_Icon_Change, 1);
11512 e_object_ref(E_OBJECT(bd));
11513 // e_object_breadcrumb_add(E_OBJECT(bd), "border_icon_change_event");
11514 ecore_event_add(E_EVENT_BORDER_ICON_CHANGE, ev,
11515 _e_border_event_border_icon_change_free, NULL);
11517 bd->changes.icon = 0;
11520 bd->new_client = 0;
11522 bd->changes.stack = 0;
11523 bd->changes.prop = 0;
11525 if (bd->client.e.state.rot.changes != -1)
11527 e_border_rotation_set(bd, bd->client.e.state.rot.changes);
11528 bd->client.e.state.rot.changes = -1;
11531 if ((bd->take_focus) || (bd->want_focus))
11533 bd->take_focus = 0;
11534 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
11535 if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) ||
11536 (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK) ||
11539 if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) || (bd->want_focus))
11542 bd->want_focus = 0;
11543 #ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
11544 if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
11545 _e_border_check_stack(bd);
11548 e_border_focus_set_with_pointer(bd);
11550 else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
11552 if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
11553 ((e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED) &&
11554 (e_border_find_by_client_window(bd->client.icccm.transient_for) ==
11555 e_border_focused_get())))
11557 e_border_focus_set_with_pointer(bd);
11562 /* focus window by default when it is the only one on desk */
11563 E_Border *bd2 = NULL;
11565 EINA_LIST_FOREACH(focus_stack, l, bd2)
11567 if (bd == bd2) continue;
11568 if ((!bd2->iconic) && (bd2->visible) &&
11569 ((bd->desk == bd2->desk) || bd2->sticky))
11575 e_border_focus_set_with_pointer(bd);
11580 if (bd->need_maximize)
11583 max = bd->maximized;
11584 bd->maximized = E_MAXIMIZE_NONE;
11585 e_border_maximize(bd, max);
11586 bd->need_maximize = 0;
11589 if (bd->need_fullscreen)
11591 e_border_fullscreen(bd, e_config->fullscreen_policy);
11592 bd->need_fullscreen = 0;
11596 e_remember_update(bd);
11598 if (send_event) // FIXME: send only if a property changed - above need to
11599 { // check on that. for now - always send.
11600 event = E_NEW(E_Event_Border_Property, 1);
11601 event->border = bd;
11602 e_object_ref(E_OBJECT(bd));
11603 ecore_event_add(E_EVENT_BORDER_PROPERTY, event, _e_border_event_border_property_free, NULL);
11605 _e_border_hook_call(E_BORDER_HOOK_EVAL_END, bd);
11609 _e_border_moveinfo_gather(E_Border *bd,
11610 const char *source)
11612 if (e_util_glob_match(source, "mouse,*,1")) bd->moveinfo.down.button = 1;
11613 else if (e_util_glob_match(source, "mouse,*,2"))
11614 bd->moveinfo.down.button = 2;
11615 else if (e_util_glob_match(source, "mouse,*,3"))
11616 bd->moveinfo.down.button = 3;
11617 else bd->moveinfo.down.button = 0;
11618 if ((bd->moveinfo.down.button >= 1) && (bd->moveinfo.down.button <= 3))
11620 bd->moveinfo.down.mx = bd->mouse.last_down[bd->moveinfo.down.button - 1].mx;
11621 bd->moveinfo.down.my = bd->mouse.last_down[bd->moveinfo.down.button - 1].my;
11625 bd->moveinfo.down.mx = bd->mouse.current.mx;
11626 bd->moveinfo.down.my = bd->mouse.current.my;
11631 _e_border_resize_handle(E_Border *bd)
11634 int new_x, new_y, new_w, new_h;
11636 Eina_List *skiplist = NULL;
11643 if ((bd->resize_mode == RESIZE_TR) ||
11644 (bd->resize_mode == RESIZE_R) ||
11645 (bd->resize_mode == RESIZE_BR))
11647 if ((bd->moveinfo.down.button >= 1) &&
11648 (bd->moveinfo.down.button <= 3))
11649 w = bd->mouse.last_down[bd->moveinfo.down.button - 1].w +
11650 (bd->mouse.current.mx - bd->moveinfo.down.mx);
11652 w = bd->moveinfo.down.w + (bd->mouse.current.mx - bd->moveinfo.down.mx);
11654 else if ((bd->resize_mode == RESIZE_TL) ||
11655 (bd->resize_mode == RESIZE_L) ||
11656 (bd->resize_mode == RESIZE_BL))
11658 if ((bd->moveinfo.down.button >= 1) &&
11659 (bd->moveinfo.down.button <= 3))
11660 w = bd->mouse.last_down[bd->moveinfo.down.button - 1].w -
11661 (bd->mouse.current.mx - bd->moveinfo.down.mx);
11663 w = bd->moveinfo.down.w - (bd->mouse.current.mx - bd->moveinfo.down.mx);
11666 if ((bd->resize_mode == RESIZE_TL) ||
11667 (bd->resize_mode == RESIZE_T) ||
11668 (bd->resize_mode == RESIZE_TR))
11670 if ((bd->moveinfo.down.button >= 1) &&
11671 (bd->moveinfo.down.button <= 3))
11672 h = bd->mouse.last_down[bd->moveinfo.down.button - 1].h -
11673 (bd->mouse.current.my - bd->moveinfo.down.my);
11675 h = bd->moveinfo.down.h - (bd->mouse.current.my - bd->moveinfo.down.my);
11677 else if ((bd->resize_mode == RESIZE_BL) ||
11678 (bd->resize_mode == RESIZE_B) ||
11679 (bd->resize_mode == RESIZE_BR))
11681 if ((bd->moveinfo.down.button >= 1) &&
11682 (bd->moveinfo.down.button <= 3))
11683 h = bd->mouse.last_down[bd->moveinfo.down.button - 1].h +
11684 (bd->mouse.current.my - bd->moveinfo.down.my);
11686 h = bd->moveinfo.down.h + (bd->mouse.current.my - bd->moveinfo.down.my);
11692 if ((bd->resize_mode == RESIZE_TL) ||
11693 (bd->resize_mode == RESIZE_L) ||
11694 (bd->resize_mode == RESIZE_BL))
11696 if ((bd->resize_mode == RESIZE_TL) ||
11697 (bd->resize_mode == RESIZE_T) ||
11698 (bd->resize_mode == RESIZE_TR))
11701 skiplist = eina_list_append(skiplist, bd);
11702 e_resist_container_border_position(bd->zone->container, skiplist,
11703 bd->x, bd->y, bd->w, bd->h,
11705 &new_x, &new_y, &new_w, &new_h);
11706 eina_list_free(skiplist);
11710 e_border_resize_limit(bd, &new_w, &new_h);
11711 if ((bd->resize_mode == RESIZE_TL) ||
11712 (bd->resize_mode == RESIZE_L) ||
11713 (bd->resize_mode == RESIZE_BL))
11714 new_x += (w - new_w);
11715 if ((bd->resize_mode == RESIZE_TL) ||
11716 (bd->resize_mode == RESIZE_T) ||
11717 (bd->resize_mode == RESIZE_TR))
11718 new_y += (h - new_h);
11720 e_border_move_resize(bd, new_x, new_y, new_w, new_h);
11724 _e_border_shade_animator(void *data)
11726 E_Border *bd = data;
11728 double dur = bd->client.h / e_config->border_shade_speed;
11730 dt = ecore_loop_time_get() - bd->shade.start;
11733 if (val < 0.0) val = 0.0;
11734 else if (val > 1.0) val = 1.0;
11736 if (e_config->border_shade_transition == E_TRANSITION_SINUSOIDAL)
11739 ecore_animator_pos_map(val, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0);
11740 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11742 else if (e_config->border_shade_transition == E_TRANSITION_DECELERATE)
11745 ecore_animator_pos_map(val, ECORE_POS_MAP_DECELERATE, 0.0, 0.0);
11746 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11748 else if (e_config->border_shade_transition == E_TRANSITION_ACCELERATE)
11751 ecore_animator_pos_map(val, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0);
11752 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11754 else if (e_config->border_shade_transition == E_TRANSITION_LINEAR)
11757 ecore_animator_pos_map(val, ECORE_POS_MAP_LINEAR, 0.0, 0.0);
11758 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11760 else if (e_config->border_shade_transition == E_TRANSITION_ACCELERATE_LOTS)
11763 ecore_animator_pos_map(val, ECORE_POS_MAP_ACCELERATE_FACTOR, 1.7, 0.0);
11764 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11766 else if (e_config->border_shade_transition == E_TRANSITION_DECELERATE_LOTS)
11769 ecore_animator_pos_map(val, ECORE_POS_MAP_DECELERATE_FACTOR, 1.7, 0.0);
11770 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11772 else if (e_config->border_shade_transition == E_TRANSITION_SINUSOIDAL_LOTS)
11775 ecore_animator_pos_map(val, ECORE_POS_MAP_SINUSOIDAL_FACTOR, 1.7, 0.0);
11776 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11778 else if (e_config->border_shade_transition == E_TRANSITION_BOUNCE)
11781 ecore_animator_pos_map(val, ECORE_POS_MAP_BOUNCE, 1.2, 3.0);
11782 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11784 else if (e_config->border_shade_transition == E_TRANSITION_BOUNCE_LOTS)
11787 ecore_animator_pos_map(val, ECORE_POS_MAP_BOUNCE, 1.2, 5.0);
11788 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11793 ecore_animator_pos_map(val, ECORE_POS_MAP_LINEAR, 0.0, 0.0);
11794 if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
11797 /* due to M_PI's innacuracy, cos(M_PI/2) != 0.0, so we need this */
11798 if (bd->shade.val < 0.001) bd->shade.val = 0.0;
11799 else if (bd->shade.val > .999)
11800 bd->shade.val = 1.0;
11802 if (bd->shade.dir == E_DIRECTION_UP)
11803 bd->h = bd->client_inset.t + bd->client_inset.b + bd->client.h * bd->shade.val;
11804 else if (bd->shade.dir == E_DIRECTION_DOWN)
11806 bd->h = bd->client_inset.t + bd->client_inset.b + bd->client.h * bd->shade.val;
11807 bd->y = bd->shade.y + bd->client.h * (1 - bd->shade.val);
11808 bd->changes.pos = 1;
11810 else if (bd->shade.dir == E_DIRECTION_LEFT)
11811 bd->w = bd->client_inset.l + bd->client_inset.r + bd->client.w * bd->shade.val;
11812 else if (bd->shade.dir == E_DIRECTION_RIGHT)
11814 bd->w = bd->client_inset.l + bd->client_inset.r + bd->client.w * bd->shade.val;
11815 bd->x = bd->shade.x + bd->client.w * (1 - bd->shade.val);
11816 bd->changes.pos = 1;
11819 if ((bd->shaped) || (bd->client.shaped))
11821 bd->need_shape_merge = 1;
11822 bd->need_shape_export = 1;
11824 if (bd->shaped_input)
11826 bd->need_shape_merge = 1;
11828 bd->changes.size = 1;
11834 E_Event_Border_Resize *ev;
11837 bd->shaded = !(bd->shaded);
11838 bd->changes.size = 1;
11839 bd->changes.shaded = 1;
11840 bd->changes.shading = 1;
11842 bd->shade.anim = NULL;
11845 edje_object_signal_emit(bd->bg_object, "e,state,shaded", "e");
11847 edje_object_signal_emit(bd->bg_object, "e,state,unshaded", "e");
11848 edje_object_message_signal_process(bd->bg_object);
11849 e_border_frame_recalc(bd);
11851 ecore_x_window_gravity_set(bd->client.win, ECORE_X_GRAVITY_NW);
11852 ev = E_NEW(E_Event_Border_Resize, 1);
11854 e_object_ref(E_OBJECT(bd));
11855 // e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
11856 ecore_event_add(E_EVENT_BORDER_RESIZE, ev, _e_border_event_border_resize_free, NULL);
11857 return ECORE_CALLBACK_CANCEL;
11859 return ECORE_CALLBACK_RENEW;
11863 _e_border_event_border_resize_free(void *data __UNUSED__,
11866 E_Event_Border_Resize *e;
11869 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_resize_event");
11870 e_object_unref(E_OBJECT(e->border));
11875 _e_border_event_border_move_free(void *data __UNUSED__,
11878 E_Event_Border_Move *e;
11881 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_move_event");
11882 e_object_unref(E_OBJECT(e->border));
11887 _e_border_event_border_add_free(void *data __UNUSED__,
11890 E_Event_Border_Add *e;
11893 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_add_event");
11894 e_object_unref(E_OBJECT(e->border));
11899 _e_border_event_border_remove_free(void *data __UNUSED__,
11902 E_Event_Border_Remove *e;
11905 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_remove_event");
11906 e_object_unref(E_OBJECT(e->border));
11911 _e_border_event_border_show_free(void *data __UNUSED__,
11914 E_Event_Border_Show *e;
11917 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_show_event");
11918 e_object_unref(E_OBJECT(e->border));
11923 _e_border_event_border_hide_free(void *data __UNUSED__,
11926 E_Event_Border_Hide *e;
11929 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_hide_event");
11930 e_object_unref(E_OBJECT(e->border));
11935 _e_border_event_border_iconify_free(void *data __UNUSED__,
11938 E_Event_Border_Iconify *e;
11941 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_iconify_event");
11942 e_object_unref(E_OBJECT(e->border));
11947 _e_border_event_border_uniconify_free(void *data __UNUSED__,
11950 E_Event_Border_Uniconify *e;
11953 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_uniconify_event");
11954 e_object_unref(E_OBJECT(e->border));
11959 _e_border_event_border_stick_free(void *data __UNUSED__,
11962 E_Event_Border_Stick *e;
11965 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_stick_event");
11966 e_object_unref(E_OBJECT(e->border));
11971 _e_border_event_border_unstick_free(void *data __UNUSED__,
11974 E_Event_Border_Unstick *e;
11977 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_unstick_event");
11978 e_object_unref(E_OBJECT(e->border));
11983 _e_border_event_border_zone_set_free(void *data __UNUSED__,
11986 E_Event_Border_Zone_Set *e;
11989 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_zone_set_event");
11990 e_object_unref(E_OBJECT(e->border));
11991 e_object_unref(E_OBJECT(e->zone));
11996 _e_border_event_border_desk_set_free(void *data __UNUSED__,
11999 E_Event_Border_Desk_Set *e;
12002 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_desk_set_event");
12003 e_object_unref(E_OBJECT(e->border));
12004 e_object_unref(E_OBJECT(e->desk));
12009 _e_border_event_border_stack_free(void *data __UNUSED__,
12012 E_Event_Border_Stack *e;
12015 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_raise_event");
12016 e_object_unref(E_OBJECT(e->border));
12019 // e_object_breadcrumb_del(E_OBJECT(e->above), "border_raise_event.above");
12020 e_object_unref(E_OBJECT(e->stack));
12026 _e_border_event_border_icon_change_free(void *data __UNUSED__,
12029 E_Event_Border_Icon_Change *e;
12032 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_icon_change_event");
12033 e_object_unref(E_OBJECT(e->border));
12038 _e_border_event_border_urgent_change_free(void *data __UNUSED__,
12041 E_Event_Border_Urgent_Change *e;
12044 e_object_unref(E_OBJECT(e->border));
12049 _e_border_event_border_focus_in_free(void *data __UNUSED__,
12052 E_Event_Border_Focus_In *e;
12055 e_object_unref(E_OBJECT(e->border));
12060 _e_border_event_border_focus_out_free(void *data __UNUSED__,
12063 E_Event_Border_Focus_Out *e;
12066 e_object_unref(E_OBJECT(e->border));
12071 _e_border_event_border_property_free(void *data __UNUSED__,
12074 E_Event_Border_Property *e;
12077 e_object_unref(E_OBJECT(e->border));
12082 _e_border_event_border_fullscreen_free(void *data __UNUSED__,
12085 E_Event_Border_Fullscreen *e;
12088 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_fullscreen_event");
12089 e_object_unref(E_OBJECT(e->border));
12094 _e_border_event_border_unfullscreen_free(void *data __UNUSED__,
12097 E_Event_Border_Unfullscreen *e;
12100 // e_object_breadcrumb_del(E_OBJECT(e->border), "border_unfullscreen_event");
12101 e_object_unref(E_OBJECT(e->border));
12105 #ifdef _F_ZONE_WINDOW_ROTATION_
12107 _e_border_event_border_rotation_change_begin_free(void *data __UNUSED__,
12110 E_Event_Border_Rotation_Change_Begin *e;
12112 e_object_unref(E_OBJECT(e->border));
12117 _e_border_event_border_rotation_change_cancel_free(void *data __UNUSED__,
12120 E_Event_Border_Rotation_Change_Cancel *e;
12122 e_object_unref(E_OBJECT(e->border));
12127 _e_border_event_border_rotation_change_end_free(void *data __UNUSED__,
12130 E_Event_Border_Rotation_Change_End *e;
12132 e_object_unref(E_OBJECT(e->border));
12137 _e_border_event_border_rotation_change_begin_send(E_Border *bd)
12139 E_Event_Border_Rotation_Change_Begin *ev = NULL;
12140 ev = E_NEW(E_Event_Border_Rotation_Change_End, 1);
12144 e_object_ref(E_OBJECT(bd));
12145 ecore_event_add(E_EVENT_BORDER_ROTATION_CHANGE_BEGIN,
12147 _e_border_event_border_rotation_change_begin_free,
12154 _e_border_zone_update(E_Border *bd)
12160 /* still within old zone - leave it there */
12161 if (E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
12162 bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h))
12163 #if _F_BORDER_CLIP_TO_ZONE_
12165 _e_border_shape_input_clip_to_zone(bd);
12170 #endif /* _F_BORDER_CLIP_TO_ZONE_ */
12171 /* find a new zone */
12172 con = bd->zone->container;
12173 EINA_LIST_FOREACH(con->zones, l, zone)
12175 if (E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
12176 zone->x, zone->y, zone->w, zone->h))
12178 e_border_zone_set(bd, zone);
12179 #if _F_BORDER_CLIP_TO_ZONE_
12180 _e_border_shape_input_clip_to_zone(bd);
12181 #endif /* _F_BORDER_CLIP_TO_ZONE_ */
12188 _e_border_resize_begin(E_Border *bd)
12192 if (!bd->lock_user_stacking)
12194 if (e_config->border_raise_on_mouse_action)
12195 e_border_raise(bd);
12197 if ((bd->shaded) || (bd->shading) ||
12198 (bd->fullscreen) || (bd->lock_user_size))
12201 if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus)
12202 ret = e_grabinput_get(bd->win, 0, bd->win);
12204 ret = e_grabinput_get(bd->win, 0, 0);
12206 if (grabbed && !ret)
12212 if (bd->client.netwm.sync.request)
12214 bd->client.netwm.sync.alarm = ecore_x_sync_alarm_new(bd->client.netwm.sync.counter);
12215 bd->client.netwm.sync.serial = 1;
12216 bd->client.netwm.sync.wait = 0;
12217 bd->client.netwm.sync.send_time = ecore_loop_time_get();
12220 _e_border_hook_call(E_BORDER_HOOK_RESIZE_BEGIN, bd);
12227 _e_border_resize_end(E_Border *bd)
12231 e_grabinput_release(bd->win, bd->win);
12234 if (bd->client.netwm.sync.alarm)
12236 E_Border_Pending_Move_Resize *pnd;
12238 ecore_x_sync_alarm_free(bd->client.netwm.sync.alarm);
12239 bd->client.netwm.sync.alarm = 0;
12240 /* resize to last geometry if sync alarm for it was not yet handled */
12241 if (bd->pending_move_resize)
12244 bd->changes.pos = 1;
12245 bd->changes.size = 1;
12246 _e_border_client_move_resize_send(bd);
12249 EINA_LIST_FREE(bd->pending_move_resize, pnd)
12253 _e_border_hook_call(E_BORDER_HOOK_RESIZE_END, bd);
12257 /* If this border was maximized, we need to unset Maximized state or
12258 * on restart, E still thinks it's maximized */
12259 if (bd->maximized != E_MAXIMIZE_NONE)
12260 e_hints_window_maximized_set(bd, bd->maximized & E_MAXIMIZE_NONE,
12261 bd->maximized & E_MAXIMIZE_NONE);
12266 _e_border_resize_update(E_Border *bd)
12268 _e_border_hook_call(E_BORDER_HOOK_RESIZE_UPDATE, bd);
12272 _e_border_move_begin(E_Border *bd)
12275 if (!bd->lock_user_stacking)
12277 if (e_config->border_raise_on_mouse_action)
12278 e_border_raise(bd);
12280 if ((bd->fullscreen) || (bd->lock_user_location))
12283 if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus)
12284 ret = e_grabinput_get(bd->win, 0, bd->win);
12286 ret = e_grabinput_get(bd->win, 0, 0);
12288 if (grabbed && !ret)
12294 if (bd->client.netwm.sync.request)
12296 bd->client.netwm.sync.alarm = ecore_x_sync_alarm_new(bd->client.netwm.sync.counter);
12297 bd->client.netwm.sync.serial = 0;
12298 bd->client.netwm.sync.wait = 0;
12299 bd->client.netwm.sync.time = ecore_loop_time_get();
12302 _e_border_hook_call(E_BORDER_HOOK_MOVE_BEGIN, bd);
12309 _e_border_move_end(E_Border *bd)
12313 e_grabinput_release(bd->win, bd->win);
12317 if (bd->client.netwm.sync.alarm)
12319 ecore_x_sync_alarm_free(bd->client.netwm.sync.alarm);
12320 bd->client.netwm.sync.alarm = 0;
12323 _e_border_hook_call(E_BORDER_HOOK_MOVE_END, bd);
12330 _e_border_move_update(E_Border *bd)
12332 _e_border_hook_call(E_BORDER_HOOK_MOVE_UPDATE, bd);
12336 _e_border_cb_ping_poller(void *data)
12346 edje_object_signal_emit(bd->bg_object, "e,state,unhung", "e");
12347 if (bd->kill_timer)
12349 ecore_timer_del(bd->kill_timer);
12350 bd->kill_timer = NULL;
12356 /* if time between last ping and now is greater
12357 * than half the ping interval... */
12358 if ((ecore_loop_time_get() - bd->ping) >
12359 ((e_config->ping_clients_interval *
12360 ecore_poller_poll_interval_get(ECORE_POLLER_CORE)) / 2.0))
12365 edje_object_signal_emit(bd->bg_object, "e,state,hung", "e");
12366 /* FIXME: if below dialog is up - hide it now */
12368 if (bd->delete_requested)
12370 /* FIXME: pop up dialog saying app is hung - kill client, or pid */
12371 e_border_act_kill_begin(bd);
12375 bd->ping_poller = NULL;
12377 return ECORE_CALLBACK_CANCEL;
12381 _e_border_cb_kill_timer(void *data)
12386 // dont wait until it's hung -
12389 if (bd->client.netwm.pid > 1)
12390 kill(bd->client.netwm.pid, SIGKILL);
12392 bd->kill_timer = NULL;
12393 return ECORE_CALLBACK_CANCEL;
12397 _e_border_pointer_resize_begin(E_Border *bd)
12399 switch (bd->resize_mode)
12402 e_pointer_type_push(bd->pointer, bd, "resize_tl");
12406 e_pointer_type_push(bd->pointer, bd, "resize_t");
12410 e_pointer_type_push(bd->pointer, bd, "resize_tr");
12414 e_pointer_type_push(bd->pointer, bd, "resize_r");
12418 e_pointer_type_push(bd->pointer, bd, "resize_br");
12422 e_pointer_type_push(bd->pointer, bd, "resize_b");
12426 e_pointer_type_push(bd->pointer, bd, "resize_bl");
12430 e_pointer_type_push(bd->pointer, bd, "resize_l");
12436 _e_border_pointer_resize_end(E_Border *bd)
12438 switch (bd->resize_mode)
12441 e_pointer_type_pop(bd->pointer, bd, "resize_tl");
12445 e_pointer_type_pop(bd->pointer, bd, "resize_t");
12449 e_pointer_type_pop(bd->pointer, bd, "resize_tr");
12453 e_pointer_type_pop(bd->pointer, bd, "resize_r");
12457 e_pointer_type_pop(bd->pointer, bd, "resize_br");
12461 e_pointer_type_pop(bd->pointer, bd, "resize_b");
12465 e_pointer_type_pop(bd->pointer, bd, "resize_bl");
12469 e_pointer_type_pop(bd->pointer, bd, "resize_l");
12475 _e_border_pointer_move_begin(E_Border *bd)
12477 e_pointer_type_push(bd->pointer, bd, "move");
12481 _e_border_pointer_move_end(E_Border *bd)
12483 e_pointer_type_pop(bd->pointer, bd, "move");
12486 static Eina_List *_e_border_hooks = NULL;
12487 static int _e_border_hooks_delete = 0;
12488 static int _e_border_hooks_walking = 0;
12491 _e_border_hooks_clean(void)
12496 EINA_LIST_FOREACH_SAFE(_e_border_hooks, l, ln, bh)
12500 _e_border_hooks = eina_list_remove_list(_e_border_hooks, l);
12507 _e_border_hook_call(E_Border_Hook_Point hookpoint,
12513 _e_border_hooks_walking++;
12514 EINA_LIST_FOREACH(_e_border_hooks, l, bh)
12516 if (bh->delete_me) continue;
12517 if (bh->hookpoint == hookpoint) bh->func(bh->data, bd);
12519 _e_border_hooks_walking--;
12520 if ((_e_border_hooks_walking == 0) && (_e_border_hooks_delete > 0))
12521 _e_border_hooks_clean();
12524 EAPI E_Border_Hook *
12525 e_border_hook_add(E_Border_Hook_Point hookpoint,
12526 void (*func)(void *data,
12532 bh = E_NEW(E_Border_Hook, 1);
12533 if (!bh) return NULL;
12534 bh->hookpoint = hookpoint;
12537 _e_border_hooks = eina_list_append(_e_border_hooks, bh);
12542 e_border_hook_del(E_Border_Hook *bh)
12545 if (_e_border_hooks_walking == 0)
12547 _e_border_hooks = eina_list_remove(_e_border_hooks, bh);
12551 _e_border_hooks_delete++;
12555 e_border_focus_track_freeze(void)
12557 focus_track_frozen++;
12561 e_border_focus_track_thaw(void)
12563 focus_track_frozen--;
12567 e_border_under_pointer_get(E_Desk *desk,
12570 E_Border *bd = NULL, *cbd;
12574 /* We need to ensure that we can get the container window for the
12575 * zone of either the given desk or the desk of the excluded
12576 * window, so return if neither is given */
12578 ecore_x_pointer_xy_get(desk->zone->container->win, &x, &y);
12580 ecore_x_pointer_xy_get(exclude->desk->zone->container->win, &x, &y);
12584 EINA_LIST_FOREACH(e_border_raise_stack_get(), l, cbd)
12586 if (!cbd) continue;
12587 /* If a border was specified which should be excluded from the list
12588 * (because it will be closed shortly for example), skip */
12589 if ((exclude) && (cbd == exclude)) continue;
12590 if ((desk) && (cbd->desk != desk)) continue;
12591 if (!E_INSIDE(x, y, cbd->x, cbd->y, cbd->w, cbd->h))
12593 /* If the layer is higher, the position of the window is higher
12594 * (always on top vs always below) */
12595 if (!bd || (cbd->layer > bd->layer))
12605 _e_border_pointer_warp_to_center_timer(void *data __UNUSED__)
12612 ecore_x_pointer_xy_get(warp_to_win, &x, &y);
12613 if ((x - warp_x) > 5 || (x - warp_x) < -5 ||
12614 (y - warp_y) > 5 || (y - warp_y) < -5)
12616 /* User moved the mouse, so stop warping */
12621 /* We just use the same warp speed as configured
12622 * for the windowlist */
12623 spd = e_config->winlist_warp_speed;
12626 warp_x = (x * (1.0 - spd)) + (warp_to_x * spd);
12627 warp_y = (y * (1.0 - spd)) + (warp_to_y * spd);
12628 if (warp_x == x && warp_y == y)
12630 warp_x = warp_to_x;
12631 warp_y = warp_to_y;
12635 ecore_x_pointer_warp(warp_to_win, warp_x, warp_y);
12636 return ECORE_CALLBACK_RENEW;
12639 ecore_timer_del(warp_timer);
12641 return ECORE_CALLBACK_CANCEL;
12645 e_border_pointer_warp_to_center(E_Border *bd)
12649 /* Do not slide pointer when disabled (probably breaks focus
12650 * on sloppy/mouse focus but requested by users). */
12651 if (!e_config->pointer_slide) return 0;
12652 /* Only warp the pointer if it is not already in the area of
12653 * the given border */
12654 ecore_x_pointer_xy_get(bd->zone->container->win, &x, &y);
12655 if ((x >= bd->x) && (x <= (bd->x + bd->w)) &&
12656 (y >= bd->y) && (y <= (bd->y + bd->h)))
12659 warp_to_x = bd->x + (bd->w / 2);
12660 if (warp_to_x < (bd->zone->x + 1))
12661 warp_to_x = bd->zone->x + ((bd->x + bd->w - bd->zone->x) / 2);
12662 else if (warp_to_x > (bd->zone->x + bd->zone->w))
12663 warp_to_x = (bd->zone->x + bd->zone->w + bd->x) / 2;
12665 warp_to_y = bd->y + (bd->h / 2);
12666 if (warp_to_y < (bd->zone->y + 1))
12667 warp_to_y = bd->zone->y + ((bd->y + bd->h - bd->zone->y) / 2);
12668 else if (warp_to_y > (bd->zone->y + bd->zone->h))
12669 warp_to_y = (bd->zone->y + bd->zone->h + bd->y) / 2;
12672 warp_to_win = bd->zone->container->win;
12673 ecore_x_pointer_xy_get(bd->zone->container->win, &warp_x, &warp_y);
12675 warp_timer = ecore_timer_add(0.01, _e_border_pointer_warp_to_center_timer, (const void *)bd);
12680 e_border_comp_hidden_set(E_Border *bd,
12686 E_OBJECT_CHECK(bd);
12687 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
12689 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
12692 ecore_x_window_hide(tmp->win);
12694 ecore_x_window_show(tmp->win);
12697 if (bd->comp_hidden == hidden) return;
12699 bd->comp_hidden = hidden;
12701 if ((bd->comp_hidden) || (bd->tmp_input_hidden > 0))
12703 ecore_x_composite_window_events_disable(bd->win);
12704 ecore_x_window_ignore_set(bd->win, EINA_TRUE);
12708 _e_border_shape_input_rectangle_set(bd);
12709 ecore_x_window_ignore_set(bd->win, EINA_FALSE);
12714 e_border_tmp_input_hidden_push(E_Border *bd)
12719 E_OBJECT_CHECK(bd);
12720 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
12722 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
12723 e_border_tmp_input_hidden_push(tmp);
12725 bd->tmp_input_hidden++;
12726 if (bd->tmp_input_hidden != 1) return;
12728 if ((bd->comp_hidden) || (bd->tmp_input_hidden > 0))
12730 ecore_x_composite_window_events_disable(bd->win);
12731 ecore_x_window_ignore_set(bd->win, EINA_TRUE);
12735 _e_border_shape_input_rectangle_set(bd);
12736 ecore_x_window_ignore_set(bd->win, EINA_FALSE);
12741 e_border_tmp_input_hidden_pop(E_Border *bd)
12746 E_OBJECT_CHECK(bd);
12747 E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
12749 EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
12750 e_border_tmp_input_hidden_pop(tmp);
12752 bd->tmp_input_hidden--;
12753 if (bd->tmp_input_hidden != 0) return;
12755 if ((bd->comp_hidden) || (bd->tmp_input_hidden > 0))
12757 ecore_x_composite_window_events_disable(bd->win);
12758 ecore_x_window_ignore_set(bd->win, EINA_TRUE);
12762 _e_border_shape_input_rectangle_set(bd);
12763 ecore_x_window_ignore_set(bd->win, EINA_FALSE);
12768 e_border_activate(E_Border *bd, Eina_Bool just_do_it)
12770 if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) ||
12772 ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
12773 ((bd->parent->focused) &&
12774 (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))) ||
12779 if (e_config->clientlist_warp_to_iconified_desktop == 1)
12780 e_desk_show(bd->desk);
12782 if (!bd->lock_user_iconify)
12783 e_border_uniconify(bd);
12785 if ((!bd->iconic) && (!bd->sticky))
12786 e_desk_show(bd->desk);
12787 if (!bd->lock_user_stacking) e_border_raise(bd);
12788 if (!bd->lock_focus_out)
12790 /* XXX ooffice does send this request for
12791 config dialogs when the main window gets focus.
12792 causing the pointer to jump back and forth. */
12793 if ((e_config->focus_policy != E_FOCUS_CLICK) &&
12794 !(bd->client.icccm.name && !strcmp(bd->client.icccm.name, "VCLSalFrame")))
12795 ecore_x_pointer_warp(bd->zone->container->win,
12796 bd->x + (bd->w / 2), bd->y + (bd->h / 2));
12797 e_border_focus_set(bd, 1, 1);
12801 /*vim:ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0*/