summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2014-01-14 20:19:12 -0500
committerMike Blumenkrantz <zmike@samsung.com>2014-01-14 20:22:02 -0500
commit86656e4df9d9125d594e9b24ba793c252b6a0a9f (patch)
tree651b51b9216b24b3158dfb973f45f2dde6a645ce /src/bin
parent7f0c849a27573fdb5b646a3dc39ff7d6200cf8ed (diff)
downloadenlightenment-86656e4df9d9125d594e9b24ba793c252b6a0a9f.tar.gz
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/Makefile.mk43
-rw-r--r--src/bin/e_about.c4
-rw-r--r--src/bin/e_about.h2
-rw-r--r--src/bin/e_actions.c949
-rw-r--r--src/bin/e_alert_main.c12
-rw-r--r--src/bin/e_atoms.c27
-rw-r--r--src/bin/e_atoms.h1
-rw-r--r--src/bin/e_backlight.c75
-rw-r--r--src/bin/e_bg.c82
-rw-r--r--src/bin/e_bg.h10
-rw-r--r--src/bin/e_bindings.c71
-rw-r--r--src/bin/e_bindings.h4
-rw-r--r--src/bin/e_border.c10232
-rw-r--r--src/bin/e_border.h885
-rw-r--r--src/bin/e_canvas.c2
-rw-r--r--src/bin/e_client.c4465
-rw-r--r--src/bin/e_client.h846
-rw-r--r--src/bin/e_client.x98
-rw-r--r--src/bin/e_color_dialog.c6
-rw-r--r--src/bin/e_color_dialog.h3
-rw-r--r--src/bin/e_comp.c4852
-rw-r--r--src/bin/e_comp.h333
-rw-r--r--src/bin/e_comp_canvas.c559
-rw-r--r--src/bin/e_comp_canvas.h81
-rw-r--r--src/bin/e_comp_object.c3364
-rw-r--r--src/bin/e_comp_object.h79
-rw-r--r--src/bin/e_comp_render_update.c248
-rw-r--r--src/bin/e_comp_render_update.h46
-rw-r--r--src/bin/e_comp_wl.c151
-rw-r--r--src/bin/e_comp_wl.h20
-rw-r--r--src/bin/e_comp_x.c4851
-rw-r--r--src/bin/e_comp_x.h7
-rw-r--r--src/bin/e_config.c117
-rw-r--r--src/bin/e_config.h14
-rw-r--r--src/bin/e_config_dialog.c29
-rw-r--r--src/bin/e_config_dialog.h4
-rw-r--r--src/bin/e_configure.c66
-rw-r--r--src/bin/e_configure.h14
-rw-r--r--src/bin/e_confirm_dialog.c2
-rw-r--r--src/bin/e_container.c1095
-rw-r--r--src/bin/e_container.h157
-rw-r--r--src/bin/e_desk.c379
-rw-r--r--src/bin/e_desk.h16
-rw-r--r--src/bin/e_desklock.c59
-rw-r--r--src/bin/e_deskmirror.c5
-rw-r--r--src/bin/e_desktop_editor.c43
-rw-r--r--src/bin/e_desktop_editor.h6
-rw-r--r--src/bin/e_dialog.c36
-rw-r--r--src/bin/e_dialog.h4
-rw-r--r--src/bin/e_dnd.c188
-rw-r--r--src/bin/e_dnd.h6
-rw-r--r--src/bin/e_dpms.c12
-rw-r--r--src/bin/e_entry.c44
-rw-r--r--src/bin/e_entry_dialog.c3
-rw-r--r--src/bin/e_exec.c84
-rw-r--r--src/bin/e_exec.h6
-rw-r--r--src/bin/e_fm.c124
-rw-r--r--src/bin/e_fm_prop.c6
-rw-r--r--src/bin/e_fm_prop.h2
-rw-r--r--src/bin/e_focus.c141
-rw-r--r--src/bin/e_focus.h20
-rw-r--r--src/bin/e_font.c27
-rw-r--r--src/bin/e_gadcon.c55
-rw-r--r--src/bin/e_gadcon_popup.c86
-rw-r--r--src/bin/e_gadcon_popup.h5
-rw-r--r--src/bin/e_grab_dialog.c21
-rw-r--r--src/bin/e_grabinput.c26
-rw-r--r--src/bin/e_grabinput.h10
-rw-r--r--src/bin/e_hints.c1259
-rw-r--r--src/bin/e_hints.h58
-rw-r--r--src/bin/e_import_config_dialog.c10
-rw-r--r--src/bin/e_import_config_dialog.h2
-rw-r--r--src/bin/e_import_dialog.c14
-rw-r--r--src/bin/e_import_dialog.h2
-rw-r--r--src/bin/e_includes.h19
-rw-r--r--src/bin/e_init.c21
-rw-r--r--src/bin/e_int_border_menu.h22
-rw-r--r--src/bin/e_int_border_remember.h10
-rw-r--r--src/bin/e_int_client_locks.c (renamed from src/bin/e_int_border_locks.c)208
-rw-r--r--src/bin/e_int_client_locks.h (renamed from src/bin/e_int_border_locks.h)2
-rw-r--r--src/bin/e_int_client_menu.c (renamed from src/bin/e_int_border_menu.c)940
-rw-r--r--src/bin/e_int_client_menu.h22
-rw-r--r--src/bin/e_int_client_prop.c (renamed from src/bin/e_int_border_prop.c)172
-rw-r--r--src/bin/e_int_client_prop.h (renamed from src/bin/e_int_border_prop.h)2
-rw-r--r--src/bin/e_int_client_remember.c (renamed from src/bin/e_int_border_remember.c)222
-rw-r--r--src/bin/e_int_client_remember.h10
-rw-r--r--src/bin/e_int_config_modules.c4
-rw-r--r--src/bin/e_int_config_modules.h2
-rw-r--r--src/bin/e_int_gadcon_config.c6
-rw-r--r--src/bin/e_int_menus.c316
-rw-r--r--src/bin/e_int_shelf_config.c52
-rw-r--r--src/bin/e_int_toolbar_config.c4
-rw-r--r--src/bin/e_main.c309
-rw-r--r--src/bin/e_manager.c871
-rw-r--r--src/bin/e_manager.h20
-rw-r--r--src/bin/e_maximize.c164
-rw-r--r--src/bin/e_maximize.h8
-rw-r--r--src/bin/e_menu.c206
-rw-r--r--src/bin/e_menu.h3
-rw-r--r--src/bin/e_module.c14
-rw-r--r--src/bin/e_moveresize.c216
-rw-r--r--src/bin/e_msgbus.c46
-rw-r--r--src/bin/e_obj_dialog.c24
-rw-r--r--src/bin/e_obj_dialog.h2
-rw-r--r--src/bin/e_pixmap.c671
-rw-r--r--src/bin/e_pixmap.h54
-rw-r--r--src/bin/e_place.c114
-rw-r--r--src/bin/e_popup.c289
-rw-r--r--src/bin/e_popup.h54
-rw-r--r--src/bin/e_remember.c601
-rw-r--r--src/bin/e_remember.h10
-rw-r--r--src/bin/e_resist.c43
-rw-r--r--src/bin/e_resist.h4
-rw-r--r--src/bin/e_screensaver.c18
-rw-r--r--src/bin/e_shelf.c207
-rw-r--r--src/bin/e_shelf.h5
-rw-r--r--src/bin/e_start_main.c2
-rw-r--r--src/bin/e_stolen.c67
-rw-r--r--src/bin/e_stolen.h11
-rw-r--r--src/bin/e_surface.c4
-rw-r--r--src/bin/e_surface.h2
-rw-r--r--src/bin/e_sys.c44
-rw-r--r--src/bin/e_test.c228
-rw-r--r--src/bin/e_theme.c4
-rw-r--r--src/bin/e_theme_about.c6
-rw-r--r--src/bin/e_theme_about.h2
-rw-r--r--src/bin/e_toolbar.c2
-rw-r--r--src/bin/e_update.c8
-rw-r--r--src/bin/e_utils.c254
-rw-r--r--src/bin/e_utils.h33
-rw-r--r--src/bin/e_widget_bgpreview.c16
-rw-r--r--src/bin/e_widget_color_well.c10
-rw-r--r--src/bin/e_win.c351
-rw-r--r--src/bin/e_win.h12
-rw-r--r--src/bin/e_xinerama.c79
-rw-r--r--src/bin/e_xinerama.h1
-rw-r--r--src/bin/e_xsettings.c65
-rw-r--r--src/bin/e_zone.c1082
-rw-r--r--src/bin/e_zone.h26
139 files changed, 20521 insertions, 24440 deletions
diff --git a/src/bin/Makefile.mk b/src/bin/Makefile.mk
index 0e58521fa8..d5f994efb0 100644
--- a/src/bin/Makefile.mk
+++ b/src/bin/Makefile.mk
@@ -46,21 +46,23 @@ src/bin/e_atoms.h \
src/bin/e_backlight.h \
src/bin/e_bg.h \
src/bin/e_bindings.h \
-src/bin/e_border.h \
src/bin/e_box.h \
src/bin/e_canvas.h \
+src/bin/e_client.h \
+src/bin/e_client.x \
src/bin/e_color_class.h \
src/bin/e_color_dialog.h \
src/bin/e_color.h \
src/bin/e_comp.h \
+src/bin/e_comp_canvas.h \
src/bin/e_comp_cfdata.h \
-src/bin/e_comp_render_update.h \
+src/bin/e_comp_object.h \
+src/bin/e_comp_x.h \
src/bin/e_config_data.h \
src/bin/e_config_dialog.h \
src/bin/e_config.h \
src/bin/e_configure.h \
src/bin/e_confirm_dialog.h \
-src/bin/e_container.h \
src/bin/e_datastore.h \
src/bin/e_dbusmenu.h \
src/bin/e_desk.h \
@@ -103,10 +105,10 @@ src/bin/e_import_config_dialog.h \
src/bin/e_import_dialog.h \
src/bin/e_includes.h \
src/bin/e_init.h \
-src/bin/e_int_border_locks.h \
-src/bin/e_int_border_menu.h \
-src/bin/e_int_border_prop.h \
-src/bin/e_int_border_remember.h \
+src/bin/e_int_client_locks.h \
+src/bin/e_int_client_menu.h \
+src/bin/e_int_client_prop.h \
+src/bin/e_int_client_remember.h \
src/bin/e_int_config_modules.h \
src/bin/e_int_gadcon_config.h \
src/bin/e_intl_data.h \
@@ -134,9 +136,9 @@ src/bin/e_object.h \
src/bin/e_order.h \
src/bin/e_pan.h \
src/bin/e_path.h \
+src/bin/e_pixmap.h \
src/bin/e_place.h \
src/bin/e_pointer.h \
-src/bin/e_popup.h \
src/bin/e_powersave.h \
src/bin/e_prefix.h \
src/bin/e_randr.h \
@@ -153,7 +155,6 @@ src/bin/e_slider.h \
src/bin/e_slidesel.h \
src/bin/e_spectrum.h \
src/bin/e_startup.h \
-src/bin/e_stolen.h \
src/bin/e_sys.h \
src/bin/e_table.h \
src/bin/e_test.h \
@@ -202,8 +203,7 @@ src/bin/e_zone.h
if HAVE_WAYLAND_CLIENTS
ENLIGHTENMENTHEADERS += \
-src/bin/e_comp_wl.h \
-src/bin/e_surface.h
+src/bin/e_comp_wl.h
endif
@@ -216,21 +216,22 @@ src/bin/e_atoms.c \
src/bin/e_backlight.c \
src/bin/e_bg.c \
src/bin/e_bindings.c \
-src/bin/e_border.c \
src/bin/e_box.c \
src/bin/e_canvas.c \
+src/bin/e_client.c \
src/bin/e_color.c \
src/bin/e_color_class.c \
src/bin/e_color_dialog.c \
src/bin/e_comp.c \
+src/bin/e_comp_canvas.c \
src/bin/e_comp_cfdata.c \
-src/bin/e_comp_render_update.c \
+src/bin/e_comp_object.c \
+src/bin/e_comp_x.c \
src/bin/e_config.c \
src/bin/e_config_data.c \
src/bin/e_config_dialog.c \
src/bin/e_configure.c \
src/bin/e_confirm_dialog.c \
-src/bin/e_container.c \
src/bin/e_datastore.c \
src/bin/e_dbusmenu.c \
src/bin/e_desk.c \
@@ -269,10 +270,10 @@ src/bin/e_ilist.c \
src/bin/e_import_config_dialog.c \
src/bin/e_import_dialog.c \
src/bin/e_init.c \
-src/bin/e_int_border_locks.c \
-src/bin/e_int_border_menu.c \
-src/bin/e_int_border_prop.c \
-src/bin/e_int_border_remember.c \
+src/bin/e_int_client_locks.c \
+src/bin/e_int_client_menu.c \
+src/bin/e_int_client_prop.c \
+src/bin/e_int_client_remember.c \
src/bin/e_int_config_modules.c \
src/bin/e_int_gadcon_config.c \
src/bin/e_intl.c \
@@ -299,9 +300,9 @@ src/bin/e_object.c \
src/bin/e_order.c \
src/bin/e_pan.c \
src/bin/e_path.c \
+src/bin/e_pixmap.c \
src/bin/e_place.c \
src/bin/e_pointer.c \
-src/bin/e_popup.c \
src/bin/e_powersave.c \
src/bin/e_prefix.c \
src/bin/e_randr.c \
@@ -318,7 +319,6 @@ src/bin/e_slider.c \
src/bin/e_slidesel.c \
src/bin/e_spectrum.c \
src/bin/e_startup.c \
-src/bin/e_stolen.c \
src/bin/e_sys.c \
src/bin/e_table.c \
src/bin/e_test.c \
@@ -368,8 +368,7 @@ $(ENLIGHTENMENTHEADERS)
if HAVE_WAYLAND_CLIENTS
enlightenment_src += \
-src/bin/e_comp_wl.c \
-src/bin/e_surface.c
+src/bin/e_comp_wl.c
endif
src_bin_enlightenment_CFLAGS = $(AM_CPPFLAGS) @WAYLAND_CFLAGS@ @WAYLAND_EGL_CFLAGS@
diff --git a/src/bin/e_about.c b/src/bin/e_about.c
index b1a64f891b..5c6e4c2de4 100644
--- a/src/bin/e_about.c
+++ b/src/bin/e_about.c
@@ -7,14 +7,14 @@
/* externally accessible functions */
EAPI E_About *
-e_about_new(E_Container *con)
+e_about_new(E_Comp *c)
{
E_Obj_Dialog *od;
char buf[16384];
FILE *f;
Eina_Strbuf *tbuf;
- od = e_obj_dialog_new(con, _("About Enlightenment"), "E", "_about");
+ od = e_obj_dialog_new(c, _("About Enlightenment"), "E", "_about");
if (!od) return NULL;
e_obj_dialog_obj_theme_set(od, "base/theme/about", "e/widgets/about/main");
e_obj_dialog_obj_part_text_set(od, "e.text.label", _("Close"));
diff --git a/src/bin/e_about.h b/src/bin/e_about.h
index 7636b8a52f..612c765a6b 100644
--- a/src/bin/e_about.h
+++ b/src/bin/e_about.h
@@ -6,7 +6,7 @@ typedef struct _E_Obj_Dialog E_About;
#ifndef E_ABOUT_H
#define E_ABOUT_H
-EAPI E_About *e_about_new (E_Container *con);
+EAPI E_About *e_about_new (E_Comp *c);
EAPI void e_about_show (E_About *about);
#endif
diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c
index 002650bd62..4c93c702b6 100644
--- a/src/bin/e_actions.c
+++ b/src/bin/e_actions.c
@@ -93,212 +93,212 @@ static int _action_groups_sort_cb(const void *d1, const void *d2);
/***************************************************************************/
ACT_FN_GO(window_move, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- if (!((E_Border *)obj)->lock_user_location)
- e_border_act_move_begin((E_Border *)obj, NULL);
+ if (obj->type != E_CLIENT_TYPE) return;
+ if (!((E_Client *)obj)->lock_user_location)
+ e_client_act_move_begin((E_Client *)obj, NULL);
}
ACT_FN_GO_MOUSE(window_move, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- e_border_act_move_begin((E_Border *)obj, ev);
+ if (obj->type != E_CLIENT_TYPE) return;
+ e_client_act_move_begin((E_Client *)obj, ev);
}
ACT_FN_GO_SIGNAL(window_move, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- if (!((E_Border *)obj)->lock_user_location)
+ if (obj->type != E_CLIENT_TYPE) return;
+ if (!((E_Client *)obj)->lock_user_location)
{
if ((params) && (!strcmp(params, "end")))
- e_border_signal_move_end((E_Border *)obj, sig, src);
+ e_client_signal_move_end((E_Client *)obj, sig, src);
else
{
- if (!((E_Border *)obj)->moving)
- e_border_signal_move_begin((E_Border *)obj, sig, src);
+ if (!((E_Client *)obj)->moving)
+ e_client_signal_move_begin((E_Client *)obj, sig, src);
}
}
}
ACT_FN_END(window_move, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- e_border_act_move_end((E_Border *)obj, NULL);
+ if (obj->type != E_CLIENT_TYPE) return;
+ e_client_act_move_end((E_Client *)obj, NULL);
}
ACT_FN_END_MOUSE(window_move, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- e_border_act_move_end((E_Border *)obj, ev);
+ if (obj->type != E_CLIENT_TYPE) return;
+ e_client_act_move_end((E_Client *)obj, ev);
}
ACT_FN_GO_KEY(window_move, __UNUSED__, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_location)
- e_border_act_move_keyboard((E_Border *)obj);
+ if (!((E_Client *)obj)->lock_user_location)
+ e_client_act_move_keyboard((E_Client *)obj);
}
/***************************************************************************/
ACT_FN_GO(window_resize, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- if (!((E_Border *)obj)->lock_user_size)
- e_border_act_resize_begin((E_Border *)obj, NULL);
+ if (obj->type != E_CLIENT_TYPE) return;
+ if (!((E_Client *)obj)->lock_user_size)
+ e_client_act_resize_begin((E_Client *)obj, NULL);
}
ACT_FN_GO_MOUSE(window_resize, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- if (!((E_Border *)obj)->lock_user_size)
- e_border_act_resize_begin((E_Border *)obj, ev);
+ if (obj->type != E_CLIENT_TYPE) return;
+ if (!((E_Client *)obj)->lock_user_size)
+ e_client_act_resize_begin((E_Client *)obj, ev);
}
ACT_FN_GO_SIGNAL(window_resize, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- if (!((E_Border *)obj)->lock_user_size)
+ if (obj->type != E_CLIENT_TYPE) return;
+ if (!((E_Client *)obj)->lock_user_size)
{
if ((params) && (!strcmp(params, "end")))
- e_border_signal_resize_end((E_Border *)obj, params, sig, src);
+ e_client_signal_resize_end((E_Client *)obj, params, sig, src);
else
{
if (!params) params = "";
- if (e_border_resizing_get((E_Border *)obj))
- e_border_signal_resize_end((E_Border *)obj, params, sig, src);
+ if (e_client_resizing_get((E_Client *)obj))
+ e_client_signal_resize_end((E_Client *)obj, params, sig, src);
else
- e_border_signal_resize_begin((E_Border *)obj, params, sig, src);
+ e_client_signal_resize_begin((E_Client *)obj, params, sig, src);
}
}
}
ACT_FN_END(window_resize, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- e_border_act_resize_end((E_Border *)obj, NULL);
+ if (obj->type != E_CLIENT_TYPE) return;
+ e_client_act_resize_end((E_Client *)obj, NULL);
}
ACT_FN_END_MOUSE(window_resize, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- e_border_act_resize_end((E_Border *)obj, ev);
+ if (obj->type != E_CLIENT_TYPE) return;
+ e_client_act_resize_end((E_Client *)obj, ev);
}
ACT_FN_GO_KEY(window_resize, __UNUSED__, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_size)
- e_border_act_resize_keyboard((E_Border *)obj);
+ if (!((E_Client *)obj)->lock_user_size)
+ e_client_act_resize_keyboard((E_Client *)obj);
}
/***************************************************************************/
ACT_FN_GO(window_menu, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- e_border_act_menu_begin((E_Border *)obj, NULL, 0);
+ e_client_act_menu_begin((E_Client *)obj, NULL, 0);
}
ACT_FN_GO_MOUSE(window_menu, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- e_border_act_menu_begin((E_Border *)obj, ev, 0);
+ e_client_act_menu_begin((E_Client *)obj, ev, 0);
}
ACT_FN_GO_KEY(window_menu, __UNUSED__, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- e_border_act_menu_begin((E_Border *)obj, NULL, 1);
+ e_client_act_menu_begin((E_Client *)obj, NULL, 1);
}
/***************************************************************************/
ACT_FN_GO(window_raise, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_stacking)
- e_border_raise((E_Border *)obj);
+ if (!((E_Client *)obj)->lock_user_stacking)
+ evas_object_raise(((E_Client *)obj)->frame);
}
/***************************************************************************/
ACT_FN_GO(window_lower, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_stacking)
- e_border_lower((E_Border *)obj);
+ if (!((E_Client *)obj)->lock_user_stacking)
+ evas_object_lower(((E_Client *)obj)->frame);
}
/***************************************************************************/
ACT_FN_GO(window_close, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_close)
- e_border_act_close_begin((E_Border *)obj);
+ if (!((E_Client *)obj)->lock_close)
+ e_client_act_close_begin((E_Client *)obj);
}
/***************************************************************************/
@@ -315,8 +315,8 @@ _e_actions_cb_kill_dialog_ok(void *data, E_Dialog *dia)
e_object_del(E_OBJECT(kill_dialog));
kill_dialog = NULL;
}
- if ((!((E_Border *)obj)->lock_close) && (!((E_Border *)obj)->internal))
- e_border_act_kill_begin((E_Border *)obj);
+ if ((!((E_Client *)obj)->lock_close) && (!((E_Client *)obj)->internal))
+ e_client_act_kill_begin((E_Client *)obj);
}
static void
@@ -337,14 +337,14 @@ _e_actions_cb_kill_dialog_delete(E_Win *win)
ACT_FN_GO(window_kill, __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
char dialog_text[1024];
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE) return;
- bd = (E_Border *)obj;
- if ((bd->lock_close) || (bd->internal)) return;
+ if (obj->type != E_CLIENT_TYPE) return;
+ ec = (E_Client *)obj;
+ if ((ec->lock_close) || (ec->internal)) return;
if (kill_dialog) e_object_del(E_OBJECT(kill_dialog));
@@ -359,9 +359,9 @@ ACT_FN_GO(window_kill, __UNUSED__)
"Please keep in mind that all data from this window<br>"
"which has not yet been saved will be lost!<br><br>"
"Are you sure you want to kill this window?"),
- bd->client.icccm.name);
+ ec->icccm.name);
- kill_dialog = e_dialog_new(e_container_current_get(e_manager_current_get()),
+ kill_dialog = e_dialog_new(NULL,
"E", "_kill_dialog");
if (!kill_dialog) return;
e_win_delete_callback_set(kill_dialog->win,
@@ -382,44 +382,44 @@ ACT_FN_GO(window_kill, __UNUSED__)
/***************************************************************************/
ACT_FN_GO(window_sticky_toggle, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_sticky)
+ if (!((E_Client *)obj)->lock_user_sticky)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- if (bd->sticky) e_border_unstick(bd);
- else e_border_stick(bd);
+ ec = (E_Client *)obj;
+ if (ec->sticky) e_client_unstick(ec);
+ else e_client_stick(ec);
}
}
/***************************************************************************/
ACT_FN_GO(window_sticky, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_sticky)
+ if (!((E_Client *)obj)->lock_user_sticky)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
if (params)
{
if (atoi(params) == 1)
- e_border_stick(bd);
+ e_client_stick(ec);
else if (atoi(params) == 0)
- e_border_unstick(bd);
+ e_client_unstick(ec);
}
}
}
@@ -427,47 +427,47 @@ ACT_FN_GO(window_sticky, )
/***************************************************************************/
ACT_FN_GO(window_iconic_toggle, __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
- if ((!bd->lock_user_iconify) && (!bd->fullscreen) &&
- ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) ||
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN)))
+ if ((!ec->lock_user_iconify) && (!ec->fullscreen) &&
+ ((ec->netwm.type == E_WINDOW_TYPE_NORMAL) ||
+ (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN)))
{
- if (bd->iconic) e_border_uniconify(bd);
- else e_border_iconify(bd);
+ if (ec->iconic) e_client_uniconify(ec);
+ else e_client_iconify(ec);
}
}
/***************************************************************************/
ACT_FN_GO(window_iconic, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_iconify)
+ if (!((E_Client *)obj)->lock_user_iconify)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
if (params)
{
if (atoi(params) == 1)
- e_border_iconify(bd);
+ e_client_iconify(ec);
else if (atoi(params) == 0)
- e_border_uniconify(bd);
+ e_client_uniconify(ec);
}
}
}
@@ -475,44 +475,44 @@ ACT_FN_GO(window_iconic, )
/***************************************************************************/
ACT_FN_GO(window_fullscreen_toggle, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_fullscreen)
+ if (!((E_Client *)obj)->lock_user_fullscreen)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- if (bd->fullscreen)
- e_border_unfullscreen(bd);
+ ec = (E_Client *)obj;
+ if (ec->fullscreen)
+ e_client_unfullscreen(ec);
else if (!params || *params == '\0')
- e_border_fullscreen(bd, e_config->fullscreen_policy);
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
else if (!strcmp(params, "resize"))
- e_border_fullscreen(bd, E_FULLSCREEN_RESIZE);
+ e_client_fullscreen(ec, E_FULLSCREEN_RESIZE);
else if (!strcmp(params, "zoom"))
- e_border_fullscreen(bd, E_FULLSCREEN_ZOOM);
+ e_client_fullscreen(ec, E_FULLSCREEN_ZOOM);
}
}
/***************************************************************************/
ACT_FN_GO(window_fullscreen, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_fullscreen)
+ if (!((E_Client *)obj)->lock_user_fullscreen)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
if (params)
{
int v;
@@ -524,14 +524,14 @@ ACT_FN_GO(window_fullscreen, )
if (v == 1)
{
if (*buf == '\0')
- e_border_fullscreen(bd, e_config->fullscreen_policy);
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
else if (!strcmp(buf, "resize"))
- e_border_fullscreen(bd, E_FULLSCREEN_RESIZE);
+ e_client_fullscreen(ec, E_FULLSCREEN_RESIZE);
else if (!strcmp(buf, "zoom"))
- e_border_fullscreen(bd, E_FULLSCREEN_ZOOM);
+ e_client_fullscreen(ec, E_FULLSCREEN_ZOOM);
}
else if (v == 0)
- e_border_unfullscreen(bd);
+ e_client_unfullscreen(ec);
}
}
}
@@ -540,29 +540,29 @@ ACT_FN_GO(window_fullscreen, )
/***************************************************************************/
ACT_FN_GO(window_maximized_toggle, )
{
- E_Border *bd;
+ E_Client *ec;
Eina_Bool resize = EINA_FALSE;
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
/* internal dialog which is resizable */
- if (bd->internal && (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))
- resize = (bd->client.icccm.max_w != bd->client.icccm.min_w);
- if ((!bd->lock_user_maximize) && (!bd->fullscreen) &&
- (resize || (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) ||
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN)))
+ if (ec->internal && (ec->netwm.type == E_WINDOW_TYPE_DIALOG))
+ resize = (ec->icccm.max_w != ec->icccm.min_w);
+ if ((!ec->lock_user_maximize) && (!ec->fullscreen) &&
+ (resize || (ec->netwm.type == E_WINDOW_TYPE_NORMAL) ||
+ (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN)))
{
- if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
+ if ((ec->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
{
if (!params)
- e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
+ e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
else
{
E_Maximize max;
@@ -571,58 +571,58 @@ ACT_FN_GO(window_maximized_toggle, )
max &= E_MAXIMIZE_DIRECTION;
if (max == E_MAXIMIZE_VERTICAL)
{
- if (bd->maximized & E_MAXIMIZE_VERTICAL)
- e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL);
+ if (ec->maximized & E_MAXIMIZE_VERTICAL)
+ e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL);
else
goto maximize;
}
else if (max == E_MAXIMIZE_HORIZONTAL)
{
- if (bd->maximized & E_MAXIMIZE_HORIZONTAL)
- e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL);
+ if (ec->maximized & E_MAXIMIZE_HORIZONTAL)
+ e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL);
else
goto maximize;
}
else if (max == E_MAXIMIZE_LEFT)
{
- if (bd->maximized & E_MAXIMIZE_LEFT)
- e_border_unmaximize(bd, E_MAXIMIZE_LEFT);
+ if (ec->maximized & E_MAXIMIZE_LEFT)
+ e_client_unmaximize(ec, E_MAXIMIZE_LEFT);
else
goto maximize;
}
else if (max == E_MAXIMIZE_RIGHT)
{
- if (bd->maximized & E_MAXIMIZE_RIGHT)
- e_border_unmaximize(bd, E_MAXIMIZE_RIGHT);
+ if (ec->maximized & E_MAXIMIZE_RIGHT)
+ e_client_unmaximize(ec, E_MAXIMIZE_RIGHT);
else
goto maximize;
}
else
- e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
+ e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
}
}
else
{
maximize:
- e_border_maximize(bd, _e_actions_maximize_parse(params));
+ e_client_maximize(ec, _e_actions_maximize_parse(params));
}
}
}
/***************************************************************************/
ACT_FN_GO(window_maximized, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_maximize)
+ if (!((E_Client *)obj)->lock_user_maximize)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
if (params)
{
E_Maximize max;
@@ -649,18 +649,18 @@ ACT_FN_GO(window_maximized, )
if (v == 1)
{
if (!strcmp(s1, "fullscreen"))
- e_border_maximize(bd, E_MAXIMIZE_FULLSCREEN | max);
+ e_client_maximize(ec, E_MAXIMIZE_FULLSCREEN | max);
else if (!strcmp(s1, "smart"))
- e_border_maximize(bd, E_MAXIMIZE_SMART | max);
+ e_client_maximize(ec, E_MAXIMIZE_SMART | max);
else if (!strcmp(s1, "expand"))
- e_border_maximize(bd, E_MAXIMIZE_EXPAND | max);
+ e_client_maximize(ec, E_MAXIMIZE_EXPAND | max);
else if (!strcmp(s1, "fill"))
- e_border_maximize(bd, E_MAXIMIZE_FILL | max);
+ e_client_maximize(ec, E_MAXIMIZE_FILL | max);
else
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | max);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | max);
}
else if (v == 0)
- e_border_unmaximize(bd, max);
+ e_client_unmaximize(ec, max);
}
}
}
@@ -669,52 +669,52 @@ ACT_FN_GO(window_maximized, )
/***************************************************************************/
ACT_FN_GO(window_shaded_toggle, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_shade)
+ if (!((E_Client *)obj)->lock_user_shade)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- if (bd->shaded)
+ ec = (E_Client *)obj;
+ if (ec->shaded)
{
if (!params)
- e_border_unshade(bd, E_DIRECTION_UP);
+ e_client_unshade(ec, E_DIRECTION_UP);
else
{
if (!strcmp(params, "up"))
- e_border_unshade(bd, E_DIRECTION_UP);
+ e_client_unshade(ec, E_DIRECTION_UP);
else if (!strcmp(params, "down"))
- e_border_unshade(bd, E_DIRECTION_DOWN);
+ e_client_unshade(ec, E_DIRECTION_DOWN);
else if (!strcmp(params, "left"))
- e_border_unshade(bd, E_DIRECTION_LEFT);
+ e_client_unshade(ec, E_DIRECTION_LEFT);
else if (!strcmp(params, "right"))
- e_border_unshade(bd, E_DIRECTION_RIGHT);
+ e_client_unshade(ec, E_DIRECTION_RIGHT);
else
- e_border_unshade(bd, E_DIRECTION_UP);
+ e_client_unshade(ec, E_DIRECTION_UP);
}
}
else
{
if (!params)
- e_border_shade(bd, E_DIRECTION_UP);
+ e_client_shade(ec, E_DIRECTION_UP);
else
{
if (!strcmp(params, "up"))
- e_border_shade(bd, E_DIRECTION_UP);
+ e_client_shade(ec, E_DIRECTION_UP);
else if (!strcmp(params, "down"))
- e_border_shade(bd, E_DIRECTION_DOWN);
+ e_client_shade(ec, E_DIRECTION_DOWN);
else if (!strcmp(params, "left"))
- e_border_shade(bd, E_DIRECTION_LEFT);
+ e_client_shade(ec, E_DIRECTION_LEFT);
else if (!strcmp(params, "right"))
- e_border_shade(bd, E_DIRECTION_RIGHT);
+ e_client_shade(ec, E_DIRECTION_RIGHT);
else
- e_border_shade(bd, E_DIRECTION_UP);
+ e_client_shade(ec, E_DIRECTION_UP);
}
}
}
@@ -723,18 +723,18 @@ ACT_FN_GO(window_shaded_toggle, )
/***************************************************************************/
ACT_FN_GO(window_shaded, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- if (!((E_Border *)obj)->lock_user_shade)
+ if (!((E_Client *)obj)->lock_user_shade)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
if (params)
{
int v;
@@ -745,24 +745,24 @@ ACT_FN_GO(window_shaded, )
if (v == 1)
{
if (!strcmp(buf, "up"))
- e_border_shade(bd, E_DIRECTION_UP);
+ e_client_shade(ec, E_DIRECTION_UP);
else if (!strcmp(buf, "down"))
- e_border_shade(bd, E_DIRECTION_DOWN);
+ e_client_shade(ec, E_DIRECTION_DOWN);
else if (!strcmp(buf, "left"))
- e_border_shade(bd, E_DIRECTION_LEFT);
+ e_client_shade(ec, E_DIRECTION_LEFT);
else if (!strcmp(buf, "right"))
- e_border_shade(bd, E_DIRECTION_RIGHT);
+ e_client_shade(ec, E_DIRECTION_RIGHT);
}
else if (v == 0)
{
if (!strcmp(buf, "up"))
- e_border_unshade(bd, E_DIRECTION_UP);
+ e_client_unshade(ec, E_DIRECTION_UP);
else if (!strcmp(buf, "down"))
- e_border_unshade(bd, E_DIRECTION_DOWN);
+ e_client_unshade(ec, E_DIRECTION_DOWN);
else if (!strcmp(buf, "left"))
- e_border_unshade(bd, E_DIRECTION_LEFT);
+ e_client_unshade(ec, E_DIRECTION_LEFT);
else if (!strcmp(buf, "right"))
- e_border_unshade(bd, E_DIRECTION_RIGHT);
+ e_client_unshade(ec, E_DIRECTION_RIGHT);
}
}
}
@@ -772,37 +772,37 @@ ACT_FN_GO(window_shaded, )
/***************************************************************************/
ACT_FN_GO(window_borderless_toggle, __UNUSED__)
{
- if ((!obj) || (obj->type != E_BORDER_TYPE))
- obj = E_OBJECT(e_border_focused_get());
+ if ((!obj) || (obj->type != E_CLIENT_TYPE))
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (!((E_Border *)obj)->lock_border)
+ if (!((E_Client *)obj)->lock_border)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- bd->borderless = !bd->borderless;
+ ec = (E_Client *)obj;
+ ec->borderless = !ec->borderless;
- bd->client.border.changed = 1;
- bd->changed = 1;
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
}
}
/***************************************************************************/
ACT_FN_GO(window_border_set, __UNUSED__)
{
- if ((!obj) || (obj->type != E_BORDER_TYPE))
- obj = E_OBJECT(e_border_focused_get());
+ if ((!obj) || (obj->type != E_CLIENT_TYPE))
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (!((E_Border *)obj)->lock_border)
+ if (!((E_Client *)obj)->lock_border)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- if (bd && params)
+ ec = (E_Client *)obj;
+ if (ec && params)
{
- eina_stringshare_replace(&bd->bordername, params);
- bd->client.border.changed = 1;
- bd->changed = 1;
+ eina_stringshare_replace(&ec->bordername, params);
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
}
}
}
@@ -810,28 +810,28 @@ ACT_FN_GO(window_border_set, __UNUSED__)
/***************************************************************************/
ACT_FN_GO(window_border_cycle, __UNUSED__)
{
- if ((!obj) || (obj->type != E_BORDER_TYPE))
- obj = E_OBJECT(e_border_focused_get());
+ if ((!obj) || (obj->type != E_CLIENT_TYPE))
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (!((E_Border *)obj)->lock_border)
+ if (!((E_Client *)obj)->lock_border)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- if (bd && params)
+ ec = (E_Client *)obj;
+ if (ec && params)
{
const char *space;
while (*params == ' ')
params++;
- if (bd->bordername)
+ if (ec->bordername)
{
const char *bdname = params;
while ((space = strchr(bdname, ' ')))
{
- if (strncmp(bd->bordername, bdname, space - bdname) == 0)
+ if (strncmp(ec->bordername, bdname, space - bdname) == 0)
{
bdname = space + 1;
while (*bdname == ' ')
@@ -839,12 +839,12 @@ ACT_FN_GO(window_border_cycle, __UNUSED__)
space = strchr(bdname, ' ');
if (space)
eina_stringshare_replace_length(
- &bd->bordername,
+ &ec->bordername,
bdname, space - bdname);
else
- eina_stringshare_replace(&bd->bordername, bdname);
- bd->client.border.changed = 1;
- bd->changed = 1;
+ eina_stringshare_replace(&ec->bordername, bdname);
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
return;
}
bdname = space + 1;
@@ -855,12 +855,12 @@ ACT_FN_GO(window_border_cycle, __UNUSED__)
space = strchr(params, ' ');
if (space)
- eina_stringshare_replace_length(&bd->bordername,
+ eina_stringshare_replace_length(&ec->bordername,
params, space - params);
else
- eina_stringshare_replace(&bd->bordername, params);
- bd->client.border.changed = 1;
- bd->changed = 1;
+ eina_stringshare_replace(&ec->bordername, params);
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
}
}
}
@@ -868,30 +868,30 @@ ACT_FN_GO(window_border_cycle, __UNUSED__)
/***************************************************************************/
ACT_FN_GO(window_pinned_toggle, __UNUSED__)
{
- if ((!obj) || (obj->type != E_BORDER_TYPE))
- obj = E_OBJECT(e_border_focused_get());
+ if ((!obj) || (obj->type != E_CLIENT_TYPE))
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (!((E_Border *)obj)->lock_border)
+ if (!((E_Client *)obj)->lock_border)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- if ((bd->client.netwm.state.stacking == E_STACKING_BELOW) &&
- (bd->user_skip_winlist) && (bd->borderless))
- e_border_pinned_set(bd, 0);
+ ec = (E_Client *)obj;
+ if ((ec->netwm.state.stacking == E_STACKING_BELOW) &&
+ (ec->user_skip_winlist) && (ec->borderless))
+ e_client_pinned_set(ec, 0);
else
- e_border_pinned_set(bd, 1);
+ e_client_pinned_set(ec, 1);
}
}
/***************************************************************************/
ACT_FN_GO(window_move_by, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (params)
@@ -900,15 +900,12 @@ ACT_FN_GO(window_move_by, )
if (sscanf(params, "%i %i", &dx, &dy) == 2)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- e_border_move(bd, bd->x + dx, bd->y + dy);
+ ec = (E_Client *)obj;
+ evas_object_move(ec->frame, ec->x + dx, ec->y + dy);
- if (e_config->focus_policy != E_FOCUS_CLICK)
- ecore_x_pointer_warp(bd->zone->container->win,
- bd->x + (bd->w / 2),
- bd->y + (bd->h / 2));
+ e_util_pointer_center(ec);
}
}
}
@@ -916,21 +913,21 @@ ACT_FN_GO(window_move_by, )
/***************************************************************************/
ACT_FN_GO(window_move_to, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (params)
{
- E_Border *bd;
+ E_Client *ec;
int x, y, zx, zy, zw, zh;
char cx, cy;
- bd = (E_Border *)obj;
- e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
+ ec = (E_Client *)obj;
+ e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
if (sscanf(params, "%c%i %c%i", &cx, &x, &cy, &y) == 4)
{
@@ -941,29 +938,26 @@ ACT_FN_GO(window_move_to, )
{
/* Updated y, keep x. */
y += zy;
- x = bd->x;
+ x = ec->x;
cx = 0;
}
else if (sscanf(params, "%c%i *", &cx, &x) == 2)
{
/* Updated x, keep y. */
x += zx;
- y = bd->y;
+ y = ec->y;
cy = 0;
}
else return;
- if (cx == '-') x = zw - bd->w - x + 2 * zx; /* compensate x with zx */
- if (cy == '-') y = zh - bd->h - y + 2 * zy; /* compensate y with zy */
+ if (cx == '-') x = zw - ec->w - x + 2 * zx; /* compensate x with zx */
+ if (cy == '-') y = zh - ec->h - y + 2 * zy; /* compensate y with zy */
- if ((x != bd->x) || (y != bd->y))
+ if ((x != ec->x) || (y != ec->y))
{
- e_border_move(bd, x, y);
+ evas_object_move(ec->frame, x, y);
- if (e_config->focus_policy != E_FOCUS_CLICK)
- ecore_x_pointer_warp(bd->zone->container->win,
- bd->x + (bd->w / 2),
- bd->y + (bd->h / 2));
+ e_util_pointer_center(ec);
}
}
}
@@ -971,39 +965,30 @@ ACT_FN_GO(window_move_to, )
/***************************************************************************/
ACT_FN_GO(window_move_to_center, __UNUSED__)
{
- E_Border *bd;
- int x, y;
+ E_Client *ec;
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- bd = (E_Border *)obj;
- e_border_center_pos_get(bd, &x, &y);
-
- if ((x != bd->x) || (y != bd->y))
- {
- e_border_move(bd, x, y);
+ ec = (E_Client *)obj;
+ e_comp_object_util_center(ec->frame);
- if (e_config->focus_policy != E_FOCUS_CLICK)
- ecore_x_pointer_warp(bd->zone->container->win,
- x + (bd->w / 2),
- y + (bd->h / 2));
- }
+ e_util_pointer_center(ec);
}
/***************************************************************************/
ACT_FN_GO(window_resize_by, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
@@ -1013,18 +998,16 @@ ACT_FN_GO(window_resize_by, )
if (sscanf(params, "%i %i", &dw, &dh) == 2)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
- dw += bd->w;
- dh += bd->h;
- e_border_resize_limit(bd, &dw, &dh);
- e_border_resize(bd, dw, dh);
+ dw += ec->w;
+ dh += ec->h;
+ e_client_resize_limit(ec, &dw, &dh);
+ evas_object_resize(ec->frame, dw, dh);
- if (e_config->focus_policy != E_FOCUS_CLICK)
- ecore_x_pointer_warp(bd->zone->container->win,
- bd->x + (dw / 2), bd->y + (dh / 2));
+ e_util_pointer_center(ec);
}
}
}
@@ -1032,18 +1015,17 @@ ACT_FN_GO(window_resize_by, )
/***************************************************************************/
ACT_FN_GO(window_push, )
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
if (params)
{
- E_Border *bd, *cur;
- E_Border_List *bd_list;
+ E_Client *ec, *cur;
E_Desk *desk_current;
int hdir, vdir;
int x, y, zx, zy, zw, zh;
@@ -1091,62 +1073,56 @@ ACT_FN_GO(window_push, )
else
return;
- bd = (E_Border *)obj;
- e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
+ ec = (E_Client *)obj;
+ e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
if (hdir < 0) x = zx;
else if (hdir > 0)
- x = zx + zw - bd->w;
- else x = bd->x;
+ x = zx + zw - ec->w;
+ else x = ec->x;
if (vdir < 0) y = zy;
else if (vdir > 0)
- y = zy + zh - bd->h;
- else y = bd->y;
+ y = zy + zh - ec->h;
+ else y = ec->y;
- desk_current = e_desk_current_get(bd->zone);
- bd_list = e_container_border_list_first(bd->zone->container);
- cur = e_container_border_list_next(bd_list);
+ desk_current = e_desk_current_get(ec->zone);
- while (cur)
+ E_CLIENT_FOREACH(ec->comp, cur)
{
- if (((cur->desk == desk_current) || (cur->sticky)) && (bd != cur) && (!cur->iconic))
+ if (((cur->desk == desk_current) || (cur->sticky)) && (ec != cur) && (!cur->iconic))
{
if ((hdir < 0)
- && (cur->x + cur->w < bd->x)
- && (E_SPANS_COMMON(bd->y, bd->h, cur->y, cur->h)))
+ && (cur->x + cur->w < ec->x)
+ && (E_SPANS_COMMON(ec->y, ec->h, cur->y, cur->h)))
x = MAX(x, cur->x + cur->w);
else if ((hdir > 0)
- && (cur->x > bd->x + bd->w)
- && (E_SPANS_COMMON(bd->y, bd->h, cur->y, cur->h)))
- x = MIN(x, zx + cur->x - bd->w);
+ && (cur->x > ec->x + ec->w)
+ && (E_SPANS_COMMON(ec->y, ec->h, cur->y, cur->h)))
+ x = MIN(x, zx + cur->x - ec->w);
if ((vdir < 0)
- && (cur->y + cur->h < bd->y)
- && (E_SPANS_COMMON(bd->x, bd->w, cur->x, cur->w)))
+ && (cur->y + cur->h < ec->y)
+ && (E_SPANS_COMMON(ec->x, ec->w, cur->x, cur->w)))
y = MAX(y, cur->y + cur->h);
else if ((vdir > 0)
- && (cur->y > bd->y + bd->h)
- && (E_SPANS_COMMON(bd->x, bd->w, cur->x, cur->w)))
- y = MIN(y, zy + cur->y - bd->h);
+ && (cur->y > ec->y + ec->h)
+ && (E_SPANS_COMMON(ec->x, ec->w, cur->x, cur->w)))
+ y = MIN(y, zy + cur->y - ec->h);
}
- cur = e_container_border_list_next(bd_list);
}
- e_container_border_list_free(bd_list);
- if ((x != bd->x) || (y != bd->y))
+ if ((x != ec->x) || (y != ec->y))
{
- e_border_move(bd, x, y);
- if (e_config->focus_policy != E_FOCUS_CLICK)
- ecore_x_pointer_warp(bd->zone->container->win,
- bd->x + (bd->w / 2), bd->y + (bd->h / 2));
+ evas_object_move(ec->frame, x, y);
+ e_util_pointer_center(ec);
}
}
}
/*
* These actions jump to a window with the given name. It uses the last focused
- * window it finds (going through e_border_focus_stack_get), so the name should
+ * window it finds (going through e_client_focus_stack_get), so the name should
* be unique, if you want to jump to a specific window.
*
*/
@@ -1155,37 +1131,31 @@ window_jump_to(const char *params)
{
Eina_List *l, *ll;
E_Zone *current_zone;
- E_Border *bd;
+ E_Client *ec;
if (!params) return 0;
/* Go through the list of all windows (that's what the focus stack is used for) */
- l = e_border_focus_stack_get();
+ l = e_client_focus_stack_get();
/* If we can start at the second window, we start there in order to cycle.
* If not, there is only one window, so let's use it */
if (eina_list_next(l))
l = l->next;
- EINA_LIST_FOREACH(l, ll, bd)
+ EINA_LIST_FOREACH(l, ll, ec)
{
- if (!bd->client.icccm.name) continue;
- if (strcmp(bd->client.icccm.name, params)) continue;
+ if (!ec->icccm.name) continue;
+ if (strcmp(ec->icccm.name, params)) continue;
/* Jump to the screen the window is on if it isn't on the current screen but
* only if we don't have to warp the pointer anyway */
current_zone = e_util_zone_current_get(e_manager_current_get());
- if (current_zone != bd->zone && e_config->focus_policy == E_FOCUS_CLICK)
- ecore_x_pointer_warp(bd->zone->container->win,
- bd->zone->x + (bd->zone->w / 2),
- bd->zone->y + (bd->zone->h / 2));
/* Change the virtual desktop if the window isn't on the current virtual desktop */
- e_desk_show(bd->desk);
-
- /* Warp the pointer */
- if (e_config->focus_policy != E_FOCUS_CLICK)
- e_border_pointer_warp_to_center(bd);
+ e_desk_show(ec->desk);
- e_border_raise(bd);
- e_border_focus_set(bd, 1, 1);
+ evas_object_raise(ec->frame);
+ if (ec->zone != current_zone)
+ e_util_pointer_center(ec);
+ evas_object_focus_set(ec->frame, 1);
return 1;
}
return 0;
@@ -1229,78 +1199,78 @@ ACT_FN_GO(window_jump_to_or_start, )
/***************************************************************************/
ACT_FN_GO(window_drag_icon, __UNUSED__)
{
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- bd->drag.start = 1;
- bd->drag.x = -1;
- bd->drag.y = -1;
+ ec = (E_Client *)obj;
+ ec->drag.start = 1;
+ ec->drag.x = -1;
+ ec->drag.y = -1;
}
}
/***************************************************************************/
ACT_FN_GO(window_desk_move_by, )
{
- E_Border *bd;
+ E_Client *ec;
int x, y;
if (!params) return;
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- bd = (E_Border *)obj;
- if ((!bd->zone) || (!bd->desk)) return;
+ ec = (E_Client *)obj;
+ if ((!ec->zone) || (!ec->desk)) return;
if (sscanf(params, "%d %d", &x, &y) == 2)
{
E_Desk *desk;
int dx, dy;
int to_x = 0, to_y = 0;
- e_desk_xy_get(bd->desk, &dx, &dy);
+ e_desk_xy_get(ec->desk, &dx, &dy);
to_x = dx + x;
to_y = dy + y;
- while (!(desk = e_desk_at_xy_get(bd->zone, to_x, to_y)))
+ while (!(desk = e_desk_at_xy_get(ec->zone, to_x, to_y)))
{
/* here we are out of our desktop range */
- while (to_x >= bd->zone->desk_x_count)
+ while (to_x >= ec->zone->desk_x_count)
{
- to_x -= bd->zone->desk_x_count;
+ to_x -= ec->zone->desk_x_count;
to_y++;
}
while (to_x < 0)
{
- to_x += bd->zone->desk_x_count;
+ to_x += ec->zone->desk_x_count;
to_y--;
}
- while (to_y >= bd->zone->desk_y_count)
- to_y -= bd->zone->desk_y_count;
+ while (to_y >= ec->zone->desk_y_count)
+ to_y -= ec->zone->desk_y_count;
while (to_y < 0)
- to_y += bd->zone->desk_y_count;
+ to_y += ec->zone->desk_y_count;
}
if (desk)
{
/* send the border to the required desktop. */
- e_border_desk_set(bd, desk);
+ e_client_desk_set(ec, desk);
/* switch desktop. Quite useful from the interface point of view. */
- e_zone_desk_flip_by(bd->zone, to_x - dx, to_y - dy);
- if (!bd->lock_user_stacking)
- e_border_raise(bd);
+ e_zone_desk_flip_by(ec->zone, to_x - dx, to_y - dy);
+ if (!ec->lock_user_stacking)
+ evas_object_raise(ec->frame);
}
}
}
@@ -1308,7 +1278,7 @@ ACT_FN_GO(window_desk_move_by, )
/***************************************************************************/
ACT_FN_GO(window_zone_move_by, )
{
- E_Border *bd;
+ E_Client *ec;
E_Zone *zone;
E_Maximize max;
int move;
@@ -1317,63 +1287,63 @@ ACT_FN_GO(window_zone_move_by, )
Eina_Bool fullscreen;
if (!params) return;
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
/* bad */
- if (!bd->zone) return;
+ if (!ec->zone) return;
/* only one screen */
- if (eina_list_count(bd->zone->container->zones) < 2) return;
+ if (eina_list_count(ec->zone->comp->zones) < 2) return;
errno = 0;
move = strtol(params, &end, 10);
if ((!end) || end[0] || errno) return;
- move += bd->zone->num;
+ move += ec->zone->num;
if (move < 0)
- move = eina_list_count(bd->zone->container->zones) - 1;
- else if ((unsigned int)move >= eina_list_count(bd->zone->container->zones))
+ move = eina_list_count(ec->zone->comp->zones) - 1;
+ else if ((unsigned int)move >= eina_list_count(ec->zone->comp->zones))
move = 0;
- zone = eina_list_nth(bd->zone->container->zones, move);
+ zone = eina_list_nth(ec->zone->comp->zones, move);
if ((!zone) || (zone->num != (unsigned int)move)) return;
- max = bd->maximized;
- fs = bd->fullscreen_policy;
- fullscreen = bd->fullscreen;
- if (bd->maximized) e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
- if (fullscreen) e_border_unfullscreen(bd);
- e_border_zone_set(bd, zone);
- if (max) e_border_maximize(bd, max);
- if (fullscreen) e_border_fullscreen(bd, fs);
- e_border_focus_set(bd, 1, 1);
+ max = ec->maximized;
+ fs = ec->fullscreen_policy;
+ fullscreen = ec->fullscreen;
+ if (ec->maximized) e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
+ if (fullscreen) e_client_unfullscreen(ec);
+ e_client_zone_set(ec, zone);
+ if (max) e_client_maximize(ec, max);
+ if (fullscreen) e_client_fullscreen(ec, fs);
+ evas_object_focus_set(ec->frame, 1);
}
/***************************************************************************/
ACT_FN_GO(window_desk_move_to, )
{
- E_Border *bd;
+ E_Client *ec;
int x, y;
if (!params) return;
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- bd = (E_Border *)obj;
- if ((!bd->zone) || (!bd->desk)) return;
+ ec = (E_Client *)obj;
+ if ((!ec->zone) || (!ec->desk)) return;
if (sscanf(params, "%d %d", &x, &y) == 2)
{
E_Desk *desk;
- desk = e_desk_at_xy_get(bd->zone, x, y);
- if (desk) e_border_desk_set(bd, desk);
+ desk = e_desk_at_xy_get(ec->zone, x, y);
+ if (desk) e_client_desk_set(ec, desk);
}
}
@@ -1383,19 +1353,18 @@ _e_actions_zone_get(E_Object *obj)
{
if (obj)
{
- if (obj->type == (int)E_MANAGER_TYPE) return e_util_zone_current_get((E_Manager *)obj);
- else if (obj->type == (int)E_CONTAINER_TYPE)
- return e_util_zone_current_get(((E_Container *)obj)->manager);
+ if (obj->type == (int)E_MANAGER_TYPE)
+ return e_util_zone_current_get((E_Manager *)obj);
+ else if (obj->type == (int)E_COMP_TYPE)
+ return e_zone_current_get((E_Comp *)obj);
else if (obj->type == (int)E_ZONE_TYPE)
return (E_Zone *)obj;
- else if (obj->type == (int)E_BORDER_TYPE)
- return ((E_Border *)obj)->zone;
+ else if (obj->type == (int)E_CLIENT_TYPE)
+ return ((E_Client *)obj)->zone;
else if (obj->type == (int)E_SHELF_TYPE)
return ((E_Shelf *)obj)->zone;
- else if (obj->type == (int)E_POPUP_TYPE)
- return ((E_Popup *)obj)->zone;
else if (obj->type == (int)E_WIN_TYPE)
- return ((E_Win *)obj)->border->zone;
+ return ((E_Win *)obj)->client->zone;
}
return e_util_zone_current_get(e_manager_current_get());
}
@@ -1467,7 +1436,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (!zone) return;
wev = E_NEW(E_Event_Pointer_Warp, 1);
if (!wev) return;
- ecore_x_pointer_xy_get(zone->container->win, &x, &y);
+ ecore_evas_pointer_xy_get(zone->comp->ee, &x, &y);
wev->prev.x = x;
wev->prev.y = y;
if (params)
@@ -1481,7 +1450,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (ACT_FLIP_LEFT(zone))
{
e_zone_desk_flip_by(zone, -1, 0);
- ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + zone->w - offset, y);
+ ecore_evas_pointer_warp(zone->comp->ee, zone->x + zone->w - offset, y);
wev->curr.y = y;
wev->curr.x = zone->w - offset;
}
@@ -1491,7 +1460,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (ACT_FLIP_RIGHT(zone))
{
e_zone_desk_flip_by(zone, 1, 0);
- ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + offset, y);
+ ecore_evas_pointer_warp(zone->comp->ee, zone->x + offset, y);
wev->curr.y = y;
wev->curr.x = offset;
}
@@ -1501,7 +1470,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (ACT_FLIP_UP(zone))
{
e_zone_desk_flip_by(zone, 0, -1);
- ecore_x_pointer_warp(zone->container->win, x, zone->container->y + zone->y + zone->h - offset);
+ ecore_evas_pointer_warp(zone->comp->ee, x, zone->y + zone->h - offset);
wev->curr.x = x;
wev->curr.y = zone->h - offset;
}
@@ -1511,7 +1480,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (ACT_FLIP_DOWN(zone))
{
e_zone_desk_flip_by(zone, 0, 1);
- ecore_x_pointer_warp(zone->container->win, x, zone->container->y + zone->y + offset);
+ ecore_evas_pointer_warp(zone->comp->ee, x, zone->y + offset);
wev->curr.x = x;
wev->curr.y = offset;
}
@@ -1521,7 +1490,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (ACT_FLIP_UP_LEFT(zone))
{
e_zone_desk_flip_by(zone, -1, -1);
- ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + zone->w - offset, zone->container->y + zone->y + zone->h - offset);
+ ecore_evas_pointer_warp(zone->comp->ee, zone->x + zone->w - offset, zone->y + zone->h - offset);
wev->curr.x = zone->w - offset;
wev->curr.y = zone->h - offset;
}
@@ -1531,7 +1500,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (ACT_FLIP_UP_RIGHT(zone))
{
e_zone_desk_flip_by(zone, 1, -1);
- ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + offset, zone->container->y + zone->y + zone->h - offset);
+ ecore_evas_pointer_warp(zone->comp->ee, zone->x + offset, zone->y + zone->h - offset);
wev->curr.x = offset;
wev->curr.y = zone->h - offset;
}
@@ -1541,7 +1510,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (ACT_FLIP_DOWN_LEFT(zone))
{
e_zone_desk_flip_by(zone, -1, 1);
- ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + zone->w - offset, zone->container->y + zone->y + offset);
+ ecore_evas_pointer_warp(zone->comp->ee, zone->x + zone->w - offset, zone->y + offset);
wev->curr.y = offset;
wev->curr.x = zone->w - offset;
}
@@ -1551,7 +1520,7 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, )
if (ACT_FLIP_DOWN_RIGHT(zone))
{
e_zone_desk_flip_by(zone, 1, 1);
- ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + offset, zone->container->y + zone->y + offset);
+ ecore_evas_pointer_warp(zone->comp->ee, zone->x + offset, zone->y + offset);
wev->curr.y = offset;
wev->curr.x = offset;
}
@@ -1606,17 +1575,14 @@ ACT_FN_GO(desk_linear_flip_to, )
#define DESK_ACTION_ALL(zone, act) \
E_Zone * zone; \
- Eina_List *lm, *lc, *lz; \
- E_Container *con; \
- E_Manager *man; \
+ const Eina_List *lc, *lz; \
+ E_Comp *c; \
\
- EINA_LIST_FOREACH(e_manager_list(), lm, man) { \
- EINA_LIST_FOREACH(man->containers, lc, con) { \
- EINA_LIST_FOREACH(con->zones, lz, zone) { \
- act; \
+ EINA_LIST_FOREACH(e_comp_list(), lc, c) { \
+ EINA_LIST_FOREACH(c->zones, lz, zone) { \
+ act; \
} \
- } \
- }
+ }
/***************************************************************************/
ACT_FN_GO(desk_flip_by_all, )
@@ -1694,23 +1660,21 @@ ACT_FN_GO(screen_send_to, )
if (scr != -1)
scr = scr % eina_list_count(e_manager_list());
if (scr < 0) scr += eina_list_count(e_manager_list());
- zone2 = e_util_container_zone_number_get(scr, 0);
+ zone2 = e_util_comp_zone_number_get(scr, 0);
}
else
{
if (scr != -1)
- scr = scr % eina_list_count(zone->container->zones);
- if (scr < 0) scr += eina_list_count(zone->container->zones);
- zone2 = e_util_container_zone_number_get(0, scr);
+ scr = scr % eina_list_count(zone->comp->zones);
+ if (scr < 0) scr += eina_list_count(zone->comp->zones);
+ zone2 = e_util_comp_zone_number_get(0, scr);
}
if ((zone2) && (zone != zone2))
{
- e_grabinput_get(zone2->container->win, 0, zone2->container->win);
- ecore_x_pointer_warp(zone2->container->win,
- zone2->x + (zone2->w / 2),
- zone2->y + (zone2->h / 2));
+ ecore_evas_pointer_warp(zone2->comp->ee,
+ zone2->x + (zone2->w / 2),
+ zone2->y + (zone2->h / 2));
e_desk_last_focused_focus(e_desk_current_get(zone2));
- e_grabinput_release(zone2->container->win, zone2->container->win);
}
}
@@ -1729,57 +1693,52 @@ ACT_FN_GO(screen_send_by, )
if (errno) return;
if (eina_list_count(e_manager_list()) > 1)
{
- scr += zone->container->num;
+ scr += zone->comp->num;
if (scr != -1)
scr = scr % eina_list_count(e_manager_list());
if (scr < 0) scr += eina_list_count(e_manager_list());
- zone2 = e_util_container_zone_number_get(scr, 0);
+ zone2 = e_util_comp_zone_number_get(scr, 0);
}
else
{
scr += zone->num;
if (scr != -1)
- scr = scr % eina_list_count(zone->container->zones);
- if (scr < 0) scr += eina_list_count(zone->container->zones);
- zone2 = e_util_container_zone_number_get(0, scr);
+ scr = scr % eina_list_count(zone->comp->zones);
+ if (scr < 0) scr += eina_list_count(zone->comp->zones);
+ zone2 = e_util_comp_zone_number_get(0, scr);
}
if ((zone2) && (zone != zone2))
{
- e_grabinput_get(zone2->container->win, 0, zone2->container->win);
- ecore_x_pointer_warp(zone2->container->win,
+ ecore_evas_pointer_warp(zone2->comp->ee,
zone2->x + (zone2->w / 2),
zone2->y + (zone2->h / 2));
e_desk_last_focused_focus(e_desk_current_get(zone2));
- e_grabinput_release(zone2->container->win, zone2->container->win);
}
}
#define ZONE_DESK_ACTION(con_num, zone_num, zone, act) \
E_Zone * zone; \
if ((con_num < 0) || (zone_num < 0)) { \
- Eina_List *l, *ll, *lll; \
- E_Container *con; \
- E_Manager *man; \
+ Eina_List *l, *ll; \
+ E_Comp *c; \
if ((con_num >= 0) && (zone_num < 0)) /* con=1 zone=all */ { \
- con = e_util_container_number_get(con_num); \
- EINA_LIST_FOREACH(con->zones, l, zone) { \
+ c = e_util_comp_number_get(con_num); \
+ EINA_LIST_FOREACH(c->zones, l, zone) { \
act; \
} } \
- else if ((con_num < 0) && (zone_num >= 0)) /* con=all zone=1 */ { \
- EINA_LIST_FOREACH(e_manager_list(), l, man) { \
- EINA_LIST_FOREACH(man->containers, ll, con) { \
- zone = e_container_zone_number_get(con, zone_num); \
- if (zone) \
- act; \
- } } } \
- else if ((con_num < 0) && (zone_num < 0)) /* con=all zone=all */ { \
- EINA_LIST_FOREACH(e_manager_list(), l, man) { \
- EINA_LIST_FOREACH(man->containers, ll, con) { \
- EINA_LIST_FOREACH(con->zones, lll, zone) { \
- act; \
- } } } } } \
+ else if ((con_num < 0) && (zone_num >= 0)) /* c=all zone=1 */ { \
+ EINA_LIST_FOREACH(e_comp_list(), l, c) { \
+ zone = e_comp_zone_number_get(c, zone_num); \
+ if (zone) \
+ act; \
+ } } \
+ else if ((con_num < 0) && (zone_num < 0)) /* c=all zone=all */ { \
+ EINA_LIST_FOREACH(e_comp_list(), l, c) { \
+ EINA_LIST_FOREACH(c->zones, lll, zone) { \
+ act; \
+ } } } } } \
else { \
- zone = e_util_container_zone_number_get(con_num, zone_num); \
+ zone = e_util_comp_zone_number_get(con_num, zone_num); \
if (zone) act; \
}
@@ -1890,9 +1849,9 @@ ACT_FN_GO(menu_show, )
{
int x, y;
- /* FIXME: this is a bit of a hack... setting m->con - bad hack */
+ /* FIXME: this is a bit of a hack... setting m->c - bad hack */
m->zone = zone;
- ecore_x_pointer_xy_get(zone->container->win, &x, &y);
+ ecore_evas_pointer_xy_get(zone->comp->ee, &x, &y);
e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL);
e_menu_activate_mouse(m, zone, x, y, 1, 1,
E_MENU_POP_DIRECTION_DOWN,
@@ -1920,12 +1879,12 @@ ACT_FN_GO_MOUSE(menu_show, )
{
int x, y;
- /* FIXME: this is a bit of a hack... setting m->con - bad hack */
+ /* FIXME: this is a bit of a hack... setting m->c - bad hack */
m->zone = zone;
x = ev->canvas.x;
y = ev->canvas.y;
- x -= zone->container->x;
- y -= zone->container->y;
+ x -= zone->comp->man->x;
+ y -= zone->comp->man->y;
e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL);
e_menu_activate_mouse(m, zone, x, y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
@@ -1954,7 +1913,7 @@ ACT_FN_GO_KEY(menu_show, , __UNUSED__)
/* FIXME: this is a bit of a hack... setting m->con - bad hack */
m->zone = zone;
- ecore_x_pointer_xy_get(zone->container->win, &x, &y);
+ ecore_evas_pointer_xy_get(zone->comp->ee, &x, &y);
e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL);
e_menu_activate_key(m, zone, x, y, 1, 1,
E_MENU_POP_DIRECTION_DOWN);
@@ -2030,24 +1989,24 @@ ACT_FN_GO(app, )
/***************************************************************************/
ACT_FN_GO(app_new_instance, __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
E_Zone *zone;
zone = _e_actions_zone_get(obj);
if (!zone)
zone = e_util_zone_current_get(e_manager_current_get());
- if (!obj) obj = E_OBJECT(e_border_focused_get());
+ if (!obj) obj = E_OBJECT(e_client_focused_get());
if ((!obj) || (!zone)) return;
- if (obj->type != E_BORDER_TYPE)
+ if (obj->type != E_CLIENT_TYPE)
{
- obj = E_OBJECT(e_border_focused_get());
+ obj = E_OBJECT(e_client_focused_get());
if (!obj) return;
}
- bd = (E_Border *)obj;
+ ec = (E_Client *)obj;
- if (bd->desktop)
- e_exec(zone, bd->desktop, NULL, NULL, "action/app");
+ if (ec->desktop)
+ e_exec(zone, ec->desktop, NULL, NULL, "action/app");
}
/***************************************************************************/
@@ -2477,15 +2436,15 @@ ACT_FN_GO(hibernate, )
ACT_FN_GO(pointer_resize_push, )
{
if (!obj) return;
- if (obj->type == E_BORDER_TYPE)
+ if (obj->type == E_CLIENT_TYPE)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- if ((bd->lock_user_size) || (bd->shaded) || (bd->shading) ||
- (bd->fullscreen) || ((bd->maximized) && (!e_config->allow_manip)))
+ ec = (E_Client *)obj;
+ if ((ec->lock_user_size) || (ec->shaded) || (ec->shading) ||
+ (ec->fullscreen) || ((ec->maximized) && (!e_config->allow_manip)))
return;
- e_pointer_type_push(e_comp_get(bd)->pointer, bd, params);
+ e_pointer_type_push(e_comp_get(ec)->pointer, ec, params);
}
}
@@ -2493,15 +2452,15 @@ ACT_FN_GO(pointer_resize_push, )
ACT_FN_GO(pointer_resize_pop, )
{
if (!obj) return;
- if (obj->type == E_BORDER_TYPE)
+ if (obj->type == E_CLIENT_TYPE)
{
- E_Border *bd;
+ E_Client *ec;
- bd = (E_Border *)obj;
- if ((bd->lock_user_size) || (bd->shaded) || (bd->shading) ||
- (bd->fullscreen) || ((bd->maximized) && (!e_config->allow_manip)))
+ ec = (E_Client *)obj;
+ if ((ec->lock_user_size) || (ec->shaded) || (ec->shading) ||
+ (ec->fullscreen) || ((ec->maximized) && (!e_config->allow_manip)))
return;
- e_pointer_type_pop(e_comp_get(bd)->pointer, bd, params);
+ e_pointer_type_pop(e_comp_get(ec)->pointer, ec, params);
}
}
diff --git a/src/bin/e_alert_main.c b/src/bin/e_alert_main.c
index 2ba2fad463..61cb20cd83 100644
--- a/src/bin/e_alert_main.c
+++ b/src/bin/e_alert_main.c
@@ -88,7 +88,7 @@ main(int argc, char **argv)
fprintf(stderr, "exit_gdb: %i\n", exit_gdb);
- tmp = getenv("E18_TAINTED");
+ tmp = getenv("E19_TAINTED");
if (tmp && !strcmp(tmp, "NO"))
tainted = EINA_FALSE;
@@ -554,7 +554,7 @@ _e_alert_draw_text(void)
"on. We were not able to generate a backtrace, check \n"
"if your 'sysactions.conf' has an 'gdb' action line.\n"
"\n"
- "Please compile latest Git E18 and EFL with\n"
+ "Please compile latest Git E19 and EFL with\n"
"-g and -ggdb3 in your CFLAGS.\n");
}
else if (backtrace_str)
@@ -562,9 +562,9 @@ _e_alert_draw_text(void)
snprintf(msg, sizeof(msg),
"This is not meant to happen and is likely a sign of \n"
"a bug in Enlightenment or the libraries it relies \n"
- "on. You will find an backtrace of E18 (%d) in :\n"
+ "on. You will find an backtrace of E19 (%d) in :\n"
"'%s'\n"
- "Before reporting issue, compile latest E18 and EFL\n"
+ "Before reporting issue, compile latest E19 and EFL\n"
"from Git with '-g -ggdb3' in your CFLAGS.\n"
"You can then report this crash on :\n"
"https://phab.enlightenment.org/maniphest/.\n",
@@ -580,7 +580,7 @@ _e_alert_draw_text(void)
"recover to try and get your desktop back the way \n"
"it was.\n"
"\n"
- "Please compile latest Git E18 and EFL with\n"
+ "Please compile latest Git E19 and EFL with\n"
"-g and -ggdb3 in your CFLAGS.\n", pid);
}
}
@@ -592,7 +592,7 @@ _e_alert_draw_text(void)
"modules; before reporting this issue, please\n"
"unload them and try to see if the bug is still\n"
"there. Also update to latest Git and be sure to\n"
- "compile E18 and EFL with -g and -ggdb3 in your CFLAGS");
+ "compile E19 and EFL with -g and -ggdb3 in your CFLAGS");
}
strcpy(warn, "");
diff --git a/src/bin/e_atoms.c b/src/bin/e_atoms.c
index 889921d312..436a772f83 100644
--- a/src/bin/e_atoms.c
+++ b/src/bin/e_atoms.c
@@ -2,7 +2,6 @@
/* Atoms */
EAPI Ecore_X_Atom E_ATOM_MANAGED = 0;
-EAPI Ecore_X_Atom E_ATOM_CONTAINER = 0;
EAPI Ecore_X_Atom E_ATOM_ZONE = 0;
EAPI Ecore_X_Atom E_ATOM_DESK = 0;
EAPI Ecore_X_Atom E_ATOM_MAPPED = 0;
@@ -20,7 +19,6 @@ e_atoms_init(void)
{
const char *atom_names[] = {
"__E_WINDOW_MANAGED",
- "__E_WINDOW_CONTAINER",
"__E_WINDOW_ZONE",
"__E_WINDOW_DESK",
"__E_WINDOW_MAPPED",
@@ -32,21 +30,20 @@ e_atoms_init(void)
"__E_ATOM_DESKTOP_FILE",
"E_ZONE_GEOMETRY"
};
- Ecore_X_Atom atoms[12];
+ Ecore_X_Atom atoms[11];
- ecore_x_atoms_get(atom_names, 12, atoms);
+ ecore_x_atoms_get(atom_names, 11, atoms);
E_ATOM_MANAGED = atoms[0];
- E_ATOM_CONTAINER = atoms[1];
- E_ATOM_ZONE = atoms[2];
- E_ATOM_DESK = atoms[3];
- E_ATOM_MAPPED = atoms[4];
- E_ATOM_SHADE_DIRECTION = atoms[5];
- E_ATOM_HIDDEN = atoms[6];
- E_ATOM_BORDER_SIZE = atoms[7];
- E_ATOM_WINDOW_STATE = atoms[8];
- E_ATOM_WINDOW_STATE_CENTERED = atoms[9];
- E_ATOM_DESKTOP_FILE = atoms[10];
- E_ATOM_ZONE_GEOMETRY = atoms[11];
+ E_ATOM_ZONE = atoms[1];
+ E_ATOM_DESK = atoms[2];
+ E_ATOM_MAPPED = atoms[3];
+ E_ATOM_SHADE_DIRECTION = atoms[4];
+ E_ATOM_HIDDEN = atoms[5];
+ E_ATOM_BORDER_SIZE = atoms[6];
+ E_ATOM_WINDOW_STATE = atoms[7];
+ E_ATOM_WINDOW_STATE_CENTERED = atoms[8];
+ E_ATOM_DESKTOP_FILE = atoms[9];
+ E_ATOM_ZONE_GEOMETRY = atoms[10];
return 1;
}
diff --git a/src/bin/e_atoms.h b/src/bin/e_atoms.h
index 831fa3836e..d01b364f43 100644
--- a/src/bin/e_atoms.h
+++ b/src/bin/e_atoms.h
@@ -7,7 +7,6 @@
extern EAPI Ecore_X_Atom E_ATOM_MANAGED;
/* basic window properties */
-extern EAPI Ecore_X_Atom E_ATOM_CONTAINER;
extern EAPI Ecore_X_Atom E_ATOM_ZONE;
extern EAPI Ecore_X_Atom E_ATOM_DESK;
extern EAPI Ecore_X_Atom E_ATOM_MAPPED;
diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c
index ca2b7d991e..683a340077 100644
--- a/src/bin/e_backlight.c
+++ b/src/bin/e_backlight.c
@@ -62,22 +62,22 @@ e_backlight_init(void)
(E_EVENT_CONFIG_MODE_CHANGED, _e_backlight_handler, NULL);
_e_backlight_handler_border_fullscreen = ecore_event_handler_add
- (E_EVENT_BORDER_FULLSCREEN, _e_backlight_handler, NULL);
+ (E_EVENT_CLIENT_FULLSCREEN, _e_backlight_handler, NULL);
_e_backlight_handler_border_unfullscreen = ecore_event_handler_add
- (E_EVENT_BORDER_UNFULLSCREEN, _e_backlight_handler, NULL);
+ (E_EVENT_CLIENT_UNFULLSCREEN, _e_backlight_handler, NULL);
_e_backlight_handler_border_remove = ecore_event_handler_add
- (E_EVENT_BORDER_REMOVE, _e_backlight_handler, NULL);
+ (E_EVENT_CLIENT_REMOVE, _e_backlight_handler, NULL);
_e_backlight_handler_border_iconify = ecore_event_handler_add
- (E_EVENT_BORDER_ICONIFY, _e_backlight_handler, NULL);
+ (E_EVENT_CLIENT_ICONIFY, _e_backlight_handler, NULL);
_e_backlight_handler_border_uniconify = ecore_event_handler_add
- (E_EVENT_BORDER_UNICONIFY, _e_backlight_handler, NULL);
+ (E_EVENT_CLIENT_UNICONIFY, _e_backlight_handler, NULL);
_e_backlight_handler_border_desk_set = ecore_event_handler_add
- (E_EVENT_BORDER_DESK_SET, _e_backlight_handler, NULL);
+ (E_EVENT_CLIENT_DESK_SET, _e_backlight_handler, NULL);
_e_backlight_handler_desk_show = ecore_event_handler_add
(E_EVENT_DESK_SHOW, _e_backlight_handler, NULL);
@@ -179,23 +179,15 @@ e_backlight_exists(void)
EAPI void
e_backlight_update(void)
{
- Eina_List *m, *c, *z;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *l, *ll;
+ E_Comp *c;
E_Zone *zone;
if (bl_avail == EINA_FALSE) return;
- EINA_LIST_FOREACH(e_manager_list(), m, man)
- {
- EINA_LIST_FOREACH(man->containers, c, con)
- {
- EINA_LIST_FOREACH(con->zones, z, zone)
- {
- _e_backlight_update(zone);
- }
- }
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ _e_backlight_update(zone);
}
EAPI void
@@ -296,33 +288,36 @@ _e_backlight_update(E_Zone *zone)
Ecore_X_Randr_Output *out;
int i, num = 0;
- root = zone->container->manager->root;
+ root = zone->comp->man->root;
// try randr
- out = ecore_x_randr_window_outputs_get(root, &num);
- if ((out) && (num > 0) && (ecore_x_randr_output_backlight_available()))
+ if (ecore_x_randr_output_backlight_available())
{
- char *name;
- const char *s;
- Eina_Bool gotten = EINA_FALSE;
-
- EINA_LIST_FREE(bl_devs, s)
- eina_stringshare_del(s);
- for (i = 0; i < num; i++)
+ out = ecore_x_randr_window_outputs_get(root, &num);
+ if ((out) && (num > 0))
{
- name = ecore_x_randr_output_name_get(root, out[i], NULL);
- bl_devs = eina_list_append(bl_devs, eina_stringshare_add(name));
- if ((name) && (e_config->backlight.sysdev) &&
- (!strcmp(name, e_config->backlight.sysdev)))
+ char *name;
+ const char *s;
+ Eina_Bool gotten = EINA_FALSE;
+
+ EINA_LIST_FREE(bl_devs, s)
+ eina_stringshare_del(s);
+ for (i = 0; i < num; i++)
{
- x_bl = ecore_x_randr_output_backlight_level_get(root, out[i]);
- gotten = EINA_TRUE;
+ name = ecore_x_randr_output_name_get(root, out[i], NULL);
+ bl_devs = eina_list_append(bl_devs, eina_stringshare_add(name));
+ if ((name) && (e_config->backlight.sysdev) &&
+ (!strcmp(name, e_config->backlight.sysdev)))
+ {
+ x_bl = ecore_x_randr_output_backlight_level_get(root, out[i]);
+ gotten = EINA_TRUE;
+ }
+ free(name);
}
- free(name);
+ if (!gotten)
+ x_bl = ecore_x_randr_output_backlight_level_get(root, out[0]);
}
- if (!gotten)
- x_bl = ecore_x_randr_output_backlight_level_get(root, out[0]);
+ free(out);
}
- free(out);
if (x_bl >= 0.0)
{
bl_val = x_bl;
@@ -350,7 +345,7 @@ _e_backlight_set(E_Zone *zone, double val)
int num = 0, i;
char *name;
- root = zone->container->manager->root;
+ root = zone->comp->man->root;
out = ecore_x_randr_window_outputs_get(root, &num);
if ((out) && (num > 0))
{
diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c
index 6b1619d6ed..3139157d3c 100644
--- a/src/bin/e_bg.c
+++ b/src/bin/e_bg.c
@@ -76,7 +76,7 @@ e_bg_shutdown(void)
* The most specific match will be returned
*/
EAPI const E_Config_Desktop_Background *
-e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
+e_bg_config_get(int manager_num, int zone_num, int desk_x, int desk_y)
{
Eina_List *l, *entries;
E_Config_Desktop_Background *bg = NULL, *cfbg = NULL;
@@ -85,7 +85,7 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
int current_spec = 0; /* how specific the setting is - we want the least general one that applies */
/* look for desk specific background. */
- if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0)
+ if (manager_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0)
{
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
{
@@ -93,8 +93,8 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
if (!cfbg) continue;
spec = 0;
- if (cfbg->container == container_num) spec++;
- else if (cfbg->container >= 0)
+ if (cfbg->manager == manager_num) spec++;
+ else if (cfbg->manager >= 0)
continue;
if (cfbg->zone == zone_num) spec++;
else if (cfbg->zone >= 0)
@@ -144,13 +144,13 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
}
EAPI Eina_Stringshare *
-e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
+e_bg_file_get(int manager_num, int zone_num, int desk_x, int desk_y)
{
const E_Config_Desktop_Background *cfbg;
const char *bgfile = NULL;
int ok = 0;
- cfbg = e_bg_config_get(container_num, zone_num, desk_x, desk_y);
+ cfbg = e_bg_config_get(manager_num, zone_num, desk_x, desk_y);
/* fall back to default */
if (cfbg)
@@ -208,9 +208,9 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
desk = e_desk_current_get(zone);
if (desk)
- bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y);
+ bgfile = e_bg_file_get(zone->comp->num, zone->num, desk->x, desk->y);
else
- bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1);
+ bgfile = e_bg_file_get(zone->comp->num, zone->num, -1, -1);
if (zone->bg_object)
{
@@ -233,39 +233,43 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
zone->bg_object = NULL;
E_FREE_FUNC(zone->transition_object, evas_object_del);
}
- o = edje_object_add(zone->container->bg_evas);
+ o = edje_object_add(zone->comp->evas);
evas_object_repeat_events_set(o, 1);
zone->transition_object = o;
+ evas_object_name_set(zone->transition_object, "zone->transition_object");
/* FIXME: segv if zone is deleted while up??? */
evas_object_data_set(o, "e_zone", zone);
snprintf(buf, sizeof(buf), "e/transitions/%s", trans);
e_theme_edje_object_set(o, "base/theme/transitions", buf);
edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone);
- evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BG);
+ evas_object_move(o, zone->x, zone->y);
+ evas_object_resize(o, zone->w, zone->h);
+ evas_object_layer_set(o, E_LAYER_BG);
evas_object_clip_set(o, zone->bg_clip_object);
evas_object_show(o);
}
if (eina_str_has_extension(bgfile, ".edj"))
{
- o = edje_object_add(zone->container->bg_evas);
+ o = edje_object_add(zone->comp->evas);
edje_object_file_set(o, bgfile, "e/desktop/background");
if (edje_object_data_get(o, "noanimation"))
edje_object_animation_set(o, EINA_FALSE);
}
else
{
- o = e_icon_add(zone->container->bg_evas);
+ o = e_icon_add(zone->comp->evas);
e_icon_file_key_set(o, bgfile, NULL);
e_icon_fill_inside_set(o, 0);
}
evas_object_data_set(o, "e_zone", zone);
evas_object_repeat_events_set(o, 1);
zone->bg_object = o;
+ evas_object_name_set(zone->bg_object, "zone->bg_object");
if (transition == E_BG_TRANSITION_NONE)
{
evas_object_move(o, zone->x, zone->y);
evas_object_resize(o, zone->w, zone->h);
- evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BG);
+ evas_object_layer_set(o, E_LAYER_BG);
}
evas_object_clip_set(o, zone->bg_clip_object);
evas_object_show(o);
@@ -285,9 +289,9 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
if (zone->bg_object) evas_object_name_set(zone->bg_object, "zone->bg_object");
if (zone->prev_bg_object) evas_object_name_set(zone->prev_bg_object, "zone->prev_bg_object");
if (zone->transition_object) evas_object_name_set(zone->transition_object, "zone->transition_object");
- if (zone->comp_zone) e_comp_zone_update(zone->comp_zone);
evas_object_move(zone->transition_object, zone->x, zone->y);
evas_object_resize(zone->transition_object, zone->w, zone->h);
+ e_comp_canvas_zone_update(zone);
end:
eina_stringshare_del(bgfile);
}
@@ -322,7 +326,7 @@ e_bg_default_set(const char *file)
e_config->desktop_default_background = NULL;
ev = E_NEW(E_Event_Bg_Update, 1);
- ev->container = -1;
+ ev->manager = -1;
ev->zone = -1;
ev->desk_x = -1;
ev->desk_y = -1;
@@ -330,7 +334,7 @@ e_bg_default_set(const char *file)
}
EAPI void
-e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
+e_bg_add(int manager, int zone, int desk_x, int desk_y, const char *file)
{
const Eina_List *l;
E_Config_Desktop_Background *cfbg;
@@ -341,7 +345,7 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
{
if ((cfbg) &&
- (cfbg->container == container) &&
+ (cfbg->manager == manager) &&
(cfbg->zone == zone) &&
(cfbg->desk_x == desk_x) &&
(cfbg->desk_y == desk_y) &&
@@ -352,9 +356,9 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
}
}
- e_bg_del(container, zone, desk_x, desk_y);
+ e_bg_del(manager, zone, desk_x, desk_y);
cfbg = E_NEW(E_Config_Desktop_Background, 1);
- cfbg->container = container;
+ cfbg->manager = manager;
cfbg->zone = zone;
cfbg->desk_x = desk_x;
cfbg->desk_y = desk_y;
@@ -364,7 +368,7 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
e_filereg_register(cfbg->file);
ev = E_NEW(E_Event_Bg_Update, 1);
- ev->container = container;
+ ev->manager = manager;
ev->zone = zone;
ev->desk_x = desk_x;
ev->desk_y = desk_y;
@@ -372,7 +376,7 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
}
EAPI void
-e_bg_del(int container, int zone, int desk_x, int desk_y)
+e_bg_del(int manager, int zone, int desk_x, int desk_y)
{
Eina_List *l;
E_Config_Desktop_Background *cfbg;
@@ -381,7 +385,7 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
{
if (!cfbg) continue;
- if ((cfbg->container == container) && (cfbg->zone == zone) &&
+ if ((cfbg->manager == manager) && (cfbg->zone == zone) &&
(cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y))
{
e_config->desktop_backgrounds = eina_list_remove_list(e_config->desktop_backgrounds, l);
@@ -393,7 +397,7 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
}
ev = E_NEW(E_Event_Bg_Update, 1);
- ev->container = container;
+ ev->manager = manager;
ev->zone = zone;
ev->desk_x = desk_x;
ev->desk_y = desk_y;
@@ -403,21 +407,13 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
EAPI void
e_bg_update(void)
{
- Eina_List *l, *ll, *lll;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *l, *ll;
+ E_Comp *c;
E_Zone *zone;
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- EINA_LIST_FOREACH(man->containers, ll, con)
- {
- EINA_LIST_FOREACH(con->zones, lll, zone)
- {
- e_zone_bg_reconfigure(zone);
- }
- }
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ e_zone_bg_reconfigure(zone);
}
/* local subsystem functions */
@@ -507,19 +503,11 @@ _e_bg_signal(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNU
{
E_Zone *zone = data;
- if (zone->prev_bg_object)
- {
- evas_object_del(zone->prev_bg_object);
- zone->prev_bg_object = NULL;
- }
- if (zone->transition_object)
- {
- evas_object_del(zone->transition_object);
- zone->transition_object = NULL;
- }
+ E_FREE_FUNC(zone->prev_bg_object, evas_object_del);
+ E_FREE_FUNC(zone->transition_object, evas_object_del);
evas_object_move(zone->bg_object, zone->x, zone->y);
evas_object_resize(zone->bg_object, zone->w, zone->h);
- evas_object_layer_set(zone->bg_object, E_COMP_CANVAS_LAYER_BG);
+ evas_object_layer_set(zone->bg_object, E_LAYER_BG);
evas_object_clip_set(zone->bg_object, zone->bg_clip_object);
evas_object_show(zone->bg_object);
}
diff --git a/src/bin/e_bg.h b/src/bin/e_bg.h
index a1bc42f557..a042c08196 100644
--- a/src/bin/e_bg.h
+++ b/src/bin/e_bg.h
@@ -19,7 +19,7 @@ extern EAPI int E_EVENT_BG_UPDATE;
struct _E_Event_Bg_Update
{
- int container;
+ int manager;
int zone;
int desk_x;
int desk_y;
@@ -28,11 +28,11 @@ struct _E_Event_Bg_Update
EINTERN int e_bg_init(void);
EINTERN int e_bg_shutdown(void);
-EAPI const E_Config_Desktop_Background *e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y);
-EAPI Eina_Stringshare *e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y);
+EAPI const E_Config_Desktop_Background *e_bg_config_get(int manager_num, int zone_num, int desk_x, int desk_y);
+EAPI Eina_Stringshare *e_bg_file_get(int manager_num, int zone_num, int desk_x, int desk_y);
EAPI void e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition);
-EAPI void e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file);
-EAPI void e_bg_del(int container, int zone, int desk_x, int desk_y);
+EAPI void e_bg_add(int manager, int zone, int desk_x, int desk_y, const char *file);
+EAPI void e_bg_del(int manager, int zone, int desk_x, int desk_y);
EAPI void e_bg_default_set(const char *file);
EAPI void e_bg_update(void);
diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c
index 65a6bbce4a..a8e9725391 100644
--- a/src/bin/e_bindings.c
+++ b/src/bin/e_bindings.c
@@ -1,8 +1,6 @@
#include "e.h"
/* local subsystem functions */
-static Eina_Bool _e_bindings_mapping_change_event_cb(void *data, int type, void *event);
-
static void _e_bindings_mouse_free(E_Binding_Mouse *bind);
static void _e_bindings_key_free(E_Binding_Key *bind);
static void _e_bindings_edge_free(E_Binding_Edge *bind);
@@ -15,15 +13,12 @@ static Eina_Bool _e_bindings_edge_cb_timer(void *data);
/* local subsystem globals */
-static Ecore_Event_Handler *mapping_handler = NULL;
-
static Eina_List *mouse_bindings = NULL;
static Eina_List *key_bindings = NULL;
static Eina_List *edge_bindings = NULL;
static Eina_List *signal_bindings = NULL;
static Eina_List *wheel_bindings = NULL;
static Eina_List *acpi_bindings = NULL;
-static int _e_bindings_mapping_change_enabled = 1;
typedef struct _E_Binding_Edge_Data E_Binding_Edge_Data;
@@ -48,9 +43,6 @@ e_bindings_init(void)
E_Config_Binding_Acpi *eba;
Eina_List *l;
- mapping_handler = ecore_event_handler_add
- (ECORE_X_EVENT_MAPPING_CHANGE, _e_bindings_mapping_change_event_cb, NULL);
-
EINA_LIST_FOREACH(e_bindings->mouse_bindings, l, ebm)
e_bindings_mouse_add(ebm->context, ebm->button, ebm->modifiers,
ebm->any_mod, ebm->action, ebm->params);
@@ -105,12 +97,6 @@ e_bindings_shutdown(void)
E_FREE_LIST(wheel_bindings, _e_bindings_wheel_free);
E_FREE_LIST(acpi_bindings, _e_bindings_acpi_free);
- if (mapping_handler)
- {
- ecore_event_handler_del(mapping_handler);
- mapping_handler = NULL;
- }
-
return 1;
}
@@ -136,7 +122,8 @@ e_bindings_ecore_event_mouse_wheel_convert(const Ecore_Event_Mouse_Wheel *ev, E_
memset(event, 0, sizeof(E_Binding_Event_Wheel));
event->direction = ev->direction;
event->z = ev->z;
- event->canvas.x = ev->root.x, event->canvas.y = ev->root.y;
+ event->canvas.x = e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x);
+ event->canvas.y = e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.y);
event->timestamp = ev->timestamp;
event->modifiers = _e_bindings_modifiers(ev->modifiers);
}
@@ -146,7 +133,8 @@ e_bindings_ecore_event_mouse_button_convert(const Ecore_Event_Mouse_Button *ev,
{
memset(event, 0, sizeof(E_Binding_Event_Mouse_Button));
event->button = ev->buttons;
- event->canvas.x = ev->root.x, event->canvas.y = ev->root.y;
+ event->canvas.x = e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x);
+ event->canvas.y = e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.y);
event->timestamp = ev->timestamp;
event->modifiers = _e_bindings_modifiers(ev->modifiers);
@@ -189,6 +177,20 @@ e_bindings_evas_event_mouse_wheel_convert(const Evas_Event_Mouse_Wheel *ev, E_Bi
*/
}
+EAPI int
+e_bindings_evas_modifiers_convert(Evas_Modifier *modifiers)
+{
+ int mod = 0;
+
+ mod |= (E_BINDING_MODIFIER_SHIFT * evas_key_modifier_is_set(modifiers, "Shift"));
+ mod |= (E_BINDING_MODIFIER_CTRL * evas_key_modifier_is_set(modifiers, "Control"));
+ mod |= (E_BINDING_MODIFIER_ALT * evas_key_modifier_is_set(modifiers, "Alt"));
+ mod |= (E_BINDING_MODIFIER_WIN * evas_key_modifier_is_set(modifiers, "Super"));
+ mod |= (E_BINDING_MODIFIER_WIN * evas_key_modifier_is_set(modifiers, "Hyper"));
+ mod |= (E_BINDING_MODIFIER_ALTGR * evas_key_modifier_is_set(modifiers, "AltGr"));
+ return mod;
+}
+
EAPI void
e_bindings_evas_event_mouse_button_convert(const Evas_Event_Mouse_Down *ev, E_Binding_Event_Mouse_Button *event)
{
@@ -197,12 +199,7 @@ e_bindings_evas_event_mouse_button_convert(const Evas_Event_Mouse_Down *ev, E_Bi
event->canvas.x = ev->output.x, event->canvas.y = ev->output.y;
event->timestamp = ev->timestamp;
- event->modifiers |= (E_BINDING_MODIFIER_SHIFT * evas_key_modifier_is_set(ev->modifiers, "Shift"));
- event->modifiers |= (E_BINDING_MODIFIER_CTRL * evas_key_modifier_is_set(ev->modifiers, "Control"));
- event->modifiers |= (E_BINDING_MODIFIER_ALT * evas_key_modifier_is_set(ev->modifiers, "Alt"));
- event->modifiers |= (E_BINDING_MODIFIER_WIN * evas_key_modifier_is_set(ev->modifiers, "Super"));
- event->modifiers |= (E_BINDING_MODIFIER_WIN * evas_key_modifier_is_set(ev->modifiers, "Hyper"));
- event->modifiers |= (E_BINDING_MODIFIER_ALTGR * evas_key_modifier_is_set(ev->modifiers, "AltGr"));
+ event->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
event->hold = (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD);
event->scroll = (ev->event_flags & EVAS_EVENT_FLAG_ON_SCROLL);
@@ -873,7 +870,7 @@ e_bindings_edge_in_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Z
Eina_List *l;
current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current);
- if (current->fullscreen_borders && (!e_config->fullscreen_flip)) return NULL;
+ if (current->fullscreen_clients && (!e_config->fullscreen_flip)) return NULL;
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
@@ -965,7 +962,7 @@ e_bindings_edge_down_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event
Eina_List *l;
current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current);
- if (current->fullscreen_borders && (!e_config->fullscreen_flip)) return NULL;
+ if (current->fullscreen_clients && (!e_config->fullscreen_flip)) return NULL;
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
@@ -1364,29 +1361,6 @@ e_bindings_acpi_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi
return act;
}
-EAPI void
-e_bindings_mapping_change_enable(Eina_Bool enable)
-{
- if (enable)
- _e_bindings_mapping_change_enabled++;
- else
- _e_bindings_mapping_change_enabled--;
- if (_e_bindings_mapping_change_enabled < 0)
- _e_bindings_mapping_change_enabled = 0;
-}
-
-/* local subsystem functions */
-static Eina_Bool
-_e_bindings_mapping_change_event_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
-{
- if (!_e_bindings_mapping_change_enabled) return ECORE_CALLBACK_RENEW;
- e_managers_keys_ungrab();
- e_border_button_bindings_ungrab_all();
- e_border_button_bindings_grab_all();
- e_managers_keys_grab();
- return ECORE_CALLBACK_PASS_ON;
-}
-
static void
_e_bindings_mouse_free(E_Binding_Mouse *binding)
{
@@ -1502,14 +1476,13 @@ _e_bindings_edge_cb_timer(void *data)
ev = ed->ev;
E_FREE(ed);
+ binding->timer = NULL;
if (act->func.go_edge)
act->func.go_edge(obj, binding->params, ev);
else if (act->func.go)
act->func.go(obj, binding->params);
- binding->timer = NULL;
-
/* Duplicate event */
E_FREE(ev);
diff --git a/src/bin/e_bindings.h b/src/bin/e_bindings.h
index 489f825f8a..6014ddd3bd 100644
--- a/src/bin/e_bindings.h
+++ b/src/bin/e_bindings.h
@@ -6,7 +6,7 @@ typedef enum _E_Binding_Context
E_BINDING_CONTEXT_UNKNOWN,
E_BINDING_CONTEXT_WINDOW,
E_BINDING_CONTEXT_ZONE,
- E_BINDING_CONTEXT_CONTAINER,
+ E_BINDING_CONTEXT_COMPOSITOR,
E_BINDING_CONTEXT_MANAGER,
E_BINDING_CONTEXT_MENU,
E_BINDING_CONTEXT_WINLIST,
@@ -193,8 +193,8 @@ EAPI void e_bindings_acpi_add(E_Binding_Context ctxt, int type, int status, cons
EAPI void e_bindings_acpi_del(E_Binding_Context ctxt, int type, int status, const char *action, const char *params);
EAPI E_Action *e_bindings_acpi_find(E_Binding_Context ctxt, E_Event_Acpi *ev, E_Binding_Acpi **bind_ret);
EAPI E_Action *e_bindings_acpi_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi *ev);
-EAPI void e_bindings_mapping_change_enable(Eina_Bool enable);
+EAPI int e_bindings_evas_modifiers_convert(Evas_Modifier *modifiers);
EAPI int e_bindings_modifiers_to_ecore_convert(E_Binding_Modifier modifiers);
EAPI void e_bindings_evas_event_mouse_button_convert(const Evas_Event_Mouse_Down *ev, E_Binding_Event_Mouse_Button *event);
EAPI void e_bindings_evas_event_mouse_wheel_convert(const Evas_Event_Mouse_Wheel *ev, E_Binding_Event_Wheel *event);
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
deleted file mode 100644
index 874b01b457..0000000000
--- a/src/bin/e_border.c
+++ /dev/null
@@ -1,10232 +0,0 @@
-#include "e.h"
-#ifdef HAVE_WAYLAND_CLIENTS
-#include "e_comp_wl.h"
-#endif
-
-//#define INOUTDEBUG_MOUSE 1
-//#define INOUTDEBUG_FOCUS 1
-
-/* local subsystem functions */
-static void _e_border_pri_raise(E_Border *bd);
-static void _e_border_pri_norm(E_Border *bd);
-static void _e_border_free(E_Border *bd);
-static void _e_border_del(E_Border *bd);
-
-#ifdef PRINT_LOTS_OF_DEBUG
-#define E_PRINT_BORDER_INFO(X) \
- _e_border_print(X, __PRETTY_FUNC__)
-
-static void _e_border_print(E_Border *bd,
- const char *func);
-#endif
-
-static void _e_border_shadow(E_Border *bd);
-
-/* FIXME: these likely belong in a separate icccm/client handler */
-/* and the border needs to become a dumb object that just does what its */
-/* told to do */
-static Eina_Bool _e_border_cb_window_show_request(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_destroy(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_hide(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_reparent(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_configure_request(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_resize_request(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_gravity(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_stack_request(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_property(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_colormap(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_shape(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_focus_in(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_focus_out(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_client_message(void *data, int ev_type, void *ev);
-static Eina_Bool _e_border_cb_window_state_request(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_window_move_resize_request(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_desktop_change(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_sync_alarm(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_efreet_cache_update(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_config_icon_theme(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_config_mode(void *data,
- int ev_type,
- void *ev);
-static Eina_Bool _e_border_cb_pointer_warp(void *data,
- int ev_type,
- void *ev);
-static void _e_border_cb_signal_bind(void *data,
- Evas_Object *obj,
- const char *emission,
- const char *source);
-static Eina_Bool _e_border_cb_grab_replay(void *data,
- int type,
- void *event);
-static void _e_border_cb_drag_finished(E_Drag *drag,
- int dropped);
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
-static Eina_Bool _e_border_cb_desk_window_profile_change(void *data,
- int ev_type,
- void *ev);
-#endif
-static void _e_border_eval(E_Border *bd);
-static void _e_border_eval0(E_Border *bd);
-static void _e_border_container_layout_hook(E_Container *con);
-
-static void _e_border_moveinfo_gather(E_Border *bd,
- const char *source);
-static void _e_border_resize_handle(E_Border *bd);
-
-static Eina_Bool _e_border_shade_animator(void *data);
-
-static void _e_border_event_border_add_free(void *data,
- void *ev);
-static void _e_border_event_border_remove_free(void *data,
- void *ev);
-static void _e_border_event_border_zone_set_free(void *data,
- void *ev);
-static void _e_border_event_border_desk_set_free(void *data,
- void *ev);
-static void _e_border_event_border_stack_free(void *data,
- void *ev);
-static void _e_border_event_border_icon_change_free(void *data,
- void *ev);
-static void _e_border_event_border_title_change_free(void *data,
- void *ev);
-static void _e_border_event_border_urgent_change_free(void *data,
- void *ev);
-static void _e_border_event_border_focus_in_free(void *data,
- void *ev);
-static void _e_border_event_border_focus_out_free(void *data,
- void *ev);
-static void _e_border_event_border_resize_free(void *data,
- void *ev);
-static void _e_border_event_border_move_free(void *data,
- void *ev);
-static void _e_border_event_border_show_free(void *data,
- void *ev);
-static void _e_border_event_border_hide_free(void *data,
- void *ev);
-static void _e_border_event_border_iconify_free(void *data,
- void *ev);
-static void _e_border_event_border_uniconify_free(void *data,
- void *ev);
-static void _e_border_event_border_stick_free(void *data,
- void *ev);
-static void _e_border_event_border_unstick_free(void *data,
- void *ev);
-static void _e_border_event_border_property_free(void *data,
- void *ev);
-static void _e_border_event_border_fullscreen_free(void *data,
- void *ev);
-static void _e_border_event_border_unfullscreen_free(void *data,
- void *ev);
-
-static void _e_border_zone_update(E_Border *bd);
-
-static int _e_border_resize_begin(E_Border *bd);
-static int _e_border_resize_end(E_Border *bd);
-static void _e_border_resize_update(E_Border *bd);
-
-static int _e_border_move_begin(E_Border *bd);
-static int _e_border_move_end(E_Border *bd);
-static void _e_border_move_update(E_Border *bd);
-
-static Eina_Bool _e_border_cb_ping_poller(void *data);
-static Eina_Bool _e_border_cb_kill_timer(void *data);
-
-static void _e_border_hook_call(E_Border_Hook_Point hookpoint,
- void *bd);
-
-static void _e_border_client_move_resize_send(E_Border *bd);
-
-static void _e_border_shape_input_rectangle_set(E_Border *bd);
-static void _e_border_show(E_Border *bd);
-static void _e_border_hide(E_Border *bd);
-
-static void _e_border_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
-static void _e_border_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
-static void _e_border_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
-static void _e_border_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
-static void _e_border_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
-static void _e_border_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
-
-static Eina_Bool _e_border_cb_mouse_x_wheel(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Wheel *ev);
-static Eina_Bool _e_border_cb_mouse_x_up(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Button *ev);
-static Eina_Bool _e_border_cb_mouse_x_down(void *d EINA_UNUSED, int t, Ecore_Event_Mouse_Button *ev);
-static Eina_Bool _e_border_cb_mouse_x_move(void *d, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev);
-static Eina_Bool _e_border_cb_mouse_x_in(void *d, int t EINA_UNUSED, Ecore_X_Event_Mouse_In *ev);
-static Eina_Bool _e_border_cb_mouse_x_out(void *d, int t EINA_UNUSED, Ecore_X_Event_Mouse_Out *ev);
-
-static void _e_border_action_finish(void);
-
-static void _e_border_move_lost_window_to_center(E_Border *bd);
-static void _e_border_reset_lost_window(E_Border *bd);
-static Eina_Bool _e_border_pointer_warp_to_center_timer(void *data);
-
-/* local subsystem globals */
-static Eina_List *handlers = NULL;
-static Eina_List *borders = NULL;
-static Eina_Hash *borders_hash = NULL;
-static E_Border *focused = NULL;
-static E_Border *focusing = NULL;
-static Eina_List *focus_next = NULL;
-static Ecore_X_Time focus_time = 0;
-
-static E_Border *bdresize = NULL;
-static E_Border *bdmove = NULL;
-static E_Drag *drag_border = NULL;
-
-static int grabbed = 0;
-
-static Eina_List *focus_stack = NULL;
-static Eina_List *raise_stack = NULL;
-
-static E_Border *warp_timer_border = NULL;
-static Eina_Bool focus_locked = EINA_FALSE;
-
-static Ecore_X_Randr_Screen_Size screen_size = { -1, -1 };
-static int screen_size_index = -1;
-
-static int focus_track_frozen = 0;
-
-static int warp_to = 0;
-static int warp_to_x = 0;
-static int warp_to_y = 0;
-static int warp_x[2] = {0}; //{cur,prev}
-static int warp_y[2] = {0}; //{cur,prev}
-static Ecore_X_Window warp_to_win;
-static Ecore_Timer *warp_timer = NULL;
-
-static Ecore_X_Window action_input_win = 0;
-static E_Border *action_border = NULL;
-static Ecore_Event_Handler *action_handler_key = NULL;
-static Ecore_Event_Handler *action_handler_mouse = NULL;
-static Ecore_Timer *action_timer = NULL;
-static Ecore_X_Rectangle action_orig;
-
-EAPI int E_EVENT_BORDER_ADD = 0;
-EAPI int E_EVENT_BORDER_REMOVE = 0;
-EAPI int E_EVENT_BORDER_ZONE_SET = 0;
-EAPI int E_EVENT_BORDER_DESK_SET = 0;
-EAPI int E_EVENT_BORDER_RESIZE = 0;
-EAPI int E_EVENT_BORDER_MOVE = 0;
-EAPI int E_EVENT_BORDER_SHOW = 0;
-EAPI int E_EVENT_BORDER_HIDE = 0;
-EAPI int E_EVENT_BORDER_ICONIFY = 0;
-EAPI int E_EVENT_BORDER_UNICONIFY = 0;
-EAPI int E_EVENT_BORDER_STICK = 0;
-EAPI int E_EVENT_BORDER_UNSTICK = 0;
-EAPI int E_EVENT_BORDER_STACK = 0;
-EAPI int E_EVENT_BORDER_ICON_CHANGE = 0;
-EAPI int E_EVENT_BORDER_TITLE_CHANGE = 0;
-EAPI int E_EVENT_BORDER_URGENT_CHANGE = 0;
-EAPI int E_EVENT_BORDER_FOCUS_IN = 0;
-EAPI int E_EVENT_BORDER_FOCUS_OUT = 0;
-EAPI int E_EVENT_BORDER_PROPERTY = 0;
-EAPI int E_EVENT_BORDER_FULLSCREEN = 0;
-EAPI int E_EVENT_BORDER_UNFULLSCREEN = 0;
-
-#define GRAV_SET(bd, grav) \
- ecore_x_window_gravity_set(bd->win, grav); \
- if (bd->client.lock_win) ecore_x_window_gravity_set(bd->client.lock_win, grav); \
- ecore_x_window_gravity_set(bd->client.win, grav);
-
-static Eina_List *
-_e_border_sub_borders_new(E_Border *bd)
-{
- Eina_List *list = NULL, *l;
- E_Border *child;
-
- EINA_LIST_FOREACH(bd->transients, l, child)
- {
- if (!eina_list_data_find(list, child))
- list = eina_list_append(list, child);
- }
- return list;
-}
-
-/* externally accessible functions */
-EINTERN int
-e_border_init(void)
-{
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHOW_REQUEST,
- _e_border_cb_window_show_request, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DESTROY,
- _e_border_cb_window_destroy, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_HIDE,
- _e_border_cb_window_hide, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_REPARENT,
- _e_border_cb_window_reparent, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST,
- _e_border_cb_window_configure_request, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_RESIZE_REQUEST,
- _e_border_cb_window_resize_request, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_GRAVITY,
- _e_border_cb_window_gravity, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STACK_REQUEST,
- _e_border_cb_window_stack_request, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_PROPERTY,
- _e_border_cb_window_property, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_COLORMAP,
- _e_border_cb_window_colormap, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHAPE,
- _e_border_cb_window_shape, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_IN,
- _e_border_cb_window_focus_in, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_OUT,
- _e_border_cb_window_focus_out, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_CLIENT_MESSAGE,
- _e_border_cb_client_message, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STATE_REQUEST,
- _e_border_cb_window_state_request, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST,
- _e_border_cb_window_move_resize_request, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DESKTOP_CHANGE,
- _e_border_cb_desktop_change, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SYNC_ALARM,
- _e_border_cb_sync_alarm, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN,
- _e_border_cb_mouse_x_down, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_UP,
- _e_border_cb_mouse_x_up, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MOUSE_IN,
- _e_border_cb_mouse_x_in, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MOUSE_OUT,
- _e_border_cb_mouse_x_out, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_WHEEL,
- _e_border_cb_mouse_x_wheel, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE,
- _e_border_cb_mouse_x_move, NULL);
-
- ecore_x_passive_grab_replay_func_set(_e_border_cb_grab_replay, NULL);
-
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_POINTER_WARP,
- _e_border_cb_pointer_warp, NULL);
- E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_DESKTOP_CACHE_UPDATE,
- _e_border_cb_efreet_cache_update, NULL);
- E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_ICON_CACHE_UPDATE,
- _e_border_cb_efreet_cache_update, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_ICON_THEME,
- _e_border_cb_config_icon_theme, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_MODE_CHANGED,
- _e_border_cb_config_mode, NULL);
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_WINDOW_PROFILE_CHANGE,
- _e_border_cb_desk_window_profile_change, NULL);
-#endif
- if (!borders_hash) borders_hash = eina_hash_string_superfast_new(NULL);
-
- E_EVENT_BORDER_ADD = ecore_event_type_new();
- E_EVENT_BORDER_REMOVE = ecore_event_type_new();
- E_EVENT_BORDER_DESK_SET = ecore_event_type_new();
- E_EVENT_BORDER_ZONE_SET = ecore_event_type_new();
- E_EVENT_BORDER_RESIZE = ecore_event_type_new();
- E_EVENT_BORDER_MOVE = ecore_event_type_new();
- E_EVENT_BORDER_SHOW = ecore_event_type_new();
- E_EVENT_BORDER_HIDE = ecore_event_type_new();
- E_EVENT_BORDER_ICONIFY = ecore_event_type_new();
- E_EVENT_BORDER_UNICONIFY = ecore_event_type_new();
- E_EVENT_BORDER_STICK = ecore_event_type_new();
- E_EVENT_BORDER_UNSTICK = ecore_event_type_new();
- E_EVENT_BORDER_STACK = ecore_event_type_new();
- E_EVENT_BORDER_ICON_CHANGE = ecore_event_type_new();
- E_EVENT_BORDER_TITLE_CHANGE = ecore_event_type_new();
- E_EVENT_BORDER_URGENT_CHANGE = ecore_event_type_new();
- E_EVENT_BORDER_FOCUS_IN = ecore_event_type_new();
- E_EVENT_BORDER_FOCUS_OUT = ecore_event_type_new();
- E_EVENT_BORDER_PROPERTY = ecore_event_type_new();
- E_EVENT_BORDER_FULLSCREEN = ecore_event_type_new();
- E_EVENT_BORDER_UNFULLSCREEN = ecore_event_type_new();
-
-// e_init_undone();
-
- return 1;
-}
-
-EINTERN int
-e_border_shutdown(void)
-{
- E_FREE_LIST(handlers, ecore_event_handler_del);
-
- if (borders_hash) eina_hash_free(borders_hash);
- borders_hash = NULL;
- e_int_border_menu_hooks_clear();
- focus_locked = EINA_FALSE;
- if (warp_timer) ecore_timer_del(warp_timer);
- warp_timer = NULL;
- warp_timer_border = NULL;
-
- return 1;
-}
-
-EAPI void
-e_border_focus_lock_set(Eina_Bool lock)
-{
- focus_locked = !!lock;
-}
-
-EAPI Eina_Bool
-e_border_focus_lock_get(void)
-{
- return focus_locked;
-}
-
-EAPI E_Border *
-e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal)
-{
- E_Border *bd;
- Ecore_X_Window_Attributes *att;
- unsigned int managed, desk[2];
- int deskx, desky;
-
- if (eina_hash_find(borders_hash, e_util_winid_str_get(win))) return NULL;
- bd = E_OBJECT_ALLOC(E_Border, E_BORDER_TYPE, _e_border_free);
- if (!bd) return NULL;
- ecore_x_window_shadow_tree_flush();
- e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del));
-
- bd->focus_policy_override = E_FOCUS_LAST;
- bd->w = 1;
- bd->h = 1;
- /* FIXME: ewww - round trip */
- bd->client.argb = ecore_x_window_argb_get(win);
- /* match bd parent argbness */
- if (bd->client.argb)
- bd->win = ecore_x_window_manager_argb_new(con->win, 0, 0, bd->w, bd->h);
- else
- {
- bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h);
- ecore_x_window_shape_events_select(bd->win, 1);
- }
- e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_focus_setup(bd);
- /* FIXME: Round trip. XCB */
- /* fetch needed to avoid grabbing the server as window may vanish */
- att = &bd->client.initial_attributes;
- if ((!ecore_x_window_attributes_get(win, att)) || (att->input_only))
- {
- // printf("##- ATTR FETCH FAILED/INPUT ONLY FOR 0x%x - ABORT MANAGE\n", win);
- ecore_x_window_free(bd->win);
- e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- ecore_x_window_free(bd->win);
- free(bd);
- return NULL;
- }
- ecore_x_window_container_manage(bd->win);
- if (!internal) ecore_x_window_client_manage(win);
- ecore_x_window_configure(bd->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- win, ECORE_X_WINDOW_STACK_BELOW);
- ecore_x_event_mask_set(bd->win, ECORE_X_EVENT_MASK_MOUSE_IN | ECORE_X_EVENT_MASK_MOUSE_OUT);
-
- /* printf("##- ON MAP CLIENT 0x%x SIZE %ix%i %i:%i\n",
- * bd->client.win, bd->client.w, bd->client.h, att->x, att->y); */
-
- /* FIXME: if first_map is 1 then we should ignore the first hide event
- * or ensure the window is already hidden and events flushed before we
- * create a border for it */
- if (first_map)
- {
- // printf("##- FIRST MAP\n");
- bd->x = att->x;
- bd->y = att->y;
- bd->changes.pos = 1;
- bd->re_manage = 1;
- // needed to be 1 for internal windw and on restart.
- // bd->ignore_first_unmap = 2;
- }
-
- bd->client.win = win;
- bd->zone = e_zone_current_get(con);
-
- _e_border_hook_call(E_BORDER_HOOK_NEW_BORDER, bd);
-
- bd->client.icccm.title = NULL;
- bd->client.icccm.name = NULL;
- bd->client.icccm.class = NULL;
- bd->client.icccm.icon_name = NULL;
- bd->client.icccm.machine = NULL;
- bd->client.icccm.min_w = 1;
- bd->client.icccm.min_h = 1;
- bd->client.icccm.max_w = 32767;
- bd->client.icccm.max_h = 32767;
- bd->client.icccm.base_w = 0;
- bd->client.icccm.base_h = 0;
- bd->client.icccm.step_w = -1;
- bd->client.icccm.step_h = -1;
- bd->client.icccm.min_aspect = 0.0;
- bd->client.icccm.max_aspect = 0.0;
- bd->client.icccm.accepts_focus = 1;
-
- bd->client.netwm.pid = 0;
- bd->client.netwm.name = NULL;
- bd->client.netwm.icon_name = NULL;
- bd->client.netwm.desktop = 0;
- bd->client.netwm.state.modal = 0;
- bd->client.netwm.state.sticky = 0;
- bd->client.netwm.state.shaded = 0;
- bd->client.netwm.state.hidden = 0;
- bd->client.netwm.state.maximized_v = 0;
- bd->client.netwm.state.maximized_h = 0;
- bd->client.netwm.state.skip_taskbar = 0;
- bd->client.netwm.state.skip_pager = 0;
- bd->client.netwm.state.fullscreen = 0;
- bd->client.netwm.state.stacking = E_STACKING_NONE;
- bd->client.netwm.action.move = 0;
- bd->client.netwm.action.resize = 0;
- bd->client.netwm.action.minimize = 0;
- bd->client.netwm.action.shade = 0;
- bd->client.netwm.action.stick = 0;
- bd->client.netwm.action.maximized_h = 0;
- bd->client.netwm.action.maximized_v = 0;
- bd->client.netwm.action.fullscreen = 0;
- bd->client.netwm.action.change_desktop = 0;
- bd->client.netwm.action.close = 0;
- bd->client.netwm.opacity = 255;
- bd->client.netwm.type = ECORE_X_WINDOW_TYPE_UNKNOWN;
-
- {
- int at_num = 0, i;
- Ecore_X_Atom *atoms;
-
- atoms = ecore_x_window_prop_list(bd->client.win, &at_num);
- bd->client.icccm.fetch.command = 1;
- if (atoms)
- {
- Eina_Bool video_parent = EINA_FALSE;
- Eina_Bool video_position = EINA_FALSE;
-
- /* icccm */
- for (i = 0; i < at_num; i++)
- {
- if (atoms[i] == ECORE_X_ATOM_WM_NAME)
- bd->client.icccm.fetch.title = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_CLASS)
- bd->client.icccm.fetch.name_class = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_ICON_NAME)
- bd->client.icccm.fetch.icon_name = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_MACHINE)
- bd->client.icccm.fetch.machine = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_HINTS)
- bd->client.icccm.fetch.hints = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_NORMAL_HINTS)
- bd->client.icccm.fetch.size_pos_hints = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_PROTOCOLS)
- bd->client.icccm.fetch.protocol = 1;
- else if (atoms[i] == ECORE_X_ATOM_MOTIF_WM_HINTS)
- bd->client.mwm.fetch.hints = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_TRANSIENT_FOR)
- {
- bd->client.icccm.fetch.transient_for = 1;
- bd->client.netwm.fetch.type = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_LEADER)
- bd->client.icccm.fetch.client_leader = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_WINDOW_ROLE)
- bd->client.icccm.fetch.window_role = 1;
- else if (atoms[i] == ECORE_X_ATOM_WM_STATE)
- bd->client.icccm.fetch.state = 1;
- }
- /* netwm, loop again, netwm will ignore some icccm, so we
- * have to be sure that netwm is checked after */
- for (i = 0; i < at_num; i++)
- {
- if (atoms[i] == ECORE_X_ATOM_NET_WM_NAME)
- {
- /* Ignore icccm */
- bd->client.icccm.fetch.title = 0;
- bd->client.netwm.fetch.name = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON_NAME)
- {
- /* Ignore icccm */
- bd->client.icccm.fetch.icon_name = 0;
- bd->client.netwm.fetch.icon_name = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON)
- {
- bd->client.netwm.fetch.icon = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_NET_WM_USER_TIME)
- {
- bd->client.netwm.fetch.user_time = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT)
- {
- DBG("ECORE_X_ATOM_NET_WM_STRUT");
- bd->client.netwm.fetch.strut = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL)
- {
- DBG("ECORE_X_ATOM_NET_WM_STRUT_PARTIAL");
- bd->client.netwm.fetch.strut = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_TYPE)
- {
- /* Ignore mwm
- bd->client.mwm.fetch.hints = 0;
- */
- bd->client.netwm.fetch.type = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_NET_WM_STATE)
- {
- bd->client.netwm.fetch.state = 1;
- }
- else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY)
- bd->client.netwm.fetch.opacity = 1;
- }
- /* other misc atoms */
- for (i = 0; i < at_num; i++)
- {
- /* loop to check for own atoms */
- if (atoms[i] == E_ATOM_WINDOW_STATE)
- {
- bd->client.e.fetch.state = 1;
- }
- /* loop to check for qtopia atoms */
- if (atoms[i] == ATM__QTOPIA_SOFT_MENU)
- bd->client.qtopia.fetch.soft_menu = 1;
- else if (atoms[i] == ATM__QTOPIA_SOFT_MENUS)
- bd->client.qtopia.fetch.soft_menus = 1;
- /* loop to check for vkbd atoms */
- else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
- bd->client.vkbd.fetch.state = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD)
- bd->client.vkbd.fetch.vkbd = 1;
- /* loop to check for illume atoms */
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_CONFORMANT)
- bd->client.illume.conformant.fetch.conformant = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE)
- bd->client.illume.quickpanel.fetch.state = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL)
- bd->client.illume.quickpanel.fetch.quickpanel = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR)
- bd->client.illume.quickpanel.fetch.priority.major = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR)
- bd->client.illume.quickpanel.fetch.priority.minor = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE)
- bd->client.illume.quickpanel.fetch.zone = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED)
- bd->client.illume.drag.fetch.locked = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG)
- bd->client.illume.drag.fetch.drag = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
- bd->client.illume.win_state.fetch.state = 1;
- else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_PARENT)
- video_parent = EINA_TRUE;
- else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_POSITION)
- video_position = EINA_TRUE;
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- /* loop to check for window profile list atom */
- else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED)
- bd->client.e.fetch.profile = 1;
-#endif
- }
- if (video_position && video_parent)
- {
- bd->client.e.state.video = 1;
- bd->client.e.fetch.video_parent = 1;
- bd->client.e.fetch.video_position = 1;
- ecore_x_window_lower(bd->win);
- ecore_x_composite_window_events_disable(bd->win);
- ecore_x_window_ignore_set(bd->win, EINA_TRUE);
- fprintf(stderr, "We found a video window \\o/ %x\n", win);
- }
- free(atoms);
- }
- }
- bd->client.border.changed = 1;
-
- bd->client.w = att->w;
- bd->client.h = att->h;
-
- bd->w = bd->client.w;
- bd->h = bd->client.h;
-
- bd->resize_mode = E_POINTER_RESIZE_NONE;
- bd->layer = 100;
- bd->saved.layer = bd->layer;
- bd->changes.icon = 1;
- bd->changes.size = 1;
- bd->changes.shape = 1;
- bd->changes.shape_input = 1;
-
- bd->offer_resistance = 1;
-
- /* just to friggin make java happy - we're DELAYING the reparent until
- * eval time...
- */
-/* ecore_x_window_reparent(win, bd->win, 0, 0); */
- bd->need_reparent = 1;
-
- ecore_x_window_border_width_set(win, 0);
- bd->shape = e_container_shape_add(con);
-
- bd->take_focus = 1;
- bd->new_client = 1;
- BD_CHANGED(bd);
-
-// bd->zone = e_zone_current_get(con);
- bd->desk = e_desk_current_get(bd->zone);
- e_container_border_add(bd);
- borders = eina_list_append(borders, bd);
- eina_hash_add(borders_hash, e_util_winid_str_get(bd->client.win), bd);
- eina_hash_add(borders_hash, e_util_winid_str_get(bd->win), bd);
- managed = 1;
- ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &managed, 1);
- ecore_x_window_prop_card32_set(win, E_ATOM_CONTAINER, &bd->zone->container->num, 1);
- ecore_x_window_prop_card32_set(win, E_ATOM_ZONE, &bd->zone->num, 1);
- {
- unsigned int zgeom[4];
-
- zgeom[0] = bd->zone->x;
- zgeom[1] = bd->zone->y;
- zgeom[2] = bd->zone->w;
- zgeom[3] = bd->zone->h;
- ecore_x_window_prop_card32_set(win, E_ATOM_ZONE_GEOMETRY, zgeom, 4);
- }
- e_desk_xy_get(bd->desk, &deskx, &desky);
- desk[0] = deskx;
- desk[1] = desky;
- ecore_x_window_prop_card32_set(win, E_ATOM_DESK, desk, 2);
-
- if (starting)
- focus_stack = eina_list_prepend(focus_stack, bd);
- else
- focus_stack = eina_list_append(focus_stack, bd);
-
- return bd;
-}
-
-EAPI void
-e_border_res_change_geometry_save(E_Border *bd)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- if (bd->pre_res_change.valid) return;
- bd->pre_res_change.valid = 1;
- bd->pre_res_change.x = bd->x;
- bd->pre_res_change.y = bd->y;
- bd->pre_res_change.w = bd->w;
- bd->pre_res_change.h = bd->h;
- bd->pre_res_change.saved.x = bd->saved.x;
- bd->pre_res_change.saved.y = bd->saved.y;
- bd->pre_res_change.saved.w = bd->saved.w;
- bd->pre_res_change.saved.h = bd->saved.h;
-}
-
-EAPI void
-e_border_res_change_geometry_restore(E_Border *bd)
-{
- struct
- {
- unsigned char valid : 1;
- int x, y, w, h;
- struct
- {
- int x, y, w, h;
- } saved;
- } pre_res_change;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (!bd->pre_res_change.valid) return;
- if (bd->new_client) return;
-
- ecore_x_window_shadow_tree_flush();
- memcpy(&pre_res_change, &bd->pre_res_change, sizeof(pre_res_change));
-
- if (bd->fullscreen)
- {
- e_border_unfullscreen(bd);
- e_border_fullscreen(bd, e_config->fullscreen_policy);
- }
- else if (bd->maximized != E_MAXIMIZE_NONE)
- {
- E_Maximize max;
-
- max = bd->maximized;
- e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
- e_border_maximize(bd, max);
- }
- else
- {
- int x, y, w, h, zx, zy, zw, zh;
-
- bd->saved.x = bd->pre_res_change.saved.x;
- bd->saved.y = bd->pre_res_change.saved.y;
- bd->saved.w = bd->pre_res_change.saved.w;
- bd->saved.h = bd->pre_res_change.saved.h;
-
- e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
-
- if (bd->saved.w > zw)
- bd->saved.w = zw;
- if ((bd->saved.x + bd->saved.w) > (zx + zw))
- bd->saved.x = zx + zw - bd->saved.w;
-
- if (bd->saved.h > zh)
- bd->saved.h = zh;
- if ((bd->saved.y + bd->saved.h) > (zy + zh))
- bd->saved.y = zy + zh - bd->saved.h;
-
- x = bd->pre_res_change.x;
- y = bd->pre_res_change.y;
- w = bd->pre_res_change.w;
- h = bd->pre_res_change.h;
- if (w > zw)
- w = zw;
- if (h > zh)
- h = zh;
- if ((x + w) > (zx + zw))
- x = zx + zw - w;
- if ((y + h) > (zy + zh))
- y = zy + zh - h;
- e_border_move_resize(bd, x, y, w, h);
- }
- memcpy(&bd->pre_res_change, &pre_res_change, sizeof(pre_res_change));
-}
-
-EAPI void
-e_border_zone_set(E_Border *bd,
- E_Zone *zone)
-{
- E_Event_Border_Zone_Set *ev;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- E_OBJECT_CHECK(zone);
- E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
- if (!zone) return;
- if (bd->zone == zone) return;
-
- /* if the window does not lie in the new zone, move it so that it does */
- if (!E_INTERSECTS(bd->x, bd->y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h))
- {
- int x, y;
- /* first guess -- get offset from old zone, and apply to new zone */
- x = zone->x + (bd->x - bd->zone->x);
- y = zone->y + (bd->y - bd->zone->y);
-
- /* keep window from hanging off bottom and left */
- if (x + bd->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + bd->w);
- if (y + bd->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + bd->h);
-
- /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */
- if (x < zone->x) x = zone->x;
- if (y < zone->y) y = zone->y;
-
- if (!E_INTERSECTS(x, y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h))
- {
- /* still not in zone at all, so just move it to closest edge */
- if (x < zone->x) x = zone->x;
- if (x >= zone->x + zone->w) x = zone->x + zone->w - bd->w;
- if (y < zone->y) y = zone->y;
- if (y >= zone->y + zone->h) y = zone->y + zone->h - bd->h;
- }
- e_border_move(bd, x, y);
- }
-
- bd->zone = zone;
-
- if (bd->desk->zone != bd->zone)
- e_border_desk_set(bd, e_desk_current_get(bd->zone));
-
- ev = E_NEW(E_Event_Border_Zone_Set, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_zone_set_event");
- ev->zone = zone;
- e_object_ref(E_OBJECT(zone));
-
- ecore_event_add(E_EVENT_BORDER_ZONE_SET, ev, _e_border_event_border_zone_set_free, NULL);
-
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_ZONE, &bd->zone->num, 1);
- // XXXXXXXXXXXXXXXXXXXXXXXXX
- // XXX ZZZZZZZZZZZZZZZZZZZzz
- // need to adjust this if zone pos/size changes
- {
- unsigned int zgeom[4];
-
- zgeom[0] = bd->zone->x;
- zgeom[1] = bd->zone->y;
- zgeom[2] = bd->zone->w;
- zgeom[3] = bd->zone->h;
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_ZONE_GEOMETRY, zgeom, 4);
- }
- e_remember_update(bd);
- e_border_res_change_geometry_save(bd);
- e_border_res_change_geometry_restore(bd);
- bd->pre_res_change.valid = 0;
-}
-
-EAPI void
-e_border_desk_set(E_Border *bd,
- E_Desk *desk)
-{
- E_Event_Border_Desk_Set *ev;
- E_Desk *old_desk;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- E_OBJECT_CHECK(desk);
- E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
- if (bd->desk == desk) return;
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- if ((e_config->use_desktop_window_profile) &&
- (bd->client.e.state.profile.use))
- {
- if (bd->client.e.state.profile.wait_for_done) return;
- if (e_util_strcmp(bd->client.e.state.profile.name, desk->window_profile))
- {
- ecore_x_e_window_profile_change_request_send(bd->client.win,
- desk->window_profile);
- bd->client.e.state.profile.wait_for_done = 1;
- return;
- }
- }
-#endif
- if (desk == e_desk_current_get(desk->zone))
- {
- e_comp_win_effect_unclip(bd->cw);
- e_comp_win_effect_set(bd->cw, NULL);
- e_border_show(bd);
- }
- else
- e_border_hide(bd, 2);
- ecore_x_window_shadow_tree_flush();
- if (bd->fullscreen)
- {
- bd->desk->fullscreen_borders--;
- desk->fullscreen_borders++;
- }
- old_desk = bd->desk;
- bd->desk = desk;
- e_border_zone_set(bd, desk->zone);
-
- _e_border_hook_call(E_BORDER_HOOK_SET_DESK, bd);
- e_hints_window_desktop_set(bd);
-
- ev = E_NEW(E_Event_Border_Desk_Set, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_desk_set_event");
- ev->desk = old_desk;
- e_object_ref(E_OBJECT(old_desk));
- ecore_event_add(E_EVENT_BORDER_DESK_SET, ev, _e_border_event_border_desk_set_free, NULL);
-
- if (bd->ignore_first_unmap != 1)
- {
- if ((bd->desk->visible) || (bd->sticky))
- e_border_show(bd);
- else
- e_border_hide(bd, 1);
- }
-
- if (e_config->transient.desktop)
- {
- E_Border *child;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_FREE(list, child)
- e_border_desk_set(child, bd->desk);
- }
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_show(E_Border *bd)
-{
- E_Event_Border_Show *ev;
- unsigned int visible;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->visible) return;
- ecore_x_window_shadow_tree_flush();
- e_container_shape_show(bd->shape);
- if (!bd->need_reparent)
- ecore_x_window_show(bd->client.win);
- e_hints_window_visible_set(bd);
- bd->hidden = 0;
- bd->visible = 1;
- bd->changes.visible = 1;
-
- visible = 1;
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1);
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1);
-
- if (bd->new_client) return;
-
- ev = E_NEW(E_Event_Border_Show, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_show_event");
- ecore_event_add(E_EVENT_BORDER_SHOW, ev, _e_border_event_border_show_free, NULL);
-}
-
-EAPI void
-e_border_hide(E_Border *bd,
- int manage)
-{
- unsigned int visible;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (!bd->visible) goto send_event;
- ecore_x_window_shadow_tree_flush();
- if (bd->moving)
- _e_border_move_end(bd);
- if (bd->resize_mode != E_POINTER_RESIZE_NONE)
- _e_border_resize_end(bd);
- if (action_border == bd)
- _e_border_action_finish();
-
- e_container_shape_hide(bd->shape);
- if ((!bd->iconic) && (!bd->delete_requested))
- e_hints_window_hidden_set(bd);
-
- bd->visible = 0;
- bd->changes.visible = 1;
-
- if (!bd->need_reparent)
- {
- if (bd->focused)
- {
- e_border_focus_set(bd, 0, 1);
- if (manage != 2)
- {
- E_Border *pbd;
- E_Zone *zone;
- E_Desk *desk;
-
- zone = e_util_zone_current_get(e_manager_current_get());
- desk = e_desk_current_get(zone);
-
- if ((bd->parent) &&
- (bd->parent->desk == desk) && (bd->parent->modal == bd))
- e_border_focus_set(bd->parent, 1, 1);
- else if (e_config->focus_revert_on_hide_or_close)
- {
- Eina_Bool unlock = bd->lock_focus_out;
- bd->lock_focus_out = 1;
- e_desk_last_focused_focus(desk);
- bd->lock_focus_out = unlock;
- }
- else if (e_config->focus_policy == E_FOCUS_MOUSE)
- {
- pbd = e_border_under_pointer_get(desk, bd);
- if (pbd)
- e_border_focus_set(pbd, 1, 1);
- }
- }
- }
- switch (manage)
- {
- case 2: break;
-
- case 3:
- bd->hidden = 1;
- /* fallthrough */
- case 1:
- default:
- if (!e_comp_evas_exists(bd))
- {
- /* Make sure that this border isn't deleted */
- bd->await_hide_event++;
- ecore_x_window_hide(bd->client.win);
- }
- }
- }
-
- if (!bd->delete_requested)
- {
- visible = 0;
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1);
- if (!manage)
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MANAGED, &visible, 1);
- }
-
- bd->post_show = 0;
-
-send_event:
- if (bd->new_client) return;
- if (!stopping)
- {
- E_Event_Border_Hide *ev;
-
- ev = E_NEW(E_Event_Border_Hide, 1);
- ev->border = bd;
- ev->manage = manage;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_hide_event");
- ecore_event_add(E_EVENT_BORDER_HIDE, ev, _e_border_event_border_hide_free, NULL);
- }
-}
-
-static void
-_pri_adj(int pid, int set, int adj, Eina_Bool use_adj, Eina_Bool adj_children, Eina_Bool do_children)
-{
- int newpri = set;
-
- if (use_adj) newpri = getpriority(PRIO_PROCESS, pid) + adj;
- setpriority(PRIO_PROCESS, pid, newpri);
-// shouldnt need to do this as default ionice class is "none" (0), and
-// this inherits io priority FROM nice level
-// ioprio_set(IOPRIO_WHO_PROCESS, pid,
-// IOPRIO_PRIO_VALUE(2, 5));
- if (do_children)
- {
- Eina_List *files;
- char *file, buf[PATH_MAX];
- FILE *f;
- int pid2, ppid;
-
- // yes - this is /proc specific... so this may not work on some
- // os's - works on linux. too bad for others.
- files = ecore_file_ls("/proc");
- EINA_LIST_FREE(files, file)
- {
- if (isdigit(file[0]))
- {
- snprintf(buf, sizeof(buf), "/proc/%s/stat", file);
- f = fopen(buf, "r");
- if (f)
- {
- pid2 = -1;
- ppid = -1;
- if (fscanf(f, "%i %*s %*s %i %*s", &pid2, &ppid) == 2)
- {
- fclose(f);
- if (ppid == pid)
- {
- if (adj_children)
- _pri_adj(pid2, set, adj, EINA_TRUE,
- adj_children, do_children);
- else
- _pri_adj(pid2, set, adj, use_adj,
- adj_children, do_children);
- }
- }
- else fclose(f);
- }
- }
- free(file);
- }
- }
-}
-
-static void
-_e_border_pri_raise(E_Border *bd)
-{
- if (bd->client.netwm.pid <= 0) return;
- if (bd->client.netwm.pid == getpid()) return;
- _pri_adj(bd->client.netwm.pid,
- e_config->priority - 1, -1, EINA_FALSE,
-// EINA_TRUE, EINA_TRUE);
- EINA_TRUE, EINA_FALSE);
-// printf("WIN: pid %i, title %s (HI!!!!!!!!!!!!!!!!!!)\n",
-// bd->client.netwm.pid, e_border_name_get(bd));
-}
-
-static void
-_e_border_pri_norm(E_Border *bd)
-{
- if (bd->client.netwm.pid <= 0) return;
- if (bd->client.netwm.pid == getpid()) return;
- _pri_adj(bd->client.netwm.pid,
- e_config->priority, 1, EINA_FALSE,
-// EINA_TRUE, EINA_TRUE);
- EINA_TRUE, EINA_FALSE);
-// printf("WIN: pid %i, title %s (NORMAL)\n",
-// bd->client.netwm.pid, e_border_name_get(bd));
-}
-
-static void
-_e_border_client_move_resize_send(E_Border *bd)
-{
- if (bd->internal_ecore_evas)
- ecore_evas_managed_move(bd->internal_ecore_evas,
- bd->client_inset.l,
- bd->client_inset.t);
-
- ecore_x_icccm_move_resize_send(bd->client.win,
- bd->x + bd->client_inset.l,
- bd->y + bd->client_inset.t,
- bd->client.w,
- bd->client.h);
-}
-
-static void
-_e_border_pending_move_resize_add(E_Border *bd,
- int move,
- int resize,
- int x,
- int y,
- int w,
- int h,
- Eina_Bool without_border,
- unsigned int serial)
-{
- E_Border_Pending_Move_Resize *pnd;
-
- pnd = E_NEW(E_Border_Pending_Move_Resize, 1);
- if (!pnd) return;
- pnd->resize = resize;
- pnd->move = move;
- pnd->without_border = without_border;
- pnd->x = x;
- pnd->y = y;
- pnd->w = w;
- pnd->h = h;
- pnd->serial = serial;
- bd->pending_move_resize = eina_list_append(bd->pending_move_resize, pnd);
-}
-
-static void
-_e_border_move_internal(E_Border *bd,
- int x,
- int y,
- Eina_Bool without_border)
-{
- E_Event_Border_Move *ev;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- ecore_x_window_shadow_tree_flush();
- if (bd->new_client)
- {
- _e_border_pending_move_resize_add(bd, 1, 0, x, y, 0, 0, without_border, 0);
- return;
- }
-
- if (bd->maximized)
- {
- if ((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH)
- {
- if (e_config->allow_manip)
- bd->maximized = 0;
-
- if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL)
- {
- x = bd->x;
- }
- else
- if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL)
- {
- y = bd->y;
- }
- }
- else if (e_config->allow_manip)
- bd->maximized = 0;
- else
- return;
- }
-
- if (without_border)
- {
- x -= bd->client_inset.l;
- y -= bd->client_inset.t;
- }
- if (bd->move_intercept_cb)
- {
- int px, py;
- px = bd->x, py = bd->y;
- bd->move_intercept_cb(bd, x, y);
- if ((bd->x == px) && (bd->y == py)) return;
- }
- else if ((x == bd->x) && (y == bd->y))
- return;
- bd->pre_res_change.valid = 0;
- bd->x = x;
- bd->y = y;
- BD_CHANGED(bd);
- bd->changes.pos = 1;
-#if 0
- if (bd->client.netwm.sync.request)
- {
- bd->client.netwm.sync.wait++;
- ecore_x_netwm_sync_request_send(bd->client.win, bd->client.netwm.sync.serial++);
- }
-#endif
- _e_border_client_move_resize_send(bd);
- _e_border_move_update(bd);
- ev = E_NEW(E_Event_Border_Move, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event");
- ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL);
- _e_border_zone_update(bd);
-}
-
-/**
- * Move window to coordinates that already account border decorations.
- *
- * This call will consider given position already accounts border
- * decorations, so it will not be considered later. This will just
- * work properly with borders that have being evaluated and border
- * decorations are known (border->client_inset).
- *
- * @parm x horizontal position to place window.
- * @parm y vertical position to place window.
- *
- * @see e_border_move_without_border()
- */
-EAPI void
-e_border_move(E_Border *bd,
- int x,
- int y)
-{
- if (bd->fullscreen)
- return;
-
- _e_border_move_internal(bd, x, y, 0);
-}
-
-/**
- * Set a callback which will be called just prior to updating the
- * move coordinates for a border
- */
-EAPI void
-e_border_move_intercept_cb_set(E_Border *bd, E_Border_Move_Intercept_Cb cb)
-{
- bd->move_intercept_cb = cb;
-}
-
-/**
- * Move window to coordinates that do not account border decorations yet.
- *
- * This call will consider given position does not account border
- * decoration, so these values (border->client_inset) will be
- * accounted automatically. This is specially useful when it is a new
- * client and has not be evaluated yet, in this case
- * border->client_inset will be zeroed and no information is known. It
- * will mark pending requests so border will be accounted on
- * evalutation phase.
- *
- * @parm x horizontal position to place window.
- * @parm y vertical position to place window.
- *
- * @see e_border_move()
- */
-EAPI void
-e_border_move_without_border(E_Border *bd,
- int x,
- int y)
-{
- if (bd->fullscreen)
- return;
-
- _e_border_move_internal(bd, x, y, 1);
-}
-
-EAPI void
-e_border_center(E_Border *bd)
-{
- int x, y, w, h;
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h);
- e_border_move(bd, x + (w - bd->w) / 2, y + (h - bd->h) / 2);
-}
-
-EAPI void
-e_border_center_pos_get(E_Border *bd,
- int *x,
- int *y)
-{
- int zx, zy, zw, zh;
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
- if (x) *x = zx + (zw - bd->w) / 2;
- if (y) *y = zy + (zh - bd->h) / 2;
-}
-
-static void
-_e_border_move_resize_internal(E_Border *bd,
- int x,
- int y,
- int w,
- int h,
- Eina_Bool without_border,
- Eina_Bool move)
-{
- E_Event_Border_Move *mev;
- E_Event_Border_Resize *rev;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- ecore_x_window_shadow_tree_flush();
-
- if (bd->new_client)
- {
- _e_border_pending_move_resize_add(bd, move, 1, x, y, w, h, without_border, 0);
- return;
- }
-
- if (bd->maximized)
- {
- if ((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH)
- {
- if (e_config->allow_manip)
- bd->maximized = 0;
-
- if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL)
- {
- x = bd->x;
- w = bd->w;
- }
- else
- if ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL)
- {
- y = bd->y;
- h = bd->h;
- }
- }
- else
- if (e_config->allow_manip)
- bd->maximized = 0;
- else
- return;
- }
-
- if (without_border)
- {
- x -= bd->client_inset.l;
- y -= bd->client_inset.t;
- w += e_border_inset_width_get(bd);
- h += e_border_inset_height_get(bd);
- }
-
- if ((!move || ((x == bd->x) && (y == bd->y))) &&
- (w == bd->w) && (h == bd->h))
- return;
-
- bd->pre_res_change.valid = 0;
- if (move)
- {
- bd->changes.pos = 1;
- bd->x = x;
- bd->y = y;
- }
- bd->w = w;
- bd->h = h;
- bd->client.w = bd->w - e_border_inset_width_get(bd);
- bd->client.h = bd->h - e_border_inset_height_get(bd);
-
- if (bd->client.shaped)
- {
- bd->need_shape_merge = 1;
- bd->need_shape_export = 1;
- }
- if (bd->shaped_input)
- {
- bd->need_shape_merge = 1;
- }
-
- if (bd->internal_ecore_evas)
- {
- BD_CHANGED(bd);
- bd->changes.size = 1;
- }
- else
- {
- if (bdresize && bd->client.netwm.sync.request)
- {
- bd->client.netwm.sync.wait++;
- /* Don't use x and y as supplied to this function, as it is called with 0, 0
- * when no move is intended. The border geometry is set above anyways.
- */
- _e_border_pending_move_resize_add(bd, move, 1, bd->x, bd->y, bd->w, bd->h, without_border,
- bd->client.netwm.sync.serial);
- ecore_x_netwm_sync_request_send(bd->client.win,
- bd->client.netwm.sync.serial++);
- }
- else
- {
- BD_CHANGED(bd);
- bd->changes.size = 1;
- }
- }
-
- _e_border_client_move_resize_send(bd);
-
- _e_border_resize_update(bd);
- if (move)
- {
- mev = E_NEW(E_Event_Border_Move, 1);
- mev->border = bd;
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event");
- ecore_event_add(E_EVENT_BORDER_MOVE, mev, _e_border_event_border_move_free, NULL);
- }
-
- rev = E_NEW(E_Event_Border_Resize, 1);
- rev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
- ecore_event_add(E_EVENT_BORDER_RESIZE, rev, _e_border_event_border_resize_free, NULL);
- _e_border_zone_update(bd);
-}
-
-/**
- * Move and resize window to values that already account border decorations.
- *
- * This call will consider given values already accounts border
- * decorations, so it will not be considered later. This will just
- * work properly with borders that have being evaluated and border
- * decorations are known (border->client_inset).
- *
- * @parm x horizontal position to place window.
- * @parm y vertical position to place window.
- * @parm w horizontal window size.
- * @parm h vertical window size.
- *
- * @see e_border_move_resize_without_border()
- */
-EAPI void
-e_border_move_resize(E_Border *bd,
- int x,
- int y,
- int w,
- int h)
-{
- if (bd->fullscreen)
- return;
-
- _e_border_move_resize_internal(bd, x, y, w, h, 0, 1);
-}
-
-/**
- * Move and resize window to values that do not account border decorations yet.
- *
- * This call will consider given values already accounts border
- * decorations, so it will not be considered later. This will just
- * work properly with borders that have being evaluated and border
- * decorations are known (border->client_inset).
- *
- * @parm x horizontal position to place window.
- * @parm y vertical position to place window.
- * @parm w horizontal window size.
- * @parm h vertical window size.
- *
- * @see e_border_move_resize()
- */
-EAPI void
-e_border_move_resize_without_border(E_Border *bd,
- int x,
- int y,
- int w,
- int h)
-{
- if (bd->fullscreen)
- return;
-
- _e_border_move_resize_internal(bd, x, y, w, h, 1, 1);
-}
-
-/**
- * Resize window to values that already account border decorations.
- *
- * This call will consider given size already accounts border
- * decorations, so it will not be considered later. This will just
- * work properly with borders that have being evaluated and border
- * decorations are known (border->client_inset).
- *
- * @parm w horizontal window size.
- * @parm h vertical window size.
- *
- * @see e_border_resize_without_border()
- */
-EAPI void
-e_border_resize(E_Border *bd,
- int w,
- int h)
-{
- if (bd->fullscreen)
- return;
-
- _e_border_move_resize_internal(bd, 0, 0, w, h, 0, 0);
-}
-
-/**
- * Resize window to values that do not account border decorations yet.
- *
- * This call will consider given size does not account border
- * decoration, so these values (border->client_inset) will be
- * accounted automatically. This is specially useful when it is a new
- * client and has not be evaluated yet, in this case
- * border->client_inset will be zeroed and no information is known. It
- * will mark pending requests so border will be accounted on
- * evalutation phase.
- *
- * @parm w horizontal window size.
- * @parm h vertical window size.
- *
- * @see e_border_resize()
- */
-EAPI void
-e_border_resize_without_border(E_Border *bd,
- int w,
- int h)
-{
- if (bd->fullscreen)
- return;
-
- _e_border_move_resize_internal(bd, 0, 0, w, h, 1, 0);
-}
-
-EAPI void
-e_border_layer_set(E_Border *bd,
- E_Layer layer)
-{
- int oldraise;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- ecore_x_window_shadow_tree_flush();
-
- oldraise = e_config->transient.raise;
-
- if (bd->fullscreen)
- {
- bd->saved.layer = layer;
- return;
- }
- bd->layer = layer;
- if (e_config->transient.layer)
- {
- E_Border *child;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- /* We need to set raise to one, else the child wont
- * follow to the new layer. It should be like this,
- * even if the user usually doesn't want to raise
- * the transients.
- */
- e_config->transient.raise = 1;
- EINA_LIST_FREE(list, child)
- e_border_layer_set(child, layer);
- }
- if ((!bd->modal) || (bd->modal->layer > bd->layer))
- e_border_raise(bd);
- else
- e_border_stack_below(bd, bd->modal);
- if (layer == E_LAYER_BELOW)
- e_hints_window_stacking_set(bd, E_STACKING_BELOW);
- else if (layer == E_LAYER_ABOVE)
- e_hints_window_stacking_set(bd, E_STACKING_ABOVE);
- else
- e_hints_window_stacking_set(bd, E_STACKING_NONE);
- e_config->transient.raise = oldraise;
-}
-
-EAPI void
-e_border_raise(E_Border *bd)
-{
- E_Event_Border_Stack *ev;
- E_Border *last = NULL, *child;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- ecore_x_window_shadow_tree_flush();
-
- if (e_config->transient.raise)
- {
- Eina_List *l, *l_prev;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child)
- {
- /* Don't stack iconic transients. If the user wants these shown,
- * thats another option.
- */
- if (!child->iconic)
- {
- if (last)
- e_border_stack_below(child, last);
- else
- {
- E_Border *above;
-
- /* First raise the border to find out which border we will end up above */
- above = e_container_border_raise(child);
-
- if (above)
- {
- /* We ended up above a border, now we must stack this border to
- * generate the stacking event, and to check if this transient
- * has other transients etc.
- */
- e_border_stack_above(child, above);
- }
- else
- {
- /* If we didn't end up above any border, we are on the bottom! */
- e_border_lower(child);
- }
- }
- last = child;
- }
- list = eina_list_remove_list(list, l);
- }
- }
-
- ev = E_NEW(E_Event_Border_Stack, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-
- if (last)
- {
- e_container_border_stack_below(bd, last);
- ev->stack = last;
- e_object_ref(E_OBJECT(last));
- ev->type = E_STACKING_BELOW;
- }
- else
- {
- E_Border *above;
-
- /* If we don't have any children, raise this border */
- above = e_container_border_raise(bd);
- e_border_raise_latest_set(bd);
- if (above)
- {
- /* We ended up above a border */
- ev->stack = above;
- e_object_ref(E_OBJECT(above));
- ev->type = E_STACKING_ABOVE;
- }
- else
- {
- /* No border to raise above, same as a lower! */
- ev->stack = NULL;
- ev->type = E_STACKING_ABOVE;
- }
- }
-
- ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_lower(E_Border *bd)
-{
- E_Event_Border_Stack *ev;
- E_Border *last = NULL, *child;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- ecore_x_window_shadow_tree_flush();
-
- if (e_config->transient.lower)
- {
- Eina_List *l, *l_prev;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child)
- {
- /* Don't stack iconic transients. If the user wants these shown,
- * thats another option.
- */
- if (!child->iconic)
- {
- if (last)
- e_border_stack_below(child, last);
- else
- {
- E_Border *below;
-
- /* First lower the border to find out which border we will end up below */
- below = e_container_border_lower(child);
-
- if (below)
- {
- /* We ended up below a border, now we must stack this border to
- * generate the stacking event, and to check if this transient
- * has other transients etc.
- */
- e_border_stack_below(child, below);
- }
- else
- {
- /* If we didn't end up below any border, we are on top! */
- e_border_raise(child);
- }
- }
- last = child;
- }
- list = eina_list_remove_list(list, l);
- }
- }
-
- ev = E_NEW(E_Event_Border_Stack, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-
- if (last)
- {
- e_container_border_stack_below(bd, last);
- ev->stack = last;
- e_object_ref(E_OBJECT(last));
- ev->type = E_STACKING_BELOW;
- }
- else
- {
- E_Border *below;
-
- /* If we don't have any children, lower this border */
- below = e_container_border_lower(bd);
- if (below)
- {
- /* We ended up below a border */
- ev->stack = below;
- e_object_ref(E_OBJECT(below));
- ev->type = E_STACKING_BELOW;
- }
- else
- {
- /* No border to hide under, same as a raise! */
- ev->stack = NULL;
- ev->type = E_STACKING_BELOW;
- }
- }
-
- ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_stack_above(E_Border *bd,
- E_Border *above)
-{
- /* TODO: Should stack above allow the border to change level */
- E_Event_Border_Stack *ev;
- E_Border *last = NULL, *child;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- ecore_x_window_shadow_tree_flush();
-
- if (e_config->transient.raise)
- {
- Eina_List *l, *l_prev;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child)
- {
- /* Don't stack iconic transients. If the user wants these shown,
- * thats another option.
- */
- if (!child->iconic)
- {
- if (last)
- e_border_stack_below(child, last);
- else
- e_border_stack_above(child, above);
- last = child;
- }
- list = eina_list_remove_list(list, l);
- }
- }
-
- ev = E_NEW(E_Event_Border_Stack, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-
- if (last)
- {
- e_container_border_stack_below(bd, last);
- ev->stack = last;
- e_object_ref(E_OBJECT(last));
- ev->type = E_STACKING_BELOW;
- }
- else
- {
- e_container_border_stack_above(bd, above);
- ev->stack = above;
- e_object_ref(E_OBJECT(above));
- ev->type = E_STACKING_ABOVE;
- }
-
- ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_stack_below(E_Border *bd,
- E_Border *below)
-{
- /* TODO: Should stack below allow the border to change level */
- E_Event_Border_Stack *ev;
- E_Border *last = NULL, *child;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- ecore_x_window_shadow_tree_flush();
-
- if (e_config->transient.lower)
- {
- Eina_List *l, *l_prev;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, child)
- {
- /* Don't stack iconic transients. If the user wants these shown,
- * thats another option.
- */
- if (!child->iconic)
- {
- if (last)
- e_border_stack_below(child, last);
- else
- e_border_stack_below(child, below);
- last = child;
- }
- list = eina_list_remove_list(list, l);
- }
- }
-
- ev = E_NEW(E_Event_Border_Stack, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-
- if (last)
- {
- e_container_border_stack_below(bd, last);
- ev->stack = last;
- e_object_ref(E_OBJECT(last));
- ev->type = E_STACKING_BELOW;
- }
- else
- {
- e_container_border_stack_below(bd, below);
- ev->stack = below;
- e_object_ref(E_OBJECT(below));
- ev->type = E_STACKING_BELOW;
- }
-
- ecore_event_add(E_EVENT_BORDER_STACK, ev, _e_border_event_border_stack_free, NULL);
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_focus_latest_set(E_Border *bd)
-{
- focus_stack = eina_list_remove(focus_stack, bd);
- focus_stack = eina_list_prepend(focus_stack, bd);
-}
-
-EAPI void
-e_border_raise_latest_set(E_Border *bd)
-{
- raise_stack = eina_list_remove(raise_stack, bd);
- raise_stack = eina_list_prepend(raise_stack, bd);
-}
-
-/*
- * Sets the focus to the given border if necessary
- * There are 3 cases of different focus_policy-configurations:
- *
- * - E_FOCUS_CLICK: just set the focus, the most simple one
- *
- * - E_FOCUS_MOUSE: focus is where the mouse is, so try to
- * warp the pointer to the window. If this fails (because
- * the pointer is already in the window), just set the focus.
- *
- * - E_FOCUS_SLOPPY: focus is where the mouse is or on the
- * last window which was focused, if the mouse is on the
- * desktop. So, we need to look if there is another window
- * under the pointer and warp to pointer to the right
- * one if so (also, we set the focus afterwards). In case
- * there is no window under pointer, the pointer is on the
- * desktop and so we just set the focus.
- *
- *
- * This function is to be called when setting the focus was not
- * explicitly triggered by the user (by moving the mouse or
- * clicking for example), but implicitly (by closing a window,
- * the last focused window should get focus).
- *
- */
-EAPI void
-e_border_focus_set_with_pointer(E_Border *bd)
-{
-#ifdef PRINT_LOTS_OF_DEBUG
- E_PRINT_BORDER_INFO(bd);
-#endif
- /* note: this is here as it seems there are enough apps that do not even
- * expect us to emulate a look of focus but not actually set x input
- * focus as we do - so simply abort any focuse set on such windows */
- /* be strict about accepting focus hint */
- if ((!bd->client.icccm.accepts_focus) &&
- (!bd->client.icccm.take_focus)) return;
- if (bd->lock_focus_out) return;
- if (bd == focused) return;
- e_border_focus_set(bd, 1, 1);
-
- if (e_config->focus_policy == E_FOCUS_CLICK) return;
- if (!bd->visible) return;
-
- if (e_config->focus_policy == E_FOCUS_SLOPPY)
- {
- E_Border *pbd;
- int ret = 0;
- pbd = e_border_under_pointer_get(bd->desk, bd);
- /* Do not slide pointer when disabled (probably breaks focus
- * on sloppy/mouse focus but requested by users). */
- if (e_config->pointer_slide && pbd && (pbd != bd))
- ret = e_border_pointer_warp_to_center(bd);
- if (!ret) e_border_focus_set(bd, 1, 0);
- }
- else
- {
- if (e_config->pointer_slide && (!e_border_pointer_warp_to_center(bd)))
- e_border_focus_set(bd, 1, 0);
- }
-}
-
-EAPI void
-e_border_focus_set(E_Border *bd,
- int focus,
- int set)
-{
- E_Border *bd_unfocus = NULL;
- Eina_Bool focus_changed = EINA_FALSE;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- /* note: this is here as it seems there are enough apps that do not even
- * expect us to emulate a look of focus but not actually set x input
- * focus as we do - so simply abort any focuse set on such windows */
- /* be strict about accepting focus hint */
- if ((!bd->client.icccm.accepts_focus) &&
- (!bd->client.icccm.take_focus))
- return;
- if ((set) && (focus) && (bd->lock_focus_out)) return;
-
- /* dont focus an iconified window. that's silly! */
- if (focus)
- {
- if ((bd->iconic) && (!bd->deskshow))
- {
- e_border_uniconify(bd);
- if (!focus_track_frozen)
- e_border_focus_latest_set(bd);
- return;
- }
- else if (!bd->visible)
- {
- return;
- }
- /* FIXME: hack for deskflip animation:
- * dont update focus when sliding previous desk */
- else if ((!bd->sticky) &&
- (bd->desk != e_desk_current_get(bd->desk->zone)))
- {
- return;
- }
- }
-
- if ((bd->modal) && (bd->modal != bd) && (bd->modal->visible))
- {
- e_border_focus_set(bd->modal, focus, set);
- return;
- }
- else if ((bd->leader) && (bd->leader->modal) && (bd->leader->modal != bd))
- {
- e_border_focus_set(bd->leader->modal, focus, set);
- return;
- }
-
- if (focus)
- {
- if (set)
- {
- if (bd->visible && bd->changes.visible)
- {
- bd->want_focus = 1;
- BD_CHANGED(bd);
- }
- else if ((!bd->focused) ||
- (focus_next && (bd != eina_list_data_get(focus_next))))
- {
- Eina_List *l;
-
- if ((l = eina_list_data_find_list(focus_next, bd)))
- focus_next = eina_list_promote_list(focus_next, l);
- else
- focus_next = eina_list_prepend(focus_next, bd);
- }
- if ((bd->client.icccm.take_focus) &&
- (bd->client.icccm.accepts_focus))
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
- /* TODO what if the client didn't take focus ? */
- }
- else if (!bd->client.icccm.accepts_focus)
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
- }
- else if (!bd->client.icccm.take_focus)
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
- /* e_border_focus_set(bd, 1, 0); */
- }
- return;
- }
-
- if (!bd->focused)
- {
- if (focused) bd_unfocus = focused;
- if (focusing == bd) focusing = NULL;
- bd->focused = 1;
- focused = bd;
- if ((!e_config->allow_above_fullscreen) && (!bd_unfocus))
- {
- Eina_List *l;
- E_Border *bd2;
-
- EINA_LIST_FOREACH(e_border_client_list(), l, bd2)
- {
- if ((bd2->fullscreen) &&
- (bd2 != bd) &&
- (bd2->zone == bd->zone) &&
- ((bd2->desk == bd->desk) ||
- (bd2->sticky) || (bd->sticky)))
- {
- Eina_Bool unfocus_is_parent = EINA_FALSE;
- E_Border *bd_parent;
-
- bd_parent = bd->parent;
- while (bd_parent)
- {
- if (bd_parent == bd2)
- {
- unfocus_is_parent = EINA_TRUE;
- break;
- }
- bd_parent = bd->parent;
- }
- if (!unfocus_is_parent)
- e_border_unfullscreen(bd2);
- }
- }
- }
- focus_changed = EINA_TRUE;
- }
- }
- else
- {
- bd->want_focus = 0;
- focus_next = eina_list_remove(focus_next, bd);
- if (bd == focusing) focusing = NULL;
-
- if (bd->focused)
- {
- Eina_Bool wasfocused = EINA_FALSE;
- bd_unfocus = bd;
-
- /* should always be the case. anyway */
- if (bd == focused)
- {
- focused = NULL;
- wasfocused = EINA_TRUE;
- }
-
- if ((set) && (!focus_next) && (!focusing))
- {
- e_grabinput_focus(bd->zone->container->bg_win,
- E_FOCUS_METHOD_PASSIVE);
- }
- if ((!e_config->allow_above_fullscreen) &&
- (bd->fullscreen) && (wasfocused) &&
- ((bd->desk == e_desk_current_get(bd->zone)) || (bd->sticky)))
- {
- Eina_Bool have_vis_child = EINA_FALSE;
- Eina_List *l;
- E_Border *bd2;
-
- EINA_LIST_FOREACH(e_border_client_list(), l, bd2)
- {
- if ((bd2 != bd) &&
- (bd2->zone == bd->zone) &&
- ((bd2->desk == bd->desk) ||
- (bd2->sticky) || (bd->sticky)))
- {
- if (bd2->parent == bd)
- {
- have_vis_child = EINA_TRUE;
- break;
- }
- }
- }
- if (!have_vis_child)
- e_border_unfullscreen(bd);
- }
- }
- }
-
- if ((bd_unfocus) &&
- (!e_object_is_del(E_OBJECT(bd_unfocus)) &&
- (e_object_ref_get(E_OBJECT(bd_unfocus)) > 0)))
- {
- E_Event_Border_Focus_Out *ev;
-
- bd_unfocus->focused = 0;
- e_focus_event_focus_out(bd_unfocus);
-
- if (bd_unfocus->raise_timer)
- ecore_timer_del(bd_unfocus->raise_timer);
- bd_unfocus->raise_timer = NULL;
-
- edje_object_signal_emit(bd_unfocus->bg_object, "e,state,unfocused", "e");
- if (bd_unfocus->icon_object)
- edje_object_signal_emit(bd_unfocus->icon_object, "e,state,unfocused", "e");
-
- ev = E_NEW(E_Event_Border_Focus_Out, 1);
- ev->border = bd_unfocus;
- e_object_ref(E_OBJECT(bd_unfocus));
-
- ecore_event_add(E_EVENT_BORDER_FOCUS_OUT, ev,
- _e_border_event_border_focus_out_free, NULL);
- if ((!e_config->allow_above_fullscreen) &&
- (bd_unfocus->fullscreen) &&
- (bd != bd_unfocus) &&
- (bd->zone == bd_unfocus->zone) &&
- ((bd->desk == bd_unfocus->desk) ||
- (bd->sticky) || (bd_unfocus->sticky)))
- {
- Eina_Bool unfocus_is_parent = EINA_FALSE;
- E_Border *bd_parent;
-
- bd_parent = bd->parent;
- while (bd_parent)
- {
- if (bd_parent == bd_unfocus)
- {
- unfocus_is_parent = EINA_TRUE;
- break;
- }
- bd_parent = bd_parent->parent;
- }
- if (!unfocus_is_parent)
- e_border_unfullscreen(bd_unfocus);
- }
- }
-
- if (focus_changed)
- {
- E_Event_Border_Focus_In *ev;
-
- e_focus_event_focus_in(bd);
-
- if (!focus_track_frozen)
- e_border_focus_latest_set(bd);
-
- e_hints_active_window_set(bd->zone->container->manager, bd);
-
- edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
- if (bd->icon_object)
- edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
-
- ev = E_NEW(E_Event_Border_Focus_In, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-
- ecore_event_add(E_EVENT_BORDER_FOCUS_IN, ev,
- _e_border_event_border_focus_in_free, NULL);
- }
-}
-
-EAPI void
-e_border_shade(E_Border *bd,
- E_Direction dir)
-{
- E_Event_Border_Simple *ev;
- Eina_List *l;
- E_Border *tmp;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if ((bd->shaded) || (bd->shading) || (bd->fullscreen) ||
- ((bd->maximized) && (!e_config->allow_manip))) return;
- if ((bd->client.border.name) &&
- (!strcmp("borderless", bd->client.border.name))) return;
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- ecore_x_window_hide(tmp->win);
-
- ecore_x_window_shadow_tree_flush();
-
- bd->take_focus = 0;
- bd->shade.x = bd->x;
- bd->shade.y = bd->y;
- bd->shade.dir = dir;
-
- e_hints_window_shaded_set(bd, 1);
- e_hints_window_shade_direction_set(bd, dir);
-
- if (e_config->border_shade_animate && (!bd->new_client))
- {
- bd->shade.start = ecore_loop_time_get();
- bd->shading = 1;
- bd->changes.shading = 1;
- BD_CHANGED(bd);
-
- bd->shade.anim = ecore_animator_add(_e_border_shade_animator, bd);
- edje_object_signal_emit(bd->bg_object, "e,state,shading", "e");
- }
- else
- {
- Eina_Bool move = EINA_FALSE;
-
- if (bd->shade.dir == E_DIRECTION_UP)
- {
- bd->h = bd->client_inset.t;
- }
- else if (bd->shade.dir == E_DIRECTION_DOWN)
- {
- bd->h = bd->client_inset.t;
- bd->y = bd->y + bd->client.h;
- move = EINA_TRUE;
- }
- else if (bd->shade.dir == E_DIRECTION_LEFT)
- {
- bd->w = bd->client_inset.t;
- }
- else if (bd->shade.dir == E_DIRECTION_RIGHT)
- {
- bd->w = bd->client_inset.t;
- bd->x = bd->x + bd->client.w;
- move = EINA_TRUE;
- }
-
- if (bd->client.shaped)
- {
- bd->need_shape_merge = 1;
- bd->need_shape_export = 1;
- }
- if (bd->shaped_input)
- {
- bd->need_shape_merge = 1;
- }
-
- bd->shaded = 1;
- bd->changes.shaded = 1;
- BD_CHANGED(bd);
- edje_object_signal_emit(bd->bg_object, "e,state,shaded", "e");
- e_border_frame_recalc(bd);
- if (move)
- {
- ev = E_NEW(E_Event_Border_Simple, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL);
- e_container_shape_move(bd->shape, bd->x, bd->y);
- }
- e_container_shape_resize(bd->shape, bd->w, bd->h);
- e_border_comp_hidden_set(bd, EINA_TRUE);
- ev = E_NEW(E_Event_Border_Simple, 1);
- ev->border = bd;
- /* The resize is added in the animator when animation complete */
- /* For non-animated, we add it immediately with the new size */
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
- ecore_event_add(E_EVENT_BORDER_RESIZE, ev, _e_border_event_border_resize_free, NULL);
- }
-
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_unshade(E_Border *bd,
- E_Direction dir)
-{
- E_Event_Border_Simple *ev;
- Eina_List *l;
- E_Border *tmp;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if ((!bd->shaded) || (bd->shading))
- return;
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- ecore_x_window_show(tmp->win);
-
- ecore_x_window_shadow_tree_flush();
-
- bd->shade.dir = dir;
-
- e_hints_window_shaded_set(bd, 0);
- e_hints_window_shade_direction_set(bd, dir);
-
- if (bd->shade.dir == E_DIRECTION_UP ||
- bd->shade.dir == E_DIRECTION_LEFT)
- {
- bd->shade.x = bd->x;
- bd->shade.y = bd->y;
- }
- else
- {
- bd->shade.x = bd->x - bd->client.w;
- bd->shade.y = bd->y - bd->client.h;
- }
- if (e_config->border_shade_animate)
- {
- bd->shade.start = ecore_loop_time_get();
- bd->shading = 1;
- bd->changes.shading = 1;
- BD_CHANGED(bd);
-
- bd->shade.anim = ecore_animator_add(_e_border_shade_animator, bd);
- edje_object_signal_emit(bd->bg_object, "e,state,unshading", "e");
- }
- else
- {
- Eina_Bool move = EINA_FALSE;
-
- if (bd->shade.dir == E_DIRECTION_UP)
- {
- bd->h = bd->client_inset.t + bd->client.h + bd->client_inset.b;
- }
- else if (bd->shade.dir == E_DIRECTION_DOWN)
- {
- bd->h = bd->client_inset.t + bd->client.h + bd->client_inset.b;
- bd->y = bd->y - bd->client.h;
- move = EINA_TRUE;
- }
- else if (bd->shade.dir == E_DIRECTION_LEFT)
- {
- bd->w = bd->client_inset.l + bd->client.w + bd->client_inset.r;
- }
- else if (bd->shade.dir == E_DIRECTION_RIGHT)
- {
- bd->w = bd->client_inset.l + bd->client.w + bd->client_inset.r;
- bd->x = bd->x - bd->client.w;
- move = EINA_TRUE;
- }
- if (bd->client.shaped)
- {
- bd->need_shape_merge = 1;
- bd->need_shape_export = 1;
- }
- if (bd->shaped_input)
- {
- bd->need_shape_merge = 1;
- }
-
- bd->shaded = 0;
- bd->changes.shaded = 1;
- BD_CHANGED(bd);
- edje_object_signal_emit(bd->bg_object, "e,state,unshaded", "e");
- e_border_frame_recalc(bd);
- if (move)
- {
- ev = E_NEW(E_Event_Border_Simple, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL);
- e_container_shape_move(bd->shape, bd->x, bd->y);
- }
- e_container_shape_resize(bd->shape, bd->w, bd->h);
- e_border_comp_hidden_set(bd, EINA_FALSE);
- ev = E_NEW(E_Event_Border_Simple, 1);
- ev->border = bd;
- /* The resize is added in the animator when animation complete */
- /* For non-animated, we add it immediately with the new size */
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
- ecore_event_add(E_EVENT_BORDER_RESIZE, ev, _e_border_event_border_resize_free, NULL);
- }
-
- e_remember_update(bd);
-}
-
-static void
-_e_border_client_inset_calc(E_Border *bd)
-{
- int w, h, cx, cy, cw, ch;
-
- if (bd->bg_object)
- {
- Evas_Object *layout;
-
- layout = e_comp_get(bd)->layout;
- if (layout) e_layout_freeze(layout);
- evas_object_geometry_get(bd->bg_object, NULL, NULL, &w, &h);
- evas_object_resize(bd->bg_object, MAX(w, 50), MAX(h, 50));
- edje_object_message_signal_process(bd->bg_object);
- edje_object_calc_force(bd->bg_object);
- edje_object_part_geometry_get(bd->bg_object, "e.swallow.client", &cx, &cy, &cw, &ch);
- bd->client_inset.l = cx;
- bd->client_inset.r = MAX(w, 50) - (cx + cw);
- bd->client_inset.t = cy;
- bd->client_inset.b = MAX(h, 50) - (cy + ch);
- evas_object_resize(bd->bg_object, w, h);
- if (layout) e_layout_thaw(layout);
- }
- else
- {
- bd->client_inset.l = 0;
- bd->client_inset.r = 0;
- bd->client_inset.t = 0;
- bd->client_inset.b = 0;
- }
-
- ecore_x_netwm_frame_size_set(bd->client.win,
- bd->client_inset.l, bd->client_inset.r,
- bd->client_inset.t, bd->client_inset.b);
- ecore_x_e_frame_size_set(bd->client.win,
- bd->client_inset.l, bd->client_inset.r,
- bd->client_inset.t, bd->client_inset.b);
- bd->client_inset.calc = 1;
-}
-
-static void
-_e_border_maximize(E_Border *bd, E_Maximize max)
-{
- int x1, yy1, x2, y2;
- int w, h, pw, ph;
- int zx, zy, zw, zh;
-
- zx = zy = zw = zh = 0;
-
- switch (max & E_MAXIMIZE_TYPE)
- {
- case E_MAXIMIZE_NONE:
- /* Ignore */
- break;
-
- case E_MAXIMIZE_FULLSCREEN:
- w = bd->zone->w;
- h = bd->zone->h;
-
- if (bd->bg_object)
- {
- edje_object_signal_emit(bd->bg_object, "e,action,maximize,fullscreen", "e");
- _e_border_client_inset_calc(bd);
- }
- e_border_resize_limit(bd, &w, &h);
- /* center x-direction */
- x1 = bd->zone->x + (bd->zone->w - w) / 2;
- /* center y-direction */
- yy1 = bd->zone->y + (bd->zone->h - h) / 2;
-
- switch (max & E_MAXIMIZE_DIRECTION)
- {
- case E_MAXIMIZE_BOTH:
- e_border_move_resize(bd, x1, yy1, w, h);
- break;
-
- case E_MAXIMIZE_VERTICAL:
- e_border_move_resize(bd, bd->x, yy1, bd->w, h);
- break;
-
- case E_MAXIMIZE_HORIZONTAL:
- e_border_move_resize(bd, x1, bd->y, w, bd->h);
- break;
-
- case E_MAXIMIZE_LEFT:
- e_border_move_resize(bd, bd->zone->x, bd->zone->y, w / 2, h);
- break;
-
- case E_MAXIMIZE_RIGHT:
- e_border_move_resize(bd, x1, bd->zone->y, w / 2, h);
- break;
- }
- break;
-
- case E_MAXIMIZE_SMART:
- case E_MAXIMIZE_EXPAND:
- e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
- w = zw, h = zh;
-
- if (bd->bg_object)
- {
- edje_object_signal_emit(bd->bg_object, "e,action,maximize", "e");
- _e_border_client_inset_calc(bd);
- }
- e_border_resize_limit(bd, &w, &h);
-
- if (bd->w < zw)
- w = bd->w;
- else
- w = zw;
-
- if (bd->h < zh)
- h = bd->h;
- else
- h = zh;
-
- if (bd->x < zx) // window left not useful coordinates
- x1 = zx;
- else if (bd->x + bd->w > zx + zw) // window right not useful coordinates
- x1 = zx + zw - bd->w;
- else // window normal position
- x1 = bd->x;
-
- if (bd->y < zy) // window top not useful coordinates
- yy1 = zy;
- else if (bd->y + bd->h > zy + zh) // window bottom not useful coordinates
- yy1 = zy + zh - bd->h;
- else // window normal position
- yy1 = bd->y;
-
- switch (max & E_MAXIMIZE_DIRECTION)
- {
- case E_MAXIMIZE_BOTH:
- e_border_move_resize(bd, zx, zy, zw, zh);
- break;
-
- case E_MAXIMIZE_VERTICAL:
- e_border_move_resize(bd, x1, zy, w, zh);
- break;
-
- case E_MAXIMIZE_HORIZONTAL:
- e_border_move_resize(bd, zx, yy1, zw, h);
- break;
-
- case E_MAXIMIZE_LEFT:
- e_border_move_resize(bd, zx, zy, zw / 2, zh);
- break;
-
- case E_MAXIMIZE_RIGHT:
- e_border_move_resize(bd, zx + zw / 2, zy, zw / 2, zh);
- break;
- }
-
- break;
-
- case E_MAXIMIZE_FILL:
- x1 = bd->zone->x;
- yy1 = bd->zone->y;
- x2 = bd->zone->x + bd->zone->w;
- y2 = bd->zone->y + bd->zone->h;
-
- /* walk through all shelves */
- e_maximize_border_shelf_fill(bd, &x1, &yy1, &x2, &y2, max);
-
- /* walk through all windows */
- e_maximize_border_border_fill(bd, &x1, &yy1, &x2, &y2, max);
-
- w = x2 - x1;
- h = y2 - yy1;
- pw = w;
- ph = h;
- e_border_resize_limit(bd, &w, &h);
- /* center x-direction */
- x1 = x1 + (pw - w) / 2;
- /* center y-direction */
- yy1 = yy1 + (ph - h) / 2;
-
- switch (max & E_MAXIMIZE_DIRECTION)
- {
- case E_MAXIMIZE_BOTH:
- e_border_move_resize(bd, x1, yy1, w, h);
- break;
-
- case E_MAXIMIZE_VERTICAL:
- e_border_move_resize(bd, bd->x, yy1, bd->w, h);
- break;
-
- case E_MAXIMIZE_HORIZONTAL:
- e_border_move_resize(bd, x1, bd->y, w, bd->h);
- break;
-
- case E_MAXIMIZE_LEFT:
- e_border_move_resize(bd, bd->zone->x, bd->zone->y, w / 2, h);
- break;
-
- case E_MAXIMIZE_RIGHT:
- e_border_move_resize(bd, x1, bd->zone->y, w / 2, h);
- break;
- }
- break;
- }
-}
-
-EAPI void
-e_border_maximize(E_Border *bd,
- E_Maximize max)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
-
- if ((bd->shaded) || (bd->shading)) return;
- ecore_x_window_shadow_tree_flush();
- if (bd->fullscreen)
- e_border_unfullscreen(bd);
- /* Only allow changes in vertical/ horizontal maximization */
- if (((bd->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION)) ||
- ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH)) return;
- if (bd->new_client)
- {
- bd->need_maximize = 1;
- bd->maximized &= ~E_MAXIMIZE_TYPE;
- bd->maximized |= max;
- return;
- }
-
- bd->pre_res_change.valid = 0;
- if (!(bd->maximized & E_MAXIMIZE_HORIZONTAL))
- {
- /* Horizontal hasn't been set */
- bd->saved.x = bd->x - bd->zone->x;
- bd->saved.w = bd->w;
- }
- if (!(bd->maximized & E_MAXIMIZE_VERTICAL))
- {
- /* Vertical hasn't been set */
- bd->saved.y = bd->y - bd->zone->y;
- bd->saved.h = bd->h;
- }
-
- bd->saved.zone = bd->zone->num;
- e_hints_window_size_set(bd);
-
- e_border_raise(bd);
-
- _e_border_maximize(bd, max);
-
- /* Remove previous type */
- bd->maximized &= ~E_MAXIMIZE_TYPE;
- /* Add new maximization. It must be added, so that VERTICAL + HORIZONTAL == BOTH */
- bd->maximized |= max;
-
- if ((bd->maximized & E_MAXIMIZE_DIRECTION) > E_MAXIMIZE_BOTH)
- /* left/right maximize */
- e_hints_window_maximized_set(bd, 0,
- ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_LEFT) ||
- ((bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_RIGHT));
- else
- e_hints_window_maximized_set(bd, bd->maximized & E_MAXIMIZE_HORIZONTAL,
- bd->maximized & E_MAXIMIZE_VERTICAL);
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_unmaximize(E_Border *bd,
- E_Maximize max)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (!(max & E_MAXIMIZE_DIRECTION))
- {
- CRI("BUG: Unmaximize call without direction!");
- return;
- }
-
- if ((bd->shaded) || (bd->shading)) return;
- ecore_x_window_shadow_tree_flush();
- /* Remove directions not used */
- max &= (bd->maximized & E_MAXIMIZE_DIRECTION);
- /* Can only remove existing maximization directions */
- if (!max) return;
- if (bd->maximized & E_MAXIMIZE_TYPE)
- {
- bd->pre_res_change.valid = 0;
- bd->need_maximize = 0;
-
- if ((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN)
- {
- if (bd->bg_object)
- {
- edje_object_signal_emit(bd->bg_object, "e,action,unmaximize,fullscreen", "e");
- _e_border_client_inset_calc(bd);
- }
-
- bd->maximized = E_MAXIMIZE_NONE;
- _e_border_move_resize_internal(bd,
- bd->zone->x + bd->saved.x,
- bd->zone->y + bd->saved.y,
- bd->saved.w, bd->saved.h, 0, 1);
- bd->saved.x = bd->saved.y = bd->saved.w = bd->saved.h = 0;
- e_hints_window_size_unset(bd);
- }
- else
- {
- int w, h, x, y;
-
- w = bd->w;
- h = bd->h;
- x = bd->x;
- y = bd->y;
-
- if (((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_SMART) ||
- ((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_EXPAND))
- {
- if (bd->bg_object)
- {
- edje_object_signal_emit(bd->bg_object, "e,action,unmaximize,fullscreen", "e");
- _e_border_client_inset_calc(bd);
- }
- }
- if (max & E_MAXIMIZE_VERTICAL)
- {
- /* Remove vertical */
- h = bd->saved.h;
- y = bd->saved.y + bd->zone->y;
- bd->saved.h = bd->saved.y = 0;
- bd->maximized &= ~E_MAXIMIZE_VERTICAL;
- bd->maximized &= ~E_MAXIMIZE_LEFT;
- bd->maximized &= ~E_MAXIMIZE_RIGHT;
- }
- if (max & E_MAXIMIZE_HORIZONTAL)
- {
- /* Remove horizontal */
- w = bd->saved.w;
- x = bd->saved.x + bd->zone->x;
- bd->saved.w = bd->saved.x = 0;
- bd->maximized &= ~E_MAXIMIZE_HORIZONTAL;
- }
-
- e_border_resize_limit(bd, &w, &h);
-
- if (!(bd->maximized & E_MAXIMIZE_DIRECTION))
- {
- bd->maximized = E_MAXIMIZE_NONE;
- _e_border_move_resize_internal(bd, x, y, w, h, 0, 1);
- e_hints_window_size_unset(bd);
- edje_object_signal_emit(bd->bg_object, "e,action,unmaximize", "e");
- }
- else
- {
- _e_border_move_resize_internal(bd, x, y, w, h, 0, 1);
- e_hints_window_size_set(bd);
- }
- }
- e_hints_window_maximized_set(bd, bd->maximized & E_MAXIMIZE_HORIZONTAL,
- bd->maximized & E_MAXIMIZE_VERTICAL);
- }
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_fullscreen(E_Border *bd,
- E_Fullscreen policy)
-{
- E_Event_Border_Fullscreen *ev;
- int x, y, w, h;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- if ((bd->shaded) || (bd->shading)) return;
- ecore_x_window_shadow_tree_flush();
- if (bd->new_client)
- {
- bd->need_fullscreen = 1;
- return;
- }
- if (!bd->fullscreen)
- {
- bd->pre_res_change.valid = 0;
-
- if (bd->maximized)
- {
- x = bd->saved.x;
- y = bd->saved.y;
- w = bd->saved.w;
- h = bd->saved.h;
- }
- else
- {
- bd->saved.x = bd->x - bd->zone->x;
- bd->saved.y = bd->y - bd->zone->y;
- bd->saved.w = bd->client.w;
- bd->saved.h = bd->client.h;
- }
- bd->saved.maximized = bd->maximized;
- bd->saved.zone = bd->zone->num;
-
- if (bd->maximized)
- {
- e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
- bd->saved.x = x;
- bd->saved.y = y;
- bd->saved.w = w;
- bd->saved.h = h;
- }
- e_hints_window_size_set(bd);
-
- bd->client_inset.l = 0;
- bd->client_inset.r = 0;
- bd->client_inset.t = 0;
- bd->client_inset.b = 0;
-
- bd->desk->fullscreen_borders++;
-
- /* e_zone_fullscreen_set(bd->zone, 1); */
- bd->saved.layer = bd->layer;
- if (!e_config->allow_above_fullscreen)
- e_border_layer_set(bd, E_LAYER_FULLSCREEN);
- else if (e_config->mode.presentation)
- e_border_layer_set(bd, E_LAYER_TOP);
-
- if ((eina_list_count(bd->zone->container->zones) > 1) ||
- (policy == E_FULLSCREEN_RESIZE) || (!ecore_x_randr_query()))
- {
- e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
- }
- else if (policy == E_FULLSCREEN_ZOOM)
- {
- Ecore_X_Randr_Screen_Size_MM *sizes;
- int num_sizes, i, best_size_index = 0;
-
- ecore_x_randr_screen_primary_output_current_size_get(bd->zone->container->manager->root,
- &screen_size.width,
- &screen_size.height,
- NULL, NULL, NULL);
- sizes = ecore_x_randr_screen_primary_output_sizes_get(bd->zone->container->manager->root,
- &num_sizes);
- if (sizes)
- {
- Ecore_X_Randr_Screen_Size best_size = { -1, -1 };
- int best_dist = INT_MAX, dist;
-
- for (i = 0; i < num_sizes; i++)
- {
- if ((sizes[i].width > bd->w) && (sizes[i].height > bd->h))
- {
- dist = (sizes[i].width * sizes[i].height) - (bd->w * bd->h);
- if (dist < best_dist)
- {
- best_size.width = sizes[i].width;
- best_size.height = sizes[i].height;
- best_dist = dist;
- best_size_index = i;
- }
- }
- }
- if (((best_size.width != -1) && (best_size.height != -1)) &&
- ((best_size.width != screen_size.width) ||
- (best_size.height != screen_size.height)))
- {
- if (ecore_x_randr_screen_primary_output_size_set(bd->zone->container->manager->root,
- best_size_index))
- screen_size_index = best_size_index;
- e_border_move_resize(bd, 0, 0, best_size.width, best_size.height);
- }
- else
- {
- screen_size.width = -1;
- screen_size.height = -1;
- e_border_move_resize(bd, 0, 0, bd->zone->w, bd->zone->h);
- }
- free(sizes);
- }
- else
- e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
- }
- bd->fullscreen = 1;
-
- e_hints_window_fullscreen_set(bd, 1);
- e_hints_window_size_unset(bd);
- bd->client.border.changed = 1;
- BD_CHANGED(bd);
- }
- bd->fullscreen_policy = policy;
- _e_border_shadow(bd);
-
- ev = E_NEW(E_Event_Border_Fullscreen, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_fullscreen_event");
- ecore_event_add(E_EVENT_BORDER_FULLSCREEN, ev, _e_border_event_border_fullscreen_free, NULL);
-
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_unfullscreen(E_Border *bd)
-{
- E_Event_Border_Unfullscreen *ev;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if ((bd->shaded) || (bd->shading)) return;
- ecore_x_window_shadow_tree_flush();
- if (bd->fullscreen)
- {
- bd->pre_res_change.valid = 0;
- bd->fullscreen = 0;
- bd->need_fullscreen = 0;
- bd->desk->fullscreen_borders--;
-
- if ((screen_size.width != -1) && (screen_size.height != -1))
- {
- ecore_x_randr_screen_primary_output_size_set(bd->zone->container->manager->root,
- screen_size_index);
- screen_size.width = -1;
- screen_size.height = -1;
- }
- _e_border_move_resize_internal(bd,
- bd->zone->x + bd->saved.x,
- bd->zone->y + bd->saved.y,
- bd->saved.w, bd->saved.h, 0, 1);
-
- if (bd->saved.maximized)
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
- bd->saved.maximized);
-
- e_border_layer_set(bd, bd->saved.layer);
-
- e_hints_window_fullscreen_set(bd, 0);
- bd->client.border.changed = 1;
- BD_CHANGED(bd);
- }
- bd->fullscreen_policy = 0;
- _e_border_shadow(bd);
-
- ev = E_NEW(E_Event_Border_Unfullscreen, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_unfullscreen_event");
- ecore_event_add(E_EVENT_BORDER_UNFULLSCREEN, ev, _e_border_event_border_unfullscreen_free, NULL);
-
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_iconify(E_Border *bd)
-{
- E_Event_Border_Iconify *ev;
- unsigned int iconic;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->shading) return;
- ecore_x_window_shadow_tree_flush();
- if (!bd->iconic)
- {
- bd->iconic = 1;
- bd->take_focus = 0;
- e_border_hide(bd, 1);
- if (bd->fullscreen) bd->desk->fullscreen_borders--;
- edje_object_signal_emit(bd->bg_object, "e,action,iconify", "e");
- }
- iconic = 1;
- e_hints_window_iconic_set(bd);
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
-
- ev = E_NEW(E_Event_Border_Iconify, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_iconify_event");
- ecore_event_add(E_EVENT_BORDER_ICONIFY, ev, _e_border_event_border_iconify_free, NULL);
-
- if (e_config->transient.iconify)
- {
- E_Border *child;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_FREE(list, child)
- e_border_iconify(child);
- }
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_uniconify(E_Border *bd)
-{
- E_Desk *desk;
- E_Event_Border_Uniconify *ev;
- unsigned int iconic;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->shading) return;
- ecore_x_window_shadow_tree_flush();
- e_border_show(bd);
- if (bd->iconic)
- {
- bd->iconic = 0;
- if (bd->fullscreen) bd->desk->fullscreen_borders++;
- desk = e_desk_current_get(bd->desk->zone);
- e_border_desk_set(bd, desk);
- e_border_raise(bd);
- edje_object_signal_emit(bd->bg_object, "e,action,uniconify", "e");
- }
- iconic = 0;
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
-
- ev = E_NEW(E_Event_Border_Uniconify, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_uniconify_event");
- ecore_event_add(E_EVENT_BORDER_UNICONIFY, ev, _e_border_event_border_uniconify_free, NULL);
-
- if (e_config->transient.iconify)
- {
- E_Border *child;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_FREE(list, child)
- e_border_uniconify(child);
- }
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_stick(E_Border *bd)
-{
- E_Event_Border_Stick *ev;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->sticky) return;
- bd->sticky = 1;
- e_hints_window_sticky_set(bd, 1);
- e_border_show(bd);
-
- if (e_config->transient.desktop)
- {
- E_Border *child;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_FREE(list, child)
- {
- child->sticky = 1;
- e_hints_window_sticky_set(child, 1);
- e_border_show(child);
- }
- }
-
- edje_object_signal_emit(bd->bg_object, "e,state,sticky", "e");
- ev = E_NEW(E_Event_Border_Stick, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_stick_event");
- ecore_event_add(E_EVENT_BORDER_STICK, ev, _e_border_event_border_stick_free, NULL);
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_unstick(E_Border *bd)
-{
- E_Event_Border_Unstick *ev;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- /* Set the desk before we unstick the border */
- if (!bd->sticky) return;
- bd->sticky = 0;
- e_hints_window_sticky_set(bd, 0);
-
- if (e_config->transient.desktop)
- {
- E_Border *child;
- Eina_List *list = _e_border_sub_borders_new(bd);
-
- EINA_LIST_FREE(list, child)
- {
- child->sticky = 0;
- e_hints_window_sticky_set(child, 0);
- }
- }
-
- edje_object_signal_emit(bd->bg_object, "e,state,unsticky", "e");
- ev = E_NEW(E_Event_Border_Unstick, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_unstick_event");
- ecore_event_add(E_EVENT_BORDER_UNSTICK, ev, _e_border_event_border_unstick_free, NULL);
-
- e_border_desk_set(bd, e_desk_current_get(bd->zone));
- e_remember_update(bd);
-}
-
-EAPI void
-e_border_pinned_set(E_Border *bd,
- int set)
-{
- E_Layer layer;
-
- if (bd)
- {
- bd->borderless = set;
- bd->user_skip_winlist = set;
- if (set)
- layer = E_LAYER_BELOW;
- else
- layer = E_LAYER_NORMAL;
-
- e_border_layer_set(bd, layer);
-
- bd->client.border.changed = 1;
- BD_CHANGED(bd);
- }
-}
-
-EAPI E_Border *
-e_border_find_by_client_window(Ecore_X_Window win)
-{
- E_Border *bd;
-
- bd = eina_hash_find(borders_hash, e_util_winid_str_get(win));
- if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
- (bd->client.win == win))
- return bd;
-#ifdef HAVE_WAYLAND_CLIENTS
- bd = e_comp_wl_border_surface_find(win);
- if (bd && (!e_object_is_del(E_OBJECT(bd)))) return bd;
-#endif
- return NULL;
-}
-
-EAPI E_Border *
-e_border_find_all_by_client_window(Ecore_X_Window win)
-{
- E_Border *bd;
-
- bd = eina_hash_find(borders_hash, e_util_winid_str_get(win));
- if ((bd) && (bd->client.win == win))
- return bd;
-#ifdef HAVE_WAYLAND_CLIENTS
- return e_comp_wl_border_surface_find(win);
-#endif
- return NULL;
-}
-
-EAPI E_Border *
-e_border_find_by_window(Ecore_X_Window win)
-{
- E_Border *bd;
-
- bd = eina_hash_find(borders_hash, e_util_winid_str_get(win));
- if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
- ((bd->win == win) || (bd->client.lock_win == win)))
- return bd;
- return NULL;
-}
-
-EAPI E_Border *
-e_border_find_by_alarm(Ecore_X_Sync_Alarm al)
-{
- Eina_List *l;
- E_Border *bd;
-
- EINA_LIST_FOREACH(borders, l, bd)
- {
- if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
- (bd->client.netwm.sync.alarm == al))
- return bd;
- }
- return NULL;
-}
-
-EAPI E_Border *
-e_border_focused_get(void)
-{
- return focused;
-}
-
-static void
-_e_border_shape_input_rectangle_set(E_Border *bd)
-{
- if (!bd) return;
-
- if ((!bd->visible) || (!bd->shaped_input))
- {
- if (bd->visible) // not shaped input
- {
- if (!((bd->comp_hidden) || (bd->tmp_input_hidden > 0)))
- ecore_x_composite_window_events_enable(bd->win);
- else
- ecore_x_composite_window_events_disable(bd->win);
- }
- else
- {
- if (!e_comp_evas_exists(bd))
- ecore_x_composite_window_events_enable(bd->win);
- else
- ecore_x_composite_window_events_disable(bd->win);
- }
- }
-}
-
-EAPI void
-e_border_idler_before(void)
-{
- Eina_List *ml, *cl;
- E_Manager *man;
- E_Container *con;
-
- if (!borders)
- return;
-
- EINA_LIST_FOREACH(e_manager_list(), ml, man)
- {
- EINA_LIST_FOREACH(man->containers, cl, con)
- {
- E_Border_List *bl;
- E_Border *bd;
-
- // pass 1 - eval0. fetch properties on new or on change and
- // call hooks to decide what to do - maybe move/resize
- bl = e_container_border_list_first(con);
- while ((bd = e_container_border_list_next(bl)))
- {
- if (bd->changed) _e_border_eval0(bd);
- }
- e_container_border_list_free(bl);
-
- // layout hook - this is where a hook gets to figure out what to
- // do if anything.
- _e_border_container_layout_hook(con);
-
- // pass 2 - show windows needing show
- bl = e_container_border_list_first(con);
- while ((bd = e_container_border_list_next(bl)))
- {
- if ((bd->changes.visible) && (bd->visible) &&
- (!bd->new_client) && (!bd->changes.pos) &&
- (!bd->changes.size))
- {
- _e_border_show(bd);
- bd->changes.visible = 0;
- }
-
- if (bd->zone && (!bd->new_client) &&
- (!E_INSIDE(bd->x, bd->y, 0, 0, bd->zone->w - 5, bd->zone->h - 5)) &&
- (!E_INSIDE(bd->x, bd->y, 0 - bd->w + 5, 0 - bd->h + 5, bd->zone->w - 5, bd->zone->h - 5))
- )
- {
- if (e_config->screen_limits != E_SCREEN_LIMITS_COMPLETELY)
- _e_border_move_lost_window_to_center(bd);
- }
- }
- e_container_border_list_free(bl);
-
- // pass 3 - hide windows needing hide and eval (main eval)
- bl = e_container_border_list_first(con);
- while ((bd = e_container_border_list_next(bl)))
- {
- if (e_object_is_del(E_OBJECT(bd))) continue;
-
- if ((bd->changes.visible) && (!bd->visible))
- {
- _e_border_hide(bd);
- bd->changes.visible = 0;
- }
-
- if (bd->changed) _e_border_eval(bd);
-
- if ((bd->changes.visible) && (bd->visible))
- {
- _e_border_show(bd);
- bd->changes.visible = 0;
- }
- }
- e_container_border_list_free(bl);
- }
- }
-
- if (focus_next)
- {
- E_Border *bd = NULL, *bd2;
-
- EINA_LIST_FREE(focus_next, bd2)
- if ((!bd) && (bd2->visible)) bd = bd2;
-
- if (!bd)
- {
- /* TODO revert focus when lost here ? */
- return;
- }
-#if 0
- if (bd == focused)
- {
- /* already focused. but anyway dont be so strict, this
- fcks up illume setting focus on internal windows */
- return;
- }
-#endif
-
- focus_time = ecore_x_current_time_get();
-
- focusing = bd;
-
- if ((bd->client.icccm.take_focus) &&
- (bd->client.icccm.accepts_focus))
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_LOCALLY_ACTIVE);
- /* TODO what if the client didn't take focus ? */
- }
- else if (!bd->client.icccm.accepts_focus)
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_GLOBALLY_ACTIVE);
- }
- else if (!bd->client.icccm.take_focus)
- {
- e_grabinput_focus(bd->client.win, E_FOCUS_METHOD_PASSIVE);
- /* e_border_focus_set(bd, 1, 0); */
- }
- }
-}
-
-EAPI Eina_List *
-e_border_client_list(void)
-{
- /* FIXME: This should be a somewhat ordered list */
- return borders;
-}
-
-static void
-_e_border_show(E_Border *bd)
-{
- Eina_List *l;
- E_Border *tmp;
-
- if (bd->post_job)
- {
- bd->post_show = 1;
- return;
- }
-
- if (!((bd->comp_hidden) || (bd->tmp_input_hidden > 0)))
- {
- _e_border_shape_input_rectangle_set(bd);
- // not anymore
- // ecore_x_composite_window_events_enable(bd->win);
- ecore_x_window_ignore_set(bd->win, EINA_FALSE);
- }
-
- ecore_x_window_show(bd->win);
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- ecore_x_window_show(tmp->win);
-}
-
-static void
-_e_border_hide(E_Border *bd)
-{
- E_Border *tmp;
- Eina_List *l;
-
- if (!e_comp_evas_exists(bd))
- {
- ecore_x_window_hide(bd->win);
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- ecore_x_window_hide(tmp->win);
- }
- else
- {
- ecore_x_composite_window_events_disable(bd->win);
- ecore_x_window_ignore_set(bd->win, EINA_TRUE);
- }
-}
-
-static int
-_e_border_action_input_win_del(void)
-{
- if (!action_input_win)
- return 0;
-
- e_grabinput_release(action_input_win, action_input_win);
- action_input_win = 0;
- return 1;
-}
-
-static int
-_e_border_action_input_win_new(E_Border *bd)
-{
- if (!action_input_win)
- action_input_win = e_comp_get(bd)->ee_win;
-
- if (e_grabinput_get(action_input_win, 0, action_input_win))
- return 1;
-
- _e_border_action_input_win_del();
- return 0;
-}
-
-static void
-_e_border_action_finish(void)
-{
- _e_border_action_input_win_del();
-
- if (action_timer)
- {
- ecore_timer_del(action_timer);
- action_timer = NULL;
- }
-
- if (action_handler_key)
- {
- ecore_event_handler_del(action_handler_key);
- action_handler_key = NULL;
- }
-
- if (action_handler_mouse)
- {
- ecore_event_handler_del(action_handler_mouse);
- action_handler_mouse = NULL;
- }
-
- action_border = NULL;
-}
-
-static void
-_e_border_action_init(E_Border *bd)
-{
- action_orig.x = bd->x;
- action_orig.y = bd->y;
- action_orig.width = bd->w;
- action_orig.height = bd->h;
-
- action_border = bd;
-}
-
-static void
-_e_border_action_restore_orig(E_Border *bd)
-{
- if (action_border != bd)
- return;
-
- e_border_move_resize(bd, action_orig.x, action_orig.y, action_orig.width, action_orig.height);
-}
-
-static int
-_e_border_key_down_modifier_apply(int modifier,
- int value)
-{
- if (modifier & ECORE_EVENT_MODIFIER_CTRL)
- return value * 2;
- else if (modifier & ECORE_EVENT_MODIFIER_ALT)
- {
- value /= 2;
- if (value)
- return value;
- else
- return 1;
- }
-
- return value;
-}
-
-static Eina_Bool
-_e_border_action_move_timeout(void *data __UNUSED__)
-{
- _e_border_move_end(action_border);
- _e_border_action_finish();
- return ECORE_CALLBACK_CANCEL;
-}
-
-static void
-_e_border_action_move_timeout_add(void)
-{
- E_FREE_FUNC(action_timer, ecore_timer_del);
- if (e_config->border_keyboard.timeout)
- action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_border_action_move_timeout, NULL);
-}
-
-static Eina_Bool
-_e_border_move_key_down(void *data __UNUSED__,
- int type __UNUSED__,
- void *event)
-{
- Ecore_Event_Key *ev = event;
- int x, y;
-
- if (ev->event_window != action_input_win)
- return ECORE_CALLBACK_PASS_ON;
- if (!action_border)
- {
- fputs("ERROR: no action_border!\n", stderr);
- goto stop;
- }
-
- x = action_border->x;
- y = action_border->y;
-
- if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0))
- y -= _e_border_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dy, 1));
- else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0))
- y += _e_border_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dy, 1));
- else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0))
- x -= _e_border_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dx, 1));
- else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0))
- x += _e_border_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dx, 1));
- else if (strcmp(ev->key, "Return") == 0)
- goto stop;
- else if (strcmp(ev->key, "Escape") == 0)
- {
- _e_border_action_restore_orig(action_border);
- goto stop;
- }
- else if ((strncmp(ev->key, "Control", sizeof("Control") - 1) != 0) &&
- (strncmp(ev->key, "Alt", sizeof("Alt") - 1) != 0))
- goto stop;
-
- e_border_move(action_border, x, y);
- _e_border_action_move_timeout_add();
-
- return ECORE_CALLBACK_PASS_ON;
-
-stop:
- _e_border_move_end(action_border);
- _e_border_action_finish();
- return ECORE_CALLBACK_DONE;
-}
-
-static Eina_Bool
-_e_border_move_mouse_down(void *data __UNUSED__,
- int type __UNUSED__,
- void *event)
-{
- Ecore_Event_Mouse_Button *ev = event;
-
- if (ev->event_window != action_input_win)
- return ECORE_CALLBACK_PASS_ON;
-
- if (!action_border)
- fputs("ERROR: no action_border!\n", stderr);
-
- _e_border_move_end(action_border);
- _e_border_action_finish();
- return ECORE_CALLBACK_DONE;
-}
-
-EAPI void
-e_border_act_move_keyboard(E_Border *bd)
-{
- if (!bd)
- return;
-
- if (!_e_border_move_begin(bd))
- return;
-
- if (!_e_border_action_input_win_new(bd))
- {
- _e_border_move_end(bd);
- return;
- }
-
- _e_border_action_init(bd);
- _e_border_action_move_timeout_add();
- _e_border_move_update(bd);
-
- if (action_handler_key)
- ecore_event_handler_del(action_handler_key);
- action_handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_border_move_key_down, NULL);
-
- if (action_handler_mouse)
- ecore_event_handler_del(action_handler_mouse);
- action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_border_move_mouse_down, NULL);
-}
-
-static Eina_Bool
-_e_border_action_resize_timeout(void *data __UNUSED__)
-{
- _e_border_resize_end(action_border);
- _e_border_action_finish();
- return ECORE_CALLBACK_CANCEL;
-}
-
-static void
-_e_border_action_resize_timeout_add(void)
-{
- E_FREE_FUNC(action_timer, ecore_timer_del);
- if (e_config->border_keyboard.timeout)
- action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_border_action_resize_timeout, NULL);
-}
-
-static Eina_Bool
-_e_border_resize_key_down(void *data __UNUSED__,
- int type __UNUSED__,
- void *event)
-{
- Ecore_Event_Key *ev = event;
- int w, h, dx, dy;
-
- if (ev->event_window != action_input_win)
- return ECORE_CALLBACK_PASS_ON;
- if (!action_border)
- {
- fputs("ERROR: no action_border!\n", stderr);
- goto stop;
- }
-
- w = action_border->w;
- h = action_border->h;
-
- dx = e_config->border_keyboard.resize.dx;
- if (dx < action_border->client.icccm.step_w)
- dx = action_border->client.icccm.step_w;
- dx = _e_border_key_down_modifier_apply(ev->modifiers, dx);
- if (dx < action_border->client.icccm.step_w)
- dx = action_border->client.icccm.step_w;
-
- dy = e_config->border_keyboard.resize.dy;
- if (dy < action_border->client.icccm.step_h)
- dy = action_border->client.icccm.step_h;
- dy = _e_border_key_down_modifier_apply(ev->modifiers, dy);
- if (dy < action_border->client.icccm.step_h)
- dy = action_border->client.icccm.step_h;
-
- if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0))
- h -= dy;
- else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0))
- h += dy;
- else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0))
- w -= dx;
- else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0))
- w += dx;
- else if (strcmp(ev->key, "Return") == 0)
- goto stop;
- else if (strcmp(ev->key, "Escape") == 0)
- {
- _e_border_action_restore_orig(action_border);
- goto stop;
- }
- else if ((strncmp(ev->key, "Control", sizeof("Control") - 1) != 0) &&
- (strncmp(ev->key, "Alt", sizeof("Alt") - 1) != 0))
- goto stop;
-
- e_border_resize_limit(action_border, &w, &h);
- e_border_resize(action_border, w, h);
- _e_border_action_resize_timeout_add();
-
- return ECORE_CALLBACK_PASS_ON;
-
-stop:
- _e_border_resize_end(action_border);
- _e_border_action_finish();
- return ECORE_CALLBACK_DONE;
-}
-
-static Eina_Bool
-_e_border_resize_mouse_down(void *data __UNUSED__,
- int type __UNUSED__,
- void *event)
-{
- Ecore_Event_Mouse_Button *ev = event;
-
- if (ev->event_window != action_input_win)
- return ECORE_CALLBACK_PASS_ON;
-
- if (!action_border)
- fputs("ERROR: no action_border!\n", stderr);
-
- _e_border_resize_end(action_border);
- _e_border_action_finish();
- return ECORE_CALLBACK_DONE;
-}
-
-EAPI void
-e_border_act_resize_keyboard(E_Border *bd)
-{
- if (!bd)
- return;
-
- if (!_e_border_resize_begin(bd))
- return;
-
- _e_border_action_init(bd);
- _e_border_action_resize_timeout_add();
- _e_border_resize_update(bd);
-
- if (action_handler_key)
- ecore_event_handler_del(action_handler_key);
- action_handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_border_resize_key_down, NULL);
-
- if (action_handler_mouse)
- ecore_event_handler_del(action_handler_mouse);
- action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_border_resize_mouse_down, NULL);
-}
-
-EAPI void
-e_border_act_move_begin(E_Border *bd,
- E_Binding_Event_Mouse_Button *ev)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if ((bd->resize_mode != E_POINTER_RESIZE_NONE) || (bd->moving)) return;
- if (!_e_border_move_begin(bd))
- return;
-
- if (!_e_border_action_input_win_new(bd))
- {
- _e_border_move_end(bd);
- return;
- }
- _e_border_action_init(bd);
- e_zone_edge_disable();
- bd->moving = 1;
- e_pointer_mode_push(bd, E_POINTER_MOVE);
- if (ev)
- {
- char source[256];
-
- snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
- _e_border_moveinfo_gather(bd, source);
- }
-}
-
-EAPI void
-e_border_act_move_end(E_Border *bd,
- E_Binding_Event_Mouse_Button *ev __UNUSED__)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (!bd->moving) return;
- e_zone_edge_enable();
- _e_border_move_end(bd);
- e_zone_flip_coords_handle(bd->zone, -1, -1);
- _e_border_action_finish();
-}
-
-EAPI void
-e_border_act_resize_begin(E_Border *bd,
- E_Binding_Event_Mouse_Button *ev)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->lock_user_size || bd->shaded || bd->shading) return;
- if ((bd->resize_mode != E_POINTER_RESIZE_NONE) || (bd->moving)) return;
- if (!_e_border_resize_begin(bd))
- return;
- _e_border_action_init(bd);
- if (bd->mouse.current.mx < (bd->x + bd->w / 2))
- {
- if (bd->mouse.current.my < (bd->y + bd->h / 2))
- {
- bd->resize_mode = E_POINTER_RESIZE_TL;
- GRAV_SET(bd, ECORE_X_GRAVITY_SE);
- }
- else
- {
- bd->resize_mode = E_POINTER_RESIZE_BL;
- GRAV_SET(bd, ECORE_X_GRAVITY_NE);
- }
- }
- else
- {
- if (bd->mouse.current.my < (bd->y + bd->h / 2))
- {
- bd->resize_mode = E_POINTER_RESIZE_TR;
- GRAV_SET(bd, ECORE_X_GRAVITY_SW);
- }
- else
- {
- bd->resize_mode = E_POINTER_RESIZE_BR;
- GRAV_SET(bd, ECORE_X_GRAVITY_NW);
- }
- }
- e_pointer_mode_push(bd, bd->resize_mode);
- if (ev)
- {
- char source[256];
-
- snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
- _e_border_moveinfo_gather(bd, source);
- }
-}
-
-EAPI void
-e_border_act_resize_end(E_Border *bd,
- E_Binding_Event_Mouse_Button *ev __UNUSED__)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->resize_mode != E_POINTER_RESIZE_NONE)
- {
- _e_border_resize_end(bd);
- bd->changes.reset_gravity = 1;
- BD_CHANGED(bd);
- }
- _e_border_action_finish();
-}
-
-EAPI void
-e_border_act_menu_begin(E_Border *bd,
- E_Binding_Event_Mouse_Button *ev,
- int key)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->border_menu) return;
- if (ev)
- e_int_border_menu_show(bd, ev->canvas.x, ev->canvas.y, key, ev->timestamp);
- else
- {
- int x, y;
-
- ecore_x_pointer_xy_get(bd->zone->container->win, &x, &y);
- e_int_border_menu_show(bd, x, y, key, 0);
- }
-}
-
-EAPI void
-e_border_act_close_begin(E_Border *bd)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->lock_close) return;
- if (bd->client.icccm.delete_request)
- {
- bd->delete_requested = 1;
- ecore_x_window_delete_request_send(bd->client.win);
- if (bd->client.netwm.ping)
- e_border_ping(bd);
- }
- else if (e_config->kill_if_close_not_possible)
- {
- e_border_act_kill_begin(bd);
- }
-}
-
-EAPI void
-e_border_act_kill_begin(E_Border *bd)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->internal) return;
- if (bd->lock_close) return;
- if ((bd->client.netwm.pid > 1) && (e_config->kill_process))
- {
- kill(bd->client.netwm.pid, SIGINT);
- bd->kill_timer = ecore_timer_add(e_config->kill_timer_wait,
- _e_border_cb_kill_timer, bd);
- }
- else
- {
- if (!bd->internal) ecore_x_kill(bd->client.win);
- }
-}
-
-EAPI Evas_Object *
-e_border_icon_add(E_Border *bd,
- Evas *evas)
-{
- Evas_Object *o;
-
- E_OBJECT_CHECK_RETURN(bd, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, NULL);
-
- o = NULL;
- if (bd->internal)
- {
- if (!bd->internal_icon)
- {
- o = e_icon_add(evas);
- e_util_icon_theme_set(o, "enlightenment");
- }
- else
- {
- if (!bd->internal_icon_key)
- {
- char *ext;
-
- ext = strrchr(bd->internal_icon, '.');
- if ((ext) && ((!strcmp(ext, ".edj"))))
- {
- o = edje_object_add(evas);
- if (!edje_object_file_set(o, bd->internal_icon, "icon"))
- e_util_icon_theme_set(o, "enlightenment");
- }
- else if (ext)
- {
- o = e_icon_add(evas);
- e_icon_file_set(o, bd->internal_icon);
- }
- else
- {
- o = e_icon_add(evas);
- if (!e_util_icon_theme_set(o, bd->internal_icon))
- e_util_icon_theme_set(o, "enlightenment");
- }
- }
- else
- {
- o = edje_object_add(evas);
- edje_object_file_set(o, bd->internal_icon,
- bd->internal_icon_key);
- }
- }
- return o;
- }
- if ((e_config->use_app_icon) && (bd->icon_preference != E_ICON_PREF_USER))
- {
- if (bd->client.netwm.icons)
- {
- o = e_icon_add(evas);
- e_icon_data_set(o, bd->client.netwm.icons[0].data,
- bd->client.netwm.icons[0].width,
- bd->client.netwm.icons[0].height);
- e_icon_alpha_set(o, 1);
- return o;
- }
- }
- if (!o)
- {
- if ((bd->desktop) && (bd->icon_preference != E_ICON_PREF_NETWM))
- {
- o = e_icon_add(evas);
- if (o)
- {
- e_icon_fdo_icon_set(o, bd->desktop->icon);
- return o;
- }
- }
- else if (bd->client.netwm.icons)
- {
- o = e_icon_add(evas);
- e_icon_data_set(o, bd->client.netwm.icons[0].data,
- bd->client.netwm.icons[0].width,
- bd->client.netwm.icons[0].height);
- e_icon_alpha_set(o, 1);
- return o;
- }
- }
-
- o = e_icon_add(evas);
- e_util_icon_theme_set(o, "unknown");
- return o;
-}
-
-EAPI void
-e_border_button_bindings_ungrab_all(void)
-{
- Eina_List *l;
- E_Border *bd;
-
- EINA_LIST_FOREACH(borders, l, bd)
- {
- e_focus_setdown(bd);
- e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- }
-}
-
-EAPI void
-e_border_button_bindings_grab_all(void)
-{
- Eina_List *l;
- E_Border *bd;
-
- EINA_LIST_FOREACH(borders, l, bd)
- {
- e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_focus_setup(bd);
- }
-}
-
-EAPI Eina_List *
-e_border_focus_stack_get(void)
-{
- return focus_stack;
-}
-
-EAPI Eina_List *
-e_border_raise_stack_get(void)
-{
- return raise_stack;
-}
-
-EAPI Eina_List *
-e_border_lost_windows_get(E_Zone *zone)
-{
- Eina_List *list = NULL, *l;
- E_Border *bd;
- int loss_overlap = 5;
-
- E_OBJECT_CHECK_RETURN(zone, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
- EINA_LIST_FOREACH(borders, l, bd)
- {
- if ((bd->zone != zone) ||
- (bd->zone->container != zone->container))
- continue;
-
- if (!E_INTERSECTS(bd->zone->x + loss_overlap,
- bd->zone->y + loss_overlap,
- bd->zone->w - (2 * loss_overlap),
- bd->zone->h - (2 * loss_overlap),
- bd->x, bd->y, bd->w, bd->h))
- {
- list = eina_list_append(list, bd);
- }
- }
- return list;
-}
-
-static void
-_e_border_zones_layout_calc(E_Border *bd, int *zx, int *zy, int *zw, int *zh)
-{
- int x, y, w, h;
- E_Zone *zone_above, *zone_below, *zone_left, *zone_right;
-
- x = bd->zone->x;
- y = bd->zone->y;
- w = bd->zone->w;
- h = bd->zone->h;
-
- if (eina_list_count(bd->zone->container->zones) == 1)
- {
- if (zx) *zx = x;
- if (zy) *zy = y;
- if (zw) *zw = w;
- if (zh) *zh = h;
- return;
- }
-
- zone_left = e_container_zone_at_point_get(bd->zone->container, (x - w + 5), y);
- zone_right = e_container_zone_at_point_get(bd->zone->container, (x + w + 5), y);
- zone_above = e_container_zone_at_point_get(bd->zone->container, x, (y - h + 5));
- zone_below = e_container_zone_at_point_get(bd->zone->container, x, (y + h + 5));
-
- if (!(zone_above) && (y))
- zone_above = e_container_zone_at_point_get(bd->zone->container, x, (h - 5));
-
- if (!(zone_left) && (x))
- zone_left = e_container_zone_at_point_get(bd->zone->container, (x - 5), y);
-
- if (zone_right)
- w = zone_right->x + zone_right->w;
-
- if (zone_left)
- w = bd->zone->x + bd->zone->w;
-
- if (zone_below)
- h = zone_below->y + zone_below->h;
-
- if (zone_above)
- h = bd->zone->y + bd->zone->h;
-
- if ((zone_left) && (zone_right))
- w = bd->zone->w + zone_right->x;
-
- if ((zone_above) && (zone_below))
- h = bd->zone->h + zone_below->y;
-
- if (x) x -= bd->zone->w;
- if (y) y -= bd->zone->h;
-
- if (zx) *zx = x > 0 ? x : 0;
- if (zy) *zy = y > 0 ? y : 0;
- if (zw) *zw = w;
- if (zh) *zh = h;
-}
-
-static void
-_e_border_move_lost_window_to_center(E_Border *bd)
-{
- int loss_overlap = 5;
- int zw, zh, zx, zy;
-
- if (bd->during_lost) return;
-
- _e_border_zones_layout_calc(bd, &zx, &zy, &zw, &zh);
-
- if (!E_INTERSECTS(zx + loss_overlap,
- zy + loss_overlap,
- zw - (2 * loss_overlap),
- zh - (2 * loss_overlap),
- bd->x, bd->y, bd->w, bd->h))
- {
- if (e_config->edge_flip_dragging)
- {
- Eina_Bool lf, rf, tf, bf;
-
- lf = rf = tf = bf = EINA_TRUE;
-
- if (bd->zone->desk_x_count <= 1) lf = rf = EINA_FALSE;
- else if (!e_config->desk_flip_wrap)
- {
- if (bd->zone->desk_x_current == 0) lf = EINA_FALSE;
- if (bd->zone->desk_x_current == (bd->zone->desk_x_count - 1)) rf = EINA_FALSE;
- }
-
- if (bd->zone->desk_y_count <= 1) tf = bf = EINA_FALSE;
- else if (!e_config->desk_flip_wrap)
- {
- if (bd->zone->desk_y_current == 0) tf = EINA_FALSE;
- if (bd->zone->desk_y_current == (bd->zone->desk_y_count - 1)) bf = EINA_FALSE;
- }
-
- if (!(lf) && (bd->x <= loss_overlap) && !(bd->zone->flip.switching))
- _e_border_reset_lost_window(bd);
-
- if (!(rf) && (bd->x >= (bd->zone->w - loss_overlap)) && !(bd->zone->flip.switching))
- _e_border_reset_lost_window(bd);
-
- if (!(tf) && (bd->y <= loss_overlap) && !(bd->zone->flip.switching))
- _e_border_reset_lost_window(bd);
-
- if (!(bf) && (bd->y >= (bd->zone->h - loss_overlap)) && !(bd->zone->flip.switching))
- _e_border_reset_lost_window(bd);
- }
-
- if (!e_config->edge_flip_dragging)
- _e_border_reset_lost_window(bd);
- }
-}
-
-static void
-_e_border_reset_lost_window(E_Border *bd)
-{
- E_OBJECT_CHECK(bd);
-
- if (bd->during_lost) return;
- bd->during_lost = EINA_TRUE;
-
- if (bd->iconic) e_border_uniconify(bd);
- if (!bd->moving) e_border_center(bd);
-
- e_border_raise(bd);
- if (!bd->lock_focus_out)
- e_border_focus_set(bd, 1, 1);
-
- e_border_pointer_warp_to_center(bd);
- bd->during_lost = EINA_FALSE;
-}
-
-EAPI void
-e_border_ping(E_Border *bd)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (!e_config->ping_clients) return;
- bd->ping_ok = 0;
- ecore_x_netwm_ping_send(bd->client.win);
- bd->ping = ecore_loop_time_get();
- if (bd->ping_poller) ecore_poller_del(bd->ping_poller);
- bd->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
- e_config->ping_clients_interval,
- _e_border_cb_ping_poller, bd);
-}
-
-EAPI void
-e_border_move_cancel(void)
-{
- if (bdmove)
- {
- if (bdmove->cur_mouse_action)
- {
- E_Border *bd;
-
- bd = bdmove;
- e_object_ref(E_OBJECT(bd));
- if (bd->cur_mouse_action->func.end_mouse)
- bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", NULL);
- else if (bd->cur_mouse_action->func.end)
- bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
- e_object_unref(E_OBJECT(bd->cur_mouse_action));
- bd->cur_mouse_action = NULL;
- e_object_unref(E_OBJECT(bd));
- }
- else
- _e_border_move_end(bdmove);
- }
-}
-
-EAPI void
-e_border_resize_cancel(void)
-{
- if (bdresize)
- {
- if (bdresize->cur_mouse_action)
- {
- E_Border *bd;
-
- bd = bdresize;
- e_object_ref(E_OBJECT(bd));
- if (bd->cur_mouse_action->func.end_mouse)
- bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", NULL);
- else if (bd->cur_mouse_action->func.end)
- bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
- e_object_unref(E_OBJECT(bd->cur_mouse_action));
- bd->cur_mouse_action = NULL;
- e_object_unref(E_OBJECT(bd));
- }
- else
- {
- _e_border_resize_end(bdresize);
- }
- }
-}
-
-EAPI void
-e_border_frame_recalc(E_Border *bd)
-{
- int w, h;
- if (!bd->bg_object) return;
-
- w = bd->w, h = bd->h;
- bd->w -= e_border_inset_width_get(bd);
- bd->h -= e_border_inset_height_get(bd);
-
- _e_border_client_inset_calc(bd);
-
- bd->w += e_border_inset_width_get(bd);
- bd->h += e_border_inset_height_get(bd);
-
- if (bd->changes.shading || bd->changes.shaded) return;
- if ((w != bd->w) || (h != bd->h))
- {
- BD_CHANGED(bd);
- bd->changes.size = 1;
- if (bd->client.shaped)
- {
- bd->need_shape_merge = 1;
- bd->need_shape_export = 1;
- }
- if (bd->shaped_input)
- {
- bd->need_shape_merge = 1;
- }
- _e_border_client_move_resize_send(bd);
- }
-}
-
-EAPI Eina_List *
-e_border_immortal_windows_get(void)
-{
- Eina_List *list = NULL, *l;
- E_Border *bd;
-
- EINA_LIST_FOREACH(borders, l, bd)
- {
- if (bd->lock_life)
- list = eina_list_append(list, bd);
- }
- return list;
-}
-
-EAPI const char *
-e_border_name_get(const E_Border *bd)
-{
- E_OBJECT_CHECK_RETURN(bd, "");
- E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, "");
- if (bd->client.netwm.name)
- return bd->client.netwm.name;
- else if (bd->client.icccm.title)
- return bd->client.icccm.title;
- return "";
-}
-
-EAPI void
-e_border_signal_move_begin(E_Border *bd,
- const char *sig,
- const char *src __UNUSED__)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- if ((bd->resize_mode != E_POINTER_RESIZE_NONE) || (bd->moving)) return;
- if (!_e_border_move_begin(bd)) return;
- bd->moving = 1;
- e_pointer_mode_push(bd, E_POINTER_MOVE);
- e_zone_edge_disable();
- _e_border_moveinfo_gather(bd, sig);
- if (bd->cur_mouse_action)
- {
- if ((!bd->cur_mouse_action->func.end_mouse) &&
- (!bd->cur_mouse_action->func.end))
- bd->cur_mouse_action = NULL;
- else
- e_object_unref(E_OBJECT(bd->cur_mouse_action));
- }
- bd->cur_mouse_action = e_action_find("window_move");
- if (bd->cur_mouse_action)
- e_object_ref(E_OBJECT(bd->cur_mouse_action));
-}
-
-EAPI void
-e_border_signal_move_end(E_Border *bd,
- const char *sig __UNUSED__,
- const char *src __UNUSED__)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (!bd->moving) return;
- e_zone_edge_enable();
- _e_border_move_end(bd);
- e_zone_flip_coords_handle(bd->zone, -1, -1);
-}
-
-EAPI int
-e_border_resizing_get(E_Border *bd)
-{
- E_OBJECT_CHECK_RETURN(bd, 0);
- E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, 0);
- if (bd->resize_mode == E_POINTER_RESIZE_NONE) return 0;
- return 1;
-}
-
-EAPI void
-e_border_signal_resize_begin(E_Border *bd,
- const char *dir,
- const char *sig,
- const char *src __UNUSED__)
-{
- Ecore_X_Gravity grav = ECORE_X_GRAVITY_NW;
- int resize_mode = E_POINTER_RESIZE_BR;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- if ((bd->resize_mode != E_POINTER_RESIZE_NONE) || (bd->moving)) return;
- if (!_e_border_resize_begin(bd))
- return;
- if (!strcmp(dir, "tl"))
- {
- resize_mode = E_POINTER_RESIZE_TL;
- grav = ECORE_X_GRAVITY_SE;
- }
- else if (!strcmp(dir, "t"))
- {
- resize_mode = E_POINTER_RESIZE_T;
- grav = ECORE_X_GRAVITY_S;
- }
- else if (!strcmp(dir, "tr"))
- {
- resize_mode = E_POINTER_RESIZE_TR;
- grav = ECORE_X_GRAVITY_SW;
- }
- else if (!strcmp(dir, "r"))
- {
- resize_mode = E_POINTER_RESIZE_R;
- grav = ECORE_X_GRAVITY_W;
- }
- else if (!strcmp(dir, "br"))
- {
- resize_mode = E_POINTER_RESIZE_BR;
- grav = ECORE_X_GRAVITY_NW;
- }
- else if (!strcmp(dir, "b"))
- {
- resize_mode = E_POINTER_RESIZE_B;
- grav = ECORE_X_GRAVITY_N;
- }
- else if (!strcmp(dir, "bl"))
- {
- resize_mode = E_POINTER_RESIZE_BL;
- grav = ECORE_X_GRAVITY_NE;
- }
- else if (!strcmp(dir, "l"))
- {
- resize_mode = E_POINTER_RESIZE_L;
- grav = ECORE_X_GRAVITY_E;
- }
- bd->resize_mode = resize_mode;
- e_pointer_mode_push(bd, bd->resize_mode);
- _e_border_moveinfo_gather(bd, sig);
- GRAV_SET(bd, grav);
- if (bd->cur_mouse_action)
- {
- if ((!bd->cur_mouse_action->func.end_mouse) &&
- (!bd->cur_mouse_action->func.end))
- bd->cur_mouse_action = NULL;
- else
- e_object_unref(E_OBJECT(bd->cur_mouse_action));
- }
- bd->cur_mouse_action = e_action_find("window_resize");
- if (bd->cur_mouse_action)
- e_object_ref(E_OBJECT(bd->cur_mouse_action));
-}
-
-EAPI void
-e_border_signal_resize_end(E_Border *bd,
- const char *dir __UNUSED__,
- const char *sig __UNUSED__,
- const char *src __UNUSED__)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- if (bd->resize_mode == E_POINTER_RESIZE_NONE) return;
- _e_border_resize_handle(bd);
- _e_border_resize_end(bd);
- bd->changes.reset_gravity = 1;
- BD_CHANGED(bd);
-}
-
-EAPI void
-e_border_resize_limit(E_Border *bd,
- int *w,
- int *h)
-{
- double a;
- Eina_Bool inc_h;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- inc_h = (*h - bd->h > 0);
- *w -= e_border_inset_width_get(bd);
- *h -= e_border_inset_height_get(bd);
- if (*h < 1) *h = 1;
- if (*w < 1) *w = 1;
- if ((bd->client.icccm.base_w >= 0) &&
- (bd->client.icccm.base_h >= 0))
- {
- int tw, th;
-
- tw = *w - bd->client.icccm.base_w;
- th = *h - bd->client.icccm.base_h;
- if (tw < 1) tw = 1;
- if (th < 1) th = 1;
- a = (double)(tw) / (double)(th);
- if ((bd->client.icccm.min_aspect != 0.0) &&
- (a < bd->client.icccm.min_aspect))
- {
- if (inc_h)
- tw = th * bd->client.icccm.min_aspect;
- else
- th = tw / bd->client.icccm.max_aspect;
- *w = tw + bd->client.icccm.base_w;
- *h = th + bd->client.icccm.base_h;
- }
- else if ((bd->client.icccm.max_aspect != 0.0) &&
- (a > bd->client.icccm.max_aspect))
- {
- tw = th * bd->client.icccm.max_aspect;
- *w = tw + bd->client.icccm.base_w;
- }
- }
- else
- {
- a = (double)*w / (double)*h;
- if ((bd->client.icccm.min_aspect != 0.0) &&
- (a < bd->client.icccm.min_aspect))
- {
- if (inc_h)
- *w = *h * bd->client.icccm.min_aspect;
- else
- *h = *w / bd->client.icccm.min_aspect;
- }
- else if ((bd->client.icccm.max_aspect != 0.0) &&
- (a > bd->client.icccm.max_aspect))
- *w = *h * bd->client.icccm.max_aspect;
- }
- if (bd->client.icccm.step_w > 0)
- {
- if (bd->client.icccm.base_w >= 0)
- *w = bd->client.icccm.base_w +
- (((*w - bd->client.icccm.base_w) / bd->client.icccm.step_w) *
- bd->client.icccm.step_w);
- else
- *w = bd->client.icccm.min_w +
- (((*w - bd->client.icccm.min_w) / bd->client.icccm.step_w) *
- bd->client.icccm.step_w);
- }
- if (bd->client.icccm.step_h > 0)
- {
- if (bd->client.icccm.base_h >= 0)
- *h = bd->client.icccm.base_h +
- (((*h - bd->client.icccm.base_h) / bd->client.icccm.step_h) *
- bd->client.icccm.step_h);
- else
- *h = bd->client.icccm.min_h +
- (((*h - bd->client.icccm.min_h) / bd->client.icccm.step_h) *
- bd->client.icccm.step_h);
- }
-
- if (*h < 1) *h = 1;
- if (*w < 1) *w = 1;
-
- if (*w > bd->client.icccm.max_w) *w = bd->client.icccm.max_w;
- else if (*w < bd->client.icccm.min_w)
- *w = bd->client.icccm.min_w;
- if (*h > bd->client.icccm.max_h) *h = bd->client.icccm.max_h;
- else if (*h < bd->client.icccm.min_h)
- *h = bd->client.icccm.min_h;
-
- *w += e_border_inset_width_get(bd);
- *h += e_border_inset_height_get(bd);
-}
-
-EAPI void
-e_border_input_object_set(E_Border *bd, Evas_Object *input_obj)
-{
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- bd->input_object = input_obj;
- if (!bd->input_object) return;
-
- evas_object_event_callback_add(bd->input_object, EVAS_CALLBACK_MOUSE_IN,
- _e_border_cb_mouse_in, bd);
- evas_object_event_callback_add(bd->input_object, EVAS_CALLBACK_MOUSE_MOVE,
- _e_border_cb_mouse_move, bd);
- evas_object_event_callback_add(bd->input_object, EVAS_CALLBACK_MOUSE_OUT,
- _e_border_cb_mouse_out, bd);
- evas_object_event_callback_add(bd->input_object, EVAS_CALLBACK_MOUSE_DOWN,
- _e_border_cb_mouse_down, bd);
- evas_object_event_callback_add(bd->input_object, EVAS_CALLBACK_MOUSE_UP,
- _e_border_cb_mouse_up, bd);
- evas_object_event_callback_add(bd->input_object, EVAS_CALLBACK_MOUSE_WHEEL,
- _e_border_cb_mouse_wheel, bd);
-
- bd->callbacks_set = EINA_TRUE;
-}
-
-/* local subsystem functions */
-static void
-_e_border_free(E_Border *bd)
-{
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- if (bd->client.e.state.profile.use)
- {
- if (bd->client.e.state.profile.available_list)
- {
- int i;
- for (i = 0; i < bd->client.e.state.profile.num; i++)
- {
- if (bd->client.e.state.profile.available_list[i])
- {
- eina_stringshare_del(bd->client.e.state.profile.available_list[i]);
- bd->client.e.state.profile.available_list[i] = NULL;
- }
- }
- E_FREE(bd->client.e.state.profile.available_list);
- bd->client.e.state.profile.available_list = NULL;
- }
-
- bd->client.e.state.profile.num = 0;
-
- if (bd->client.e.state.profile.name)
- {
- eina_stringshare_del(bd->client.e.state.profile.name);
- bd->client.e.state.profile.name = NULL;
- }
-
- bd->client.e.state.profile.wait_for_done = 0;
- bd->client.e.state.profile.use = 0;
- }
-#endif
- if (bd->client.e.state.video_parent && bd->client.e.state.video_parent_border)
- {
- bd->client.e.state.video_parent_border->client.e.state.video_child =
- eina_list_remove
- (bd->client.e.state.video_parent_border->client.e.state.video_child,
- bd);
- }
- if (bd->client.e.state.video_child)
- {
- E_Border *tmp;
-
- EINA_LIST_FREE(bd->client.e.state.video_child, tmp)
- {
- tmp->client.e.state.video_parent_border = NULL;
- }
- }
- if (bd->internal_ecore_evas)
- {
- e_canvas_del(bd->internal_ecore_evas);
- ecore_evas_free(bd->internal_ecore_evas);
- bd->internal_ecore_evas = NULL;
- }
- if (bd->desktop)
- {
- efreet_desktop_free(bd->desktop);
- bd->desktop = NULL;
- }
- if (bd->post_job)
- {
- ecore_idle_enterer_del(bd->post_job);
- bd->post_job = NULL;
- }
-
- if ((bdresize == bd) || (bd->resize_mode != E_POINTER_RESIZE_NONE))
- _e_border_resize_end(bd);
- if (bdmove == bd)
- _e_border_move_end(bd);
- /* TODO: Other states to end before dying? */
-
- if (bd->cur_mouse_action)
- {
- e_object_unref(E_OBJECT(bd->cur_mouse_action));
- bd->cur_mouse_action = NULL;
- }
-
-/*
- if (bd->dangling_ref_check)
- {
- ecore_timer_del(bd->dangling_ref_check);
- bd->dangling_ref_check = NULL;
- }
- */
- if (bd->kill_timer)
- {
- ecore_timer_del(bd->kill_timer);
- bd->kill_timer = NULL;
- }
- if (bd->ping_poller)
- {
- ecore_poller_del(bd->ping_poller);
- bd->ping_poller = NULL;
- }
- E_FREE_LIST(bd->pending_move_resize, free);
-
- if (bd->shade.anim) ecore_animator_del(bd->shade.anim);
- if (bd->border_menu) e_menu_deactivate(bd->border_menu);
-
- if (bd->border_locks_dialog)
- {
- e_object_del(E_OBJECT(bd->border_locks_dialog));
- bd->border_locks_dialog = NULL;
- }
- if (bd->border_remember_dialog)
- {
- e_object_del(E_OBJECT(bd->border_remember_dialog));
- bd->border_remember_dialog = NULL;
- }
- if (bd->border_border_dialog)
- {
- e_object_del(E_OBJECT(bd->border_border_dialog));
- bd->border_border_dialog = NULL;
- }
- if (bd->border_prop_dialog)
- {
- e_object_del(E_OBJECT(bd->border_prop_dialog));
- bd->border_prop_dialog = NULL;
- }
-
- e_int_border_menu_del(bd);
-
- if (focusing == bd)
- focusing = NULL;
-
- focus_next = eina_list_remove(focus_next, bd);
-
- if ((focused == bd) ||
- (e_grabinput_last_focus_win_get() == bd->client.win))
- {
- if ((!focus_next) && (!focusing))
- {
- e_grabinput_focus(bd->zone->container->bg_win,
- E_FOCUS_METHOD_PASSIVE);
- e_hints_active_window_set(bd->zone->container->manager, NULL);
- }
-
- focused = NULL;
- }
- if (bd->remember)
- {
- E_Remember *rem;
-
- rem = bd->remember;
- bd->remember = NULL;
- e_remember_unuse(rem);
- }
- if (!bd->already_unparented)
- {
- ecore_x_window_reparent(bd->client.win, bd->zone->container->manager->root,
- bd->x + bd->client_inset.l, bd->y + bd->client_inset.t);
- ecore_x_window_save_set_del(bd->client.win);
- bd->already_unparented = 1;
- }
- if (bd->group) eina_list_free(bd->group);
- bd->group = NULL;
- if (bd->transients) eina_list_free(bd->transients);
- bd->transients = NULL;
- if (bd->stick_desks) eina_list_free(bd->stick_desks);
- bd->stick_desks = NULL;
- if (bd->client.netwm.icons)
- {
- int i;
- for (i = 0; i < bd->client.netwm.num_icons; i++)
- free(bd->client.netwm.icons[i].data);
- free(bd->client.netwm.icons);
- bd->client.netwm.icons = NULL;
- }
- free(bd->client.netwm.extra_types);
- bd->client.netwm.extra_types = NULL;
- if (bd->client.border.name)
- eina_stringshare_del(bd->client.border.name);
- bd->client.border.name = NULL;
- if (bd->bordername)
- eina_stringshare_del(bd->bordername);
- bd->bordername = NULL;
- if (bd->client.icccm.name)
- eina_stringshare_del(bd->client.icccm.name);
- bd->client.icccm.name = NULL;
- if (bd->client.icccm.class)
- {
- if (bd->client.hacks.mapping_change)
- e_bindings_mapping_change_enable(EINA_TRUE);
- eina_stringshare_del(bd->client.icccm.class);
- bd->client.icccm.class = NULL;
- }
- if (bd->client.icccm.title)
- eina_stringshare_del(bd->client.icccm.title);
- bd->client.icccm.title = NULL;
- if (bd->client.icccm.icon_name)
- eina_stringshare_del(bd->client.icccm.icon_name);
- bd->client.icccm.icon_name = NULL;
- if (bd->client.icccm.machine)
- eina_stringshare_del(bd->client.icccm.machine);
- bd->client.icccm.machine = NULL;
- if (bd->client.icccm.window_role)
- eina_stringshare_del(bd->client.icccm.window_role);
- bd->client.icccm.window_role = NULL;
-
- if ((bd->client.icccm.command.argc > 0) && (bd->client.icccm.command.argv))
- {
- int i;
-
- for (i = 0; i < bd->client.icccm.command.argc; i++)
- free(bd->client.icccm.command.argv[i]);
- free(bd->client.icccm.command.argv);
- bd->client.icccm.command.argv = NULL;
- }
- if (bd->client.netwm.name)
- eina_stringshare_del(bd->client.netwm.name);
- bd->client.netwm.name = NULL;
- if (bd->client.netwm.icon_name)
- eina_stringshare_del(bd->client.netwm.icon_name);
- bd->client.netwm.icon_name = NULL;
- if (bd->shape) e_object_del(E_OBJECT(bd->shape));
- bd->shape = NULL;
- if (bd->internal_icon) eina_stringshare_del(bd->internal_icon);
- bd->internal_icon = NULL;
- if (bd->internal_icon_key) eina_stringshare_del(bd->internal_icon_key);
- bd->internal_icon_key = NULL;
- if (bd->icon_object) evas_object_del(bd->icon_object);
- bd->icon_object = NULL;
- evas_object_del(bd->bg_object);
- bd->bg_object = NULL;
- e_focus_setdown(bd);
- e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- eina_hash_del(borders_hash, e_util_winid_str_get(bd->client.win), bd);
- eina_hash_del(borders_hash, e_util_winid_str_get(bd->win), bd);
- ecore_x_window_free(bd->win);
- bd->win = 0;
-
- borders = eina_list_remove(borders, bd);
- focus_stack = eina_list_remove(focus_stack, bd);
- raise_stack = eina_list_remove(raise_stack, bd);
-
- e_container_border_remove(bd);
- free(bd);
-}
-
-/*
- static int
- _e_border_del_dangling_ref_check(void *data)
- {
- E_Border *bd;
-
- bd = data;
- printf("---\n");
- printf("EEK EEK border still around 1 second after being deleted!\n");
- printf("%p, %i, \"%s\" [\"%s\" \"%s\"]\n",
- bd, e_object_ref_get(E_OBJECT(bd)), bd->client.icccm.title,
- bd->client.icccm.name, bd->client.icccm.class);
- // e_object_breadcrumb_debug(E_OBJECT(bd));
- printf("---\n");
- return 1;
- }
- */
-
-static void
-_e_border_shadow(E_Border *bd)
-{
- if (!bd->bg_object) return;
- if (e_util_border_shadow_state_get(bd))
- edje_object_signal_emit(bd->bg_object, "e,state,shadow,on", "e");
- else
- edje_object_signal_emit(bd->bg_object, "e,state,shadow,off", "e");
-}
-
-static void
-_e_border_del(E_Border *bd)
-{
- E_Event_Border_Remove *ev;
- E_Border *child;
-
- if (bd == focused)
- {
- focused = NULL;
- }
-
- if (bd == focusing)
- focusing = NULL;
-
- focus_next = eina_list_remove(focus_next, bd);
- bd->changed = 0;
-
- if (bd->exe_inst)
- {
- if (bd->exe_inst->phony && (eina_list_count(bd->exe_inst->borders) == 1))
- e_exec_phony_del(bd->exe_inst);
- else
- bd->exe_inst->borders = eina_list_remove(bd->exe_inst->borders, bd);
- bd->exe_inst = NULL;
- }
-
- if (bd->fullscreen) bd->desk->fullscreen_borders--;
-
- if (bd->cur_mouse_action)
- {
- if (bd->cur_mouse_action->func.end)
- bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
- }
- if (action_border == bd) _e_border_action_finish();
- e_pointer_type_pop(e_comp_get(bd)->pointer, bd, NULL);
-
- if (warp_timer_border == bd)
- {
- if (warp_timer) ecore_timer_del(warp_timer);
- warp_timer = NULL;
- warp_timer_border = NULL;
- e_border_focus_lock_set(EINA_FALSE);
- }
-
- if ((drag_border) && (drag_border->data == bd))
- {
- e_object_del(E_OBJECT(drag_border));
- drag_border = NULL;
- }
- if (bd->border_menu) e_menu_deactivate(bd->border_menu);
-
- if (bd->border_locks_dialog)
- {
- e_object_del(E_OBJECT(bd->border_locks_dialog));
- bd->border_locks_dialog = NULL;
- }
- if (bd->border_remember_dialog)
- {
- e_object_del(E_OBJECT(bd->border_remember_dialog));
- bd->border_remember_dialog = NULL;
- }
- if (bd->border_border_dialog)
- {
- e_object_del(E_OBJECT(bd->border_border_dialog));
- bd->border_border_dialog = NULL;
- }
- if (bd->border_prop_dialog)
- {
- e_object_del(E_OBJECT(bd->border_prop_dialog));
- bd->border_prop_dialog = NULL;
- }
-
- e_int_border_menu_del(bd);
-
- if (bd->raise_timer)
- {
- ecore_timer_del(bd->raise_timer);
- bd->raise_timer = NULL;
- }
- if ((!bd->already_unparented) && (!bd->destroyed))
- {
- ecore_x_window_reparent(bd->client.win,
- bd->zone->container->manager->root,
- bd->x + bd->client_inset.l,
- bd->y + bd->client_inset.t);
- ecore_x_window_save_set_del(bd->client.win);
-// bd->client.win = 0;
- }
- bd->already_unparented = 1;
-
- if ((!bd->new_client) && (!stopping))
- {
- ev = E_NEW(E_Event_Border_Remove, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_remove_event");
- ecore_event_add(E_EVENT_BORDER_REMOVE, ev, _e_border_event_border_remove_free, NULL);
- }
-
- if (bd->parent)
- {
- bd->parent->transients = eina_list_remove(bd->parent->transients, bd);
- if (bd->parent->modal == bd)
- {
- if (bd->parent->client.lock_win)
- {
- eina_hash_del_by_key(borders_hash, e_util_winid_str_get(bd->parent->client.lock_win));
- ecore_x_window_hide(bd->parent->client.lock_win);
- ecore_x_window_free(bd->parent->client.lock_win);
- bd->parent->client.lock_win = 0;
- }
- bd->parent->lock_close = 0;
- bd->parent->modal = NULL;
- }
- bd->parent = NULL;
- }
- EINA_LIST_FREE(bd->transients, child)
- {
- child->parent = NULL;
- }
-
- if (bd->leader)
- {
- bd->leader->group = eina_list_remove(bd->leader->group, bd);
- if (bd->leader->modal == bd)
- bd->leader->modal = NULL;
- bd->leader = NULL;
- }
- EINA_LIST_FREE(bd->group, child)
- {
- child->leader = NULL;
- }
-}
-
-#ifdef PRINT_LOTS_OF_DEBUG
-static void
-_e_border_print(E_Border *bd,
- const char *func)
-{
- if (!bd) return;
-
- DBG("*Window Info*"
- "\tPointer: %p\n"
- "\tName: %s\n"
- "\tTitle: %s\n"
- "\tBorderless: %s\n",
- bd, bd->client.icccm.name, bd->client.icccm.title,
- bd->borderless ? "TRUE" : "FALSE");
-}
-
-#endif
-
-static Eina_Bool
-_e_border_cb_window_show_request(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Show_Request *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
- if (bd->iconic)
- {
- if (!bd->lock_client_iconify)
- e_border_uniconify(bd);
- }
- else
- {
- /* FIXME: make border "urgent" for a bit - it wants attention */
-/* e_border_show(bd); */
- if (!bd->lock_client_stacking)
- e_border_raise(bd);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_destroy(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Destroy *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
- bd->destroyed = 1;
- e_object_del(E_OBJECT(bd));
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_hide(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd = NULL;
- Ecore_X_Event_Window_Hide *e;
-
- e = ev;
-// printf("HIDE: %x, event %x send: %i\n", e->win, e->event_win, e->send_event);
-// not interested in hide events from windows other than the window in question
- if (e->win != e->event_win)
- {
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
- if (!e->send_event) return ECORE_CALLBACK_PASS_ON;
- else
- {
- if (bd->zone->container->manager->root != e->event_win)
- return ECORE_CALLBACK_PASS_ON;
- }
-#else
- return ECORE_CALLBACK_PASS_ON;
-#endif
- }
- if (!bd) bd = e_border_find_by_client_window(e->win);
-// printf(" bd = %p\n", bd);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-// printf(" bd->ignore_first_unmap = %i\n", bd->ignore_first_unmap);
- if (bd->ignore_first_unmap > 0)
- {
- bd->ignore_first_unmap--;
- return ECORE_CALLBACK_PASS_ON;
- }
- /* Don't delete hidden or iconified windows */
- if ((bd->iconic) || (bd->await_hide_event > 0))
- {
-// printf(" Don't delete hidden or iconified windows\n");
-// printf(" bd->iconic = %i, bd->visible = %i, bd->new_client = %i, bd->await_hide_event = %i\n",
-// bd->iconic, bd->visible, bd->new_client, bd->await_hide_event);
- if (bd->await_hide_event > 0)
- {
- bd->await_hide_event--;
- }
- else
- {
-// printf(" hide really\n");
- /* Only hide the border if it is visible */
- if (bd->visible) e_border_hide(bd, 1);
- }
- }
- else
- {
-// printf(" hide2\n");
-
- e_border_hide(bd, 0);
- e_object_del(E_OBJECT(bd));
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_reparent(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev __UNUSED__)
-{
-#if 0
- E_Border *bd;
- Ecore_X_Event_Window_Reparent *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return 1;
- if (e->parent == bd->win) return 1;
- if (ecore_x_window_parent_get(e->win) == bd->win)
- {
- return 1;
- }
- e_border_hide(bd, 0);
- e_object_del(E_OBJECT(bd));
-#endif
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_configure_request(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Configure_Request *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd)
- {
- if (e_stolen_win_get(e->win)) return ECORE_CALLBACK_PASS_ON;
- if (!e_util_container_window_find(e->win))
- ecore_x_window_configure(e->win, e->value_mask,
- e->x, e->y, e->w, e->h, e->border,
- e->abovewin, e->detail);
- return ECORE_CALLBACK_PASS_ON;
- }
-
- if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_X) ||
- (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_Y))
- {
- int x, y;
- int zx = 0, zy = 0, zw = 0, zh = 0;
-
- x = bd->x;
- y = bd->y;
-
- e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
- if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_X)
- {
- /* ignore moves (usually from wine clients)
- * which would cause the window to jump
- * by the size of the frame
- */
- if (bd->x + bd->client_inset.l == e->x)
- x = bd->x;
- else if (e_config->screen_limits == E_SCREEN_LIMITS_WITHIN)
- x = E_CLAMP(e->x, zx, zx + zw - bd->w);
- else
- x = e->x;
- }
- if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_Y)
- {
- /* ignore moves (usually from wine clients)
- * which would cause the window to jump
- * by the size of the frame
- */
- if (bd->y + bd->client_inset.t == e->y)
- y = bd->y;
- else if (e_config->screen_limits == E_SCREEN_LIMITS_WITHIN)
- y = E_CLAMP(e->y, zy, zy + zh - bd->h);
- else
- y = e->y;
- }
- if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W) ||
- (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H))
- {
- int w, h;
-
- h = bd->h;
- w = bd->w;
- if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W)
- w = e->w + e_border_inset_width_get(bd);
- if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H)
- h = e->h + e_border_inset_height_get(bd);
- if ((!bd->lock_client_location) && (!bd->lock_client_size))
- {
- if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
- {
- bd->saved.x = x - bd->zone->x;
- bd->saved.y = y - bd->zone->y;
- bd->saved.w = w;
- bd->saved.h = h;
- }
- else
- e_border_move_resize(bd, x, y, w, h);
- }
- else if (!bd->lock_client_location)
- {
- if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
- {
- bd->saved.x = x - bd->zone->x;
- bd->saved.y = y - bd->zone->y;
- }
- else
- e_border_move(bd, x, y);
- }
- else if (!bd->lock_client_size)
- {
- if ((bd->shaded) || (bd->shading))
- {
- int pw, ph;
-
- pw = bd->client.w;
- ph = bd->client.h;
- if ((bd->shade.dir == E_DIRECTION_UP) ||
- (bd->shade.dir == E_DIRECTION_DOWN))
- {
- e_border_resize(bd, w, bd->h);
- bd->client.h = ph;
- }
- else
- {
- e_border_resize(bd, bd->w, h);
- bd->client.w = pw;
- }
- }
- else
- {
- if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
- {
- bd->saved.w = w;
- bd->saved.h = h;
- }
- else
- e_border_resize(bd, w, h);
- }
- }
- }
- else
- {
- if (!bd->lock_client_location)
- {
- if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
- {
- bd->saved.x = x - bd->zone->x;
- bd->saved.y = y - bd->zone->y;
- }
- else
- {
- if ((e_config->screen_limits != E_SCREEN_LIMITS_COMPLETELY) && bd->zone &&
- (!E_INSIDE(x, y, 0, 0, bd->zone->w - 5, bd->zone->h - 5)) &&
- (!E_INSIDE(x, y, 0 - bd->w + 5, 0 - bd->h + 5, bd->zone->w - 5, bd->zone->h - 5))
- )
- _e_border_move_lost_window_to_center(bd);
- else
- e_border_move(bd, x, y);
- }
- }
- }
- }
- else if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W) ||
- (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H))
- {
- int w, h;
-
- h = bd->h;
- w = bd->w;
- if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W)
- w = e->w + e_border_inset_width_get(bd);
- if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H)
- h = e->h + e_border_inset_height_get(bd);
- if (!bd->lock_client_size)
- {
- if ((bd->shaded) || (bd->shading))
- {
- int pw, ph;
-
- pw = bd->client.w;
- ph = bd->client.h;
- if ((bd->shade.dir == E_DIRECTION_UP) ||
- (bd->shade.dir == E_DIRECTION_DOWN))
- {
- e_border_resize(bd, w, bd->h);
- bd->client.h = ph;
- }
- else
- {
- e_border_resize(bd, bd->w, h);
- bd->client.w = pw;
- }
- }
- else
- {
- if ((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_NONE)
- {
- int zx, zy, zw, zh;
- zx = zy = zw = zh = 0;
-
- /*
- * This code does resize and move a window on a
- * X configure request into an useful geometry.
- * This is really useful for size jumping file dialogs.
- */
- e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
-
- if (e_config->geometry_auto_resize_limit == 1)
- {
- if (w > zw)
- w = zw;
-
- if (h > zh)
- h = zh;
- }
- e_border_resize(bd, w, h);
- }
- }
- /* note: we USED to forcibly apply a window placement policy here
- * this is WRONG. the geometry_auto_move option is ONLY for
- * new clients, in which case we will autocorrect the positioning anyway.
- */
- }
- }
- if (!bd->lock_client_stacking)
- {
- if ((e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE) &&
- (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING))
- {
- E_Border *obd;
-
- if (e->detail == ECORE_X_WINDOW_STACK_ABOVE)
- {
- obd = e_border_find_by_client_window(e->abovewin);
- if (obd)
- {
- e_border_stack_above(bd, obd);
- }
- else
- {
- ecore_x_window_configure(bd->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- e->abovewin, ECORE_X_WINDOW_STACK_ABOVE);
- /* FIXME: need to rebuiuld border list from current stacking */
- }
- }
- else if (e->detail == ECORE_X_WINDOW_STACK_BELOW)
- {
- obd = e_border_find_by_client_window(e->abovewin);
- if (obd)
- {
- e_border_stack_below(bd, obd);
- }
- else
- {
- ecore_x_window_configure(bd->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- e->abovewin, ECORE_X_WINDOW_STACK_BELOW);
- /* FIXME: need to rebuiuld border list from current stacking */
- }
- }
- else if (e->detail == ECORE_X_WINDOW_STACK_TOP_IF)
- {
- /* FIXME: do */
- }
- else if (e->detail == ECORE_X_WINDOW_STACK_BOTTOM_IF)
- {
- /* FIXME: do */
- }
- else if (e->detail == ECORE_X_WINDOW_STACK_OPPOSITE)
- {
- /* FIXME: do */
- }
- }
- else if (e->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE)
- {
- if (e->detail == ECORE_X_WINDOW_STACK_ABOVE)
- {
- e_border_raise(bd);
- }
- else if (e->detail == ECORE_X_WINDOW_STACK_BELOW)
- {
- e_border_lower(bd);
- }
- else if (e->detail == ECORE_X_WINDOW_STACK_TOP_IF)
- {
- /* FIXME: do */
- }
- else if (e->detail == ECORE_X_WINDOW_STACK_BOTTOM_IF)
- {
- /* FIXME: do */
- }
- else if (e->detail == ECORE_X_WINDOW_STACK_OPPOSITE)
- {
- /* FIXME: do */
- }
- }
- }
-
- /* FIXME: need to send synthetic stacking event too as well as move/resize */
- _e_border_client_move_resize_send(bd);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_resize_request(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Resize_Request *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd)
- {
- if (e_stolen_win_get(e->win)) return ECORE_CALLBACK_PASS_ON;
- ecore_x_window_resize(e->win, e->w, e->h);
- return ECORE_CALLBACK_PASS_ON;
- }
- {
- int w, h;
-
- w = e->w + e_border_inset_width_get(bd);
- h = e->h + e_border_inset_height_get(bd);
- if ((bd->shaded) || (bd->shading))
- {
- int pw, ph;
-
- pw = bd->client.w;
- ph = bd->client.h;
- if ((bd->shade.dir == E_DIRECTION_UP) ||
- (bd->shade.dir == E_DIRECTION_DOWN))
- {
- e_border_resize(bd, w, bd->h);
- bd->client.h = ph;
- }
- else
- {
- e_border_resize(bd, bd->w, h);
- bd->client.w = pw;
- }
- }
- else
- e_border_resize(bd, w, h);
- }
-
- _e_border_client_move_resize_send(bd);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_gravity(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev __UNUSED__)
-{
-// E_Border *bd;
-// Ecore_X_Event_Window_Gravity *e;
-
-// e = ev;
-// bd = e_border_find_by_client_window(e->win);
-// if (!bd) return 1;
- return 1;
-}
-
-static Eina_Bool
-_e_border_cb_window_stack_request(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Stack_Request *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd)
- {
- if (e_stolen_win_get(e->win)) return ECORE_CALLBACK_PASS_ON;
- if (!e_util_container_window_find(e->win))
- {
- if (e->detail == ECORE_X_WINDOW_STACK_ABOVE)
- ecore_x_window_raise(e->win);
- else if (e->detail == ECORE_X_WINDOW_STACK_BELOW)
- ecore_x_window_lower(e->win);
- }
- return ECORE_CALLBACK_PASS_ON;
- }
- if (e->detail == ECORE_X_WINDOW_STACK_ABOVE)
- e_border_raise(bd);
- else if (e->detail == ECORE_X_WINDOW_STACK_BELOW)
- e_border_lower(bd);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_property(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Property *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-
- if (e->atom == ECORE_X_ATOM_WM_NAME)
- {
- if ((!bd->client.netwm.name) &&
- (!bd->client.netwm.fetch.name))
- {
- bd->client.icccm.fetch.title = 1;
- BD_CHANGED(bd);
- }
- }
- else if (e->atom == ECORE_X_ATOM_NET_WM_NAME)
- {
- bd->client.netwm.fetch.name = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_WM_CLASS)
- {
- bd->client.icccm.fetch.name_class = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_WM_ICON_NAME)
- {
- if ((!bd->client.netwm.icon_name) &&
- (!bd->client.netwm.fetch.icon_name))
- {
- bd->client.icccm.fetch.icon_name = 1;
- BD_CHANGED(bd);
- }
- }
- else if (e->atom == ECORE_X_ATOM_NET_WM_ICON_NAME)
- {
- bd->client.netwm.fetch.icon_name = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_WM_CLIENT_MACHINE)
- {
- bd->client.icccm.fetch.machine = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_WM_PROTOCOLS)
- {
- bd->client.icccm.fetch.protocol = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_WM_HINTS)
- {
- bd->client.icccm.fetch.hints = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_WM_NORMAL_HINTS)
- {
- bd->client.icccm.fetch.size_pos_hints = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_MOTIF_WM_HINTS)
- {
- /*
- if ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN) &&
- (!bd->client.netwm.fetch.type))
- {
- */
- bd->client.mwm.fetch.hints = 1;
- BD_CHANGED(bd);
- /*
- }
- */
- }
- else if (e->atom == ECORE_X_ATOM_WM_TRANSIENT_FOR)
- {
- bd->client.icccm.fetch.transient_for = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_WM_CLIENT_LEADER)
- {
- bd->client.icccm.fetch.client_leader = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_WM_WINDOW_ROLE)
- {
- bd->client.icccm.fetch.window_role = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_NET_WM_ICON)
- {
- bd->client.netwm.fetch.icon = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ATM__QTOPIA_SOFT_MENU)
- {
- bd->client.qtopia.fetch.soft_menu = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ATM__QTOPIA_SOFT_MENUS)
- {
- bd->client.qtopia.fetch.soft_menus = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
- {
- bd->client.vkbd.fetch.state = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD)
- {
- bd->client.vkbd.fetch.vkbd = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_CONFORMANT)
- {
- bd->client.illume.conformant.fetch.conformant = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE)
- {
- bd->client.illume.quickpanel.fetch.state = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL)
- {
- bd->client.illume.quickpanel.fetch.quickpanel = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR)
- {
- bd->client.illume.quickpanel.fetch.priority.major = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR)
- {
- bd->client.illume.quickpanel.fetch.priority.minor = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE)
- {
- bd->client.illume.quickpanel.fetch.zone = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED)
- {
- bd->client.illume.drag.fetch.locked = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_DRAG)
- {
- bd->client.illume.drag.fetch.drag = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
- {
- bd->client.illume.win_state.fetch.state = 1;
- BD_CHANGED(bd);
- }
- /*
- else if (e->atom == ECORE_X_ATOM_NET_WM_USER_TIME)
- {
- bd->client.netwm.fetch.user_time = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_NET_WM_STRUT)
- {
- bd->client.netwm.fetch.strut = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL)
- {
- bd->client.netwm.fetch.strut = 1;
- BD_CHANGED(bd);
- }
- */
- else if (e->atom == ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER)
- {
- //printf("ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER\n");
- }
- else if (e->atom == ECORE_X_ATOM_E_VIDEO_POSITION)
- {
- bd->client.e.fetch.video_position = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_VIDEO_PARENT)
- {
- bd->client.e.fetch.video_parent = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_NET_WM_STATE)
- {
- bd->client.netwm.fetch.state = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY)
- {
- if (bd->client.netwm.opacity_changed)
- bd->client.netwm.opacity_changed = 0;
- else
- {
- bd->client.netwm.fetch.opacity = 1;
- BD_CHANGED(bd);
- }
- }
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- else if (e->atom == ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED)
- {
- bd->client.e.fetch.profile = 1;
- BD_CHANGED(bd);
- }
- else if (e->atom == ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST)
- {
- bd->client.e.fetch.profile = 1;
- BD_CHANGED(bd);
- }
-#endif
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_colormap(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Colormap *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_shape(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Shape *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
-
- if (e->type == ECORE_X_SHAPE_INPUT)
- {
- if (bd)
- {
- bd->need_shape_merge = 1;
-// YYY bd->shaped_input = 1;
- bd->changes.shape_input = 1;
- BD_CHANGED(bd);
- }
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- if (bd)
- {
- bd->changes.shape = 1;
- BD_CHANGED(bd);
- return ECORE_CALLBACK_PASS_ON;
- }
- bd = e_border_find_by_window(e->win);
- if (bd)
- {
- bd->need_shape_export = 1;
- BD_CHANGED(bd);
- return ECORE_CALLBACK_PASS_ON;
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_focus_in(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Focus_In *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-
- /* block refocus attempts on iconic windows
- * these result from iconifying a window during a grab */
- if (bd->iconic) return ECORE_CALLBACK_RENEW;
-#ifdef INOUTDEBUG_FOCUS
- {
- time_t t;
- char *ct;
-
- const char *modes[] = {
- "MODE_NORMAL",
- "MODE_WHILE_GRABBED",
- "MODE_GRAB",
- "MODE_UNGRAB"
- };
- const char *details[] = {
- "DETAIL_ANCESTOR",
- "DETAIL_VIRTUAL",
- "DETAIL_INFERIOR",
- "DETAIL_NON_LINEAR",
- "DETAIL_NON_LINEAR_VIRTUAL",
- "DETAIL_POINTER",
- "DETAIL_POINTER_ROOT",
- "DETAIL_DETAIL_NONE"
- };
- t = time(NULL);
- ct = ctime(&t);
- ct[strlen(ct) - 1] = 0;
- DBG("FF ->IN %i 0x%x %s md=%s dt=%s\n",
- e->time,
- e->win,
- ct,
- modes[e->mode],
- details[e->detail]);
-
- DBG("%s cb focus in %d %d\n",
- e_border_name_get(bd),
- bd->client.icccm.accepts_focus,
- bd->client.icccm.take_focus);
- }
-#endif
- _e_border_pri_raise(bd);
- if (e->mode == ECORE_X_EVENT_MODE_GRAB)
- {
- if (e->detail == ECORE_X_EVENT_DETAIL_POINTER) return ECORE_CALLBACK_PASS_ON;
- }
- else if (e->mode == ECORE_X_EVENT_MODE_UNGRAB)
- {
- /* this seems to break winlist...
- if (e->detail == ECORE_X_EVENT_DETAIL_POINTER)
- */
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /* ignore focus in from !take_focus windows, we just gave it em */
- /* if (!bd->client.icccm.take_focus)
- * return ECORE_CALLBACK_PASS_ON; */
-
- /* should be equal, maybe some clients dont reply with the proper timestamp ? */
- if (e->time >= focus_time)
- e_border_focus_set(bd, 1, 0);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_focus_out(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Focus_Out *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-#ifdef INOUTDEBUG_FOCUS
- {
- time_t t;
- char *ct;
-
- const char *modes[] = {
- "MODE_NORMAL",
- "MODE_WHILE_GRABBED",
- "MODE_GRAB",
- "MODE_UNGRAB"
- };
- const char *details[] = {
- "DETAIL_ANCESTOR",
- "DETAIL_VIRTUAL",
- "DETAIL_INFERIOR",
- "DETAIL_NON_LINEAR",
- "DETAIL_NON_LINEAR_VIRTUAL",
- "DETAIL_POINTER",
- "DETAIL_POINTER_ROOT",
- "DETAIL_DETAIL_NONE"
- };
- t = time(NULL);
- ct = ctime(&t);
- ct[strlen(ct) - 1] = 0;
- DBG("FF <-OUT %i 0x%x %s md=%s dt=%s",
- e->time,
- e->win,
- ct,
- modes[e->mode],
- details[e->detail]);
-
- DBG("%s cb focus out %d %d",
- e_border_name_get(bd),
- bd->client.icccm.accepts_focus,
- bd->client.icccm.take_focus);
- }
-#endif
- _e_border_pri_norm(bd);
- if (e->mode == ECORE_X_EVENT_MODE_NORMAL)
- {
- if (e->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
- return ECORE_CALLBACK_PASS_ON;
- else if (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)
- return ECORE_CALLBACK_PASS_ON;
- else if (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL)
- return ECORE_CALLBACK_PASS_ON;
- }
- else if (e->mode == ECORE_X_EVENT_MODE_GRAB)
- {
- if (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)
- return ECORE_CALLBACK_PASS_ON;
- else if (e->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
- return ECORE_CALLBACK_PASS_ON;
- else if (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL)
- return ECORE_CALLBACK_PASS_ON;
- else if (e->detail == ECORE_X_EVENT_DETAIL_ANCESTOR)
- return ECORE_CALLBACK_PASS_ON;
- else if (e->detail == ECORE_X_EVENT_DETAIL_VIRTUAL)
- return ECORE_CALLBACK_PASS_ON;
- }
- else if (e->mode == ECORE_X_EVENT_MODE_UNGRAB)
- {
- /* for firefox/thunderbird (xul) menu walking */
- /* NB: why did i disable this before? */
- if (e->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
- return ECORE_CALLBACK_PASS_ON;
- else if (e->detail == ECORE_X_EVENT_DETAIL_POINTER)
- return ECORE_CALLBACK_PASS_ON;
- }
- else if (e->mode == ECORE_X_EVENT_MODE_WHILE_GRABBED)
- {
- if (e->detail == ECORE_X_EVENT_DETAIL_ANCESTOR)
- return ECORE_CALLBACK_PASS_ON;
- else if (e->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
- return ECORE_CALLBACK_PASS_ON;
- }
- e_border_focus_set(bd, 0, 0);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_client_message(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Client_Message *e = ev;
-
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-
- if (e->message_type == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY)
- {
- bd->client.netwm.fetch.opacity = 1;
- BD_CHANGED(bd);
- }
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- else if (e->message_type == ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE)
- {
- if (bd->client.e.state.profile.use)
- {
- char *profile;
- profile = ecore_x_atom_name_get(e->data.l[1]);
- ecore_x_e_window_profile_change_request_send(bd->client.win,
- profile);
- bd->client.e.state.profile.wait_for_done = 1;
- free(profile);
- }
- }
- else if (e->message_type == ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_DONE)
- {
- if ((bd->client.e.state.profile.use) &&
- (bd->client.e.state.profile.wait_for_done))
- {
- E_Container *con = bd->zone->container;
- E_Desk *desk = NULL;
- char *profile;
-
- profile = ecore_x_atom_name_get(e->data.l[1]);
- if (profile)
- eina_stringshare_replace(&bd->client.e.state.profile.name, profile);
-
- bd->client.e.state.profile.wait_for_done = 0;
-
- if (bd->desk && e_util_strcmp(bd->desk->window_profile, profile))
- {
- desk = e_container_desk_window_profile_get(con, profile);
- if (desk)
- e_border_desk_set(bd, desk);
- }
- free(profile);
- }
- }
-#endif
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_state_request(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_State_Request *e;
- int i;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-
- for (i = 0; i < 2; i++)
- e_hints_window_state_update(bd, e->state[i], e->action);
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_window_move_resize_request(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Window_Move_Resize_Request *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-
- if ((bd->shaded) || (bd->shading) ||
- (bd->fullscreen) || (bd->moving) ||
- (bd->resize_mode != E_POINTER_RESIZE_NONE))
- return ECORE_CALLBACK_PASS_ON;
-
- if ((e->button >= 1) && (e->button <= 3))
- {
- bd->mouse.last_down[e->button - 1].mx = e->x;
- bd->mouse.last_down[e->button - 1].my = e->y;
- bd->mouse.last_down[e->button - 1].x = bd->x;
- bd->mouse.last_down[e->button - 1].y = bd->y;
- bd->mouse.last_down[e->button - 1].w = bd->w;
- bd->mouse.last_down[e->button - 1].h = bd->h;
- }
- else
- {
- bd->moveinfo.down.x = bd->x;
- bd->moveinfo.down.y = bd->y;
- bd->moveinfo.down.w = bd->w;
- bd->moveinfo.down.h = bd->h;
- }
- bd->mouse.current.mx = e->x;
- bd->mouse.current.my = e->y;
- bd->moveinfo.down.button = e->button;
- bd->moveinfo.down.mx = e->x;
- bd->moveinfo.down.my = e->y;
- grabbed = 1;
-
- if (!bd->lock_user_stacking)
- e_border_raise(bd);
-
- if (e->direction == E_POINTER_MOVE)
- {
- bd->cur_mouse_action = e_action_find("window_move");
- if (bd->cur_mouse_action)
- {
- if ((!bd->cur_mouse_action->func.end_mouse) &&
- (!bd->cur_mouse_action->func.end))
- bd->cur_mouse_action = NULL;
- if (bd->cur_mouse_action)
- {
- e_object_ref(E_OBJECT(bd->cur_mouse_action));
- bd->cur_mouse_action->func.go(E_OBJECT(bd), NULL);
- }
- }
- return ECORE_CALLBACK_PASS_ON;
- }
- bd->cur_mouse_action = e_action_find("window_resize");
- if (bd->cur_mouse_action)
- {
- if ((!bd->cur_mouse_action->func.end_mouse) &&
- (!bd->cur_mouse_action->func.end))
- bd->cur_mouse_action = NULL;
- }
- if (!bd->cur_mouse_action) return ECORE_CALLBACK_RENEW;
-
- e_object_ref(E_OBJECT(bd->cur_mouse_action));
- bd->cur_mouse_action->func.go(E_OBJECT(bd), NULL);
- switch (e->direction)
- {
- case E_POINTER_RESIZE_TL:
- bd->resize_mode = E_POINTER_RESIZE_TL;
- GRAV_SET(bd, ECORE_X_GRAVITY_SE);
- break;
-
- case E_POINTER_RESIZE_T:
- bd->resize_mode = E_POINTER_RESIZE_T;
- GRAV_SET(bd, ECORE_X_GRAVITY_S);
- break;
-
- case E_POINTER_RESIZE_TR:
- bd->resize_mode = E_POINTER_RESIZE_TR;
- GRAV_SET(bd, ECORE_X_GRAVITY_SW);
- break;
-
- case E_POINTER_RESIZE_R:
- bd->resize_mode = E_POINTER_RESIZE_R;
- GRAV_SET(bd, ECORE_X_GRAVITY_W);
- break;
-
- case E_POINTER_RESIZE_BR:
- bd->resize_mode = E_POINTER_RESIZE_BR;
- GRAV_SET(bd, ECORE_X_GRAVITY_NW);
- break;
-
- case E_POINTER_RESIZE_B:
- bd->resize_mode = E_POINTER_RESIZE_B;
- GRAV_SET(bd, ECORE_X_GRAVITY_N);
- break;
-
- case E_POINTER_RESIZE_BL:
- bd->resize_mode = E_POINTER_RESIZE_BL;
- GRAV_SET(bd, ECORE_X_GRAVITY_NE);
- break;
-
- case E_POINTER_RESIZE_L:
- bd->resize_mode = E_POINTER_RESIZE_L;
- GRAV_SET(bd, ECORE_X_GRAVITY_E);
- break;
-
- default:
- return ECORE_CALLBACK_PASS_ON;
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_desktop_change(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Desktop_Change *e;
-
- e = ev;
- bd = e_border_find_by_client_window(e->win);
- if (bd)
- {
- if (e->desk == 0xffffffff)
- e_border_stick(bd);
- else if ((int)e->desk < (bd->zone->desk_x_count * bd->zone->desk_y_count))
- {
- E_Desk *desk;
-
- desk = e_desk_at_pos_get(bd->zone, e->desk);
- if (desk)
- e_border_desk_set(bd, desk);
- }
- }
- else
- {
- ecore_x_netwm_desktop_set(e->win, e->desk);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_sync_alarm(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Border *bd;
- Ecore_X_Event_Sync_Alarm *e;
- unsigned int serial;
-
- e = ev;
- bd = e_border_find_by_alarm(e->alarm);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-
- if (bd->client.netwm.sync.wait)
- bd->client.netwm.sync.wait--;
-
- if (ecore_x_sync_counter_query(bd->client.netwm.sync.counter, &serial))
- {
- E_Border_Pending_Move_Resize *pnd = NULL;
-
- /* skip pending for which we didn't get a reply */
- while (bd->pending_move_resize)
- {
- pnd = bd->pending_move_resize->data;
- bd->pending_move_resize = eina_list_remove(bd->pending_move_resize, pnd);
-
- if (serial == pnd->serial)
- break;
-
- E_FREE(pnd);
- }
-
- if (pnd)
- {
- bd->x = pnd->x;
- bd->y = pnd->y;
- bd->w = pnd->w;
- bd->h = pnd->h;
- bd->client.w = bd->w - (e_border_inset_width_get(bd));
- bd->client.h = bd->h - (e_border_inset_height_get(bd));
- E_FREE(pnd);
- }
- }
-
- bd->changes.size = 1;
- bd->changes.pos = 1;
-
- _e_border_eval(bd);
-
- ecore_x_pointer_xy_get(e_manager_current_get()->root,
- &bd->mouse.current.mx,
- &bd->mouse.current.my);
-
- bd->client.netwm.sync.send_time = ecore_loop_time_get();
- _e_border_resize_handle(bd);
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_efreet_cache_update(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev __UNUSED__)
-{
- Eina_List *l;
- E_Border *bd;
-
- /* mark all borders for desktop/icon updates */
- EINA_LIST_FOREACH(borders, l, bd)
- {
- if (e_object_is_del(E_OBJECT(bd))) continue;
- if (bd->desktop)
- {
- efreet_desktop_free(bd->desktop);
- bd->desktop = NULL;
- }
- bd->changes.icon = 1;
- BD_CHANGED(bd);
- }
- /*
- e_init_status_set(_("Desktop files scan done"));
- e_init_done();
- */
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_config_icon_theme(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev __UNUSED__)
-{
- Eina_List *l;
- E_Border *bd;
-
- /* mark all borders for desktop/icon updates */
- EINA_LIST_FOREACH(borders, l, bd)
- {
- bd->changes.icon = 1;
- BD_CHANGED(bd);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_config_mode(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev __UNUSED__)
-{
- Eina_List *l;
- E_Border *bd;
-
- /* move fullscreen borders above everything */
- if (e_config->mode.presentation)
- {
- EINA_LIST_FOREACH(borders, l, bd)
- {
- if ((bd->fullscreen) || (bd->need_fullscreen))
- {
- bd->fullscreen = 0;
- e_border_layer_set(bd, E_LAYER_TOP);
- bd->fullscreen = 1;
- }
- }
- }
- else if (!e_config->allow_above_fullscreen)
- {
- EINA_LIST_FOREACH(borders, l, bd)
- {
- if ((bd->fullscreen) || (bd->need_fullscreen))
- {
- bd->fullscreen = 0;
- e_border_layer_set(bd, E_LAYER_FULLSCREEN);
- bd->fullscreen = 1;
- }
- }
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_border_cb_pointer_warp(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev)
-{
- E_Event_Pointer_Warp *e;
-
- e = ev;
- if (!bdmove) return ECORE_CALLBACK_PASS_ON;
- e_border_move(bdmove, bdmove->x + (e->curr.x - e->prev.x), bdmove->y + (e->curr.y - e->prev.y));
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_e_border_cb_signal_bind(void *data,
- Evas_Object *obj __UNUSED__,
- const char *emission,
- const char *source)
-{
- E_Border *bd;
-
- bd = data;
- if (e_dnd_active() || e_object_is_del(E_OBJECT(bd))) return;
- e_bindings_signal_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(bd),
- emission, source);
-}
-
-static void
-_e_border_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- Evas_Event_Mouse_In *ev = event_info;
- E_Border *bd = data;
-
- if (grabbed) return;
- if (focus_locked && (bd != warp_timer_border)) return;
- if (e_object_is_del(E_OBJECT(bd))) return;
- if (bd->desk && bd->desk->animate_count) return;
- bd->mouse.current.mx = ev->output.x;
- bd->mouse.current.my = ev->output.y;
- if (!bd->iconic)
- e_focus_event_mouse_in(bd);
-}
-
-static Eina_Bool
-_e_border_cb_mouse_x_in(void *data EINA_UNUSED, int t EINA_UNUSED, Ecore_X_Event_Mouse_In *ev)
-{
- E_Border *bd;
-
- if (grabbed) return ECORE_CALLBACK_RENEW;
- bd = e_border_find_by_window(ev->event_win);
- if (!bd) return ECORE_CALLBACK_RENEW;
- if (bd->input_object) return ECORE_CALLBACK_RENEW;
- if (focus_locked && (bd != warp_timer_border)) return ECORE_CALLBACK_RENEW;
- if (e_object_is_del(E_OBJECT(bd))) return ECORE_CALLBACK_RENEW;
- if (bd->desk && bd->desk->animate_count) return ECORE_CALLBACK_RENEW;
- bd->mouse.current.mx = ev->root.x;
- bd->mouse.current.my = ev->root.y;
- if (!bd->iconic)
- e_focus_event_mouse_in(bd);
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_e_border_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- Evas_Event_Mouse_Out *ev = event_info;
- E_Border *bd = data;
-
- if (grabbed) return;
- if (bd->fullscreen) return;
- if ((bd != focused) && (bd == focusing)) return;
- if (e_object_is_del(E_OBJECT(bd))) return;
- if (bd->desk && bd->desk->animate_count) return;
- if (!bd->input_object)
- if (E_INSIDE(ev->output.x, ev->output.y, bd->x, bd->y, bd->w, bd->h)) return;
- bd->mouse.current.mx = ev->output.x;
- bd->mouse.current.my = ev->output.y;
- if (!bd->iconic)
- e_focus_event_mouse_out(bd);
-}
-
-static Eina_Bool
-_e_border_cb_mouse_x_out(void *data EINA_UNUSED, int t EINA_UNUSED, Ecore_X_Event_Mouse_Out *ev)
-{
- E_Border *bd;
-
- if (grabbed) return ECORE_CALLBACK_RENEW;
- bd = e_border_find_by_window(ev->event_win);
- if (!bd) return ECORE_CALLBACK_RENEW;
- if (bd->input_object) return ECORE_CALLBACK_RENEW;
- if (bd->fullscreen) return ECORE_CALLBACK_RENEW;
- if ((bd != focused) && (bd == focusing)) return ECORE_CALLBACK_RENEW;
- if (e_object_is_del(E_OBJECT(bd))) return ECORE_CALLBACK_RENEW;
- if (bd->desk && bd->desk->animate_count) return ECORE_CALLBACK_RENEW;
- if (E_INSIDE(ev->root.x, ev->root.y, bd->x, bd->y, bd->w, bd->h)) return ECORE_CALLBACK_RENEW;
- if ((ev->mode == ECORE_X_EVENT_MODE_UNGRAB) &&
- (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR))
- return ECORE_CALLBACK_PASS_ON;
- if (ev->mode == ECORE_X_EVENT_MODE_GRAB)
- return ECORE_CALLBACK_PASS_ON;
- if ((ev->mode == ECORE_X_EVENT_MODE_NORMAL) &&
- (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR))
- return ECORE_CALLBACK_PASS_ON;
- bd->mouse.current.mx = ev->root.x;
- bd->mouse.current.my = ev->root.y;
- if (!bd->iconic)
- e_focus_event_mouse_out(bd);
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_e_border_cb_mouse_wheel_helper(E_Border *bd, Evas_Point *output, E_Binding_Event_Wheel *ev)
-{
- bd->mouse.current.mx = output->x;
- bd->mouse.current.my = output->y;
- if (!bd->cur_mouse_action)
- {
- e_bindings_wheel_event_handle(E_BINDING_CONTEXT_WINDOW,
- E_OBJECT(bd), ev);
- }
-}
-
-static Eina_Bool
-_e_border_cb_mouse_x_wheel(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Wheel *ev)
-{
- E_Border *bd;
- E_Binding_Event_Wheel ev2;
-
- if (action_border)
- bd = action_border;
- else
- {
- bd = e_border_find_by_client_window(ev->window);
- if (!bd) bd = e_border_find_by_window(ev->window);
- if (!bd) return ECORE_CALLBACK_RENEW;
- /* event_window here should be bd->win if it isn't the same as window, not sure if this can NOT happen */
- if ((ev->window != ev->event_window) && (bd->win != ev->event_window) && (bd->client.lock_win != ev->event_window))
- return ECORE_CALLBACK_RENEW;
- }
- e_bindings_ecore_event_mouse_wheel_convert(ev, &ev2);
- _e_border_cb_mouse_wheel_helper(bd, (Evas_Point*)&ev->root, &ev2);
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_e_border_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- Evas_Event_Mouse_Wheel *ev = event_info;
- E_Border *bd = data;
- E_Binding_Event_Wheel ev2;
-
- if (action_border) return; // already existing border doing something
- e_bindings_evas_event_mouse_wheel_convert(ev, &ev2);
- _e_border_cb_mouse_wheel_helper(bd, &ev->output, &ev2);
-}
-
-static void
-_e_border_cb_mouse_down_helper(E_Border *bd, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev)
-{
- if ((button >= 1) && (button <= 3))
- {
- bd->mouse.last_down[button - 1].mx = output->x;
- bd->mouse.last_down[button - 1].my = output->y;
- bd->mouse.last_down[button - 1].x = bd->x;
- bd->mouse.last_down[button - 1].y = bd->y;
- bd->mouse.last_down[button - 1].w = bd->w;
- bd->mouse.last_down[button - 1].h = bd->h;
- }
- else
- {
- bd->moveinfo.down.x = bd->x;
- bd->moveinfo.down.y = bd->y;
- bd->moveinfo.down.w = bd->w;
- bd->moveinfo.down.h = bd->h;
- }
- bd->mouse.current.mx = output->x;
- bd->mouse.current.my = output->y;
- if (!bd->cur_mouse_action)
- {
- bd->cur_mouse_action =
- e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_WINDOW,
- E_OBJECT(bd), ev);
- if (bd->cur_mouse_action)
- {
- if ((!bd->cur_mouse_action->func.end_mouse) &&
- (!bd->cur_mouse_action->func.end))
- bd->cur_mouse_action = NULL;
- if (bd->cur_mouse_action)
- e_object_ref(E_OBJECT(bd->cur_mouse_action));
- }
- }
- e_focus_event_mouse_down(bd);
- if ((button >= 1) && (button <= 3))
- {
- bd->mouse.last_down[button - 1].mx = output->x;
- bd->mouse.last_down[button - 1].my = output->y;
- bd->mouse.last_down[button - 1].x = bd->x;
- bd->mouse.last_down[button - 1].y = bd->y;
- bd->mouse.last_down[button - 1].w = bd->w;
- bd->mouse.last_down[button - 1].h = bd->h;
- }
- else
- {
- bd->moveinfo.down.x = bd->x;
- bd->moveinfo.down.y = bd->y;
- bd->moveinfo.down.w = bd->w;
- bd->moveinfo.down.h = bd->h;
- }
- bd->mouse.current.mx = output->x;
- bd->mouse.current.my = output->y;
-/*
- if (bd->moving)
- {
- }
- else if (bd->resize_mode != E_POINTER_RESIZE_NONE)
- {
- }
- else
- */
-}
-
-static Eina_Bool
-_e_border_cb_mouse_x_down(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev)
-{
- E_Border *bd;
- E_Binding_Event_Mouse_Button ev2;
-
- if (action_border)
- bd = action_border;
- else
- {
- bd = e_border_find_by_client_window(ev->window);
- if (!bd) bd = e_border_find_by_window(ev->window);
- if (!bd) return ECORE_CALLBACK_RENEW;
- /* event_window here should be bd->win if it isn't the same as window, not sure if this can NOT happen */
- if ((ev->window != ev->event_window) && (bd->win != ev->event_window) && (bd->client.lock_win != ev->event_window))
- return ECORE_CALLBACK_RENEW;
- }
- e_bindings_ecore_event_mouse_button_convert(ev, &ev2);
- _e_border_cb_mouse_down_helper(bd, ev->buttons, (Evas_Point*)&ev->root, &ev2);
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_e_border_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- Evas_Event_Mouse_Down *ev = event_info;
- E_Border *bd = data;
- E_Binding_Event_Mouse_Button ev2;
-
- if (action_border) return; // already existing border doing something
- e_bindings_evas_event_mouse_button_convert(ev, &ev2);
- _e_border_cb_mouse_down_helper(bd, ev->button, &ev->output, &ev2);
-}
-
-static void
-_e_border_cb_mouse_up_helper(E_Border *bd, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev)
-{
- if ((button >= 1) && (button <= 3))
- {
- bd->mouse.last_up[button - 1].mx = output->x;
- bd->mouse.last_up[button - 1].my = output->y;
- bd->mouse.last_up[button - 1].x = bd->x;
- bd->mouse.last_up[button - 1].y = bd->y;
- }
- bd->mouse.current.mx = output->x;
- bd->mouse.current.my = output->y;
- /* also we dont pass the same params that went in - then again that */
- /* should be ok as we are just ending the action if it has an end */
- if (bd->cur_mouse_action)
- {
- if (bd->cur_mouse_action->func.end_mouse)
- bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", ev);
- else if (bd->cur_mouse_action->func.end)
- bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
- e_object_unref(E_OBJECT(bd->cur_mouse_action));
- bd->cur_mouse_action = NULL;
- }
- else
- {
- if (!e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(bd), ev))
- e_focus_event_mouse_up(bd);
- }
- if ((button >= 1) && (button <= 3))
- {
- bd->mouse.last_up[button - 1].mx = output->x;
- bd->mouse.last_up[button - 1].my = output->y;
- bd->mouse.last_up[button - 1].x = bd->x;
- bd->mouse.last_up[button - 1].y = bd->y;
- }
-
- bd->drag.start = 0;
-}
-
-static Eina_Bool
-_e_border_cb_mouse_x_up(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev)
-{
- E_Border *bd;
- E_Binding_Event_Mouse_Button ev2;
-
- if (action_border)
- bd = action_border;
- else
- {
- bd = e_border_find_by_client_window(ev->window);
- if (!bd) bd = e_border_find_by_window(ev->window);
- if (!bd) return ECORE_CALLBACK_RENEW;
- /* event_window here should be bd->win if it isn't the same as window, not sure if this can NOT happen */
- if ((ev->window != ev->event_window) && (bd->win != ev->event_window) && (bd->client.lock_win != ev->event_window))
- return ECORE_CALLBACK_RENEW;
- }
- e_bindings_ecore_event_mouse_button_convert(ev, &ev2);
- _e_border_cb_mouse_up_helper(bd, ev->buttons, (Evas_Point*)&ev->root, &ev2);
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_e_border_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- Evas_Event_Mouse_Down *ev = event_info;
- E_Border *bd = data;
- E_Binding_Event_Mouse_Button ev2;
-
- if (action_border) return; // already existing border doing something
- e_bindings_evas_event_mouse_button_convert(ev, &ev2);
- _e_border_cb_mouse_up_helper(bd, ev->button, &ev->output, &ev2);
-}
-
-static void
-_e_border_stay_within_container(E_Border *bd, int x, int y, int *new_x, int *new_y)
-{
- int new_x_max, new_y_max;
- int zw, zh;
- Eina_Bool lw, lh;
-
- _e_border_zones_layout_calc(bd, NULL, NULL, &zw, &zh);
-
- new_x_max = zw - bd->w;
- new_y_max = zh - bd->h;
- lw = bd->w > zw ? EINA_TRUE : EINA_FALSE;
- lh = bd->h > zh ? EINA_TRUE : EINA_FALSE;
-
- if (lw)
- {
- if (x <= new_x_max)
- *new_x = new_x_max;
- else if (x >= 0)
- *new_x = 0;
- }
- else
- {
- if (x >= new_x_max)
- *new_x = new_x_max;
- else if (x <= 0)
- *new_x = 0;
- }
-
- if (lh)
- {
- if (y <= new_y_max)
- *new_y = new_y_max;
- else if (y >= 0)
- *new_y = 0;
- }
- else
- {
- if (y >= new_y_max)
- *new_y = new_y_max;
- else if (y <= 0)
- *new_y = 0;
- }
-}
-
-static void
-_e_border_cb_mouse_move_helper(E_Border *bd, Evas_Point *output)
-{
-
- bd->mouse.current.mx = output->x;
- bd->mouse.current.my = output->y;
- if (bd->moving)
- {
- int x, y, new_x, new_y;
- int new_w, new_h;
- Eina_List *skiplist = NULL;
-#if 0
- // FIXME: remove? sync what for when only moving?
- if ((ecore_loop_time_get() - bd->client.netwm.sync.time) > 0.5)
- bd->client.netwm.sync.wait = 0;
- if ((bd->client.netwm.sync.request) &&
- (bd->client.netwm.sync.alarm) &&
- (bd->client.netwm.sync.wait > 1)) return;
-#endif
- if ((bd->moveinfo.down.button >= 1) && (bd->moveinfo.down.button <= 3))
- {
- x = bd->mouse.last_down[bd->moveinfo.down.button - 1].x +
- (bd->mouse.current.mx - bd->moveinfo.down.mx);
- y = bd->mouse.last_down[bd->moveinfo.down.button - 1].y +
- (bd->mouse.current.my - bd->moveinfo.down.my);
- }
- else
- {
- x = bd->moveinfo.down.x +
- (bd->mouse.current.mx - bd->moveinfo.down.mx);
- y = bd->moveinfo.down.y +
- (bd->mouse.current.my - bd->moveinfo.down.my);
- }
- new_x = x;
- new_y = y;
-
- skiplist = eina_list_append(skiplist, bd);
- e_resist_container_border_position(bd->zone->container, skiplist,
- bd->x, bd->y, bd->w, bd->h,
- x, y, bd->w, bd->h,
- &new_x, &new_y, &new_w, &new_h);
- eina_list_free(skiplist);
-
- if (e_config->screen_limits == E_SCREEN_LIMITS_WITHIN)
- _e_border_stay_within_container(bd, x, y, &new_x, &new_y);
-
- bd->shelf_fix.x = 0;
- bd->shelf_fix.y = 0;
- bd->shelf_fix.modified = 0;
- e_border_move(bd, new_x, new_y);
- e_zone_flip_coords_handle(bd->zone, output->x, output->y);
- }
- else if (bd->resize_mode != E_POINTER_RESIZE_NONE)
- {
- if ((bd->client.netwm.sync.request) &&
- (bd->client.netwm.sync.alarm))
- {
- if ((ecore_loop_time_get() - bd->client.netwm.sync.send_time) > 0.5)
- {
- E_Border_Pending_Move_Resize *pnd;
-
- if (bd->pending_move_resize)
- {
- bd->changes.pos = 1;
- bd->changes.size = 1;
- BD_CHANGED(bd);
- _e_border_client_move_resize_send(bd);
- }
- EINA_LIST_FREE(bd->pending_move_resize, pnd)
- E_FREE(pnd);
-
- bd->client.netwm.sync.wait = 0;
- }
- /* sync.wait is incremented when resize_handle sends
- * sync-request and decremented by sync-alarm cb. so
- * we resize here either on initial resize, timeout or
- * when no new resize-request was added by sync-alarm cb.
- */
- if (!bd->client.netwm.sync.wait)
- _e_border_resize_handle(bd);
- }
- else
- _e_border_resize_handle(bd);
- }
- else if (bd->drag.start)
- {
- if ((bd->drag.x == -1) && (bd->drag.y == -1))
- {
- bd->drag.x = output->x;
- bd->drag.y = output->y;
- }
- else
- {
- int dx, dy;
-
- dx = bd->drag.x - output->x;
- dy = bd->drag.y - output->y;
- if (((dx * dx) + (dy * dy)) >
- (e_config->drag_resist * e_config->drag_resist))
- {
- /* start drag! */
- if (bd->icon_object)
- {
- Evas_Object *o = NULL;
- Evas_Coord x, y, w, h;
- const char *drag_types[] = { "enlightenment/border" };
-
- e_object_ref(E_OBJECT(bd));
- evas_object_geometry_get(bd->icon_object,
- &x, &y, &w, &h);
- drag_border = e_drag_new(bd->zone->container,
- x, y,
- drag_types, 1, bd, -1,
- NULL,
- _e_border_cb_drag_finished);
- o = e_border_icon_add(bd, drag_border->evas);
- if (!o)
- {
- /* FIXME: fallback icon for drag */
- o = evas_object_rectangle_add(drag_border->evas);
- evas_object_color_set(o, 255, 255, 255, 255);
- }
- e_drag_object_set(drag_border, o);
-
- e_drag_resize(drag_border, w, h);
- e_drag_start(drag_border, bd->drag.x, bd->drag.y);
- }
- bd->drag.start = 0;
- }
- }
- }
-}
-
-static Eina_Bool
-_e_border_cb_mouse_x_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev)
-{
- if (!action_border) return ECORE_CALLBACK_RENEW;
- _e_border_cb_mouse_move_helper(action_border, (Evas_Point*)&ev->root);
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_e_border_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- Evas_Event_Mouse_Move *ev = event_info;
- E_Border *bd = data;
-
- if (action_border) return; // already existing border doing something
- _e_border_cb_mouse_move_helper(bd, &ev->cur.output);
-}
-
-static Eina_Bool
-_e_border_cb_grab_replay(void *data __UNUSED__,
- int type,
- void *event)
-{
- Ecore_Event_Mouse_Button *ev;
-
- if (type != ECORE_EVENT_MOUSE_BUTTON_DOWN) return ECORE_CALLBACK_DONE;
- ev = event;
- if ((e_config->pass_click_on)
- || (e_config->always_click_to_raise) // this works even if not on click-to-focus
- || (e_config->always_click_to_focus) // this works even if not on click-to-focus
- )
- {
- E_Border *bd;
-
- bd = e_border_find_by_window(ev->event_window);
- if (bd)
- {
- if (bd->cur_mouse_action)
- return ECORE_CALLBACK_DONE;
- if (ev->event_window == bd->win)
- {
- E_Binding_Event_Mouse_Button ev2;
-
- e_bindings_ecore_event_mouse_button_convert(ev, &ev2);
- if (!e_bindings_mouse_button_find(E_BINDING_CONTEXT_WINDOW,
- &ev2, NULL))
- return ECORE_CALLBACK_PASS_ON;
- }
- }
- }
- return ECORE_CALLBACK_DONE;
-}
-
-static void
-_e_border_cb_drag_finished(E_Drag *drag,
- int dropped __UNUSED__)
-{
- E_Border *bd;
-
- bd = drag->data;
- e_object_unref(E_OBJECT(bd));
- drag_border = NULL;
-}
-
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
-static Eina_Bool
-_e_border_cb_desk_window_profile_change(void *data __UNUSED__,
- int ev_type __UNUSED__,
- void *ev __UNUSED__)
-{
-// E_Event_Desk_Window_Profile_Change *e = ev;
- Eina_List *l = NULL;
- E_Border *bd;
-
- EINA_LIST_FOREACH(borders, l, bd)
- {
- if (!e_object_is_del(E_OBJECT(bd)))
- {
- bd->client.e.fetch.profile = 1;
- BD_CHANGED(bd);
- }
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-#endif
-static Eina_Bool
-_e_border_post_move_resize_job(void *data)
-{
- E_Border *bd;
-
- bd = (E_Border *)data;
- if (bd->post_move)
- {
- E_Border *tmp;
- Eina_List *l;
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- ecore_x_window_move(tmp->win,
- bd->x +
- bd->client_inset.l +
- tmp->client.e.state.video_position.x,
- bd->y +
- bd->client_inset.t +
- tmp->client.e.state.video_position.y);
- }
- if (bd->client.e.state.video)
- {
- E_Border *parent;
-
- parent = bd->client.e.state.video_parent_border;
- ecore_x_window_move(bd->win,
- parent->x +
- parent->client_inset.l +
- bd->client.e.state.video_position.x,
- parent->y +
- parent->client_inset.t +
- bd->client.e.state.video_position.y);
- }
- else if ((bd->post_move) && (bd->post_resize))
- {
- ecore_x_window_move_resize(bd->win,
- bd->x + bd->client_inset.l,
- bd->y + bd->client_inset.t,
- bd->w - (e_border_inset_width_get(bd)),
- bd->h - (e_border_inset_height_get(bd)));
- }
- else if (bd->post_move)
- {
- ecore_x_window_move(bd->win, bd->x + bd->client_inset.l, bd->y + bd->client_inset.t);
- }
- else if (bd->post_resize)
- {
- ecore_x_window_resize(bd->win,
- bd->w - (e_border_inset_width_get(bd)),
- bd->h - (e_border_inset_height_get(bd)));
- }
-
- if (bd->client.e.state.video)
- {
- fprintf(stderr, "%x: [%i, %i] [%i, %i]\n",
- bd->win,
- bd->client.e.state.video_parent_border->x +
- bd->client.e.state.video_parent_border->client_inset.l +
- bd->client.e.state.video_position.x,
- bd->client.e.state.video_parent_border->y +
- bd->client.e.state.video_parent_border->client_inset.t +
- bd->client.e.state.video_position.y,
- bd->w, bd->h);
- }
-
- if (bd->post_show)
- {
- if (bd->visible)
- {
- bd->post_job = NULL;
- _e_border_show(bd);
- }
- }
- bd->post_show = 0;
- bd->post_move = 0;
- bd->post_resize = 0;
- bd->post_job = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
-static void
-_e_border_container_layout_hook(E_Container *con)
-{
- _e_border_hook_call(E_BORDER_HOOK_CONTAINER_LAYOUT, con);
-}
-
-static void
-_e_border_eval0(E_Border *bd)
-{
- int change_urgent = 0;
- int rem_change = 0;
- int title_change = 0;
- Eina_Bool new_cw = !bd->cw;
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- Eina_Bool need_desk_set = EINA_FALSE;
-#endif
-
- if (e_object_is_del(E_OBJECT(bd)))
- {
- CRI("_e_border_eval(%p) with deleted border!\n", bd);
- bd->changed = 0;
- return;
- }
-
- _e_border_hook_call(E_BORDER_HOOK_EVAL_PRE_FETCH, bd);
-
- bd->changes.border = 0;
-
- /* fetch any info queued to be fetched */
- if (bd->changes.prop || bd->client.netwm.fetch.state)
- {
- e_hints_window_state_get(bd);
- bd->client.netwm.fetch.state = 0;
- rem_change = 1;
- }
- if (bd->client.icccm.fetch.client_leader)
- {
- /* TODO: What do to if the client leader isn't mapped yet? */
- E_Border *bd_leader = NULL;
-
- bd->client.icccm.client_leader = ecore_x_icccm_client_leader_get(bd->client.win);
- if (bd->client.icccm.client_leader)
- bd_leader = e_border_find_by_client_window(bd->client.icccm.client_leader);
- if (bd->leader)
- {
- if (bd->leader != bd_leader)
- {
- bd->leader->group = eina_list_remove(bd->leader->group, bd);
- if (bd->leader->modal == bd) bd->leader->modal = NULL;
- bd->leader = NULL;
- }
- else
- bd_leader = NULL;
- }
- /* If this border is the leader of the group, don't register itself */
- if ((bd_leader) && (bd_leader != bd))
- {
- bd_leader->group = eina_list_append(bd_leader->group, bd);
- bd->leader = bd_leader;
- /* Only set the window modal to the leader it there is no parent */
- if ((bd->client.netwm.state.modal) &&
- ((!bd->parent) || (bd->parent->modal != bd)))
- {
- bd->leader->modal = bd;
- if (bd->leader->focused)
- e_border_focus_set(bd, 1, 1);
- else
- {
- Eina_List *l;
- E_Border *child;
-
- EINA_LIST_FOREACH(bd->leader->group, l, child)
- {
- if ((child != bd) && (child->focused))
- e_border_focus_set(bd, 1, 1);
- }
- }
- }
- }
- bd->client.icccm.fetch.client_leader = 0;
- rem_change = 1;
- }
- if (bd->client.icccm.fetch.title)
- {
- char *title = ecore_x_icccm_title_get(bd->client.win);
- eina_stringshare_replace(&bd->client.icccm.title, title);
- free(title);
-
- if (bd->bg_object)
- edje_object_part_text_set(bd->bg_object, "e.text.title",
- bd->client.icccm.title);
-
- bd->client.icccm.fetch.title = 0;
- rem_change = 1;
- title_change = 1;
- }
- if (bd->client.netwm.fetch.name)
- {
- char *name;
- ecore_x_netwm_name_get(bd->client.win, &name);
- eina_stringshare_replace(&bd->client.netwm.name, name);
- free(name);
-
- bd->client.hacks.iconic_shading =
- ((bd->client.netwm.icon_name == bd->client.netwm.name) &&
- (!e_util_strcmp(bd->client.netwm.name, "QEMU")));
-
- if (bd->bg_object)
- edje_object_part_text_set(bd->bg_object, "e.text.title",
- bd->client.netwm.name);
-
- bd->client.netwm.fetch.name = 0;
- rem_change = 1;
- title_change = 1;
- }
- if (title_change)
- {
- E_Event_Border_Title_Change *ev;
- ev = E_NEW(E_Event_Border_Title_Change, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- ecore_event_add(E_EVENT_BORDER_TITLE_CHANGE, ev,
- _e_border_event_border_title_change_free, NULL);
- }
- if (bd->client.icccm.fetch.name_class)
- {
- const char *pname, *pclass;
- char *nname, *nclass;
-
- ecore_x_icccm_name_class_get(bd->client.win, &nname, &nclass);
- pname = bd->client.icccm.name;
- pclass = bd->client.icccm.class;
- bd->client.icccm.name = eina_stringshare_add(nname);
- bd->client.icccm.class = eina_stringshare_add(nclass);
- bd->client.hacks.mapping_change =
- ((!e_util_strcasecmp(bd->client.icccm.class, "vmplayer")) ||
- (!e_util_strcasecmp(bd->client.icccm.class, "vmware")));
- if (bd->client.hacks.mapping_change)
- e_bindings_mapping_change_enable(EINA_FALSE);
- free(nname);
- free(nclass);
-
- if (!((bd->client.icccm.name == pname) &&
- (bd->client.icccm.class == pclass)))
- {
- bd->changes.icon = 1;
- rem_change = 1;
- }
-
- eina_stringshare_del(pname);
- eina_stringshare_del(pclass);
- bd->client.icccm.fetch.name_class = 0;
- }
- if (bd->changes.prop || bd->client.icccm.fetch.state)
- {
- bd->client.icccm.state = ecore_x_icccm_state_get(bd->client.win);
- bd->client.icccm.fetch.state = 0;
- rem_change = 1;
- }
- if (bd->changes.prop || bd->client.e.fetch.state)
- {
- e_hints_window_e_state_get(bd);
- bd->client.e.fetch.state = 0;
- rem_change = 1;
- }
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- if (bd->client.e.fetch.profile)
- {
- const char **list = NULL;
- int n, i, res;
- unsigned int use;
-
- if (bd->client.e.state.profile.name)
- {
- eina_stringshare_del(bd->client.e.state.profile.name);
- bd->client.e.state.profile.name = NULL;
- }
-
- if (bd->client.e.state.profile.available_list)
- {
- for (i = 0; i < bd->client.e.state.profile.num; i++)
- {
- if (bd->client.e.state.profile.available_list[i])
- {
- eina_stringshare_del(bd->client.e.state.profile.available_list[i]);
- bd->client.e.state.profile.available_list[i] = NULL;
- }
- }
- E_FREE(bd->client.e.state.profile.available_list);
- bd->client.e.state.profile.available_list = NULL;
- }
- bd->client.e.state.profile.num = 0;
-
- res = ecore_x_window_prop_card32_get(bd->client.win,
- ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED,
- &use,
- 1);
- if ((res == 1) && (use == 1))
- {
- Ecore_X_Atom val;
- res = ecore_x_window_prop_atom_get(bd->client.win,
- ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE,
- &val, 1);
- if (res == 1)
- {
- char *name = ecore_x_atom_name_get(val);
- if (name)
- {
- bd->client.e.state.profile.name = eina_stringshare_add(name);
- free(name);
- }
- }
-
- if (ecore_x_e_window_available_profiles_get(bd->client.win, &list, &n))
- {
- bd->client.e.state.profile.available_list = E_NEW(const char *, n);
- for (i = 0; i < n; i++)
- bd->client.e.state.profile.available_list[i] = eina_stringshare_add(list[i]);
- bd->client.e.state.profile.num = n;
- }
- need_desk_set = EINA_TRUE;
- bd->client.e.state.profile.use = 1;
- free(list);
- }
-
- bd->client.e.fetch.profile = 0;
- }
-#endif
- if (bd->changes.prop || bd->client.netwm.fetch.type)
- {
- e_hints_window_type_get(bd);
- if ((!bd->lock_border) || (!bd->client.border.name))
- bd->client.border.changed = 1;
-
- if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK)
- {
- if (!bd->client.netwm.state.skip_pager)
- {
- bd->client.netwm.state.skip_pager = 1;
- bd->client.netwm.update.state = 1;
- }
- if (!bd->client.netwm.state.skip_taskbar)
- {
- bd->client.netwm.state.skip_taskbar = 1;
- bd->client.netwm.update.state = 1;
- }
- }
- else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DESKTOP)
- {
- bd->focus_policy_override = E_FOCUS_CLICK;
- e_focus_setup(bd);
- if (!bd->client.netwm.state.skip_pager)
- {
- bd->client.netwm.state.skip_pager = 1;
- bd->client.netwm.update.state = 1;
- }
- if (!bd->client.netwm.state.skip_taskbar)
- {
- bd->client.netwm.state.skip_taskbar = 1;
- bd->client.netwm.update.state = 1;
- }
- }
- bd->client.netwm.fetch.type = 0;
- }
- if (bd->client.icccm.fetch.machine)
- {
- char *machine = ecore_x_icccm_client_machine_get(bd->client.win);
-
- if ((!machine) && (bd->client.icccm.client_leader))
- machine = ecore_x_icccm_client_machine_get(bd->client.icccm.client_leader);
-
- eina_stringshare_replace(&bd->client.icccm.machine, machine);
- free(machine);
-
- bd->client.icccm.fetch.machine = 0;
- rem_change = 1;
- }
- if (bd->client.icccm.fetch.command)
- {
- if ((bd->client.icccm.command.argc > 0) && (bd->client.icccm.command.argv))
- {
- int i;
-
- for (i = 0; i < bd->client.icccm.command.argc; i++)
- free(bd->client.icccm.command.argv[i]);
- free(bd->client.icccm.command.argv);
- }
- bd->client.icccm.command.argc = 0;
- bd->client.icccm.command.argv = NULL;
- ecore_x_icccm_command_get(bd->client.win,
- &(bd->client.icccm.command.argc),
- &(bd->client.icccm.command.argv));
- if ((bd->client.icccm.client_leader) &&
- (!bd->client.icccm.command.argv))
- ecore_x_icccm_command_get(bd->client.icccm.client_leader,
- &(bd->client.icccm.command.argc),
- &(bd->client.icccm.command.argv));
- bd->client.icccm.fetch.command = 0;
- rem_change = 1;
- }
- if (bd->changes.prop || bd->client.icccm.fetch.hints)
- {
- Eina_Bool accepts_focus, is_urgent;
-
- accepts_focus = EINA_TRUE;
- is_urgent = EINA_FALSE;
- bd->client.icccm.initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
- if (ecore_x_icccm_hints_get(bd->client.win,
- &accepts_focus,
- &bd->client.icccm.initial_state,
- &bd->client.icccm.icon_pixmap,
- &bd->client.icccm.icon_mask,
- &bd->client.icccm.icon_window,
- &bd->client.icccm.window_group,
- &is_urgent))
- {
- bd->client.icccm.accepts_focus = accepts_focus;
- if ((bd->client.icccm.urgent != is_urgent) && ((!bd->focused) || (!is_urgent)))
- change_urgent = 1;
- bd->client.icccm.urgent = is_urgent;
-
- /* If this is a new window, set the state as requested. */
- if ((bd->new_client) &&
- (bd->client.icccm.initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC))
- {
- e_border_iconify(bd);
- e_border_hide(bd, 1);
- }
- }
- bd->client.icccm.fetch.hints = 0;
- rem_change = 1;
- }
- if (bd->changes.prop || bd->client.icccm.fetch.size_pos_hints)
- {
- Eina_Bool request_pos;
-
- request_pos = EINA_FALSE;
- if (ecore_x_icccm_size_pos_hints_get(bd->client.win,
- &request_pos,
- &bd->client.icccm.gravity,
- &bd->client.icccm.min_w,
- &bd->client.icccm.min_h,
- &bd->client.icccm.max_w,
- &bd->client.icccm.max_h,
- &bd->client.icccm.base_w,
- &bd->client.icccm.base_h,
- &bd->client.icccm.step_w,
- &bd->client.icccm.step_h,
- &bd->client.icccm.min_aspect,
- &bd->client.icccm.max_aspect))
- {
- bd->client.icccm.request_pos = request_pos;
- }
- else
- {
- }
- if (bd->client.icccm.min_w > 32767) bd->client.icccm.min_w = 32767;
- if (bd->client.icccm.min_h > 32767) bd->client.icccm.min_h = 32767;
- if (bd->client.icccm.max_w > 32767) bd->client.icccm.max_w = 32767;
- if (bd->client.icccm.max_h > 32767) bd->client.icccm.max_h = 32767;
- if (bd->client.icccm.base_w > 32767) bd->client.icccm.base_w = 32767;
- if (bd->client.icccm.base_h > 32767) bd->client.icccm.base_h = 32767;
- // if (bd->client.icccm.step_w < 1) bd->client.icccm.step_w = 1;
- // if (bd->client.icccm.step_h < 1) bd->client.icccm.step_h = 1;
- // if doing a resize, fix it up
- if (bd->resize_mode != E_POINTER_RESIZE_NONE)
- {
- int x, y, w, h, new_w, new_h;
-
- x = bd->x;
- y = bd->y;
- w = bd->w;
- h = bd->h;
- new_w = w;
- new_h = h;
- e_border_resize_limit(bd, &new_w, &new_h);
- if ((bd->resize_mode == E_POINTER_RESIZE_TL) ||
- (bd->resize_mode == E_POINTER_RESIZE_L) ||
- (bd->resize_mode == E_POINTER_RESIZE_BL))
- x += (w - new_w);
- if ((bd->resize_mode == E_POINTER_RESIZE_TL) ||
- (bd->resize_mode == E_POINTER_RESIZE_T) ||
- (bd->resize_mode == E_POINTER_RESIZE_TR))
- y += (h - new_h);
- e_border_move_resize(bd, x, y, new_w, new_h);
- }
- bd->client.icccm.fetch.size_pos_hints = 0;
- rem_change = 1;
- }
- if (bd->client.icccm.fetch.protocol)
- {
- int i, num;
- Ecore_X_WM_Protocol *proto;
-
- proto = ecore_x_window_prop_protocol_list_get(bd->client.win, &num);
- if (proto)
- {
- for (i = 0; i < num; i++)
- {
- if (proto[i] == ECORE_X_WM_PROTOCOL_DELETE_REQUEST)
- bd->client.icccm.delete_request = 1;
- else if (proto[i] == ECORE_X_WM_PROTOCOL_TAKE_FOCUS)
- bd->client.icccm.take_focus = 1;
- else if (proto[i] == ECORE_X_NET_WM_PROTOCOL_PING)
- bd->client.netwm.ping = 1;
- else if (proto[i] == ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST)
- {
- bd->client.netwm.sync.request = 1;
- if (!ecore_x_netwm_sync_counter_get(bd->client.win,
- &bd->client.netwm.sync.counter))
- bd->client.netwm.sync.request = 0;
- }
- }
- free(proto);
- }
- if (bd->client.netwm.ping)
- e_border_ping(bd);
- else
- {
- if (bd->ping_poller) ecore_poller_del(bd->ping_poller);
- bd->ping_poller = NULL;
- }
- bd->client.icccm.fetch.protocol = 0;
- }
- if (bd->client.icccm.fetch.transient_for)
- {
- /* TODO: What do to if the transient for isn't mapped yet? */
- E_Border *bd_parent = NULL;
-
- bd->client.icccm.transient_for = ecore_x_icccm_transient_for_get(bd->client.win);
- if (bd->client.icccm.transient_for)
- bd_parent = e_border_find_by_client_window(bd->client.icccm.transient_for);
- /* If we already have a parent, remove it */
- if (bd->parent)
- {
- if (bd_parent != bd->parent)
- {
- bd->parent->transients = eina_list_remove(bd->parent->transients, bd);
- if (bd->parent->modal == bd) bd->parent->modal = NULL;
- bd->parent = NULL;
- }
- else
- bd_parent = NULL;
- }
- if ((bd_parent) && (bd_parent != bd) &&
- (eina_list_data_find(bd->transients, bd_parent) != bd_parent))
- {
- bd_parent->transients = eina_list_append(bd_parent->transients, bd);
- bd->parent = bd_parent;
- }
- if (bd->parent)
- {
- if (bd->parent->layer != bd->layer)
- e_border_layer_set(bd, bd->parent->layer);
- if (bd->client.netwm.state.modal)
- {
- bd->parent->modal = bd;
- bd->parent->lock_close = 1;
- if (!bd->parent->client.lock_win)
- {
- bd->parent->client.lock_win = ecore_x_window_input_new(bd->parent->win, 0, 0, bd->parent->client.w, bd->parent->client.h);
- e_comp_ignore_win_add(bd->parent->client.lock_win);
- eina_hash_add(borders_hash, e_util_winid_str_get(bd->parent->client.lock_win), bd->parent);
- ecore_x_window_show(bd->parent->client.lock_win);
- ecore_x_icccm_name_class_set(bd->parent->client.lock_win, "lock_win", "lock_win");
- }
- }
-
- if (e_config->focus_setting == E_FOCUS_NEW_DIALOG ||
- (bd->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
- bd->take_focus = 1;
- }
- bd->client.icccm.fetch.transient_for = 0;
- rem_change = 1;
- }
- if (bd->client.icccm.fetch.window_role)
- {
- char *role = ecore_x_icccm_window_role_get(bd->client.win);
- eina_stringshare_replace(&bd->client.icccm.window_role, role);
- free(role);
-
- bd->client.icccm.fetch.window_role = 0;
- rem_change = 1;
- }
- if (bd->client.icccm.fetch.icon_name)
- {
- char *icon_name = ecore_x_icccm_icon_name_get(bd->client.win);
- eina_stringshare_replace(&bd->client.icccm.icon_name, icon_name);
- free(icon_name);
-
- bd->client.hacks.iconic_shading =
- ((bd->client.netwm.icon_name == bd->client.netwm.name) &&
- (!e_util_strcmp(bd->client.netwm.icon_name, "QEMU")));
-
- bd->client.icccm.fetch.icon_name = 0;
- rem_change = 1;
- }
- if (bd->client.netwm.fetch.icon_name)
- {
- char *icon_name;
- ecore_x_netwm_icon_name_get(bd->client.win, &icon_name);
- eina_stringshare_replace(&bd->client.netwm.icon_name, icon_name);
- free(icon_name);
-
- bd->client.netwm.fetch.icon_name = 0;
- rem_change = 1;
- }
- if (bd->client.netwm.fetch.opacity)
- {
- unsigned int val;
-
- if (ecore_x_window_prop_card32_get(bd->client.win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, &val, 1) > 0)
- bd->client.netwm.opacity = (val >> 24);
- }
- if (bd->client.netwm.fetch.icon)
- {
- int i;
- if (bd->client.netwm.icons)
- {
- for (i = 0; i < bd->client.netwm.num_icons; i++)
- {
- free(bd->client.netwm.icons[i].data);
- bd->client.netwm.icons[i].data = NULL;
- }
- free(bd->client.netwm.icons);
- }
- bd->client.netwm.icons = NULL;
- bd->client.netwm.num_icons = 0;
- if (ecore_x_netwm_icons_get(bd->client.win,
- &bd->client.netwm.icons,
- &bd->client.netwm.num_icons))
- {
- // unless the rest of e17 uses border icons OTHER than icon #0
- // then free the rest that we don't need anymore.
- for (i = 1; i < bd->client.netwm.num_icons; i++)
- {
- free(bd->client.netwm.icons[i].data);
- bd->client.netwm.icons[i].data = NULL;
- }
- bd->client.netwm.num_icons = 1;
- bd->changes.icon = 1;
- }
- bd->client.netwm.fetch.icon = 0;
- }
- if (bd->client.netwm.fetch.user_time)
- {
- ecore_x_netwm_user_time_get(bd->client.win, &bd->client.netwm.user_time);
- bd->client.netwm.fetch.user_time = 0;
- }
- if (bd->client.netwm.fetch.strut)
- {
- if (!ecore_x_netwm_strut_partial_get(bd->client.win,
- &bd->client.netwm.strut.left,
- &bd->client.netwm.strut.right,
- &bd->client.netwm.strut.top,
- &bd->client.netwm.strut.bottom,
- &bd->client.netwm.strut.left_start_y,
- &bd->client.netwm.strut.left_end_y,
- &bd->client.netwm.strut.right_start_y,
- &bd->client.netwm.strut.right_end_y,
- &bd->client.netwm.strut.top_start_x,
- &bd->client.netwm.strut.top_end_x,
- &bd->client.netwm.strut.bottom_start_x,
- &bd->client.netwm.strut.bottom_end_x))
- {
- ecore_x_netwm_strut_get(bd->client.win,
- &bd->client.netwm.strut.left, &bd->client.netwm.strut.right,
- &bd->client.netwm.strut.top, &bd->client.netwm.strut.bottom);
-
- bd->client.netwm.strut.left_start_y = 0;
- bd->client.netwm.strut.left_end_y = 0;
- bd->client.netwm.strut.right_start_y = 0;
- bd->client.netwm.strut.right_end_y = 0;
- bd->client.netwm.strut.top_start_x = 0;
- bd->client.netwm.strut.top_end_x = 0;
- bd->client.netwm.strut.bottom_start_x = 0;
- bd->client.netwm.strut.bottom_end_x = 0;
- }
- bd->client.netwm.fetch.strut = 0;
- }
- if (bd->client.qtopia.fetch.soft_menu)
- {
- e_hints_window_qtopia_soft_menu_get(bd);
- bd->client.qtopia.fetch.soft_menu = 0;
- rem_change = 1;
- }
- if (bd->client.qtopia.fetch.soft_menus)
- {
- e_hints_window_qtopia_soft_menus_get(bd);
- bd->client.qtopia.fetch.soft_menus = 0;
- rem_change = 1;
- }
- if (bd->client.vkbd.fetch.state)
- {
- e_hints_window_virtual_keyboard_state_get(bd);
- bd->client.vkbd.fetch.state = 0;
- rem_change = 1;
- }
- if (bd->client.vkbd.fetch.vkbd)
- {
- e_hints_window_virtual_keyboard_get(bd);
- bd->client.vkbd.fetch.vkbd = 0;
- rem_change = 1;
- }
- if (bd->client.illume.conformant.fetch.conformant)
- {
- bd->client.illume.conformant.conformant =
- ecore_x_e_illume_conformant_get(bd->client.win);
- bd->client.illume.conformant.fetch.conformant = 0;
- }
- if (bd->client.illume.quickpanel.fetch.state)
- {
- bd->client.illume.quickpanel.state =
- ecore_x_e_illume_quickpanel_state_get(bd->client.win);
- bd->client.illume.quickpanel.fetch.state = 0;
- }
- if (bd->client.illume.quickpanel.fetch.quickpanel)
- {
- bd->client.illume.quickpanel.quickpanel =
- ecore_x_e_illume_quickpanel_get(bd->client.win);
- bd->client.illume.quickpanel.fetch.quickpanel = 0;
- }
- if (bd->client.illume.quickpanel.fetch.priority.major)
- {
- bd->client.illume.quickpanel.priority.major =
- ecore_x_e_illume_quickpanel_priority_major_get(bd->client.win);
- bd->client.illume.quickpanel.fetch.priority.major = 0;
- }
- if (bd->client.illume.quickpanel.fetch.priority.minor)
- {
- bd->client.illume.quickpanel.priority.minor =
- ecore_x_e_illume_quickpanel_priority_minor_get(bd->client.win);
- bd->client.illume.quickpanel.fetch.priority.minor = 0;
- }
- if (bd->client.illume.quickpanel.fetch.zone)
- {
- bd->client.illume.quickpanel.zone =
- ecore_x_e_illume_quickpanel_zone_get(bd->client.win);
- bd->client.illume.quickpanel.fetch.zone = 0;
- }
- if (bd->client.illume.drag.fetch.drag)
- {
- bd->client.illume.drag.drag =
- ecore_x_e_illume_drag_get(bd->client.win);
- bd->client.illume.drag.fetch.drag = 0;
- }
- if (bd->client.illume.drag.fetch.locked)
- {
- bd->client.illume.drag.locked =
- ecore_x_e_illume_drag_locked_get(bd->client.win);
- bd->client.illume.drag.fetch.locked = 0;
- }
- if (bd->client.illume.win_state.fetch.state)
- {
- bd->client.illume.win_state.state =
- ecore_x_e_illume_window_state_get(bd->client.win);
- bd->client.illume.win_state.fetch.state = 0;
- }
- if (bd->changes.shape)
- {
- Ecore_X_Rectangle *rects;
- int num;
-
- bd->changes.shape = 0;
- rects = ecore_x_window_shape_rectangles_get(bd->client.win, &num);
- if (rects)
- {
- int cw = 0, ch = 0;
-
- /* This doesn't fix the race, but makes it smaller. we detect
- * this and if cw and ch != client w/h then mark this as needing
- * a shape change again to fixup next event loop.
- */
- ecore_x_window_size_get(bd->client.win, &cw, &ch);
- if ((cw != bd->client.w) || (ch != bd->client.h))
- bd->changes.shape = 1;
- if ((num == 1) &&
- (rects[0].x == 0) &&
- (rects[0].y == 0) &&
- ((int)rects[0].width == cw) &&
- ((int)rects[0].height == ch))
- {
- if (bd->client.shaped)
- {
- bd->client.shaped = 0;
- if (!bd->bordername)
- bd->client.border.changed = 1;
- }
- }
- else
- {
- if (!bd->client.shaped)
- {
- bd->client.shaped = 1;
- if (!bd->bordername)
- bd->client.border.changed = 1;
- }
- ecore_x_window_shape_rectangles_set(bd->win, rects, num);
- bd->changes.shape_input = 0;
- e_container_shape_input_rects_set(bd->shape, NULL, 0);
- }
- free(rects);
- }
- else
- {
- // FIXME: no rects i think can mean... totally empty window
- bd->client.shaped = 0;
- if (!bd->bordername)
- bd->client.border.changed = 1;
- }
- bd->need_shape_merge = 1;
- }
- if (bd->changes.shape_input)
- {
- Ecore_X_Rectangle *rects;
- int num;
-
- bd->changes.shape_input = 0;
- rects = ecore_x_window_shape_input_rectangles_get(bd->client.win, &num);
- if (rects)
- {
- int cw = 0, ch = 0;
-
- /* This doesn't fix the race, but makes it smaller. we detect
- * this and if cw and ch != client w/h then mark this as needing
- * a shape change again to fixup next event loop.
- */
- ecore_x_window_size_get(bd->client.win, &cw, &ch);
- if ((cw != bd->client.w) || (ch != bd->client.h))
- bd->changes.shape_input = 1;
- if ((num == 1) &&
- (rects[0].x == 0) &&
- (rects[0].y == 0) &&
- ((int)rects[0].width == cw) &&
- ((int)rects[0].height == ch))
- {
- if (bd->shaped_input)
- {
- bd->shaped_input = 0;
- if (!bd->bordername)
- bd->client.border.changed = 1;
- }
- free(rects);
- }
- else
- {
- if (!bd->shaped_input)
- {
- bd->shaped_input = 1;
- if (!bd->bordername)
- bd->client.border.changed = 1;
- }
- ecore_x_window_shape_input_rectangles_set(bd->win, rects, num);
- e_container_shape_input_rects_set(bd->shape, (Eina_Rectangle *)rects, num);
- }
- }
- else
- {
- bd->shaped_input = 1;
- if (!bd->bordername)
- bd->client.border.changed = 1;
- }
- bd->need_shape_merge = 1;
- }
- if (bd->changes.prop || bd->client.mwm.fetch.hints)
- {
- int pb;
-
- bd->client.mwm.exists =
- ecore_x_mwm_hints_get(bd->client.win,
- &bd->client.mwm.func,
- &bd->client.mwm.decor,
- &bd->client.mwm.input);
- pb = bd->client.mwm.borderless;
- bd->client.mwm.borderless = 0;
- if (bd->client.mwm.exists)
- {
- if ((!(bd->client.mwm.decor & ECORE_X_MWM_HINT_DECOR_ALL)) &&
- (!(bd->client.mwm.decor & ECORE_X_MWM_HINT_DECOR_TITLE)) &&
- (!(bd->client.mwm.decor & ECORE_X_MWM_HINT_DECOR_BORDER)))
- bd->client.mwm.borderless = 1;
- }
- if (bd->client.mwm.borderless != pb)
- {
- if ((!bd->lock_border) || (!bd->client.border.name))
- bd->client.border.changed = 1;
- }
- bd->client.mwm.fetch.hints = 0;
- rem_change = 1;
- }
- if (bd->client.e.fetch.video_parent)
- {
- /* unlinking child/parent */
- if (bd->client.e.state.video_parent_border != NULL)
- {
- bd->client.e.state.video_parent_border->client.e.state.video_child =
- eina_list_remove
- (bd->client.e.state.video_parent_border->client.e.state.video_child,
- bd);
- }
-
- ecore_x_window_prop_card32_get(bd->client.win,
- ECORE_X_ATOM_E_VIDEO_PARENT,
- &bd->client.e.state.video_parent,
- 1);
-
- /* linking child/parent */
- if (bd->client.e.state.video_parent != 0)
- {
- E_Border *tmp;
- Eina_List *l;
-
- EINA_LIST_FOREACH(borders, l, tmp)
- if (tmp->client.win == bd->client.e.state.video_parent)
- {
- /* fprintf(stderr, "child added to parent \\o/\n"); */
- bd->client.e.state.video_parent_border = tmp;
- tmp->client.e.state.video_child = eina_list_append(tmp->client.e.state.video_child,
- bd);
- if (bd->desk != tmp->desk)
- e_border_desk_set(bd, tmp->desk);
- break;
- }
- }
-
- /* fprintf(stderr, "new parent %x => %p\n", bd->client.e.state.video_parent, bd->client.e.state.video_parent_border); */
-
- if (bd->client.e.state.video_parent_border) bd->client.e.fetch.video_parent = 0;
- rem_change = 1;
- }
- if (bd->client.e.fetch.video_position && bd->client.e.fetch.video_parent == 0)
- {
- unsigned int xy[2];
-
- ecore_x_window_prop_card32_get(bd->client.win,
- ECORE_X_ATOM_E_VIDEO_POSITION,
- xy,
- 2);
- bd->client.e.state.video_position.x = xy[0];
- bd->client.e.state.video_position.y = xy[1];
- bd->client.e.state.video_position.updated = 1;
- bd->client.e.fetch.video_position = 0;
- bd->x = bd->client.e.state.video_position.x;
- bd->y = bd->client.e.state.video_position.y;
-
- fprintf(stderr, "internal position has been updated [%i, %i]\n", bd->client.e.state.video_position.x, bd->client.e.state.video_position.y);
- }
- if (bd->changes.prop || bd->client.netwm.update.state)
- {
- e_hints_window_state_set(bd);
- /* Some stats might change the border, like modal */
- if (((!bd->lock_border) || (!bd->client.border.name)) &&
- (!(((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN))))
- {
- bd->client.border.changed = 1;
- }
- if (bd->parent)
- {
- if (bd->client.netwm.state.modal)
- {
- bd->parent->modal = bd;
- if (bd->parent->focused)
- e_border_focus_set(bd, 1, 1);
- }
- }
- else if (bd->leader)
- {
- if (bd->client.netwm.state.modal)
- {
- bd->leader->modal = bd;
- if (bd->leader->focused)
- e_border_focus_set(bd, 1, 1);
- else
- {
- Eina_List *l;
- E_Border *child;
-
- EINA_LIST_FOREACH(bd->leader->group, l, child)
- {
- if ((child != bd) && (child->focused))
- e_border_focus_set(bd, 1, 1);
- }
- }
- }
- }
- bd->client.netwm.update.state = 0;
- }
-
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- if ((e_config->use_desktop_window_profile) && (need_desk_set))
- {
- if (!(bd->client.e.state.profile.name) &&
- (bd->client.e.state.profile.num >= 1))
- {
- const char *p = NULL;
- int i;
- for (i = 0; i < bd->client.e.state.profile.num; i++)
- {
- if (!bd->client.e.state.profile.available_list[i])
- continue;
- p = bd->client.e.state.profile.available_list[i];
- if (strcmp(bd->desk->window_profile, p) == 0)
- {
- bd->client.e.state.profile.name = eina_stringshare_add(bd->desk->window_profile);
- break;
- }
- }
-
- if (!bd->client.e.state.profile.name)
- {
- E_Container *con = bd->zone->container;
- E_Desk *desk = NULL;
-
- for (i = 0; i < bd->client.e.state.profile.num; i++)
- {
- if (!bd->client.e.state.profile.available_list[i])
- continue;
- p = bd->client.e.state.profile.available_list[i];
- desk = e_container_desk_window_profile_get(con, p);
- if ((desk) && (bd->desk != desk))
- {
- bd->client.e.state.profile.name = eina_stringshare_add(p);
- break;
- }
- }
- }
- }
-
- if (!bd->client.e.state.profile.name)
- {
- bd->client.e.state.profile.name = eina_stringshare_add(bd->desk->window_profile);
- }
-
- ecore_x_e_window_profile_change_request_send(bd->client.win,
- bd->client.e.state.profile.name);
- bd->client.e.state.profile.wait_for_done = 1;
- }
-#endif
- if (bd->new_client)
- {
- E_Event_Border_Add *ev;
- E_Exec_Instance *inst;
-
- ev = E_NEW(E_Event_Border_Add, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_add_event");
- ecore_event_add(E_EVENT_BORDER_ADD, ev, _e_border_event_border_add_free, NULL);
-
- if ((!bd->lock_border) || (!bd->client.border.name))
- bd->client.border.changed = 1;
-
- {
- char *str = NULL;
-
- if ((!bd->internal) &&
- ((ecore_x_netwm_startup_id_get(bd->client.win, &str) && (str)) ||
- ((bd->client.icccm.client_leader > 0) &&
- ecore_x_netwm_startup_id_get(bd->client.icccm.client_leader, &str) && (str)))
- )
- {
- if (!strncmp(str, "E_START|", 8))
- {
- int id;
-
- id = atoi(str + 8);
- if (id > 0) bd->client.netwm.startup_id = id;
- }
- free(str);
- }
- }
- /* It's ok not to have fetch flag, should only be set on startup
- * * and not changed. */
- if (!ecore_x_netwm_pid_get(bd->client.win, &bd->client.netwm.pid))
- {
- if (bd->client.icccm.client_leader)
- {
- if (!ecore_x_netwm_pid_get(bd->client.icccm.client_leader, &bd->client.netwm.pid))
- bd->client.netwm.pid = -1;
- }
- else
- bd->client.netwm.pid = -1;
- }
-
- if (!bd->re_manage)
- {
- inst = e_exec_startup_id_pid_instance_find(bd->client.netwm.startup_id,
- bd->client.netwm.pid);
- if (inst)
- {
- Eina_Bool found;
- if (inst->used == 0)
- {
- E_Zone *zone;
- E_Desk *desk;
-
- inst->used++;
- zone = e_container_zone_number_get(bd->zone->container,
- inst->screen);
- if (zone) e_border_zone_set(bd, zone);
- desk = e_desk_at_xy_get(bd->zone, inst->desk_x,
- inst->desk_y);
- if (desk) e_border_desk_set(bd, desk);
- if (bd->client.netwm.pid != ecore_exe_pid_get(inst->exe))
- {
- /* most likely what has happened here is that the .desktop launcher
- * has spawned a process which then created this border, meaning the
- * E_Exec instance will be deleted in a moment, and we will be unable to track it.
- * to prevent this, we convert our instance to a phony
- */
- inst->phony = 1;
- }
- }
- found = !!inst->borders;
- e_exec_instance_client_add(inst, bd);
- if (!found)
- e_exec_instance_found(inst);
- }
-
- if (e_config->window_grouping) // FIXME: We may want to make the border "urgent" so that the user knows it appeared.
- {
- E_Border *bdl = NULL;
-
- bdl = bd->parent;
- if (!bdl)
- {
- if (bd->leader) bdl = bd->leader;
- }
- if (!bdl)
- {
- E_Border *child;
- E_Border_List *bl;
-
- bl = e_container_border_list_first(bd->zone->container);
- while ((child = e_container_border_list_next(bl)))
- {
- if (child == bd) continue;
- if (e_object_is_del(E_OBJECT(child))) continue;
- if ((bd->client.icccm.client_leader) &&
- (child->client.icccm.client_leader ==
- bd->client.icccm.client_leader))
- {
- bdl = child;
- break;
- }
- }
- e_container_border_list_free(bl);
- }
- if (bdl)
- {
- if (bdl->zone)
- e_border_zone_set(bd, bdl->zone);
- if (bdl->desk)
- e_border_desk_set(bd, bdl->desk);
- else
- e_border_stick(bd);
- }
- }
- }
- }
-
- /* PRE_POST_FETCH calls e_remember apply for new client */
- _e_border_hook_call(E_BORDER_HOOK_EVAL_PRE_POST_FETCH, bd);
- _e_border_hook_call(E_BORDER_HOOK_EVAL_POST_FETCH, bd);
- _e_border_hook_call(E_BORDER_HOOK_EVAL_PRE_BORDER_ASSIGN, bd);
-
- if (bd->need_reparent)
- {
- if (!bd->internal)
- ecore_x_window_save_set_add(bd->client.win);
- ecore_x_window_reparent(bd->client.win, bd->win, bd->client_inset.l, bd->client_inset.t);
- if (bd->visible)
- {
- if ((bd->new_client) && (bd->internal) &&
- (bd->internal_ecore_evas))
- ecore_evas_show(bd->internal_ecore_evas);
- }
- if (bd->new_client)
- {
- ecore_x_window_show(bd->client.win);
- _e_border_show(bd);
- }
- bd->need_reparent = 0;
- }
-
- if ((bd->client.border.changed) && (!bd->shaded) &&
- (!(((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN))))
- {
- const char *bordername;
-
- if (bd->fullscreen || bd->borderless)
- bordername = "borderless";
- else if (bd->bordername)
- bordername = bd->bordername;
- else if ((bd->client.mwm.borderless) || (bd->borderless))
- bordername = "borderless";
- else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DESKTOP)
- bordername = "borderless";
- else if (((bd->client.icccm.transient_for != 0) ||
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)) &&
- (bd->client.icccm.min_w == bd->client.icccm.max_w) &&
- (bd->client.icccm.min_h == bd->client.icccm.max_h))
- bordername = "noresize_dialog";
- else if ((bd->client.icccm.min_w == bd->client.icccm.max_w) &&
- (bd->client.icccm.min_h == bd->client.icccm.max_h))
- bordername = "noresize";
- else if (bd->client.shaped)
- bordername = "shaped";
- else if ((!bd->client.icccm.accepts_focus) &&
- (!bd->client.icccm.take_focus))
- bordername = "nofocus";
- else if (bd->client.icccm.urgent)
- bordername = "urgent";
- else if ((bd->client.icccm.transient_for != 0) ||
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))
- bordername = "dialog";
- else if (bd->client.netwm.state.modal)
- bordername = "modal";
- else if ((bd->client.netwm.state.skip_taskbar) ||
- (bd->client.netwm.state.skip_pager))
- bordername = "skipped";
-/*
- else if ((bd->internal) && (bd->client.icccm.class) &&
- (!strncmp(bd->client.icccm.class, "e_fwin", 6)))
- bordername = "internal_fileman";
- */
- else
- bordername = e_config->theme_default_border_style;
- if (!bordername) bordername = "default";
-
- if ((!bd->client.border.name) || (strcmp(bd->client.border.name, bordername)))
- {
- Evas_Object *o, *pbg = bd->bg_object;
- char buf[4096];
- int ok;
-
- bd->changes.border = 1;
- eina_stringshare_replace(&bd->client.border.name, bordername);
-
- if (bd->bg_object)
- {
- int w, h;
-
- w = bd->w, h = bd->h;
- bd->w -= (e_border_inset_width_get(bd));
- bd->h -= (e_border_inset_height_get(bd));
- if ((bd->w != w) || (h != bd->h)) bd->changes.size = 1;
- evas_object_del(bd->bg_object);
- }
- o = edje_object_add(e_comp_get(bd)->evas);
- snprintf(buf, sizeof(buf), "e/widgets/border/%s/border", bd->client.border.name);
- ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
- if ((!ok) && (strcmp(bd->client.border.name, "borderless")))
- {
- if (bd->client.border.name != e_config->theme_default_border_style)
- {
- snprintf(buf, sizeof(buf), "e/widgets/border/%s/border", e_config->theme_default_border_style);
- ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
- }
- if (!ok)
- {
- ok = e_theme_edje_object_set(o, "base/theme/borders",
- "e/widgets/border/default/border");
- if (ok)
- {
- /* Reset default border style to default */
- eina_stringshare_replace(&e_config->theme_default_border_style, "default");
- e_config_save_queue();
- }
- }
- }
-
- if (ok)
- {
- bd->bg_object = o;
- evas_object_name_set(o, "bd->bg_object");
-
- if (bd->client.netwm.name)
- edje_object_part_text_set(o, "e.text.title",
- bd->client.netwm.name);
- else if (bd->client.icccm.title)
- edje_object_part_text_set(o, "e.text.title",
- bd->client.icccm.title);
- bd->theme_shadow = !!edje_object_data_get(o, "shadow");
- _e_border_shadow(bd);
-
- if (pbg)
- {
- if (bd->icon_object)
- edje_object_part_swallow(bd->bg_object, "e.swallow.icon", bd->icon_object);
- }
- else bd->changes.icon = 1;
- }
- else
- {
- if (strcmp(bordername, "borderless"))
- /* it should never happen that a theme fails to set the edje
- * unless it's using borderless
- */
- CRI("USER IS USING A SHITTY THEME! ABORT!!!!");
- evas_object_del(o);
- bd->bg_object = NULL;
- E_FREE_FUNC(bd->icon_object, evas_object_del);
- o = bd->cw ? bd->cw->obj : NULL;
- }
- if (bd->cw) e_comp_win_reshadow(bd->cw);
- /* FIXME: it's theoretically possible that o is NULL here if first border eval occurs for a fullscreen
- * borderless window before its comp win has been set up;
- * E19 material imo
- */
- {
- // previously calculated
- Eina_Bool calc = bd->client_inset.calc;
- // previously was borderless
- Eina_Bool inset, pinset = !!(e_border_inset_width_get(bd) + e_border_inset_height_get(bd));
-
- _e_border_client_inset_calc(bd);
- inset = !!(e_border_inset_width_get(bd) + e_border_inset_height_get(bd));
- if (calc && (inset != pinset) && (pbg || (!bd->bg_object)))
- {
- if (inset)
- bd->x -= bd->client_inset.l, bd->y -= bd->client_inset.t;
- else
- bd->x += bd->client_inset.l, bd->y += bd->client_inset.t;
- }
- }
-
- bd->w += (e_border_inset_width_get(bd));
- bd->h += (e_border_inset_height_get(bd));
- bd->changes.size = 1;
-
- if (bd->maximized != E_MAXIMIZE_NONE)
- {
- E_Maximize maximized = bd->maximized;
-
- /* to force possible resizes */
- bd->maximized = E_MAXIMIZE_NONE;
-
- _e_border_maximize(bd, maximized);
-
- /* restore maximized state */
- bd->maximized = maximized;
-
- e_hints_window_maximized_set(bd, bd->maximized & E_MAXIMIZE_HORIZONTAL,
- bd->maximized & E_MAXIMIZE_VERTICAL);
- }
- if (bd->bg_object)
- {
- edje_object_signal_callback_add(bd->bg_object, "*", "*",
- _e_border_cb_signal_bind, bd);
- if (bd->focused)
- {
- edje_object_signal_emit(bd->bg_object, "e,state,focused", "e");
- if (bd->icon_object)
- edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
- }
- if (bd->shaded)
- edje_object_signal_emit(bd->bg_object, "e,state,shaded", "e");
- if (bd->sticky)
- edje_object_signal_emit(bd->bg_object, "e,state,sticky", "e");
- if (bd->hung)
- edje_object_signal_emit(bd->bg_object, "e,state,hung", "e");
- // FIXME: in eval -do differently
- // edje_object_message_signal_process(bd->bg_object);
- // e_border_frame_recalc(bd);
- }
- rem_change = 1;
- }
- bd->client.border.changed = 0;
- }
-
- bd->changes.prop = 0;
- if (rem_change) e_remember_update(bd);
- /* the below function updates the border's remember
- * and relevant netwm atom
- * ...eventually
- */
- if (bd->cw) e_comp_win_opacity_set(bd->cw, bd->client.netwm.opacity);
-
- if (change_urgent)
- {
- E_Event_Border_Urgent_Change *ev;
-
- if (bd->client.icccm.urgent)
- edje_object_signal_emit(bd->bg_object, "e,state,urgent", "e");
- else
- edje_object_signal_emit(bd->bg_object, "e,state,not_urgent", "e");
-
- ev = E_NEW(E_Event_Border_Urgent_Change, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- ecore_event_add(E_EVENT_BORDER_URGENT_CHANGE, ev,
- _e_border_event_border_urgent_change_free, NULL);
- }
-
- _e_border_hook_call(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN, bd);
- if (!new_cw) return;
- evas_object_event_callback_add(bd->cw->effect_obj, EVAS_CALLBACK_MOUSE_IN, _e_border_cb_mouse_in, bd);
- evas_object_event_callback_add(bd->cw->effect_obj, EVAS_CALLBACK_MOUSE_MOVE, _e_border_cb_mouse_move, bd);
- evas_object_event_callback_add(bd->cw->effect_obj, EVAS_CALLBACK_MOUSE_OUT, _e_border_cb_mouse_out, bd);
- evas_object_event_callback_add(bd->cw->effect_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_border_cb_mouse_down, bd);
- evas_object_event_callback_add(bd->cw->effect_obj, EVAS_CALLBACK_MOUSE_UP, _e_border_cb_mouse_up, bd);
- evas_object_event_callback_add(bd->cw->effect_obj, EVAS_CALLBACK_MOUSE_WHEEL, _e_border_cb_mouse_wheel, bd);
-}
-
-static void
-_e_border_eval(E_Border *bd)
-{
- E_Event_Border_Property *event;
- E_Border_Pending_Move_Resize *pnd;
- int rem_change = 0;
- int send_event = 1;
-
- if (e_object_is_del(E_OBJECT(bd)))
- {
- CRI("_e_border_eval(%p) with deleted border! - %d\n", bd, bd->new_client);
- bd->changed = 0;
- return;
- }
-
- _e_border_hook_call(E_BORDER_HOOK_EVAL_PRE_NEW_BORDER, bd);
-
- if (bd->new_client)
- {
- int zx = 0, zy = 0, zw = 0, zh = 0;
-
- e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
-
- /*
- * Limit maximum size of windows to useful geometry
- */
- // TODO: temoporary limited maximize algorithm
- // ->
- /*if (bd->w > zw)
- rw = zw;
- else
- rw = bd->w;
-
- if (bd->h > zh)
- rh = zh;
- else
- rh = bd->h;
-
- if ((rw != bd->w) || (rh != bd->h))
- {
- bd->w = rw;
- bd->h = rh;
- e_border_resize (bd, bd->w, bd->h);
- }*/
- // <-
-
- if (bd->re_manage)
- {
- int x = bd->x, y = bd->y;
- if (bd->x) bd->x -= bd->client_inset.l;
- if (bd->y) bd->y -= bd->client_inset.t;
- if ((x != bd->x) || (y != bd->y)) bd->changes.pos = 1;
- bd->placed = 1;
- }
- else if ((!bd->placed) && (bd->client.icccm.request_pos))
- {
- Ecore_X_Window_Attributes *att;
- int bw;
-
- att = &bd->client.initial_attributes;
- bw = att->border * 2;
- switch (bd->client.icccm.gravity)
- {
- case ECORE_X_GRAVITY_N:
- bd->x = (att->x - (bw / 2)) - (bd->client_inset.l / 2);
- bd->y = att->y;
- break;
-
- case ECORE_X_GRAVITY_NE:
- bd->x = (att->x - (bw)) - (bd->client_inset.l);
- bd->y = att->y;
- break;
-
- case ECORE_X_GRAVITY_E:
- bd->x = (att->x - (bw)) - (bd->client_inset.l);
- bd->y = (att->y - (bw / 2)) - (bd->client_inset.t / 2);
- break;
-
- case ECORE_X_GRAVITY_SE:
- bd->x = (att->x - (bw)) - (bd->client_inset.l);
- bd->y = (att->y - (bw)) - (bd->client_inset.t);
- break;
-
- case ECORE_X_GRAVITY_S:
- bd->x = (att->x - (bw / 2)) - (bd->client_inset.l / 2);
- bd->y = (att->y - (bw)) - (bd->client_inset.t);
- break;
-
- case ECORE_X_GRAVITY_SW:
- bd->x = att->x;
- bd->y = (att->y - (bw)) - (bd->client_inset.t);
- break;
-
- case ECORE_X_GRAVITY_W:
- bd->x = att->x;
- bd->y = (att->y - (bw)) - (bd->client_inset.t);
- break;
-
- case ECORE_X_GRAVITY_CENTER:
- bd->x = (att->x - (bw / 2)) - (bd->client_inset.l / 2);
- bd->y = (att->y - (bw / 2)) - (bd->client_inset.t / 2);
- break;
-
- case ECORE_X_GRAVITY_NW:
- default:
- bd->x = att->x;
- bd->y = att->y;
- }
-
- /*
- * This ensures that windows that like to open with a x/y
- * position smaller than returned by e_zone_useful_geometry_get()
- * are moved to useful positions.
- */
- // ->
- if (e_config->geometry_auto_move)
- {
- if (bd->x < zx)
- bd->x = zx;
-
- if (bd->y < zy)
- bd->y = zy;
-
- /* ensure we account for windows which already have client_inset;
- * fixes lots of wine placement issues
- */
- if (bd->x - bd->client_inset.l >= zx)
- bd->x -= bd->client_inset.l;
- if (bd->y - bd->client_inset.t >= zy)
- bd->y -= bd->client_inset.t;
-
- if (bd->x + bd->w > zx + zw)
- bd->x = zx + zw - bd->w;
-
- if (bd->y + bd->h > zy + zh)
- bd->y = zy + zh - bd->h;
-
- // <--
- if (bd->zone && e_container_zone_at_point_get(bd->zone->container, bd->x, bd->y))
- {
- if (!E_INSIDE(bd->x, bd->y, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h))
- {
- bd->x = E_CLAMP(bd->x, bd->zone->x, bd->zone->x + bd->zone->w);
- bd->y = E_CLAMP(bd->y, bd->zone->y, bd->zone->y + bd->zone->h);
- }
- /* some application failing to correctly center a window */
- if (eina_list_count(bd->zone->container->zones) > 1)
- {
- if (((abs((bd->zone->container->w / 2) - bd->x) < 3) || //bd->x is center of container
- ((abs((bd->zone->container->w / 2) - bd->x - bd->w) < 3) || //bd->x - bd->w is center of container
- (abs((bd->zone->container->w / 2) - bd->x - (bd->w / 2)) < 3))) || //bd->x - bd->w/2 is center of container
- ((abs((bd->zone->container->h / 2) - bd->y) < 3) || //bd->y is center of container
- ((abs((bd->zone->container->h / 2) - bd->y - bd->h) < 3) || //bd->y - bd->h is center of container
- (abs((bd->zone->container->h / 2) - bd->y - (bd->h / 2)) < 3))) //bd->y - bd->h/2 is center of container
- )
- e_border_center(bd);
- }
- bd->changes.pos = 1;
- bd->placed = 1;
- }
- }
- else
- {
- bd->changes.pos = 1;
- bd->placed = 1;
- }
- }
- if (!bd->placed)
- {
- /* FIXME: special placement for dialogs etc. etc. etc goes
- * here */
- /* FIXME: what if parent is not on this desktop - or zone? */
- if ((bd->parent) && (bd->parent->visible))
- {
- bd->x = bd->parent->x + ((bd->parent->w - bd->w) / 2);
- bd->y = bd->parent->y + ((bd->parent->h - bd->h) / 2);
- bd->changes.pos = 1;
- bd->placed = 1;
- }
-#if 0
- else if ((bd->leader) && (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))
- {
- /* TODO: Place in center of group */
- }
-#endif
- else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)
- {
- bd->x = zx + ((zw - bd->w) / 2);
- bd->y = zy + ((zh - bd->h) / 2);
- bd->changes.pos = 1;
- bd->placed = 1;
- }
- }
- if (!bd->placed)
- {
- Eina_List *skiplist = NULL;
- int new_x, new_y;
-
- if (zw > bd->w)
- new_x = zx + (rand() % (zw - bd->w));
- else
- new_x = zx;
- if (zh > bd->h)
- new_y = zy + (rand() % (zh - bd->h));
- else
- new_y = zy;
-
- if ((e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART) || (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET))
- {
- skiplist = eina_list_append(skiplist, bd);
- if (bd->desk)
- e_place_desk_region_smart(bd->desk, skiplist,
- bd->x, bd->y, bd->w, bd->h,
- &new_x, &new_y);
- else
- e_place_zone_region_smart(bd->zone, skiplist,
- bd->x, bd->y, bd->w, bd->h,
- &new_x, &new_y);
- eina_list_free(skiplist);
- }
- else if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL)
- {
- e_place_zone_manual(bd->zone, bd->w, bd->client_inset.t,
- &new_x, &new_y);
- }
- else
- {
- e_place_zone_cursor(bd->zone, bd->x, bd->y, bd->w, bd->h,
- bd->client_inset.t, &new_x, &new_y);
- }
- bd->x = new_x;
- bd->y = new_y;
- bd->changes.pos = 1;
- }
-
- EINA_LIST_FREE(bd->pending_move_resize, pnd)
- {
- if ((!bd->lock_client_location) && (pnd->move))
- {
- bd->x = pnd->x;
- bd->y = pnd->y;
- bd->changes.pos = 1;
- bd->placed = 1;
- if (pnd->without_border)
- {
- bd->x -= bd->client_inset.l;
- bd->y -= bd->client_inset.t;
- }
- }
- if ((!bd->lock_client_size) && (pnd->resize))
- {
- bd->w = pnd->w + (e_border_inset_width_get(bd));
- bd->h = pnd->h + (e_border_inset_height_get(bd));
- bd->client.w = pnd->w;
- bd->client.h = pnd->h;
- bd->changes.size = 1;
- }
-
- free(pnd);
- }
-
- /* Recreate state */
- e_hints_window_init(bd);
- if ((bd->client.e.state.centered) &&
- ((!bd->remember) ||
- ((bd->remember) && (!(bd->remember->apply & E_REMEMBER_APPLY_POS)))))
- {
- bd->x = zx + (zw - bd->w) / 2;
- bd->y = zy + (zh - bd->h) / 2;
- bd->changes.pos = 1;
- bd->placed = 1;
- }
-
- _e_border_client_move_resize_send(bd);
-
- /* if the explicit geometry request asks for the app to be
- * in another zone - well move it there */
- {
- E_Zone *zone;
-
- zone = e_container_zone_at_point_get(bd->zone->container,
- bd->x + (bd->w / 2),
- bd->y + (bd->h / 2));
- if (!zone)
- zone = e_container_zone_at_point_get(bd->zone->container,
- bd->x,
- bd->y);
- if (!zone)
- zone = e_container_zone_at_point_get(bd->zone->container,
- bd->x + bd->w - 1,
- bd->y);
- if (!zone)
- zone = e_container_zone_at_point_get(bd->zone->container,
- bd->x + bd->w - 1,
- bd->y + bd->h - 1);
- if (!zone)
- zone = e_container_zone_at_point_get(bd->zone->container,
- bd->x,
- bd->y + bd->h - 1);
- if ((zone) && (zone != bd->zone))
- e_border_zone_set(bd, zone);
- }
- }
-
- _e_border_hook_call(E_BORDER_HOOK_EVAL_POST_NEW_BORDER, bd);
-
- /* effect changes to the window border itself */
- if ((bd->changes.shading))
- {
- /* show at start of unshade (but don't hide until end of shade) */
- //if (bd->shaded)
- //ecore_x_window_raise(bd->win);
- bd->changes.shading = 0;
- send_event = 0;
- rem_change = 1;
- }
- if (bd->changes.shaded) send_event = 0;
- if ((bd->changes.shaded) && (bd->changes.pos) && (bd->changes.size))
- {
- //if (bd->shaded)
- //ecore_x_window_lower(bd->win);
- //else
- //ecore_x_window_raise(bd->win);
- bd->changes.shaded = 0;
- rem_change = 1;
- }
- else if ((bd->changes.shaded) && (bd->changes.pos))
- {
- //if (bd->shaded)
- //ecore_x_window_lower(bd->win);
- //else
- //ecore_x_window_raise(bd->win);
- bd->changes.size = 1;
- bd->changes.shaded = 0;
- rem_change = 1;
- }
- else if ((bd->changes.shaded) && (bd->changes.size))
- {
- //if (bd->shaded)
- //ecore_x_window_lower(bd->win);
- //else
- //ecore_x_window_raise(bd->win);
- bd->changes.shaded = 0;
- rem_change = 1;
- }
- else if (bd->changes.shaded)
- {
- //if (bd->shaded)
- //ecore_x_window_lower(bd->win);
- //else
- //ecore_x_window_raise(bd->win);
- bd->changes.shaded = 0;
- rem_change = 1;
- }
-
- if (bd->changes.size)
- {
- int x, y, w = 0, h = 0;
-
- x = bd->x + bd->client_inset.l;
- y = bd->y + bd->client_inset.t;
- if ((!bd->shaded) || (bd->shading))
- {
- w = bd->w - (e_border_inset_width_get(bd));
- h = bd->h - (e_border_inset_height_get(bd));
-
- if (bd->shading)
- {
- if (bd->shade.dir == E_DIRECTION_UP)
- {
- y = h - bd->client.h;
- }
- else if (bd->shade.dir == E_DIRECTION_LEFT)
- {
- x = w - bd->client.w;
- }
- }
- }
-
- if (bd->client.e.state.video)
- {
- if (bd->client.e.state.video_position.updated)
- {
- ecore_x_window_move(bd->win,
- bd->client.e.state.video_parent_border->x +
- bd->client.e.state.video_parent_border->client_inset.l +
- bd->client.e.state.video_position.x,
- bd->client.e.state.video_parent_border->y +
- bd->client.e.state.video_parent_border->client_inset.t +
- bd->client.e.state.video_position.y);
- bd->client.e.state.video_position.updated = 0;
- }
- }
- else if (!bd->changes.pos)
- {
- if (bd->post_job) ecore_idle_enterer_del(bd->post_job);
- bd->post_job = ecore_idle_enterer_add(_e_border_post_move_resize_job, bd);
- bd->post_resize = 1;
- }
- else
- {
- E_Border *tmp;
- Eina_List *l;
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- ecore_x_window_move(tmp->win,
- bd->x + bd->client_inset.l + tmp->client.e.state.video_position.x,
- bd->y + bd->client_inset.t + tmp->client.e.state.video_position.y);
- }
-
- if ((!bd->shaded) && (!bd->shading))
- {
- ecore_x_window_move_resize(bd->win, x, y, w, h);
-
- if (bd->internal_ecore_evas)
- ecore_evas_move_resize(bd->internal_ecore_evas, 0, 0, w, h);
- else if (!bd->client.e.state.video)
- {
- ecore_x_window_move_resize(bd->client.win, 0, 0, bd->client.w, bd->client.h);
- if (bd->client.lock_win)
- ecore_x_window_move_resize(bd->client.lock_win, 0, 0, bd->client.w, bd->client.h);
- }
- _e_border_client_move_resize_send(bd);
- }
- else if (bd->changes.pos)
- ecore_x_window_move(bd->win, x, y);
-
- e_container_shape_resize(bd->shape, w, h);
- if (bd->changes.pos)
- e_container_shape_move(bd->shape, x, y);
-
- bd->changes.pos = 0;
- bd->changes.size = 0;
- rem_change = 1;
- }
- else if (bd->changes.pos)
- {
- if (bd->post_job) ecore_idle_enterer_del(bd->post_job);
- bd->post_job = ecore_idle_enterer_add(_e_border_post_move_resize_job, bd);
- bd->post_move = 1;
-
- e_container_shape_move(bd->shape, bd->x + bd->client_inset.l, bd->y + bd->client_inset.t);
-
- _e_border_client_move_resize_send(bd);
-
- bd->changes.pos = 0;
- rem_change = 1;
- }
-
- if (bd->changes.reset_gravity)
- {
- GRAV_SET(bd, ECORE_X_GRAVITY_NW);
- bd->changes.reset_gravity = 0;
- rem_change = 1;
- }
-
- if (bd->need_shape_merge)
- {
- _e_border_shape_input_rectangle_set(bd);
- if (!bd->client.shaped)
- ecore_x_window_shape_mask_set(bd->win, 0);
- //bd->need_shape_export = 1;
- bd->need_shape_merge = 0;
- }
-
- if (bd->need_shape_export)
- {
- Ecore_X_Rectangle *rects, *orects;
- int num;
-
- rects = ecore_x_window_shape_rectangles_get(bd->client.win, &num);
- if (rects)
- {
- int changed;
-
- changed = 1;
- if ((num == bd->shape->shape_rects_num) && (bd->shape->shape_rects))
- {
- int i;
-
- orects = (Ecore_X_Rectangle*)bd->shape->shape_rects;
- changed = 0;
- for (i = 0; i < num; i++)
- {
- if (rects[i].x < 0)
- {
- rects[i].width -= rects[i].x;
- rects[i].x = 0;
- }
- if ((rects[i].x + (int)rects[i].width) > bd->w)
- rects[i].width = rects[i].width - rects[i].x;
- if (rects[i].y < 0)
- {
- rects[i].height -= rects[i].y;
- rects[i].y = 0;
- }
- if ((rects[i].y + (int)rects[i].height) > bd->h)
- rects[i].height = rects[i].height - rects[i].y;
-
- if ((orects[i].x != rects[i].x) ||
- (orects[i].y != rects[i].y) ||
- (orects[i].width != rects[i].width) ||
- (orects[i].height != rects[i].height))
- {
- changed = 1;
- break;
- }
- }
- }
- if (changed)
- {
- if (bd->client.shaped)
- e_container_shape_solid_rect_set(bd->shape, 0, 0, 0, 0);
- e_container_shape_rects_set(bd->shape, (Eina_Rectangle*)rects, num);
- }
- else
- free(rects);
- }
- else
- {
- e_container_shape_rects_set(bd->shape, NULL, 0);
- }
- bd->need_shape_export = 0;
- }
-
- if ((bd->changes.visible) && (bd->visible) && (bd->new_client))
- {
- int x, y;
-
- ecore_x_pointer_xy_get(bd->zone->container->win, &x, &y);
- if ((!bd->placed) && (!bd->re_manage) &&
- (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL) &&
- (!((bd->client.icccm.transient_for != 0) ||
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))) &&
- (!bdmove) && (!bdresize))
- {
- /* Set this window into moving state */
-
- bd->cur_mouse_action = e_action_find("window_move");
- if (bd->cur_mouse_action)
- {
- if ((!bd->cur_mouse_action->func.end_mouse) &&
- (!bd->cur_mouse_action->func.end))
- bd->cur_mouse_action = NULL;
- if (bd->cur_mouse_action)
- {
- bd->x = x - (bd->w >> 1);
- bd->y = y - (bd->client_inset.t >> 1);
- BD_CHANGED(bd);
- bd->changes.pos = 1;
-
- _e_border_client_move_resize_send(bd);
- }
- }
- }
-
- _e_border_show(bd);
-
- if (bd->cur_mouse_action)
- {
- bd->moveinfo.down.x = bd->x;
- bd->moveinfo.down.y = bd->y;
- bd->moveinfo.down.w = bd->w;
- bd->moveinfo.down.h = bd->h;
- bd->mouse.current.mx = x;
- bd->mouse.current.my = y;
- bd->moveinfo.down.button = 0;
- bd->moveinfo.down.mx = x;
- bd->moveinfo.down.my = y;
-
- grabbed = 1;
- e_object_ref(E_OBJECT(bd->cur_mouse_action));
- bd->cur_mouse_action->func.go(E_OBJECT(bd), NULL);
- if (e_config->border_raise_on_mouse_action)
- e_border_raise(bd);
- e_border_focus_set(bd, 1, 1);
- }
- bd->changes.visible = 0;
- rem_change = 1;
- {
- E_Event_Border_Show *ev;
-
- ev = E_NEW(E_Event_Border_Show, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_show_event");
- ecore_event_add(E_EVENT_BORDER_SHOW, ev, _e_border_event_border_show_free, NULL);
- }
- }
- else if ((bd->changes.visible) && (bd->new_client))
- {
- bd->changes.visible = 0;
- {
- E_Event_Border_Hide *ev;
-
- ev = E_NEW(E_Event_Border_Hide, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_hide_event");
- ecore_event_add(E_EVENT_BORDER_HIDE, ev, _e_border_event_border_hide_free, NULL);
- }
- }
-
- if (bd->changes.icon)
- {
- if (bd->desktop && (!bd->new_client))
- {
- efreet_desktop_free(bd->desktop);
- bd->desktop = NULL;
- }
- if (bd->icon_object && (!bd->new_client))
- {
- evas_object_del(bd->icon_object);
- bd->icon_object = NULL;
- }
- if (bd->remember && bd->remember->prop.desktop_file)
- {
- const char *desktop = bd->remember->prop.desktop_file;
-
- bd->desktop = efreet_desktop_get(desktop);
- if (!bd->desktop)
- bd->desktop = efreet_util_desktop_name_find(desktop);
- }
- if (!bd->desktop)
- {
- if (bd->internal && (bd->client.icccm.class && (!strncmp(bd->client.icccm.class, "e_fwin::", 8))))
- bd->desktop = efreet_util_desktop_exec_find("enlightenment_filemanager");
- }
- if (!bd->desktop)
- {
- if ((bd->client.icccm.name) && (bd->client.icccm.class))
- bd->desktop = efreet_util_desktop_wm_class_find(bd->client.icccm.name,
- bd->client.icccm.class);
- }
- if (!bd->desktop)
- {
- /* libreoffice and maybe others match window class
- with .desktop file name */
- if (bd->client.icccm.class)
- {
- char buf[128];
- snprintf(buf, sizeof(buf), "%s.desktop", bd->client.icccm.class);
- bd->desktop = efreet_util_desktop_file_id_find(buf);
- }
- if ((!bd->desktop) && (bd->client.icccm.class))
- {
- char buf[4096], *s;
-
- strncpy(buf, bd->client.icccm.class, sizeof(buf) - 1);
- buf[sizeof(buf) - 1] = 0;
- s = buf;
- eina_str_tolower(&s);
- if (strcmp(s, bd->client.icccm.class))
- bd->desktop = efreet_util_desktop_exec_find(s);
- }
- }
- if (!bd->desktop)
- {
- bd->desktop = e_exec_startup_id_pid_find(bd->client.netwm.startup_id,
- bd->client.netwm.pid);
- if (bd->desktop) efreet_desktop_ref(bd->desktop);
- }
- if (!bd->desktop && bd->client.icccm.name)
- {
- /* this works for most cases as fallback. useful when app is
- run from a shell */
- bd->desktop = efreet_util_desktop_exec_find(bd->client.icccm.name);
- }
- if (!bd->desktop && bd->client.icccm.transient_for)
- {
- E_Border *bd2 = e_border_find_by_client_window(bd->client.icccm.transient_for);
- if (bd2 && bd2->desktop)
- {
- efreet_desktop_ref(bd2->desktop);
- bd->desktop = bd2->desktop;
- }
- }
- if (bd->desktop)
- {
- ecore_x_window_prop_string_set(bd->client.win, E_ATOM_DESKTOP_FILE,
- bd->desktop->orig_path);
- }
-
- bd->icon_object = e_border_icon_add(bd, e_comp_get(bd)->evas);
- if ((bd->focused) && (bd->icon_object))
- edje_object_signal_emit(bd->icon_object, "e,state,focused", "e");
- if (bd->bg_object)
- {
- evas_object_show(bd->icon_object);
- edje_object_part_swallow(bd->bg_object, "e.swallow.icon", bd->icon_object);
- }
- else
- evas_object_hide(bd->icon_object);
-
- {
- E_Event_Border_Icon_Change *ev;
-
- ev = E_NEW(E_Event_Border_Icon_Change, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- // e_object_breadcrumb_add(E_OBJECT(bd), "border_icon_change_event");
- ecore_event_add(E_EVENT_BORDER_ICON_CHANGE, ev,
- _e_border_event_border_icon_change_free, NULL);
- }
- if ((bd->new_client || bd->re_manage) && bd->desktop && (!bd->exe_inst))
- e_exec_phony(bd);
- bd->changes.icon = 0;
- }
-
- bd->new_client = 0;
- bd->changed = 0;
- bd->changes.stack = 0;
-
- if ((bd->take_focus) || (bd->want_focus))
- {
- bd->take_focus = 0;
- if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) || (bd->want_focus))
- {
- bd->want_focus = 0;
- e_border_focus_set_with_pointer(bd);
- }
- else if ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG) ||
- (bd->parent && (bd->parent->modal == bd)))
- {
- if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
- ((e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED) &&
- (e_border_find_by_client_window(bd->client.icccm.transient_for) ==
- e_border_focused_get())))
- {
- e_border_focus_set_with_pointer(bd);
- }
- }
- else
- {
- /* focus window by default when it is the only one on desk */
- E_Border *bd2 = NULL;
- Eina_List *l;
- EINA_LIST_FOREACH(focus_stack, l, bd2)
- {
- if (bd == bd2) continue;
- if ((!bd2->iconic) && (bd2->visible) &&
- ((bd->desk == bd2->desk) || bd2->sticky))
- break;
- }
-
- if (!bd2)
- {
- e_border_focus_set_with_pointer(bd);
- }
- }
- }
-
- if (bd->need_maximize)
- {
- E_Maximize max;
- max = bd->maximized;
- bd->maximized = E_MAXIMIZE_NONE;
- e_border_maximize(bd, max);
- bd->need_maximize = 0;
- }
-
- if (bd->need_fullscreen)
- {
- e_border_fullscreen(bd, e_config->fullscreen_policy);
- bd->need_fullscreen = 0;
- }
-
- if (rem_change)
- e_remember_update(bd);
-
- if (send_event) // FIXME: send only if a property changed - above need to
- { // check on that. for now - always send.
- event = E_NEW(E_Event_Border_Property, 1);
- event->border = bd;
- e_object_ref(E_OBJECT(bd));
- ecore_event_add(E_EVENT_BORDER_PROPERTY, event, _e_border_event_border_property_free, NULL);
- }
- _e_border_hook_call(E_BORDER_HOOK_EVAL_END, bd);
-}
-
-static void
-_e_border_moveinfo_gather(E_Border *bd,
- const char *source)
-{
- if (e_util_glob_match(source, "mouse,*,1")) bd->moveinfo.down.button = 1;
- else if (e_util_glob_match(source, "mouse,*,2"))
- bd->moveinfo.down.button = 2;
- else if (e_util_glob_match(source, "mouse,*,3"))
- bd->moveinfo.down.button = 3;
- else bd->moveinfo.down.button = 0;
- if ((bd->moveinfo.down.button >= 1) && (bd->moveinfo.down.button <= 3))
- {
- bd->moveinfo.down.mx = bd->mouse.last_down[bd->moveinfo.down.button - 1].mx;
- bd->moveinfo.down.my = bd->mouse.last_down[bd->moveinfo.down.button - 1].my;
- }
- else
- {
- bd->moveinfo.down.mx = bd->mouse.current.mx;
- bd->moveinfo.down.my = bd->mouse.current.my;
- }
-}
-
-static void
-_e_border_resize_handle(E_Border *bd)
-{
- int x, y, w, h;
- int new_x, new_y, new_w, new_h;
- int tw, th;
- Eina_List *skiplist = NULL;
-
- x = bd->x;
- y = bd->y;
- w = bd->w;
- h = bd->h;
-
- if ((bd->resize_mode == E_POINTER_RESIZE_TR) ||
- (bd->resize_mode == E_POINTER_RESIZE_R) ||
- (bd->resize_mode == E_POINTER_RESIZE_BR))
- {
- if ((bd->moveinfo.down.button >= 1) &&
- (bd->moveinfo.down.button <= 3))
- w = bd->mouse.last_down[bd->moveinfo.down.button - 1].w +
- (bd->mouse.current.mx - bd->moveinfo.down.mx);
- else
- w = bd->moveinfo.down.w + (bd->mouse.current.mx - bd->moveinfo.down.mx);
- }
- else if ((bd->resize_mode == E_POINTER_RESIZE_TL) ||
- (bd->resize_mode == E_POINTER_RESIZE_L) ||
- (bd->resize_mode == E_POINTER_RESIZE_BL))
- {
- if ((bd->moveinfo.down.button >= 1) &&
- (bd->moveinfo.down.button <= 3))
- w = bd->mouse.last_down[bd->moveinfo.down.button - 1].w -
- (bd->mouse.current.mx - bd->moveinfo.down.mx);
- else
- w = bd->moveinfo.down.w - (bd->mouse.current.mx - bd->moveinfo.down.mx);
- }
-
- if ((bd->resize_mode == E_POINTER_RESIZE_TL) ||
- (bd->resize_mode == E_POINTER_RESIZE_T) ||
- (bd->resize_mode == E_POINTER_RESIZE_TR))
- {
- if ((bd->moveinfo.down.button >= 1) &&
- (bd->moveinfo.down.button <= 3))
- h = bd->mouse.last_down[bd->moveinfo.down.button - 1].h -
- (bd->mouse.current.my - bd->moveinfo.down.my);
- else
- h = bd->moveinfo.down.h - (bd->mouse.current.my - bd->moveinfo.down.my);
- }
- else if ((bd->resize_mode == E_POINTER_RESIZE_BL) ||
- (bd->resize_mode == E_POINTER_RESIZE_B) ||
- (bd->resize_mode == E_POINTER_RESIZE_BR))
- {
- if ((bd->moveinfo.down.button >= 1) &&
- (bd->moveinfo.down.button <= 3))
- h = bd->mouse.last_down[bd->moveinfo.down.button - 1].h +
- (bd->mouse.current.my - bd->moveinfo.down.my);
- else
- h = bd->moveinfo.down.h + (bd->mouse.current.my - bd->moveinfo.down.my);
- }
-
- tw = bd->w;
- th = bd->h;
-
- if ((bd->resize_mode == E_POINTER_RESIZE_TL) ||
- (bd->resize_mode == E_POINTER_RESIZE_L) ||
- (bd->resize_mode == E_POINTER_RESIZE_BL))
- x += (tw - w);
- if ((bd->resize_mode == E_POINTER_RESIZE_TL) ||
- (bd->resize_mode == E_POINTER_RESIZE_T) ||
- (bd->resize_mode == E_POINTER_RESIZE_TR))
- y += (th - h);
-
- skiplist = eina_list_append(skiplist, bd);
- e_resist_container_border_position(bd->zone->container, skiplist,
- bd->x, bd->y, bd->w, bd->h,
- x, y, w, h,
- &new_x, &new_y, &new_w, &new_h);
- eina_list_free(skiplist);
-
- w = new_w;
- h = new_h;
- e_border_resize_limit(bd, &new_w, &new_h);
- if ((bd->resize_mode == E_POINTER_RESIZE_TL) ||
- (bd->resize_mode == E_POINTER_RESIZE_L) ||
- (bd->resize_mode == E_POINTER_RESIZE_BL))
- new_x += (w - new_w);
- if ((bd->resize_mode == E_POINTER_RESIZE_TL) ||
- (bd->resize_mode == E_POINTER_RESIZE_T) ||
- (bd->resize_mode == E_POINTER_RESIZE_TR))
- new_y += (h - new_h);
-
- e_border_move_resize(bd, new_x, new_y, new_w, new_h);
-}
-
-static Eina_Bool
-_e_border_shade_animator(void *data)
-{
- E_Border *bd = data;
- E_Event_Border_Simple *ev;
- Eina_Bool move = EINA_FALSE;
- double dt, val;
- double dur = bd->client.h / e_config->border_shade_speed;
-
- dt = ecore_loop_time_get() - bd->shade.start;
- val = dt / dur;
-
- if (val < 0.0) val = 0.0;
- else if (val > 1.0)
- val = 1.0;
-
- if (e_config->border_shade_transition == E_TRANSITION_SINUSOIDAL)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else if (e_config->border_shade_transition == E_TRANSITION_DECELERATE)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_DECELERATE, 0.0, 0.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else if (e_config->border_shade_transition == E_TRANSITION_ACCELERATE)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else if (e_config->border_shade_transition == E_TRANSITION_LINEAR)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_LINEAR, 0.0, 0.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else if (e_config->border_shade_transition == E_TRANSITION_ACCELERATE_LOTS)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_ACCELERATE_FACTOR, 1.7, 0.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else if (e_config->border_shade_transition == E_TRANSITION_DECELERATE_LOTS)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_DECELERATE_FACTOR, 1.7, 0.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else if (e_config->border_shade_transition == E_TRANSITION_SINUSOIDAL_LOTS)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_SINUSOIDAL_FACTOR, 1.7, 0.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else if (e_config->border_shade_transition == E_TRANSITION_BOUNCE)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_BOUNCE, 1.2, 3.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else if (e_config->border_shade_transition == E_TRANSITION_BOUNCE_LOTS)
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_BOUNCE, 1.2, 5.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
- else
- {
- bd->shade.val =
- ecore_animator_pos_map(val, ECORE_POS_MAP_LINEAR, 0.0, 0.0);
- if (!bd->shaded) bd->shade.val = 1.0 - bd->shade.val;
- }
-
- /* due to M_PI's innacuracy, cos(M_PI/2) != 0.0, so we need this */
- if (bd->shade.val < 0.001) bd->shade.val = 0.0;
- else if (bd->shade.val > .999)
- bd->shade.val = 1.0;
-
- if (bd->shade.dir == E_DIRECTION_UP)
- bd->h = bd->client_inset.t + bd->client.h * bd->shade.val;
- else if (bd->shade.dir == E_DIRECTION_DOWN)
- {
- bd->h = bd->client_inset.t + bd->client.h * bd->shade.val;
- bd->y = bd->shade.y + bd->client.h * (1 - bd->shade.val);
- move = EINA_TRUE;
- }
- else if (bd->shade.dir == E_DIRECTION_LEFT)
- bd->w = bd->client_inset.t + bd->client.w * bd->shade.val;
- else if (bd->shade.dir == E_DIRECTION_RIGHT)
- {
- bd->w = bd->client_inset.t + bd->client.w * bd->shade.val;
- bd->x = bd->shade.x + bd->client.w * (1 - bd->shade.val);
- move = EINA_TRUE;
- }
-
- if (bd->client.shaped)
- {
- bd->need_shape_merge = 1;
- bd->need_shape_export = 1;
- }
- if (bd->shaped_input)
- {
- bd->need_shape_merge = 1;
- }
- BD_CHANGED(bd);
-
- /* we're done */
- if (val == 1)
- {
- bd->shading = 0;
- bd->shaded = !(bd->shaded);
- bd->changes.shaded = 1;
- bd->changes.shading = 1;
- bd->shade.anim = NULL;
-
- if (bd->shaded)
- edje_object_signal_emit(bd->bg_object, "e,state,shaded", "e");
- else
- edje_object_signal_emit(bd->bg_object, "e,state,unshaded", "e");
- edje_object_message_signal_process(bd->bg_object);
- e_border_frame_recalc(bd);
- e_border_comp_hidden_set(bd, bd->shaded);
- }
- if (move)
- {
- ev = E_NEW(E_Event_Border_Simple, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
- ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free, NULL);
- e_container_shape_move(bd->shape, bd->x, bd->y);
- }
- e_container_shape_resize(bd->shape, bd->w, bd->h);
- ev = E_NEW(E_Event_Border_Simple, 1);
- ev->border = bd;
- e_object_ref(E_OBJECT(bd));
-// e_object_breadcrumb_add(E_OBJECT(bd), "border_resize_event");
- ecore_event_add(E_EVENT_BORDER_RESIZE, ev, _e_border_event_border_resize_free, NULL);
- return (val != 1);
-}
-
-static void
-_e_border_event_border_resize_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Resize *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_resize_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_move_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Move *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_move_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_add_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Add *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_add_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_remove_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Remove *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_remove_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_show_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Show *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_show_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_hide_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Hide *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_hide_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_iconify_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Iconify *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_iconify_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_uniconify_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Uniconify *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_uniconify_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_stick_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Stick *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_stick_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_unstick_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Unstick *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_unstick_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_zone_set_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Zone_Set *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_zone_set_event");
- e_object_unref(E_OBJECT(e->border));
- e_object_unref(E_OBJECT(e->zone));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_desk_set_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Desk_Set *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_desk_set_event");
- e_object_unref(E_OBJECT(e->border));
- e_object_unref(E_OBJECT(e->desk));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_stack_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Stack *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_raise_event");
- e_object_unref(E_OBJECT(e->border));
- if (e->stack)
- {
-// e_object_breadcrumb_del(E_OBJECT(e->above), "border_raise_event.above");
- e_object_unref(E_OBJECT(e->stack));
- }
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_icon_change_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Icon_Change *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_icon_change_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_title_change_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Title_Change *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_icon_change_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_urgent_change_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Urgent_Change *e;
-
- e = ev;
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_focus_in_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Focus_In *e;
-
- e = ev;
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_focus_out_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Focus_Out *e;
-
- e = ev;
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_property_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Property *e;
-
- e = ev;
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_fullscreen_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Fullscreen *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_fullscreen_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_event_border_unfullscreen_free(void *data __UNUSED__,
- void *ev)
-{
- E_Event_Border_Unfullscreen *e;
-
- e = ev;
-// e_object_breadcrumb_del(E_OBJECT(e->border), "border_unfullscreen_event");
- e_object_unref(E_OBJECT(e->border));
- E_FREE(e);
-}
-
-static void
-_e_border_zone_update(E_Border *bd)
-{
- E_Container *con;
- Eina_List *l;
- E_Zone *zone;
-
- /* still within old zone - leave it there */
- if (E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
- bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h))
- return;
- /* find a new zone */
- con = bd->zone->container;
- EINA_LIST_FOREACH(con->zones, l, zone)
- {
- if (E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
- zone->x, zone->y, zone->w, zone->h))
- {
- e_border_zone_set(bd, zone);
- return;
- }
- }
-}
-
-static int
-_e_border_resize_begin(E_Border *bd)
-{
- if (!bd->lock_user_stacking)
- {
- if (e_config->border_raise_on_mouse_action)
- e_border_raise(bd);
- }
- if ((bd->shaded) || (bd->shading) ||
- (bd->fullscreen) || (bd->lock_user_size))
- return 0;
-
- if (!_e_border_action_input_win_new(bd))
- {
- grabbed = 0;
- return 0;
- }
-
- if (bd->client.netwm.sync.request)
- {
- bd->client.netwm.sync.alarm = ecore_x_sync_alarm_new(bd->client.netwm.sync.counter);
- bd->client.netwm.sync.serial = 1;
- bd->client.netwm.sync.wait = 0;
- bd->client.netwm.sync.send_time = ecore_loop_time_get();
- }
-
- _e_border_hook_call(E_BORDER_HOOK_RESIZE_BEGIN, bd);
-
- bdresize = bd;
- return 1;
-}
-
-static int
-_e_border_resize_end(E_Border *bd)
-{
- if (grabbed)
- {
- e_grabinput_release(bd->win, bd->win);
- grabbed = 0;
- }
- if (bd->client.netwm.sync.alarm)
- {
- E_Border_Pending_Move_Resize *pnd;
-
- ecore_x_sync_alarm_free(bd->client.netwm.sync.alarm);
- bd->client.netwm.sync.alarm = 0;
- /* resize to last geometry if sync alarm for it was not yet handled */
- if (bd->pending_move_resize)
- {
- BD_CHANGED(bd);
- bd->changes.pos = 1;
- bd->changes.size = 1;
- _e_border_client_move_resize_send(bd);
- }
-
- EINA_LIST_FREE(bd->pending_move_resize, pnd)
- E_FREE(pnd);
- }
- e_pointer_mode_pop(bd, bd->resize_mode);
- bd->resize_mode = E_POINTER_RESIZE_NONE;
- _e_border_hook_call(E_BORDER_HOOK_RESIZE_END, bd);
-
- bdresize = NULL;
-
- /* If this border was maximized, we need to unset Maximized state or
- * on restart, E still thinks it's maximized */
- if (bd->maximized != E_MAXIMIZE_NONE)
- e_hints_window_maximized_set(bd, bd->maximized & E_MAXIMIZE_NONE,
- bd->maximized & E_MAXIMIZE_NONE);
- return 1;
-}
-
-static void
-_e_border_resize_update(E_Border *bd)
-{
- _e_border_hook_call(E_BORDER_HOOK_RESIZE_UPDATE, bd);
-}
-
-static int
-_e_border_move_begin(E_Border *bd)
-{
- if (!bd->lock_user_stacking)
- {
- if (e_config->border_raise_on_mouse_action)
- e_border_raise(bd);
- }
- if ((bd->fullscreen) || (bd->lock_user_location))
- return 0;
-
- if (grabbed && !e_grabinput_get(bd->win, 0, bd->win))
- {
- grabbed = 0;
- return 0;
- }
-#if 0
- if (bd->client.netwm.sync.request)
- {
- bd->client.netwm.sync.alarm = ecore_x_sync_alarm_new(bd->client.netwm.sync.counter);
- bd->client.netwm.sync.serial = 0;
- bd->client.netwm.sync.wait = 0;
- bd->client.netwm.sync.time = ecore_loop_time_get();
- }
-#endif
- _e_border_hook_call(E_BORDER_HOOK_MOVE_BEGIN, bd);
-
- bdmove = bd;
- return 1;
-}
-
-static int
-_e_border_move_end(E_Border *bd)
-{
- if (grabbed)
- {
- e_grabinput_release(bd->win, bd->win);
- grabbed = 0;
- }
-#if 0
- if (bd->client.netwm.sync.alarm)
- {
- ecore_x_sync_alarm_free(bd->client.netwm.sync.alarm);
- bd->client.netwm.sync.alarm = 0;
- }
-#endif
- e_pointer_mode_pop(bd, E_POINTER_MOVE);
- bd->moving = 0;
- _e_border_hook_call(E_BORDER_HOOK_MOVE_END, bd);
-
- bdmove = NULL;
- return 1;
-}
-
-static void
-_e_border_move_update(E_Border *bd)
-{
- _e_border_hook_call(E_BORDER_HOOK_MOVE_UPDATE, bd);
-}
-
-static Eina_Bool
-_e_border_cb_ping_poller(void *data)
-{
- E_Border *bd;
-
- bd = data;
- if (bd->ping_ok)
- {
- if (bd->hung)
- {
- bd->hung = 0;
- edje_object_signal_emit(bd->bg_object, "e,state,unhung", "e");
- if (bd->kill_timer)
- {
- ecore_timer_del(bd->kill_timer);
- bd->kill_timer = NULL;
- }
- }
- }
- else
- {
- /* if time between last ping and now is greater
- * than half the ping interval... */
- if ((ecore_loop_time_get() - bd->ping) >
- ((e_config->ping_clients_interval *
- ecore_poller_poll_interval_get(ECORE_POLLER_CORE)) / 2.0))
- {
- if (!bd->hung)
- {
- bd->hung = 1;
- edje_object_signal_emit(bd->bg_object, "e,state,hung", "e");
- /* FIXME: if below dialog is up - hide it now */
- }
- if (bd->delete_requested)
- {
- /* FIXME: pop up dialog saying app is hung - kill client, or pid */
- e_border_act_kill_begin(bd);
- }
- }
- }
- bd->ping_poller = NULL;
- e_border_ping(bd);
- return ECORE_CALLBACK_CANCEL;
-}
-
-static Eina_Bool
-_e_border_cb_kill_timer(void *data)
-{
- E_Border *bd;
-
- bd = data;
-// dont wait until it's hung -
-// if (bd->hung)
-// {
- if (bd->client.netwm.pid > 1)
- kill(bd->client.netwm.pid, SIGKILL);
-// }
- bd->kill_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
-static Eina_List *_e_border_hooks = NULL;
-static int _e_border_hooks_delete = 0;
-static int _e_border_hooks_walking = 0;
-
-static void
-_e_border_hooks_clean(void)
-{
- Eina_List *l, *ln;
- E_Border_Hook *bh;
-
- EINA_LIST_FOREACH_SAFE(_e_border_hooks, l, ln, bh)
- {
- if (bh->delete_me)
- {
- _e_border_hooks = eina_list_remove_list(_e_border_hooks, l);
- free(bh);
- }
- }
-}
-
-static void
-_e_border_hook_call(E_Border_Hook_Point hookpoint,
- void *bd)
-{
- Eina_List *l;
- E_Border_Hook *bh;
-
- _e_border_hooks_walking++;
- EINA_LIST_FOREACH(_e_border_hooks, l, bh)
- {
- if (bh->delete_me) continue;
- if (bh->hookpoint == hookpoint) bh->func(bh->data, bd);
- }
- _e_border_hooks_walking--;
- if ((_e_border_hooks_walking == 0) && (_e_border_hooks_delete > 0))
- _e_border_hooks_clean();
-}
-
-EAPI E_Border_Hook *
-e_border_hook_add(E_Border_Hook_Point hookpoint,
- void (*func)(void *data,
- void *bd),
- void *data)
-{
- E_Border_Hook *bh;
-
- bh = E_NEW(E_Border_Hook, 1);
- if (!bh) return NULL;
- bh->hookpoint = hookpoint;
- bh->func = func;
- bh->data = data;
- _e_border_hooks = eina_list_append(_e_border_hooks, bh);
- return bh;
-}
-
-EAPI void
-e_border_hook_del(E_Border_Hook *bh)
-{
- bh->delete_me = 1;
- if (_e_border_hooks_walking == 0)
- {
- _e_border_hooks = eina_list_remove(_e_border_hooks, bh);
- free(bh);
- }
- else
- _e_border_hooks_delete++;
-}
-
-EAPI void
-e_border_focus_track_freeze(void)
-{
- focus_track_frozen++;
-}
-
-EAPI void
-e_border_focus_track_thaw(void)
-{
- focus_track_frozen--;
-}
-
-static E_Border *
-_e_border_under_pointer_helper(E_Desk *desk, E_Border *exclude, int x, int y)
-{
- E_Border *bd = NULL, *cbd;
- Eina_List *l;
-
- EINA_LIST_FOREACH(e_border_raise_stack_get(), l, cbd)
- {
- if (!cbd) continue;
- /* If a border was specified which should be excluded from the list
- * (because it will be closed shortly for example), skip */
- if ((exclude) && (cbd == exclude)) continue;
- if ((desk) && (cbd->desk != desk)) continue;
- if (!E_INSIDE(x, y, cbd->x, cbd->y, cbd->w, cbd->h))
- continue;
- /* If the layer is higher, the position of the window is higher
- * (always on top vs always below) */
- if (!bd || (cbd->layer > bd->layer))
- bd = cbd;
- }
- return bd;
-}
-
-EAPI E_Border *
-e_border_under_pointer_get(E_Desk *desk,
- E_Border *exclude)
-{
- int x, y;
-
- /* We need to ensure that we can get the container window for the
- * zone of either the given desk or the desk of the excluded
- * window, so return if neither is given */
- if (desk)
- ecore_x_pointer_xy_get(desk->zone->container->win, &x, &y);
- else if (exclude)
- ecore_x_pointer_xy_get(exclude->desk->zone->container->win, &x, &y);
- else
- return NULL;
-
- return _e_border_under_pointer_helper(desk, exclude, x, y);
-}
-
-static Eina_Bool
-_e_border_pointer_warp_to_center_timer(void *data __UNUSED__)
-{
- if (warp_to)
- {
- int x, y;
- double spd;
-
- ecore_x_pointer_xy_get(warp_to_win, &x, &y);
- /* move hasn't happened yet */
- if ((x == warp_x[1]) && (y == warp_y[1]))
- return EINA_TRUE;
- if ((abs(x - warp_x[0]) > 5) || (abs(y - warp_y[0]) > 5))
- {
- /* User moved the mouse, so stop warping */
- warp_to = 0;
- goto cleanup;
- }
-
- spd = e_config->pointer_warp_speed;
- warp_x[1] = x = warp_x[0];
- warp_y[1] = y = warp_y[0];
- warp_x[0] = (x * (1.0 - spd)) + (warp_to_x * spd);
- warp_y[0] = (y * (1.0 - spd)) + (warp_to_y * spd);
- if ((warp_x[0] == x) && (warp_y[0] == y))
- {
- warp_x[0] = warp_to_x;
- warp_y[0] = warp_to_y;
- warp_to = 0;
- goto cleanup;
- }
- ecore_x_pointer_warp(warp_to_win, warp_x[0], warp_y[0]);
- return ECORE_CALLBACK_RENEW;
- }
-cleanup:
- if (warp_timer) ecore_timer_del(warp_timer);
- warp_timer = NULL;
- e_border_focus_lock_set(EINA_FALSE);
- if (warp_timer_border)
- {
- warp_x[0] = warp_x[1] = warp_y[0] = warp_y[1] = -1;
- if (warp_timer_border->modal)
- {
- /* got a modal dialog during pointer warp...whoops */
- e_border_raise(warp_timer_border->modal);
- warp_timer_border = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
- e_focus_event_mouse_in(warp_timer_border);
- if (warp_timer_border->iconic)
- {
- if (!warp_timer_border->lock_user_iconify)
- e_border_uniconify(warp_timer_border);
- }
- if (warp_timer_border->shaded)
- {
- if (!warp_timer_border->lock_user_shade)
- e_border_unshade(warp_timer_border, warp_timer_border->shade.dir);
- }
-
- if (!warp_timer_border->lock_focus_out)
- {
- e_border_focus_set(warp_timer_border, 1, 1);
- e_border_focus_latest_set(warp_timer_border);
- }
- warp_timer_border = NULL;
- }
- return ECORE_CALLBACK_CANCEL;
-}
-
-EAPI int
-e_border_pointer_warp_to_center_now(E_Border *bd)
-{
- if (e_config->disable_all_pointer_warps) return 0;
- if (warp_timer_border == bd)
- {
- ecore_x_pointer_warp(warp_to_win, warp_to_x, warp_to_y);
- warp_to = 0;
- }
- else
- {
- if (e_border_pointer_warp_to_center(bd))
- e_border_pointer_warp_to_center_now(bd);
- }
- return 1;
-}
-
-EAPI int
-e_border_pointer_warp_to_center(E_Border *bd)
-{
- int x, y;
- E_Border *cbd = NULL;
-
- if (e_config->disable_all_pointer_warps) return 0;
- /* Only warp the pointer if it is not already in the area of
- * the given border */
- ecore_x_pointer_xy_get(bd->zone->container->win, &x, &y);
- if ((x >= bd->x) && (x <= (bd->x + bd->w)) &&
- (y >= bd->y) && (y <= (bd->y + bd->h)))
- {
- cbd = _e_border_under_pointer_helper(bd->desk, bd, x, y);
- if (cbd == bd) return 0;
- }
-
- warp_to_x = bd->x + (bd->w / 2);
- if (warp_to_x < (bd->zone->x + 1))
- warp_to_x = bd->zone->x + ((bd->x + bd->w - bd->zone->x) / 2);
- else if (warp_to_x > (bd->zone->x + bd->zone->w))
- warp_to_x = (bd->zone->x + bd->zone->w + bd->x) / 2;
-
- warp_to_y = bd->y + (bd->h / 2);
- if (warp_to_y < (bd->zone->y + 1))
- warp_to_y = bd->zone->y + ((bd->y + bd->h - bd->zone->y) / 2);
- else if (warp_to_y > (bd->zone->y + bd->zone->h))
- warp_to_y = (bd->zone->y + bd->zone->h + bd->y) / 2;
-
- /* TODO: handle case where another border is over the exact center,
- * find a place where the requested border is not overlapped?
- *
- if (!cbd) cbd = _e_border_under_pointer_helper(bd->desk, bd, x, y);
- if (cbd != bd)
- {
- }
- */
-
- warp_to = 1;
- warp_to_win = bd->zone->container->win;
- ecore_x_pointer_xy_get(bd->zone->container->win, &warp_x[0], &warp_y[0]);
- if (warp_timer) ecore_timer_del(warp_timer);
- warp_timer = ecore_timer_add(0.01, _e_border_pointer_warp_to_center_timer, bd);
- warp_timer_border = bd;
- e_border_focus_lock_set(EINA_TRUE);
- return 1;
-}
-
-EAPI void
-e_border_comp_hidden_set(E_Border *bd,
- Eina_Bool hidden)
-{
- E_Border *tmp;
- Eina_List *l;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- {
- if (hidden)
- ecore_x_window_hide(tmp->win);
- else
- ecore_x_window_show(tmp->win);
- }
-
- if (bd->comp_hidden == hidden) return;
-
- bd->comp_hidden = hidden;
-
- if ((bd->comp_hidden) || (bd->tmp_input_hidden > 0))
- {
- ecore_x_composite_window_events_disable(bd->win);
- ecore_x_window_ignore_set(bd->win, EINA_TRUE);
- }
- else
- {
- ecore_x_composite_window_events_enable(bd->win);
- ecore_x_window_ignore_set(bd->win, EINA_FALSE);
- }
-}
-
-EAPI void
-e_border_tmp_input_hidden_push(E_Border *bd)
-{
- E_Border *tmp;
- Eina_List *l;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- e_border_tmp_input_hidden_push(tmp);
-
- bd->tmp_input_hidden++;
- if (bd->tmp_input_hidden != 1) return;
-
- if ((bd->comp_hidden) || (bd->tmp_input_hidden > 0))
- {
- ecore_x_composite_window_events_disable(bd->win);
- ecore_x_window_ignore_set(bd->win, EINA_TRUE);
- }
- else
- {
- _e_border_shape_input_rectangle_set(bd);
- ecore_x_window_ignore_set(bd->win, EINA_FALSE);
- }
-}
-
-EAPI void
-e_border_tmp_input_hidden_pop(E_Border *bd)
-{
- E_Border *tmp;
- Eina_List *l;
-
- E_OBJECT_CHECK(bd);
- E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
-
- EINA_LIST_FOREACH(bd->client.e.state.video_child, l, tmp)
- e_border_tmp_input_hidden_pop(tmp);
-
- bd->tmp_input_hidden--;
- if (bd->tmp_input_hidden != 0) return;
-
- if ((bd->comp_hidden) || (bd->tmp_input_hidden > 0))
- {
- ecore_x_composite_window_events_disable(bd->win);
- ecore_x_window_ignore_set(bd->win, EINA_TRUE);
- }
- else
- {
- _e_border_shape_input_rectangle_set(bd);
- ecore_x_window_ignore_set(bd->win, EINA_FALSE);
- }
-}
-
-EAPI void
-e_border_activate(E_Border *bd, Eina_Bool just_do_it)
-{
- if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) ||
- ((bd->parent) &&
- ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
- ((bd->parent->focused) &&
- (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))) ||
- (just_do_it))
- {
- if (bd->iconic)
- {
- if (e_config->clientlist_warp_to_iconified_desktop == 1)
- e_desk_show(bd->desk);
-
- if (!bd->lock_user_iconify)
- e_border_uniconify(bd);
- }
- if ((!bd->iconic) && (!bd->sticky))
- e_desk_show(bd->desk);
- if (!bd->lock_user_stacking) e_border_raise(bd);
- if (!bd->lock_focus_out)
- {
- /* XXX ooffice does send this request for
- config dialogs when the main window gets focus.
- causing the pointer to jump back and forth. */
- if ((e_config->focus_policy != E_FOCUS_CLICK) && (!bd->new_client) &&
- (!e_config->disable_all_pointer_warps) &&
- !(bd->client.icccm.name && !strcmp(bd->client.icccm.name, "VCLSalFrame")))
- ecore_x_pointer_warp(bd->zone->container->win,
- bd->x + (bd->w / 2), bd->y + (bd->h / 2));
- e_border_focus_set(bd, 1, 1);
- }
- }
-}
-
-/*vim:ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0*/
diff --git a/src/bin/e_border.h b/src/bin/e_border.h
deleted file mode 100644
index fff74992f2..0000000000
--- a/src/bin/e_border.h
+++ /dev/null
@@ -1,885 +0,0 @@
-#ifdef E_TYPEDEFS
-
-typedef enum _E_Screen_Limits
-{
- E_SCREEN_LIMITS_PARTLY = 0,
- E_SCREEN_LIMITS_COMPLETELY = 1,
- E_SCREEN_LIMITS_WITHIN = 2
-} E_Screen_Limits;
-
-typedef enum _E_Icon_Preference
-{
- E_ICON_PREF_E_DEFAULT,
- E_ICON_PREF_NETWM,
- E_ICON_PREF_USER
-} E_Icon_Preference;
-
-typedef enum _E_Direction
-{
- E_DIRECTION_UP,
- E_DIRECTION_DOWN,
- E_DIRECTION_LEFT,
- E_DIRECTION_RIGHT
-} E_Direction;
-
-typedef enum _E_Transition
-{
- E_TRANSITION_LINEAR = 0,
- E_TRANSITION_SINUSOIDAL = 1,
- E_TRANSITION_ACCELERATE = 2,
- E_TRANSITION_DECELERATE = 3,
- E_TRANSITION_ACCELERATE_LOTS = 4,
- E_TRANSITION_DECELERATE_LOTS = 5,
- E_TRANSITION_SINUSOIDAL_LOTS = 6,
- E_TRANSITION_BOUNCE = 7,
- E_TRANSITION_BOUNCE_LOTS = 8
-} E_Transition;
-
-typedef enum _E_Stacking
-{
- E_STACKING_NONE,
- E_STACKING_ABOVE,
- E_STACKING_BELOW
-} E_Stacking;
-
-typedef enum _E_Focus_Policy
-{
- E_FOCUS_CLICK,
- E_FOCUS_MOUSE,
- E_FOCUS_SLOPPY,
- E_FOCUS_LAST
-} E_Focus_Policy;
-
-typedef enum _E_Urgency_Policy
-{
- E_ACTIVEHINT_POLICY_IGNORE,
- E_ACTIVEHINT_POLICY_ANIMATE,
- E_ACTIVEHINT_POLICY_ACTIVATE
-} E_Urgency_Policy;
-
-typedef enum _E_Focus_Setting
-{
- E_FOCUS_NONE,
- E_FOCUS_NEW_WINDOW,
- E_FOCUS_NEW_DIALOG,
- E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED
-} E_Focus_Setting;
-
-typedef enum _E_Maximize
-{
- E_MAXIMIZE_NONE = 0x00000000,
- E_MAXIMIZE_FULLSCREEN = 0x00000001,
- E_MAXIMIZE_SMART = 0x00000002,
- E_MAXIMIZE_EXPAND = 0x00000003,
- E_MAXIMIZE_FILL = 0x00000004,
- E_MAXIMIZE_TYPE = 0x0000000f,
- E_MAXIMIZE_VERTICAL = 0x00000010,
- E_MAXIMIZE_HORIZONTAL = 0x00000020,
- E_MAXIMIZE_BOTH = 0x00000030,
- E_MAXIMIZE_LEFT = 0x00000070,
- E_MAXIMIZE_RIGHT = 0x000000b0,
- E_MAXIMIZE_DIRECTION = 0x000000f0
-} E_Maximize;
-
-typedef enum _E_Fullscreen
-{
- /* Resize window */
- E_FULLSCREEN_RESIZE,
- /* Change screen resoultion and resize window */
- E_FULLSCREEN_ZOOM
-} E_Fullscreen;
-
-typedef enum _E_Window_Placement
-{
- E_WINDOW_PLACEMENT_SMART,
- E_WINDOW_PLACEMENT_ANTIGADGET,
- E_WINDOW_PLACEMENT_CURSOR,
- E_WINDOW_PLACEMENT_MANUAL
-} E_Window_Placement;
-
-typedef enum _E_Border_Hook_Point
-{
- E_BORDER_HOOK_EVAL_PRE_FETCH,
- E_BORDER_HOOK_EVAL_PRE_POST_FETCH,
- E_BORDER_HOOK_EVAL_POST_FETCH,
- E_BORDER_HOOK_EVAL_PRE_BORDER_ASSIGN,
- E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN,
- E_BORDER_HOOK_EVAL_PRE_NEW_BORDER,
- E_BORDER_HOOK_EVAL_POST_NEW_BORDER,
- E_BORDER_HOOK_EVAL_END,
- E_BORDER_HOOK_CONTAINER_LAYOUT,
- E_BORDER_HOOK_NEW_BORDER,
- E_BORDER_HOOK_SET_DESK,
- E_BORDER_HOOK_MOVE_BEGIN,
- E_BORDER_HOOK_MOVE_UPDATE,
- E_BORDER_HOOK_MOVE_END,
- E_BORDER_HOOK_RESIZE_BEGIN,
- E_BORDER_HOOK_RESIZE_UPDATE,
- E_BORDER_HOOK_RESIZE_END
-} E_Border_Hook_Point;
-
-typedef struct _E_Border E_Border;
-typedef struct _E_Event_Border_Simple E_Event_Border_Simple;
-typedef struct _E_Border_Pending_Move_Resize E_Border_Pending_Move_Resize;
-typedef struct _E_Border_Hook E_Border_Hook;
-typedef struct _E_Event_Border_Simple E_Event_Border_Resize;
-typedef struct _E_Event_Border_Simple E_Event_Border_Move;
-typedef struct _E_Event_Border_Simple E_Event_Border_Add;
-typedef struct _E_Event_Border_Simple E_Event_Border_Remove;
-typedef struct _E_Event_Border_Simple E_Event_Border_Show;
-typedef struct _E_Event_Border_Hide E_Event_Border_Hide;
-typedef struct _E_Event_Border_Simple E_Event_Border_Iconify;
-typedef struct _E_Event_Border_Simple E_Event_Border_Uniconify;
-typedef struct _E_Event_Border_Simple E_Event_Border_Stick;
-typedef struct _E_Event_Border_Simple E_Event_Border_Unstick;
-typedef struct _E_Event_Border_Zone_Set E_Event_Border_Zone_Set;
-typedef struct _E_Event_Border_Desk_Set E_Event_Border_Desk_Set;
-typedef struct _E_Event_Border_Stack E_Event_Border_Stack;
-typedef struct _E_Event_Border_Simple E_Event_Border_Icon_Change;
-typedef struct _E_Event_Border_Simple E_Event_Border_Title_Change;
-typedef struct _E_Event_Border_Simple E_Event_Border_Urgent_Change;
-typedef struct _E_Event_Border_Simple E_Event_Border_Focus_In;
-typedef struct _E_Event_Border_Simple E_Event_Border_Focus_Out;
-typedef struct _E_Event_Border_Simple E_Event_Border_Property;
-typedef struct _E_Event_Border_Simple E_Event_Border_Fullscreen;
-typedef struct _E_Event_Border_Simple E_Event_Border_Unfullscreen;
-typedef void (*E_Border_Move_Intercept_Cb)(E_Border *, int x, int y);
-#else
-#ifndef E_BORDER_H
-#define E_BORDER_H
-
-#define E_BORDER_TYPE (int)0xE0b01002
-
-struct _E_Border
-{
- E_Object e_obj_inherit;
-
- struct
- {
- struct
- {
- int x, y, w, h;
- int mx, my;
- } current, last_down[3], last_up[3];
- } mouse;
-
- struct
- {
- struct
- {
- int x, y, w, h;
- int mx, my;
- int button;
- } down;
- } moveinfo;
-
- int x, y, w, h;
- int ref;
- E_Zone *zone;
- E_Desk *desk;
-
- struct
- {
- int l, r, t, b;
- Eina_Bool calc : 1; // inset has been calculated
- } client_inset;
-
- E_Comp_Win *cw;
- Ecore_X_Window win;
- Evas_Object *bg_object;
- Evas_Object *icon_object;
- Evas_Object *input_object;
- Eina_Stringshare *internal_icon;
- Eina_Stringshare *internal_icon_key;
-
- Eina_Bool callbacks_set : 1;
-
- struct
- {
- Ecore_X_Window lock_win;
- Ecore_X_Window win;
-
- int w, h;
-
- struct
- {
- Eina_Bool mapping_change : 1;
- Eina_Bool iconic_shading : 1;
- } hacks;
-
- struct
- {
- unsigned char changed : 1;
- unsigned char user_selected : 1;
- Eina_Stringshare *name;
- } border;
-
- unsigned char shaped : 1;
- unsigned char argb : 1;
-
- /* ICCCM */
- struct
- {
- Eina_Stringshare *title;
- Eina_Stringshare *name;
- Eina_Stringshare *class;
- Eina_Stringshare *icon_name;
- Eina_Stringshare *machine;
- int min_w, min_h;
- int max_w, max_h;
- int base_w, base_h;
- int step_w, step_h;
- int start_x, start_y;
- double min_aspect, max_aspect;
- Ecore_X_Window_State_Hint initial_state;
- Ecore_X_Window_State_Hint state;
- Ecore_X_Pixmap icon_pixmap;
- Ecore_X_Pixmap icon_mask;
- Ecore_X_Window icon_window;
- Ecore_X_Window window_group;
- Ecore_X_Window transient_for;
- Ecore_X_Window client_leader;
- Ecore_X_Gravity gravity;
- Eina_Stringshare *window_role;
- unsigned char take_focus : 1;
- unsigned char accepts_focus : 1;
- unsigned char urgent : 1;
- unsigned char delete_request : 1;
- unsigned char request_pos : 1;
- struct
- {
- int argc;
- char **argv;
- } command;
- struct
- {
- unsigned char title : 1;
- unsigned char name_class : 1;
- unsigned char icon_name : 1;
- unsigned char machine : 1;
- unsigned char hints : 1;
- unsigned char size_pos_hints : 1;
- unsigned char protocol : 1;
- unsigned char transient_for : 1;
- unsigned char client_leader : 1;
- unsigned char window_role : 1;
- unsigned char state : 1;
- unsigned char command : 1;
- } fetch;
- } icccm;
-
- /* MWM */
- struct
- {
- Ecore_X_MWM_Hint_Func func;
- Ecore_X_MWM_Hint_Decor decor;
- Ecore_X_MWM_Hint_Input input;
- unsigned char exists : 1;
- unsigned char borderless : 1;
- struct
- {
- unsigned char hints : 1;
- } fetch;
- } mwm;
-
- /* NetWM */
- struct
- {
- pid_t pid;
- unsigned int desktop;
- Eina_Stringshare *name;
- Eina_Stringshare *icon_name;
- Ecore_X_Icon *icons;
- int num_icons;
- unsigned int user_time;
- unsigned char opacity;
- Eina_Bool opacity_changed : 1; // prevent fetching opacity next prop change
- struct
- {
- int left;
- int right;
- int top;
- int bottom;
- int left_start_y;
- int left_end_y;
- int right_start_y;
- int right_end_y;
- int top_start_x;
- int top_end_x;
- int bottom_start_x;
- int bottom_end_x;
- } strut;
- unsigned char ping : 1;
- struct
- {
- unsigned char request : 1;
- unsigned int wait;
- Ecore_X_Sync_Alarm alarm;
- Ecore_X_Sync_Counter counter;
- unsigned int serial;
- double send_time;
- } sync;
-
- /* NetWM Window state */
- struct
- {
- unsigned char modal : 1;
- unsigned char sticky : 1;
- unsigned char maximized_v : 1;
- unsigned char maximized_h : 1;
- unsigned char shaded : 1;
- unsigned char skip_taskbar : 1;
- unsigned char skip_pager : 1;
- unsigned char hidden : 1;
- unsigned char fullscreen : 1;
- E_Stacking stacking;
- } state;
-
- /* NetWM Window allowed actions */
- struct
- {
- unsigned char move : 1;
- unsigned char resize : 1;
- unsigned char minimize : 1;
- unsigned char shade : 1;
- unsigned char stick : 1;
- unsigned char maximized_h : 1;
- unsigned char maximized_v : 1;
- unsigned char fullscreen : 1;
- unsigned char change_desktop : 1;
- unsigned char close : 1;
- } action;
-
- Ecore_X_Window_Type type;
- Ecore_X_Window_Type *extra_types;
- int extra_types_num;
- int startup_id;
-
- struct
- {
- unsigned char name : 1;
- unsigned char icon_name : 1;
- unsigned char icon : 1;
- unsigned char user_time : 1;
- unsigned char strut : 1;
- unsigned char type : 1;
- unsigned char state : 1;
- unsigned char opacity : 1;
- /* No, fetch on new_client, shouldn't be changed after map.
- unsigned char pid : 1;
- */
- /* No, ignore this
- unsigned char desktop : 1;
- */
- } fetch;
-
- struct
- {
- unsigned char state : 1;
- } update;
- } netwm;
-
- /* Extra e stuff */
- struct
- {
- struct
- {
- struct
- {
- int x, y;
-
- unsigned char updated : 1;
- } video_position;
- Ecore_X_Window video_parent;
- E_Border *video_parent_border;
- Eina_List *video_child;
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- struct
- {
- Eina_Stringshare *name;
- Eina_Stringshare **available_list;
- int num;
- unsigned char wait_for_done : 1;
- unsigned char use : 1;
- } profile;
-#endif
- unsigned char centered : 1;
- unsigned char video : 1;
- } state;
-
- struct
- {
- unsigned char state : 1;
- unsigned char video_parent : 1;
- unsigned char video_position : 1;
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- unsigned char profile : 1;
-#endif
- } fetch;
- } e;
-
- struct
- {
- struct
- {
- unsigned char soft_menu : 1;
- unsigned char soft_menus : 1;
- } fetch;
-
- unsigned char soft_menu : 1;
- unsigned char soft_menus : 1;
- } qtopia;
-
- struct
- {
- struct
- {
- unsigned char state : 1;
- unsigned char vkbd : 1;
- } fetch;
- Ecore_X_Virtual_Keyboard_State state;
- unsigned char have_property : 1;
- unsigned char vkbd : 1;
- } vkbd;
-
- struct
- {
- struct
- {
- struct
- {
- unsigned char conformant : 1;
- } fetch;
- unsigned char conformant : 1;
- } conformant;
- struct
- {
- struct
- {
- unsigned char state : 1;
- struct
- {
- unsigned int major : 1;
- unsigned int minor : 1;
- } priority;
- unsigned char quickpanel : 1;
- unsigned char zone : 1;
- } fetch;
- Ecore_X_Illume_Quickpanel_State state;
- struct
- {
- unsigned int major : 1;
- unsigned int minor : 1;
- } priority;
- unsigned char quickpanel : 1;
- int zone;
- } quickpanel;
- struct
- {
- struct
- {
- unsigned char drag : 1;
- unsigned char locked : 1;
- } fetch;
- unsigned char drag : 1;
- unsigned char locked : 1;
- } drag;
- struct
- {
- struct
- {
- unsigned char state : 1;
- } fetch;
- Ecore_X_Illume_Window_State state;
- } win_state;
- } illume;
-
- Ecore_X_Window_Attributes initial_attributes;
- } client;
-
- E_Container_Shape *shape;
-
- unsigned int visible : 1;
- Eina_Bool hidden : 1; // set when window has been hidden by api and should not be shown
- unsigned int await_hide_event;
- unsigned int moving : 1;
- unsigned int focused : 1;
- unsigned int new_client : 1;
- unsigned int re_manage : 1;
- unsigned int placed : 1;
- unsigned int shading : 1;
- unsigned int shaded : 1;
- unsigned int iconic : 1;
- unsigned int deskshow : 1;
- unsigned int sticky : 1;
- unsigned int shaped_input : 1;
- unsigned int need_shape_merge : 1;
- unsigned int need_shape_export : 1;
- unsigned int fullscreen : 1;
- unsigned int need_fullscreen : 1;
- unsigned int already_unparented : 1;
- unsigned int need_reparent : 1;
- unsigned int button_grabbed : 1;
- unsigned int delete_requested : 1;
- unsigned int ping_ok : 1;
- unsigned int hung : 1;
- unsigned int take_focus : 1;
- unsigned int want_focus : 1;
- unsigned int user_skip_winlist : 1;
- unsigned int need_maximize : 1;
- E_Maximize maximized;
- E_Fullscreen fullscreen_policy;
- unsigned int borderless : 1;
- unsigned char offer_resistance : 1;
- Eina_Stringshare *bordername;
-
- unsigned int lock_user_location : 1; /*DONE*/
- unsigned int lock_client_location : 1; /*DONE*/
- unsigned int lock_user_size : 1; /*DONE*/
- unsigned int lock_client_size : 1; /*DONE*/
- unsigned int lock_user_stacking : 1; /*DONE*/
- unsigned int lock_client_stacking : 1; /*DONE*/
- unsigned int lock_user_iconify : 1; /*DONE*/
- unsigned int lock_client_iconify : 1; /*DONE*/
- unsigned int lock_user_desk : 1;
- unsigned int lock_client_desk : 1;
- unsigned int lock_user_sticky : 1; /*DONE*/
- unsigned int lock_client_sticky : 1; /*DONE*/
- unsigned int lock_user_shade : 1; /*DONE*/
- unsigned int lock_client_shade : 1; /*DONE*/
- unsigned int lock_user_maximize : 1; /*DONE*/
- unsigned int lock_client_maximize : 1; /*DONE*/
- unsigned int lock_user_fullscreen : 1; /*DONE*/
- unsigned int lock_client_fullscreen : 1; /*DONE*/
- unsigned int lock_border : 1; /*DONE*/
- unsigned int lock_close : 1; /*DONE*/
- unsigned int lock_focus_in : 1; /*DONE*/
- unsigned int lock_focus_out : 1; /*DONE*/
- unsigned int lock_life : 1; /*DONE*/
-
- unsigned int internal : 1;
- unsigned int internal_no_remember : 1;
- unsigned int internal_no_reopen : 1;
- unsigned int stolen : 1;
- Eina_Bool theme_shadow : 1;
- Eina_Bool destroyed : 1;
-
- Ecore_Evas *internal_ecore_evas;
-
- double ping;
-
- unsigned char changed : 1;
-
- unsigned char icon_preference;
- unsigned char ignore_first_unmap;
- unsigned char resize_mode;
-
- struct
- {
- int x, y, w, h;
- E_Layer layer;
- int zone;
- E_Maximize maximized;
- } saved;
-
- struct
- {
- unsigned char valid : 1;
- int x, y, w, h;
- struct
- {
- int x, y, w, h;
- } saved;
- } pre_res_change;
-
- struct
- {
- double start;
- double val;
- int x, y;
- E_Direction dir;
- Ecore_Animator *anim;
- } shade;
-
- struct
- {
- int x, y;
- int modified;
- } shelf_fix;
-
- Eina_List *stick_desks;
- E_Menu *border_menu;
- E_Config_Dialog *border_locks_dialog;
- E_Config_Dialog *border_remember_dialog;
- E_Config_Dialog *border_border_dialog;
- E_Dialog *border_prop_dialog;
- Eina_List *pending_move_resize;
-
- struct
- {
- unsigned char visible : 1;
- unsigned char pos : 1;
- unsigned char size : 1;
- unsigned char stack : 1;
- unsigned char prop : 1;
- unsigned char border : 1;
- unsigned char reset_gravity : 1;
- unsigned char shading : 1;
- unsigned char shaded : 1;
- unsigned char shape : 1;
- unsigned char shape_input : 1;
- unsigned char icon : 1;
- } changes;
-
- struct
- {
- unsigned char start : 1;
- int x, y;
- } drag;
-
- E_Layer layer;
- E_Action *cur_mouse_action;
- Ecore_Timer *raise_timer;
- Ecore_Poller *ping_poller;
- Ecore_Timer *kill_timer;
- E_Border_Move_Intercept_Cb move_intercept_cb;
- E_Remember *remember;
-
- E_Border *modal;
-
- E_Border *leader;
- Eina_List *group;
-
- E_Border *parent;
- Eina_List *transients;
-
- Efreet_Desktop *desktop;
- E_Exec_Instance *exe_inst;
-
- unsigned char comp_hidden : 1;
-
- unsigned char post_move : 1;
- unsigned char post_resize : 1;
- unsigned char post_show : 1;
- unsigned char during_lost : 1;
-
- Ecore_Idle_Enterer *post_job;
-
- Eina_Bool argb;
-
- int tmp_input_hidden;
- E_Focus_Policy focus_policy_override;
-};
-
-struct _E_Border_Pending_Move_Resize
-{
- int x, y, w, h;
- unsigned char move : 1;
- unsigned char resize : 1;
- unsigned char without_border : 1;
- unsigned int serial;
-};
-
-struct _E_Border_Hook
-{
- E_Border_Hook_Point hookpoint;
- void (*func)(void *data, void *bd);
- void *data;
- unsigned char delete_me : 1;
-};
-
-struct _E_Event_Border_Hide
-{
- E_Border *border;
- int manage;
-};
-
-struct _E_Event_Border_Simple
-{
- E_Border *border;
-};
-
-struct _E_Event_Border_Zone_Set
-{
- E_Border *border;
- E_Zone *zone;
-};
-
-struct _E_Event_Border_Desk_Set
-{
- E_Border *border;
- E_Desk *desk;
-};
-
-struct _E_Event_Border_Stack
-{
- E_Border *border, *stack;
- E_Stacking type;
-};
-
-EINTERN int e_border_init(void);
-EINTERN int e_border_shutdown(void);
-
-EAPI E_Border *e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal);
-EAPI void e_border_ref(E_Border *bd);
-EAPI void e_border_unref(E_Border *bd);
-EAPI void e_border_res_change_geometry_save(E_Border *bd);
-EAPI void e_border_res_change_geometry_restore(E_Border *bd);
-
-EAPI void e_border_zone_set(E_Border *bd, E_Zone *zone);
-EAPI void e_border_desk_set(E_Border *bd, E_Desk *desk);
-EAPI void e_border_show(E_Border *bd);
-EAPI void e_border_hide(E_Border *bd, int manage);
-EAPI void e_border_move(E_Border *bd, int x, int y);
-EAPI void e_border_move_intercept_cb_set(E_Border *bd, E_Border_Move_Intercept_Cb cb);
-EAPI void e_border_move_without_border(E_Border *bd, int x, int y);
-EAPI void e_border_center(E_Border *bd);
-EAPI void e_border_center_pos_get(E_Border *bd, int *x, int *y);
-EAPI void e_border_resize(E_Border *bd, int w, int h);
-EAPI void e_border_resize_without_border(E_Border *bd, int w, int h);
-EAPI void e_border_move_resize(E_Border *bd, int x, int y, int w, int h);
-EAPI void e_border_move_resize_without_border(E_Border *bd, int x, int y, int w, int h);
-EAPI void e_border_layer_set(E_Border *bd, E_Layer layer);
-EAPI void e_border_raise(E_Border *bd);
-EAPI void e_border_lower(E_Border *bd);
-EAPI void e_border_stack_above(E_Border *bd, E_Border *above);
-EAPI void e_border_stack_below(E_Border *bd, E_Border *below);
-EAPI void e_border_focus_latest_set(E_Border *bd);
-EAPI void e_border_raise_latest_set(E_Border *bd);
-EAPI void e_border_focus_set_with_pointer(E_Border *bd);
-EAPI void e_border_focus_set(E_Border *bd, int focus, int set);
-EAPI void e_border_shade(E_Border *bd, E_Direction dir);
-EAPI void e_border_unshade(E_Border *bd, E_Direction dir);
-EAPI void e_border_maximize(E_Border *bd, E_Maximize max);
-EAPI void e_border_unmaximize(E_Border *bd, E_Maximize max);
-EAPI void e_border_fullscreen(E_Border *bd, E_Fullscreen policy);
-EAPI void e_border_unfullscreen(E_Border *bd);
-EAPI void e_border_iconify(E_Border *bd);
-EAPI void e_border_uniconify(E_Border *bd);
-EAPI void e_border_stick(E_Border *bd);
-EAPI void e_border_unstick(E_Border *bd);
-EAPI void e_border_pinned_set(E_Border *bd, int set);
-
-EAPI E_Border *e_border_find_by_client_window(Ecore_X_Window win);
-EAPI E_Border *e_border_find_all_by_client_window(Ecore_X_Window win);
-EAPI E_Border *e_border_find_by_window(Ecore_X_Window win);
-EAPI E_Border *e_border_find_by_alarm(Ecore_X_Sync_Alarm alarm);
-EAPI E_Border *e_border_focused_get(void);
-
-EAPI void e_border_idler_before(void);
-
-EAPI Eina_List *e_border_client_list(void);
-
-EAPI void e_border_act_move_keyboard(E_Border *bd);
-EAPI void e_border_act_resize_keyboard(E_Border *bd);
-
-EAPI void e_border_act_move_begin(E_Border *bd, E_Binding_Event_Mouse_Button *ev);
-EAPI void e_border_act_move_end(E_Border *bd, E_Binding_Event_Mouse_Button *ev);
-EAPI void e_border_act_resize_begin(E_Border *bd, E_Binding_Event_Mouse_Button *ev);
-EAPI void e_border_act_resize_end(E_Border *bd, E_Binding_Event_Mouse_Button *ev);
-EAPI void e_border_act_menu_begin(E_Border *bd, E_Binding_Event_Mouse_Button *ev, int key);
-EAPI void e_border_act_close_begin(E_Border *bd);
-EAPI void e_border_act_kill_begin(E_Border *bd);
-
-EAPI Evas_Object *e_border_icon_add(E_Border *bd, Evas *evas);
-
-EAPI void e_border_button_bindings_ungrab_all(void);
-EAPI void e_border_button_bindings_grab_all(void);
-
-EAPI Eina_List *e_border_focus_stack_get(void);
-EAPI Eina_List *e_border_lost_windows_get(E_Zone *zone);
-
-EAPI void e_border_ping(E_Border *bd);
-EAPI void e_border_move_cancel(void);
-EAPI void e_border_resize_cancel(void);
-EAPI void e_border_frame_recalc(E_Border *bd);
-EAPI Eina_List *e_border_immortal_windows_get(void);
-
-EAPI const char *e_border_name_get(const E_Border *bd);
-
-EAPI void e_border_signal_move_begin(E_Border *bd, const char *sig, const char *src);
-EAPI void e_border_signal_move_end(E_Border *bd, const char *sig, const char *src);
-EAPI int e_border_resizing_get(E_Border *bd);
-EAPI void e_border_signal_resize_begin(E_Border *bd, const char *dir, const char *sig, const char *src);
-EAPI void e_border_signal_resize_end(E_Border *bd, const char *dir, const char *sig, const char *src);
-EAPI void e_border_resize_limit(E_Border *bd, int *w, int *h);
-
-EAPI E_Border_Hook *e_border_hook_add(E_Border_Hook_Point hookpoint, void (*func)(void *data, void *bd), void *data);
-EAPI void e_border_hook_del(E_Border_Hook *bh);
-EAPI void e_border_focus_track_freeze(void);
-EAPI void e_border_focus_track_thaw(void);
-
-EAPI E_Border *e_border_under_pointer_get(E_Desk *desk, E_Border *exclude);
-EAPI int e_border_pointer_warp_to_center_now(E_Border *bd);
-EAPI int e_border_pointer_warp_to_center(E_Border *bd);
-
-EAPI void e_border_comp_hidden_set(E_Border *bd, Eina_Bool hidden);
-EAPI void e_border_tmp_input_hidden_push(E_Border *bd);
-EAPI void e_border_tmp_input_hidden_pop(E_Border *bd);
-
-EAPI void e_border_activate(E_Border *bd, Eina_Bool just_do_it);
-
-EAPI void e_border_focus_lock_set(Eina_Bool lock);
-EAPI Eina_Bool e_border_focus_lock_get(void);
-
-EAPI void e_border_input_object_set(E_Border *bd, Evas_Object *input_obj);
-
-extern EAPI int E_EVENT_BORDER_RESIZE;
-extern EAPI int E_EVENT_BORDER_MOVE;
-extern EAPI int E_EVENT_BORDER_ADD;
-extern EAPI int E_EVENT_BORDER_SHOW;
-extern EAPI int E_EVENT_BORDER_HIDE;
-extern EAPI int E_EVENT_BORDER_REMOVE;
-extern EAPI int E_EVENT_BORDER_ICONIFY;
-extern EAPI int E_EVENT_BORDER_UNICONIFY;
-extern EAPI int E_EVENT_BORDER_STICK;
-extern EAPI int E_EVENT_BORDER_UNSTICK;
-extern EAPI int E_EVENT_BORDER_ZONE_SET;
-extern EAPI int E_EVENT_BORDER_DESK_SET;
-extern EAPI int E_EVENT_BORDER_STACK;
-extern EAPI int E_EVENT_BORDER_ICON_CHANGE;
-extern EAPI int E_EVENT_BORDER_TITLE_CHANGE;
-extern EAPI int E_EVENT_BORDER_URGENT_CHANGE;
-extern EAPI int E_EVENT_BORDER_FOCUS_IN;
-extern EAPI int E_EVENT_BORDER_FOCUS_OUT;
-extern EAPI int E_EVENT_BORDER_PROPERTY;
-extern EAPI int E_EVENT_BORDER_FULLSCREEN;
-extern EAPI int E_EVENT_BORDER_UNFULLSCREEN;
-
-static inline unsigned int
-e_border_inset_width_get(const E_Border *bd)
-{
- return bd->client_inset.l + bd->client_inset.r;
-}
-
-static inline unsigned int
-e_border_inset_height_get(const E_Border *bd)
-{
- return bd->client_inset.t + bd->client_inset.b;
-}
-
-/* e_config not available everywhere e_border.h is used...
-static inline Eina_Bool
-e_border_focus_policy_click(const E_Border *bd)
-{
- return ((bd->focus_policy_override == E_FOCUS_CLICK) || (e_config->focus_policy == E_FOCUS_CLICK));
-}
-*/
-#define e_border_focus_policy_click(bd) \
- ((bd->focus_policy_override == E_FOCUS_CLICK) || (e_config->focus_policy == E_FOCUS_CLICK))
-
-/* macro for finding misuse of changed flag */
-#if 0
-# define BD_CHANGED(BD) \
- do { \
- if (e_object_is_del(E_OBJECT(BD))) \
- EINA_LOG_CRIT("CHANGED SET ON DELETED BORDER!"); \
- BD->changed = 1; \
- INF("%s:%d - BD CHANGED: %p", __FILE__, __LINE__, BD); \
- } while (0)
-#else
-# define BD_CHANGED(BD) BD->changed = 1
-#endif
-
-#endif
-#endif
diff --git a/src/bin/e_canvas.c b/src/bin/e_canvas.c
index 636aa8cb08..14a4bee5ca 100644
--- a/src/bin/e_canvas.c
+++ b/src/bin/e_canvas.c
@@ -146,7 +146,7 @@ EAPI Ecore_Evas *
e_canvas_new(Ecore_X_Window win, int x, int y, int w, int h,
int direct_resize, int override, Ecore_X_Window *win_ret)
{
- Ecore_Evas *ee;
+ Ecore_Evas *ee = NULL;
ee = ecore_evas_software_x11_new(NULL, win, x, y, w, h);
if (ee)
diff --git a/src/bin/e_client.c b/src/bin/e_client.c
new file mode 100644
index 0000000000..c55e4d47fe
--- /dev/null
+++ b/src/bin/e_client.c
@@ -0,0 +1,4465 @@
+#include "e.h"
+
+static Eina_List *_e_client_hooks = NULL;
+static int _e_client_hooks_delete = 0;
+static int _e_client_hooks_walking = 0;
+
+EAPI int E_EVENT_CLIENT_ADD = -1;
+EAPI int E_EVENT_CLIENT_REMOVE = -1;
+EAPI int E_EVENT_CLIENT_ZONE_SET = -1;
+EAPI int E_EVENT_CLIENT_DESK_SET = -1;
+EAPI int E_EVENT_CLIENT_RESIZE = -1;
+EAPI int E_EVENT_CLIENT_MOVE = -1;
+EAPI int E_EVENT_CLIENT_SHOW = -1;
+EAPI int E_EVENT_CLIENT_HIDE = -1;
+EAPI int E_EVENT_CLIENT_ICONIFY = -1;
+EAPI int E_EVENT_CLIENT_UNICONIFY = -1;
+EAPI int E_EVENT_CLIENT_STICK = -1;
+EAPI int E_EVENT_CLIENT_UNSTICK = -1;
+EAPI int E_EVENT_CLIENT_STACK = -1;
+EAPI int E_EVENT_CLIENT_FOCUS_IN = -1;
+EAPI int E_EVENT_CLIENT_FOCUS_OUT = -1;
+EAPI int E_EVENT_CLIENT_PROPERTY = -1;
+EAPI int E_EVENT_CLIENT_FULLSCREEN = -1;
+EAPI int E_EVENT_CLIENT_UNFULLSCREEN = -1;
+
+static Eina_Hash *clients_hash = NULL; // pixmap->client
+
+static int focus_track_frozen = 0;
+
+static int warp_to = 0;
+static int warp_to_x = 0;
+static int warp_to_y = 0;
+static int warp_x[2] = {0}; //{cur,prev}
+static int warp_y[2] = {0}; //{cur,prev}
+static Ecore_Timer *warp_timer = NULL;
+
+static E_Client *focused = NULL;
+static E_Client *warp_client = NULL;
+static E_Client *ecmove = NULL;
+static E_Client *ecresize = NULL;
+static E_Client *action_client = NULL;
+static E_Drag *client_drag = NULL;
+
+static Eina_List *focus_stack = NULL;
+static Eina_List *raise_stack = NULL;
+
+static Eina_Bool comp_grabbed = EINA_FALSE;
+
+static Eina_List *handlers = NULL;
+//static Eina_Bool client_grabbed = EINA_FALSE;
+
+static Ecore_Event_Handler *action_handler_key = NULL;
+static Ecore_Event_Handler *action_handler_mouse = NULL;
+static Ecore_Timer *action_timer = NULL;
+static Eina_Rectangle action_orig = {0};
+
+EINTERN void e_client_focused_set(E_Client *ec);
+
+
+///////////////////////////////////////////
+
+static Eina_Bool
+_e_client_cb_efreet_cache_update(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED)
+{
+ E_Comp *c;
+ const Eina_List *l, *ll;
+ E_Client *ec;
+
+ /* mark all clients for desktop/icon updates */
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ E_FREE_FUNC(ec->desktop, efreet_desktop_free);
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+ ec->changes.icon = 1;
+ EC_CHANGED(ec);
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_client_cb_config_icon_theme(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED)
+{
+ E_Comp *c;
+ const Eina_List *l, *ll;
+ E_Client *ec;
+
+ /* mark all clients for desktop/icon updates */
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+ ec->changes.icon = 1;
+ EC_CHANGED(ec);
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_client_cb_config_mode(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED)
+{
+ E_Comp *c;
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Layer layer;
+
+ /* move fullscreen borders above everything */
+
+ if (e_config->mode.presentation)
+ layer = E_LAYER_CLIENT_TOP;
+ else if (!e_config->allow_above_fullscreen)
+ layer = E_LAYER_CLIENT_FULLSCREEN;
+ else
+ return ECORE_CALLBACK_RENEW;
+
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+ if ((ec->fullscreen) || (ec->need_fullscreen))
+ {
+ ec->fullscreen = 0;
+ evas_object_layer_set(ec->frame, layer);
+ ec->fullscreen = 1;
+ }
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_client_cb_pointer_warp(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Pointer_Warp *ev)
+{
+ if (ecmove)
+ evas_object_move(ecmove->frame, ecmove->x + (ev->curr.x - ev->prev.x), ecmove->y + (ev->curr.y - ev->prev.y));
+ return ECORE_CALLBACK_RENEW;
+}
+
+
+static Eina_Bool
+_e_client_cb_desk_window_profile_change(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Desk_Window_Profile_Change *ev EINA_UNUSED)
+{
+ E_Comp *c;
+ const Eina_List *l, *ll;
+ E_Client *ec;
+
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+ ec->e.fetch.profile = 1;
+ EC_CHANGED(ec);
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_e_client_cb_drag_finished(E_Drag *drag, int dropped EINA_UNUSED)
+{
+ E_Client *ec;
+
+ ec = drag->data;
+ e_object_unref(E_OBJECT(ec));
+ client_drag = NULL;
+}
+////////////////////////////////////////////////
+
+
+static Eina_Bool
+_e_client_pointer_warp_to_center_timer(void *data EINA_UNUSED)
+{
+ if (warp_to)
+ {
+ int x, y;
+ double spd;
+
+ ecore_evas_pointer_xy_get(warp_client->comp->ee, &x, &y);
+ /* move hasn't happened yet */
+ if ((x == warp_x[1]) && (y == warp_y[1]))
+ return EINA_TRUE;
+ if ((abs(x - warp_x[0]) > 5) || (abs(y - warp_y[0]) > 5))
+ {
+ /* User moved the mouse, so stop warping */
+ warp_to = 0;
+ goto cleanup;
+ }
+
+ spd = e_config->pointer_warp_speed;
+ warp_x[1] = x = warp_x[0];
+ warp_y[1] = y = warp_y[0];
+ warp_x[0] = (x * (1.0 - spd)) + (warp_to_x * spd);
+ warp_y[0] = (y * (1.0 - spd)) + (warp_to_y * spd);
+ if ((warp_x[0] == x) && (warp_y[0] == y))
+ {
+ warp_x[0] = warp_to_x;
+ warp_y[0] = warp_to_y;
+ warp_to = 0;
+ goto cleanup;
+ }
+ ecore_evas_pointer_warp(warp_client->comp->ee, warp_x[0], warp_y[0]);
+ return ECORE_CALLBACK_RENEW;
+ }
+cleanup:
+ E_FREE_FUNC(warp_timer, ecore_timer_del);
+ if (warp_client)
+ {
+ warp_x[0] = warp_x[1] = warp_y[0] = warp_y[1] = -1;
+ if (warp_client->modal)
+ {
+ warp_client = NULL;
+ return ECORE_CALLBACK_CANCEL;
+ }
+ e_focus_event_mouse_in(warp_client);
+ if (warp_client->iconic)
+ {
+ if (!warp_client->lock_user_iconify)
+ e_client_uniconify(warp_client);
+ }
+ if (warp_client->shaded)
+ {
+ if (!warp_client->lock_user_shade)
+ e_client_unshade(warp_client, warp_client->shade_dir);
+ }
+
+ if (!warp_client->lock_focus_out)
+ {
+ evas_object_focus_set(warp_client->frame, 1);
+ e_client_focus_latest_set(warp_client);
+ }
+ warp_client = NULL;
+ }
+ return ECORE_CALLBACK_CANCEL;
+}
+
+////////////////////////////////////////////////
+
+static void
+_e_client_hooks_clean(void)
+{
+ Eina_List *l, *ln;
+ E_Client_Hook *ch;
+
+ EINA_LIST_FOREACH_SAFE(_e_client_hooks, l, ln, ch)
+ {
+ if (ch->delete_me)
+ {
+ _e_client_hooks = eina_list_remove_list(_e_client_hooks, l);
+ free(ch);
+ }
+ }
+}
+
+static Eina_Bool
+_e_client_hook_call(E_Client_Hook_Point hookpoint, E_Client *ec)
+{
+ Eina_List *l;
+ E_Client_Hook *ch;
+
+ e_object_ref(E_OBJECT(ec));
+ _e_client_hooks_walking++;
+ EINA_LIST_FOREACH(_e_client_hooks, l, ch)
+ {
+ if (ch->delete_me) continue;
+ if (ch->hookpoint == hookpoint) ch->func(ch->data, ec);
+ }
+ _e_client_hooks_walking--;
+ if ((_e_client_hooks_walking == 0) && (_e_client_hooks_delete > 0))
+ _e_client_hooks_clean();
+ return !!e_object_unref(E_OBJECT(ec));
+}
+
+///////////////////////////////////////////
+
+static void
+_e_client_event_simple_free(void *d EINA_UNUSED, E_Event_Client *ev)
+{
+ e_object_unref(E_OBJECT(ev->ec));
+ free(ev);
+}
+
+static void
+_e_client_event_simple(E_Client *ec, int type)
+{
+ E_Event_Client *ev;
+
+ ev = E_NEW(E_Event_Client, 1);
+ ev->ec = ec;
+ e_object_ref(E_OBJECT(ec));
+ ecore_event_add(type, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
+}
+
+static void
+_e_client_event_property(E_Client *ec, int prop)
+{
+ E_Event_Client_Property *ev;
+
+ ev = E_NEW(E_Event_Client_Property, 1);
+ ev->ec = ec;
+ ev->property = prop;
+ e_object_ref(E_OBJECT(ec));
+ ecore_event_add(E_EVENT_CLIENT_PROPERTY, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL);
+}
+
+static void
+_e_client_event_desk_set_free(void *d EINA_UNUSED, E_Event_Client_Desk_Set *ev)
+{
+ e_object_unref(E_OBJECT(ev->ec));
+ e_object_unref(E_OBJECT(ev->desk));
+ free(ev);
+}
+
+static void
+_e_client_event_zone_set_free(void *d EINA_UNUSED, E_Event_Client_Zone_Set *ev)
+{
+ e_object_unref(E_OBJECT(ev->ec));
+ e_object_unref(E_OBJECT(ev->zone));
+ free(ev);
+}
+
+////////////////////////////////////////////////
+
+static int
+_e_client_action_input_win_del(E_Comp *c)
+{
+ if (!comp_grabbed) return 0;
+
+ e_comp_ungrab_input(c, 1, 1);
+ comp_grabbed = 0;
+ return 1;
+}
+
+static void
+_e_client_action_finish(void)
+{
+ if (comp_grabbed)
+ _e_client_action_input_win_del(action_client ? action_client->comp : e_comp_get(NULL));
+
+ E_FREE_FUNC(action_timer, ecore_timer_del);
+ E_FREE_FUNC(action_handler_key, ecore_event_handler_del);
+ E_FREE_FUNC(action_handler_mouse, ecore_event_handler_del);
+ action_client = NULL;
+}
+
+static void
+_e_client_revert_focus(E_Client *ec)
+{
+ E_Client *pec;
+ E_Desk *desk;
+
+ if (stopping) return;
+ if (!ec->focused) return;
+ desk = e_desk_current_get(ec->zone);
+ if (ec->desk == desk)
+ evas_object_focus_set(ec->frame, 0);
+
+ if ((ec->parent) &&
+ (ec->parent->desk == desk) && (ec->parent->modal == ec))
+ evas_object_focus_set(ec->parent->frame, 1);
+ else if (e_config->focus_revert_on_hide_or_close)
+ {
+ Eina_Bool unlock = ec->lock_focus_out;
+ ec->lock_focus_out = 1;
+ e_desk_last_focused_focus(desk);
+ ec->lock_focus_out = unlock;
+ }
+ else if (e_config->focus_policy == E_FOCUS_MOUSE)
+ {
+ pec = e_client_under_pointer_get(desk, ec);
+ if (pec)
+ evas_object_focus_set(pec->frame, 1);
+ }
+}
+
+static void
+_e_client_free(E_Client *ec)
+{
+ if (ec->focused)
+ e_client_focused_set(NULL);
+ e_comp_object_redirected_set(ec->frame, 0);
+ e_comp_object_render_update_del(ec->frame);
+
+ if (ec->fullscreen)
+ {
+ ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
+ if (!ec->desk->fullscreen_clients)
+ e_comp_render_queue(ec->comp);
+ }
+ if (ec->new_client)
+ ec->comp->new_clients--;
+ if (ec->e.state.profile.use)
+ {
+ if (ec->e.state.profile.available_list)
+ {
+ int i;
+ for (i = 0; i < ec->e.state.profile.num; i++)
+ eina_stringshare_replace(&ec->e.state.profile.available_list[i], NULL);
+ E_FREE(ec->e.state.profile.available_list);
+ }
+
+ ec->e.state.profile.num = 0;
+
+ eina_stringshare_replace(&ec->e.state.profile.name, NULL);
+ ec->e.state.profile.wait_for_done = 0;
+ ec->e.state.profile.use = 0;
+ }
+
+ if (ec->e.state.video_parent && ec->e.state.video_parent_client)
+ {
+ ec->e.state.video_parent_client->e.state.video_child =
+ eina_list_remove(ec->e.state.video_parent_client->e.state.video_child, ec);
+ }
+ if (ec->e.state.video_child)
+ {
+ E_Client *tmp;
+
+ EINA_LIST_FREE(ec->e.state.video_child, tmp)
+ tmp->e.state.video_parent_client = NULL;
+ }
+ if (ec->internal_ecore_evas)
+ {
+ e_canvas_del(ec->internal_ecore_evas);
+ E_FREE_FUNC(ec->internal_ecore_evas, ecore_evas_free);
+ }
+ E_FREE_FUNC(ec->desktop, efreet_desktop_free);
+ E_FREE_FUNC(ec->post_job, ecore_idle_enterer_del);
+
+ E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
+ E_FREE_LIST(ec->pending_resize, free);
+
+ if (ec->remember)
+ {
+ E_Remember *rem;
+
+ rem = ec->remember;
+ ec->remember = NULL;
+ e_remember_unuse(rem);
+ }
+ ec->group = eina_list_free(ec->group);
+ ec->transients = eina_list_free(ec->transients);
+ ec->stick_desks = eina_list_free(ec->stick_desks);
+ if (ec->netwm.icons)
+ {
+ int i;
+ for (i = 0; i < ec->netwm.num_icons; i++)
+ free(ec->netwm.icons[i].data);
+ E_FREE(ec->netwm.icons);
+ }
+ E_FREE(ec->netwm.extra_types);
+ eina_stringshare_replace(&ec->border.name, NULL);
+ eina_stringshare_replace(&ec->bordername, NULL);
+ eina_stringshare_replace(&ec->icccm.name, NULL);
+ eina_stringshare_replace(&ec->icccm.class, NULL);
+ eina_stringshare_replace(&ec->icccm.title, NULL);
+ eina_stringshare_replace(&ec->icccm.icon_name, NULL);
+ eina_stringshare_replace(&ec->icccm.machine, NULL);
+ eina_stringshare_replace(&ec->icccm.window_role, NULL);
+ if ((ec->icccm.command.argc > 0) && (ec->icccm.command.argv))
+ {
+ int i;
+
+ for (i = 0; i < ec->icccm.command.argc; i++)
+ free(ec->icccm.command.argv[i]);
+ E_FREE(ec->icccm.command.argv);
+ }
+ eina_stringshare_replace(&ec->netwm.name, NULL);
+ eina_stringshare_replace(&ec->netwm.icon_name, NULL);
+ eina_stringshare_replace(&ec->internal_icon, NULL);
+ eina_stringshare_replace(&ec->internal_icon_key, NULL);
+
+ focus_stack = eina_list_remove(focus_stack, ec);
+ raise_stack = eina_list_remove(raise_stack, ec);
+
+ e_hints_client_list_set();
+ evas_object_del(ec->frame);
+ free(ec);
+}
+
+static void
+_e_client_del(E_Client *ec)
+{
+ E_Client *child;
+
+ ec->changed = 0;
+ focus_stack = eina_list_remove(focus_stack, ec);
+ raise_stack = eina_list_remove(raise_stack, ec);
+ if (ec->exe_inst)
+ {
+ if (ec->exe_inst->phony && (eina_list_count(ec->exe_inst->clients) == 1))
+ e_exec_phony_del(ec->exe_inst);
+ else
+ ec->exe_inst->clients = eina_list_remove(ec->exe_inst->clients, ec);
+ ec->exe_inst = NULL;
+ }
+
+ if (ec->cur_mouse_action)
+ {
+ if (ec->cur_mouse_action->func.end)
+ ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
+ }
+ if (action_client == ec) _e_client_action_finish();
+ e_pointer_type_pop(ec->comp->pointer, ec, NULL);
+
+ if (warp_client == ec)
+ {
+ E_FREE_FUNC(warp_timer, ecore_timer_del);
+ warp_client = NULL;
+ }
+
+ if ((client_drag) && (client_drag->data == ec))
+ {
+ e_object_del(E_OBJECT(client_drag));
+ client_drag = NULL;
+ }
+ if (ec->border_menu) e_menu_deactivate(ec->border_menu);
+ if (!stopping) e_client_comp_hidden_set(ec, 1);
+
+ E_FREE_FUNC(ec->border_locks_dialog, e_object_del);
+ E_FREE_FUNC(ec->border_remember_dialog, e_object_del);
+ E_FREE_FUNC(ec->border_border_dialog, e_object_del);
+ E_FREE_FUNC(ec->border_prop_dialog, e_object_del);
+ e_int_client_menu_del(ec);
+ E_FREE_FUNC(ec->raise_timer, ecore_timer_del);
+
+ if (ec->internal_ecore_evas)
+ ecore_evas_hide(ec->internal_ecore_evas);
+
+ if (ec->focused)
+ _e_client_revert_focus(ec);
+
+ E_FREE_FUNC(ec->ping_poller, ecore_poller_del);
+ /* must be called before parent/child clear */
+ _e_client_hook_call(E_CLIENT_HOOK_DEL, ec);
+
+ if ((!ec->new_client) && (!stopping))
+ _e_client_event_simple(ec, E_EVENT_CLIENT_REMOVE);
+
+ if (ec->parent)
+ {
+ ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
+ ec->parent = NULL;
+ }
+ EINA_LIST_FREE(ec->transients, child)
+ child->parent = NULL;
+
+ if (ec->leader)
+ {
+ ec->leader->group = eina_list_remove(ec->leader->group, ec);
+ if (ec->leader->modal == ec)
+ ec->leader->modal = NULL;
+ ec->leader = NULL;
+ }
+ EINA_LIST_FREE(ec->group, child)
+ child->leader = NULL;
+
+ eina_hash_del_by_key(clients_hash, &ec->pixmap);
+ ec->comp->clients = eina_list_remove(ec->comp->clients, ec);
+ e_comp_object_render_update_del(ec->frame);
+ if (e_pixmap_free(ec->pixmap))
+ e_pixmap_client_set(ec->pixmap, NULL);
+ ec->pixmap = NULL;
+}
+
+///////////////////////////////////////////
+
+static Eina_Bool
+_e_client_cb_kill_timer(void *data)
+{
+ E_Client *ec = data;
+
+// dont wait until it's hung -
+// if (ec->hung)
+// {
+ if (ec->netwm.pid > 1)
+ kill(ec->netwm.pid, SIGKILL);
+// }
+ ec->kill_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool
+_e_client_cb_ping_poller(void *data)
+{
+ E_Client *ec;
+
+ ec = data;
+ if (ec->ping_ok)
+ {
+ if (ec->hung)
+ {
+ ec->hung = 0;
+ evas_object_smart_callback_call(ec->frame, "unhung", NULL);
+ E_FREE_FUNC(ec->kill_timer, ecore_timer_del);
+ }
+ }
+ else
+ {
+ /* if time between last ping and now is greater
+ * than half the ping interval... */
+ if ((ecore_loop_time_get() - ec->ping) >
+ ((e_config->ping_clients_interval *
+ ecore_poller_poll_interval_get(ECORE_POLLER_CORE)) / 2.0))
+ {
+ if (!ec->hung)
+ {
+ ec->hung = 1;
+ evas_object_smart_callback_call(ec->frame, "hung", NULL);
+ /* FIXME: if below dialog is up - hide it now */
+ }
+ if (ec->delete_requested)
+ {
+ /* FIXME: pop up dialog saying app is hung - kill client, or pid */
+ e_client_act_kill_begin(ec);
+ }
+ }
+ }
+ ec->ping_poller = NULL;
+ e_client_ping(ec);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+///////////////////////////////////////////
+
+static int
+_e_client_action_input_win_new(E_Client *ec)
+{
+ comp_grabbed = e_comp_grab_input(ec->comp, 1, 1);
+ if (!comp_grabbed) _e_client_action_input_win_del(ec->comp);
+ return comp_grabbed;
+}
+
+static void
+_e_client_action_init(E_Client *ec)
+{
+ action_orig.x = ec->x;
+ action_orig.y = ec->y;
+ action_orig.w = ec->w;
+ action_orig.h = ec->h;
+
+ action_client = ec;
+}
+
+static void
+_e_client_action_restore_orig(E_Client *ec)
+{
+ if (action_client != ec)
+ return;
+
+ evas_object_geometry_set(ec->frame, action_orig.x, action_orig.y, action_orig.w, action_orig.h);
+}
+
+static int
+_e_client_key_down_modifier_apply(int modifier, int value)
+{
+ if (modifier & ECORE_EVENT_MODIFIER_CTRL)
+ return value * 2;
+ else if (modifier & ECORE_EVENT_MODIFIER_ALT)
+ {
+ value /= 2;
+ if (value)
+ return value;
+ else
+ return 1;
+ }
+
+ return value;
+}
+
+
+static int
+_e_client_move_begin(E_Client *ec)
+{
+ if (!ec->lock_user_stacking)
+ {
+ if (e_config->border_raise_on_mouse_action)
+ evas_object_raise(ec->frame);
+ }
+ if ((ec->fullscreen) || (ec->lock_user_location))
+ return 0;
+
+/*
+ if (client_grabbed && !e_grabinput_get(e_client_util_pwin_get(ec), 0, e_client_util_pwin_get(ec)))
+ {
+ client_grabbed = 0;
+ return 0;
+ }
+*/
+ if (!_e_client_action_input_win_new(ec)) return 0;
+ ecmove = ec;
+ _e_client_hook_call(E_CLIENT_HOOK_MOVE_BEGIN, ec);
+
+ return 1;
+}
+
+static int
+_e_client_move_end(E_Client *ec)
+{
+ //if (client_grabbed)
+ //{
+ //e_grabinput_release(e_client_util_pwin_get(ec), e_client_util_pwin_get(ec));
+ //client_grabbed = 0;
+ //}
+ _e_client_action_input_win_del(ec->comp);
+ e_pointer_mode_pop(ec, E_POINTER_MOVE);
+ ec->moving = 0;
+ _e_client_hook_call(E_CLIENT_HOOK_MOVE_END, ec);
+
+ ecmove = NULL;
+ return 1;
+}
+
+static Eina_Bool
+_e_client_action_move_timeout(void *data EINA_UNUSED)
+{
+ _e_client_move_end(action_client);
+ _e_client_action_finish();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_e_client_action_move_timeout_add(void)
+{
+ E_FREE_FUNC(action_timer, ecore_timer_del);
+ if (e_config->border_keyboard.timeout)
+ action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_move_timeout, NULL);
+}
+
+static Eina_Bool
+_e_client_move_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ Ecore_Event_Key *ev = event;
+ int x, y;
+
+ if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
+ if (!action_client)
+ {
+ ERR("no action_client!");
+ goto stop;
+ }
+
+ x = action_client->x;
+ y = action_client->y;
+
+ if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0))
+ y -= _e_client_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dy, 1));
+ else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0))
+ y += _e_client_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dy, 1));
+ else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0))
+ x -= _e_client_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dx, 1));
+ else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0))
+ x += _e_client_key_down_modifier_apply(ev->modifiers, MAX(e_config->border_keyboard.move.dx, 1));
+ else if (strcmp(ev->key, "Return") == 0)
+ goto stop;
+ else if (strcmp(ev->key, "Escape") == 0)
+ {
+ _e_client_action_restore_orig(action_client);
+ goto stop;
+ }
+ else if ((strncmp(ev->key, "Control", sizeof("Control") - 1) != 0) &&
+ (strncmp(ev->key, "Alt", sizeof("Alt") - 1) != 0))
+ goto stop;
+
+ evas_object_move(action_client->frame, x, y);
+ _e_client_action_move_timeout_add();
+
+ return ECORE_CALLBACK_PASS_ON;
+
+stop:
+ _e_client_move_end(action_client);
+ _e_client_action_finish();
+ return ECORE_CALLBACK_DONE;
+}
+
+static Eina_Bool
+_e_client_move_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
+{
+ if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
+
+ if (!action_client)
+ ERR("no action_client!");
+
+ _e_client_move_end(action_client);
+ _e_client_action_finish();
+ return ECORE_CALLBACK_DONE;
+}
+
+static void
+_e_client_moveinfo_gather(E_Client *ec, const char *source)
+{
+ if (e_util_glob_match(source, "mouse,*,1"))
+ ec->moveinfo.down.button = 1;
+ else if (e_util_glob_match(source, "mouse,*,2"))
+ ec->moveinfo.down.button = 2;
+ else if (e_util_glob_match(source, "mouse,*,3"))
+ ec->moveinfo.down.button = 3;
+ else
+ ec->moveinfo.down.button = 0;
+ if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
+ {
+ ec->moveinfo.down.mx = ec->mouse.last_down[ec->moveinfo.down.button - 1].mx;
+ ec->moveinfo.down.my = ec->mouse.last_down[ec->moveinfo.down.button - 1].my;
+ }
+ else
+ {
+ ec->moveinfo.down.mx = ec->mouse.current.mx;
+ ec->moveinfo.down.my = ec->mouse.current.my;
+ }
+}
+
+static void
+_e_client_resize_handle(E_Client *ec)
+{
+ int x, y, w, h;
+ int new_x, new_y, new_w, new_h;
+ int tw, th;
+ Eina_List *skiplist = NULL;
+
+ x = ec->x;
+ y = ec->y;
+ w = ec->w;
+ h = ec->h;
+
+ if ((ec->resize_mode == E_POINTER_RESIZE_TR) ||
+ (ec->resize_mode == E_POINTER_RESIZE_R) ||
+ (ec->resize_mode == E_POINTER_RESIZE_BR))
+ {
+ if ((ec->moveinfo.down.button >= 1) &&
+ (ec->moveinfo.down.button <= 3))
+ w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w +
+ (ec->mouse.current.mx - ec->moveinfo.down.mx);
+ else
+ w = ec->moveinfo.down.w + (ec->mouse.current.mx - ec->moveinfo.down.mx);
+ }
+ else if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_L) ||
+ (ec->resize_mode == E_POINTER_RESIZE_BL))
+ {
+ if ((ec->moveinfo.down.button >= 1) &&
+ (ec->moveinfo.down.button <= 3))
+ w = ec->mouse.last_down[ec->moveinfo.down.button - 1].w -
+ (ec->mouse.current.mx - ec->moveinfo.down.mx);
+ else
+ w = ec->moveinfo.down.w - (ec->mouse.current.mx - ec->moveinfo.down.mx);
+ }
+
+ if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_T) ||
+ (ec->resize_mode == E_POINTER_RESIZE_TR))
+ {
+ if ((ec->moveinfo.down.button >= 1) &&
+ (ec->moveinfo.down.button <= 3))
+ h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h -
+ (ec->mouse.current.my - ec->moveinfo.down.my);
+ else
+ h = ec->moveinfo.down.h - (ec->mouse.current.my - ec->moveinfo.down.my);
+ }
+ else if ((ec->resize_mode == E_POINTER_RESIZE_BL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_B) ||
+ (ec->resize_mode == E_POINTER_RESIZE_BR))
+ {
+ if ((ec->moveinfo.down.button >= 1) &&
+ (ec->moveinfo.down.button <= 3))
+ h = ec->mouse.last_down[ec->moveinfo.down.button - 1].h +
+ (ec->mouse.current.my - ec->moveinfo.down.my);
+ else
+ h = ec->moveinfo.down.h + (ec->mouse.current.my - ec->moveinfo.down.my);
+ }
+
+ tw = ec->w;
+ th = ec->h;
+
+ if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_L) ||
+ (ec->resize_mode == E_POINTER_RESIZE_BL))
+ x += (tw - w);
+ if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_T) ||
+ (ec->resize_mode == E_POINTER_RESIZE_TR))
+ y += (th - h);
+
+ skiplist = eina_list_append(skiplist, ec);
+ e_resist_client_position(ec->comp, skiplist,
+ ec->x, ec->y, ec->w, ec->h,
+ x, y, w, h,
+ &new_x, &new_y, &new_w, &new_h);
+ eina_list_free(skiplist);
+
+ w = new_w;
+ h = new_h;
+ e_client_resize_limit(ec, &new_w, &new_h);
+ if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_L) ||
+ (ec->resize_mode == E_POINTER_RESIZE_BL))
+ new_x += (w - new_w);
+ if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_T) ||
+ (ec->resize_mode == E_POINTER_RESIZE_TR))
+ new_y += (h - new_h);
+
+ evas_object_geometry_set(ec->frame, new_x, new_y, new_w, new_h);
+}
+
+static int
+_e_client_resize_end(E_Client *ec)
+{
+ _e_client_action_input_win_del(ec->comp);
+ e_pointer_mode_pop(ec, ec->resize_mode);
+ ec->resize_mode = E_POINTER_RESIZE_NONE;
+
+ /* If this border was maximized, we need to unset Maximized state or
+ * on restart, E still thinks it's maximized */
+ if (ec->maximized != E_MAXIMIZE_NONE)
+ e_hints_window_maximized_set(ec, ec->maximized & E_MAXIMIZE_NONE,
+ ec->maximized & E_MAXIMIZE_NONE);
+
+ _e_client_hook_call(E_CLIENT_HOOK_RESIZE_END, ec);
+
+ ecresize = NULL;
+
+ return 1;
+}
+
+
+static Eina_Bool
+_e_client_action_resize_timeout(void *data EINA_UNUSED)
+{
+ _e_client_resize_end(action_client);
+ _e_client_action_finish();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_e_client_action_resize_timeout_add(void)
+{
+ E_FREE_FUNC(action_timer, ecore_timer_del);
+ if (e_config->border_keyboard.timeout)
+ action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_resize_timeout, NULL);
+}
+
+static Eina_Bool
+_e_client_resize_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ Ecore_Event_Key *ev = event;
+ int w, h, dx, dy;
+
+ if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
+ if (!action_client)
+ {
+ ERR("no action_client!");
+ goto stop;
+ }
+
+ w = action_client->w;
+ h = action_client->h;
+
+ dx = e_config->border_keyboard.resize.dx;
+ if (dx < action_client->icccm.step_w)
+ dx = action_client->icccm.step_w;
+ dx = _e_client_key_down_modifier_apply(ev->modifiers, dx);
+ if (dx < action_client->icccm.step_w)
+ dx = action_client->icccm.step_w;
+
+ dy = e_config->border_keyboard.resize.dy;
+ if (dy < action_client->icccm.step_h)
+ dy = action_client->icccm.step_h;
+ dy = _e_client_key_down_modifier_apply(ev->modifiers, dy);
+ if (dy < action_client->icccm.step_h)
+ dy = action_client->icccm.step_h;
+
+ if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0))
+ h -= dy;
+ else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0))
+ h += dy;
+ else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0))
+ w -= dx;
+ else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0))
+ w += dx;
+ else if (strcmp(ev->key, "Return") == 0)
+ goto stop;
+ else if (strcmp(ev->key, "Escape") == 0)
+ {
+ _e_client_action_restore_orig(action_client);
+ goto stop;
+ }
+ else if ((strncmp(ev->key, "Control", sizeof("Control") - 1) != 0) &&
+ (strncmp(ev->key, "Alt", sizeof("Alt") - 1) != 0))
+ goto stop;
+
+ e_client_resize_limit(action_client, &w, &h);
+ evas_object_resize(action_client->frame, w, h);
+ _e_client_action_resize_timeout_add();
+
+ return ECORE_CALLBACK_PASS_ON;
+
+stop:
+ _e_client_resize_end(action_client);
+ _e_client_action_finish();
+ return ECORE_CALLBACK_DONE;
+}
+
+static Eina_Bool
+_e_client_resize_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
+{
+ if (!comp_grabbed) return ECORE_CALLBACK_RENEW;
+
+ if (!action_client)
+ ERR("no action_client!");
+
+ _e_client_resize_end(action_client);
+ _e_client_action_finish();
+ return ECORE_CALLBACK_DONE;
+}
+
+////////////////////////////////////////////////
+
+static E_Client *
+_e_client_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
+{
+ E_Client *ec = NULL, *cec;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(raise_stack, l, cec)
+ {
+ /* If a border was specified which should be excluded from the list
+ * (because it will be closed shortly for example), skip */
+ if ((exclude) && (cec == exclude)) continue;
+ if ((desk) && (cec->desk != desk)) continue;
+ if (!E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
+ continue;
+ /* If the layer is higher, the position of the window is higher
+ * (always on top vs always below) */
+ if (!ec || (cec->layer > ec->layer))
+ ec = cec;
+ }
+ return ec;
+}
+
+////////////////////////////////////////////////
+
+static void
+_e_client_zones_layout_calc(E_Client *ec, int *zx, int *zy, int *zw, int *zh)
+{
+ int x, y, w, h;
+ E_Zone *zone_above, *zone_below, *zone_left, *zone_right;
+
+ x = ec->zone->x;
+ y = ec->zone->y;
+ w = ec->zone->w;
+ h = ec->zone->h;
+
+ if (eina_list_count(ec->comp->zones) == 1)
+ {
+ if (zx) *zx = x;
+ if (zy) *zy = y;
+ if (zw) *zw = w;
+ if (zh) *zh = h;
+ return;
+ }
+
+ zone_left = e_comp_zone_xy_get(ec->comp, (x - w + 5), y);
+ zone_right = e_comp_zone_xy_get(ec->comp, (x + w + 5), y);
+ zone_above = e_comp_zone_xy_get(ec->comp, x, (y - h + 5));
+ zone_below = e_comp_zone_xy_get(ec->comp, x, (y + h + 5));
+
+ if (!(zone_above) && (y))
+ zone_above = e_comp_zone_xy_get(ec->comp, x, (h - 5));
+
+ if (!(zone_left) && (x))
+ zone_left = e_comp_zone_xy_get(ec->comp, (x - 5), y);
+
+ if (zone_right)
+ w = zone_right->x + zone_right->w;
+
+ if (zone_left)
+ w = ec->zone->x + ec->zone->w;
+
+ if (zone_below)
+ h = zone_below->y + zone_below->h;
+
+ if (zone_above)
+ h = ec->zone->y + ec->zone->h;
+
+ if ((zone_left) && (zone_right))
+ w = ec->zone->w + zone_right->x;
+
+ if ((zone_above) && (zone_below))
+ h = ec->zone->h + zone_below->y;
+
+ if (x) x -= ec->zone->w;
+ if (y) y -= ec->zone->h;
+
+ if (zx) *zx = x > 0 ? x : 0;
+ if (zy) *zy = y > 0 ? y : 0;
+ if (zw) *zw = w;
+ if (zh) *zh = h;
+}
+
+static void
+_e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y)
+{
+ int new_x_max, new_y_max;
+ int zw, zh;
+ Eina_Bool lw, lh;
+
+ if (!ec->zone)
+ {
+ if (new_x) *new_x = x;
+ if (new_y) *new_y = y;
+ return;
+ }
+
+ _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
+
+ new_x_max = zw - ec->w;
+ new_y_max = zh - ec->h;
+ lw = ec->w > zw ? EINA_TRUE : EINA_FALSE;
+ lh = ec->h > zh ? EINA_TRUE : EINA_FALSE;
+
+ if (lw)
+ {
+ if (x <= new_x_max)
+ *new_x = new_x_max;
+ else if (x >= 0)
+ *new_x = 0;
+ }
+ else
+ {
+ if (x >= new_x_max)
+ *new_x = new_x_max;
+ else if (x <= 0)
+ *new_x = 0;
+ }
+
+ if (lh)
+ {
+ if (y <= new_y_max)
+ *new_y = new_y_max;
+ else if (y >= 0)
+ *new_y = 0;
+ }
+ else
+ {
+ if (y >= new_y_max)
+ *new_y = new_y_max;
+ else if (y <= 0)
+ *new_y = 0;
+ }
+}
+
+static void
+_e_client_reset_lost_window(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+
+ if (ec->during_lost) return;
+ ec->during_lost = EINA_TRUE;
+
+ if (ec->iconic) e_client_uniconify(ec);
+ if (!ec->moving) e_comp_object_util_center(ec->frame);
+
+ evas_object_raise(ec->frame);
+ if (!ec->lock_focus_out)
+ evas_object_focus_set(ec->frame, 1);
+
+ e_client_pointer_warp_to_center(ec);
+ ec->during_lost = EINA_FALSE;
+}
+
+static void
+_e_client_move_lost_window_to_center(E_Client *ec)
+{
+ int loss_overlap = 5;
+ int zw, zh, zx, zy;
+
+ if (ec->during_lost) return;
+ if (!ec->zone) return;
+
+ _e_client_zones_layout_calc(ec, &zx, &zy, &zw, &zh);
+
+ if (!E_INTERSECTS(zx + loss_overlap,
+ zy + loss_overlap,
+ zw - (2 * loss_overlap),
+ zh - (2 * loss_overlap),
+ ec->x, ec->y, ec->w, ec->h))
+ {
+ if (e_config->edge_flip_dragging)
+ {
+ Eina_Bool lf, rf, tf, bf;
+
+ lf = rf = tf = bf = EINA_TRUE;
+
+ if (ec->zone->desk_x_count <= 1) lf = rf = EINA_FALSE;
+ else if (!e_config->desk_flip_wrap)
+ {
+ if (ec->zone->desk_x_current == 0) lf = EINA_FALSE;
+ if (ec->zone->desk_x_current == (ec->zone->desk_x_count - 1)) rf = EINA_FALSE;
+ }
+
+ if (ec->zone->desk_y_count <= 1) tf = bf = EINA_FALSE;
+ else if (!e_config->desk_flip_wrap)
+ {
+ if (ec->zone->desk_y_current == 0) tf = EINA_FALSE;
+ if (ec->zone->desk_y_current == (ec->zone->desk_y_count - 1)) bf = EINA_FALSE;
+ }
+
+ if (!(lf) && (ec->x <= loss_overlap) && !(ec->zone->flip.switching))
+ _e_client_reset_lost_window(ec);
+
+ if (!(rf) && (ec->x >= (ec->zone->w - loss_overlap)) && !(ec->zone->flip.switching))
+ _e_client_reset_lost_window(ec);
+
+ if (!(tf) && (ec->y <= loss_overlap) && !(ec->zone->flip.switching))
+ _e_client_reset_lost_window(ec);
+
+ if (!(bf) && (ec->y >= (ec->zone->h - loss_overlap)) && !(ec->zone->flip.switching))
+ _e_client_reset_lost_window(ec);
+ }
+
+ if (!e_config->edge_flip_dragging)
+ _e_client_reset_lost_window(ec);
+ }
+}
+
+////////////////////////////////////////////////
+static void
+_e_client_zone_update(E_Client *ec)
+{
+ Eina_List *l;
+ E_Zone *zone;
+
+ /* still within old zone - leave it there */
+ if (E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
+ ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h))
+ return;
+ /* find a new zone */
+ EINA_LIST_FOREACH(ec->comp->zones, l, zone)
+ {
+ if (E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
+ zone->x, zone->y, zone->w, zone->h))
+ {
+ e_client_zone_set(ec, zone);
+ return;
+ }
+ }
+}
+
+////////////////////////////////////////////////
+
+static void
+_e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ if (stopping) return; //ignore all of this if we're shutting down!
+ if (e_object_is_del(data)) return; //client is about to die
+ if (ec->cur_mouse_action)
+ {
+ if (ec->cur_mouse_action->func.end_mouse)
+ ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
+ else if (ec->cur_mouse_action->func.end)
+ ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
+ E_FREE_FUNC(ec->cur_mouse_action, e_object_unref);
+ }
+ if (action_client == ec) _e_client_action_finish();
+ e_pointer_type_pop(ec->comp->pointer, ec, NULL);
+
+ if (!ec->iconic) e_hints_window_hidden_set(ec);
+
+ if (!ec->hidden)
+ {
+ ec->visible = 0;
+ ec->changes.visible = 1;
+ EC_CHANGED(ec);
+ if (ec->focused)
+ _e_client_revert_focus(ec);
+ }
+
+ ec->post_show = 0;
+
+ if (ec->new_client || ec->iconic) return;
+ _e_client_event_simple(ec, E_EVENT_CLIENT_HIDE);
+}
+
+static void
+_e_client_cb_evas_shade_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ ec->shading = 0;
+ ec->shaded = !(ec->shaded);
+ ec->changes.shaded = 1;
+ ec->changes.shading = 1;
+ e_client_comp_hidden_set(ec, ec->shaded);
+}
+
+static void
+_e_client_cb_evas_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ ec->pre_res_change.valid = 0;
+ if (ec->internal_ecore_evas)
+ {
+ EC_CHANGED(ec);
+ ec->changes.pos = 1;
+ }
+
+ _e_client_event_simple(ec, E_EVENT_CLIENT_MOVE);
+
+ _e_client_zone_update(ec);
+ if (ec->moving)
+ _e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec);
+}
+
+static void
+_e_client_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ ec->pre_res_change.valid = 0;
+ if (ec->internal_ecore_evas || (!ec->netwm.sync.request))
+ {
+ EC_CHANGED(ec);
+ ec->changes.size = 1;
+ }
+ if (ec->shaped)
+ {
+ ec->need_shape_merge = 1;
+ ec->need_shape_export = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ec->shaped_input)
+ {
+ ec->need_shape_merge = 1;
+ EC_CHANGED(ec);
+ }
+
+ _e_client_event_simple(ec, E_EVENT_CLIENT_RESIZE);
+
+ _e_client_zone_update(ec);
+
+ _e_client_hook_call(E_CLIENT_HOOK_RESIZE_UPDATE, ec);
+}
+
+static void
+_e_client_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ if (!ec->hidden)
+ {
+ ec->visible = 1;
+ ec->changes.visible = 1;
+ EC_CHANGED(ec);
+ }
+ if (!ec->iconic)
+ _e_client_event_simple(data, E_EVENT_CLIENT_SHOW);
+}
+
+static void
+_e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ if (e_config->transient.raise && ec->transients)
+ {
+ Eina_List *list = eina_list_clone(ec->transients);
+ E_Client *child, *below = NULL;
+
+ E_LIST_REVERSE_FREE(list, child)
+ {
+ /* Don't stack iconic transients. If the user wants these shown,
+ * thats another option.
+ */
+ if (child->iconic) continue;
+ if (below)
+ evas_object_stack_below(child->frame, below->frame);
+ else
+ evas_object_stack_above(child->frame, ec->frame);
+ below = child;
+ }
+ }
+
+ e_remember_update(ec);
+ _e_client_event_simple(ec, E_EVENT_CLIENT_STACK);
+}
+
+////////////////////////////////////////////////
+
+static void
+_e_client_maximize(E_Client *ec, E_Maximize max)
+{
+ int x1, yy1, x2, y2;
+ int w, h, pw, ph;
+ int zx, zy, zw, zh;
+ int ecx, ecy, ecw, ech;
+
+ zx = zy = zw = zh = 0;
+
+ switch (max & E_MAXIMIZE_TYPE)
+ {
+ case E_MAXIMIZE_NONE:
+ /* Ignore */
+ break;
+
+ case E_MAXIMIZE_FULLSCREEN:
+ w = ec->zone->w;
+ h = ec->zone->h;
+
+ evas_object_smart_callback_call(ec->frame, "fullscreen", NULL);
+ e_client_resize_limit(ec, &w, &h);
+ /* center x-direction */
+ x1 = ec->zone->x + (ec->zone->w - w) / 2;
+ /* center y-direction */
+ yy1 = ec->zone->y + (ec->zone->h - h) / 2;
+
+ switch (max & E_MAXIMIZE_DIRECTION)
+ {
+ case E_MAXIMIZE_BOTH:
+ evas_object_geometry_set(ec->frame, x1, yy1, w, h);
+ break;
+
+ case E_MAXIMIZE_VERTICAL:
+ evas_object_geometry_set(ec->frame, ec->x, yy1, ec->w, h);
+ break;
+
+ case E_MAXIMIZE_HORIZONTAL:
+ evas_object_geometry_set(ec->frame, x1, ec->y, w, ec->h);
+ break;
+
+ case E_MAXIMIZE_LEFT:
+ evas_object_geometry_set(ec->frame, ec->zone->x, ec->zone->y, w / 2, h);
+ break;
+
+ case E_MAXIMIZE_RIGHT:
+ evas_object_geometry_set(ec->frame, x1, ec->zone->y, w / 2, h);
+ break;
+ }
+ break;
+
+ case E_MAXIMIZE_SMART:
+ case E_MAXIMIZE_EXPAND:
+ e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
+ w = zw, h = zh;
+
+ evas_object_smart_callback_call(ec->frame, "maximize", NULL);
+ e_client_resize_limit(ec, &w, &h);
+ e_comp_object_frame_xy_unadjust(ec->frame, ec->x, ec->y, &ecx, &ecy);
+ e_comp_object_frame_wh_unadjust(ec->frame, ec->w, ec->h, &ecw, &ech);
+
+ if (ecw < zw)
+ w = ecw;
+ else
+ w = zw;
+
+ if (ech < zh)
+ h = ech;
+ else
+ h = zh;
+
+ if (ecx < zx) // window left not useful coordinates
+ x1 = zx;
+ else if (ecx + ecw > zx + zw) // window right not useful coordinates
+ x1 = zx + zw - ecw;
+ else // window normal position
+ x1 = ecx;
+
+ if (ecy < zy) // window top not useful coordinates
+ yy1 = zy;
+ else if (ecy + ech > zy + zh) // window bottom not useful coordinates
+ yy1 = zy + zh - ech;
+ else // window normal position
+ yy1 = ecy;
+
+ switch (max & E_MAXIMIZE_DIRECTION)
+ {
+ case E_MAXIMIZE_BOTH:
+ evas_object_geometry_set(ec->frame, zx, zy, zw, zh);
+ break;
+
+ case E_MAXIMIZE_VERTICAL:
+ evas_object_geometry_set(ec->frame, x1, zy, w, zh);
+ break;
+
+ case E_MAXIMIZE_HORIZONTAL:
+ evas_object_geometry_set(ec->frame, zx, yy1, zw, h);
+ break;
+
+ case E_MAXIMIZE_LEFT:
+ evas_object_geometry_set(ec->frame, zx, zy, zw / 2, zh);
+ break;
+
+ case E_MAXIMIZE_RIGHT:
+ evas_object_geometry_set(ec->frame, zx + zw / 2, zy, zw / 2, zh);
+ break;
+ }
+
+ break;
+
+ case E_MAXIMIZE_FILL:
+ x1 = ec->zone->x;
+ yy1 = ec->zone->y;
+ x2 = ec->zone->x + ec->zone->w;
+ y2 = ec->zone->y + ec->zone->h;
+
+ /* walk through all shelves */
+ e_maximize_client_shelf_fill(ec, &x1, &yy1, &x2, &y2, max);
+
+ /* walk through all windows */
+ e_maximize_client_client_fill(ec, &x1, &yy1, &x2, &y2, max);
+
+ w = x2 - x1;
+ h = y2 - yy1;
+ pw = w;
+ ph = h;
+ e_client_resize_limit(ec, &w, &h);
+ /* center x-direction */
+ x1 = x1 + (pw - w) / 2;
+ /* center y-direction */
+ yy1 = yy1 + (ph - h) / 2;
+
+ switch (max & E_MAXIMIZE_DIRECTION)
+ {
+ case E_MAXIMIZE_BOTH:
+ evas_object_geometry_set(ec->frame, x1, yy1, w, h);
+ break;
+
+ case E_MAXIMIZE_VERTICAL:
+ evas_object_geometry_set(ec->frame, ec->x, yy1, ec->w, h);
+ break;
+
+ case E_MAXIMIZE_HORIZONTAL:
+ evas_object_geometry_set(ec->frame, x1, ec->y, w, ec->h);
+ break;
+
+ case E_MAXIMIZE_LEFT:
+ evas_object_geometry_set(ec->frame, ec->zone->x, ec->zone->y, w / 2, h);
+ break;
+
+ case E_MAXIMIZE_RIGHT:
+ evas_object_geometry_set(ec->frame, x1, ec->zone->y, w / 2, h);
+ break;
+ }
+ break;
+ }
+}
+
+////////////////////////////////////////////////
+
+static void
+_e_client_eval(E_Client *ec)
+{
+ int rem_change = 0;
+ int send_event = 1;
+ unsigned int prop = 0;
+
+ if (e_object_is_del(E_OBJECT(ec)))
+ {
+ CRI("_e_client_eval(%p) with deleted border! - %d\n", ec, ec->new_client);
+ ec->changed = 0;
+ return;
+ }
+
+ if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT, ec)) return;
+
+ if (ec->new_client && (!e_client_util_ignored_get(ec)))
+ {
+ int zx = 0, zy = 0, zw = 0, zh = 0;
+
+ e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
+ /* enforce wm size hints for initial sizing */
+ e_client_resize_limit(ec, &ec->w, &ec->h);
+
+ if (ec->re_manage)
+ {
+ int x = ec->x, y = ec->y;
+ if (ec->x) e_comp_object_frame_xy_adjust(ec->frame, ec->x, 0, &ec->x, NULL);
+ if (ec->y) e_comp_object_frame_xy_adjust(ec->frame, 0, ec->y, NULL, &ec->y);
+ if ((x != ec->x) || (y != ec->y)) ec->changes.pos = 1;
+ ec->placed = 1;
+ }
+ if (ec->override)
+ ec->placed = 1;
+ if (!ec->placed)
+ {
+ /* FIXME: special placement for dialogs etc. etc. etc goes
+ * here */
+ /* FIXME: what if parent is not on this desktop - or zone? */
+ if ((ec->parent) && (ec->parent->visible))
+ {
+ if (!E_INSIDE(ec->x, ec->y, ec->parent->x, ec->parent->y, ec->parent->w, ec->parent->h))
+ {
+ ec->x = ec->parent->x + ((ec->parent->w - ec->w) / 2);
+ ec->y = ec->parent->y + ((ec->parent->h - ec->h) / 2);
+ ec->changes.pos = 1;
+ }
+ ec->placed = 1;
+ }
+#if 0
+ else if ((ec->leader) && (ec->dialog))
+ {
+ /* TODO: Place in center of group */
+ }
+#endif
+ else if (ec->dialog)
+ {
+ ec->x = zx + ((zw - ec->w) / 2);
+ ec->y = zy + ((zh - ec->h) / 2);
+ ec->changes.pos = 1;
+ ec->placed = 1;
+ }
+ }
+
+ if (!ec->placed)
+ {
+ Eina_List *skiplist = NULL;
+ int new_x, new_y, t = 0;
+
+ if (zw > ec->w)
+ new_x = zx + (rand() % (zw - ec->w));
+ else
+ new_x = zx;
+ if (zh > ec->h)
+ new_y = zy + (rand() % (zh - ec->h));
+ else
+ new_y = zy;
+
+ e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
+
+ if ((e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART) || (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET))
+ {
+ skiplist = eina_list_append(skiplist, ec);
+ if (ec->desk)
+ e_place_desk_region_smart(ec->desk, skiplist,
+ ec->x, ec->y, ec->w, ec->h,
+ &new_x, &new_y);
+ else
+ e_place_zone_region_smart(ec->zone, skiplist,
+ ec->x, ec->y, ec->w, ec->h,
+ &new_x, &new_y);
+ eina_list_free(skiplist);
+ }
+ else if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL)
+ {
+ e_place_zone_manual(ec->zone, ec->w, t, &new_x, &new_y);
+ }
+ else
+ {
+ e_place_zone_cursor(ec->zone, ec->x, ec->y, ec->w, ec->h,
+ t, &new_x, &new_y);
+ }
+ ec->x = new_x;
+ ec->y = new_y;
+ ec->changes.pos = 1;
+ }
+
+ /* Recreate state */
+ e_hints_window_init(ec);
+ if ((ec->e.state.centered) &&
+ ((!ec->remember) ||
+ ((ec->remember) && (!(ec->remember->apply & E_REMEMBER_APPLY_POS)))))
+ {
+ ec->x = zx + (zw - ec->w) / 2;
+ ec->y = zy + (zh - ec->h) / 2;
+ ec->changes.pos = 1;
+ ec->placed = 1;
+ }
+
+ /* if the explicit geometry request asks for the app to be
+ * in another zone - well move it there */
+ {
+ E_Zone *zone;
+
+ zone = e_comp_zone_xy_get(ec->comp, ec->x + (ec->w / 2), ec->y + (ec->h / 2));
+ if (!zone)
+ zone = e_comp_zone_xy_get(ec->comp, ec->x, ec->y);
+ if (!zone)
+ zone = e_comp_zone_xy_get(ec->comp, ec->x + ec->w - 1, ec->y);
+ if (!zone)
+ zone = e_comp_zone_xy_get(ec->comp, ec->x + ec->w - 1, ec->y + ec->h - 1);
+ if (!zone)
+ zone = e_comp_zone_xy_get(ec->comp, ec->x, ec->y + ec->h - 1);
+ if ((zone) && (zone != ec->zone))
+ e_client_zone_set(ec, zone);
+ }
+ }
+
+ if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, ec)) return;
+
+ /* effect changes to the window border itself */
+ if ((ec->changes.shading))
+ {
+ /* show at start of unshade (but don't hide until end of shade) */
+ //if (ec->shaded)
+ //ecore_x_window_raise(ec->win);
+ ec->changes.shading = 0;
+ send_event = 0;
+ rem_change = 1;
+ }
+ if (ec->changes.shaded) send_event = 0;
+ if ((ec->changes.shaded) && (ec->changes.pos) && (ec->changes.size))
+ {
+ //if (ec->shaded)
+ //ecore_x_window_lower(ec->win);
+ //else
+ //ecore_x_window_raise(ec->win);
+ ec->changes.shaded = 0;
+ rem_change = 1;
+ }
+ else if ((ec->changes.shaded) && (ec->changes.pos))
+ {
+ //if (ec->shaded)
+ //ecore_x_window_lower(ec->win);
+ //else
+ //ecore_x_window_raise(ec->win);
+ ec->changes.size = 1;
+ ec->changes.shaded = 0;
+ rem_change = 1;
+ }
+ else if ((ec->changes.shaded) && (ec->changes.size))
+ {
+ //if (ec->shaded)
+ //ecore_x_window_lower(ec->win);
+ //else
+ //ecore_x_window_raise(ec->win);
+ ec->changes.shaded = 0;
+ rem_change = 1;
+ }
+ else if (ec->changes.shaded)
+ {
+ //if (ec->shaded)
+ //ecore_x_window_lower(ec->win);
+ //else
+ //ecore_x_window_raise(ec->win);
+ ec->changes.shaded = 0;
+ rem_change = 1;
+ }
+
+ if (ec->changes.size)
+ {
+ ec->changes.size = 0;
+ if ((!ec->shaded) && (!ec->shading))
+ {
+ evas_object_resize(ec->frame, ec->w, ec->h);
+ if (ec->internal_ecore_evas)
+ ecore_evas_move_resize(ec->internal_ecore_evas, 0, 0, ec->client.w, ec->client.h);
+ }
+
+ rem_change = 1;
+ prop |= E_CLIENT_PROPERTY_SIZE;
+ }
+ if (ec->changes.pos)
+ {
+ ec->changes.pos = 0;
+ evas_object_move(ec->frame, ec->x, ec->y);
+ rem_change = 1;
+ prop |= E_CLIENT_PROPERTY_POS;
+ }
+
+ if (ec->changes.reset_gravity)
+ {
+ ec->changes.reset_gravity = 0;
+ rem_change = 1;
+ prop |= E_CLIENT_PROPERTY_GRAVITY;
+ }
+
+ if ((ec->changes.visible) && (ec->visible) && (ec->new_client))
+ {
+ int x, y;
+
+ ecore_evas_pointer_xy_get(ec->comp->ee, &x, &y);
+ if ((!ec->placed) && (!ec->re_manage) &&
+ (e_config->window_placement_policy == E_WINDOW_PLACEMENT_MANUAL) &&
+ (!((ec->icccm.transient_for != 0) ||
+ (ec->dialog))) &&
+ (!ecmove) && (!ecresize))
+ {
+ /* Set this window into moving state */
+
+ ec->cur_mouse_action = e_action_find("window_move");
+ if (ec->cur_mouse_action)
+ {
+ if ((!ec->cur_mouse_action->func.end_mouse) &&
+ (!ec->cur_mouse_action->func.end))
+ ec->cur_mouse_action = NULL;
+ if (ec->cur_mouse_action)
+ {
+ int t;
+ ec->x = x - (ec->w >> 1);
+ e_comp_object_frame_geometry_get(ec->frame, NULL, NULL, &t, NULL);
+ ec->y = y - (t >> 1);
+ EC_CHANGED(ec);
+ ec->changes.pos = 1;
+ }
+ }
+ }
+
+ evas_object_show(ec->frame);
+ if (evas_object_visible_get(ec->frame))
+ {
+ if (ec->cur_mouse_action)
+ {
+ ec->moveinfo.down.x = ec->x;
+ ec->moveinfo.down.y = ec->y;
+ ec->moveinfo.down.w = ec->w;
+ ec->moveinfo.down.h = ec->h;
+ ec->mouse.current.mx = x;
+ ec->mouse.current.my = y;
+ ec->moveinfo.down.button = 0;
+ ec->moveinfo.down.mx = x;
+ ec->moveinfo.down.my = y;
+
+ e_object_ref(E_OBJECT(ec->cur_mouse_action));
+ ec->cur_mouse_action->func.go(E_OBJECT(ec), NULL);
+ if (e_config->border_raise_on_mouse_action)
+ evas_object_raise(ec->frame);
+ evas_object_focus_set(ec->frame, 1);
+ }
+ ec->changes.visible = 0;
+ rem_change = 1;
+ _e_client_event_simple(ec, E_EVENT_CLIENT_SHOW);
+ }
+ }
+ else if ((ec->changes.visible) && (ec->new_client))
+ {
+ ec->changes.visible = 0;
+ _e_client_event_simple(ec, E_EVENT_CLIENT_HIDE);
+ }
+
+ if (ec->changes.icon)
+ {
+ if (!ec->new_client)
+ E_FREE_FUNC(ec->desktop, efreet_desktop_free);
+ if (ec->remember && ec->remember->prop.desktop_file)
+ {
+ Efreet_Desktop *d;
+ const char *desktop = ec->remember->prop.desktop_file;
+
+ d = efreet_desktop_get(desktop);
+ if (!d)
+ d = efreet_util_desktop_name_find(desktop);
+ if (d)
+ {
+ efreet_desktop_free(ec->desktop);
+ ec->desktop = d;
+ }
+ }
+ if (!ec->desktop)
+ {
+ if (ec->internal && (ec->icccm.class && (!strncmp(ec->icccm.class, "e_fwin::", 8))))
+ ec->desktop = efreet_util_desktop_exec_find("enlightenment_filemanager");
+ }
+ if (!ec->desktop)
+ {
+ if ((ec->icccm.name) && (ec->icccm.class))
+ ec->desktop = efreet_util_desktop_wm_class_find(ec->icccm.name,
+ ec->icccm.class);
+ }
+ if (!ec->desktop)
+ {
+ /* libreoffice and maybe others match window class
+ with .desktop file name */
+ if (ec->icccm.class)
+ {
+ char buf[4096] = {0};
+ snprintf(buf, sizeof(buf), "%s.desktop", ec->icccm.class);
+ ec->desktop = efreet_util_desktop_file_id_find(buf);
+ if (!ec->desktop)
+ {
+ char *s;
+
+ strncpy(buf, ec->icccm.class, sizeof(buf));
+ s = buf;
+ eina_str_tolower(&s);
+ if (strcmp(s, ec->icccm.class))
+ ec->desktop = efreet_util_desktop_exec_find(s);
+ }
+ }
+ }
+ if (!ec->desktop)
+ {
+ ec->desktop = e_exec_startup_id_pid_find(ec->netwm.startup_id,
+ ec->netwm.pid);
+ if (ec->desktop) efreet_desktop_ref(ec->desktop);
+ }
+ if (!ec->desktop && ec->icccm.name)
+ {
+ /* this works for most cases as fallback. useful when app is
+ run from a shell */
+ ec->desktop = efreet_util_desktop_exec_find(ec->icccm.name);
+ }
+ if (!ec->desktop && ec->parent)
+ {
+ E_Client *ec2 = ec->parent;
+ if (ec2->desktop)
+ {
+ efreet_desktop_ref(ec2->desktop);
+ ec->desktop = ec2->desktop;
+ }
+ }
+
+ e_comp_object_frame_icon_update(ec->frame);
+ if ((ec->new_client || ec->re_manage) && ec->desktop && (!ec->exe_inst))
+ e_exec_phony(ec);
+ ec->changes.icon = 0;
+ prop |= E_CLIENT_PROPERTY_ICON;
+ }
+
+ ec->new_client = 0;
+ ec->comp->new_clients--;
+ ec->changed = ec->changes.pos || ec->changes.size ||
+ ec->changes.stack || ec->changes.prop || ec->changes.border ||
+ ec->changes.reset_gravity || ec->changes.shading || ec->changes.shaded ||
+ ec->changes.shape || ec->changes.shape_input || ec->changes.icon ||
+ ec->changes.internal_props || ec->changes.internal_state ||
+ ec->changes.need_maximize || ec->changes.need_unmaximize;
+ ec->changes.stack = 0;
+
+ if ((!ec->input_only) && ((ec->take_focus) || (ec->want_focus)))
+ {
+ ec->take_focus = 0;
+ if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) || (ec->want_focus))
+ {
+ ec->want_focus = 0;
+ e_client_focus_set_with_pointer(ec);
+ }
+ else if (ec->dialog)
+ {
+ if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
+ ((e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED) &&
+ (ec->parent == e_client_focused_get())))
+ {
+ e_client_focus_set_with_pointer(ec);
+ }
+ }
+ else
+ {
+ /* focus window by default when it is the only one on desk */
+ E_Client *ec2 = NULL;
+ Eina_List *l;
+ EINA_LIST_FOREACH(focus_stack, l, ec2)
+ {
+ if (ec == ec2) continue;
+ if ((!ec2->iconic) && (ec2->visible) &&
+ ((ec->desk == ec2->desk) || ec2->sticky))
+ break;
+ }
+
+ if (!ec2)
+ {
+ e_client_focus_set_with_pointer(ec);
+ }
+ }
+ }
+
+ if (ec->changes.need_maximize)
+ {
+ E_Maximize max = ec->maximized;
+ ec->maximized = E_MAXIMIZE_NONE;
+ e_client_maximize(ec, max);
+ ec->changes.need_maximize = 0;
+ }
+ else if (ec->changes.need_unmaximize)
+ {
+ e_client_unmaximize(ec, ec->maximized);
+ ec->changes.need_unmaximize = 0;
+ }
+
+ if (ec->need_fullscreen)
+ {
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
+ ec->need_fullscreen = 0;
+ }
+
+ if (rem_change)
+ e_remember_update(ec);
+
+ if (send_event && rem_change && prop)
+ {
+ _e_client_event_property(ec, prop);
+ }
+ _e_client_hook_call(E_CLIENT_HOOK_EVAL_END, ec);
+}
+
+
+////////////////////////////////////////////////
+EINTERN void
+e_client_idler_before(void)
+{
+ const Eina_List *l;
+ E_Comp *c;
+
+ if (!eina_hash_population(clients_hash)) return;
+
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ {
+ Eina_List *ll;
+ E_Client *ec;
+
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ int urgent = ec->icccm.urgent;
+ Eina_Stringshare *title;
+ // pass 1 - eval0. fetch properties on new or on change and
+ // call hooks to decide what to do - maybe move/resize
+ if (!ec->changed) continue;
+
+ if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FETCH, ec)) continue;
+ /* FETCH is hooked by the compositor to get client hints */
+ title = e_client_name_get(ec);
+ if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_FETCH, ec)) continue;
+ if (title != e_client_name_get(ec))
+ _e_client_event_property(ec, E_CLIENT_PROPERTY_TITLE);
+ /* PRE_POST_FETCH calls e_remember apply for new client */
+ if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, ec)) continue;
+ if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FETCH, ec)) continue;
+ if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, ec)) continue;
+
+ if ((ec->border.changed) && (!ec->shaded) &&
+ (!(((ec->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN))))
+ {
+ const char *bordername;
+ Eina_Stringshare *pborder;
+
+ if (ec->fullscreen || ec->borderless)
+ bordername = "borderless";
+ else if (ec->bordername)
+ bordername = ec->bordername;
+ else if ((ec->mwm.borderless) || (ec->borderless))
+ bordername = "borderless";
+ else if (((ec->icccm.transient_for != 0) ||
+ (ec->dialog)) &&
+ (ec->icccm.min_w == ec->icccm.max_w) &&
+ (ec->icccm.min_h == ec->icccm.max_h))
+ bordername = "noresize_dialog";
+ else if ((ec->icccm.min_w == ec->icccm.max_w) &&
+ (ec->icccm.min_h == ec->icccm.max_h))
+ bordername = "noresize";
+ else if (ec->shaped)
+ bordername = "shaped";
+ else if (e_pixmap_is_x(ec->pixmap) &&
+ ((!ec->icccm.accepts_focus) &&
+ (!ec->icccm.take_focus)))
+ bordername = "nofocus";
+ else if (ec->icccm.urgent)
+ bordername = "urgent";
+ else if ((ec->icccm.transient_for != 0) ||
+ (ec->dialog))
+ bordername = "dialog";
+ else if (ec->netwm.state.modal)
+ bordername = "modal";
+ else if ((ec->netwm.state.skip_taskbar) ||
+ (ec->netwm.state.skip_pager))
+ bordername = "skipped";
+ /*
+ else if ((ec->internal) && (ec->icccm.class) &&
+ (!strncmp(ec->icccm.class, "e_fwin", 6)))
+ bordername = "internal_fileman";
+ */
+ else
+ bordername = e_config->theme_default_border_style;
+ if (!bordername) bordername = "default";
+
+ if (e_util_strcmp(ec->border.name, bordername))
+ {
+ pborder = ec->border.name;
+ ec->border.name = eina_stringshare_add(bordername);
+ if (e_comp_object_frame_theme_set(ec->frame, bordername))
+ eina_stringshare_del(pborder);
+ else
+ {
+ eina_stringshare_del(ec->border.name);
+ ec->border.name = pborder;
+ }
+ }
+ ec->border.changed = 0;
+ }
+ if (urgent != ec->icccm.urgent)
+ {
+ _e_client_event_property(ec, E_CLIENT_PROPERTY_URGENCY);
+ if (ec->icccm.urgent && (!ec->focused))
+ e_comp_object_signal_emit(ec->frame, "e,state,urgent", "e");
+ else
+ e_comp_object_signal_emit(ec->frame, "e,state,not_urgent", "e");
+ }
+ _e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, ec);
+ }
+
+ // layout hook - this is where a hook gets to figure out what to
+ // do if anything.
+#warning FIXME: this should be...better :/
+ _e_client_hook_call(E_CLIENT_HOOK_CANVAS_LAYOUT, (void*)c);
+
+ E_CLIENT_FOREACH(c, ec)
+ {
+ // pass 2 - show windows needing show
+ if ((ec->changes.visible) && (ec->visible) &&
+ (!ec->new_client) && (!ec->changes.pos) &&
+ (!ec->changes.size))
+ {
+ evas_object_show(ec->frame);
+ ec->changes.visible = !evas_object_visible_get(ec->frame);
+ }
+
+ if ((!ec->new_client) && (!e_client_util_ignored_get(ec)) &&
+ (!E_INSIDE(ec->x, ec->y, 0, 0, ec->zone->w - 5, ec->zone->h - 5)) &&
+ (!E_INSIDE(ec->x, ec->y, 0 - ec->w + 5, 0 - ec->h + 5, ec->zone->w - 5, ec->zone->h - 5))
+ )
+ {
+ if (e_config->screen_limits != E_SCREEN_LIMITS_COMPLETELY)
+ _e_client_move_lost_window_to_center(ec);
+ }
+ }
+
+
+ // pass 3 - hide windows needing hide and eval (main eval)
+ E_CLIENT_FOREACH(c, ec)
+ {
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+
+ if ((ec->changes.visible) && (!ec->visible))
+ {
+ evas_object_hide(ec->frame);
+ ec->changes.visible = 0;
+ }
+
+ if (ec->changed)
+ _e_client_eval(ec);
+
+ if ((ec->changes.visible) && (ec->visible) && (!ec->changed))
+ {
+ evas_object_show(ec->frame);
+ ec->changes.visible = !evas_object_visible_get(ec->frame);
+ ec->changed = ec->changes.visible;
+ }
+ }
+ }
+}
+
+
+EINTERN Eina_Bool
+e_client_init(void)
+{
+ clients_hash = eina_hash_pointer_new(NULL);
+
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_POINTER_WARP,
+ _e_client_cb_pointer_warp, NULL);
+ E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_DESKTOP_CACHE_UPDATE,
+ _e_client_cb_efreet_cache_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_ICON_CACHE_UPDATE,
+ _e_client_cb_efreet_cache_update, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_ICON_THEME,
+ _e_client_cb_config_icon_theme, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_MODE_CHANGED,
+ _e_client_cb_config_mode, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_WINDOW_PROFILE_CHANGE,
+ _e_client_cb_desk_window_profile_change, NULL);
+
+ E_EVENT_CLIENT_ADD = ecore_event_type_new();
+ E_EVENT_CLIENT_REMOVE = ecore_event_type_new();
+ E_EVENT_CLIENT_DESK_SET = ecore_event_type_new();
+ E_EVENT_CLIENT_ZONE_SET = ecore_event_type_new();
+ E_EVENT_CLIENT_RESIZE = ecore_event_type_new();
+ E_EVENT_CLIENT_MOVE = ecore_event_type_new();
+ E_EVENT_CLIENT_SHOW = ecore_event_type_new();
+ E_EVENT_CLIENT_HIDE = ecore_event_type_new();
+ E_EVENT_CLIENT_ICONIFY = ecore_event_type_new();
+ E_EVENT_CLIENT_UNICONIFY = ecore_event_type_new();
+ E_EVENT_CLIENT_STICK = ecore_event_type_new();
+ E_EVENT_CLIENT_UNSTICK = ecore_event_type_new();
+ E_EVENT_CLIENT_STACK = ecore_event_type_new();
+ E_EVENT_CLIENT_FOCUS_IN = ecore_event_type_new();
+ E_EVENT_CLIENT_FOCUS_OUT = ecore_event_type_new();
+ E_EVENT_CLIENT_PROPERTY = ecore_event_type_new();
+ E_EVENT_CLIENT_FULLSCREEN = ecore_event_type_new();
+ E_EVENT_CLIENT_UNFULLSCREEN = ecore_event_type_new();
+
+ return (!!clients_hash);
+}
+
+EINTERN void
+e_client_shutdown(void)
+{
+ E_FREE_FUNC(clients_hash, eina_hash_free);
+
+ E_FREE_LIST(handlers, ecore_event_handler_del);
+
+ e_int_client_menu_hooks_clear();
+ E_FREE_FUNC(warp_timer, ecore_timer_del);
+ warp_client = NULL;
+}
+
+EAPI E_Client *
+e_client_new(E_Comp *c, E_Pixmap *cp, int first_map, int internal)
+{
+ E_Client *ec;
+
+ if (eina_hash_find(clients_hash, &cp)) return NULL;
+
+ ec = E_OBJECT_ALLOC(E_Client, E_CLIENT_TYPE, _e_client_free);
+ if (!ec) return NULL;
+ e_object_del_func_set(E_OBJECT(ec), E_OBJECT_CLEANUP_FUNC(_e_client_del));
+
+ ec->focus_policy_override = E_FOCUS_LAST;
+ ec->w = 1;
+ ec->h = 1;
+ ec->internal = internal;
+ ec->comp = c;
+
+ ec->pixmap = cp;
+ e_pixmap_client_set(cp, ec);
+ ec->resize_mode = E_POINTER_RESIZE_NONE;
+ ec->layer = E_LAYER_CLIENT_NORMAL;
+
+ /* printf("##- ON MAP CLIENT 0x%x SIZE %ix%i %i:%i\n",
+ * ec->win, ec->w, ec->h, att->x, att->y); */
+
+ /* FIXME: if first_map is 1 then we should ignore the first hide event
+ * or ensure the window is already hidden and events flushed before we
+ * create a border for it */
+ if (first_map)
+ {
+ // printf("##- FIRST MAP\n");
+ ec->changes.pos = 1;
+ ec->re_manage = 1;
+ // needed to be 1 for internal windw and on restart.
+ // ec->ignore_first_unmap = 2;
+ }
+ ec->offer_resistance = 1;
+ ec->new_client = 1;
+ ec->comp->new_clients++;
+
+ if (!_e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT, ec)) return NULL;
+ e_client_desk_set(ec, e_desk_current_get(e_zone_current_get(c)));
+
+ ec->icccm.title = NULL;
+ ec->icccm.name = NULL;
+ ec->icccm.class = NULL;
+ ec->icccm.icon_name = NULL;
+ ec->icccm.machine = NULL;
+ ec->icccm.min_w = 1;
+ ec->icccm.min_h = 1;
+ ec->icccm.max_w = 32767;
+ ec->icccm.max_h = 32767;
+ ec->icccm.base_w = 0;
+ ec->icccm.base_h = 0;
+ ec->icccm.step_w = -1;
+ ec->icccm.step_h = -1;
+ ec->icccm.min_aspect = 0.0;
+ ec->icccm.max_aspect = 0.0;
+
+ ec->netwm.pid = 0;
+ ec->netwm.name = NULL;
+ ec->netwm.icon_name = NULL;
+ ec->netwm.desktop = 0;
+ ec->netwm.state.modal = 0;
+ ec->netwm.state.sticky = 0;
+ ec->netwm.state.shaded = 0;
+ ec->netwm.state.hidden = 0;
+ ec->netwm.state.maximized_v = 0;
+ ec->netwm.state.maximized_h = 0;
+ ec->netwm.state.skip_taskbar = 0;
+ ec->netwm.state.skip_pager = 0;
+ ec->netwm.state.fullscreen = 0;
+ ec->netwm.state.stacking = E_STACKING_NONE;
+ ec->netwm.action.move = 0;
+ ec->netwm.action.resize = 0;
+ ec->netwm.action.minimize = 0;
+ ec->netwm.action.shade = 0;
+ ec->netwm.action.stick = 0;
+ ec->netwm.action.maximized_h = 0;
+ ec->netwm.action.maximized_v = 0;
+ ec->netwm.action.fullscreen = 0;
+ ec->netwm.action.change_desktop = 0;
+ ec->netwm.action.close = 0;
+ ec->netwm.opacity = 255;
+
+ EC_CHANGED(ec);
+
+ c->clients = eina_list_append(c->clients, ec);
+ eina_hash_direct_add(clients_hash, &ec->pixmap, ec);
+
+ _e_client_event_simple(ec, E_EVENT_CLIENT_ADD);
+ e_comp_object_client_add(ec);
+ if (ec->frame)
+ {
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_client_cb_evas_show, ec);
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_client_cb_evas_hide, ec);
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_client_cb_evas_move, ec);
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _e_client_cb_evas_resize, ec);
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_client_cb_evas_restack, ec);
+ evas_object_smart_callback_add(ec->frame, "shade_done", _e_client_cb_evas_shade_done, ec);
+ if (ec->override)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_PRIO);
+ else
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
+ }
+ if (!e_client_util_ignored_get(ec))
+ {
+ if (starting)
+ focus_stack = eina_list_prepend(focus_stack, ec);
+ else
+ focus_stack = eina_list_append(focus_stack, ec);
+ }
+
+ return ec;
+}
+
+EAPI void
+e_client_desk_set(E_Client *ec, E_Desk *desk)
+{
+ E_Event_Client_Desk_Set *ev;
+ E_Desk *old_desk;
+
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ E_OBJECT_CHECK(desk);
+ E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
+ if (ec->desk == desk) return;
+ if ((e_config->use_desktop_window_profile) &&
+ (ec->e.state.profile.use))
+ {
+ if (ec->e.state.profile.wait_for_done) return;
+ if (e_util_strcmp(ec->e.state.profile.name, desk->window_profile))
+ {
+ eina_stringshare_refplace(&ec->e.state.profile.set, desk->window_profile);
+ EC_CHANGED(ec);
+ return;
+ }
+ }
+ if (ec->fullscreen)
+ {
+ ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
+ desk->fullscreen_clients = eina_list_append(desk->fullscreen_clients, ec);
+ }
+ old_desk = ec->desk;
+ ec->desk = desk;
+ if (desk->visible || ec->sticky)
+ {
+ e_comp_object_effect_unclip(ec->frame);
+ e_comp_object_effect_set(ec->frame, NULL);
+ if ((!ec->hidden) && (!ec->iconic))
+ evas_object_show(ec->frame);
+ }
+ else
+ {
+ ec->hidden = 1;
+ evas_object_hide(ec->frame);
+ }
+ e_client_comp_hidden_set(ec, !desk->visible);
+ e_client_zone_set(ec, desk->zone);
+
+ e_hints_window_desktop_set(ec);
+
+ if (old_desk)
+ {
+ ev = E_NEW(E_Event_Client_Desk_Set, 1);
+ ev->ec = ec;
+ e_object_ref(E_OBJECT(ec));
+ ev->desk = old_desk;
+ e_object_ref(E_OBJECT(old_desk));
+ ecore_event_add(E_EVENT_CLIENT_DESK_SET, ev, (Ecore_End_Cb)_e_client_event_desk_set_free, NULL);
+ }
+
+ if (e_config->transient.desktop)
+ {
+ E_Client *child;
+ const Eina_List *l;
+
+ EINA_LIST_FOREACH(ec->transients, l, child)
+ e_client_desk_set(child, ec->desk);
+ }
+
+ e_remember_update(ec);
+ _e_client_hook_call(E_CLIENT_HOOK_DESK_SET, ec);
+}
+
+EAPI Eina_Bool
+e_client_comp_grabbed_get(void)
+{
+ return comp_grabbed;
+}
+
+EAPI E_Client *
+e_client_action_get(void)
+{
+ return action_client;
+}
+
+EAPI E_Client *
+e_client_warping_get(void)
+{
+ return warp_client;
+}
+
+
+EAPI Eina_List *
+e_clients_immortal_list(const E_Comp *c)
+{
+ const Eina_List *l, *ll;
+ Eina_List *list = NULL;
+ E_Client *ec;
+
+ if (c)
+ {
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (ec->lock_life)
+ list = eina_list_append(list, ec);
+ }
+ }
+ else
+ {
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (ec->lock_life)
+ list = eina_list_append(list, ec);
+ }
+ }
+ return list;
+}
+
+//////////////////////////////////////////////////////////
+
+EAPI void
+e_client_mouse_in(E_Client *ec, int x, int y)
+{
+ if (comp_grabbed) return;
+ if (warp_client && (ec != warp_client)) return;
+ if (e_object_is_del(E_OBJECT(ec))) return;
+ if (ec->desk && ec->desk->animate_count) return;
+ ec->mouse.current.mx = x;
+ ec->mouse.current.my = y;
+ if (!ec->iconic)
+ e_focus_event_mouse_in(ec);
+}
+
+EAPI void
+e_client_mouse_out(E_Client *ec, int x, int y)
+{
+ if (comp_grabbed) return;
+ if (ec->fullscreen) return;
+ if (e_object_is_del(E_OBJECT(ec))) return;
+ if (ec->desk && ec->desk->animate_count) return;
+ if ((!ec->input_object) && E_INSIDE(x, y, ec->x, ec->y, ec->w, ec->h)) return;
+
+ ec->mouse.current.mx = x;
+ ec->mouse.current.my = y;
+ if (!ec->iconic)
+ e_focus_event_mouse_out(ec);
+}
+
+EAPI void
+e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+ if (action_client) return;
+ ec->mouse.current.mx = output->x;
+ ec->mouse.current.my = output->y;
+ if (!ec->cur_mouse_action)
+ e_bindings_wheel_event_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(ec), ev);
+}
+
+EAPI void
+e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+ if (action_client) return;
+ if ((button >= 1) && (button <= 3))
+ {
+ ec->mouse.last_down[button - 1].mx = output->x;
+ ec->mouse.last_down[button - 1].my = output->y;
+ ec->mouse.last_down[button - 1].x = ec->x;
+ ec->mouse.last_down[button - 1].y = ec->y;
+ ec->mouse.last_down[button - 1].w = ec->w;
+ ec->mouse.last_down[button - 1].h = ec->h;
+ }
+ else
+ {
+ ec->moveinfo.down.x = ec->x;
+ ec->moveinfo.down.y = ec->y;
+ ec->moveinfo.down.w = ec->w;
+ ec->moveinfo.down.h = ec->h;
+ }
+ ec->mouse.current.mx = output->x;
+ ec->mouse.current.my = output->y;
+ if (!ec->cur_mouse_action)
+ {
+ ec->cur_mouse_action =
+ e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_WINDOW,
+ E_OBJECT(ec), ev);
+ if (ec->cur_mouse_action)
+ {
+ if ((!ec->cur_mouse_action->func.end_mouse) &&
+ (!ec->cur_mouse_action->func.end))
+ ec->cur_mouse_action = NULL;
+ if (ec->cur_mouse_action)
+ e_object_ref(E_OBJECT(ec->cur_mouse_action));
+ }
+ }
+ e_focus_event_mouse_down(ec);
+ if ((button >= 1) && (button <= 3))
+ {
+ ec->mouse.last_down[button - 1].mx = output->x;
+ ec->mouse.last_down[button - 1].my = output->y;
+ ec->mouse.last_down[button - 1].x = ec->x;
+ ec->mouse.last_down[button - 1].y = ec->y;
+ ec->mouse.last_down[button - 1].w = ec->w;
+ ec->mouse.last_down[button - 1].h = ec->h;
+ }
+ else
+ {
+ ec->moveinfo.down.x = ec->x;
+ ec->moveinfo.down.y = ec->y;
+ ec->moveinfo.down.w = ec->w;
+ ec->moveinfo.down.h = ec->h;
+ }
+ ec->mouse.current.mx = output->x;
+ ec->mouse.current.my = output->y;
+}
+
+EAPI void
+e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+ if ((button >= 1) && (button <= 3))
+ {
+ ec->mouse.last_up[button - 1].mx = output->x;
+ ec->mouse.last_up[button - 1].my = output->y;
+ ec->mouse.last_up[button - 1].x = ec->x;
+ ec->mouse.last_up[button - 1].y = ec->y;
+ }
+ ec->mouse.current.mx = output->x;
+ ec->mouse.current.my = output->y;
+ /* also we dont pass the same params that went in - then again that */
+ /* should be ok as we are just ending the action if it has an end */
+ if (ec->cur_mouse_action)
+ {
+ if (ec->cur_mouse_action->func.end_mouse)
+ ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", ev);
+ else if (ec->cur_mouse_action->func.end)
+ ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
+ e_object_unref(E_OBJECT(ec->cur_mouse_action));
+ ec->cur_mouse_action = NULL;
+ }
+ else
+ {
+ if (!e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(ec), ev))
+ e_focus_event_mouse_up(ec);
+ }
+ if ((button >= 1) && (button <= 3))
+ {
+ ec->mouse.last_up[button - 1].mx = output->x;
+ ec->mouse.last_up[button - 1].my = output->y;
+ ec->mouse.last_up[button - 1].x = ec->x;
+ ec->mouse.last_up[button - 1].y = ec->y;
+ }
+
+ ec->drag.start = 0;
+}
+
+EAPI void
+e_client_mouse_move(E_Client *ec, Evas_Point *output)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+ ec->mouse.current.mx = output->x;
+ ec->mouse.current.my = output->y;
+ if (ec->moving)
+ {
+ int x, y, new_x, new_y;
+ int new_w, new_h;
+ Eina_List *skiplist = NULL;
+
+ if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
+ {
+ x = ec->mouse.last_down[ec->moveinfo.down.button - 1].x +
+ (ec->mouse.current.mx - ec->moveinfo.down.mx);
+ y = ec->mouse.last_down[ec->moveinfo.down.button - 1].y +
+ (ec->mouse.current.my - ec->moveinfo.down.my);
+ }
+ else
+ {
+ x = ec->moveinfo.down.x +
+ (ec->mouse.current.mx - ec->moveinfo.down.mx);
+ y = ec->moveinfo.down.y +
+ (ec->mouse.current.my - ec->moveinfo.down.my);
+ }
+ e_comp_object_frame_xy_adjust(ec->frame, x, y, &new_x, &new_y);
+
+ skiplist = eina_list_append(skiplist, ec);
+ e_resist_client_position(ec->comp, skiplist,
+ ec->x, ec->y, ec->w, ec->h,
+ x, y, ec->w, ec->h,
+ &new_x, &new_y, &new_w, &new_h);
+ eina_list_free(skiplist);
+
+ if (e_config->screen_limits == E_SCREEN_LIMITS_WITHIN)
+ _e_client_stay_within_canvas(ec, x, y, &new_x, &new_y);
+
+ ec->shelf_fix.x = 0;
+ ec->shelf_fix.y = 0;
+ ec->shelf_fix.modified = 0;
+ evas_object_move(ec->frame, new_x, new_y);
+ e_zone_flip_coords_handle(ec->zone, output->x, output->y);
+ }
+ else if (e_client_resizing_get(ec))
+ {
+ _e_client_resize_handle(ec);
+ }
+ else if (ec->drag.start)
+ {
+ if ((ec->drag.x == -1) && (ec->drag.y == -1))
+ {
+ ec->drag.x = output->x;
+ ec->drag.y = output->y;
+ }
+ else
+ {
+ int dx, dy;
+
+ dx = ec->drag.x - output->x;
+ dy = ec->drag.y - output->y;
+ if (((dx * dx) + (dy * dy)) >
+ (e_config->drag_resist * e_config->drag_resist))
+ {
+ /* start drag! */
+ if (ec->netwm.icons || ec->desktop || ec->internal_icon)
+ {
+ Evas_Object *o = NULL;
+ const char *drag_types[] = { "enlightenment/border" };
+
+ e_object_ref(E_OBJECT(ec));
+ client_drag = e_drag_new(ec->zone->comp,
+ output->x, output->y,
+ drag_types, 1, ec, -1,
+ NULL,
+ _e_client_cb_drag_finished);
+ e_drag_resize(client_drag, e_scale * 48, e_scale * 48);
+ o = e_client_icon_add(ec, client_drag->evas);
+ if (!o)
+ {
+ /* FIXME: fallback icon for drag */
+ o = evas_object_rectangle_add(client_drag->evas);
+ evas_object_color_set(o, 255, 255, 255, 255);
+ }
+ e_drag_object_set(client_drag, o);
+
+ e_drag_start(client_drag, ec->drag.x, ec->drag.y);
+ }
+ ec->drag.start = 0;
+ }
+ }
+ }
+}
+///////////////////////////////////////////////////////
+
+EAPI void
+e_client_res_change_geometry_save(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ if (ec->pre_res_change.valid) return;
+ ec->pre_res_change.valid = 1;
+ ec->pre_res_change.x = ec->x;
+ ec->pre_res_change.y = ec->y;
+ ec->pre_res_change.w = ec->w;
+ ec->pre_res_change.h = ec->h;
+ ec->pre_res_change.saved.x = ec->saved.x;
+ ec->pre_res_change.saved.y = ec->saved.y;
+ ec->pre_res_change.saved.w = ec->saved.w;
+ ec->pre_res_change.saved.h = ec->saved.h;
+}
+
+EAPI void
+e_client_res_change_geometry_restore(E_Client *ec)
+{
+ struct
+ {
+ unsigned char valid : 1;
+ int x, y, w, h;
+ struct
+ {
+ int x, y, w, h;
+ } saved;
+ } pre_res_change;
+
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (!ec->pre_res_change.valid) return;
+ if (ec->new_client) return;
+
+ memcpy(&pre_res_change, &ec->pre_res_change, sizeof(pre_res_change));
+
+ if (ec->fullscreen)
+ {
+ e_client_unfullscreen(ec);
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
+ }
+ else if (ec->maximized != E_MAXIMIZE_NONE)
+ {
+ E_Maximize max;
+
+ max = ec->maximized;
+ e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
+ e_client_maximize(ec, max);
+ }
+ else
+ {
+ int x, y, w, h, zx, zy, zw, zh;
+
+ ec->saved.x = ec->pre_res_change.saved.x;
+ ec->saved.y = ec->pre_res_change.saved.y;
+ ec->saved.w = ec->pre_res_change.saved.w;
+ ec->saved.h = ec->pre_res_change.saved.h;
+
+ e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
+
+ if (ec->saved.w > zw)
+ ec->saved.w = zw;
+ if ((ec->saved.x + ec->saved.w) > (zx + zw))
+ ec->saved.x = zx + zw - ec->saved.w;
+
+ if (ec->saved.h > zh)
+ ec->saved.h = zh;
+ if ((ec->saved.y + ec->saved.h) > (zy + zh))
+ ec->saved.y = zy + zh - ec->saved.h;
+
+ x = ec->pre_res_change.x;
+ y = ec->pre_res_change.y;
+ w = ec->pre_res_change.w;
+ h = ec->pre_res_change.h;
+ if (w > zw)
+ w = zw;
+ if (h > zh)
+ h = zh;
+ if ((x + w) > (zx + zw))
+ x = zx + zw - w;
+ if ((y + h) > (zy + zh))
+ y = zy + zh - h;
+ evas_object_geometry_set(ec->frame, x, y, w, h);
+ }
+ memcpy(&ec->pre_res_change, &pre_res_change, sizeof(pre_res_change));
+}
+
+EAPI void
+e_client_zone_set(E_Client *ec, E_Zone *zone)
+{
+ E_Event_Client_Zone_Set *ev;
+
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ E_OBJECT_CHECK(zone);
+ E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
+ if (!zone) return;
+ if (ec->zone == zone) return;
+
+ /* if the window does not lie in the new zone, move it so that it does */
+ if (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
+ {
+ int x, y;
+
+ if (ec->zone)
+ {
+ /* first guess -- get offset from old zone, and apply to new zone */
+ x = zone->x + (ec->x - ec->zone->x);
+ y = zone->y + (ec->y - ec->zone->y);
+ }
+ else
+ x = ec->x, y = ec->y;
+
+ /* keep window from hanging off bottom and left */
+ if (x + ec->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + ec->w);
+ if (y + ec->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + ec->h);
+
+ /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */
+ if (x < zone->x) x = zone->x;
+ if (y < zone->y) y = zone->y;
+
+ if (!E_INTERSECTS(x, y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
+ {
+ /* still not in zone at all, so just move it to closest edge */
+ if (x < zone->x) x = zone->x;
+ if (x >= zone->x + zone->w) x = zone->x + zone->w - ec->w;
+ if (y < zone->y) y = zone->y;
+ if (y >= zone->y + zone->h) y = zone->y + zone->h - ec->h;
+ }
+ evas_object_move(ec->frame, x, y);
+ }
+
+ ec->zone = zone;
+
+ if (ec->desk->zone != ec->zone)
+ e_client_desk_set(ec, e_desk_current_get(ec->zone));
+
+ ev = E_NEW(E_Event_Client_Zone_Set, 1);
+ ev->ec = ec;
+ e_object_ref(E_OBJECT(ec));
+ ev->zone = zone;
+ e_object_ref(E_OBJECT(zone));
+
+ ecore_event_add(E_EVENT_CLIENT_ZONE_SET, ev, (Ecore_End_Cb)_e_client_event_zone_set_free, NULL);
+
+ e_remember_update(ec);
+ e_client_res_change_geometry_save(ec);
+ e_client_res_change_geometry_restore(ec);
+ ec->pre_res_change.valid = 0;
+}
+
+EAPI void
+e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ if (ec->frame)
+ evas_object_geometry_get(ec->frame, x, y, w, h);
+ else
+ {
+ if (x) *x = ec->x;
+ if (y) *y = ec->y;
+ if (w) *w = ec->w;
+ if (h) *h = ec->h;
+ }
+}
+
+EAPI E_Client *
+e_client_above_get(const E_Client *ec)
+{
+ unsigned int x;
+ E_Client *ec2;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
+ if (EINA_INLIST_GET(ec)->next) //check current layer
+ {
+ EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
+ if (!e_object_is_del(E_OBJECT(ec2)))
+ return ec2;
+ }
+ if (ec->layer == E_LAYER_CLIENT_PRIO) return NULL;
+
+ /* go up the layers until we find one */
+ for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); x++)
+ {
+ if (!ec->comp->layers[x].clients) continue;
+ EINA_INLIST_FOREACH(ec->comp->layers[x].clients, ec2)
+ if (!e_object_is_del(E_OBJECT(ec2)))
+ return ec2;
+ }
+ return NULL;
+}
+
+EAPI E_Client *
+e_client_below_get(const E_Client *ec)
+{
+ unsigned int x;
+ E_Client *ec2;
+ Eina_Inlist *l;
+
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
+ if (EINA_INLIST_GET(ec)->prev) //check current layer
+ {
+ for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
+ {
+ ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);;
+ if (!e_object_is_del(E_OBJECT(ec2)))
+ return ec2;
+ }
+ }
+ if (ec->layer == E_LAYER_CLIENT_DESKTOP) return NULL;
+
+ /* go down the layers until we find one */
+ for (x = e_comp_canvas_layer_map(ec->layer) - 1; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
+ {
+ if (!ec->comp->layers[x].clients) continue;
+ EINA_INLIST_REVERSE_FOREACH(ec->comp->layers[x].clients, ec2)
+ if (!e_object_is_del(E_OBJECT(ec2)))
+ return ec2;
+ }
+ return NULL;
+}
+
+EAPI E_Client *
+e_client_bottom_get(const E_Comp *c)
+{
+ unsigned int x;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(c, NULL);
+
+ for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); x++)
+ {
+ E_Client *ec2;
+
+ if (!c->layers[x].clients) continue;
+ EINA_INLIST_FOREACH(c->layers[x].clients, ec2)
+ if (!e_object_is_del(E_OBJECT(ec2)))
+ return ec2;
+ }
+ return NULL;
+}
+
+EAPI E_Client *
+e_client_top_get(const E_Comp *c)
+{
+ unsigned int x;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(c, NULL);
+
+ for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
+ {
+ E_Client *ec2;
+
+ if (!c->layers[x].clients) continue;
+ EINA_INLIST_REVERSE_FOREACH(c->layers[x].clients, ec2)
+ if (!e_object_is_del(E_OBJECT(ec2)))
+ return ec2;
+ }
+ return NULL;
+}
+
+EAPI unsigned int
+e_clients_count(E_Comp *c)
+{
+ if (!c) return eina_hash_population(clients_hash);
+ return eina_list_count(c->clients);
+}
+
+
+/**
+ * Set a callback which will be called just prior to updating the
+ * move coordinates for a border
+ */
+EAPI void
+e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb)
+{
+ ec->move_intercept_cb = cb;
+}
+
+///////////////////////////////////////
+
+EAPI E_Client_Hook *
+e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data)
+{
+ E_Client_Hook *ch;
+
+ ch = E_NEW(E_Client_Hook, 1);
+ if (!ch) return NULL;
+ ch->hookpoint = hookpoint;
+ ch->func = func;
+ ch->data = (void*)data;
+ _e_client_hooks = eina_list_append(_e_client_hooks, ch);
+ return ch;
+}
+
+EAPI void
+e_client_hook_del(E_Client_Hook *ch)
+{
+ ch->delete_me = 1;
+ if (_e_client_hooks_walking == 0)
+ {
+ _e_client_hooks = eina_list_remove(_e_client_hooks, ch);
+ free(ch);
+ }
+ else
+ _e_client_hooks_delete++;
+}
+
+///////////////////////////////////////
+
+EAPI void
+e_client_focus_latest_set(E_Client *ec)
+{
+ focus_stack = eina_list_remove(focus_stack, ec);
+ focus_stack = eina_list_prepend(focus_stack, ec);
+}
+
+EAPI void
+e_client_raise_latest_set(E_Client *ec)
+{
+ raise_stack = eina_list_remove(raise_stack, ec);
+ raise_stack = eina_list_prepend(raise_stack, ec);
+}
+
+EAPI Eina_Bool
+e_client_focus_track_enabled(void)
+{
+ return !focus_track_frozen;
+}
+
+EAPI void
+e_client_focus_track_freeze(void)
+{
+ focus_track_frozen++;
+}
+
+EAPI void
+e_client_focus_track_thaw(void)
+{
+ focus_track_frozen--;
+}
+
+/*
+ * Sets the focus to the given client if necessary
+ * There are 3 cases of different focus_policy-configurations:
+ *
+ * - E_FOCUS_CLICK: just set the focus, the most simple one
+ *
+ * - E_FOCUS_MOUSE: focus is where the mouse is, so try to
+ * warp the pointer to the window. If this fails (because
+ * the pointer is already in the window), just set the focus.
+ *
+ * - E_FOCUS_SLOPPY: focus is where the mouse is or on the
+ * last window which was focused, if the mouse is on the
+ * desktop. So, we need to look if there is another window
+ * under the pointer and warp to pointer to the right
+ * one if so (also, we set the focus afterwards). In case
+ * there is no window under pointer, the pointer is on the
+ * desktop and so we just set the focus.
+ *
+ *
+ * This function is to be called when setting the focus was not
+ * explicitly triggered by the user (by moving the mouse or
+ * clicking for example), but implicitly (by closing a window,
+ * the last focused window should get focus).
+ *
+ */
+EAPI void
+e_client_focus_set_with_pointer(E_Client *ec)
+{
+ /* note: this is here as it seems there are enough apps that do not even
+ * expect us to emulate a look of focus but not actually set x input
+ * focus as we do - so simply abort any focuse set on such windows */
+ if (e_pixmap_is_x(ec->pixmap))
+ {
+ /* be strict about accepting focus hint */
+ if ((!ec->icccm.accepts_focus) &&
+ (!ec->icccm.take_focus)) return;
+ }
+ if (ec->lock_focus_out) return;
+ if (ec == focused) return;
+ evas_object_focus_set(ec->frame, 1);
+
+ if (e_config->focus_policy == E_FOCUS_CLICK) return;
+ if (!ec->visible) return;
+
+ if (e_config->focus_policy == E_FOCUS_SLOPPY)
+ {
+ E_Client *pec;
+ pec = e_client_under_pointer_get(ec->desk, ec);
+ /* Do not slide pointer when disabled (probably breaks focus
+ * on sloppy/mouse focus but requested by users). */
+ if (e_config->pointer_slide && pec && (pec != ec))
+ e_client_pointer_warp_to_center(ec);
+ }
+ else
+ {
+ if (e_config->pointer_slide)
+ e_client_pointer_warp_to_center(ec);
+ }
+}
+
+EINTERN void
+e_client_focused_set(E_Client *ec)
+{
+ E_Client *ec2, *ec_unfocus = focused;
+ Eina_List *l, *ll;
+
+ if (ec == focused) return;
+ focused = ec;
+ if (ec)
+ {
+ ec->focused = 1;
+ if (!e_config->allow_above_fullscreen)
+ {
+ int x, total = ec->zone->desk_x_count * ec->zone->desk_y_count;
+
+ for (x = 0; x < total; x++)
+ {
+ E_Desk *desk = ec->zone->desks[x];
+ /* if there's any fullscreen non-parents on this desk, unfullscreen them */
+ EINA_LIST_FOREACH_SAFE(desk->fullscreen_clients, l, ll, ec2)
+ {
+ if (ec2 == ec) continue;
+ if (e_object_is_del(E_OBJECT(ec2))) continue;
+ /* but only if it's the same desk or one of the clients is sticky */
+ if ((desk == ec->desk) || (ec->sticky || ec2->sticky))
+ {
+ if (!eina_list_data_find(ec->transients, ec2))
+ e_client_unfullscreen(ec2);
+ }
+ }
+ }
+ }
+ }
+
+ while (ec_unfocus)
+ {
+ ec_unfocus->want_focus = ec_unfocus->focused = 0;
+ if (!e_object_is_del(E_OBJECT(ec_unfocus)))
+ e_focus_event_focus_out(ec_unfocus);
+
+ E_FREE_FUNC(ec_unfocus->raise_timer, ecore_timer_del);
+
+ e_comp_object_signal_emit(ec_unfocus->frame, "e,state,unfocused", "e");
+
+ /* if there unfocus client is fullscreen and visible */
+ if ((!e_config->allow_above_fullscreen) &&
+ (ec_unfocus->fullscreen) &&
+ ((ec_unfocus->desk == e_desk_current_get(ec_unfocus->zone)) || (ec_unfocus->sticky)))
+ {
+ Eina_Bool have_vis_child = EINA_FALSE;
+
+ /* if any of its children are visible */
+ EINA_LIST_FOREACH(ec_unfocus->transients, l, ec2)
+ {
+ if ((ec2->zone == ec_unfocus->zone) &&
+ ((ec2->desk == ec_unfocus->desk) ||
+ (ec2->sticky) || (ec_unfocus->sticky)))
+ {
+ have_vis_child = EINA_TRUE;
+ break;
+ }
+ }
+ /* if no children are visible, unfullscreen */
+ if ((!e_object_is_del(E_OBJECT(ec_unfocus))) && (!have_vis_child))
+ e_client_unfullscreen(ec_unfocus);
+ }
+
+ /* only send event/hook here if we're not being deleted */
+ if ((!e_object_is_del(E_OBJECT(ec_unfocus))) &&
+ (e_object_ref_get(E_OBJECT(ec_unfocus)) > 0))
+ {
+ _e_client_event_simple(ec_unfocus, E_EVENT_CLIENT_FOCUS_OUT);
+ _e_client_hook_call(E_CLIENT_HOOK_FOCUS_UNSET, ec_unfocus);
+ }
+ break;
+ }
+ if (!ec) return;
+
+ _e_client_hook_call(E_CLIENT_HOOK_FOCUS_SET, ec);
+ e_focus_event_focus_in(ec);
+
+ if (!focus_track_frozen)
+ e_client_focus_latest_set(ec);
+
+ e_hints_active_window_set(ec->comp->man, ec);
+ _e_client_event_simple(ec, E_EVENT_CLIENT_FOCUS_IN);
+}
+
+EAPI void
+e_client_activate(E_Client *ec, Eina_Bool just_do_it)
+{
+ if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) ||
+ ((ec->parent) &&
+ ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
+ ((ec->parent->focused) &&
+ (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))) ||
+ (just_do_it))
+ {
+ if (ec->iconic)
+ {
+ if (e_config->clientlist_warp_to_iconified_desktop == 1)
+ e_desk_show(ec->desk);
+
+ if (!ec->lock_user_iconify)
+ e_client_uniconify(ec);
+ }
+ if ((!ec->iconic) && (!ec->sticky))
+ e_desk_show(ec->desk);
+ if (!ec->lock_user_stacking)
+ evas_object_raise(ec->frame);
+ if (!ec->lock_focus_out)
+ {
+ /* XXX ooffice does send this request for
+ config dialogs when the main window gets focus.
+ causing the pointer to jump back and forth. */
+ if ((e_config->focus_policy != E_FOCUS_CLICK) && (!ec->new_client) &&
+ (!e_config->disable_all_pointer_warps) &&
+ (!e_util_strcmp(ec->icccm.name, "VCLSalFrame")))
+ ecore_evas_pointer_warp(ec->comp->ee,
+ ec->x + (ec->w / 2), ec->y + (ec->h / 2));
+ evas_object_focus_set(ec->frame, 1);
+ }
+ }
+}
+
+EAPI E_Client *
+e_client_focused_get(void)
+{
+ return focused;
+}
+
+EAPI Eina_List *
+e_client_focus_stack_get(void)
+{
+ return focus_stack;
+}
+
+EAPI Eina_List *
+e_client_raise_stack_get(void)
+{
+ return raise_stack;
+}
+
+EAPI Eina_List *
+e_client_lost_windows_get(E_Zone *zone)
+{
+ Eina_List *list = NULL;
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Comp *c;
+ int loss_overlap = 5;
+
+ E_OBJECT_CHECK_RETURN(zone, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ {
+ if (zone->comp != c) continue;
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (ec->zone != zone) continue;
+
+ if (!E_INTERSECTS(ec->zone->x + loss_overlap,
+ ec->zone->y + loss_overlap,
+ ec->zone->w - (2 * loss_overlap),
+ ec->zone->h - (2 * loss_overlap),
+ ec->x, ec->y, ec->w, ec->h))
+ {
+ list = eina_list_append(list, ec);
+ }
+ }
+ }
+ return list;
+}
+
+///////////////////////////////////////
+
+EAPI void
+e_client_shade(E_Client *ec, E_Direction dir)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if ((ec->shaded) || (ec->shading) || (ec->fullscreen) ||
+ ((ec->maximized) && (!e_config->allow_manip))) return;
+ if (!e_util_strcmp("borderless", ec->bordername)) return;
+
+ e_hints_window_shaded_set(ec, 1);
+ e_hints_window_shade_direction_set(ec, dir);
+ ec->take_focus = 0;
+ ec->shading = 1;
+ ec->shade_dir = dir;
+
+ if (e_config->border_shade_animate && (!ec->new_client))
+ {
+ ec->changes.shading = 1;
+ EC_CHANGED(ec);
+
+ evas_object_smart_callback_call(ec->frame, "shading", (uintptr_t*)dir);
+ }
+ else
+ evas_object_smart_callback_call(ec->frame, "shaded", (uintptr_t*)dir);
+
+ e_remember_update(ec);
+}
+
+EAPI void
+e_client_unshade(E_Client *ec, E_Direction dir)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if ((!ec->shaded) || (ec->shading))
+ return;
+
+ e_hints_window_shaded_set(ec, 0);
+ e_hints_window_shade_direction_set(ec, dir);
+ ec->shading = 1;
+ ec->shade_dir = 0;
+
+ if (e_config->border_shade_animate)
+ {
+ ec->changes.shading = 1;
+ EC_CHANGED(ec);
+
+ evas_object_smart_callback_call(ec->frame, "unshading", (uintptr_t*)dir);
+ }
+ else
+ evas_object_smart_callback_call(ec->frame, "unshaded", (uintptr_t*)dir);
+
+ e_remember_update(ec);
+}
+
+///////////////////////////////////////
+
+EAPI void
+e_client_maximize(E_Client *ec, E_Maximize max)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH;
+
+ if ((ec->shaded) || (ec->shading)) return;
+ /* Only allow changes in vertical/ horizontal maximization */
+ if (((ec->maximized & E_MAXIMIZE_DIRECTION) == (max & E_MAXIMIZE_DIRECTION)) ||
+ ((ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH)) return;
+ if (ec->new_client)
+ {
+ ec->changes.need_maximize = 1;
+ ec->maximized &= ~E_MAXIMIZE_TYPE;
+ ec->maximized |= max;
+ EC_CHANGED(ec);
+ return;
+ }
+
+ if (ec->fullscreen)
+ e_client_unfullscreen(ec);
+ ec->pre_res_change.valid = 0;
+ if (!(ec->maximized & E_MAXIMIZE_HORIZONTAL))
+ {
+ /* Horizontal hasn't been set */
+ ec->saved.x = ec->client.x;
+ ec->saved.w = ec->client.w;
+ }
+ if (!(ec->maximized & E_MAXIMIZE_VERTICAL))
+ {
+ /* Vertical hasn't been set */
+ ec->saved.y = ec->client.y;
+ ec->saved.h = ec->client.h;
+ }
+
+ ec->saved.zone = ec->zone->num;
+ e_hints_window_size_set(ec);
+
+ if (!starting)
+ evas_object_raise(ec->frame);
+
+ _e_client_maximize(ec, max);
+
+ /* Remove previous type */
+ ec->maximized &= ~E_MAXIMIZE_TYPE;
+ /* Add new maximization. It must be added, so that VERTICAL + HORIZONTAL == BOTH */
+ ec->maximized |= max;
+
+ if ((ec->maximized & E_MAXIMIZE_DIRECTION) > E_MAXIMIZE_BOTH)
+ /* left/right maximize */
+ e_hints_window_maximized_set(ec, 0,
+ ((ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_LEFT) ||
+ ((ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_RIGHT));
+ else
+ e_hints_window_maximized_set(ec, ec->maximized & E_MAXIMIZE_HORIZONTAL,
+ ec->maximized & E_MAXIMIZE_VERTICAL);
+ e_remember_update(ec);
+}
+
+EAPI void
+e_client_unmaximize(E_Client *ec, E_Maximize max)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (!(max & E_MAXIMIZE_DIRECTION))
+ {
+ CRI("BUG: Unmaximize call without direction!");
+ return;
+ }
+ if (ec->new_client)
+ {
+ ec->changes.need_unmaximize = 1;
+ EC_CHANGED(ec);
+ return;
+ }
+
+ if ((ec->shaded) || (ec->shading)) return;
+ /* Remove directions not used */
+ max &= (ec->maximized & E_MAXIMIZE_DIRECTION);
+ /* Can only remove existing maximization directions */
+ if (!max) return;
+ if (ec->maximized & E_MAXIMIZE_TYPE)
+ {
+ ec->pre_res_change.valid = 0;
+ ec->changes.need_maximize = 0;
+
+ if ((ec->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN)
+ {
+ evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
+ ec->maximized = E_MAXIMIZE_NONE;
+ e_client_util_move_resize_without_frame(ec,
+ ec->saved.x,
+ ec->saved.y,
+ ec->saved.w, ec->saved.h);
+ ec->saved.x = ec->saved.y = ec->saved.w = ec->saved.h = 0;
+ e_hints_window_size_unset(ec);
+ }
+ else
+ {
+ int w, h, x, y;
+
+ w = ec->w;
+ h = ec->h;
+ x = ec->x;
+ y = ec->y;
+
+ if (((ec->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_SMART) ||
+ ((ec->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_EXPAND))
+ {
+ evas_object_smart_callback_call(ec->frame, "unfullscreen", NULL);
+ }
+ if (max & E_MAXIMIZE_VERTICAL)
+ {
+ /* Remove vertical */
+ h = ec->saved.h;
+ y = ec->saved.y + ec->zone->y;
+ ec->saved.h = ec->saved.y = 0;
+ ec->maximized &= ~E_MAXIMIZE_VERTICAL;
+ ec->maximized &= ~E_MAXIMIZE_LEFT;
+ ec->maximized &= ~E_MAXIMIZE_RIGHT;
+ }
+ if (max & E_MAXIMIZE_HORIZONTAL)
+ {
+ /* Remove horizontal */
+ w = ec->saved.w;
+ x = ec->saved.x + ec->zone->x;
+ ec->saved.w = ec->saved.x = 0;
+ ec->maximized &= ~E_MAXIMIZE_HORIZONTAL;
+ }
+
+ e_client_resize_limit(ec, &w, &h);
+
+ if (!(ec->maximized & E_MAXIMIZE_DIRECTION))
+ {
+ ec->maximized = E_MAXIMIZE_NONE;
+ evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
+ e_client_util_move_resize_without_frame(ec, x, y, w, h);
+ e_hints_window_size_unset(ec);
+ }
+ else
+ {
+ e_client_util_move_resize_without_frame(ec, x, y, w, h);
+ e_hints_window_size_set(ec);
+ }
+ }
+ e_hints_window_maximized_set(ec, ec->maximized & E_MAXIMIZE_HORIZONTAL,
+ ec->maximized & E_MAXIMIZE_VERTICAL);
+ }
+ if (!e_client_util_ignored_get(ec))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ e_remember_update(ec);
+}
+
+EAPI void
+e_client_fullscreen(E_Client *ec, E_Fullscreen policy)
+{
+ int x, y, w, h;
+
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ if ((ec->shaded) || (ec->shading) || ec->fullscreen) return;
+ if (ec->new_client)
+ {
+ ec->need_fullscreen = 1;
+ return;
+ }
+ ec->desk->fullscreen_clients = eina_list_append(ec->desk->fullscreen_clients, ec);
+ ec->pre_res_change.valid = 0;
+
+ if (ec->maximized)
+ {
+ x = ec->saved.x;
+ y = ec->saved.y;
+ w = ec->saved.w;
+ h = ec->saved.h;
+ }
+ else
+ {
+ ec->saved.x = ec->x - ec->zone->x;
+ ec->saved.y = ec->y - ec->zone->y;
+ ec->saved.w = ec->client.w;
+ ec->saved.h = ec->client.h;
+ }
+ ec->saved.maximized = ec->maximized;
+ ec->saved.zone = ec->zone->num;
+
+ if (ec->maximized)
+ {
+ e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
+ ec->saved.x = x;
+ ec->saved.y = y;
+ ec->saved.w = w;
+ ec->saved.h = h;
+ }
+ e_hints_window_size_set(ec);
+
+ ec->saved.layer = ec->layer;
+ if (!e_config->allow_above_fullscreen)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_FULLSCREEN);
+ else if (e_config->mode.presentation)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_TOP);
+
+ if ((eina_list_count(ec->comp->zones) > 1) ||
+ (policy == E_FULLSCREEN_RESIZE) || (!ecore_x_randr_query()))
+ {
+ evas_object_geometry_set(ec->frame, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h);
+ }
+ else if (policy == E_FULLSCREEN_ZOOM)
+ {
+ /* compositor backends! */
+ evas_object_smart_callback_call(ec->frame, "fullscreen_zoom", NULL);
+ }
+ ec->fullscreen = 1;
+
+ e_hints_window_fullscreen_set(ec, 1);
+ e_hints_window_size_unset(ec);
+ if (!e_client_util_ignored_get(ec))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ ec->fullscreen_policy = policy;
+ evas_object_smart_callback_call(ec->frame, "fullscreen", NULL);
+
+ _e_client_event_simple(ec, E_EVENT_CLIENT_FULLSCREEN);
+
+ e_remember_update(ec);
+}
+
+EAPI void
+e_client_unfullscreen(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if ((ec->shaded) || (ec->shading)) return;
+ if (!ec->fullscreen) return;
+ ec->pre_res_change.valid = 0;
+ ec->fullscreen = 0;
+ ec->need_fullscreen = 0;
+ ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
+
+ if (ec->fullscreen_policy == E_FULLSCREEN_ZOOM)
+ evas_object_smart_callback_call(ec->frame, "unfullscreen_zoom", NULL);
+
+ e_client_util_move_resize_without_frame(ec, ec->zone->x + ec->saved.x,
+ ec->zone->y + ec->saved.y,
+ ec->saved.w, ec->saved.h);
+
+ if (ec->saved.maximized)
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
+ ec->saved.maximized);
+
+ evas_object_layer_set(ec->frame, ec->saved.layer);
+
+ e_hints_window_fullscreen_set(ec, 0);
+ if (!e_client_util_ignored_get(ec))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ ec->fullscreen_policy = 0;
+ evas_object_smart_callback_call(ec->frame, "unfullscreen", NULL);
+ _e_client_event_simple(ec, E_EVENT_CLIENT_UNFULLSCREEN);
+
+ e_remember_update(ec);
+ if (!ec->desk->fullscreen_clients)
+ e_comp_render_queue(ec->comp);
+}
+
+///////////////////////////////////////
+
+
+EAPI void
+e_client_iconify(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (ec->shading || ec->iconic) return;
+ ec->iconic = 1;
+ ec->take_focus = 0;
+ if (ec->fullscreen)
+ ec->desk->fullscreen_clients = eina_list_remove(ec->desk->fullscreen_clients, ec);
+ e_client_comp_hidden_set(ec, 1);
+ if (ec->new_client)
+ {
+ ec->visible = 0;
+ ec->changes.visible = 0;
+ EC_CHANGED(ec);
+ e_comp_object_signal_emit(ec->frame, "e,action,iconify", "e");
+ }
+ else
+ evas_object_hide(ec->frame);
+ e_hints_window_iconic_set(ec);
+
+ _e_client_event_simple(ec, E_EVENT_CLIENT_ICONIFY);
+
+ if (e_config->transient.iconify)
+ {
+ E_Client *child;
+ Eina_List *list = eina_list_clone(ec->transients);
+
+ EINA_LIST_FREE(list, child)
+ e_client_iconify(child);
+ }
+ e_remember_update(ec);
+}
+
+EAPI void
+e_client_uniconify(E_Client *ec)
+{
+ E_Desk *desk;
+
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (ec->shading || (!ec->iconic)) return;
+ desk = e_desk_current_get(ec->desk->zone);
+ e_client_desk_set(ec, desk);
+ evas_object_raise(ec->frame);
+ evas_object_show(ec->frame);
+ e_client_comp_hidden_set(ec, 0);
+ ec->deskshow = ec->iconic = 0;
+ evas_object_focus_set(ec->frame, 1);
+
+ _e_client_event_simple(ec, E_EVENT_CLIENT_UNICONIFY);
+
+ if (e_config->transient.iconify)
+ {
+ E_Client *child;
+ Eina_List *list = eina_list_clone(ec->transients);
+
+ EINA_LIST_FREE(list, child)
+ e_client_uniconify(child);
+ }
+ e_remember_update(ec);
+}
+
+///////////////////////////////////////
+
+EAPI void
+e_client_stick(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (ec->sticky) return;
+ ec->sticky = 1;
+ e_hints_window_sticky_set(ec, 1);
+ evas_object_show(ec->frame);
+
+ if (e_config->transient.desktop)
+ {
+ E_Client *child;
+ Eina_List *list = eina_list_clone(ec->transients);
+
+ EINA_LIST_FREE(list, child)
+ {
+ child->sticky = 1;
+ e_hints_window_sticky_set(child, 1);
+ evas_object_show(ec->frame);
+ }
+ }
+
+ _e_client_event_simple(ec, E_EVENT_CLIENT_STICK);
+ e_remember_update(ec);
+}
+
+EAPI void
+e_client_unstick(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ /* Set the desk before we unstick the client */
+ if (!ec->sticky) return;
+ ec->sticky = 0;
+ e_hints_window_sticky_set(ec, 0);
+
+ if (e_config->transient.desktop)
+ {
+ E_Client *child;
+ Eina_List *list = eina_list_clone(ec->transients);
+
+ EINA_LIST_FREE(list, child)
+ {
+ child->sticky = 0;
+ e_hints_window_sticky_set(child, 0);
+ }
+ }
+
+ e_comp_object_signal_emit(ec->frame, "e,state,unsticky", "e");
+ _e_client_event_simple(ec, E_EVENT_CLIENT_UNSTICK);
+
+ e_client_desk_set(ec, e_desk_current_get(ec->zone));
+ e_remember_update(ec);
+}
+
+EAPI void
+e_client_pinned_set(E_Client *ec, Eina_Bool set)
+{
+ E_Layer layer;
+
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+ ec->borderless = !!set;
+ ec->user_skip_winlist = !!set;
+ if (set)
+ layer = E_LAYER_CLIENT_BELOW;
+ else
+ layer = E_LAYER_CLIENT_NORMAL;
+
+ evas_object_layer_set(ec->frame, layer);
+
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+}
+
+///////////////////////////////////////
+
+EAPI void
+e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ hidden = !!hidden;
+ if (ec->comp_hidden == hidden) return;
+ ec->comp_hidden = hidden;
+ evas_object_smart_callback_call(ec->frame, "comp_hidden", NULL);
+}
+
+///////////////////////////////////////
+
+EAPI void
+e_client_act_move_keyboard(E_Client *ec)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+
+ if (!_e_client_move_begin(ec))
+ return;
+
+ if (!_e_client_action_input_win_new(ec))
+ {
+ _e_client_move_end(ec);
+ return;
+ }
+
+ _e_client_action_init(ec);
+ _e_client_action_move_timeout_add();
+ if (!_e_client_hook_call(E_CLIENT_HOOK_MOVE_UPDATE, ec)) return;
+
+ if (!action_handler_key)
+ action_handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_client_move_key_down, NULL);
+
+ if (!action_handler_mouse)
+ action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_move_mouse_down, NULL);
+}
+
+EAPI void
+e_client_act_resize_keyboard(E_Client *ec)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+
+ if (!e_client_resize_begin(ec))
+ return;
+
+ _e_client_action_init(ec);
+ _e_client_action_resize_timeout_add();
+
+ if (!action_handler_key)
+ action_handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_client_resize_key_down, NULL);
+
+ if (!action_handler_mouse)
+ action_handler_mouse = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_client_resize_mouse_down, NULL);
+}
+
+EAPI void
+e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (e_client_resizing_get(ec) || (ec->moving)) return;
+ if (!_e_client_move_begin(ec))
+ return;
+
+ if (!_e_client_action_input_win_new(ec))
+ {
+ _e_client_move_end(ec);
+ return;
+ }
+ _e_client_action_init(ec);
+ e_zone_edge_disable();
+ ec->moving = 1;
+ e_pointer_mode_push(ec, E_POINTER_MOVE);
+ if (ev)
+ {
+ char source[256];
+
+ snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
+ _e_client_moveinfo_gather(ec, source);
+ }
+}
+
+EAPI void
+e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (!ec->moving) return;
+ e_zone_edge_enable();
+ _e_client_move_end(ec);
+ e_zone_flip_coords_handle(ec->zone, -1, -1);
+ _e_client_action_finish();
+}
+
+EAPI void
+e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (ec->lock_user_size || ec->shaded || ec->shading) return;
+ if (e_client_resizing_get(ec) || (ec->moving)) return;
+ if (ev)
+ {
+ char source[256];
+
+ snprintf(source, sizeof(source) - 1, "mouse,down,%i", ev->button);
+ _e_client_moveinfo_gather(ec, source);
+ }
+ if ((ec->mouse.current.mx > (ec->x + ec->w / 5)) &&
+ (ec->mouse.current.mx < (ec->x + ec->w * 4 / 5)))
+ {
+ if (ec->mouse.current.my < (ec->y + ec->h / 2))
+ {
+ ec->resize_mode = E_POINTER_RESIZE_T;
+ }
+ else
+ {
+ ec->resize_mode = E_POINTER_RESIZE_B;
+ }
+ }
+ else if (ec->mouse.current.mx < (ec->x + ec->w / 2))
+ {
+ if ((ec->mouse.current.my > (ec->y + ec->h / 5)) &&
+ (ec->mouse.current.my < (ec->y + ec->h * 4 / 5)))
+ {
+ ec->resize_mode = E_POINTER_RESIZE_L;
+ }
+ else if (ec->mouse.current.my < (ec->y + ec->h / 2))
+ {
+ ec->resize_mode = E_POINTER_RESIZE_TL;
+ }
+ else
+ {
+ ec->resize_mode = E_POINTER_RESIZE_BL;
+ }
+ }
+ else
+ {
+ if ((ec->mouse.current.my > (ec->y + ec->h / 5)) &&
+ (ec->mouse.current.my < (ec->y + ec->h * 4 / 5)))
+ {
+ ec->resize_mode = E_POINTER_RESIZE_R;
+ }
+ else if (ec->mouse.current.my < (ec->y + ec->h / 2))
+ {
+ ec->resize_mode = E_POINTER_RESIZE_TR;
+ }
+ else
+ {
+ ec->resize_mode = E_POINTER_RESIZE_BR;
+ }
+ }
+ if (!e_client_resize_begin(ec))
+ {
+ ec->resize_mode = E_POINTER_RESIZE_NONE;
+ return;
+ }
+ _e_client_action_init(ec);
+ e_pointer_mode_push(ec, ec->resize_mode);
+}
+
+EAPI void
+e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (e_client_resizing_get(ec))
+ {
+ _e_client_resize_end(ec);
+ ec->changes.reset_gravity = 1;
+ if (!e_object_is_del(E_OBJECT(ec)))
+ EC_CHANGED(ec);
+ }
+ _e_client_action_finish();
+}
+
+EAPI void
+e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (ec->border_menu) return;
+ if (ev)
+ e_int_client_menu_show(ec, ev->canvas.x, ev->canvas.y, key, ev->timestamp);
+ else
+ {
+ int x, y;
+
+ evas_pointer_canvas_xy_get(ec->comp->evas, &x, &y);
+ e_int_client_menu_show(ec, x, y, key, 0);
+ }
+}
+
+EAPI void
+e_client_act_close_begin(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (ec->lock_close) return;
+ if (ec->icccm.delete_request)
+ {
+ ec->delete_requested = 1;
+ evas_object_smart_callback_call(ec->frame, "delete_request", NULL);
+ }
+ else if (e_config->kill_if_close_not_possible)
+ {
+ e_client_act_kill_begin(ec);
+ }
+}
+
+EAPI void
+e_client_act_kill_begin(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (ec->internal) return;
+ if (ec->lock_close) return;
+ if ((ec->netwm.pid > 1) && (e_config->kill_process))
+ {
+ kill(ec->netwm.pid, SIGINT);
+ ec->kill_timer = ecore_timer_add(e_config->kill_timer_wait,
+ _e_client_cb_kill_timer, ec);
+ }
+ else
+ evas_object_smart_callback_call(ec->frame, "kill_request", NULL);
+}
+
+////////////////////////////////////////////////
+
+
+EAPI Evas_Object *
+e_client_icon_add(E_Client *ec, Evas *evas)
+{
+ Evas_Object *o;
+
+ E_OBJECT_CHECK_RETURN(ec, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
+
+ o = NULL;
+ if (ec->internal)
+ {
+ if (!ec->internal_icon)
+ {
+ o = e_icon_add(evas);
+ e_util_icon_theme_set(o, "enlightenment");
+ }
+ else
+ {
+ if (!ec->internal_icon_key)
+ {
+ char *ext;
+
+ ext = strrchr(ec->internal_icon, '.');
+ if ((ext) && ((!strcmp(ext, ".edj"))))
+ {
+ o = edje_object_add(evas);
+ if (!edje_object_file_set(o, ec->internal_icon, "icon"))
+ e_util_icon_theme_set(o, "enlightenment");
+ }
+ else if (ext)
+ {
+ o = e_icon_add(evas);
+ e_icon_file_set(o, ec->internal_icon);
+ }
+ else
+ {
+ o = e_icon_add(evas);
+ if (!e_util_icon_theme_set(o, ec->internal_icon))
+ e_util_icon_theme_set(o, "enlightenment");
+ }
+ }
+ else
+ {
+ o = edje_object_add(evas);
+ edje_object_file_set(o, ec->internal_icon,
+ ec->internal_icon_key);
+ }
+ }
+ return o;
+ }
+ if ((e_config->use_app_icon) && (ec->icon_preference != E_ICON_PREF_USER))
+ {
+ if (ec->netwm.icons)
+ {
+ o = e_icon_add(evas);
+ e_icon_data_set(o, ec->netwm.icons[0].data,
+ ec->netwm.icons[0].width,
+ ec->netwm.icons[0].height);
+ e_icon_alpha_set(o, 1);
+ return o;
+ }
+ }
+ if (!o)
+ {
+ if ((ec->desktop) && (ec->icon_preference != E_ICON_PREF_NETWM))
+ {
+ o = e_icon_add(evas);
+ if (o)
+ {
+ e_icon_fdo_icon_set(o, ec->desktop->icon);
+ return o;
+ }
+ }
+ else if (ec->netwm.icons)
+ {
+ o = e_icon_add(evas);
+ e_icon_data_set(o, ec->netwm.icons[0].data,
+ ec->netwm.icons[0].width,
+ ec->netwm.icons[0].height);
+ e_icon_alpha_set(o, 1);
+ return o;
+ }
+ }
+
+ o = e_icon_add(evas);
+ e_util_icon_theme_set(o, "unknown");
+ return o;
+}
+
+////////////////////////////////////////////
+
+EAPI void
+e_client_ping(E_Client *ec)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (!e_config->ping_clients) return;
+ ec->ping_ok = 0;
+ evas_object_smart_callback_call(ec->frame, "ping", NULL);
+ ec->ping = ecore_loop_time_get();
+ if (ec->ping_poller) ecore_poller_del(ec->ping_poller);
+ ec->ping_poller = ecore_poller_add(ECORE_POLLER_CORE,
+ e_config->ping_clients_interval,
+ _e_client_cb_ping_poller, ec);
+}
+
+////////////////////////////////////////////
+
+EAPI void
+e_client_move_cancel(void)
+{
+ if (!ecmove) return;
+ if (ecmove->cur_mouse_action)
+ {
+ E_Client *ec;
+
+ ec = ecmove;
+ e_object_ref(E_OBJECT(ec));
+ if (ec->cur_mouse_action->func.end_mouse)
+ ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
+ else if (ec->cur_mouse_action->func.end)
+ ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
+ e_object_unref(E_OBJECT(ec->cur_mouse_action));
+ ec->cur_mouse_action = NULL;
+ e_object_unref(E_OBJECT(ec));
+ }
+ else
+ _e_client_move_end(ecmove);
+}
+
+EAPI void
+e_client_resize_cancel(void)
+{
+ if (!ecresize) return;
+ if (ecresize->cur_mouse_action)
+ {
+ E_Client *ec;
+
+ ec = ecresize;
+ e_object_ref(E_OBJECT(ec));
+ if (ec->cur_mouse_action->func.end_mouse)
+ ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
+ else if (ec->cur_mouse_action->func.end)
+ ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
+ e_object_unref(E_OBJECT(ec->cur_mouse_action));
+ ec->cur_mouse_action = NULL;
+ e_object_unref(E_OBJECT(ec));
+ }
+ else
+ _e_client_resize_end(ecresize);
+}
+
+EAPI Eina_Bool
+e_client_resize_begin(E_Client *ec)
+{
+ if (!ec->lock_user_stacking)
+ {
+ if (e_config->border_raise_on_mouse_action)
+ evas_object_raise(ec->frame);
+ }
+ if ((ec->shaded) || (ec->shading) ||
+ (ec->fullscreen) || (ec->lock_user_size))
+ return EINA_FALSE;
+
+ if (!_e_client_action_input_win_new(ec)) return EINA_FALSE;
+
+ ecresize = ec;
+ return _e_client_hook_call(E_CLIENT_HOOK_RESIZE_BEGIN, ec);
+}
+
+
+////////////////////////////////////////////
+
+EAPI void
+e_client_frame_recalc(E_Client *ec)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+ if (!ec->frame) return;
+ evas_object_smart_callback_call(ec->frame, "frame_recalc", NULL);
+}
+
+////////////////////////////////////////////
+
+EAPI void
+e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ if (e_client_resizing_get(ec) || (ec->moving)) return;
+ if (!_e_client_move_begin(ec)) return;
+ ec->moving = 1;
+ e_pointer_mode_push(ec, E_POINTER_MOVE);
+ e_zone_edge_disable();
+ _e_client_moveinfo_gather(ec, sig);
+ if (ec->cur_mouse_action)
+ {
+ if ((!ec->cur_mouse_action->func.end_mouse) &&
+ (!ec->cur_mouse_action->func.end))
+ ec->cur_mouse_action = NULL;
+ else
+ e_object_unref(E_OBJECT(ec->cur_mouse_action));
+ }
+ ec->cur_mouse_action = e_action_find("window_move");
+ if (ec->cur_mouse_action)
+ e_object_ref(E_OBJECT(ec->cur_mouse_action));
+}
+
+EAPI void
+e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (!ec->moving) return;
+ e_zone_edge_enable();
+ _e_client_move_end(ec);
+ e_zone_flip_coords_handle(ec->zone, -1, -1);
+}
+
+EAPI void
+e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED)
+{
+ int resize_mode = E_POINTER_RESIZE_BR;
+
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ if (e_client_resizing_get(ec) || (ec->moving)) return;
+ if (!strcmp(dir, "tl"))
+ {
+ resize_mode = E_POINTER_RESIZE_TL;
+ }
+ else if (!strcmp(dir, "t"))
+ {
+ resize_mode = E_POINTER_RESIZE_T;
+ }
+ else if (!strcmp(dir, "tr"))
+ {
+ resize_mode = E_POINTER_RESIZE_TR;
+ }
+ else if (!strcmp(dir, "r"))
+ {
+ resize_mode = E_POINTER_RESIZE_R;
+ }
+ else if (!strcmp(dir, "br"))
+ {
+ resize_mode = E_POINTER_RESIZE_BR;
+ }
+ else if (!strcmp(dir, "b"))
+ {
+ resize_mode = E_POINTER_RESIZE_B;
+ }
+ else if (!strcmp(dir, "bl"))
+ {
+ resize_mode = E_POINTER_RESIZE_BL;
+ }
+ else if (!strcmp(dir, "l"))
+ {
+ resize_mode = E_POINTER_RESIZE_L;
+ }
+ ec->resize_mode = resize_mode;
+ _e_client_moveinfo_gather(ec, sig);
+ if (!e_client_resize_begin(ec))
+ {
+ ec->resize_mode = E_POINTER_RESIZE_NONE;
+ return;
+ }
+ e_pointer_mode_push(ec, ec->resize_mode);
+ if (ec->cur_mouse_action)
+ {
+ if ((!ec->cur_mouse_action->func.end_mouse) &&
+ (!ec->cur_mouse_action->func.end))
+ ec->cur_mouse_action = NULL;
+ else
+ e_object_unref(E_OBJECT(ec->cur_mouse_action));
+ }
+ ec->cur_mouse_action = e_action_find("window_resize");
+ if (ec->cur_mouse_action)
+ e_object_ref(E_OBJECT(ec->cur_mouse_action));
+}
+
+EAPI void
+e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
+{
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+ if (!e_client_resizing_get(ec)) return;
+ _e_client_resize_handle(ec);
+ _e_client_resize_end(ec);
+ ec->changes.reset_gravity = 1;
+ EC_CHANGED(ec);
+}
+
+////////////////////////////////////////////
+
+EAPI void
+e_client_resize_limit(E_Client *ec, int *w, int *h)
+{
+ double a;
+ Eina_Bool inc_h;
+
+ E_OBJECT_CHECK(ec);
+ E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+
+ inc_h = (*h - ec->h > 0);
+ if (ec->frame)
+ e_comp_object_frame_wh_unadjust(ec->frame, *w, *h, w, h);
+ if (*h < 1) *h = 1;
+ if (*w < 1) *w = 1;
+ if ((ec->icccm.base_w >= 0) &&
+ (ec->icccm.base_h >= 0))
+ {
+ int tw, th;
+
+ tw = *w - ec->icccm.base_w;
+ th = *h - ec->icccm.base_h;
+ if (tw < 1) tw = 1;
+ if (th < 1) th = 1;
+ a = (double)(tw) / (double)(th);
+ if ((ec->icccm.min_aspect != 0.0) &&
+ (a < ec->icccm.min_aspect))
+ {
+ if (inc_h)
+ tw = th * ec->icccm.min_aspect;
+ else
+ th = tw / ec->icccm.max_aspect;
+ *w = tw + ec->icccm.base_w;
+ *h = th + ec->icccm.base_h;
+ }
+ else if ((ec->icccm.max_aspect != 0.0) &&
+ (a > ec->icccm.max_aspect))
+ {
+ tw = th * ec->icccm.max_aspect;
+ *w = tw + ec->icccm.base_w;
+ }
+ }
+ else
+ {
+ a = (double)*w / (double)*h;
+ if ((ec->icccm.min_aspect != 0.0) &&
+ (a < ec->icccm.min_aspect))
+ {
+ if (inc_h)
+ *w = *h * ec->icccm.min_aspect;
+ else
+ *h = *w / ec->icccm.min_aspect;
+ }
+ else if ((ec->icccm.max_aspect != 0.0) &&
+ (a > ec->icccm.max_aspect))
+ *w = *h * ec->icccm.max_aspect;
+ }
+ if (ec->icccm.step_w > 0)
+ {
+ if (ec->icccm.base_w >= 0)
+ *w = ec->icccm.base_w +
+ (((*w - ec->icccm.base_w) / ec->icccm.step_w) *
+ ec->icccm.step_w);
+ else
+ *w = ec->icccm.min_w +
+ (((*w - ec->icccm.min_w) / ec->icccm.step_w) *
+ ec->icccm.step_w);
+ }
+ if (ec->icccm.step_h > 0)
+ {
+ if (ec->icccm.base_h >= 0)
+ *h = ec->icccm.base_h +
+ (((*h - ec->icccm.base_h) / ec->icccm.step_h) *
+ ec->icccm.step_h);
+ else
+ *h = ec->icccm.min_h +
+ (((*h - ec->icccm.min_h) / ec->icccm.step_h) *
+ ec->icccm.step_h);
+ }
+
+ if (*h < 1) *h = 1;
+ if (*w < 1) *w = 1;
+
+ if (*w > ec->icccm.max_w) *w = ec->icccm.max_w;
+ else if (*w < ec->icccm.min_w)
+ *w = ec->icccm.min_w;
+ if (*h > ec->icccm.max_h) *h = ec->icccm.max_h;
+ else if (*h < ec->icccm.min_h)
+ *h = ec->icccm.min_h;
+
+ if (ec->frame)
+ e_comp_object_frame_wh_adjust(ec->frame, *w, *h, w, h);
+}
+
+////////////////////////////////////////////
+
+
+
+EAPI E_Client *
+e_client_under_pointer_get(E_Desk *desk, E_Client *exclude)
+{
+ int x, y;
+
+ /* We need to ensure that we can get the comp window for the
+ * zone of either the given desk or the desk of the excluded
+ * window, so return if neither is given */
+ if (desk)
+ ecore_evas_pointer_xy_get(e_comp_get(desk)->ee, &x, &y);
+ else if (exclude)
+ ecore_evas_pointer_xy_get(exclude->comp->ee, &x, &y);
+ else
+ return NULL;
+
+ return _e_client_under_pointer_helper(desk, exclude, x, y);
+}
+
+////////////////////////////////////////////
+
+EAPI int
+e_client_pointer_warp_to_center_now(E_Client *ec)
+{
+ if (e_config->disable_all_pointer_warps) return 0;
+ if (warp_client == ec)
+ {
+ ecore_evas_pointer_warp(ec->comp->ee, warp_to_x, warp_to_y);
+ warp_to = 0;
+ }
+ else
+ {
+ if (e_client_pointer_warp_to_center(ec))
+ e_client_pointer_warp_to_center_now(ec);
+ }
+ return 1;
+}
+
+EAPI int
+e_client_pointer_warp_to_center(E_Client *ec)
+{
+ int x, y;
+ E_Client *cec = NULL;
+
+ if (e_config->disable_all_pointer_warps) return 0;
+ /* Only warp the pointer if it is not already in the area of
+ * the given border */
+ ecore_evas_pointer_xy_get(ec->comp->ee, &x, &y);
+ if ((x >= ec->x) && (x <= (ec->x + ec->w)) &&
+ (y >= ec->y) && (y <= (ec->y + ec->h)))
+ {
+ cec = _e_client_under_pointer_helper(ec->desk, ec, x, y);
+ if (cec == ec) return 0;
+ }
+
+ warp_to_x = ec->x + (ec->w / 2);
+ if (warp_to_x < (ec->zone->x + 1))
+ warp_to_x = ec->zone->x + ((ec->x + ec->w - ec->zone->x) / 2);
+ else if (warp_to_x > (ec->zone->x + ec->zone->w))
+ warp_to_x = (ec->zone->x + ec->zone->w + ec->x) / 2;
+
+ warp_to_y = ec->y + (ec->h / 2);
+ if (warp_to_y < (ec->zone->y + 1))
+ warp_to_y = ec->zone->y + ((ec->y + ec->h - ec->zone->y) / 2);
+ else if (warp_to_y > (ec->zone->y + ec->zone->h))
+ warp_to_y = (ec->zone->y + ec->zone->h + ec->y) / 2;
+
+ /* TODO: handle case where another border is over the exact center,
+ * find a place where the requested border is not overlapped?
+ *
+ if (!cec) cec = _e_client_under_pointer_helper(ec->desk, ec, x, y);
+ if (cec != ec)
+ {
+ }
+ */
+
+ warp_to = 1;
+ warp_client = ec;
+ ecore_evas_pointer_xy_get(warp_client->comp->ee, &warp_x[0], &warp_y[0]);
+ if (warp_timer) ecore_timer_del(warp_timer);
+ warp_timer = ecore_timer_add(0.01, _e_client_pointer_warp_to_center_timer, ec);
+ return 1;
+}
+
+////////////////////////////////////////////
+
+EAPI void
+e_client_redirected_set(E_Client *ec, Eina_Bool set)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+ if (ec->input_only) return;
+ set = !!set;
+ if (ec->redirected == set) return;
+ if (set)
+ {
+ e_client_frame_recalc(ec);
+ if (!_e_client_hook_call(E_CLIENT_HOOK_REDIRECT, ec)) return;
+ }
+ else
+ {
+ if (!_e_client_hook_call(E_CLIENT_HOOK_UNREDIRECT, ec)) return;
+ }
+ e_comp_object_redirected_set(ec->frame, set);
+ ec->redirected = !!set;
+}
+
+////////////////////////////////////////////
+
+
+EAPI Eina_Stringshare *
+e_client_name_get(const E_Client *ec)
+{
+ E_OBJECT_CHECK_RETURN(ec, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
+ if (ec->netwm.name)
+ return ec->netwm.name;
+ else if (ec->icccm.title)
+ return ec->icccm.title;
+ return NULL;
+}
+
+EAPI Eina_Bool
+e_client_util_is_stacking(const E_Client *ec)
+{
+ return ec->comp->layers[e_comp_canvas_layer_map(ec->layer)].obj == ec->frame;
+}
diff --git a/src/bin/e_client.h b/src/bin/e_client.h
new file mode 100644
index 0000000000..9e62881b12
--- /dev/null
+++ b/src/bin/e_client.h
@@ -0,0 +1,846 @@
+#ifdef E_TYPEDEFS
+typedef enum _E_Screen_Limits
+{
+ E_SCREEN_LIMITS_PARTLY = 0,
+ E_SCREEN_LIMITS_COMPLETELY = 1,
+ E_SCREEN_LIMITS_WITHIN = 2
+} E_Screen_Limits;
+
+typedef enum _E_Icon_Preference
+{
+ E_ICON_PREF_E_DEFAULT,
+ E_ICON_PREF_NETWM,
+ E_ICON_PREF_USER
+} E_Icon_Preference;
+
+typedef enum _E_Direction
+{
+ E_DIRECTION_UP,
+ E_DIRECTION_DOWN,
+ E_DIRECTION_LEFT,
+ E_DIRECTION_RIGHT
+} E_Direction;
+
+typedef enum _E_Transition
+{
+ E_TRANSITION_LINEAR = 0,
+ E_TRANSITION_SINUSOIDAL = 1,
+ E_TRANSITION_ACCELERATE = 2,
+ E_TRANSITION_DECELERATE = 3,
+ E_TRANSITION_ACCELERATE_LOTS = 4,
+ E_TRANSITION_DECELERATE_LOTS = 5,
+ E_TRANSITION_SINUSOIDAL_LOTS = 6,
+ E_TRANSITION_BOUNCE = 7,
+ E_TRANSITION_BOUNCE_LOTS = 8
+} E_Transition;
+
+typedef enum _E_Stacking
+{
+ E_STACKING_NONE,
+ E_STACKING_ABOVE,
+ E_STACKING_BELOW
+} E_Stacking;
+
+typedef enum _E_Focus_Policy
+{
+ E_FOCUS_CLICK,
+ E_FOCUS_MOUSE,
+ E_FOCUS_SLOPPY,
+ E_FOCUS_LAST,
+} E_Focus_Policy;
+
+typedef enum
+{
+ /* same as ecore-x types */
+ E_WINDOW_TYPE_UNKNOWN = 0,
+ E_WINDOW_TYPE_DESKTOP,
+ E_WINDOW_TYPE_DOCK,
+ E_WINDOW_TYPE_TOOLBAR,
+ E_WINDOW_TYPE_MENU,
+ E_WINDOW_TYPE_UTILITY,
+ E_WINDOW_TYPE_SPLASH,
+ E_WINDOW_TYPE_DIALOG,
+ E_WINDOW_TYPE_NORMAL,
+ E_WINDOW_TYPE_DROPDOWN_MENU,
+ E_WINDOW_TYPE_POPUP_MENU,
+ E_WINDOW_TYPE_TOOLTIP,
+ E_WINDOW_TYPE_NOTIFICATION,
+ E_WINDOW_TYPE_COMBO,
+ E_WINDOW_TYPE_DND
+} E_Window_Type;
+
+typedef enum _E_Urgency_Policy
+{
+ E_ACTIVEHINT_POLICY_IGNORE,
+ E_ACTIVEHINT_POLICY_ANIMATE,
+ E_ACTIVEHINT_POLICY_ACTIVATE
+} E_Urgency_Policy;
+
+typedef enum _E_Focus_Setting
+{
+ E_FOCUS_NONE,
+ E_FOCUS_NEW_WINDOW,
+ E_FOCUS_NEW_DIALOG,
+ E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED
+} E_Focus_Setting;
+
+typedef enum _E_Maximize
+{
+ E_MAXIMIZE_NONE = 0x00000000,
+ E_MAXIMIZE_FULLSCREEN = 0x00000001,
+ E_MAXIMIZE_SMART = 0x00000002,
+ E_MAXIMIZE_EXPAND = 0x00000003,
+ E_MAXIMIZE_FILL = 0x00000004,
+ E_MAXIMIZE_TYPE = 0x0000000f,
+ E_MAXIMIZE_VERTICAL = 0x00000010,
+ E_MAXIMIZE_HORIZONTAL = 0x00000020,
+ E_MAXIMIZE_BOTH = 0x00000030,
+ E_MAXIMIZE_LEFT = 0x00000070,
+ E_MAXIMIZE_RIGHT = 0x000000b0,
+ E_MAXIMIZE_DIRECTION = 0x000000f0
+} E_Maximize;
+
+typedef enum _E_Fullscreen
+{
+ /* Resize window */
+ E_FULLSCREEN_RESIZE,
+ /* Change screen resoultion and resize window */
+ E_FULLSCREEN_ZOOM
+} E_Fullscreen;
+
+typedef enum _E_Window_Placement
+{
+ E_WINDOW_PLACEMENT_SMART,
+ E_WINDOW_PLACEMENT_ANTIGADGET,
+ E_WINDOW_PLACEMENT_CURSOR,
+ E_WINDOW_PLACEMENT_MANUAL
+} E_Window_Placement;
+
+typedef enum E_Client_Property
+{
+ E_CLIENT_PROPERTY_NONE = 0,
+ E_CLIENT_PROPERTY_SIZE = (1 << 0),
+ E_CLIENT_PROPERTY_POS = (1 << 1),
+ E_CLIENT_PROPERTY_TITLE = (1 << 2),
+ E_CLIENT_PROPERTY_ICON = (1 << 3),
+ E_CLIENT_PROPERTY_URGENCY = (1 << 4),
+ E_CLIENT_PROPERTY_GRAVITY = (1 << 5),
+ E_CLIENT_PROPERTY_NETWM_STATE = (1 << 6),
+} E_Client_Property;
+
+typedef struct E_Client E_Client;
+
+typedef struct E_Event_Client E_Event_Client;
+typedef struct _E_Event_Client_Property E_Event_Client_Property;
+typedef struct _E_Client_Pending_Resize E_Client_Pending_Resize;
+typedef struct E_Event_Client_Zone_Set E_Event_Client_Zone_Set;
+typedef struct E_Event_Client_Desk_Set E_Event_Client_Desk_Set;
+typedef struct _E_Client_Hook E_Client_Hook;
+
+typedef enum _E_Client_Hook_Point
+{
+ E_CLIENT_HOOK_EVAL_PRE_FETCH,
+ E_CLIENT_HOOK_EVAL_FETCH,
+ E_CLIENT_HOOK_EVAL_PRE_POST_FETCH,
+ E_CLIENT_HOOK_EVAL_POST_FETCH,
+ E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN,
+ E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN,
+ E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT,
+ E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT,
+ E_CLIENT_HOOK_EVAL_END,
+ E_CLIENT_HOOK_FOCUS_SET,
+ E_CLIENT_HOOK_FOCUS_UNSET,
+ E_CLIENT_HOOK_CANVAS_LAYOUT, //sends E_Comp!
+ E_CLIENT_HOOK_NEW_CLIENT,
+ E_CLIENT_HOOK_DESK_SET,
+ E_CLIENT_HOOK_MOVE_BEGIN,
+ E_CLIENT_HOOK_MOVE_UPDATE,
+ E_CLIENT_HOOK_MOVE_END,
+ E_CLIENT_HOOK_RESIZE_BEGIN,
+ E_CLIENT_HOOK_RESIZE_UPDATE,
+ E_CLIENT_HOOK_RESIZE_END,
+ E_CLIENT_HOOK_DEL,
+ E_CLIENT_HOOK_UNREDIRECT,
+ E_CLIENT_HOOK_REDIRECT,
+} E_Client_Hook_Point;
+
+typedef void (*E_Client_Move_Intercept_Cb)(E_Client *, int x, int y);
+typedef void (*E_Client_Hook_Cb)(void *data, E_Client *ec);
+#else
+
+#define E_CLIENT_TYPE (int)0xE0b01002
+
+struct E_Event_Client
+{
+ E_Client *ec;
+};
+
+struct E_Event_Client_Desk_Set
+{
+ E_Client *ec;
+ E_Desk *desk;
+};
+
+struct E_Event_Client_Zone_Set
+{
+ E_Client *ec;
+ E_Zone *zone;
+};
+
+struct _E_Event_Client_Property
+{
+ E_Client *ec;
+ unsigned int property;
+};
+
+struct _E_Client_Hook
+{
+ E_Client_Hook_Point hookpoint;
+ E_Client_Hook_Cb func;
+ void *data;
+ unsigned char delete_me : 1;
+};
+
+struct _E_Client_Pending_Resize
+{
+ int w, h;
+ unsigned int serial;
+};
+
+struct E_Client
+{
+ E_Object e_obj_inherit;
+ EINA_INLIST;
+
+ E_Pixmap *pixmap;
+ E_Comp *comp;
+ int depth;
+ int x, y, w, h; //frame+client geom
+ Eina_Rectangle client; //client geom
+ Evas_Object *frame; //comp object
+ E_Zone *zone;
+ E_Desk *desk;
+
+ Ecore_Poller *ping_poller;
+ Ecore_Timer *kill_timer;
+
+ E_Client *modal;
+
+ E_Client *leader;
+ Eina_List *group;
+
+ E_Client *parent;
+ Eina_List *transients;
+
+ E_Layer layer;
+
+ Eina_Rectangle *shape_rects;
+ unsigned int shape_rects_num;
+
+ Eina_Rectangle *shape_input_rects;
+ unsigned int shape_input_rects_num;
+
+ Eina_Stringshare *internal_icon;
+ Eina_Stringshare *internal_icon_key;
+
+ E_Direction shade_dir;
+
+ E_Comp_Client_Data *comp_data; //private for the compositor engine (X, Wayland) ONLY
+
+ Evas_Object *input_object; //for running wayland clients in X
+
+ E_Action *cur_mouse_action;
+
+ int border_size; //size of client's border
+
+ struct
+ {
+ struct
+ {
+ int x, y, w, h;
+ int mx, my;
+ } current, last_down[3], last_up[3];
+ } mouse;
+
+ struct
+ {
+ struct
+ {
+ int x, y, w, h;
+ int mx, my;
+ int button;
+ } down;
+ } moveinfo;
+
+ unsigned char ignore_first_unmap;
+ E_Pointer_Mode resize_mode;
+
+ struct
+ {
+ Eina_Bool mapping_change : 1;
+ Eina_Bool iconic_shading : 1;
+ } hacks;
+
+ struct
+ {
+ unsigned char changed : 1;
+ unsigned char user_selected : 1;
+ Eina_Stringshare *name;
+ } border;
+
+ struct
+ {
+ int x, y, w, h;
+ E_Layer layer;
+ int zone;
+ E_Maximize maximized;
+ } saved;
+
+ struct
+ {
+ unsigned char valid : 1;
+ int x, y, w, h;
+ struct
+ {
+ int x, y, w, h;
+ } saved;
+ } pre_res_change;
+
+ unsigned char shaped : 1;
+ unsigned char argb : 1;
+
+ /* ICCCM */
+ struct
+ {
+ Eina_Stringshare *title;
+ Eina_Stringshare *name;
+ Eina_Stringshare *class;
+ Eina_Stringshare *icon_name;
+ Eina_Stringshare *machine;
+ int min_w, min_h;
+ int max_w, max_h;
+ int base_w, base_h;
+ int step_w, step_h;
+ int start_x, start_y;
+ double min_aspect, max_aspect;
+ Ecore_X_Window_State_Hint initial_state;
+ Ecore_X_Window_State_Hint state;
+ Ecore_X_Pixmap icon_pixmap;
+ Ecore_X_Pixmap icon_mask;
+ Ecore_X_Window icon_window;
+ Ecore_X_Window window_group;
+ Ecore_X_Window transient_for;
+ Ecore_X_Window client_leader;
+ Ecore_X_Gravity gravity;
+ Eina_Stringshare *window_role;
+ unsigned char take_focus : 1;
+ unsigned char accepts_focus : 1;
+ unsigned char urgent : 1;
+ unsigned char delete_request : 1;
+ unsigned char request_pos : 1;
+ struct
+ {
+ int argc;
+ char **argv;
+ } command;
+ struct
+ {
+ unsigned char title : 1;
+ unsigned char name_class : 1;
+ unsigned char icon_name : 1;
+ unsigned char machine : 1;
+ unsigned char hints : 1;
+ unsigned char size_pos_hints : 1;
+ unsigned char protocol : 1;
+ unsigned char transient_for : 1;
+ unsigned char client_leader : 1;
+ unsigned char window_role : 1;
+ unsigned char state : 1;
+ unsigned char command : 1;
+ } fetch;
+ } icccm;
+
+ /* MWM */
+ struct
+ {
+ Ecore_X_MWM_Hint_Func func;
+ Ecore_X_MWM_Hint_Decor decor;
+ Ecore_X_MWM_Hint_Input input;
+ unsigned char exists : 1;
+ unsigned char borderless : 1;
+ struct
+ {
+ unsigned char hints : 1;
+ } fetch;
+ } mwm;
+
+ /* NetWM */
+ struct
+ {
+ pid_t pid;
+ unsigned int desktop;
+ Eina_Stringshare *name;
+ Eina_Stringshare *icon_name;
+ Ecore_X_Icon *icons;
+ int num_icons;
+ unsigned int user_time;
+ unsigned char opacity;
+ Eina_Bool opacity_changed : 1; // prevent fetching opacity next prop change
+ struct
+ {
+ int left;
+ int right;
+ int top;
+ int bottom;
+ int left_start_y;
+ int left_end_y;
+ int right_start_y;
+ int right_end_y;
+ int top_start_x;
+ int top_end_x;
+ int bottom_start_x;
+ int bottom_end_x;
+ } strut;
+ unsigned char ping : 1;
+ struct
+ {
+ unsigned char request : 1;
+ unsigned int wait;
+ Ecore_X_Sync_Alarm alarm;
+ Ecore_X_Sync_Counter counter;
+ unsigned int serial;
+ double send_time;
+ } sync;
+
+ /* NetWM Window state */
+ struct
+ {
+ unsigned char modal : 1;
+ unsigned char sticky : 1;
+ unsigned char maximized_v : 1;
+ unsigned char maximized_h : 1;
+ unsigned char shaded : 1;
+ unsigned char skip_taskbar : 1;
+ unsigned char skip_pager : 1;
+ unsigned char hidden : 1;
+ unsigned char fullscreen : 1;
+ E_Stacking stacking;
+ } state;
+
+ /* NetWM Window allowed actions */
+ struct
+ {
+ unsigned char move : 1;
+ unsigned char resize : 1;
+ unsigned char minimize : 1;
+ unsigned char shade : 1;
+ unsigned char stick : 1;
+ unsigned char maximized_h : 1;
+ unsigned char maximized_v : 1;
+ unsigned char fullscreen : 1;
+ unsigned char change_desktop : 1;
+ unsigned char close : 1;
+ } action;
+
+ E_Window_Type type;
+ E_Window_Type *extra_types;
+ int extra_types_num;
+ int startup_id;
+
+ struct
+ {
+ unsigned char name : 1;
+ unsigned char icon_name : 1;
+ unsigned char icon : 1;
+ unsigned char user_time : 1;
+ unsigned char strut : 1;
+ unsigned char type : 1;
+ unsigned char state : 1;
+ unsigned char opacity : 1;
+ /* No, fetch on new_client, shouldn't be changed after map.
+ unsigned char pid : 1;
+ */
+ /* No, ignore this
+ unsigned char desktop : 1;
+ */
+ } fetch;
+
+ struct
+ {
+ unsigned char state : 1;
+ } update;
+ } netwm;
+
+ /* Extra e stuff */
+ struct
+ {
+ struct
+ {
+ struct
+ {
+ int x, y;
+
+ unsigned char updated : 1;
+ } video_position;
+ Ecore_Window video_parent;
+ E_Client *video_parent_client;
+ Eina_List *video_child;
+ struct
+ {
+ Eina_Stringshare *name;
+ Eina_Stringshare **available_list;
+ Eina_Stringshare *set;
+ int num;
+ unsigned char wait_for_done : 1;
+ unsigned char use : 1;
+ } profile;
+ unsigned char centered : 1;
+ unsigned char video : 1;
+ } state;
+
+ struct
+ {
+ unsigned char state : 1;
+ unsigned char video_parent : 1;
+ unsigned char video_position : 1;
+ unsigned char profile : 1;
+ } fetch;
+ } e;
+
+ struct
+ {
+ struct
+ {
+ unsigned char soft_menu : 1;
+ unsigned char soft_menus : 1;
+ } fetch;
+
+ unsigned char soft_menu : 1;
+ unsigned char soft_menus : 1;
+ } qtopia;
+
+ struct
+ {
+ struct
+ {
+ unsigned char state : 1;
+ unsigned char vkbd : 1;
+ } fetch;
+ Ecore_X_Virtual_Keyboard_State state;
+ unsigned char have_property : 1;
+ unsigned char vkbd : 1;
+ } vkbd;
+
+ struct
+ {
+ struct
+ {
+ struct
+ {
+ unsigned char conformant : 1;
+ } fetch;
+ unsigned char conformant : 1;
+ } conformant;
+ struct
+ {
+ struct
+ {
+ unsigned char state : 1;
+ struct
+ {
+ unsigned int major : 1;
+ unsigned int minor : 1;
+ } priority;
+ unsigned char quickpanel : 1;
+ unsigned char zone : 1;
+ } fetch;
+ Ecore_X_Illume_Quickpanel_State state;
+ struct
+ {
+ unsigned int major : 1;
+ unsigned int minor : 1;
+ } priority;
+ unsigned char quickpanel : 1;
+ int zone;
+ } quickpanel;
+ struct
+ {
+ struct
+ {
+ unsigned char drag : 1;
+ unsigned char locked : 1;
+ } fetch;
+ unsigned char drag : 1;
+ unsigned char locked : 1;
+ } drag;
+ struct
+ {
+ struct
+ {
+ unsigned char state : 1;
+ } fetch;
+ Ecore_X_Illume_Window_State state;
+ } win_state;
+ } illume;
+
+ struct
+ {
+ unsigned char visible : 1;
+ unsigned char pos : 1;
+ unsigned char size : 1;
+ unsigned char stack : 1;
+ unsigned char prop : 1;
+ unsigned char border : 1;
+ unsigned char reset_gravity : 1;
+ unsigned char shading : 1;
+ unsigned char shaded : 1;
+ unsigned char shape : 1;
+ unsigned char shape_input : 1;
+ unsigned char icon : 1;
+ Eina_Bool internal_props : 1;
+ Eina_Bool internal_state : 1;
+ Eina_Bool need_maximize : 1;
+ Eina_Bool need_unmaximize : 1;
+ } changes;
+
+ unsigned int visible : 1;
+ Eina_Bool hidden : 1; // set when window has been hidden by api and should not be shown
+ unsigned int await_hide_event;
+ unsigned int moving : 1;
+ unsigned int focused : 1;
+ unsigned int new_client : 1;
+ unsigned int re_manage : 1;
+ unsigned int placed : 1;
+ unsigned int shading : 1;
+ unsigned int shaded : 1;
+ unsigned int iconic : 1;
+ unsigned int deskshow : 1;
+ unsigned int sticky : 1;
+ unsigned int shaped_input : 1;
+ unsigned int need_shape_merge : 1;
+ unsigned int need_shape_export : 1;
+ unsigned int fullscreen : 1;
+ unsigned int need_fullscreen : 1;
+ unsigned int already_unparented : 1;
+ unsigned int need_reparent : 1;
+ unsigned int button_grabbed : 1;
+ unsigned int delete_requested : 1;
+ unsigned int ping_ok : 1;
+ unsigned int hung : 1;
+ unsigned int take_focus : 1;
+ unsigned int want_focus : 1;
+ unsigned int user_skip_winlist : 1;
+ E_Maximize maximized;
+ E_Fullscreen fullscreen_policy;
+ unsigned int borderless : 1;
+ unsigned char offer_resistance : 1;
+ Eina_Stringshare *bordername;
+
+ unsigned int lock_user_location : 1; /*DONE*/
+ unsigned int lock_client_location : 1; /*DONE*/
+ unsigned int lock_user_size : 1; /*DONE*/
+ unsigned int lock_client_size : 1; /*DONE*/
+ unsigned int lock_user_stacking : 1; /*DONE*/
+ unsigned int lock_client_stacking : 1; /*DONE*/
+ unsigned int lock_user_iconify : 1; /*DONE*/
+ unsigned int lock_client_iconify : 1; /*DONE*/
+ unsigned int lock_user_desk : 1;
+ unsigned int lock_client_desk : 1;
+ unsigned int lock_user_sticky : 1; /*DONE*/
+ unsigned int lock_client_sticky : 1; /*DONE*/
+ unsigned int lock_user_shade : 1; /*DONE*/
+ unsigned int lock_client_shade : 1; /*DONE*/
+ unsigned int lock_user_maximize : 1; /*DONE*/
+ unsigned int lock_client_maximize : 1; /*DONE*/
+ unsigned int lock_user_fullscreen : 1; /*DONE*/
+ unsigned int lock_client_fullscreen : 1; /*DONE*/
+ unsigned int lock_border : 1; /*DONE*/
+ unsigned int lock_close : 1; /*DONE*/
+ unsigned int lock_focus_in : 1; /*DONE*/
+ unsigned int lock_focus_out : 1; /*DONE*/
+ unsigned int lock_life : 1; /*DONE*/
+
+ unsigned int stolen : 1;
+
+ unsigned int internal : 1;
+ unsigned int internal_no_remember : 1;
+ unsigned int internal_no_reopen : 1;
+ Eina_Bool theme_shadow : 1;
+
+ Ecore_Evas *internal_ecore_evas;
+
+ double ping;
+
+ unsigned char changed : 1;
+
+ unsigned char icon_preference;
+
+ struct
+ {
+ int x, y;
+ int modified;
+ } shelf_fix;
+
+ Eina_List *stick_desks;
+ E_Menu *border_menu;
+ E_Config_Dialog *border_locks_dialog;
+ E_Config_Dialog *border_remember_dialog;
+ E_Config_Dialog *border_border_dialog;
+ E_Dialog *border_prop_dialog;
+ Eina_List *pending_resize;
+
+ struct
+ {
+ unsigned char start : 1;
+ int x, y;
+ } drag;
+
+ Ecore_Timer *raise_timer;
+ E_Client_Move_Intercept_Cb move_intercept_cb;
+ E_Remember *remember;
+
+ Efreet_Desktop *desktop;
+ E_Exec_Instance *exe_inst;
+
+ unsigned char comp_hidden : 1;
+
+ unsigned char post_move : 1;
+ unsigned char post_resize : 1;
+ unsigned char post_show : 1;
+ unsigned char during_lost : 1;
+
+ Ecore_Idle_Enterer *post_job;
+
+ E_Focus_Policy focus_policy_override;
+
+ Eina_Bool override : 1;
+ Eina_Bool input_only : 1;
+ Eina_Bool dialog : 1;
+ Eina_Bool tooltip : 1;
+ Eina_Bool redirected : 1;
+ Eina_Bool shape_changed : 1;
+ Eina_Bool ignored : 1; // client is comp-ignored
+ Eina_Bool no_shape_cut : 1; // client shape should not be cut
+};
+
+#define e_client_focus_policy_click(ec) \
+ ((ec->focus_policy_override == E_FOCUS_CLICK) || (e_config->focus_policy == E_FOCUS_CLICK))
+
+/* macro for finding misuse of changed flag */
+#if 0
+# define EC_CHANGED(EC) \
+ do { \
+ if (e_object_is_del(E_OBJECT(EC))) \
+ EINA_LOG_CRIT("CHANGED SET ON DELETED CLIENT!"); \
+ EC->changed = 1; \
+ INF("%s:%d - EC CHANGED: %p", __FILE__, __LINE__, EC); \
+ } while (0)
+#else
+# define EC_CHANGED(EC) EC->changed = 1
+#endif
+
+#define E_CLIENT_FOREACH(COMP, EC) \
+ for (EC = e_client_bottom_get(COMP); EC; EC = e_client_above_get(EC))
+
+#define E_CLIENT_REVERSE_FOREACH(COMP, EC) \
+ for (EC = e_client_top_get(COMP); EC; EC = e_client_below_get(EC))
+
+
+EAPI extern int E_EVENT_CLIENT_ADD;
+EAPI extern int E_EVENT_CLIENT_REMOVE;
+EAPI extern int E_EVENT_CLIENT_ZONE_SET;
+EAPI extern int E_EVENT_CLIENT_DESK_SET;
+EAPI extern int E_EVENT_CLIENT_RESIZE;
+EAPI extern int E_EVENT_CLIENT_MOVE;
+EAPI extern int E_EVENT_CLIENT_SHOW;
+EAPI extern int E_EVENT_CLIENT_HIDE;
+EAPI extern int E_EVENT_CLIENT_ICONIFY;
+EAPI extern int E_EVENT_CLIENT_UNICONIFY;
+EAPI extern int E_EVENT_CLIENT_STICK;
+EAPI extern int E_EVENT_CLIENT_UNSTICK;
+EAPI extern int E_EVENT_CLIENT_STACK;
+EAPI extern int E_EVENT_CLIENT_FOCUS_IN;
+EAPI extern int E_EVENT_CLIENT_FOCUS_OUT;
+EAPI extern int E_EVENT_CLIENT_PROPERTY;
+EAPI extern int E_EVENT_CLIENT_FULLSCREEN;
+EAPI extern int E_EVENT_CLIENT_UNFULLSCREEN;
+
+
+EINTERN void e_client_idler_before(void);
+EINTERN Eina_Bool e_client_init(void);
+EINTERN void e_client_shutdown(void);
+EAPI E_Client *e_client_new(E_Comp *c, E_Pixmap *cp, int first_map, int internal);
+EAPI void e_client_desk_set(E_Client *ec, E_Desk *desk);
+EAPI Eina_Bool e_client_comp_grabbed_get(void);
+EAPI E_Client *e_client_action_get(void);
+EAPI E_Client *e_client_warping_get(void);
+EAPI Eina_List *e_clients_immortal_list(const E_Comp *c);
+EAPI void e_client_mouse_in(E_Client *ec, int x, int y);
+EAPI void e_client_mouse_out(E_Client *ec, int x, int y);
+EAPI void e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev);
+EAPI void e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev);
+EAPI void e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev);
+EAPI void e_client_mouse_move(E_Client *ec, Evas_Point *output);
+EAPI void e_client_res_change_geometry_save(E_Client *bd);
+EAPI void e_client_res_change_geometry_restore(E_Client *ec);
+EAPI void e_client_zone_set(E_Client *ec, E_Zone *zone);
+EAPI void e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h);
+EAPI E_Client *e_client_above_get(const E_Client *ec);
+EAPI E_Client *e_client_below_get(const E_Client *ec);
+EAPI E_Client *e_client_bottom_get(const E_Comp *c);
+EAPI E_Client *e_client_top_get(const E_Comp *c);
+EAPI unsigned int e_clients_count(E_Comp *c);
+EAPI void e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb);
+EAPI E_Client_Hook *e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data);
+EAPI void e_client_hook_del(E_Client_Hook *ch);
+EAPI void e_client_focus_latest_set(E_Client *ec);
+EAPI void e_client_raise_latest_set(E_Client *ec);
+EAPI Eina_Bool e_client_focus_track_enabled(void);
+EAPI void e_client_focus_track_freeze(void);
+EAPI void e_client_focus_track_thaw(void);
+EAPI void e_client_focus_set_with_pointer(E_Client *ec);
+EAPI void e_client_activate(E_Client *ec, Eina_Bool just_do_it);
+EAPI E_Client *e_client_focused_get(void);
+EAPI Eina_List *e_client_focus_stack_get(void);
+EAPI Eina_List *e_client_raise_stack_get(void);
+EAPI Eina_List *e_client_lost_windows_get(E_Zone *zone);
+EAPI void e_client_shade(E_Client *ec, E_Direction dir);
+EAPI void e_client_unshade(E_Client *ec, E_Direction dir);
+EAPI void e_client_maximize(E_Client *ec, E_Maximize max);
+EAPI void e_client_unmaximize(E_Client *ec, E_Maximize max);
+EAPI void e_client_fullscreen(E_Client *ec, E_Fullscreen policy);
+EAPI void e_client_unfullscreen(E_Client *ec);
+EAPI void e_client_iconify(E_Client *ec);
+EAPI void e_client_uniconify(E_Client *ec);
+EAPI void e_client_stick(E_Client *ec);
+EAPI void e_client_unstick(E_Client *ec);
+EAPI void e_client_pinned_set(E_Client *ec, Eina_Bool set);
+EAPI void e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden);
+EAPI void e_client_act_move_keyboard(E_Client *ec);
+EAPI void e_client_act_resize_keyboard(E_Client *ec);
+EAPI void e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev);
+EAPI void e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED);
+EAPI void e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev);
+EAPI void e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED);
+EAPI void e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key);
+EAPI void e_client_act_close_begin(E_Client *ec);
+EAPI void e_client_act_kill_begin(E_Client *ec);
+EAPI Evas_Object *e_client_icon_add(E_Client *ec, Evas *evas);
+EAPI void e_client_ping(E_Client *cw);
+EAPI void e_client_move_cancel(void);
+EAPI void e_client_resize_cancel(void);
+EAPI Eina_Bool e_client_resize_begin(E_Client *ec);
+EAPI void e_client_frame_recalc(E_Client *ec);
+EAPI void e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED);
+EAPI void e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED);
+EAPI void e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED);
+EAPI void e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED);
+EAPI void e_client_resize_limit(E_Client *ec, int *w, int *h);
+EAPI E_Client *e_client_under_pointer_get(E_Desk *desk, E_Client *exclude);
+EAPI int e_client_pointer_warp_to_center_now(E_Client *ec);
+EAPI int e_client_pointer_warp_to_center(E_Client *ec);
+EAPI void e_client_redirected_set(E_Client *ec, Eina_Bool set);
+EAPI Eina_Stringshare *e_client_name_get(const E_Client *ec);
+EAPI Eina_Bool e_client_util_is_stacking(const E_Client *ec);
+#include "e_client.x"
+#endif
diff --git a/src/bin/e_client.x b/src/bin/e_client.x
new file mode 100644
index 0000000000..69bff4b8f8
--- /dev/null
+++ b/src/bin/e_client.x
@@ -0,0 +1,98 @@
+
+/**
+ * Move window to coordinates that do not account client decorations yet.
+ *
+ * This call will consider given position does not account client
+ * decoration, so these values (e_comp_object_frame) will be
+ * accounted automatically. This is specially useful when it is a new
+ * client and has not be evaluated yet, in this case
+ * the frame will be zeroed and no information is known. It
+ * will mark pending requests so client will be accounted on
+ * evalutation phase.
+ *
+ * @parm x horizontal position to place window.
+ * @parm y vertical position to place window.
+ *
+ * @see e_client_move()
+ */
+static inline void
+e_client_util_move_without_frame(E_Client *ec, int x, int y)
+{
+ e_comp_object_frame_xy_adjust(ec->frame, x, y, &x, &y);
+ evas_object_move(ec->frame, x, y);
+}
+
+/**
+ * Resize window to values that do not account client decorations yet.
+ *
+ * This call will consider given size does not account client
+ * decoration, so these values (e_comp_object_frame) will be
+ * accounted automatically. This is specially useful when it is a new
+ * client and has not be evaluated yet, in this case
+ * e_comp_object_frame will be zeroed and no information is known. It
+ * will mark pending requests so client will be accounted on
+ * evalutation phase.
+ *
+ * @parm w horizontal window size.
+ * @parm h vertical window size.
+ *
+ * @see e_client_resize()
+ */
+static inline void
+e_client_util_resize_without_frame(E_Client *ec, int w, int h)
+{
+ e_comp_object_frame_wh_adjust(ec->frame, w, h, &w, &h);
+ evas_object_resize(ec->frame, w, h);
+}
+
+/**
+ * Move and resize window to values that do not account client decorations yet.
+ *
+ * This call will consider given values already accounts client
+ * decorations, so it will not be considered later. This will just
+ * work properly with clients that have being evaluated and client
+ * decorations are known (e_comp_object_frame).
+ *
+ * @parm x horizontal position to place window.
+ * @parm y vertical position to place window.
+ * @parm w horizontal window size.
+ * @parm h vertical window size.
+ *
+ * @see e_client_move_resize()
+ */
+static inline void
+e_client_util_move_resize_without_frame(E_Client *ec, int x, int y, int w, int h)
+{
+ e_client_util_move_without_frame(ec, x, y);
+ e_client_util_resize_without_frame(ec, w, h);
+}
+
+static inline Eina_Bool
+e_client_util_ignored_get(const E_Client *ec)
+{
+ return ec->override || ec->input_only || ec->ignored;
+}
+
+static inline Eina_Bool
+e_client_util_desk_visible(const E_Client *ec, const E_Desk *desk)
+{
+ return ec->sticky || (ec->desk == desk);
+}
+
+static inline Ecore_Window
+e_client_util_pwin_get(const E_Client *ec)
+{
+ return e_pixmap_parent_window_get(ec->pixmap);
+}
+
+static inline Ecore_Window
+e_client_util_win_get(const E_Client *ec)
+{
+ return e_pixmap_window_get(ec->pixmap);
+}
+
+static inline Eina_Bool
+e_client_resizing_get(const E_Client *ec)
+{
+ return (ec->resize_mode != E_POINTER_RESIZE_NONE);
+}
diff --git a/src/bin/e_color_dialog.c b/src/bin/e_color_dialog.c
index a536c2a236..5a5e10aeae 100644
--- a/src/bin/e_color_dialog.c
+++ b/src/bin/e_color_dialog.c
@@ -9,12 +9,12 @@ static void _e_color_dialog_cb_csel_change(void *data, Evas_Object *obj);
/**
* Create a color selector dialog.
*
- * @param con container to display on
+ * @param c compositor to display on
* @param color color to initialize to (or NULL for black).
* @param alpha_enabled if set, uses alpha and let user edit it.
*/
E_Color_Dialog *
-e_color_dialog_new(E_Container *con, const E_Color *color, Eina_Bool alpha_enabled)
+e_color_dialog_new(E_Comp *c, const E_Color *color, Eina_Bool alpha_enabled)
{
E_Color_Dialog *dia;
Evas_Object *o;
@@ -22,7 +22,7 @@ e_color_dialog_new(E_Container *con, const E_Color *color, Eina_Bool alpha_enabl
dia = E_OBJECT_ALLOC(E_Color_Dialog, E_COLOR_DIALOG_TYPE, _e_color_dialog_free);
if (!dia) return NULL;
- dia->dia = e_dialog_new(con, "E", "_color_dialog");
+ dia->dia = e_dialog_new(c, "E", "_color_dialog");
e_dialog_title_set(dia->dia, _("Color Selector"));
dia->color = calloc(1, sizeof(E_Color));
diff --git a/src/bin/e_color_dialog.h b/src/bin/e_color_dialog.h
index 415be74787..ade2226588 100644
--- a/src/bin/e_color_dialog.h
+++ b/src/bin/e_color_dialog.h
@@ -12,7 +12,6 @@ struct _E_Color_Dialog
{
E_Object e_obj_inherit;
- E_Container *con;
E_Dialog *dia;
E_Color *color, *initial;
@@ -25,7 +24,7 @@ struct _E_Color_Dialog
void *change_data;
};
-EAPI E_Color_Dialog *e_color_dialog_new (E_Container *con, const E_Color *initial_color, Eina_Bool alpha_enabled);
+EAPI E_Color_Dialog *e_color_dialog_new (E_Comp *c, const E_Color *initial_color, Eina_Bool alpha_enabled);
EAPI void e_color_dialog_show (E_Color_Dialog *dia);
EAPI void e_color_dialog_title_set (E_Color_Dialog *dia, const char *title);
diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c
index d6531b69a9..bc756872bc 100644
--- a/src/bin/e_comp.c
+++ b/src/bin/e_comp.c
@@ -2,7 +2,9 @@
#ifdef HAVE_WAYLAND_CLIENTS
#include "e_comp_wl.h"
#endif
-
+
+#include "e_comp_x.h"
+
#define ACTION_TIMEOUT 30.0
#define OVER_FLOW 1
//#define SHAPE_DEBUG
@@ -23,9 +25,6 @@
static Eina_List *handlers = NULL;
static Eina_List *hooks = NULL;
static Eina_List *compositors = NULL;
-static Eina_Hash *windows = NULL;
-static Eina_Hash *borders = NULL;
-static Eina_Hash *damages = NULL;
static Eina_Hash *ignores = NULL;
static Eina_List *actions = NULL;
@@ -36,14 +35,10 @@ static E_Config_DD *conf_match_edd = NULL;
static Ecore_Timer *action_timeout = NULL;
static Eina_Bool gl_avail = EINA_FALSE;
-EAPI int E_EVENT_COMP_SOURCE_VISIBILITY = -1;
-EAPI int E_EVENT_COMP_SOURCE_ADD = -1;
-EAPI int E_EVENT_COMP_SOURCE_DEL = -1;
-EAPI int E_EVENT_COMP_SOURCE_CONFIGURE = -1;
-EAPI int E_EVENT_COMP_SOURCE_STACK = -1;
-
static int _e_comp_log_dom = -1;
+EAPI int E_EVENT_COMPOSITOR_RESIZE = -1;
+
//////////////////////////////////////////////////////////////////////////
#undef DBG
#undef INF
@@ -79,127 +74,6 @@ static int _e_comp_log_dom = -1;
#define CRI(f, x ...)
#endif
-static Eina_Bool _e_comp_win_do_shadow(E_Comp_Win *cw);
-static void _e_comp_win_ready_timeout_setup(E_Comp_Win *cw);
-static void _e_comp_render_queue(E_Comp *c);
-static void _e_comp_win_damage(E_Comp_Win *cw, int x, int y, int w, int h, Eina_Bool dmg);
-static void _e_comp_win_render_queue(E_Comp_Win *cw);
-static void _e_comp_win_release(E_Comp_Win *cw);
-static void _e_comp_win_adopt(E_Comp_Win *cw);
-static void _e_comp_win_del(E_Comp_Win *cw);
-static void _e_comp_win_show(E_Comp_Win *cw);
-static void _e_comp_win_real_hide(E_Comp_Win *cw);
-static void _e_comp_win_hide(E_Comp_Win *cw);
-static void _e_comp_win_configure(E_Comp_Win *cw, int x, int y, int w, int h, int border);
-static void _e_comp_shapes_update(void *data, E_Container_Shape *es, E_Container_Shape_Change ch);
-static void _e_comp_win_shape_create(E_Comp_Win *cw, int x, int y, int w, int h);
-static void _e_comp_injected_win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
-static void _e_comp_injected_win_hide_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
-static void _e_comp_injected_win_focus_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
-static void _e_comp_injected_win_focus_out_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
-
-static void
-_e_comp_event_end(void *d EINA_UNUSED, E_Event_Comp *ev)
-{
- ev->cw->pending_count--;
- if (ev->cw->delete_pending && (!ev->cw->pending_count))
- _e_comp_win_del(ev->cw);
- free(ev);
-}
-
-/* FIXME: external ? */
-static void
-_e_comp_event_source_visibility(E_Comp_Win *cw)
-{
- E_Event_Comp *ev;
-
- ev = E_NEW(E_Event_Comp, 1);
- ev->cw = cw;
- ecore_event_add(E_EVENT_COMP_SOURCE_VISIBILITY, ev, (Ecore_End_Cb)_e_comp_event_end, NULL);
-}
-
-static void
-_e_comp_event_source_add(E_Comp_Win *cw)
-{
- E_Event_Comp *ev;
-
- ev = E_NEW(E_Event_Comp, 1);
- ev->cw = cw;
- ecore_event_add(E_EVENT_COMP_SOURCE_ADD, ev, (Ecore_End_Cb)_e_comp_event_end, NULL);
-}
-
-static void
-_e_comp_event_source_del(E_Comp_Win *cw)
-{
- E_Event_Comp *ev;
-
- ev = E_NEW(E_Event_Comp, 1);
- ev->cw = cw;
- ecore_event_add(E_EVENT_COMP_SOURCE_DEL, ev, (Ecore_End_Cb)_e_comp_event_end, NULL);
-}
-
-static void
-_e_comp_event_source_configure(E_Comp_Win *cw)
-{
- E_Event_Comp *ev;
-
- ev = E_NEW(E_Event_Comp, 1);
- ev->cw = cw;
- ecore_event_add(E_EVENT_COMP_SOURCE_CONFIGURE, ev, (Ecore_End_Cb)_e_comp_event_end, NULL);
-}
-
-static void
-_e_comp_event_source_stack(E_Comp_Win *cw)
-{
- E_Event_Comp *ev;
-
- ev = E_NEW(E_Event_Comp, 1);
- ev->cw = cw;
- ecore_event_add(E_EVENT_COMP_SOURCE_STACK, ev, (Ecore_End_Cb)_e_comp_event_end, NULL);
-}
-
-static void
-_e_comp_child_show(E_Comp_Win *cw)
-{
- evas_object_show(cw->effect_obj);
- if (cw->bd)
- {
- Eina_List *l;
- E_Border *tmp;
-
- EINA_LIST_FOREACH(cw->bd->client.e.state.video_child, l, tmp)
- {
- E_Comp_Win *tcw;
-
- tcw = eina_hash_find(borders, e_util_winid_str_get(tmp->client.win));
- if (!tcw) continue;
-
- evas_object_show(tcw->effect_obj);
- }
- }
-}
-
-static void
-_e_comp_child_hide(E_Comp_Win *cw)
-{
- evas_object_hide(cw->effect_obj);
- if (cw->bd)
- {
- Eina_List *l;
- E_Border *tmp;
-
- EINA_LIST_FOREACH(cw->bd->client.e.state.video_child, l, tmp)
- {
- E_Comp_Win *tcw;
-
- tcw = eina_hash_find(borders, e_util_winid_str_get(tmp->client.win));
- if (!tcw) continue;
-
- evas_object_hide(tcw->effect_obj);
- }
- }
-}
-
static Eina_Bool
_e_comp_visible_object_clip_is(Evas_Object *obj)
{
@@ -290,968 +164,107 @@ _e_comp_visible_object_is_above(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Ev
return EINA_FALSE;
}
-static E_Comp_Win *
+static E_Client *
_e_comp_fullscreen_check(E_Comp *c)
{
- E_Comp_Win *cw;
+ E_Client *ec;
- if (!c->wins) return NULL;
- EINA_INLIST_REVERSE_FOREACH(c->wins, cw)
+ E_CLIENT_REVERSE_FOREACH(c, ec)
{
- if ((!cw->visible) || (cw->input_only) || (cw->invalid) || (cw->real_obj))
+ Evas_Object *o = ec->frame;
+
+ if (e_client_util_ignored_get(ec) || (!evas_object_visible_get(ec->frame)))
continue;
- if (!cw->bd) continue;
- if ((cw->x == 0) && (cw->y == 0) &&
- ((cw->bd->client.w) == c->man->w) &&
- ((cw->bd->client.h) == c->man->h) &&
- (cw->bd->client_inset.l == 0) && (cw->bd->client_inset.r == 0) &&
- (cw->bd->client_inset.t == 0) && (cw->bd->client_inset.b == 0) &&
- (!cw->argb) && (!cw->shaped) && (!cw->bg_win)
- )
+ if (!e_comp_util_client_is_fullscreen(ec)) return NULL;
+ while (o)
{
- // check for objects above...
- Evas_Object *parent = NULL, *o = NULL;
-
- o = cw->obj;
- do
- {
- if (_e_comp_visible_object_is_above
- (o, 0, 0, c->man->w, c->man->h)) return NULL;
- parent = evas_object_smart_parent_get(o);
- if (parent) o = parent;
- }
- while (parent);
- return cw;
+ if (_e_comp_visible_object_is_above
+ (o, 0, 0, c->man->w, c->man->h)) return NULL;
+ o = evas_object_smart_parent_get(o);
}
- return NULL;
+ return ec;
}
return NULL;
}
-static inline Eina_Bool
-_e_comp_shaped_check(int w, int h, const Eina_Rectangle *rects, int num)
-{
- if ((!rects) || (num < 1)) return EINA_FALSE;
- if (num > 1) return EINA_TRUE;
- if ((rects[0].x == 0) && (rects[0].y == 0) &&
- ((int)rects[0].w == w) && ((int)rects[0].h == h))
- return EINA_FALSE;
- return EINA_TRUE;
-}
-
-static inline Eina_Bool
-_e_comp_win_shaped_check(const E_Comp_Win *cw, const Eina_Rectangle *rects, int num)
-{
- return _e_comp_shaped_check(cw->w, cw->h, rects, num);
-}
-
-static void
-_e_comp_win_shape_rectangles_apply(E_Comp_Win *cw, const Eina_Rectangle *rects, int num)
-{
- Eina_List *l;
- Evas_Object *o;
- int i;
-
- DBG("SHAPE [0x%x] change, rects=%p (%d)", cw->win, rects, num);
- if (!_e_comp_win_shaped_check(cw, rects, num))
- {
- rects = NULL;
- }
- if (rects)
- {
- unsigned int *pix, *p;
- unsigned char *spix, *sp;
- int w, h, px, py;
-
- evas_object_image_size_get(cw->obj, &w, &h);
- if ((w > 0) && (h > 0))
- {
- if (cw->native)
- {
- ERR("BUGGER: shape with native surface? cw=%p", cw);
- return;
- }
-
- evas_object_image_native_surface_set(cw->obj, NULL);
- evas_object_image_alpha_set(cw->obj, 1);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_native_surface_set(o, NULL);
- evas_object_image_alpha_set(o, 1);
- }
- pix = evas_object_image_data_get(cw->obj, 1);
- if (pix)
- {
- spix = calloc(w * h, sizeof(unsigned char));
- if (spix)
- {
- DBG("SHAPE [0x%x] rects %i", cw->win, num);
- for (i = 0; i < num; i++)
- {
- int rx, ry, rw, rh;
-
- rx = rects[i].x; ry = rects[i].y;
- rw = rects[i].w; rh = rects[i].h;
- E_RECTS_CLIP_TO_RECT(rx, ry, rw, rh, 0, 0, w, h);
- sp = spix + (w * ry) + rx;
- for (py = 0; py < rh; py++)
- {
- for (px = 0; px < rw; px++)
- {
- *sp = 0xff; sp++;
- }
- sp += w - rw;
- }
- }
- sp = spix;
- p = pix;
- for (py = 0; py < h; py++)
- {
- for (px = 0; px < w; px++)
- {
- unsigned int mask, imask;
-
- mask = ((unsigned int)(*sp)) << 24;
- imask = mask >> 8;
- imask |= imask >> 8;
- imask |= imask >> 8;
- *p = mask | (*p & imask);
- //if (*sp) *p = 0xff000000 | *p;
- //else *p = 0x00000000;
- sp++;
- p++;
- }
- }
- free(spix);
- }
- evas_object_image_data_set(cw->obj, pix);
- evas_object_image_data_update_add(cw->obj, 0, 0, w, h);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_data_set(o, pix);
- evas_object_image_data_update_add(o, 0, 0, w, h);
- }
- }
- }
- }
- else
- {
- if (cw->shaped)
- {
- unsigned int *pix, *p;
- int w, h, px, py;
-
- evas_object_image_size_get(cw->obj, &w, &h);
- if ((w > 0) && (h > 0))
- {
- if (cw->native)
- {
- ERR("BUGGER: shape with native surface? cw=%p", cw);
- return;
- }
-
- evas_object_image_alpha_set(cw->obj, 0);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_alpha_set(o, 1);
- }
- pix = evas_object_image_data_get(cw->obj, 1);
- if (pix)
- {
- p = pix;
- for (py = 0; py < h; py++)
- {
- for (px = 0; px < w; px++)
- *p |= 0xff000000;
- }
- }
- evas_object_image_data_set(cw->obj, pix);
- evas_object_image_data_update_add(cw->obj, 0, 0, w, h);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_data_set(o, pix);
- evas_object_image_data_update_add(o, 0, 0, w, h);
- }
- }
- }
- // dont need to fix alpha chanel as blending
- // should be totally off here regardless of
- // alpha channel content
- }
-}
-
-static Eina_Bool
-_e_comp_cb_win_show_ready_timeout(void *data)
-{
- E_Comp_Win *cw = data;
- cw->show_ready = 1;
- if (cw->visible)
- {
- if (!cw->update)
- {
- if (cw->update_timeout)
- {
- ecore_timer_del(cw->update_timeout);
- cw->update_timeout = NULL;
- }
- cw->update = 1;
- cw->c->updates = eina_list_append(cw->c->updates, cw);
- }
- _e_comp_win_render_queue(cw);
- }
- cw->ready_timeout = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
-static void
-_e_comp_win_ready_timeout_setup(E_Comp_Win *cw)
-{
- if (cw->ready_timeout)
- {
- ecore_timer_del(cw->ready_timeout);
- cw->ready_timeout = NULL;
- }
- if (cw->show_ready) return;
- // FIXME: make show_ready option
- if (0)
- {
- cw->show_ready = 1;
- }
- else
- cw->ready_timeout = ecore_timer_add(conf->first_draw_delay, _e_comp_cb_win_show_ready_timeout, cw);
-}
-
-static void
-_e_comp_win_layout_populate(E_Comp_Win *cw)
-{
- e_layout_pack(cw->c->layout, cw->effect_obj);
-}
-
-static void
-_e_comp_win_restack(E_Comp_Win *cw)
-{
- Eina_Inlist *prev, *next;
- Eina_List *l;
- E_Comp_Win *cwp = NULL, *cwn = NULL;
-
- next = EINA_INLIST_GET(cw)->next;
- if (next) cwn = EINA_INLIST_CONTAINER_GET(next, E_Comp_Win);
- prev = EINA_INLIST_GET(cw)->prev;
- if (prev) cwp = EINA_INLIST_CONTAINER_GET(prev, E_Comp_Win);
-
- if (cwp)
- e_layout_child_raise_above(cw->effect_obj, cwp->effect_obj);
- else if (cwn)
- e_layout_child_lower_below(cw->effect_obj, cwn->effect_obj);
- if (cw->bd)
- {
- E_Border *tmp;
-
- EINA_LIST_FOREACH(cw->bd->client.e.state.video_child, l, tmp)
- {
- E_Comp_Win *tcw;
-
- tcw = eina_hash_find(borders, e_util_winid_str_get(tmp->client.win));
- if (!tcw) continue;
- e_layout_child_lower_below(tcw->effect_obj, cw->effect_obj);
- cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(tcw));
- cw->c->wins = eina_inlist_prepend_relative(cw->c->wins, EINA_INLIST_GET(tcw), EINA_INLIST_GET(cw));
- }
- }
- EINA_LIST_FOREACH(cw->stack_below, l, cwp)
- {
- e_layout_child_lower_below(cwp->effect_obj, cw->effect_obj);
- cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cwp));
- cw->c->wins = eina_inlist_prepend_relative(cw->c->wins, EINA_INLIST_GET(cwp), EINA_INLIST_GET(cw));
- }
- _e_comp_shapes_update(cw->c, NULL, E_CONTAINER_SHAPE_MOVE);
-}
-
-static void
-_e_comp_win_geometry_update(E_Comp_Win *cw)
-{
- int x, y, w, h;
-
- if (cw->update)
- {
- cw->geom_update = 1;
- _e_comp_win_render_queue(cw);
- return;
- }
- if (cw->bd)
- {
- if (!cw->pixmap) return;
- x = cw->bd->x, y = cw->bd->y;
- }
- else if (cw->visible)
- x = cw->x, y = cw->y;
- else
- x = cw->hidden.x, y = cw->hidden.y;
- if (cw->real_obj)
- w = cw->w, h = cw->h;
- else if (cw->bd)
- {
- if (((!cw->bd->shaded) && (!cw->bd->shading)) && cw->pw && cw->ph)
- {
- w = cw->pw + e_border_inset_width_get(cw->bd), h = cw->ph + e_border_inset_height_get(cw->bd);
- if ((cw->pw != cw->bd->client.w) || (cw->ph != cw->bd->client.h))
- {
- /* something fucked us and the pixmap came back with the wrong size
- * fix it by forcing a resize in e_border
- */
- if (!e_object_is_del(E_OBJECT(cw->bd)))
- {
- BD_CHANGED(cw->bd);
- cw->bd->changes.size = 1;
- }
- }
- }
- else
- w = cw->bd->w, h = cw->bd->h;
- }
- else
- w = cw->pw ?: cw->w, h = cw->ph ?: cw->h;
- if (cw->zoomobj) e_zoomap_child_resize(cw->zoomobj, w, h);
- if (cw->not_in_layout)
- {
- evas_object_resize(cw->effect_obj, w, h);
- evas_object_move(cw->effect_obj, x, y);
- }
- else
- {
- e_layout_child_move(cw->effect_obj, x, y);
- e_layout_child_resize(cw->effect_obj, w, h);
- }
- cw->geom_update = 0;
-}
-
-static void
-_e_comp_win_update(E_Comp_Win *cw)
-{
- Eina_List *l;
- Evas_Object *o;
- E_Comp_Render_Update_Rect *r;
- int i, num;
- int pw, ph;
- int pshaped = cw->shaped;
- Eina_Rectangle *rects;
-
- DBG("UPDATE [0x%x] pm = %x", cw->win, cw->pixmap);
- if (conf->grab) ecore_x_grab();
- cw->update = 0;
-
- pw = cw->pw, ph = cw->ph;
- if (cw->shape_changed)
- {
- if ((cw->shape) && (cw->free_shape))
- {
- ecore_x_window_geometry_get(cw->win, NULL, NULL, &(cw->w), &(cw->h));
- rects = (Eina_Rectangle*)ecore_x_window_shape_rectangles_get(cw->win, &num);
- e_container_shape_rects_set(cw->shape, rects, num);
- if (cw->shape->shape_rects)
- e_container_shape_input_rects_set(cw->shape, NULL, 0);
- else
- {
- rects = (Eina_Rectangle*)ecore_x_window_shape_input_rectangles_get(cw->win, &num);
- e_container_shape_input_rects_set(cw->shape, rects, num);
- }
- }
- if ((cw->shape) && (cw->shape->shape_rects))
- {
- for (i = 0; i < cw->shape->shape_rects_num; i++)
- {
- E_RECTS_CLIP_TO_RECT(cw->shape->shape_rects[i].x, cw->shape->shape_rects[i].y,
- cw->shape->shape_rects[i].w, cw->shape->shape_rects[i].h, 0, 0, (int)cw->w, (int)cw->h);
- }
- }
- if ((cw->shape) && (cw->shape->shape_input_rects))
- {
- for (i = 0; i < cw->shape->shape_input_rects_num; i++)
- {
- E_RECTS_CLIP_TO_RECT(cw->shape->shape_input_rects[i].x, cw->shape->shape_input_rects[i].y,
- cw->shape->shape_input_rects[i].w, cw->shape->shape_input_rects[i].h, 0, 0, (int)cw->w, (int)cw->h);
- }
- }
- if (cw->shape)
- {
- cw->shaped = _e_comp_win_shaped_check(cw, cw->shape->shape_rects, cw->shape->shape_rects_num);
- evas_object_precise_is_inside_set(cw->obj, cw->shaped);
- }
- }
-
- if (cw->dmg_updates && (((!cw->pixmap) || (cw->needpix)) &&
- (!cw->real_hid) && (!cw->nocomp) && (!cw->c->nocomp)))
- {
- Ecore_X_Pixmap pm = 0;
-
- /* #ifdef HAVE_WAYLAND_CLIENTS */
- /* if ((cw->bd) && (cw->bd->borderless)) */
- /* pm = e_comp_wl_pixmap_get(cw->win); */
- /* #endif */
- if (!pm) pm = ecore_x_composite_name_window_pixmap_get(cw->win);
- while (pm)
- {
- Ecore_X_Pixmap oldpm;
-
- oldpm = cw->pixmap;
- ecore_x_pixmap_geometry_get(pm, NULL, NULL, &(cw->pw), &(cw->ph));
- if ((pw == cw->pw) && (ph == cw->ph))
- {
- ecore_x_pixmap_free(pm);
- break;
- }
- cw->pixmap = pm;
- cw->needpix = 0;
- if (cw->xim) cw->needxim = 1;
- cw->show_ready = 0;
- _e_comp_win_ready_timeout_setup(cw);
- if ((cw->pw != pw) || (cw->ph != ph)) cw->geom_update = 1;
- DBG("REND [0x%x] pixmap = [0x%x], %ix%i", cw->win, cw->pixmap, cw->pw, cw->ph);
- if ((cw->pw <= 0) || (cw->ph <= 0))
- {
- if (cw->native)
- {
- DBG(" [0x%x] free native", cw->win);
- evas_object_image_native_surface_set(cw->obj, NULL);
- cw->native = 0;
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_native_surface_set(o, NULL);
- }
- }
- if (cw->pixmap)
- {
- DBG(" [0x%x] free pixmap", cw->win);
- ecore_x_pixmap_free(cw->pixmap);
- cw->pixmap = 0;
- //cw->show_ready = 0; // hmm maybe not needed?
- }
- cw->pw = 0;
- cw->ph = 0;
- }
- ecore_x_e_comp_pixmap_set(cw->win, cw->pixmap);
- cw->native = 0;
- DBG(" [0x%x] up resize %ix%i", cw->win, cw->pw, cw->ph);
- e_comp_render_update_resize(cw->up, cw->pw, cw->ph);
- e_comp_render_update_add(cw->up, 0, 0, cw->pw, cw->ph);
- if (oldpm)
- {
- DBG(" [0x%x] free pm %x", cw->win, oldpm);
- // XXX the below is unreachable code! :)
- /*
- if (cw->native)
- {
- cw->native = 0;
- if (!((cw->pw > 0) && (cw->ph > 0)))
- {
- evas_object_image_native_surface_set(cw->obj, NULL);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_native_surface_set(o, NULL);
- }
- }
- }
- */
- ecore_x_pixmap_free(oldpm);
- }
- break;
- }
- }
- if (!((cw->pw > 0) && (cw->ph > 0)))
- {
- if (cw->geom_update) _e_comp_win_geometry_update(cw);
- if (conf->grab) ecore_x_ungrab();
- return;
- }
-
- // evas_object_move(cw->effect_obj, cw->x, cw->y);
- // was cw->w / cw->h
- // evas_object_resize(cw->effect_obj, cw->pw, cw->ph);
- if ((cw->c->gl) && (conf->texture_from_pixmap) &&
- (!cw->shaped) && (cw->pixmap))
- {
- /* #ifdef HAVE_WAYLAND_CLIENTS */
- /* DBG("DEBUG - pm now %x", e_comp_wl_pixmap_get(cw->win)); */
- /* #endif */
- /* DBG("DEBUG - pm now %x", ecore_x_composite_name_window_pixmap_get(cw->win)); */
- evas_object_image_size_set(cw->obj, cw->pw, cw->ph);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_size_set(o, cw->pw, cw->ph);
- }
- if (!cw->native)
- {
- Evas_Native_Surface ns;
-
- ns.version = EVAS_NATIVE_SURFACE_VERSION;
- ns.type = EVAS_NATIVE_SURFACE_X11;
- ns.data.x11.visual = cw->vis;
- ns.data.x11.pixmap = cw->pixmap;
- evas_object_image_native_surface_set(cw->obj, &ns);
- DBG("NATIVE [0x%x] %x %ix%i", cw->win, cw->pixmap, cw->pw, cw->ph);
- cw->native = 1;
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_native_surface_set(o, &ns);
- }
- }
- r = e_comp_render_update_rects_get(cw->up);
- if (r)
- {
- e_comp_render_update_clear(cw->up);
- for (i = 0; r[i].w > 0; i++)
- {
- int x, y, w, h;
-
- x = r[i].x; y = r[i].y;
- w = r[i].w; h = r[i].h;
- DBG("UPDATE [0x%x] pm [0x%x] %i %i %ix%i", cw->win, cw->pixmap, x, y, w, h);
- evas_object_image_data_update_add(cw->obj, x, y, w, h);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_data_update_add(o, x, y, w, h);
- }
- }
- free(r);
- }
- else
- {
- DBG("UPDATE [0x%x] NO RECTS!!! %i %i - %i %i",
- cw->win, cw->up->w, cw->up->h, cw->up->tw, cw->up->th);
- // cw->update = 1;
- }
- }
- else if (cw->pixmap)
- {
- if (cw->native)
- {
- evas_object_image_native_surface_set(cw->obj, NULL);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_native_surface_set(o, NULL);
- }
- cw->native = 0;
- }
- if (cw->needxim)
- {
- cw->needxim = 0;
- if (cw->xim)
- {
- evas_object_image_size_set(cw->obj, 1, 1);
- evas_object_image_data_set(cw->obj, NULL);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_size_set(o, 1, 1);
- evas_object_image_data_set(o, NULL);
- }
- ecore_x_image_free(cw->xim);
- cw->xim = NULL;
- }
- }
- if (!cw->xim)
- {
- if ((cw->xim = ecore_x_image_new(cw->pw, cw->ph, cw->vis, cw->depth)))
- e_comp_render_update_add(cw->up, 0, 0, cw->pw, cw->ph);
- }
- r = e_comp_render_update_rects_get(cw->up);
- if (r)
- {
- if (cw->xim)
- {
- if (ecore_x_image_is_argb32_get(cw->xim))
- {
- unsigned int *pix;
-
- pix = ecore_x_image_data_get(cw->xim, NULL, NULL, NULL);
- evas_object_image_data_set(cw->obj, pix);
- evas_object_image_size_set(cw->obj, cw->pw, cw->ph);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_data_set(o, pix);
- evas_object_image_size_set(o, cw->pw, cw->ph);
- }
-
- e_comp_render_update_clear(cw->up);
- for (i = 0; r[i].w > 0; i++)
- {
- int x, y, w, h;
-
- x = r[i].x; y = r[i].y;
- w = r[i].w; h = r[i].h;
- if (!ecore_x_image_get(cw->xim, cw->pixmap, x, y, x, y, w, h))
- {
- WRN("UPDATE [0x%x] %i %i %ix%i FAIL!!!!!!!!!!!!!!!!!", cw->win, x, y, w, h);
- e_comp_render_update_add(cw->up, x, y, w, h);
- cw->update = 1;
- }
- else
- {
- // why do we neeed these 2? this smells wrong
- pix = ecore_x_image_data_get(cw->xim, NULL, NULL, NULL);
- DBG("UPDATE [0x%x] %i %i %ix%i -- pix = %p", cw->win, x, y, w, h, pix);
- evas_object_image_data_set(cw->obj, pix);
- evas_object_image_data_update_add(cw->obj, x, y, w, h);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_data_set(o, pix);
- evas_object_image_data_update_add(o, x, y, w, h);
- }
- }
- }
- }
- else
- {
- unsigned int *pix;
- int stride;
-
- evas_object_image_size_set(cw->obj, cw->pw, cw->ph);
- pix = evas_object_image_data_get(cw->obj, EINA_TRUE);
- stride = evas_object_image_stride_get(cw->obj);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_data_set(o, pix);
- evas_object_image_size_set(o, cw->pw, cw->ph);
- }
-
- e_comp_render_update_clear(cw->up);
- for (i = 0; r[i].w > 0; i++)
- {
- int x, y, w, h;
-
- x = r[i].x; y = r[i].y;
- w = r[i].w; h = r[i].h;
- if (!ecore_x_image_get(cw->xim, cw->pixmap, x, y, x, y, w, h))
- {
- WRN("UPDATE [0x%x] %i %i %ix%i FAIL!!!!!!!!!!!!!!!!!", cw->win, x, y, w, h);
- e_comp_render_update_add(cw->up, x, y, w, h);
- cw->update = 1;
- }
- else
- {
- unsigned int *srcpix;
- int srcbpp = 0, srcbpl = 0;
- // why do we neeed these 2? this smells wrong
- srcpix = ecore_x_image_data_get(cw->xim, &srcbpl, NULL, &srcbpp);
- ecore_x_image_to_argb_convert(srcpix, srcbpp, srcbpl,
- cw->cmap, cw->vis, x, y, w, h, pix, stride, x, y);
- DBG("UPDATE [0x%x] %i %i %ix%i -- pix = %p", cw->win, x, y, w, h, pix);
- evas_object_image_data_update_add(cw->obj, x, y, w, h);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_data_update_add(o, x, y, w, h);
- }
- }
- }
- evas_object_image_data_set(cw->obj, pix);
- }
- }
- free(r);
- if ((cw->shape) && (cw->shaped || cw->shape_changed))
- _e_comp_win_shape_rectangles_apply(cw, cw->shape->shape_rects, cw->shape->shape_rects_num);
- cw->shape_changed = 0;
- }
- else
- {
- DBG("UPDATE [0x%x] NO RECTS!!! %i %i - %i %i",
- cw->win, cw->up->w, cw->up->h, cw->up->tw, cw->up->th);
- // causes updates to be flagged when not needed - disabled
- // cw->update = 1;
- }
- }
- // FIXME: below cw update check screws with show
- if (/*(!cw->update) &&*/ (cw->visible) && (cw->dmg_updates >= 1) &&
- (cw->show_ready) && (!cw->bd || cw->bd->visible))
- {
- if (!evas_object_visible_get(cw->effect_obj))
- {
- if (!cw->hidden_override)
- {
- _e_comp_child_show(cw);
- _e_comp_win_render_queue(cw);
- }
-
- if (!cw->show_anim)
- {
- edje_object_signal_emit(cw->shobj, "e,state,visible,on", "e");
- if (!cw->animating)
- {
- cw->c->animating++;
- }
-
- cw->animating = 1;
-
- cw->pending_count++;
- _e_comp_event_source_visibility(cw);
- cw->show_anim = EINA_TRUE;
- }
- if (cw->shape)
- {
- cw->shape->visible = 0;
- e_container_shape_show(cw->shape);
- }
- }
- }
- if (cw->geom_update) _e_comp_win_geometry_update(cw);
- if ((cw->shobj) && (cw->obj))
- {
- if (pshaped != cw->shaped)
- {
- if (_e_comp_win_do_shadow(cw))
- edje_object_signal_emit(cw->shobj, "e,state,shadow,on", "e");
- else
- edje_object_signal_emit(cw->shobj, "e,state,shadow,off", "e");
- }
- }
-
- if (conf->grab) ecore_x_ungrab();
-}
-
-static void
-_e_comp_pre_swap(void *data, Evas *e EINA_UNUSED)
-{
- E_Comp *c = data;
-
- if (conf->grab)
- {
- if (c->grabbed)
- {
- ecore_x_ungrab();
- c->grabbed = 0;
- }
- }
-}
-
-static Eina_Bool
-_e_comp_cb_delayed_update_timer(void *data)
-{
- E_Comp *c = data;
- _e_comp_render_queue(c);
- c->new_up_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
static void
_e_comp_fps_update(E_Comp *c)
{
if (conf->fps_show)
{
- if (!c->fps_bg)
- {
- c->fps_bg = evas_object_rectangle_add(c->evas);
- evas_object_color_set(c->fps_bg, 0, 0, 0, 128);
- evas_object_layer_set(c->fps_bg, E_COMP_CANVAS_LAYER_MAX);
- evas_object_lower(c->fps_bg);
- evas_object_show(c->fps_bg);
-
- c->fps_fg = evas_object_text_add(c->evas);
- evas_object_text_font_set(c->fps_fg, "Sans", 10);
- evas_object_text_text_set(c->fps_fg, "???");
- evas_object_color_set(c->fps_fg, 255, 255, 255, 255);
- evas_object_layer_set(c->fps_fg, E_COMP_CANVAS_LAYER_MAX);
- evas_object_stack_above(c->fps_fg, c->fps_bg);
- evas_object_show(c->fps_fg);
- }
- }
- else
- {
- if (c->fps_fg)
- {
- evas_object_del(c->fps_fg);
- c->fps_fg = NULL;
- }
- if (c->fps_bg)
- {
- evas_object_del(c->fps_bg);
- c->fps_bg = NULL;
- }
- }
-}
+ if (c->fps_bg) return;
-static void
-_e_comp_win_release(E_Comp_Win *cw)
-{
- Eina_List *l;
- Evas_Object *o;
+ c->fps_bg = evas_object_rectangle_add(c->evas);
+ evas_object_color_set(c->fps_bg, 0, 0, 0, 128);
+ evas_object_layer_set(c->fps_bg, E_LAYER_MAX);
+ evas_object_name_set(c->fps_bg, "c->fps_bg");
+ evas_object_lower(c->fps_bg);
+ evas_object_show(c->fps_bg);
- if (cw->xim)
- {
- evas_object_image_size_set(cw->obj, 1, 1);
- evas_object_image_data_set(cw->obj, NULL);
- ecore_x_image_free(cw->xim);
- cw->xim = NULL;
- }
- if (!cw->real_obj)
- {
- evas_object_image_native_surface_set(cw->obj, NULL);
- cw->native = 0;
- }
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- if (cw->xim)
- {
- evas_object_image_size_set(o, 1, 1);
- evas_object_image_data_set(o, NULL);
- }
- evas_object_image_native_surface_set(o, NULL);
- }
- if (cw->pixmap)
- {
- ecore_x_pixmap_free(cw->pixmap);
- cw->pixmap = 0;
- cw->pw = 0;
- cw->ph = 0;
- ecore_x_e_comp_pixmap_set(cw->win, cw->pixmap);
- cw->show_ready = 0; // hmm maybe not needed?
- }
- if (cw->redirected)
- {
- // we redirect all subwindows anyway
- // ecore_x_composite_unredirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
- cw->redirected = 0;
- }
- if (cw->damage)
- {
- Ecore_X_Region parts;
-
- eina_hash_del(damages, e_util_winid_str_get(cw->damage), cw);
- parts = ecore_x_region_new(NULL, 0);
- ecore_x_damage_subtract(cw->damage, 0, parts);
- ecore_x_region_free(parts);
- ecore_x_damage_free(cw->damage);
- cw->damage = 0;
+ c->fps_fg = evas_object_text_add(c->evas);
+ evas_object_text_font_set(c->fps_fg, "Sans", 10);
+ evas_object_text_text_set(c->fps_fg, "???");
+ evas_object_color_set(c->fps_fg, 255, 255, 255, 255);
+ evas_object_layer_set(c->fps_fg, E_LAYER_MAX);
+ evas_object_name_set(c->fps_bg, "c->fps_fg");
+ evas_object_stack_above(c->fps_fg, c->fps_bg);
+ evas_object_show(c->fps_fg);
}
-}
-
-static void
-_e_comp_win_adopt(E_Comp_Win *cw)
-{
- if (!cw->damage)
- {
- cw->damage = ecore_x_damage_new
- (cw->win, ECORE_X_DAMAGE_REPORT_DELTA_RECTANGLES);
- eina_hash_add(damages, e_util_winid_str_get(cw->damage), cw);
- }
- if (!cw->update)
+ else
{
- cw->update = 1;
- cw->c->updates = eina_list_append(cw->c->updates, cw);
+ E_FREE_FUNC(c->fps_fg, evas_object_del);
+ E_FREE_FUNC(c->fps_bg, evas_object_del);
}
- cw->redirected = 1;
- if (cw->bd) e_comp_win_reshadow(cw);
- e_comp_render_update_resize(cw->up, cw->pw, cw->ph);
- e_comp_render_update_add(cw->up, 0, 0, cw->pw, cw->ph);
- _e_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0);
- _e_comp_win_render_queue(cw);
}
static void
_e_comp_cb_nocomp_begin(E_Comp *c)
{
- E_Comp_Win *cw, *cwf;
+ E_Client *ec, *ecf;
if (c->nocomp) return;
- if (c->nocomp_delay_timer)
- {
- ecore_timer_del(c->nocomp_delay_timer);
- c->nocomp_delay_timer = NULL;
- }
-
- cwf = _e_comp_fullscreen_check(c);
- if (!cwf) return;
+ E_FREE_FUNC(c->nocomp_delay_timer, ecore_timer_del);
- if (cwf->bd)
- e_border_raise(cwf->bd);
-
- EINA_INLIST_FOREACH(c->wins, cw)
- {
- _e_comp_win_release(cw);
- }
- cw = cwf;
+ ecf = _e_comp_fullscreen_check(c);
+ if (!ecf) return;
+ E_CLIENT_FOREACH(c, ec)
+ if (ec != ecf) e_client_redirected_set(ec, 0);
- INF("NOCOMP win %x effect_obj %p", cw->win, cw->effect_obj);
+ INF("NOCOMP %p: frame %p", ecf, ecf->frame);
+ c->nocomp = 1;
- _e_comp_win_release(cw);
+ evas_object_raise(ecf->frame);
+ e_client_redirected_set(ecf, 0);
- ecore_x_composite_unredirect_subwindows
- (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
- c->nocomp = 1;
- c->render_overflow = OVER_FLOW;
- ecore_x_window_hide(c->win);
- ecore_evas_manual_render_set(c->ee, EINA_TRUE);
- ecore_evas_resize(c->ee, 1, 1);
+ //ecore_evas_manual_render_set(c->ee, EINA_TRUE);
+ ecore_evas_hide(c->ee);
edje_file_cache_flush();
edje_collection_cache_flush();
evas_image_cache_flush(c->evas);
evas_font_cache_flush(c->evas);
evas_render_dump(c->evas);
- cw->nocomp = 1;
- if (cw->redirected)
- {
- // ecore_x_composite_unredirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
- cw->redirected = 0;
- }
- if (cw->update_timeout)
- {
- ecore_timer_del(cw->update_timeout);
- cw->update_timeout = NULL;
- }
- if (cw->update)
- {
- cw->update = 0;
- cw->c->updates = eina_list_remove(cw->c->updates, cw);
- }
+
DBG("JOB2...");
- _e_comp_render_queue(c);
+ e_comp_render_queue(c);
}
static void
_e_comp_cb_nocomp_end(E_Comp *c)
{
- E_Comp_Win *cw;
+ E_Client *ec;
if (!c->nocomp) return;
- ecore_x_composite_redirect_subwindows
- (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
-
INF("COMP RESUME!");
- c->nocomp = 0;
- c->render_overflow = OVER_FLOW;
- // ecore_evas_manual_render_set(c->ee, conf->lock_fps);
- ecore_evas_manual_render_set(c->ee, EINA_FALSE);
- ecore_evas_resize(c->ee, c->man->w, c->man->h);
- ecore_x_window_show(c->win);
- EINA_INLIST_FOREACH(c->wins, cw)
+ //ecore_evas_manual_render_set(c->ee, EINA_FALSE);
+ ecore_evas_show(c->ee);
+ E_CLIENT_FOREACH(c, ec)
{
- if (!cw->nocomp)
- {
- if ((cw->input_only) || (cw->invalid) || cw->real_obj) continue;
-
- if (cw->nocomp_need_update)
- {
- cw->nocomp_need_update = EINA_FALSE;
-
- e_comp_render_update_resize(cw->up, cw->pw, cw->ph);
- e_comp_render_update_add(cw->up, 0, 0, cw->pw, cw->ph);
- }
- _e_comp_win_adopt(cw);
- continue;
- }
- cw->nocomp = 0;
-
- _e_comp_win_adopt(cw);
-
- INF("restore comp %x --- %p", cw->win, cw->effect_obj);
-
- if (cw->visible)
- {
- if (!cw->hidden_override) _e_comp_child_show(cw);
- cw->pending_count++;
- _e_comp_event_source_visibility(cw);
- // no need for effect
- }
+ e_client_redirected_set(ec, 1);
+ e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
}
+ e_comp_render_queue(c);
}
static Eina_Bool
@@ -1268,31 +281,76 @@ _e_comp_cb_nocomp_begin_timeout(void *data)
return EINA_FALSE;
}
+
+static Eina_Bool
+_e_comp_client_update(E_Client *ec)
+{
+ int pw, ph;
+ Eina_Bool post = EINA_FALSE;
+
+ DBG("UPDATE [%p] pm = %p", ec, ec->pixmap);
+ if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
+
+ e_pixmap_size_get(ec->pixmap, &pw, &ph);
+
+ if (e_pixmap_dirty_get(ec->pixmap) && (!ec->comp->nocomp))
+ {
+ int w, h;
+
+ if (e_pixmap_refresh(ec->pixmap) &&
+ e_pixmap_size_get(ec->pixmap, &w, &h) &&
+ e_pixmap_size_changed(ec->pixmap, pw, ph))
+ {
+ e_pixmap_image_clear(ec->pixmap, 0);
+ post = EINA_TRUE;
+ e_comp_object_render_update_del(ec->frame); //clear update
+ }
+ else if (!e_pixmap_size_get(ec->pixmap, NULL, NULL))
+ {
+ WRN("FAIL %p", ec);
+ e_comp_object_redirected_set(ec->frame, 0);
+ if (e_pixmap_failures_get(ec->pixmap) < 3)
+ e_comp_object_render_update_add(ec->frame);
+ }
+ }
+ if (e_pixmap_size_get(ec->pixmap, &pw, &ph))
+ {
+ //INF("PX DIRTY: PX(%dx%d) CLI(%dx%d)", pw, ph, ec->client.w, ec->client.h);
+ e_pixmap_image_refresh(ec->pixmap);
+ e_comp_object_dirty(ec->frame);
+ if (!ec->override)
+ evas_object_resize(ec->frame, ec->w, ec->h);
+ }
+ return post;
+}
+
static Eina_Bool
_e_comp_cb_update(E_Comp *c)
{
- E_Comp_Win *cw;
- Eina_List *new_updates = NULL; // for failed pixmap fetches - get them next frame
+ E_Client *ec;
+ Eina_List *l;
// static int doframeinfo = -1;
if (!c) return EINA_FALSE;
- c->update_job = NULL;
+ if (c->update_job)
+ c->update_job = NULL;
+ else
+ ecore_animator_freeze(c->render_animator);
DBG("UPDATE ALL");
if (c->nocomp) goto nocomp;
- if (conf->grab)
+ if (conf->grab && (!c->grabbed))
{
- ecore_x_grab();
- ecore_x_sync();
+ if (c->grab_cb) c->grab_cb(c);
c->grabbed = 1;
}
- EINA_LIST_FREE(c->updates, cw)
+ l = c->updates;
+ c->updates = NULL;
+ EINA_LIST_FREE(l, ec)
{
- _e_comp_win_update(cw);
- if (cw->update)
- {
- new_updates = eina_list_append(new_updates, cw);
- }
- if (cw->geom_update) _e_comp_win_geometry_update(cw);
+ /* clear update flag */
+ e_comp_object_render_update_del(ec->frame);
+ if (_e_comp_client_update(ec))
+ c->post_updates = eina_list_append(c->post_updates, ec);
}
_e_comp_fps_update(c);
if (conf->fps_show)
@@ -1325,7 +383,7 @@ _e_comp_cb_update(E_Comp *c)
evas_object_geometry_get(c->fps_fg, NULL, NULL, &w, &h);
w += 8;
h += 8;
- z = e_util_zone_current_get(c->man);
+ z = e_zone_current_get(c);
if (z)
{
switch (conf->fps_corner)
@@ -1344,7 +402,6 @@ _e_comp_cb_update(E_Comp *c)
x = z->x + z->w - w;
y = z->y;
break;
-
default: // 0 // top-left
x = z->x;
y = z->y;
@@ -1360,24 +417,14 @@ _e_comp_cb_update(E_Comp *c)
DBG("MANUAL RENDER...");
// if (!c->nocomp) ecore_evas_manual_render(c->ee);
}
- if (conf->grab)
- {
- if (c->grabbed)
- {
- c->grabbed = 0;
- ecore_x_ungrab();
- }
- }
- if (new_updates)
+
+ if (conf->grab && c->grabbed)
{
- DBG("JOB1...");
- if (c->new_up_timer) ecore_timer_del(c->new_up_timer);
- c->new_up_timer =
- ecore_timer_add(0.001, _e_comp_cb_delayed_update_timer, c);
- // _e_comp_render_queue(c);
+ if (c->grab_cb) c->grab_cb(c);
+ c->grabbed = 0;
}
- c->updates = new_updates;
- if (!c->animating) c->render_overflow--;
+ if (c->updates && (!c->update_job))
+ ecore_animator_thaw(c->render_animator);
/*
if (doframeinfo == -1)
{
@@ -1403,38 +450,26 @@ _e_comp_cb_update(E_Comp *c)
}
*/
nocomp:
- cw = _e_comp_fullscreen_check(c);
- if (cw)
+ ec = _e_comp_fullscreen_check(c);
+ if (ec)
{
if (conf->nocomp_fs)
{
if ((!c->nocomp) && (!c->nocomp_override > 0))
{
if (!c->nocomp_delay_timer)
- c->nocomp_delay_timer = ecore_timer_add
- (1.0, _e_comp_cb_nocomp_begin_timeout, c);
+ c->nocomp_delay_timer = ecore_timer_add(1.0, _e_comp_cb_nocomp_begin_timeout, c);
}
}
}
else
{
c->nocomp_want = 0;
- if (c->nocomp_delay_timer)
- {
- ecore_timer_del(c->nocomp_delay_timer);
- c->nocomp_delay_timer = NULL;
- }
+ E_FREE_FUNC(c->nocomp_delay_timer, ecore_timer_del);
if (c->nocomp)
_e_comp_cb_nocomp_end(c);
}
- DBG("UPDATE ALL DONE: overflow = %i", c->render_overflow);
- if (c->render_overflow <= 0)
- {
- c->render_overflow = 0;
- if (c->render_animator) c->render_animator = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
return ECORE_CALLBACK_RENEW;
}
@@ -1451,2121 +486,19 @@ _e_comp_cb_animator(void *data)
return _e_comp_cb_update(data);
}
-static void
-_e_comp_render_queue(E_Comp *c)
-{
- /* FIXME workaround */
- if (!c) return;
-
- if (conf->lock_fps)
- {
- if (c->render_animator)
- {
- c->render_overflow = OVER_FLOW;
- return;
- }
- c->render_animator = ecore_animator_add(_e_comp_cb_animator, c);
- }
- else
- {
- if (c->update_job)
- {
- DBG("UPDATE JOB DEL...");
- ecore_job_del(c->update_job);
- c->update_job = NULL;
- c->render_overflow = 0;
- }
- DBG("UPDATE JOB ADD...");
- c->update_job = ecore_job_add(_e_comp_cb_job, c);
- }
-}
-
-static void
-_e_comp_win_render_queue(E_Comp_Win *cw)
-{
- if (cw->real_obj) return;
- DBG("JOB3...");
- _e_comp_render_queue(cw->c);
-}
-
-static E_Comp *
-_e_comp_find(Ecore_X_Window root)
-{
- Eina_List *l;
- E_Comp *c;
-
- // fixme: use hash if compositors list > 4
- EINA_LIST_FOREACH(compositors, l, c)
- {
- if (c->man->root == root) return c;
- }
- return NULL;
-}
-
-static E_Comp_Win *
-_e_comp_win_find(Ecore_X_Window win)
-{
- return eina_hash_find(windows, e_util_winid_str_get(win));
-}
-
-static E_Comp_Win *
-_e_comp_border_client_find(Ecore_X_Window win)
-{
- return eina_hash_find(borders, e_util_winid_str_get(win));
-}
-
-static E_Comp_Win *
-_e_comp_win_damage_find(Ecore_X_Damage damage)
-{
- return eina_hash_find(damages, e_util_winid_str_get(damage));
-}
-
-static Eina_Bool
-_e_comp_ignore_find(Ecore_X_Window win)
-{
- return !!eina_hash_find(ignores, e_util_winid_str_get(win));
-}
-
-static Eina_Bool
-_e_comp_win_is_borderless(E_Comp_Win *cw)
-{
- if (!cw->bd) return 1;
- if ((cw->bd->client.border.name) &&
- (!strcmp(cw->bd->client.border.name, "borderless")))
- return 1;
- return 0;
-}
-
-static Eina_Bool
-_e_comp_win_do_shadow(E_Comp_Win *cw)
-{
- if (cw->shaped) return 0;
- if (cw->bd && cw->bd->theme_shadow) return 0;
- if (cw->real_obj)
- {
- return ((!!cw->pop) || (!!cw->menu));
- }
- if (cw->argb)
- {
- if (_e_comp_win_is_borderless(cw)) return 0;
- }
- return 1;
-}
-
-static void
-_e_comp_object_del(void *data, void *obj)
-{
- E_Comp_Win *cw = data;
-
- if (!cw) return;
-
- _e_comp_win_render_queue(cw);
- if (obj == cw->bd)
- {
- if (cw->bd) eina_hash_del(borders, e_util_winid_str_get(cw->bd->client.win), cw);
- cw->bd->cw = NULL;
- cw->bd = NULL;
- evas_object_data_del(cw->shobj, "border");
- }
- else if (obj == cw->pop)
- {
- cw->pop->cw = NULL;
- cw->pop = NULL;
- evas_object_data_del(cw->shobj, "popup");
- }
- else if (obj == cw->menu)
- {
- cw->menu->cw = NULL;
- cw->menu = NULL;
- evas_object_data_del(cw->shobj, "menu");
- }
- if (cw->dfn)
- {
- e_object_delfn_del(obj, cw->dfn);
- cw->dfn = NULL;
- }
- cw->eobj = NULL;
- e_comp_win_del(cw);
-}
-
-static void
-_e_comp_done_defer(E_Comp_Win *cw)
-{
- if (cw->animating)
- {
- cw->c->animating--;
- }
- cw->animating = 0;
- if (cw->visible && cw->win && cw->real_hid)
- {
- /* window show event occurred during hide animation */
- //INF("UNSETTING real_hid %p:%u", cw, cw->win);
- _e_comp_win_damage(cw, cw->x, cw->y, cw->w, cw->h, 0);
- _e_comp_child_hide(cw);
- cw->real_hid = 0;
- }
- _e_comp_win_render_queue(cw);
- cw->force = 1;
- if (cw->defer_hide) _e_comp_win_hide(cw);
- cw->force = 1;
- if (cw->delete_me)
- {
-// if (cw->real_obj && cw->eobj)
-// e_object_unref(E_OBJECT(cw->eobj));
- _e_comp_win_del(cw);
- }
- else cw->force = 0;
-}
-
-static void
-_e_comp_show_done(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
-{
- E_Comp_Win *cw = data;
- _e_comp_done_defer(cw);
-}
-
-static void
-_e_comp_hide_done(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
-{
- E_Comp_Win *cw = data;
- _e_comp_done_defer(cw);
-}
-
-static void
-_e_comp_win_shadow_setup(E_Comp_Win *cw)
-{
- Evas_Object *o;
- int ok = 0;
- char buf[4096];
- Eina_List *list = NULL, *l;
- E_Comp_Match *m;
- Eina_Stringshare *reshadow_group = NULL;
- Eina_Bool focus = EINA_FALSE, urgent = EINA_FALSE, skip = EINA_FALSE, fast = EINA_FALSE, reshadow, no_shadow = EINA_FALSE;
- const char *title = NULL, *name = NULL, *clas = NULL, *role = NULL;
- Ecore_X_Window_Type primary_type = ECORE_X_WINDOW_TYPE_UNKNOWN;
-
- edje_object_file_get(cw->shobj, NULL, &reshadow_group);
- if (!cw->real_obj)
- evas_object_image_smooth_scale_set(cw->obj, conf->smooth_windows);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_smooth_scale_set(o, conf->smooth_windows);
- }
- if (cw->bd)
- {
- list = conf->match.borders;
- title = cw->bd->client.icccm.title;
- if (cw->bd->client.netwm.name) title = cw->bd->client.netwm.name;
- name = cw->bd->client.icccm.name;
- clas = cw->bd->client.icccm.class;
- role = cw->bd->client.icccm.window_role;
- primary_type = cw->bd->client.netwm.type;
- skip = (conf->match.disable_borders);
- fast = conf->fast_borders;
- }
- else if (cw->pop)
- {
- // FIXME: i only added "shelf" as a name for popups that are shelves
- // ... need more nmes like for pager popup, evertything, exebuf
- // etc. etc.
- list = conf->match.popups;
- name = cw->pop->name;
- skip = conf->match.disable_popups;
- if (cw->pop->name && (!skip))
- skip = (!strncmp(cw->pop->name, "noshadow", 8));
- fast = conf->fast_popups;
- }
- else if (cw->menu)
- {
- // FIXME: e has no way to tell e menus apart... need naming
- list = conf->match.menus;
- skip = (conf->match.disable_menus);
- fast = conf->fast_menus;
- }
- else if (cw->real_obj)
- {
- list = conf->match.objects;
- name = evas_object_name_get(cw->obj);
- //skip = conf->match.disable_objects;
- skip = 1;
- fast = conf->fast_objects;
- }
- else
- {
- list = conf->match.overrides;
- title = cw->title;
- name = cw->name;
- clas = cw->clas;
- role = cw->role;
- primary_type = cw->primary_type;
- skip = conf->match.disable_overrides || (title && (!strncmp(title, "noshadow", 8)));
- fast = conf->fast_overrides;
- }
-
- if (!skip)
- {
- EINA_LIST_FOREACH(list, l, m)
- {
- if (((m->title) && (!title)) ||
- ((title) && (m->title) && (!e_util_glob_match(title, m->title))))
- continue;
- if (((m->name) && (!name)) ||
- ((name) && (m->name) && (!e_util_glob_match(name, m->name))))
- continue;
- if (((m->clas) && (!clas)) ||
- ((clas) && (m->clas) && (!e_util_glob_match(clas, m->clas))))
- continue;
- if (((m->role) && (!role)) ||
- ((role) && (m->role) && (!e_util_glob_match(role, m->role))))
- continue;
- if ((primary_type != ECORE_X_WINDOW_TYPE_UNKNOWN) &&
- (m->primary_type != ECORE_X_WINDOW_TYPE_UNKNOWN) &&
- ((int)primary_type != m->primary_type))
- continue;
- if (cw->bd)
- {
- if (m->borderless != 0)
- {
- int borderless = 0;
-
- if ((cw->bd->client.mwm.borderless) || (cw->bd->borderless))
- borderless = 1;
- if (!(((m->borderless == -1) && (!borderless)) ||
- ((m->borderless == 1) && (borderless))))
- continue;
- }
- if (m->dialog != 0)
- {
- int dialog = 0;
-
- if (((cw->bd->client.icccm.transient_for != 0) ||
- (cw->bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)))
- dialog = 1;
- if (!(((m->dialog == -1) && (!dialog)) ||
- ((m->dialog == 1) && (dialog))))
- continue;
- }
- if (m->accepts_focus != 0)
- {
- int accepts_focus = 0;
-
- if (cw->bd->client.icccm.accepts_focus)
- accepts_focus = 1;
- if (!(((m->accepts_focus == -1) && (!accepts_focus)) ||
- ((m->accepts_focus == 1) && (accepts_focus))))
- continue;
- }
- if (m->vkbd != 0)
- {
- int vkbd = 0;
-
- if (cw->bd->client.vkbd.vkbd)
- vkbd = 1;
- if (!(((m->vkbd == -1) && (!vkbd)) ||
- ((m->vkbd == 1) && (vkbd))))
- continue;
- }
- if (m->quickpanel != 0)
- {
- int quickpanel = 0;
-
- if (cw->bd->client.illume.quickpanel.quickpanel)
- quickpanel = 1;
- if (!(((m->quickpanel == -1) && (!quickpanel)) ||
- ((m->quickpanel == 1) && (quickpanel))))
- continue;
- }
- if (m->argb != 0)
- {
- if (!(((m->argb == -1) && (!cw->argb)) ||
- ((m->argb == 1) && (cw->argb))))
- continue;
- }
- if (m->fullscreen != 0)
- {
- int fullscreen = 0;
-
- if (cw->bd->client.netwm.state.fullscreen)
- fullscreen = 1;
- if (!(((m->fullscreen == -1) && (!fullscreen)) ||
- ((m->fullscreen == 1) && (fullscreen))))
- continue;
- }
- if (m->modal != 0)
- {
- int modal = 0;
-
- if (cw->bd->client.netwm.state.modal)
- modal = 1;
- if (!(((m->modal == -1) && (!modal)) ||
- ((m->modal == 1) && (modal))))
- continue;
- }
- }
- focus = m->focus;
- urgent = m->urgent;
- no_shadow = m->no_shadow;
- if (m->shadow_style)
- {
- if (fast)
- {
- snprintf(buf, sizeof(buf), "e/comp/border/%s/fast", m->shadow_style);
- reshadow = ok = !e_util_strcmp(reshadow_group, buf);
- if (!ok)
- ok = e_theme_edje_object_set(cw->shobj, "base/theme/borders", buf);
- }
- if (!ok)
- {
- snprintf(buf, sizeof(buf), "e/comp/border/%s", m->shadow_style);
- reshadow = ok = !e_util_strcmp(reshadow_group, buf);
- if (!ok)
- ok = e_theme_edje_object_set(cw->shobj, "base/theme/borders", buf);
- }
- if (ok) break;
- }
- }
- }
- while (!ok)
- {
- if (skip || (cw->bd && cw->bd->client.e.state.video))
- {
- reshadow = ok = !e_util_strcmp(reshadow_group, "e/comp/border/none");
- if (!ok)
- ok = e_theme_edje_object_set(cw->shobj, "base/theme/borders", "e/comp/border/none");
- }
- if (ok) break;
- if (conf->shadow_style)
- {
- if (fast)
- {
- snprintf(buf, sizeof(buf), "e/comp/border/%s/fast", conf->shadow_style);
- reshadow = ok = !e_util_strcmp(reshadow_group, buf);
- if (!ok)
- ok = e_theme_edje_object_set(cw->shobj, "base/theme/borders", buf);
- }
- if (!ok)
- {
- snprintf(buf, sizeof(buf), "e/comp/border/%s", conf->shadow_style);
- reshadow = ok = !e_util_strcmp(reshadow_group, buf);
- if (!ok)
- ok = e_theme_edje_object_set(cw->shobj, "base/theme/borders", buf);
- }
- }
- if (!ok)
- {
- if (fast)
- {
- reshadow = ok = !e_util_strcmp(reshadow_group, "e/comp/border/default/fast");
- if (!ok)
- ok = e_theme_edje_object_set(cw->shobj, "base/theme/borders", "e/comp/border/default/fast");
- }
- if (!ok)
- {
- reshadow = ok = !e_util_strcmp(reshadow_group, "e/comp/border/default");
- if (!ok)
- ok = e_theme_edje_object_set(cw->shobj, "base/theme/borders", "e/comp/border/default");
- }
- }
- break;
- }
- if (reshadow)
- {
- if (!cw->bd) return;
-#ifdef BORDER_ZOOMAPS
- if (cw->bd->bg_object && (e_zoomap_child_get(cw->zoomobj) == cw->bd->bg_object))
-#else
- if (cw->bd->bg_object && (edje_object_part_swallow_get(cw->shobj, "e.swallow.content") == cw->bd->bg_object))
-#endif
- return;
- }
- if (_e_comp_win_do_shadow(cw) && (!no_shadow))
- edje_object_signal_emit(cw->shobj, "e,state,shadow,on", "e");
- else
- edje_object_signal_emit(cw->shobj, "e,state,shadow,off", "e");
-
- if (cw->bd)
- {
- if (focus || (cw->bd && cw->bd->focused))
- edje_object_signal_emit(cw->shobj, "e,state,focus,on", "e");
- else
- edje_object_signal_emit(cw->shobj, "e,state,focus,off", "e");
- if (urgent || (cw->bd && cw->bd->client.icccm.urgent))
- edje_object_signal_emit(cw->shobj, "e,state,urgent,on", "e");
- else
- edje_object_signal_emit(cw->shobj, "e,state,urgent,off", "e");
- }
- if (cw->visible)
- edje_object_signal_emit(cw->shobj, "e,state,visible,on", "e");
- else
- edje_object_signal_emit(cw->shobj, "e,state,visible,off", "e");
-
-#ifndef BORDER_ZOOMAPS
- if (cw->eobj)
-#endif
- e_zoomap_child_set(cw->zoomobj, NULL);
- if (cw->bd && cw->bd->bg_object)
- {
- edje_object_part_swallow(cw->bd->bg_object, "e.swallow.client", cw->obj);
-#ifdef BORDER_ZOOMAPS
- e_zoomap_child_set(cw->zoomobj, cw->bd->bg_object);
-#else
- edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->bd->bg_object);
-#endif
- no_shadow = 1;
- }
- else
- {
- if (cw->bd) no_shadow = 1;
-#ifdef BORDER_ZOOMAPS
- e_zoomap_child_set(cw->zoomobj, cw->obj);
-#else
- if (cw->zoomobj)
- {
- e_zoomap_child_set(cw->zoomobj, cw->obj);
- edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->zoomobj);
- }
- else
- edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->obj);
-#endif
- }
- if (cw->menu
-#ifdef BORDER_ZOOMAPS
- || cw->bd
-#endif
- )
- e_zoomap_child_edje_solid_setup(cw->zoomobj);
-#ifdef BORDER_ZOOMAPS
- edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->zoomobj);
-#endif
- if (!cw->visible) return;
-
- if (!cw->animating)
- {
- cw->c->animating++;
- }
- cw->animating = 1;
- _e_comp_win_render_queue(cw);
- cw->pending_count++;
- _e_comp_event_source_visibility(cw);
-}
-
-static void
-_e_comp_cb_win_mirror_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
-{
- E_Comp_Win *cw;
-
- if (!(cw = data)) return;
- cw->obj_mirror = eina_list_remove(cw->obj_mirror, obj);
-}
-
-static Evas_Object *
-_e_comp_win_mirror_add(E_Comp_Win *cw)
-{
- Evas_Object *o;
- int w, h;
-
- EINA_SAFETY_ON_TRUE_RETURN_VAL(((!cw->pixmap) || (!cw->pw) || (!cw->ph)) && (!cw->real_obj) && ((!cw->w) || (!cw->h)), NULL);
-
- o = evas_object_image_filled_add(cw->c->evas);
- evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
- cw->obj_mirror = eina_list_append(cw->obj_mirror, o);
- evas_object_image_smooth_scale_set(o, conf->smooth_windows);
-
- evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _e_comp_cb_win_mirror_del, cw);
-
- if ((cw->pixmap) && (cw->pw > 0) && (cw->ph > 0))
- {
- unsigned int *pix = NULL;
- Eina_Bool alpha, argb = EINA_FALSE;
-
- alpha = evas_object_image_alpha_get(cw->obj);
- w = cw->pw, h = cw->ph;
-
- evas_object_image_alpha_set(o, alpha);
- evas_object_image_size_set(o, w, h);
-
- if (cw->shaped)
- pix = evas_object_image_data_get(cw->obj, 0);
- else
- {
- if (cw->native)
- {
- Evas_Native_Surface ns;
-
- ns.version = EVAS_NATIVE_SURFACE_VERSION;
- ns.type = EVAS_NATIVE_SURFACE_X11;
- ns.data.x11.visual = cw->vis;
- ns.data.x11.pixmap = cw->pixmap;
- evas_object_image_native_surface_set(o, &ns);
- }
- else if (cw->xim)
- {
- argb = ecore_x_image_is_argb32_get(cw->xim);
- if (argb)
- pix = ecore_x_image_data_get(cw->xim, NULL, NULL, NULL);
- else
- pix = evas_object_image_data_get(cw->obj, EINA_FALSE);
- }
- }
- if (pix)
- {
- evas_object_image_data_set(o, pix);
- if (!argb)
- evas_object_image_data_set(cw->obj, pix);
- }
- }
- else if (cw->real_obj)
- {
- /* FIXME: the first mirror shown with vsync enabled won't render immediately */
- evas_object_image_alpha_set(o, 1);
- evas_object_geometry_get(cw->zoomobj ?: cw->obj, NULL, NULL, &w, &h);
- evas_object_image_source_set(o, cw->zoomobj ?: cw->obj);
- }
- evas_object_image_data_update_add(o, 0, 0, w, h);
- return o;
-}
-
-static E_Comp_Win *
-_e_comp_win_dummy_add(E_Comp *c, Evas_Object *obj, E_Object *eobj, Eina_Bool nolayout)
-{
- E_Comp_Win *cw;
- int x, y, w, h;
-
- cw = calloc(1, sizeof(E_Comp_Win));
- if (!cw) return NULL;
- cw->not_in_layout = nolayout;
- if (eobj)
- {
- switch (eobj->type)
- {
- case E_POPUP_TYPE:
- cw->pop = (void*)eobj;
- cw->pop->cw = cw;
- cw->shape = cw->pop->shape;
- cw->dfn = e_object_delfn_add(E_OBJECT(cw->pop), _e_comp_object_del, cw);
- cw->show_ready = cw->pop->visible;
- break;
- case E_MENU_TYPE:
- cw->menu = (void*)eobj;
- cw->menu->cw = cw;
- cw->shape = cw->menu->shape;
- cw->dfn = e_object_delfn_add(E_OBJECT(cw->menu), _e_comp_object_del, cw);
- cw->show_ready = cw->menu->cur.visible;
- break;
- default:
- CRI("UNHANDLED");
- }
- cw->eobj = eobj;
- e_object_ref(E_OBJECT(cw->eobj));
- }
- else
- cw->show_ready = evas_object_visible_get(obj);
-
- cw->obj = obj;
- cw->c = c;
- cw->real_hid = !cw->show_ready;
- cw->real_obj = 1;
- cw->argb = 1;
- cw->opacity = 255.0;
- if (cw->shape) cw->shape->comp_win = cw;
- if (conf->grab) ecore_x_grab();
-
- evas_object_geometry_get(obj, &x, &y, &w, &h);
-
- cw->effect_obj = edje_object_add(c->evas);
- e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", "e/comp/effects/none");
- cw->shobj = edje_object_add(c->evas);
- if (cw->eobj)
- {
- cw->zoomobj = e_zoomap_add(c->evas);
- e_zoomap_smooth_set(cw->zoomobj, conf->smooth_windows);
- }
- _e_comp_win_shadow_setup(cw);
- edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj);
-
- edje_object_signal_callback_add(cw->shobj, "e,action,show,done", "e", _e_comp_show_done, cw);
- edje_object_signal_callback_add(cw->shobj, "e,action,hide,done", "e", _e_comp_hide_done, cw);
-
- _e_comp_win_configure(cw, x, y, w, h, 0);
-
- if (!nolayout) _e_comp_win_layout_populate(cw);
-
- if (cw->pop)
- {
- e_zoomap_always_set(cw->zoomobj, EINA_TRUE);
- evas_object_data_set(cw->shobj, "popup", cw->pop);
- evas_object_data_set(cw->effect_obj, "popup", cw->pop);
- evas_object_name_set(cw->zoomobj, "cw->zoomobj::POPUP");
- evas_object_name_set(cw->shobj, "cw->shobj::POPUP");
- evas_object_name_set(cw->effect_obj, "cw->effect_obj::POPUP");
- }
- else if (cw->menu)
- {
- e_zoomap_always_set(cw->zoomobj, EINA_TRUE);
- evas_object_data_set(cw->shobj, "menu", cw->menu);
- evas_object_data_set(cw->effect_obj, "menu", cw->menu);
- evas_object_name_set(cw->zoomobj, "cw->zoomobj::MENU");
- evas_object_name_set(cw->shobj, "cw->shobj::MENU");
- evas_object_name_set(cw->effect_obj, "cw->effect_obj::MENU");
- }
-
- cw->pending_count++;
- _e_comp_event_source_add(cw);
- evas_object_data_set(cw->effect_obj, "comp_win", cw);
- evas_object_data_set(cw->shobj, "comp_win", cw);
- evas_object_data_set(cw->obj, "comp_win", cw);
-
- c->wins_invalid = 1;
- c->wins = eina_inlist_append(c->wins, EINA_INLIST_GET(cw));
- DBG(" [0x%x] add", cw->win);
- if (conf->grab) ecore_x_ungrab();
- if (cw->show_ready) _e_comp_win_show(cw);
- return cw;
-}
-
-static void
-_e_comp_win_bd_setup(E_Comp_Win *cw, E_Border *bd)
-{
- cw->bd = bd;
- eina_hash_add(borders, e_util_winid_str_get(cw->bd->client.win), cw);
- cw->dfn = e_object_delfn_add(E_OBJECT(cw->bd), _e_comp_object_del, cw);
- E_FREE_FUNC(cw->shape, e_object_del);
- if (cw->effect_obj) evas_object_pass_events_set(cw->effect_obj, 0);
- cw->free_shape = 0;
- cw->win = bd->win;
- cw->shape = cw->bd->shape;
- cw->bd->cw = cw;
- cw->opacity = cw->bd->client.netwm.opacity;
- cw->eobj = E_OBJECT(cw->bd);
- e_object_ref(cw->eobj);
- cw->input_only = cw->bd->client.initial_attributes.input_only;
- cw->override = cw->bd->client.initial_attributes.override;
- cw->vis = cw->bd->client.initial_attributes.visual;
- cw->cmap = cw->bd->client.initial_attributes.colormap;
- cw->depth = cw->bd->client.initial_attributes.depth;
-}
-
-static void
-_e_comp_win_shape_init(E_Comp_Win *cw, int w, int h)
-{
- int i;
-
- if (!cw->shape) return;
- for (i = 0; i < cw->shape->shape_rects_num; i++)
- E_RECTS_CLIP_TO_RECT(cw->shape->shape_rects[i].x, cw->shape->shape_rects[i].y,
- cw->shape->shape_rects[i].w, cw->shape->shape_rects[i].h, 0, 0, w, h);
-
- if (_e_comp_shaped_check(w, h, cw->shape->shape_rects, cw->shape->shape_rects_num))
- cw->shape_changed = 1;
-}
-
-static E_Comp_Win *
-_e_comp_win_add(E_Comp *c, Ecore_X_Window win, E_Border *bd)
-{
- E_Comp_Win *cw;
- int x = 0, y = 0, w, h, border = 0;
-
- cw = calloc(1, sizeof(E_Comp_Win));
- if (!cw) return NULL;
- cw->win = win;
- cw->c = c;
- cw->real_hid = !bd;
- cw->opacity = 255.0;
- if (conf->grab) ecore_x_grab();
- if (bd)
- {
- _e_comp_win_bd_setup(cw, bd);
- w = cw->bd->client.w, h = cw->bd->client.h;
- }
- else
- {
- Ecore_X_Window_Attributes att;
- char *netwm_title = NULL;
-
- memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
- if (!ecore_x_window_attributes_get(cw->win, &att))
- {
- free(cw);
- if (conf->grab) ecore_x_ungrab();
- return NULL;
- }
- if ((!att.input_only) &&
- ((att.depth != 24) && (att.depth != 32)))
- {
- // printf("WARNING: window 0x%x not 24/32bpp -> %ibpp", cw->win, att.depth);
- // cw->invalid = 1;
- }
- cw->input_only = att.input_only;
- cw->override = att.override;
- cw->vis = att.visual;
- cw->cmap = att.colormap;
- cw->depth = att.depth;
- w = att.w, h = att.h, border = att.border;
- x = att.x, y = att.y;
-
- if (cw->override && (!(att.event_mask.mine & ECORE_X_EVENT_MASK_WINDOW_PROPERTY)))
- ecore_x_event_mask_set(cw->win, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
-
- cw->title = ecore_x_icccm_title_get(cw->win);
- if (ecore_x_netwm_name_get(cw->win, &netwm_title))
- {
- free(cw->title);
- cw->title = netwm_title;
- }
- ecore_x_icccm_name_class_get(cw->win, &cw->name, &cw->clas);
- cw->role = ecore_x_icccm_window_role_get(cw->win);
- if (!ecore_x_netwm_window_type_get(cw->win, &cw->primary_type))
- cw->primary_type = ECORE_X_WINDOW_TYPE_UNKNOWN;
- {
- E_Container *con;
-
- con = e_util_container_current_get();
- cw->bg_win = (con && (cw->win == con->bg_win));
- }
- cw->free_shape = 1;
- _e_comp_win_shape_create(cw, x, y, w, h);
- }
-
- if (cw->bd)
- cw->argb = cw->bd->client.argb;
- else
- cw->argb = ecore_x_window_argb_get(cw->win);
- eina_hash_add(windows, e_util_winid_str_get(cw->win), cw);
- cw->inhash = 1;
- if ((!cw->input_only) && (!cw->invalid))
- {
- cw->damage = ecore_x_damage_new
- (cw->win, ECORE_X_DAMAGE_REPORT_DELTA_RECTANGLES);
- eina_hash_add(damages, e_util_winid_str_get(cw->damage), cw);
- cw->effect_obj = edje_object_add(c->evas);
- e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", "e/comp/effects/none");
- cw->shobj = edje_object_add(c->evas);
-#ifdef BORDER_ZOOMAPS
- cw->zoomobj = e_zoomap_add(c->evas);
- e_zoomap_smooth_set(cw->zoomobj, conf->smooth_windows);
-#endif
- cw->obj = evas_object_image_filled_add(c->evas);
- evas_object_image_colorspace_set(cw->obj, EVAS_COLORSPACE_ARGB8888);
- if (cw->argb) evas_object_image_alpha_set(cw->obj, 1);
- else evas_object_image_alpha_set(cw->obj, 0);
-
- _e_comp_win_shadow_setup(cw);
- edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj);
-
- edje_object_signal_callback_add(cw->shobj, "e,action,show,done", "e", _e_comp_show_done, cw);
- edje_object_signal_callback_add(cw->shobj, "e,action,hide,done", "e", _e_comp_hide_done, cw);
- evas_object_precise_is_inside_set(cw->obj, cw->shaped);
-
- _e_comp_win_layout_populate(cw);
-
- evas_object_show(cw->obj);
- ecore_x_window_shape_events_select(cw->win, 1);
-
- if (cw->bd)
- {
- _e_comp_win_shape_init(cw, w, h);
- evas_object_data_set(cw->shobj, "border", cw->bd);
- evas_object_data_set(cw->effect_obj, "border", cw->bd);
-#ifdef BORDER_ZOOMAPS
- evas_object_name_set(cw->zoomobj, "cw->zoomobj::BORDER");
-#endif
- evas_object_name_set(cw->shobj, "cw->shobj::BORDER");
- evas_object_name_set(cw->effect_obj, "cw->effect_obj::BORDER");
- }
- else
- {
-#ifdef BORDER_ZOOMAPS
- evas_object_name_set(cw->zoomobj, "cw->zoomobj::WINDOW");
-#endif
- evas_object_name_set(cw->shobj, "cw->shobj::WINDOW");
- evas_object_name_set(cw->effect_obj, "cw->effect_obj::WINDOW");
- }
-
- evas_object_name_set(cw->obj, "cw->obj");
-
- cw->pending_count++;
- _e_comp_event_source_add(cw);
- cw->up = e_comp_render_update_new();
- e_comp_render_update_tile_size_set(cw->up, 32, 32);
- // for software:
- e_comp_render_update_policy_set
- (cw->up, E_COMP_RENDER_UPDATE_POLICY_HALF_WIDTH_OR_MORE_ROUND_UP_TO_FULL_WIDTH);
- }
- else
- {
- cw->effect_obj = evas_object_rectangle_add(c->evas);
- _e_comp_win_layout_populate(cw);
-
- evas_object_color_set(cw->effect_obj, 0, 0, 0, 0);
- }
- if (cw->shobj) evas_object_data_set(cw->shobj, "comp_win", cw);
- evas_object_data_set(cw->effect_obj, "comp_win", cw);
-
- c->wins_invalid = 1;
- c->wins = eina_inlist_append(c->wins, EINA_INLIST_GET(cw));
-
- if (((!cw->input_only) && (!cw->invalid)) && (cw->override))
- {
- cw->redirected = 1;
- // we redirect all subwindows anyway
- // ecore_x_composite_redirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
- cw->dmg_updates = 0;
- }
- if (cw->bd)
- {
- e_comp_win_opacity_set(cw, cw->opacity);
- border = cw->bd->client.initial_attributes.border;
- x = cw->bd->x, y = cw->bd->y, w = cw->bd->w, h = cw->bd->h;
- }
- _e_comp_win_configure(cw, x, y, w, h, border);
- DBG(" [0x%x] add", cw->win);
- if (conf->grab) ecore_x_ungrab();
- return cw;
-}
-
-static void
-_e_comp_win_del(E_Comp_Win *cw)
-{
- Evas_Object *o;
-
- if (cw->eobj)
- {
- e_object_unref(E_OBJECT(cw->eobj));
- cw->eobj = NULL;
- }
- E_FREE_FUNC(cw->opacity_set_timer, ecore_timer_del);
- if (cw->animating)
- {
- cw->c->animating--;
- }
- cw->animating = 0;
- if (cw->cw_above)
- {
- cw->cw_above->stack_below = eina_list_remove(cw->cw_above->stack_below, cw);
- cw->cw_above = NULL;
- }
- if (cw->stack_below)
- {
- E_Comp_Win *cw2, *cwn = NULL;
- Eina_List *l;
-
- if (EINA_INLIST_GET(cw)->next)
- cwn = EINA_INLIST_CONTAINER_GET(EINA_INLIST_GET(cw)->next, E_Comp_Win);
- else if (EINA_INLIST_GET(cw)->prev)
- cwn = EINA_INLIST_CONTAINER_GET(EINA_INLIST_GET(cw)->prev, E_Comp_Win);
-
- if (cwn)
- {
- cwn->stack_below = cw->stack_below;
- cw->stack_below = NULL;
- EINA_LIST_FOREACH(cwn->stack_below, l, cw2)
- cw2->cw_above = cwn;
- _e_comp_win_restack(cwn);
- }
- else
- {
- EINA_LIST_FREE(cw->stack_below, cw2)
- cw2->cw_above = NULL;
- }
- }
-
- E_FREE_FUNC(cw->up, e_comp_render_update_free);
- DBG(" [0x%x] del", cw->win);
- if (cw->update_timeout)
- {
- ecore_timer_del(cw->update_timeout);
- cw->update_timeout = NULL;
- }
- if (cw->ready_timeout)
- {
- ecore_timer_del(cw->ready_timeout);
- cw->ready_timeout = NULL;
- }
- if (cw->dfn)
- {
- if (cw->bd)
- {
- eina_hash_del(borders, e_util_winid_str_get(cw->bd->client.win), cw);
- e_object_delfn_del(E_OBJECT(cw->bd), cw->dfn);
- cw->bd->cw = NULL;
- cw->bd = NULL;
- }
- else if (cw->pop)
- {
- cw->pop->cw = NULL;
- e_object_delfn_del(E_OBJECT(cw->pop), cw->dfn);
- cw->pop = NULL;
- }
- else if (cw->menu)
- {
- e_object_delfn_del(E_OBJECT(cw->menu), cw->dfn);
- cw->menu->cw = NULL;
- cw->menu = NULL;
- }
- cw->dfn = NULL;
- }
- if (cw->update)
- {
- cw->update = 0;
- cw->c->updates = eina_list_remove(cw->c->updates, cw);
- }
-
- _e_comp_win_release(cw);
-
- if (cw->inhash)
- eina_hash_del(windows, e_util_winid_str_get(cw->win), cw);
- cw->inhash = 0;
-
- if (!cw->delete_pending)
- {
- cw->c->wins_invalid = 1;
- cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
- }
- if ((!cw->delete_pending) && (!cw->input_only) && (!cw->invalid))
- {
- cw->pending_count++;
- _e_comp_event_source_del(cw);
- cw->delete_pending = 1;
- return;
- }
- if (cw->pending_count) return;
- if (cw->obj_mirror)
- {
- EINA_LIST_FREE(cw->obj_mirror, o)
- {
- if (cw->xim) evas_object_image_data_set(o, NULL);
- evas_object_event_callback_del(o, EVAS_CALLBACK_DEL, _e_comp_cb_win_mirror_del);
- evas_object_del(o);
- }
- }
- if (cw->real_obj && cw->obj)
- {
- if (evas_object_layer_get(cw->obj) > E_COMP_CANVAS_LAYER_LAYOUT)
- e_comp_override_del(cw->c);
- evas_object_event_callback_del_full(cw->obj, EVAS_CALLBACK_DEL, _e_comp_injected_win_del_cb, cw);
- evas_object_event_callback_del_full(cw->obj, EVAS_CALLBACK_HIDE, _e_comp_injected_win_hide_cb, cw);
- evas_object_event_callback_del_full(cw->obj, EVAS_CALLBACK_FOCUS_IN, _e_comp_injected_win_focus_in_cb, cw);
- evas_object_event_callback_del_full(cw->obj, EVAS_CALLBACK_FOCUS_OUT, _e_comp_injected_win_focus_out_cb, cw);
- }
- E_FREE_FUNC(cw->obj, evas_object_del);
- E_FREE_FUNC(cw->zoomobj, evas_object_del);
- E_FREE_FUNC(cw->shobj, evas_object_del);
- E_FREE_FUNC(cw->effect_obj, evas_object_del);
-
- if (cw->free_shape) E_FREE_FUNC(cw->shape, e_object_del);
-
- free(cw->title);
- free(cw->name);
- free(cw->clas);
- free(cw->role);
- free(cw);
-}
-
-static void
-_e_comp_win_show(E_Comp_Win *cw)
-{
- Eina_List *l;
- Evas_Object *o;
- int pw, ph;
-
- if (cw->visible || cw->invalid) return;
- cw->visible = 1;
- pw = cw->pw, ph = cw->ph;
- DBG(" [0x%x] sho ++ [redir=%i, pm=%x, dmg_up=%i]",
- cw->win, cw->redirected, cw->pixmap, cw->dmg_updates);
- _e_comp_win_configure(cw, cw->hidden.x, cw->hidden.y, cw->w, cw->h, cw->border);
- if (cw->invalid) return;
- if (cw->input_only)
- {
- if (!cw->shape) return;
- evas_object_show(cw->effect_obj);
- cw->real_hid = 0;
- cw->shape->visible = 0;
- e_container_shape_show(cw->shape);
- return;
- }
- cw->show_anim = EINA_FALSE;
-
- if (cw->real_hid)
- {
- DBG(" [0x%x] real hid - fix", cw->win);
- cw->real_hid = cw->animating;
- if (cw->native)
- {
- evas_object_image_native_surface_set(cw->obj, NULL);
- cw->native = 0;
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_native_surface_set(o, NULL);
- }
- }
- if (cw->pixmap)
- {
- ecore_x_pixmap_free(cw->pixmap);
- cw->pixmap = 0;
- cw->pw = 0;
- cw->ph = 0;
- ecore_x_e_comp_pixmap_set(cw->win, cw->pixmap);
- }
- if (cw->xim)
- {
- evas_object_image_size_set(cw->obj, 1, 1);
- evas_object_image_data_set(cw->obj, NULL);
- ecore_x_image_free(cw->xim);
- cw->xim = NULL;
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_size_set(o, 1, 1);
- evas_object_image_data_set(o, NULL);
- }
- }
- if (cw->redirected)
- {
- cw->redirected = 0;
- cw->pw = 0;
- cw->ph = 0;
- }
- if (cw->win) return;
- }
- cw->dmg_updates = 1;
-
- cw->geom_update = 1;
- if (cw->win && ((!cw->redirected) || (!cw->pixmap)))
- {
- // we redirect all subwindows anyway
- // ecore_x_composite_redirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
- /* #ifdef HAVE_WAYLAND_CLIENTS */
- /* if ((cw->bd) && (cw->bd->borderless)) */
- /* cw->pixmap = e_comp_wl_pixmap_get(cw->win); */
- /* #endif */
- if (!cw->pixmap)
- cw->pixmap = ecore_x_composite_name_window_pixmap_get(cw->win);
- if (cw->pixmap)
- {
- ecore_x_pixmap_geometry_get(cw->pixmap, NULL, NULL, &(cw->pw), &(cw->ph));
- cw->show_ready = 1;
- _e_comp_win_ready_timeout_setup(cw);
- if ((cw->pw != pw) || (cw->ph != ph)) cw->geom_update = 1;
- }
- else
- {
- cw->pw = 0;
- cw->ph = 0;
- }
- if ((cw->pw <= 0) || (cw->ph <= 0))
- {
- if (cw->pixmap)
- {
- ecore_x_pixmap_free(cw->pixmap);
- cw->pixmap = 0;
- }
- // cw->show_ready = 0; // hmm maybe not needed?
- }
- cw->redirected = 1;
- DBG(" [0x%x] up resize %ix%i", cw->win, cw->pw, cw->ph);
- e_comp_render_update_resize(cw->up, cw->pw, cw->ph);
- e_comp_render_update_add(cw->up, 0, 0, cw->pw, cw->ph);
- evas_object_image_size_set(cw->obj, cw->pw, cw->ph);
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_size_set(o, cw->pw, cw->ph);
- }
- ecore_x_e_comp_pixmap_set(cw->win, cw->pixmap);
- }
- if ((cw->dmg_updates >= 1) && (cw->show_ready))
- {
- cw->defer_hide = 0;
- if (!cw->hidden_override) _e_comp_child_show(cw);
- edje_object_signal_emit(cw->shobj, "e,state,visible,on", "e");
- if (!cw->animating)
- {
- cw->c->animating++;
- }
- cw->animating = 1;
- _e_comp_win_render_queue(cw);
-
- cw->pending_count++;
- _e_comp_event_source_visibility(cw);
- }
- _e_comp_win_render_queue(cw);
- if (!cw->shape) return;
- cw->shape->visible = 0;
- e_container_shape_show(cw->shape);
-}
-
-static void
-_e_comp_win_real_hide(E_Comp_Win *cw)
-{
- if (!cw->bd) cw->real_hid = 1;
- _e_comp_win_hide(cw);
-}
-
-static void
-_e_comp_win_hide(E_Comp_Win *cw)
-{
- Eina_List *l;
- Evas_Object *o;
-
- if ((!cw->visible) && (!cw->defer_hide)) return;
- cw->visible = 0;
- if (cw->invalid) return;
- if (cw->input_only)
- {
- if (cw->shape) e_container_shape_hide(cw->shape);
- return;
- }
- DBG(" [0x%x] hid --", cw->win);
- cw->dmg_updates = 0;
- if (!cw->force)
- {
- cw->defer_hide = 1;
- edje_object_signal_emit(cw->shobj, "e,state,visible,off", "e");
- if (!cw->animating)
- {
- cw->c->animating++;
- }
- cw->animating = 1;
-// if (cw->real_obj && cw->eobj)
-// e_object_ref(cw->eobj);
- _e_comp_win_render_queue(cw);
-
- cw->pending_count++;
- _e_comp_event_source_visibility(cw);
- if (cw->shape) e_container_shape_hide(cw->shape);
- return;
- }
- cw->defer_hide = 0;
- _e_comp_child_hide(cw);
- if (!cw->force)
- edje_object_signal_emit(cw->shobj, "e,state,visible,off", "e");
- cw->force = 0;
-
- if (cw->update_timeout)
- {
- ecore_timer_del(cw->update_timeout);
- cw->update_timeout = NULL;
- }
- if (cw->nocomp)
- _e_comp_render_queue(cw->c);
- if (conf->keep_unmapped && cw->win)
- {
- if (!cw->delete_me)
- {
- if (conf->send_flush)
- {
- if (cw->bd) ecore_x_e_comp_flush_send(cw->bd->client.win);
- else ecore_x_e_comp_flush_send(cw->win);
- }
- if (conf->send_dump)
- {
- if (cw->bd) ecore_x_e_comp_dump_send(cw->bd->client.win);
- else ecore_x_e_comp_dump_send(cw->win);
- }
- }
- return;
- }
- if (cw->ready_timeout)
- {
- ecore_timer_del(cw->ready_timeout);
- cw->ready_timeout = NULL;
- }
-
- if (cw->native)
- {
- evas_object_image_native_surface_set(cw->obj, NULL);
- cw->native = 0;
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_native_surface_set(o, NULL);
- }
- }
- if (cw->pixmap)
- {
- ecore_x_pixmap_free(cw->pixmap);
- cw->pixmap = 0;
- cw->pw = 0;
- cw->ph = 0;
- ecore_x_e_comp_pixmap_set(cw->win, cw->pixmap);
- // cw->show_ready = 0; // hmm maybe not needed?
- }
- if (cw->xim)
- {
- evas_object_image_size_set(cw->obj, 1, 1);
- evas_object_image_data_set(cw->obj, NULL);
- ecore_x_image_free(cw->xim);
- cw->xim = NULL;
- EINA_LIST_FOREACH(cw->obj_mirror, l, o)
- {
- evas_object_image_size_set(o, 1, 1);
- evas_object_image_data_set(o, NULL);
- }
- }
- if (cw->redirected)
- {
- // we redirect all subwindows anyway
- // ecore_x_composite_unredirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
- cw->redirected = 0;
- cw->pw = 0;
- cw->ph = 0;
- }
- _e_comp_win_render_queue(cw);
- if (!cw->win) return;
- if (conf->send_flush)
- {
- if (cw->bd) ecore_x_e_comp_flush_send(cw->bd->client.win);
- else ecore_x_e_comp_flush_send(cw->win);
- }
- if (conf->send_dump)
- {
- if (cw->bd) ecore_x_e_comp_dump_send(cw->bd->client.win);
- else ecore_x_e_comp_dump_send(cw->win);
- }
-}
-
-static void
-_e_comp_win_raise_above(E_Comp_Win *cw, E_Comp_Win *cw2)
-{
- DBG(" [0x%x] abv [0x%x]", cw->win, cw2->win);
- cw->c->wins_invalid = 1;
- cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
- cw->c->wins = eina_inlist_append_relative(cw->c->wins, EINA_INLIST_GET(cw), EINA_INLIST_GET(cw2));
- _e_comp_win_restack(cw);
- _e_comp_win_render_queue(cw);
- cw->pending_count++;
- _e_comp_event_source_stack(cw);
-}
-
-static void
-_e_comp_win_raise(E_Comp_Win *cw)
-{
- DBG(" [0x%x] rai", cw->win);
- cw->c->wins_invalid = 1;
- cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
- cw->c->wins = eina_inlist_append(cw->c->wins, EINA_INLIST_GET(cw));
- _e_comp_win_restack(cw);
- _e_comp_win_render_queue(cw);
- cw->pending_count++;
- _e_comp_event_source_stack(cw);
-}
-
-static void
-_e_comp_win_lower_below(E_Comp_Win *cw, E_Comp_Win *cw2)
-{
- DBG(" [0x%x] below [0x%x]", cw->win, cw2->win);
- cw->c->wins_invalid = 1;
- cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
- cw->c->wins = eina_inlist_prepend_relative(cw->c->wins, EINA_INLIST_GET(cw), EINA_INLIST_GET(cw2));
- _e_comp_win_restack(cw);
- _e_comp_win_render_queue(cw);
- cw->pending_count++;
- _e_comp_event_source_stack(cw);
-}
-
-static void
-_e_comp_win_lower(E_Comp_Win *cw)
-{
- DBG(" [0x%x] low", cw->win);
- cw->c->wins_invalid = 1;
- cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
- cw->c->wins = eina_inlist_prepend(cw->c->wins, EINA_INLIST_GET(cw));
- _e_comp_win_restack(cw);
- _e_comp_win_render_queue(cw);
- cw->pending_count++;
- _e_comp_event_source_stack(cw);
-}
-
-static void
-_e_comp_win_configure(E_Comp_Win *cw, int x, int y, int w, int h, int border)
-{
- Eina_Bool moved = EINA_FALSE, resized = EINA_FALSE;
-
- if (!cw->visible)
- {
- cw->hidden.x = x;
- cw->hidden.y = y;
- cw->border = border;
- }
- else
- {
- if (!((x == cw->x) && (y == cw->y)))
- {
- DBG(" [0x%x] mov %4i %4i", cw->win, x, y);
- cw->x = x;
- cw->y = y;
- // evas_object_move(cw->effect_obj, cw->x, cw->y);
- moved = EINA_TRUE;
- }
- cw->hidden.x = x;
- cw->hidden.y = y;
- }
- cw->hidden.w = w;
- cw->hidden.h = h;
- if (!((w == cw->w) && (h == cw->h)))
- {
- DBG(" [0x%x] rsz %4ix%4i", cw->win, w, h);
- cw->w = w;
- cw->h = h;
- resized = EINA_TRUE;
- if ((!cw->bd) || ((!cw->bd->shading) && (!cw->bd->shaded)))
- {
- cw->needpix = 1;
- // was cw->w / cw->h
- // evas_object_resize(cw->effect_obj, cw->pw, cw->ph);
- if (!cw->real_obj) _e_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0);
- }
- }
- if (cw->border != border)
- {
- cw->border = border;
- cw->needpix = 1;
- // evas_object_resize(cw->effect_obj, cw->pw, cw->ph);
- resized = EINA_TRUE;
- _e_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0);
- }
- if ((cw->input_only) || (cw->invalid)) return;
- _e_comp_win_render_queue(cw);
- /* need to block move/resize of the edje for real objects so the external object doesn't
- * accidentally get shown and block our show callback
- */
- if ((cw->real_obj && cw->visible) || moved || resized) _e_comp_win_geometry_update(cw);
- // add pending manager comp event count to match below config send
- cw->pending_count++;
- _e_comp_event_source_configure(cw);
-}
-
-static void
-_e_comp_win_damage(E_Comp_Win *cw, int x, int y, int w, int h, Eina_Bool dmg)
-{
- if ((cw->input_only) || (cw->invalid)) return;
- DBG(" [0x%x] dmg [%x] %4i %4i %4ix%4i", cw->win, cw->damage, x, y, w, h);
- if ((dmg) && (cw->damage))
- {
- Ecore_X_Region parts;
-
- parts = ecore_x_region_new(NULL, 0);
- ecore_x_damage_subtract(cw->damage, 0, parts);
- ecore_x_region_free(parts);
- cw->dmg_updates++;
- }
- if (cw->nocomp) return;
- if (cw->c->nocomp)
- {
- cw->nocomp_need_update = EINA_TRUE;
- return;
- }
- e_comp_render_update_add(cw->up, x, y, w, h);
- if (!cw->update)
- {
- //INF("RENDER QUEUE: %p:%u", cw, cw->win);
- cw->update = 1;
- cw->c->updates = eina_list_append(cw->c->updates, cw);
- }
- _e_comp_win_render_queue(cw);
-}
-
-static void
-_e_comp_win_reshape(E_Comp_Win *cw)
-{
- if (cw->shape_changed) return;
- cw->shape_changed = 1;
- if (cw->c->nocomp)
- {
- cw->nocomp_need_update = EINA_TRUE;
- return;
- }
- if (!cw->update)
- {
- cw->update = 1;
- cw->c->updates = eina_list_append(cw->c->updates, cw);
- }
- e_comp_render_update_add(cw->up, 0, 0, cw->w, cw->h);
- _e_comp_win_render_queue(cw);
-}
-
-static void
-_e_comp_win_shape_create(E_Comp_Win *cw, int x, int y, int w, int h)
-{
- Eina_List *l;
- E_Container *con;
- Eina_Rectangle *rects;
- int num;
-
- EINA_LIST_FOREACH(cw->c->man->containers, l, con)
- {
- if (!E_INSIDE(x, y, con->x, con->y, con->w, con->h)) continue;
- cw->shape = e_container_shape_add(con);
- break;
- }
- if (!cw->shape) cw->shape = e_container_shape_add(eina_list_data_get(cw->c->man->containers));
- if (!cw->shape) return;
- e_container_shape_resize(cw->shape, w, h);
- rects = (Eina_Rectangle*)ecore_x_window_shape_rectangles_get(cw->win, &num);
- e_container_shape_rects_set(cw->shape, rects, num);
- if (cw->shape->shape_rects)
- e_container_shape_input_rects_set(cw->shape, NULL, 0);
- else
- {
- rects = (Eina_Rectangle*)ecore_x_window_shape_input_rectangles_get(cw->win, &num);
- e_container_shape_input_rects_set(cw->shape, rects, num);
- }
- _e_comp_win_shape_init(cw, w, h);
- cw->shape->comp_win = cw;
-}
-
//////////////////////////////////////////////////////////////////////////
-static Eina_Bool
-_e_comp_show_request(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Show_Request *ev = event;
- E_Comp *c;
-
- c = _e_comp_find(ev->parent);
- if (!c) return ECORE_CALLBACK_PASS_ON;
- if (c->win == ev->win) return ECORE_CALLBACK_PASS_ON;
- if (c->ee_win == ev->win) return ECORE_CALLBACK_PASS_ON;
- if (c->man->root == ev->win) return ECORE_CALLBACK_PASS_ON;
- if (_e_comp_ignore_find(ev->win)) return ECORE_CALLBACK_PASS_ON;
- if (e_border_find_by_client_window(ev->win)) return ECORE_CALLBACK_RENEW;
- if (e_border_find_by_window(ev->win)) return ECORE_CALLBACK_RENEW;
- if (_e_comp_win_find(ev->win)) return ECORE_CALLBACK_RENEW;
- //INF("SHOW_REQUEST: %u", ev->win);
- _e_comp_win_add(c, ev->win, NULL);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_destroy(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Destroy *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->win);
- //INF("DESTROY: %p %u:%u", cw, ev->win, ev->event_win);
- if (!cw)
- {
- eina_hash_del_by_key(ignores, e_util_winid_str_get(ev->win));
- return ECORE_CALLBACK_PASS_ON;
- }
- if (cw->animating) cw->delete_me = 1;
- else _e_comp_win_del(cw);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Show *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->win);
- if (!cw)
- {
- E_Manager *man;
-
- /* block root window and parents */
- if (ev->win <= ev->event_win) return ECORE_CALLBACK_RENEW;
- if (_e_comp_ignore_find(ev->win)) return ECORE_CALLBACK_RENEW;
- if (e_border_find_all_by_client_window(ev->win)) return ECORE_CALLBACK_RENEW;
- man = e_manager_find_by_root(ev->event_win);
- if (!man) return ECORE_CALLBACK_RENEW;
- cw = _e_comp_win_add(man->comp, ev->win, NULL);
- if (!cw) return ECORE_CALLBACK_RENEW;
- //INF("SHOW: %p %u:%u", cw, ev->win, ev->event_win);
- if (cw->free_shape) _e_comp_win_shape_create(cw, cw->x, cw->y, cw->w, cw->h);
- }
- //else
- //INF("SHOW: %p %u:%u || %d", cw, ev->win, ev->event_win, cw->animating);
- //if (cw->animating)
- //INF("ANIMATING!");
- cw->defer_hide = 0;
- if (cw->visible || cw->bd) return ECORE_CALLBACK_PASS_ON;
- _e_comp_win_show(cw);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Hide *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->win);
- //INF("HIDE: %p %u:%u", cw, ev->win, ev->event_win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- if (!cw->visible) return ECORE_CALLBACK_PASS_ON;
- _e_comp_win_real_hide(cw);
- if ((cw->shape) && (cw->free_shape)) e_container_shape_hide(cw->shape);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_reparent(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Reparent *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- DBG("== repar [0x%x] to [0x%x]", ev->win, ev->parent);
- if (ev->parent != cw->c->man->root)
- _e_comp_win_del(cw);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Configure *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->win);
- //INF("CFG: %p %u:%u", cw, ev->win, ev->event_win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
-
- if (ev->abovewin == 0)
- {
- if (EINA_INLIST_GET(cw)->prev) _e_comp_win_lower(cw);
- }
- else
- {
- E_Comp_Win *cw2 = _e_comp_win_find(ev->abovewin);
-
- if (cw2)
- {
- E_Comp_Win *cw3 = (E_Comp_Win *)(EINA_INLIST_GET(cw)->prev);
-
- if (cw3 != cw2) _e_comp_win_raise_above(cw, cw2);
- }
- }
-
- if (cw->bd)
- {
- if ((cw->pw != cw->bd->client.w) || (cw->ph != cw->bd->client.h))
- {
- /* border resize callback will handle configure */
- cw->geom_update = cw->needpix = 1;
- _e_comp_win_render_queue(cw);
- }
- }
- else if (!((cw->x == ev->x) && (cw->y == ev->y) &&
- (cw->w == ev->w) && (cw->h == ev->h) &&
- (cw->border == ev->border)))
- {
- _e_comp_win_configure(cw, ev->x, ev->y, ev->w, ev->h, ev->border);
- if ((cw->shape) && (cw->free_shape))
- {
- if (cw->visible)
- e_container_shape_move(cw->shape, cw->x, cw->y);
- else
- e_container_shape_move(cw->shape, cw->hidden.x, cw->hidden.y);
- e_container_shape_resize(cw->shape, cw->w, cw->h);
- }
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_stack(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Stack *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- if (ev->detail == ECORE_X_WINDOW_STACK_ABOVE) _e_comp_win_raise(cw);
- else _e_comp_win_lower(cw);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_shape(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Shape *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- if (ev->type != ECORE_X_SHAPE_BOUNDING) return ECORE_CALLBACK_PASS_ON;
- _e_comp_win_reshape(cw);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_damage(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Damage *ev = event;
- E_Comp_Win *cw = _e_comp_win_damage_find(ev->damage);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- //INF("DAMAGE: %p %u", cw, cw->win);
- _e_comp_win_damage(cw, ev->area.x, ev->area.y, ev->area.width, ev->area.height, 1);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_damage_win(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_X_Event_Window_Damage *ev = event;
- Eina_List *l;
- E_Comp *c;
-
- // fixme: use hash if compositors list > 4
- EINA_LIST_FOREACH(compositors, l, c)
- {
- if (ev->win == c->ee_win)
- {
- // expose on comp win - init win or some other bypass win did it
- DBG("JOB4...");
- _e_comp_render_queue(c);
- break;
- }
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_override_expire(void *data)
-{
- E_Comp *c = data;
-
- c->nocomp_override_timer = NULL;
- c->nocomp_override--;
-
- if (c->nocomp_override <= 0)
- {
- c->nocomp_override = 0;
- if (c->nocomp_want) _e_comp_cb_nocomp_begin(c);
- }
- return EINA_FALSE;
-}
-
-static void
-_e_comp_override_timed_pop(E_Comp *c)
-{
- if (c->nocomp_override <= 0) return;
- if (c->nocomp_override_timer)
- ecore_timer_del(c->nocomp_override_timer);
- c->nocomp_override_timer =
- ecore_timer_add(5.0, _e_comp_override_expire, c);
-}
-
-static void
-_e_comp_fade_handle(E_Comp_Zone *cz, int out, double tim)
-{
- if (out == 1)
- {
- if ((e_backlight_exists()) && (!conf->nofade))
- {
- e_backlight_update();
- cz->bloff = EINA_TRUE;
- cz->bl = e_backlight_level_get(cz->zone);
- e_backlight_level_set(cz->zone, 0.0, tim);
- }
- }
- else
- {
- if ((e_backlight_exists()) && (!conf->nofade))
- {
- cz->bloff = EINA_FALSE;
- e_backlight_update();
- if (e_backlight_mode_get(cz->zone) != E_BACKLIGHT_MODE_NORMAL)
- e_backlight_mode_set(cz->zone, E_BACKLIGHT_MODE_NORMAL);
- else
- e_backlight_level_set(cz->zone, e_config->backlight.normal, tim);
- }
- }
-}
-
-static Eina_Bool
-_e_comp_screensaver_on(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
-{
- Eina_List *l, *ll;
- E_Comp_Zone *cz;
- E_Comp *c;
-
- // fixme: use hash if compositors list > 4
- EINA_LIST_FOREACH(compositors, l, c)
- {
- if (!c->saver)
- {
- c->saver = EINA_TRUE;
- EINA_LIST_FOREACH(c->zones, ll, cz)
- {
- e_comp_override_add(c);
- _e_comp_fade_handle(cz, 1, 3.0);
- edje_object_signal_emit(cz->base, "e,state,screensaver,on", "e");
- edje_object_signal_emit(cz->over, "e,state,screensaver,on", "e");
- }
- }
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_screensaver_off(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
-{
- Eina_List *l, *ll;
- E_Comp_Zone *cz;
- E_Comp *c;
-
- // fixme: use hash if compositors list > 4
- EINA_LIST_FOREACH(compositors, l, c)
- {
- if (c->saver)
- {
- c->saver = EINA_FALSE;
- EINA_LIST_FOREACH(c->zones, ll, cz)
- {
- edje_object_signal_emit(cz->base, "e,state,screensaver,off", "e");
- edje_object_signal_emit(cz->over, "e,state,screensaver,off", "e");
- _e_comp_fade_handle(cz, 0, 0.5);
- _e_comp_override_timed_pop(c);
- }
- }
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_e_comp_screens_eval(E_Comp *c)
-{
- Eina_List *l, *ll;
- E_Container *con;
- E_Zone *zone;
- E_Comp_Zone *cz;
-
- EINA_LIST_FREE(c->zones, cz)
- {
- evas_object_del(cz->base);
- evas_object_del(cz->over);
- if (cz->bloff)
- {
- if (!conf->nofade)
- {
- if (e_backlight_mode_get(cz->zone) != E_BACKLIGHT_MODE_NORMAL)
- e_backlight_mode_set(cz->zone, E_BACKLIGHT_MODE_NORMAL);
- e_backlight_level_set(cz->zone, e_config->backlight.normal, -1.0);
- }
- }
- if (cz->zone) cz->zone->comp_zone = NULL;
- free(cz);
- }
- EINA_LIST_FOREACH(c->man->containers, l, con)
- {
- EINA_LIST_FOREACH(con->zones, ll, zone)
- {
- cz = E_NEW(E_Comp_Zone, 1);
- cz->zone = zone;
- cz->comp = c;
- zone->comp_zone = cz;
- cz->container_num = zone->container->num;
- cz->zone_num = zone->num;
- cz->x = zone->x;
- cz->y = zone->y;
- cz->w = zone->w;
- cz->h = zone->h;
- e_comp_zone_update(cz);
- c->zones = eina_list_append(c->zones, cz);
- }
- }
- e_layout_freeze(c->layout);
- evas_object_move(c->layout, 0, 0);
- evas_object_resize(c->layout, c->man->w, c->man->h);
- e_layout_virtual_size_set(c->layout, c->man->w, c->man->h);
- e_layout_thaw(c->layout);
-}
-
-static void
-_e_comp_screen_change(void *data)
-{
- E_Comp *c = data;
-
- c->screen_job = NULL;
- if (!c->nocomp) ecore_evas_resize(c->ee, c->man->w, c->man->h);
- _e_comp_screens_eval(c);
-}
-
-static Eina_Bool
-_e_comp_randr(void *data EINA_UNUSED, int type EINA_UNUSED, EINA_UNUSED void *event)
-{
- Eina_List *l;
- E_Comp *c;
-
- EINA_LIST_FOREACH(compositors, l, c)
- {
- if (c->screen_job) ecore_job_del(c->screen_job);
- c->screen_job = ecore_job_add(_e_comp_screen_change, c);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_zonech(void *data EINA_UNUSED, int type EINA_UNUSED, EINA_UNUSED void *event)
-{
- Eina_List *l;
- E_Comp *c;
-
- EINA_LIST_FOREACH(compositors, l, c)
- {
- if (c->screen_job) ecore_job_del(c->screen_job);
- c->screen_job = ecore_job_add(_e_comp_screen_change, c);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_e_comp_bd_add(void *data EINA_UNUSED, void *ev)
-{
- E_Border *bd = ev;
- E_Comp_Win *cw;
- E_Container *con;
- int x;
-
- if (bd->cw) return;
- cw = _e_comp_win_find(bd->win);
- if (cw)
- {
- _e_comp_win_bd_setup(cw, bd);
- evas_object_data_set(cw->shobj, "border", cw->bd);
- evas_object_data_set(cw->effect_obj, "border", cw->bd);
-#ifdef BORDER_ZOOMAPS
- evas_object_name_set(cw->zoomobj, "cw->zoomobj::BORDER");
-#endif
- evas_object_name_set(cw->shobj, "cw->shobj::BORDER");
- evas_object_name_set(cw->effect_obj, "cw->effect_obj::BORDER");
- e_comp_win_reshadow(cw);
- }
- else
- cw = _e_comp_win_add(e_comp_get(bd), bd->win, bd);
- if (cw->shape) cw->shape->comp_win = cw;
- con = cw->bd->zone->container;
- /* we previously ignored potential stacking requests before the border setup,
- * so we have to manually stack it here */
- for (x = 0; x < E_CONTAINER_LAYER_COUNT; x++)
- {
- Eina_List *l, *ll;
- E_Border *bd2;
- E_Comp_Win *cw2;
-
- if (!con->layers[x].clients) continue;
- l = eina_list_data_find_list(con->layers[x].clients, cw->bd);
- if (!l) continue;
- for (ll = l->prev; ll; ll = ll->prev)
- {
- bd2 = eina_list_data_get(ll);
- if (bd->desk != bd2->desk) continue;
- cw2 = bd2->cw;
- if (cw2)
- {
- _e_comp_win_raise_above(cw, cw2);
- return;
- }
- }
- for (ll = l->next; ll; ll = ll->next)
- {
- bd2 = eina_list_data_get(ll);
- if (bd->desk != bd2->desk) continue;
- cw2 = bd2->cw;
- if (cw2)
- {
- _e_comp_win_lower_below(cw, cw2);
- return;
- }
- }
- cw2 = _e_comp_win_find(con->layers[x].win);
- if (cw2) _e_comp_win_lower_below(cw, cw2);
- break;
- }
- //if (cw->bd->visible)
- //{
- //_e_comp_win_show(cw);
- //}
-}
-
-static Eina_Bool
-_e_comp_bd_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Remove *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (cw) e_comp_win_del(cw);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Show *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (cw) _e_comp_win_show(cw);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Hide *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (cw)
- {
- cw->force |= (ev->manage == 2);
- _e_comp_win_hide(cw);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Move *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- _e_comp_win_configure(cw, ev->border->x, ev->border->y, cw->w, cw->h, cw->border);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Resize *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- _e_comp_win_configure(cw, cw->x, cw->y, ev->border->w, ev->border->h, cw->border);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_iconify(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Iconify *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- // fimxe: special iconfiy anim
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_uniconify(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Uniconify *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- // fimxe: special uniconfiy anim
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_urgent_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Urgent_Change *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- if (cw->bd->client.icccm.urgent)
- edje_object_signal_emit(cw->shobj, "e,state,urgent,on", "e");
- else
- edje_object_signal_emit(cw->shobj, "e,state,urgent,off", "e");
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Focus_In *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- edje_object_signal_emit(cw->shobj, "e,state,focus,on", "e");
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_focus_out(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Focus_Out *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- edje_object_signal_emit(cw->shobj, "e,state,focus,off", "e");
- return ECORE_CALLBACK_PASS_ON;
-}
static Eina_Bool
-_e_comp_bd_property(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+_e_comp_cb_zone_change(void *data EINA_UNUSED, int type EINA_UNUSED, EINA_UNUSED void *event)
{
- E_Event_Border_Property *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- // fimxe: other properties?
+ E_LIST_FOREACH(compositors, e_comp_canvas_update);
return ECORE_CALLBACK_PASS_ON;
}
-static Eina_Bool
-_e_comp_bd_fullscreen(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Property *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- e_comp_win_reshadow(cw);
- /* bd->bg_object deletion pending */
-#ifdef BORDER_ZOOMAPS
- e_zoomap_child_set(cw->zoomobj, cw->obj);
-#else
- edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->obj);
-#endif
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_comp_bd_unfullscreen(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Border_Property *ev = event;
- E_Comp_Win *cw = _e_comp_win_find(ev->border->win);
- if (!cw) return ECORE_CALLBACK_PASS_ON;
- e_comp_win_reshadow(cw);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_e_comp_injected_win_focus_out_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- E_Comp_Win *cw = data;
- edje_object_signal_emit(cw->shobj, "e,state,focus,off", "e");
-}
-
-static void
-_e_comp_injected_win_focus_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- E_Comp_Win *cw = data;
- edje_object_signal_emit(cw->shobj, "e,state,focus,on", "e");
-}
-
-static void
-_e_comp_injected_win_hide_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- E_Comp_Win *cw = data;
-
- _e_comp_win_real_hide(cw);
-}
-
-static void
-_e_comp_injected_win_show_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- E_Comp_Win *cw = data;
-
- cw->defer_hide = 0;
- cw->show_ready = 1;
- _e_comp_win_geometry_update(cw);
- _e_comp_win_show(cw);
-}
-
-static void
-_e_comp_injected_win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
-{
- E_Comp_Win *cw = data;
-
- if (evas_object_layer_get(obj) > E_COMP_CANVAS_LAYER_LAYOUT)
- e_comp_override_del(cw->c);
- cw->obj = NULL;
- if (cw->animating) cw->delete_me = 1;
- else _e_comp_win_del(cw);
-}
-/*
-static void
-_e_comp_injected_win_moveresize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
-{
- E_Comp_Win *cw = data;
- int x, y, w, h;
-
- evas_object_geometry_get(obj, &x, &y, &w, &h);
- _e_comp_win_configure(cw, x, y, w, h, 0);
-}
-*/
#ifdef SHAPE_DEBUG
static void
-_e_comp_shape_debug_rect(E_Comp *c, Ecore_X_Rectangle *rect, E_Color *color)
+_e_comp_shape_debug_rect(E_Comp *c, Eina_Rectangle *rect, E_Color *color)
{
Evas_Object *o;
@@ -3578,11 +511,9 @@ _e_comp_shape_debug_rect(E_Comp *c, Ecore_X_Rectangle *rect, E_Color *color)
else
evas_object_color_set(o, 0, 0, (color->b += COLOR_INCREMENT), 255);
evas_object_repeat_events_set(o, 1);
- evas_object_raise(o);
- e_layout_pack(c->layout, o);
- e_layout_child_move(o, rect->x, rect->y);
- e_layout_child_resize(o, rect->width, rect->height);
- e_layout_child_raise(o);
+ evas_object_layer_set(o, E_LAYER_MENU - 1);
+ evas_object_move(o, rect->x, rect->y);
+ evas_object_resize(o, rect->w, rect->h);
c->debug_rects = eina_list_append(c->debug_rects, o);
evas_object_show(o);
}
@@ -3591,106 +522,83 @@ _e_comp_shape_debug_rect(E_Comp *c, Ecore_X_Rectangle *rect, E_Color *color)
static Eina_Bool
_e_comp_shapes_update_object_checker_function_thingy(E_Comp *c, Evas_Object *o)
{
- Eina_List *l, *ll;
- E_Container *con;
+ Eina_List *l;
E_Zone *zone;
- E_Comp_Zone *cz;
- EINA_LIST_FOREACH(c->zones, l, cz)
- if ((o == cz->over) || (o == cz->base)) return EINA_TRUE;
- EINA_LIST_FOREACH(c->man->containers, l, con)
+ if (o == c->bg_blank_object) return EINA_TRUE;
+ EINA_LIST_FOREACH(c->zones, l, zone)
{
- if (o == con->bg_blank_object) return EINA_TRUE;
- EINA_LIST_FOREACH(con->zones, ll, zone)
- if ((o == zone->bg_object) || (o == zone->bg_event_object) ||
- (o == zone->bg_clip_object) || (o == zone->prev_bg_object) ||
- (o == zone->transition_object))
- return EINA_TRUE;
+ if ((o == zone->over) || (o == zone->base)) return EINA_TRUE;
+ if ((o == zone->bg_object) || (o == zone->bg_event_object) ||
+ (o == zone->bg_clip_object) || (o == zone->prev_bg_object) ||
+ (o == zone->transition_object))
+ return EINA_TRUE;
}
return EINA_FALSE;
}
static void
#ifdef SHAPE_DEBUG
-_e_comp_shapes_update_comp_win_shape_comp_helper(E_Comp_Win *cw, Eina_Tiler *tb, Eina_List **rl)
+_e_comp_shapes_update_comp_client_shape_comp_helper(E_Client *ec, Eina_Tiler *tb, Eina_List **rl)
#else
-_e_comp_shapes_update_comp_win_shape_comp_helper(E_Comp_Win *cw, Eina_Tiler *tb)
+_e_comp_shapes_update_comp_client_shape_comp_helper(E_Client *ec, Eina_Tiler *tb)
#endif
{
int x, y, w, h;
/* ignore deleted shapes */
- if (!cw->shape)
+ if (e_object_is_del(E_OBJECT(ec)))
{
- SHAPE_INF("IGNORING DELETED: %u", cw->win);
+ SHAPE_INF("IGNORING DELETED: %p", ec);
return;
}
-
- if (cw->invalid || cw->real_hid || (!cw->visible) || (!cw->shape->visible) ||
- evas_object_pass_events_get(cw->effect_obj) || evas_object_repeat_events_get(cw->effect_obj))
+ if ((!ec->visible) || (ec->hidden) || (!evas_object_visible_get(ec->frame)) || evas_object_pass_events_get(ec->frame))
{
- SHAPE_DBG("SKIPPING SHAPE");
+ SHAPE_DBG("SKIPPING SHAPE FOR %p", ec);
return;
}
#ifdef SHAPE_DEBUG
- if (cw->bd)
- INF("COMP BD: %u", cw->win);
- else if (cw->pop)
- INF("COMP POP: %u", cw->win);
- else if (cw->menu)
- INF("COMP MENU: %u", cw->win);
- else if (cw->real_obj)
- INF("COMP OBJ: %s", evas_object_name_get(cw->obj));
- else
- INF("COMP WIN: %u", cw->win);
+ INF("COMP EC: %p", ec);
#endif
- if (cw->shape->shape_input_rects || cw->shape->shape_rects)
+ if (ec->shape_input_rects || ec->shape_rects)
{
int num, tot;
+ int l, r, t, b;
Eina_Rectangle *rect, *rects;
/* add the frame */
- if (cw->bd)
+ e_comp_object_frame_geometry_get(ec->frame, &l, &r, &t, &b);
+ if (l || r || t || b)
{
- if (cw->bd->client_inset.calc)
+ if (t)
{
- if (cw->bd->client_inset.t)
- {
- eina_tiler_rect_add(tb, &(Eina_Rectangle){cw->bd->x, cw->bd->y, cw->bd->w, cw->bd->client_inset.t});
- SHAPE_INF("ADD: %d,%d@%dx%d", cw->bd->x, cw->bd->y, cw->bd->w, cw->bd->client_inset.t);
- }
- if (cw->bd->client_inset.l)
- {
- eina_tiler_rect_add(tb, &(Eina_Rectangle){cw->bd->x, cw->bd->y, cw->bd->client_inset.l, cw->bd->h});
- SHAPE_INF("ADD: %d,%d@%dx%d", cw->bd->x, cw->bd->y, cw->bd->client_inset.l, cw->bd->h);
- }
- if (cw->bd->client_inset.r)
- {
- eina_tiler_rect_add(tb, &(Eina_Rectangle){cw->bd->x + cw->bd->client_inset.l + cw->bd->client.w, cw->bd->y, cw->bd->client_inset.r, cw->bd->h});
- SHAPE_INF("ADD: %d,%d@%dx%d", cw->bd->x + cw->bd->client_inset.l + cw->bd->client.w, cw->bd->y, cw->bd->client_inset.r, cw->bd->h);
- }
- if (cw->bd->client_inset.b)
- {
- eina_tiler_rect_add(tb, &(Eina_Rectangle){cw->bd->x, cw->bd->y + cw->bd->client_inset.t + cw->bd->client.h, cw->bd->w, cw->bd->client_inset.b});
- SHAPE_INF("ADD: %d,%d@%dx%d", cw->bd->x, cw->bd->y + cw->bd->client_inset.t + cw->bd->client.h, cw->bd->w, cw->bd->client_inset.b);
- }
+ eina_tiler_rect_add(tb, &(Eina_Rectangle){ec->x, ec->y, ec->w, t});
+ SHAPE_INF("ADD: %d,%d@%dx%d", ec->x, ec->y, ec->w, t);
+ }
+ if (l)
+ {
+ eina_tiler_rect_add(tb, &(Eina_Rectangle){ec->x, ec->y, l, ec->h});
+ SHAPE_INF("ADD: %d,%d@%dx%d", ec->x, ec->y, l, ec->h);
+ }
+ if (r)
+ {
+ eina_tiler_rect_add(tb, &(Eina_Rectangle){ec->x + l + ec->client.w, ec->y, r, ec->h});
+ SHAPE_INF("ADD: %d,%d@%dx%d", ec->client.x + ec->client.w, ec->y, r, ec->h);
+ }
+ if (b)
+ {
+ eina_tiler_rect_add(tb, &(Eina_Rectangle){ec->x, ec->y + t + ec->client.h, ec->w, b});
+ SHAPE_INF("ADD: %d,%d@%dx%d", ec->x, ec->client.y + ec->client.h, ec->w, b);
}
}
- rects = cw->shape->shape_rects ?: cw->shape->shape_input_rects;
- tot = cw->shape->shape_rects_num ?: cw->shape->shape_input_rects_num;
+ rects = ec->shape_rects ?: ec->shape_input_rects;
+ tot = ec->shape_rects_num ?: ec->shape_input_rects_num;
for (num = 0, rect = rects; num < tot; num++, rect++)
{
x = rect->x, y = rect->y, w = rect->w, h = rect->h;
- if (cw->bd)
- {
- x += cw->bd->x, y += cw->bd->y;
- if (cw->bd->client_inset.calc)
- x += cw->bd->client_inset.l, y += cw->bd->client_inset.t;
- }
- else
- x += cw->x, y += cw->y;
- E_RECTS_CLIP_TO_RECT(x, y, w, h, cw->c->man->x, cw->c->man->y, cw->c->man->w, cw->c->man->h);
+ x += ec->client.x, y += ec->client.y;
+ E_RECTS_CLIP_TO_RECT(x, y, w, h, ec->comp->man->x, ec->comp->man->y, ec->comp->man->w, ec->comp->man->h);
if ((w < 1) || (h < 1)) continue;
//#ifdef SHAPE_DEBUG not sure we can shape check these?
//r = E_NEW(Eina_Rectangle, 1);
@@ -3702,69 +610,56 @@ _e_comp_shapes_update_comp_win_shape_comp_helper(E_Comp_Win *cw, Eina_Tiler *tb)
}
return;
}
- /* borders and popups sometimes call shape changes before the changes have
- * propagated to the comp_win :/
- */
- if (cw->bd)
- x = cw->bd->x + cw->bd->client_inset.l, y = cw->bd->y + cw->bd->client_inset.t, w = cw->bd->client.w, h = cw->bd->client.h;
- else if (cw->pop)
- x = cw->pop->x + cw->pop->zone->x, y = cw->pop->y + cw->pop->zone->y, w = cw->pop->w, h = cw->pop->h;
- //else if (cw->menu)
- //x = cw->menu->x + cw->menu->zone->x, y = cw->menu->y + cw->menu->zone->y, w = cw->menu->w, h = cw->menu->h;
- else
- x = cw->x, y = cw->y, w = cw->w, h = cw->h;
+
#ifdef SHAPE_DEBUG
- if (!cw->real_obj)
{
Eina_Rectangle *r;
r = E_NEW(Eina_Rectangle, 1);
- EINA_RECTANGLE_SET(r, x, y, w, h);
+ EINA_RECTANGLE_SET(r, ec->client.x, ec->client.y, ec->client.w, ec->client.h);
*rl = eina_list_append(*rl, r);
}
#endif
- if (cw->real_obj)
+
+ if ((!ec->borderless) && (e_util_strcmp(ec->border.name, "borderless")))
{
- eina_tiler_rect_add(tb, &(Eina_Rectangle){x, y, w, h});
- SHAPE_INF("ADD: %d,%d@%dx%d", x, y, w, h);
+ /* add the frame */
+ eina_tiler_rect_add(tb, &(Eina_Rectangle){ec->x, ec->y, ec->w, ec->h});
+ SHAPE_INF("ADD: %d,%d@%dx%d", ec->x, ec->y, ec->w, ec->h);
}
- else
- {
- if (cw->bd && (!cw->bd->borderless) && (!_e_comp_win_is_borderless(cw)))
- {
- if (cw->bd->client_inset.calc)
- {
- /* add the frame */
- eina_tiler_rect_add(tb, &(Eina_Rectangle){cw->bd->x, cw->bd->y, cw->bd->w, cw->bd->h});
- SHAPE_INF("ADD: %d,%d@%dx%d", cw->bd->x, cw->bd->y, cw->bd->w, cw->bd->h);
- }
- if (!cw->bd->shaded)
- {
- /* delete the client if not shaded */
- eina_tiler_rect_del(tb, &(Eina_Rectangle){x, y, w, h});
- SHAPE_INF("DEL: %d,%d@%dx%d", x, y, w, h);
- }
- }
- else
- {
- eina_tiler_rect_del(tb, &(Eina_Rectangle){x, y, w, h});
- SHAPE_INF("DEL: %d,%d@%dx%d", x, y, w, h);
- }
+ if ((!ec->shaded) && (!ec->shading))
+ {
+ /* delete the client if not shaded */
+ eina_tiler_rect_del(tb, &(Eina_Rectangle){ec->client.x, ec->client.y, ec->client.w, ec->client.h});
+ SHAPE_INF("DEL: %d,%d@%dx%d", ec->client.x, ec->client.y, ec->client.w, ec->client.h);
}
}
static void
+_e_comp_shapes_update_object_shape_comp_helper(E_Comp *c, Evas_Object *o, Eina_Tiler *tb)
+{
+ int x, y, w, h;
+
+ /* ignore hidden and pass-event objects */
+ if ((!evas_object_visible_get(o)) || evas_object_pass_events_get(o) || evas_object_repeat_events_get(o)) return;
+ /* ignore canvas objects */
+ if (_e_comp_shapes_update_object_checker_function_thingy(c, o)) return;
+ SHAPE_INF("OBJ: %p:%s", o, evas_object_name_get(o));
+ evas_object_geometry_get(o, &x, &y, &w, &h);
+ eina_tiler_rect_add(tb, &(Eina_Rectangle){x, y, w, h});
+ SHAPE_INF("ADD: %d,%d@%dx%d", x, y, w, h);
+}
+
+static void
_e_comp_shapes_update_job(E_Comp *c)
{
Eina_Tiler *tb;
Evas_Object *o;
Eina_Rectangle *tr;
Eina_Iterator *ti;
- Ecore_X_Rectangle *exr;
+ Eina_Rectangle *exr;
unsigned int i, tile_count;
- int x, y, w, h;
- Eina_Bool layout = EINA_FALSE;
#ifdef SHAPE_DEBUG
Eina_Rectangle *r;
Eina_List *rl = NULL;
@@ -3774,73 +669,47 @@ _e_comp_shapes_update_job(E_Comp *c)
E_FREE_LIST(c->debug_rects, evas_object_del);
tb = eina_tiler_new(c->man->w, c->man->h);
eina_tiler_tile_size_set(tb, 1, 1);
+ /* background */
eina_tiler_rect_add(tb, &(Eina_Rectangle){c->man->x, c->man->y, c->man->w, c->man->h});
o = evas_object_bottom_get(c->evas);
for (; o; o = evas_object_above_get(o))
{
- if (o == c->layout)
- {
- Evas_Object *ch;
- Eina_List *l;
+ int layer;
+ E_Client *ec;
- layout = EINA_TRUE; //ignore all objects under layout
- l = e_layout_children_get(o);
- EINA_LIST_FREE(l, ch)
- {
- E_Comp_Win *cw;
-
- cw = evas_object_data_get(ch, "comp_win");
- if (cw)
- _e_comp_shapes_update_comp_win_shape_comp_helper(cw, tb
-#ifdef SHAPE_DEBUG
- ,&rl
-#endif
- );
- else if (evas_object_visible_get(ch) && (!evas_object_pass_events_get(ch)) && (!evas_object_repeat_events_get(ch)))
- {
- SHAPE_INF("COMP OBJ: %p", ch);
- e_layout_child_geometry_get(ch, &x, &y, &w, &h);
- eina_tiler_rect_add(tb, &(Eina_Rectangle){x, y, w, h});
- SHAPE_INF("ADD: %d,%d@%dx%d", x, y, w, h);
- }
- }
- }
- else if (layout && evas_object_visible_get(o) && (!evas_object_pass_events_get(o)) && (!evas_object_repeat_events_get(o)))
+ layer = evas_object_layer_get(o);
+ if (e_comp_canvas_client_layer_map(layer) == 9999) //not a client layer
{
- E_Comp_Win *cw;
-
- if (_e_comp_shapes_update_object_checker_function_thingy(c, o)) continue;
- cw = evas_object_data_get(o, "comp_win");
- if (cw)
- {
- _e_comp_shapes_update_comp_win_shape_comp_helper(cw, tb
+ /* ignore objects stacked below first client layer */
+ if (layer < E_LAYER_CLIENT_PRIO) continue;
+ _e_comp_shapes_update_object_shape_comp_helper(c, o, tb);
+ }
+ ec = evas_object_data_get(o, "E_Client");
+ if (ec && (!ec->no_shape_cut))
+ _e_comp_shapes_update_comp_client_shape_comp_helper(ec, tb
#ifdef SHAPE_DEBUG
- ,&rl
+ ,&rl
#endif
- );
- continue;
- }
- SHAPE_INF("OBJ: %p:%s", o, evas_object_name_get(o));
- evas_object_geometry_get(o, &x, &y, &w, &h);
- eina_tiler_rect_add(tb, &(Eina_Rectangle){x, y, w, h});
- SHAPE_INF("ADD: %d,%d@%dx%d", x, y, w, h);
- }
+ );
+
+ else
+ _e_comp_shapes_update_object_shape_comp_helper(c, o, tb);
}
ti = eina_tiler_iterator_new(tb);
tile_count = 128;
- exr = malloc(sizeof(Ecore_X_Rectangle) * tile_count);
+ exr = malloc(sizeof(Eina_Rectangle) * tile_count);
i = 0;
EINA_ITERATOR_FOREACH(ti, tr)
{
- exr[i++] = *(Ecore_X_Rectangle*)((char*)tr);
+ exr[i++] = *(Eina_Rectangle*)((char*)tr);
if (i == tile_count - 1)
- exr = realloc(exr, sizeof(Ecore_X_Rectangle) * (tile_count *= 2));
+ exr = realloc(exr, sizeof(Eina_Rectangle) * (tile_count *= 2));
#ifdef SHAPE_DEBUG
Eina_List *l;
_e_comp_shape_debug_rect(c, &exr[i - 1], &color);
- INF("%d,%d @ %dx%d", exr[i - 1].x, exr[i - 1].y, exr[i - 1].width, exr[i - 1].height);
+ INF("%d,%d @ %dx%d", exr[i - 1].x, exr[i - 1].y, exr[i - 1].w, exr[i - 1].h);
EINA_LIST_FOREACH(rl, l, r)
{
if (E_INTERSECTS(r->x, r->y, r->w, r->h, tr->x, tr->y, tr->w, tr->h))
@@ -3848,7 +717,7 @@ _e_comp_shapes_update_job(E_Comp *c)
}
#endif
}
- ecore_x_window_shape_input_rectangles_set(c->win, exr, i);
+ ecore_x_window_shape_input_rectangles_set(c->win, (Ecore_X_Rectangle*)exr, i);
#ifdef SHAPE_DEBUG
E_FREE_LIST(rl, free);
printf("\n");
@@ -3859,369 +728,125 @@ _e_comp_shapes_update_job(E_Comp *c)
c->shape_job = NULL;
}
-static void
-_e_comp_shapes_update(void *data, E_Container_Shape *es, E_Container_Shape_Change change)
-{
- E_Comp *c = data;
-#ifdef SHAPE_DEBUG
- const char const *change_text[] =
- {
- "ADD",
- "DEL",
- "SHOW",
- "HIDE",
- "MOVE",
- "RESIZE",
- "RECTS"
- };
-#endif
-
- if (change == E_CONTAINER_SHAPE_ADD) return;
- if (es)
- {
- if (!es->comp_win) return;
- switch (change)
- {
- /* these need to always get through since
- * it's guaranteed input shape will change when they occur
- */
- case E_CONTAINER_SHAPE_SHOW:
- case E_CONTAINER_SHAPE_HIDE:
- case E_CONTAINER_SHAPE_DEL:
- break;
- case E_CONTAINER_SHAPE_RECTS:
- case E_CONTAINER_SHAPE_INPUT_RECTS:
- es->comp_win->shape_changed = 1;
- _e_comp_win_render_queue(es->comp_win);
- default:
- /* any other changes only matter if the
- * object is visible
- */
- if (!es->visible) return;
- }
- SHAPE_INF("RESHAPE %u: %s", es->comp_win->win, change_text[change]);
- }
- if (!c->shape_job) c->shape_job = ecore_job_add((Ecore_Cb)_e_comp_shapes_update_job, c);
-}
-
//////////////////////////////////////////////////////////////////////////
-static void
-_e_comp_fps_toggle(void)
-{
- Eina_List *l;
- E_Comp *c;
- if (conf->fps_show)
- {
- conf->fps_show = 0;
- e_config_save_queue();
- }
- else
- {
- conf->fps_show = 1;
- e_config_save_queue();
- }
- EINA_LIST_FOREACH(compositors, l, c)
- _e_comp_cb_update(c);
-}
static Eina_Bool
-_e_comp_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+_e_comp_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Key *ev)
{
- Ecore_Event_Key *ev = event;
-
if ((!strcasecmp(ev->keyname, "f")) &&
(ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) &&
(ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
(ev->modifiers & ECORE_EVENT_MODIFIER_ALT))
{
- _e_comp_fps_toggle();
+ e_comp_canvas_fps_toggle();
}
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
-_e_comp_signal_user(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+_e_comp_signal_user(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Signal_User *ev)
{
- Ecore_Event_Signal_User *ev = event;
-
if (ev->number == 1)
{
- // e17 uses this to pop up config panel
+ // e uses this to pop up config panel
}
else if (ev->number == 2)
{
- _e_comp_fps_toggle();
+ e_comp_canvas_fps_toggle();
}
return ECORE_CALLBACK_PASS_ON;
}
//////////////////////////////////////////////////////////////////////////
-static void
-_e_comp_populate(E_Comp *c)
-{
- Ecore_X_Window *wins;
- Eina_List *l;
- E_Container *con;
- int i, num;
-
- c->layout = e_layout_add(c->evas);
- evas_object_name_set(c->layout, "c->layout");
- evas_object_layer_set(c->layout, E_COMP_CANVAS_LAYER_LAYOUT);
- evas_object_show(c->layout);
-
- EINA_LIST_FOREACH(c->man->containers, l, con)
- e_container_shape_change_callback_add(con, _e_comp_shapes_update, c);
- ecore_evas_lower(c->ee);
- wins = ecore_x_window_children_get(c->man->root, &num);
- if (!wins) return;
- for (i = 0; i < num; i++)
- {
- E_Comp_Win *cw;
-
- if (wins[i] == c->win) continue;
- if (e_border_find_by_client_window(wins[i]) ||
- e_border_find_by_window(wins[i])) continue;
- cw = _e_comp_win_add(c, wins[i], NULL);
- if (!cw) continue;
- if (cw->free_shape) _e_comp_win_shape_create(cw, cw->hidden.x, cw->hidden.y, cw->hidden.w, cw->hidden.h);
- if ((!cw->bd) && (ecore_x_window_visible_get(wins[i])))
- _e_comp_win_show(cw);
- }
- free(wins);
- if (!c->shape_job) c->shape_job = ecore_job_add((Ecore_Cb)_e_comp_shapes_update_job, c);
-}
static void
-_e_comp_add_fail_job(void *d EINA_UNUSED)
+_e_comp_free(E_Comp *c)
{
- e_util_dialog_internal
- (_("Compositor Warning"),
- _("Your display driver does not support OpenGL, GLSL<br>"
- "shaders or no OpenGL engines were compiled or installed<br>"
- "for Evas or Ecore-Evas. Falling back to software engine.<br>"
- "<br>"
- "You will need an OpenGL 2.0 (or OpenGL ES 2.0) capable<br>"
- "GPU to use OpenGL with compositing."));
-}
+ E_FREE_LIST(c->zones, e_object_del);
-static E_Comp *
-_e_comp_add(E_Manager *man)
-{
- E_Comp *c;
- Ecore_X_Window_Attributes att;
- Eina_Bool res;
+ e_comp_canvas_clear(c);
- c = calloc(1, sizeof(E_Comp));
- if (!c) return NULL;
+ ecore_evas_free(c->ee);
+ eina_stringshare_del(c->name);
- res = ecore_x_screen_is_composited(man->num);
- if (res)
- {
- e_util_dialog_internal
- (_("Compositor Error"), _("Another compositor is already running<br>"
- "on your display server."));
- free(c);
- return NULL;
- }
+ if (c->render_animator) ecore_animator_del(c->render_animator);
+ if (c->update_job) ecore_job_del(c->update_job);
+ if (c->screen_job) ecore_job_del(c->screen_job);
+ if (c->nocomp_delay_timer) ecore_timer_del(c->nocomp_delay_timer);
+ if (c->nocomp_override_timer) ecore_timer_del(c->nocomp_override_timer);
- c->cm_selection = ecore_x_window_input_new(man->root, 0, 0, 1, 1);
- if (!c->cm_selection)
- {
- free(c);
- return NULL;
- }
- ecore_x_screen_is_composited_set(man->num, c->cm_selection);
+ free(c);
+}
- c->man = man;
- man->comp = c;
- c->win = ecore_x_composite_render_window_enable(man->root);
- if (!c->win)
- {
- e_util_dialog_internal
- (_("Compositor Error"), _("Your display server does not support the<br>"
- "compositor overlay window. This is needed<br>"
- "for it to function."));
- free(c);
- return NULL;
- }
+//////////////////////////////////////////////////////////////////////////
- memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
- ecore_x_window_attributes_get(c->win, &att);
+static Eina_Bool
+_e_comp_override_expire(void *data)
+{
+ E_Comp *c = data;
+
+ c->nocomp_override_timer = NULL;
+ c->nocomp_override--;
- if ((att.depth != 24) && (att.depth != 32))
+ if (c->nocomp_override <= 0)
{
- /*
- e_util_dialog_internal
- (_("Compositor Error"), _("Your screen is not in 24/32bit display mode.<br>"
- "This is required to be your default depth<br>"
- "setting for the compositor to work properly."));
- ecore_x_composite_render_window_disable(c->win);
- free(c);
- return NULL;
- */
+ c->nocomp_override = 0;
+ if (c->nocomp_want) _e_comp_cb_nocomp_begin(c);
}
+ return EINA_FALSE;
+}
- if (c->man->num == 0) e_alert_composite_win(c->man->root, c->win);
+//////////////////////////////////////////////////////////////////////////
- if (gl_avail && (conf->engine == E_COMP_ENGINE_GL))
- {
- int opt[20];
- int opt_i = 0;
+static Eina_Bool
+_e_comp_screensaver_on(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
+{
+ Eina_List *l, *ll;
+ E_Zone *zone;
+ E_Comp *c;
- if (conf->indirect)
- {
- opt[opt_i] = ECORE_EVAS_GL_X11_OPT_INDIRECT;
- opt_i++;
- opt[opt_i] = 1;
- opt_i++;
- }
- if (conf->vsync)
- {
- opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
- opt_i++;
- opt[opt_i] = 1;
- opt_i++;
- }
-#ifdef ECORE_EVAS_GL_X11_OPT_SWAP_MODE
- if (conf->swap_mode)
- {
- opt[opt_i] = ECORE_EVAS_GL_X11_OPT_SWAP_MODE;
- opt_i++;
- opt[opt_i] = conf->swap_mode;
- opt_i++;
- }
-#endif
- if (opt_i > 0)
- {
- opt[opt_i] = ECORE_EVAS_GL_X11_OPT_NONE;
- c->ee = ecore_evas_gl_x11_options_new
- (NULL, c->win, 0, 0, man->w, man->h, opt);
- }
- if (!c->ee)
- c->ee = ecore_evas_gl_x11_new(NULL, c->win, 0, 0, man->w, man->h);
- if (c->ee)
+ // fixme: use hash if compositors list > 4
+ EINA_LIST_FOREACH(compositors, l, c)
+ {
+ if (c->saver) continue;
+ c->saver = EINA_TRUE;
+ EINA_LIST_FOREACH(c->zones, ll, zone)
{
- c->gl = 1;
- ecore_evas_gl_x11_pre_post_swap_callback_set
- (c->ee, c, _e_comp_pre_swap, NULL);
+ e_comp_override_add(c);
+ e_zone_fade_handle(zone, 1, 3.0);
+ edje_object_signal_emit(zone->base, "e,state,screensaver,on", "e");
+ edje_object_signal_emit(zone->over, "e,state,screensaver,on", "e");
}
}
- if (!c->ee)
- {
- c->ee = ecore_evas_software_x11_new(NULL, c->win, 0, 0, man->w, man->h);
- if (conf->engine == E_COMP_ENGINE_GL)
- ecore_job_add(_e_comp_add_fail_job, NULL);
- }
-
- ecore_evas_name_class_set(c->ee, "E", "Comp_EE");
- // ecore_evas_manual_render_set(c->ee, conf->lock_fps);
- c->evas = ecore_evas_get(c->ee);
- ecore_evas_data_set(c->ee, "comp", c);
- ecore_evas_show(c->ee);
-
- c->ee_win = ecore_evas_window_get(c->ee);
- e_drop_xdnd_register_set(c->win, 1);
- c->pointer = e_pointer_window_new(c->ee_win, 0);
- ecore_x_composite_redirect_subwindows
- (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
- ecore_x_window_key_grab(c->man->root, "Home", ECORE_EVENT_MODIFIER_SHIFT |
- ECORE_EVENT_MODIFIER_CTRL |
- ECORE_EVENT_MODIFIER_ALT, 0);
- ecore_x_window_key_grab(c->man->root, "F", ECORE_EVENT_MODIFIER_SHIFT |
- ECORE_EVENT_MODIFIER_CTRL |
- ECORE_EVENT_MODIFIER_ALT, 0);
-
- return c;
-}
-
-EAPI void
-e_comp_populate(E_Comp *c)
-{
- _e_comp_populate(c);
+ return ECORE_CALLBACK_PASS_ON;
}
-static void
-_e_comp_del(E_Comp *c)
+static Eina_Bool
+_e_comp_screensaver_off(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
- E_Comp_Win *cw;
- E_Comp_Zone *cz;
- Eina_List *l;
- E_Container *con;
-
- c->man->comp = NULL;
- evas_event_freeze(c->evas);
- edje_freeze();
- EINA_LIST_FOREACH(c->man->containers, l, con)
- e_container_shape_change_callback_del(con, _e_comp_shapes_update, c);
-
- E_FREE_FUNC(c->fps_fg, evas_object_del);
- E_FREE_FUNC(c->fps_bg, evas_object_del);
- E_FREE_FUNC(c->shape_job, ecore_job_del);
- E_FREE_FUNC(c->pointer, e_object_del);
-
- ecore_x_window_key_ungrab(c->man->root, "F", ECORE_EVENT_MODIFIER_SHIFT |
- ECORE_EVENT_MODIFIER_CTRL |
- ECORE_EVENT_MODIFIER_ALT, 0);
- ecore_x_window_key_ungrab(c->man->root, "Home", ECORE_EVENT_MODIFIER_SHIFT |
- ECORE_EVENT_MODIFIER_CTRL |
- ECORE_EVENT_MODIFIER_ALT, 0);
- if (c->grabbed)
- {
- c->grabbed = 0;
- ecore_x_ungrab();
- }
- while (c->wins)
- {
- cw = (E_Comp_Win *)(c->wins);
- cw->force = 1;
- _e_comp_win_hide(cw);
- cw->force = 1;
- _e_comp_win_del(cw);
- }
+ Eina_List *l, *ll;
+ E_Zone *zone;
+ E_Comp *c;
- EINA_LIST_FREE(c->zones, cz)
+ // fixme: use hash if compositors list > 4
+ EINA_LIST_FOREACH(compositors, l, c)
{
- if (cz->zone) cz->zone->comp_zone = NULL;
- evas_object_del(cz->base);
- evas_object_del(cz->over);
- if (!conf->nofade)
+ if (!c->saver) continue;
+ c->saver = EINA_FALSE;
+ EINA_LIST_FOREACH(c->zones, ll, zone)
{
- if (cz->bloff)
- {
- if (e_backlight_mode_get(cz->zone) != E_BACKLIGHT_MODE_NORMAL)
- e_backlight_mode_set(cz->zone, E_BACKLIGHT_MODE_NORMAL);
- e_backlight_level_set(cz->zone, e_config->backlight.normal, 0.0);
- }
+ edje_object_signal_emit(zone->base, "e,state,screensaver,off", "e");
+ edje_object_signal_emit(zone->over, "e,state,screensaver,off", "e");
+ e_zone_fade_handle(zone, 0, 0.5);
+ e_comp_override_timed_pop(c);
}
- free(cz);
}
- if (c->layout) evas_object_del(c->layout);
-
- ecore_evas_free(c->ee);
- ecore_x_composite_unredirect_subwindows
- (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
- if (c->block_win) ecore_x_window_free(c->block_win);
- ecore_x_composite_render_window_disable(c->win);
- if (c->man->num == 0) e_alert_composite_win(c->man->root, 0);
- if (c->render_animator) ecore_animator_del(c->render_animator);
- if (c->new_up_timer) ecore_timer_del(c->new_up_timer);
- if (c->update_job) ecore_job_del(c->update_job);
- if (c->wins_list) eina_list_free(c->wins_list);
- if (c->screen_job) ecore_job_del(c->screen_job);
- if (c->nocomp_delay_timer) ecore_timer_del(c->nocomp_delay_timer);
- if (c->nocomp_override_timer) ecore_timer_del(c->nocomp_override_timer);
-
- ecore_x_window_free(c->cm_selection);
- ecore_x_screen_is_composited_set(c->man->num, 0);
-
- free(c);
+ return ECORE_CALLBACK_PASS_ON;
}
-//////////////////////////////////////////////////////////////////////////
-
static void
_e_comp_sys_done_cb(void *data, Evas_Object *obj, const char *sig, const char *src)
{
@@ -4235,7 +860,7 @@ _e_comp_sys_action_timeout(void *data)
{
Eina_List *l, *ll;
E_Comp *c;
- E_Comp_Zone *cz;
+ E_Zone *zone;
E_Sys_Action a = (long)(intptr_t)data;
const char *sig = NULL;
@@ -4263,8 +888,8 @@ _e_comp_sys_action_timeout(void *data)
if (sig)
{
EINA_LIST_FOREACH(compositors, l, c)
- EINA_LIST_FOREACH(c->zones, ll, cz)
- edje_object_signal_callback_del(cz->over, sig, "e", _e_comp_sys_done_cb);
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ edje_object_signal_callback_del(zone->over, sig, "e", _e_comp_sys_done_cb);
}
e_sys_action_raw_do(a, NULL);
return EINA_FALSE;
@@ -4274,21 +899,21 @@ static void
_e_comp_sys_emit_cb_wait(E_Sys_Action a, const char *sig, const char *rep, Eina_Bool nocomp_push)
{
Eina_List *l, *ll;
- E_Comp_Zone *cz;
+ E_Zone *zone;
E_Comp *c;
Eina_Bool first = EINA_TRUE;
EINA_LIST_FOREACH(compositors, l, c)
{
if (nocomp_push) e_comp_override_add(c);
- else _e_comp_override_timed_pop(c);
- EINA_LIST_FOREACH(c->zones, ll, cz)
+ else e_comp_override_timed_pop(c);
+ EINA_LIST_FOREACH(c->zones, ll, zone)
{
- _e_comp_fade_handle(cz, nocomp_push, 0.5);
- edje_object_signal_emit(cz->base, sig, "e");
- edje_object_signal_emit(cz->over, sig, "e");
+ e_zone_fade_handle(zone, nocomp_push, 0.5);
+ edje_object_signal_emit(zone->base, sig, "e");
+ edje_object_signal_emit(zone->over, sig, "e");
if ((rep) && (first))
- edje_object_signal_callback_add(cz->over, rep, "e", _e_comp_sys_done_cb, (void *)(long)a);
+ edje_object_signal_callback_add(zone->over, rep, "e", _e_comp_sys_done_cb, (void *)(long)a);
first = EINA_FALSE;
}
}
@@ -4340,43 +965,24 @@ _e_comp_sys_resume(void)
_e_comp_sys_emit_cb_wait(E_SYS_SUSPEND, "e,state,sys,resume", NULL, EINA_FALSE);
}
-static Eina_Bool
-_e_comp_opacity_set_timer_cb(E_Comp_Win *cw)
-{
- unsigned int opacity;
-
- cw->bd->client.netwm.opacity = cw->opacity;
- e_remember_update(cw->bd);
- opacity = (cw->opacity << 24);
- ecore_x_window_prop_card32_set(cw->bd->client.win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, &opacity, 1);
- cw->bd->client.netwm.opacity_changed = 1;
- cw->opacity_set_timer = NULL;
- return EINA_FALSE;
-}
-
-static E_Comp_Win *
-_e_comp_act_opacity_win_finder(E_Object *obj)
+static Evas_Object *
+_e_comp_act_opacity_obj_finder(E_Object *obj)
{
- E_Border *bd;
+ E_Client *ec;
switch (obj->type)
{
case E_WIN_TYPE:
- bd = ((E_Win*)obj)->border;
- if (!bd) return NULL;
- return _e_comp_border_client_find(bd->client.win);
- case E_BORDER_TYPE:
- bd = (E_Border*)obj;
- return _e_comp_border_client_find(bd->client.win);
- case E_POPUP_TYPE:
- return evas_object_data_get(((E_Popup*)obj)->content, "comp_win");
+ ec = ((E_Win*)obj)->client;
+ return ec ? ec->frame : NULL;
+ case E_CLIENT_TYPE:
+ return ((E_Client*)obj)->frame;
default:
case E_ZONE_TYPE:
- case E_CONTAINER_TYPE:
case E_MANAGER_TYPE:
case E_MENU_TYPE:
- bd = e_border_focused_get();
- if (bd) return _e_comp_border_client_find(bd->client.win);
+ ec = e_client_focused_get();
+ return ec ? ec->frame : NULL;
}
return NULL;
}
@@ -4384,31 +990,32 @@ _e_comp_act_opacity_win_finder(E_Object *obj)
static void
_e_comp_act_opacity_change_go(E_Object *obj, const char *params)
{
- int opacity;
- E_Comp_Win *cw;
+ int opacity, cur;
+ Evas_Object *o;
if ((!params) || (!params[0])) return;
- cw = _e_comp_act_opacity_win_finder(obj);
- if (!cw) return;
+ o = _e_comp_act_opacity_obj_finder(obj);
+ if (!o) return;
opacity = atoi(params);
opacity = E_CLAMP(opacity, -255, 255);
- opacity += cw->opacity;
- opacity = MAX(0, opacity);
- e_comp_win_opacity_set(cw, opacity);
+ evas_object_color_get(o, NULL, NULL, NULL, &cur);
+ opacity += cur;
+ opacity = E_CLAMP(opacity, 0, 255);
+ evas_object_color_set(o, opacity, opacity, opacity, opacity);
}
static void
_e_comp_act_opacity_set_go(E_Object * obj __UNUSED__, const char *params)
{
int opacity;
- E_Comp_Win *cw;
+ Evas_Object *o;
if ((!params) || (!params[0])) return;
- cw = _e_comp_act_opacity_win_finder(obj);
- if (!cw) return;
+ o = _e_comp_act_opacity_obj_finder(obj);
+ if (!o) return;
opacity = atoi(params);
opacity = E_CLAMP(opacity, 0, 255);
- e_comp_win_opacity_set(cw, opacity);
+ evas_object_color_set(o, opacity, opacity, opacity, opacity);
}
//////////////////////////////////////////////////////////////////////////
@@ -4416,45 +1023,17 @@ _e_comp_act_opacity_set_go(E_Object * obj __UNUSED__, const char *params)
EINTERN Eina_Bool
e_comp_init(void)
{
- if (!ecore_x_composite_query())
- {
- e_error_message_show
- (_("Your display server does not support XComposite, "
- "or Ecore-X was built without XComposite support. "
- "Note that for composite support you will also need "
- "XRender and XFixes support in X11 and Ecore."));
- return EINA_FALSE;
- }
- if (!ecore_x_damage_query())
- {
- e_error_message_show
- (_("Your display server does not support XDamage "
- "or Ecore was built without XDamage support."));
- return EINA_FALSE;
- }
-
_e_comp_log_dom = eina_log_domain_register("e_comp", EINA_COLOR_YELLOW);
eina_log_domain_level_set("e_comp", EINA_LOG_LEVEL_INFO);
+ E_EVENT_COMPOSITOR_RESIZE = ecore_event_type_new();
+ E_EVENT_COMP_OBJECT_ADD = ecore_event_type_new();
+
e_sys_handlers_set(_e_comp_sys_suspend, _e_comp_sys_hibernate,
_e_comp_sys_reboot, _e_comp_sys_shutdown,
_e_comp_sys_logout, _e_comp_sys_resume);
- windows = eina_hash_string_superfast_new(NULL);
- borders = eina_hash_string_superfast_new(NULL);
- damages = eina_hash_string_superfast_new(NULL);
- ignores = eina_hash_string_superfast_new(NULL);
-
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHOW_REQUEST, _e_comp_show_request, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DESTROY, _e_comp_destroy, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHOW, _e_comp_show, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_HIDE, _e_comp_hide, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_REPARENT, _e_comp_reparent, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_CONFIGURE, _e_comp_configure, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STACK, _e_comp_stack, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHAPE, _e_comp_shape, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DAMAGE_NOTIFY, _e_comp_damage, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DAMAGE, _e_comp_damage_win, NULL);
+ ignores = eina_hash_pointer_new(NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_screensaver_on, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _e_comp_screensaver_off, NULL);
@@ -4462,32 +1041,9 @@ e_comp_init(void)
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _e_comp_key_down, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_SIGNAL_USER, _e_comp_signal_user, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONTAINER_RESIZE, _e_comp_randr, NULL);
-
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_MOVE_RESIZE, _e_comp_zonech, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_ADD, _e_comp_zonech, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DEL, _e_comp_zonech, NULL);
-
- hooks = eina_list_append(hooks, e_border_hook_add(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN, _e_comp_bd_add, NULL));
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_REMOVE, _e_comp_bd_del, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_SHOW, _e_comp_bd_show, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_HIDE, _e_comp_bd_hide, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_MOVE, _e_comp_bd_move, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_RESIZE, _e_comp_bd_resize, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_ICONIFY, _e_comp_bd_iconify, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_UNICONIFY, _e_comp_bd_uniconify, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_URGENT_CHANGE, _e_comp_bd_urgent_change, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_FOCUS_IN, _e_comp_bd_focus_in, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_FOCUS_OUT, _e_comp_bd_focus_out, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_PROPERTY, _e_comp_bd_property, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_FULLSCREEN, _e_comp_bd_fullscreen, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_UNFULLSCREEN, _e_comp_bd_unfullscreen, NULL);
-
- E_EVENT_COMP_SOURCE_VISIBILITY = ecore_event_type_new();
- E_EVENT_COMP_SOURCE_ADD = ecore_event_type_new();
- E_EVENT_COMP_SOURCE_DEL = ecore_event_type_new();
- E_EVENT_COMP_SOURCE_CONFIGURE = ecore_event_type_new();
- E_EVENT_COMP_SOURCE_STACK = ecore_event_type_new();
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_MOVE_RESIZE, _e_comp_cb_zone_change, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_ADD, _e_comp_cb_zone_change, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DEL, _e_comp_cb_zone_change, NULL);
e_comp_cfdata_edd_init(&conf_edd, &conf_match_edd);
conf = e_config_domain_load("e_comp", conf_edd);
@@ -4516,12 +1072,6 @@ e_comp_init(void)
conf->version = E_COMP_VERSION;
}
- if (!getenv("ECORE_X_NO_XLIB"))
- {
- if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11))
- gl_avail = EINA_TRUE;
- }
-
{
E_Action *act;
@@ -4539,23 +1089,35 @@ e_comp_init(void)
actions = eina_list_append(actions, act);
}
+#ifndef WAYLAND_ONLY
+ if (!e_comp_x_init()) return EINA_FALSE;
+#endif
#ifdef HAVE_WAYLAND_CLIENTS
if (!e_comp_wl_init())
- EINA_LOG_ERR("Failed to initialize Wayland Client Support !!");
+ {
+ EINA_LOG_ERR("Failed to initialize Wayland Client Support !!");
+ return EINA_FALSE;
+ }
#endif
-
return EINA_TRUE;
}
-EINTERN Eina_Bool
-e_comp_manager_init(E_Manager *man)
+EAPI E_Comp *
+e_comp_new(void)
{
E_Comp *c;
+ char name[40];
- c = _e_comp_add(man);
- if (c)
- compositors = eina_list_append(compositors, c);
- return !!c;
+ c = E_OBJECT_ALLOC(E_Comp, E_COMP_TYPE, _e_comp_free);
+ if (!c) return NULL;
+
+ c->num = eina_list_count(compositors);
+ snprintf(name, sizeof(name), _("Compositor %u"), c->num);
+ c->name = eina_stringshare_add(name);
+ c->render_animator = ecore_animator_add(_e_comp_cb_animator, c);
+ ecore_animator_freeze(c->render_animator);
+ compositors = eina_list_append(compositors, c);
+ return c;
}
EAPI int
@@ -4567,12 +1129,17 @@ e_comp_internal_save(void)
EINTERN int
e_comp_shutdown(void)
{
- if (!compositors) return 1;
+ E_Comp *c;
+
E_FREE_FUNC(action_timeout, ecore_timer_del);
- E_FREE_LIST(compositors, _e_comp_del);
+ EINA_LIST_FREE(compositors, c)
+ {
+ E_FREE_LIST(c->clients, e_object_del);
+ e_object_del(E_OBJECT(c));
+ }
E_FREE_LIST(handlers, ecore_event_handler_del);
E_FREE_LIST(actions, e_object_del);
- E_FREE_LIST(hooks, e_border_hook_del);
+ E_FREE_LIST(hooks, e_client_hook_del);
#ifdef HAVE_WAYLAND_CLIENTS
e_comp_wl_shutdown();
@@ -4586,178 +1153,105 @@ e_comp_shutdown(void)
conf_match_edd = NULL;
conf_edd = NULL;
- if (ignores) eina_hash_free(ignores);
- if (damages) eina_hash_free(damages);
- if (windows) eina_hash_free(windows);
- if (borders) eina_hash_free(borders);
- ignores = NULL;
- damages = NULL;
- windows = NULL;
- borders = NULL;
+ E_FREE_FUNC(ignores, eina_hash_free);
e_sys_handlers_set(NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}
-EAPI E_Comp_Config *
-e_comp_config_get(void)
-{
- return conf;
-}
-
-EAPI const Eina_List *
-e_comp_list(void)
-{
- return compositors;
-}
-
EAPI void
-e_comp_shadows_reset(void)
+e_comp_render_queue(E_Comp *c)
{
- Eina_List *l;
- E_Comp *c;
+ E_OBJECT_CHECK(c);
+ E_OBJECT_TYPE_CHECK(c, E_COMP_TYPE);
+ if (!c) return;
- EINA_LIST_FOREACH(compositors, l, c)
+ if (conf->lock_fps)
{
- E_Comp_Win *cw;
-
- // ecore_evas_manual_render_set(c->ee, conf->lock_fps);
- _e_comp_fps_update(c);
- E_LIST_FOREACH(c->zones, e_comp_zone_update);
- EINA_INLIST_FOREACH(c->wins, cw)
+ ecore_animator_thaw(c->render_animator);
+ }
+ else
+ {
+ if (c->update_job)
{
- if ((!cw->shobj) || (!cw->obj)) continue;
- _e_comp_win_shadow_setup(cw);
+ DBG("UPDATE JOB DEL...");
+ E_FREE_FUNC(c->update_job, ecore_job_del);
}
+ DBG("UPDATE JOB ADD...");
+ c->update_job = ecore_job_add(_e_comp_cb_job, c);
}
}
EAPI void
-e_comp_render_update(E_Comp *c)
+e_comp_shape_queue(E_Comp *c)
{
- _e_comp_render_queue(c);
-}
+ EINA_SAFETY_ON_NULL_RETURN(c);
-EAPI E_Comp_Win *
-e_comp_win_find_client_win(Ecore_X_Window win)
-{
- return _e_comp_border_client_find(win);
+ if (!c->shape_job)
+ c->shape_job = ecore_job_add((Ecore_Cb)_e_comp_shapes_update_job, c);
}
-EAPI E_Comp_Win *
-e_comp_win_find(Ecore_X_Window win)
+EAPI E_Comp_Config *
+e_comp_config_get(void)
{
- return _e_comp_win_find(win);
+ return conf;
}
EAPI const Eina_List *
-e_comp_win_list_get(E_Comp *c)
-{
- E_Comp_Win *cw;
-
- if (!c->wins) return NULL;
- if (c->wins_invalid)
- {
- c->wins_invalid = 0;
- if (c->wins_list) eina_list_free(c->wins_list);
- c->wins_list = NULL;
- EINA_INLIST_FOREACH(c->wins, cw)
- {
- if ((cw->shobj) && (cw->obj))
- c->wins_list = eina_list_append(c->wins_list, cw);
- }
- }
- return c->wins_list;
-}
-
-EAPI Evas_Object *
-e_comp_win_image_mirror_add(E_Comp_Win *cw)
+e_comp_list(void)
{
- if ((!cw) || (!cw->c)) return NULL;
- return _e_comp_win_mirror_add(cw);
+ return compositors;
}
EAPI void
-e_comp_win_hidden_set(E_Comp_Win *cw, Eina_Bool hidden)
+e_comp_shadows_reset(void)
{
- if (!cw->c) return;
- if (cw->hidden_override == hidden) return;
- cw->hidden_override = hidden;
- if (cw->bd) e_border_comp_hidden_set(cw->bd, cw->hidden_override);
- if (cw->visible)
- {
- if (cw->hidden_override)
- _e_comp_child_hide(cw);
- else if (!cw->bd || cw->bd->visible)
- _e_comp_child_show(cw);
- }
- else
- {
- if (cw->hidden_override) _e_comp_child_hide(cw);
- }
-}
+ Eina_List *l;
+ E_Comp *c;
-EAPI void
-e_comp_win_reshadow(E_Comp_Win *cw)
-{
- if (cw->visible) evas_object_hide(cw->effect_obj);
- _e_comp_win_shadow_setup(cw);
- // evas_object_move(cw->effect_obj, cw->x, cw->y);
- // evas_object_resize(cw->effect_obj, cw->pw, cw->ph);
- if (!cw->visible) return;
- cw->geom_update = 1;
- evas_object_show(cw->effect_obj);
- if (cw->show_ready)
+ EINA_LIST_FOREACH(compositors, l, c)
{
- cw->defer_hide = 0;
- if (!cw->hidden_override) _e_comp_child_show(cw);
- edje_object_signal_emit(cw->shobj, "e,state,visible,on", "e");
- if (!cw->animating)
- {
- cw->c->animating++;
- }
- cw->animating = 1;
- _e_comp_win_render_queue(cw);
+ E_Client *ec;
+
+ _e_comp_fps_update(c);
+ E_LIST_FOREACH(c->zones, e_comp_canvas_zone_update);
+ E_CLIENT_FOREACH(c, ec)
+ e_comp_object_frame_theme_set(ec->frame, E_COMP_OBJECT_FRAME_RESHADOW);
}
}
EAPI E_Comp *
-e_comp_get(void *o)
+e_comp_get(const void *o)
{
- E_Border *bd;
- E_Popup *pop;
+ E_Client *ec;
E_Shelf *es;
E_Menu *m;
E_Desk *desk;
E_Menu_Item *mi;
- E_Object *obj = o;
+ const E_Object *obj = o;
E_Zone *zone = NULL;
- E_Container *con = NULL;
E_Manager *man = NULL;
E_Gadcon_Popup *gp;
E_Gadcon *gc;
E_Gadcon_Client *gcc;
E_Drag *drag;
+ E_Win *ewin;
if (!o) obj = (E_Object*)e_manager_current_get();
/* try to get to zone type first */
switch (obj->type)
{
+ case E_WIN_TYPE:
+ ewin = (E_Win*)obj;
+ return ewin->comp;
case E_DESK_TYPE:
desk = (E_Desk*)obj;
obj = (void*)desk->zone;
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
break;
- case E_BORDER_TYPE:
- bd = (E_Border*)obj;
- obj = (void*)bd->zone;
- EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
- break;
- case E_POPUP_TYPE:
- pop = (E_Popup*)obj;
- obj = (void*)pop->zone;
- EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
- break;
+ case E_CLIENT_TYPE:
+ ec = (E_Client*)obj;
+ return ec->comp;
case E_MENU_TYPE:
m = (E_Menu*)obj;
obj = (void*)m->zone;
@@ -4773,16 +1267,13 @@ e_comp_get(void *o)
obj = (void*)es->zone;
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
break;
- case E_GADCON_POPUP_TYPE:
- gp = (E_Gadcon_Popup*)obj;
- obj = (void*)gp->win->zone;
- EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
- break;
case E_DRAG_TYPE:
drag = (E_Drag*)obj;
- obj = (void*)drag->container;
+ return drag->comp;
+ case E_GADCON_POPUP_TYPE:
+ gp = (E_Gadcon_Popup*)obj;
+ obj = (void*)gp->gcc;
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
- break;
case E_GADCON_CLIENT_TYPE:
gcc = (E_Gadcon_Client*)obj;
obj = (void*)gcc->gadcon;
@@ -4799,12 +1290,7 @@ e_comp_get(void *o)
{
case E_ZONE_TYPE:
if (!zone) zone = (E_Zone*)obj;
- con = zone->container;
- EINA_SAFETY_ON_NULL_RETURN_VAL(con, NULL);
- case E_CONTAINER_TYPE:
- if (!con) con = (E_Container*)obj;
- man = con->manager;
- EINA_SAFETY_ON_NULL_RETURN_VAL(man, NULL);
+ return zone->comp;
case E_MANAGER_TYPE:
if (!man) man = (E_Manager*)obj;
return man->comp;
@@ -4813,317 +1299,73 @@ e_comp_get(void *o)
return NULL;
}
-EAPI void
-e_comp_zone_update(E_Comp_Zone *cz)
-{
- Evas_Object *o;
- const char *const over_styles[] =
- {
- "e/comp/screen/overlay/default",
- "e/comp/screen/overlay/noeffects"
- };
- const char *const under_styles[] =
- {
- "e/comp/screen/base/default",
- "e/comp/screen/base/noeffects"
- };
- if (cz->over && cz->base)
- {
- e_theme_edje_object_set(cz->base, "base/theme/comp",
- under_styles[conf->disable_screen_effects]);
- edje_object_part_swallow(cz->base, "e.swallow.background",
- cz->zone->transition_object ?: cz->zone->bg_object);
- e_theme_edje_object_set(cz->over, "base/theme/comp",
- over_styles[conf->disable_screen_effects]);
- return;
- }
- E_FREE_FUNC(cz->base, evas_object_del);
- E_FREE_FUNC(cz->over, evas_object_del);
- cz->base = o = edje_object_add(cz->comp->evas);
- evas_object_repeat_events_set(o, 1);
- evas_object_name_set(cz->base, "cz->base");
- e_theme_edje_object_set(o, "base/theme/comp", under_styles[conf->disable_screen_effects]);
- edje_object_part_swallow(cz->base, "e.swallow.background", cz->zone->transition_object ?: cz->zone->bg_object);
- evas_object_move(o, cz->zone->x, cz->zone->y);
- evas_object_resize(o, cz->zone->w, cz->zone->h);
- evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BG);
- evas_object_show(o);
-
- cz->over = o = edje_object_add(cz->comp->evas);
- evas_object_layer_set(o, E_COMP_CANVAS_LAYER_MAX);
- evas_object_name_set(cz->over, "cz->over");
- evas_object_pass_events_set(o, 1);
- e_theme_edje_object_set(o, "base/theme/comp", over_styles[conf->disable_screen_effects]);
- evas_object_move(o, cz->zone->x, cz->zone->y);
- evas_object_resize(o, cz->zone->w, cz->zone->h);
- evas_object_raise(o);
- evas_object_show(o);
-}
-
-EAPI Ecore_X_Window
-e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y, Eina_Bool vis, Ecore_X_Window *ignore, unsigned int ignore_num)
+EAPI Ecore_Window
+e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y)
{
- E_Comp_Win *cw;
+ E_Client *ec;
Evas_Object *o;
- Eina_List *ignore_list = NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(c, 0);
o = evas_object_top_at_xy_get(c->evas, x, y, 0, 0);
if (!o) return c->ee_win;
- if (o != c->layout) return c->ee_win;
- if (ignore && ignore_num)
- {
- unsigned int i;
-
- for (i = 0; i < ignore_num; i++)
- {
- cw = e_comp_win_find(ignore[i]);
- if (cw)
- ignore_list = eina_list_append(ignore_list, cw->effect_obj);
- }
- }
- o = e_layout_top_child_at_xy_get(c->layout, x, y, vis, ignore_list);
- eina_list_free(ignore_list);
- cw = evas_object_data_get(o, "comp_win");
- if (!cw) return c->ee_win;
- return cw->real_obj ? c->ee_win : cw->win;
-}
-
-EAPI E_Comp_Win *
-e_comp_object_inject(E_Comp *c, Evas_Object *obj, E_Object *eobj, E_Layer layer)
-{
- E_Comp_Win *cw, *cwn;
- E_Container *con;
- int pos;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(c, NULL);
- EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
-
- con = e_container_current_get(c->man);
- EINA_SAFETY_ON_NULL_RETURN_VAL(con, NULL);
-
- pos = 1 + (layer / 50);
- if (pos > 10) pos = 10;
- cw = _e_comp_win_find(con->layers[pos].win);
- EINA_SAFETY_ON_NULL_RETURN_VAL(cw, NULL);
-
- cwn = _e_comp_win_dummy_add(c, obj, eobj, 0);
-
- _e_comp_win_lower_below(cwn, (E_Comp_Win*)EINA_INLIST_GET(cw));
- cw->stack_below = eina_list_append(cw->stack_below, cwn);
- cwn->cw_above = cw;
- evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _e_comp_injected_win_del_cb, cwn);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _e_comp_injected_win_focus_in_cb, cwn);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _e_comp_injected_win_focus_out_cb, cwn);
- return cwn;
-}
-
-EAPI E_Comp_Win *
-e_comp_object_add(E_Comp *c, Evas_Object *obj, E_Object *eobj)
-{
- E_Comp_Win *cw;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(c, NULL);
- EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
-
- cw = _e_comp_win_dummy_add(c, obj, eobj, 1);
-
- evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _e_comp_injected_win_del_cb, cw);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _e_comp_injected_win_show_cb, cw);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _e_comp_injected_win_hide_cb, cw);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _e_comp_injected_win_focus_in_cb, cw);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _e_comp_injected_win_focus_out_cb, cw);
- return cw;
+ ec = evas_object_data_get(o, "E_Client");
+ if (ec) return e_client_util_pwin_get(ec);
+ return c->ee_win;
}
EAPI void
-e_comp_win_move(E_Comp_Win *cw, Evas_Coord x, Evas_Coord y)
-{
- EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj);
- if (cw->visible)
- {
- if ((cw->x == x) && (cw->y == y)) return;
- }
- else
- {
- if ((cw->hidden.x == x) && (cw->hidden.y == y)) return;
- }
- if (cw->shape) e_container_shape_move(cw->shape, x, y);
- _e_comp_win_configure(cw, x, y, cw->w, cw->h, 0);
-}
-
-EAPI void
-e_comp_win_resize(E_Comp_Win *cw, int w, int h)
+e_comp_util_wins_print(const E_Comp *c)
{
- EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj);
- if ((cw->w == w) && (cw->h == h)) return;
- if (cw->shape) e_container_shape_resize(cw->shape, w, h);
- edje_extern_object_min_size_set(cw->obj, w, h);
- _e_comp_win_configure(cw, cw->x, cw->y, w, h, 0);
-}
+ Evas_Object *o;
-EAPI void
-e_comp_win_moveresize(E_Comp_Win *cw, Evas_Coord x, Evas_Coord y, int w, int h)
-{
- EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj);
- if ((cw->w == w) && (cw->h == h))
- {
- if (cw->visible)
- {
- if ((cw->x == x) && (cw->y == y)) return;
- }
- else
- {
- if ((cw->hidden.x == x) && (cw->hidden.y == y)) return;
- }
- }
- if (cw->shape)
+ if (!c) c = e_comp_get(NULL);
+ o = evas_object_top_get(c->evas);
+ while (o)
{
- e_container_shape_move(cw->shape, x, y);
- e_container_shape_resize(cw->shape, w, h);
- }
- edje_extern_object_min_size_set(cw->obj, w, h);
- _e_comp_win_configure(cw, x, y, w, h, 0);
-}
+ E_Client *ec;
+ int x, y, w, h;
-EAPI void
-e_comp_win_del(E_Comp_Win *cw)
-{
- if (!cw) return;
- if (cw->animating) cw->delete_me = 1;
- else _e_comp_win_del(cw);
-}
-
-EAPI void
-e_comp_win_hide(E_Comp_Win *cw)
-{
- EINA_SAFETY_ON_NULL_RETURN(cw);
- EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj);
- _e_comp_win_real_hide(cw);
-}
-
-EAPI void
-e_comp_win_show(E_Comp_Win *cw)
-{
- EINA_SAFETY_ON_NULL_RETURN(cw);
- EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj);
- cw->defer_hide = 0;
- cw->show_ready = 1;
- _e_comp_win_geometry_update(cw);
- _e_comp_win_show(cw);
-}
-
-EAPI E_Comp_Win *
-e_comp_canvas_layer_set(Evas_Object *obj, E_Comp_Canvas_Layer comp_layer, E_Layer layer, E_Comp_Canvas_Stack stack)
-{
- E_Comp_Win *cw;
- E_Comp *c;
-
- c = e_comp_util_evas_object_comp_get(obj);
- if (comp_layer == E_COMP_CANVAS_LAYER_LAYOUT)
- cw = e_comp_object_inject(c, obj, evas_object_data_get(obj, "eobj"), layer);
- else
- {
- cw = e_comp_object_add(c, obj, evas_object_data_get(obj, "eobj"));
- evas_object_layer_set(cw->effect_obj, comp_layer);
- if (comp_layer > E_COMP_CANVAS_LAYER_LAYOUT)
- e_comp_override_add(c);
+ ec = evas_object_data_get(o, "E_Client");
+ evas_object_geometry_get(o, &x, &y, &w, &h);
+ fprintf(stderr, "LAYER %d ", evas_object_layer_get(o));
+ if (ec)
+ fprintf(stderr, "COMP EC%s: %p - '%s:%s' || %d,%d @ %dx%d\n", ec->focused ? "*" : "", ec, ec->icccm.name, ec->icccm.class, x, y, w, h);
else
- {
- E_Comp_Win *cwn;
- E_Container *con;
-
- con = eina_list_data_get(c->man->containers);
- cwn = e_comp_win_find(con->layers[0].win);
- if (!cwn)
- {
- ERR("Major error. Cannot find container layer 0 window marker");
- c->wins = eina_inlist_prepend(c->wins, EINA_INLIST_GET(cw));
- }
- else
- {
- cwn->stack_below = eina_list_append(cwn->stack_below, cw);
- cw->cw_above = cwn;
- c->wins = eina_inlist_remove(c->wins, EINA_INLIST_GET(cw));
- c->wins = eina_inlist_prepend_relative(c->wins, EINA_INLIST_GET(cw), EINA_INLIST_GET(cwn));
- }
- }
+ fprintf(stderr, "COMP OBJ: %p - %s || %d,%d @ %dx%d\n", o, evas_object_name_get(o), x, y, w, h);
+ o = evas_object_below_get(o);
}
- if (stack == E_COMP_CANVAS_STACK_ABOVE)
- _e_comp_win_raise(cw);
- else if (stack == E_COMP_CANVAS_STACK_UNDER)
- _e_comp_win_lower(cw);
- return cw;
+ fputc('\n', stderr);
}
EAPI void
-e_comp_util_wins_print(const E_Comp *c)
+e_comp_ignore_win_add(E_Pixmap_Type type, Ecore_Window win)
{
- E_Comp_Win *cw;
+ E_Client *ec;
- if (!c) c = e_comp_get(NULL);
- EINA_INLIST_FOREACH(c->wins, cw)
- {
- if (cw->bd)
- fprintf(stderr, "COMP BD: %p - %u '%s:%s'\n", cw, cw->win, cw->bd->client.icccm.name, cw->bd->client.icccm.class);
- else if (cw->pop)
- fprintf(stderr, "COMP POP: %p - %s\n", cw, cw->pop->name);
- else if (cw->menu)
- fprintf(stderr, "COMP MENU: %p - %s\n", cw, cw->menu->header.title);
- else if (cw->real_obj)
- fprintf(stderr, "COMP OBJ: %p - %s\n", cw, evas_object_name_get(cw->obj));
- else
- {
- fprintf(stderr, "COMP WIN: %p - %u", cw, cw->win);
- if (cw->name || cw->title)
- {
- fprintf(stderr, " '%s", cw->name ?: "");
- if (cw->title)
- fprintf(stderr, ":%s", cw->title);
- fprintf(stderr, "'");
- }
- fprintf(stderr, "%s%s\n", cw->input_only ? " INPUT" : "", cw->override ? " OVERRIDE" : "");
- }
- }
+ eina_hash_add(ignores, &win, (void*)1);
+ ec = e_pixmap_find_client(type, win);
+ if (!ec) return;
+ ec->ignored = 1;
+ if (ec->visible) evas_object_hide(ec->frame);
}
EAPI void
-e_comp_ignore_win_add(Ecore_X_Window win)
+e_comp_ignore_win_del(E_Pixmap_Type type, Ecore_Window win)
{
- E_Comp_Win *cw;
-
- EINA_SAFETY_ON_TRUE_RETURN(_e_comp_ignore_find(win));
- eina_hash_add(ignores, e_util_winid_str_get(win), (void*)1);
- cw = _e_comp_win_find(win);
- if (!cw) return;
- cw->invalid = 1;
- _e_comp_win_del(cw);
+ E_Client *ec;
+
+ eina_hash_del_by_key(ignores, &win);
+ ec = e_pixmap_find_client(type, win);
+ if ((!ec) || (e_object_is_del(E_OBJECT(ec)))) return;
+ ec->ignored = 0;
+ if (ec->visible) evas_object_show(ec->frame);
}
-EAPI void
-e_comp_win_opacity_set(E_Comp_Win *cw, unsigned int opacity)
+EAPI Eina_Bool
+e_comp_ignore_win_find(Ecore_Window win)
{
- EINA_SAFETY_ON_NULL_RETURN(cw);
- if (opacity == cw->opacity) return;
- opacity = MIN(opacity, 255);
- cw->opacity = opacity;
- if (cw->bd)
- {
- if (cw->opacity_set_timer) ecore_timer_reset(cw->opacity_set_timer);
- else cw->opacity_set_timer = ecore_timer_add(5.0, (Ecore_Task_Cb)_e_comp_opacity_set_timer_cb, cw);
- }
- if (cw->opacity == 255)
- {
- edje_object_color_class_del(cw->shobj, "comp_alpha");
- }
- else
- {
- edje_object_color_class_set(cw->shobj, "comp_alpha",
- 255, 255, 255, cw->opacity,
- 255, 255, 255, cw->opacity,
- 255, 255, 255, cw->opacity);
- }
+ return !!eina_hash_find(ignores, &win);
}
EAPI void
@@ -5144,6 +1386,8 @@ e_comp_override_add(E_Comp *c)
if ((c->nocomp_override > 0) && (c->nocomp)) _e_comp_cb_nocomp_end(c);
}
+#if 0
+FIXME
EAPI void
e_comp_block_window_add(void)
{
@@ -5180,178 +1424,120 @@ e_comp_block_window_del(void)
c->block_win = 0;
}
}
+#endif
-EAPI void
-e_comp_win_effect_set(E_Comp_Win *cw, const char *effect)
+EAPI E_Comp *
+e_comp_find_by_window(Ecore_Window win)
{
- char buf[4096];
- Eina_Stringshare *grp;
-
- EINA_SAFETY_ON_NULL_RETURN(cw);
- if (!cw->shobj) return; //input window
+ Eina_List *l;
+ E_Comp *c;
- if (!effect) effect = "none";
- snprintf(buf, sizeof(buf), "e/comp/effects/%s", effect);
- edje_object_file_get(cw->effect_obj, NULL, &grp);
- if (!e_util_strcmp(buf, grp)) return;
- if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", buf))
- {
- snprintf(buf, sizeof(buf), "e/comp/effects/auto/%s", effect);
- if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", buf))
- if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", "e/comp/effects/none")) return;
- }
- edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj);
- if (cw->effect_clip)
+ EINA_LIST_FOREACH(compositors, l, c)
{
- evas_object_clip_unset(cw->effect_obj);
- cw->effect_clip = 0;
+ if ((c->win == win) || (c->ee_win == win) || (c->man->root == win)) return c;
}
- cw->effect_clip_able = !edje_object_data_get(cw->shobj, "noclip");
+ return NULL;
}
EAPI void
-e_comp_win_effect_params_set(E_Comp_Win *cw, int id, int *params, unsigned int count)
+e_comp_override_timed_pop(E_Comp *c)
{
- Edje_Message_Int_Set *msg;
- unsigned int x;
-
- EINA_SAFETY_ON_NULL_RETURN(cw);
- EINA_SAFETY_ON_NULL_RETURN(params);
- EINA_SAFETY_ON_FALSE_RETURN(count);
-
- msg = alloca(sizeof(Edje_Message_Int_Set) + ((count - 1) * sizeof(int)));
- msg->count = (int)count;
- for (x = 0; x < count; x++)
- msg->val[x] = params[x];
- edje_object_message_send(cw->effect_obj, EDJE_MESSAGE_INT_SET, id, msg);
- edje_object_message_signal_process(cw->effect_obj);
+ EINA_SAFETY_ON_NULL_RETURN(c);
+ if (c->nocomp_override <= 0) return;
+ if (c->nocomp_override_timer)
+ ecore_timer_reset(c->nocomp_override_timer);
+ else
+ c->nocomp_override_timer = ecore_timer_add(5.0, _e_comp_override_expire, c);
}
-static void
-_e_comp_win_effect_end_cb(void *data EINA_UNUSED, Evas_Object *obj, const char *emission, const char *source)
+EAPI unsigned int
+e_comp_e_object_layer_get(const E_Object *obj)
{
- Edje_Signal_Cb end_cb;
- void *end_data;
+ E_Gadcon *gc = NULL;
- end_cb = evas_object_data_get(obj, "_e_comp.end_cb");
- end_data = evas_object_data_get(obj, "_e_comp.end_data");
- end_cb(end_data, obj, emission, source);
+ if (!obj) return 0;
+ switch (obj->type)
+ {
+ case E_GADCON_CLIENT_TYPE:
+ gc = ((E_Gadcon_Client *)(obj))->gadcon;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(gc, 0);
+ case E_GADCON_TYPE:
+ if (!gc) gc = (E_Gadcon *)obj;
+ if (gc->shelf) return gc->shelf->layer;
+ if (!gc->toolbar) return E_LAYER_DESKTOP;
+ return gc->toolbar->fwin->client->layer;
- edje_object_signal_callback_del_full(obj, "e,action,done", "e", _e_comp_win_effect_end_cb, NULL);
+ case E_WIN_TYPE:
+ return ((E_Win *)(obj))->client->layer;
+
+ case E_ZONE_TYPE:
+ return E_LAYER_DESKTOP;
+
+ case E_CLIENT_TYPE:
+ return ((E_Client *)(obj))->layer;
+
+ /* FIXME: add more types as needed */
+ default:
+ break;
+ }
+ return 0;
}
-EAPI void
-e_comp_win_effect_clip(E_Comp_Win *cw)
+EAPI Eina_Bool
+e_comp_grab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd)
{
- EINA_SAFETY_ON_NULL_RETURN(cw);
- if (!cw->bd->zone) return;
- if (cw->effect_clip) e_comp_win_effect_unclip(cw);
- evas_object_clip_set(cw->effect_obj, cw->bd->zone->bg_clip_object);
- cw->effect_clip = 1;
+ return e_grabinput_get((!!mouse) * c->ee_win, 0, (!!kbd) * c->ee_win);
}
EAPI void
-e_comp_win_effect_unclip(E_Comp_Win *cw)
+e_comp_ungrab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd)
{
- EINA_SAFETY_ON_NULL_RETURN(cw);
- if (!cw->effect_clip) return;
- evas_object_clip_unset(cw->effect_obj);
- cw->effect_clip = 0;
+ e_grabinput_release((!!mouse) * c->ee_win, (!!kbd) * c->ee_win);
+ evas_event_feed_mouse_out(c->evas, 0, NULL);
+ evas_event_feed_mouse_in(c->evas, 0, NULL);
}
EAPI void
-e_comp_win_effect_start(E_Comp_Win *cw, Edje_Signal_Cb end_cb, const void *end_data)
+e_comp_gl_set(Eina_Bool set)
{
- EINA_SAFETY_ON_NULL_RETURN(cw);
- EINA_SAFETY_ON_FALSE_RETURN(cw->bd); //FIXME
- if (cw->effect_clip)
- {
- evas_object_clip_unset(cw->effect_obj);
- cw->effect_clip = 0;
- }
- if (cw->effect_clip_able)
- {
- if (cw->bd->zone)
- {
- evas_object_clip_set(cw->effect_obj, cw->bd->zone->bg_clip_object);
- cw->effect_clip = 1;
- }
- }
- /* this is a stack, so the callbacks added first will be called last */
- edje_object_signal_callback_del_full(cw->effect_obj, "e,action,done", "e", _e_comp_win_effect_end_cb, NULL);
-
- edje_object_signal_callback_add(cw->effect_obj, "e,action,done", "e", _e_comp_win_effect_end_cb, NULL);
- evas_object_data_set(cw->effect_obj, "_e_comp.end_cb", end_cb);
- evas_object_data_set(cw->effect_obj, "_e_comp.end_data", end_data);
-
- edje_object_signal_emit(cw->effect_obj, "e,action,go", "e");
+ gl_avail = !!set;
}
-EAPI void
-e_comp_win_effect_stop(E_Comp_Win *cw, Edje_Signal_Cb end_cb EINA_UNUSED)
+EAPI Eina_Bool
+e_comp_gl_get(void)
{
- EINA_SAFETY_ON_NULL_RETURN(cw);
- if (cw->effect_clip)
- {
- evas_object_clip_unset(cw->effect_obj);
- cw->effect_clip = 0;
- }
- edje_object_signal_emit(cw->effect_obj, "e,action,stop", "e");
- edje_object_signal_callback_del_full(cw->effect_obj, "e,action,done", "e", _e_comp_win_effect_end_cb, NULL);
+ return gl_avail;
}
-EAPI unsigned int
-e_comp_e_object_layer_get(const E_Object *obj)
+EAPI E_Comp *
+e_comp_evas_find(const Evas *e)
{
- if (!obj) return 0;
- switch (obj->type)
- {
- E_Gadcon *gc;
-
- case E_GADCON_TYPE:
- gc = (E_Gadcon *)obj;
- if (gc->shelf)
- {
- if (gc->shelf->popup)
- return E_COMP_CANVAS_LAYER_LAYOUT + gc->shelf->popup->layer;
- return E_COMP_CANVAS_LAYER_DESKTOP_TOP;
- }
- if (!gc->toolbar) return E_COMP_CANVAS_LAYER_DESKTOP;
- return E_COMP_CANVAS_LAYER_LAYOUT + gc->toolbar->fwin->border->layer;
-
- case E_GADCON_CLIENT_TYPE:
- gc = ((E_Gadcon_Client *)(obj))->gadcon;
- if (gc->shelf)
- {
- if (gc->shelf->popup)
- return E_COMP_CANVAS_LAYER_LAYOUT + gc->shelf->popup->layer;
- return E_COMP_CANVAS_LAYER_DESKTOP_TOP;
- }
- if (!gc->toolbar) return E_COMP_CANVAS_LAYER_DESKTOP;
- return E_COMP_CANVAS_LAYER_LAYOUT + gc->toolbar->fwin->border->layer;
-
- case E_WIN_TYPE:
- return E_COMP_CANVAS_LAYER_LAYOUT + ((E_Win *)(obj))->border->layer;
-
- case E_ZONE_TYPE:
- return E_COMP_CANVAS_LAYER_DESKTOP;
+ Eina_List *l;
+ E_Comp *c;
- case E_BORDER_TYPE:
- return E_COMP_CANVAS_LAYER_LAYOUT + ((E_Border *)(obj))->layer;
+ EINA_LIST_FOREACH(compositors, l, c)
+ if (c->evas == e) return c;
+ return NULL;
+}
- case E_POPUP_TYPE:
- return ((E_Popup *)(obj))->comp_layer + ((E_Popup *)(obj))->layer;
+EAPI void
+e_comp_button_bindings_ungrab_all(void)
+{
+ Eina_List *l;
+ E_Comp *c;
- /* FIXME: add more types as needed */
- default:
- break;
- }
- return 0;
+ EINA_LIST_FOREACH(compositors, l, c)
+ if (c->bindings_ungrab_cb)
+ c->bindings_ungrab_cb(c);
}
EAPI void
-e_comp_shape_queue(E_Comp *c)
+e_comp_button_bindings_grab_all(void)
{
- if (!c->shape_job)
- c->shape_job = ecore_job_add((Ecore_Cb)_e_comp_shapes_update_job, c);
+ Eina_List *l;
+ E_Comp *c;
+
+ EINA_LIST_FOREACH(compositors, l, c)
+ if (c->bindings_grab_cb)
+ c->bindings_grab_cb(c);
}
diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h
index 5e8c9c1b72..d360aeb116 100644
--- a/src/bin/e_comp.h
+++ b/src/bin/e_comp.h
@@ -1,210 +1,116 @@
#ifdef E_TYPEDEFS
typedef struct _E_Comp E_Comp;
-typedef struct _E_Comp_Win E_Comp_Win;
-typedef struct _E_Comp_Zone E_Comp_Zone;
-typedef struct E_Event_Comp E_Event_Comp;
+typedef struct _E_Comp_Data E_Comp_Data;
+typedef struct E_Comp_Client_Data E_Comp_Client_Data;
-typedef enum
-{
- E_COMP_CANVAS_LAYER_BOTTOM = -100,
- E_COMP_CANVAS_LAYER_BG = -1, // zone bg stuff
- E_COMP_CANVAS_LAYER_DESKTOP = 0, // desktop objects: fileman, gadgets, shelves
- E_COMP_CANVAS_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets, shelves
- E_COMP_CANVAS_LAYER_LAYOUT = 100, // should be nothing else on this layer
- E_COMP_CANVAS_LAYER_POPUP = 999, // popups
- E_COMP_CANVAS_LAYER_MENU = 5000, // menus
- E_COMP_CANVAS_LAYER_DESKLOCK = 9999, // desklock
- E_COMP_CANVAS_LAYER_MAX = 32767 // EVAS_LAYER_MAX
-} E_Comp_Canvas_Layer;
+#define E_COMP_TYPE (int) 0xE0b01003
+
+#define E_LAYER_COUNT 19
+#define E_CLIENT_LAYER_COUNT 11
typedef enum _E_Layer
{
- E_LAYER_DESKTOP = 0,
- E_LAYER_BELOW = 50,
- E_LAYER_NORMAL = 100,
- E_LAYER_ABOVE = 150,
- E_LAYER_EDGE = 200,
- E_LAYER_FULLSCREEN = 250,
- E_LAYER_EDGE_FULLSCREEN = 300,
- E_LAYER_POPUP = 300,
- E_LAYER_TOP = 350,
- E_LAYER_DRAG = 400,
- E_LAYER_PRIO = 450
+ E_LAYER_BOTTOM = -100,
+ E_LAYER_BG = -1, // zone bg stuff
+ E_LAYER_DESKTOP = 0, // desktop objects: fileman, gadgets, shelves
+ E_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets
+ E_LAYER_CLIENT_DESKTOP = 100, //shelves
+ E_LAYER_CLIENT_BELOW = 150,
+ E_LAYER_CLIENT_NORMAL = 200,
+ E_LAYER_CLIENT_ABOVE = 250,
+ E_LAYER_CLIENT_EDGE = 300,
+ E_LAYER_CLIENT_FULLSCREEN = 350,
+ E_LAYER_CLIENT_EDGE_FULLSCREEN = 400,
+ E_LAYER_CLIENT_POPUP = 450,
+ E_LAYER_CLIENT_TOP = 500,
+ E_LAYER_CLIENT_DRAG = 550,
+ E_LAYER_CLIENT_PRIO = 600,
+ E_LAYER_POPUP = 999, // popups
+ E_LAYER_MENU = 5000, // menus
+ E_LAYER_DESKLOCK = 9999, // desklock
+ E_LAYER_MAX = 32767 // EVAS_LAYER_MAX
} E_Layer;
-typedef enum
-{
- E_COMP_CANVAS_STACK_UNDER = -1,
- E_COMP_CANVAS_STACK_NONE = 0,
- E_COMP_CANVAS_STACK_ABOVE = 1
-} E_Comp_Canvas_Stack;
-
#else
#ifndef E_MOD_COMP_H
#define E_MOD_COMP_H
# include "e_comp_cfdata.h"
-# include "e_comp_render_update.h"
struct _E_Comp
{
- Ecore_X_Window win; // input overlay
+ E_Object e_obj_inherit;
+
+ Ecore_Window win; // input overlay
Ecore_Evas *ee;
- Ecore_X_Window ee_win;
+ Ecore_Window ee_win;
Evas *evas;
- Evas_Object *layout;
+ Evas_Object *bg_blank_object;
Eina_List *zones;
E_Manager *man;
E_Pointer *pointer;
+ Eina_List *clients;
+ unsigned int new_clients;
+
+ E_Comp_Data *comp_data;
+
+ unsigned int num;
+ Eina_Stringshare *name;
+ struct {
+ Ecore_Window win;
+ Evas_Object *obj;
+ //Eina_Inlist *objs; /* E_Comp_Object; NOT to be exposed; seems pointless? */
+ Eina_Inlist *clients; /* E_Client, bottom to top */
+ unsigned int clients_count;
+ } layers[E_LAYER_COUNT];
+
+ struct
+ {
+ Evas_Object *rect;
+ Evas_Object *obj;
+ Ecore_Event_Handler *key_handler;
+ E_Comp_Object_Autoclose_Cb del_cb;
+ E_Comp_Object_Key_Cb key_cb;
+ void *data;
+ } autoclose;
Eina_List *debug_rects;
Eina_List *ignore_wins;
- Eina_Inlist *wins;
- Eina_List *wins_list;
Eina_List *updates;
+ Eina_List *post_updates;
Ecore_Animator *render_animator;
Ecore_Job *shape_job;
Ecore_Job *update_job;
- Ecore_Timer *new_up_timer;
Evas_Object *fps_bg;
Evas_Object *fps_fg;
Ecore_Job *screen_job;
Ecore_Timer *nocomp_delay_timer;
Ecore_Timer *nocomp_override_timer;
int animating;
- int render_overflow;
double frametimes[122];
int frameskip;
int nocomp_override; //number of times nocomp override has been requested
- Ecore_X_Window block_win;
+ Ecore_Window block_win;
int block_count; //number of times block window has been requested
- Ecore_X_Window cm_selection;
+ Ecore_Window cm_selection; //FIXME: move to comp_x ?
+
+ int depth;
+
+ Ecore_Cb grab_cb;
+ Ecore_Cb bindings_grab_cb;
+ Ecore_Cb bindings_ungrab_cb;
Eina_Bool gl : 1;
Eina_Bool grabbed : 1;
Eina_Bool nocomp : 1;
Eina_Bool nocomp_want : 1;
- Eina_Bool wins_invalid : 1;
Eina_Bool saver : 1;
};
-struct _E_Comp_Zone
-{
- E_Comp *comp;
- E_Zone *zone; // never deref - just use for handle cmp's
- Evas_Object *base;
- Evas_Object *over;
- int container_num;
- int zone_num;
- int x, y, w, h;
- double bl;
- Eina_Bool bloff;
-};
-
-struct _E_Comp_Win
-{
- EINA_INLIST;
-
- E_Comp *c; // parent compositor
- Ecore_X_Window win; // raw window - for menus etc.
- E_Container_Shape *shape;
- E_Border *bd; // if its a border - later
- E_Popup *pop; // if its a popup - later
- E_Menu *menu; // if it is a menu - later
- int x, y, w, h; // geometry
- Eina_Rectangle hidden; // hidden geometry (used when its unmapped and re-instated on map)
- int pw, ph; // pixmap w/h
- int border; // border width
- Ecore_X_Pixmap pixmap; // the compositing pixmap
- Ecore_X_Damage damage; // damage region
- Ecore_X_Visual vis; // window visual
- Ecore_X_Colormap cmap; // colormap of window
- int depth; // window depth
- Evas_Object *obj; // composite object
- Evas_Object *zoomobj; // zoomap
- Evas_Object *shobj; // shadow object
- Evas_Object *effect_obj; // effects object
- E_Object *eobj; // internal e object
- E_Comp_Win *cw_above; // comp win that should always be stacked above this one
- Eina_List *stack_below; // list of objects to keep stacked below this one
- Eina_List *obj_mirror; // extra mirror objects
- Ecore_X_Image *xim; // x image - software fallback
- E_Comp_Render_Update *up; // update handler
- E_Object_Delfn *dfn; // delete function handle for objects being tracked
- Ecore_Timer *update_timeout; // max time between damage and "done" event
- Ecore_Timer *ready_timeout; // max time on show (new window draw) to wait for window contents to be ready if sync protocol not handled. this is fallback.
- int dmg_updates; // num of damage event updates since a redirect
-
- Ecore_X_Pixmap cache_pixmap; // the cached pixmap (1/nth the dimensions)
- int cache_w, cache_h; // cached pixmap size
- int update_count; // how many updates have happened to this win
- double last_visible_time; // last time window was visible
- double last_draw_time; // last time window was damaged
-
- int pending_count; // pending event count
-
- unsigned int opacity; // opacity set with _NET_WM_WINDOW_OPACITY
- Ecore_Timer *opacity_set_timer; // timer for setting opacity in ecore-x to avoid roundtrips
-
- char *title, *name, *clas, *role; // fetched for override-redirect windowa
- Ecore_X_Window_Type primary_type; // fetched for override-redirect windowa
-
- unsigned char misses; // number of sync misses
-
- Eina_Bool delete_pending : 1; // delete pendig
- Eina_Bool hidden_override : 1; // hidden override
- Eina_Bool animating : 1; // it's busy animating - defer hides/dels
- Eina_Bool force : 1; // force del/hide even if animating
- Eina_Bool defer_hide : 1; // flag to get hide to work on deferred hide
- Eina_Bool delete_me : 1; // delete me!
- Eina_Bool visible : 1; // is visible
- Eina_Bool input_only : 1; // is input_only
-
- Eina_Bool override : 1; // is override-redirect
- Eina_Bool argb : 1; // is argb
- Eina_Bool shaped : 1; // is shaped
- Eina_Bool update : 1; // has updates to fetch
- Eina_Bool redirected : 1; // has updates to fetch
- Eina_Bool shape_changed : 1; // shape changed
- Eina_Bool native : 1; // native
- Eina_Bool drawme : 1; // drawme flag fo syncing rendering
-
- Eina_Bool invalid : 1; // invalid depth used - just use as marker
- Eina_Bool nocomp : 1; // nocomp applied
- Eina_Bool nocomp_need_update : 1; // nocomp in effect, but this window updated while in nocomp mode
- Eina_Bool needpix : 1; // need new pixmap
- Eina_Bool needxim : 1; // need new xim
- Eina_Bool real_hid : 1; // last hide was a real window unmap
- Eina_Bool inhash : 1; // is in the windows hash
- Eina_Bool show_ready : 1; // is this window ready for its first show
- Eina_Bool geom_update : 1; // window needs geometry updated
-
- Eina_Bool show_anim : 1; // ran show animation
-
- Eina_Bool bg_win : 1; // window is the bg win for a container
- Eina_Bool free_shape : 1; // container shape needs to be freed
- Eina_Bool real_obj : 1; // real object (for dummy comp wins)
- Eina_Bool not_in_layout : 1; // object is a dummy not in comp layout
-
- Eina_Bool effect_clip : 1; //effect_obj is clipped
- Eina_Bool effect_clip_able : 1; //effect_obj will be clipped for effects
-};
-
-struct E_Event_Comp
-{
- E_Comp_Win *cw;
-};
-
-extern EAPI int E_EVENT_COMP_SOURCE_VISIBILITY;
-extern EAPI int E_EVENT_COMP_SOURCE_ADD;
-extern EAPI int E_EVENT_COMP_SOURCE_DEL;
-extern EAPI int E_EVENT_COMP_SOURCE_CONFIGURE;
-extern EAPI int E_EVENT_COMP_SOURCE_STACK;
-
typedef enum
{
E_COMP_ENGINE_NONE = 0,
@@ -213,67 +119,35 @@ typedef enum
} E_Comp_Engine;
EINTERN Eina_Bool e_comp_init(void);
-EINTERN int e_comp_shutdown(void);
-EINTERN Eina_Bool e_comp_manager_init(E_Manager *man);
-
-EAPI const Eina_List *e_comp_list(void);
-
+EAPI E_Comp *e_comp_new(void);
EAPI int e_comp_internal_save(void);
+EINTERN int e_comp_shutdown(void);
+EAPI void e_comp_render_queue(E_Comp *c);
+EAPI void e_comp_shape_queue(E_Comp *c);
EAPI E_Comp_Config *e_comp_config_get(void);
+EAPI const Eina_List *e_comp_list(void);
EAPI void e_comp_shadows_reset(void);
-
-EAPI void e_comp_block_window_add(void);
-EAPI void e_comp_block_window_del(void);
-
-EAPI void e_comp_render_update(E_Comp *c);
-EAPI void e_comp_zone_update(E_Comp_Zone *cz);
-
+EAPI E_Comp *e_comp_get(const void *o);
+EAPI Ecore_Window e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y);
+EAPI void e_comp_util_wins_print(const E_Comp *c);
+EAPI void e_comp_ignore_win_add(E_Pixmap_Type type, Ecore_Window win);
+EAPI void e_comp_ignore_win_del(E_Pixmap_Type type, Ecore_Window win);
+EAPI Eina_Bool e_comp_ignore_win_find(Ecore_Window win);
EAPI void e_comp_override_del(E_Comp *c);
EAPI void e_comp_override_add(E_Comp *c);
-
-EAPI void e_comp_win_effect_set(E_Comp_Win *cw, const char *effect);
-EAPI void e_comp_win_effect_params_set(E_Comp_Win *cw, int id, int *params, unsigned int count);
-EAPI void e_comp_win_effect_start(E_Comp_Win *cw, Edje_Signal_Cb end_cb, const void *end_data);
-EAPI void e_comp_win_effect_stop(E_Comp_Win *cw, Edje_Signal_Cb end_cb);
-EAPI void e_comp_win_effect_clip(E_Comp_Win *cw);
-EAPI void e_comp_win_effect_unclip(E_Comp_Win *cw);
-
-EAPI E_Comp_Win *e_comp_win_find_client_win(Ecore_X_Window win);
-EAPI E_Comp_Win *e_comp_win_find(Ecore_X_Window win);
-EAPI const Eina_List *e_comp_win_list_get(E_Comp *c);
-EAPI Evas_Object *e_comp_win_image_mirror_add(E_Comp_Win *cw);
-EAPI void e_comp_win_hidden_set(E_Comp_Win *cw, Eina_Bool hidden);
-EAPI void e_comp_win_opacity_set(E_Comp_Win *cw, unsigned int opacity);
-
-EAPI E_Comp *e_comp_get(void *o);
-EAPI void e_comp_populate(E_Comp *c);
-
-EAPI Ecore_X_Window e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y, Eina_Bool vis, Ecore_X_Window *ignore, unsigned int ignore_num);
-
-/* for injecting objects into the comp layout */
-EAPI E_Comp_Win *e_comp_object_inject(E_Comp *c, Evas_Object *obj, E_Object *eobj, E_Layer layer);
-/* for giving objects the comp theme and such without injecting into layout */
-EAPI E_Comp_Win *e_comp_object_add(E_Comp *c, Evas_Object *obj, E_Object *eobj);
-
-EAPI void e_comp_win_move(E_Comp_Win *cw, Evas_Coord x, Evas_Coord y);
-EAPI void e_comp_win_resize(E_Comp_Win *cw, int w, int h);
-EAPI void e_comp_win_moveresize(E_Comp_Win *cw, Evas_Coord x, Evas_Coord y, int w, int h);
-EAPI void e_comp_win_hide(E_Comp_Win *cw);
-EAPI void e_comp_win_show(E_Comp_Win *cw);
-EAPI void e_comp_win_del(E_Comp_Win *cw);
-EAPI void e_comp_win_reshadow(E_Comp_Win *cw);
-
-EAPI void e_comp_ignore_win_add(Ecore_X_Window win);
-
-#define E_LAYER_SET(obj, layer) e_comp_canvas_layer_set(obj, layer, 0, E_COMP_CANVAS_STACK_NONE)
-#define E_LAYER_SET_UNDER(obj, layer) e_comp_canvas_layer_set(obj, layer, 0, E_COMP_CANVAS_STACK_UNDER)
-#define E_LAYER_SET_ABOVE(obj, layer) e_comp_canvas_layer_set(obj, layer, 0, E_COMP_CANVAS_STACK_ABOVE)
-#define E_LAYER_LAYOUT_ADD(obj, layer) e_comp_canvas_layer_set(obj, E_COMP_CANVAS_LAYER_LAYOUT, layer, E_COMP_CANVAS_STACK_NONE)
-#define E_LAYER_LAYOUT_ADD_UNDER(obj, layer) e_comp_canvas_layer_set(obj, E_COMP_CANVAS_LAYER_LAYOUT, layer, E_COMP_CANVAS_STACK_UNDER)
-#define E_LAYER_LAYOUT_ADD_ABOVE(obj, layer) e_comp_canvas_layer_set(obj, E_COMP_CANVAS_LAYER_LAYOUT, layer, E_COMP_CANVAS_STACK_ABOVE)
-
-EAPI E_Comp_Win *e_comp_canvas_layer_set(Evas_Object *obj, E_Comp_Canvas_Layer comp_layer, E_Layer layer, E_Comp_Canvas_Stack stack);
+EAPI void e_comp_block_window_add(void);
+EAPI void e_comp_block_window_del(void);
+EAPI E_Comp *e_comp_find_by_window(Ecore_Window win);
+EAPI void e_comp_override_timed_pop(E_Comp *c);
EAPI unsigned int e_comp_e_object_layer_get(const E_Object *obj);
+EAPI Eina_Bool e_comp_grab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd);
+EAPI void e_comp_ungrab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd);
+EAPI void e_comp_gl_set(Eina_Bool set);
+EAPI Eina_Bool e_comp_gl_get(void);
+EAPI E_Comp *e_comp_evas_find(const Evas *e);
+
+EAPI void e_comp_button_bindings_grab_all(void);
+EAPI void e_comp_button_bindings_ungrab_all(void);
static inline E_Comp *
e_comp_util_evas_object_comp_get(Evas_Object *obj)
@@ -282,35 +156,16 @@ e_comp_util_evas_object_comp_get(Evas_Object *obj)
}
static inline Eina_Bool
-e_comp_evas_exists(void *o)
-{
- E_Comp *c;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(o, EINA_FALSE);
- c = e_comp_get(o);
- return c ? !!c->evas : EINA_FALSE;
-}
-
-static inline void
-e_comp_win_ignore_events_set(E_Comp_Win *cw, Eina_Bool ignore)
-{
- EINA_SAFETY_ON_NULL_RETURN(cw);
- ignore = !!ignore;
- evas_object_pass_events_set(cw->effect_obj, ignore);
-}
-
-static inline unsigned int
-e_comp_e_object_layer_effective_get(const E_Object *obj)
+e_comp_util_client_is_fullscreen(const E_Client *ec)
{
- unsigned int layer;
-
- layer = e_comp_e_object_layer_get(obj);
- if ((layer > E_COMP_CANVAS_LAYER_LAYOUT) && (layer < E_COMP_CANVAS_LAYER_POPUP))
- layer = E_COMP_CANVAS_LAYER_LAYOUT;
- return layer;
+ if ((!ec->visible) || (ec->input_only))
+ return EINA_FALSE;
+ return ((ec->client.x == 0) && (ec->client.y == 0) &&
+ ((ec->client.w) >= ec->comp->man->w) &&
+ ((ec->client.h) >= ec->comp->man->h) &&
+ (!ec->argb) && (!ec->shaped)
+ );
}
-EAPI void e_comp_util_wins_print(const E_Comp *c);
-EAPI void e_comp_shape_queue(E_Comp *c);
#endif
#endif
diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c
new file mode 100644
index 0000000000..87b5915ea9
--- /dev/null
+++ b/src/bin/e_comp_canvas.c
@@ -0,0 +1,559 @@
+#include "e.h"
+
+static void
+_e_comp_canvas_event_compositor_resize_free(void *data EINA_UNUSED, void *event)
+{
+ E_Event_Compositor_Resize *ev = event;
+
+ e_object_unref(E_OBJECT(ev->comp));
+ free(ev);
+}
+
+///////////////////////////////////
+
+static void
+_e_comp_canvas_render_post(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Comp *c = data;
+ E_Client *ec;
+ //Evas_Event_Render_Post *ev = event_info;
+ //Eina_List *l;
+ //Eina_Rectangle *r;
+
+ //if (ev)
+ //{
+ //EINA_LIST_FOREACH(ev->updated_area, l, r)
+ //INF("POST RENDER: %d,%d %dx%d", r->x, r->y, r->w, r->h);
+ //}
+ EINA_LIST_FREE(c->post_updates, ec)
+ {
+ //INF("POST %p", ec);
+ if (!e_object_is_del(E_OBJECT(ec)))
+ e_pixmap_image_clear(ec->pixmap, 1);
+ }
+}
+
+///////////////////////////////////
+
+static void
+_e_comp_canvas_cb_mouse_in(E_Comp *c EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec;
+
+ if (e_client_action_get()) return;
+ ec = e_client_focused_get();
+ if (ec && (!ec->border_menu)) e_focus_event_mouse_out(ec);
+}
+
+static void
+_e_comp_canvas_cb_mouse_down(E_Comp *c, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ if (e_client_action_get()) return;
+ e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(c), event_info);
+}
+
+static void
+_e_comp_canvas_cb_mouse_up(E_Comp *c, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ if (e_client_action_get()) return;
+ e_bindings_mouse_up_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(c), event_info);
+}
+
+static void
+_e_comp_canvas_cb_mouse_wheel(E_Comp *c, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ if (e_client_action_get()) return;
+ e_bindings_wheel_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(c), event_info);
+}
+
+////////////////////////////////////
+
+static int
+_e_comp_canvas_cb_zone_sort(const void *data1, const void *data2)
+{
+ const E_Zone *z1 = data1, *z2 = data2;
+
+ return z2->num - z1->num;
+}
+
+
+EAPI Eina_Bool
+e_comp_canvas_init(E_Comp *c)
+{
+ Evas_Object *o;
+ Eina_List *screens;
+ unsigned int layer;
+
+ c->evas = ecore_evas_get(c->ee);
+ ecore_evas_data_set(c->ee, "comp", c);
+ o = evas_object_rectangle_add(c->evas);
+ c->bg_blank_object = o;
+ evas_object_layer_set(o, E_LAYER_BOTTOM);
+ evas_object_move(o, 0, 0);
+ evas_object_resize(o, c->man->w, c->man->h);
+ evas_object_color_set(o, 255, 255, 255, 255);
+ evas_object_name_set(o, "comp->bg_blank_object");
+ evas_object_data_set(o, "e_comp", c);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, (Evas_Object_Event_Cb)_e_comp_canvas_cb_mouse_down, c);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, (Evas_Object_Event_Cb)_e_comp_canvas_cb_mouse_up, c);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, (Evas_Object_Event_Cb)_e_comp_canvas_cb_mouse_in, c);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, (Evas_Object_Event_Cb)_e_comp_canvas_cb_mouse_wheel, c);
+ evas_object_show(o);
+
+ ecore_evas_name_class_set(c->ee, "E", "Comp_EE");
+ // ecore_evas_manual_render_set(c->ee, conf->lock_fps);
+ ecore_evas_show(c->ee);
+
+ evas_event_callback_add(c->evas, EVAS_CALLBACK_RENDER_POST, _e_comp_canvas_render_post, c);
+
+ c->ee_win = ecore_evas_window_get(c->ee);
+ c->pointer = e_pointer_window_new(c->man->root, 1);
+
+ for (layer = 0; layer <= e_comp_canvas_layer_map(E_LAYER_MAX); layer++)
+ {
+ Evas_Object *o2;
+
+ /* client layers have actual X windows backing them, so we wait */
+ if (e_comp_canvas_client_layer_map(e_comp_canvas_layer_map_to(layer)) != 9999)
+ continue;
+ o2 = c->layers[layer].obj = evas_object_rectangle_add(c->evas);
+ evas_object_layer_set(o2, e_comp_canvas_layer_map_to(layer));
+ evas_object_name_set(o2, "layer_obj");
+ }
+
+ screens = (Eina_List *)e_xinerama_screens_get();
+ if (screens)
+ {
+ E_Screen *scr;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(screens, l, scr)
+ {
+ e_zone_new(c, scr->screen, scr->escreen, scr->x, scr->y, scr->w, scr->h);
+ }
+ }
+ else
+ e_zone_new(c, 0, 0, 0, 0, c->man->w, c->man->h);
+
+ return EINA_TRUE;
+}
+
+EINTERN void
+e_comp_canvas_clear(E_Comp *c)
+{
+ evas_event_freeze(c->evas);
+ edje_freeze();
+
+ E_FREE_FUNC(c->fps_fg, evas_object_del);
+ E_FREE_FUNC(c->fps_bg, evas_object_del);
+ E_FREE_FUNC(c->autoclose.rect, evas_object_del);
+ E_FREE_FUNC(c->shape_job, ecore_job_del);
+ E_FREE_FUNC(c->pointer, e_object_del);
+}
+
+//////////////////////////////////////////////
+
+EAPI void
+e_comp_all_freeze(void)
+{
+ Eina_List *l;
+ E_Manager *man;
+
+ EINA_LIST_FOREACH(e_manager_list(), l, man)
+ evas_event_freeze(man->comp->evas);
+}
+
+EAPI void
+e_comp_all_thaw(void)
+{
+ Eina_List *l;
+ E_Manager *man;
+
+ EINA_LIST_FOREACH(e_manager_list(), l, man)
+ evas_event_thaw(man->comp->evas);
+}
+
+EAPI E_Zone *
+e_comp_zone_xy_get(const E_Comp *c, Evas_Coord x, Evas_Coord y)
+{
+ const Eina_List *l;
+ E_Zone *zone;
+
+ if (!c) c = e_comp_get(NULL);
+ EINA_LIST_FOREACH(c->zones, l, zone)
+ if (E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h)) return zone;
+ return NULL;
+}
+
+EAPI E_Zone *
+e_comp_zone_number_get(E_Comp *c, int num)
+{
+ Eina_List *l = NULL;
+ E_Zone *zone = NULL;
+
+ E_OBJECT_CHECK_RETURN(c, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(c, E_COMP_TYPE, NULL);
+ EINA_LIST_FOREACH(c->zones, l, zone)
+ {
+ if ((int)zone->num == num) return zone;
+ }
+ return NULL;
+}
+
+EAPI E_Zone *
+e_comp_zone_id_get(E_Comp *c, int id)
+{
+ Eina_List *l = NULL;
+ E_Zone *zone = NULL;
+
+ E_OBJECT_CHECK_RETURN(c, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(c, E_COMP_TYPE, NULL);
+ EINA_LIST_FOREACH(c->zones, l, zone)
+ {
+ if (zone->id == id) return zone;
+ }
+ return NULL;
+}
+
+EAPI E_Comp *
+e_comp_number_get(unsigned int num)
+{
+ const Eina_List *l;
+ E_Comp *c;
+
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ if (c->num == num) return c;
+ return NULL;
+}
+
+EAPI E_Desk *
+e_comp_desk_window_profile_get(E_Comp *c, const char *profile)
+{
+ Eina_List *l = NULL;
+ E_Zone *zone = NULL;
+ int x, y;
+
+ E_OBJECT_CHECK_RETURN(c, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(c, E_COMP_TYPE, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(profile, NULL);
+
+ EINA_LIST_FOREACH(c->zones, l, zone)
+ {
+ for (x = 0; x < zone->desk_x_count; x++)
+ {
+ for (y = 0; y < zone->desk_y_count; y++)
+ {
+ E_Desk *desk = e_desk_at_xy_get(zone, x, y);
+ if (!e_util_strcmp(desk->window_profile, profile))
+ return desk;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+EAPI void
+e_comp_canvas_zone_update(E_Zone *zone)
+{
+ Evas_Object *o;
+ const char *const over_styles[] =
+ {
+ "e/comp/screen/overlay/default",
+ "e/comp/screen/overlay/noeffects"
+ };
+ const char *const under_styles[] =
+ {
+ "e/comp/screen/base/default",
+ "e/comp/screen/base/noeffects"
+ };
+ E_Comp_Config *conf = e_comp_config_get();
+
+ if (zone->over && zone->base)
+ {
+ e_theme_edje_object_set(zone->base, "base/theme/comp",
+ under_styles[conf->disable_screen_effects]);
+ edje_object_part_swallow(zone->base, "e.swallow.background",
+ zone->transition_object ?: zone->bg_object);
+ e_theme_edje_object_set(zone->over, "base/theme/comp",
+ over_styles[conf->disable_screen_effects]);
+ return;
+ }
+ E_FREE_FUNC(zone->base, evas_object_del);
+ E_FREE_FUNC(zone->over, evas_object_del);
+ zone->base = o = edje_object_add(zone->comp->evas);
+ evas_object_repeat_events_set(o, 1);
+ evas_object_name_set(zone->base, "zone->base");
+ e_theme_edje_object_set(o, "base/theme/comp", under_styles[conf->disable_screen_effects]);
+ edje_object_part_swallow(zone->base, "e.swallow.background", zone->transition_object ?: zone->bg_object);
+ evas_object_move(o, zone->x, zone->y);
+ evas_object_resize(o, zone->w, zone->h);
+ evas_object_layer_set(o, E_LAYER_BG);
+ evas_object_show(o);
+
+ zone->over = o = edje_object_add(zone->comp->evas);
+ evas_object_layer_set(o, E_LAYER_MAX);
+ evas_object_raise(o);
+ evas_object_name_set(zone->over, "zone->over");
+ evas_object_pass_events_set(o, 1);
+ e_theme_edje_object_set(o, "base/theme/comp", over_styles[conf->disable_screen_effects]);
+ evas_object_move(o, zone->x, zone->y);
+ evas_object_resize(o, zone->w, zone->h);
+ evas_object_raise(o);
+ evas_object_show(o);
+}
+
+EAPI void
+e_comp_canvas_update(E_Comp *c)
+{
+ E_Event_Compositor_Resize *ev;
+ Eina_List *l, *screens, *zones = NULL, *ll;
+ E_Zone *zone;
+ E_Screen *scr;
+ int i;
+ Eina_Bool changed = EINA_FALSE;
+
+ screens = (Eina_List *)e_xinerama_screens_get();
+
+ if (screens)
+ {
+ zones = c->zones;
+ c->zones = NULL;
+ EINA_LIST_FOREACH(screens, l, scr)
+ {
+ zone = NULL;
+
+ EINA_LIST_FOREACH(zones, ll, zone)
+ {
+ if (zone->id == scr->escreen) break;
+ zone = NULL;
+ }
+ if (zone)
+ {
+ changed |= e_zone_move_resize(zone, scr->x, scr->y, scr->w, scr->h);
+ if (changed)
+ printf("@@@ FOUND ZONE %i %i [%p]\n", zone->num, zone->id, zone);
+ zones = eina_list_remove(zones, zone);
+ c->zones = eina_list_append(c->zones, zone);
+ zone->num = scr->screen;
+ }
+ else
+ {
+ zone = e_zone_new(c, scr->screen, scr->escreen,
+ scr->x, scr->y, scr->w, scr->h);
+ printf("@@@ NEW ZONE = %p\n", zone);
+ changed = EINA_TRUE;
+ }
+ if (changed)
+ printf("@@@ SCREENS: %i %i | %i %i %ix%i\n",
+ scr->screen, scr->escreen, scr->x, scr->y, scr->w, scr->h);
+ }
+ c->zones = eina_list_sort(c->zones, 0, _e_comp_canvas_cb_zone_sort);
+ if (zones)
+ {
+ E_Zone *spare_zone;
+
+ changed = EINA_TRUE;
+ spare_zone = eina_list_data_get(c->zones);
+
+ EINA_LIST_FREE(zones, zone)
+ {
+ E_Client *ec;
+
+ /* delete any shelves on this zone */
+ E_CLIENT_FOREACH(c, ec)
+ {
+ if (ec->zone == zone)
+ {
+ if (spare_zone)
+ e_client_zone_set(ec, spare_zone);
+ else
+ printf("EEEK! should not be here - but no\n"
+ "spare zones exist to move this\n"
+ "window to!!! help!\n");
+ }
+ }
+ e_object_del(E_OBJECT(zone));
+ }
+ }
+ if (changed) e_shelf_config_update();
+ }
+ else
+ {
+ E_Zone *z;
+
+ z = e_comp_zone_number_get(c, 0);
+ if (z)
+ {
+ changed |= e_zone_move_resize(z, 0, 0, c->man->w, c->man->h);
+ if (changed) e_shelf_zone_move_resize_handle(z);
+ }
+ }
+
+ if (!changed) return;
+ if (!starting)
+ {
+ ev = calloc(1, sizeof(E_Event_Compositor_Resize));
+ ev->comp = c;
+ e_object_ref(E_OBJECT(c));
+ ecore_event_add(E_EVENT_COMPOSITOR_RESIZE, ev, _e_comp_canvas_event_compositor_resize_free, NULL);
+ }
+
+ EINA_LIST_FOREACH(c->zones, l, zone)
+ {
+ E_FREE_FUNC(zone->base, evas_object_del);
+ E_FREE_FUNC(zone->over, evas_object_del);
+ if (zone->bloff)
+ {
+ if (!e_comp_config_get()->nofade)
+ {
+ if (e_backlight_mode_get(zone) != E_BACKLIGHT_MODE_NORMAL)
+ e_backlight_mode_set(zone, E_BACKLIGHT_MODE_NORMAL);
+ e_backlight_level_set(zone, e_config->backlight.normal, -1.0);
+ }
+ }
+ e_comp_canvas_zone_update(zone);
+ }
+
+ for (i = 0; i < 11; i++)
+ {
+ Eina_List *tmp = NULL;
+ E_Client *ec;
+
+ if (!c->layers[i].clients) continue;
+ /* Make temporary list as e_client_res_change_geometry_restore
+ * rearranges the order. */
+ EINA_INLIST_FOREACH(c->layers[i].clients, ec)
+ tmp = eina_list_append(tmp, ec);
+
+ EINA_LIST_FREE(tmp, ec)
+ {
+ e_client_res_change_geometry_save(ec);
+ e_client_res_change_geometry_restore(ec);
+ }
+ }
+}
+
+EAPI void
+e_comp_canvas_fake_layers_init(E_Comp *comp)
+{
+ unsigned int layer;
+
+ /* init layers */
+ for (layer = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); layer <= e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); layer++)
+ {
+ Evas_Object *o2;
+
+ o2 = comp->layers[layer].obj = evas_object_rectangle_add(comp->evas);
+ evas_object_layer_set(o2, e_comp_canvas_layer_map_to(layer));
+ evas_object_name_set(o2, "layer_obj");
+ }
+}
+
+EAPI void
+e_comp_canvas_fps_toggle(void)
+{
+ E_Comp_Config *conf = e_comp_config_get();
+
+ conf->fps_show = !conf->fps_show;
+ e_comp_internal_save();
+ E_LIST_FOREACH(e_comp_list(), e_comp_render_queue);
+}
+
+EAPI E_Layer
+e_comp_canvas_layer_map_to(unsigned int layer)
+{
+ switch (layer)
+ {
+ case 0: return E_LAYER_BOTTOM;
+ case 1: return E_LAYER_BG;
+ case 2: return E_LAYER_DESKTOP;
+ case 3: return E_LAYER_DESKTOP_TOP;
+ case 4: return E_LAYER_CLIENT_DESKTOP;
+ case 5: return E_LAYER_CLIENT_BELOW;
+ case 6: return E_LAYER_CLIENT_NORMAL;
+ case 7: return E_LAYER_CLIENT_ABOVE;
+ case 8: return E_LAYER_CLIENT_EDGE;
+ case 9: return E_LAYER_CLIENT_FULLSCREEN;
+ case 10: return E_LAYER_CLIENT_EDGE_FULLSCREEN;
+ case 11: return E_LAYER_CLIENT_POPUP;
+ case 12: return E_LAYER_CLIENT_TOP;
+ case 13: return E_LAYER_CLIENT_DRAG;
+ case 14: return E_LAYER_CLIENT_PRIO;
+ case 15: return E_LAYER_POPUP;
+ case 16: return E_LAYER_MENU;
+ case 17: return E_LAYER_DESKLOCK;
+ case 18: return E_LAYER_MAX;
+ default: break;
+ }
+ return -INT_MAX;
+}
+
+EAPI unsigned int
+e_comp_canvas_layer_map(E_Layer layer)
+{
+ switch (layer)
+ {
+ case E_LAYER_BOTTOM: return 0;
+ case E_LAYER_BG: return 1;
+ case E_LAYER_DESKTOP: return 2;
+ case E_LAYER_DESKTOP_TOP: return 3;
+ case E_LAYER_CLIENT_DESKTOP: return 4;
+ case E_LAYER_CLIENT_BELOW: return 5;
+ case E_LAYER_CLIENT_NORMAL: return 6;
+ case E_LAYER_CLIENT_ABOVE: return 7;
+ case E_LAYER_CLIENT_EDGE: return 8;
+ case E_LAYER_CLIENT_FULLSCREEN: return 9;
+ case E_LAYER_CLIENT_EDGE_FULLSCREEN: return 10;
+ case E_LAYER_CLIENT_POPUP: return 11;
+ case E_LAYER_CLIENT_TOP: return 12;
+ case E_LAYER_CLIENT_DRAG: return 13;
+ case E_LAYER_CLIENT_PRIO: return 14;
+ case E_LAYER_POPUP: return 15;
+ case E_LAYER_MENU: return 16;
+ case E_LAYER_DESKLOCK: return 17;
+ case E_LAYER_MAX: return 18;
+ default: break;
+ }
+ return 9999;
+}
+
+EAPI unsigned int
+e_comp_canvas_client_layer_map(E_Layer layer)
+{
+ switch (layer)
+ {
+ case E_LAYER_CLIENT_DESKTOP: return 0;
+ case E_LAYER_CLIENT_BELOW: return 1;
+ case E_LAYER_CLIENT_NORMAL: return 2;
+ case E_LAYER_CLIENT_ABOVE: return 3;
+ case E_LAYER_CLIENT_EDGE: return 4;
+ case E_LAYER_CLIENT_FULLSCREEN: return 5;
+ case E_LAYER_CLIENT_EDGE_FULLSCREEN: return 6;
+ case E_LAYER_CLIENT_POPUP: return 7;
+ case E_LAYER_CLIENT_TOP: return 8;
+ case E_LAYER_CLIENT_DRAG: return 9;
+ case E_LAYER_CLIENT_PRIO: return 10;
+ default: break;
+ }
+ return 9999;
+}
+
+EAPI E_Layer
+e_comp_canvas_client_layer_map_nearest(int layer)
+{
+#define LAYER_MAP(X) \
+ if (layer <= X) return X
+
+ LAYER_MAP(E_LAYER_CLIENT_DESKTOP);
+ LAYER_MAP(E_LAYER_CLIENT_BELOW);
+ LAYER_MAP(E_LAYER_CLIENT_NORMAL);
+ LAYER_MAP(E_LAYER_CLIENT_ABOVE);
+ LAYER_MAP(E_LAYER_CLIENT_EDGE);
+ LAYER_MAP(E_LAYER_CLIENT_FULLSCREEN);
+ LAYER_MAP(E_LAYER_CLIENT_EDGE_FULLSCREEN);
+ LAYER_MAP(E_LAYER_CLIENT_POPUP);
+ LAYER_MAP(E_LAYER_CLIENT_TOP);
+ LAYER_MAP(E_LAYER_CLIENT_DRAG);
+ return E_LAYER_CLIENT_PRIO;
+}
diff --git a/src/bin/e_comp_canvas.h b/src/bin/e_comp_canvas.h
new file mode 100644
index 0000000000..30d6af5d41
--- /dev/null
+++ b/src/bin/e_comp_canvas.h
@@ -0,0 +1,81 @@
+#ifdef E_TYPEDEFS
+
+
+
+typedef struct _E_Event_Compositor_Resize E_Event_Compositor_Resize;
+
+#else
+#ifndef E_COMP_CANVAS_H
+#define E_COMP_CANVAS_H
+
+struct _E_Event_Compositor_Resize
+{
+ E_Comp *comp;
+};
+
+extern EAPI int E_EVENT_COMPOSITOR_RESIZE;
+
+EAPI Eina_Bool e_comp_canvas_init(E_Comp *c);
+EINTERN void e_comp_canvas_clear(E_Comp *c);
+EAPI void e_comp_all_freeze(void);
+EAPI void e_comp_all_thaw(void);
+EAPI E_Zone * e_comp_zone_xy_get(const E_Comp *c, Evas_Coord x, Evas_Coord y);
+EAPI E_Zone * e_comp_zone_number_get(E_Comp *c, int num);
+EAPI E_Zone * e_comp_zone_id_get(E_Comp *c, int id);
+EAPI E_Comp * e_comp_number_get(unsigned int num);
+EAPI E_Desk * e_comp_desk_window_profile_get(E_Comp *c, const char *profile);
+EAPI void e_comp_canvas_zone_update(E_Zone *zone);
+EAPI void e_comp_canvas_update(E_Comp *c);
+EAPI void e_comp_canvas_fake_layers_init(E_Comp *comp);
+EAPI void e_comp_canvas_fps_toggle(void);
+EAPI E_Layer e_comp_canvas_layer_map_to(unsigned int layer);
+EAPI unsigned int e_comp_canvas_layer_map(E_Layer layer);
+EAPI unsigned int e_comp_canvas_client_layer_map(E_Layer layer);
+EAPI E_Layer e_comp_canvas_client_layer_map_nearest(int layer);
+
+
+/* the following functions are used for adjusting root window coordinates
+ * to/from canvas coordinates.
+ * this ensures correct positioning when running E as a nested compositor
+ *
+ * - use the "adjust" functions to go root->canvas
+ * - use the "unadjust" functions to go canvas->root
+ */
+static inline int
+e_comp_canvas_x_root_unadjust(const E_Comp *c, int x)
+{
+ int cx;
+
+ ecore_evas_geometry_get(c->ee, &cx, NULL, NULL, NULL);
+ return x + cx;
+}
+
+static inline int
+e_comp_canvas_y_root_unadjust(const E_Comp *c, int y)
+{
+ int cy;
+
+ ecore_evas_geometry_get(c->ee, NULL, &cy, NULL, NULL);
+ return y + cy;
+}
+
+static inline int
+e_comp_canvas_x_root_adjust(const E_Comp *c, int x)
+{
+ int cx;
+
+ ecore_evas_geometry_get(c->ee, &cx, NULL, NULL, NULL);
+ return x - cx;
+}
+
+static inline int
+e_comp_canvas_y_root_adjust(const E_Comp *c, int y)
+{
+ int cy;
+
+ ecore_evas_geometry_get(c->ee, NULL, &cy, NULL, NULL);
+ return y - cy;
+}
+
+#endif
+#endif
diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c
new file mode 100644
index 0000000000..da32b1af24
--- /dev/null
+++ b/src/bin/e_comp_object.c
@@ -0,0 +1,3364 @@
+#include "e.h"
+
+#define UPDATE_MAX 512 // same as evas
+#define SMART_NAME "e_comp_object"
+
+/* for non-util functions */
+#define API_ENTRY E_Comp_Object *cw; \
+ cw = evas_object_smart_data_get(obj); \
+ if ((!obj) || (!cw) || (e_util_strcmp(evas_object_type_get(obj), SMART_NAME))) return
+
+/* for util functions (obj may or may not be E_Comp_Object */
+#define SOFT_ENTRY(...) E_Comp_Object *cw; \
+ if (!obj) \
+ { \
+ CRI("YOU PASSED NULL! ARGH!"); \
+ return __VA_ARGS__; \
+ } \
+ cw = evas_object_smart_data_get(obj); \
+ if ((!cw) || (e_util_strcmp(evas_object_type_get(obj), SMART_NAME))) \
+ cw = NULL
+#define INTERNAL_ENTRY E_Comp_Object *cw; cw = evas_object_smart_data_get(obj);
+
+#if 1
+# define e_util_size_debug_set(x, y)
+#endif
+
+typedef struct _E_Comp_Object
+{
+ EINA_INLIST;
+
+ int x, y, w, h; // geometry
+ Eina_Rectangle input_rect;
+
+ E_Client *ec;
+ E_Comp *comp;
+
+ E_Comp_Object_Frame client_inset;
+ struct
+ {
+ double start;
+ double val;
+ int x, y;
+ E_Direction dir;
+ Ecore_Animator *anim;
+ } shade;
+
+ Eina_Stringshare *frame_theme;
+ Eina_Stringshare *frame_name;
+
+ Evas_Object *smart_obj; // smart object
+ Evas_Object *clip; // clipper over effect object
+ Evas_Object *input_obj; // input rect
+ Evas_Object *obj; // composite object
+ Evas_Object *frame_object; // for client frames
+ Evas_Object *frame_icon; // for client frames
+ Evas_Object *zoomobj; // zoomap
+ Evas_Object *shobj; // shadow object
+ Evas_Object *effect_obj; // effects object
+ unsigned int layer; //e_comp_canvas_layer_map(cw->ec->layer)
+ Eina_List *obj_mirror; // extra mirror objects
+ Eina_Tiler *updates;
+ Eina_Tiler *pending_updates;
+
+ unsigned int update_count; // how many updates have happened to this obj
+
+ unsigned int opacity; // opacity set with _NET_WM_WINDOW_OPACITY
+
+ Eina_Bool delete_pending : 1; // delete pendig
+ Eina_Bool animating : 1; // it's busy animating - defer hides/dels
+ Eina_Bool defer_hide : 1; // flag to get hide to work on deferred hide
+ Eina_Bool visible : 1; // is visible
+
+ Eina_Bool shaped : 1; // is shaped
+ Eina_Bool update : 1; // has updates to fetch
+ Eina_Bool redirected : 1; // has updates to fetch
+ Eina_Bool native : 1; // native
+
+ Eina_Bool nocomp : 1; // nocomp applied
+ Eina_Bool nocomp_need_update : 1; // nocomp in effect, but this window updated while in nocomp mode
+ Eina_Bool real_hid : 1; // last hide was a real window unmap
+
+ Eina_Bool effect_clip : 1; //effect_obj is clipped
+ Eina_Bool effect_clip_able : 1; //effect_obj will be clipped for effects
+
+ Eina_Bool zoomap_disabled : 1; //whether zoomap is usable
+ Eina_Bool updates_exist : 1;
+ Eina_Bool updates_full : 1; // entire object will be updated
+
+ Eina_Bool force_move : 1;
+} E_Comp_Object;
+
+static Evas_Smart *_e_comp_smart = NULL;
+
+/* sekrit functionzzz */
+EINTERN void e_client_focused_set(E_Client *ec);
+
+EAPI int E_EVENT_COMP_OBJECT_ADD = -1;
+
+static void
+_e_comp_object_event_free(void *d EINA_UNUSED, void *event)
+{
+ E_Event_Comp_Object *ev = event;
+
+ evas_object_unref(ev->comp_object);
+ free(ev);
+}
+
+static void
+_e_comp_object_event_add(Evas_Object *obj)
+{
+ E_Event_Comp_Object *ev;
+
+ if (stopping) return;
+ ev = E_NEW(E_Event_Comp_Object, 1);
+ evas_object_ref(obj);
+ ev->comp_object = obj;
+ ecore_event_add(E_EVENT_COMP_OBJECT_ADD, ev, _e_comp_object_event_free, NULL);
+}
+
+/////////////////////////////////////
+
+static inline Eina_Bool
+_e_comp_shaped_check(int w, int h, const Eina_Rectangle *rects, int num)
+{
+ if ((!rects) || (num < 1)) return EINA_FALSE;
+ if (num > 1) return EINA_TRUE;
+ if ((rects[0].x == 0) && (rects[0].y == 0) &&
+ ((int)rects[0].w == w) && ((int)rects[0].h == h))
+ return EINA_FALSE;
+ return EINA_TRUE;
+}
+
+/////////////////////////////////////
+
+static Eina_Bool
+_e_comp_object_do_shadow(E_Comp_Object *cw)
+{
+ if (cw->ec)
+ {
+ if (cw->ec->shaped) return 0;
+ if (cw->frame_object) return 0;
+ if (cw->ec->borderless || (!e_util_strcmp(cw->ec->border.name, "borderless")))
+ return 0;
+ }
+ return 1;
+}
+
+/////////////////////////////////////
+
+static void
+_e_comp_object_layers_add(E_Comp_Object *cw, E_Comp_Object *above, E_Comp_Object *below, Eina_Bool prepend)
+{
+ E_Comp_Object *layer_cw = NULL;
+
+ if (cw->comp->layers[cw->layer].obj)
+ layer_cw = evas_object_smart_data_get(cw->comp->layers[cw->layer].obj);
+ if (layer_cw == cw) layer_cw = NULL;
+/*
+ if (above)
+ cw->comp->layers[cw->layer].objs = eina_inlist_append_relative(cw->comp->layers[cw->layer].objs, EINA_INLIST_GET(cw), EINA_INLIST_GET(cw2));
+ else if (below)
+ cw->comp->layers[cw->layer].objs = eina_inlist_prepend_relative(cw->comp->layers[cw->layer].objs, EINA_INLIST_GET(cw), EINA_INLIST_GET(cw2));
+ else
+ {
+ if (prepend)
+ cw->comp->layers[cw->layer].objs = eina_inlist_prepend(cw->comp->layers[cw->layer].objs, EINA_INLIST_GET(cw));
+ else
+ cw->comp->layers[cw->layer].objs = eina_inlist_append(cw->comp->layers[cw->layer].objs, EINA_INLIST_GET(cw));
+ }
+ cw->comp->layers[cw->layer].objs_count++;
+ if (!cw->ec) return;
+*/
+ if (above)
+ cw->comp->layers[above->layer].clients = eina_inlist_append_relative(cw->comp->layers[above->layer].clients, EINA_INLIST_GET(cw->ec), EINA_INLIST_GET(above->ec));
+ else if (below)
+ cw->comp->layers[below->layer].clients = eina_inlist_prepend_relative(cw->comp->layers[below->layer].clients, EINA_INLIST_GET(cw->ec), EINA_INLIST_GET(below->ec));
+ if ((!above) && (!below))
+ {
+ if (prepend)
+ cw->comp->layers[cw->layer].clients = eina_inlist_prepend(cw->comp->layers[cw->layer].clients, EINA_INLIST_GET(cw->ec));
+ else if (layer_cw)
+ cw->comp->layers[cw->layer].clients = eina_inlist_prepend_relative(cw->comp->layers[cw->layer].clients, EINA_INLIST_GET(cw->ec), EINA_INLIST_GET(layer_cw->ec));
+ else //this is either the layer object or a tough actin tinactin^W^W^Wfast stacking client
+ cw->comp->layers[cw->layer].clients = eina_inlist_append(cw->comp->layers[cw->layer].clients, EINA_INLIST_GET(cw->ec));
+ }
+ cw->comp->layers[cw->layer].clients_count++;
+}
+
+static void
+_e_comp_object_layers_remove(E_Comp_Object *cw)
+{
+ if (cw->ec && cw->comp->layers[cw->layer].clients)
+ {
+ cw->comp->layers[cw->layer].clients = eina_inlist_remove(cw->comp->layers[cw->layer].clients, EINA_INLIST_GET(cw->ec));
+ cw->comp->layers[cw->layer].clients_count--;
+ }
+/*
+ cw->comp->layers[cw->layer].objs = eina_inlist_remove(cw->comp->layers[cw->layer].objs, EINA_INLIST_GET(cw));
+ cw->comp->layers[cw->layer].objs_count--;
+*/
+}
+
+/////////////////////////////////////
+
+static void
+_e_comp_object_shadow(E_Comp_Object *cw)
+{
+ if (!cw->frame_object) return;
+ if (e_util_client_shadow_state_get(cw->ec))
+ edje_object_signal_emit(cw->frame_object, "e,state,shadow,on", "e");
+ else
+ edje_object_signal_emit(cw->frame_object, "e,state,shadow,off", "e");
+}
+
+static void
+_e_comp_object_cb_signal_bind(void *data, Evas_Object *obj EINA_UNUSED, const char *emission, const char *source)
+{
+ E_Comp_Object *cw = data;
+
+ if (e_dnd_active() || (!cw->ec)) return;
+ e_bindings_signal_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(cw->ec),
+ emission, source);
+}
+
+/////////////////////////////////////
+
+static void
+_e_comp_object_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_In *ev = event_info;
+ E_Comp_Object *cw = data;
+
+ e_client_mouse_in(cw->ec, ev->output.x, ev->output.y);
+}
+
+static void
+_e_comp_object_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Out *ev = event_info;
+ E_Comp_Object *cw = data;
+
+ e_client_mouse_out(cw->ec, ev->output.x, ev->output.y);
+}
+
+static void
+_e_comp_object_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Wheel *ev = event_info;
+ E_Comp_Object *cw = data;
+ E_Binding_Event_Wheel ev2;
+
+ if (!cw->ec) return;
+ if (e_client_action_get()) return;
+ e_bindings_evas_event_mouse_wheel_convert(ev, &ev2);
+ e_client_mouse_wheel(cw->ec, &ev->output, &ev2);
+}
+
+static void
+_e_comp_object_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Down *ev = event_info;
+ E_Comp_Object *cw = data;
+ E_Binding_Event_Mouse_Button ev2;
+
+ if (!cw->ec) return;
+ if (e_client_action_get()) return;
+ e_bindings_evas_event_mouse_button_convert(ev, &ev2);
+ e_client_mouse_down(cw->ec, ev->button, &ev->output, &ev2);
+}
+
+static void
+_e_comp_object_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Down *ev = event_info;
+ E_Comp_Object *cw = data;
+ E_Binding_Event_Mouse_Button ev2;
+
+ if (!cw->ec) return;
+ if (e_client_action_get() && (e_client_action_get() != cw->ec)) return;
+ e_bindings_evas_event_mouse_button_convert(ev, &ev2);
+ e_client_mouse_up(cw->ec, ev->button, &ev->output, &ev2);
+}
+
+static void
+_e_comp_object_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Move *ev = event_info;
+ E_Comp_Object *cw = data;
+
+ if (!cw->ec) return;
+ if (e_client_action_get() && (e_client_action_get() != cw->ec)) return;
+ e_client_mouse_move(cw->ec, &ev->cur.output);
+}
+/////////////////////////////////////
+
+static Eina_Bool
+_e_comp_object_shadow_client_match(const E_Client *ec, E_Comp_Match *m)
+{
+ if (((m->title) && (!ec->netwm.name)) ||
+ ((ec->netwm.name) && (m->title) && (!e_util_glob_match(ec->netwm.name, m->title))))
+ return EINA_FALSE;
+ if (((m->clas) && (!ec->icccm.class)) ||
+ ((ec->icccm.class) && (m->clas) && (!e_util_glob_match(ec->icccm.class, m->clas))))
+ return EINA_FALSE;
+ if (((m->role) && (!ec->icccm.window_role)) ||
+ ((ec->icccm.window_role) && (m->role) && (!e_util_glob_match(ec->icccm.window_role, m->role))))
+ return EINA_FALSE;
+ if ((ec->netwm.type != E_WINDOW_TYPE_UNKNOWN) &&
+ (m->primary_type != E_WINDOW_TYPE_UNKNOWN) &&
+ ((int)ec->netwm.type != m->primary_type))
+ return EINA_FALSE;
+ if (m->borderless != 0)
+ {
+ int borderless = 0;
+
+ if ((ec->mwm.borderless) || (ec->borderless))
+ borderless = 1;
+ if (!(((m->borderless == -1) && (!borderless)) ||
+ ((m->borderless == 1) && (borderless))))
+ return EINA_FALSE;
+ }
+ if (m->dialog != 0)
+ {
+ int dialog = 0;
+
+ if (((ec->icccm.transient_for != 0) ||
+ (ec->dialog)))
+ dialog = 1;
+ if (!(((m->dialog == -1) && (!dialog)) ||
+ ((m->dialog == 1) && (dialog))))
+ return EINA_FALSE;
+ }
+ if (m->accepts_focus != 0)
+ {
+ int accepts_focus = 0;
+
+ if (ec->icccm.accepts_focus)
+ accepts_focus = 1;
+ if (!(((m->accepts_focus == -1) && (!accepts_focus)) ||
+ ((m->accepts_focus == 1) && (accepts_focus))))
+ return EINA_FALSE;
+ }
+ if (m->vkbd != 0)
+ {
+ int vkbd = 0;
+
+ if (ec->vkbd.vkbd)
+ vkbd = 1;
+ if (!(((m->vkbd == -1) && (!vkbd)) ||
+ ((m->vkbd == 1) && (vkbd))))
+ return EINA_FALSE;
+ }
+ if (m->argb != 0)
+ {
+ if (!(((m->argb == -1) && (!ec->argb)) ||
+ ((m->argb == 1) && (ec->argb))))
+ return EINA_FALSE;
+ }
+ if (m->fullscreen != 0)
+ {
+ int fullscreen = 0;
+
+ if (ec->netwm.state.fullscreen)
+ fullscreen = 1;
+ if (!(((m->fullscreen == -1) && (!fullscreen)) ||
+ ((m->fullscreen == 1) && (fullscreen))))
+ return EINA_FALSE;
+ }
+ if (m->modal != 0)
+ {
+ int modal = 0;
+
+ if (ec->netwm.state.modal)
+ modal = 1;
+ if (!(((m->modal == -1) && (!modal)) ||
+ ((m->modal == 1) && (modal))))
+ return EINA_FALSE;
+ }
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_e_comp_object_shadow_setup(E_Comp_Object *cw)
+{
+ int ok = 0;
+ char buf[4096];
+ Eina_List *list = NULL, *l;
+ E_Comp_Match *m;
+ Eina_Stringshare *reshadow_group = NULL;
+ Eina_Bool focus = EINA_FALSE, urgent = EINA_FALSE, skip = EINA_FALSE, fast = EINA_FALSE, reshadow = EINA_FALSE, no_shadow = EINA_FALSE;
+ Eina_Stringshare *name, *title;
+ E_Comp_Config *conf = e_comp_config_get();
+
+ edje_object_file_get(cw->shobj, NULL, &reshadow_group);
+ list = cw->ec->override ? conf->match.overrides : conf->match.borders;
+ name = cw->ec->icccm.name;
+ title = cw->ec->icccm.title;
+ skip = (cw->ec->override ? conf->match.disable_overrides : conf->match.disable_borders) || (title && (!strncmp(title, "noshadow", 8)));
+ fast = cw->ec->override ? conf->fast_overrides : conf->fast_borders;
+
+ if (!skip)
+ {
+ EINA_LIST_FOREACH(list, l, m)
+ {
+ if (((m->name) && (!name)) ||
+ ((name) && (m->name) && (!e_util_glob_match(name, m->name))))
+ continue;
+ if (!_e_comp_object_shadow_client_match(cw->ec, m)) continue;
+
+ focus = m->focus;
+ urgent = m->urgent;
+ no_shadow = m->no_shadow;
+ if (m->shadow_style)
+ {
+ if (fast)
+ {
+ snprintf(buf, sizeof(buf), "e/comp/frame/%s/fast", m->shadow_style);
+ reshadow = ok = !e_util_strcmp(reshadow_group, buf);
+ if (!ok)
+ ok = e_theme_edje_object_set(cw->shobj, "base/theme/comp", buf);
+ }
+ if (!ok)
+ {
+ snprintf(buf, sizeof(buf), "e/comp/frame/%s", m->shadow_style);
+ reshadow = ok = !e_util_strcmp(reshadow_group, buf);
+ if (!ok)
+ ok = e_theme_edje_object_set(cw->shobj, "base/theme/comp", buf);
+ }
+ if (ok) break;
+ }
+ }
+ }
+ while (!ok)
+ {
+ if (skip || (cw->ec->e.state.video))
+ {
+ reshadow = ok = !e_util_strcmp(reshadow_group, "e/comp/frame/none");
+ if (!ok)
+ ok = e_theme_edje_object_set(cw->shobj, "base/theme/comp", "e/comp/frame/none");
+ }
+ if (ok) break;
+ if (conf->shadow_style)
+ {
+ if (fast)
+ {
+ snprintf(buf, sizeof(buf), "e/comp/frame/%s/fast", conf->shadow_style);
+ reshadow = ok = !e_util_strcmp(reshadow_group, buf);
+ if (!ok)
+ ok = e_theme_edje_object_set(cw->shobj, "base/theme/comp", buf);
+ }
+ if (!ok)
+ {
+ snprintf(buf, sizeof(buf), "e/comp/frame/%s", conf->shadow_style);
+ reshadow = ok = !e_util_strcmp(reshadow_group, buf);
+ if (!ok)
+ ok = e_theme_edje_object_set(cw->shobj, "base/theme/comp", buf);
+ }
+ }
+ if (!ok)
+ {
+ if (fast)
+ {
+ reshadow = ok = !e_util_strcmp(reshadow_group, "e/comp/frame/default/fast");
+ if (!ok)
+ ok = e_theme_edje_object_set(cw->shobj, "base/theme/comp", "e/comp/frame/default/fast");
+ }
+ if (!ok)
+ {
+ reshadow = ok = !e_util_strcmp(reshadow_group, "e/comp/frame/default");
+ if (!ok)
+ ok = e_theme_edje_object_set(cw->shobj, "base/theme/comp", "e/comp/frame/default");
+ }
+ }
+ break;
+ }
+ if (reshadow)
+ {
+ if (cw->zoomap_disabled)
+ {
+ if (cw->frame_object && (e_zoomap_child_get(cw->zoomobj) == cw->frame_object)) return EINA_FALSE;
+ }
+ else
+ {
+ if (cw->frame_object && (edje_object_part_swallow_get(cw->shobj, "e.swallow.content") == cw->frame_object)) return EINA_FALSE;
+ }
+ }
+ if (cw->ec->override)
+ {
+ if (_e_comp_object_do_shadow(cw) && (!no_shadow))
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,shadow,on", "e");
+ else
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,shadow,off", "e");
+ }
+
+ if (focus || cw->ec->focused)
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,focused", "e");
+ else
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,unfocused", "e");
+ if (urgent || cw->ec->icccm.urgent)
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,urgent", "e");
+ else
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,not_urgent", "e");
+ if (cw->ec->shaded)
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,shaded", "e");
+ if (cw->ec->sticky)
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,sticky", "e");
+ if (cw->ec->hung)
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,hung", "e");
+ if (cw->visible || cw->ec->re_manage)
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,visible", "e");
+ else if (cw->ec->iconic)
+ e_comp_object_signal_emit(cw->smart_obj, "e,action,iconify", "e");
+ else
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,hidden", "e");
+
+ if (cw->ec->iconic && cw->ec->re_manage)
+ e_comp_object_signal_emit(cw->smart_obj, "e,action,iconify", "e");
+ if (!cw->zoomap_disabled)
+ e_zoomap_child_set(cw->zoomobj, NULL);
+ if (cw->frame_object)
+ {
+ edje_object_part_swallow(cw->frame_object, "e.swallow.client", cw->obj);
+ edje_object_part_swallow(cw->frame_object, "e.swallow.icon", cw->frame_icon);
+ if (cw->zoomap_disabled)
+ edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->frame_object);
+ else
+ {
+ e_zoomap_child_set(cw->zoomobj, cw->frame_object);
+ edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->zoomobj);
+ }
+ no_shadow = 1;
+ }
+ else
+ {
+ no_shadow = 1;
+ if (cw->zoomobj)
+ {
+ e_zoomap_child_set(cw->zoomobj, cw->obj);
+ edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->zoomobj);
+ }
+ else
+ edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->obj);
+ }
+#ifdef BORDER_ZOOMAPS
+ e_zoomap_child_edje_solid_setup(cw->zoomobj);
+#endif
+ return EINA_TRUE;
+}
+
+/////////////////////////////////////////////
+
+static void
+_e_comp_object_done_defer(void *data, Evas_Object *obj EINA_UNUSED, const char *emission, const char *source EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+
+ //INF("DONE DEFER %p: %dx%d - %s", cw->ec, cw->w, cw->h, emission);
+ if ((!cw->ec->new_client) && (!cw->ec->changes.size) && ((cw->w < 0) || (cw->h < 0)) && (!strcmp(emission, "e,action,show,done")))
+ CRI("ACK!");
+ if (cw->animating)
+ {
+ cw->animating = 0;
+ cw->comp->animating--;
+ if (!e_object_unref(E_OBJECT(cw->ec))) return;
+ }
+ if (cw->defer_hide &&
+ ((!strcmp(emission, "e,action,hide,done")) ||
+ (!strcmp(emission, "e,action,iconify,done"))))
+ evas_object_hide(cw->smart_obj);
+}
+
+/////////////////////////////////////////////
+
+static void
+_e_comp_object_setup(E_Comp_Object *cw)
+{
+ cw->clip = evas_object_rectangle_add(cw->comp->evas);
+ evas_object_resize(cw->clip, cw->comp->man->w, cw->comp->man->h);
+ evas_object_smart_member_add(cw->clip, cw->smart_obj);
+ cw->effect_obj = edje_object_add(cw->comp->evas);
+ evas_object_move(cw->effect_obj, cw->x, cw->y);
+ evas_object_clip_set(cw->effect_obj, cw->clip);
+ evas_object_smart_member_add(cw->effect_obj, cw->smart_obj);
+ e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", "e/comp/effects/none");
+ cw->shobj = edje_object_add(cw->comp->evas);
+ edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj);
+ edje_object_signal_callback_add(cw->shobj, "e,action,*,done", "e", _e_comp_object_done_defer, cw);
+
+ if (cw->ec->override)
+ {
+ evas_object_name_set(cw->shobj, "cw->shobj::WINDOW");
+ evas_object_name_set(cw->effect_obj, "cw->effect_obj::WINDOW");
+ evas_object_name_set(cw->clip, "cw->clip::WINDOW");
+ }
+ else if (!cw->ec->input_only)
+ {
+ evas_object_name_set(cw->shobj, "cw->shobj::CLIENT");
+ evas_object_name_set(cw->effect_obj, "cw->effect_obj::CLIENT");
+ evas_object_name_set(cw->clip, "cw->clip::CLIENT");
+ }
+ cw->real_hid = !cw->ec->input_only;
+ if (!cw->ec->input_only)
+ {
+ //e_util_size_debug_set(cw->clip, 1);
+ e_util_size_debug_set(cw->effect_obj, 1);
+ //e_util_size_debug_set(cw->shobj, 1);
+ evas_object_event_callback_add(cw->smart_obj, EVAS_CALLBACK_MOUSE_IN, _e_comp_object_cb_mouse_in, cw);
+ evas_object_event_callback_add(cw->smart_obj, EVAS_CALLBACK_MOUSE_OUT, _e_comp_object_cb_mouse_out, cw);
+ evas_object_event_callback_add(cw->smart_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_comp_object_cb_mouse_down, cw);
+ evas_object_event_callback_add(cw->smart_obj, EVAS_CALLBACK_MOUSE_UP, _e_comp_object_cb_mouse_up, cw);
+ evas_object_event_callback_add(cw->smart_obj, EVAS_CALLBACK_MOUSE_MOVE, _e_comp_object_cb_mouse_move, cw);
+ evas_object_event_callback_add(cw->smart_obj, EVAS_CALLBACK_MOUSE_WHEEL, _e_comp_object_cb_mouse_wheel, cw);
+ }
+}
+
+/////////////////////////////////////////////
+
+static void
+_e_comp_object_pixels_get(void *data, Evas_Object *obj EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+ E_Client *ec = cw->ec;
+ int pw, ph;
+
+ if (e_object_is_del(E_OBJECT(ec))) return;
+ if (!e_pixmap_size_get(ec->pixmap, &pw, &ph)) return;
+ //INF("PIXEL GET %p: %dx%d || %dx%d", ec, ec->w, ec->h, pw, ph);
+ if (cw->native)
+ E_FREE_FUNC(cw->pending_updates, eina_tiler_free);
+ else if (e_comp_object_render(ec->frame))
+ {
+ if ((!cw->native) && (ec->shaped || ec->shape_changed))
+ e_comp_object_shape_apply(ec->frame);
+ ec->shape_changed = 0;
+ }
+ evas_object_precise_is_inside_set(cw->obj, ec->shaped);
+
+ if (e_pixmap_dirty_get(ec->pixmap) && e_pixmap_size_get(ec->pixmap, &pw, &ph))
+ e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
+ //INF("%p PX(%dx%d) EC(%dx%d) CW(%dx%d)", ec, pw, ph, ec->w, ec->h, cw->w, cw->h);
+ //e_comp_object_frame_wh_adjust(cw->smart_obj, pw, ph, &pw, &ph);
+ //if ((ec->w != pw) || (ec->h != ph))
+ //{
+ ///* DO NOT RESIZE HERE. */
+ //INF("CW RSZ FIX: %dx%d -> %dx%d", ec->w, ec->h, pw, ph);
+ //ec->w = pw, ec->h = ph;
+ //ec->changes.size = 1;
+ //EC_CHANGED(ec);
+ //}
+}
+
+/////////////////////////////////////////////
+
+static void
+_e_comp_object_client_pending_resize_add(E_Client *ec,
+ int w,
+ int h,
+ unsigned int serial)
+{
+ E_Client_Pending_Resize *pnd;
+
+ pnd = E_NEW(E_Client_Pending_Resize, 1);
+ if (!pnd) return;
+ pnd->w = w;
+ pnd->h = h;
+ pnd->serial = serial;
+ ec->pending_resize = eina_list_append(ec->pending_resize, pnd);
+}
+
+static void
+_e_comp_intercept_move(void *data, Evas_Object *obj, int x, int y)
+{
+ E_Comp_Object *cw = data;
+ int ix, iy;
+
+ if ((cw->x == x) && (cw->y == y)) return;
+ ix = x + cw->client_inset.l;
+ iy = y + cw->client_inset.t;
+ if (cw->ec->maximized && ((cw->ec->x != x) || (cw->ec->y != y)))
+ {
+ if ((!e_config->allow_manip) && ((cw->ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH)) return;
+ if ((!cw->ec->shading) && (!cw->ec->shaded))
+ {
+ cw->ec->changes.need_unmaximize = 1;
+ cw->ec->saved.x = ix;
+ cw->ec->saved.y = iy;
+ cw->ec->saved.w = cw->ec->client.w;
+ cw->ec->saved.h = cw->ec->client.h;
+ EC_CHANGED(cw->ec);
+ return;
+ }
+ return;
+ }
+ cw->ec->x = x, cw->ec->y = y;
+ if (e_client_resizing_get(cw->ec) && (!cw->force_move)) return;
+ if (!cw->ec->shading)
+ {
+ cw->ec->client.x = ix;
+ cw->ec->client.y = iy;
+ }
+ if (cw->ec->new_client)
+ {
+ cw->ec->placed = ((!cw->ec->dialog) && (!cw->ec->parent));
+ cw->ec->changes.pos = 1;
+ EC_CHANGED(cw->ec);
+ }
+ else
+ evas_object_move(obj, x, y);
+}
+
+static void
+_e_comp_intercept_resize(void *data, Evas_Object *obj, int w, int h)
+{
+ E_Comp_Object *cw = data;
+ int pw, ph, fw, fh, iw, ih, prev_w, prev_h;
+
+ if ((cw->w == w) && (cw->h == h)) return;
+ if (cw->ec->fullscreen && ((w != cw->ec->zone->w) || (h != cw->ec->zone->h)))
+ return;
+ /* calculate client size */
+ iw = w - cw->client_inset.l - cw->client_inset.r;
+ ih = h - cw->client_inset.t - cw->client_inset.b;
+ if (cw->ec->maximized && ((cw->ec->w != w) || (cw->ec->h != h)))
+ {
+ if ((!e_config->allow_manip) && ((cw->ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH)) return;
+ if ((!cw->ec->shading) && (!cw->ec->shaded))
+ {
+ cw->ec->changes.need_unmaximize = 1;
+ cw->ec->saved.w = iw;
+ cw->ec->saved.h = ih;
+ cw->ec->saved.x = cw->ec->client.x;
+ cw->ec->saved.y = cw->ec->client.y;
+ EC_CHANGED(cw->ec);
+ return;
+ }
+ }
+ if (cw->ec->new_client)
+ {
+ if (!cw->ec->maximized)
+ {
+ cw->ec->w = w, cw->ec->h = h;
+ cw->ec->changes.size = 1;
+ EC_CHANGED(cw->ec);
+ }
+ return;
+ }
+ if ((!cw->ec->internal) && e_client_resizing_get(cw->ec) && cw->ec->netwm.sync.request &&
+ ((cw->ec->w != w) && (cw->ec->h != h)))
+ {
+ /* this is ugly. */
+ //INF("PENDING %dx%d", iw, ih);
+ _e_comp_object_client_pending_resize_add(cw->ec, iw, ih, cw->ec->netwm.sync.serial);
+ }
+ cw->ec->w = w, cw->ec->h = h;
+ if ((!cw->ec->shading) && (!cw->ec->shaded))
+ {
+ /* client geom never changes when shading since the client is never altered */
+ //INF("%p: CUR(%dx%d) || REQ(%dx%d)", cw->ec, cw->ec->client.w, cw->ec->client.h, iw, ih);
+ cw->ec->client.w = iw;
+ cw->ec->client.h = ih;
+ if ((cw->ec->client.w < 0) || (cw->ec->client.h < 0)) CRI("WTF");
+ }
+ if ((!cw->ec->input_only) && (!e_pixmap_size_get(cw->ec->pixmap, &pw, &ph)))
+ {
+ e_pixmap_dirty(cw->ec->pixmap);
+ e_comp_object_render_update_add(obj);
+ cw->ec->changes.size = 1;
+ EC_CHANGED(cw->ec);
+ return;
+ }
+ prev_w = cw->w, prev_h = cw->h;
+ e_comp_object_frame_wh_adjust(obj, 0, 0, &fw, &fh);
+ if ((!cw->ec->shading) && (!cw->ec->shaded) && (!cw->ec->input_only) && (!cw->ec->override) &&
+ (((w - fw != pw) || (h - fh != ph))))
+ {
+ //INF("CALLBACK: REQ(%dx%d) != CUR(%dx%d)", w - fw, h - fh, pw, ph);
+ evas_object_smart_callback_call(obj, "client_resize", NULL);
+ e_comp_object_frame_wh_adjust(obj, pw, ph, &w, &h);
+ evas_object_resize(obj, w, h);
+ }
+ else
+ {
+ //INF("INTERCEPT %dx%d", w, h);
+ evas_object_resize(obj, w, h);
+ }
+ cw->ec->need_shape_merge |= cw->ec->shaped || cw->ec->shaped_input;
+ cw->ec->need_shape_export |= cw->ec->shaped;
+ if (cw->ec->shaped || cw->ec->shaped_input)
+ EC_CHANGED(cw->ec);
+
+ /* this fixes positioning jiggles when using a resize mode
+ * which also changes the client's position
+ */
+ cw->force_move = 1;
+ switch (cw->ec->resize_mode)
+ {
+ case E_POINTER_RESIZE_BL:
+ case E_POINTER_RESIZE_L:
+ evas_object_move(obj, cw->x + prev_w - cw->w, cw->y);
+ break;
+ case E_POINTER_RESIZE_TL:
+ evas_object_move(obj, cw->x + prev_w - cw->w, cw->y + prev_h - cw->h);
+ break;
+ case E_POINTER_RESIZE_T:
+ case E_POINTER_RESIZE_TR:
+ evas_object_move(obj, cw->x, cw->y + prev_h - cw->h);
+ break;
+ default:
+ break;
+ }
+ cw->force_move = 0;
+}
+
+static void
+_e_comp_intercept_layer_set(void *data, Evas_Object *obj, int layer)
+{
+ E_Comp_Object *cw = data;
+ unsigned int l = e_comp_canvas_layer_map(layer);
+ int oldraise;
+
+ if (cw->layer == l) return;
+ if (e_comp_canvas_client_layer_map(layer) == 9999) return; //invalid layer for clients
+ if (cw->ec->fullscreen)
+ {
+ cw->ec->saved.layer = layer;
+ return;
+ }
+ oldraise = e_config->transient.raise;
+ _e_comp_object_layers_remove(cw);
+ /* clamp to valid client layer */
+ layer = e_comp_canvas_client_layer_map_nearest(layer);
+ cw->ec->layer = layer;
+ if (e_config->transient.layer)
+ {
+ E_Client *child;
+ Eina_List *list = eina_list_clone(cw->ec->transients);
+
+ /* We need to set raise to one, else the child wont
+ * follow to the new layer. It should be like this,
+ * even if the user usually doesn't want to raise
+ * the transients.
+ */
+ e_config->transient.raise = 1;
+ EINA_LIST_FREE(list, child)
+ evas_object_layer_set(child->frame, layer);
+ }
+ if (!cw->ec->override)
+ {
+ if (layer == E_LAYER_CLIENT_BELOW)
+ e_hints_window_stacking_set(cw->ec, E_STACKING_BELOW);
+ else if (layer == E_LAYER_CLIENT_ABOVE)
+ e_hints_window_stacking_set(cw->ec, E_STACKING_ABOVE);
+ else
+ e_hints_window_stacking_set(cw->ec, E_STACKING_NONE);
+ }
+
+ e_config->transient.raise = oldraise;
+ cw->layer = e_comp_canvas_layer_map(layer);
+ _e_comp_object_layers_add(cw, NULL, NULL, 0);
+ //if (cw->ec->new_client)
+ //INF("CLIENT STACKED %p: %u", cw->ec, layer);
+ evas_object_layer_set(obj, layer);
+ if (!cw->comp->layers[cw->layer].obj)
+ {
+ /* got a fast stacker :/ */
+ E_Client *ec2;
+
+ ec2 = e_client_below_get(cw->ec);
+ if (ec2)
+ evas_object_stack_above(obj, ec2->frame);
+ else
+ {
+ ec2 = e_client_above_get(cw->ec);
+ if (ec2)
+ evas_object_stack_below(obj, ec2->frame);
+ else
+ evas_object_lower(obj);
+ }
+ return;
+ }
+ evas_object_stack_below(obj, cw->comp->layers[cw->layer].obj);
+ if (evas_object_below_get(obj) == cw->comp->layers[cw->layer].obj)
+ {
+ CRI("STACKING ERROR!!!");
+ }
+ e_comp_shape_queue(cw->comp);
+}
+
+static void
+_e_comp_intercept_stack_above(void *data, Evas_Object *obj, Evas_Object *above)
+{
+ E_Comp_Object *cw2 = NULL, *cw = data;
+ E_Client *ecstack;
+ short layer;
+ Evas_Object *o = above;
+
+ EINA_SAFETY_ON_TRUE_RETURN(obj == above);
+ if (evas_object_below_get(obj) == above) return;
+ if (cw->ec->new_client)
+ layer = cw->ec->layer;
+ else
+ layer = evas_object_layer_get(above);
+ ecstack = e_client_below_get(cw->ec);
+ if (layer != e_comp_canvas_layer_map_to(cw->layer))
+ {
+ /* some FOOL is trying to restack a layer marker */
+ if (obj == cw->comp->layers[cw->layer].obj) return;
+ evas_object_layer_set(obj, layer);
+ /* we got our layer wrangled, return now! */
+ if (layer != e_comp_canvas_layer_map_to(cw->layer)) return;
+ }
+
+ /* check if we're stacking below another client */
+ cw2 = evas_object_data_get(o, "comp_obj");
+ while (!cw2)
+ {
+ /* find an existing client to use for layering
+ * by walking up the object stack
+ *
+ * this is guaranteed to be pretty quick since we'll either:
+ * - run out of client layers
+ * - find a stacking client
+ */
+ o = evas_object_above_get(o);
+ if ((!o) || (o == obj)) break;
+ if (evas_object_layer_get(o) != layer)
+ {
+ /* reached the top client layer somehow
+ * use top client object
+ */
+ o = cw->comp->layers[e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO)].obj;
+ }
+ if (!o)
+ /* top client layer window hasn't been stacked yet. this probably shouldn't happen?
+ * return here since the top client layer window
+ */
+ {
+ E_Client *ec;
+
+ ec = e_client_top_get(cw->comp);
+ if (ec)
+ o = ec->frame;
+ //else //wat
+ }
+ if (o) cw2 = evas_object_data_get(o, "comp_obj");
+ }
+
+
+ /* remove existing layers */
+ _e_comp_object_layers_remove(cw);
+ if (cw2)
+ {
+ if (o == above)
+ _e_comp_object_layers_add(cw, cw2, NULL, 0);
+ else if (o == obj)
+ _e_comp_object_layers_add(cw, NULL, NULL, 0);
+ else
+ _e_comp_object_layers_add(cw, NULL, cw2, 0);
+ }
+ else
+ _e_comp_object_layers_add(cw, NULL, NULL, 0);
+ if (cw->ec->new_client || (ecstack != (cw2 ? cw2->ec : NULL)))
+ evas_object_data_set(obj, "client_restack", (void*)1);
+ evas_object_stack_above(obj, above);
+ if (cw->comp->layers[cw->layer].obj)
+ if (evas_object_below_get(obj) == cw->comp->layers[cw->layer].obj)
+ {
+ CRI("STACKING ERROR!!!");
+ }
+ if (cw->ec->new_client || (ecstack != (cw2 ? cw2->ec : NULL)))
+ evas_object_data_del(obj, "client_restack");
+ e_comp_shape_queue(cw->comp);
+}
+
+static void
+_e_comp_intercept_stack_below(void *data, Evas_Object *obj, Evas_Object *below)
+{
+ E_Comp_Object *cw2 = NULL, *cw = data;
+ E_Client *ecstack;
+ short layer;
+ Evas_Object *o = below;
+
+ EINA_SAFETY_ON_TRUE_RETURN(obj == below);
+ if (evas_object_above_get(obj) == below) return;
+ if (cw->ec->new_client)
+ layer = cw->ec->layer;
+ else
+ layer = evas_object_layer_get(below);
+ ecstack = e_client_below_get(cw->ec);
+ if (layer != e_comp_canvas_layer_map_to(cw->layer))
+ {
+ /* some FOOL is trying to restack a layer marker */
+ if (obj == cw->comp->layers[cw->layer].obj) return;
+ evas_object_layer_set(obj, layer);
+ /* we got our layer wrangled, return now! */
+ if (layer != e_comp_canvas_layer_map_to(cw->layer)) return;
+ }
+
+ /* check if we're stacking below another client */
+ cw2 = evas_object_data_get(o, "comp_obj");
+ while (!cw2)
+ {
+ /* find an existing client to use for layering
+ * by walking up the object stack
+ *
+ * this is guaranteed to be pretty quick since we'll either:
+ * - run out of client layers
+ * - find a stacking client
+ */
+ o = evas_object_above_get(o);
+ if ((!o) || (o == obj)) break;
+ if (evas_object_layer_get(o) != layer)
+ {
+ /* reached the top client layer somehow
+ * use top client object
+ */
+ o = cw->comp->layers[e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO)].obj;
+ }
+ if (!o)
+ /* top client layer window hasn't been stacked yet. this probably shouldn't happen?
+ * return here since the top client layer window
+ */
+ {
+ E_Client *ec;
+
+ ec = e_client_top_get(cw->comp);
+ if (ec)
+ o = ec->frame;
+ //else //wat
+ }
+ if (o) cw2 = evas_object_data_get(o, "comp_obj");
+ }
+
+
+ /* remove existing layers */
+ _e_comp_object_layers_remove(cw);
+ if (cw2)
+ {
+ if (o == below)
+ _e_comp_object_layers_add(cw, NULL, cw2, 0);
+ else if (o == obj)
+ _e_comp_object_layers_add(cw, NULL, NULL, 1);
+ else
+ _e_comp_object_layers_add(cw, cw2, NULL, 0);
+ }
+ else
+ _e_comp_object_layers_add(cw, NULL, NULL, 0);
+ if (cw->ec->new_client || (ecstack != (cw2 ? cw2->ec : NULL)))
+ evas_object_data_set(obj, "client_restack", (void*)1);
+ evas_object_stack_below(obj, below);
+ if (cw->comp->layers[cw->layer].obj)
+ if (evas_object_below_get(obj) == cw->comp->layers[cw->layer].obj)
+ {
+ CRI("STACKING ERROR!!!");
+ }
+ if (cw->ec->new_client || (ecstack != (cw2 ? cw2->ec : NULL)))
+ evas_object_data_del(obj, "client_restack");
+ e_comp_shape_queue(cw->comp);
+}
+
+static void
+_e_comp_intercept_lower(void *data, Evas_Object *obj)
+{
+ E_Comp_Object *cw = data;
+ Evas_Object *o;
+
+ if (!EINA_INLIST_GET(cw->ec)->prev) return; //already lowest on layer
+ o = evas_object_below_get(obj);
+ _e_comp_object_layers_remove(cw);
+ _e_comp_object_layers_add(cw, NULL, NULL, 1);
+ if (evas_object_layer_get(o) != evas_object_layer_get(obj)) return; //already at bottom!
+ if (obj == cw->comp->layers[cw->layer].obj) return; //never lower a layer marker!
+ if (o == evas_object_below_get(obj)) return;
+ evas_object_lower(obj);
+ e_comp_shape_queue(cw->comp);
+}
+
+static void
+_e_comp_intercept_raise(void *data, Evas_Object *obj)
+{
+ E_Comp_Object *cw = data;
+ Evas_Object *o;
+
+ if (!EINA_INLIST_GET(cw->ec)->next) return;//already highest on layer
+ {
+ E_Client *ecabove = e_client_above_get(cw->ec);
+ if (ecabove && (ecabove->frame == cw->comp->layers[cw->layer].obj)) return; //highest below marker
+ }
+ o = evas_object_above_get(obj);
+ _e_comp_object_layers_remove(cw);
+ _e_comp_object_layers_add(cw, NULL, NULL, 0);
+ if (evas_object_layer_get(o) != evas_object_layer_get(obj)) return; //already at top!
+ if (obj == cw->comp->layers[cw->layer].obj) //never raise a non-layer marker!
+ evas_object_raise(obj);
+ else
+ {
+ evas_object_stack_below(obj, cw->comp->layers[cw->layer].obj);
+ e_client_raise_latest_set(cw->ec);
+ }
+ e_comp_shape_queue(cw->comp);
+}
+
+static void
+_e_comp_intercept_hide(void *data, Evas_Object *obj)
+{
+ E_Comp_Object *cw = data;
+
+ if (cw->ec->hidden)
+ {
+ evas_object_hide(obj);
+ return;
+ }
+
+ if (cw->ec->input_only)
+ {
+ evas_object_hide(obj);
+ return;
+ }
+ if ((!cw->visible) || (cw->animating && (!cw->ec->iconic))) return;
+
+ if (!cw->defer_hide)
+ {
+ cw->defer_hide = 1;
+ if ((!cw->animating) || (cw->ec->iconic))
+ {
+ if (!cw->comp->animating)
+ cw->comp->animating++;
+ cw->animating = 1;
+ e_object_ref(E_OBJECT(cw->ec));
+ if (cw->ec->iconic)
+ e_comp_object_signal_emit(obj, "e,action,iconify", "e");
+ else
+ e_comp_object_signal_emit(obj, "e,state,hidden", "e");
+ }
+ }
+ if (cw->animating) return;
+ cw->defer_hide = 0;
+ evas_object_hide(obj);
+}
+
+static void
+_e_comp_intercept_show_helper(E_Comp_Object *cw)
+{
+ int w = 0, h = 0, pw, ph;
+
+ if (cw->ec->sticky)
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,sticky", "e");
+ if (cw->visible)
+ {
+ if (cw->ec->iconic && cw->animating)
+ {
+ e_comp_object_signal_emit(cw->smart_obj, "e,action,uniconify", "e");
+ cw->defer_hide = 0;
+ }
+ return;
+ }
+ if (cw->ec->new_client)
+ {
+ cw->ec->changes.visible = !cw->ec->hidden;
+ cw->ec->visible = 1;
+ EC_CHANGED(cw->ec);
+ return;
+ }
+ if (cw->ec->input_only)
+ {
+ cw->real_hid = 0;
+ evas_object_move(cw->smart_obj, cw->ec->x, cw->ec->y);
+ evas_object_resize(cw->smart_obj, cw->ec->w, cw->ec->h);
+ evas_object_show(cw->smart_obj);
+ return;
+ }
+ evas_object_move(cw->smart_obj, cw->ec->x, cw->ec->y);
+ if (cw->frame_object && (cw->ec->h == cw->ec->client.h))
+ CRI("ACK!");
+ evas_object_resize(cw->smart_obj, cw->ec->w, cw->ec->h);
+ if ((cw->w < 1) || (cw->h < 1))
+ {
+ cw->ec->visible = cw->ec->changes.visible = 1;
+ EC_CHANGED(cw->ec);
+ return;
+ }
+ e_pixmap_size_get(cw->ec->pixmap, &pw, &ph);
+ if ((!e_pixmap_refresh(cw->ec->pixmap)) || (!e_pixmap_size_get(cw->ec->pixmap, &w, &h)))
+ e_pixmap_clear(cw->ec->pixmap);
+
+ if (cw->real_hid && w && h)
+ {
+ DBG(" [%p] real hid - fix", cw->ec);
+ cw->real_hid = 0;
+ }
+
+ if (!cw->real_hid)
+ {
+ e_comp_object_damage(cw->smart_obj, 0, 0, cw->w, cw->h);
+ evas_object_show(cw->smart_obj);
+ }
+}
+
+static void
+_e_comp_intercept_show(void *data, Evas_Object *obj EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+ E_Client *ec = cw->ec;
+
+ if (ec->ignored) return;
+ if (cw->effect_obj)
+ {
+ //INF("SHOW2 %p", ec);
+ _e_comp_intercept_show_helper(cw);
+ return;
+ }
+ //INF("SHOW %p", ec);
+ if (ec->input_only)
+ {
+ cw->effect_obj = evas_object_rectangle_add(cw->comp->evas);
+ evas_object_color_set(cw->effect_obj, 0, 0, 0, 0);
+ evas_object_smart_member_add(cw->effect_obj, cw->smart_obj);
+ }
+ else
+ {
+ _e_comp_object_setup(cw);
+ cw->obj = evas_object_image_filled_add(cw->comp->evas);
+ e_util_size_debug_set(cw->obj, 1);
+ evas_object_image_pixels_get_callback_set(cw->obj, _e_comp_object_pixels_get, cw);
+ evas_object_image_smooth_scale_set(cw->obj, e_comp_config_get()->smooth_windows);
+ evas_object_name_set(cw->obj, "cw->obj");
+ evas_object_image_colorspace_set(cw->obj, EVAS_COLORSPACE_ARGB8888);
+ evas_object_image_alpha_set(cw->obj, ec->argb);
+#ifdef BORDER_ZOOMAPS
+ e_comp_object_zoomap_set(o, 1);
+#else
+ cw->zoomap_disabled = 1;
+#endif
+ e_comp_object_frame_theme_set(cw->smart_obj, E_COMP_OBJECT_FRAME_RESHADOW);
+
+ cw->redirected = 1;
+ evas_object_color_set(cw->clip, ec->netwm.opacity, ec->netwm.opacity, ec->netwm.opacity, ec->netwm.opacity);
+
+ if ((!cw->ec->input_only) && (!cw->ec->ignored))
+ {
+ cw->updates = eina_tiler_new(cw->ec->client.w, cw->ec->client.h);
+ eina_tiler_tile_size_set(cw->updates, 1, 1);
+ }
+ }
+
+ _e_comp_intercept_show_helper(cw);
+}
+
+static void
+_e_comp_intercept_focus(void *data, Evas_Object *obj, Eina_Bool focus)
+{
+ E_Comp_Object *cw = data;
+ E_Client *ec;
+
+ ec = cw->ec;
+ /* note: this is here as it seems there are enough apps that do not even
+ * expect us to emulate a look of focus but not actually set x input
+ * focus as we do - so simply abort any focuse set on such windows */
+ /* be strict about accepting focus hint */
+ if (e_pixmap_is_x(ec->pixmap))
+ {
+ /* be strict about accepting focus hint */
+ if ((!ec->icccm.accepts_focus) &&
+ (!ec->icccm.take_focus)) return;
+ }
+ if (focus && ec->lock_focus_out) return;
+ if (e_object_is_del(E_OBJECT(ec)) && focus)
+ CRI("CAN'T FOCUS DELETED CLIENT!");
+
+ /* dont focus an iconified window. that's silly! */
+ if (focus)
+ {
+ if (ec->focused)
+ {
+ evas_object_focus_set(obj, focus);
+ return;
+ }
+ if ((ec->iconic) && (!ec->deskshow))
+ {
+ e_client_uniconify(ec);
+ if (e_client_focus_track_enabled())
+ e_client_focus_latest_set(ec);
+ return;
+ }
+ if (!ec->visible)
+ {
+ return;
+ }
+ /* FIXME: hack for deskflip animation:
+ * dont update focus when sliding previous desk */
+ if ((!ec->sticky) &&
+ (ec->desk != e_desk_current_get(ec->desk->zone)))
+ {
+ return;
+ }
+ }
+
+ if (focus)
+ {
+ if ((ec->modal) && (ec->modal != ec) &&
+ (ec->modal->visible) && (!e_object_is_del(E_OBJECT(ec->modal))))
+ {
+ evas_object_focus_set(ec->modal->frame, focus);
+ return;
+ }
+ else if ((ec->leader) && (ec->leader->modal) &&
+ (ec->leader->modal != ec) && ec->leader->modal->visible &&
+ (!e_object_is_del(E_OBJECT(ec->leader->modal))))
+ {
+ evas_object_focus_set(ec->leader->modal->frame, focus);
+ return;
+ }
+ if (!cw->visible)
+ {
+ /* not yet visible, wait till the next time... */
+ ec->want_focus = 1;
+ EC_CHANGED(ec);
+ return;
+ }
+ e_client_focused_set(ec);
+ }
+ else
+ {
+ if (e_client_focused_get() == ec)
+ e_client_focused_set(NULL);
+ }
+ evas_object_focus_set(obj, focus);
+}
+
+////////////////////////////////////////////////////
+
+static void
+_e_comp_object_frame_recalc(E_Comp_Object *cw)
+{
+ int w, h, ox, oy, ow, oh;
+
+ if (cw->frame_object)
+ {
+ if (cw->obj) edje_object_part_unswallow(cw->frame_object, cw->obj);
+ evas_object_geometry_get(cw->frame_object, NULL, NULL, &w, &h);
+ evas_object_resize(cw->frame_object, MAX(w, 50), MAX(h, 50));
+ edje_object_message_signal_process(cw->frame_object);
+ edje_object_calc_force(cw->frame_object);
+ edje_object_part_geometry_get(cw->frame_object, "e.swallow.client", &ox, &oy, &ow, &oh);
+ cw->client_inset.l = ox;
+ cw->client_inset.r = MAX(w, 50) - (ox + ow);
+ cw->client_inset.t = oy;
+ cw->client_inset.b = MAX(h, 50) - (oy + oh);
+ if (cw->obj) edje_object_part_swallow(cw->frame_object, "e.swallow.client", cw->obj);
+ evas_object_resize(cw->frame_object, w, h);
+ if (cw->input_rect.w && (!cw->input_obj))
+ evas_object_pass_events_set(cw->obj, 0);
+ }
+ else
+ {
+ cw->client_inset.l = 0;
+ cw->client_inset.r = 0;
+ cw->client_inset.t = 0;
+ cw->client_inset.b = 0;
+ }
+ cw->client_inset.calc = 1;
+}
+
+static void
+_e_comp_smart_cb_frame_recalc(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+ int w, h, pw, ph;
+
+ w = cw->ec->w, h = cw->ec->h;
+ e_comp_object_frame_wh_unadjust(obj, w, h, &pw, &ph);
+
+ _e_comp_object_frame_recalc(cw);
+
+ if (!cw->ec->fullscreen)
+ e_comp_object_frame_wh_adjust(obj, cw->ec->client.w, cw->ec->client.h, &w, &h);
+
+ evas_object_smart_callback_call(cw->smart_obj, "frame_recalc_done", &cw->client_inset);
+ if (cw->ec->shading || cw->ec->shaded) return;
+ if (cw->ec->fullscreen)
+ evas_object_resize(cw->ec->frame, cw->ec->zone->w, cw->ec->zone->h);
+ else if (cw->ec->new_client)
+ {
+ e_comp_object_frame_wh_adjust(obj, pw, ph, &w, &h);
+ evas_object_resize(cw->ec->frame, w, h);
+ }
+ else if ((w != cw->ec->w) || (h != cw->ec->h))
+ evas_object_resize(cw->ec->frame, w, h);
+}
+
+static Eina_Bool
+_e_comp_object_shade_animator(void *data)
+{
+ E_Comp_Object *cw = data;
+ Eina_Bool move = EINA_FALSE;
+ int x, y, w, h;
+ double dt, val;
+ double dur;
+
+ dt = ecore_loop_time_get() - cw->shade.start;
+ dur = cw->ec->client.h / e_config->border_shade_speed;
+ val = dt / dur;
+
+ if (val < 0.0)
+ val = 0.0;
+ else if (val > 1.0)
+ val = 1.0;
+
+ if (e_config->border_shade_transition == E_TRANSITION_SINUSOIDAL)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else if (e_config->border_shade_transition == E_TRANSITION_DECELERATE)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_DECELERATE, 0.0, 0.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else if (e_config->border_shade_transition == E_TRANSITION_ACCELERATE)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else if (e_config->border_shade_transition == E_TRANSITION_LINEAR)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_LINEAR, 0.0, 0.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else if (e_config->border_shade_transition == E_TRANSITION_ACCELERATE_LOTS)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_ACCELERATE_FACTOR, 1.7, 0.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else if (e_config->border_shade_transition == E_TRANSITION_DECELERATE_LOTS)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_DECELERATE_FACTOR, 1.7, 0.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else if (e_config->border_shade_transition == E_TRANSITION_SINUSOIDAL_LOTS)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_SINUSOIDAL_FACTOR, 1.7, 0.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else if (e_config->border_shade_transition == E_TRANSITION_BOUNCE)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_BOUNCE, 1.2, 3.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else if (e_config->border_shade_transition == E_TRANSITION_BOUNCE_LOTS)
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_BOUNCE, 1.2, 5.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+ else
+ {
+ cw->shade.val =
+ ecore_animator_pos_map(val, ECORE_POS_MAP_LINEAR, 0.0, 0.0);
+ if (!cw->ec->shaded) cw->shade.val = 1.0 - cw->shade.val;
+ }
+
+ /* due to M_PI's innacuracy, cos(M_PI/2) != 0.0, so we need this */
+ if (cw->shade.val < 0.001) cw->shade.val = 0.0;
+ else if (cw->shade.val > .999)
+ cw->shade.val = 1.0;
+
+ x = cw->ec->x, y = cw->ec->y, w = cw->ec->w, h = cw->ec->h;
+ if (cw->shade.dir == E_DIRECTION_UP)
+ h = cw->client_inset.t + cw->ec->client.h * cw->shade.val;
+ else if (cw->shade.dir == E_DIRECTION_DOWN)
+ {
+ h = cw->client_inset.t + cw->ec->client.h * cw->shade.val;
+ y = cw->shade.y + cw->ec->client.h * (1 - cw->shade.val);
+ move = EINA_TRUE;
+ }
+ else if (cw->shade.dir == E_DIRECTION_LEFT)
+ w = cw->client_inset.t + cw->ec->client.w * cw->shade.val;
+ else if (cw->shade.dir == E_DIRECTION_RIGHT)
+ {
+ w = cw->client_inset.t + cw->ec->client.w * cw->shade.val;
+ x = cw->shade.x + cw->ec->client.w * (1 - cw->shade.val);
+ move = EINA_TRUE;
+ }
+
+ if (move) evas_object_move(cw->smart_obj, x, y);
+ evas_object_resize(cw->smart_obj, w, h);
+
+ /* we're done */
+ if (val == 1)
+ {
+ cw->shade.anim = NULL;
+
+ evas_object_smart_callback_call(cw->smart_obj, "shade_done", NULL);
+ if (cw->ec->shaded)
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,shaded", "e");
+ else
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,unshaded", "e");
+ edje_object_message_signal_process(cw->frame_object);
+ _e_comp_smart_cb_frame_recalc(cw, cw->smart_obj, NULL);
+ }
+ return cw->ec->shading;
+}
+
+static void
+_e_comp_smart_cb_shading(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ E_Comp_Object *cw = data;
+
+ if (!cw->ec) return; //NYI
+ E_FREE_FUNC(cw->shade.anim, ecore_timer_del);
+
+ cw->shade.x = cw->x;
+ cw->shade.y = cw->y;
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,shading", "e");
+ cw->shade.start = ecore_loop_time_get();
+ cw->shade.dir = (E_Direction)event_info;
+ cw->shade.anim = ecore_animator_add(_e_comp_object_shade_animator, cw);
+}
+
+static void
+_e_comp_smart_cb_shaded(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ E_Comp_Object *cw = data;
+
+ if (!cw->ec) return; //NYI
+ E_FREE_FUNC(cw->shade.anim, ecore_timer_del);
+
+ cw->shade.x = cw->x;
+ cw->shade.y = cw->y;
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,shaded", "e");
+ cw->shade.start = -100;
+ cw->shade.dir = (E_Direction)event_info;
+ _e_comp_object_shade_animator(cw);
+}
+
+static void
+_e_comp_smart_cb_unshading(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ E_Comp_Object *cw = data;
+
+ if (!cw->ec) return; //NYI
+ E_FREE_FUNC(cw->shade.anim, ecore_timer_del);
+
+ cw->shade.dir = (E_Direction)event_info;
+ if (cw->shade.dir == E_DIRECTION_UP ||
+ cw->shade.dir == E_DIRECTION_LEFT)
+ {
+ cw->shade.x = cw->x;
+ cw->shade.y = cw->y;
+ }
+ else
+ {
+ cw->shade.x = cw->x - cw->w;
+ cw->shade.y = cw->y - cw->h;
+ }
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,unshading", "e");
+ cw->shade.start = ecore_loop_time_get();
+ cw->shade.anim = ecore_animator_add(_e_comp_object_shade_animator, cw);
+}
+
+static void
+_e_comp_smart_cb_unshaded(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ E_Comp_Object *cw = data;
+
+ if (!cw->ec) return; //NYI
+ E_FREE_FUNC(cw->shade.anim, ecore_timer_del);
+
+ cw->shade.dir = (E_Direction)event_info;
+ if (cw->shade.dir == E_DIRECTION_UP ||
+ cw->shade.dir == E_DIRECTION_LEFT)
+ {
+ cw->shade.x = cw->x;
+ cw->shade.y = cw->y;
+ }
+ else
+ {
+ cw->shade.x = cw->x - cw->w;
+ cw->shade.y = cw->y - cw->h;
+ }
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,unshaded", "e");
+ cw->shade.start = -100;
+ _e_comp_object_shade_animator(cw);
+}
+
+static void
+_e_comp_smart_cb_maximize(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+
+ _e_comp_object_shadow_setup(cw);
+ if (cw->frame_object)
+ {
+ _e_comp_object_shadow(cw);
+ e_comp_object_signal_emit(cw->smart_obj, "e,action,maximize", "e");
+ _e_comp_object_frame_recalc(cw);
+ evas_object_smart_callback_call(cw->smart_obj, "frame_recalc_done", &cw->client_inset);
+ }
+}
+
+static void
+_e_comp_smart_cb_fullscreen(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+
+ if (_e_comp_object_shadow_setup(cw))
+ e_comp_object_damage(cw->smart_obj, 0, 0, cw->ec->w, cw->ec->h);
+ if (cw->frame_object)
+ {
+ _e_comp_object_shadow(cw);
+ e_comp_object_signal_emit(cw->smart_obj, "e,action,maximize,fullscreen", "e");
+ _e_comp_object_frame_recalc(cw);
+ evas_object_smart_callback_call(cw->smart_obj, "frame_recalc_done", &cw->client_inset);
+ }
+}
+
+static void
+_e_comp_smart_cb_unmaximize(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+
+ if (cw->frame_object)
+ {
+ _e_comp_object_shadow(cw);
+ e_comp_object_signal_emit(obj, "e,action,unmaximize", "e");
+ _e_comp_object_frame_recalc(cw);
+ evas_object_smart_callback_call(cw->smart_obj, "frame_recalc_done", &cw->client_inset);
+ }
+}
+
+static void
+_e_comp_smart_cb_unfullscreen(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+
+ if (_e_comp_object_shadow_setup(cw))
+ {
+ EC_CHANGED(cw->ec);
+ cw->ec->changes.size = 1;
+ }
+ if (cw->frame_object)
+ {
+ _e_comp_object_shadow(cw);
+ e_comp_object_signal_emit(obj, "e,action,maximize,unfullscreen", "e");
+ _e_comp_object_frame_recalc(cw);
+ evas_object_smart_callback_call(cw->smart_obj, "frame_recalc_done", &cw->client_inset);
+ }
+}
+
+static void
+_e_comp_smart_cb_unsticky(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ e_comp_object_signal_emit(obj, "e,state,unsticky", "e");
+}
+
+static void
+_e_comp_smart_cb_unhung(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+
+ if (!cw->ec) return; //NYI
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,unhung", "e");
+}
+
+static void
+_e_comp_smart_cb_hung(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+
+ if (!cw->ec) return; //NYI
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,hung", "e");
+}
+
+static void
+_e_comp_smart_focus_in(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ e_comp_object_signal_emit(obj, "e,state,focused", "e");
+}
+
+static void
+_e_comp_smart_focus_out(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ e_comp_object_signal_emit(obj, "e,state,unfocused", "e");
+}
+
+static void
+_e_comp_smart_add(Evas_Object *obj)
+{
+ E_Comp_Object *cw;
+
+ cw = E_NEW(E_Comp_Object, 1);
+ cw->smart_obj = obj;
+ cw->x = cw->y = cw->w = cw->h = -1;
+ evas_object_smart_data_set(obj, cw);
+ cw->opacity = 255.0;
+ evas_object_data_set(obj, "comp_obj", cw);
+ evas_object_move(obj, -1, -1);
+ evas_object_intercept_stack_above_callback_add(obj, _e_comp_intercept_stack_above, cw);
+ evas_object_intercept_stack_below_callback_add(obj, _e_comp_intercept_stack_below, cw);
+ evas_object_intercept_raise_callback_add(obj, _e_comp_intercept_raise, cw);
+ evas_object_intercept_lower_callback_add(obj, _e_comp_intercept_lower, cw);
+ evas_object_intercept_layer_set_callback_add(obj, _e_comp_intercept_layer_set, cw);
+ evas_object_intercept_move_callback_add(obj, _e_comp_intercept_move, cw);
+ evas_object_intercept_resize_callback_add(obj, _e_comp_intercept_resize, cw);
+ evas_object_intercept_show_callback_add(obj, _e_comp_intercept_show, cw);
+ evas_object_intercept_hide_callback_add(obj, _e_comp_intercept_hide, cw);
+ evas_object_intercept_focus_set_callback_add(obj, _e_comp_intercept_focus, cw);
+
+ evas_object_smart_callback_add(obj, "shading", _e_comp_smart_cb_shading, cw);
+ evas_object_smart_callback_add(obj, "shaded", _e_comp_smart_cb_shaded, cw);
+ evas_object_smart_callback_add(obj, "unshading", _e_comp_smart_cb_unshading, cw);
+ evas_object_smart_callback_add(obj, "unshaded", _e_comp_smart_cb_unshaded, cw);
+
+ evas_object_smart_callback_add(obj, "maximize", _e_comp_smart_cb_maximize, cw);
+ evas_object_smart_callback_add(obj, "fullscreen", _e_comp_smart_cb_fullscreen, cw);
+ evas_object_smart_callback_add(obj, "unmaximize", _e_comp_smart_cb_unmaximize, cw);
+ evas_object_smart_callback_add(obj, "unfullscreen", _e_comp_smart_cb_unfullscreen, cw);
+
+ evas_object_smart_callback_add(obj, "unsticky", _e_comp_smart_cb_unsticky, cw);
+
+ evas_object_smart_callback_add(obj, "hung", _e_comp_smart_cb_hung, cw);
+ evas_object_smart_callback_add(obj, "unhung", _e_comp_smart_cb_unhung, cw);
+
+ evas_object_smart_callback_add(obj, "frame_recalc", _e_comp_smart_cb_frame_recalc, cw);
+
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _e_comp_smart_focus_in, cw);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _e_comp_smart_focus_out, cw);
+}
+
+static void
+_e_comp_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
+{
+ INTERNAL_ENTRY;
+ evas_object_color_set(cw->clip, r, g, b, a);
+ evas_object_smart_callback_call(obj, "color_set", NULL);
+}
+
+
+static void
+_e_comp_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
+{
+ INTERNAL_ENTRY;
+ evas_object_clip_set(cw->clip, clip);
+}
+
+static void
+_e_comp_smart_clip_unset(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ evas_object_clip_unset(cw->clip);
+}
+
+static void
+_e_comp_smart_hide(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ cw->visible = 0;
+ evas_object_hide(cw->clip);
+ if (cw->input_obj) evas_object_hide(cw->input_obj);
+ evas_object_hide(cw->effect_obj);
+ if (cw->ec->focused)
+ evas_object_focus_set(cw->ec->frame, 0);
+ e_comp_render_queue(cw->comp); //force nocomp recheck
+ e_comp_shape_queue(cw->comp);
+}
+
+static void
+_e_comp_smart_show(Evas_Object *obj)
+{
+ E_Client *tmp;
+ Eina_List *l;
+
+ INTERNAL_ENTRY;
+ cw->defer_hide = 0;
+ cw->visible = 1;
+ if ((cw->w < 0) || (cw->h < 0))
+ CRI("ACK!");
+
+ //INF("SMART SHOW: %p EC(%dx%d) CW(%dx%d)", cw->ec, cw->ec->w, cw->ec->h, cw->w, cw->h);
+
+ EINA_LIST_FOREACH(cw->ec->e.state.video_child, l, tmp)
+ evas_object_show(tmp->frame);
+
+ evas_object_show(cw->clip);
+ if (cw->input_obj) evas_object_show(cw->input_obj);
+ evas_object_show(cw->effect_obj);
+ e_comp_shape_queue(cw->comp);
+ if (cw->ec->input_only) return;
+ if (cw->ec->iconic)
+ e_comp_object_signal_emit(cw->smart_obj, "e,action,uniconify", "e");
+ else
+ e_comp_object_signal_emit(cw->smart_obj, "e,state,visible", "e");
+ if (!cw->animating)
+ cw->comp->animating++;
+ cw->animating = 1;
+ e_object_ref(E_OBJECT(cw->ec));
+}
+
+static void
+_e_comp_object_cb_mirror_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ E_Comp_Object *cw = data;
+
+ cw->obj_mirror = eina_list_remove(cw->obj_mirror, obj);
+}
+
+static void
+_e_comp_smart_del(Evas_Object *obj)
+{
+ Eina_List *l;
+
+ INTERNAL_ENTRY;
+
+ if (cw->animating)
+ {
+ cw->comp->animating--;
+ }
+ cw->animating = 0;
+ E_FREE_FUNC(cw->updates, eina_tiler_free);
+ E_FREE_FUNC(cw->pending_updates, eina_tiler_free);
+ DBG(" [%p] del", cw->ec);
+ e_comp_object_render_update_del(cw->smart_obj);
+
+ if (cw->obj_mirror)
+ {
+ Evas_Object *o;
+
+ EINA_LIST_FREE(cw->obj_mirror, o)
+ {
+ evas_object_image_data_set(o, NULL);
+ evas_object_freeze_events_set(o, 1);
+ evas_object_event_callback_del_full(o, EVAS_CALLBACK_DEL, _e_comp_object_cb_mirror_del, cw);
+ evas_object_del(o);
+ }
+ }
+ _e_comp_object_layers_remove(cw);
+ l = evas_object_data_get(obj, "comp_object-to_del");
+ E_FREE_LIST(l, evas_object_del);
+ evas_object_del(cw->clip);
+ evas_object_del(cw->effect_obj);
+ evas_object_del(cw->shobj);
+ evas_object_del(cw->frame_icon);
+ evas_object_del(cw->frame_object);
+ evas_object_del(cw->zoomobj);
+ evas_object_del(cw->input_obj);
+ evas_object_del(cw->obj);
+ e_comp_shape_queue(cw->comp);
+ eina_stringshare_del(cw->frame_theme);
+ eina_stringshare_del(cw->frame_name);
+ free(cw);
+}
+
+static void
+_e_comp_smart_move(Evas_Object *obj, int x, int y)
+{
+ INTERNAL_ENTRY;
+
+ cw->x = x, cw->y = y;
+ evas_object_move(cw->clip, 0, 0);
+ evas_object_move(cw->effect_obj, x, y);
+ if (cw->input_obj)
+ evas_object_geometry_set(cw->input_obj, cw->x + cw->input_rect.x, cw->y + cw->input_rect.y, cw->input_rect.w, cw->input_rect.h);
+ /* this gets called once during setup to init coords offscreen and guarantee first move */
+ if (cw->comp)
+ e_comp_shape_queue(cw->comp);
+}
+
+static void
+_e_comp_smart_resize(Evas_Object *obj, int w, int h)
+{
+ INTERNAL_ENTRY;
+
+ //INF("RSZ");
+ if (!cw->effect_obj) CRI("ACK!");
+ cw->w = w, cw->h = h;
+ evas_object_resize(cw->clip, cw->comp->man->w, cw->comp->man->h);
+ if ((!cw->ec->shading) && (!cw->ec->shaded))
+ {
+ int ww, hh, pw, ph;
+ e_comp_object_frame_wh_unadjust(obj, w, h, &ww, &hh);
+ if (e_pixmap_size_get(cw->ec->pixmap, &pw, &ph) && (!cw->ec->override))
+ {
+ //INF("CW RSZ: %dx%d PIX(%dx%d)", w, h, pw, ph);
+ //if (cw->obj)
+ //{
+ //edje_extern_object_max_size_set(cw->obj, pw, ph);
+ //edje_extern_object_min_size_set(cw->obj, pw, ph);
+ //}
+ if ((ww != pw) || (hh != ph))
+ CRI("CW RSZ: %dx%d || PX: %dx%d", ww, hh, pw, ph);
+ }
+ evas_object_resize(cw->effect_obj, w, h);
+ if (cw->zoomobj) e_zoomap_child_resize(cw->zoomobj, cw->ec->client.w, cw->ec->client.h);
+ if (cw->input_obj)
+ evas_object_geometry_set(cw->input_obj, cw->x + cw->input_rect.x, cw->y + cw->input_rect.y, cw->input_rect.w, cw->input_rect.h);
+ cw->updates_full = 0;
+ e_comp_object_damage(obj, 0, 0, cw->w, cw->h);
+
+ }
+ else
+ {
+ e_comp_object_frame_wh_adjust(obj, cw->ec->client.w, cw->ec->client.h, &w, &h);
+ evas_object_resize(cw->effect_obj, w, h);
+ if (cw->zoomobj) e_zoomap_child_resize(cw->zoomobj, cw->ec->client.w, cw->ec->client.h);
+ }
+ e_comp_shape_queue(cw->comp);
+}
+
+static void
+_e_comp_smart_init(void)
+{
+ if (_e_comp_smart) return;
+ {
+ static const Evas_Smart_Class sc =
+ {
+ SMART_NAME,
+ EVAS_SMART_CLASS_VERSION,
+ _e_comp_smart_add,
+ _e_comp_smart_del,
+ _e_comp_smart_move,
+ _e_comp_smart_resize,
+ _e_comp_smart_show,
+ _e_comp_smart_hide,
+ _e_comp_smart_color_set,
+ _e_comp_smart_clip_set,
+ _e_comp_smart_clip_unset,
+ NULL,
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+ _e_comp_smart = evas_smart_class_new(&sc);
+ }
+}
+
+EAPI void
+e_comp_object_zoomap_set(Evas_Object *obj, Eina_Bool enabled)
+{
+ API_ENTRY;
+
+ enabled = !enabled;
+ if (cw->zoomap_disabled == enabled) return;
+ if (enabled)
+ {
+ cw->zoomobj = e_zoomap_add(cw->comp->evas);
+ e_zoomap_smooth_set(cw->zoomobj, e_comp_config_get()->smooth_windows);
+ e_zoomap_child_set(cw->zoomobj, cw->ec ? cw->frame_object : cw->obj);
+ edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->zoomobj);
+ e_zoomap_child_edje_solid_setup(cw->zoomobj);
+ if (cw->ec->override)
+ evas_object_name_set(cw->zoomobj, "cw->zoomobj::WINDOW");
+ else if (!cw->ec->input_only)
+ evas_object_name_set(cw->zoomobj, "cw->zoomobj::CLIENT");
+ }
+ else
+ {
+ edje_object_part_unswallow(cw->shobj, cw->zoomobj);
+ E_FREE_FUNC(cw->zoomobj, evas_object_del);
+ edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->ec ? cw->frame_object : cw->obj);
+ }
+ cw->zoomap_disabled = enabled;
+}
+
+/////////////////////////////////////////////////////////
+
+static void
+_e_comp_object_util_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Eina_List *l;
+ Eina_Bool comp_object;
+
+ comp_object = !!evas_object_data_get(obj, "comp_object");
+ if (comp_object)
+ {
+ Evas_Object *o;
+
+ o = edje_object_part_swallow_get(obj, "e.swallow.content");
+ evas_object_del(o);
+ e_comp_shape_queue(e_comp_util_evas_object_comp_get(obj));
+ }
+ l = evas_object_data_get(obj, "comp_object-to_del");
+ E_FREE_LIST(l, evas_object_del);
+}
+
+static void
+_e_comp_object_util_show(void *data EINA_UNUSED, Evas_Object *obj)
+{
+ Eina_Bool ref = EINA_TRUE;
+ if (evas_object_visible_get(obj))
+ {
+ void *d;
+
+ d = evas_object_data_del(obj, "comp_hiding");
+ if (d)
+ /* currently trying to hide */
+ ref = EINA_FALSE;
+ else
+ /* already visible */
+ return;
+ }
+ else
+ e_comp_shape_queue(e_comp_util_evas_object_comp_get(obj));
+
+ evas_object_show(obj);
+ if (ref) evas_object_ref(obj);
+ edje_object_signal_emit(obj, "e,state,visible", "e");
+ evas_object_data_set(obj, "comp_showing", (void*)1);
+}
+
+static void
+_e_comp_object_util_hide(void *data EINA_UNUSED, Evas_Object *obj)
+{
+ if (!evas_object_visible_get(obj)) return;
+ /* already hiding */
+ if (evas_object_data_get(obj, "comp_hiding")) return;
+ evas_object_data_del(obj, "comp_showing");
+ edje_object_signal_emit(obj, "e,state,hidden", "e");
+ evas_object_data_set(obj, "comp_hiding", (void*)1);
+}
+
+static void
+_e_comp_object_util_done_defer(void *data, Evas_Object *obj, const char *emission, const char *source EINA_UNUSED)
+{
+ if (!e_util_strcmp(emission, "e,action,hide,done"))
+ {
+ evas_object_data_del(obj, "comp_hiding");
+ evas_object_intercept_hide_callback_del(obj, _e_comp_object_util_hide);
+ evas_object_hide(obj);
+ e_comp_shape_queue(e_comp_util_evas_object_comp_get(obj));
+ evas_object_intercept_hide_callback_add(obj, _e_comp_object_util_hide, data);
+ evas_object_unref(obj);
+ }
+ else
+ evas_object_data_del(obj, "comp_showing");
+}
+
+static void
+_e_comp_object_util_moveresize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ if (data)
+ {
+ int w, h;
+
+ evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+ e_zoomap_child_resize(data, w, h);
+ }
+
+ if (evas_object_visible_get(obj))
+ e_comp_shape_queue(e_comp_util_evas_object_comp_get(obj));
+}
+
+EAPI Evas_Object *
+e_comp_object_util_add(Evas_Object *obj, E_Comp_Object_Type type)
+{
+ Evas_Object *o, *z = NULL;
+ E_Comp *c;
+ const char *name;
+ Eina_List *l, *list = NULL;
+ E_Comp_Config *conf = e_comp_config_get();
+ Eina_Bool skip = EINA_FALSE, fast = EINA_FALSE, shadow = EINA_FALSE;
+ E_Comp_Match *m;
+ char buf[1024];
+ int ok = 0;
+ int x, y, w, h;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
+
+ switch (type)
+ {
+ case E_COMP_OBJECT_TYPE_MENU:
+ list = conf->match.menus;
+ skip = conf->match.disable_menus;
+ fast = conf->fast_menus;
+ shadow = EINA_TRUE;
+ break;
+ case E_COMP_OBJECT_TYPE_POPUP:
+ list = conf->match.popups;
+ skip = conf->match.disable_popups;
+ fast = conf->fast_popups;
+ shadow = EINA_TRUE;
+ break;
+ default:
+ skip = EINA_TRUE;
+ }
+ name = evas_object_name_get(obj);
+ c = e_comp_util_evas_object_comp_get(obj);
+ o = edje_object_add(c->evas);
+ evas_object_data_set(o, "comp_object", (void*)1);
+ if (name && (!skip))
+ skip = (!strncmp(name, "noshadow", 8));
+ if (skip)
+ evas_object_data_set(o, "comp_object_skip", (void*)1);
+ else
+ {
+ EINA_LIST_FOREACH(list, l, m)
+ {
+ if (((m->name) && (!name)) ||
+ ((name) && (m->name) && (!e_util_glob_match(name, m->name))))
+ continue;
+ if (!m->shadow_style) continue;
+ if (fast)
+ {
+ snprintf(buf, sizeof(buf), "e/comp/frame/%s/fast", m->shadow_style);
+ ok = e_theme_edje_object_set(o, "base/theme/comp", buf);
+ }
+ if (!ok)
+ {
+ snprintf(buf, sizeof(buf), "e/comp/frame/%s", m->shadow_style);
+ ok = e_theme_edje_object_set(o, "base/theme/comp", buf);
+ }
+ if (ok)
+ {
+ shadow = !m->no_shadow;
+ break;
+ }
+ }
+ }
+ while (!ok)
+ {
+ if (skip)
+ ok = e_theme_edje_object_set(o, "base/theme/comp", "e/comp/frame/none");
+ if (ok) break;
+ if (conf->shadow_style)
+ {
+ if (fast)
+ {
+ snprintf(buf, sizeof(buf), "e/comp/frame/%s/fast", conf->shadow_style);
+ ok = e_theme_edje_object_set(o, "base/theme/comp", buf);
+ }
+ if (!ok)
+ {
+ snprintf(buf, sizeof(buf), "e/comp/frame/%s", conf->shadow_style);
+ ok = e_theme_edje_object_set(o, "base/theme/comp", buf);
+ }
+ if (ok) break;
+ }
+ if (fast)
+ ok = e_theme_edje_object_set(o, "base/theme/comp", "e/comp/frame/default/fast");
+ if (!ok)
+ ok = e_theme_edje_object_set(o, "base/theme/comp", "e/comp/frame/default");
+ break;
+ }
+ if (shadow)
+ e_comp_object_signal_emit(o, "e,state,shadow,on", "e");
+ else
+ e_comp_object_signal_emit(o, "e,state,shadow,off", "e");
+
+ if (evas_object_visible_get(obj))
+ {
+ evas_object_show(o);
+ e_comp_object_signal_emit(o, "e,state,visible", "e");
+ evas_object_ref(o);
+ }
+ else
+ e_comp_object_signal_emit(o, "e,state,hidden", "e");
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ evas_object_geometry_set(o, x, y, w, h);
+ evas_object_pass_events_set(o, evas_object_pass_events_get(obj));
+
+ if (list)
+ {
+ z = e_zoomap_add(c->evas);
+ e_zoomap_child_edje_solid_setup(z);
+ e_zoomap_smooth_set(z, conf->smooth_windows);
+ e_zoomap_child_set(z, obj);
+ e_zoomap_child_resize(z, w, h);
+ evas_object_show(z);
+ }
+ edje_object_signal_callback_add(o, "e,action,*,done", "e", _e_comp_object_util_done_defer, z);
+
+ evas_object_intercept_show_callback_add(o, _e_comp_object_util_show, z);
+ evas_object_intercept_hide_callback_add(o, _e_comp_object_util_hide, z);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _e_comp_object_util_moveresize, z);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _e_comp_object_util_del, z);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _e_comp_object_util_moveresize, z);
+
+ edje_object_part_swallow(o, "e.swallow.content", z ?: obj);
+
+ _e_comp_object_event_add(o);
+
+ return o;
+}
+
+EAPI void
+e_comp_object_util_del_list_append(Evas_Object *obj, Evas_Object *to_del)
+{
+ Eina_List *l;
+
+ SOFT_ENTRY();
+ EINA_SAFETY_ON_NULL_RETURN(to_del);
+ l = evas_object_data_get(obj, "comp_object-to_del");
+ evas_object_data_set(obj, "comp_object-to_del", eina_list_append(l, to_del));
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, _e_comp_object_util_del);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _e_comp_object_util_del, NULL);
+}
+
+EAPI void
+e_comp_object_util_del_list_remove(Evas_Object *obj, Evas_Object *to_del)
+{
+ Eina_List *l;
+
+ SOFT_ENTRY();
+ EINA_SAFETY_ON_NULL_RETURN(to_del);
+ l = evas_object_data_get(obj, "comp_object-to_del");
+ if (l)
+ evas_object_data_set(obj, "comp_object-to_del", eina_list_remove(l, to_del));
+}
+
+/////////////////////////////////////////////////////////
+
+EAPI Evas_Object *
+e_comp_object_client_add(E_Client *ec)
+{
+ Evas_Object *o;
+ E_Comp_Object *cw;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
+ if (ec->frame) return NULL;
+ _e_comp_smart_init();
+ o = evas_object_smart_add(ec->comp->evas, _e_comp_smart);
+ cw = evas_object_smart_data_get(o);
+ cw->comp = ec->comp;
+ evas_object_data_set(o, "E_Client", ec);
+ cw->ec = ec;
+ ec->frame = o;
+ evas_object_data_set(o, "comp_object", (void*)1);
+
+ _e_comp_object_event_add(o);
+
+ return o;
+}
+
+EAPI void
+e_comp_object_frame_xy_adjust(Evas_Object *obj, int x, int y, int *ax, int *ay)
+{
+ API_ENTRY;
+ if (!cw->client_inset.calc)
+ {
+ if (ax) *ax = x;
+ if (ay) *ay = y;
+ return;
+ }
+ if (ax) *ax = x - cw->client_inset.l;
+ if (ay) *ay = y - cw->client_inset.t;
+}
+
+EAPI void
+e_comp_object_frame_xy_unadjust(Evas_Object *obj, int x, int y, int *ax, int *ay)
+{
+ API_ENTRY;
+ if (!cw->client_inset.calc)
+ {
+ if (ax) *ax = x;
+ if (ay) *ay = y;
+ return;
+ }
+ if (ax) *ax = x + cw->client_inset.l;
+ if (ay) *ay = y + cw->client_inset.t;
+}
+
+EAPI void
+e_comp_object_frame_wh_adjust(Evas_Object *obj, int w, int h, int *aw, int *ah)
+{
+ API_ENTRY;
+ if (!cw->client_inset.calc)
+ {
+ if (aw) *aw = w;
+ if (ah) *ah = h;
+ return;
+ }
+ if (aw) *aw = w + cw->client_inset.l + cw->client_inset.r;
+ if (ah) *ah = h + cw->client_inset.t + cw->client_inset.b;
+}
+
+EAPI void
+e_comp_object_frame_wh_unadjust(Evas_Object *obj, int w, int h, int *aw, int *ah)
+{
+ API_ENTRY;
+ if (!cw->client_inset.calc)
+ {
+ if (aw) *aw = w;
+ if (ah) *ah = h;
+ return;
+ }
+ if (aw) *aw = w - cw->client_inset.l - cw->client_inset.r;
+ if (ah) *ah = h - cw->client_inset.t - cw->client_inset.b;
+}
+
+EAPI E_Client *
+e_comp_object_client_get(Evas_Object *obj)
+{
+ SOFT_ENTRY(NULL);
+ return cw ? cw->ec : NULL;
+}
+
+EAPI E_Zone *
+e_comp_object_util_zone_get(Evas_Object *obj)
+{
+ E_Zone *zone;
+
+ SOFT_ENTRY(NULL);
+ if (cw)
+ zone = cw->ec->zone;
+ else
+ {
+ int x, y;
+ E_Comp *c;
+
+ c = e_comp_util_evas_object_comp_get(obj);
+ if (c)
+ {
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ zone = e_comp_zone_xy_get(c, x, y);
+ }
+ else
+ {
+ Ecore_Evas *ee;
+
+ ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
+ if (ee)
+ {
+ E_Win *win;
+
+ win = ecore_evas_data_get(ee, "E_Win");
+ if (win)
+ {
+ if (win->client)
+ zone = win->client->zone;
+ else
+ zone = e_comp_zone_xy_get(NULL, win->x, win->y);
+ }
+ else
+ {
+ ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
+ zone = e_comp_zone_xy_get(NULL, x, y);
+ }
+ }
+ else
+ {
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ zone = e_comp_zone_xy_get(NULL, x, y);
+ }
+ }
+ }
+ return zone;
+}
+
+EAPI void
+e_comp_object_util_center(Evas_Object *obj)
+{
+ int x, y, w, h, ow, oh;
+ E_Zone *zone;
+
+ SOFT_ENTRY();
+
+ zone = e_comp_object_util_zone_get(obj);
+ EINA_SAFETY_ON_NULL_RETURN(zone);
+ e_zone_useful_geometry_get(zone, &x, &y, &w, &h);
+ if (cw && cw->ec->changes.size)
+ ow = cw->ec->w, oh = cw->ec->h;
+ else
+ evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
+ x = x + (w - ow) / 2;
+ y = y + (h - oh) / 2;
+ evas_object_move(obj, x, y);
+}
+
+EAPI void
+e_comp_object_util_center_on(Evas_Object *obj, Evas_Object *on)
+{
+ int x, y, w, h, ow, oh;
+
+ SOFT_ENTRY();
+ EINA_SAFETY_ON_NULL_RETURN(on);
+ evas_object_geometry_get(on, &x, &y, &w, &h);
+ if (cw && cw->ec->changes.size)
+ ow = cw->ec->w, oh = cw->ec->h;
+ else
+ evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
+ evas_object_move(obj, x + (w / 2) - (ow / 2), y + (h / 2) - (oh / 2));
+}
+
+EAPI void
+e_comp_object_util_fullscreen(Evas_Object *obj)
+{
+ SOFT_ENTRY();
+
+ if (cw)
+ e_client_fullscreen(cw->ec, E_FULLSCREEN_RESIZE);
+ else
+ {
+ E_Comp *c = e_comp_util_evas_object_comp_get(obj);
+
+ EINA_SAFETY_ON_NULL_RETURN(c);
+ evas_object_move(obj, 0, 0);
+ evas_object_resize(obj, c->man->w, c->man->h);
+ }
+}
+
+EAPI void
+e_comp_object_util_center_pos_get(Evas_Object *obj, int *x, int *y)
+{
+ E_Zone *zone;
+ int zx, zy, zw, zh;
+ SOFT_ENTRY();
+
+ zone = e_comp_object_util_zone_get(obj);
+ e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
+ if (x) *x = zx + (zw - cw->w) / 2;
+ if (y) *y = zy + (zh - cw->h) / 2;
+}
+
+EAPI void
+e_comp_object_input_area_set(Evas_Object *obj, int x, int y, int w, int h)
+{
+ API_ENTRY;
+
+ //INF("%d,%d %dx%d", x, y, w, h);
+ E_RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, cw->ec->w, cw->ec->h);
+ if ((cw->input_rect.x == x) && (cw->input_rect.y == y) &&
+ (cw->input_rect.w == w) && (cw->input_rect.h == h)) return;
+ EINA_RECTANGLE_SET(&cw->input_rect, x, y, w, h);
+ if (x || y || (w != cw->w) || (h != cw->h))
+ {
+ if (!cw->input_obj)
+ {
+ cw->input_obj = evas_object_rectangle_add(cw->comp->evas);
+ //e_util_size_debug_set(cw->input_obj, 1);
+ evas_object_name_set(cw->input_obj, "cw->input_obj");
+ evas_object_color_set(cw->input_obj, 0, 0, 0, 0);
+ evas_object_pass_events_set(cw->obj, 1);
+ evas_object_clip_set(cw->input_obj, cw->clip);
+ evas_object_smart_member_add(cw->input_obj, obj);
+ }
+ evas_object_geometry_set(cw->input_obj, MAX(cw->x, 0) + x, MAX(cw->y, 0) + y, w, h);
+ evas_object_layer_set(cw->input_obj, 9999);
+ if (cw->visible) evas_object_show(cw->input_obj);
+ }
+ else
+ {
+ evas_object_smart_member_del(cw->input_obj);
+ E_FREE_FUNC(cw->input_obj, evas_object_del);
+ evas_object_pass_events_set(cw->obj, 0);
+ }
+}
+
+EAPI void
+e_comp_object_frame_geometry_get(Evas_Object *obj, int *l, int *r, int *t, int *b)
+{
+ API_ENTRY;
+ if (l) *l = cw->client_inset.l;
+ if (r) *r = cw->client_inset.r;
+ if (t) *t = cw->client_inset.t;
+ if (b) *b = cw->client_inset.b;
+}
+
+EAPI Eina_Bool
+e_comp_object_frame_title_set(Evas_Object *obj, const char *name)
+{
+ API_ENTRY EINA_FALSE;
+ if (!e_util_strcmp(cw->frame_name, name)) return EINA_FALSE;
+ eina_stringshare_replace(&cw->frame_name, name);
+ if (cw->frame_object)
+ edje_object_part_text_set(cw->frame_object, "e.text.title", cw->frame_name);
+ return EINA_TRUE;
+}
+
+EAPI Eina_Bool
+e_comp_object_frame_exists(Evas_Object *obj)
+{
+ API_ENTRY EINA_FALSE;
+ return !!cw->frame_object;
+}
+
+EAPI void
+e_comp_object_frame_icon_update(Evas_Object *obj)
+{
+ API_ENTRY;
+
+ evas_object_del(cw->frame_icon);
+ cw->frame_icon = e_client_icon_add(cw->ec, cw->comp->evas);
+ if (!cw->frame_icon) return;
+ edje_object_part_swallow(cw->frame_object, "e.swallow.icon", cw->frame_icon);
+}
+
+EAPI Eina_Bool
+e_comp_object_frame_theme_set(Evas_Object *obj, const char *name)
+{
+ Evas_Object *o, *pbg;
+ char buf[4096];
+ int ok;
+ Eina_Stringshare *theme;
+
+ API_ENTRY EINA_FALSE;
+
+ if (!e_util_strcmp(cw->frame_theme, name))
+ return edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->frame_object ?: cw->obj);
+ if (!e_util_strcmp(name, "COMP_RESHADOW"))
+ return _e_comp_object_shadow_setup(cw);
+ pbg = cw->frame_object;
+ theme = eina_stringshare_add(name);
+
+ if (cw->frame_object)
+ {
+ int w, h;
+
+ w = cw->w, h = cw->h;
+ e_comp_object_frame_wh_unadjust(cw->frame_object, w, h, &cw->w, &cw->h);
+ if (cw->ec && ((cw->w != w) || (cw->h != h)))
+ {
+ cw->ec->changes.size = 1;
+ EC_CHANGED(cw->ec);
+ }
+ E_FREE_FUNC(cw->frame_object, evas_object_del);
+ if (!name) goto reshadow;
+ }
+ o = edje_object_add(cw->comp->evas);
+ snprintf(buf, sizeof(buf), "e/widgets/border/%s/border", name);
+ ok = e_theme_edje_object_set(o, "base/theme/border", buf);
+ if ((!ok) && (!e_util_strcmp(name, "borderless")))
+ {
+ cw->frame_object = NULL;
+ E_FREE_FUNC(cw->frame_icon, evas_object_del);
+ evas_object_del(o);
+ eina_stringshare_del(cw->frame_theme);
+ cw->frame_theme = theme;
+ goto reshadow;
+ }
+ if (!ok)
+ {
+ if (theme != e_config->theme_default_border_style)
+ {
+ snprintf(buf, sizeof(buf), "e/widgets/border/%s/border", e_config->theme_default_border_style);
+ ok = e_theme_edje_object_set(o, "base/theme/border", buf);
+ }
+ if (!ok)
+ {
+ ok = e_theme_edje_object_set(o, "base/theme/border",
+ "e/widgets/border/default/border");
+ if (ok && (theme == e_config->theme_default_border_style))
+ {
+ /* Reset default border style to default */
+ eina_stringshare_replace(&e_config->theme_default_border_style, "default");
+ e_config_save_queue();
+ }
+ }
+ }
+
+ if (ok)
+ {
+ cw->frame_object = o;
+ eina_stringshare_del(cw->frame_theme);
+ cw->frame_theme = theme;
+ evas_object_name_set(o, "cw->frame_object");
+
+ if (cw->frame_name)
+ edje_object_part_text_set(o, "e.text.title", cw->frame_name);
+
+ _e_comp_object_shadow(cw);
+
+ if (pbg)
+ {
+ if (cw->frame_icon)
+ edje_object_part_swallow(cw->frame_object, "e.swallow.icon", cw->frame_icon);
+ }
+ else if (cw->ec)
+ {
+ cw->ec->changes.icon = 1;
+ EC_CHANGED(cw->ec);
+ }
+ }
+ else
+ {
+ CRI("USER IS USING A SHITTY THEME! ABORT!!!!");
+ evas_object_del(o);
+ E_FREE_FUNC(cw->frame_icon, evas_object_del);
+ }
+reshadow:
+ if (cw->shobj)
+ _e_comp_object_shadow_setup(cw);
+ do
+ {
+ _e_comp_smart_cb_frame_recalc(cw, cw->smart_obj, NULL);
+ /* this guarantees that we won't get blocked by the NOP check in the interceptor */
+ cw->y = cw->x = -99999;
+ if (pbg)
+ evas_object_move(obj, cw->ec->x, cw->ec->y);
+ else if (cw->ec->placed || (!cw->ec->new_client))
+ {
+ /* if no previous frame:
+ * - reapply client_inset
+ * - clamp to zone
+ */
+ int x, y;
+
+ if (cw->ec->placed && cw->ec->new_client)
+ {
+ x = cw->ec->x;
+ y = cw->ec->y;
+ }
+ else
+ {
+ x = cw->ec->client.x, y = cw->ec->client.y;
+ x = MAX(cw->ec->zone->x, cw->ec->client.x - cw->client_inset.l);
+ y = MAX(cw->ec->zone->y, cw->ec->client.y - cw->client_inset.t);
+ }
+ evas_object_move(obj, x, y);
+ }
+ } while (0);
+
+ if (cw->ec && cw->ec->maximized)
+ {
+ cw->ec->changes.need_maximize = 1;
+ EC_CHANGED(cw->ec);
+ }
+ evas_object_smart_callback_call(cw->smart_obj, "frame_changed", NULL);
+ if (cw->frame_object)
+ edje_object_signal_callback_add(cw->frame_object, "*", "*",
+ _e_comp_object_cb_signal_bind, cw);
+ evas_object_del(pbg);
+ return EINA_TRUE;
+}
+
+EAPI void
+e_comp_object_signal_emit(Evas_Object *obj, const char *sig, const char *src)
+{
+ API_ENTRY;
+ //INF("EMIT %p: %s %s", cw->ec, sig, src);
+ edje_object_signal_emit(cw->shobj, sig, src);
+ if (cw->frame_object) edje_object_signal_emit(cw->frame_object, sig, src);
+ if (cw->frame_icon) edje_object_signal_emit(cw->frame_icon, sig, src);
+}
+
+EAPI void
+e_comp_object_signal_callback_add(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb, const void *data)
+{
+ /* FIXME: at some point I guess this should use eo to inherit
+ * -EDJE_OBJ_SUB_ID_SIGNAL_CALLBACK_ADD
+ * -EDJE_OBJ_SUB_ID_SIGNAL_CALLBACK_DEL
+ */
+ API_ENTRY;
+ edje_object_signal_callback_add(cw->shobj, sig, src, cb, (void*)data);
+}
+
+EAPI void
+e_comp_object_signal_callback_del(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb)
+{
+ API_ENTRY;
+ edje_object_signal_callback_del(cw->shobj, sig, src, cb);
+}
+
+EAPI void
+e_comp_object_signal_callback_del_full(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb, const void *data)
+{
+ API_ENTRY;
+ edje_object_signal_callback_del_full(cw->shobj, sig, src, cb, (void*)data);
+}
+
+EAPI void
+e_comp_object_damage(Evas_Object *obj, int x, int y, int w, int h)
+{
+ int tw, th;
+ API_ENTRY;
+
+ if (cw->ec->input_only || (!cw->updates)) return;
+ if (cw->nocomp) return;
+ if (cw->comp->nocomp)
+ {
+ cw->nocomp_need_update = EINA_TRUE;
+ return;
+ }
+ /* ignore overdraw */
+ if (cw->updates_full)
+ {
+ //INF("IGNORED %p: %d,%d %dx%d", cw->ec, x, y, w, h);
+ e_comp_object_render_update_add(obj);
+ return;
+ }
+ /* clip rect to client surface */
+ //INF("DAMAGE(%d,%d %dx%d) CLIP(%dx%d)", x, y, w, h, cw->ec->client.w, cw->ec->client.h);
+ E_RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, cw->ec->client.w, cw->ec->client.h);
+ /* if rect is the total size of the client after clip, clear the updates
+ * since this is guaranteed to be the whole region anyway
+ */
+ eina_tiler_area_size_get(cw->updates, &tw, &th);
+ if ((w > tw) || (h > th))
+ {
+ //INF("DAMAGE RESIZE %p: %dx%d", cw->ec, cw->ec->client.w, cw->ec->client.h);
+ eina_tiler_clear(cw->updates);
+ eina_tiler_area_size_set(cw->updates, cw->ec->client.w, cw->ec->client.h);
+ x = 0, y = 0;
+ tw = cw->ec->client.w, th = cw->ec->client.h;
+ }
+ if ((!x) && (!y) && (w == tw) && (h == th))
+ {
+ eina_tiler_clear(cw->updates);
+ //INF("DAMAGE FULL: %p", cw->ec);
+ cw->updates_full = 1;
+ cw->update_count = 0;
+ }
+ cw->update_count++;
+ if (cw->update_count > UPDATE_MAX)
+ {
+ /* this is going to get really dumb, so just update the whole thing */
+ eina_tiler_clear(cw->updates);
+ cw->update_count = cw->updates_full = 1;
+ eina_tiler_rect_add(cw->updates, &(Eina_Rectangle){0, 0, tw, th});
+ //INF("DAMAGE MAX: %dx%d", tw, th);
+ }
+ else
+ {
+ eina_tiler_rect_add(cw->updates, &(Eina_Rectangle){x, y, w, h});
+ //INF("DAMAGE: %d,%d %dx%d", x, y, w, h);
+ }
+ cw->updates_exist = 1;
+ e_comp_object_render_update_add(obj);
+}
+
+EAPI void
+e_comp_object_render_update_add(Evas_Object *obj)
+{
+ API_ENTRY;
+
+ if (cw->ec->input_only || (!cw->updates) || (!cw->redirected)) return;
+ if (e_object_is_del(E_OBJECT(cw->ec)))
+ CRI("CAN'T RENDER A DELETED CLIENT!");
+ if (!e_pixmap_usable_get(cw->ec->pixmap)) return;
+ //if (e_client_resizing_get(cw->ec) && (e_pixmap_type_get(cw->ec->pixmap) == E_PIXMAP_TYPE_WL))
+ //INF("WL RENDER UPDATE");
+ if (!cw->update)
+ {
+ cw->update = 1;
+ cw->comp->updates = eina_list_append(cw->comp->updates, cw->ec);
+ }
+ e_comp_render_queue(cw->comp);
+}
+
+EAPI void
+e_comp_object_render_update_del(Evas_Object *obj)
+{
+ API_ENTRY;
+
+ if (cw->ec->input_only || (!cw->updates)) return;
+ if (!cw->update) return;
+ cw->update = 0;
+ /* this gets called during comp animating to clear the update flag */
+ if (cw->comp->grabbed) return;
+ cw->comp->updates = eina_list_remove(cw->comp->updates, cw->ec);
+ if (!cw->comp->updates)
+ {
+ E_FREE_FUNC(cw->comp->update_job, ecore_job_del);
+ if (cw->comp->render_animator)
+ ecore_animator_freeze(cw->comp->render_animator);
+ }
+}
+
+EAPI void
+e_comp_object_shape_apply(Evas_Object *obj)
+{
+ Eina_List *l;
+ Evas_Object *o;
+ unsigned int i, *pix, *p;
+ int w, h, px, py;
+
+ API_ENTRY;
+ if (!cw->ec) return; //NYI
+ _e_comp_object_shadow(cw);
+ if (!_e_comp_shaped_check(cw->ec->client.w, cw->ec->client.h, cw->ec->shape_rects, cw->ec->shape_rects_num))
+ {
+ if (!cw->ec->shaped) return;
+ }
+ if (cw->native)
+ {
+ ERR("BUGGER: shape with native surface? cw=%p", cw);
+ return;
+ }
+ evas_object_image_size_get(cw->obj, &w, &h);
+ if ((w < 1) || (h < 1)) return;
+
+ if (cw->ec->shape_rects) evas_object_image_native_surface_set(cw->obj, NULL);
+ evas_object_image_alpha_set(cw->obj, !!cw->ec->shape_rects);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ {
+ if (cw->ec->shape_rects) evas_object_image_native_surface_set(o, NULL);
+ evas_object_image_alpha_set(o, 1);
+ }
+
+ p = pix = evas_object_image_data_get(cw->obj, 1);
+ if (!pix)
+ {
+ evas_object_image_data_set(cw->obj, pix);
+ return;
+ }
+ if (cw->ec->shape_rects)
+ {
+ unsigned char *spix, *sp;
+
+ spix = calloc(w * h, sizeof(unsigned char));
+ DBG("SHAPE [%p] rects %i", cw->ec, cw->ec->shape_rects_num);
+ for (i = 0; i < cw->ec->shape_rects_num; i++)
+ {
+ int rx, ry, rw, rh;
+
+ rx = cw->ec->shape_rects[i].x; ry = cw->ec->shape_rects[i].y;
+ rw = cw->ec->shape_rects[i].w; rh = cw->ec->shape_rects[i].h;
+ E_RECTS_CLIP_TO_RECT(rx, ry, rw, rh, 0, 0, w, h);
+ sp = spix + (w * ry) + rx;
+ for (py = 0; py < rh; py++)
+ {
+ for (px = 0; px < rw; px++)
+ {
+ *sp = 0xff; sp++;
+ }
+ sp += w - rw;
+ }
+ }
+ sp = spix;
+ for (py = 0; py < h; py++)
+ {
+ for (px = 0; px < w; px++)
+ {
+ unsigned int mask, imask;
+
+ mask = ((unsigned int)(*sp)) << 24;
+ imask = mask >> 8;
+ imask |= imask >> 8;
+ imask |= imask >> 8;
+ *p = mask | (*p & imask);
+ //if (*sp) *p = 0xff000000 | *p;
+ //else *p = 0x00000000;
+ sp++;
+ p++;
+ }
+ }
+ free(spix);
+ }
+ else
+ {
+ for (py = 0; py < h; py++)
+ {
+ for (px = 0; px < w; px++)
+ *p |= 0xff000000;
+ }
+ }
+ evas_object_image_data_set(cw->obj, pix);
+ evas_object_image_data_update_add(cw->obj, 0, 0, w, h);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ {
+ evas_object_image_data_set(o, pix);
+ evas_object_image_data_update_add(o, 0, 0, w, h);
+ }
+// dont need to fix alpha chanel as blending
+// should be totally off here regardless of
+// alpha channel content
+}
+
+EAPI void
+e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set)
+{
+ API_ENTRY;
+
+ set = !!set;
+ if (cw->redirected == set) return;
+ cw->redirected = set;
+ if (set)
+ {
+ _e_comp_object_shadow_setup(cw);
+ if (cw->updates_exist)
+ e_comp_object_render_update_add(obj);
+ else
+ e_comp_object_damage(obj, 0, 0, cw->w, cw->h);
+ }
+ else
+ {
+ Eina_List *l;
+ Evas_Object *o;
+
+ if (cw->ec->pixmap)
+ e_pixmap_clear(cw->ec->pixmap);
+ if (cw->native)
+ evas_object_image_native_surface_set(cw->obj, NULL);
+ evas_object_image_size_set(cw->obj, 1, 1);
+ evas_object_image_data_set(cw->obj, NULL);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ {
+ evas_object_image_size_set(o, 1, 1);
+ evas_object_image_data_set(o, NULL);
+ if (cw->native)
+ evas_object_image_native_surface_set(o, NULL);
+ }
+ cw->native = 0;
+ e_comp_object_render_update_del(obj);
+ }
+}
+
+EAPI void
+e_comp_object_native_surface_set(Evas_Object *obj, Eina_Bool set)
+{
+ Evas_Native_Surface ns;
+ Eina_List *l;
+ Evas_Object *o;
+
+ API_ENTRY;
+ EINA_SAFETY_ON_NULL_RETURN(cw->ec);
+ if (cw->ec->input_only) return;
+ set = !!set;
+
+ if (set)
+ {
+ set = (cw->ec->comp->gl && e_comp_config_get()->texture_from_pixmap && (!cw->ec->shaped));
+ if (set)
+ set = e_pixmap_native_surface_init(cw->ec->pixmap, &ns);
+ }
+ cw->native = set;
+
+ evas_object_image_native_surface_set(cw->obj, set ? &ns : NULL);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ evas_object_image_native_surface_set(o, set ? &ns : NULL);
+}
+
+EAPI void
+e_comp_object_dirty(Evas_Object *obj)
+{
+ Eina_Iterator *it;
+ Eina_Rectangle *r;
+ Eina_List *l;
+ Evas_Object *o;
+ int w, h, ow, oh;
+ Eina_Bool dirty;
+
+ API_ENTRY;
+
+ evas_object_geometry_get(cw->obj, NULL, NULL, &ow, &oh);
+ if ((!ow) && (!oh)) return; //get it on the next resize
+ dirty = e_pixmap_size_get(cw->ec->pixmap, &w, &h);
+ if (!dirty) w = h = 1;
+ evas_object_image_pixels_dirty_set(cw->obj, dirty);
+ if (!dirty)
+ evas_object_image_data_set(cw->obj, NULL);
+ evas_object_image_size_set(cw->obj, w, h);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ {
+ evas_object_image_pixels_dirty_set(o, dirty);
+ if (!dirty)
+ evas_object_image_data_set(o, NULL);
+ evas_object_image_size_set(o, w, h);
+ }
+ if (!dirty)
+ {
+ ERR("ERROR FETCHING PIXMAP FOR %p", cw->ec);
+ return;
+ }
+ e_comp_object_native_surface_set(obj, 1);
+ it = eina_tiler_iterator_new(cw->updates);
+ EINA_ITERATOR_FOREACH(it, r)
+ {
+ //INF("UPDATE [%p]: %d %d %dx%d", cw->ec, r->x, r->y, r->w, r->h);
+ evas_object_image_data_update_add(cw->obj, r->x, r->y, r->w, r->h);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ evas_object_image_data_update_add(o, r->x, r->y, r->w, r->h);
+ if (cw->pending_updates)
+ eina_tiler_rect_add(cw->pending_updates, r);
+ }
+ eina_iterator_free(it);
+ if (cw->pending_updates)
+ eina_tiler_clear(cw->updates);
+ else
+ {
+ cw->pending_updates = cw->updates;
+ cw->updates = eina_tiler_new(w, h);
+ eina_tiler_tile_size_set(cw->updates, 1, 1);
+ }
+ cw->update_count = cw->updates_full = cw->updates_exist = 0;
+}
+
+EAPI Eina_Bool
+e_comp_object_render(Evas_Object *obj)
+{
+ Eina_Iterator *it;
+ Eina_Rectangle *r;
+ Eina_List *l;
+ Evas_Object *o;
+ int stride, pw, ph;
+ unsigned int *pix, *srcpix;
+ Eina_Bool ret = EINA_FALSE;
+
+ API_ENTRY EINA_FALSE;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cw->ec, EINA_FALSE);
+ if (cw->ec->input_only) return EINA_TRUE;
+ e_comp_object_render_update_del(obj);
+ if (!e_pixmap_size_get(cw->ec->pixmap, &pw, &ph)) return EINA_FALSE;
+ //if (e_pixmap_type_get(cw->ec->pixmap) == E_PIXMAP_TYPE_WL)
+ //INF("WL RENDER!");
+ {
+ int ow, oh;
+ evas_object_geometry_get(cw->obj, NULL, NULL, &ow, &oh);
+ if ((ow != pw) || (oh != ph))
+ {
+ /* this results in a black frame, but I think that's better than
+ * pixmap size mismatch renders...
+ */
+ e_comp_object_damage(cw->smart_obj, 0, 0, cw->w, cw->h);
+ evas_object_image_data_set(cw->obj, NULL);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ evas_object_image_data_set(o, NULL);
+ return EINA_FALSE;
+ //CRI("ACK");
+ }
+ }
+
+ if (!cw->pending_updates)
+ {
+ WRN("RENDER [%p]: NO RECTS!", cw->ec);
+ evas_object_image_data_set(cw->obj, NULL);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ evas_object_image_data_set(o, NULL);
+ return EINA_FALSE;
+ }
+
+ it = eina_tiler_iterator_new(cw->pending_updates);
+ if (e_pixmap_image_is_argb(cw->ec->pixmap))
+ {
+ pix = e_pixmap_image_data_get(cw->ec->pixmap);
+ EINA_ITERATOR_FOREACH(it, r)
+ {
+ E_RECTS_CLIP_TO_RECT(r->x, r->y, r->w, r->h, 0, 0, pw, ph);
+ ret = e_pixmap_image_draw(cw->ec->pixmap, r);
+ if (!ret)
+ {
+ WRN("UPDATE [%p]: %i %i %ix%i FAIL!!!!!!!!!!!!!!!!!", cw->ec, r->x, r->y, r->w, r->h);
+ e_comp_object_damage(obj, 0, 0, pw, ph);
+ break;
+ }
+ //INF("UPDATE [%p] %i %i %ix%i", cw->ec, r->x, r->y, r->w, r->h);
+ }
+ evas_object_image_data_set(cw->obj, pix);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ evas_object_image_data_set(o, pix);
+ eina_iterator_free(it);
+ E_FREE_FUNC(cw->pending_updates, eina_tiler_free);
+ return ret;
+ }
+
+ pix = evas_object_image_data_get(cw->obj, EINA_TRUE);
+ stride = evas_object_image_stride_get(cw->obj);
+ srcpix = e_pixmap_image_data_get(cw->ec->pixmap);
+ EINA_ITERATOR_FOREACH(it, r)
+ {
+ E_RECTS_CLIP_TO_RECT(r->x, r->y, r->w, r->h, 0, 0, pw, ph);
+ ret = e_pixmap_image_draw(cw->ec->pixmap, r);
+ if (!ret)
+ {
+ WRN("UPDATE [%p]: %i %i %ix%i FAIL!!!!!!!!!!!!!!!!!", cw->ec, r->x, r->y, r->w, r->h);
+ e_comp_object_damage(obj, 0, 0, pw, ph);
+ break;
+ }
+ e_pixmap_image_data_argb_convert(cw->ec->pixmap, pix, srcpix, r, stride);
+ //INF("UPDATE [%p]: %d %d %dx%d -- pix = %p", cw->ec, r->x, r->y, r->w, r->h, pix);
+ }
+ evas_object_image_data_set(cw->obj, pix);
+ EINA_LIST_FOREACH(cw->obj_mirror, l, o)
+ evas_object_image_data_set(o, pix);
+
+ eina_iterator_free(it);
+ E_FREE_FUNC(cw->pending_updates, eina_tiler_free);
+ return EINA_TRUE;
+}
+
+Evas_Object *
+e_comp_object_util_mirror_add(Evas_Object *obj)
+{
+ Evas_Object *o;
+ int w, h;
+ unsigned int *pix = NULL;
+ Eina_Bool argb = EINA_FALSE;
+
+ SOFT_ENTRY(NULL);
+
+ if (!cw)
+ {
+ o = evas_object_image_filled_add(evas_object_evas_get(obj));
+ evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
+ evas_object_image_smooth_scale_set(o, e_comp_config_get()->smooth_windows);
+ evas_object_image_alpha_set(o, 1);
+ evas_object_image_source_set(o, obj);
+ return o;
+ }
+ if ((!cw->ec) || (!e_pixmap_size_get(cw->ec->pixmap, &w, &h))) return NULL;
+ if ((!cw->native) && (!e_pixmap_image_exists(cw->ec->pixmap))) return NULL;
+ o = evas_object_image_filled_add(evas_object_evas_get(obj));
+ evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
+ evas_object_image_smooth_scale_set(o, e_comp_config_get()->smooth_windows);
+ cw->obj_mirror = eina_list_append(cw->obj_mirror, o);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _e_comp_object_cb_mirror_del, cw);
+
+ evas_object_image_alpha_set(o, evas_object_image_alpha_get(cw->obj));
+ evas_object_image_size_set(o, w, h);
+
+ if (cw->ec->shaped)
+ {
+ if (!e_pixmap_image_exists(cw->ec->pixmap)) return o;
+ pix = evas_object_image_data_get(cw->obj, 0);
+ }
+ else
+ {
+ if (cw->native)
+ {
+ Evas_Native_Surface ns;
+
+ e_pixmap_native_surface_init(cw->ec->pixmap, &ns);
+ evas_object_image_native_surface_set(o, &ns);
+ }
+ else
+ {
+ if (!e_pixmap_image_exists(cw->ec->pixmap)) return o;
+ argb = e_pixmap_image_is_argb(cw->ec->pixmap);
+ if (argb)
+ pix = e_pixmap_image_data_get(cw->ec->pixmap);
+ else
+ pix = evas_object_image_data_get(cw->obj, EINA_FALSE);
+ }
+ }
+ if (pix)
+ {
+ evas_object_image_data_set(o, pix);
+ if (!argb)
+ evas_object_image_data_set(cw->obj, pix);
+ }
+ evas_object_image_data_update_add(o, 0, 0, w, h);
+ return o;
+}
+
+//////////////////////////////////////////////////////
+
+EAPI void
+e_comp_object_effect_set(Evas_Object *obj, const char *effect)
+{
+ char buf[4096];
+ Eina_Stringshare *grp;
+
+ API_ENTRY;
+ if (!cw->shobj) return; //input window
+
+ if (!effect) effect = "none";
+ snprintf(buf, sizeof(buf), "e/comp/effects/%s", effect);
+ edje_object_file_get(cw->effect_obj, NULL, &grp);
+ if (!e_util_strcmp(buf, grp)) return;
+ if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", buf))
+ {
+ snprintf(buf, sizeof(buf), "e/comp/effects/auto/%s", effect);
+ if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", buf))
+ if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", "e/comp/effects/none")) return;
+ }
+ edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj);
+ if (cw->effect_clip)
+ {
+ evas_object_clip_unset(cw->clip);
+ cw->effect_clip = 0;
+ }
+ cw->effect_clip_able = !edje_object_data_get(cw->effect_obj, "noclip");
+}
+
+EAPI void
+e_comp_object_effect_params_set(Evas_Object *obj, int id, int *params, unsigned int count)
+{
+ Edje_Message_Int_Set *msg;
+ unsigned int x;
+
+ API_ENTRY;
+ EINA_SAFETY_ON_NULL_RETURN(params);
+ EINA_SAFETY_ON_FALSE_RETURN(count);
+
+ msg = alloca(sizeof(Edje_Message_Int_Set) + ((count - 1) * sizeof(int)));
+ msg->count = (int)count;
+ for (x = 0; x < count; x++)
+ msg->val[x] = params[x];
+ edje_object_message_send(cw->effect_obj, EDJE_MESSAGE_INT_SET, id, msg);
+ edje_object_message_signal_process(cw->effect_obj);
+}
+
+static void
+_e_comp_object_effect_end_cb(void *data EINA_UNUSED, Evas_Object *obj, const char *emission, const char *source)
+{
+ Edje_Signal_Cb end_cb;
+ void *end_data;
+
+ end_cb = evas_object_data_get(obj, "_e_comp.end_cb");
+ end_data = evas_object_data_get(obj, "_e_comp.end_data");
+ end_cb(end_data, obj, emission, source);
+
+ edje_object_signal_callback_del_full(obj, "e,action,done", "e", _e_comp_object_effect_end_cb, NULL);
+}
+
+EAPI void
+e_comp_object_effect_clip(Evas_Object *obj)
+{
+ API_ENTRY;
+ if (!cw->ec->zone) return;
+ if (cw->effect_clip) e_comp_object_effect_unclip(cw->smart_obj);
+ if (!cw->effect_clip_able) return;
+ evas_object_clip_set(cw->smart_obj, cw->ec->zone->bg_clip_object);
+ cw->effect_clip = 1;
+}
+
+EAPI void
+e_comp_object_effect_unclip(Evas_Object *obj)
+{
+ API_ENTRY;
+ if (!cw->effect_clip) return;
+ evas_object_clip_unset(cw->smart_obj);
+ cw->effect_clip = 0;
+}
+
+EAPI void
+e_comp_object_effect_start(Evas_Object *obj, Edje_Signal_Cb end_cb, const void *end_data)
+{
+ API_ENTRY;
+ EINA_SAFETY_ON_NULL_RETURN(cw->ec); //NYI
+ e_comp_object_effect_clip(obj);
+ edje_object_signal_callback_del_full(cw->effect_obj, "e,action,done", "e", _e_comp_object_effect_end_cb, NULL);
+
+ edje_object_signal_callback_add(cw->effect_obj, "e,action,done", "e", _e_comp_object_effect_end_cb, NULL);
+ evas_object_data_set(cw->effect_obj, "_e_comp.end_cb", end_cb);
+ evas_object_data_set(cw->effect_obj, "_e_comp.end_data", end_data);
+
+ edje_object_signal_emit(cw->effect_obj, "e,action,go", "e");
+}
+
+EAPI void
+e_comp_object_effect_stop(Evas_Object *obj, Edje_Signal_Cb end_cb EINA_UNUSED)
+{
+ API_ENTRY;
+ e_comp_object_effect_unclip(obj);
+ if (cw->effect_clip)
+ {
+ evas_object_clip_unset(cw->effect_obj);
+ cw->effect_clip = 0;
+ }
+ edje_object_signal_emit(cw->effect_obj, "e,action,stop", "e");
+ edje_object_signal_callback_del_full(cw->effect_obj, "e,action,done", "e", _e_comp_object_effect_end_cb, NULL);
+}
+
+////////////////////////////////////
+
+static void
+_e_comp_object_autoclose_cleanup(E_Comp *c)
+{
+ if (c->autoclose.obj)
+ {
+ c = e_comp_util_evas_object_comp_get(c->autoclose.obj);
+ e_comp_ungrab_input(c, 0, 1);
+ if (c->autoclose.del_cb)
+ c->autoclose.del_cb(c->autoclose.data, c->autoclose.obj);
+ else
+ {
+ evas_object_hide(c->autoclose.obj);
+ E_FREE_FUNC(c->autoclose.obj, evas_object_del);
+ }
+ E_FREE_FUNC(c->autoclose.rect, evas_object_del);
+ }
+ c->autoclose.obj = NULL;
+ c->autoclose.data = NULL;
+ c->autoclose.del_cb = NULL;
+ c->autoclose.key_cb = NULL;
+ E_FREE_FUNC(c->autoclose.key_handler, ecore_event_handler_del);
+ e_comp_shape_queue(c);
+}
+
+static Eina_Bool
+_e_comp_object_autoclose_key_down_cb(void *data, int type EINA_UNUSED, void *event)
+{
+ Ecore_Event_Key *ev = event;
+ Eina_Bool del = EINA_TRUE;
+ E_Comp *c = data;
+
+ if (c->autoclose.key_cb)
+ del = !c->autoclose.key_cb(c->autoclose.data, ev);
+ if (del) _e_comp_object_autoclose_cleanup(data);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_e_comp_object_autoclose_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ _e_comp_object_autoclose_cleanup(data);
+}
+
+static void
+_e_comp_object_autoclose_setup(Evas_Object *obj)
+{
+ E_Comp *c = e_comp_util_evas_object_comp_get(obj);
+
+ if (!c->autoclose.rect)
+ {
+ c->autoclose.rect = evas_object_rectangle_add(c->evas);
+ evas_object_name_set(c->autoclose.rect, "c->autoclose.rect");
+ evas_object_color_set(c->autoclose.rect, 0, 0, 0, 0);
+ evas_object_event_callback_add(c->autoclose.rect, EVAS_CALLBACK_MOUSE_UP, _e_comp_object_autoclose_mouse_up_cb, c);
+ }
+ evas_object_move(c->autoclose.rect, 0, 0);
+ evas_object_resize(c->autoclose.rect, c->man->w, c->man->h);
+ evas_object_layer_set(c->autoclose.rect, evas_object_layer_get(obj) - 1);
+ evas_object_show(c->autoclose.rect);
+ e_comp_shape_queue(c);
+ c->autoclose.key_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_comp_object_autoclose_key_down_cb, c);
+ e_comp_grab_input(c, 0, 1);
+}
+
+static void
+_e_comp_object_autoclose_show(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ _e_comp_object_autoclose_setup(obj);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _e_comp_object_autoclose_show);
+}
+
+static void
+_e_comp_object_autoclose_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _e_comp_object_autoclose_show);
+ _e_comp_object_autoclose_cleanup(data);
+}
+
+EAPI void
+e_comp_object_util_autoclose(Evas_Object *obj, E_Comp_Object_Autoclose_Cb del_cb, E_Comp_Object_Key_Cb cb, const void *data)
+{
+ E_Comp *c;
+
+ SOFT_ENTRY();
+
+ c = e_comp_util_evas_object_comp_get(obj);
+ EINA_SAFETY_ON_NULL_RETURN(c);
+ if (c->autoclose.obj)
+ {
+ /* block overwrite of current autoclose object */
+ if (c->autoclose.obj != obj) return;
+ c->autoclose.del_cb = del_cb;
+ c->autoclose.key_cb = cb;
+ c->autoclose.data = (void*)data;
+ return;
+ }
+ c->autoclose.obj = obj;
+ c->autoclose.del_cb = del_cb;
+ c->autoclose.key_cb = cb;
+ c->autoclose.data = (void*)data;
+ if (evas_object_visible_get(obj))
+ _e_comp_object_autoclose_setup(obj);
+ else
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _e_comp_object_autoclose_show, c);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _e_comp_object_autoclose_del, c);
+}
diff --git a/src/bin/e_comp_object.h b/src/bin/e_comp_object.h
new file mode 100644
index 0000000000..040a174f26
--- /dev/null
+++ b/src/bin/e_comp_object.h
@@ -0,0 +1,79 @@
+#ifdef E_TYPEDEFS
+typedef struct E_Comp_Object_Frame E_Comp_Object_Frame;
+typedef struct E_Event_Comp_Object E_Event_Comp_Object;
+typedef void (*E_Comp_Object_Autoclose_Cb)(void *, Evas_Object *);
+typedef Eina_Bool (*E_Comp_Object_Key_Cb)(void *, Ecore_Event_Key *);
+
+typedef enum
+{
+ E_COMP_OBJECT_TYPE_NONE,
+ E_COMP_OBJECT_TYPE_MENU,
+ E_COMP_OBJECT_TYPE_POPUP,
+ E_COMP_OBJECT_TYPE_LAST,
+} E_Comp_Object_Type;
+
+#else
+#ifndef E_COMP_OBJECT_H
+#define E_COMP_OBJECT_H
+
+#define E_COMP_OBJECT_FRAME_RESHADOW "COMP_RESHADOW"
+
+struct E_Event_Comp_Object
+{
+ Evas_Object *comp_object;
+};
+
+struct E_Comp_Object_Frame
+{
+ int l, r, t, b;
+ Eina_Bool calc : 1; // inset has been calculated
+};
+
+
+extern EAPI int E_EVENT_COMP_OBJECT_ADD;
+
+EAPI void e_comp_object_zoomap_set(Evas_Object *obj, Eina_Bool enabled);
+EAPI Evas_Object *e_comp_object_client_add(E_Client *ec);
+EAPI Evas_Object *e_comp_object_util_mirror_add(Evas_Object *obj);
+EAPI Evas_Object *e_comp_object_util_add(Evas_Object *obj, E_Comp_Object_Type type);
+EAPI void e_comp_object_frame_xy_adjust(Evas_Object *obj, int x, int y, int *ax, int *ay);
+EAPI void e_comp_object_frame_xy_unadjust(Evas_Object *obj, int x, int y, int *ax, int *ay);
+EAPI void e_comp_object_frame_wh_adjust(Evas_Object *obj, int w, int h, int *aw, int *ah);
+EAPI void e_comp_object_frame_wh_unadjust(Evas_Object *obj, int w, int h, int *aw, int *ah);
+EAPI E_Client *e_comp_object_client_get(Evas_Object *obj);
+EAPI E_Zone *e_comp_object_util_zone_get(Evas_Object *obj);
+EAPI void e_comp_object_util_del_list_append(Evas_Object *obj, Evas_Object *to_del);
+EAPI void e_comp_object_util_del_list_remove(Evas_Object *obj, Evas_Object *to_del);
+EAPI void e_comp_object_util_autoclose(Evas_Object *obj, E_Comp_Object_Autoclose_Cb del_cb, E_Comp_Object_Key_Cb cb, const void *data);
+EAPI void e_comp_object_util_center(Evas_Object *obj);
+EAPI void e_comp_object_util_center_on(Evas_Object *obj, Evas_Object *on);
+EAPI void e_comp_object_util_center_pos_get(Evas_Object *obj, int *x, int *y);
+EAPI void e_comp_object_util_fullscreen(Evas_Object *obj);
+EAPI void e_comp_object_frame_geometry_get(Evas_Object *obj, int *l, int *r, int *t, int *b);
+EAPI Eina_Bool e_comp_object_frame_title_set(Evas_Object *obj, const char *name);
+EAPI Eina_Bool e_comp_object_frame_exists(Evas_Object *obj);
+EAPI void e_comp_object_frame_icon_update(Evas_Object *obj);
+EAPI Eina_Bool e_comp_object_frame_theme_set(Evas_Object *obj, const char *name);
+EAPI void e_comp_object_signal_emit(Evas_Object *obj, const char *sig, const char *src);
+EAPI void e_comp_object_signal_callback_add(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb, const void *data);
+EAPI void e_comp_object_signal_callback_del(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb);
+EAPI void e_comp_object_signal_callback_del_full(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb, const void *data);
+EAPI void e_comp_object_input_area_set(Evas_Object *obj, int x, int y, int w, int h);
+EAPI void e_comp_object_damage(Evas_Object *obj, int x, int y, int w, int h);
+EAPI void e_comp_object_render_update_add(Evas_Object *obj);
+EAPI void e_comp_object_render_update_del(Evas_Object *obj);
+EAPI void e_comp_object_shape_apply(Evas_Object *obj);
+EAPI void e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set);
+EAPI void e_comp_object_native_surface_set(Evas_Object *obj, Eina_Bool set);
+EAPI void e_comp_object_dirty(Evas_Object *obj);
+EAPI Eina_Bool e_comp_object_render(Evas_Object *obj);
+EAPI void e_comp_object_effect_set(Evas_Object *obj, const char *effect);
+EAPI void e_comp_object_effect_params_set(Evas_Object *obj, int id, int *params, unsigned int count);
+EAPI void e_comp_object_effect_clip(Evas_Object *obj);
+EAPI void e_comp_object_effect_unclip(Evas_Object *obj);
+EAPI void e_comp_object_effect_start(Evas_Object *obj, Edje_Signal_Cb end_cb, const void *end_data);
+EAPI void e_comp_object_effect_stop(Evas_Object *obj, Edje_Signal_Cb end_cb EINA_UNUSED);
+
+#endif
+#endif
+
diff --git a/src/bin/e_comp_render_update.c b/src/bin/e_comp_render_update.c
deleted file mode 100644
index dae8c021d6..0000000000
--- a/src/bin/e_comp_render_update.c
+++ /dev/null
@@ -1,248 +0,0 @@
-#include "e.h"
-#include "e_comp_render_update.h"
-
-//////////////////////////////////////////////////////////////////////////
-
-static void
-_e_comp_tiles_alloc(E_Comp_Render_Update *up)
-{
- if (up->tiles) return;
- up->tiles = calloc(up->tw * up->th, sizeof(unsigned char));
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-E_Comp_Render_Update *
-e_comp_render_update_new(void)
-{
- E_Comp_Render_Update *up;
-
- up = calloc(1, sizeof(E_Comp_Render_Update));
- up->tsw = 32;
- up->tsh = 32;
- up->pol = E_COMP_RENDER_UPDATE_POLICY_RAW;
- return up;
-}
-
-void
-e_comp_render_update_free(E_Comp_Render_Update *up)
-{
- if (!up) return;
- free(up->tiles);
- free(up);
-}
-
-void
-e_comp_render_update_policy_set(E_Comp_Render_Update *up,
- E_Comp_Render_Update_Policy pol)
-{
- up->pol = pol;
-}
-
-void
-e_comp_render_update_tile_size_set(E_Comp_Render_Update *up,
- int tsw,
- int tsh)
-{
- if ((up->tsw == tsw) && (up->tsh == tsh)) return;
- up->tsw = tsw;
- up->tsh = tsh;
- e_comp_render_update_clear(up);
-}
-
-void
-e_comp_render_update_resize(E_Comp_Render_Update *up,
- int w,
- int h)
-{
- unsigned char *ptiles, *p, *pp;
- int ptw, pth, x, y;
-
- if ((!up) || ((up->w == w) && (up->h == h))) return;
-
- ptw = up->tw;
- pth = up->th;
- ptiles = up->tiles;
-
- up->w = w;
- up->h = h;
- up->tw = (up->w + up->tsw - 1) / up->tsw;
- up->th = (up->h + up->tsh - 1) / up->tsh;
- up->tiles = NULL;
- _e_comp_tiles_alloc(up);
- if ((ptiles) && (up->tiles))
- {
- if (pth <= up->th)
- {
- for (y = 0; y < pth; y++)
- {
- p = up->tiles + (y * up->tw);
- pp = ptiles + (y * ptw);
- if (ptw <= up->tw)
- for (x = 0; x < ptw; x++)
- *p++ = *pp++;
- else
- for (x = 0; x < up->tw; x++)
- *p++ = *pp++;
- }
- }
- else
- {
- for (y = 0; y < up->th; y++)
- {
- p = up->tiles + (y * up->tw);
- pp = ptiles + (y * ptw);
- if (ptw <= up->tw)
- for (x = 0; x < ptw; x++)
- *p++ = *pp++;
- else
- for (x = 0; x < up->tw; x++)
- *p++ = *pp++;
- }
- }
- }
- free(ptiles);
-}
-
-void
-e_comp_render_update_add(E_Comp_Render_Update *up,
- int x,
- int y,
- int w,
- int h)
-{
- int tx, ty, txx, tyy, xx, yy;
- unsigned char *t, *t2;
-
- if ((w <= 0) || (h <= 0)) return;
- if ((up->tw <= 0) || (up->th <= 0)) return;
-
- _e_comp_tiles_alloc(up);
-
- E_RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, up->w, up->h);
- if ((w <= 0) || (h <= 0)) return;
-
- switch (up->pol)
- {
- case E_COMP_RENDER_UPDATE_POLICY_RAW:
- break;
-
- case E_COMP_RENDER_UPDATE_POLICY_HALF_WIDTH_OR_MORE_ROUND_UP_TO_FULL_WIDTH:
- if (w > (up->w / 2))
- {
- x = 0;
- w = up->w;
- }
- break;
-
- default:
- break;
- }
-
- tx = x / up->tsw;
- ty = y / up->tsh;
- txx = (x + w - 1) / up->tsw;
- tyy = (y + h - 1) / up->tsh;
- t = up->tiles + (ty * up->tw) + tx;
- for (yy = ty; yy <= tyy; yy++)
- {
- t2 = t;
- for (xx = tx; xx <= txx; xx++)
- {
- *t2 = 1;
- t2++;
- }
- t += up->tw;
- }
-}
-
-E_Comp_Render_Update_Rect *
-e_comp_render_update_rects_get(E_Comp_Render_Update *up)
-{
- E_Comp_Render_Update_Rect *r;
- int ri = 0;
- int x, y;
- unsigned char *t, *t2, *t3;
-
- if (!up->tiles) return NULL;
- r = calloc((up->tw * up->th) + 1, sizeof(E_Comp_Render_Update_Rect));
- if (!r) return NULL;
- t = up->tiles;
- for (y = 0; y < up->th; y++)
- {
- for (x = 0; x < up->tw; x++)
- {
- if (*t)
- {
- int can_expand_x = 1, can_expand_y = 1;
- int xx = 0, yy = 0;
-
- t2 = t + 1;
- while (can_expand_x)
- {
- xx++;
- if ((x + xx) >= up->tw) can_expand_x = 0;
- else if (!*t2)
- can_expand_x = 0;
- if (can_expand_x) *t2 = 0;
- t2++;
- }
- t3 = t;
- while (can_expand_y)
- {
- int i;
-
- yy++;
- t3 += up->tw;
- if ((y + yy) >= up->th) can_expand_y = 0;
- if (can_expand_y)
- {
- t2 = t3;
- for (i = 0; i < xx; i++)
- {
- if (!*t2)
- {
- can_expand_y = 0;
- break;
- }
- t2++;
- }
- }
- if (can_expand_y)
- {
- t2 = t3;
- for (i = 0; i < xx; i++)
- {
- *t2 = 0;
- t2++;
- }
- }
- }
- *t = 0;
- r[ri].x = x * up->tsw;
- r[ri].y = y * up->tsh;
- r[ri].w = xx * up->tsw;
- r[ri].h = yy * up->tsh;
- if ((r[ri].x + r[ri].w) > up->w) r[ri].w = up->w - r[ri].x;
- if ((r[ri].y + r[ri].h) > up->h) r[ri].h = up->h - r[ri].y;
- if ((r[ri].w <= 0) || (r[ri].h <= 0)) r[ri].w = 0;
- else ri++;
- x += xx - 1;
- t += xx - 1;
- }
- t++;
- }
- }
- return r;
-}
-
-void
-e_comp_render_update_clear(E_Comp_Render_Update *up)
-{
- if (up->tiles)
- {
- free(up->tiles);
- up->tiles = NULL;
- }
-}
-
diff --git a/src/bin/e_comp_render_update.h b/src/bin/e_comp_render_update.h
deleted file mode 100644
index 3b355f1b27..0000000000
--- a/src/bin/e_comp_render_update.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifdef E_TYPEDEFS
-typedef struct _E_Comp_Render_Update E_Comp_Render_Update;
-typedef struct _E_Comp_Render_Update_Rect E_Comp_Render_Update_Rect;
-typedef enum _E_Comp_Render_Update_Policy
-{
- E_COMP_RENDER_UPDATE_POLICY_RAW,
- E_COMP_RENDER_UPDATE_POLICY_HALF_WIDTH_OR_MORE_ROUND_UP_TO_FULL_WIDTH,
-} E_Comp_Render_Update_Policy;
-#else
-#ifndef E_COMP_RENDER_UPDATE_H
-#define E_COMP_RENDER_UPDATE_H
-
-struct _E_Comp_Render_Update_Rect
-{
- int x, y, w, h;
-};
-
-struct _E_Comp_Render_Update
-{
- int w, h;
- int tw, th;
- int tsw, tsh;
- unsigned char *tiles;
- E_Comp_Render_Update_Policy pol;
-};
-
-E_Comp_Render_Update *e_comp_render_update_new(void);
-void e_comp_render_update_free(E_Comp_Render_Update *up);
-void e_comp_render_update_policy_set(E_Comp_Render_Update *up,
- E_Comp_Render_Update_Policy pol);
-void e_comp_render_update_tile_size_set(E_Comp_Render_Update *up,
- int tsw,
- int tsh);
-void e_comp_render_update_resize(E_Comp_Render_Update *up,
- int w,
- int h);
-void e_comp_render_update_add(E_Comp_Render_Update *up,
- int x,
- int y,
- int w,
- int h);
-E_Comp_Render_Update_Rect *e_comp_render_update_rects_get(E_Comp_Render_Update *up);
-void e_comp_render_update_clear(E_Comp_Render_Update *up);
-
-#endif
-#endif
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index 2f23abf00a..159254b993 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -1,6 +1,5 @@
#include "e.h"
#include "e_comp_wl.h"
-#include "e_surface.h"
#include <sys/mman.h>
/* compositor function prototypes */
@@ -225,8 +224,6 @@ static const struct wl_pointer_grab_interface _e_drag_grab_interface =
/* local variables */
static Ecore_Idler *_module_idler = NULL;
-static Eina_Hash *_e_wl_border_hash = NULL;
-
/* external variables */
EAPI E_Wayland_Compositor *_e_wl_comp;
@@ -452,8 +449,6 @@ e_comp_wl_shutdown(void)
E_FREE(_e_wl_comp);
}
- E_FREE_FUNC(_e_wl_border_hash, eina_hash_free);
-
/* disable the loaded shell module */
/* TODO: we should have a config variable somewhere to store which
* shell we want to unload (tablet, mobile, etc) */
@@ -461,28 +456,6 @@ e_comp_wl_shutdown(void)
e_module_disable(mod);
}
-EAPI void
-e_comp_wl_border_surface_add(Ecore_Window win, const E_Border *bd)
-{
- if (!_e_wl_border_hash)
- _e_wl_border_hash = eina_hash_int32_new(NULL);
- eina_hash_add(_e_wl_border_hash, &win, bd);
-}
-
-EAPI void
-e_comp_wl_border_surface_del(Ecore_Window win)
-{
- if (!_e_wl_border_hash) return;
- eina_hash_del_by_key(_e_wl_border_hash, &win);
-}
-
-EAPI E_Border *
-e_comp_wl_border_surface_find(Ecore_Window win)
-{
- if (!_e_wl_border_hash) return NULL;
- return eina_hash_find(_e_wl_border_hash, &win);
-}
-
EAPI void
wl_seat_init(struct wl_seat *seat)
{
@@ -1679,8 +1652,11 @@ _e_comp_wl_cb_surface_create(struct wl_client *client, struct wl_resource *resou
wl_resource_post_no_memory(resource);
return;
}
- ews->id = id;
+ ews->wl.client = client;
+ ews->pixmap = e_pixmap_new(E_PIXMAP_TYPE_WL, ews);
+ e_pixmap_parent_window_set(ews->pixmap, ews);
+ e_pixmap_usable_set(ews->pixmap, 1);
/* initialize the destroy signal */
wl_signal_init(&ews->wl.destroy_signal);
@@ -1745,6 +1721,10 @@ _e_comp_wl_cb_surface_destroy(struct wl_resource *resource)
{
if (ews->unmap) ews->unmap(ews);
}
+ if (ews->buffer_reference.buffer)
+ ews->buffer_reference.buffer->ews = NULL;
+ if (ews->pending.buffer)
+ ews->pending.buffer->ews = NULL;
/* loop any pending surface frame callbacks and destroy them */
wl_list_for_each_safe(cb, ncb, &ews->pending.frames, wl.link)
@@ -1772,11 +1752,14 @@ _e_comp_wl_cb_surface_destroy(struct wl_resource *resource)
wl_list_for_each_safe(cb, ncb, &ews->wl.frames, wl.link)
wl_resource_destroy(cb->wl.resource);
+ e_pixmap_parent_window_set(ews->pixmap, NULL);
+ e_pixmap_free(ews->pixmap);
+
/* remove this surface from the compositor's list of surfaces */
_e_wl_comp->surfaces = eina_inlist_remove(_e_wl_comp->surfaces, EINA_INLIST_GET(ews));
/* free the allocated surface structure */
- E_FREE(ews);
+ free(ews);
}
static void
@@ -2314,11 +2297,13 @@ _e_comp_wl_pointer_configure(E_Wayland_Surface *ews, Evas_Coord x, Evas_Coord y,
* using the pixels from their cursor surface */
/* is it mapped ? */
- if ((focus->mapped) && (focus->ee))
+ if ((focus->mapped) && (focus->ec))
{
Ecore_Window win;
/* try to get the ecore_window */
+#warning CURSOR BROKEN
+#if 0
if ((win = ecore_evas_window_get(focus->ee)))
{
E_Wayland_Buffer_Reference *ref;
@@ -2348,6 +2333,7 @@ _e_comp_wl_pointer_configure(E_Wayland_Surface *ews, Evas_Coord x, Evas_Coord y,
else
ecore_x_window_cursor_set(win, 0);
}
+#endif
}
}
}
@@ -2566,6 +2552,7 @@ _e_comp_wl_surface_buffer_reference(E_Wayland_Buffer_Reference *ref, E_Wayland_B
wl_signal_add(&buffer->wl.destroy_signal, &ref->destroy_listener);
}
+ //INF("CURRENT BUFFER SWAP");
ref->buffer = buffer;
ref->destroy_listener.notify =
_e_comp_wl_surface_buffer_reference_cb_destroy;
@@ -2611,12 +2598,29 @@ _e_comp_wl_surface_buffer_resource(struct wl_resource *resource)
}
static void
-_e_comp_wl_surface_buffer_cb_destroy(struct wl_listener *listener, void *data EINA_UNUSED)
+_e_comp_wl_surface_buffer_cb_destroy(struct wl_listener *listener, void *data)
{
E_Wayland_Buffer *buffer;
buffer = container_of(listener, E_Wayland_Buffer, wl.destroy_listener);
wl_signal_emit(&buffer->wl.destroy_signal, buffer);
+ if (buffer->ews && buffer->ews->pixmap && (e_pixmap_resource_get(buffer->ews->pixmap) == data))
+ {
+ if (buffer->ews->ec)
+ {
+ INF("DESTROYED CURRENT BUFFER: %s", e_pixmap_dirty_get(buffer->ews->pixmap) ? "DIRTY" : "CLEAN");
+ e_pixmap_usable_set(buffer->ews->pixmap, 0);
+ if (!e_pixmap_image_exists(buffer->ews->pixmap))
+ {
+ e_pixmap_image_refresh(buffer->ews->pixmap);
+ }
+
+ e_pixmap_image_clear(buffer->ews->pixmap, 0);
+ e_comp_object_damage(buffer->ews->ec->frame, 0, 0, buffer->ews->ec->client.w, buffer->ews->ec->client.h);
+ e_comp_object_render(buffer->ews->ec->frame);
+ e_comp_object_render_update_del(buffer->ews->ec->frame);
+ }
+ }
E_FREE(buffer);
}
@@ -2637,13 +2641,26 @@ _e_comp_wl_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_res
if (!(ews = wl_resource_get_user_data(resource))) return;
if (buffer_resource)
- buffer = _e_comp_wl_surface_buffer_resource(buffer_resource);
+ {
+ buffer = _e_comp_wl_surface_buffer_resource(buffer_resource);
+ if (ews->ec && (!ews->buffer_reference.buffer))
+ {
+ e_pixmap_usable_set(ews->pixmap, 1);
+ }
+ }
/* reference any existing buffers */
_e_comp_wl_surface_buffer_reference(&ews->buffer_reference, buffer);
+ //INF("ATTACHED NEW BUFFER");
+ e_pixmap_dirty(ews->pixmap);
+ //if (ews->ec)
+ //e_comp_object_damage(ews->ec->frame, 0, 0, ews->ec->client.w, ews->ec->client.h);
+
/* if we are setting a null buffer, then unmap the surface */
- if (!buffer)
+ if (buffer)
+ buffer->ews = ews;
+ else
{
if (ews->mapped)
{
@@ -2674,6 +2691,7 @@ _e_comp_wl_surface_cb_damage(struct wl_client *client EINA_UNUSED, struct wl_res
/* try to cast the resource data to our surface structure */
if (!(ews = wl_resource_get_user_data(resource))) return;
+ e_pixmap_image_clear(ews->pixmap, 1);
/* tell pixman to add this damage to pending */
pixman_region32_union_rect(&ews->pending.damage, &ews->pending.damage,
@@ -2780,49 +2798,19 @@ _e_comp_wl_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_res
ews->pending.buffer);
/* if the pending buffer is NULL, unmap the surface */
- if (!ews->pending.buffer)
+ if (ews->pending.buffer)
+ ews->pending.buffer->ews = ews;
+ else
{
if (ews->mapped)
{
if (ews->unmap) ews->unmap(ews);
}
}
- else
- {
- if (ews->obj)
- {
- E_Wayland_Buffer *buff;
- struct wl_shm_buffer *shm_buffer;
- void *data;
-
- buff = ews->pending.buffer;
-
- shm_buffer = wl_shm_buffer_get(buff->wl.resource);
-
- bw = wl_shm_buffer_get_width(shm_buffer);
- bh = wl_shm_buffer_get_height(shm_buffer);
-
- /* grab the pixel data from the buffer */
- data = wl_shm_buffer_get_data(shm_buffer);
-
- /* send the pixel data to the smart object */
- e_surface_image_set(ews->obj, bw, bh, data);
- }
- }
- }
-
- /* if we have a reference to a buffer, get it's size */
- if (&ews->buffer_reference)
- {
- E_Wayland_Buffer *buff;
- struct wl_shm_buffer *shm_buffer;
-
- buff = ews->buffer_reference.buffer;
-
- shm_buffer = wl_shm_buffer_get(buff->wl.resource);
- bw = wl_shm_buffer_get_width(shm_buffer);
- bh = wl_shm_buffer_get_height(shm_buffer);
}
+ e_pixmap_dirty(ews->pixmap);
+ e_pixmap_refresh(ews->pixmap);
+ e_pixmap_size_get(ews->pixmap, &bw, &bh);
/* if we have a new pending buffer, call configure */
if ((ews->configure) && (ews->pending.new_buffer))
@@ -2849,15 +2837,18 @@ _e_comp_wl_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_res
pixman_region32_init(&ews->pending.damage);
/* get the extent of the damage region */
- rects = pixman_region32_rectangles(&ews->region.damage, &n);
- while (n--)
+ if (ews->ec)
{
- pixman_box32_t *r;
+ rects = pixman_region32_rectangles(&ews->region.damage, &n);
+ while (n--)
+ {
+ pixman_box32_t *r;
- r = &rects[n];
+ r = &rects[n];
- /* send damages to the image */
- e_surface_damage_add(ews->obj, r->x1, r->y1, r->x2, r->y2);
+ /* send damages to the image */
+ e_comp_object_damage(ews->ec->frame, r->x1, r->y1, r->x2, r->y2);
+ }
}
/* tell pixman we are finished with this region */
@@ -2898,9 +2889,9 @@ _e_comp_wl_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_res
rects = pixman_region32_extents(&ews->region.input);
/* update the smart object's input region */
- if (ews->obj)
- e_surface_input_set(ews->obj, rects->x1, rects->y1,
- rects->x2, rects->y2);
+ if (ews->ec)
+ e_comp_object_input_area_set(ews->ec->frame, rects->x1, rects->y1,
+ rects->x2, rects->y2);
}
/* put any pending frame callbacks into active list */
@@ -2909,6 +2900,10 @@ _e_comp_wl_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_res
/* clear list of pending frame callbacks */
wl_list_init(&ews->pending.frames);
+ ews->updates = 1;
+
+ _e_wl_comp->surfaces = eina_inlist_promote(_e_wl_comp->surfaces, EINA_INLIST_GET(ews));
+
/* TODO: schedule repaint ?? */
}
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index 912f9bf05f..c264fc21bd 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -267,6 +267,7 @@ struct _E_Wayland_Buffer
int w, h;
unsigned int busy_count;
+ E_Wayland_Surface *ews;
};
struct _E_Wayland_Buffer_Reference
@@ -281,6 +282,7 @@ struct _E_Wayland_Surface
Ecore_Window id;
struct
{
+ struct wl_client *client;
struct wl_resource *surface;
struct wl_signal destroy_signal;
struct wl_list link, frames;
@@ -311,18 +313,12 @@ struct _E_Wayland_Surface
pixman_region32_t damage, clip;
} region;
- /* smart object for this surface */
- Evas_Object *obj;
-
- Ecore_Evas *ee;
- Ecore_X_Window evas_win;
- Evas *evas;
-
- E_Border *bd;
- Eina_List *bd_hooks;
+ E_Client *ec;
+ E_Pixmap *pixmap;
E_Wayland_Shell_Surface *shell_surface;
Eina_Bool mapped : 1;
+ Eina_Bool updates : 1; //surface has render updates
E_Wayland_Input *input;
@@ -367,7 +363,7 @@ struct _E_Wayland_Shell_Surface
E_Wayland_Surface *surface, *parent;
E_Wayland_Shell_Surface_Type type, next_type;
- char *title, *clas;
+ Eina_Stringshare *title, *clas;
Eina_Bool active : 1;
@@ -588,10 +584,6 @@ extern EAPI E_Wayland_Compositor *_e_wl_comp;
EINTERN Eina_Bool e_comp_wl_init(void);
EINTERN void e_comp_wl_shutdown(void);
-EAPI void e_comp_wl_border_surface_add(Ecore_Window win, const E_Border *bd);
-EAPI void e_comp_wl_border_surface_del(Ecore_Window win);
-EAPI E_Border *e_comp_wl_border_surface_find(Ecore_Window win);
-
EAPI void wl_seat_init(struct wl_seat *seat);
EAPI void wl_seat_release(struct wl_seat *seat);
diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c
new file mode 100644
index 0000000000..e0ca54526c
--- /dev/null
+++ b/src/bin/e_comp_x.c
@@ -0,0 +1,4851 @@
+#include "e.h"
+#include <Ecore_X.h>
+
+#define GRAV_SET(ec, grav) \
+ ecore_x_window_gravity_set(e_client_util_pwin_get(ec), grav); \
+ if (ec->comp_data->lock_win) ecore_x_window_gravity_set(ec->comp_data->lock_win, grav); \
+ ecore_x_window_gravity_set(e_client_util_win_get(ec), grav);
+
+#define E_COMP_X_PIXMAP_CHECK if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_X) return
+
+/* maybe make configurable?
+ * not sure why anyone would want to change it...
+ */
+#define MOVE_COUNTER_LIMIT 50
+
+EINTERN void _e_main_cb_x_fatal(void *data EINA_UNUSED);
+
+typedef struct _Frame_Extents Frame_Extents;
+
+struct _Frame_Extents
+{
+ int l, r, t, b;
+};
+
+struct _E_Comp_Data
+{
+ Eina_Bool restack : 1;
+};
+
+struct E_Comp_Client_Data
+{
+ Ecore_X_Window lock_win;
+
+ Ecore_X_Damage damage; // damage region
+ Ecore_X_Visual vis; // window visual
+ Ecore_X_Colormap cmap; // colormap of window
+
+#if 0 //NOT USED
+ Ecore_X_Pixmap cache_pixmap; // the cached pixmap (1/nth the dimensions)
+ int cache_w, cache_h; // cached pixmap size
+#endif
+
+ Ecore_X_Image *xim; // x image - software fallback
+
+ unsigned char misses; // number of sync misses
+
+ Ecore_X_Window_Attributes initial_attributes;
+
+ unsigned int move_counter; //reduce X calls when moving a window
+ unsigned int internal_props_set; //don't need to refetch our own internal props
+
+ Eina_Bool moving : 1;
+ Eina_Bool first_map : 1;
+ Eina_Bool change_icon : 1;
+ Eina_Bool need_reparent : 1;
+ Eina_Bool reparented : 1;
+ Eina_Bool deleted : 1;
+ Eina_Bool button_grabbed : 1;
+ Eina_Bool fetch_exe : 1;
+ Eina_Bool set_win_type : 1;
+ Eina_Bool frame_update : 1;
+ Eina_Bool evas_init : 1;
+};
+
+static Ecore_X_Time focus_time = 0;
+static Eina_List *handlers = NULL;
+static Eina_Hash *clients_win_hash = NULL;
+static Eina_Hash *damages_hash = NULL;
+static Eina_Hash *frame_extents = NULL;
+static Eina_Hash *alarm_hash = NULL;
+
+static Ecore_Idle_Enterer *_e_comp_x_post_client_idler = NULL;
+static Eina_List *post_clients = NULL;
+
+static int _e_comp_x_mapping_change_disabled = 0;
+
+static Ecore_X_Randr_Screen_Size screen_size = { -1, -1 };
+static int screen_size_index = -1;
+
+static inline Ecore_X_Window
+_e_comp_x_client_window_get(const E_Client *ec)
+{
+ if (ec->comp_data->reparented)
+ return e_client_util_pwin_get(ec);
+ return e_client_util_win_get(ec);
+}
+
+static void
+_e_comp_x_client_damage_add(E_Client *ec)
+{
+ Ecore_X_Window win;
+
+ if (ec->comp_data->damage) return;
+ win = _e_comp_x_client_window_get(ec);
+ ec->comp_data->damage = ecore_x_damage_new(win, ECORE_X_DAMAGE_REPORT_DELTA_RECTANGLES);
+ eina_hash_add(damages_hash, &ec->comp_data->damage, ec);
+}
+
+static void
+_e_comp_x_focus_check(E_Comp *comp)
+{
+ E_Client *focused;
+
+ if (stopping) return;
+ focused = e_client_focused_get();
+ /* if there is no new focused or it is a non-X client,
+ * focus comp canvas on focus-out */
+ if ((!focused) || (e_pixmap_type_get(focused->pixmap) != E_PIXMAP_TYPE_X))
+ e_grabinput_focus(comp->ee_win, E_FOCUS_METHOD_PASSIVE);
+}
+
+static void
+_e_comp_x_client_frame_update(E_Client *ec, int l, int r, int t, int b)
+{
+ ecore_x_netwm_frame_size_set(e_client_util_win_get(ec), l, r, t, b);
+ ecore_x_e_frame_size_set(e_client_util_win_get(ec), l, r, t, b);
+ ec->comp_data->frame_update = 0;
+}
+
+static void
+_e_comp_x_client_event_free(void *d EINA_UNUSED, void *e)
+{
+ E_Event_Client *ev = e;
+
+ e_object_unref(E_OBJECT(ev->ec));
+ free(ev);
+}
+
+static void
+_e_comp_x_print_win(Ecore_X_Window win)
+{
+ int x, y, w, h;
+ Eina_Bool vis;
+
+ ecore_x_window_geometry_get(win, &x, &y, &w, &h);
+ vis = ecore_x_window_visible_get(win);
+ fprintf(stderr, "%s 0x%x: %d,%d @ %dx%d\n", vis ? "VIS" : "HID", win, x, y, w, h);
+}
+
+
+static void
+_e_comp_x_focus_setup(E_Client *ec)
+{
+ if (ec->comp_data->button_grabbed) return;
+ if (!((e_client_focus_policy_click(ec)) ||
+ (e_config->always_click_to_raise) ||
+ (e_config->always_click_to_focus))) return;
+
+ ecore_x_window_button_grab(e_client_util_pwin_get(ec), 1,
+ ECORE_X_EVENT_MASK_MOUSE_DOWN |
+ ECORE_X_EVENT_MASK_MOUSE_UP |
+ ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
+ ecore_x_window_button_grab(e_client_util_pwin_get(ec), 2,
+ ECORE_X_EVENT_MASK_MOUSE_DOWN |
+ ECORE_X_EVENT_MASK_MOUSE_UP |
+ ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
+ ecore_x_window_button_grab(e_client_util_pwin_get(ec), 3,
+ ECORE_X_EVENT_MASK_MOUSE_DOWN |
+ ECORE_X_EVENT_MASK_MOUSE_UP |
+ ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
+ ec->comp_data->button_grabbed = 1;
+}
+
+
+static void
+_e_comp_x_focus_setdown(E_Client *ec)
+{
+ Ecore_X_Window win = e_client_util_pwin_get(ec);
+
+ if (!ec->comp_data->button_grabbed) return;
+ e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, win);
+ e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, win);
+ ecore_x_window_button_ungrab(win, 1, 0, 1);
+ ecore_x_window_button_ungrab(win, 2, 0, 1);
+ ecore_x_window_button_ungrab(win, 3, 0, 1);
+ e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, win);
+ e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, win);
+ ec->comp_data->button_grabbed = 0;
+}
+
+static Eina_Bool
+_e_comp_x_client_new_helper(E_Client *ec)
+{
+ Ecore_X_Window win = e_client_util_win_get(ec);
+ int at_num = 0, i;
+ Ecore_X_Atom *atoms;
+
+ if (!ecore_x_window_attributes_get(win, &ec->comp_data->initial_attributes))
+ {
+ //CRI("OUCH! FIX THIS!");
+ e_object_del(E_OBJECT(ec));
+ return EINA_FALSE;
+ }
+ if (ec->re_manage && (!ec->comp_data->initial_attributes.visible))
+ {
+ /* ain't gonna be no hidden clients on my watch! */
+ e_object_del(E_OBJECT(ec));
+ return EINA_FALSE;
+ }
+ ec->depth = ec->comp_data->initial_attributes.depth;
+ ec->override = ec->comp_data->initial_attributes.override;
+ ec->input_only = ec->comp_data->initial_attributes.input_only;
+ ec->border_size = ec->comp_data->initial_attributes.border;
+ ec->icccm.accepts_focus = (!ec->override) && (!ec->input_only);
+ //INF("NEW CLIENT: %d,%d -> %d,%d", ec->x, ec->y, ec->comp_data->initial_attributes.x, ec->comp_data->initial_attributes.y);
+ ec->x = ec->client.x = ec->comp_data->initial_attributes.x;
+ ec->y = ec->client.y = ec->comp_data->initial_attributes.y;
+ if (ec->override && ((ec->x == -77) && (ec->y == -777)))
+ {
+ /* this is the ecore-x private window :/ */
+ e_comp_ignore_win_add(E_PIXMAP_TYPE_X, win);
+ e_object_del(E_OBJECT(ec));
+ return EINA_FALSE;
+ }
+ if ((!e_client_util_ignored_get(ec)) && (!ec->internal) && (!ec->internal_ecore_evas))
+ {
+ ec->comp_data->need_reparent = 1;
+ EC_CHANGED(ec);
+ ec->take_focus = 1;
+ }
+ ec->w = ec->client.w = ec->comp_data->initial_attributes.w;
+ ec->h = ec->client.h = ec->comp_data->initial_attributes.h;
+ ec->changes.size = 1;
+
+
+ e_pixmap_visual_cmap_set(ec->pixmap, ec->comp_data->initial_attributes.visual, ec->comp_data->initial_attributes.colormap);
+ if (ec->override && (!(ec->comp_data->initial_attributes.event_mask.mine & ECORE_X_EVENT_MASK_WINDOW_PROPERTY)))
+ ecore_x_event_mask_set(win, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
+
+ atoms = ecore_x_window_prop_list(win, &at_num);
+ ec->icccm.fetch.command = 1;
+
+ if (atoms)
+ {
+ Eina_Bool video_parent = EINA_FALSE;
+ Eina_Bool video_position = EINA_FALSE;
+
+ /* icccm */
+ for (i = 0; i < at_num; i++)
+ {
+ if (atoms[i] == ECORE_X_ATOM_WM_NAME)
+ ec->icccm.fetch.title = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_CLASS)
+ ec->icccm.fetch.name_class = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_ICON_NAME)
+ ec->icccm.fetch.icon_name = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_MACHINE)
+ ec->icccm.fetch.machine = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_HINTS)
+ ec->icccm.fetch.hints = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_NORMAL_HINTS)
+ ec->icccm.fetch.size_pos_hints = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_PROTOCOLS)
+ ec->icccm.fetch.protocol = 1;
+ else if (atoms[i] == ECORE_X_ATOM_MOTIF_WM_HINTS)
+ ec->mwm.fetch.hints = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_TRANSIENT_FOR)
+ {
+ ec->icccm.fetch.transient_for = 1;
+ ec->netwm.fetch.type = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_LEADER)
+ ec->icccm.fetch.client_leader = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_WINDOW_ROLE)
+ ec->icccm.fetch.window_role = 1;
+ else if (atoms[i] == ECORE_X_ATOM_WM_STATE)
+ ec->icccm.fetch.state = 1;
+ }
+ /* netwm, loop again, netwm will ignore some icccm, so we
+ * have to be sure that netwm is checked after */
+ for (i = 0; i < at_num; i++)
+ {
+ if (atoms[i] == ECORE_X_ATOM_NET_WM_NAME)
+ {
+ /* Ignore icccm */
+ ec->icccm.fetch.title = 0;
+ ec->netwm.fetch.name = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON_NAME)
+ {
+ /* Ignore icccm */
+ ec->icccm.fetch.icon_name = 0;
+ ec->netwm.fetch.icon_name = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON)
+ {
+ ec->netwm.fetch.icon = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_NET_WM_USER_TIME)
+ {
+ ec->netwm.fetch.user_time = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT)
+ {
+ DBG("ECORE_X_ATOM_NET_WM_STRUT");
+ ec->netwm.fetch.strut = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL)
+ {
+ DBG("ECORE_X_ATOM_NET_WM_STRUT_PARTIAL");
+ ec->netwm.fetch.strut = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_TYPE)
+ {
+ /* Ignore mwm
+ ec->mwm.fetch.hints = 0;
+ */
+ ec->netwm.fetch.type = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_NET_WM_STATE)
+ {
+ ec->netwm.fetch.state = 1;
+ }
+ else if (atoms[i] == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY)
+ ec->netwm.fetch.opacity = 1;
+ }
+ /* other misc atoms */
+ for (i = 0; i < at_num; i++)
+ {
+ /* loop to check for own atoms */
+ if (atoms[i] == E_ATOM_WINDOW_STATE)
+ {
+ ec->e.fetch.state = 1;
+ }
+ /* loop to check for qtopia atoms */
+ if (atoms[i] == ATM__QTOPIA_SOFT_MENU)
+ ec->qtopia.fetch.soft_menu = 1;
+ else if (atoms[i] == ATM__QTOPIA_SOFT_MENUS)
+ ec->qtopia.fetch.soft_menus = 1;
+ /* loop to check for vkbd atoms */
+ else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
+ ec->vkbd.fetch.state = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD)
+ ec->vkbd.fetch.vkbd = 1;
+ /* loop to check for illume atoms */
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_CONFORMANT)
+ ec->illume.conformant.fetch.conformant = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE)
+ ec->illume.quickpanel.fetch.state = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL)
+ ec->illume.quickpanel.fetch.quickpanel = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR)
+ ec->illume.quickpanel.fetch.priority.major = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR)
+ ec->illume.quickpanel.fetch.priority.minor = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE)
+ ec->illume.quickpanel.fetch.zone = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED)
+ ec->illume.drag.fetch.locked = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_DRAG)
+ ec->illume.drag.fetch.drag = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
+ ec->illume.win_state.fetch.state = 1;
+ else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_PARENT)
+ video_parent = EINA_TRUE;
+ else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_POSITION)
+ video_position = EINA_TRUE;
+ /* loop to check for window profile list atom */
+ else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED)
+ ec->e.fetch.profile = 1;
+ }
+ if (video_position && video_parent)
+ {
+ ec->e.state.video = 1;
+ ec->e.fetch.video_parent = 1;
+ ec->e.fetch.video_position = 1;
+ fprintf(stderr, "We found a video window \\o/ %x\n", win);
+ }
+ free(atoms);
+ }
+
+ return EINA_TRUE;
+}
+
+static E_Client *
+_e_comp_x_client_find_by_damage(Ecore_X_Damage damage)
+{
+ return eina_hash_find(damages_hash, &damage);
+}
+
+static E_Client *
+_e_comp_x_client_find_by_window(Ecore_X_Window win)
+{
+ E_Client *ec;
+
+ ec = eina_hash_find(clients_win_hash, &win);
+ if (ec && e_object_is_del(E_OBJECT(ec))) ec = NULL;
+ return ec;
+}
+
+/*
+static E_Client *
+_e_comp_x_client_find_all_by_window(Ecore_X_Window win)
+{
+ return eina_hash_find(clients_win_hash, &win);
+}
+*/
+
+static void
+_e_comp_x_add_fail_job(void *d EINA_UNUSED)
+{
+ e_util_dialog_internal
+ (_("Compositor Warning"),
+ _("Your display driver does not support OpenGL, GLSL<br>"
+ "shaders or no OpenGL engines were compiled or installed<br>"
+ "for Evas or Ecore-Evas. Falling back to software engine.<br>"
+ "<br>"
+ "You will need an OpenGL 2.0 (or OpenGL ES 2.0) capable<br>"
+ "GPU to use OpenGL with compositing."));
+}
+
+static void
+_pri_adj(int pid, int set, int adj, Eina_Bool use_adj, Eina_Bool adj_children, Eina_Bool do_children)
+{
+ int newpri = set;
+
+ if (use_adj) newpri = getpriority(PRIO_PROCESS, pid) + adj;
+ setpriority(PRIO_PROCESS, pid, newpri);
+// shouldnt need to do this as default ionice class is "none" (0), and
+// this inherits io priority FROM nice level
+// ioprio_set(IOPRIO_WHO_PROCESS, pid,
+// IOPRIO_PRIO_VALUE(2, 5));
+ if (do_children)
+ {
+ Eina_List *files;
+ char *file, buf[PATH_MAX];
+ FILE *f;
+ int pid2, ppid;
+
+ // yes - this is /proc specific... so this may not work on some
+ // os's - works on linux. too bad for others.
+ files = ecore_file_ls("/proc");
+ EINA_LIST_FREE(files, file)
+ {
+ if (isdigit(file[0]))
+ {
+ snprintf(buf, sizeof(buf), "/proc/%s/stat", file);
+ f = fopen(buf, "r");
+ if (f)
+ {
+ pid2 = -1;
+ ppid = -1;
+ if (fscanf(f, "%i %*s %*s %i %*s", &pid2, &ppid) == 2)
+ {
+ fclose(f);
+ if (ppid == pid)
+ {
+ if (adj_children)
+ _pri_adj(pid2, set, adj, EINA_TRUE,
+ adj_children, do_children);
+ else
+ _pri_adj(pid2, set, adj, use_adj,
+ adj_children, do_children);
+ }
+ }
+ else fclose(f);
+ }
+ }
+ free(file);
+ }
+ }
+}
+
+static E_Client *
+_e_comp_x_client_find_by_alarm(Ecore_X_Sync_Alarm al)
+{
+ return eina_hash_find(alarm_hash, &al);
+}
+
+static void
+_e_comp_x_client_move_resize_send(E_Client *ec)
+{
+ if (ec->internal_ecore_evas)
+ ecore_evas_managed_move(ec->internal_ecore_evas, ec->client.x - ec->x, ec->client.y - ec->y);
+
+ ecore_x_icccm_move_resize_send(e_client_util_win_get(ec), ec->client.x, ec->client.y, ec->client.w, ec->client.h);
+}
+
+static Eina_Bool
+_e_comp_x_post_client_idler_cb(void *d EINA_UNUSED)
+{
+ E_Client *ec;
+ const Eina_List *l;
+ E_Comp *c;
+
+ //INF("POST IDLER");
+ EINA_LIST_FREE(post_clients, ec)
+ {
+ Ecore_X_Window win, twin;
+
+ if (e_object_is_del(E_OBJECT(ec)) || (!ec->comp_data)) continue;
+ win = _e_comp_x_client_window_get(ec);
+ if (ec->post_move)
+ {
+ E_Client *tmp;
+
+ EINA_LIST_FOREACH(ec->e.state.video_child, l, tmp)
+ {
+ twin = _e_comp_x_client_window_get(tmp);
+ ecore_x_window_move(twin,
+ ec->client.x +
+ tmp->e.state.video_position.x,
+ ec->client.y +
+ tmp->e.state.video_position.y);
+ }
+ }
+ if (ec->e.state.video)
+ {
+ E_Client *parent;
+
+ parent = ec->e.state.video_parent_client;
+ twin = _e_comp_x_client_window_get(parent);
+ ecore_x_window_move(twin,
+ parent->client.x +
+ ec->e.state.video_position.x,
+ parent->client.y +
+ ec->e.state.video_position.y);
+ }
+ else if (ec->shading)
+ {
+ // do nothing
+ }
+ else if ((ec->post_move) && (ec->post_resize))
+ {
+ //INF("X MVRSZ");
+ ecore_x_window_move_resize(win,
+ ec->client.x,
+ ec->client.y,
+ ec->client.w,
+ ec->client.h);
+ if (ec->comp_data->reparented)
+ ecore_x_window_resize(e_client_util_win_get(ec),
+ ec->client.w,
+ ec->client.h);
+ }
+ else if (ec->post_move)
+ {
+ //INF("X MV");
+ ecore_x_window_move(win, ec->client.x, ec->client.y);
+ }
+ else if (ec->post_resize)
+ {
+ //INF("X RSZ: %dx%d (REAL: %dx%d)", ec->client.w, ec->client.h, ec->w, ec->h);
+ ecore_x_window_resize(win,
+ ec->client.w, ec->client.h);
+ if (ec->comp_data->reparented)
+ ecore_x_window_resize(e_client_util_win_get(ec),
+ ec->client.w, ec->client.h);
+ }
+ if ((!ec->shading) && (!ec->shaded))
+ {
+ if (ec->post_resize)
+ {
+ if (ec->netwm.sync.request)
+ {
+ //INF("NETWM SYNC: %p", ec);
+ ec->netwm.sync.wait++;
+ ecore_x_netwm_sync_request_send(e_client_util_win_get(ec),
+ ec->netwm.sync.serial++);
+ }
+ }
+
+ if (ec->post_move || ec->post_resize)
+ _e_comp_x_client_move_resize_send(ec);
+ }
+
+ if (ec->e.state.video)
+ {
+ fprintf(stderr, "VIDEO %p: [%i, %i] [%i, %i]\n",
+ ec,
+ ec->e.state.video_parent_client->client.x +
+ ec->e.state.video_position.x,
+ ec->e.state.video_parent_client->client.y +
+ ec->e.state.video_position.y,
+ ec->w, ec->h);
+ }
+ if (ec->netwm.opacity_changed)
+ {
+ unsigned int opacity;
+ int op;
+
+ evas_object_color_get(ec->frame, NULL, NULL, NULL, &op);
+ ec->netwm.opacity = op;
+ opacity = (op << 24);
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ec), ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, &opacity, 1);
+ /* flag gets unset in property cb to avoid fetching opacity after we just set it */
+ }
+ ec->post_move = 0;
+ ec->post_resize = 0;
+ }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ if (c->comp_data->restack && (!c->new_clients))
+ {
+ e_hints_client_stacking_set();
+ c->comp_data->restack = 0;
+ }
+ _e_comp_x_post_client_idler = NULL;
+ return EINA_FALSE;
+}
+
+static void
+_e_comp_x_post_client_idler_add(E_Client *ec)
+{
+ if (!_e_comp_x_post_client_idler)
+ _e_comp_x_post_client_idler = ecore_idle_enterer_add(_e_comp_x_post_client_idler_cb, NULL);
+ if (!ec) CRI("ACK!");
+ //INF("POST IDLE: %p", ec);
+ if (!eina_list_data_find(post_clients, ec))
+ post_clients = eina_list_append(post_clients, ec);
+}
+
+static void
+_e_comp_x_client_stack(E_Client *ec)
+{
+ E_Client *ec2;
+ Ecore_X_Window_Stack_Mode mode = ECORE_X_WINDOW_STACK_BELOW;
+ Ecore_X_Window win = 0;
+ Eina_List *l;
+
+ if (ec->override && (!ec->internal)) return; //can't restack these
+
+ ecore_x_window_shadow_tree_flush();
+
+ /* try stacking below */
+ ec2 = e_client_above_get(ec);
+ if (ec2)
+ {
+ if (ec2->layer == ec->layer)
+ win = _e_comp_x_client_window_get(ec2);
+ }
+
+ /* try stacking above */
+ if (!win)
+ {
+ ec2 = e_client_below_get(ec);
+ if (ec2 && (ec2->layer == ec->layer))
+ {
+ win = _e_comp_x_client_window_get(ec2);
+ mode = ECORE_X_WINDOW_STACK_ABOVE;
+ }
+ }
+
+ /* just layer stack */
+ if (!win)
+ {
+ win = ec->comp->layers[e_comp_canvas_layer_map(ec->layer)].win;
+ mode = ECORE_X_WINDOW_STACK_BELOW;
+ }
+ ecore_x_window_configure(_e_comp_x_client_window_get(ec),
+ ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
+ ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
+ 0, 0, 0, 0, 0, win, mode);
+ _e_comp_x_post_client_idler_add(ec);
+ ec->comp->comp_data->restack = 1;
+ EINA_LIST_FOREACH(ec->e.state.video_child, l, ec2)
+ evas_object_stack_below(ec2->frame, ec->frame);
+}
+
+static E_Client *
+_e_comp_x_client_new(E_Comp *c, Ecore_X_Window win, Eina_Bool first)
+{
+ E_Pixmap *cp;
+ E_Client *ec;
+
+ cp = e_pixmap_new(E_PIXMAP_TYPE_X, win);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, NULL);
+
+ ec = e_client_new(c, cp, first, 0);
+ return ec;
+}
+
+static void
+_e_comp_x_client_pri_raise(E_Client *ec)
+{
+ if (ec->netwm.pid <= 0) return;
+ if (ec->netwm.pid == getpid()) return;
+ _pri_adj(ec->netwm.pid,
+ e_config->priority - 1, -1, EINA_FALSE,
+// EINA_TRUE, EINA_TRUE);
+ EINA_TRUE, EINA_FALSE);
+// printf("WIN: pid %i, title %s (HI!!!!!!!!!!!!!!!!!!)\n",
+// ec->netwm.pid, e_client_name_get(ec));
+}
+
+static void
+_e_comp_x_client_pri_norm(E_Client *ec)
+{
+ if (ec->netwm.pid <= 0) return;
+ if (ec->netwm.pid == getpid()) return;
+ _pri_adj(ec->netwm.pid,
+ e_config->priority, 1, EINA_FALSE,
+// EINA_TRUE, EINA_TRUE);
+ EINA_TRUE, EINA_FALSE);
+// printf("WIN: pid %i, title %s (NORMAL)\n",
+// ec->netwm.pid, e_client_name_get(ec));
+}
+
+static void
+_e_comp_x_client_shape_input_rectangle_set(E_Client *ec)
+{
+ Ecore_X_Window win = e_client_util_pwin_get(ec);
+
+ if (!ec->comp_data->reparented) return;
+
+ if (ec->shaped_input)
+ ecore_x_composite_window_events_disable(win);
+ else
+ {
+ if (ec->visible && (!ec->comp_hidden))
+ ecore_x_composite_window_events_enable(win);
+ else
+ ecore_x_composite_window_events_disable(win);
+ }
+}
+
+static void
+_e_comp_x_evas_color_set_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+ int a;
+
+ evas_object_color_get(obj, NULL, NULL, NULL, &a);
+ if (a == ec->netwm.opacity) return;
+ ec->netwm.opacity_changed = 1;
+ _e_comp_x_post_client_idler_add(ec);
+}
+
+static void
+_e_comp_x_evas_ping_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ ecore_x_netwm_ping_send(e_client_util_win_get(ec));
+}
+
+static void
+_e_comp_x_evas_kill_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ ecore_x_kill(e_client_util_win_get(ec));
+}
+
+static void
+_e_comp_x_evas_delete_request_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ if (ec->netwm.ping)
+ e_client_ping(ec);
+ ecore_x_window_delete_request_send(e_client_util_win_get(ec));
+}
+
+static void
+_e_comp_x_evas_comp_hidden_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *tmp, *ec = data;
+ Eina_List *l;
+ Ecore_X_Window win;
+
+ if (ec->comp_data->need_reparent) return;
+ win = _e_comp_x_client_window_get(ec);
+
+ EINA_LIST_FOREACH(ec->e.state.video_child, l, tmp)
+ {
+ Ecore_X_Window cwin;
+
+ cwin = _e_comp_x_client_window_get(tmp);
+ if (ec->comp_hidden)
+ ecore_x_window_hide(cwin);
+ else
+ ecore_x_window_show(cwin);
+ }
+
+ if (ec->comp_hidden)
+ ecore_x_composite_window_events_disable(win);
+ else
+ ecore_x_composite_window_events_enable(win);
+ ecore_x_window_ignore_set(win, ec->comp_hidden);
+}
+
+static void
+_e_comp_x_evas_shade_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+ Eina_List *l;
+ E_Client *tmp;
+
+ EINA_LIST_FOREACH(ec->e.state.video_child, l, tmp)
+ ecore_x_window_hide(e_client_util_pwin_get(tmp));
+
+ ecore_x_window_shadow_tree_flush();
+}
+
+static void
+_e_comp_x_evas_frame_recalc_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ E_Client *ec = data;
+ E_Comp_Object_Frame *fr = event_info;
+
+ if (evas_object_visible_get(obj))
+ _e_comp_x_client_frame_update(ec, fr->l, fr->r, fr->t, fr->b);
+ else
+ ec->comp_data->frame_update = 1;
+}
+
+static void
+_e_comp_x_evas_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ if (ec->comp_data->moving)
+ {
+ if (ec->comp_data->move_counter++ < MOVE_COUNTER_LIMIT) return;
+ ec->comp_data->move_counter = 0;
+ }
+
+ ecore_x_window_shadow_tree_flush();
+ ec->post_move = 1;
+ _e_comp_x_post_client_idler_add(ec);
+}
+
+static void
+_e_comp_x_evas_resize_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ if (ec->shading || ec->shaded) return;
+ if (!e_pixmap_size_changed(ec->pixmap, ec->client.w, ec->client.h)) return;
+
+ ecore_x_window_shadow_tree_flush();
+
+ if (ec->e.state.video)
+ {
+ if (ec->e.state.video_position.updated)
+ {
+ ecore_x_window_move(e_client_util_pwin_get(ec),
+ ec->e.state.video_parent_client->client.x +
+ ec->e.state.video_position.x,
+ ec->e.state.video_parent_client->client.y +
+ ec->e.state.video_position.y);
+ ec->e.state.video_position.updated = 0;
+ }
+ }
+ else if (ec->changes.pos)
+ {
+ E_Client *tmp;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(ec->e.state.video_child, l, tmp)
+ ecore_x_window_move(e_client_util_pwin_get(tmp),
+ ec->client.x + tmp->e.state.video_position.x,
+ ec->client.y + tmp->e.state.video_position.y);
+ }
+
+ ec->post_resize = 1;
+ e_pixmap_dirty(ec->pixmap);
+ e_comp_object_render_update_del(ec->frame);
+ _e_comp_x_post_client_idler_add(ec);
+}
+
+static void
+_e_comp_x_evas_hide_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data, *tmp;
+ unsigned int visible = 0;
+ Eina_List *l;
+
+ if (!ec->comp_data) return; // already deleted, happens with internal wins
+ ecore_x_window_shadow_tree_flush();
+ if (!ec->iconic)
+ {
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_MAPPED, &visible, 1);
+ e_hints_window_hidden_set(ec);
+ }
+
+ EINA_LIST_FOREACH(ec->e.state.video_child, l, tmp)
+ evas_object_hide(tmp->frame);
+
+ if (e_comp_config_get()->send_flush)
+ ecore_x_e_comp_flush_send(e_client_util_pwin_get(ec));
+ if (e_comp_config_get()->send_dump)
+ ecore_x_e_comp_dump_send(e_client_util_pwin_get(ec));
+}
+
+static void
+_e_comp_x_evas_show_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data, *tmp;
+ unsigned int visible = 1;
+ Ecore_X_Window win;
+ Eina_List *l;
+
+ if (!ec->comp_data) return;
+ win = e_client_util_win_get(ec);
+ ecore_x_window_shadow_tree_flush();
+ if (!ec->comp_data->need_reparent)
+ ecore_x_window_show(win);
+ e_hints_window_visible_set(ec);
+
+ ecore_x_window_prop_card32_set(win, E_ATOM_MAPPED, &visible, 1);
+ ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &visible, 1);
+
+ if (ec->comp_data->frame_update)
+ {
+ int ll, r, t, b;
+
+ e_comp_object_frame_geometry_get(obj, &ll, &r, &t, &b);
+ _e_comp_x_client_frame_update(ec, ll, r, t, b);
+ }
+
+ EINA_LIST_FOREACH(ec->e.state.video_child, l, tmp)
+ {
+ evas_object_show(tmp->frame);
+ ecore_x_window_show(e_client_util_pwin_get(tmp));
+ }
+}
+
+static void
+_e_comp_x_evas_stack_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ if (evas_object_data_get(obj, "client_restack"))
+ _e_comp_x_client_stack(data);
+}
+
+static void
+_e_comp_x_evas_unfullscreen_zoom_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+
+ if ((screen_size.width != -1) && (screen_size.height != -1))
+ {
+ ecore_x_randr_screen_primary_output_size_set(ec->comp->man->root,
+ screen_size_index);
+ screen_size.width = -1;
+ screen_size.height = -1;
+ }
+}
+
+static void
+_e_comp_x_evas_fullscreen_zoom_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Client *ec = data;
+ Ecore_X_Randr_Screen_Size_MM *sizes;
+ int num_sizes, i, best_size_index = 0;
+
+ ecore_x_randr_screen_primary_output_current_size_get(ec->comp->man->root,
+ &screen_size.width,
+ &screen_size.height,
+ NULL, NULL, NULL);
+ sizes = ecore_x_randr_screen_primary_output_sizes_get(ec->comp->man->root,
+ &num_sizes);
+ if (sizes)
+ {
+ Ecore_X_Randr_Screen_Size best_size = { -1, -1 };
+ int best_dist = INT_MAX, dist;
+
+ for (i = 0; i < num_sizes; i++)
+ {
+ if ((sizes[i].width > ec->w) && (sizes[i].height > ec->h))
+ {
+ dist = (sizes[i].width * sizes[i].height) - (ec->w * ec->h);
+ if (dist < best_dist)
+ {
+ best_size.width = sizes[i].width;
+ best_size.height = sizes[i].height;
+ best_dist = dist;
+ best_size_index = i;
+ }
+ }
+ }
+ if (((best_size.width != -1) && (best_size.height != -1)) &&
+ ((best_size.width != screen_size.width) ||
+ (best_size.height != screen_size.height)))
+ {
+ if (ecore_x_randr_screen_primary_output_size_set(ec->comp->man->root,
+ best_size_index))
+ screen_size_index = best_size_index;
+ evas_object_geometry_set(ec->frame, 0, 0, best_size.width, best_size.height);
+ }
+ else
+ {
+ screen_size.width = -1;
+ screen_size.height = -1;
+ evas_object_geometry_set(ec->frame, 0, 0, ec->zone->w, ec->zone->h);
+ }
+ free(sizes);
+ }
+ else
+ evas_object_geometry_set(ec->frame, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h);
+}
+
+static Eina_Bool
+_e_comp_x_destroy(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Destroy *ev)
+{
+ E_Client *ec;
+
+ //INF("X DESTROY: %u", ev->win);
+ e_comp_ignore_win_del(E_PIXMAP_TYPE_X, ev->win);
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ if (ec->comp_data)
+ {
+ if (ec->comp_data->reparented)
+ e_client_comp_hidden_set(ec, 1);
+ evas_object_pass_events_set(ec->frame, 1);
+ evas_object_hide(ec->frame);
+ ec->comp_data->deleted = 1;
+ e_object_del(E_OBJECT(ec));
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_resize_request(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Resize_Request *ev)
+{
+ E_Client *ec;
+ int w, h;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec)
+ {
+ if (!e_comp_find_by_window(ev->win)) ecore_x_window_resize(ev->win, ev->w, ev->h);
+ return ECORE_CALLBACK_PASS_ON;
+ }
+ w = ev->w, h = ev->h;
+ if (ec->zone && (e_config->geometry_auto_resize_limit == 1))
+ {
+ int zx, zy, zw, zh;
+
+ e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
+ if (w > zw)
+ w = zw;
+
+ if (h > zh)
+ h = zh;
+ }
+ if ((w != ec->w) || (h != ec->h))
+ evas_object_resize(ec->frame, w, h);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_e_comp_x_client_evas_init(E_Client *ec)
+{
+ ec->comp_data->evas_init = 1;
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_comp_x_evas_stack_cb, ec);
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_comp_x_evas_show_cb, ec);
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_comp_x_evas_hide_cb, ec);
+ if (!ec->override)
+ {
+ evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_comp_x_evas_move_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "client_resize", _e_comp_x_evas_resize_cb, ec);
+ }
+ evas_object_smart_callback_add(ec->frame, "frame_recalc_done", _e_comp_x_evas_frame_recalc_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "shade_done", _e_comp_x_evas_shade_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "comp_hidden", _e_comp_x_evas_comp_hidden_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "delete_request", _e_comp_x_evas_delete_request_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "kill_request", _e_comp_x_evas_kill_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "ping", _e_comp_x_evas_ping_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "color_set", _e_comp_x_evas_color_set_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "fullscreen_zoom", _e_comp_x_evas_fullscreen_zoom_cb, ec);
+ evas_object_smart_callback_add(ec->frame, "unfullscreen_zoom", _e_comp_x_evas_unfullscreen_zoom_cb, ec);
+ /* force apply this since we haven't set up our smart cb previously */
+ _e_comp_x_evas_comp_hidden_cb(ec, NULL, NULL);
+}
+
+static Eina_Bool
+_e_comp_x_show_request(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Show_Request *ev)
+{
+ E_Client *ec;
+ E_Comp *c;
+
+ //INF("X SHOW REQ: %u", ev->win);
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ c = e_comp_find_by_window(ev->parent);
+ if (e_comp_ignore_win_find(ev->win) ||
+ (ec && (ec->ignored || ec->override)) ||
+ (!c) || (ev->parent != c->man->root))
+ {
+ ecore_x_window_show(ev->win);
+ return ECORE_CALLBACK_RENEW;
+ }
+ if (!ec)
+ ec = _e_comp_x_client_new(c, ev->win, 0);
+ if (!ec)
+ {
+ ecore_x_window_show(ev->win);
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ if ((!ec->comp_data->reparented) && (!e_client_util_ignored_get(ec)))
+ {
+ if (!ec->override)
+ ec->comp_data->need_reparent = 1;
+ ec->visible = 1;
+ EC_CHANGED(ec);
+ return ECORE_CALLBACK_RENEW;
+ }
+ if (ec->iconic)
+ {
+ if (!ec->lock_client_iconify)
+ e_client_uniconify(ec);
+ }
+ else
+ {
+ /* FIXME: make client "urgent" for a bit - it wants attention */
+ /* e_client_show(ec); */
+ if (!ec->lock_client_stacking)
+ evas_object_raise(ec->frame);
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_show(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Show *ev)
+{
+ E_Client *ec;
+ E_Comp *c;
+
+ //INF("X SHOW: %u", ev->win);
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec)
+ {
+ if (e_comp_ignore_win_find(ev->win)) return ECORE_CALLBACK_RENEW;
+ c = e_comp_find_by_window(ev->event_win);
+ if (!c) return ECORE_CALLBACK_RENEW;
+ if (ev->event_win != c->man->root) return ECORE_CALLBACK_RENEW;
+ if ((c->win == ev->win) || (c->ee_win == ev->win) ||
+ (c->man->root == ev->win) || (c->cm_selection == ev->win)) return ECORE_CALLBACK_RENEW;
+ /* some window which we haven't made a client for yet but need to */
+ ec = _e_comp_x_client_new(c, ev->win, 0);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ }
+ else if (e_object_is_del(E_OBJECT(ec)) || ec->already_unparented)
+ return ECORE_CALLBACK_RENEW;
+ if ((!ec->override) && (!ec->re_manage) && (!ec->comp_data->first_map) &&
+ (!ec->comp_data->reparented) && (!ec->comp_data->need_reparent))
+ {
+ /* this is most likely an internal window */
+ ec->comp_data->need_reparent = 1;
+ ec->visible = 1;
+ if (ec->internal_ecore_evas)
+ ec->take_focus = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ec->override)
+ {
+ ec->changes.visible = ec->visible = 1;
+ EC_CHANGED(ec);
+ if (!ec->comp_data->first_map)
+ _e_comp_x_client_evas_init(ec);
+ }
+ if (!ec->input_only)
+ _e_comp_x_client_damage_add(ec);
+ if (!ec->comp_data->need_reparent)
+ {
+ e_pixmap_usable_set(ec->pixmap, 1);
+ if (ec->hidden || ec->iconic)
+ {
+ evas_object_hide(ec->frame);
+ e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
+ }
+ else
+ evas_object_show(ec->frame);
+ ec->comp_data->first_map = 1;
+ if (ec->internal_ecore_evas)
+ {
+ _e_comp_x_post_client_idler_add(ec);
+ ec->post_move = 1;
+ ec->post_resize = 1;
+ ec->comp->comp_data->restack = 1;
+ }
+ }
+ if (ec->internal || (!ec->override))
+ _e_comp_x_client_stack(ec);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_hide(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Hide *ev)
+{
+ E_Client *ec;
+ Eina_Bool hid = EINA_FALSE;
+
+ //INF("X HIDE: %u", ev->win);
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_PASS_ON;
+ if (!ec->visible)
+ {
+ //INF("IGNORED");
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ if (ev->win != ev->event_win)
+ {
+ if ((!ec->override) && (!ev->send_event)) return ECORE_CALLBACK_PASS_ON;
+ }
+ if (ec->ignore_first_unmap > 0)
+ {
+ ec->ignore_first_unmap--;
+ return ECORE_CALLBACK_PASS_ON;
+ }
+ /* Don't delete hidden or iconified windows */
+ if ((ec->iconic) || (ec->await_hide_event > 0))
+ {
+ if (ec->await_hide_event > 0)
+ {
+ ec->await_hide_event--;
+ }
+ else
+ {
+ /* Only hide the border if it is visible */
+ hid = EINA_TRUE;
+ evas_object_hide(ec->frame);
+ }
+ }
+ else
+ {
+ hid = EINA_TRUE;
+ evas_object_hide(ec->frame);
+ if (!ec->internal)
+ e_object_del(E_OBJECT(ec));
+ }
+ if (hid)
+ _e_comp_x_focus_check(ec->comp);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_reparent(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Reparent *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if ((!ec) || (ev->win == e_client_util_pwin_get(ec))) return ECORE_CALLBACK_PASS_ON;
+ DBG("== repar [%u] to [%u]", ev->win, ev->parent);
+ if (ev->parent != e_client_util_pwin_get(ec))
+ {
+ e_pixmap_parent_window_set(ec->pixmap, ev->parent);
+ if (!e_object_is_del(E_OBJECT(ec)))
+ e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_configure(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Configure *ev)
+{
+ E_Client *ec;
+ E_Comp *c;
+ Eina_Bool move, resize;
+
+ c = e_comp_find_by_window(ev->win);
+ if (c)
+ {
+ e_manager_resize(c->man, ev->w, ev->h);
+ return ECORE_CALLBACK_RENEW;
+ }
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if ((!ec) || (!ec->override)) return ECORE_CALLBACK_PASS_ON;
+
+ //INF("configure %p: %d,%d %dx%d", ec, ev->x, ev->y, ev->w, ev->h);
+ if (ev->abovewin == 0)
+ {
+ if (e_client_below_get(ec))
+ evas_object_lower(ec->frame);
+ }
+ else
+ {
+ E_Client *ec2 = _e_comp_x_client_find_by_window(ev->abovewin);
+
+ if (ec2)
+ {
+ /* client(ec) wants to be above a layer client(ec2) */
+ if (e_client_util_is_stacking(ec2)) //is it a stacking placeholder window?
+ {
+ E_Client *ec3;
+
+ ec3 = e_client_above_get(ec2);
+ /* stack under next client(ec3) */
+ if (ec3)
+ {
+ evas_object_layer_set(ec->frame, ec3->layer);
+ if (!e_client_util_is_stacking(ec3))
+ evas_object_stack_below(ec->frame, ec3->frame);
+ }
+ else //force override to obey our stacking
+ evas_object_layer_set(ec->frame, ec2->layer);
+ }
+ else
+ {
+ evas_object_layer_set(ec->frame, ec2->layer);
+ evas_object_stack_above(ec->frame, ec2->frame);
+ }
+ }
+ }
+ move = (ec->client.x != ev->x) || (ec->client.y != ev->y);
+ resize = (ec->client.w != ev->w) || (ec->client.h != ev->h);
+ EINA_RECTANGLE_SET(&ec->client, ev->x, ev->y, ev->w, ev->h);
+ if (move)
+ evas_object_move(ec->frame, ev->x, ev->y);
+ if (resize)
+ {
+ e_pixmap_dirty(ec->pixmap);
+ evas_object_resize(ec->frame, ev->w, ev->h);
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_configure_request(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Configure_Request *ev)
+{
+ E_Client *ec;
+ Eina_Bool move = EINA_FALSE, resize = EINA_FALSE;
+ int ox, oy, ow, oh;
+ int x, y, w, h;
+
+ if (e_comp_find_by_window(ev->win)) return ECORE_CALLBACK_RENEW;
+ ec = _e_comp_x_client_find_by_window(ev->win);
+
+ /* pass through requests for windows we haven't/won't reparent yet */
+ if (ec && (!ec->comp_data->need_reparent) && (!ec->comp_data->reparented))
+ {
+ ec->comp_data->initial_attributes.x = ev->x;
+ ec->comp_data->initial_attributes.y = ev->y;
+ ec->w = ec->client.w = ec->comp_data->initial_attributes.w = ev->w;
+ ec->h = ec->client.h = ec->comp_data->initial_attributes.h = ev->h;
+ ec->border_size = ev->border;
+ ec->changes.size = 1;
+ ec = NULL;
+ }
+ if (!ec)
+ {
+ ecore_x_window_configure(ev->win, ev->value_mask,
+ ev->x, ev->y, ev->w, ev->h, ev->border,
+ ev->abovewin, ev->detail);
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ x = ox = ec->x;
+ y = oy = ec->y;
+ w = ow = ec->client.w;
+ h = oh = ec->client.h;
+
+ if ((ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_X) ||
+ (ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_Y))
+ {
+ int zx, zy, zw, zh, t, l;
+
+ e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
+ e_comp_object_frame_geometry_get(ec->frame, &l, NULL, &t, NULL);
+ if (ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_X)
+ {
+ if (e_config->screen_limits == E_SCREEN_LIMITS_WITHIN)
+ x = E_CLAMP(ev->x, zx, zx + zw - ec->w);
+ else
+ x = ev->x;
+ }
+ if (ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_Y)
+ {
+ if (e_config->screen_limits == E_SCREEN_LIMITS_WITHIN)
+ y = E_CLAMP(ev->y, zy, zy + zh - ec->h);
+ else
+ y = ev->y;
+ }
+ }
+
+ if ((ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W) ||
+ (ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H))
+ {
+ if (ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_W)
+ w = ev->w;
+ if (ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_H)
+ h = ev->h;
+ }
+
+ e_comp_object_frame_wh_adjust(ec->frame, w, h, &w, &h);
+
+ move = (x != ec->x) || (y != ec->y);
+ resize = (w != ec->w) || (h != ec->h);
+
+ if (move && (!ec->lock_client_location))
+ {
+ if ((ec->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
+ {
+ ec->saved.x = x;
+ ec->saved.y = y;
+ }
+ else
+ {
+ if (ec->zone)
+ {
+ /* client is completely outside the zone, policy does not allow */
+ if (((!E_INTERSECTS(x, y, ec->w, ec->h, ec->zone->x, ec->zone->y, ec->zone->w - 5, ec->zone->h - 5)) &&
+ (e_config->screen_limits != E_SCREEN_LIMITS_COMPLETELY)) ||
+ /* client is partly outside the zone, policy does not allow */
+ (((!E_INSIDE(x, y, ec->zone->x, ec->zone->y, ec->zone->w - 5, ec->zone->h - 5)) &&
+ (!E_INSIDE(x + ec->w, y, ec->zone->x, ec->zone->y, ec->zone->w - 5, ec->zone->h - 5)) &&
+ (!E_INSIDE(x, y + ec->h, ec->zone->x, ec->zone->y, ec->zone->w - 5, ec->zone->h - 5)) &&
+ (!E_INSIDE(x + ec->w, y + ec->h, ec->zone->x, ec->zone->y, ec->zone->w - 5, ec->zone->h - 5))) &&
+ (e_config->screen_limits == E_SCREEN_LIMITS_WITHIN))
+ )
+ e_comp_object_util_center(ec->frame);
+ else
+ evas_object_move(ec->frame, x, y);
+ }
+ else
+ {
+ evas_object_move(ec->frame, x, y);
+ }
+ }
+ }
+
+ if (resize && (!ec->lock_client_size))
+ {
+ if ((ec->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
+ {
+ ec->saved.w = w;
+ ec->saved.h = h;
+ }
+ else
+ {
+ evas_object_resize(ec->frame, w, h);
+ }
+ }
+ if (!ec->lock_client_stacking)
+ {
+ if ((ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE) &&
+ (ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING))
+ {
+ E_Client *oec;
+
+ if (ev->detail == ECORE_X_WINDOW_STACK_ABOVE)
+ {
+ oec = _e_comp_x_client_find_by_window(ev->abovewin);
+ if (oec)
+ {
+ evas_object_stack_above(ec->frame, oec->frame);
+ }
+ else
+ {
+ ecore_x_window_configure(e_client_util_pwin_get(ec),
+ ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
+ ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
+ 0, 0, 0, 0, 0,
+ ev->abovewin, ECORE_X_WINDOW_STACK_ABOVE);
+ }
+ }
+ else if (ev->detail == ECORE_X_WINDOW_STACK_BELOW)
+ {
+ oec = _e_comp_x_client_find_by_window(ev->abovewin);
+ if (oec)
+ {
+ evas_object_stack_below(ec->frame, oec->frame);
+ }
+ else
+ {
+ ecore_x_window_configure(e_client_util_pwin_get(ec),
+ ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
+ ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
+ 0, 0, 0, 0, 0,
+ ev->abovewin, ECORE_X_WINDOW_STACK_BELOW);
+ }
+ }
+ else if (ev->detail == ECORE_X_WINDOW_STACK_TOP_IF)
+ {
+ /* FIXME: do */
+ }
+ else if (ev->detail == ECORE_X_WINDOW_STACK_BOTTOM_IF)
+ {
+ /* FIXME: do */
+ }
+ else if (ev->detail == ECORE_X_WINDOW_STACK_OPPOSITE)
+ {
+ /* FIXME: do */
+ }
+ }
+ else if (ev->value_mask & ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE)
+ {
+ if (ev->detail == ECORE_X_WINDOW_STACK_ABOVE)
+ {
+ evas_object_raise(ec->frame);
+ }
+ else if (ev->detail == ECORE_X_WINDOW_STACK_BELOW)
+ {
+ evas_object_lower(ec->frame);
+ }
+ else if (ev->detail == ECORE_X_WINDOW_STACK_TOP_IF)
+ {
+ /* FIXME: do */
+ }
+ else if (ev->detail == ECORE_X_WINDOW_STACK_BOTTOM_IF)
+ {
+ /* FIXME: do */
+ }
+ else if (ev->detail == ECORE_X_WINDOW_STACK_OPPOSITE)
+ {
+ /* FIXME: do */
+ }
+ }
+ }
+
+ /* FIXME: need to send synthetic stacking event too as well as move/resize */
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_stack_request(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Stack_Request *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (ev->detail == ECORE_X_WINDOW_STACK_ABOVE)
+ evas_object_raise(ec->frame);
+ else if (ev->detail == ECORE_X_WINDOW_STACK_BELOW)
+ evas_object_lower(ec->frame);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_stack(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Stack *ev)
+{
+ E_Client *ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_PASS_ON;
+ if (ev->detail == ECORE_X_WINDOW_STACK_ABOVE) evas_object_raise(ec->frame);
+ else evas_object_lower(ec->frame);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_property(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Property *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+
+ if (ev->atom == ECORE_X_ATOM_WM_NAME)
+ {
+ if ((!ec->netwm.name) &&
+ (!ec->netwm.fetch.name))
+ {
+ ec->icccm.fetch.title = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_NAME)
+ {
+ ec->netwm.fetch.name = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_CLASS)
+ {
+ ec->icccm.fetch.name_class = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_ICON_NAME)
+ {
+ if ((!ec->netwm.icon_name) &&
+ (!ec->netwm.fetch.icon_name))
+ {
+ ec->icccm.fetch.icon_name = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_ICON_NAME)
+ {
+ ec->netwm.fetch.icon_name = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_CLIENT_MACHINE)
+ {
+ ec->icccm.fetch.machine = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_PROTOCOLS)
+ {
+ ec->icccm.fetch.protocol = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_HINTS)
+ {
+ ec->icccm.fetch.hints = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_NORMAL_HINTS)
+ {
+ if (ec->comp_data->internal_props_set)
+ ec->comp_data->internal_props_set--;
+ else
+ {
+ ec->icccm.fetch.size_pos_hints = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ else if (ev->atom == ECORE_X_ATOM_MOTIF_WM_HINTS)
+ {
+ /*
+ if ((ec->netwm.type == E_WINDOW_TYPE_UNKNOWN) &&
+ (!ec->netwm.fetch.type))
+ {
+ */
+ ec->mwm.fetch.hints = 1;
+ EC_CHANGED(ec);
+ /*
+ }
+ */
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_TRANSIENT_FOR)
+ {
+ ec->icccm.fetch.transient_for = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_CLIENT_LEADER)
+ {
+ ec->icccm.fetch.client_leader = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_WM_WINDOW_ROLE)
+ {
+ ec->icccm.fetch.window_role = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_ICON)
+ {
+ ec->netwm.fetch.icon = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ATM__QTOPIA_SOFT_MENU)
+ {
+ ec->qtopia.fetch.soft_menu = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ATM__QTOPIA_SOFT_MENUS)
+ {
+ ec->qtopia.fetch.soft_menus = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
+ {
+ ec->vkbd.fetch.state = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD)
+ {
+ ec->vkbd.fetch.vkbd = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_CONFORMANT)
+ {
+ ec->illume.conformant.fetch.conformant = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE)
+ {
+ ec->illume.quickpanel.fetch.state = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL)
+ {
+ ec->illume.quickpanel.fetch.quickpanel = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR)
+ {
+ ec->illume.quickpanel.fetch.priority.major = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR)
+ {
+ ec->illume.quickpanel.fetch.priority.minor = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE)
+ {
+ ec->illume.quickpanel.fetch.zone = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED)
+ {
+ ec->illume.drag.fetch.locked = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_DRAG)
+ {
+ ec->illume.drag.fetch.drag = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE)
+ {
+ ec->illume.win_state.fetch.state = 1;
+ EC_CHANGED(ec);
+ }
+ /*
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_USER_TIME)
+ {
+ ec->netwm.fetch.user_time = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_STRUT)
+ {
+ ec->netwm.fetch.strut = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL)
+ {
+ ec->netwm.fetch.strut = 1;
+ EC_CHANGED(ec);
+ }
+ */
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER)
+ {
+ //printf("ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER\n");
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_VIDEO_POSITION)
+ {
+ ec->e.fetch.video_position = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_VIDEO_PARENT)
+ {
+ ec->e.fetch.video_parent = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_STATE)
+ {
+ ec->netwm.fetch.state = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY)
+ {
+ if (ec->netwm.opacity_changed)
+ ec->netwm.opacity_changed = 0;
+ else
+ {
+ ec->netwm.fetch.opacity = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED)
+ {
+ ec->e.fetch.profile = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->atom == ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST)
+ {
+ ec->e.fetch.profile = 1;
+ EC_CHANGED(ec);
+ }
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_message(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Client_Message *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ if (ev->message_type == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY)
+ {
+ ec->netwm.fetch.opacity = 1;
+ EC_CHANGED(ec);
+ }
+ else if (ev->message_type == ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE)
+ {
+ if (ec->e.state.profile.use)
+ {
+ char *profile;
+ profile = ecore_x_atom_name_get(ev->data.l[1]);
+ ecore_x_e_window_profile_change_request_send(e_client_util_pwin_get(ec), profile);
+ ec->e.state.profile.wait_for_done = 1;
+ free(profile);
+ }
+ }
+ else if (ev->message_type == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
+ {
+#if 0 /* notes */
+ if (e->data.l[0] == 0 /* 0 == old, 1 == client, 2 == pager */)
+ {
+ }
+ timestamp = e->data.l[1];
+ requestor_id e->data.l[2];
+#endif
+ switch (e_config->window_activehint_policy)
+ {
+ case 0: break;
+
+ case 1:
+ e_comp_object_signal_emit(ec->frame, "e,state,urgent", "e");
+ ec->icccm.urgent = 1;
+ EC_CHANGED(ec);
+ break;
+
+ default:
+ if (e_client_action_get())
+ {
+ /* be helpful and ignore activates during window actions, but still set urgent */
+ e_comp_object_signal_emit(ec->frame, "e,state,urgent", "e");
+ ec->icccm.urgent = 1;
+ EC_CHANGED(ec);
+ break;
+ }
+ if ((!starting) && (!ec->focused))
+ e_client_activate(ec, EINA_TRUE);
+ else
+ evas_object_raise(ec->frame);
+ }
+ }
+ else if (ev->message_type == ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_DONE)
+ {
+ if ((ec->e.state.profile.use) &&
+ (ec->e.state.profile.wait_for_done))
+ {
+ E_Desk *desk = NULL;
+ char *profile;
+
+ profile = ecore_x_atom_name_get(ev->data.l[1]);
+ if (profile)
+ eina_stringshare_replace(&ec->e.state.profile.name, profile);
+
+ ec->e.state.profile.wait_for_done = 0;
+
+ if (ec->desk && e_util_strcmp(ec->desk->window_profile, profile))
+ {
+ desk = e_comp_desk_window_profile_get(ec->comp, profile);
+ if (desk)
+ e_client_desk_set(ec, desk);
+ }
+ free(profile);
+ }
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_state_request(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_State_Request *ev)
+{
+ int i;
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+
+ for (i = 0; i < 2; i++)
+ e_hints_window_state_update(ec, ev->state[i], ev->action);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_mapping_change(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Mapping_Change *ev EINA_UNUSED)
+{
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Comp *c;
+
+ if (_e_comp_x_mapping_change_disabled) return ECORE_CALLBACK_RENEW;
+ e_managers_keys_ungrab();
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ Ecore_X_Window win;
+
+ if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_X) continue;
+ win = e_client_util_pwin_get(ec);
+ if ((!ec->comp_data->first_map) || (!ec->comp_data->reparented)) continue;
+ _e_comp_x_focus_setdown(ec);
+ e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, win);
+ e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, win);
+ e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, win);
+ e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, win);
+ _e_comp_x_focus_setup(ec);
+ }
+ e_managers_keys_grab();
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Mouse_In *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ if (ec->comp_data->deleted) return ECORE_CALLBACK_RENEW;
+ if (ec->input_object) return ECORE_CALLBACK_RENEW;
+ e_client_mouse_in(ec, e_comp_canvas_x_root_adjust(ec->comp, ev->root.x), e_comp_canvas_x_root_adjust(ec->comp, ev->root.y));
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Mouse_In *ev)
+{
+ E_Client *ec;
+
+ if ((ev->mode == ECORE_X_EVENT_MODE_UNGRAB) &&
+ (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR))
+ return ECORE_CALLBACK_PASS_ON;
+ if (ev->mode == ECORE_X_EVENT_MODE_GRAB)
+ return ECORE_CALLBACK_PASS_ON;
+ if ((ev->mode == ECORE_X_EVENT_MODE_NORMAL) &&
+ (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR))
+ return ECORE_CALLBACK_PASS_ON;
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ if (ec->comp_data->deleted) return ECORE_CALLBACK_RENEW;
+ if (ec->input_object) return ECORE_CALLBACK_RENEW;
+ e_client_mouse_out(ec, e_comp_canvas_x_root_adjust(ec->comp, ev->root.x), e_comp_canvas_x_root_adjust(ec->comp, ev->root.y));
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_mouse_wheel(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Wheel *ev)
+{
+ E_Client *ec;
+ E_Binding_Event_Wheel ev2;
+
+ //if (action_input_win)
+ //ec = action_border;
+ //else
+ {
+ ec = _e_comp_x_client_find_by_window(ev->window);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ }
+ if (ec->comp_data->deleted) return ECORE_CALLBACK_RENEW;
+ e_bindings_ecore_event_mouse_wheel_convert(ev, &ev2);
+ e_client_mouse_wheel(ec, (Evas_Point*)&ev->root, &ev2);
+ return ECORE_CALLBACK_RENEW;
+}
+
+
+static Eina_Bool
+_e_comp_x_mouse_up(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev)
+{
+ E_Client *ec;
+ E_Binding_Event_Mouse_Button ev2;
+
+ //if (action_input_win)
+ //ec = action_border;
+ //else
+ {
+ ec = _e_comp_x_client_find_by_window(ev->window);
+ if (!ec)
+ {
+ if (e_client_comp_grabbed_get())
+ ec = e_client_action_get();
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ }
+ }
+ if (ec->comp_data->deleted) return ECORE_CALLBACK_RENEW;
+ e_bindings_ecore_event_mouse_button_convert(ev, &ev2);
+ e_client_mouse_up(ec, ev->buttons, (Evas_Point*)&ev->root, &ev2);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_mouse_down(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev)
+{
+ E_Client *ec;
+ E_Binding_Event_Mouse_Button ev2;
+
+ if (e_client_action_get()) return ECORE_CALLBACK_RENEW; //block extra mouse buttons during action
+ //if (action_input_win)
+ //ec = action_border;
+ //else
+ {
+ ec = _e_comp_x_client_find_by_window(ev->window);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ }
+ if (ec->comp_data->deleted) return ECORE_CALLBACK_RENEW;
+ e_bindings_ecore_event_mouse_button_convert(ev, &ev2);
+ e_client_mouse_down(ec, ev->buttons, (Evas_Point*)&ev->root, &ev2);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev)
+{
+ E_Client *ec;
+
+ if (!e_client_comp_grabbed_get()) return ECORE_CALLBACK_RENEW;
+ ec = e_client_action_get();
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ if (ec->comp_data->deleted) return ECORE_CALLBACK_RENEW;
+ if (e_client_resizing_get(ec) &&
+ ec->netwm.sync.request &&
+ ec->netwm.sync.alarm
+ )
+ {
+ if ((ecore_loop_time_get() - ec->netwm.sync.send_time) > 0.5)
+ {
+ if (ec->pending_resize)
+ {
+ ec->changes.pos = 1;
+ ec->changes.size = 1;
+ EC_CHANGED(ec);
+ _e_comp_x_client_move_resize_send(ec);
+ }
+ E_FREE_LIST(ec->pending_resize, free);
+
+ ec->netwm.sync.wait = 0;
+ /* sync.wait is incremented when resize_handle sends
+ * sync-request and decremented by sync-alarm cb. so
+ * we resize here either on initial resize, timeout or
+ * when no new resize-request was added by sync-alarm cb.
+ */
+ }
+ e_client_mouse_move(ec, (Evas_Point*)&ev->root);
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_focus_out(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Focus_Out *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+
+ _e_comp_x_client_pri_norm(ec);
+ if (ev->mode == ECORE_X_EVENT_MODE_NORMAL)
+ {
+ if (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
+ return ECORE_CALLBACK_PASS_ON;
+ else if (ev->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)
+ return ECORE_CALLBACK_PASS_ON;
+ else if (ev->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL)
+ return ECORE_CALLBACK_PASS_ON;
+ }
+ else if (ev->mode == ECORE_X_EVENT_MODE_GRAB)
+ {
+ if (ev->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)
+ return ECORE_CALLBACK_PASS_ON;
+ else if (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
+ return ECORE_CALLBACK_PASS_ON;
+ else if (ev->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL)
+ return ECORE_CALLBACK_PASS_ON;
+ else if (ev->detail == ECORE_X_EVENT_DETAIL_ANCESTOR)
+ return ECORE_CALLBACK_PASS_ON;
+ else if (ev->detail == ECORE_X_EVENT_DETAIL_VIRTUAL)
+ return ECORE_CALLBACK_PASS_ON;
+ }
+ else if (ev->mode == ECORE_X_EVENT_MODE_UNGRAB)
+ {
+ /* for firefox/thunderbird (xul) menu walking */
+ /* NB: why did i disable this before? */
+ if (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
+ return ECORE_CALLBACK_PASS_ON;
+ else if (ev->detail == ECORE_X_EVENT_DETAIL_POINTER)
+ return ECORE_CALLBACK_PASS_ON;
+ }
+ else if (ev->mode == ECORE_X_EVENT_MODE_WHILE_GRABBED)
+ {
+ if (ev->detail == ECORE_X_EVENT_DETAIL_ANCESTOR)
+ return ECORE_CALLBACK_PASS_ON;
+ else if (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
+ return ECORE_CALLBACK_PASS_ON;
+ }
+ evas_object_focus_set(ec->frame, 0);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_client_property(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Property *ev)
+{
+ if ((ev->property & E_CLIENT_PROPERTY_ICON) && ev->ec->desktop)
+ ecore_x_window_prop_string_set(e_client_util_win_get(ev->ec), E_ATOM_DESKTOP_FILE,
+ ev->ec->desktop->orig_path);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_e_comp_x_client_zone_geometry_set(E_Client *ec)
+{
+ unsigned int zgeom[4];
+
+ zgeom[0] = ec->zone->x;
+ zgeom[1] = ec->zone->y;
+ zgeom[2] = ec->zone->w;
+ zgeom[3] = ec->zone->h;
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_ZONE_GEOMETRY, zgeom, 4);
+}
+
+static Eina_Bool
+_e_comp_x_client_zone_set(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client *ev)
+{
+ E_Client *ec = ev->ec;
+
+ if (e_object_is_del(E_OBJECT(ec))) return ECORE_CALLBACK_RENEW;
+ E_COMP_X_PIXMAP_CHECK ECORE_CALLBACK_RENEW;
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ev->ec), E_ATOM_ZONE, &ev->ec->zone->num, 1);
+ _e_comp_x_client_zone_geometry_set(ev->ec);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_sync_alarm(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Sync_Alarm *ev)
+{
+ unsigned int serial;
+ E_Client *ec;
+ Eina_Bool resize = EINA_FALSE;
+
+ ec = _e_comp_x_client_find_by_alarm(ev->alarm);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+
+ if (ec->netwm.sync.wait)
+ ec->netwm.sync.wait--;
+
+ if (ecore_x_sync_counter_query(ec->netwm.sync.counter, &serial))
+ {
+ E_Client_Pending_Resize *pnd = NULL;
+
+ /* skip pending for which we didn't get a reply */
+ while (ec->pending_resize)
+ {
+ pnd = ec->pending_resize->data;
+ ec->pending_resize = eina_list_remove(ec->pending_resize, pnd);
+
+ if (serial == pnd->serial)
+ break;
+
+ E_FREE(pnd);
+ }
+
+ if (pnd)
+ {
+ resize = ((ec->w != pnd->w) || (ec->h != pnd->h));
+ ec->w = pnd->w;
+ ec->h = pnd->h;
+ E_FREE(pnd);
+ }
+ }
+
+ if (resize)
+ {
+ ec->changes.size = 1;
+ EC_CHANGED(ec);
+ }
+
+ ecore_x_pointer_xy_get(ec->comp->man->root,
+ &ec->mouse.current.mx,
+ &ec->mouse.current.my);
+
+ ec->netwm.sync.send_time = ecore_loop_time_get();
+ if (resize)
+ e_client_mouse_move(ec, &(Evas_Point){ec->mouse.current.mx, ec->mouse.current.my});
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_desktop_change(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Desktop_Change *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (ec)
+ {
+ if (ev->desk == 0xffffffff)
+ e_client_stick(ec);
+ else if ((int)ev->desk < (ec->zone->desk_x_count * ec->zone->desk_y_count))
+ {
+ E_Desk *desk;
+
+ desk = e_desk_at_pos_get(ec->zone, ev->desk);
+ if (desk)
+ e_client_desk_set(ec, desk);
+ }
+ }
+ else
+ ecore_x_netwm_desktop_set(ev->win, ev->desk);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_move_resize_request(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Move_Resize_Request *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+
+ if ((ec->shaded) || (ec->shading) ||
+ (ec->fullscreen) || (ec->moving) ||
+ (ec->resize_mode != E_POINTER_RESIZE_NONE))
+ return ECORE_CALLBACK_PASS_ON;
+
+ if ((ev->button >= 1) && (ev->button <= 3))
+ {
+ ec->mouse.last_down[ev->button - 1].mx = ev->x;
+ ec->mouse.last_down[ev->button - 1].my = ev->y;
+ ec->mouse.last_down[ev->button - 1].x = ec->x;
+ ec->mouse.last_down[ev->button - 1].y = ec->y;
+ ec->mouse.last_down[ev->button - 1].w = ec->w;
+ ec->mouse.last_down[ev->button - 1].h = ec->h;
+ }
+ else
+ {
+ ec->moveinfo.down.x = ec->x;
+ ec->moveinfo.down.y = ec->y;
+ ec->moveinfo.down.w = ec->w;
+ ec->moveinfo.down.h = ec->h;
+ }
+ ec->mouse.current.mx = ev->x;
+ ec->mouse.current.my = ev->y;
+ ec->moveinfo.down.button = ev->button;
+ ec->moveinfo.down.mx = ev->x;
+ ec->moveinfo.down.my = ev->y;
+
+ if (!ec->lock_user_stacking)
+ evas_object_raise(ec->frame);
+
+ if (ev->direction == E_POINTER_MOVE)
+ {
+ ec->cur_mouse_action = e_action_find("window_move");
+ if (ec->cur_mouse_action)
+ {
+ if ((!ec->cur_mouse_action->func.end_mouse) &&
+ (!ec->cur_mouse_action->func.end))
+ ec->cur_mouse_action = NULL;
+ if (ec->cur_mouse_action)
+ {
+ e_object_ref(E_OBJECT(ec->cur_mouse_action));
+ ec->cur_mouse_action->func.go(E_OBJECT(ec), NULL);
+ }
+ }
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ ec->cur_mouse_action = e_action_find("window_resize");
+ if (ec->cur_mouse_action)
+ {
+ if ((!ec->cur_mouse_action->func.end_mouse) &&
+ (!ec->cur_mouse_action->func.end))
+ ec->cur_mouse_action = NULL;
+ }
+ if (!ec->cur_mouse_action) return ECORE_CALLBACK_RENEW;
+ e_object_ref(E_OBJECT(ec->cur_mouse_action));
+ ec->cur_mouse_action->func.go(E_OBJECT(ec), NULL);
+
+ switch (ev->direction)
+ {
+ case E_POINTER_RESIZE_TL:
+ ec->resize_mode = E_POINTER_RESIZE_TL;
+ GRAV_SET(ec, ECORE_X_GRAVITY_SE);
+ break;
+
+ case E_POINTER_RESIZE_T:
+ ec->resize_mode = E_POINTER_RESIZE_T;
+ GRAV_SET(ec, ECORE_X_GRAVITY_S);
+ break;
+
+ case E_POINTER_RESIZE_TR:
+ ec->resize_mode = E_POINTER_RESIZE_TR;
+ GRAV_SET(ec, ECORE_X_GRAVITY_SW);
+ break;
+
+ case E_POINTER_RESIZE_R:
+ ec->resize_mode = E_POINTER_RESIZE_R;
+ GRAV_SET(ec, ECORE_X_GRAVITY_W);
+ break;
+
+ case E_POINTER_RESIZE_BR:
+ ec->resize_mode = E_POINTER_RESIZE_BR;
+ GRAV_SET(ec, ECORE_X_GRAVITY_NW);
+ break;
+
+ case E_POINTER_RESIZE_B:
+ ec->resize_mode = E_POINTER_RESIZE_B;
+ GRAV_SET(ec, ECORE_X_GRAVITY_N);
+ break;
+
+ case E_POINTER_RESIZE_BL:
+ ec->resize_mode = E_POINTER_RESIZE_BL;
+ GRAV_SET(ec, ECORE_X_GRAVITY_NE);
+ break;
+
+ case E_POINTER_RESIZE_L:
+ ec->resize_mode = E_POINTER_RESIZE_L;
+ GRAV_SET(ec, ECORE_X_GRAVITY_E);
+ break;
+
+ default:
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Focus_In *ev)
+{
+ E_Client *ec, *focused;
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+
+ /* block refocus attempts on iconic clients
+ * these result from iconifying a client during a grab */
+ if (ec->iconic) return ECORE_CALLBACK_RENEW;
+
+ /* block spurious focus events
+ * not sure if correct, but seems necessary to use pointer focus...
+ */
+ focused = e_client_focused_get();
+ if (focused && (ec != focused)) return ECORE_CALLBACK_RENEW;
+
+ _e_comp_x_client_pri_raise(ec);
+ if (ev->mode == ECORE_X_EVENT_MODE_GRAB)
+ {
+ if (ev->detail == ECORE_X_EVENT_DETAIL_POINTER) return ECORE_CALLBACK_PASS_ON;
+ }
+ else if (ev->mode == ECORE_X_EVENT_MODE_UNGRAB)
+ {
+ /* this seems to break winlist...
+ if (ev->detail == ECORE_X_EVENT_DETAIL_POINTER)
+ */
+
+ /* we're getting a non-linear focus re-set on a visible
+ * window on current desk when no other client is focused;
+ * this is probably when we're trying to reapply focus after
+ * unfocusing some comp canvas widget
+ */
+ if ((ev->detail != ECORE_X_EVENT_DETAIL_NON_LINEAR) ||
+ focused ||
+ (!e_client_util_desk_visible(ec, e_desk_current_get(ec->zone))))
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ /* ignore focus in from !take_focus windows, we just gave it em */
+ /* if (!ec->icccm.take_focus)
+ * return ECORE_CALLBACK_PASS_ON; */
+
+ /* should be equal, maybe some clients dont reply with the proper timestamp ? */
+ if (ev->time >= focus_time)
+ evas_object_focus_set(ec->frame, 1);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_shape(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Shape *ev)
+{
+ E_Client *ec;
+ //const char *txt[] =
+ //{
+ //[ECORE_X_SHAPE_BOUNDING] = "BOUNDING",
+ //[ECORE_X_SHAPE_INPUT] = "INPUT",
+ //[ECORE_X_SHAPE_CLIP] = "CLIP",
+ //};
+
+ ec = _e_comp_x_client_find_by_window(ev->win);
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ //INF("%p(%s): %d,%d %dx%d || %d", ec, txt[ev->type], ev->x, ev->y, ev->w, ev->h, ev->shaped);
+ if (ev->win == e_client_util_win_get(ec))
+ {
+ if (ev->type == ECORE_X_SHAPE_INPUT)
+ {
+ ec->changes.shape_input = 1;
+ ec->need_shape_merge = 1;
+ }
+ else
+ ec->changes.shape = 1;
+ }
+ else if (ec->shaped) //shape change on parent window only valid if window is known to be shaped
+ ec->need_shape_export = 1;
+ EC_CHANGED(ec);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_damage(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Damage *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_damage(ev->damage);
+ if (!ec) return ECORE_CALLBACK_PASS_ON;
+ if (ec->comp_data->damage)
+ {
+ Ecore_X_Region parts;
+
+ parts = ecore_x_region_new(NULL, 0);
+ ecore_x_damage_subtract(ec->comp_data->damage, 0, parts);
+ ecore_x_region_free(parts);
+ }
+
+ //WRN("DAMAGE %p: %dx%d", ec, ev->area.width, ev->area.height);
+ if (ec->comp->nocomp)
+ e_pixmap_dirty(ec->pixmap);
+ else
+ e_comp_object_damage(ec->frame, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_e_comp_x_damage_win(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Window_Damage *ev)
+{
+ E_Comp *c;
+
+ c = e_comp_find_by_window(ev->win);
+ if (c) e_comp_render_queue(c);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_grab_replay(void *data EINA_UNUSED, int type, void *event)
+{
+ Ecore_Event_Mouse_Button *ev = event;
+ E_Binding_Event_Mouse_Button ev2;
+ E_Client *ec;
+
+ if (type != ECORE_EVENT_MOUSE_BUTTON_DOWN) return ECORE_CALLBACK_DONE;
+ if ((!e_config->pass_click_on) &&
+ (!e_config->always_click_to_raise) && // this works even if not on click-to-focus
+ (!e_config->always_click_to_focus) // this works even if not on click-to-focus
+ )
+ return ECORE_CALLBACK_DONE;
+ ec = _e_comp_x_client_find_by_window(ev->event_window);
+ if (!ec) return ECORE_CALLBACK_DONE;
+ if (ec->cur_mouse_action) return ECORE_CALLBACK_DONE;
+ e_bindings_ecore_event_mouse_button_convert(ev, &ev2);
+ return !e_bindings_mouse_button_find(E_BINDING_CONTEXT_WINDOW,
+ &ev2, NULL);
+}
+
+static void
+_e_comp_x_hook_client_eval_end(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ if (ec->comp->comp_data->restack && (!ec->comp->new_clients))
+ {
+ e_hints_client_stacking_set();
+ ec->comp->comp_data->restack = 0;
+ }
+}
+
+static void
+_e_comp_x_hook_client_post_new_client(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ if (ec->changes.reset_gravity)
+ {
+ GRAV_SET(ec, ECORE_X_GRAVITY_NW);
+ }
+
+ if (ec->need_shape_merge)
+ {
+ _e_comp_x_client_shape_input_rectangle_set(ec);
+ if (!ec->shaped)
+ ecore_x_window_shape_mask_set(e_client_util_pwin_get(ec), 0);
+ ec->need_shape_merge = 0;
+ }
+
+ if (ec->changes.internal_state)
+ {
+ Ecore_X_Atom state[1];
+ int num = 0;
+ E_Win *win = ecore_evas_data_get(ec->internal_ecore_evas, "E_Win");
+
+ if (win->state.centered)
+ state[num++] = E_ATOM_WINDOW_STATE_CENTERED;
+
+ if (num)
+ ecore_x_window_prop_card32_set(win->evas_win, E_ATOM_WINDOW_STATE, state, num);
+ else
+ ecore_x_window_prop_property_del(win->evas_win, E_ATOM_WINDOW_STATE);
+ }
+
+ if (ec->changes.internal_props)
+ {
+ E_Win *win = ecore_evas_data_get(ec->internal_ecore_evas, "E_Win");
+
+ ecore_x_icccm_size_pos_hints_set(win->evas_win,
+ win->placed, ECORE_X_GRAVITY_NW,
+ win->min_w, win->min_h,
+ win->max_w, win->max_h,
+ win->base_w, win->base_h,
+ win->step_x, win->step_y,
+ win->min_aspect, win->max_aspect);
+ ec->changes.internal_props = 0;
+ ec->comp_data->internal_props_set++;
+ }
+
+ if (ec->need_shape_export)
+ {
+ Ecore_X_Rectangle *rects, *orects;
+ int num;
+
+ rects = ecore_x_window_shape_rectangles_get(e_client_util_win_get(ec), &num);
+ if (rects)
+ {
+ int changed = 1;
+
+ if (((unsigned int)num == ec->shape_rects_num) && (ec->shape_rects))
+ {
+ int i;
+
+ orects = (Ecore_X_Rectangle*)ec->shape_rects;
+ changed = 0;
+ for (i = 0; i < num; i++)
+ {
+ E_RECTS_CLIP_TO_RECT(rects[i].x, rects[i].y,
+ rects[i].width, rects[i].height, 0, 0, ec->client.w, ec->client.h);
+
+ if ((orects[i].x != rects[i].x) ||
+ (orects[i].y != rects[i].y) ||
+ (orects[i].width != rects[i].width) ||
+ (orects[i].height != rects[i].height))
+ {
+ changed = 1;
+ break;
+ }
+ }
+ }
+ if (changed)
+ {
+ E_FREE(ec->shape_rects);
+ ec->shape_rects = (Eina_Rectangle*)rects;
+ ec->shape_rects_num = num;
+ ec->shape_changed = 1;
+ }
+ else
+ free(rects);
+ }
+ else
+ {
+ E_FREE(ec->shape_rects);
+ ec->shape_rects_num = 0;
+ }
+ ec->need_shape_export = 0;
+ }
+}
+
+static void
+_e_comp_x_hook_client_pre_frame_assign(void *d EINA_UNUSED, E_Client *ec)
+{
+ Ecore_X_Window win, pwin;
+
+ E_COMP_X_PIXMAP_CHECK;
+ win = e_client_util_win_get(ec);
+ if (!ec->comp_data->need_reparent) return;
+ /* match ec parent argbness */
+ if (ec->argb)
+ pwin = ecore_x_window_manager_argb_new(ec->comp->man->root, ec->client.x, ec->client.y, ec->client.w, ec->client.h);
+ else
+ {
+ pwin = ecore_x_window_override_new(ec->comp->man->root, ec->client.x, ec->client.y, ec->client.w, ec->client.h);
+ ecore_x_window_shape_events_select(pwin, !ec->internal); //let's just agree never to do this with our own windows...
+ }
+
+ if (ec->client.w && ec->client.h)
+ /* force a resize here (no-op most of the time)
+ * prevents mismatch between remembered window size and current size
+ */
+ ecore_x_window_resize(win, ec->client.w, ec->client.h);
+ ecore_x_window_container_manage(pwin);
+ if (!ec->internal) ecore_x_window_client_manage(win);
+ ecore_x_window_configure(pwin,
+ ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
+ ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
+ 0, 0, 0, 0, 0,
+ win, ECORE_X_WINDOW_STACK_ABOVE);
+ ecore_x_event_mask_set(pwin, ECORE_X_EVENT_MASK_MOUSE_IN | ECORE_X_EVENT_MASK_MOUSE_OUT);
+ ecore_x_window_border_width_set(win, 0);
+ ec->border_size = 0;
+
+ if (ec->e.state.video)
+ {
+ ecore_x_window_lower(pwin);
+ ecore_x_composite_window_events_disable(pwin);
+ ecore_x_window_ignore_set(pwin, EINA_TRUE);
+ }
+ if (!ec->internal)
+ ecore_x_window_save_set_add(win);
+ ecore_x_window_reparent(win, pwin, 0, 0);
+
+ {
+ unsigned int managed = 1;
+ ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &managed, 1);
+ }
+ e_pixmap_parent_window_set(ec->pixmap, pwin);
+ ec->border.changed = 1;
+ if (!ec->shaped)
+ ecore_x_window_shape_mask_set(pwin, 0);
+ if (ec->shaped_input)
+ ecore_x_window_shape_input_rectangles_set(pwin, (Ecore_X_Rectangle*)ec->shape_input_rects, ec->shape_input_rects_num);
+ ec->changes.shape = 1;
+ ec->changes.shape_input = 1;
+ if (ec->internal_ecore_evas)
+ {
+ ecore_x_window_gravity_set(win, ECORE_X_GRAVITY_NW);
+ ec->changes.reset_gravity = 1;
+ }
+ EC_CHANGED(ec);
+
+ eina_hash_add(clients_win_hash, &pwin, ec);
+
+ if (ec->visible)
+ {
+ if (ec->comp_data->set_win_type && ec->internal_ecore_evas)
+ {
+ E_Win *ewin = ecore_evas_data_get(ec->internal_ecore_evas, "E_Win");
+
+ if (ewin)
+ {
+ if (ec->dialog)
+ ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_DIALOG);
+ else
+ ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
+ }
+ ec->comp_data->set_win_type = 0;
+ ecore_evas_show(ec->internal_ecore_evas);
+ }
+ }
+ if (ec->re_manage || ec->visible)
+ {
+ ecore_x_window_show(win);
+ ecore_x_window_show(pwin);
+ }
+
+ _e_comp_x_focus_setup(ec);
+ e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, pwin);
+ e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, pwin);
+ _e_comp_x_client_evas_init(ec);
+ if (ec->netwm.ping && (!ec->ping_poller))
+ e_client_ping(ec);
+ if (ec->visible) evas_object_show(ec->frame);
+ ec->comp_data->need_reparent = 0;
+ ec->redirected = 1;
+ if (ec->comp_data->change_icon)
+ {
+ ec->changes.icon = 1;
+ EC_CHANGED(ec);
+ }
+ ec->comp_data->change_icon = 0;
+ ec->comp_data->reparented = 1;
+ _e_comp_x_evas_comp_hidden_cb(ec, NULL, NULL);
+}
+
+static void
+_e_comp_x_hook_client_fetch(void *d EINA_UNUSED, E_Client *ec)
+{
+ Ecore_X_Window win, pwin;
+ int rem_change = 0;
+ Eina_Bool need_desk_set = EINA_FALSE;
+
+ E_COMP_X_PIXMAP_CHECK;
+ win = e_client_util_win_get(ec);
+ pwin = e_client_util_pwin_get(ec);
+ if (ec->changes.visible)
+ _e_comp_x_client_shape_input_rectangle_set(ec);
+ /* fetch any info queued to be fetched */
+ if (ec->changes.prop || ec->netwm.fetch.state)
+ {
+ e_hints_window_state_get(ec);
+ ec->netwm.fetch.state = 0;
+ rem_change = 1;
+ }
+ if (ec->icccm.fetch.client_leader)
+ {
+ /* TODO: What do to if the client leader isn't mapped yet? */
+ E_Client *ec_leader = NULL;
+
+ ec->icccm.client_leader = ecore_x_icccm_client_leader_get(win);
+ if (ec->icccm.client_leader)
+ ec_leader = _e_comp_x_client_find_by_window(ec->icccm.client_leader);
+ if (ec->leader)
+ {
+ if (ec->leader != ec_leader)
+ {
+ ec->leader->group = eina_list_remove(ec->leader->group, ec);
+ if (ec->leader->modal == ec) ec->leader->modal = NULL;
+ ec->leader = NULL;
+ }
+ else
+ ec_leader = NULL;
+ }
+ /* If this client is the leader of the group, don't register itself */
+ if ((ec_leader) && (ec_leader != ec))
+ {
+ ec_leader->group = eina_list_append(ec_leader->group, ec);
+ ec->leader = ec_leader;
+ /* Only set the window modal to the leader it there is no parent */
+ if ((ec->netwm.state.modal) &&
+ ((!ec->parent) || (ec->parent->modal != ec)))
+ {
+ ec->leader->modal = ec;
+ if (ec->leader->focused)
+ evas_object_focus_set(ec->frame, 1);
+ else
+ {
+ Eina_List *l;
+ E_Client *child;
+
+ EINA_LIST_FOREACH(ec->leader->group, l, child)
+ {
+ if ((child != ec) && (child->focused))
+ evas_object_focus_set(ec->frame, 1);
+ }
+ }
+ }
+ }
+ ec->icccm.fetch.client_leader = 0;
+ rem_change = 1;
+ }
+ if (ec->icccm.fetch.title)
+ {
+ char *title = ecore_x_icccm_title_get(win);
+ eina_stringshare_replace(&ec->icccm.title, title);
+ free(title);
+
+ e_comp_object_frame_title_set(ec->frame, ec->icccm.title);
+
+ ec->icccm.fetch.title = 0;
+ rem_change = 1;
+ }
+ if (ec->netwm.fetch.name)
+ {
+ char *name;
+ ecore_x_netwm_name_get(win, &name);
+ eina_stringshare_replace(&ec->netwm.name, name);
+ free(name);
+
+ ec->hacks.iconic_shading =
+ ((ec->netwm.icon_name == ec->netwm.name) &&
+ (!e_util_strcmp(ec->netwm.name, "QEMU")));
+
+ e_comp_object_frame_title_set(ec->frame, ec->netwm.name);
+
+ ec->netwm.fetch.name = 0;
+ rem_change = 1;
+ }
+
+ if (ec->icccm.fetch.name_class)
+ {
+ const char *pname, *pclass;
+ char *nname, *nclass;
+
+ ecore_x_icccm_name_class_get(win, &nname, &nclass);
+ pname = ec->icccm.name;
+ pclass = ec->icccm.class;
+ ec->icccm.name = eina_stringshare_add(nname);
+ ec->icccm.class = eina_stringshare_add(nclass);
+ ec->hacks.mapping_change =
+ ((!e_util_strcasecmp(ec->icccm.class, "vmplayer")) ||
+ (!e_util_strcasecmp(ec->icccm.class, "vmware")));
+ if (ec->hacks.mapping_change)
+ _e_comp_x_mapping_change_disabled++;
+ _e_comp_x_mapping_change_disabled = MIN(_e_comp_x_mapping_change_disabled, 0);
+ free(nname);
+ free(nclass);
+
+ if (!((ec->icccm.name == pname) &&
+ (ec->icccm.class == pclass)))
+ {
+ if (ec->icccm.name && (!e_util_strcmp(ec->icccm.class, "e_layer_win")))
+ {
+ /* this is a stacking window or someone trying to crash us */
+ E_Layer layer;
+
+ errno = 0;
+ layer = strtol(ec->icccm.name, NULL, 10);
+ if ((!errno) && (!ec->comp->layers[e_comp_canvas_layer_map(layer)].obj))
+ {
+ ec->lock_client_stacking = 1;
+ ec->internal = 1;
+ ec->comp->layers[e_comp_canvas_layer_map(layer)].obj = ec->frame;
+ evas_object_layer_set(ec->frame, layer);
+ }
+ }
+ ec->changes.icon = 1;
+ rem_change = 1;
+ }
+
+ eina_stringshare_del(pname);
+ eina_stringshare_del(pclass);
+ ec->icccm.fetch.name_class = 0;
+ }
+ if (ec->changes.prop || ec->icccm.fetch.state)
+ {
+ ec->icccm.state = ecore_x_icccm_state_get(win);
+ ec->icccm.fetch.state = 0;
+ rem_change = 1;
+ }
+ if (ec->changes.prop || ec->e.fetch.state)
+ {
+ e_hints_window_e_state_get(ec);
+ ec->e.fetch.state = 0;
+ rem_change = 1;
+ }
+ if (ec->e.fetch.profile)
+ {
+ const char **list = NULL;
+ int n, i, res;
+ unsigned int use;
+
+ if (ec->e.state.profile.name)
+ {
+ eina_stringshare_del(ec->e.state.profile.name);
+ ec->e.state.profile.name = NULL;
+ }
+
+ if (ec->e.state.profile.available_list)
+ {
+ for (i = 0; i < ec->e.state.profile.num; i++)
+ {
+ if (ec->e.state.profile.available_list[i])
+ {
+ eina_stringshare_del(ec->e.state.profile.available_list[i]);
+ ec->e.state.profile.available_list[i] = NULL;
+ }
+ }
+ E_FREE(ec->e.state.profile.available_list);
+ ec->e.state.profile.available_list = NULL;
+ }
+ ec->e.state.profile.num = 0;
+
+ res = ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED,
+ &use,
+ 1);
+ if ((res == 1) && (use == 1))
+ {
+ Ecore_X_Atom val;
+ res = ecore_x_window_prop_atom_get(win,
+ ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE,
+ &val, 1);
+ if (res == 1)
+ {
+ char *name = ecore_x_atom_name_get(val);
+ if (name)
+ {
+ ec->e.state.profile.name = eina_stringshare_add(name);
+ free(name);
+ }
+ }
+
+ if (ecore_x_e_window_available_profiles_get(win, &list, &n))
+ {
+ ec->e.state.profile.available_list = E_NEW(const char *, n);
+ for (i = 0; i < n; i++)
+ ec->e.state.profile.available_list[i] = eina_stringshare_add(list[i]);
+ ec->e.state.profile.num = n;
+ }
+ need_desk_set = EINA_TRUE;
+ ec->e.state.profile.use = 1;
+ free(list);
+ }
+
+ ec->e.fetch.profile = 0;
+ }
+ if (ec->e.state.profile.set)
+ {
+ ecore_x_e_window_profile_change_request_send(e_client_util_pwin_get(ec),
+ ec->e.state.profile.set);
+ ec->e.state.profile.wait_for_done = 1;
+ eina_stringshare_replace(&ec->e.state.profile.set, NULL);
+ }
+ if (ec->changes.prop || ec->netwm.fetch.type)
+ {
+ e_hints_window_type_get(ec);
+ if (((!ec->lock_border) || (!ec->border.name)) && ec->comp_data->reparented)
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+
+ if ((ec->netwm.type == E_WINDOW_TYPE_DOCK) || ec->tooltip)
+ {
+ if (!ec->netwm.state.skip_pager)
+ {
+ ec->netwm.state.skip_pager = 1;
+ ec->netwm.update.state = 1;
+ }
+ if (!ec->netwm.state.skip_taskbar)
+ {
+ ec->netwm.state.skip_taskbar = 1;
+ ec->netwm.update.state = 1;
+ }
+ }
+ else if (ec->netwm.type == E_WINDOW_TYPE_DESKTOP)
+ {
+ ec->focus_policy_override = E_FOCUS_CLICK;
+ _e_comp_x_focus_setup(ec);
+ if (!ec->netwm.state.skip_pager)
+ {
+ ec->netwm.state.skip_pager = 1;
+ ec->netwm.update.state = 1;
+ }
+ if (!ec->netwm.state.skip_taskbar)
+ {
+ ec->netwm.state.skip_taskbar = 1;
+ ec->netwm.update.state = 1;
+ }
+ if (!e_client_util_ignored_get(ec))
+ ec->border.changed = ec->borderless = 1;
+ }
+ if (ec->tooltip)
+ {
+ ec->icccm.accepts_focus = 0;
+ eina_stringshare_replace(&ec->bordername, "borderless");
+ }
+ else if (ec->internal)
+ {
+ if (ec->dialog)
+ ecore_x_icccm_transient_for_set(win, ec->comp->man->root);
+ else
+ ecore_x_icccm_transient_for_unset(win);
+ }
+ {
+ E_Event_Client_Property *ev;
+
+ ev = E_NEW(E_Event_Client_Property, 1);
+ ev->ec = ec;
+ e_object_ref(E_OBJECT(ec));
+ ev->property = E_CLIENT_PROPERTY_NETWM_STATE;
+ ecore_event_add(E_EVENT_CLIENT_PROPERTY, ev, _e_comp_x_client_event_free, NULL);
+ }
+ ec->netwm.fetch.type = 0;
+ }
+ if (ec->icccm.fetch.machine)
+ {
+ char *machine = ecore_x_icccm_client_machine_get(win);
+
+ if ((!machine) && (ec->icccm.client_leader))
+ machine = ecore_x_icccm_client_machine_get(ec->icccm.client_leader);
+
+ eina_stringshare_replace(&ec->icccm.machine, machine);
+ free(machine);
+
+ ec->icccm.fetch.machine = 0;
+ rem_change = 1;
+ }
+ if (ec->icccm.fetch.command)
+ {
+ if ((ec->icccm.command.argc > 0) && (ec->icccm.command.argv))
+ {
+ int i;
+
+ for (i = 0; i < ec->icccm.command.argc; i++)
+ free(ec->icccm.command.argv[i]);
+ free(ec->icccm.command.argv);
+ }
+ ec->icccm.command.argc = 0;
+ ec->icccm.command.argv = NULL;
+ ecore_x_icccm_command_get(win,
+ &(ec->icccm.command.argc),
+ &(ec->icccm.command.argv));
+ if ((ec->icccm.client_leader) &&
+ (!ec->icccm.command.argv))
+ ecore_x_icccm_command_get(ec->icccm.client_leader,
+ &(ec->icccm.command.argc),
+ &(ec->icccm.command.argv));
+ ec->icccm.fetch.command = 0;
+ rem_change = 1;
+ }
+ if (ec->changes.prop || ec->icccm.fetch.hints)
+ {
+ Eina_Bool accepts_focus, is_urgent;
+
+ accepts_focus = EINA_TRUE;
+ is_urgent = EINA_FALSE;
+ ec->icccm.initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
+ if (ecore_x_icccm_hints_get(win,
+ &accepts_focus,
+ &ec->icccm.initial_state,
+ &ec->icccm.icon_pixmap,
+ &ec->icccm.icon_mask,
+ &ec->icccm.icon_window,
+ &ec->icccm.window_group,
+ &is_urgent))
+ {
+ ec->icccm.accepts_focus = accepts_focus;
+ ec->icccm.urgent = is_urgent;
+
+ /* If this is a new window, set the state as requested. */
+ if ((ec->new_client) &&
+ (ec->icccm.initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC))
+ e_client_iconify(ec);
+ }
+ ec->icccm.fetch.hints = 0;
+ rem_change = 1;
+ }
+ if (ec->changes.prop || ec->icccm.fetch.size_pos_hints)
+ {
+ Eina_Bool request_pos;
+
+ request_pos = EINA_FALSE;
+ if (ecore_x_icccm_size_pos_hints_get(win,
+ &request_pos,
+ &ec->icccm.gravity,
+ &ec->icccm.min_w,
+ &ec->icccm.min_h,
+ &ec->icccm.max_w,
+ &ec->icccm.max_h,
+ &ec->icccm.base_w,
+ &ec->icccm.base_h,
+ &ec->icccm.step_w,
+ &ec->icccm.step_h,
+ &ec->icccm.min_aspect,
+ &ec->icccm.max_aspect))
+ {
+ ec->icccm.request_pos = request_pos;
+ if (request_pos && (!ec->placed) && (!ec->re_manage))
+ {
+ Ecore_X_Window_Attributes *att;
+ int bw;
+ int l, r, t, b;
+ int zx = 0, zy = 0, zw = 0, zh = 0;
+
+ if (ec->zone)
+ e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
+ e_comp_object_frame_geometry_get(ec->frame, &l, &r, &t, &b);
+ att = &ec->comp_data->initial_attributes;
+ bw = att->border * 2;
+ switch (ec->icccm.gravity)
+ {
+ case ECORE_X_GRAVITY_N:
+ ec->x = (att->x - (bw / 2)) - (l / 2);
+ ec->y = att->y;
+ break;
+
+ case ECORE_X_GRAVITY_NE:
+ ec->x = (att->x - (bw)) - (l);
+ ec->y = att->y;
+ break;
+
+ case ECORE_X_GRAVITY_E:
+ ec->x = (att->x - (bw)) - (l);
+ ec->y = (att->y - (bw / 2)) - (t / 2);
+ break;
+
+ case ECORE_X_GRAVITY_SE:
+ ec->x = (att->x - (bw)) - (l);
+ ec->y = (att->y - (bw)) - (t);
+ break;
+
+ case ECORE_X_GRAVITY_S:
+ ec->x = (att->x - (bw / 2)) - (l / 2);
+ ec->y = (att->y - (bw)) - (t);
+ break;
+
+ case ECORE_X_GRAVITY_SW:
+ ec->x = att->x;
+ ec->y = (att->y - (bw)) - (t);
+ break;
+
+ case ECORE_X_GRAVITY_W:
+ ec->x = att->x;
+ ec->y = (att->y - (bw)) - (t);
+ break;
+
+ case ECORE_X_GRAVITY_CENTER:
+ ec->x = (att->x - (bw / 2)) - (l / 2);
+ ec->y = (att->y - (bw / 2)) - (t / 2);
+ break;
+
+ case ECORE_X_GRAVITY_NW:
+ default:
+ ec->x = att->x;
+ ec->y = att->y;
+ }
+
+ /*
+ * This ensures that windows that like to open with a x/y
+ * position smaller than returned by e_zone_useful_geometry_get()
+ * are moved to useful positions.
+ */
+ // ->
+ if (e_config->geometry_auto_move)
+ {
+ if (ec->x < zx)
+ ec->x = zx;
+
+ if (ec->y < zy)
+ ec->y = zy;
+
+ /* ensure we account for windows which already have client_inset;
+ * fixes lots of wine placement issues
+ */
+ if (ec->x - l >= zx)
+ ec->x -= l;
+ if (ec->y - t >= zy)
+ ec->y -= t;
+
+ if (ec->x + ec->w > zx + zw)
+ ec->x = zx + zw - ec->w;
+
+ if (ec->y + ec->h > zy + zh)
+ ec->y = zy + zh - ec->h;
+
+ // <--
+ if (ec->zone && e_comp_zone_xy_get(ec->comp, ec->x, ec->y))
+ {
+ if (!E_INSIDE(ec->x, ec->y, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h))
+ {
+ ec->x = E_CLAMP(ec->x, ec->zone->x, ec->zone->x + ec->zone->w);
+ ec->y = E_CLAMP(ec->y, ec->zone->y, ec->zone->y + ec->zone->h);
+ }
+ /* some application failing to correctly center a window */
+ if (eina_list_count(ec->comp->zones) > 1)
+ {
+ if (((abs((ec->comp->man->w / 2) - ec->x) < 3) || //ec->x is center of manager
+ ((abs((ec->comp->man->w / 2) - ec->x - ec->w) < 3) || //ec->x - ec->w is center of manager
+ (abs((ec->comp->man->w / 2) - ec->x - (ec->w / 2)) < 3))) || //ec->x - ec->w/2 is center of manager
+ ((abs((ec->comp->man->h / 2) - ec->y) < 3) || //ec->y is center of manager
+ ((abs((ec->comp->man->h / 2) - ec->y - ec->h) < 3) || //ec->y - ec->h is center of manager
+ (abs((ec->comp->man->h / 2) - ec->y - (ec->h / 2)) < 3))) //ec->y - ec->h/2 is center of manager
+ )
+ e_comp_object_util_center(ec->frame);
+ }
+ ec->changes.pos = 1;
+ ec->placed = 1;
+ }
+ }
+ else
+ {
+ ec->changes.pos = 1;
+ ec->placed = 1;
+ }
+ }
+ }
+ else
+ {
+ }
+ if (ec->icccm.min_w > 32767) ec->icccm.min_w = 32767;
+ if (ec->icccm.min_h > 32767) ec->icccm.min_h = 32767;
+ if (ec->icccm.max_w > 32767) ec->icccm.max_w = 32767;
+ if (ec->icccm.max_h > 32767) ec->icccm.max_h = 32767;
+ if (ec->icccm.base_w > 32767) ec->icccm.base_w = 32767;
+ if (ec->icccm.base_h > 32767) ec->icccm.base_h = 32767;
+ // if (ec->icccm.step_w < 1) ec->icccm.step_w = 1;
+ // if (ec->icccm.step_h < 1) ec->icccm.step_h = 1;
+ // if doing a resize, fix it up
+ if (e_client_resizing_get(ec))
+ {
+ int x, y, w, h, new_w, new_h;
+
+ x = ec->x;
+ y = ec->y;
+ w = ec->w;
+ h = ec->h;
+ new_w = w;
+ new_h = h;
+ e_client_resize_limit(ec, &new_w, &new_h);
+ if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_L) ||
+ (ec->resize_mode == E_POINTER_RESIZE_BL))
+ x += (w - new_w);
+ if ((ec->resize_mode == E_POINTER_RESIZE_TL) ||
+ (ec->resize_mode == E_POINTER_RESIZE_T) ||
+ (ec->resize_mode == E_POINTER_RESIZE_TR))
+ y += (h - new_h);
+ evas_object_geometry_set(ec->frame, x, y, new_w, new_h);
+ }
+ ec->icccm.fetch.size_pos_hints = 0;
+ rem_change = 1;
+ }
+ if (ec->icccm.fetch.protocol)
+ {
+ int i, num;
+ Ecore_X_WM_Protocol *proto;
+
+ proto = ecore_x_window_prop_protocol_list_get(win, &num);
+ if (proto)
+ {
+ for (i = 0; i < num; i++)
+ {
+ if (proto[i] == ECORE_X_WM_PROTOCOL_DELETE_REQUEST)
+ ec->icccm.delete_request = 1;
+ else if (proto[i] == ECORE_X_WM_PROTOCOL_TAKE_FOCUS)
+ ec->icccm.take_focus = 1;
+ else if (proto[i] == ECORE_X_NET_WM_PROTOCOL_PING)
+ ec->netwm.ping = 1;
+ else if (proto[i] == ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST)
+ {
+ ec->netwm.sync.request = 1;
+ if (!ecore_x_netwm_sync_counter_get(win,
+ &ec->netwm.sync.counter))
+ ec->netwm.sync.request = 0;
+ }
+ }
+ free(proto);
+ }
+ if (ec->netwm.ping && ec->comp_data->evas_init)
+ e_client_ping(ec);
+ else
+ E_FREE_FUNC(ec->ping_poller, ecore_poller_del);
+ ec->icccm.fetch.protocol = 0;
+ }
+ if (ec->icccm.fetch.transient_for)
+ {
+ /* TODO: What do to if the transient for isn't mapped yet? */
+ E_Client *ec_parent = NULL;
+
+ ec->icccm.transient_for = ecore_x_icccm_transient_for_get(win);
+ if (ec->icccm.transient_for)
+ ec_parent = _e_comp_x_client_find_by_window(ec->icccm.transient_for);
+ /* If we already have a parent, remove it */
+ if (ec->parent)
+ {
+ if (ec_parent != ec->parent)
+ {
+ ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
+ if (ec->parent->modal == ec) ec->parent->modal = NULL;
+ ec->parent = NULL;
+ }
+ else
+ ec_parent = NULL;
+ }
+ if ((ec_parent) && (ec_parent != ec) &&
+ (eina_list_data_find(ec->transients, ec_parent) != ec_parent))
+ {
+ ec_parent->transients = eina_list_append(ec_parent->transients, ec);
+ ec->parent = ec_parent;
+ }
+ if (ec->parent)
+ {
+ evas_object_layer_set(ec->frame, ec->parent->layer);
+ if (ec->netwm.state.modal)
+ {
+ ec->parent->modal = ec;
+ ec->parent->lock_close = 1;
+ if (!ec->parent->comp_data->lock_win)
+ {
+ eina_hash_add(clients_win_hash, &ec->parent->comp_data->lock_win, ec->parent);
+ ec->parent->comp_data->lock_win = ecore_x_window_input_new(e_client_util_pwin_get(ec->parent), 0, 0, ec->parent->w, ec->parent->h);
+ e_comp_ignore_win_add(E_PIXMAP_TYPE_X, ec->parent->comp_data->lock_win);
+ ecore_x_window_show(ec->parent->comp_data->lock_win);
+ ecore_x_icccm_name_class_set(ec->parent->comp_data->lock_win, "comp_data->lock_win", "comp_data->lock_win");
+ }
+ }
+
+ if (e_config->focus_setting == E_FOCUS_NEW_DIALOG ||
+ (ec->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
+ ec->take_focus = 1;
+ }
+ ec->icccm.fetch.transient_for = 0;
+ rem_change = 1;
+ }
+ if (ec->icccm.fetch.window_role)
+ {
+ char *role = ecore_x_icccm_window_role_get(win);
+ eina_stringshare_replace(&ec->icccm.window_role, role);
+ free(role);
+
+ ec->icccm.fetch.window_role = 0;
+ rem_change = 1;
+ }
+ if (ec->icccm.fetch.icon_name)
+ {
+ char *icon_name = ecore_x_icccm_icon_name_get(win);
+ eina_stringshare_replace(&ec->icccm.icon_name, icon_name);
+ free(icon_name);
+
+ ec->hacks.iconic_shading =
+ ((ec->netwm.icon_name == ec->netwm.name) &&
+ (!e_util_strcmp(ec->netwm.icon_name, "QEMU")));
+
+ ec->icccm.fetch.icon_name = 0;
+ rem_change = 1;
+ }
+ if (ec->netwm.fetch.icon_name)
+ {
+ char *icon_name;
+ ecore_x_netwm_icon_name_get(win, &icon_name);
+ eina_stringshare_replace(&ec->netwm.icon_name, icon_name);
+ free(icon_name);
+
+ ec->netwm.fetch.icon_name = 0;
+ rem_change = 1;
+ }
+ if (ec->netwm.fetch.opacity)
+ {
+ unsigned int val;
+
+ if (ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, &val, 1) > 0)
+ {
+ val = (val >> 24);
+ if (ec->netwm.opacity != val)
+ {
+ ec->netwm.opacity = val;
+ rem_change = 1;
+ }
+ }
+ }
+ if (ec->netwm.fetch.icon)
+ {
+ int i;
+ if (ec->netwm.icons)
+ {
+ for (i = 0; i < ec->netwm.num_icons; i++)
+ {
+ free(ec->netwm.icons[i].data);
+ ec->netwm.icons[i].data = NULL;
+ }
+ free(ec->netwm.icons);
+ }
+ ec->netwm.icons = NULL;
+ ec->netwm.num_icons = 0;
+ if (ecore_x_netwm_icons_get(win,
+ &ec->netwm.icons,
+ &ec->netwm.num_icons))
+ {
+ // unless the rest of e uses border icons OTHER than icon #0
+ // then free the rest that we don't need anymore.
+ for (i = 1; i < ec->netwm.num_icons; i++)
+ {
+ free(ec->netwm.icons[i].data);
+ ec->netwm.icons[i].data = NULL;
+ }
+ ec->netwm.num_icons = 1;
+ ec->changes.icon = 1;
+ }
+ ec->netwm.fetch.icon = 0;
+ }
+ if (ec->netwm.fetch.user_time)
+ {
+ ecore_x_netwm_user_time_get(win, &ec->netwm.user_time);
+ ec->netwm.fetch.user_time = 0;
+ }
+ if (ec->netwm.fetch.strut)
+ {
+ if (!ecore_x_netwm_strut_partial_get(win,
+ &ec->netwm.strut.left,
+ &ec->netwm.strut.right,
+ &ec->netwm.strut.top,
+ &ec->netwm.strut.bottom,
+ &ec->netwm.strut.left_start_y,
+ &ec->netwm.strut.left_end_y,
+ &ec->netwm.strut.right_start_y,
+ &ec->netwm.strut.right_end_y,
+ &ec->netwm.strut.top_start_x,
+ &ec->netwm.strut.top_end_x,
+ &ec->netwm.strut.bottom_start_x,
+ &ec->netwm.strut.bottom_end_x))
+ {
+ ecore_x_netwm_strut_get(win,
+ &ec->netwm.strut.left, &ec->netwm.strut.right,
+ &ec->netwm.strut.top, &ec->netwm.strut.bottom);
+
+ ec->netwm.strut.left_start_y = 0;
+ ec->netwm.strut.left_end_y = 0;
+ ec->netwm.strut.right_start_y = 0;
+ ec->netwm.strut.right_end_y = 0;
+ ec->netwm.strut.top_start_x = 0;
+ ec->netwm.strut.top_end_x = 0;
+ ec->netwm.strut.bottom_start_x = 0;
+ ec->netwm.strut.bottom_end_x = 0;
+ }
+ ec->netwm.fetch.strut = 0;
+ }
+ if (ec->qtopia.fetch.soft_menu)
+ {
+ e_hints_window_qtopia_soft_menu_get(ec);
+ ec->qtopia.fetch.soft_menu = 0;
+ rem_change = 1;
+ }
+ if (ec->qtopia.fetch.soft_menus)
+ {
+ e_hints_window_qtopia_soft_menus_get(ec);
+ ec->qtopia.fetch.soft_menus = 0;
+ rem_change = 1;
+ }
+ if (ec->vkbd.fetch.state)
+ {
+ e_hints_window_virtual_keyboard_state_get(ec);
+ ec->vkbd.fetch.state = 0;
+ rem_change = 1;
+ }
+ if (ec->vkbd.fetch.vkbd)
+ {
+ e_hints_window_virtual_keyboard_get(ec);
+ ec->vkbd.fetch.vkbd = 0;
+ rem_change = 1;
+ }
+ if (ec->illume.conformant.fetch.conformant)
+ {
+ ec->illume.conformant.conformant =
+ ecore_x_e_illume_conformant_get(win);
+ ec->illume.conformant.fetch.conformant = 0;
+ }
+ if (ec->illume.quickpanel.fetch.state)
+ {
+ ec->illume.quickpanel.state =
+ ecore_x_e_illume_quickpanel_state_get(win);
+ ec->illume.quickpanel.fetch.state = 0;
+ }
+ if (ec->illume.quickpanel.fetch.quickpanel)
+ {
+ ec->illume.quickpanel.quickpanel =
+ ecore_x_e_illume_quickpanel_get(win);
+ ec->illume.quickpanel.fetch.quickpanel = 0;
+ }
+ if (ec->illume.quickpanel.fetch.priority.major)
+ {
+ ec->illume.quickpanel.priority.major =
+ ecore_x_e_illume_quickpanel_priority_major_get(win);
+ ec->illume.quickpanel.fetch.priority.major = 0;
+ }
+ if (ec->illume.quickpanel.fetch.priority.minor)
+ {
+ ec->illume.quickpanel.priority.minor =
+ ecore_x_e_illume_quickpanel_priority_minor_get(win);
+ ec->illume.quickpanel.fetch.priority.minor = 0;
+ }
+ if (ec->illume.quickpanel.fetch.zone)
+ {
+ ec->illume.quickpanel.zone =
+ ecore_x_e_illume_quickpanel_zone_get(win);
+ ec->illume.quickpanel.fetch.zone = 0;
+ }
+ if (ec->illume.drag.fetch.drag)
+ {
+ ec->illume.drag.drag =
+ ecore_x_e_illume_drag_get(win);
+ ec->illume.drag.fetch.drag = 0;
+ }
+ if (ec->illume.drag.fetch.locked)
+ {
+ ec->illume.drag.locked =
+ ecore_x_e_illume_drag_locked_get(win);
+ ec->illume.drag.fetch.locked = 0;
+ }
+ if (ec->illume.win_state.fetch.state)
+ {
+ ec->illume.win_state.state =
+ ecore_x_e_illume_window_state_get(win);
+ ec->illume.win_state.fetch.state = 0;
+ }
+ if (ec->changes.shape)
+ {
+ Ecore_X_Rectangle *rects;
+ int num;
+ Eina_Bool pshaped = ec->shaped;
+
+ ec->changes.shape = 0;
+ rects = ecore_x_window_shape_rectangles_get(win, &num);
+ if (rects)
+ {
+ int cw = 0, ch = 0;
+
+ /* This doesn't fix the race, but makes it smaller. we detect
+ * this and if cw and ch != client w/h then mark this as needing
+ * a shape change again to fixup next event loop.
+ */
+ ecore_x_window_size_get(win, &cw, &ch);
+ /* normalize for client window dead zone */
+ if (ec->border_size && (num == 1))
+ {
+ rects[0].x += ec->border_size;
+ rects[0].y += ec->border_size;
+ rects[0].width -= ec->border_size;
+ rects[0].height -= ec->border_size;
+ }
+ if ((cw != ec->client.w) || (ch != ec->client.h))
+ {
+ ec->changes.shape = 1;
+ EC_CHANGED(ec);
+ }
+ if ((num == 1) &&
+ (rects[0].x == 0) &&
+ (rects[0].y == 0) &&
+ ((int)rects[0].width == cw) &&
+ ((int)rects[0].height == ch))
+ {
+ if (ec->shaped)
+ {
+ ec->shaped = 0;
+ if (ec->comp_data->reparented && (!ec->bordername))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ }
+ else
+ {
+ if (ec->comp_data->reparented)
+ {
+ ecore_x_window_shape_rectangles_set(pwin, rects, num);
+ if ((!ec->shaped) && (!ec->bordername))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ ec->shaped = 1;
+ ec->changes.shape_input = 0;
+ E_FREE(ec->shape_input_rects);
+ ec->shape_input_rects_num = 0;
+ }
+ free(rects);
+ }
+ else
+ {
+ // FIXME: no rects i think can mean... totally empty window
+ if (ec->shaped && ec->comp_data->reparented && (!ec->bordername))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ ec->shaped = 0;
+ }
+ if (ec->shaped != pshaped)
+ {
+ _e_comp_x_client_shape_input_rectangle_set(ec);
+ if ((!ec->shaped) && ec->comp_data->reparented)
+ ecore_x_window_shape_mask_set(pwin, 0);
+ }
+ ec->need_shape_merge = 1;
+ }
+ if (ec->changes.shape_input)
+ {
+ Ecore_X_Rectangle *rects;
+ Eina_Bool pshaped = ec->shaped_input, changed = EINA_FALSE;
+ int num;
+
+ ec->changes.shape_input = 0;
+ rects = ecore_x_window_shape_input_rectangles_get(win, &num);
+ if (rects)
+ {
+ int cw = 0, ch = 0;
+
+ /* This doesn't fix the race, but makes it smaller. we detect
+ * this and if cw and ch != client w/h then mark this as needing
+ * a shape change again to fixup next event loop.
+ */
+ ecore_x_window_size_get(win, &cw, &ch);
+ /* normalize for client window dead zone */
+ if (ec->border_size && (num == 1))
+ {
+ rects[0].x += ec->border_size;
+ rects[0].y += ec->border_size;
+ rects[0].width -= ec->border_size;
+ rects[0].height -= ec->border_size;
+ }
+ if ((cw != ec->client.w) || (ch != ec->client.h))
+ ec->changes.shape_input = 1;
+ if (num == 1)
+ E_RECTS_CLIP_TO_RECT(rects[0].x, rects[0].y, rects[0].width, rects[0].height, 0, 0, cw, ch);
+ if ((num == 1) &&
+ (rects[0].x == 0) &&
+ (rects[0].y == 0) &&
+ ((int)rects[0].width == cw) &&
+ ((int)rects[0].height == ch))
+ {
+ if (ec->shaped_input)
+ {
+ ec->shaped_input = 0;
+ if (ec->comp_data->reparented && (!ec->bordername))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ free(rects);
+ }
+ else
+ {
+ if (!ec->shaped_input)
+ {
+ ec->shaped_input = 1;
+ if (ec->comp_data->reparented && (!ec->bordername))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ if (ec->comp_data->reparented)
+ ecore_x_window_shape_input_rectangles_set(pwin, rects, num);
+ changed = EINA_TRUE;
+ free(ec->shape_input_rects);
+ ec->shape_input_rects = (Eina_Rectangle*)rects;
+ ec->shape_input_rects_num = num;
+ }
+ }
+ else
+ {
+ ec->shaped_input = 1;
+ if (ec->comp_data->reparented && (!ec->bordername))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ if (changed || (pshaped != ec->shaped_input))
+ ec->need_shape_merge = 1;
+ }
+ if (ec->changes.prop || ec->mwm.fetch.hints)
+ {
+ int pb;
+
+ ec->mwm.exists =
+ ecore_x_mwm_hints_get(win,
+ &ec->mwm.func,
+ &ec->mwm.decor,
+ &ec->mwm.input);
+ pb = ec->mwm.borderless;
+ ec->mwm.borderless = 0;
+ if (ec->mwm.exists)
+ {
+ if ((!(ec->mwm.decor & ECORE_X_MWM_HINT_DECOR_ALL)) &&
+ (!(ec->mwm.decor & ECORE_X_MWM_HINT_DECOR_TITLE)) &&
+ (!(ec->mwm.decor & ECORE_X_MWM_HINT_DECOR_BORDER)))
+ ec->mwm.borderless = 1;
+ }
+ if (ec->mwm.borderless != pb)
+ {
+ if (ec->comp_data->reparented && ((!ec->lock_border) || (!ec->border.name)))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ }
+ ec->mwm.fetch.hints = 0;
+ rem_change = 1;
+ }
+ if (ec->e.fetch.video_parent)
+ {
+ /* unlinking child/parent */
+ if (ec->e.state.video_parent_client != NULL)
+ {
+ ec->e.state.video_parent_client->e.state.video_child =
+ eina_list_remove(ec->e.state.video_parent_client->e.state.video_child, ec);
+ }
+
+ ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_VIDEO_PARENT,
+ (Ecore_X_Window*)&ec->e.state.video_parent, 1);
+
+ /* linking child/parent */
+ if (ec->e.state.video_parent != 0)
+ {
+ E_Client *tmp;
+
+ tmp = _e_comp_x_client_find_by_window(ec->e.state.video_parent);
+ if (tmp)
+ {
+ /* fprintf(stderr, "child added to parent \\o/\n"); */
+ ec->e.state.video_parent_client = tmp;
+ tmp->e.state.video_child = eina_list_append(tmp->e.state.video_child, ec);
+ if (ec->desk != tmp->desk)
+ e_client_desk_set(ec, tmp->desk);
+ }
+ }
+
+ /* fprintf(stderr, "new parent %x => %p\n", ec->e.state.video_parent, ec->e.state.video_parent_client); */
+
+ if (ec->e.state.video_parent_client) ec->e.fetch.video_parent = 0;
+ rem_change = 1;
+ }
+ if (ec->e.fetch.video_position && ec->e.fetch.video_parent == 0)
+ {
+ unsigned int xy[2];
+
+ ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_VIDEO_POSITION,
+ xy, 2);
+ ec->e.state.video_position.x = xy[0];
+ ec->e.state.video_position.y = xy[1];
+ ec->e.state.video_position.updated = 1;
+ ec->e.fetch.video_position = 0;
+ ec->x = ec->e.state.video_position.x;
+ ec->y = ec->e.state.video_position.y;
+
+ fprintf(stderr, "internal position has been updated [%i, %i]\n", ec->e.state.video_position.x, ec->e.state.video_position.y);
+ }
+ if (ec->changes.prop || ec->netwm.update.state)
+ {
+ e_hints_window_state_set(ec);
+ /* Some stats might change the border, like modal */
+ if (((!ec->lock_border) || (!ec->border.name)) &&
+ (!(((ec->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN))) &&
+ ec->comp_data->reparented)
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+ if (ec->parent)
+ {
+ if (ec->netwm.state.modal)
+ {
+ ec->parent->modal = ec;
+ if (ec->parent->focused)
+ evas_object_focus_set(ec->frame, 1);
+ }
+ }
+ else if (ec->leader)
+ {
+ if (ec->netwm.state.modal)
+ {
+ ec->leader->modal = ec;
+ if (ec->leader->focused)
+ evas_object_focus_set(ec->frame, 1);
+ else
+ {
+ Eina_List *l;
+ E_Client *child;
+
+ EINA_LIST_FOREACH(ec->leader->group, l, child)
+ {
+ if ((child != ec) && (child->focused))
+ evas_object_focus_set(ec->frame, 1);
+ }
+ }
+ }
+ }
+ ec->netwm.update.state = 0;
+ }
+
+ if ((e_config->use_desktop_window_profile) && (need_desk_set))
+ {
+ if (!(ec->e.state.profile.name) &&
+ (ec->e.state.profile.num >= 1))
+ {
+ const char *p = NULL;
+ int i;
+ for (i = 0; i < ec->e.state.profile.num; i++)
+ {
+ if (!ec->e.state.profile.available_list[i])
+ continue;
+ p = ec->e.state.profile.available_list[i];
+ if (strcmp(ec->desk->window_profile, p) == 0)
+ {
+ ec->e.state.profile.name = eina_stringshare_add(ec->desk->window_profile);
+ break;
+ }
+ }
+
+ if (!ec->e.state.profile.name)
+ {
+ E_Comp *c = ec->comp;
+ E_Desk *desk = NULL;
+
+ for (i = 0; i < ec->e.state.profile.num; i++)
+ {
+ if (!ec->e.state.profile.available_list[i])
+ continue;
+ p = ec->e.state.profile.available_list[i];
+ desk = e_comp_desk_window_profile_get(c, p);
+ if ((desk) && (ec->desk != desk))
+ {
+ ec->e.state.profile.name = eina_stringshare_add(p);
+ break;
+ }
+ }
+ }
+ }
+
+ if (!ec->e.state.profile.name)
+ {
+ ec->e.state.profile.name = eina_stringshare_add(ec->desk->window_profile);
+ }
+
+ ecore_x_e_window_profile_change_request_send(win,
+ ec->e.state.profile.name);
+ ec->e.state.profile.wait_for_done = 1;
+ }
+ if (ec->comp_data->fetch_exe)
+ {
+ E_Exec_Instance *inst;
+
+ if (((!ec->lock_border) || (!ec->border.name)) && (ec->comp_data->reparented))
+ {
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
+ }
+
+ {
+ char *str = NULL;
+
+ if ((!ec->internal) &&
+ ((ecore_x_netwm_startup_id_get(win, &str) && (str)) ||
+ ((ec->icccm.client_leader > 0) &&
+ ecore_x_netwm_startup_id_get(ec->icccm.client_leader, &str) && (str)))
+ )
+ {
+ if (!strncmp(str, "E_START|", 8))
+ {
+ int id;
+
+ id = atoi(str + 8);
+ if (id > 0) ec->netwm.startup_id = id;
+ }
+ free(str);
+ }
+ }
+ /* It's ok not to have fetch flag, should only be set on startup
+ * * and not changed. */
+ if (!ecore_x_netwm_pid_get(win, &ec->netwm.pid))
+ {
+ if (ec->icccm.client_leader)
+ {
+ if (!ecore_x_netwm_pid_get(ec->icccm.client_leader, &ec->netwm.pid))
+ ec->netwm.pid = -1;
+ }
+ else
+ ec->netwm.pid = -1;
+ }
+
+ if (!e_client_util_ignored_get(ec))
+ {
+ inst = e_exec_startup_id_pid_instance_find(ec->netwm.startup_id,
+ ec->netwm.pid);
+ if (inst)
+ {
+ Eina_Bool found;
+
+ if (inst->used == 0)
+ {
+ E_Zone *zone;
+ E_Desk *desk;
+
+ inst->used++;
+ zone = e_comp_zone_number_get(ec->comp, inst->screen);
+ if (zone) e_client_zone_set(ec, zone);
+ desk = e_desk_at_xy_get(ec->zone, inst->desk_x,
+ inst->desk_y);
+ if (desk) e_client_desk_set(ec, desk);
+ if (ec->netwm.pid != ecore_exe_pid_get(inst->exe))
+ {
+ /* most likely what has happened here is that the .desktop launcher
+ * has spawned a process which then created this border, meaning the
+ * E_Exec instance will be deleted in a moment, and we will be unable to track it.
+ * to prevent this, we convert our instance to a phony
+ */
+ inst->phony = 1;
+ }
+ }
+ found = !!inst->clients;
+ e_exec_instance_client_add(inst, ec);
+ if (!found)
+ e_exec_instance_found(inst);
+ }
+
+ if (e_config->window_grouping) // FIXME: We may want to make the border "urgent" so that the user knows it appeared.
+ {
+ E_Client *ecl = NULL;
+
+ ecl = ec->parent;
+ if (!ecl)
+ ecl = ec->leader;
+ if (!ecl)
+ {
+ E_Client *child = e_client_bottom_get(ec->comp);
+
+ do
+ {
+ if (child == ec) continue;
+ if (e_object_is_del(E_OBJECT(child))) continue;
+ if ((ec->icccm.client_leader) &&
+ (child->icccm.client_leader ==
+ ec->icccm.client_leader))
+ {
+ ecl = child;
+ break;
+ }
+ child = e_client_above_get(child);
+ } while (child);
+ }
+ if (ecl)
+ {
+ if (ecl->zone)
+ e_client_zone_set(ec, ecl->zone);
+ if (ecl->desk)
+ e_client_desk_set(ec, ecl->desk);
+ else
+ e_client_stick(ec);
+ }
+ }
+ }
+ ec->comp_data->fetch_exe = 0;
+ }
+ ec->changes.prop = 0;
+ if (rem_change) e_remember_update(ec);
+ if (!ec->comp_data->reparented) ec->changes.border = 0;
+ if (ec->changes.icon)
+ {
+ /* don't create an icon until we need it */
+ if (ec->comp_data->reparented) return;
+ ec->comp_data->change_icon = 1;
+ ec->changes.icon = 0;
+ }
+}
+
+static void
+_e_comp_x_hook_client_new(void *d EINA_UNUSED, E_Client *ec)
+{
+ Ecore_X_Window win;
+
+ E_COMP_X_PIXMAP_CHECK;
+ win = e_pixmap_window_get(ec->pixmap);
+ ec->ignored = e_comp_ignore_win_find(win);
+
+ ec->comp_data = E_NEW(E_Comp_Client_Data, 1);
+ ec->comp_data->set_win_type = ec->comp_data->fetch_exe = 1;
+
+ /* FIXME: ewww - round trip */
+ ec->argb = ecore_x_window_argb_get(win);
+ ec->changes.shape = 1;
+ ec->changes.shape_input = 1;
+
+ ec->netwm.type = E_WINDOW_TYPE_UNKNOWN;
+ ec->icccm.state = ECORE_X_WINDOW_STATE_HINT_NONE;
+
+ if (!_e_comp_x_client_new_helper(ec)) return;
+
+ eina_hash_add(clients_win_hash, &win, ec);
+ e_hints_client_list_set();
+}
+
+static void
+_e_comp_x_hook_client_focus_unset(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ _e_comp_x_focus_check(ec->comp);
+}
+
+static void
+_e_comp_x_hook_client_focus_set(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ focus_time = ecore_x_current_time_get();
+
+ if ((ec->icccm.take_focus) && (ec->icccm.accepts_focus))
+ {
+ e_grabinput_focus(e_client_util_win_get(ec), E_FOCUS_METHOD_LOCALLY_ACTIVE);
+ /* TODO what if the client didn't take focus ? */
+ }
+ else if (!ec->icccm.accepts_focus)
+ {
+ e_grabinput_focus(e_client_util_win_get(ec), E_FOCUS_METHOD_GLOBALLY_ACTIVE);
+ }
+ else if (!ec->icccm.take_focus)
+ {
+ e_grabinput_focus(e_client_util_win_get(ec), E_FOCUS_METHOD_PASSIVE);
+ }
+}
+
+static void
+_e_comp_x_hook_client_redirect(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ if (ec->comp->nocomp)
+ {
+ /* first window */
+ ec->comp->nocomp = 0;
+ ecore_x_composite_redirect_subwindows(ec->comp->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
+ ecore_x_window_show(ec->comp->win);
+ }
+ if (!ec->comp_data->damage)
+ _e_comp_x_client_damage_add(ec);
+}
+
+static void
+_e_comp_x_hook_client_unredirect(void *d EINA_UNUSED, E_Client *ec)
+{
+ Ecore_X_Region parts;
+
+ E_COMP_X_PIXMAP_CHECK;
+ eina_hash_del(damages_hash, &ec->comp_data->damage, ec);
+ parts = ecore_x_region_new(NULL, 0);
+ ecore_x_damage_subtract(ec->comp_data->damage, 0, parts);
+ ecore_x_region_free(parts);
+ ecore_x_damage_free(ec->comp_data->damage);
+ ec->comp_data->damage = 0;
+
+ if (!ec->comp->nocomp) return; //wait for it...
+ ecore_x_composite_unredirect_subwindows(ec->comp->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
+ ecore_x_window_hide(ec->comp->win);
+}
+
+static void
+_e_comp_x_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
+{
+ Ecore_X_Window win;
+ unsigned int visible = 0;
+
+ E_COMP_X_PIXMAP_CHECK;
+ win = e_client_util_win_get(ec);
+
+ if ((!stopping) && (!ec->comp_data->deleted))
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_MANAGED, &visible, 1);
+ if ((!ec->already_unparented) && ec->comp_data->reparented)
+ {
+ e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ _e_comp_x_focus_setdown(ec);
+ if (!ec->comp_data->deleted)
+ {
+ if (stopping)
+ ecore_x_window_reparent(win, ec->comp->man->root,
+ ec->client.x, ec->client.y);
+
+ else
+ /* put the window back where we found it to prevent annoying dancing windows */
+ ecore_x_window_reparent(win, ec->comp->man->root,
+ ec->comp_data->initial_attributes.x,
+ ec->comp_data->initial_attributes.y);
+ if (!ec->internal)
+ ecore_x_window_save_set_del(win);
+ }
+ }
+ ec->already_unparented = 1;
+ eina_hash_del_by_key(clients_win_hash, &win);
+ if (ec->comp_data->damage)
+ {
+ eina_hash_del(damages_hash, &ec->comp_data->damage, ec);
+ ecore_x_damage_free(ec->comp_data->damage);
+ }
+ if (ec->comp_data->reparented)
+ {
+ win = e_client_util_pwin_get(ec);
+ eina_hash_del_by_key(clients_win_hash, &win);
+ e_pixmap_parent_window_set(ec->pixmap, 0);
+ ecore_x_window_free(win);
+ }
+
+ if (ec->hacks.mapping_change)
+ _e_comp_x_mapping_change_disabled--;
+ if (ec->parent && (ec->parent->modal == ec))
+ {
+ if (ec->parent->comp_data->lock_win)
+ {
+ eina_hash_del_by_key(clients_win_hash, &ec->parent->comp_data->lock_win);
+ ecore_x_window_hide(ec->parent->comp_data->lock_win);
+ ecore_x_window_free(ec->parent->comp_data->lock_win);
+ ec->parent->comp_data->lock_win = 0;
+ }
+ ec->parent->lock_close = 0;
+ ec->parent->modal = NULL;
+ }
+ E_FREE(ec->comp_data);
+ if (post_clients)
+ post_clients = eina_list_remove(post_clients, ec);
+
+ _e_comp_x_focus_check(ec->comp);
+}
+
+static void
+_e_comp_x_hook_client_move_end(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ ec->comp_data->moving = 0;
+ if (!ec->comp_data->move_counter) return;
+ ec->comp_data->move_counter = 0;
+ ec->post_move = 1;
+ _e_comp_x_post_client_idler_add(ec);
+}
+
+static void
+_e_comp_x_hook_client_move_begin(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ ec->comp_data->moving = 1;
+}
+
+static void
+_e_comp_x_hook_client_resize_end(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ if (!ec->netwm.sync.alarm) return;
+ eina_hash_del_by_key(alarm_hash, &ec->netwm.sync.alarm);
+ ecore_x_sync_alarm_free(ec->netwm.sync.alarm);
+ ec->netwm.sync.alarm = 0;
+ /* resize to last geometry if sync alarm for it was not yet handled */
+ if (ec->pending_resize)
+ {
+ EC_CHANGED(ec);
+ ec->changes.pos = 1;
+ ec->changes.size = 1;
+ }
+
+ E_FREE_LIST(ec->pending_resize, free);
+}
+
+static void
+_e_comp_x_hook_client_resize_begin(void *d EINA_UNUSED, E_Client *ec)
+{
+ E_COMP_X_PIXMAP_CHECK;
+ if (!ec->netwm.sync.request) return;
+ eina_hash_add(alarm_hash, &ec->netwm.sync.alarm, ec);
+ ec->netwm.sync.alarm = ecore_x_sync_alarm_new(ec->netwm.sync.counter);
+ ec->netwm.sync.serial = 1;
+ ec->netwm.sync.wait = 0;
+ ec->netwm.sync.send_time = ecore_loop_time_get();
+}
+
+static void
+_e_comp_x_hook_client_desk_set(void *d EINA_UNUSED, E_Client *ec)
+{
+ unsigned int num[2];
+ int x, y;
+
+ E_COMP_X_PIXMAP_CHECK;
+ e_desk_xy_get(ec->desk, &x, &y);
+ num[0] = x, num[1] = y;
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_DESK, num, 2);
+}
+
+static Eina_Bool
+_e_comp_x_cb_ping(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_X_Event_Ping *ev)
+{
+ E_Client *ec;
+
+ ec = _e_comp_x_client_find_by_window(ev->event_win);
+ if (ec) ec->ping_ok = 1;
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_comp_x_cb_frame_extents_request(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_X_Event_Frame_Extents_Request *ev)
+{
+ E_Manager *man;
+ Ecore_X_Window_Type type;
+ Ecore_X_MWM_Hint_Decor decor;
+ Ecore_X_Window_State *state;
+ Ecore_X_Window win;
+ Frame_Extents *extents;
+ const char *border, *sig, *key;
+ int ok;
+ unsigned int i, num;
+
+ win = ecore_x_window_parent_get(ev->win);
+ man = e_manager_find_by_root(win);
+ if (!man) return ECORE_CALLBACK_PASS_ON;
+
+ /* TODO:
+ * * We need to check if we remember this window, and border locking is set
+ */
+ border = "default";
+ key = border;
+ ok = ecore_x_mwm_hints_get(ev->win, NULL, &decor, NULL);
+ if ((ok) &&
+ (!(decor & ECORE_X_MWM_HINT_DECOR_ALL)) &&
+ (!(decor & ECORE_X_MWM_HINT_DECOR_TITLE)) &&
+ (!(decor & ECORE_X_MWM_HINT_DECOR_BORDER)))
+ {
+ border = "borderless";
+ key = border;
+ }
+
+ ok = ecore_x_netwm_window_type_get(ev->win, &type);
+ if ((ok) &&
+ ((type == ECORE_X_WINDOW_TYPE_DESKTOP) ||
+ (type == ECORE_X_WINDOW_TYPE_DOCK)))
+ {
+ border = "borderless";
+ key = border;
+ }
+
+ sig = NULL;
+ ecore_x_netwm_window_state_get(ev->win, &state, &num);
+ if (state)
+ {
+ int maximized = 0;
+
+ for (i = 0; i < num; i++)
+ {
+ switch (state[i])
+ {
+ case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
+ maximized++;
+ break;
+
+ case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
+ maximized++;
+ break;
+
+ case ECORE_X_WINDOW_STATE_FULLSCREEN:
+ border = "borderless";
+ key = border;
+ break;
+
+ case ECORE_X_WINDOW_STATE_SHADED:
+ case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
+ case ECORE_X_WINDOW_STATE_SKIP_PAGER:
+ case ECORE_X_WINDOW_STATE_HIDDEN:
+ case ECORE_X_WINDOW_STATE_ICONIFIED:
+ case ECORE_X_WINDOW_STATE_MODAL:
+ case ECORE_X_WINDOW_STATE_STICKY:
+ case ECORE_X_WINDOW_STATE_ABOVE:
+ case ECORE_X_WINDOW_STATE_BELOW:
+ case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
+ case ECORE_X_WINDOW_STATE_UNKNOWN:
+ break;
+ }
+ }
+ if ((maximized == 2) &&
+ (e_config->maximize_policy == E_MAXIMIZE_FULLSCREEN))
+ {
+ sig = "ev,action,maximize,fullscreen";
+ key = "maximize,fullscreen";
+ }
+ free(state);
+ }
+
+ extents = eina_hash_find(frame_extents, key);
+ if (!extents)
+ {
+ Evas_Object *o;
+ char buf[1024];
+
+ extents = E_NEW(Frame_Extents, 1);
+ if (!extents) return ECORE_CALLBACK_RENEW;
+
+ o = edje_object_add(man->comp->evas);
+ snprintf(buf, sizeof(buf), "ev/widgets/border/%s/border", border);
+ ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
+ if (ok)
+ {
+ Evas_Coord x, y, w, h;
+
+ if (sig)
+ {
+ edje_object_signal_emit(o, sig, "ev");
+ edje_object_message_signal_process(o);
+ }
+
+ evas_object_resize(o, 1000, 1000);
+ edje_object_calc_force(o);
+ edje_object_part_geometry_get(o, "ev.swallow.client",
+ &x, &y, &w, &h);
+ extents->l = x;
+ extents->r = 1000 - (x + w);
+ extents->t = y;
+ extents->b = 1000 - (y + h);
+ }
+ else
+ {
+ extents->l = 0;
+ extents->r = 0;
+ extents->t = 0;
+ extents->b = 0;
+ }
+ evas_object_del(o);
+ eina_hash_add(frame_extents, key, extents);
+ }
+
+ if (extents)
+ ecore_x_netwm_frame_size_set(ev->win, extents->l, extents->r, extents->t, extents->b);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_e_comp_x_pre_swap(void *data, Evas *e EINA_UNUSED)
+{
+ E_Comp *c = data;
+
+ if (!e_comp_config_get()->grab) return;
+ if (!c->grabbed) return;
+ ecore_x_ungrab();
+ c->grabbed = 0;
+}
+
+static Eina_Bool
+_e_comp_x_xinerama_setup(int rw, int rh)
+{
+ int n, i;
+ E_Screen *screen;
+ Eina_List *all_screens = NULL;
+
+ /* first (and only) root window */
+ /* get number of xinerama screens */
+ n = ecore_x_xinerama_screen_count_get();
+ if (n < 2)
+ {
+ screen = E_NEW(E_Screen, 1);
+ screen->escreen = screen->screen = 0;
+ screen->x = 0;
+ screen->y = 0;
+ screen->w = rw;
+ screen->h = rh;
+ all_screens = eina_list_append(all_screens, screen);
+ }
+ else
+ {
+ for (i = 0; i < n; i++)
+ {
+ int x, y, w, h;
+
+ /* get each xinerama screen geometry */
+ if (ecore_x_xinerama_screen_geometry_get(i, &x, &y, &w, &h))
+ {
+ INF("E19 INIT: XINERAMA SCREEN: [%i][%i], %ix%i+%i+%i",
+ i, i, w, h, x, y);
+ /* add it to our list */
+ screen = E_NEW(E_Screen, 1);
+ screen->escreen = screen->screen = i;
+ screen->x = x;
+ screen->y = y;
+ screen->w = w;
+ screen->h = h;
+ all_screens = eina_list_append(all_screens, screen);
+ }
+ }
+ }
+ e_xinerama_screens_set(all_screens);
+ return EINA_TRUE;
+}
+
+static void
+_e_comp_x_ee_resize(Ecore_Evas *ee)
+{
+ E_Client *ec;
+ E_Comp *c = ecore_evas_data_get(ee, "comp");
+
+ ecore_x_netwm_desk_size_set(c->man->root, c->man->w, c->man->h);
+ _e_comp_x_xinerama_setup(c->man->w, c->man->h);
+
+ e_comp_canvas_update(c);
+ ec = e_client_bottom_get(c);
+ while (ec)
+ {
+ _e_comp_x_client_zone_geometry_set(ec);
+ ec = e_client_above_get(ec);
+ }
+}
+
+static void
+_e_comp_x_del(E_Comp *c)
+{
+ unsigned int i;
+
+ ecore_x_window_key_ungrab(c->man->root, "F", ECORE_EVENT_MODIFIER_SHIFT |
+ ECORE_EVENT_MODIFIER_CTRL |
+ ECORE_EVENT_MODIFIER_ALT, 0);
+ ecore_x_window_key_ungrab(c->man->root, "Home", ECORE_EVENT_MODIFIER_SHIFT |
+ ECORE_EVENT_MODIFIER_CTRL |
+ ECORE_EVENT_MODIFIER_ALT, 0);
+ if (c->grabbed)
+ {
+ c->grabbed = 0;
+ ecore_x_ungrab();
+ }
+
+ for (i = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); i <= e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); i++)
+ ecore_x_window_free(c->layers[i].win);
+
+ ecore_x_composite_unredirect_subwindows
+ (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
+ if (c->block_win) ecore_x_window_free(c->block_win);
+ ecore_x_composite_render_window_disable(c->win);
+ if (c->man->num == 0) e_alert_composite_win(c->man->root, 0);
+
+ ecore_x_window_free(c->cm_selection);
+ ecore_x_screen_is_composited_set(c->man->num, 0);
+
+ free(c->comp_data);
+}
+
+static void
+_e_comp_x_manage_windows(E_Comp *c)
+{
+ E_Manager *man = c->man;
+ Ecore_X_Window *windows;
+ int wnum;
+ int i;
+ const char *atom_names[] =
+ {
+ "_XEMBED_INFO",
+ "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR",
+ "KWM_DOCKWINDOW"
+ };
+ Ecore_X_Atom atoms[3];
+ Ecore_X_Atom atom_xmbed, atom_kde_netwm_systray, atom_kwm_dockwindow;
+ int count;
+
+ /* a manager is designated for each root. lets get all the windows in
+ the managers root */
+ windows = ecore_x_window_children_get(man->root, &wnum);
+ if (!windows) return;
+
+ ecore_x_atoms_get(atom_names, 3, atoms);
+ atom_xmbed = atoms[0];
+ atom_kde_netwm_systray = atoms[1];
+ atom_kwm_dockwindow = atoms[2];
+ for (i = 0; i < wnum; i++)
+ {
+ unsigned int ret_val, deskxy[2];
+ unsigned char *data = NULL;
+ int ret;
+ E_Client *ec = NULL;
+
+ if ((c->win == windows[i]) || (c->ee_win == windows[i]) ||
+ (c->man->root == windows[i]) || (c->cm_selection == windows[i]))
+ continue;
+ if (_e_comp_x_client_find_by_window(windows[i]))
+ continue;
+ if (!ecore_x_window_prop_property_get(windows[i],
+ atom_kde_netwm_systray,
+ atom_xmbed, 32,
+ &data, &count))
+ data = NULL;
+
+ if (!data)
+ {
+ if (!ecore_x_window_prop_property_get(windows[i],
+ atom_kwm_dockwindow,
+ atom_kwm_dockwindow, 32,
+ &data, &count))
+ data = NULL;
+ }
+ if (data)
+ {
+ E_FREE(data);
+ continue;
+ }
+ ret = ecore_x_window_prop_card32_get(windows[i],
+ E_ATOM_MANAGED,
+ &ret_val, 1);
+
+ /* we have seen this window before */
+ if ((ret > -1) && (ret_val == 1))
+ {
+ E_Zone *zone = NULL;
+ E_Desk *desk = NULL;
+ unsigned int id;
+ char *path;
+ Efreet_Desktop *desktop = NULL;
+
+ /* get all information from window before it is
+ * reset by e_client_new */
+ ret = ecore_x_window_prop_card32_get(windows[i],
+ E_ATOM_ZONE,
+ &id, 1);
+ if (ret == 1)
+ zone = e_comp_zone_number_get(c, id);
+ if (!zone)
+ zone = e_zone_current_get(c);
+ ret = ecore_x_window_prop_card32_get(windows[i],
+ E_ATOM_DESK,
+ deskxy, 2);
+ if (ret == 2)
+ desk = e_desk_at_xy_get(zone,
+ deskxy[0],
+ deskxy[1]);
+
+ path = ecore_x_window_prop_string_get(windows[i],
+ E_ATOM_DESKTOP_FILE);
+ if (path)
+ {
+ desktop = efreet_desktop_get(path);
+ free(path);
+ }
+
+ {
+ ec = _e_comp_x_client_new(c, windows[i], 1);
+ if (ec)
+ {
+ if (desk) e_client_desk_set(ec, desk);
+ ec->desktop = desktop;
+ }
+ }
+ }
+ else
+ {
+ /* We have not seen this window, and X tells us it
+ * should be seen */
+ ec = _e_comp_x_client_new(c, windows[i], 1);
+ }
+ if (ec && (!ec->comp_data->initial_attributes.visible))
+ E_FREE_FUNC(ec, e_object_del);
+ if (ec)
+ {
+ if (ec->override)
+ {
+ _e_comp_x_client_evas_init(ec);
+ if (!ec->input_only)
+ _e_comp_x_client_damage_add(ec);
+ e_pixmap_usable_set(ec->pixmap, 1);
+ ec->comp_data->first_map = 1;
+ }
+ ec->ignore_first_unmap = 1;
+ evas_object_show(ec->frame);
+ }
+ }
+ free(windows);
+}
+
+static void
+_e_comp_x_bindings_grab_cb(E_Comp *c)
+{
+ Eina_List *l;
+ E_Client *ec;
+
+ EINA_LIST_FOREACH(c->clients, l, ec)
+ {
+ if (e_client_util_ignored_get(ec)) continue;
+ _e_comp_x_focus_setup(ec);
+ e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ }
+}
+
+static void
+_e_comp_x_bindings_ungrab_cb(E_Comp *c)
+{
+ Eina_List *l;
+ E_Client *ec;
+
+ EINA_LIST_FOREACH(c->clients, l, ec)
+ {
+ if (e_client_util_ignored_get(ec)) continue;
+ _e_comp_x_focus_setdown(ec);
+ e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ }
+}
+
+static void
+_e_comp_x_grab_cb(E_Comp *c)
+{
+ if (!c->grabbed)
+ {
+ ecore_x_grab();
+ ecore_x_sync();
+ }
+ else
+ ecore_x_ungrab();
+}
+
+static Eina_Bool
+_e_comp_x_setup(E_Comp *c, Ecore_X_Window root, int w, int h)
+{
+ Ecore_X_Window_Attributes att;
+ Eina_Bool res;
+ unsigned int i;
+
+ res = ecore_x_screen_is_composited(c->num);
+ if (res)
+ {
+ e_util_dialog_internal(_("Compositor Error"),
+ _("Another compositor is already running<br>"
+ "on your display server."));
+ return EINA_FALSE;
+ }
+ if (!ecore_x_window_manage(root)) return EINA_FALSE;
+
+ E_OBJECT_DEL_SET(c, _e_comp_x_del);
+ c->comp_data = E_NEW(E_Comp_Data, 1);
+ ecore_x_e_window_profile_supported_set(root, e_config->use_desktop_window_profile);
+ c->cm_selection = ecore_x_window_input_new(root, 0, 0, 1, 1);
+ if (!c->cm_selection) return EINA_FALSE;
+ e_hints_init(root, c->cm_selection);
+ ecore_x_window_background_color_set(root, 0, 0, 0);
+ ecore_x_screen_is_composited_set(c->num, c->cm_selection);
+
+ c->win = ecore_x_composite_render_window_enable(root);
+ if (!c->win)
+ {
+ e_util_dialog_internal(_("Compositor Error"),
+ _("Your display server does not support the<br>"
+ "compositor overlay window. This is needed<br>"
+ "for it to function."));
+ return EINA_FALSE;
+ }
+ c->man = e_manager_new(root, c, w, h);
+
+ memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
+ ecore_x_window_attributes_get(c->win, &att);
+
+ if ((att.depth != 24) && (att.depth != 32))
+ {
+ /*
+ e_util_dialog_internal
+ (_("Compositor Error"), _("Your screen is not in 24/32bit display mode.<br>"
+ "This is required to be your default depth<br>"
+ "setting for the compositor to work properly."));
+ ecore_x_composite_render_window_disable(c->win);
+ free(c);
+ return NULL;
+ */
+ }
+ c->depth = att.depth;
+
+ if (!c->num) e_alert_composite_win(root, c->win);
+
+ if (e_comp_gl_get() && (e_comp_config_get()->engine == E_COMP_ENGINE_GL))
+ {
+ int opt[20];
+ int opt_i = 0;
+
+ if (e_comp_config_get()->indirect)
+ {
+ opt[opt_i] = ECORE_EVAS_GL_X11_OPT_INDIRECT;
+ opt_i++;
+ opt[opt_i] = 1;
+ opt_i++;
+ }
+ if (e_comp_config_get()->vsync)
+ {
+ opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
+ opt_i++;
+ opt[opt_i] = 1;
+ opt_i++;
+ }
+#ifdef ECORE_EVAS_GL_X11_OPT_SWAP_MODE
+ if (e_comp_config_get()->swap_mode)
+ {
+ opt[opt_i] = ECORE_EVAS_GL_X11_OPT_SWAP_MODE;
+ opt_i++;
+ opt[opt_i] = e_comp_config_get()->swap_mode;
+ opt_i++;
+ }
+#endif
+ if (opt_i > 0)
+ {
+ opt[opt_i] = ECORE_EVAS_GL_X11_OPT_NONE;
+ c->ee = ecore_evas_gl_x11_options_new(NULL, c->win, 0, 0, w, h, opt);
+ }
+ if (!c->ee)
+ c->ee = ecore_evas_gl_x11_new(NULL, c->win, 0, 0, w, h);
+ if (c->ee)
+ {
+ c->gl = 1;
+ ecore_evas_gl_x11_pre_post_swap_callback_set(c->ee, c, _e_comp_x_pre_swap, NULL);
+ }
+ }
+ if (!c->ee)
+ {
+ c->ee = ecore_evas_software_x11_new(NULL, c->win, 0, 0, w, h);
+ if (e_comp_config_get()->engine == E_COMP_ENGINE_GL)
+ ecore_job_add(_e_comp_x_add_fail_job, NULL);
+ e_comp_gl_set(0);
+ }
+
+ ecore_x_composite_redirect_subwindows(root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
+
+ ecore_x_window_key_grab(root, "Home", ECORE_EVENT_MODIFIER_SHIFT |
+ ECORE_EVENT_MODIFIER_CTRL |
+ ECORE_EVENT_MODIFIER_ALT, 0);
+ ecore_x_window_key_grab(root, "F", ECORE_EVENT_MODIFIER_SHIFT |
+ ECORE_EVENT_MODIFIER_CTRL |
+ ECORE_EVENT_MODIFIER_ALT, 0);
+
+ ecore_evas_callback_resize_set(c->ee, _e_comp_x_ee_resize);
+ ecore_evas_data_set(c->ee, "comp", c);
+ c->grab_cb = (Ecore_Cb)_e_comp_x_grab_cb;
+ c->bindings_grab_cb = (Ecore_Cb)_e_comp_x_bindings_grab_cb;
+ c->bindings_ungrab_cb = (Ecore_Cb)_e_comp_x_bindings_ungrab_cb;
+
+ if (!e_comp_canvas_init(c)) return EINA_FALSE;
+
+ e_grabinput_focus(c->ee_win, E_FOCUS_METHOD_PASSIVE);
+
+ /* init layers */
+ for (i = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); i <= e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); i++)
+ {
+ char buf[64];
+
+ c->layers[i].win = ecore_x_window_input_new(root, 0, 0, 1, 1);
+ ecore_x_window_show(c->layers[i].win);
+ snprintf(buf, sizeof(buf), "%d", e_comp_canvas_layer_map_to(i));
+ ecore_x_icccm_name_class_set(c->layers[i].win, buf, "e_layer_win");
+
+ if (i - e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP) > 0)
+ ecore_x_window_configure(c->layers[i].win,
+ ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
+ ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
+ 0, 0, 0, 0, 0,
+ c->layers[i - 1].win, ECORE_X_WINDOW_STACK_ABOVE);
+ else
+ ecore_x_window_raise(c->layers[i].win);
+ }
+
+ ecore_evas_lower(c->ee);
+ _e_comp_x_manage_windows(c);
+
+ return !!c->bg_blank_object;
+}
+
+static Eina_Bool
+_e_comp_x_screens_setup(void)
+{
+ int n, i;
+ Ecore_X_Window *roots;
+ Eina_Bool success = EINA_FALSE;
+
+ roots = ecore_x_window_root_list(&n);
+ if ((!roots) || (n <= 0))
+ {
+ free(roots);
+ e_error_message_show("X reports there are no root windows and %i screens!\n",
+ n);
+ return 0;
+ }
+ for (i = 0; i < n; i++)
+ {
+ int rw, rh;
+ Ecore_X_Window root = roots[i];
+ E_Comp *c;
+
+ ecore_x_window_size_get(root, &rw, &rh);
+ if (n == 1)
+ {
+ /* more than 1 root window - xinerama wont be active */
+ success = _e_comp_x_xinerama_setup(rw, rh);
+ if (!success) break;
+ }
+ if (!success) break;
+ c = e_comp_new();
+ success = _e_comp_x_setup(c, root, rw, rh);
+ if (!success) break;
+ }
+ free(roots);
+ return success;
+}
+
+EINTERN Eina_Bool
+e_comp_x_init(void)
+{
+ clients_win_hash = eina_hash_int32_new(NULL);
+ damages_hash = eina_hash_int32_new(NULL);
+ alarm_hash = eina_hash_int32_new(NULL);
+ frame_extents = eina_hash_string_superfast_new(free);
+
+
+ if (!ecore_x_init(NULL))
+ {
+ e_error_message_show(_("Enlightenment cannot initialize Ecore_X!\n"));
+ return EINA_FALSE;
+ }
+
+ ecore_x_io_error_handler_set(_e_main_cb_x_fatal, NULL);
+
+ if (!ecore_x_composite_query())
+ {
+ e_error_message_show
+ (_("Your display server does not support XComposite, "
+ "or Ecore-X was built without XComposite support. "
+ "Note that for composite support you will also need "
+ "XRender and XFixes support in X11 and Ecore."));
+ return EINA_FALSE;
+ }
+ if (!ecore_x_damage_query())
+ {
+ e_error_message_show
+ (_("Your display server does not support XDamage "
+ "or Ecore was built without XDamage support."));
+ return EINA_FALSE;
+ }
+
+ if (!getenv("ECORE_X_NO_XLIB"))
+ {
+ if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11))
+ e_comp_gl_set(EINA_TRUE);
+ }
+ ecore_x_screensaver_event_listen_set(1);
+
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DESTROY, _e_comp_x_destroy, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHOW, _e_comp_x_show, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHOW_REQUEST, _e_comp_x_show_request, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, _e_comp_x_resize_request, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_HIDE, _e_comp_x_hide, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_REPARENT, _e_comp_x_reparent, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_CONFIGURE, _e_comp_x_configure, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, _e_comp_x_configure_request, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STATE_REQUEST, _e_comp_x_state_request, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STACK, _e_comp_x_stack, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_STACK_REQUEST, _e_comp_x_stack_request, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_CLIENT_MESSAGE, _e_comp_x_message, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_PROPERTY, _e_comp_x_property, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHAPE, _e_comp_x_shape, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DAMAGE_NOTIFY, _e_comp_x_damage, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DAMAGE, _e_comp_x_damage_win, NULL);
+
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MAPPING_CHANGE, _e_comp_x_mapping_change, NULL);
+
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_IN, _e_comp_x_focus_in, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_OUT, _e_comp_x_focus_out, NULL);
+
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST,
+ _e_comp_x_move_resize_request, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DESKTOP_CHANGE,
+ _e_comp_x_desktop_change, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SYNC_ALARM,
+ _e_comp_x_sync_alarm, NULL);
+
+
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ _e_comp_x_mouse_down, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_UP,
+ _e_comp_x_mouse_up, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_WHEEL,
+ _e_comp_x_mouse_wheel, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE,
+ _e_comp_x_mouse_move, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MOUSE_IN,
+ _e_comp_x_mouse_in, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MOUSE_OUT,
+ _e_comp_x_mouse_out, NULL);
+
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ZONE_SET,
+ _e_comp_x_client_zone_set, NULL);
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_PROPERTY,
+ _e_comp_x_client_property, NULL);
+
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_FRAME_EXTENTS_REQUEST,
+ _e_comp_x_cb_frame_extents_request, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_PING,
+ _e_comp_x_cb_ping, NULL);
+
+ ecore_x_passive_grab_replay_func_set(_e_comp_x_grab_replay, NULL);
+
+ e_client_hook_add(E_CLIENT_HOOK_DESK_SET, _e_comp_x_hook_client_desk_set, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_RESIZE_BEGIN, _e_comp_x_hook_client_resize_begin, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_RESIZE_END, _e_comp_x_hook_client_resize_end, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_MOVE_BEGIN, _e_comp_x_hook_client_move_begin, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_MOVE_END, _e_comp_x_hook_client_move_end, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_DEL, _e_comp_x_hook_client_del, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_NEW_CLIENT, _e_comp_x_hook_client_new, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_EVAL_FETCH, _e_comp_x_hook_client_fetch, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, _e_comp_x_hook_client_pre_frame_assign, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_UNREDIRECT, _e_comp_x_hook_client_unredirect, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_REDIRECT, _e_comp_x_hook_client_redirect, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, _e_comp_x_hook_client_post_new_client, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_FOCUS_SET, _e_comp_x_hook_client_focus_set, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_FOCUS_UNSET, _e_comp_x_hook_client_focus_unset, NULL);
+ e_client_hook_add(E_CLIENT_HOOK_EVAL_END, _e_comp_x_hook_client_eval_end, NULL);
+
+ if (!e_atoms_init()) return 0;
+ if (!_e_comp_x_screens_setup()) return EINA_FALSE;
+ if (!e_xsettings_init())
+ e_error_message_show(_("Enlightenment cannot initialize the XSettings system.\n"));
+
+ ecore_x_sync();
+
+ return EINA_TRUE;
+}
+
+EINTERN void
+e_comp_x_shutdown(void)
+{
+ E_FREE_LIST(handlers, ecore_event_handler_del);
+ E_FREE_FUNC(clients_win_hash, eina_hash_free);
+ E_FREE_FUNC(damages_hash, eina_hash_free);
+ E_FREE_FUNC(alarm_hash, eina_hash_free);
+ E_FREE_FUNC(frame_extents, eina_hash_free);
+ e_xsettings_shutdown();
+ if (x_fatal) return;
+ e_atoms_shutdown();
+ /* ecore_x_ungrab(); */
+ ecore_x_focus_reset();
+ ecore_x_events_allow_all();
+ ecore_x_shutdown();
+}
diff --git a/src/bin/e_comp_x.h b/src/bin/e_comp_x.h
new file mode 100644
index 0000000000..a2d6fcaa5d
--- /dev/null
+++ b/src/bin/e_comp_x.h
@@ -0,0 +1,7 @@
+#ifndef E_COMP_X_H
+#define E_COMP_X_H
+
+EINTERN Eina_Bool e_comp_x_init(void);
+EINTERN void e_comp_x_shutdown(void);
+
+#endif
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index d8f8f4c0bd..1f37bba555 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -1,6 +1,6 @@
#include "e.h"
-#if ((E18_PROFILE >= LOWRES_PDA) && (E18_PROFILE <= HIRES_PDA))
+#if ((E19_PROFILE >= LOWRES_PDA) && (E19_PROFILE <= HIRES_PDA))
#define DEF_MENUCLICK 1.25
#else
#define DEF_MENUCLICK 0.25
@@ -173,7 +173,8 @@ _e_config_edd_init(Eina_Bool old)
#define D _e_config_shelf_edd
E_CONFIG_VAL(D, T, name, STR);
E_CONFIG_VAL(D, T, id, INT);
- E_CONFIG_VAL(D, T, container, INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(D, T, "container", manager, EET_T_INT);
+ E_CONFIG_VAL(D, T, manager /*container */, INT);
E_CONFIG_VAL(D, T, zone, INT);
E_CONFIG_VAL(D, T, layer, INT);
E_CONFIG_VAL(D, T, popup, UCHAR);
@@ -202,7 +203,8 @@ _e_config_edd_init(Eina_Bool old)
#undef D
#define T E_Config_Desktop_Background
#define D _e_config_desktop_bg_edd
- E_CONFIG_VAL(D, T, container, INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(D, T, "container", manager, EET_T_INT);
+ E_CONFIG_VAL(D, T, manager /*container */, INT);
E_CONFIG_VAL(D, T, zone, INT);
E_CONFIG_VAL(D, T, desk_x, INT);
E_CONFIG_VAL(D, T, desk_y, INT);
@@ -213,7 +215,8 @@ _e_config_edd_init(Eina_Bool old)
#undef D
#define T E_Config_Desktop_Name
#define D _e_config_desktop_name_edd
- E_CONFIG_VAL(D, T, container, INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(D, T, "container", manager, EET_T_INT);
+ E_CONFIG_VAL(D, T, manager /*container */, INT);
E_CONFIG_VAL(D, T, zone, INT);
E_CONFIG_VAL(D, T, desk_x, INT);
E_CONFIG_VAL(D, T, desk_y, INT);
@@ -224,7 +227,7 @@ _e_config_edd_init(Eina_Bool old)
#undef D
#define T E_Config_Desktop_Window_Profile
#define D _e_config_desktop_window_profile_edd
- E_CONFIG_VAL(D, T, container, INT);
+ E_CONFIG_VAL(D, T, manager, INT);
E_CONFIG_VAL(D, T, zone, INT);
E_CONFIG_VAL(D, T, desk_x, INT);
E_CONFIG_VAL(D, T, desk_y, INT);
@@ -1233,29 +1236,50 @@ e_config_load(void)
break;
}
}
- CONFIG_VERSION_CHECK(13)
+ CONFIG_VERSION_CHECK(14)
{
E_Config_Theme *et;
E_Path_Dir *epd;
char buf[PATH_MAX], buf2[PATH_MAX], *f;
- Eina_List *files;
+ Eina_List *files, *l;
Eina_Bool fail = EINA_FALSE;
+ E_Config_Shelf *cf_es;
+ E_Remember *rem;
+
+ CONFIG_VERSION_UPDATE_INFO(14);
+
+ EINA_LIST_FOREACH(e_config->shelves, l, cf_es)
+ {
+ if (cf_es->popup)
+ {
+ if (cf_es->layer)
+ cf_es->layer = E_LAYER_CLIENT_ABOVE;
+ else
+ cf_es->layer = E_LAYER_CLIENT_DESKTOP;
+ }
+ else if (!cf_es->layer)
+ cf_es->layer = E_LAYER_DESKTOP; //redundant, but whatever
+ cf_es->popup = 0;
+ }
- CONFIG_VERSION_UPDATE_INFO(13);
// empty out theme elements of config
- eina_stringshare_del(e_config->init_default_theme);
- e_config->init_default_theme = NULL;
+ eina_stringshare_replace(&e_config->init_default_theme, NULL);
EINA_LIST_FREE(e_config->themes, et)
{
- if (et->category) eina_stringshare_del(et->category);
- if (et->file) eina_stringshare_del(et->file);
- E_FREE(et);
+ eina_stringshare_del(et->category);
+ eina_stringshare_del(et->file);
+ free(et);
}
EINA_LIST_FREE(e_config->path_append_themes, epd)
{
- if (epd->dir) eina_stringshare_del(epd->dir);
- E_FREE(epd);
+ eina_stringshare_del(epd->dir);
+ free(epd);
}
+ /* E19 layer values are higher */
+ EINA_LIST_FOREACH(e_config->remembers, l, rem)
+ if (rem->apply & E_REMEMBER_APPLY_LAYER)
+ rem->prop.layer += 100;
+
// copy all of ~/.e/e/themes/* into ~/.elementary/themes
// and delete original data in ~/.e/e/themes
ecore_file_mkpath(elm_theme_user_dir_get());
@@ -1698,38 +1722,34 @@ e_config_domain_system_load(const char *domain, E_Config_DD *edd)
static void
_e_config_mv_error(const char *from, const char *to)
{
- if (!_e_config_error_dialog)
- {
- E_Dialog *dia;
-
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
- "E", "_sys_error_logout_slow");
- if (dia)
- {
- char buf[8192];
-
- e_dialog_title_set(dia, _("Enlightenment Settings Write Problems"));
- e_dialog_icon_set(dia, "dialog-error", 64);
- snprintf(buf, sizeof(buf),
- _("Enlightenment has had an error while moving config files<br>"
- "from:<br>"
- "%s<br>"
- "<br>"
- "to:<br>"
- "%s<br>"
- "<br>"
- "The rest of the write has been aborted for safety.<br>"),
- from, to);
- e_dialog_text_set(dia, buf);
- e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
- e_dialog_button_focus_num(dia, 0);
- e_win_centered_set(dia->win, 1);
- e_object_del_attach_func_set(E_OBJECT(dia),
- _e_config_error_dialog_cb_delete);
- e_dialog_show(dia);
- _e_config_error_dialog = dia;
- }
- }
+ E_Dialog *dia;
+ char buf[8192];
+
+ if (_e_config_error_dialog) return;
+
+ dia = e_dialog_new(NULL, "E", "_sys_error_logout_slow");
+ EINA_SAFETY_ON_NULL_RETURN(dia);
+
+ e_dialog_title_set(dia, _("Enlightenment Settings Write Problems"));
+ e_dialog_icon_set(dia, "dialog-error", 64);
+ snprintf(buf, sizeof(buf),
+ _("Enlightenment has had an error while moving config files<br>"
+ "from:<br>"
+ "%s<br>"
+ "<br>"
+ "to:<br>"
+ "%s<br>"
+ "<br>"
+ "The rest of the write has been aborted for safety.<br>"),
+ from, to);
+ e_dialog_text_set(dia, buf);
+ e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
+ e_dialog_button_focus_num(dia, 0);
+ e_win_centered_set(dia->win, 1);
+ e_object_del_attach_func_set(E_OBJECT(dia),
+ _e_config_error_dialog_cb_delete);
+ e_dialog_show(dia);
+ _e_config_error_dialog = dia;
}
EAPI int
@@ -2363,8 +2383,7 @@ _e_config_eet_close_handle(Eet_File *ef, char *file)
{
E_Dialog *dia;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
- "E", "_sys_error_logout_slow");
+ dia = e_dialog_new(NULL, "E", "_sys_error_logout_slow");
if (dia)
{
char buf[8192];
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index a7e3f59289..f873eeec94 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -48,7 +48,7 @@ typedef enum
/* increment this whenever a new set of config values are added but the users
* config doesn't need to be wiped - simply new values need to be put in
*/
-#define E_CONFIG_FILE_GENERATION 13
+#define E_CONFIG_FILE_GENERATION 14
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION)
#define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!!
@@ -546,7 +546,7 @@ struct _E_Config_Binding_Acpi
struct _E_Config_Desktop_Background
{
- int container;
+ int manager;
int zone;
int desk_x;
int desk_y;
@@ -555,7 +555,7 @@ struct _E_Config_Desktop_Background
struct _E_Config_Desktop_Name
{
- int container;
+ int manager;
int zone;
int desk_x;
int desk_y;
@@ -564,7 +564,7 @@ struct _E_Config_Desktop_Name
struct _E_Config_Desktop_Window_Profile
{
- int container;
+ int manager;
int zone;
int desk_x;
int desk_y;
@@ -603,9 +603,9 @@ struct _E_Config_Shelf
{
const char *name;
int id;
- int container, zone;
- int layer;
- unsigned char popup;
+ int manager, zone;
+ int layer; //E_Layer
+ unsigned char popup; //DEAD
int orient;
unsigned char fit_along;
unsigned char fit_size;
diff --git a/src/bin/e_config_dialog.c b/src/bin/e_config_dialog.c
index cf2263dbc8..8f56a0e2bb 100644
--- a/src/bin/e_config_dialog.c
+++ b/src/bin/e_config_dialog.c
@@ -21,7 +21,7 @@ static Eina_List *_e_config_dialog_list = NULL;
/**
* Creates a new dialog
*
- * @param con the container the dialog will be added too
+ * @param c the compositor the dialog will be added to
* @param title to display for the dialog
* @param name the name used to register the window in e
* @param class the call used to register the window in e
@@ -32,14 +32,14 @@ static Eina_List *_e_config_dialog_list = NULL;
* @return returns the created dialog. Null on failure
*/
EAPI E_Config_Dialog *
-e_config_dialog_new(E_Container *con, const char *title, const char *name, const char *class, const char *icon, int icon_size, E_Config_Dialog_View *view, void *data)
+e_config_dialog_new(E_Comp *c, const char *title, const char *name, const char *class, const char *icon, int icon_size, E_Config_Dialog_View *view, void *data)
{
E_Config_Dialog *cfd;
cfd = E_OBJECT_ALLOC(E_Config_Dialog, E_CONFIG_DIALOG_TYPE,
_e_config_dialog_free);
cfd->view = view;
- cfd->con = con;
+ cfd->comp = c;
cfd->title = eina_stringshare_add(title);
cfd->name = eina_stringshare_add(name);
cfd->class = eina_stringshare_add(class);
@@ -106,22 +106,21 @@ e_config_dialog_find(const char *name, const char *class)
E_Zone *z;
z = e_util_zone_current_get(e_manager_current_get());
- e_border_uniconify(cfd->dia->win->border);
+ e_client_uniconify(cfd->dia->win->client);
e_win_raise(cfd->dia->win);
- if (z->container == cfd->dia->win->border->zone->container)
- e_border_desk_set(cfd->dia->win->border, e_desk_current_get(z));
+ if (z->comp == cfd->dia->win->client->zone->comp)
+ e_client_desk_set(cfd->dia->win->client, e_desk_current_get(z));
else
{
- if (!cfd->dia->win->border->sticky)
- e_desk_show(cfd->dia->win->border->desk);
- ecore_x_pointer_warp(cfd->dia->win->border->zone->container->win,
- cfd->dia->win->border->zone->x + (cfd->dia->win->border->zone->w / 2),
- cfd->dia->win->border->zone->y + (cfd->dia->win->border->zone->h / 2));
+ if (!cfd->dia->win->client->sticky)
+ e_desk_show(cfd->dia->win->client->desk);
+ e_util_pointer_center(cfd->dia->win->client);
}
- e_border_unshade(cfd->dia->win->border, cfd->dia->win->border->shade.dir);
+ if (cfd->dia->win->client->shaded || cfd->dia->win->client->shading)
+ e_client_unshade(cfd->dia->win->client, cfd->dia->win->client->shade_dir);
if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
(e_config->focus_setting == E_FOCUS_NEW_WINDOW))
- e_border_focus_set(cfd->dia->win->border, 1, 1);
+ evas_object_focus_set(cfd->dia->win->client->frame, 1);
return 1;
}
}
@@ -192,9 +191,9 @@ _e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type)
if (!pdia) /* creating window for the first time */
{
if ((cfd->view->normal_win) || (e_config->cfgdlg_normal_wins))
- cfd->dia = e_dialog_normal_win_new(cfd->con, cfd->name, buf);
+ cfd->dia = e_dialog_normal_win_new(cfd->comp, cfd->name, buf);
else
- cfd->dia = e_dialog_new(cfd->con, cfd->name, buf);
+ cfd->dia = e_dialog_new(cfd->comp, cfd->name, buf);
e_object_del_attach_func_set(E_OBJECT(cfd->dia),
_e_config_dialog_cb_dialog_del);
} /* window was created before - deleting content only */
diff --git a/src/bin/e_config_dialog.h b/src/bin/e_config_dialog.h
index 7e1e5b4bf5..3b50eb08be 100644
--- a/src/bin/e_config_dialog.h
+++ b/src/bin/e_config_dialog.h
@@ -41,7 +41,7 @@ struct _E_Config_Dialog
E_Config_Dialog_CFData_Type view_type;
E_Config_Dialog_View *view;
E_Config_Dialog_Data *cfdata;
- E_Container *con;
+ E_Comp *comp;
const char *title;
const char *icon;
const char *name;
@@ -55,7 +55,7 @@ struct _E_Config_Dialog
unsigned char cfg_changed_auto : 1;
};
-EAPI E_Config_Dialog *e_config_dialog_new(E_Container *con, const char *title, const char *name, const char *class, const char *icon, int icon_size, E_Config_Dialog_View *view, void *data);
+EAPI E_Config_Dialog *e_config_dialog_new(E_Comp *c, const char *title, const char *name, const char *class, const char *icon, int icon_size, E_Config_Dialog_View *view, void *data);
EAPI int e_config_dialog_find(const char *name, const char *class);
EAPI E_Config_Dialog *e_config_dialog_get(const char *name, const char *class);
diff --git a/src/bin/e_configure.c b/src/bin/e_configure.c
index 6d0459c1aa..f16af30b79 100644
--- a/src/bin/e_configure.c
+++ b/src/bin/e_configure.c
@@ -5,7 +5,7 @@ static void _e_configure_menu_add(void *data, E_Menu *m);
static void _e_configure_efreet_desktop_cleanup(void);
static void _e_configure_efreet_desktop_update(void);
static Eina_Bool _e_configure_cb_efreet_desktop_cache_update(void *data, int type, void *event);
-static void _e_configure_registry_item_full_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Container * con, const char *params), void (*generic_func)(E_Container *con, const char *params), Efreet_Desktop *desktop, const char *params);
+static void _e_configure_registry_item_full_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Comp *c, const char *params), void (*generic_func)(E_Comp *c, const char *params), Efreet_Desktop *desktop, const char *params);
static void _e_configure_registry_item_free(E_Configure_It *eci);
static void _configure_job(void *data);
@@ -19,7 +19,7 @@ static Ecore_Job *update_job = NULL;
static struct
{
- void (*func)(const void *data, E_Container *con, const char *params, Efreet_Desktop *desktop);
+ void (*func)(const void *data, E_Comp *c, const char *params, Efreet_Desktop *desktop);
const char *data;
} custom_desktop_exec = { NULL, NULL };
@@ -41,7 +41,7 @@ e_configure_init(void)
}
EAPI void
-e_configure_registry_call(const char *path, E_Container *con, const char *params)
+e_configure_registry_call(const char *path, E_Comp *c, const char *params)
{
E_Configure_Cat *ecat;
Eina_List *l;
@@ -52,7 +52,7 @@ e_configure_registry_call(const char *path, E_Container *con, const char *params
cat = ecore_file_dir_get(path);
if (!cat) return;
item = ecore_file_file_get(path);
- if (!con) con = e_container_current_get(e_manager_current_get());
+ if (!c) c = e_comp_get(NULL);
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
if (!strcmp(cat, ecat->cat))
{
@@ -64,16 +64,16 @@ e_configure_registry_call(const char *path, E_Container *con, const char *params
{
if (!params) params = eci->params;
- if (eci->func) eci->func(con, params);
+ if (eci->func) eci->func(c, params);
else if (eci->generic_func)
- eci->generic_func(con, params);
+ eci->generic_func(c, params);
else if (eci->desktop)
{
if (custom_desktop_exec.func)
custom_desktop_exec.func(custom_desktop_exec.data,
- con, params, eci->desktop);
+ c, params, eci->desktop);
else
- e_exec(e_util_zone_current_get(con->manager),
+ e_exec(e_util_zone_current_get(c->man),
eci->desktop, NULL, NULL, "config");
}
break;
@@ -84,27 +84,27 @@ e_configure_registry_call(const char *path, E_Container *con, const char *params
}
EAPI void
-e_configure_registry_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Container * con, const char *params))
+e_configure_registry_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Comp *c, const char *params))
{
_e_configure_registry_item_full_add(path, pri, label, icon_file, icon, func, NULL, NULL, NULL);
}
EAPI void
-e_configure_registry_generic_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, void (*generic_func)(E_Container *con, const char *params))
+e_configure_registry_generic_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, void (*generic_func)(E_Comp *c, const char *params))
{
_e_configure_registry_item_full_add(path, pri, label, icon_file, icon, NULL, generic_func, NULL, NULL);
}
EAPI void
-e_configure_registry_item_params_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Container * con, const char *params), const char *params)
+e_configure_registry_item_params_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Comp *c, const char *params), const char *params)
{
_e_configure_registry_item_full_add(path, pri, label, icon_file, icon, func, NULL, NULL, params);
}
/**
- * Delete an item in the configuration panel.
+ *Delete an item in the configuration panel.
*
- * @param path location the item to delete
+ *@param path location the item to delete
*/
EAPI void
e_configure_registry_item_del(const char *path)
@@ -139,14 +139,14 @@ e_configure_registry_item_del(const char *path)
}
/**
- * Add a category to the configuration panel.
+ *Add a category to the configuration panel.
*
- * @param path location the new category
- * @param pri the priority for sorting the category in the category list
- * @param label the name the user will see in configuration panel
- * @param icon_file the edje file that holds the icon for the category.
- * Can be null to use current theme.
- * @param icon the name of the edje group to use as icon
+ *@param path location the new category
+ *@param pri the priority for sorting the category in the category list
+ *@param label the name the user will see in configuration panel
+ *@param icon_file the edje file that holds the icon for the category.
+ *Can be null to use current theme.
+ *@param icon the name of the edje group to use as icon
*/
static int
_E_configure_category_pri_cb(E_Configure_Cat *ecat, E_Configure_Cat *ecat2)
@@ -181,9 +181,9 @@ e_configure_registry_category_add(const char *path, int pri, const char *label,
}
/**
- * Delete a category in the configuration panel.
+ *Delete a category in the configuration panel.
*
- * @param path location the category to delete
+ *@param path location the category to delete
*/
EAPI void
e_configure_registry_category_del(const char *path)
@@ -210,19 +210,19 @@ e_configure_registry_category_del(const char *path)
}
/**
- * Add a item to the configuration panel.
+ *Add a item to the configuration panel.
*
- * @param path location the location to place configuration item
- * @param pri the priority for sorting the item in the category list
- * @param label the name the user will see in configuration panel
- * @param icon_file the edje file that holds the icon for the category.
- * Can be null to use current theme.
- * @param icon the name of the edje group to use as icon
- * @param func the callback to use when the configuration item is clicked
+ *@param path location the location to place configuration item
+ *@param pri the priority for sorting the item in the category list
+ *@param label the name the user will see in configuration panel
+ *@param icon_file the edje file that holds the icon for the category.
+ *Can be null to use current theme.
+ *@param icon the name of the edje group to use as icon
+ *@param func the callback to use when the configuration item is clicked
*/
EAPI void
-e_configure_registry_custom_desktop_exec_callback_set(void (*func)(const void *data, E_Container *con, const char *params, Efreet_Desktop *desktop), const void *data)
+e_configure_registry_custom_desktop_exec_callback_set(void (*func)(const void *data, E_Comp *c, const char *params, Efreet_Desktop *desktop), const void *data)
{
custom_desktop_exec.func = func;
custom_desktop_exec.data = data;
@@ -268,7 +268,7 @@ e_configure_registry_exists(const char *path)
static void
_e_configure_menu_module_item_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
- e_int_config_modules(m->zone->container, NULL);
+ e_int_config_modules(m->zone->comp, NULL);
}
static void
@@ -461,7 +461,7 @@ _e_configure_compare_pri_cb(E_Configure_It *eci, E_Configure_It *eci2)
}
static void
-_e_configure_registry_item_full_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Container * con, const char *params), void (*generic_func)(E_Container *con, const char *params), Efreet_Desktop *desktop, const char *params)
+_e_configure_registry_item_full_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Comp *c, const char *params), void (*generic_func)(E_Comp *c, const char *params), Efreet_Desktop *desktop, const char *params)
{
Eina_List *l;
char *cat;
diff --git a/src/bin/e_configure.h b/src/bin/e_configure.h
index 4e5466e9a7..cd6851c8a3 100644
--- a/src/bin/e_configure.h
+++ b/src/bin/e_configure.h
@@ -25,20 +25,20 @@ struct _E_Configure_It
const char *icon_file;
const char *icon;
const char *params;
- E_Config_Dialog *(*func) (E_Container *con, const char *params);
- void (*generic_func) (E_Container *con, const char *params);
+ E_Config_Dialog *(*func) (E_Comp *c, const char *params);
+ void (*generic_func) (E_Comp *c, const char *params);
Efreet_Desktop *desktop;
};
-EAPI void e_configure_registry_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func) (E_Container *con, const char *params));
-EAPI void e_configure_registry_item_params_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func) (E_Container *con, const char *params), const char *params);
-EAPI void e_configure_registry_generic_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, void (*generic_func) (E_Container *con, const char *params));
+EAPI void e_configure_registry_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func) (E_Comp *c, const char *params));
+EAPI void e_configure_registry_item_params_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func) (E_Comp *c, const char *params), const char *params);
+EAPI void e_configure_registry_generic_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, void (*generic_func) (E_Comp *c, const char *params));
EAPI void e_configure_registry_item_del(const char *path);
EAPI void e_configure_registry_category_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon);
EAPI void e_configure_registry_category_del(const char *path);
-EAPI void e_configure_registry_call(const char *path, E_Container *con, const char *params);
+EAPI void e_configure_registry_call(const char *path, E_Comp *c, const char *params);
EAPI int e_configure_registry_exists(const char *path);
-EAPI void e_configure_registry_custom_desktop_exec_callback_set(void (*func) (const void *data, E_Container *con, const char *params, Efreet_Desktop *desktop), const void *data);
+EAPI void e_configure_registry_custom_desktop_exec_callback_set(void (*func) (const void *data, E_Comp *c, const char *params, Efreet_Desktop *desktop), const void *data);
EINTERN void e_configure_init(void);
extern EAPI Eina_List *e_configure_registry;
diff --git a/src/bin/e_confirm_dialog.c b/src/bin/e_confirm_dialog.c
index 7dc862d363..14dbc5dbd9 100644
--- a/src/bin/e_confirm_dialog.c
+++ b/src/bin/e_confirm_dialog.c
@@ -33,7 +33,7 @@ e_confirm_dialog_show(const char *title, const char *icon, const char *text,
cd->del.func = del_func;
cd->del.data = del_data;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_confirm_dialog");
+ dia = e_dialog_new(NULL, "E", "_confirm_dialog");
if (!dia)
{
e_object_del(E_OBJECT(cd));
diff --git a/src/bin/e_container.c b/src/bin/e_container.c
deleted file mode 100644
index fc354af76a..0000000000
--- a/src/bin/e_container.c
+++ /dev/null
@@ -1,1095 +0,0 @@
-#include "e.h"
-
-/* TODO List:
- *
- * * fix shape callbacks to be able to be safely deleted
- * * remove duplicate bd->layer -> layers code
- *
- */
-
-/* local subsystem functions */
-static void _e_container_free(E_Container *con);
-
-static void _e_container_cb_mouse_in(E_Container *con, Evas *e, Evas_Object *obj, void *event_info);
-static void _e_container_cb_mouse_down(E_Container *con, Evas *e, Evas_Object *obj, void *event_info);
-static void _e_container_cb_mouse_up(E_Container *con, Evas *e, Evas_Object *obj, void *event_info);
-static void _e_container_cb_mouse_wheel(E_Container *con, Evas *e, Evas_Object *obj, void *event_info);
-
-static void _e_container_shape_del(E_Container_Shape *es);
-static void _e_container_shape_free(E_Container_Shape *es);
-static void _e_container_shape_change_call(E_Container_Shape *es, E_Container_Shape_Change ch);
-static void _e_container_resize_handle(E_Container *con);
-static void _e_container_event_container_resize_free(void *data, void *ev);
-
-EAPI int E_EVENT_CONTAINER_RESIZE = 0;
-static Eina_List *handlers = NULL;
-
-/* externally accessible functions */
-EINTERN int
-e_container_init(void)
-{
- E_EVENT_CONTAINER_RESIZE = ecore_event_type_new();
- return 1;
-}
-
-EINTERN int
-e_container_shutdown(void)
-{
- E_FREE_LIST(handlers, ecore_event_handler_del);
- return 1;
-}
-
-EAPI E_Container *
-e_container_new(E_Manager *man)
-{
- E_Container *con;
- Evas_Object *o;
- char name[40];
- Eina_List *l, *screens;
- int i;
- Ecore_X_Window mwin;
- E_Comp *c;
- static int container_num = 0;
-
- con = E_OBJECT_ALLOC(E_Container, E_CONTAINER_TYPE, _e_container_free);
- if (!con) return NULL;
- con->manager = man;
- con->manager->containers = eina_list_append(con->manager->containers, con);
- con->w = con->manager->w;
- con->h = con->manager->h;
- con->win = con->manager->win;
-
- c = e_comp_get(man);
- con->bg_win = c->ee_win;
- con->bg_ecore_evas = c->ee;
- con->event_win = c->ee_win;
- con->bg_evas = c->evas;
-
- o = evas_object_rectangle_add(con->bg_evas);
- con->bg_blank_object = o;
- evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BOTTOM);
- evas_object_move(o, 0, 0);
- evas_object_resize(o, con->w, con->h);
- evas_object_color_set(o, 255, 255, 255, 255);
- evas_object_name_set(o, "container->bg_blank_object");
- evas_object_data_set(o, "e_container", con);
- evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, (Evas_Object_Event_Cb)_e_container_cb_mouse_down, con);
- evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, (Evas_Object_Event_Cb)_e_container_cb_mouse_up, con);
- evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, (Evas_Object_Event_Cb)_e_container_cb_mouse_in, con);
- evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, (Evas_Object_Event_Cb)_e_container_cb_mouse_wheel, con);
- evas_object_show(o);
-
- con->num = container_num;
- container_num++;
- snprintf(name, sizeof(name), _("Container %d"), con->num);
- con->name = eina_stringshare_add(name);
-
- /* create a scratch window for putting stuff into */
- con->scratch_win = ecore_x_window_override_new(con->win, 0, 0, 7, 7);
-
- /* init layers */
- for (i = 0; i < 12; i++)
- {
- con->layers[i].win = ecore_x_window_input_new(con->win, 0, 0, 1, 1);
- ecore_x_window_lower(con->layers[i].win);
-
- if (i > 0)
- ecore_x_window_configure(con->layers[i].win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- con->layers[i - 1].win, ECORE_X_WINDOW_STACK_ABOVE);
- }
-
- /* Put init win on top */
- if (man->initwin)
- ecore_x_window_configure(man->initwin,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- con->layers[11].win, ECORE_X_WINDOW_STACK_ABOVE);
-
- /* Put menu win on top */
- mwin = e_menu_grab_window_get();
- if (mwin)
- ecore_x_window_configure(mwin,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- con->layers[11].win, ECORE_X_WINDOW_STACK_ABOVE);
-
- screens = (Eina_List *)e_xinerama_screens_get();
- if (screens)
- {
- E_Screen *scr;
- EINA_LIST_FOREACH(screens, l, scr)
- {
- e_zone_new(con, scr->screen, scr->escreen, scr->x, scr->y, scr->w, scr->h);
- }
- }
- else
- e_zone_new(con, 0, 0, 0, 0, con->w, con->h);
- return con;
-}
-
-EAPI void
-e_container_show(E_Container *con)
-{
- E_OBJECT_CHECK(con);
- E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
-
- if (con->visible) return;
- if (con->win != con->manager->win)
- ecore_x_window_show(con->win);
- con->visible = 1;
-}
-
-EAPI void
-e_container_hide(E_Container *con)
-{
- E_OBJECT_CHECK(con);
- E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
-
- if (!con->visible) return;
- if (con->win != con->manager->win)
- ecore_x_window_hide(con->win);
- con->visible = 0;
-}
-
-EAPI E_Container *
-e_container_current_get(E_Manager *man)
-{
- Eina_List *l;
- E_Container *con;
- E_OBJECT_CHECK_RETURN(man, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL);
-
- EINA_LIST_FOREACH(man->containers, l, con)
- {
- if (!con) continue;
- if (con->visible) return con;
- }
-
- /* If no one is available, return the first */
- if (!man->containers) return NULL;
- l = man->containers;
- return (E_Container *)eina_list_data_get(l);
-}
-
-EAPI E_Container *
-e_container_number_get(E_Manager *man, int num)
-{
- Eina_List *l;
- E_Container *con;
-
- E_OBJECT_CHECK_RETURN(man, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL);
- EINA_LIST_FOREACH(man->containers, l, con)
- {
- if ((int)con->num == num) return con;
- }
- return NULL;
-}
-
-EAPI void
-e_container_move(E_Container *con, int x, int y)
-{
- E_OBJECT_CHECK(con);
- E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
- if ((x == con->x) && (y == con->y)) return;
- con->x = x;
- con->y = y;
- if (con->win != con->manager->win)
- ecore_x_window_move(con->win, con->x, con->y);
- evas_object_move(con->bg_blank_object, con->x, con->y);
-}
-
-EAPI void
-e_container_resize(E_Container *con, int w, int h)
-{
- E_OBJECT_CHECK(con);
- E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
- con->w = w;
- con->h = h;
- if (con->win != con->manager->win)
- ecore_x_window_resize(con->win, con->w, con->h);
- ecore_x_window_resize(con->event_win, con->w, con->h);
- if (!e_config->null_container_win)
- ecore_evas_resize(con->bg_ecore_evas, con->w, con->h);
- evas_object_resize(con->bg_blank_object, con->w, con->h);
- _e_container_resize_handle(con);
-}
-
-EAPI void
-e_container_move_resize(E_Container *con, int x, int y, int w, int h)
-{
- E_OBJECT_CHECK(con);
- E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
- con->x = x;
- con->y = y;
- con->w = w;
- con->h = h;
- if (con->win != con->manager->win)
- ecore_x_window_move_resize(con->win, con->x, con->y, con->w, con->h);
- ecore_x_window_move_resize(con->event_win, con->x, con->y, con->w, con->h);
- if (!e_config->null_container_win)
- ecore_evas_move_resize(con->bg_ecore_evas, x, y, w, h);
- evas_object_move(con->bg_blank_object, con->x, con->y);
- evas_object_resize(con->bg_blank_object, con->w, con->h);
- _e_container_resize_handle(con);
-}
-
-EAPI void
-e_container_raise(E_Container *con __UNUSED__)
-{
-// E_OBJECT_CHECK(con);
-// E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
-}
-
-EAPI void
-e_container_lower(E_Container *con __UNUSED__)
-{
-// E_OBJECT_CHECK(con);
-// E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
-}
-
-EAPI E_Zone *
-e_container_zone_at_point_get(E_Container *con, int x, int y)
-{
- Eina_List *l = NULL;
- E_Zone *zone = NULL;
-
- E_OBJECT_CHECK_RETURN(con, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
- EINA_LIST_FOREACH(con->zones, l, zone)
- {
- if (E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h))
- return zone;
- }
- return NULL;
-}
-
-EAPI E_Zone *
-e_container_zone_number_get(E_Container *con, int num)
-{
- Eina_List *l = NULL;
- E_Zone *zone = NULL;
-
- E_OBJECT_CHECK_RETURN(con, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
- EINA_LIST_FOREACH(con->zones, l, zone)
- {
- if ((int)zone->num == num) return zone;
- }
- return NULL;
-}
-
-EAPI E_Zone *
-e_container_zone_id_get(E_Container *con, int id)
-{
- Eina_List *l = NULL;
- E_Zone *zone = NULL;
-
- E_OBJECT_CHECK_RETURN(con, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
- EINA_LIST_FOREACH(con->zones, l, zone)
- {
- if (zone->id == id) return zone;
- }
- return NULL;
-}
-
-EAPI E_Desk *
-e_container_desk_window_profile_get(E_Container *con,
- const char *profile)
-{
- Eina_List *l = NULL;
- E_Zone *zone = NULL;
- int x, y;
-
- E_OBJECT_CHECK_RETURN(con, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
- if (!profile) return NULL;
-
- EINA_LIST_FOREACH(con->zones, l, zone)
- {
- for (x = 0; x < zone->desk_x_count; x++)
- {
- for (y = 0; y < zone->desk_y_count; y++)
- {
- E_Desk *desk = e_desk_at_xy_get(zone, x, y);
- if ((desk->window_profile) &&
- strcmp(desk->window_profile, profile) == 0)
- {
- return desk;
- }
- }
- }
- }
-
- return NULL;
-}
-
-EAPI E_Container_Shape *
-e_container_shape_add(E_Container *con)
-{
- E_Container_Shape *es;
-
- E_OBJECT_CHECK_RETURN(con, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, 0);
-
- es = E_OBJECT_ALLOC(E_Container_Shape, E_CONTAINER_SHAPE_TYPE, _e_container_shape_free);
- if (!es) return NULL;
- E_OBJECT_DEL_SET(es, _e_container_shape_del);
- es->con = con;
- con->shapes = eina_list_append(con->shapes, es);
- _e_container_shape_change_call(es, E_CONTAINER_SHAPE_ADD);
- return es;
-}
-
-EAPI void
-e_container_shape_show(E_Container_Shape *es)
-{
- E_OBJECT_CHECK(es);
- E_OBJECT_TYPE_CHECK(es, E_CONTAINER_SHAPE_TYPE);
- if (es->visible) return;
- es->visible = 1;
- _e_container_shape_change_call(es, E_CONTAINER_SHAPE_SHOW);
-}
-
-EAPI void
-e_container_shape_hide(E_Container_Shape *es)
-{
- E_OBJECT_CHECK(es);
- E_OBJECT_TYPE_CHECK(es, E_CONTAINER_SHAPE_TYPE);
- if (!es->visible) return;
- es->visible = 0;
- _e_container_shape_change_call(es, E_CONTAINER_SHAPE_HIDE);
-}
-
-EAPI void
-e_container_shape_move(E_Container_Shape *es, int x, int y)
-{
- E_OBJECT_CHECK(es);
- E_OBJECT_TYPE_CHECK(es, E_CONTAINER_SHAPE_TYPE);
- if ((es->x == x) && (es->y == y)) return;
- es->x = x;
- es->y = y;
- _e_container_shape_change_call(es, E_CONTAINER_SHAPE_MOVE);
-}
-
-EAPI void
-e_container_shape_resize(E_Container_Shape *es, int w, int h)
-{
- E_OBJECT_CHECK(es);
- E_OBJECT_TYPE_CHECK(es, E_CONTAINER_SHAPE_TYPE);
- if (w < 1) w = 1;
- if (h < 1) h = 1;
- if ((es->w == w) && (es->h == h)) return;
- es->w = w;
- es->h = h;
- _e_container_shape_change_call(es, E_CONTAINER_SHAPE_RESIZE);
-}
-
-EAPI Eina_List *
-e_container_shape_list_get(E_Container *con)
-{
- E_OBJECT_CHECK_RETURN(con, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
- return con->shapes;
-}
-
-EAPI void
-e_container_shape_geometry_get(E_Container_Shape *es, int *x, int *y, int *w, int *h)
-{
- E_OBJECT_CHECK(es);
- E_OBJECT_TYPE_CHECK(es, E_CONTAINER_SHAPE_TYPE);
- if (x) *x = es->x;
- if (y) *y = es->y;
- if (w) *w = es->w;
- if (h) *h = es->h;
-}
-
-EAPI E_Container *
-e_container_shape_container_get(E_Container_Shape *es)
-{
- E_OBJECT_CHECK_RETURN(es, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(es, E_CONTAINER_SHAPE_TYPE, NULL);
- return es->con;
-}
-
-EAPI void
-e_container_shape_change_callback_add(E_Container *con, E_Container_Shape_Cb func, void *data)
-{
- E_Container_Shape_Callback *cb;
-
- E_OBJECT_CHECK(con);
- E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
- cb = calloc(1, sizeof(E_Container_Shape_Callback));
- if (!cb) return;
- cb->func = func;
- cb->data = data;
- con->shape_change_cb = eina_list_append(con->shape_change_cb, cb);
-}
-
-EAPI void
-e_container_shape_change_callback_del(E_Container *con, E_Container_Shape_Cb func, void *data)
-{
- Eina_List *l = NULL;
- E_Container_Shape_Callback *cb = NULL;
-
- /* FIXME: if we call this from within a callback we are in trouble */
- E_OBJECT_CHECK(con);
- E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
- EINA_LIST_FOREACH(con->shape_change_cb, l, cb)
- {
- if ((cb->func == func) && (cb->data == data))
- {
- con->shape_change_cb = eina_list_remove_list(con->shape_change_cb, l);
- free(cb);
- return;
- }
- }
-}
-
-EAPI void
-e_container_shape_rects_set(E_Container_Shape *es, Eina_Rectangle *rects, int num)
-{
- E_OBJECT_CHECK(es);
- E_OBJECT_TYPE_CHECK(es, E_CONTAINER_SHAPE_TYPE);
- E_FREE(es->shape_rects);
- es->shape_rects_num = 0;
- if ((rects) && (num == 1) &&
- (rects[0].x == 0) &&
- (rects[0].y == 0) &&
- ((int)rects[0].w == es->w) &&
- ((int)rects[0].h == es->h))
- {
- free(rects);
- }
- else if (rects)
- {
- es->shape_rects = rects;
- es->shape_rects_num = num;
- }
- _e_container_shape_change_call(es, E_CONTAINER_SHAPE_RECTS);
-}
-
-EAPI void
-e_container_shape_input_rects_set(E_Container_Shape *es, Eina_Rectangle *rects, int num)
-{
- E_OBJECT_CHECK(es);
- E_OBJECT_TYPE_CHECK(es, E_CONTAINER_SHAPE_TYPE);
- E_FREE(es->shape_input_rects);
- es->shape_input_rects_num = 0;
- if ((rects) && (num == 1) &&
- (rects[0].x == 0) &&
- (rects[0].y == 0) &&
- ((int)rects[0].w == es->w) &&
- ((int)rects[0].h == es->h))
- {
- free(rects);
- }
- else if (rects)
- {
- es->shape_input_rects = rects;
- es->shape_input_rects_num = num;
- }
- _e_container_shape_change_call(es, E_CONTAINER_SHAPE_INPUT_RECTS);
-}
-
-EAPI void
-e_container_shape_solid_rect_set(E_Container_Shape *es, int x, int y, int w, int h)
-{
- es->solid_rect.x = x;
- es->solid_rect.y = y;
- es->solid_rect.w = w;
- es->solid_rect.h = h;
-}
-
-EAPI void
-e_container_shape_solid_rect_get(E_Container_Shape *es, int *x, int *y, int *w, int *h)
-{
- if (x) *x = es->solid_rect.x;
- if (y) *y = es->solid_rect.y;
- if (w) *w = es->solid_rect.w;
- if (h) *h = es->solid_rect.h;
-}
-
-/* layers
- * 0 = desktop
- * 50 = below
- * 100 = normal
- * 150 = above
- * 200 = fullscreen
- * 250 = fullscreen
- * 300 = fullscreen
- * 350 = stuff over fullscreen
- * 400 = stuff over stuff
- * 450 = yet more stuff on top
- */
-EAPI int
-e_container_borders_count(E_Container *con)
-{
- return con->clients;
-}
-
-static int
-_e_container_layer_map(E_Layer layer)
-{
- int pos = 0;
-
- pos = 1 + (layer / 50);
- if (pos > 10) pos = 10;
- return pos;
-}
-
-EAPI void
-e_container_border_add(E_Border *bd)
-{
- int pos = _e_container_layer_map(bd->layer);
- bd->zone->container->clients++;
- bd->zone->container->layers[pos].clients =
- eina_list_append(bd->zone->container->layers[pos].clients, bd);
- e_hints_client_list_set();
-}
-
-EAPI void
-e_container_border_remove(E_Border *bd)
-{
- int i;
-
- if (!bd->zone) return;
- /* FIXME: Could revert to old behaviour, ->layer is consistent
- * with pos now. */
- for (i = 0; i < 11; i++)
- {
- bd->zone->container->layers[i].clients =
- eina_list_remove(bd->zone->container->layers[i].clients, bd);
- }
- bd->zone->container->clients--;
- bd->zone = NULL;
- e_hints_client_list_set();
-}
-
-EAPI void
-e_container_window_raise(E_Container *con, Ecore_X_Window win, E_Layer layer)
-{
- int pos = _e_container_layer_map(layer);
- ecore_x_window_configure(win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- con->layers[pos + 1].win, ECORE_X_WINDOW_STACK_BELOW);
-}
-
-EAPI void
-e_container_window_lower(E_Container *con, Ecore_X_Window win, E_Layer layer)
-{
- int pos = _e_container_layer_map(layer);
- ecore_x_window_configure(win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- con->layers[pos].win, ECORE_X_WINDOW_STACK_ABOVE);
-}
-
-EAPI E_Border *
-e_container_border_raise(E_Border *bd)
-{
- E_Border *above = NULL;
- Eina_List *l;
- int pos = 0, i;
-
- if (!bd->zone) return NULL;
- /* Remove from old layer */
- for (i = 0; i < 11; i++)
- {
- bd->zone->container->layers[i].clients =
- eina_list_remove(bd->zone->container->layers[i].clients, bd);
- }
-
- /* Add to new layer */
- pos = _e_container_layer_map(bd->layer);
-
- ecore_x_window_configure(bd->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- bd->zone->container->layers[pos + 1].win, ECORE_X_WINDOW_STACK_BELOW);
-
- bd->zone->container->layers[pos].clients =
- eina_list_append(bd->zone->container->layers[pos].clients, bd);
-
- /* Find the window below this one */
- l = eina_list_data_find_list(bd->zone->container->layers[pos].clients, bd);
- if (eina_list_prev(l))
- above = eina_list_data_get(eina_list_prev(l));
- else
- {
- /* Need to check the layers below */
- for (i = pos - 1; i >= 0; i--)
- {
- if ((bd->zone->container->layers[i].clients) &&
- (l = eina_list_last(bd->zone->container->layers[i].clients)))
- {
- above = eina_list_data_get(l);
- break;
- }
- }
- }
-
- e_hints_client_stacking_set();
- return above;
-}
-
-EAPI E_Border *
-e_container_border_lower(E_Border *bd)
-{
- E_Border *below = NULL;
- Eina_List *l;
- int pos = 0, i;
-
- if (!bd->zone) return NULL;
- /* Remove from old layer */
- for (i = 0; i < 11; i++)
- {
- bd->zone->container->layers[i].clients =
- eina_list_remove(bd->zone->container->layers[i].clients, bd);
- }
-
- /* Add to new layer */
- pos = _e_container_layer_map(bd->layer);
-
- ecore_x_window_configure(bd->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- bd->zone->container->layers[pos].win, ECORE_X_WINDOW_STACK_ABOVE);
-
- bd->zone->container->layers[pos].clients =
- eina_list_prepend(bd->zone->container->layers[pos].clients, bd);
-
- /* Find the window above this one */
- l = eina_list_data_find_list(bd->zone->container->layers[pos].clients, bd);
- if (eina_list_next(l))
- below = eina_list_data_get(eina_list_next(l));
- else
- {
- /* Need to check the layers above */
- for (i = pos + 1; i < 11; i++)
- {
- if (bd->zone->container->layers[i].clients)
- {
- below = eina_list_data_get(bd->zone->container->layers[i].clients);
- break;
- }
- }
- }
-
- e_hints_client_stacking_set();
- return below;
-}
-
-EAPI void
-e_container_border_stack_above(E_Border *bd, E_Border *above)
-{
- int pos = 0, i;
-
- if (!bd->zone) return;
- /* Remove from old layer */
- for (i = 0; i < 11; i++)
- {
- bd->zone->container->layers[i].clients =
- eina_list_remove(bd->zone->container->layers[i].clients, bd);
- }
-
- /* Add to new layer */
- bd->layer = above->layer;
- pos = _e_container_layer_map(bd->layer);
-
- ecore_x_window_configure(bd->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- above->win, ECORE_X_WINDOW_STACK_ABOVE);
-
- bd->zone->container->layers[pos].clients =
- eina_list_append_relative(bd->zone->container->layers[pos].clients, bd, above);
-}
-
-EAPI void
-e_container_border_stack_below(E_Border *bd, E_Border *below)
-{
- int pos = 0, i;
-
- if (!bd->zone) return;
- /* Remove from old layer */
- for (i = 0; i < 11; i++)
- {
- bd->zone->container->layers[i].clients =
- eina_list_remove(bd->zone->container->layers[i].clients, bd);
- }
-
- /* Add to new layer */
- bd->layer = below->layer;
- pos = _e_container_layer_map(bd->layer);
-
- ecore_x_window_configure(bd->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- below->win, ECORE_X_WINDOW_STACK_BELOW);
-
- bd->zone->container->layers[pos].clients =
- eina_list_prepend_relative(bd->zone->container->layers[pos].clients, bd, below);
-}
-
-static E_Border_List *
-_e_container_border_list_new(E_Container *con)
-{
- E_Border_List *list = NULL;
- E_Border *bd;
- int i;
- Eina_List *l;
-
- if (!(list = E_NEW(E_Border_List, 1))) return NULL;
- list->container = con;
- e_object_ref(E_OBJECT(list->container));
- eina_array_step_set(&(list->client_array), sizeof(list->client_array), 256);
- for (i = 0; i < 11; i++)
- {
- EINA_LIST_FOREACH(con->layers[i].clients, l, bd)
- eina_array_push(&(list->client_array), bd);
- }
- return list;
-}
-
-static E_Border *
-_e_container_border_list_jump(E_Border_List *list, int dir)
-{
- E_Border *bd;
-
- if ((list->pos < 0) ||
- (list->pos >= (int)eina_array_count(&(list->client_array))))
- return NULL;
- bd = eina_array_data_get(&(list->client_array), list->pos);
- list->pos += dir;
- return bd;
-}
-
-EAPI E_Border_List *
-e_container_border_list_first(E_Container *con)
-{
- E_Border_List *list = NULL;
-
- list = _e_container_border_list_new(con);
- list->pos = 0;
- return list;
-}
-
-EAPI E_Border_List *
-e_container_border_list_last(E_Container *con)
-{
- E_Border_List *list = NULL;
-
- list = _e_container_border_list_new(con);
- list->pos = eina_array_count(&(list->client_array)) - 1;
- return list;
-}
-
-EAPI E_Border *
-e_container_border_list_next(E_Border_List *list)
-{
- return _e_container_border_list_jump(list, 1);
-}
-
-EAPI E_Border *
-e_container_border_list_prev(E_Border_List *list)
-{
- return _e_container_border_list_jump(list, -1);
-}
-
-EAPI void
-e_container_border_list_free(E_Border_List *list)
-{
- e_object_unref(E_OBJECT(list->container));
- eina_array_flush(&(list->client_array));
- free(list);
-}
-
-EAPI void
-e_container_all_freeze(void)
-{
- Eina_List *l, *ll;
- E_Manager *man;
- E_Container *con;
-
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- EINA_LIST_FOREACH(man->containers, ll, con)
- {
- evas_event_freeze(con->bg_evas);
- }
- }
-}
-
-EAPI void
-e_container_all_thaw(void)
-{
- Eina_List *l, *ll;
- E_Manager *man;
- E_Container *con;
-
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- EINA_LIST_FOREACH(man->containers, ll, con)
- {
- evas_event_thaw(con->bg_evas);
- }
- }
-}
-
-EAPI E_Container *
-e_container_evas_object_container_get(Evas_Object *obj)
-{
- Evas *evas;
- Evas_Object *wobj;
- E_Container *con;
-
- if (!obj) return NULL;
- evas = evas_object_evas_get(obj);
- wobj = evas_object_name_find(evas, "container->bg_blank_object");
- if (!wobj) return NULL;
- con = evas_object_data_get(wobj, "e_container");
- return con;
-}
-
-/* local subsystem functions */
-static void
-_e_container_free(E_Container *con)
-{
- Eina_List *l;
- int i;
-
- ecore_x_window_free(con->scratch_win);
- /* We can't use e_object_del here, because border adds a ref to itself
- * when it is removed, and the ref is never unref'ed */
- for (i = 0; i < 11; i++)
- {
- ecore_x_window_free(con->layers[i].win);
-/* FIXME: had to disable this as it was freeing already freed items during
- * looping (particularly remember/lock config dialogs). this is just
- * disabled until we put in some special handling for this
- *
- EINA_LiST_FOREACH(con->layers[i].clients, l, tmp)
- {
- e_object_free(E_OBJECT(tmp));
- }
- */
- }
- l = con->zones;
- con->zones = NULL;
- E_FREE_LIST(l, e_object_del);
- con->manager->containers = eina_list_remove(con->manager->containers, con);
- e_canvas_del(con->bg_ecore_evas);
- ecore_evas_free(con->bg_ecore_evas);
- if (con->manager->win != con->win)
- {
- ecore_x_window_free(con->win);
- }
- if (con->name) eina_stringshare_del(con->name);
- free(con);
-}
-
-static void
-_e_container_cb_mouse_in(E_Container *con EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- E_Border *bd;
-
- bd = e_border_focused_get();
- if (bd && (!bd->border_menu)) e_focus_event_mouse_out(bd);
-}
-
-static void
-_e_container_cb_mouse_down(E_Container *con, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_CONTAINER, E_OBJECT(con), event_info);
-}
-
-static void
-_e_container_cb_mouse_up(E_Container *con, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- e_bindings_mouse_up_evas_event_handle(E_BINDING_CONTEXT_CONTAINER, E_OBJECT(con), event_info);
-}
-
-static void
-_e_container_cb_mouse_wheel(E_Container *con, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- e_bindings_wheel_evas_event_handle(E_BINDING_CONTEXT_CONTAINER, E_OBJECT(con), event_info);
-}
-
-static void
-_e_container_shape_del(E_Container_Shape *es)
-{
- if (es->comp_win) es->comp_win->shape = NULL;
- _e_container_shape_change_call(es, E_CONTAINER_SHAPE_DEL);
-}
-
-static void
-_e_container_shape_free(E_Container_Shape *es)
-{
- es->con->shapes = eina_list_remove(es->con->shapes, es);
- free(es->shape_rects);
- free(es->shape_input_rects);
- free(es);
-}
-
-static void
-_e_container_shape_change_call(E_Container_Shape *es, E_Container_Shape_Change ch)
-{
- Eina_List *l = NULL;
- E_Container_Shape_Callback *cb = NULL;
-
- if ((!es) || (!es->con) || (!es->con->shape_change_cb)) return;
- EINA_LIST_FOREACH(es->con->shape_change_cb, l, cb)
- {
- if (!cb) continue;
- cb->func(cb->data, es, ch);
- }
-}
-
-static int
-_e_container_cb_zone_sort(const void *data1, const void *data2)
-{
- const E_Zone *z1, *z2;
-
- z1 = data1;
- z2 = data2;
-
- return z2->num - z1->num;
-}
-
-static void
-_e_container_resize_handle(E_Container *con)
-{
- E_Event_Container_Resize *ev;
- Eina_List *l, *screens, *zones = NULL, *ll;
- E_Zone *zone;
- E_Screen *scr;
- int i;
-
- ev = calloc(1, sizeof(E_Event_Container_Resize));
- ev->container = con;
- e_object_ref(E_OBJECT(con));
-
- e_xinerama_update();
- screens = (Eina_List *)e_xinerama_screens_get();
-
- if (screens)
- {
- EINA_LIST_FOREACH(con->zones, l, zone)
- zones = eina_list_append(zones, zone);
- con->zones = NULL;
- EINA_LIST_FOREACH(screens, l, scr)
- {
- zone = NULL;
-
- printf("@@@ SCREENS: %i %i | %i %i %ix%i\n",
- scr->screen, scr->escreen, scr->x, scr->y, scr->w, scr->h);
- EINA_LIST_FOREACH(zones, ll, zone)
- {
- if (zone->id == scr->escreen) break;
- zone = NULL;
- }
- if (zone)
- {
- printf("@@@ FOUND ZONE %i %i [%p]\n", zone->num, zone->id, zone);
- e_zone_move_resize(zone, scr->x, scr->y, scr->w, scr->h);
- zones = eina_list_remove(zones, zone);
- con->zones = eina_list_append(con->zones, zone);
- zone->num = scr->screen;
- }
- else
- {
- zone = e_zone_new(con, scr->screen, scr->escreen,
- scr->x, scr->y, scr->w, scr->h);
- printf("@@@ NEW ZONE = %p\n", zone);
- }
- }
- con->zones = eina_list_sort(con->zones, eina_list_count(con->zones),
- _e_container_cb_zone_sort);
- if (zones)
- {
- E_Zone *spare_zone = NULL;
-
- if (con->zones) spare_zone = con->zones->data;
-
- EINA_LIST_FREE(zones, zone)
- {
- E_Border_List *bl;
- E_Border *bd;
-
- /* delete any shelves on this zone */
- bl = e_container_border_list_first(zone->container);
- while ((bd = e_container_border_list_next(bl)))
- {
- if (bd->zone == zone)
- {
- if (spare_zone) e_border_zone_set(bd, spare_zone);
- else
- printf("EEEK! should not be here - but no\n"
- "spare zones exist to move this\n"
- "window to!!! help!\n");
- }
- }
- e_container_border_list_free(bl);
- e_object_del(E_OBJECT(zone));
- }
- }
- e_shelf_config_update();
- }
- else
- {
- E_Zone *z;
-
- z = e_container_zone_number_get(con, 0);
- if (z)
- {
- e_zone_move_resize(z, 0, 0, con->w, con->h);
- e_shelf_zone_move_resize_handle(z);
- }
- }
-
- ecore_event_add(E_EVENT_CONTAINER_RESIZE, ev, _e_container_event_container_resize_free, NULL);
-
- for (i = 0; i < 11; i++)
- {
- Eina_List *tmp = NULL;
- E_Border *bd;
-
- /* Make temporary list as e_border_res_change_geometry_restore
- * rearranges the order. */
- EINA_LIST_FOREACH(con->layers[i].clients, l, bd)
- tmp = eina_list_append(tmp, bd);
-
- EINA_LIST_FOREACH(tmp, l, bd)
- {
- e_border_res_change_geometry_save(bd);
- e_border_res_change_geometry_restore(bd);
- }
-
- eina_list_free(tmp);
- }
-}
-
-static void
-_e_container_event_container_resize_free(void *data __UNUSED__, void *ev)
-{
- E_Event_Container_Resize *e;
-
- e = ev;
- e_object_unref(E_OBJECT(e->container));
- free(e);
-}
-
diff --git a/src/bin/e_container.h b/src/bin/e_container.h
deleted file mode 100644
index 4619a75024..0000000000
--- a/src/bin/e_container.h
+++ /dev/null
@@ -1,157 +0,0 @@
-#ifdef E_TYPEDEFS
-
-typedef enum _E_Container_Shape_Change
-{
- E_CONTAINER_SHAPE_ADD,
- E_CONTAINER_SHAPE_DEL,
- E_CONTAINER_SHAPE_SHOW,
- E_CONTAINER_SHAPE_HIDE,
- E_CONTAINER_SHAPE_MOVE,
- E_CONTAINER_SHAPE_RESIZE,
- E_CONTAINER_SHAPE_RECTS,
- E_CONTAINER_SHAPE_INPUT_RECTS
-} E_Container_Shape_Change;
-
-typedef struct _E_Container E_Container;
-typedef struct _E_Border_List E_Border_List;
-typedef struct _E_Container_Shape E_Container_Shape;
-typedef struct _E_Container_Shape_Callback E_Container_Shape_Callback;
-typedef struct _E_Event_Container_Resize E_Event_Container_Resize;
-
-typedef void (*E_Container_Shape_Cb)(void *data, E_Container_Shape *es, E_Container_Shape_Change ch);
-
-#else
-#ifndef E_CONTAINER_H
-#define E_CONTAINER_H
-
-#define E_CONTAINER_TYPE (int) 0xE0b01003
-#define E_CONTAINER_SHAPE_TYPE (int) 0xE0b01004
-
-#define E_CONTAINER_LAYER_COUNT 12
-
-struct _E_Container
-{
- E_Object e_obj_inherit;
-
- Ecore_X_Window win;
- int x, y, w, h;
- char visible : 1;
- E_Manager *manager;
-
- unsigned int num;
- const char *name;
-
- Ecore_Evas *bg_ecore_evas;
- Evas *bg_evas;
- Evas_Object *bg_blank_object;
- Ecore_X_Window bg_win;
- Ecore_X_Window event_win;
-
- Eina_List *shapes;
- Eina_List *shape_change_cb;
- Eina_List *zones;
-
- unsigned int clients;
- struct {
- Ecore_X_Window win;
- Eina_List *clients; /* E_Border */
- } layers[E_CONTAINER_LAYER_COUNT];
-
- Ecore_X_Window scratch_win;
-};
-
-struct _E_Border_List
-{
- E_Container *container;
- Eina_Array client_array;
- int pos;
-};
-
-struct _E_Container_Shape
-{
- E_Object e_obj_inherit;
-
- E_Container *con;
- E_Comp_Win *comp_win;
- int x, y, w, h;
- unsigned char visible : 1;
- struct {
- int x, y, w, h;
- } solid_rect;
- int shape_rects_num;
- Eina_Rectangle *shape_rects;
- int shape_input_rects_num;
- Eina_Rectangle *shape_input_rects;
-};
-
-struct _E_Container_Shape_Callback
-{
- E_Container_Shape_Cb func;
- void *data;
-};
-
-struct _E_Event_Container_Resize
-{
- E_Container *container;
-};
-
-EINTERN int e_container_init(void);
-EINTERN int e_container_shutdown(void);
-
-EAPI E_Container *e_container_new(E_Manager *man);
-EAPI void e_container_show(E_Container *con);
-EAPI void e_container_hide(E_Container *con);
-EAPI E_Container *e_container_current_get(E_Manager *man);
-EAPI E_Container *e_container_number_get(E_Manager *man, int num);
-EAPI void e_container_move(E_Container *con, int x, int y);
-EAPI void e_container_resize(E_Container *con, int w, int h);
-EAPI void e_container_move_resize(E_Container *con, int x, int y, int w, int h);
-EAPI void e_container_raise(E_Container *con);
-EAPI void e_container_lower(E_Container *con);
-
-EAPI E_Border_List *e_container_border_list_first(E_Container *con);
-EAPI E_Border_List *e_container_border_list_last(E_Container *con);
-EAPI E_Border *e_container_border_list_next(E_Border_List *list);
-EAPI E_Border *e_container_border_list_prev(E_Border_List *list);
-EAPI void e_container_border_list_free(E_Border_List *list);
-
-EAPI E_Zone *e_container_zone_at_point_get(E_Container *con, int x, int y);
-EAPI E_Zone *e_container_zone_number_get(E_Container *con, int num);
-EAPI E_Zone *e_container_zone_id_get(E_Container *con, int id);
-
-EAPI E_Desk *e_container_desk_window_profile_get(E_Container *con, const char *profile);
-
-EAPI E_Container_Shape *e_container_shape_add(E_Container *con);
-EAPI void e_container_shape_show(E_Container_Shape *es);
-EAPI void e_container_shape_hide(E_Container_Shape *es);
-EAPI void e_container_shape_move(E_Container_Shape *es, int x, int y);
-EAPI void e_container_shape_resize(E_Container_Shape *es, int w, int h);
-EAPI Eina_List *e_container_shape_list_get(E_Container *con);
-EAPI void e_container_shape_geometry_get(E_Container_Shape *es, int *x, int *y, int *w, int *h);
-EAPI E_Container *e_container_shape_container_get(E_Container_Shape *es);
-EAPI void e_container_shape_change_callback_add(E_Container *con, E_Container_Shape_Cb func, void *data);
-EAPI void e_container_shape_change_callback_del(E_Container *con, E_Container_Shape_Cb func, void *data);
-EAPI void e_container_shape_rects_set(E_Container_Shape *es, Eina_Rectangle *rects, int num);
-EAPI void e_container_shape_input_rects_set(E_Container_Shape *es, Eina_Rectangle *rects, int num);
-EAPI void e_container_shape_solid_rect_set(E_Container_Shape *es, int x, int y, int w, int h);
-EAPI void e_container_shape_solid_rect_get(E_Container_Shape *es, int *x, int *y, int *w, int *h);
-
-EAPI int e_container_borders_count(E_Container *con);
-EAPI void e_container_border_add(E_Border *bd);
-EAPI void e_container_border_remove(E_Border *bd);
-EAPI void e_container_window_raise(E_Container *con, Ecore_X_Window win, E_Layer layer);
-EAPI void e_container_window_lower(E_Container *con, Ecore_X_Window win, E_Layer layer);
-EAPI E_Border *e_container_border_raise(E_Border *bd);
-EAPI E_Border *e_container_border_lower(E_Border *bd);
-EAPI void e_container_border_stack_above(E_Border *bd, E_Border *above);
-EAPI void e_container_border_stack_below(E_Border *bd, E_Border *below);
-
-EAPI void e_container_all_freeze(void);
-EAPI void e_container_all_thaw(void);
-
-EAPI E_Container *e_container_evas_object_container_get(Evas_Object *obj);
-
-extern EAPI int E_EVENT_CONTAINER_RESIZE;
-
-#endif
-#endif
diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c
index b156e19894..f080e8411e 100644
--- a/src/bin/e_desk.c
+++ b/src/bin/e_desk.c
@@ -13,10 +13,8 @@ static void _e_desk_event_desk_deskshow_free(void *data, void *ev);
static void _e_desk_event_desk_name_change_free(void *data, void *ev);
static void _e_desk_show_begin(E_Desk *desk, int dx, int dy);
static void _e_desk_hide_begin(E_Desk *desk, int dx, int dy);
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
static void _e_desk_event_desk_window_profile_change_free(void *data, void *ev);
static void _e_desk_window_profile_change_protocol_set(void);
-#endif
EAPI int E_EVENT_DESK_SHOW = 0;
EAPI int E_EVENT_DESK_BEFORE_SHOW = 0;
@@ -49,9 +47,7 @@ e_desk_new(E_Zone *zone, int x, int y)
E_Desk *desk;
Eina_List *l;
E_Config_Desktop_Name *cfname;
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
E_Config_Desktop_Window_Profile *cfprof;
-#endif
char name[40];
int ok = 0;
@@ -68,8 +64,8 @@ e_desk_new(E_Zone *zone, int x, int y)
/* Get current desktop's name */
EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
{
- if ((cfname->container >= 0) &&
- ((int)zone->container->num != cfname->container)) continue;
+ if ((cfname->manager >= 0) &&
+ ((int)zone->comp->num != cfname->manager)) continue;
if ((cfname->zone >= 0) &&
((int)zone->num != cfname->zone)) continue;
if ((cfname->desk_x != desk->x) || (cfname->desk_y != desk->y))
@@ -84,13 +80,12 @@ e_desk_new(E_Zone *zone, int x, int y)
snprintf(name, sizeof(name), _(e_config->desktop_default_name), x, y);
desk->name = eina_stringshare_add(name);
}
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
/* Get window profile name for current desktop */
ok = 0;
EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
{
- if ((cfprof->container >= 0) &&
- ((int)zone->container->num != cfprof->container)) continue;
+ if ((cfprof->manager >= 0) &&
+ ((int)zone->comp->num != cfprof->manager)) continue;
if ((cfprof->zone >= 0) &&
((int)zone->num != cfprof->zone)) continue;
if ((cfprof->desk_x != desk->x) || (cfprof->desk_y != desk->y))
@@ -105,7 +100,6 @@ e_desk_new(E_Zone *zone, int x, int y)
desk->window_profile = eina_stringshare_add
(e_config->desktop_default_window_profile);
}
-#endif
return desk;
}
@@ -127,14 +121,14 @@ e_desk_name_set(E_Desk *desk, const char *name)
}
EAPI void
-e_desk_name_add(int container, int zone, int desk_x, int desk_y, const char *name)
+e_desk_name_add(int manager, int zone, int desk_x, int desk_y, const char *name)
{
E_Config_Desktop_Name *cfname;
- e_desk_name_del(container, zone, desk_x, desk_y);
+ e_desk_name_del(manager, zone, desk_x, desk_y);
cfname = E_NEW(E_Config_Desktop_Name, 1);
- cfname->container = container;
+ cfname->manager = manager;
cfname->zone = zone;
cfname->desk_x = desk_x;
cfname->desk_y = desk_y;
@@ -144,14 +138,14 @@ e_desk_name_add(int container, int zone, int desk_x, int desk_y, const char *nam
}
EAPI void
-e_desk_name_del(int container, int zone, int desk_x, int desk_y)
+e_desk_name_del(int manager, int zone, int desk_x, int desk_y)
{
Eina_List *l = NULL;
E_Config_Desktop_Name *cfname = NULL;
EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
{
- if ((cfname->container == container) && (cfname->zone == zone) &&
+ if ((cfname->manager == manager) && (cfname->zone == zone) &&
(cfname->desk_x == desk_x) && (cfname->desk_y == desk_y))
{
e_config->desktop_names =
@@ -166,48 +160,44 @@ e_desk_name_del(int container, int zone, int desk_x, int desk_y)
EAPI void
e_desk_name_update(void)
{
- Eina_List *m, *c, *z, *l;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *z, *l;
+ E_Comp *c;
E_Zone *zone;
E_Desk *desk;
E_Config_Desktop_Name *cfname;
int d_x, d_y, ok;
char name[40];
- EINA_LIST_FOREACH(e_manager_list(), m, man)
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
{
- EINA_LIST_FOREACH(man->containers, c, con)
+ EINA_LIST_FOREACH(c->zones, z, zone)
{
- EINA_LIST_FOREACH(con->zones, z, zone)
+ for (d_x = 0; d_x < zone->desk_x_count; d_x++)
{
- for (d_x = 0; d_x < zone->desk_x_count; d_x++)
+ for (d_y = 0; d_y < zone->desk_y_count; d_y++)
{
- for (d_y = 0; d_y < zone->desk_y_count; d_y++)
+ desk = zone->desks[d_x + zone->desk_x_count * d_y];
+ ok = 0;
+
+ EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
+ {
+ if ((cfname->manager >= 0) &&
+ ((int)c->num != cfname->manager)) continue;
+ if ((cfname->zone >= 0) &&
+ ((int)zone->num != cfname->zone)) continue;
+ if ((cfname->desk_x != d_x) ||
+ (cfname->desk_y != d_y)) continue;
+ e_desk_name_set(desk, cfname->name);
+ ok = 1;
+ break;
+ }
+
+ if (!ok)
{
- desk = zone->desks[d_x + zone->desk_x_count * d_y];
- ok = 0;
-
- EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
- {
- if ((cfname->container >= 0) &&
- ((int)con->num != cfname->container)) continue;
- if ((cfname->zone >= 0) &&
- ((int)zone->num != cfname->zone)) continue;
- if ((cfname->desk_x != d_x) ||
- (cfname->desk_y != d_y)) continue;
- e_desk_name_set(desk, cfname->name);
- ok = 1;
- break;
- }
-
- if (!ok)
- {
- snprintf(name, sizeof(name),
- _(e_config->desktop_default_name),
- d_x, d_y);
- e_desk_name_set(desk, name);
- }
+ snprintf(name, sizeof(name),
+ _(e_config->desktop_default_name),
+ d_x, d_y);
+ e_desk_name_set(desk, name);
}
}
}
@@ -236,7 +226,6 @@ e_desk_show(E_Desk *desk)
ecore_event_add(E_EVENT_DESK_BEFORE_SHOW, eev,
_e_desk_event_desk_before_show_free, NULL);
- ecore_x_window_shadow_tree_flush();
for (x = 0; x < desk->zone->desk_x_count; x++)
{
for (y = 0; y < desk->zone->desk_y_count; y++)
@@ -293,6 +282,8 @@ e_desk_show(E_Desk *desk)
{
if (e_config->focus_last_focused_per_desktop)
e_desk_last_focused_focus(desk);
+ else if (e_client_focused_get())
+ evas_object_focus_set(e_client_focused_get()->frame, 0);
}
if (was_zone)
@@ -328,8 +319,7 @@ e_desk_show(E_Desk *desk)
EAPI void
e_desk_deskshow(E_Zone *zone)
{
- E_Border *bd;
- E_Border_List *bl;
+ E_Client *ec;
E_Desk *desk;
E_Event_Desk_Show *ev;
@@ -337,32 +327,31 @@ e_desk_deskshow(E_Zone *zone)
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
desk = e_desk_current_get(zone);
- bl = e_container_border_list_first(zone->container);
- ecore_x_window_shadow_tree_flush();
- while ((bd = e_container_border_list_next(bl)))
+ /* uniconify raises windows and changes stacking order
+ * go top-down to avoid skipping windows
+ */
+ E_CLIENT_REVERSE_FOREACH(zone->comp, ec)
{
- if (bd->desk == desk)
+ if (e_client_util_ignored_get(ec)) continue;
+ if (ec->desk != desk) continue;
+ if (desk->deskshow_toggle)
{
- if (desk->deskshow_toggle)
- {
- if (bd->deskshow)
- {
- bd->deskshow = 0;
- e_border_uniconify(bd);
- }
- }
- else
+ if (ec->deskshow)
{
- if (bd->iconic) continue;
- if (bd->client.netwm.state.skip_taskbar) continue;
- if (bd->user_skip_winlist) continue;
- bd->deskshow = 1;
- e_border_iconify(bd);
+ ec->deskshow = 0;
+ e_client_uniconify(ec);
}
}
+ else
+ {
+ if (ec->iconic) continue;
+ if (ec->netwm.state.skip_taskbar) continue;
+ if (ec->user_skip_winlist) continue;
+ ec->deskshow = 1;
+ e_client_iconify(ec);
+ }
}
- desk->deskshow_toggle = desk->deskshow_toggle ? 0 : 1;
- e_container_border_list_free(bl);
+ desk->deskshow_toggle = !desk->deskshow_toggle;
ev = E_NEW(E_Event_Desk_Show, 1);
ev->desk = desk;
e_object_ref(E_OBJECT(desk));
@@ -370,41 +359,43 @@ e_desk_deskshow(E_Zone *zone)
_e_desk_event_desk_deskshow_free, NULL);
}
-EAPI E_Border *
+EAPI E_Client *
e_desk_last_focused_focus(E_Desk *desk)
{
Eina_List *l = NULL;
- E_Border *bd, *bds = NULL;
+ E_Client *ec, *ecs = NULL;
- EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
+ EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec)
{
- if ((!bd->iconic) && (bd->visible) &&
- ((bd->desk == desk) || ((bd->zone == desk->zone) && bd->sticky)) &&
- (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus) &&
- (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
- (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR) &&
- (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_MENU) &&
- (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_SPLASH) &&
- (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DESKTOP))
+ if ((!ec->iconic) && (ec->visible) &&
+ ((ec->desk == desk) || ((ec->zone == desk->zone) && ec->sticky)) &&
+ (ec->icccm.accepts_focus || ec->icccm.take_focus) &&
+ (ec->netwm.type != E_WINDOW_TYPE_DOCK) &&
+ (ec->netwm.type != E_WINDOW_TYPE_TOOLBAR) &&
+ (ec->netwm.type != E_WINDOW_TYPE_MENU) &&
+ (ec->netwm.type != E_WINDOW_TYPE_SPLASH) &&
+ (ec->netwm.type != E_WINDOW_TYPE_DESKTOP))
{
/* this was the window last focused in this desktop */
- if (!bd->lock_focus_out)
+ if (!ec->lock_focus_out)
{
- if (bd->sticky)
+ if (ec->sticky)
{
- bds = bd;
+ ecs = ec;
continue;
}
- e_border_focus_set_with_pointer(bd);
- return bd;
+ e_client_focus_set_with_pointer(ec);
+ return ec;
}
}
}
- if (bds)
+ if (ecs)
{
- e_border_focus_set_with_pointer(bds);
- return bds;
+ e_client_focus_set_with_pointer(ecs);
+ return ecs;
}
+ if (e_client_focused_get())
+ evas_object_focus_set(e_client_focused_get()->frame, 0);
return NULL;
}
@@ -532,7 +523,6 @@ e_desk_prev(E_Zone *zone)
e_desk_show(e_desk_at_xy_get(zone, x, y));
}
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
EAPI void
e_desk_window_profile_set(E_Desk *desk,
const char *profile)
@@ -552,7 +542,7 @@ e_desk_window_profile_set(E_Desk *desk,
}
EAPI void
-e_desk_window_profile_add(int container,
+e_desk_window_profile_add(int manager,
int zone,
int desk_x,
int desk_y,
@@ -560,20 +550,19 @@ e_desk_window_profile_add(int container,
{
E_Config_Desktop_Window_Profile *cfprof;
- e_desk_window_profile_del(container, zone, desk_x, desk_y);
+ e_desk_window_profile_del(manager, zone, desk_x, desk_y);
cfprof = E_NEW(E_Config_Desktop_Window_Profile, 1);
- cfprof->container = container;
+ cfprof->manager = manager;
cfprof->zone = zone;
cfprof->desk_x = desk_x;
cfprof->desk_y = desk_y;
- if (profile) cfprof->profile = eina_stringshare_add(profile);
- else cfprof->profile = NULL;
+ cfprof->profile = eina_stringshare_add(profile);
e_config->desktop_window_profiles = eina_list_append(e_config->desktop_window_profiles, cfprof);
}
EAPI void
-e_desk_window_profile_del(int container,
+e_desk_window_profile_del(int manager,
int zone,
int desk_x,
int desk_y)
@@ -583,7 +572,7 @@ e_desk_window_profile_del(int container,
EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
{
- if (!((cfprof->container == container) &&
+ if (!((cfprof->manager == manager) &&
(cfprof->zone == zone) &&
(cfprof->desk_x == desk_x) &&
(cfprof->desk_y == desk_y)))
@@ -591,8 +580,8 @@ e_desk_window_profile_del(int container,
e_config->desktop_window_profiles =
eina_list_remove_list(e_config->desktop_window_profiles, l);
- if (cfprof->profile) eina_stringshare_del(cfprof->profile);
- E_FREE(cfprof);
+ eina_stringshare_del(cfprof->profile);
+ free(cfprof);
break;
}
}
@@ -600,9 +589,8 @@ e_desk_window_profile_del(int container,
EAPI void
e_desk_window_profile_update(void)
{
- Eina_List *m, *c, *z, *l;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *z, *l;
+ E_Comp *c;
E_Zone *zone;
E_Desk *desk;
E_Config_Desktop_Window_Profile *cfprof;
@@ -613,37 +601,34 @@ e_desk_window_profile_update(void)
if (!(e_config->use_desktop_window_profile))
return;
- EINA_LIST_FOREACH(e_manager_list(), m, man)
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
{
- EINA_LIST_FOREACH(man->containers, c, con)
+ EINA_LIST_FOREACH(c->zones, z, zone)
{
- EINA_LIST_FOREACH(con->zones, z, zone)
+ for (d_x = 0; d_x < zone->desk_x_count; d_x++)
{
- for (d_x = 0; d_x < zone->desk_x_count; d_x++)
+ for (d_y = 0; d_y < zone->desk_y_count; d_y++)
{
- for (d_y = 0; d_y < zone->desk_y_count; d_y++)
+ desk = zone->desks[d_x + zone->desk_x_count * d_y];
+ ok = 0;
+
+ EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
+ {
+ if ((cfprof->manager >= 0) &&
+ ((int)c->num != cfprof->manager)) continue;
+ if ((cfprof->zone >= 0) &&
+ ((int)zone->num != cfprof->zone)) continue;
+ if ((cfprof->desk_x != d_x) ||
+ (cfprof->desk_y != d_y)) continue;
+ e_desk_window_profile_set(desk, cfprof->profile);
+ ok = 1;
+ break;
+ }
+
+ if (!ok)
{
- desk = zone->desks[d_x + zone->desk_x_count * d_y];
- ok = 0;
-
- EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
- {
- if ((cfprof->container >= 0) &&
- ((int)con->num != cfprof->container)) continue;
- if ((cfprof->zone >= 0) &&
- ((int)zone->num != cfprof->zone)) continue;
- if ((cfprof->desk_x != d_x) ||
- (cfprof->desk_y != d_y)) continue;
- e_desk_window_profile_set(desk, cfprof->profile);
- ok = 1;
- break;
- }
-
- if (!ok)
- {
- e_desk_window_profile_set
- (desk, e_config->desktop_default_window_profile);
- }
+ e_desk_window_profile_set
+ (desk, e_config->desktop_default_window_profile);
}
}
}
@@ -651,8 +636,6 @@ e_desk_window_profile_update(void)
}
}
-#endif
-
static void
_e_desk_free(E_Desk *desk)
{
@@ -704,34 +687,28 @@ _e_desk_event_desk_deskshow_free(void *data __UNUSED__, void *event)
static void
_e_desk_event_desk_name_change_free(void *data __UNUSED__, void *event)
{
- E_Event_Desk_Name_Change *ev;
-
- ev = event;
+ E_Event_Desk_Name_Change *ev = event;
e_object_unref(E_OBJECT(ev->desk));
free(ev);
}
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
static void
_e_desk_event_desk_window_profile_change_free(void *data __UNUSED__, void *event)
{
- E_Event_Desk_Window_Profile_Change *ev;
- ev = event;
+ E_Event_Desk_Window_Profile_Change *ev = event;
e_object_unref(E_OBJECT(ev->desk));
E_FREE(ev);
}
-#endif
-
static Eina_Bool
-_e_desk_transition_setup(E_Border *bd, int dx, int dy, int state)
+_e_desk_transition_setup(E_Client *ec, int dx, int dy, int state)
{
- e_comp_win_effect_set(bd->cw, e_config->desk_flip_animate_type ?: "none");
+ e_comp_object_effect_set(ec->frame, e_config->desk_flip_animate_type ?: "none");
if (e_config->desk_flip_animate_type)
{
/* set geoms */
- e_comp_win_effect_params_set(bd->cw, 1, (int[]){bd->x - bd->zone->x, bd->y - bd->zone->y, bd->w, bd->h, bd->zone->w, bd->zone->h, dx, dy}, 8);
- e_comp_win_effect_params_set(bd->cw, 0, (int[]){state}, 1);
+ e_comp_object_effect_params_set(ec->frame, 1, (int[]){ec->x - ec->zone->x, ec->y - ec->zone->y, ec->w, ec->h, ec->zone->w, ec->zone->h, dx, dy}, 8);
+ e_comp_object_effect_params_set(ec->frame, 0, (int[]){state}, 1);
}
return !!e_config->desk_flip_animate_type;
@@ -741,6 +718,7 @@ static void
_e_desk_show_end_serious(E_Desk *desk)
{
E_Event_Desk_After_Show *ev;
+ E_Client *ec;
ev = E_NEW(E_Event_Desk_After_Show, 1);
ev->desk = desk;
@@ -752,49 +730,61 @@ _e_desk_show_end_serious(E_Desk *desk)
if ((e_config->focus_policy == E_FOCUS_MOUSE) ||
(e_config->focus_policy == E_FOCUS_SLOPPY))
{
- E_Border *bd;
-
- bd = e_border_focused_get();
+ ec = e_client_focused_get();
/* only set focus/warp pointer if currently focused window
* is on same screen (user hasn't switched screens during transition)
*/
- if (bd && bd->desk && (bd->desk->zone != desk->zone))
+ if (ec && ec->desk && (ec->desk->zone != desk->zone))
return;
}
- e_desk_last_focused_focus(desk);
+ if (starting) return;
+ ec = e_desk_last_focused_focus(desk);
+ if ((e_config->focus_policy != E_FOCUS_MOUSE) && (!ec))
+ {
+ /* we didn't previously have a focused window on this desk
+ * but we should, so this is probably the first time the
+ * user has flipped to this desk. let's be helpful and
+ * focus a random window!
+ */
+ E_CLIENT_REVERSE_FOREACH(e_comp_get(desk), ec)
+ {
+ /* start with top and go down... */
+ if (e_client_util_ignored_get(ec)) continue;
+ if (!e_client_util_desk_visible(ec, desk)) continue;
+ evas_object_focus_set(ec->frame, 1);
+ break;
+ }
+ }
}
static void
_e_desk_show_end(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
- E_Border *bd = data;
+ E_Client *ec = data;
- bd->desk->animate_count--;
- e_border_comp_hidden_set(bd, bd->shaded);
- if (bd->desk != e_desk_current_get(bd->zone)) return;
- e_comp_win_effect_unclip(bd->cw);
- if (!bd->visible) e_border_show(bd);
- if (bd->desk->animate_count) return;
- _e_desk_show_end_serious(bd->desk);
+ ec->desk->animate_count--;
+ e_client_comp_hidden_set(ec, ec->shaded);
+ e_comp_object_effect_unclip(ec->frame);
+ ec->hidden = 0;
+ if (!ec->visible) evas_object_show(ec->frame);
+ if (ec->desk != e_desk_current_get(ec->zone)) return;
+ if (!ec->desk->animate_count) _e_desk_show_end_serious(ec->desk);
}
static void
_e_desk_hide_end(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
- E_Border *bd = data;
+ E_Client *ec = data;
- bd->desk->animate_count--;
- e_border_comp_hidden_set(bd, bd->shaded);
- e_border_hide(bd, 2);
- if (bd->desk->animate_count) return;
- ecore_x_window_shadow_tree_flush();
+ ec->desk->animate_count--;
+ ec->hidden = 1;
+ evas_object_hide(ec->frame);
}
static void
_e_desk_show_begin(E_Desk *desk, int dx, int dy)
{
- E_Border_List *bl;
- E_Border *bd;
+ E_Client *ec;
if (dx < 0) dx = -1;
if (dx > 0) dx = 1;
@@ -802,36 +792,38 @@ _e_desk_show_begin(E_Desk *desk, int dx, int dy)
if (dy > 0) dy = 1;
desk->animate_count = 0;
- bl = e_container_border_list_first(desk->zone->container);
- while ((bd = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(desk->zone->comp, ec)
{
- if ((bd->desk->zone != desk->zone) || (bd->iconic)) continue;
- if (bd->moving)
+ if ((ec->desk->zone != desk->zone) || (ec->iconic) || e_client_util_ignored_get(ec)) continue;
+ if (ec->moving)
{
- e_border_desk_set(bd, desk);
- e_border_show(bd);
+ e_client_desk_set(ec, desk);
+ evas_object_show(ec->frame);
continue;
}
- if ((bd->desk != desk) || (bd->sticky)) continue;
- if (_e_desk_transition_setup(bd, dx, dy, 1))
+ if ((ec->desk != desk) || (ec->sticky)) continue;
+ if (starting)
+ ec->hidden = 0;
+ else if (_e_desk_transition_setup(ec, dx, dy, 1))
{
- e_comp_win_effect_stop(bd->cw, _e_desk_hide_end);
- e_comp_win_effect_start(bd->cw, _e_desk_show_end, bd);
+ e_comp_object_effect_stop(ec->frame, _e_desk_hide_end);
+ e_comp_object_effect_start(ec->frame, _e_desk_show_end, ec);
desk->animate_count++;
- e_border_comp_hidden_set(bd, EINA_TRUE);
}
- e_border_show(bd);
+ else
+ ec->hidden = 0;
+
+ e_client_comp_hidden_set(ec, ec->hidden);
+ evas_object_show(ec->frame);
}
if ((!e_config->desk_flip_animate_type) || (!desk->animate_count))
_e_desk_show_end_serious(desk);
- e_container_border_list_free(bl);
}
static void
_e_desk_hide_begin(E_Desk *desk, int dx, int dy)
{
- E_Border_List *bl;
- E_Border *bd;
+ E_Client *ec;
if (dx < 0) dx = -1;
if (dx > 0) dx = 1;
@@ -839,28 +831,26 @@ _e_desk_hide_begin(E_Desk *desk, int dx, int dy)
if (dy > 0) dy = 1;
desk->animate_count = 0;
- bl = e_container_border_list_first(desk->zone->container);
- while ((bd = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(desk->zone->comp, ec)
{
- if ((bd->desk->zone != desk->zone) || (bd->iconic)) continue;
- if (bd->moving) continue;
- if ((bd->desk != desk) || (bd->sticky)) continue;
- if (_e_desk_transition_setup(bd, -dx, -dy, 0))
+ if ((ec->desk->zone != desk->zone) || (ec->iconic) || e_client_util_ignored_get(ec)) continue;
+ if (ec->moving) continue;
+ if ((ec->desk != desk) || (ec->sticky)) continue;
+ if ((!starting) && _e_desk_transition_setup(ec, -dx, -dy, 0))
{
- e_comp_win_effect_stop(bd->cw, _e_desk_show_end);
- e_comp_win_effect_start(bd->cw, _e_desk_hide_end, bd);
+ e_comp_object_effect_stop(ec->frame, _e_desk_show_end);
+ e_comp_object_effect_start(ec->frame, _e_desk_hide_end, ec);
desk->animate_count++;
- e_border_comp_hidden_set(bd, EINA_TRUE);
}
else
- e_border_hide(bd, 2);
+ {
+ ec->hidden = 1;
+ evas_object_hide(ec->frame);
+ }
+ e_client_comp_hidden_set(ec, EINA_TRUE);
}
- if (!e_config->desk_flip_animate_type)
- ecore_x_window_shadow_tree_flush();
- e_container_border_list_free(bl);
}
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
static void
_e_desk_window_profile_change_protocol_set(void)
{
@@ -868,10 +858,5 @@ _e_desk_window_profile_change_protocol_set(void)
E_Manager *man;
EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- ecore_x_e_window_profile_supported_set
- (man->root, e_config->use_desktop_window_profile);
- }
+ ecore_x_e_window_profile_supported_set(man->root, e_config->use_desktop_window_profile);
}
-
-#endif
diff --git a/src/bin/e_desk.h b/src/bin/e_desk.h
index b8d06dc0cf..4d6985b465 100644
--- a/src/bin/e_desk.h
+++ b/src/bin/e_desk.h
@@ -30,7 +30,7 @@ struct _E_Desk
int x, y;
unsigned char visible : 1;
unsigned int deskshow_toggle : 1;
- int fullscreen_borders;
+ Eina_List *fullscreen_clients;
Evas_Object *bg_object;
@@ -66,12 +66,12 @@ EINTERN int e_desk_init(void);
EINTERN int e_desk_shutdown(void);
EAPI E_Desk *e_desk_new(E_Zone *zone, int x, int y);
EAPI void e_desk_name_set(E_Desk *desk, const char *name);
-EAPI void e_desk_name_add(int container, int zone, int desk_x, int desk_y, const char *name);
-EAPI void e_desk_name_del(int container, int zone, int desk_x, int desk_y);
+EAPI void e_desk_name_add(int manager, int zone, int desk_x, int desk_y, const char *name);
+EAPI void e_desk_name_del(int manager, int zone, int desk_x, int desk_y);
EAPI void e_desk_name_update(void);
EAPI void e_desk_show(E_Desk *desk);
EAPI void e_desk_deskshow(E_Zone *zone);
-EAPI E_Border *e_desk_last_focused_focus(E_Desk *desk);
+EAPI E_Client *e_desk_last_focused_focus(E_Desk *desk);
EAPI E_Desk *e_desk_current_get(E_Zone *zone);
EAPI E_Desk *e_desk_at_xy_get(E_Zone *zone, int x, int y);
EAPI E_Desk *e_desk_at_pos_get(E_Zone *zone, int pos);
@@ -82,21 +82,17 @@ EAPI void e_desk_row_add(E_Zone *zone);
EAPI void e_desk_row_remove(E_Zone *zone);
EAPI void e_desk_col_add(E_Zone *zone);
EAPI void e_desk_col_remove(E_Zone *zone);
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
EAPI void e_desk_window_profile_set(E_Desk *desk, const char *profile);
-EAPI void e_desk_window_profile_add(int container, int zone, int desk_x, int desk_y, const char *profile);
-EAPI void e_desk_window_profile_del(int container, int zone, int desk_x, int desk_y);
+EAPI void e_desk_window_profile_add(int manager, int zone, int desk_x, int desk_y, const char *profile);
+EAPI void e_desk_window_profile_del(int manager, int zone, int desk_x, int desk_y);
EAPI void e_desk_window_profile_update(void);
-#endif
extern EAPI int E_EVENT_DESK_SHOW;
extern EAPI int E_EVENT_DESK_BEFORE_SHOW;
extern EAPI int E_EVENT_DESK_AFTER_SHOW;
extern EAPI int E_EVENT_DESK_DESKSHOW;
extern EAPI int E_EVENT_DESK_NAME_CHANGE;
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
extern EAPI int E_EVENT_DESK_WINDOW_PROFILE_CHANGE;
-#endif
#endif
#endif
diff --git a/src/bin/e_desklock.c b/src/bin/e_desklock.c
index cddd541980..009871bcaf 100644
--- a/src/bin/e_desklock.c
+++ b/src/bin/e_desklock.c
@@ -22,6 +22,7 @@ typedef struct _E_Desklock_Run E_Desklock_Run;
struct _E_Desklock_Popup_Data
{
E_Zone *zone;
+ Evas_Object *comp_object;
Evas_Object *bg_object;
Evas_Object *login_box;
};
@@ -183,7 +184,7 @@ _user_wallpaper_get(E_Zone *zone)
desk = e_desk_current_get(zone);
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cdbg)
{
- if ((cdbg->container > -1) && (cdbg->container != (int)zone->container->num)) continue;
+ if ((cdbg->manager > -1) && (cdbg->manager != (int)zone->comp->num)) continue;
if ((cdbg->zone > -1) && (cdbg->zone != (int)zone->num)) continue;
if ((cdbg->desk_x > -1) && (cdbg->desk_x != desk->x)) continue;
if ((cdbg->desk_y > -1) && (cdbg->desk_y != desk->y)) continue;
@@ -207,7 +208,7 @@ e_desklock_show_autolocked(void)
EAPI int
e_desklock_show(Eina_Bool suspend)
{
- Eina_List *managers, *l, *l2, *l3;
+ Eina_List *managers, *l, *l3;
E_Manager *man;
int total_zone_num;
E_Event_Desklock *ev;
@@ -251,7 +252,7 @@ e_desklock_show(Eina_Bool suspend)
zone = e_util_zone_current_get(e_manager_current_get());
if (zone)
- e_configure_registry_call("screen/screen_lock", zone->container, NULL);
+ e_configure_registry_call("screen/screen_lock", zone->comp, NULL);
return 0;
}
#ifdef HAVE_PAM
@@ -310,7 +311,7 @@ e_desklock_show(Eina_Bool suspend)
works:
//e_comp_block_window_add();
E_LIST_FOREACH(e_comp_list(), e_comp_override_add);
- e_comp_ignore_win_add(edd->elock_wnd);
+ e_comp_ignore_win_add(E_PIXMAP_TYPE_X, edd->elock_wnd);
if (e_config->desklock_language)
e_intl_language_set(e_config->desklock_language);
@@ -320,14 +321,9 @@ works:
total_zone_num = _e_desklock_zone_num_get();
EINA_LIST_FOREACH(managers, l, man)
{
- E_Container *con;
-
- EINA_LIST_FOREACH(man->containers, l2, con)
- {
- E_Zone *zone;
- EINA_LIST_FOREACH(con->zones, l3, zone)
- _e_desklock_popup_add(zone);
- }
+ E_Zone *zone;
+ EINA_LIST_FOREACH(man->comp->zones, l3, zone)
+ _e_desklock_popup_add(zone);
}
/* handlers */
@@ -476,8 +472,9 @@ _e_desklock_popup_add(E_Zone *zone)
evas_object_move(edp->bg_object, zone->x, zone->y);
evas_object_resize(edp->bg_object, zone->w, zone->h);
evas_object_show(edp->bg_object);
- E_LAYER_SET_ABOVE(edp->bg_object, E_COMP_CANVAS_LAYER_DESKLOCK);
- evas_object_clip_set(edp->bg_object, edp->zone->bg_clip_object);
+ edp->comp_object = e_comp_object_util_add(edp->bg_object, 0);
+ evas_object_layer_set(edp->comp_object, E_LAYER_DESKLOCK);
+ evas_object_clip_set(edp->comp_object, edp->zone->bg_clip_object);
_e_desklock_login_box_add(edp);
evas_event_thaw(evas);
@@ -521,11 +518,10 @@ _e_desklock_login_box_add(E_Desklock_Popup_Data *edp)
else
{
evas_object_resize(edp->login_box, mw, mh);
- evas_object_move(edp->login_box,
- zone->x + ((zone->w - mw) / 2),
- zone->y + ((zone->h - mh) / 2));
+ e_comp_object_util_center_on(edp->login_box, edp->comp_object);
evas_object_show(edp->login_box);
- E_LAYER_SET_ABOVE(edp->login_box, E_COMP_CANVAS_LAYER_DESKLOCK);
+ evas_object_layer_set(edp->login_box, E_LAYER_DESKLOCK);
+ evas_object_stack_above(edp->login_box, edp->comp_object);
}
evas_object_clip_set(edp->login_box, edp->zone->bg_clip_object);
@@ -536,6 +532,8 @@ _e_desklock_popup_free(E_Desklock_Popup_Data *edp)
{
if (!edp) return;
+ evas_object_hide(edp->comp_object);
+ evas_object_del(edp->comp_object);
evas_object_del(edp->bg_object);
evas_object_del(edp->login_box);
@@ -580,7 +578,7 @@ _e_desklock_cb_zone_del(void *data __UNUSED__,
E_Event_Zone_Del *ev = event;
Eina_List *l;
if (!edd) return ECORE_CALLBACK_PASS_ON;
- if ((eina_list_count(e_container_current_get(e_manager_current_get())->zones) == 1) && (e_config->desklock_login_box_zone == -2))
+ if ((eina_list_count(e_util_comp_current_get()->zones) == 1) && (e_config->desklock_login_box_zone == -2))
edd->move_handler = ecore_event_handler_del(edd->move_handler);
l = _e_desklock_popup_find(ev->zone);
@@ -605,13 +603,8 @@ _e_desklock_cb_zone_move_resize(void *data __UNUSED__,
EINA_LIST_FOREACH(edd->elock_wnd_list, l, edp)
if (edp->zone == ev->zone)
{
- int w, h;
-
evas_object_resize(edp->bg_object, ev->zone->w, ev->zone->h);
- evas_object_geometry_get(edp->login_box, NULL, NULL, &w, &h);
- evas_object_move(edp->login_box,
- edp->zone->x + ((edp->zone->w - w) / 2),
- edp->zone->y + ((edp->zone->h - h) / 2));
+ e_comp_object_util_center_on(edp->login_box, edp->comp_object);
break;
}
return ECORE_CALLBACK_PASS_ON;
@@ -794,16 +787,12 @@ static int
_e_desklock_zone_num_get(void)
{
int num;
- Eina_List *l, *l2;
+ Eina_List *l;
E_Manager *man;
num = 0;
EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- E_Container *con;
- EINA_LIST_FOREACH(man->containers, l2, con)
- num += eina_list_count(con->zones);
- }
+ num += eina_list_count(man->comp->zones);
return num;
}
@@ -870,8 +859,6 @@ _e_desklock_state_set(int state)
EINA_LIST_FOREACH(edd->elock_wnd_list, l, edp)
{
- edje_object_signal_emit(edp->login_box, signal_desklock, "e.desklock"); // compat
- edje_object_signal_emit(edp->bg_object, signal_desklock, "e.desklock"); // compat
edje_object_signal_emit(edp->login_box, signal_desklock, "e");
edje_object_signal_emit(edp->bg_object, signal_desklock, "e");
edje_object_part_text_set(edp->login_box, "e.text.title", text);
@@ -1223,15 +1210,11 @@ _e_desklock_ask_presentation_key_down(void *data, Evas *e __UNUSED__, Evas_Objec
static void
_e_desklock_ask_presentation_mode(void)
{
- E_Manager *man;
- E_Container *con;
E_Dialog *dia;
if (_e_desklock_ask_presentation_dia) return;
- if (!(man = e_manager_current_get())) return;
- if (!(con = e_container_current_get(man))) return;
- if (!(dia = e_dialog_new(con, "E", "_desklock_ask_presentation"))) return;
+ if (!(dia = e_dialog_new(NULL, "E", "_desklock_ask_presentation"))) return;
e_dialog_title_set(dia, _("Activate Presentation Mode?"));
e_dialog_icon_set(dia, "dialog-ask", 64);
diff --git a/src/bin/e_deskmirror.c b/src/bin/e_deskmirror.c
index 6306f96650..374a4d0b0e 100644
--- a/src/bin/e_deskmirror.c
+++ b/src/bin/e_deskmirror.c
@@ -1,3 +1,5 @@
+#warning FIXME
+#if 0
#include "e.h"
#define INTERNAL_ENTRY E_Smart_Data * sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
@@ -406,7 +408,7 @@ _mirror_border_new(Mirror *m)
else
edje_object_signal_emit(mb->frame, "e,state,shadow,off", "e");
edje_object_signal_callback_add(mb->m->cw->bd->bg_object, "*", "*", _mirror_border_signal_cb, mb);
- if (e_border_focused_get() == mb->m->cw->bd)
+ if (e_client_focused_get() == mb->m->cw->bd)
edje_object_signal_emit(mb->frame, "e,state,focused", "e");
if (mb->m->cw->bd->shaded)
edje_object_signal_emit(mb->frame, "e,state,shaded", "e");
@@ -625,3 +627,4 @@ e_deskmirror_util_wins_print(Evas_Object *obj)
fprintf(stderr, "MIRROR WIN: %p - %u%s\n", m->cw, m->cw->win, m->cw->input_only ? " INPUT" : "");
}
}
+#endif
diff --git a/src/bin/e_desktop_editor.c b/src/bin/e_desktop_editor.c
index d0cb1fb88e..ef8459de59 100644
--- a/src/bin/e_desktop_editor.c
+++ b/src/bin/e_desktop_editor.c
@@ -38,7 +38,7 @@ struct _E_Config_Dialog_Data
/* local subsystem functions */
-static int _e_desktop_edit_view_create(E_Desktop_Edit *editor, E_Container *con);
+static int _e_desktop_edit_view_create(E_Desktop_Edit *editor, E_Comp *c);
static void _e_desktop_edit_free(E_Desktop_Edit *editor);
static void *_e_desktop_edit_create_data(E_Config_Dialog *cfd);
static void _e_desktop_edit_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *data);
@@ -64,18 +64,18 @@ static void _e_desktop_editor_icon_entry_changed(void *data, Evas_Object
/* externally accessible functions */
EAPI Efreet_Desktop *
-e_desktop_border_create(E_Border *bd)
+e_desktop_client_create(E_Client *ec)
{
Efreet_Desktop *desktop = NULL;
const char *desktop_dir, *icon_dir;
const char *bname, *bclass, *btitle;
char path[PATH_MAX];
- bname = bd->client.icccm.name;
+ bname = ec->icccm.name;
if ((bname) && (bname[0] == 0)) bname = NULL;
- bclass = bd->client.icccm.class;
+ bclass = ec->icccm.class;
if ((bclass) && (bclass[0] == 0)) bclass = NULL;
- btitle = e_border_name_get(bd);
+ btitle = e_client_name_get(ec);
desktop_dir = e_user_desktop_dir_get();
@@ -125,15 +125,15 @@ e_desktop_border_create(E_Border *bd)
if (btitle) desktop->comment = strdup(btitle);
if (bclass) desktop->startup_wm_class = strdup(bclass);
- if (bd->client.icccm.command.argc > 0)
+ if (ec->icccm.command.argc > 0)
// FIXME this should concat the entire argv array together
- desktop->exec = strdup(bd->client.icccm.command.argv[0]);
+ desktop->exec = strdup(ec->icccm.command.argv[0]);
else if (bname)
desktop->exec = strdup(bname);
// disable this
-// if (bd->client.netwm.startup_id > 0) desktop->startup_notify = 1;
- if (bd->client.netwm.icons)
+// if (ec->netwm.startup_id > 0) desktop->startup_notify = 1;
+ if (ec->netwm.icons)
{
/* FIXME
* - Find the icon with the best size
@@ -143,7 +143,7 @@ e_desktop_border_create(E_Border *bd)
snprintf(file, sizeof(file), "%s-%.6f.png", bname ?: "", ecore_time_get());
snprintf(path, sizeof(path), "%s/%s", icon_dir, file);
- if (e_util_icon_save(&(bd->client.netwm.icons[0]), path))
+ if (e_util_icon_save(&(ec->netwm.icons[0]), path))
desktop->icon = strdup(file);
else
fprintf(stderr, "Could not save file from ARGB: %s\n", path);
@@ -152,22 +152,21 @@ e_desktop_border_create(E_Border *bd)
}
EAPI E_Desktop_Edit *
-e_desktop_border_edit(E_Container *con, E_Border *bd)
+e_desktop_border_edit(E_Comp *c, E_Client *ec)
{
E_Desktop_Edit *editor;
int new_desktop = 0;
- if (!con) return NULL;
editor = E_OBJECT_ALLOC(E_Desktop_Edit, E_DESKTOP_EDIT_TYPE, _e_desktop_edit_free);
if (!editor) return NULL;
- if (bd->desktop)
- editor->desktop = bd->desktop;
+ if (ec->desktop)
+ editor->desktop = ec->desktop;
/* the border does not yet have a desktop entry. add one and pre-populate
it with values from the border */
if (!editor->desktop)
{
- editor->desktop = e_desktop_border_create(bd);
+ editor->desktop = e_desktop_client_create(ec);
if ((editor->desktop) && (editor->desktop->icon))
editor->tmp_image_path = strdup(editor->desktop->icon);
new_desktop = 1;
@@ -186,7 +185,7 @@ e_desktop_border_edit(E_Container *con, E_Border *bd)
"change."));
}
#endif
- if (!_e_desktop_edit_view_create(editor, con))
+ if (!_e_desktop_edit_view_create(editor, c))
{
e_object_del(E_OBJECT(editor));
editor = NULL;
@@ -198,14 +197,14 @@ e_desktop_border_edit(E_Container *con, E_Border *bd)
}
EAPI E_Desktop_Edit *
-e_desktop_edit(E_Container *con, Efreet_Desktop *desktop)
+e_desktop_edit(E_Comp *c, Efreet_Desktop *desktop)
{
E_Desktop_Edit *editor;
editor = E_OBJECT_ALLOC(E_Desktop_Edit, E_DESKTOP_EDIT_TYPE, _e_desktop_edit_free);
if (!editor) return NULL;
if (desktop) editor->desktop = desktop;
- if (!_e_desktop_edit_view_create(editor, con))
+ if (!_e_desktop_edit_view_create(editor, c))
{
e_object_del(E_OBJECT(editor));
editor = NULL;
@@ -214,7 +213,7 @@ e_desktop_edit(E_Container *con, Efreet_Desktop *desktop)
}
static int
-_e_desktop_edit_view_create(E_Desktop_Edit *editor, E_Container *con)
+_e_desktop_edit_view_create(E_Desktop_Edit *editor, E_Comp *c)
{
E_Config_Dialog_View *v;
@@ -229,7 +228,7 @@ _e_desktop_edit_view_create(E_Desktop_Edit *editor, E_Container *con)
v->basic.check_changed = _e_desktop_edit_basic_check_changed;
editor->cfd =
- e_config_dialog_new(con, _("Desktop Entry Editor"), "E",
+ e_config_dialog_new(c, _("Desktop Entry Editor"), "E",
"applications/new_application",
"preferences-applications", 0, v, editor);
@@ -813,7 +812,7 @@ _e_desktop_editor_cb_icon_select(void *data1, void *data2)
if (editor->icon_fsel_dia) return;
- dia = e_dialog_new(cfdata->editor->cfd->con, "E", "_eap_icon_select_dialog");
+ dia = e_dialog_new(cfdata->editor->cfd->comp, "E", "_eap_icon_select_dialog");
if (!dia) return;
e_object_del_attach_func_set(E_OBJECT(dia),
_e_desktop_edit_cb_icon_select_destroy);
@@ -879,7 +878,7 @@ _e_desktop_editor_cb_exec_select(void *data1, void *data2)
if (editor->exec_fsel_dia) return;
- dia = e_dialog_new(cfdata->editor->cfd->con, "E", "_eap_exec_select_dialog");
+ dia = e_dialog_new(cfdata->editor->cfd->comp, "E", "_eap_exec_select_dialog");
if (!dia) return;
e_object_del_attach_func_set(E_OBJECT(dia),
_e_desktop_edit_cb_exec_select_destroy);
diff --git a/src/bin/e_desktop_editor.h b/src/bin/e_desktop_editor.h
index a6d8bd6ddf..786e1d7567 100644
--- a/src/bin/e_desktop_editor.h
+++ b/src/bin/e_desktop_editor.h
@@ -32,9 +32,9 @@ struct _E_Desktop_Edit
E_Config_Dialog *cfd;
};
-EAPI Efreet_Desktop *e_desktop_border_create(E_Border *bd);
-EAPI E_Desktop_Edit *e_desktop_border_edit(E_Container *con, E_Border *bd);
-EAPI E_Desktop_Edit *e_desktop_edit(E_Container *con, Efreet_Desktop *desktop);
+EAPI Efreet_Desktop *e_desktop_client_create(E_Client *ec);
+EAPI E_Desktop_Edit *e_desktop_border_edit(E_Comp *c, E_Client *ec);
+EAPI E_Desktop_Edit *e_desktop_edit(E_Comp *c, Efreet_Desktop *desktop);
#endif
#endif
diff --git a/src/bin/e_dialog.c b/src/bin/e_dialog.c
index b923d04b4b..f6609d5a4c 100644
--- a/src/bin/e_dialog.c
+++ b/src/bin/e_dialog.c
@@ -13,25 +13,17 @@ static void _e_dialog_cb_wid_on_focus(void *data, Evas_Object *obj);
/* externally accessible functions */
static E_Dialog *
-_e_dialog_internal_new(E_Container *con, const char *name, const char *class, int dialog)
+_e_dialog_internal_new(E_Comp *c, const char *name, const char *class, int dialog)
{
E_Dialog *dia;
- E_Manager *man;
Evas_Object *o;
Evas_Modifier_Mask mask;
Eina_Bool kg;
- if (!con)
- {
- man = e_manager_current_get();
- if (!man) return NULL;
- con = e_container_current_get(man);
- if (!con) con = e_container_number_get(man, 0);
- if (!con) return NULL;
- }
+ if (!c) c = e_util_comp_current_get();
dia = E_OBJECT_ALLOC(E_Dialog, E_DIALOG_TYPE, _e_dialog_free);
if (!dia) return NULL;
- dia->win = e_win_new(con);
+ dia->win = e_win_new(c);
if (!dia->win)
{
free(dia);
@@ -84,15 +76,15 @@ _e_dialog_internal_new(E_Container *con, const char *name, const char *class, in
}
EAPI E_Dialog *
-e_dialog_new(E_Container *con, const char *name, const char *class)
+e_dialog_new(E_Comp *c, const char *name, const char *class)
{
- return _e_dialog_internal_new(con, name, class, 1);
+ return _e_dialog_internal_new(c, name, class, 1);
}
EAPI E_Dialog *
-e_dialog_normal_win_new(E_Container *con, const char *name, const char *class)
+e_dialog_normal_win_new(E_Comp *c, const char *name, const char *class)
{
- return _e_dialog_internal_new(con, name, class, 0);
+ return _e_dialog_internal_new(c, name, class, 0);
}
EAPI void
@@ -182,17 +174,11 @@ e_dialog_icon_set(E_Dialog *dia, const char *icon, Evas_Coord size)
EAPI void
e_dialog_border_icon_set(E_Dialog *dia, const char *icon)
{
- E_Border *border;
+ E_Client *ec;
- border = dia->win->border;
- if (!border) return;
- if (border->internal_icon)
- {
- eina_stringshare_del(border->internal_icon);
- border->internal_icon = NULL;
- }
- if (icon)
- border->internal_icon = eina_stringshare_add(icon);
+ ec = dia->win->client;
+ if (ec)
+ eina_stringshare_replace(&ec->internal_icon, icon);
}
EAPI void
diff --git a/src/bin/e_dialog.h b/src/bin/e_dialog.h
index 9ec238db5f..44adc67d81 100644
--- a/src/bin/e_dialog.h
+++ b/src/bin/e_dialog.h
@@ -28,8 +28,8 @@ struct _E_Dialog
typedef void (*E_Dialog_Cb)(void *data, E_Dialog *dia);
-EAPI E_Dialog *e_dialog_new (E_Container *con, const char *name, const char *class);
-EAPI E_Dialog *e_dialog_normal_win_new (E_Container *con, const char *name, const char *class);
+EAPI E_Dialog *e_dialog_new (E_Comp *c, const char *name, const char *class);
+EAPI E_Dialog *e_dialog_normal_win_new (E_Comp *c, const char *name, const char *class);
EAPI void e_dialog_parent_set(E_Dialog *dia, E_Win *win);
EAPI void e_dialog_button_add (E_Dialog *dia, const char *label, const char *icon, E_Dialog_Cb func, void *data);
EAPI int e_dialog_button_focus_num (E_Dialog *dia, int button);
diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index 52a3b7c734..73e82ff5a6 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -49,8 +49,6 @@ static Eina_List *_drag_list = NULL;
static E_Drag *_drag_current = NULL;
static XDnd *_xdnd = NULL;
-#define XDS_ATOM "XdndDirectSave0"
-static Ecore_X_Atom _xds_atom = 0;
static Ecore_X_Atom _text_atom = 0;
static Eina_Stringshare *_type_text_uri_list = NULL;
@@ -103,14 +101,16 @@ _e_drop_handler_active_check(E_Drop_Handler *h, const E_Drag *drag, Eina_Strings
EINTERN int
e_dnd_init(void)
{
+ E_Comp *c;
+ const Eina_List *l;
+
_type_text_uri_list = eina_stringshare_add("text/uri-list");
- _type_xds = eina_stringshare_add(XDS_ATOM);
+ _type_xds = eina_stringshare_add("XdndDirectSave0");
_type_text_x_moz_url = eina_stringshare_add("text/x-moz-url");
_type_enlightenment_x_file = eina_stringshare_add("enlightenment/x-file");
- _xds_atom = ecore_x_atom_get(XDS_ATOM);
_text_atom = ecore_x_atom_get("text/plain");
- _drop_win_hash = eina_hash_string_superfast_new(NULL);
+ _drop_win_hash = eina_hash_int32_new(NULL);
_drop_handlers_responsives = eina_hash_string_superfast_new(NULL);
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_dnd_cb_mouse_up, NULL);
@@ -126,6 +126,9 @@ e_dnd_init(void)
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_KEY_DOWN, _e_dnd_cb_key_down, NULL);
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_KEY_UP, _e_dnd_cb_key_up, NULL);
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ e_drop_xdnd_register_set(c->ee_win, 1);
+
_action = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
return 1;
}
@@ -152,13 +155,13 @@ e_dnd_shutdown(void)
_type_xds = NULL;
_type_text_x_moz_url = NULL;
_type_enlightenment_x_file = NULL;
- _text_atom = _xds_atom = 0;
+ _text_atom = 0;
return 1;
}
EAPI E_Drag *
-e_drag_new(E_Container *container, int x, int y,
+e_drag_new(E_Comp *comp, int x, int y,
const char **types, unsigned int num_types,
void *data, int size,
void *(*convert_cb)(E_Drag * drag, const char *type),
@@ -177,20 +180,11 @@ e_drag_new(E_Container *container, int x, int y,
drag->y = y;
drag->w = 24;
drag->h = 24;
- drag->layer = E_LAYER_DRAG;
- drag->container = container;
- e_object_ref(E_OBJECT(drag->container));
+ drag->layer = E_LAYER_CLIENT_DRAG;
+ drag->comp = comp;
+ e_object_ref(E_OBJECT(drag->comp));
- drag->evas = e_comp_get(drag)->evas;
- /* use first zone to preserve location coords */
- drag->pop = e_popup_new(eina_list_data_get(container->zones), x, y, drag->w, drag->h);
-
- e_popup_name_set(drag->pop, "E Drag");
- e_popup_layer_set(drag->pop, E_COMP_CANVAS_LAYER_POPUP, 0);
- e_popup_ignore_events_set(drag->pop, 1);
-
- drag->object = evas_object_rectangle_add(drag->evas);
- evas_object_color_set(drag->object, 255, 0, 0, 255);
+ drag->evas = comp->evas;
drag->type = E_DRAG_NONE;
@@ -206,7 +200,7 @@ e_drag_new(E_Container *container, int x, int y,
ecore_x_window_shadow_tree_flush();
- _drag_win_root = drag->container->manager->root;
+ _drag_win_root = drag->comp->man->root;
drag->cb.key_down = NULL;
drag->cb.key_up = NULL;
@@ -223,11 +217,17 @@ e_drag_evas_get(const E_Drag *drag)
EAPI void
e_drag_object_set(E_Drag *drag, Evas_Object *object)
{
- if (drag->object) evas_object_del(drag->object);
+ EINA_SAFETY_ON_NULL_RETURN(object);
+ EINA_SAFETY_ON_TRUE_RETURN(!!drag->object);
+ if (drag->visible)
+ evas_object_show(object);
+ else
+ evas_object_hide(object);
drag->object = object;
- drag->pop->content = NULL;
- if (_drag_current == drag)
- e_popup_content_set(drag->pop, object);
+ drag->comp_object = e_comp_object_util_add(object, E_COMP_OBJECT_TYPE_POPUP);
+ evas_object_layer_set(drag->comp_object, drag->layer);
+ evas_object_name_set(drag->comp_object, "E Drag");
+ evas_object_pass_events_set(drag->comp_object, 1);
}
EAPI void
@@ -237,7 +237,7 @@ e_drag_move(E_Drag *drag, int x, int y)
drag->x = x;
drag->y = y;
if (_drag_current == drag)
- e_popup_move(drag->pop, x, y);
+ evas_object_move(drag->comp_object, x, y);
}
EAPI void
@@ -247,7 +247,7 @@ e_drag_resize(E_Drag *drag, int w, int h)
drag->h = h;
drag->w = w;
if (_drag_current == drag)
- e_popup_resize(drag->pop, w, h);
+ evas_object_resize(drag->comp_object, w, h);
}
EAPI int
@@ -263,18 +263,23 @@ e_drag_start(E_Drag *drag, int x, int y)
E_Drop_Handler *h;
if (_drag_win) return 0;
- _drag_win = ecore_x_window_input_new(drag->container->win,
- drag->container->x, drag->container->y,
- drag->container->w, drag->container->h);
- _drag_win_root = drag->container->manager->root;
+ _drag_win = ecore_x_window_input_new(drag->comp->win,
+ drag->comp->man->x, drag->comp->man->y,
+ drag->comp->man->w, drag->comp->man->h);
+ _drag_win_root = drag->comp->man->root;
ecore_x_window_show(_drag_win);
if (!e_grabinput_get(_drag_win, 1, _drag_win))
{
ecore_x_window_free(_drag_win);
return 0;
}
- e_popup_move_resize(drag->pop, drag->x, drag->y, drag->w, drag->h);
- e_popup_content_set(drag->pop, drag->object);
+ if (!drag->object)
+ {
+ e_drag_object_set(drag, evas_object_rectangle_add(drag->evas));
+ evas_object_color_set(drag->object, 255, 0, 0, 255);
+ }
+ evas_object_move(drag->comp_object, drag->x, drag->y);
+ evas_object_resize(drag->comp_object, drag->w, drag->h);
drag->visible = 1;
drag->type = E_DRAG_INTERNAL;
@@ -315,9 +320,9 @@ e_drag_xdnd_start(E_Drag *drag, int x, int y)
E_Drop_Handler *h;
if (_drag_win) return 0;
- _drag_win = ecore_x_window_input_new(drag->container->win,
- drag->container->x, drag->container->y,
- drag->container->w, drag->container->h);
+ _drag_win = ecore_x_window_input_new(drag->comp->win,
+ drag->comp->man->x, drag->comp->man->y,
+ drag->comp->man->w, drag->comp->man->h);
ecore_x_window_show(_drag_win);
if (!e_grabinput_get(_drag_win, 1, _drag_win))
@@ -325,8 +330,13 @@ e_drag_xdnd_start(E_Drag *drag, int x, int y)
ecore_x_window_free(_drag_win);
return 0;
}
- e_popup_move_resize(drag->pop, drag->x, drag->y, drag->w, drag->h);
- e_popup_content_set(drag->pop, drag->object);
+ if (!drag->object)
+ {
+ e_drag_object_set(drag, evas_object_rectangle_add(drag->evas));
+ evas_object_color_set(drag->object, 255, 0, 0, 255);
+ }
+ evas_object_move(drag->comp_object, drag->x, drag->y);
+ evas_object_resize(drag->comp_object, drag->w, drag->h);
drag->visible = 1;
drag->type = E_DRAG_XDND;
@@ -380,7 +390,7 @@ e_drop_xds_update(Eina_Bool enable, const char *value)
xwin = ecore_x_selection_owner_get(ECORE_X_ATOM_SELECTION_XDND);
if (enable)
{
- if (!ecore_x_window_prop_property_get(xwin, _xds_atom, _text_atom, 8, (unsigned char **)&file, &size))
+ if (!ecore_x_window_prop_property_get(xwin, ECORE_X_ATOM_XDND_DIRECTSAVE0, _text_atom, 8, (unsigned char **)&file, &size))
return;
len = strlen(value);
if (size + len + 8 + 1 > sizeof(buf))
@@ -391,10 +401,10 @@ e_drop_xds_update(Eina_Bool enable, const char *value)
snprintf(buf, sizeof(buf), "file://%s/", value);
strncat(buf, file, size);
free(file);
- ecore_x_window_prop_property_set(xwin, _xds_atom, _text_atom, 8, (void *)buf, size + len + 8);
+ ecore_x_window_prop_property_set(xwin, ECORE_X_ATOM_XDND_DIRECTSAVE0, _text_atom, 8, (void *)buf, size + len + 8);
}
else
- ecore_x_window_prop_property_del(xwin, _xds_atom);
+ ecore_x_window_prop_property_del(xwin, ECORE_X_ATOM_XDND_DIRECTSAVE0);
}
EAPI E_Drop_Handler *
@@ -473,21 +483,18 @@ e_drop_handler_del(E_Drop_Handler *handler)
EAPI int
e_drop_xdnd_register_set(Ecore_X_Window win, int reg)
{
- const char *id;
-
- id = e_util_winid_str_get(win);
if (reg)
{
- if (!eina_hash_find(_drop_win_hash, id))
+ if (!eina_hash_find(_drop_win_hash, &win))
{
ecore_x_dnd_aware_set(win, 1);
- eina_hash_add(_drop_win_hash, id, (void *)1);
+ eina_hash_add(_drop_win_hash, &win, (void *)1);
}
}
else
{
ecore_x_dnd_aware_set(win, 0);
- eina_hash_del(_drop_win_hash, id, (void *)1);
+ eina_hash_del(_drop_win_hash, &win, (void *)1);
}
return 1;
}
@@ -597,12 +604,12 @@ _e_drag_move(E_Drag *drag, int x, int y)
if (((drag->x + drag->dx) == x) && ((drag->y + drag->dy) == y)) return;
- zone = e_container_zone_at_point_get(drag->container, x, y);
+ zone = e_comp_zone_xy_get(drag->comp, x, y);
if (zone) e_zone_flip_coords_handle(zone, x, y);
drag->x = x - drag->dx;
drag->y = y - drag->dy;
- e_popup_move(drag->pop, drag->x, drag->y);
+ evas_object_move(drag->comp_object, drag->x, drag->y);
}
static void
@@ -634,25 +641,20 @@ _e_drag_coords_update(const E_Drop_Handler *h, int *dx, int *dy)
break;
case E_WIN_TYPE:
- px = ((E_Win *)(h->obj))->border->x;
- py = ((E_Win *)(h->obj))->border->y;
+ px = ((E_Win *)(h->obj))->client->x;
+ py = ((E_Win *)(h->obj))->client->y;
break;
case E_ZONE_TYPE:
-// zone based drag targets are in a container thus their coords should be
+// zone based drag targets are in a comp thus their coords should be
// screen-relative as containers just cover the screen
// px = ((E_Zone *)(h->obj))->x;
// py = ((E_Zone *)(h->obj))->y;
break;
- case E_BORDER_TYPE:
- px = ((E_Border *)(h->obj))->x;
- py = ((E_Border *)(h->obj))->y;
- break;
-
- case E_POPUP_TYPE:
- px = ((E_Popup *)(h->obj))->x;
- py = ((E_Popup *)(h->obj))->y;
+ case E_CLIENT_TYPE:
+ px = ((E_Client *)(h->obj))->x;
+ py = ((E_Client *)(h->obj))->y;
break;
/* FIXME: add more types as needed */
@@ -671,25 +673,17 @@ _e_drag_win_get(const E_Drop_Handler *h, int xdnd)
if (h->obj)
{
+ E_Gadcon *gc = NULL;
+
switch (h->obj->type)
{
- E_Gadcon *gc;
-
- case E_GADCON_TYPE:
- gc = (E_Gadcon *)h->obj;
-
- if (gc->toolbar) hwin = gc->toolbar->fwin->border->win; //double check for xdnd...
- else
- {
- if (xdnd) hwin = e_gadcon_xdnd_window_get(gc);
- else hwin = e_gadcon_dnd_window_get(gc);
- }
- break;
-
case E_GADCON_CLIENT_TYPE:
gc = ((E_Gadcon_Client *)(h->obj))->gadcon;
+ if (!gc) return 0;
+ case E_GADCON_TYPE:
+ if (!gc) gc = (E_Gadcon *)h->obj;
- if (gc->toolbar) hwin = gc->toolbar->fwin->border->win; //double check for xdnd...
+ if (gc->toolbar) hwin = e_client_util_pwin_get(gc->toolbar->fwin->client); //double check for xdnd...
else
{
if (xdnd) hwin = e_gadcon_xdnd_window_get(gc);
@@ -701,9 +695,8 @@ _e_drag_win_get(const E_Drop_Handler *h, int xdnd)
hwin = ((E_Win *)(h->obj))->evas_win;
break;
- case E_BORDER_TYPE:
+ case E_CLIENT_TYPE:
case E_ZONE_TYPE:
- case E_POPUP_TYPE:
hwin = e_comp_get(h->obj)->ee_win;
break;
@@ -812,18 +805,14 @@ _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action)
// double t1 = ecore_time_get(); ////
if (_drag_current && !_xdnd)
- {
- Ecore_X_Window ignore[1];
- ignore[0] = _drag_win;
- win = e_comp_top_window_at_xy_get(e_comp_get(_drag_current), x, y, 1, ignore, 1);
- }
+ win = e_comp_top_window_at_xy_get(e_comp_get(_drag_current), x, y);
else
win = root;
if (_drag_current)
{
- if (_drag_current->visible) e_popup_show(_drag_current->pop);
- else e_popup_hide(_drag_current->pop);
+ if (_drag_current->visible) evas_object_show(_drag_current->comp_object);
+ else evas_object_hide(_drag_current->comp_object);
_e_drag_move(_drag_current, x, y);
}
EINA_LIST_FOREACH(_active_handlers, l, h)
@@ -937,16 +926,14 @@ _e_drag_end(int x, int y)
Ecore_X_Window win;
E_Drop_Handler *h;
int dropped;
- Ecore_X_Window ignore[1];
if (!_drag_current) return;
- ignore[0] = _drag_win;
- win = e_comp_top_window_at_xy_get(e_comp_get(_drag_current), x, y, 1, ignore, 1);
- zone = e_container_zone_at_point_get(_drag_current->container, x, y);
+ win = e_comp_top_window_at_xy_get(e_comp_get(_drag_current), x, y);
+ zone = e_comp_zone_xy_get(_drag_current->comp, x, y);
/* Pass -1, -1, so that it is possible to drop at the edge. */
if (zone) e_zone_flip_coords_handle(zone, -1, -1);
- e_popup_hide(_drag_current->pop);
+ evas_object_hide(_drag_current->comp_object);
e_grabinput_release(_drag_win, _drag_win);
while (_drag_current->type == E_DRAG_XDND)
@@ -1105,8 +1092,9 @@ _e_drag_free(E_Drag *drag)
_drag_list = eina_list_remove(_drag_list, drag);
- e_object_unref(E_OBJECT(drag->container));
- E_FREE_FUNC(drag->pop, e_object_del);
+ e_object_unref(E_OBJECT(drag->comp));
+ evas_object_hide(drag->comp_object);
+ E_FREE_FUNC(drag->comp_object, evas_object_del);
for (i = 0; i < drag->num_types; i++)
eina_stringshare_del(drag->types[i]);
free(drag);
@@ -1176,12 +1164,10 @@ _e_dnd_cb_event_dnd_enter(void *data __UNUSED__, int type __UNUSED__, void *even
{
Ecore_X_Event_Xdnd_Enter *ev = event;
E_Drop_Handler *h;
- const char *id;
const Eina_List *l;
int i;
- id = e_util_winid_str_get(ev->win);
- if (!eina_hash_find(_drop_win_hash, id)) return ECORE_CALLBACK_PASS_ON;
+ if (!eina_hash_find(_drop_win_hash, &ev->win)) return ECORE_CALLBACK_PASS_ON;
EINA_LIST_FREE(_active_handlers, h)
{
@@ -1214,11 +1200,9 @@ _e_dnd_cb_event_dnd_leave(void *data __UNUSED__, int type __UNUSED__, void *even
{
Ecore_X_Event_Xdnd_Leave *ev = event;
E_Event_Dnd_Leave leave_ev;
- const char *id;
const Eina_List *l;
- id = e_util_winid_str_get(ev->win);
- if (!eina_hash_find(_drop_win_hash, id)) return ECORE_CALLBACK_PASS_ON;
+ if (!eina_hash_find(_drop_win_hash, &ev->win)) return ECORE_CALLBACK_PASS_ON;
leave_ev.x = 0;
leave_ev.y = 0;
@@ -1285,12 +1269,10 @@ _e_dnd_cb_event_dnd_position(void *data __UNUSED__, int type __UNUSED__, void *e
{
Ecore_X_Event_Xdnd_Position *ev = event;
Ecore_X_Rectangle rect;
- const char *id;
int responsive;
// double t1 = ecore_time_get(); ////
- id = e_util_winid_str_get(ev->win);
- if (!eina_hash_find(_drop_win_hash, id))
+ if (!eina_hash_find(_drop_win_hash, &ev->win))
{
// double t2 = ecore_time_get() - t1; ////
// printf("DND POS EV 1 %3.7f\n", t2); ////
@@ -1351,10 +1333,8 @@ static Eina_Bool
_e_dnd_cb_event_dnd_drop(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_X_Event_Xdnd_Drop *ev = event;
- const char *id;
- id = e_util_winid_str_get(ev->win);
- if (!eina_hash_find(_drop_win_hash, id)) return ECORE_CALLBACK_PASS_ON;
+ if (!eina_hash_find(_drop_win_hash, &ev->win)) return ECORE_CALLBACK_PASS_ON;
if (_xdnd)
{
@@ -1389,11 +1369,9 @@ static Eina_Bool
_e_dnd_cb_event_dnd_selection(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_X_Event_Selection_Notify *ev = event;
- const char *id;
int i;
- id = e_util_winid_str_get(ev->win);
- if (!eina_hash_find(_drop_win_hash, id)) return ECORE_CALLBACK_PASS_ON;
+ if (!eina_hash_find(_drop_win_hash, &ev->win)) return ECORE_CALLBACK_PASS_ON;
if (ev->selection != ECORE_X_SELECTION_XDND) return ECORE_CALLBACK_PASS_ON;
if (!_xdnd)
diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h
index 37614b6ac0..33f2613c15 100644
--- a/src/bin/e_dnd.h
+++ b/src/bin/e_dnd.h
@@ -38,9 +38,9 @@ struct _E_Drag
void (*key_up)(E_Drag *drag, Ecore_Event_Key *e);
} cb;
- E_Container *container;
+ E_Comp *comp;
Evas *evas;
- E_Popup *pop;
+ Evas_Object *comp_object;
Evas_Object *object;
int x, y, w, h;
@@ -113,7 +113,7 @@ EINTERN int e_dnd_shutdown(void);
EAPI int e_dnd_active(void);
/* x and y are the top left coords of the object that is to be dragged */
-EAPI E_Drag *e_drag_new(E_Container *container, int x, int y,
+EAPI E_Drag *e_drag_new(E_Comp *comp, int x, int y,
const char **types, unsigned int num_types,
void *data, int size,
void *(*convert_cb)(E_Drag * drag, const char *type),
diff --git a/src/bin/e_dpms.c b/src/bin/e_dpms.c
index 2544b75b29..866c903145 100644
--- a/src/bin/e_dpms.c
+++ b/src/bin/e_dpms.c
@@ -113,22 +113,22 @@ e_dpms_init(void)
(E_EVENT_CONFIG_MODE_CHANGED, _e_dpms_handler_config_mode_cb, NULL);
_e_dpms_handler_border_fullscreen = ecore_event_handler_add
- (E_EVENT_BORDER_FULLSCREEN, _e_dpms_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_FULLSCREEN, _e_dpms_handler_border_fullscreen_check_cb, NULL);
_e_dpms_handler_border_unfullscreen = ecore_event_handler_add
- (E_EVENT_BORDER_UNFULLSCREEN, _e_dpms_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_UNFULLSCREEN, _e_dpms_handler_border_fullscreen_check_cb, NULL);
_e_dpms_handler_border_remove = ecore_event_handler_add
- (E_EVENT_BORDER_REMOVE, _e_dpms_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_REMOVE, _e_dpms_handler_border_fullscreen_check_cb, NULL);
_e_dpms_handler_border_iconify = ecore_event_handler_add
- (E_EVENT_BORDER_ICONIFY, _e_dpms_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_ICONIFY, _e_dpms_handler_border_fullscreen_check_cb, NULL);
_e_dpms_handler_border_uniconify = ecore_event_handler_add
- (E_EVENT_BORDER_UNICONIFY, _e_dpms_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_UNICONIFY, _e_dpms_handler_border_fullscreen_check_cb, NULL);
_e_dpms_handler_border_desk_set = ecore_event_handler_add
- (E_EVENT_BORDER_DESK_SET, _e_dpms_handler_border_desk_set_cb, NULL);
+ (E_EVENT_CLIENT_DESK_SET, _e_dpms_handler_border_desk_set_cb, NULL);
_e_dpms_handler_desk_show = ecore_event_handler_add
(E_EVENT_DESK_SHOW, _e_dpms_handler_desk_show_cb, NULL);
diff --git a/src/bin/e_entry.c b/src/bin/e_entry.c
index 83bdf35f09..a5115cc762 100644
--- a/src/bin/e_entry.c
+++ b/src/bin/e_entry.c
@@ -454,8 +454,6 @@ _e_entry_mouse_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o
if (event->button == 3)
{
E_Menu_Item *mi;
- E_Manager *man;
- E_Container *con;
Evas_Coord x, y;
int s_enabled, s_selecting, s_passwd, s_empty;
@@ -466,9 +464,7 @@ _e_entry_mouse_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o
if (!s_selecting && !s_enabled && s_empty) return;
- man = e_manager_current_get();
- con = e_container_current_get(man);
- ecore_x_pointer_xy_get(con->win, &x, &y);
+ ecore_evas_pointer_xy_get(e_util_comp_current_get()->ee, &x, &y);
/* Popup a menu */
sd->popup = e_menu_new();
@@ -526,7 +522,7 @@ _e_entry_mouse_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o
e_menu_item_callback_set(mi, _e_entry_cb_select_all, sd);
}
- e_menu_activate_mouse(sd->popup, e_util_zone_current_get(man),
+ e_menu_activate_mouse(sd->popup, e_util_zone_current_get(e_manager_current_get()),
x, y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, event->timestamp);
}
@@ -574,9 +570,9 @@ static void
_e_entry_x_selection_update(Evas_Object *entry)
{
E_Entry_Smart_Data *sd;
- Ecore_X_Window xwin;
+ Ecore_Window xwin;
E_Win *win;
- E_Container *con;
+ E_Comp *c;
const char *text;
if ((!entry) || (!(sd = evas_object_smart_data_get(entry))))
@@ -586,9 +582,9 @@ _e_entry_x_selection_update(Evas_Object *entry)
xwin = e_grabinput_key_win_get();
if (!xwin)
{
- con = e_container_evas_object_container_get(sd->entry_object);
- if (!con) return;
- xwin = ecore_evas_window_get(con->bg_ecore_evas);
+ c = e_comp_util_evas_object_comp_get(sd->entry_object);
+ if (!c) return;
+ xwin = c->ee_win;
}
}
else
@@ -608,18 +604,18 @@ _entry_paste_request_signal_cb(void *data,
const char *emission,
const char *source EINA_UNUSED)
{
- Ecore_X_Window xwin;
+ Ecore_Window xwin;
E_Win *win;
- E_Container *con;
+ E_Comp *c;
if (!(win = e_win_evas_object_win_get(data)))
{
xwin = e_grabinput_key_win_get();
if (!xwin)
{
- con = e_container_evas_object_container_get(data);
- if (!con) return;
- xwin = ecore_evas_window_get(con->bg_ecore_evas);
+ c = e_comp_util_evas_object_comp_get(data);
+ if (!c) return;
+ xwin = c->ee_win;
}
}
else
@@ -971,11 +967,11 @@ _e_entry_cb_copy(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
xwin = e_grabinput_key_win_get();
if (!xwin)
{
- E_Container *con;
+ E_Comp *c;
- con = e_container_evas_object_container_get(sd->entry_object);
- if (!con) return;
- xwin = ecore_evas_window_get(con->bg_ecore_evas);
+ c = e_comp_util_evas_object_comp_get(sd->entry_object);
+ if (!c) return;
+ xwin = c->ee_win;
}
}
ecore_x_selection_clipboard_set(xwin, range, strlen(range) + 1);
@@ -1000,11 +996,11 @@ _e_entry_cb_paste(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
xwin = e_grabinput_key_win_get();
if (!xwin)
{
- E_Container *con;
+ E_Comp *c;
- con = e_container_evas_object_container_get(sd->entry_object);
- if (!con) return;
- xwin = ecore_evas_window_get(con->bg_ecore_evas);
+ c = e_comp_util_evas_object_comp_get(sd->entry_object);
+ if (!c) return;
+ xwin = c->ee_win;
}
}
ecore_x_selection_clipboard_request(xwin, ECORE_X_SELECTION_TARGET_UTF8_STRING);
diff --git a/src/bin/e_entry_dialog.c b/src/bin/e_entry_dialog.c
index d0236ce132..5944f42853 100644
--- a/src/bin/e_entry_dialog.c
+++ b/src/bin/e_entry_dialog.c
@@ -30,7 +30,7 @@ e_entry_dialog_show(const char *title, const char *icon, const char *text,
if (initial_text)
ed->text = strdup(initial_text);
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_entry_dialog");
+ dia = e_dialog_new(NULL, "E", "_entry_dialog");
if (!dia)
{
e_object_del(E_OBJECT(ed));
@@ -76,6 +76,7 @@ _e_entry_dia_del(void *data)
{
E_Dialog *dia = data;
+ e_win_delete_callback_set(dia->win, _e_entry_dialog_delete);
e_object_del(dia->data);
}
diff --git a/src/bin/e_exec.c b/src/bin/e_exec.c
index eb0a5d1806..f3c9a5a394 100644
--- a/src/bin/e_exec.c
+++ b/src/bin/e_exec.c
@@ -90,7 +90,7 @@ e_exec_init(void)
ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _e_exec_cb_exit, NULL);
#if 0
_e_exec_border_add_handler =
- ecore_event_handler_add(E_EVENT_BORDER_ADD, _e_exec_cb_event_border_add, NULL);
+ ecore_event_handler_add(E_EVENT_CLIENT_ADD, _e_exec_cb_event_border_add, NULL);
#endif
E_EVENT_EXEC_NEW = ecore_event_type_new();
@@ -159,20 +159,22 @@ e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec,
if (dosingle)
{
- Eina_List *l;
- E_Border *bd;
-
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- {
- if (bd && bd->desktop == desktop)
- {
- if (!bd->focused)
- e_border_activate(bd, EINA_TRUE);
- else
- e_border_raise(bd);
- return NULL;
- }
- }
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Comp *c;
+
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (ec && (ec->desktop == desktop))
+ {
+ if (!ec->focused)
+ e_client_activate(ec, EINA_TRUE);
+ else
+ evas_object_raise(ec->frame);
+ return NULL;
+ }
+ }
}
}
}
@@ -222,7 +224,7 @@ e_exec_phony_del(E_Exec_Instance *inst)
}
EAPI E_Exec_Instance *
-e_exec_phony(E_Border *bd)
+e_exec_phony(E_Client *ec)
{
E_Exec_Instance *inst;
Eina_List *l, *lnew;
@@ -230,23 +232,23 @@ e_exec_phony(E_Border *bd)
inst = E_NEW(E_Exec_Instance, 1);
inst->ref = 1;
inst->phony = 1;
- inst->desktop = bd->desktop;
- inst->startup_id = bd->client.netwm.startup_id;
- if (bd->desktop)
+ inst->desktop = ec->desktop;
+ inst->startup_id = ec->netwm.startup_id;
+ if (ec->desktop)
{
- efreet_desktop_ref(bd->desktop);
- inst->key = eina_stringshare_add(bd->desktop->orig_path ?: bd->desktop->name);
+ efreet_desktop_ref(ec->desktop);
+ inst->key = eina_stringshare_add(ec->desktop->orig_path ?: ec->desktop->name);
}
- else if (bd->client.icccm.command.argc)
+ else if (ec->icccm.command.argc)
{
Eina_Strbuf *buf;
int x;
buf = eina_strbuf_new();
- for (x = 0; x < bd->client.icccm.command.argc; x++)
+ for (x = 0; x < ec->icccm.command.argc; x++)
{
- eina_strbuf_append(buf, bd->client.icccm.command.argv[x]);
- if (x + 1 < bd->client.icccm.command.argc)
+ eina_strbuf_append(buf, ec->icccm.command.argv[x]);
+ if (x + 1 < ec->icccm.command.argc)
eina_strbuf_append_char(buf, ' ');
}
inst->key = eina_stringshare_add(eina_strbuf_string_get(buf));
@@ -258,13 +260,13 @@ e_exec_phony(E_Border *bd)
return NULL;
}
inst->used = 1;
- bd->exe_inst = inst;
- inst->borders = eina_list_append(inst->borders, bd);
- if (bd->zone) inst->screen = bd->zone->num;
- if (bd->desk)
+ ec->exe_inst = inst;
+ inst->clients = eina_list_append(inst->clients, ec);
+ if (ec->zone) inst->screen = ec->zone->num;
+ if (ec->desk)
{
- inst->desk_x = bd->desk->x;
- inst->desk_y = bd->desk->y;
+ inst->desk_x = ec->desk->x;
+ inst->desk_y = ec->desk->y;
}
l = eina_hash_find(e_exec_instances, inst->key);
lnew = eina_list_append(l, inst);
@@ -344,10 +346,10 @@ e_exec_instance_found(E_Exec_Instance *inst)
}
EAPI void
-e_exec_instance_client_add(E_Exec_Instance *inst, E_Border *bd)
+e_exec_instance_client_add(E_Exec_Instance *inst, E_Client *ec)
{
- inst->borders = eina_list_append(inst->borders, bd);
- bd->exe_inst = inst;
+ inst->clients = eina_list_append(inst->clients, ec);
+ ec->exe_inst = inst;
inst->ref++;
ecore_event_add(E_EVENT_EXEC_NEW_CLIENT, inst, _e_exec_cb_exec_new_free, inst);
}
@@ -422,7 +424,7 @@ _e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining)
int head_length;
int penv_display_length;
- head = launch->zone->container->manager->num;
+ head = launch->zone->comp->num;
penv_display_length = strlen(penv_display);
/* Check for insane length for DISPLAY env */
@@ -629,7 +631,7 @@ static void
_e_exec_instance_free(E_Exec_Instance *inst)
{
Eina_List *instances;
- E_Border *bd;
+ E_Client *ec;
if (inst->ref) return;
E_FREE_LIST(inst->watchers, free);
@@ -656,8 +658,8 @@ _e_exec_instance_free(E_Exec_Instance *inst)
e_exec_start_pending = eina_list_remove(e_exec_start_pending,
inst->desktop);
if (inst->expire_timer) ecore_timer_del(inst->expire_timer);
- EINA_LIST_FREE(inst->borders, bd)
- bd->exe_inst = NULL;
+ EINA_LIST_FREE(inst->clients, ec)
+ ec->exe_inst = NULL;
if (inst->desktop) efreet_desktop_free(inst->desktop);
if (inst->exe) ecore_exe_data_set(inst->exe, NULL);
free(inst);
@@ -716,7 +718,7 @@ _e_exec_cb_exit(void *data __UNUSED__, int type __UNUSED__, void *event)
{
E_Dialog *dia;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
+ dia = e_dialog_new(NULL,
"E", "_e_exec_run_error_dialog");
if (dia)
{
@@ -810,7 +812,6 @@ _e_exec_error_dialog(Efreet_Desktop *desktop, const char *exec, Ecore_Exe_Event_
{
E_Config_Dialog_View *v;
E_Config_Dialog_Data *cfdata;
- E_Container *con;
v = E_NEW(E_Config_Dialog_View, 1);
if (!v) return;
@@ -832,9 +833,8 @@ _e_exec_error_dialog(Efreet_Desktop *desktop, const char *exec, Ecore_Exe_Event_
v->basic.create_widgets = _basic_create_widgets;
v->advanced.create_widgets = _advanced_create_widgets;
- con = e_container_current_get(e_manager_current_get());
/* Create The Dialog */
- e_config_dialog_new(con, _("Application Execution Error"),
+ e_config_dialog_new(NULL, _("Application Execution Error"),
"E", "_e_exec_error_exit_dialog",
NULL, 0, v, cfdata);
}
diff --git a/src/bin/e_exec.h b/src/bin/e_exec.h
index 86090b80bb..c76c8fff8e 100644
--- a/src/bin/e_exec.h
+++ b/src/bin/e_exec.h
@@ -9,7 +9,7 @@ typedef struct _E_Exec_Instance E_Exec_Instance;
struct _E_Exec_Instance
{
Efreet_Desktop *desktop;
- Eina_List *borders;
+ Eina_List *clients;
const char *key;
Ecore_Exe *exe;
int startup_id;
@@ -35,7 +35,7 @@ EINTERN int e_exec_init(void);
EINTERN int e_exec_shutdown(void);
EAPI void e_exec_executor_set(E_Exec_Instance *(*func) (void *data, E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method), const void *data);
EAPI E_Exec_Instance *e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method);
-EAPI E_Exec_Instance *e_exec_phony(E_Border *bd);
+EAPI E_Exec_Instance *e_exec_phony(E_Client *ec);
EAPI void e_exec_phony_del(E_Exec_Instance *inst);
EAPI E_Exec_Instance *e_exec_startup_id_pid_instance_find(int id, pid_t pid);
EAPI Efreet_Desktop *e_exec_startup_id_pid_find(int startup_id, pid_t pid);
@@ -46,7 +46,7 @@ EAPI void e_exec_instance_watcher_del(E_Exec_Instance *inst, void (*func) (void
EAPI const Eina_List *e_exec_desktop_instances_find(const Efreet_Desktop *desktop);
EAPI const Eina_Hash *e_exec_instances_get(void);
-EAPI void e_exec_instance_client_add(E_Exec_Instance *inst, E_Border *bd);
+EAPI void e_exec_instance_client_add(E_Exec_Instance *inst, E_Client *ec);
/* sends E_Exec_Instance */
EAPI extern int E_EVENT_EXEC_NEW;
diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c
index fb662d5a24..67fcd32e89 100644
--- a/src/bin/e_fm.c
+++ b/src/bin/e_fm.c
@@ -7529,41 +7529,15 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU
(e_config->drag_resist * e_config->drag_resist))
{
E_Drag *d;
- Evas_Object *o = NULL, *o2, *layout = NULL;
+ Evas_Object *o = NULL, *o2 = NULL, *layout = NULL;
const char *drag_types[] = { "text/uri-list" }, *real_path;
char buf[PATH_MAX + 8], *p, *sel = NULL;
- E_Container *con = NULL;
+ E_Comp *c = NULL;
Eina_Binbuf *sbuf;
Eina_List *sl, *icons = NULL;
size_t sel_length = 0, p_offset, p_length;
- switch (ic->sd->eobj->type)
- {
- case E_GADCON_TYPE:
- con = ((E_Gadcon *)(ic->sd->eobj))->zone->container;
- break;
-
- case E_WIN_TYPE:
- con = ((E_Win *)(ic->sd->eobj))->container;
- break;
-
- case E_ZONE_TYPE:
- con = ((E_Zone *)(ic->sd->eobj))->container;
- break;
-
- case E_BORDER_TYPE:
- con = ((E_Border *)(ic->sd->eobj))->zone->container;
- break;
-
- case E_POPUP_TYPE:
- con = ((E_Popup *)(ic->sd->eobj))->zone->container;
- break;
-
- /* FIXME: add more types as needed */
- default:
- break;
- }
- if (!con) return;
+ c = e_comp_get(ic->sd->eobj);
ic->sd->drag = EINA_TRUE;
ic->drag.start = EINA_FALSE;
real_path = e_fm2_real_path_get(ic->sd->obj);
@@ -7662,7 +7636,7 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU
sel = (char*)eina_binbuf_string_steal(sbuf);
eina_binbuf_free(sbuf);
- d = e_drag_new(con, 0, 0, drag_types, 1,
+ d = e_drag_new(c, 0, 0, drag_types, 1,
sel, sel_length, NULL, _e_fm2_cb_drag_finished);
if (layout)
d->x = ic->sd->x, d->y = ic->sd->y;
@@ -7671,14 +7645,18 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU
e_drop_handler_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE);
e_drag_object_set(d, layout ?: o);
- d->pop->objects = icons;
if (layout)
{
e_layout_thaw(layout);
e_drag_resize(d, ic->sd->w, ic->sd->h);
+ EINA_LIST_FREE(icons, o)
+ e_comp_object_util_del_list_append(d->comp_object, o);
}
else
- e_drag_resize(d, ic->w, ic->h);
+ {
+ e_drag_resize(d, ic->w, ic->h);
+ e_comp_object_util_del_list_append(d->comp_object, o2);
+ }
evas_object_smart_callback_call(ic->sd->obj, "dnd_begin", &ic->info);
e_drag_key_down_cb_set(d, _e_fm_drag_key_down_cb);
@@ -8834,8 +8812,6 @@ _e_fm2_menu(Evas_Object *obj, unsigned int timestamp)
E_Fm2_Smart_Data *sd;
E_Menu *mn, *sub;
E_Menu_Item *mi;
- E_Manager *man;
- E_Container *con;
E_Zone *zone;
int x, y;
@@ -8950,20 +8926,8 @@ _e_fm2_menu(Evas_Object *obj, unsigned int timestamp)
sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, NULL);
}
- man = e_manager_current_get();
- if (!man)
- {
- e_object_del(E_OBJECT(mn));
- return;
- }
- con = e_container_current_get(man);
- if (!con)
- {
- e_object_del(E_OBJECT(mn));
- return;
- }
- ecore_x_pointer_xy_get(con->win, &x, &y);
- zone = e_util_zone_current_get(man);
+ ecore_evas_pointer_xy_get(e_util_comp_current_get()->ee, &x, &y);
+ zone = e_zone_current_get(e_util_comp_current_get());
if (!zone)
{
e_object_del(E_OBJECT(mn));
@@ -8991,8 +8955,6 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp)
E_Fm2_Smart_Data *sd;
E_Menu *mn, *sub;
E_Menu_Item *mi;
- E_Manager *man;
- E_Container *con;
E_Zone *zone;
Eina_List *sel;
Eina_List *l = NULL;
@@ -9297,20 +9259,8 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp)
sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, &(ic->info));
}
- man = e_manager_current_get();
- if (!man)
- {
- e_object_del(E_OBJECT(mn));
- return;
- }
- con = e_container_current_get(man);
- if (!con)
- {
- e_object_del(E_OBJECT(mn));
- return;
- }
- ecore_x_pointer_xy_get(con->win, &x, &y);
- zone = e_util_zone_current_get(man);
+ ecore_evas_pointer_xy_get(e_util_comp_current_get()->ee, &x, &y);
+ zone = e_zone_current_get(e_util_comp_current_get());
if (!zone)
{
e_object_del(E_OBJECT(mn));
@@ -10335,9 +10285,7 @@ static Evas_Object *
_e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic)
{
Evas *e;
- E_Container *con;
- E_Manager *man;
- Eina_List *l, *ll;
+ E_Comp *c;
if (ic->sd->iop_icon)
_e_fm2_icon_entry_widget_accept(ic->sd->iop_icon);
@@ -10346,19 +10294,13 @@ _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic)
return NULL;
e = evas_object_evas_get(ic->obj);
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- EINA_LIST_FOREACH(man->containers, ll, con)
- {
- if (con->bg_evas != e) continue;
- ic->keygrab = ecore_evas_window_get(con->bg_ecore_evas);
- break;
- }
+ c = e_comp_evas_find(e);
ic->entry_widget = e_widget_entry_add(e, NULL, NULL, NULL, NULL);
evas_object_event_callback_add(ic->entry_widget, EVAS_CALLBACK_KEY_DOWN,
_e_fm2_icon_entry_widget_cb_key_down, ic);
evas_event_feed_mouse_out(evas_object_evas_get(ic->obj), ecore_x_current_time_get(), NULL);
- if (ic->keygrab)
- e_grabinput_get(0, 0, ic->keygrab);
+ if (c)
+ e_comp_grab_input(c, 0, 1);
edje_object_part_swallow(ic->obj, "e.swallow.entry", ic->entry_widget);
evas_object_show(ic->entry_widget);
e_widget_entry_text_set(ic->entry_widget, ic->info.file);
@@ -10366,7 +10308,7 @@ _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic)
e_widget_entry_select_all(ic->entry_widget);
ic->sd->iop_icon = ic;
ic->sd->typebuf.disabled = EINA_TRUE;
- evas_event_feed_mouse_in(evas_object_evas_get(ic->obj), ecore_x_current_time_get(), NULL);
+ evas_event_feed_mouse_in(e, ecore_x_current_time_get(), NULL);
return ic->entry_widget;
}
@@ -10859,8 +10801,6 @@ _e_fm2_file_application_properties(void *data, E_Menu *m __UNUSED__, E_Menu_Item
{
Efreet_Desktop *desktop;
E_Fm2_Icon *ic;
- E_Manager *man;
- E_Container *con;
char buf[PATH_MAX];
ic = data;
@@ -10868,31 +10808,19 @@ _e_fm2_file_application_properties(void *data, E_Menu *m __UNUSED__, E_Menu_Item
return;
desktop = efreet_desktop_get(buf);
- man = e_manager_current_get();
- if (!man) return;
- con = e_container_current_get(man);
- if (!con) return;
-
- e_desktop_edit(con, desktop);
+ e_desktop_edit(NULL, desktop);
}
static void
_e_fm2_file_properties(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
E_Fm2_Icon *ic;
- E_Manager *man;
- E_Container *con;
ic = data;
if ((ic->entry_dialog) || (ic->entry_widget)) return;
- man = e_manager_current_get();
- if (!man) return;
- con = e_container_current_get(man);
- if (!con) return;
-
if (ic->prop_dialog) e_object_del(E_OBJECT(ic->prop_dialog));
- ic->prop_dialog = e_fm_prop_file(con, ic);
+ ic->prop_dialog = e_fm_prop_file(NULL, ic);
E_OBJECT(ic->prop_dialog)->data = ic;
e_object_del_attach_func_set(E_OBJECT(ic->prop_dialog), _e_fm2_file_properties_delete_cb);
}
@@ -11676,8 +11604,6 @@ e_fm2_drop_menu(Evas_Object *obj, char *args)
{
E_Menu *menu;
E_Menu_Item *item;
- E_Manager *man;
- E_Container *con;
E_Zone *zone;
int x, y;
@@ -11722,12 +11648,8 @@ e_fm2_drop_menu(Evas_Object *obj, char *args)
"e/fileman/default/button/abort"),
"e/fileman/default/button/abort");
- man = e_manager_current_get();
- if (!man) goto error;
- con = e_container_current_get(man);
- if (!con) goto error;
- ecore_x_pointer_xy_get(con->win, &x, &y);
- zone = e_util_zone_current_get(man);
+ ecore_evas_pointer_xy_get(e_util_comp_current_get()->ee, &x, &y);
+ zone = e_zone_current_get(e_util_comp_current_get());
if (!zone) goto error;
e_menu_activate_mouse(menu, zone, x, y, 1, 1, E_MENU_POP_DIRECTION_DOWN, 0);
return;
diff --git a/src/bin/e_fm_prop.c b/src/bin/e_fm_prop.c
index 10abca6a7d..853194d9d4 100644
--- a/src/bin/e_fm_prop.c
+++ b/src/bin/e_fm_prop.c
@@ -94,7 +94,7 @@ struct _E_Config_Dialog_Data
/* a nice easy setup function that does the dirty work */
EAPI E_Config_Dialog *
-e_fm_prop_file(E_Container *con, E_Fm2_Icon *ic)
+e_fm_prop_file(E_Comp *c, E_Fm2_Icon *ic)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
@@ -111,7 +111,7 @@ e_fm_prop_file(E_Container *con, E_Fm2_Icon *ic)
v->advanced.create_widgets = _advanced_create_widgets;
#endif
/* create config dialog for NULL object/data */
- cfd = e_config_dialog_new(con,
+ cfd = e_config_dialog_new(c,
_("File Properties"),
"E", "_fm_prop",
"enlightenment/file_properties", 0, v, ic);
@@ -605,7 +605,7 @@ _cb_icon_sel(void *data, void *data2)
cfd = data2;
if (!cfd) return;
- dia = e_dialog_new(cfd->con, "E", "_fm2_file_properties_icon_select_dialog");
+ dia = e_dialog_new(cfd->comp, "E", "_fm2_file_properties_icon_select_dialog");
if (!dia) return;
// if (cfdata->type == EDJ)
// e_dialog_title_set(dia, _("Select an Edj File"));
diff --git a/src/bin/e_fm_prop.h b/src/bin/e_fm_prop.h
index 275bfc860e..e2d25caece 100644
--- a/src/bin/e_fm_prop.h
+++ b/src/bin/e_fm_prop.h
@@ -3,7 +3,7 @@
#ifndef E_FM_PROP_H
#define E_FM_PROP_H
-EAPI E_Config_Dialog *e_fm_prop_file(E_Container *con, E_Fm2_Icon *ic);
+EAPI E_Config_Dialog *e_fm_prop_file(E_Comp *c, E_Fm2_Icon *ic);
#endif
#endif
diff --git a/src/bin/e_focus.c b/src/bin/e_focus.c
index 28b70952be..d5ab2d949c 100644
--- a/src/bin/e_focus.c
+++ b/src/bin/e_focus.c
@@ -6,173 +6,110 @@ static Eina_Bool _e_focus_raise_timer(void *data);
/* local subsystem globals */
/* externally accessible functions */
-EINTERN int
-e_focus_init(void)
-{
- return 1;
-}
-
-EINTERN int
-e_focus_shutdown(void)
-{
- return 1;
-}
-
-EAPI void
-e_focus_idler_before(void)
-{
- return;
-}
-
EAPI void
-e_focus_event_mouse_in(E_Border *bd)
+e_focus_event_mouse_in(E_Client *ec)
{
if ((e_config->focus_policy == E_FOCUS_MOUSE) ||
(e_config->focus_policy == E_FOCUS_SLOPPY))
{
- if (bd != e_border_focused_get())
- e_border_focus_set(bd, 1, 1);
+ evas_object_focus_set(ec->frame, 1);
}
- if (bd->raise_timer) ecore_timer_del(bd->raise_timer);
- bd->raise_timer = NULL;
+ E_FREE_FUNC(ec->raise_timer, ecore_timer_del);
if (e_config->use_auto_raise)
{
if (e_config->auto_raise_delay == 0.0)
{
- if (!bd->lock_user_stacking)
- e_border_raise(bd);
+ if (!ec->lock_user_stacking)
+ evas_object_raise(ec->frame);
}
else
- bd->raise_timer = ecore_timer_add(e_config->auto_raise_delay, _e_focus_raise_timer, bd);
+ ec->raise_timer = ecore_timer_add(e_config->auto_raise_delay, _e_focus_raise_timer, ec);
}
}
EAPI void
-e_focus_event_mouse_out(E_Border *bd)
+e_focus_event_mouse_out(E_Client *ec)
{
if (e_config->focus_policy == E_FOCUS_MOUSE)
{
- if (!bd->lock_focus_in)
+ if (!ec->lock_focus_in)
{
- if (bd->focused)
- e_border_focus_set(bd, 0, 1);
+ if (ec->focused)
+ evas_object_focus_set(ec->frame, 0);
}
}
- E_FREE_FUNC(bd->raise_timer, ecore_timer_del);
+ E_FREE_FUNC(ec->raise_timer, ecore_timer_del);
}
EAPI void
-e_focus_event_mouse_down(E_Border *bd)
+e_focus_event_mouse_down(E_Client *ec)
{
- if (!bd->focused)
- {
- if (e_border_focus_policy_click(bd))
- e_border_focus_set(bd, 1, 1);
- else if (e_config->always_click_to_focus)
- e_border_focus_set(bd, 1, 1);
- }
+ if (e_client_focus_policy_click(ec) ||
+ e_config->always_click_to_focus)
+ evas_object_focus_set(ec->frame, 1);
if (e_config->always_click_to_raise)
{
- if (!bd->lock_user_stacking)
- e_border_raise(bd);
+ if (!ec->lock_user_stacking)
+ evas_object_raise(ec->frame);
}
}
EAPI void
-e_focus_event_mouse_up(E_Border *bd __UNUSED__)
+e_focus_event_mouse_up(E_Client *ec __UNUSED__)
{
}
EAPI void
-e_focus_event_focus_in(E_Border *bd)
+e_focus_event_focus_in(E_Client *ec)
{
- if ((e_border_focus_policy_click(bd)) &&
+ if ((e_client_focus_policy_click(ec)) &&
(!e_config->always_click_to_raise) &&
(!e_config->always_click_to_focus))
{
- if (!bd->button_grabbed) return;
- e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- ecore_x_window_button_ungrab(bd->win, 1, 0, 1);
- ecore_x_window_button_ungrab(bd->win, 2, 0, 1);
- ecore_x_window_button_ungrab(bd->win, 3, 0, 1);
- e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
- bd->button_grabbed = 0;
+ if (!ec->button_grabbed) return;
+ e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ ecore_x_window_button_ungrab(e_client_util_pwin_get(ec), 1, 0, 1);
+ ecore_x_window_button_ungrab(e_client_util_pwin_get(ec), 2, 0, 1);
+ ecore_x_window_button_ungrab(e_client_util_pwin_get(ec), 3, 0, 1);
+ e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec));
+ ec->button_grabbed = 0;
}
}
EAPI void
-e_focus_event_focus_out(E_Border *bd)
+e_focus_event_focus_out(E_Client *ec)
{
- if ((e_border_focus_policy_click(bd)) &&
+ if ((e_client_focus_policy_click(ec)) &&
(!e_config->always_click_to_raise) &&
(!e_config->always_click_to_focus))
{
- if (bd->button_grabbed) return;
- ecore_x_window_button_grab(bd->win, 1,
+ if (ec->button_grabbed) return;
+ ecore_x_window_button_grab(e_client_util_pwin_get(ec), 1,
ECORE_X_EVENT_MASK_MOUSE_DOWN |
ECORE_X_EVENT_MASK_MOUSE_UP |
ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
- ecore_x_window_button_grab(bd->win, 2,
+ ecore_x_window_button_grab(e_client_util_pwin_get(ec), 2,
ECORE_X_EVENT_MASK_MOUSE_DOWN |
ECORE_X_EVENT_MASK_MOUSE_UP |
ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
- ecore_x_window_button_grab(bd->win, 3,
+ ecore_x_window_button_grab(e_client_util_pwin_get(ec), 3,
ECORE_X_EVENT_MASK_MOUSE_DOWN |
ECORE_X_EVENT_MASK_MOUSE_UP |
ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
- bd->button_grabbed = 1;
+ ec->button_grabbed = 1;
}
}
-EAPI void
-e_focus_setup(E_Border *bd)
-{
- if ((e_border_focus_policy_click(bd)) ||
- (e_config->always_click_to_raise) ||
- (e_config->always_click_to_focus))
- {
- if (bd->button_grabbed) return;
- ecore_x_window_button_grab(bd->win, 1,
- ECORE_X_EVENT_MASK_MOUSE_DOWN |
- ECORE_X_EVENT_MASK_MOUSE_UP |
- ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
- ecore_x_window_button_grab(bd->win, 2,
- ECORE_X_EVENT_MASK_MOUSE_DOWN |
- ECORE_X_EVENT_MASK_MOUSE_UP |
- ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
- ecore_x_window_button_grab(bd->win, 3,
- ECORE_X_EVENT_MASK_MOUSE_DOWN |
- ECORE_X_EVENT_MASK_MOUSE_UP |
- ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1);
- bd->button_grabbed = 1;
- }
-}
-
-EAPI void
-e_focus_setdown(E_Border *bd)
-{
- if (!bd->button_grabbed) return;
- e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, bd->win);
- ecore_x_window_button_ungrab(bd->win, 1, 0, 1);
- ecore_x_window_button_ungrab(bd->win, 2, 0, 1);
- ecore_x_window_button_ungrab(bd->win, 3, 0, 1);
- e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
- e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, bd->win);
- bd->button_grabbed = 0;
-}
-
/* local subsystem functions */
static Eina_Bool
_e_focus_raise_timer(void *data)
{
- E_Border *bd;
+ E_Client *ec = data;
- bd = data;
- if (!bd->lock_user_stacking) e_border_raise(bd);
- bd->raise_timer = NULL;
+ if (!ec->lock_user_stacking) evas_object_raise(ec->frame);
+ ec->raise_timer = NULL;
return ECORE_CALLBACK_CANCEL;
}
diff --git a/src/bin/e_focus.h b/src/bin/e_focus.h
index ce069b8ab2..9b20560cd0 100644
--- a/src/bin/e_focus.h
+++ b/src/bin/e_focus.h
@@ -3,18 +3,14 @@
#ifndef E_FOCUS_H
#define E_FOCUS_H
-EINTERN int e_focus_init(void);
-EINTERN int e_focus_shutdown(void);
-EAPI void e_focus_idler_before(void);
-
-EAPI void e_focus_event_mouse_in(E_Border* bd);
-EAPI void e_focus_event_mouse_out(E_Border* bd);
-EAPI void e_focus_event_mouse_down(E_Border* bd);
-EAPI void e_focus_event_mouse_up(E_Border* bd);
-EAPI void e_focus_event_focus_in(E_Border *bd);
-EAPI void e_focus_event_focus_out(E_Border *bd);
-EAPI void e_focus_setup(E_Border *bd);
-EAPI void e_focus_setdown(E_Border *bd);
+EAPI void e_focus_event_mouse_in(E_Client* ec);
+EAPI void e_focus_event_mouse_out(E_Client* ec);
+EAPI void e_focus_event_mouse_down(E_Client* ec);
+EAPI void e_focus_event_mouse_up(E_Client* ec);
+EAPI void e_focus_event_focus_in(E_Client *ec);
+EAPI void e_focus_event_focus_out(E_Client *ec);
+EAPI void e_focus_setup(E_Client *ec);
+EAPI void e_focus_setdown(E_Client *ec);
#endif
#endif
diff --git a/src/bin/e_font.c b/src/bin/e_font.c
index a575077f22..c977a33929 100644
--- a/src/bin/e_font.c
+++ b/src/bin/e_font.c
@@ -25,8 +25,9 @@ EAPI void
e_font_apply(void)
{
char buf[1024];
- Eina_List *l;
- E_Border *bd;
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Comp *c;
E_Font_Default *efd;
E_Font_Fallback *eff;
int blen, len;
@@ -71,11 +72,10 @@ e_font_apply(void)
edje_text_class_set(efd->text_class, efd->font, efd->size);
}
- /* Update borders */
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- {
- e_border_frame_recalc(bd);
- }
+ /* Update clients */
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ e_client_frame_recalc(ec);
}
EAPI Eina_List *
@@ -85,16 +85,11 @@ e_font_available_list(void)
Eina_List *e_fonts;
Eina_List *l;
const char *evas_font;
- E_Manager *man;
- E_Container *con;
+ E_Comp *c;
- man = e_manager_current_get();
- if (!man) return NULL;
- con = e_container_current_get(man);
- if (!con) con = e_container_number_get(man, 0);
- if (!con) return NULL;
+ c = e_util_comp_current_get();
- evas_fonts = evas_font_available_list(con->bg_evas);
+ evas_fonts = evas_font_available_list(c->evas);
e_fonts = NULL;
EINA_LIST_FOREACH(evas_fonts, l, evas_font)
@@ -106,7 +101,7 @@ e_font_available_list(void)
e_fonts = eina_list_append(e_fonts, efa);
}
- evas_font_available_list_free(con->bg_evas, evas_fonts);
+ evas_font_available_list_free(c->evas, evas_fonts);
return e_fonts;
}
diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c
index 979c3b463c..e7ce999059 100644
--- a/src/bin/e_gadcon.c
+++ b/src/bin/e_gadcon.c
@@ -761,7 +761,7 @@ e_gadcon_zone_get(E_Gadcon *gc)
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, NULL);
if (gc->zone) return gc->zone;
if (!gc->toolbar) return NULL;
- return gc->toolbar->fwin->border->zone;
+ return gc->toolbar->fwin->client->zone;
}
EAPI void
@@ -779,7 +779,7 @@ e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h)
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, 0);
if (!gc->ecore_evas) return 0;
ecore_evas_geometry_get(gc->ecore_evas, x, y, w, h);
-// so much relies on this down here to have been broken... ie return container-relative coords.
+// so much relies on this down here to have been broken... ie return comp-relative coords.
// if (gc->zone)
// {
// if (x) *x = *x - gc->zone->x;
@@ -1133,7 +1133,7 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc)
{
Evas_Coord x, y, w, h;
Evas_Object *base;
- unsigned int layer;
+ int layer;
E_OBJECT_CHECK(gcc);
E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
@@ -1141,11 +1141,11 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc)
base = gcc->o_frame ?: gcc->o_base;
if (!base) return;
+ layer = evas_object_layer_get(base) + 1;
evas_object_geometry_get(base, &x, &y, &w, &h);
gcc->o_control = edje_object_add(gcc->gadcon->evas);
/* FIXME: should probably be in gadget theme or something */
- layer = e_comp_e_object_layer_effective_get(E_OBJECT(gcc)) + 1;
evas_object_layer_set(gcc->o_control, layer);
e_gadcon_locked_set(gcc->gadcon, 1);
gcc->gadcon->editing = 1;
@@ -2272,7 +2272,7 @@ _e_gadcon_client_drag_begin(E_Gadcon_Client *gcc, int x, int y)
zone = e_gadcon_zone_get(gcc->gadcon);
if (gcc->gadcon->drag_gcc) return;
- if ((!zone) || (!zone->container)) return;
+ if (!zone) return;
if (!e_util_strcmp(gcc->client_class->name, "systray"))
return;
@@ -2289,9 +2289,9 @@ _e_gadcon_client_drag_begin(E_Gadcon_Client *gcc, int x, int y)
if (!e_drop_inside(gcc->gadcon->drop_handler, x, y))
e_gadcon_client_hide(gcc);
- ecore_x_pointer_xy_get(zone->container->win, &x, &y);
+ ecore_evas_pointer_xy_get(zone->comp->ee, &x, &y);
- gcc->drag.drag = drag = e_drag_new(zone->container, x, y,
+ gcc->drag.drag = drag = e_drag_new(zone->comp, x, y,
drag_types, 1, gcc, -1, NULL,
e_gadcon_drag_finished_cb);
if (!drag) return;
@@ -2480,7 +2480,7 @@ _e_gadcon_cb_client_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *o
}
if (gcc->gadcon->toolbar)
- ecore_x_pointer_xy_get(zone->container->win, &cx, &cy);
+ ecore_evas_pointer_xy_get(zone->comp->ee, &cx, &cy);
else
{
e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, NULL, NULL);
@@ -2591,7 +2591,7 @@ _e_gadcon_client_move_go(E_Gadcon_Client *gcc)
if (gcc->gadcon->toolbar)
evas_pointer_canvas_xy_get(gcc->gadcon->evas, &cx, &cy);
else
- ecore_x_pointer_xy_get(gcc->gadcon->zone->container->win, &cx, &cy);
+ ecore_evas_pointer_xy_get(e_comp_get(gcc)->ee, &cx, &cy);
evas_object_geometry_get(gcc->gadcon->o_container, &gx, &gy, &gw, &gh);
@@ -5557,7 +5557,7 @@ _e_gadcon_custom_populate_job(void *data __UNUSED__)
Eina_List *l, *ll;
E_Gadcon *gc;
-#ifndef E18_RELEASE_BUILD
+#ifndef E19_RELEASE_BUILD
static Eina_Bool first = EINA_TRUE;
if (first)
e_main_ts("gadcon custom populate idler start");
@@ -5584,14 +5584,14 @@ _e_gadcon_custom_populate_job(void *data __UNUSED__)
_e_gadcon_event_populate(gc);
}
-#ifndef E18_RELEASE_BUILD
+#ifndef E19_RELEASE_BUILD
if (first)
e_main_ts("gadcon custom populate idler end");
#endif
if (!custom_populate_requests)
{
custom_populate_job = NULL;
-#ifndef E18_RELEASE_BUILD
+#ifndef E19_RELEASE_BUILD
first = EINA_FALSE;
#endif
}
@@ -5604,7 +5604,7 @@ _e_gadcon_provider_populate_job(void *data __UNUSED__)
Eina_List *l;
E_Gadcon *gc;
-#ifndef E18_RELEASE_BUILD
+#ifndef E19_RELEASE_BUILD
static Eina_Bool first = EINA_TRUE;
if (first)
e_main_ts("gadcon populate idler start");
@@ -5620,7 +5620,7 @@ _e_gadcon_provider_populate_job(void *data __UNUSED__)
}
EINA_LIST_FREE(gc->populate_requests, cc)
{
-#ifndef E18_RELEASE_BUILD
+#ifndef E19_RELEASE_BUILD
if (first) e_main_ts(cc->name);
#endif
if (gc->populate_class.func)
@@ -5647,13 +5647,13 @@ _e_gadcon_provider_populate_job(void *data __UNUSED__)
if (x && _modules_loaded) _e_gadcon_event_populate(gc);
}
//out:
-#ifndef E18_RELEASE_BUILD
+#ifndef E19_RELEASE_BUILD
if (first)
e_main_ts("gadcon populate idler end");
#endif
populate_job = NULL;
-#ifndef E18_RELEASE_BUILD
+#ifndef E19_RELEASE_BUILD
first = EINA_FALSE;
#endif
}
@@ -5754,9 +5754,8 @@ _e_gadcon_location_change(E_Gadcon_Client *gcc, E_Gadcon_Location *src, E_Gadcon
EAPI Eina_Bool
e_gadcon_client_visible_get(const E_Gadcon_Client *gcc, const E_Desk *desk)
{
- const Eina_List *l, *ll, *lll;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *l, *ll;
+ E_Comp *c;
E_Zone *zone;
if (!gcc->gadcon) return EINA_FALSE;
@@ -5766,18 +5765,16 @@ e_gadcon_client_visible_get(const E_Gadcon_Client *gcc, const E_Desk *desk)
return EINA_TRUE; // FIXME for when gadman allows per-desk gadgets
case E_GADCON_SITE_SHELF:
if (desk) return e_shelf_desk_visible(gcc->gadcon->shelf, desk);
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- EINA_LIST_FOREACH(man->containers, ll, con)
- EINA_LIST_FOREACH(con->zones, lll, zone)
- if (e_shelf_desk_visible(gcc->gadcon->shelf, e_desk_current_get(zone)))
- return EINA_TRUE;
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ if (e_shelf_desk_visible(gcc->gadcon->shelf, e_desk_current_get(zone)))
+ return EINA_TRUE;
case E_GADCON_SITE_TOOLBAR:
case E_GADCON_SITE_EFM_TOOLBAR:
- if (desk) return (gcc->gadcon->toolbar->fwin->border->desk == desk);
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- EINA_LIST_FOREACH(man->containers, ll, con)
- EINA_LIST_FOREACH(con->zones, lll, zone)
- if (gcc->gadcon->toolbar->fwin->border->desk == e_desk_current_get(zone)) return EINA_TRUE;
+ if (desk) return (gcc->gadcon->toolbar->fwin->client->desk == desk);
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ if (gcc->gadcon->toolbar->fwin->client->desk == e_desk_current_get(zone)) return EINA_TRUE;
default:
break;
}
diff --git a/src/bin/e_gadcon_popup.c b/src/bin/e_gadcon_popup.c
index 47629480b8..b09a253f2c 100644
--- a/src/bin/e_gadcon_popup.c
+++ b/src/bin/e_gadcon_popup.c
@@ -9,7 +9,7 @@ _e_popup_autoclose_deskafter_show_cb(void *data EINA_UNUSED, int type EINA_UNUSE
E_Gadcon_Popup *pop = data;
if (!pop) return ECORE_CALLBACK_RENEW;
- if (!pop->win->visible) return ECORE_CALLBACK_RENEW;
+ if (!pop->visible) return ECORE_CALLBACK_RENEW;
if (!e_gadcon_client_visible_get(pop->gcc, ev->desk))
e_object_del(E_OBJECT(pop));
@@ -17,15 +17,15 @@ _e_popup_autoclose_deskafter_show_cb(void *data EINA_UNUSED, int type EINA_UNUSE
}
static Eina_Bool
-_e_popup_autoclose_border_fullscreen_cb(void *data, int type EINA_UNUSED, void *event)
+_e_popup_autoclose_client_fullscreen_cb(void *data, int type EINA_UNUSED, void *event)
{
- E_Event_Border_Fullscreen *ev = event;
+ E_Event_Client *ev = event;
E_Gadcon_Popup *pop = data;
if (!pop) return ECORE_CALLBACK_RENEW;
- if (!pop->win->visible) return ECORE_CALLBACK_RENEW;
- if (!ev->border->fullscreen) return ECORE_CALLBACK_RENEW;
- if (e_gadcon_client_visible_get(pop->gcc, ev->border->desk))
+ if (!pop->visible) return ECORE_CALLBACK_RENEW;
+ if (!ev->ec->fullscreen) return ECORE_CALLBACK_RENEW;
+ if (e_gadcon_client_visible_get(pop->gcc, ev->ec->desk))
e_object_del(E_OBJECT(pop));
return ECORE_CALLBACK_RENEW;
}
@@ -41,6 +41,14 @@ _e_gadcon_popup_locked_set(E_Gadcon_Popup *pop, Eina_Bool locked)
}
static void
+_e_gadcon_popup_delay_del(void *obj)
+{
+ E_Gadcon_Popup *pop = obj;
+
+ if (pop->comp_object) evas_object_hide(pop->comp_object);
+}
+
+static void
_e_gadcon_popup_free(E_Gadcon_Popup *pop)
{
E_FREE_FUNC(pop->autoclose_handlers[0], ecore_event_handler_del);
@@ -49,33 +57,24 @@ _e_gadcon_popup_free(E_Gadcon_Popup *pop)
if (pop->gadcon_was_locked)
_e_gadcon_popup_locked_set(pop, 0);
pop->gcc = NULL;
- if (pop->win)
- E_OBJECT_DEL_SET(pop->win, NULL);
- E_FREE_FUNC(pop->win, e_object_del);
+ evas_object_hide(pop->comp_object);
+ E_FREE_FUNC(pop->comp_object, evas_object_del);
free(pop);
}
static void
-_e_gadcon_popup_del_cb(void *obj)
-{
- E_Gadcon_Popup *pop;
-
- pop = e_object_data_get(obj);
- pop->win = NULL;
- e_object_del(E_OBJECT(pop));
-}
-
-static void
_e_gadcon_popup_position(E_Gadcon_Popup *pop)
{
Evas_Coord gx = 0, gy = 0, gw, gh, zw, zh, zx, zy, px, py;
+ E_Zone *zone;
/* Popup positioning */
e_gadcon_client_geometry_get(pop->gcc, &gx, &gy, &gw, &gh);
- zx = pop->win->zone->x;
- zy = pop->win->zone->y;
- zw = pop->win->zone->w;
- zh = pop->win->zone->h;
+ zone = e_gadcon_zone_get(pop->gcc->gadcon);
+ zx = zone->x;
+ zy = zone->y;
+ zw = zone->w;
+ zh = zone->h;
switch (pop->gcc->gadcon->orient)
{
case E_GADCON_ORIENT_CORNER_RT:
@@ -135,14 +134,14 @@ _e_gadcon_popup_position(E_Gadcon_Popup *pop)
break;
default:
- e_popup_move(pop->win, 50, 50);
+ evas_object_move(pop->comp_object, 50, 50);
return;
}
if (px - zx < 0)
px = zx;
if (py - zy < 0)
py = zy;
- e_popup_move(pop->win, px - zx, py - zy);
+ evas_object_move(pop->comp_object, px, py);
if (pop->gadcon_lock && (!pop->gadcon_was_locked))
_e_gadcon_popup_locked_set(pop, 1);
@@ -162,42 +161,37 @@ _e_gadcon_popup_size_recalc(E_Gadcon_Popup *pop, Evas_Object *obj)
}
edje_extern_object_min_size_set(obj, w, h);
edje_object_size_min_calc(pop->o_bg, &pop->w, &pop->h);
- e_popup_resize(pop->win, pop->w, pop->h);
+ evas_object_resize(pop->comp_object, pop->w, pop->h);
- if (pop->win->visible)
+ if (pop->visible)
_e_gadcon_popup_position(pop);
}
static void
_e_gadcon_popup_changed_size_hints_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
- E_Gadcon_Popup *pop;
-
- pop = data;
- _e_gadcon_popup_size_recalc(pop, obj);
+ _e_gadcon_popup_size_recalc(data, obj);
}
/* externally accessible functions */
EAPI E_Gadcon_Popup *
-e_gadcon_popup_new(E_Gadcon_Client *gcc)
+e_gadcon_popup_new(E_Gadcon_Client *gcc, Eina_Bool noshadow)
{
E_Gadcon_Popup *pop;
Evas_Object *o;
- E_Zone *zone;
pop = E_OBJECT_ALLOC(E_Gadcon_Popup, E_GADCON_POPUP_TYPE, _e_gadcon_popup_free);
if (!pop) return NULL;
- zone = e_gadcon_client_zone_get(gcc);
- pop->win = e_popup_new(zone, 0, 0, 0, 0);
- e_popup_layer_set(pop->win, E_COMP_CANVAS_LAYER_POPUP, 0);
- e_object_data_set(E_OBJECT(pop->win), pop);
- E_OBJECT_DEL_SET(pop->win, _e_gadcon_popup_del_cb);
+ e_object_delay_del_set(E_OBJECT(pop), _e_gadcon_popup_delay_del);
- o = edje_object_add(pop->win->evas);
+ o = edje_object_add(e_comp_get(gcc)->evas);
e_theme_edje_object_set(o, "base/theme/gadman", "e/gadman/popup");
pop->o_bg = o;
+ pop->comp_object = e_comp_object_util_add(o, noshadow ? E_COMP_OBJECT_TYPE_NONE : E_COMP_OBJECT_TYPE_POPUP);
+ evas_object_layer_set(pop->comp_object, E_LAYER_POPUP);
+
pop->gcc = gcc;
pop->gadcon_lock = 1;
pop->gadcon_was_locked = 0;
@@ -227,35 +221,31 @@ e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o)
_e_gadcon_popup_changed_size_hints_cb, pop);
}
pop->content = o;
- if (old_o) e_popup_object_remove(pop->win, old_o);
- if (o) e_popup_object_add(pop->win, o);
_e_gadcon_popup_size_recalc(pop, o);
}
EAPI void
e_gadcon_popup_show(E_Gadcon_Popup *pop)
{
- if (!pop) return;
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
- if (pop->win->visible) return;
+ if (pop->visible) return;
_e_gadcon_popup_position(pop);
pop->autoclose_handlers[0] = ecore_event_handler_add(E_EVENT_DESK_AFTER_SHOW, _e_popup_autoclose_deskafter_show_cb, NULL);
- pop->autoclose_handlers[1] = ecore_event_handler_add(E_EVENT_BORDER_FULLSCREEN, _e_popup_autoclose_border_fullscreen_cb, NULL);
- e_popup_content_set(pop->win, pop->o_bg);
- e_popup_show(pop->win);
+ pop->autoclose_handlers[1] = ecore_event_handler_add(E_EVENT_CLIENT_FULLSCREEN, _e_popup_autoclose_client_fullscreen_cb, NULL);
+ e_comp_object_util_del_list_append(pop->comp_object, pop->content);
+ evas_object_show(pop->comp_object);
}
EAPI void
e_gadcon_popup_hide(E_Gadcon_Popup *pop)
{
- if (!pop) return;
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
if (pop->pinned) return;
- e_popup_hide(pop->win);
+ evas_object_hide(pop->comp_object);
if (pop->gadcon_was_locked)
_e_gadcon_popup_locked_set(pop, 0);
}
diff --git a/src/bin/e_gadcon_popup.h b/src/bin/e_gadcon_popup.h
index 1368adf82d..bb5c0c5c8f 100644
--- a/src/bin/e_gadcon_popup.h
+++ b/src/bin/e_gadcon_popup.h
@@ -12,7 +12,7 @@ struct _E_Gadcon_Popup
{
E_Object e_obj_inherit;
- E_Popup *win;
+ Evas_Object *comp_object;
E_Gadcon_Client *gcc;
Evas_Coord w, h;
Evas_Object *o_bg;
@@ -22,9 +22,10 @@ struct _E_Gadcon_Popup
Eina_Bool pinned : 1;
Eina_Bool gadcon_lock : 1;
Eina_Bool gadcon_was_locked : 1;
+ Eina_Bool visible : 1;
};
-EAPI E_Gadcon_Popup *e_gadcon_popup_new(E_Gadcon_Client *gcc);
+EAPI E_Gadcon_Popup *e_gadcon_popup_new(E_Gadcon_Client *gcc, Eina_Bool noshadow);
EAPI void e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o);
EAPI void e_gadcon_popup_show(E_Gadcon_Popup *pop);
EAPI void e_gadcon_popup_hide(E_Gadcon_Popup *pop);
diff --git a/src/bin/e_grab_dialog.c b/src/bin/e_grab_dialog.c
index c875a413d1..9bd5296f27 100644
--- a/src/bin/e_grab_dialog.c
+++ b/src/bin/e_grab_dialog.c
@@ -102,36 +102,31 @@ _e_grab_dialog_dia_del(void *data)
EAPI E_Grab_Dialog *
e_grab_dialog_show(E_Win *parent, Eina_Bool is_mouse, Ecore_Event_Handler_Cb key, Ecore_Event_Handler_Cb mouse, Ecore_Event_Handler_Cb wheel, const void *data)
{
- E_Manager *man;
- E_Container *con;
+ E_Comp *c = NULL;
E_Grab_Dialog *eg;
Ecore_Event_Handler *eh;
if (parent)
{
- con = parent->container;
- man = con->manager;
- e_border_focus_set(parent->border, 0, 1);
+ c = parent->comp;
+ evas_object_focus_set(parent->client->frame, 0);
}
else
- {
- man = e_manager_current_get();
- con = e_container_current_get(man);
- }
+ c = e_comp_get(NULL);
eg = E_OBJECT_ALLOC(E_Grab_Dialog, E_GRAB_DIALOG_TYPE, _e_grab_dialog_free);
if (!eg) return NULL;
if (is_mouse)
{
- eg->dia = e_dialog_new(con, "E", "_mousebind_getmouse_dialog");
+ eg->dia = e_dialog_new(c, "E", "_mousebind_getmouse_dialog");
e_dialog_title_set(eg->dia, _("Mouse Binding Sequence"));
e_dialog_icon_set(eg->dia, "preferences-desktop-mouse", 48);
e_dialog_text_set(eg->dia, TEXT_PRESS_MOUSE_BINIDING_SEQUENCE);
}
else
{
- eg->dia = e_dialog_new(con, "E", "_keybind_getkey_dialog");
+ eg->dia = e_dialog_new(c, "E", "_keybind_getkey_dialog");
e_dialog_title_set(eg->dia, _("Key Binding Sequence"));
e_dialog_icon_set(eg->dia, "preferences-desktop-keyboard-shortcuts", 48);
e_dialog_text_set(eg->dia, TEXT_PRESS_KEY_SEQUENCE);
@@ -142,7 +137,7 @@ e_grab_dialog_show(E_Win *parent, Eina_Bool is_mouse, Ecore_Event_Handler_Cb key
e_object_del_attach_func_set(E_OBJECT(eg->dia), _e_grab_dialog_dia_del);
e_win_delete_callback_set(eg->dia->win, _e_grab_dialog_delete);
- eg->grab_win = ecore_x_window_input_new(man->root, 0, 0, 1, 1);
+ eg->grab_win = ecore_x_window_input_new(c->man->root, 0, 0, 1, 1);
ecore_x_window_show(eg->grab_win);
e_grabinput_get(eg->grab_win, 0, eg->grab_win);
@@ -161,7 +156,7 @@ e_grab_dialog_show(E_Win *parent, Eina_Bool is_mouse, Ecore_Event_Handler_Cb key
eg->handlers = eina_list_append(eg->handlers, eh);
}
e_dialog_show(eg->dia);
- e_border_layer_set(eg->dia->win->border, E_LAYER_ABOVE);
+ evas_object_layer_set(eg->dia->win->client->frame, E_LAYER_CLIENT_ABOVE);
if (parent)
e_dialog_parent_set(eg->dia, parent);
return eg;
diff --git a/src/bin/e_grabinput.c b/src/bin/e_grabinput.c
index 2dfd3cdf08..48c1057bcb 100644
--- a/src/bin/e_grabinput.c
+++ b/src/bin/e_grabinput.c
@@ -2,17 +2,17 @@
/* local subsystem functions */
static Eina_Bool _e_grabinput_focus_check(void *data);
-static void _e_grabinput_focus_do(Ecore_X_Window win, E_Focus_Method method);
-static void _e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method);
+static void _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method);
+static void _e_grabinput_focus(Ecore_Window win, E_Focus_Method method);
/* local subsystem globals */
-static Ecore_X_Window grab_mouse_win = 0;
-static Ecore_X_Window grab_key_win = 0;
-static Ecore_X_Window focus_win = 0;
+static Ecore_Window grab_mouse_win = 0;
+static Ecore_Window grab_key_win = 0;
+static Ecore_Window focus_win = 0;
static E_Focus_Method focus_method = E_FOCUS_METHOD_NO_INPUT;
static double last_focus_time = 0.0;
-static Ecore_X_Window focus_fix_win = 0;
+static Ecore_Window focus_fix_win = 0;
static Ecore_Timer *focus_fix_timer = NULL;
static E_Focus_Method focus_fix_method = E_FOCUS_METHOD_NO_INPUT;
@@ -35,7 +35,7 @@ e_grabinput_shutdown(void)
}
EAPI int
-e_grabinput_get(Ecore_X_Window mouse_win, int confine_mouse, Ecore_X_Window key_win)
+e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
{
if (grab_mouse_win)
{
@@ -79,7 +79,7 @@ e_grabinput_get(Ecore_X_Window mouse_win, int confine_mouse, Ecore_X_Window key_
}
EAPI void
-e_grabinput_release(Ecore_X_Window mouse_win, Ecore_X_Window key_win)
+e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win)
{
if (mouse_win == grab_mouse_win)
{
@@ -101,7 +101,7 @@ e_grabinput_release(Ecore_X_Window mouse_win, Ecore_X_Window key_win)
}
EAPI void
-e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method)
+e_grabinput_focus(Ecore_Window win, E_Focus_Method method)
{
if (grab_key_win != 0)
{
@@ -122,13 +122,13 @@ e_grabinput_last_focus_time_get(void)
return last_focus_time;
}
-EAPI Ecore_X_Window
+EAPI Ecore_Window
e_grabinput_last_focus_win_get(void)
{
return focus_fix_win;
}
-EAPI Ecore_X_Window
+EAPI Ecore_Window
e_grabinput_key_win_get(void)
{
return grab_key_win;
@@ -147,7 +147,7 @@ _e_grabinput_focus_check(void *data __UNUSED__)
}
static void
-_e_grabinput_focus_do(Ecore_X_Window win, E_Focus_Method method)
+_e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method)
{
/* fprintf(stderr, "focus to %x method %i\n", win, method); */
switch (method)
@@ -174,7 +174,7 @@ _e_grabinput_focus_do(Ecore_X_Window win, E_Focus_Method method)
}
static void
-_e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method)
+_e_grabinput_focus(Ecore_Window win, E_Focus_Method method)
{
focus_fix_win = win;
focus_fix_method = method;
diff --git a/src/bin/e_grabinput.h b/src/bin/e_grabinput.h
index b3acbc000a..b6715573bf 100644
--- a/src/bin/e_grabinput.h
+++ b/src/bin/e_grabinput.h
@@ -14,12 +14,12 @@ typedef enum _E_Focus_Method
EINTERN int e_grabinput_init(void);
EINTERN int e_grabinput_shutdown(void);
-EAPI int e_grabinput_get(Ecore_X_Window mouse_win, int confine_mouse, Ecore_X_Window key_win);
-EAPI void e_grabinput_release(Ecore_X_Window mouse_win, Ecore_X_Window key_win);
-EAPI void e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method);
+EAPI int e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win);
+EAPI void e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win);
+EAPI void e_grabinput_focus(Ecore_Window win, E_Focus_Method method);
EAPI double e_grabinput_last_focus_time_get(void);
-EAPI Ecore_X_Window e_grabinput_last_focus_win_get(void);
-EAPI Ecore_X_Window e_grabinput_key_win_get(void);
+EAPI Ecore_Window e_grabinput_last_focus_win_get(void);
+EAPI Ecore_Window e_grabinput_key_win_get(void);
#endif
#endif
diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c
index 40ba968b2a..61de71943b 100644
--- a/src/bin/e_hints.c
+++ b/src/bin/e_hints.c
@@ -8,10 +8,8 @@ EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_VERSION = 0;
EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_SCALE = 0;
EINTERN void
-e_hints_init(void)
+e_hints_init(Ecore_X_Window root, Ecore_X_Window propwin)
{
- Ecore_X_Window *roots = NULL;
- int num;
const char *atom_names[] = {
"_QTOPIA_SOFT_MENU",
"_QTOPIA_SOFT_MENUS",
@@ -21,6 +19,12 @@ e_hints_init(void)
"ENLIGHTENMENT_SCALE"
};
Ecore_X_Atom atoms[6];
+ Ecore_X_Atom supported[43];
+ int supported_num;
+ Ecore_X_Window win, twin;
+ int nwins;
+ char *name;
+ double ts;
ecore_x_atoms_get(atom_names, 6, atoms);
ATM__QTOPIA_SOFT_MENU = atoms[0];
@@ -30,166 +34,157 @@ e_hints_init(void)
ATM_ENLIGHTENMENT_VERSION = atoms[4];
ATM_ENLIGHTENMENT_SCALE = atoms[5];
- roots = ecore_x_window_root_list(&num);
- if (roots)
+ supported_num = 0;
+ /* Set what hints we support */
+ /* Root Window Properties (and Related Messages) */
+ supported[supported_num++] = ECORE_X_ATOM_NET_CLIENT_LIST;
+ supported[supported_num++] = ECORE_X_ATOM_NET_CLIENT_LIST_STACKING;
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_CURRENT_DESKTOP, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_DESKTOP_NAMES, 1);*/
+ supported[supported_num++] = ECORE_X_ATOM_NET_ACTIVE_WINDOW;
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WORKAREA, 1);*/
+ supported[supported_num++] = ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK;
+ supported[supported_num++] = ECORE_X_ATOM_NET_VIRTUAL_ROOTS;
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_DESKTOP_LAYOUT, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_SHOWING_DESKTOP, 1);*/
+
+ /* Other Root Window Messages */
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_CLOSE_WINDOW, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_MOVERESIZE_WINDOW, 1);*/
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_MOVERESIZE;
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_RESTACK_WINDOW, 1);*/
+ supported[supported_num++] = ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS;
+
+ /* Application Window Properties */
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_NAME;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_VISIBLE_NAME;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_ICON_NAME;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME;
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_DESKTOP, 1);*/
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_MODAL;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_STICKY;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_SHADED;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_ABOVE;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_BELOW;
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_MOVE, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_RESIZE, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_SHADE, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_STICK, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP, 1);*/
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_CLOSE, 1);*/
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STRUT;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_STRUT_PARTIAL;
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, 1);*/
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_ICON;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_PID;
+ /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_HANDLED_ICONS, 1);*/
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_USER_TIME;
+ supported[supported_num++] = ECORE_X_ATOM_NET_FRAME_EXTENTS;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_PING;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
+ supported[supported_num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER;
+ supported[supported_num++] = ECORE_X_ATOM_E_VIDEO_PARENT;
+ supported[supported_num++] = ECORE_X_ATOM_E_VIDEO_POSITION;
+
+
+
+
+ /* check for previous netwm wm and wait for it to die */
+ ts = ecore_time_get();
+ nwins = ecore_x_window_prop_window_get(root,
+ ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
+ &win, 1);
+ if ((nwins > 0) && (win != propwin))
{
- Ecore_X_Atom supported[43];
- int supported_num, i;
-
- supported_num = 0;
- /* Set what hints we support */
- /* Root Window Properties (and Related Messages) */
- supported[supported_num++] = ECORE_X_ATOM_NET_CLIENT_LIST;
- supported[supported_num++] = ECORE_X_ATOM_NET_CLIENT_LIST_STACKING;
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_CURRENT_DESKTOP, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_DESKTOP_NAMES, 1);*/
- supported[supported_num++] = ECORE_X_ATOM_NET_ACTIVE_WINDOW;
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WORKAREA, 1);*/
- supported[supported_num++] = ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK;
- supported[supported_num++] = ECORE_X_ATOM_NET_VIRTUAL_ROOTS;
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_DESKTOP_LAYOUT, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_SHOWING_DESKTOP, 1);*/
-
- /* Other Root Window Messages */
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_CLOSE_WINDOW, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_MOVERESIZE_WINDOW, 1);*/
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_MOVERESIZE;
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_RESTACK_WINDOW, 1);*/
- supported[supported_num++] = ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS;
-
- /* Application Window Properties */
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_NAME;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_VISIBLE_NAME;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_ICON_NAME;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME;
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_DESKTOP, 1);*/
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_MODAL;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_STICKY;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_SHADED;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_ABOVE;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STATE_BELOW;
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_MOVE, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_RESIZE, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_SHADE, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_STICK, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP, 1);*/
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ACTION_CLOSE, 1);*/
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STRUT;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_STRUT_PARTIAL;
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, 1);*/
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_ICON;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_PID;
- /*ecore_x_netwm_supported(roots[supported_num], ECORE_X_ATOM_NET_WM_HANDLED_ICONS, 1);*/
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_USER_TIME;
- supported[supported_num++] = ECORE_X_ATOM_NET_FRAME_EXTENTS;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_PING;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
- supported[supported_num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER;
- supported[supported_num++] = ECORE_X_ATOM_E_VIDEO_PARENT;
- supported[supported_num++] = ECORE_X_ATOM_E_VIDEO_POSITION;
-
- for (i = 0; i < num; i++)
+ twin = win;
+ for (;; )
{
- Ecore_X_Window win, twin;
- int nwins;
- char *name;
- double ts;
-
- /* check for previous netwm wm and wait for it to die */
- ts = ecore_time_get();
- nwins = ecore_x_window_prop_window_get(roots[i],
- ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
- &win, 1);
- twin = win;
- if (nwins > 0)
+ if (nwins < 1) break;
+ if (twin != win) break;
+ if (ecore_x_netwm_name_get(twin, &name))
{
- for (;; )
+ if (name)
{
- if (twin != win) break;
- if (ecore_x_error_code_get()) break; //some dead window has the atom
- if (ecore_x_netwm_name_get(win, &name))
- {
- if (name)
- {
- if (strcmp(name, "Enlightenment"))
- {
- free(name);
- break;
- }
- free(name);
- }
- }
- ecore_x_sync();
- if ((ecore_time_get() - ts) > 2.0)
+ if (strcmp(name, "Enlightenment"))
{
- e_error_message_show(_("A previous instance of Enlightenment is still active\n"
- "on this screen. Aborting startup.\n"));
- exit(1);
+ free(name);
+ break;
}
- nwins = ecore_x_window_prop_window_get(roots[i],
+ nwins = ecore_x_window_prop_window_get(root,
ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
&twin, 1);
if (nwins < 1) break;
+ free(name);
}
}
+ else
+ if (ecore_x_error_code_get()) break; //some dead window
+ if ((ecore_time_get() - ts) > 2.0)
+ {
+ e_error_message_show(_("A previous instance of Enlightenment is still active\n"
+ "on this screen. Aborting startup.\n"));
+ exit(1);
+ }
+ nwins = ecore_x_window_prop_window_get(root,
+ ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
+ &twin, 1);
+ }
+ }
- /* TODO: Remember this window and close it on shutdown */
- win = ecore_x_window_new(roots[i], -200, -200, 5, 5);
/*
- * I don't FUCKING believe it. if we PRETEND we are Kwin - java is happy.
- * why? it expects a double reparenting wm then. java insists on finding this
- * out when it should be irrelevant! stupid code! I can't believe the time we
- * just wasted hunting a bug that wasn't and that is due to sheer stupid
- * coding (in java's awt layer that swing also uses).
- */
+* I don't FUCKING believe it. if we PRETEND we are Kwin - java is happy.
+* why? it expects a double reparenting wm then. java insists on finding this
+* out when it should be irrelevant! stupid code! I can't believe the time we
+* just wasted hunting a bug that wasn't and that is due to sheer stupid
+* coding (in java's awt layer that swing also uses).
+*/
/* Now for more stupidity... Openoffice.org will change its look and feel
- * depending on what wm it thinks there is... so if we pretend to be Kwin...
- * it tries to use kde preferences, if found.
- */
+* depending on what wm it thinks there is... so if we pretend to be Kwin...
+* it tries to use kde preferences, if found.
+*/
/* I have disabled this now by pretending to be E16 with e16 comms. this
- * means java plays nice and uses our FRAME property.. but we had to do other
- * evil stuff as java EXPECTS all this at REPARENT time... i've deferred
- * reparenting... i hate java!
- */
-/* ecore_x_netwm_wm_identify(roots[i], win, "KWin");*/
- ecore_x_netwm_wm_identify(roots[i], win, "Enlightenment");
+* means java plays nice and uses our FRAME property.. but we had to do other
+* evil stuff as java EXPECTS all this at REPARENT time... i've deferred
+* reparenting... i hate java!
+*/
+/* ecore_x_netwm_wm_identify(root, win, "KWin");*/
+ ecore_x_netwm_wm_identify(root, propwin, "Enlightenment");
/* this makes openoffice.org read gtk settings so it doesn't look like shit */
- e_hints_openoffice_gnome_fake(roots[i]);
+ e_hints_openoffice_gnome_fake(root);
- ecore_x_netwm_supported_set(roots[i], supported, supported_num);
+ ecore_x_netwm_supported_set(root, supported, supported_num);
- /* fake mwm, this might crash some ol' motif apps, if
- they still exist, but at least it makes borderless
- feature of Eterm and urxvt work... */
- ecore_x_atom_get("_MOTIF_WM_INFO");
- }
- free(roots);
- }
+ /* fake mwm, this might crash some ol' motif apps, if
+ they still exist, but at least it makes borderless
+ feature of Eterm and urxvt work... */
+ ecore_x_atom_get("_MOTIF_WM_INFO");
+ e_hints_e16_comms_pretend(root, propwin);
+ ecore_x_sync();
}
/*
@@ -198,24 +193,23 @@ e_hints_init(void)
* window port anyway
*/
EAPI void
-e_hints_e16_comms_pretend(E_Manager *man)
+e_hints_e16_comms_pretend(Ecore_X_Window root, Ecore_X_Window propwin)
{
- Ecore_X_Window win;
char buf[256];
- win = ecore_x_window_input_new(man->root, -100, -100, 1, 1);
-
/* to help detect this is NOT e16 */
snprintf(buf, sizeof(buf), "Enlightenment %s", VERSION);
- ecore_x_window_prop_property_set(win, ATM_ENLIGHTENMENT_VERSION, ECORE_X_ATOM_STRING, 8, buf, strlen(buf));
- ecore_x_window_prop_property_set(man->root, ATM_ENLIGHTENMENT_VERSION, ECORE_X_ATOM_STRING, 8, buf, strlen(buf));
+ ecore_x_window_prop_property_set(propwin, ATM_ENLIGHTENMENT_VERSION, ECORE_X_ATOM_STRING, 8, buf, strlen(buf));
+ ecore_x_window_prop_property_set(root, ATM_ENLIGHTENMENT_VERSION, ECORE_X_ATOM_STRING, 8, buf, strlen(buf));
- snprintf(buf, sizeof(buf), "WINID %8x", (int)win);
- ecore_x_window_prop_property_set(win, ATM_ENLIGHTENMENT_COMMS, ECORE_X_ATOM_STRING, 8, buf, 14);
+ snprintf(buf, sizeof(buf), "WINID %8x", (int)propwin);
+ ecore_x_window_prop_property_set(propwin, ATM_ENLIGHTENMENT_COMMS, ECORE_X_ATOM_STRING, 8, buf, 14);
- ecore_x_window_prop_property_set(man->root, ATM_ENLIGHTENMENT_COMMS, ECORE_X_ATOM_STRING, 8, buf, 14);
+ ecore_x_window_prop_property_set(root, ATM_ENLIGHTENMENT_COMMS, ECORE_X_ATOM_STRING, 8, buf, 14);
}
+#if 0
+THIS FUNCTION DOES NOTHING!!!!
EINTERN void
e_hints_manager_init(E_Manager *man)
{
@@ -262,66 +256,35 @@ e_hints_manager_init(E_Manager *man)
free(vroots);
free(areas);
}
+#endif
-/* FIXME, this should set the list in map order, not stack order */
EAPI void
e_hints_client_list_set(void)
{
- Eina_List *ml = NULL, *cl = NULL;
- unsigned int i = 0, num = 0;
- E_Manager *m;
- E_Container *c;
- E_Border_List *bl;
- E_Border *b;
- Ecore_X_Window *clients = NULL;
+ E_Manager *man;
+ const Eina_List *l;
/* Get client count by adding client lists on all containers */
- EINA_LIST_FOREACH(e_manager_list(), ml, m)
+ EINA_LIST_FOREACH(e_manager_list(), l, man)
{
- EINA_LIST_FOREACH(m->containers, cl, c)
- {
- num += e_container_borders_count(c);
- }
- }
-
- clients = calloc(num, sizeof(Ecore_X_Window));
- if (!clients)
- return;
+ unsigned int i = 0;
+ Ecore_X_Window *clients = NULL;
- /* Fetch window IDs and add to array */
- if (num > 0)
- {
- EINA_LIST_FOREACH(e_manager_list(), ml, m)
+ if (man->comp->clients)
{
- i = 0;
- EINA_LIST_FOREACH(m->containers, cl, c)
- {
- bl = e_container_border_list_first(c);
- while ((b = e_container_border_list_next(bl)))
- clients[i++] = b->client.win;
- e_container_border_list_free(bl);
- }
- if (i > 0)
- {
- ecore_x_netwm_client_list_stacking_set(m->root, clients, i);
- ecore_x_netwm_client_list_set(m->root, clients, i);
- }
- else
+ E_Client *ec;
+ const Eina_List *ll;
+
+ clients = calloc(e_clients_count(man->comp), sizeof(Ecore_X_Window));
+ EINA_LIST_FOREACH(man->comp->clients, ll, ec)
{
- ecore_x_netwm_client_list_set(m->root, NULL, 0);
- ecore_x_netwm_client_list_stacking_set(m->root, NULL, 0);
+ if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_X) continue;
+ clients[i++] = e_client_util_win_get(ec);
}
}
+ ecore_x_netwm_client_list_set(man->root, clients, i);
+ free(clients);
}
- else
- {
- EINA_LIST_FOREACH(e_manager_list(), ml, m)
- {
- ecore_x_netwm_client_list_set(m->root, NULL, 0);
- ecore_x_netwm_client_list_stacking_set(m->root, NULL, 0);
- }
- }
- E_FREE(clients);
}
/* Client list is already in stacking order, so this function is nearly
@@ -329,277 +292,274 @@ e_hints_client_list_set(void)
EAPI void
e_hints_client_stacking_set(void)
{
- Eina_List *ml = NULL, *cl = NULL;
- unsigned int i = 0, num = 0;
- E_Manager *m;
- E_Container *c;
- E_Border_List *bl;
- E_Border *b;
- Ecore_X_Window *clients = NULL;
+ E_Comp *comp;
+ const Eina_List *l;
+#define CLIENT_STACK_DEBUG
/* Get client count */
- EINA_LIST_FOREACH(e_manager_list(), ml, m)
+ EINA_LIST_FOREACH(e_comp_list(), l, comp)
{
- EINA_LIST_FOREACH(m->containers, cl, c)
- {
- num += e_container_borders_count(c);
- }
- }
+ unsigned int c, i = 0, non_x = 0;
+ Ecore_X_Window *clients = NULL;
- if (num > 0)
- {
- clients = calloc(num, sizeof(Ecore_X_Window));
- if (!clients) return;
-
- EINA_LIST_FOREACH(e_manager_list(), ml, m)
+ c = e_clients_count(comp);
+ if (c)
{
- EINA_LIST_FOREACH(m->containers, cl, c)
+ E_Client *ec;
+#ifdef CLIENT_STACK_DEBUG
+ Eina_List *ll = NULL;
+#endif
+ clients = calloc(c, sizeof(Ecore_X_Window));
+ E_CLIENT_FOREACH(comp, ec)
{
- bl = e_container_border_list_first(c);
- while ((b = e_container_border_list_next(bl)))
+ if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_X)
{
- if (i >= num)
- {
- e_error_message_show("e_hints.c: e_hints_client_stacking_set()\n"
- "\n"
- "Window list size greater than window count.\n"
- "This is really bad.\n"
- "Please report this.\n");
- break;
- }
- clients[i++] = b->client.win;
+ non_x++;
+ continue;
+ }
+ clients[i++] = e_client_util_win_get(ec);
+#ifdef CLIENT_STACK_DEBUG
+ ll = eina_list_append(ll, ec);
+#endif
+ if (i > c)
+ {
+ CRI("Window list size greater than window count.");
+ break;
}
- e_container_border_list_free(bl);
+ }
+
+ if (i < c - non_x)
+ {
+#ifdef CLIENT_STACK_DEBUG
+ Eina_List *lll = eina_list_clone(comp->clients);
+
+ EINA_LIST_FREE(ll, ec)
+ lll = eina_list_remove(lll, ec);
+ EINA_LIST_FREE(lll, ec)
+ WRN("Missing %p: %snew client", ec, ec->new_client ? "" : "not ");
+#endif
+ CRI("Window list size less than window count.");
}
}
- if (i < num)
- {
- e_error_message_show("e_hints.c: e_hints_client_stacking_set()\n"
- "\n"
- "Window list size less than window count.\n"
- "This is strange, but not harmful.\n"
- "Please report this.\n");
- }
- EINA_LIST_FOREACH(e_manager_list(), ml, m)
- {
- ecore_x_netwm_client_list_stacking_set(m->root, clients, num);
- }
- E_FREE(clients);
- }
- else
- {
- EINA_LIST_FOREACH(e_manager_list(), ml, m)
- {
- ecore_x_netwm_client_list_stacking_set(m->root, NULL, 0);
- }
+ /* XXX: it should be "more correct" to be setting the stacking atom as "windows per root"
+ * since any apps using it are probably not going to want windows from other screens
+ * to be returned in the list
+ */
+ if (i <= c)
+ ecore_x_netwm_client_list_stacking_set(comp->man->root, clients, c);
+ free(clients);
}
}
EAPI void
e_hints_active_window_set(E_Manager *man,
- E_Border *bd)
+ E_Client *ec)
{
E_OBJECT_CHECK(man);
- if (bd)
- ecore_x_netwm_client_active_set(man->root, bd->client.win);
+ if (ec && (e_pixmap_type_get(ec->pixmap) == E_PIXMAP_TYPE_X))
+ ecore_x_netwm_client_active_set(man->root, e_client_util_win_get(ec));
else
ecore_x_netwm_client_active_set(man->root, 0);
}
EINTERN void
-e_hints_window_init(E_Border *bd)
+e_hints_window_init(E_Client *ec)
{
E_Remember *rem = NULL;
- if (bd->remember)
- rem = bd->remember;
+ if (ec->remember)
+ rem = ec->remember;
- if (bd->client.icccm.state == ECORE_X_WINDOW_STATE_HINT_NONE)
+ if (ec->icccm.state == ECORE_X_WINDOW_STATE_HINT_NONE)
{
- if (bd->client.netwm.state.hidden)
- bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
+ if (ec->netwm.state.hidden)
+ ec->icccm.state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
else
- bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
+ ec->icccm.state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
}
- if ((rem) && (rem->prop.layer))
+ if ((rem) && (rem->apply & E_REMEMBER_APPLY_LAYER))
{
- bd->layer = rem->prop.layer;
- e_border_layer_set(bd, bd->layer);
+ ec->layer = rem->prop.layer;
+ evas_object_layer_set(ec->frame, ec->layer);
}
else
{
- if (!bd->lock_client_stacking)
+ if (!ec->lock_client_stacking)
{
- if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DESKTOP)
- e_border_layer_set(bd, E_LAYER_DESKTOP);
- else if (bd->client.netwm.state.stacking == E_STACKING_BELOW)
- e_border_layer_set(bd, E_LAYER_BELOW);
- else if (bd->client.netwm.state.stacking == E_STACKING_ABOVE)
- e_border_layer_set(bd, E_LAYER_ABOVE);
- else if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DOCK)
- e_border_layer_set(bd, E_LAYER_ABOVE);
- else
- e_border_layer_set(bd, E_LAYER_NORMAL);
+ if (ec->netwm.type == E_WINDOW_TYPE_DESKTOP)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_DESKTOP);
+ else if (ec->netwm.state.stacking == E_STACKING_BELOW)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_BELOW);
+ else if (ec->netwm.state.stacking == E_STACKING_ABOVE)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
+ else if (ec->netwm.type == E_WINDOW_TYPE_DOCK)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
+ else if (!evas_object_layer_get(ec->frame)) //impossible?
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
}
else
- e_border_raise(bd);
+ evas_object_raise(ec->frame);
}
- if ((bd->parent) && (e_config->transient.layer))
- e_border_layer_set(bd, bd->parent->layer);
+ if ((ec->parent) && (e_config->transient.layer))
+ evas_object_layer_set(ec->frame, ec->parent->layer);
#if 0
/* Ignore this, E has incompatible desktop setup */
- if (ecore_x_netwm_desktop_get(bd->client.win, &bd->client.netwm.desktop))
+ if (ecore_x_netwm_desktop_get(e_client_util_win_get(ec), &ec->netwm.desktop))
{
- if (bd->client.netwm.desktop == 0xffffffff)
+ if (ec->netwm.desktop == 0xffffffff)
{
- e_border_stick(bd);
+ e_client_stick(ec);
}
- else if (bd->client.netwm.desktop < (bd->zone->desk_x_count * bd->zone->desk_y_count))
+ else if (ec->netwm.desktop < (ec->zone->desk_x_count * ec->zone->desk_y_count))
{
E_Desk *desk;
- desk = e_desk_at_pos_get(bd->zone, bd->client.netwm.desktop);
+ desk = e_desk_at_pos_get(ec->zone, ec->netwm.desktop);
if (desk)
- e_border_desk_set(bd, desk);
+ e_client_desk_set(ec, desk);
}
else
{
/* Update netwm desktop with current desktop */
- e_hints_window_desktop_set(bd);
+ e_hints_window_desktop_set(ec);
}
}
else
{
/* Update netwm desktop with current desktop */
- e_hints_window_desktop_set(bd);
+ e_hints_window_desktop_set(ec);
}
#endif
- if (bd->client.netwm.state.sticky)
+ if (ec->netwm.state.sticky)
{
- if (!bd->lock_client_sticky)
- e_border_stick(bd);
+ if (!ec->lock_client_sticky)
+ e_client_stick(ec);
else
- e_hints_window_sticky_set(bd, 0);
+ e_hints_window_sticky_set(ec, 0);
}
- if (bd->client.netwm.state.shaded)
+ if (ec->netwm.state.shaded)
{
- if (!bd->lock_client_shade)
- e_border_shade(bd, e_hints_window_shade_direction_get(bd));
+ if (!ec->lock_client_shade)
+ e_client_shade(ec, e_hints_window_shade_direction_get(ec));
else
- e_hints_window_shaded_set(bd, 0);
+ e_hints_window_shaded_set(ec, 0);
}
- if ((bd->client.netwm.state.maximized_v) && (bd->client.netwm.state.maximized_h))
+ if ((ec->netwm.state.maximized_v) && (ec->netwm.state.maximized_h))
{
- if (!bd->lock_client_maximize)
+ if (!ec->lock_client_maximize)
{
- e_hints_window_size_get(bd);
- e_border_maximize(bd, e_config->maximize_policy);
+ e_hints_window_size_get(ec);
+ e_client_maximize(ec, e_config->maximize_policy);
}
else
- e_hints_window_maximized_set(bd, 0, 0);
+ e_hints_window_maximized_set(ec, 0, 0);
}
- else if (bd->client.netwm.state.maximized_h)
+ else if (ec->netwm.state.maximized_h)
{
- if (!bd->lock_client_maximize)
+ if (!ec->lock_client_maximize)
{
- e_hints_window_size_get(bd);
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_HORIZONTAL);
+ e_hints_window_size_get(ec);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_HORIZONTAL);
}
else
- e_hints_window_maximized_set(bd, 0, 0);
+ e_hints_window_maximized_set(ec, 0, 0);
}
- else if (bd->client.netwm.state.maximized_v)
+ else if (ec->netwm.state.maximized_v)
{
- if (!bd->lock_client_maximize)
+ if (!ec->lock_client_maximize)
{
- e_hints_window_size_get(bd);
+ e_hints_window_size_get(ec);
do
{
- if (bd->client.initial_attributes.w == (bd->zone->w / 2))
+ if (ec->client.w == (ec->zone->w / 2))
{
- if (!bd->client.initial_attributes.x)
+ if (!ec->client.x)
{
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_LEFT);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_LEFT);
break;
}
- else if (bd->client.initial_attributes.x == bd->zone->w / 2)
+ else if (ec->client.x == ec->zone->w / 2)
{
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_RIGHT);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_RIGHT);
break;
}
}
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_VERTICAL);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_VERTICAL);
} while (0);
}
else
- e_hints_window_maximized_set(bd, 0, 0);
+ e_hints_window_maximized_set(ec, 0, 0);
}
- if (bd->client.netwm.state.fullscreen)
+ if (ec->netwm.state.fullscreen)
{
- if (!bd->lock_client_fullscreen)
+ if (!ec->lock_client_fullscreen)
{
- e_hints_window_size_get(bd);
- e_border_fullscreen(bd, e_config->fullscreen_policy);
+ e_hints_window_size_get(ec);
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
}
else
- e_hints_window_fullscreen_set(bd, 0);
+ e_hints_window_fullscreen_set(ec, 0);
}
- if ((bd->client.icccm.state == ECORE_X_WINDOW_STATE_HINT_ICONIC) &&
- (bd->client.netwm.state.hidden))
+ if ((ec->icccm.state == ECORE_X_WINDOW_STATE_HINT_ICONIC) &&
+ (ec->netwm.state.hidden))
{
- if (!bd->lock_client_iconify)
- e_border_iconify(bd);
+ if (!ec->lock_client_iconify)
+ e_client_iconify(ec);
else
- e_hints_window_visible_set(bd);
+ e_hints_window_visible_set(ec);
}
- else if ((bd->parent) && (e_config->transient.iconify) && (bd->parent->iconic))
- e_border_iconify(bd);
+ else if ((ec->parent) && (e_config->transient.iconify) && (ec->parent->iconic))
+ e_client_iconify(ec);
/* If a window isn't iconic, and is one the current desk,
* show it! */
- else if (bd->desk == e_desk_current_get(bd->zone))
- e_border_show(bd);
+ else if (ec->desk == e_desk_current_get(ec->zone))
+ {
+ /* ...but only if it's supposed to be shown */
+ if (ec->re_manage)
+ {
+ ec->changes.visible = 1;
+ ec->visible = 1;
+ }
+ }
/* e hints */
/*
- if (bd->client.e.state.centered)
+ if (ec->e.state.centered)
{
- e_border_center(bd);
+ e_client_center(ec);
}
*/
-/* Update stacking */
- e_hints_client_list_set();
- e_hints_client_stacking_set();
}
EAPI void
-e_hints_window_state_set(E_Border *bd)
+e_hints_window_state_set(E_Client *ec)
{
Ecore_X_Window_State state[10];
int num = 0;
- if (bd->client.netwm.state.modal)
+ if (ec->netwm.state.modal)
state[num++] = ECORE_X_WINDOW_STATE_MODAL;
- if (bd->client.netwm.state.sticky)
+ if (ec->netwm.state.sticky)
state[num++] = ECORE_X_WINDOW_STATE_STICKY;
- if (bd->client.netwm.state.maximized_v)
+ if (ec->netwm.state.maximized_v)
state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
- if (bd->client.netwm.state.maximized_h)
+ if (ec->netwm.state.maximized_h)
state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
- if (bd->client.netwm.state.shaded)
+ if (ec->netwm.state.shaded)
state[num++] = ECORE_X_WINDOW_STATE_SHADED;
- if (bd->client.netwm.state.skip_taskbar)
+ if (ec->netwm.state.skip_taskbar)
state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
- if (bd->client.netwm.state.skip_pager)
+ if (ec->netwm.state.skip_pager)
state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
- if (bd->client.netwm.state.hidden)
+ if (ec->netwm.state.hidden)
state[num++] = ECORE_X_WINDOW_STATE_HIDDEN;
- if (bd->client.netwm.state.fullscreen)
+ if (ec->netwm.state.fullscreen)
state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
- switch (bd->client.netwm.state.stacking)
+ switch (ec->netwm.state.stacking)
{
case E_STACKING_ABOVE:
state[num++] = ECORE_X_WINDOW_STATE_ABOVE;
@@ -613,88 +573,91 @@ e_hints_window_state_set(E_Border *bd)
default:
break;
}
- ecore_x_netwm_window_state_set(bd->client.win, state, num);
+ ecore_x_netwm_window_state_set(e_client_util_win_get(ec), state, num);
}
EAPI void
-e_hints_allowed_action_set(E_Border *bd)
+e_hints_allowed_action_set(E_Client *ec)
{
Ecore_X_Action action[10];
int num = 0;
- if (bd->client.netwm.action.move)
+ if (ec->netwm.action.move)
action[num++] = ECORE_X_ACTION_MOVE;
- if (bd->client.netwm.action.resize)
+ if (ec->netwm.action.resize)
action[num++] = ECORE_X_ACTION_RESIZE;
- if (bd->client.netwm.action.minimize)
+ if (ec->netwm.action.minimize)
action[num++] = ECORE_X_ACTION_MINIMIZE;
- if (bd->client.netwm.action.shade)
+ if (ec->netwm.action.shade)
action[num++] = ECORE_X_ACTION_SHADE;
- if (bd->client.netwm.action.stick)
+ if (ec->netwm.action.stick)
action[num++] = ECORE_X_ACTION_STICK;
- if (bd->client.netwm.action.maximized_h)
+ if (ec->netwm.action.maximized_h)
action[num++] = ECORE_X_ACTION_MAXIMIZE_HORZ;
- if (bd->client.netwm.action.maximized_v)
+ if (ec->netwm.action.maximized_v)
action[num++] = ECORE_X_ACTION_MAXIMIZE_VERT;
- if (bd->client.netwm.action.fullscreen)
+ if (ec->netwm.action.fullscreen)
action[num++] = ECORE_X_ACTION_FULLSCREEN;
- if (bd->client.netwm.action.change_desktop)
+ if (ec->netwm.action.change_desktop)
action[num++] = ECORE_X_ACTION_CHANGE_DESKTOP;
- if (bd->client.netwm.action.close)
+ if (ec->netwm.action.close)
action[num++] = ECORE_X_ACTION_CLOSE;
- ecore_x_netwm_allowed_action_set(bd->client.win, action, num);
+ ecore_x_netwm_allowed_action_set(e_client_util_win_get(ec), action, num);
}
EAPI void
-e_hints_window_type_set(E_Border *bd)
+e_hints_window_type_set(E_Client *ec)
{
- ecore_x_netwm_window_type_set(bd->client.win, bd->client.netwm.type);
+ ecore_x_netwm_window_type_set(e_client_util_win_get(ec), ec->netwm.type);
}
EAPI void
-e_hints_window_type_get(E_Border *bd)
+e_hints_window_type_get(E_Client *ec)
{
Ecore_X_Window_Type *types = NULL;
int num, i, j;
- num = ecore_x_netwm_window_types_get(bd->client.win, &types);
- if (bd->client.netwm.extra_types)
+ num = ecore_x_netwm_window_types_get(e_client_util_win_get(ec), &types);
+ if (ec->netwm.extra_types)
{
- free(bd->client.netwm.extra_types);
- bd->client.netwm.extra_types = NULL;
- bd->client.netwm.extra_types_num = 0;
+ free(ec->netwm.extra_types);
+ ec->netwm.extra_types = NULL;
+ ec->netwm.extra_types_num = 0;
}
if (num == 0)
- bd->client.netwm.type = ECORE_X_WINDOW_TYPE_UNKNOWN;
+ ec->netwm.type = E_WINDOW_TYPE_UNKNOWN;
else
{
j = 0;
- bd->client.netwm.type = types[j];
+ ec->netwm.type = types[j];
j++;
while ((j < num) &&
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN))
+ (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN))
{
j++;
- bd->client.netwm.type = types[j];
+ ec->netwm.type = types[j];
}
if (num > j)
{
- bd->client.netwm.extra_types =
+ ec->netwm.extra_types =
malloc((num - j) * sizeof(Ecore_X_Window_Type));
- if (bd->client.netwm.extra_types)
+ if (ec->netwm.extra_types)
{
for (i = j + 1; i < num; i++)
- bd->client.netwm.extra_types[i - (j + 1)] = types[i];
- bd->client.netwm.extra_types_num = num - j;
+ ec->netwm.extra_types[i - (j + 1)] = types[i];
+ ec->netwm.extra_types_num = num - j;
}
}
free(types);
}
+ ec->dialog = (ec->netwm.type == E_WINDOW_TYPE_DIALOG);
+ if (!ec->dialog)
+ ec->tooltip = (ec->netwm.type == E_WINDOW_TYPE_TOOLTIP);
}
EAPI void
-e_hints_window_state_update(E_Border *bd,
+e_hints_window_state_update(E_Client *ec,
Ecore_X_Window_State state,
Ecore_X_Window_State_Action action)
{
@@ -702,124 +665,124 @@ e_hints_window_state_update(E_Border *bd,
{
case ECORE_X_WINDOW_STATE_ICONIFIED:
if (action != ECORE_X_WINDOW_STATE_ACTION_ADD) return;
- if (bd->client.icccm.state == ECORE_X_WINDOW_STATE_HINT_ICONIC) return;
- if (bd->lock_client_iconify) return;
- e_border_iconify(bd);
+ if (ec->icccm.state == ECORE_X_WINDOW_STATE_HINT_ICONIC) return;
+ if (ec->lock_client_iconify) return;
+ e_client_iconify(ec);
break;
case ECORE_X_WINDOW_STATE_MODAL:
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- if (bd->client.netwm.state.modal)
+ if (ec->netwm.state.modal)
{
- bd->client.netwm.state.modal = 0;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.modal = 0;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
}
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- if (!bd->client.netwm.state.modal)
+ if (!ec->netwm.state.modal)
{
- bd->client.netwm.state.modal = 1;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.modal = 1;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
}
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- bd->client.netwm.state.modal = !bd->client.netwm.state.modal;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.modal = !ec->netwm.state.modal;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
break;
}
break;
case ECORE_X_WINDOW_STATE_STICKY:
- if (bd->lock_client_sticky) return;
+ if (ec->lock_client_sticky) return;
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- e_border_unstick(bd);
+ e_client_unstick(ec);
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- e_border_stick(bd);
+ e_client_stick(ec);
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- if (bd->sticky)
- e_border_unstick(bd);
+ if (ec->sticky)
+ e_client_unstick(ec);
else
- e_border_stick(bd);
+ e_client_stick(ec);
break;
}
break;
case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
- if (bd->lock_client_maximize) return;
+ if (ec->lock_client_maximize) return;
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- if (bd->maximized & E_MAXIMIZE_VERTICAL)
- e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL);
+ if (ec->maximized & E_MAXIMIZE_VERTICAL)
+ e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL);
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- if (!(bd->maximized & E_MAXIMIZE_VERTICAL))
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_VERTICAL);
+ if (!(ec->maximized & E_MAXIMIZE_VERTICAL))
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_VERTICAL);
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- if (bd->maximized & E_MAXIMIZE_VERTICAL)
- e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL);
+ if (ec->maximized & E_MAXIMIZE_VERTICAL)
+ e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL);
else
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_VERTICAL);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_VERTICAL);
break;
}
break;
case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
- if (bd->lock_client_maximize) return;
+ if (ec->lock_client_maximize) return;
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- if (bd->maximized & E_MAXIMIZE_HORIZONTAL)
- e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL);
+ if (ec->maximized & E_MAXIMIZE_HORIZONTAL)
+ e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL);
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- if (!(bd->maximized & E_MAXIMIZE_HORIZONTAL))
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_HORIZONTAL);
+ if (!(ec->maximized & E_MAXIMIZE_HORIZONTAL))
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_HORIZONTAL);
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- if (bd->maximized & E_MAXIMIZE_HORIZONTAL)
- e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL);
+ if (ec->maximized & E_MAXIMIZE_HORIZONTAL)
+ e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL);
else
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_HORIZONTAL);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_HORIZONTAL);
break;
}
break;
case ECORE_X_WINDOW_STATE_SHADED:
- if (bd->lock_client_shade) return;
+ if (ec->lock_client_shade) return;
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- e_border_unshade(bd, e_hints_window_shade_direction_get(bd));
+ e_client_unshade(ec, e_hints_window_shade_direction_get(ec));
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- e_border_shade(bd, e_hints_window_shade_direction_get(bd));
+ e_client_shade(ec, e_hints_window_shade_direction_get(ec));
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- if (bd->shaded)
- e_border_unshade(bd, e_hints_window_shade_direction_get(bd));
+ if (ec->shaded)
+ e_client_unshade(ec, e_hints_window_shade_direction_get(ec));
else
- e_border_shade(bd, e_hints_window_shade_direction_get(bd));
+ e_client_shade(ec, e_hints_window_shade_direction_get(ec));
break;
}
break;
@@ -828,27 +791,27 @@ e_hints_window_state_update(E_Border *bd,
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- if (bd->client.netwm.state.skip_taskbar)
+ if (ec->netwm.state.skip_taskbar)
{
- bd->client.netwm.state.skip_taskbar = 0;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.skip_taskbar = 0;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
}
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- if (!bd->client.netwm.state.skip_taskbar)
+ if (!ec->netwm.state.skip_taskbar)
{
- bd->client.netwm.state.skip_taskbar = 1;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.skip_taskbar = 1;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
}
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- bd->client.netwm.state.skip_taskbar = !bd->client.netwm.state.skip_taskbar;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.skip_taskbar = !ec->netwm.state.skip_taskbar;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
break;
}
break;
@@ -857,27 +820,27 @@ e_hints_window_state_update(E_Border *bd,
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- if (bd->client.netwm.state.skip_pager)
+ if (ec->netwm.state.skip_pager)
{
- bd->client.netwm.state.skip_pager = 0;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.skip_pager = 0;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
}
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- if (!bd->client.netwm.state.skip_pager)
+ if (!ec->netwm.state.skip_pager)
{
- bd->client.netwm.state.skip_pager = 1;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.skip_pager = 1;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
}
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- bd->client.netwm.state.skip_pager = !bd->client.netwm.state.skip_pager;
- bd->client.netwm.update.state = 1;
- bd->changed = 1;
+ ec->netwm.state.skip_pager = !ec->netwm.state.skip_pager;
+ ec->netwm.update.state = 1;
+ EC_CHANGED(ec);
break;
}
break;
@@ -887,68 +850,68 @@ e_hints_window_state_update(E_Border *bd,
break;
case ECORE_X_WINDOW_STATE_FULLSCREEN:
- if (bd->lock_client_fullscreen) return;
+ if (ec->lock_client_fullscreen) return;
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- e_border_unfullscreen(bd);
+ e_client_unfullscreen(ec);
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- e_border_fullscreen(bd, e_config->fullscreen_policy);
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- if (bd->fullscreen)
- e_border_unfullscreen(bd);
+ if (ec->fullscreen)
+ e_client_unfullscreen(ec);
else
- e_border_fullscreen(bd, e_config->fullscreen_policy);
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
break;
}
break;
case ECORE_X_WINDOW_STATE_ABOVE:
- if (bd->lock_client_stacking) return;
+ if (ec->lock_client_stacking) return;
/* FIXME: Should this require that BELOW is set to 0 first, or just
* do it? */
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- e_border_layer_set(bd, E_LAYER_NORMAL);
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- e_border_layer_set(bd, E_LAYER_ABOVE);
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- if (bd->layer == E_LAYER_ABOVE)
- e_border_layer_set(bd, E_LAYER_NORMAL);
+ if (ec->layer == E_LAYER_CLIENT_ABOVE)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
else
- e_border_layer_set(bd, E_LAYER_ABOVE);
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
break;
}
break;
case ECORE_X_WINDOW_STATE_BELOW:
- if (bd->lock_client_stacking) return;
+ if (ec->lock_client_stacking) return;
/* FIXME: Should this require that ABOVE is set to 0 first, or just
* do it? */
switch (action)
{
case ECORE_X_WINDOW_STATE_ACTION_REMOVE:
- e_border_layer_set(bd, E_LAYER_NORMAL);
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- e_border_layer_set(bd, E_LAYER_BELOW);
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_BELOW);
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
- if (bd->layer == E_LAYER_BELOW)
- e_border_layer_set(bd, E_LAYER_NORMAL);
+ if (ec->layer == E_LAYER_CLIENT_BELOW)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
else
- e_border_layer_set(bd, E_LAYER_BELOW);
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_BELOW);
break;
}
break;
@@ -964,23 +927,23 @@ e_hints_window_state_update(E_Border *bd,
}
EAPI void
-e_hints_window_state_get(E_Border *bd)
+e_hints_window_state_get(E_Client *ec)
{
unsigned int i, num;
Ecore_X_Window_State *state;
- bd->client.netwm.state.modal = 0;
- bd->client.netwm.state.sticky = 0;
- bd->client.netwm.state.maximized_v = 0;
- bd->client.netwm.state.maximized_h = 0;
- bd->client.netwm.state.shaded = 0;
- bd->client.netwm.state.skip_taskbar = 0;
- bd->client.netwm.state.skip_pager = 0;
- bd->client.netwm.state.hidden = 0;
- bd->client.netwm.state.fullscreen = 0;
- bd->client.netwm.state.stacking = 0;
-
- ecore_x_netwm_window_state_get(bd->client.win, &state, &num);
+ ec->netwm.state.modal = 0;
+ ec->netwm.state.sticky = 0;
+ ec->netwm.state.maximized_v = 0;
+ ec->netwm.state.maximized_h = 0;
+ ec->netwm.state.shaded = 0;
+ ec->netwm.state.skip_taskbar = 0;
+ ec->netwm.state.skip_pager = 0;
+ ec->netwm.state.hidden = 0;
+ ec->netwm.state.fullscreen = 0;
+ ec->netwm.state.stacking = 0;
+
+ ecore_x_netwm_window_state_get(e_client_util_win_get(ec), &state, &num);
if (state)
{
for (i = 0; i < num; i++)
@@ -992,47 +955,47 @@ e_hints_window_state_get(E_Border *bd)
break;
case ECORE_X_WINDOW_STATE_MODAL:
- bd->client.netwm.state.modal = 1;
+ ec->netwm.state.modal = 1;
break;
case ECORE_X_WINDOW_STATE_STICKY:
- bd->client.netwm.state.sticky = 1;
+ ec->netwm.state.sticky = 1;
break;
case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
- bd->client.netwm.state.maximized_v = 1;
+ ec->netwm.state.maximized_v = 1;
break;
case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
- bd->client.netwm.state.maximized_h = 1;
+ ec->netwm.state.maximized_h = 1;
break;
case ECORE_X_WINDOW_STATE_SHADED:
- bd->client.netwm.state.shaded = 1;
+ ec->netwm.state.shaded = 1;
break;
case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
- bd->client.netwm.state.skip_taskbar = 1;
+ ec->netwm.state.skip_taskbar = 1;
break;
case ECORE_X_WINDOW_STATE_SKIP_PAGER:
- bd->client.netwm.state.skip_pager = 1;
+ ec->netwm.state.skip_pager = 1;
break;
case ECORE_X_WINDOW_STATE_HIDDEN:
- bd->client.netwm.state.hidden = 1;
+ ec->netwm.state.hidden = 1;
break;
case ECORE_X_WINDOW_STATE_FULLSCREEN:
- bd->client.netwm.state.fullscreen = 1;
+ ec->netwm.state.fullscreen = 1;
break;
case ECORE_X_WINDOW_STATE_ABOVE:
- bd->client.netwm.state.stacking = E_STACKING_ABOVE;
+ ec->netwm.state.stacking = E_STACKING_ABOVE;
break;
case ECORE_X_WINDOW_STATE_BELOW:
- bd->client.netwm.state.stacking = E_STACKING_BELOW;
+ ec->netwm.state.stacking = E_STACKING_BELOW;
break;
case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
@@ -1049,7 +1012,7 @@ e_hints_window_state_get(E_Border *bd)
}
EAPI void
-e_hints_allowed_action_update(E_Border *bd __UNUSED__,
+e_hints_allowed_action_update(E_Client *ec __UNUSED__,
Ecore_X_Action action)
{
switch (action)
@@ -1093,24 +1056,24 @@ e_hints_allowed_action_update(E_Border *bd __UNUSED__,
}
EAPI void
-e_hints_allowed_action_get(E_Border *bd)
+e_hints_allowed_action_get(E_Client *ec)
{
Ecore_X_Action *action;
unsigned int i;
unsigned int num;
- bd->client.netwm.action.move = 0;
- bd->client.netwm.action.resize = 0;
- bd->client.netwm.action.minimize = 0;
- bd->client.netwm.action.shade = 0;
- bd->client.netwm.action.stick = 0;
- bd->client.netwm.action.maximized_h = 0;
- bd->client.netwm.action.maximized_v = 0;
- bd->client.netwm.action.fullscreen = 0;
- bd->client.netwm.action.change_desktop = 0;
- bd->client.netwm.action.close = 0;
-
- ecore_x_netwm_allowed_action_get(bd->client.win, &action, &num);
+ ec->netwm.action.move = 0;
+ ec->netwm.action.resize = 0;
+ ec->netwm.action.minimize = 0;
+ ec->netwm.action.shade = 0;
+ ec->netwm.action.stick = 0;
+ ec->netwm.action.maximized_h = 0;
+ ec->netwm.action.maximized_v = 0;
+ ec->netwm.action.fullscreen = 0;
+ ec->netwm.action.change_desktop = 0;
+ ec->netwm.action.close = 0;
+
+ ecore_x_netwm_allowed_action_get(e_client_util_win_get(ec), &action, &num);
if (action)
{
for (i = 0; i < num; i++)
@@ -1118,43 +1081,43 @@ e_hints_allowed_action_get(E_Border *bd)
switch (action[i])
{
case ECORE_X_ACTION_MOVE:
- bd->client.netwm.action.move = 1;
+ ec->netwm.action.move = 1;
break;
case ECORE_X_ACTION_RESIZE:
- bd->client.netwm.action.resize = 1;
+ ec->netwm.action.resize = 1;
break;
case ECORE_X_ACTION_MINIMIZE:
- bd->client.netwm.action.minimize = 1;
+ ec->netwm.action.minimize = 1;
break;
case ECORE_X_ACTION_SHADE:
- bd->client.netwm.action.shade = 1;
+ ec->netwm.action.shade = 1;
break;
case ECORE_X_ACTION_STICK:
- bd->client.netwm.action.stick = 1;
+ ec->netwm.action.stick = 1;
break;
case ECORE_X_ACTION_MAXIMIZE_HORZ:
- bd->client.netwm.action.maximized_h = 1;
+ ec->netwm.action.maximized_h = 1;
break;
case ECORE_X_ACTION_MAXIMIZE_VERT:
- bd->client.netwm.action.maximized_v = 1;
+ ec->netwm.action.maximized_v = 1;
break;
case ECORE_X_ACTION_FULLSCREEN:
- bd->client.netwm.action.fullscreen = 1;
+ ec->netwm.action.fullscreen = 1;
break;
case ECORE_X_ACTION_CHANGE_DESKTOP:
- bd->client.netwm.action.change_desktop = 1;
+ ec->netwm.action.change_desktop = 1;
break;
case ECORE_X_ACTION_CLOSE:
- bd->client.netwm.action.close = 1;
+ ec->netwm.action.close = 1;
break;
case ECORE_X_ACTION_ABOVE:
@@ -1169,105 +1132,103 @@ e_hints_allowed_action_get(E_Border *bd)
}
static void
-_e_hints_process_wakeup(E_Border *bd)
+_e_hints_process_wakeup(E_Client *ec)
{
// check for e vkbd state property - if its there, it's efl, so sending a
// a fake sigchild to wake things up os just fine
- if (!bd->client.vkbd.have_property) return;
- if (bd->client.netwm.pid <= 0) return;
+ if (!ec->vkbd.have_property) return;
+ if (ec->netwm.pid <= 0) return;
#ifdef SIGCHLD
- kill(bd->client.netwm.pid, SIGCHLD);
+ kill(ec->netwm.pid, SIGCHLD);
#endif
}
EAPI void
-e_hints_window_visible_set(E_Border *bd)
+e_hints_window_visible_set(E_Client *ec)
{
- if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL)
+ if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL)
{
- ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_NORMAL);
- bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
+ ecore_x_icccm_state_set(e_client_util_win_get(ec), ECORE_X_WINDOW_STATE_HINT_NORMAL);
+ ec->icccm.state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
}
- if (bd->client.netwm.state.hidden)
+ if (ec->netwm.state.hidden)
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.hidden = 0;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.hidden = 0;
+ EC_CHANGED(ec);
}
- _e_hints_process_wakeup(bd);
+ _e_hints_process_wakeup(ec);
}
EAPI void
-e_hints_window_iconic_set(E_Border *bd)
+e_hints_window_iconic_set(E_Client *ec)
{
- if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_ICONIC)
+ if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_ICONIC)
{
- ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_ICONIC);
- bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
+ ecore_x_icccm_state_set(e_client_util_win_get(ec), ECORE_X_WINDOW_STATE_HINT_ICONIC);
+ ec->icccm.state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
}
- if (!bd->client.netwm.state.hidden)
+ if (!ec->netwm.state.hidden)
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.hidden = 1;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.hidden = 1;
+ EC_CHANGED(ec);
}
- _e_hints_process_wakeup(bd);
+ _e_hints_process_wakeup(ec);
}
EAPI void
-e_hints_window_hidden_set(E_Border *bd)
+e_hints_window_hidden_set(E_Client *ec)
{
- if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
+ if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
{
- ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_WITHDRAWN);
- bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
+ ecore_x_icccm_state_set(e_client_util_win_get(ec), ECORE_X_WINDOW_STATE_HINT_WITHDRAWN);
+ ec->icccm.state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
}
- if (bd->client.netwm.state.hidden)
+ if (ec->netwm.state.hidden)
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.hidden = 0;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.hidden = 0;
+ EC_CHANGED(ec);
}
- _e_hints_process_wakeup(bd);
+ _e_hints_process_wakeup(ec);
}
EAPI void
-e_hints_window_shaded_set(E_Border *bd,
- int on)
+e_hints_window_shaded_set(E_Client *ec, int on)
{
- if ((!bd->client.netwm.state.shaded) && (on))
+ if ((!ec->netwm.state.shaded) && (on))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.shaded = 1;
- if (bd->client.hacks.iconic_shading)
- e_hints_window_iconic_set(bd);
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.shaded = 1;
+ if (ec->hacks.iconic_shading)
+ e_hints_window_iconic_set(ec);
+ EC_CHANGED(ec);
}
- else if ((bd->client.netwm.state.shaded) && (!on))
+ else if ((ec->netwm.state.shaded) && (!on))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.shaded = 0;
- if (bd->client.hacks.iconic_shading)
- e_hints_window_visible_set(bd);
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.shaded = 0;
+ if (ec->hacks.iconic_shading)
+ e_hints_window_visible_set(ec);
+ EC_CHANGED(ec);
}
- _e_hints_process_wakeup(bd);
+ _e_hints_process_wakeup(ec);
}
EAPI void
-e_hints_window_shade_direction_set(E_Border *bd,
- E_Direction dir)
+e_hints_window_shade_direction_set(E_Client *ec, E_Direction dir)
{
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_SHADE_DIRECTION, &dir, 1);
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_SHADE_DIRECTION, &dir, 1);
}
EAPI E_Direction
-e_hints_window_shade_direction_get(E_Border *bd)
+e_hints_window_shade_direction_get(E_Client *ec)
{
int ret;
E_Direction dir;
- ret = ecore_x_window_prop_card32_get(bd->client.win,
+ ret = ecore_x_window_prop_card32_get(e_client_util_win_get(ec),
E_ATOM_SHADE_DIRECTION,
&dir, 1);
if (ret == 1)
@@ -1277,145 +1238,141 @@ e_hints_window_shade_direction_get(E_Border *bd)
}
EAPI void
-e_hints_window_size_set(E_Border *bd)
+e_hints_window_size_set(E_Client *ec)
{
unsigned int sizes[4];
- sizes[0] = bd->x;
- sizes[1] = bd->y;
- sizes[2] = bd->w;
- sizes[3] = bd->h;
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_BORDER_SIZE, sizes, 4);
+ sizes[0] = ec->x;
+ sizes[1] = ec->y;
+ sizes[2] = ec->w;
+ sizes[3] = ec->h;
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_BORDER_SIZE, sizes, 4);
}
EAPI void
-e_hints_window_size_unset(E_Border *bd)
+e_hints_window_size_unset(E_Client *ec)
{
- ecore_x_window_prop_property_del(bd->client.win, E_ATOM_BORDER_SIZE);
+ ecore_x_window_prop_property_del(e_client_util_win_get(ec), E_ATOM_BORDER_SIZE);
}
EAPI int
-e_hints_window_size_get(E_Border *bd)
+e_hints_window_size_get(E_Client *ec)
{
int ret;
unsigned int sizes[4];
memset(sizes, 0, sizeof(sizes));
- ret = ecore_x_window_prop_card32_get(bd->client.win, E_ATOM_BORDER_SIZE,
+ ret = ecore_x_window_prop_card32_get(e_client_util_win_get(ec), E_ATOM_BORDER_SIZE,
sizes, 4);
if (ret != 4)
return 0;
- bd->x = sizes[0];
- bd->y = sizes[1];
- bd->w = sizes[2];
- bd->h = sizes[3];
+ ec->x = sizes[0];
+ ec->y = sizes[1];
+ ec->w = sizes[2];
+ ec->h = sizes[3];
return 1;
}
EAPI void
-e_hints_window_maximized_set(E_Border *bd,
- int horizontal,
- int vertical)
+e_hints_window_maximized_set(E_Client *ec, int horizontal, int vertical)
{
- if ((horizontal) && (!bd->client.netwm.state.maximized_h))
+ if ((horizontal) && (!ec->netwm.state.maximized_h))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.maximized_h = 1;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.maximized_h = 1;
+ EC_CHANGED(ec);
}
- else if ((!horizontal) && (bd->client.netwm.state.maximized_h))
+ else if ((!horizontal) && (ec->netwm.state.maximized_h))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.maximized_h = 0;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.maximized_h = 0;
+ EC_CHANGED(ec);
}
- if ((vertical) && (!bd->client.netwm.state.maximized_v))
+ if ((vertical) && (!ec->netwm.state.maximized_v))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.maximized_v = 1;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.maximized_v = 1;
+ EC_CHANGED(ec);
}
- else if ((!vertical) && (bd->client.netwm.state.maximized_v))
+ else if ((!vertical) && (ec->netwm.state.maximized_v))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.maximized_v = 0;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.maximized_v = 0;
+ EC_CHANGED(ec);
}
}
EAPI void
-e_hints_window_fullscreen_set(E_Border *bd,
+e_hints_window_fullscreen_set(E_Client *ec,
int on)
{
- if ((!bd->client.netwm.state.fullscreen) && (on))
+ if ((!ec->netwm.state.fullscreen) && (on))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.fullscreen = 1;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.fullscreen = 1;
+ EC_CHANGED(ec);
}
- else if ((bd->client.netwm.state.fullscreen) && (!on))
+ else if ((ec->netwm.state.fullscreen) && (!on))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.fullscreen = 0;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.fullscreen = 0;
+ EC_CHANGED(ec);
}
}
EAPI void
-e_hints_window_sticky_set(E_Border *bd,
- int on)
+e_hints_window_sticky_set(E_Client *ec, int on)
{
- if ((!bd->client.netwm.state.sticky) && (on))
+ if ((!ec->netwm.state.sticky) && (on))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.sticky = 1;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.sticky = 1;
+ EC_CHANGED(ec);
}
- else if ((bd->client.netwm.state.sticky) && (!on))
+ else if ((ec->netwm.state.sticky) && (!on))
{
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.sticky = 0;
- bd->changed = 1;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.sticky = 0;
+ EC_CHANGED(ec);
}
}
EAPI void
-e_hints_window_stacking_set(E_Border *bd,
- E_Stacking stacking)
+e_hints_window_stacking_set(E_Client *ec, E_Stacking stacking)
{
- if (bd->client.netwm.state.stacking == stacking) return;
- bd->client.netwm.update.state = 1;
- bd->client.netwm.state.stacking = stacking;
- bd->changed = 1;
+ if (ec->netwm.state.stacking == stacking) return;
+ ec->netwm.update.state = 1;
+ ec->netwm.state.stacking = stacking;
+ EC_CHANGED(ec);
}
EAPI void
-e_hints_window_desktop_set(E_Border *bd)
+e_hints_window_desktop_set(E_Client *ec)
{
/* This function is only called when really changing desktop,
* so just set the property and don't care about the roundtrip.
*/
unsigned int deskpos[2];
- /* if valgrind complains here it is complaining bd->client.netwm.desktop
+ /* if valgrind complains here it is complaining ec->netwm.desktop
* is an uninitialised variable - but it isn't. it can't be. its part of
* a calloc()'d struct and thus has to have been set to 0. hell even
- * e_border.c explicitly sets it to 0 on creation of the border object.
+ * e_client.c explicitly sets it to 0 on creation of the border object.
*/
- deskpos[0] = bd->desk->x;
- deskpos[1] = bd->desk->y;
- ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_DESK, deskpos, 2);
+ deskpos[0] = ec->desk->x;
+ deskpos[1] = ec->desk->y;
+ ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_DESK, deskpos, 2);
#if 0
- ecore_x_netwm_desktop_set(bd->client.win, current);
+ ecore_x_netwm_desktop_set(e_client_util_win_get(ec), current);
#endif
- bd->client.netwm.desktop = (bd->desk->y * bd->zone->desk_x_count) + bd->desk->x;
+ ec->netwm.desktop = (ec->desk->y * ec->zone->desk_x_count) + ec->desk->x;
}
EAPI void
-e_hints_window_e_state_get(E_Border *bd)
+e_hints_window_e_state_get(E_Client *ec)
{
/* Remember to update the count if we add more states! */
Ecore_X_Atom state[1];
@@ -1428,62 +1385,62 @@ e_hints_window_e_state_get(E_Border *bd)
size = (sizeof(state) / sizeof(state[0]));
num =
- ecore_x_window_prop_card32_get(bd->client.win, E_ATOM_WINDOW_STATE,
+ ecore_x_window_prop_card32_get(e_client_util_win_get(ec), E_ATOM_WINDOW_STATE,
state, size);
if (!num) return;
for (i = 0; (i < num) && (i < size); i++)
{
if (state[i] == E_ATOM_WINDOW_STATE_CENTERED)
- bd->client.e.state.centered = 1;
+ ec->e.state.centered = 1;
}
}
EAPI void
-e_hints_window_e_state_set(E_Border *bd __UNUSED__)
+e_hints_window_e_state_set(E_Client *ec __UNUSED__)
{
/* TODO */
}
EAPI void
-e_hints_window_qtopia_soft_menu_get(E_Border *bd)
+e_hints_window_qtopia_soft_menu_get(E_Client *ec)
{
unsigned int val;
- if (ecore_x_window_prop_card32_get(bd->client.win, ATM__QTOPIA_SOFT_MENU, &val, 1))
- bd->client.qtopia.soft_menu = val;
+ if (ecore_x_window_prop_card32_get(e_client_util_win_get(ec), ATM__QTOPIA_SOFT_MENU, &val, 1))
+ ec->qtopia.soft_menu = val;
else
- bd->client.qtopia.soft_menu = 0;
+ ec->qtopia.soft_menu = 0;
}
EAPI void
-e_hints_window_qtopia_soft_menus_get(E_Border *bd)
+e_hints_window_qtopia_soft_menus_get(E_Client *ec)
{
unsigned int val;
- if (ecore_x_window_prop_card32_get(bd->client.win, ATM__QTOPIA_SOFT_MENUS, &val, 1))
- bd->client.qtopia.soft_menus = val;
+ if (ecore_x_window_prop_card32_get(e_client_util_win_get(ec), ATM__QTOPIA_SOFT_MENUS, &val, 1))
+ ec->qtopia.soft_menus = val;
else
- bd->client.qtopia.soft_menus = 0;
+ ec->qtopia.soft_menus = 0;
}
EAPI void
-e_hints_window_virtual_keyboard_state_get(E_Border *bd)
+e_hints_window_virtual_keyboard_state_get(E_Client *ec)
{
Ecore_X_Atom atom = 0;
- bd->client.vkbd.state = ecore_x_e_virtual_keyboard_state_get(bd->client.win);
- if (ecore_x_window_prop_atom_get(bd->client.win,
+ ec->vkbd.state = ecore_x_e_virtual_keyboard_state_get(e_client_util_win_get(ec));
+ if (ecore_x_window_prop_atom_get(e_client_util_win_get(ec),
ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
&atom, 1))
- bd->client.vkbd.have_property = 1;
+ ec->vkbd.have_property = 1;
else
- bd->client.vkbd.have_property = 0;
+ ec->vkbd.have_property = 0;
}
EAPI void
-e_hints_window_virtual_keyboard_get(E_Border *bd)
+e_hints_window_virtual_keyboard_get(E_Client *ec)
{
- bd->client.vkbd.vkbd = ecore_x_e_virtual_keyboard_get(bd->client.win);
+ ec->vkbd.vkbd = ecore_x_e_virtual_keyboard_get(e_client_util_win_get(ec));
}
EAPI void
@@ -1507,17 +1464,11 @@ e_hints_openoffice_kde_fake(Ecore_X_Window root)
EAPI void
e_hints_scale_update(void)
{
- Ecore_X_Window *roots = NULL;
- int i, num;
- unsigned int scale;
+ E_Comp *c;
+ const Eina_List *l;
+ unsigned int scale = e_scale * 1000;
- roots = ecore_x_window_root_list(&num);
- if (roots)
- {
- scale = e_scale * 1000;
- for (i = 0; i < num; i++)
- ecore_x_window_prop_card32_set(roots[i], ATM_ENLIGHTENMENT_SCALE, &scale, 1);
- free(roots);
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ ecore_x_window_prop_card32_set(c->man->root, ATM_ENLIGHTENMENT_SCALE, &scale, 1);
}
diff --git a/src/bin/e_hints.h b/src/bin/e_hints.h
index a4746dd1a7..d945df5f43 100644
--- a/src/bin/e_hints.h
+++ b/src/bin/e_hints.h
@@ -3,49 +3,49 @@
#ifndef E_HINTS_H
#define E_HINTS_H
-EINTERN void e_hints_init(void);
-EAPI void e_hints_e16_comms_pretend(E_Manager *man);
+EINTERN void e_hints_init(Ecore_X_Window win, Ecore_X_Window propwin);
+EAPI void e_hints_e16_comms_pretend(Ecore_X_Window root, Ecore_X_Window propwin);
EINTERN void e_hints_manager_init(E_Manager *man);
EAPI void e_hints_client_list_set(void);
EAPI void e_hints_client_stacking_set(void);
-EAPI void e_hints_active_window_set(E_Manager *man, E_Border *bd);
+EAPI void e_hints_active_window_set(E_Manager *man, E_Client *ec);
-EINTERN void e_hints_window_init(E_Border *bd);
-EAPI void e_hints_window_state_set(E_Border *bd);
-EAPI void e_hints_window_state_get(E_Border *bd);
-EAPI void e_hints_window_type_set(E_Border *bd);
-EAPI void e_hints_window_type_get(E_Border *bd);
+EINTERN void e_hints_window_init(E_Client *ec);
+EAPI void e_hints_window_state_set(E_Client *ec);
+EAPI void e_hints_window_state_get(E_Client *ec);
+EAPI void e_hints_window_type_set(E_Client *ec);
+EAPI void e_hints_window_type_get(E_Client *ec);
-EAPI void e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
+EAPI void e_hints_window_state_update(E_Client *ec, Ecore_X_Window_State state,
Ecore_X_Window_State_Action action);
-EAPI void e_hints_window_visible_set(E_Border *bd);
-EAPI void e_hints_window_iconic_set(E_Border *bd);
-EAPI void e_hints_window_hidden_set(E_Border *bd);
+EAPI void e_hints_window_visible_set(E_Client *ec);
+EAPI void e_hints_window_iconic_set(E_Client *ec);
+EAPI void e_hints_window_hidden_set(E_Client *ec);
-EAPI void e_hints_window_shade_direction_set(E_Border *bd, E_Direction dir);
-EAPI E_Direction e_hints_window_shade_direction_get(E_Border *bd);
+EAPI void e_hints_window_shade_direction_set(E_Client *ec, E_Direction dir);
+EAPI E_Direction e_hints_window_shade_direction_get(E_Client *ec);
-EAPI void e_hints_window_size_set(E_Border *bd);
-EAPI void e_hints_window_size_unset(E_Border *bd);
-EAPI int e_hints_window_size_get(E_Border *bd);
+EAPI void e_hints_window_size_set(E_Client *ec);
+EAPI void e_hints_window_size_unset(E_Client *ec);
+EAPI int e_hints_window_size_get(E_Client *ec);
-EAPI void e_hints_window_shaded_set(E_Border *bd, int on);
-EAPI void e_hints_window_maximized_set(E_Border *bd, int horizontal, int vertical);
-EAPI void e_hints_window_fullscreen_set(E_Border *bd, int on);
-EAPI void e_hints_window_sticky_set(E_Border *bd, int on);
-EAPI void e_hints_window_stacking_set(E_Border *bd, E_Stacking stacking);
-EAPI void e_hints_window_desktop_set(E_Border *bd);
+EAPI void e_hints_window_shaded_set(E_Client *ec, int on);
+EAPI void e_hints_window_maximized_set(E_Client *ec, int horizontal, int vertical);
+EAPI void e_hints_window_fullscreen_set(E_Client *ec, int on);
+EAPI void e_hints_window_sticky_set(E_Client *ec, int on);
+EAPI void e_hints_window_stacking_set(E_Client *ec, E_Stacking stacking);
+EAPI void e_hints_window_desktop_set(E_Client *ec);
-EAPI void e_hints_window_e_state_set(E_Border *bd);
-EAPI void e_hints_window_e_state_get(E_Border *bd);
+EAPI void e_hints_window_e_state_set(E_Client *ec);
+EAPI void e_hints_window_e_state_get(E_Client *ec);
-EAPI void e_hints_window_qtopia_soft_menu_get(E_Border *bd);
-EAPI void e_hints_window_qtopia_soft_menus_get(E_Border *bd);
+EAPI void e_hints_window_qtopia_soft_menu_get(E_Client *ec);
+EAPI void e_hints_window_qtopia_soft_menus_get(E_Client *ec);
-EAPI void e_hints_window_virtual_keyboard_state_get(E_Border *bd);
-EAPI void e_hints_window_virtual_keyboard_get(E_Border *bd);
+EAPI void e_hints_window_virtual_keyboard_state_get(E_Client *ec);
+EAPI void e_hints_window_virtual_keyboard_get(E_Client *ec);
EAPI void e_hints_openoffice_gnome_fake(Ecore_X_Window root);
EAPI void e_hints_openoffice_kde_fake(Ecore_X_Window root);
diff --git a/src/bin/e_import_config_dialog.c b/src/bin/e_import_config_dialog.c
index 5248f61203..e29afdf306 100644
--- a/src/bin/e_import_config_dialog.c
+++ b/src/bin/e_import_config_dialog.c
@@ -393,8 +393,11 @@ static void
_e_import_config_dia_del(void *data)
{
E_Dialog *dia = data;
+ E_Import_Config_Dialog *import;
- e_object_del(dia->data);
+ import = dia->data;
+ dia->data = NULL;
+ e_object_del(E_OBJECT(import));
}
static void
@@ -421,6 +424,7 @@ _e_import_config_dialog_win_del(E_Win *win)
dia = win->data;
import = dia->data;
+ if (!import) return;
e_object_ref(E_OBJECT(import));
if (import->cancel) import->cancel(import);
e_object_del(E_OBJECT(import));
@@ -430,7 +434,7 @@ _e_import_config_dialog_win_del(E_Win *win)
///////////////////////////////////////////////////////////////////////////////////
EAPI E_Import_Config_Dialog *
-e_import_config_dialog_show(E_Container *con, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel)
+e_import_config_dialog_show(E_Comp *c, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel)
{
Evas *evas;
E_Dialog *dia;
@@ -444,7 +448,7 @@ e_import_config_dialog_show(E_Container *con, const char *path, Ecore_End_Cb ok,
import = E_OBJECT_ALLOC(E_Import_Config_Dialog, E_IMPORT_CONFIG_DIALOG_TYPE, _e_import_config_dialog_del);
if (!import) return NULL;
- dia = e_dialog_new(con, "E", "_import_config_dialog");
+ dia = e_dialog_new(c, "E", "_import_config_dialog");
if (!dia)
{
e_object_del(E_OBJECT(import));
diff --git a/src/bin/e_import_config_dialog.h b/src/bin/e_import_config_dialog.h
index 0bf09e1219..805998e237 100644
--- a/src/bin/e_import_config_dialog.h
+++ b/src/bin/e_import_config_dialog.h
@@ -26,7 +26,7 @@ struct _E_Import_Config_Dialog
E_Dialog *dia;
};
-EAPI E_Import_Config_Dialog *e_import_config_dialog_show(E_Container *con, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel);
+EAPI E_Import_Config_Dialog *e_import_config_dialog_show(E_Comp *c, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel);
#endif
#endif
diff --git a/src/bin/e_import_dialog.c b/src/bin/e_import_dialog.c
index 9b29932b27..c08682125d 100644
--- a/src/bin/e_import_dialog.c
+++ b/src/bin/e_import_dialog.c
@@ -54,7 +54,7 @@ _fsel_cb_ok(void *data, E_Dialog *dia __UNUSED__)
if ((p) && (strcasecmp(p, ".edj")))
{
E_Import_Config_Dialog *import;
- import = e_import_config_dialog_show(id->dia->win->container, path, _import_ok, NULL);
+ import = e_import_config_dialog_show(id->dia->win->comp, path, _import_ok, NULL);
e_dialog_parent_set(import->dia, id->dia->win);
e_object_data_set(E_OBJECT(import), id);
return;
@@ -103,8 +103,11 @@ static void
_e_import_dia_del(void *data)
{
E_Dialog *dia = data;
+ E_Import_Dialog *id;
- e_object_del(dia->data);
+ id = dia->data;
+ dia->data = NULL;
+ e_object_del(E_OBJECT(id));
}
static void
@@ -125,13 +128,14 @@ _e_import_dialog_win_del(E_Win *win)
dia = win->data;
id = dia->data;
- e_object_del(E_OBJECT(id));
+ if (id)
+ e_object_del(E_OBJECT(id));
}
//////////////////////////////////////////////////////////////////////////////////
EAPI E_Import_Dialog *
-e_import_dialog_show(E_Container *con, const char *dev, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel)
+e_import_dialog_show(E_Comp *c, const char *dev, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel)
{
Evas *evas;
E_Import_Dialog *id;
@@ -144,7 +148,7 @@ e_import_dialog_show(E_Container *con, const char *dev, const char *path, Ecore_
id = E_OBJECT_ALLOC(E_Import_Dialog, E_IMPORT_DIALOG_TYPE, _e_import_dialog_del);
if (!id) return NULL;
- dia = e_dialog_new(con, "E", "_import_fsel_dialog");
+ dia = e_dialog_new(c, "E", "_import_fsel_dialog");
if (!dia)
{
e_object_del(E_OBJECT(id));
diff --git a/src/bin/e_import_dialog.h b/src/bin/e_import_dialog.h
index 5e3e227528..6722cb8629 100644
--- a/src/bin/e_import_dialog.h
+++ b/src/bin/e_import_dialog.h
@@ -15,7 +15,7 @@ struct _E_Import_Dialog
E_Dialog *dia;
};
-EAPI E_Import_Dialog *e_import_dialog_show(E_Container *con, const char *dev, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel);
+EAPI E_Import_Dialog *e_import_dialog_show(E_Comp *c, const char *dev, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel);
#endif
#endif
diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h
index 8cb36ee5bd..cba8d036bc 100644
--- a/src/bin/e_includes.h
+++ b/src/bin/e_includes.h
@@ -5,10 +5,11 @@
#include "e_path.h"
#include "e_ipc.h"
#include "e_error.h"
-#include "e_container.h"
#include "e_zone.h"
#include "e_desk.h"
-#include "e_border.h"
+#include "e_pixmap.h"
+#include "e_comp_object.h"
+#include "e_client.h"
#include "e_pointer.h"
#include "e_config.h"
#include "e_config_data.h"
@@ -21,7 +22,6 @@
#include "e_int_menus.h"
#include "e_module.h"
#include "e_atoms.h"
-#include "e_utils.h"
#include "e_canvas.h"
#include "e_focus.h"
#include "e_place.h"
@@ -41,7 +41,6 @@
#include "e_bindings.h"
#include "e_moveresize.h"
#include "e_actions.h"
-#include "e_popup.h"
#include "e_gadcon_popup.h"
#include "e_ipc_codec.h"
#include "e_test.h"
@@ -72,12 +71,12 @@
#include "e_widget_entry.h"
#include "e_widget_image.h"
#include "e_config_dialog.h"
-#include "e_int_border_locks.h"
+#include "e_int_client_locks.h"
#include "e_thumb.h"
-#include "e_int_border_remember.h"
+#include "e_int_client_remember.h"
#include "e_desktop_editor.h"
#include "e_scrollframe.h"
-#include "e_int_border_menu.h"
+#include "e_int_client_menu.h"
#include "e_ilist.h"
#include "e_livethumb.h"
#include "e_widget_ilist.h"
@@ -91,14 +90,13 @@
#include "e_exehist.h"
#include "e_color_class.h"
#include "e_widget_textblock.h"
-#include "e_stolen.h"
#include "e_gadcon.h"
#include "e_shelf.h"
#include "e_widget_preview.h"
#include "e_int_shelf_config.h"
#include "e_int_gadcon_config.h"
#include "e_confirm_dialog.h"
-#include "e_int_border_prop.h"
+#include "e_int_client_prop.h"
#include "e_entry_dialog.h"
#include "e_fm.h"
#include "e_fm_op_registry.h"
@@ -153,4 +151,5 @@
#include "e_notification.h"
#include "e_comp.h"
#include "e_comp_cfdata.h"
-#include "e_comp_render_update.h"
+#include "e_comp_canvas.h"
+#include "e_utils.h"
diff --git a/src/bin/e_init.c b/src/bin/e_init.c
index e1755ffd1b..a7e3fd5c00 100644
--- a/src/bin/e_init.c
+++ b/src/bin/e_init.c
@@ -45,30 +45,28 @@ EAPI void
e_init_show(void)
{
Evas_Object *o;
- E_Manager *man;
- E_Container *con;
+ E_Comp *c;
E_Zone *zone;
Eina_List *l;
/* exec init */
/* extra screens */
- EINA_LIST_FOREACH(e_manager_list()->next, l, man)
+ EINA_LIST_FOREACH(e_comp_list()->next, l, c)
{
- o = edje_object_add(e_comp_get(man)->evas);
+ o = edje_object_add(c->evas);
e_theme_edje_object_set(o, NULL, "e/init/extra_screen");
evas_object_name_set(o, "_e_init_extra_screen");
evas_object_move(o, 0, 0);
- evas_object_resize(o, man->w, man->h);
- evas_object_layer_set(o, E_COMP_CANVAS_LAYER_MAX);
+ evas_object_resize(o, c->man->w, c->man->h);
+ evas_object_layer_set(o, E_LAYER_MAX);
evas_object_show(o);
splash_objs = eina_list_append(splash_objs, o);
}
- man = eina_list_data_get(e_manager_list());
- con = eina_list_data_get(man->containers);
- EINA_LIST_FOREACH(con->zones, l, zone)
+ c = eina_list_data_get(e_comp_list());
+ EINA_LIST_FOREACH(c->zones, l, zone)
{
- o = edje_object_add(e_comp_get(man)->evas);
+ o = edje_object_add(c->evas);
if (!zone->num)
{
e_theme_edje_object_set(o, NULL, "e/init/splash");
@@ -84,7 +82,7 @@ e_init_show(void)
fprintf(stderr, "zone %p: %i %i %ix%i\n", zone, zone->x, zone->y, zone->w, zone->h);
evas_object_move(o, zone->x, zone->y);
evas_object_resize(o, zone->w, zone->h);
- evas_object_layer_set(o, E_COMP_CANVAS_LAYER_MAX);
+ evas_object_layer_set(o, E_LAYER_MAX);
evas_object_show(o);
splash_objs = eina_list_append(splash_objs, o);
}
@@ -101,6 +99,7 @@ EAPI void
e_init_hide(void)
{
E_FREE_LIST(splash_objs, evas_object_del);
+ E_LIST_FOREACH(e_comp_list(), e_comp_shape_queue);
_e_init_object = NULL;
E_FREE_FUNC(_e_init_timeout_timer, ecore_timer_del);
}
diff --git a/src/bin/e_int_border_menu.h b/src/bin/e_int_border_menu.h
deleted file mode 100644
index 1508246803..0000000000
--- a/src/bin/e_int_border_menu.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifdef E_TYPEDEFS
-
-#else
-#ifndef E_INT_BORDER_MENU_H
-#define E_INT_BORDER_MENU_H
-
-typedef void (*E_Border_Menu_Hook_Cb)(void *, E_Border *);
-typedef struct E_Border_Menu_Hook
-{
- E_Border_Menu_Hook_Cb cb;
- void *data;
-} E_Border_Menu_Hook;
-
-EAPI E_Border_Menu_Hook *e_int_border_menu_hook_add(E_Border_Menu_Hook_Cb cb, const void *data);
-EAPI void e_int_border_menu_hook_del(E_Border_Menu_Hook *hook);
-EAPI void e_int_border_menu_hooks_clear(void);
-EAPI void e_int_border_menu_create(E_Border *bd);
-EAPI void e_int_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key, Ecore_X_Time timestamp);
-EAPI void e_int_border_menu_del(E_Border *bd);
-
-#endif
-#endif
diff --git a/src/bin/e_int_border_remember.h b/src/bin/e_int_border_remember.h
deleted file mode 100644
index 460036fc2b..0000000000
--- a/src/bin/e_int_border_remember.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifdef E_TYPEDEFS
-#else
-#ifndef E_INT_BORDER_REMEMBER_H
-#define E_INT_BORDER_REMEMBER_H
-
-EAPI void e_int_border_remember(E_Border *bd);
-EAPI E_Config_Dialog *e_int_border_remember_edit(E_Remember *rem);
-
-#endif
-#endif
diff --git a/src/bin/e_int_border_locks.c b/src/bin/e_int_client_locks.c
index a7f267c08d..a15b28ec2f 100644
--- a/src/bin/e_int_border_locks.c
+++ b/src/bin/e_int_client_locks.c
@@ -11,7 +11,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E
/* Actual config data we will be playing with whil the dialog is active */
struct _E_Config_Dialog_Data
{
- E_Border *border;
+ E_Client *client;
/*- BASIC -*/
int do_what_i_say;
int protect_from_me;
@@ -45,7 +45,7 @@ struct _E_Config_Dialog_Data
/* a nice easy setup function that does the dirty work */
EAPI void
-e_int_border_locks(E_Border *bd)
+e_int_client_locks(E_Client *ec)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
@@ -62,11 +62,11 @@ e_int_border_locks(E_Border *bd)
v->advanced.create_widgets = _advanced_create_widgets;
v->override_auto_apply = 1;
/* create config diaolg for bd object/data */
- cfd = e_config_dialog_new(bd->zone->container,
+ cfd = e_config_dialog_new(ec->comp,
_("Window Locks"),
"E", "_border_locks_dialog",
- NULL, 0, v, bd);
- bd->border_locks_dialog = cfd;
+ NULL, 0, v, ec);
+ ec->border_locks_dialog = cfd;
}
}
@@ -74,31 +74,31 @@ e_int_border_locks(E_Border *bd)
static void
_fill_data(E_Config_Dialog_Data *cfdata)
{
- cfdata->lock.user.location = (int)cfdata->border->lock_user_location & 0x1;
- cfdata->lock.user.size = (int)cfdata->border->lock_user_size & 0x1;
- cfdata->lock.user.stacking = (int)cfdata->border->lock_user_stacking & 0x1;
- cfdata->lock.user.iconify = (int)cfdata->border->lock_user_iconify & 0x1;
- cfdata->lock.user.desk = (int)cfdata->border->lock_user_desk & 0x1;
- cfdata->lock.user.sticky = (int)cfdata->border->lock_user_sticky & 0x1;
- cfdata->lock.user.shade = (int)cfdata->border->lock_user_shade & 0x1;
- cfdata->lock.user.maximize = (int)cfdata->border->lock_user_maximize & 0x1;
- cfdata->lock.user.fullscreen = (int)cfdata->border->lock_user_fullscreen & 0x1;
- cfdata->lock.client.location = (int)cfdata->border->lock_client_location & 0x1;
- cfdata->lock.client.size = (int)cfdata->border->lock_client_size & 0x1;
- cfdata->lock.client.stacking = (int)cfdata->border->lock_client_stacking & 0x1;
- cfdata->lock.client.iconify = (int)cfdata->border->lock_client_iconify & 0x1;
- cfdata->lock.client.desk = (int)cfdata->border->lock_client_desk & 0x1;
- cfdata->lock.client.sticky = (int)cfdata->border->lock_client_sticky & 0x1;
- cfdata->lock.client.shade = (int)cfdata->border->lock_client_shade & 0x1;
- cfdata->lock.client.maximize = (int)cfdata->border->lock_client_maximize & 0x1;
- cfdata->lock.client.fullscreen = (int)cfdata->border->lock_client_fullscreen & 0x1;
- cfdata->lock.border = (int)cfdata->border->lock_border & 0x1;
- cfdata->lock.close = (int)cfdata->border->lock_close & 0x1;
- cfdata->lock.focus_in = (int)cfdata->border->lock_focus_in & 0x1;
- cfdata->lock.focus_out = (int)cfdata->border->lock_focus_out & 0x1;
- cfdata->lock.life = (int)cfdata->border->lock_life & 0x1;
- if ((cfdata->border->remember) &&
- (cfdata->border->remember->apply & E_REMEMBER_APPLY_LOCKS))
+ cfdata->lock.user.location = (int)cfdata->client->lock_user_location & 0x1;
+ cfdata->lock.user.size = (int)cfdata->client->lock_user_size & 0x1;
+ cfdata->lock.user.stacking = (int)cfdata->client->lock_user_stacking & 0x1;
+ cfdata->lock.user.iconify = (int)cfdata->client->lock_user_iconify & 0x1;
+ cfdata->lock.user.desk = (int)cfdata->client->lock_user_desk & 0x1;
+ cfdata->lock.user.sticky = (int)cfdata->client->lock_user_sticky & 0x1;
+ cfdata->lock.user.shade = (int)cfdata->client->lock_user_shade & 0x1;
+ cfdata->lock.user.maximize = (int)cfdata->client->lock_user_maximize & 0x1;
+ cfdata->lock.user.fullscreen = (int)cfdata->client->lock_user_fullscreen & 0x1;
+ cfdata->lock.client.location = (int)cfdata->client->lock_client_location & 0x1;
+ cfdata->lock.client.size = (int)cfdata->client->lock_client_size & 0x1;
+ cfdata->lock.client.stacking = (int)cfdata->client->lock_client_stacking & 0x1;
+ cfdata->lock.client.iconify = (int)cfdata->client->lock_client_iconify & 0x1;
+ cfdata->lock.client.desk = (int)cfdata->client->lock_client_desk & 0x1;
+ cfdata->lock.client.sticky = (int)cfdata->client->lock_client_sticky & 0x1;
+ cfdata->lock.client.shade = (int)cfdata->client->lock_client_shade & 0x1;
+ cfdata->lock.client.maximize = (int)cfdata->client->lock_client_maximize & 0x1;
+ cfdata->lock.client.fullscreen = (int)cfdata->client->lock_client_fullscreen & 0x1;
+ cfdata->lock.border = (int)cfdata->client->lock_border & 0x1;
+ cfdata->lock.close = (int)cfdata->client->lock_close & 0x1;
+ cfdata->lock.focus_in = (int)cfdata->client->lock_focus_in & 0x1;
+ cfdata->lock.focus_out = (int)cfdata->client->lock_focus_out & 0x1;
+ cfdata->lock.life = (int)cfdata->client->lock_life & 0x1;
+ if ((cfdata->client->remember) &&
+ (cfdata->client->remember->apply & E_REMEMBER_APPLY_LOCKS))
cfdata->lock.remember = 1;
/* figure out basic config from the current locks */
@@ -131,7 +131,7 @@ _create_data(E_Config_Dialog *cfd)
E_Config_Dialog_Data *cfdata;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
- cfdata->border = cfd->data;
+ cfdata->client = cfd->data;
_fill_data(cfdata);
return cfdata;
}
@@ -140,7 +140,7 @@ static void
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
/* Free the cfdata */
- cfdata->border->border_locks_dialog = NULL;
+ cfdata->client->border_locks_dialog = NULL;
free(cfdata);
}
@@ -152,59 +152,59 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
/* Actually take our cfdata settings and apply them in real life */
flag = cfdata->do_what_i_say;
- cfdata->border->lock_client_location = flag;
- cfdata->border->lock_client_size = flag;
- cfdata->border->lock_client_stacking = flag;
- cfdata->border->lock_client_iconify = flag;
- cfdata->border->lock_client_desk = 0;
- cfdata->border->lock_client_sticky = flag;
- cfdata->border->lock_client_shade = flag;
- cfdata->border->lock_client_maximize = flag;
- cfdata->border->lock_client_fullscreen = flag;
+ cfdata->client->lock_client_location = flag;
+ cfdata->client->lock_client_size = flag;
+ cfdata->client->lock_client_stacking = flag;
+ cfdata->client->lock_client_iconify = flag;
+ cfdata->client->lock_client_desk = 0;
+ cfdata->client->lock_client_sticky = flag;
+ cfdata->client->lock_client_shade = flag;
+ cfdata->client->lock_client_maximize = flag;
+ cfdata->client->lock_client_fullscreen = flag;
flag = cfdata->protect_from_me;
- cfdata->border->lock_user_location = flag;
- cfdata->border->lock_user_size = flag;
- cfdata->border->lock_user_stacking = flag;
- cfdata->border->lock_user_iconify = flag;
- cfdata->border->lock_user_desk = 0;
- cfdata->border->lock_user_sticky = flag;
- cfdata->border->lock_user_shade = flag;
- cfdata->border->lock_user_maximize = flag;
- cfdata->border->lock_user_fullscreen = flag;
+ cfdata->client->lock_user_location = flag;
+ cfdata->client->lock_user_size = flag;
+ cfdata->client->lock_user_stacking = flag;
+ cfdata->client->lock_user_iconify = flag;
+ cfdata->client->lock_user_desk = 0;
+ cfdata->client->lock_user_sticky = flag;
+ cfdata->client->lock_user_shade = flag;
+ cfdata->client->lock_user_maximize = flag;
+ cfdata->client->lock_user_fullscreen = flag;
flag = cfdata->important_window;
- cfdata->border->lock_close = flag;
- cfdata->border->lock_life = flag;
+ cfdata->client->lock_close = flag;
+ cfdata->client->lock_life = flag;
flag = cfdata->keep_my_border;
- cfdata->border->lock_border = flag;
+ cfdata->client->lock_border = flag;
if (cfdata->remember_locks)
{
- if (!cfdata->border->remember)
+ if (!cfdata->client->remember)
{
- cfdata->border->remember = e_remember_new();
- if (cfdata->border->remember)
- e_remember_use(cfdata->border->remember);
+ cfdata->client->remember = e_remember_new();
+ if (cfdata->client->remember)
+ e_remember_use(cfdata->client->remember);
}
- if (cfdata->border->remember)
+ if (cfdata->client->remember)
{
- cfdata->border->remember->apply |= E_REMEMBER_APPLY_LOCKS;
- e_remember_default_match_set(cfdata->border->remember, cfdata->border);
- e_remember_update(cfdata->border);
+ cfdata->client->remember->apply |= E_REMEMBER_APPLY_LOCKS;
+ e_remember_default_match_set(cfdata->client->remember, cfdata->client);
+ e_remember_update(cfdata->client);
}
}
else
{
- if (cfdata->border->remember)
+ if (cfdata->client->remember)
{
- cfdata->border->remember->apply &= ~E_REMEMBER_APPLY_LOCKS;
- if (cfdata->border->remember->apply == 0)
+ cfdata->client->remember->apply &= ~E_REMEMBER_APPLY_LOCKS;
+ if (cfdata->client->remember->apply == 0)
{
- e_remember_unuse(cfdata->border->remember);
- e_remember_del(cfdata->border->remember);
- cfdata->border->remember = NULL;
+ e_remember_unuse(cfdata->client->remember);
+ e_remember_del(cfdata->client->remember);
+ cfdata->client->remember = NULL;
}
}
}
@@ -216,55 +216,55 @@ static int
_advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
/* Actually take our cfdata settings and apply them in real life */
- cfdata->border->lock_user_location = cfdata->lock.user.location;
- cfdata->border->lock_user_size = cfdata->lock.user.size;
- cfdata->border->lock_user_stacking = cfdata->lock.user.stacking;
- cfdata->border->lock_user_iconify = cfdata->lock.user.iconify;
- cfdata->border->lock_user_desk = cfdata->lock.user.desk;
- cfdata->border->lock_user_sticky = cfdata->lock.user.sticky;
- cfdata->border->lock_user_shade = cfdata->lock.user.shade;
- cfdata->border->lock_user_maximize = cfdata->lock.user.maximize;
- cfdata->border->lock_user_fullscreen = cfdata->lock.user.fullscreen;
- cfdata->border->lock_client_location = cfdata->lock.client.location;
- cfdata->border->lock_client_size = cfdata->lock.client.size;
- cfdata->border->lock_client_stacking = cfdata->lock.client.stacking;
- cfdata->border->lock_client_iconify = cfdata->lock.client.iconify;
- cfdata->border->lock_client_desk = cfdata->lock.client.desk;
- cfdata->border->lock_client_sticky = cfdata->lock.client.sticky;
- cfdata->border->lock_client_shade = cfdata->lock.client.shade;
- cfdata->border->lock_client_maximize = cfdata->lock.client.maximize;
- cfdata->border->lock_client_fullscreen = cfdata->lock.client.fullscreen;
- cfdata->border->lock_border = cfdata->lock.border;
- cfdata->border->lock_close = cfdata->lock.close;
- cfdata->border->lock_focus_in = cfdata->lock.focus_in;
- cfdata->border->lock_focus_out = cfdata->lock.focus_out;
- cfdata->border->lock_life = cfdata->lock.life;
+ cfdata->client->lock_user_location = cfdata->lock.user.location;
+ cfdata->client->lock_user_size = cfdata->lock.user.size;
+ cfdata->client->lock_user_stacking = cfdata->lock.user.stacking;
+ cfdata->client->lock_user_iconify = cfdata->lock.user.iconify;
+ cfdata->client->lock_user_desk = cfdata->lock.user.desk;
+ cfdata->client->lock_user_sticky = cfdata->lock.user.sticky;
+ cfdata->client->lock_user_shade = cfdata->lock.user.shade;
+ cfdata->client->lock_user_maximize = cfdata->lock.user.maximize;
+ cfdata->client->lock_user_fullscreen = cfdata->lock.user.fullscreen;
+ cfdata->client->lock_client_location = cfdata->lock.client.location;
+ cfdata->client->lock_client_size = cfdata->lock.client.size;
+ cfdata->client->lock_client_stacking = cfdata->lock.client.stacking;
+ cfdata->client->lock_client_iconify = cfdata->lock.client.iconify;
+ cfdata->client->lock_client_desk = cfdata->lock.client.desk;
+ cfdata->client->lock_client_sticky = cfdata->lock.client.sticky;
+ cfdata->client->lock_client_shade = cfdata->lock.client.shade;
+ cfdata->client->lock_client_maximize = cfdata->lock.client.maximize;
+ cfdata->client->lock_client_fullscreen = cfdata->lock.client.fullscreen;
+ cfdata->client->lock_border = cfdata->lock.border;
+ cfdata->client->lock_close = cfdata->lock.close;
+ cfdata->client->lock_focus_in = cfdata->lock.focus_in;
+ cfdata->client->lock_focus_out = cfdata->lock.focus_out;
+ cfdata->client->lock_life = cfdata->lock.life;
if (cfdata->lock.remember)
{
- if (!cfdata->border->remember)
+ if (!cfdata->client->remember)
{
- cfdata->border->remember = e_remember_new();
- if (cfdata->border->remember)
- e_remember_use(cfdata->border->remember);
+ cfdata->client->remember = e_remember_new();
+ if (cfdata->client->remember)
+ e_remember_use(cfdata->client->remember);
}
- if (cfdata->border->remember)
+ if (cfdata->client->remember)
{
- cfdata->border->remember->apply |= E_REMEMBER_APPLY_LOCKS;
- e_remember_default_match_set(cfdata->border->remember, cfdata->border);
- e_remember_update(cfdata->border);
+ cfdata->client->remember->apply |= E_REMEMBER_APPLY_LOCKS;
+ e_remember_default_match_set(cfdata->client->remember, cfdata->client);
+ e_remember_update(cfdata->client);
}
}
else
{
- if (cfdata->border->remember)
+ if (cfdata->client->remember)
{
- cfdata->border->remember->apply &= ~E_REMEMBER_APPLY_LOCKS;
- if (cfdata->border->remember->apply == 0)
+ cfdata->client->remember->apply &= ~E_REMEMBER_APPLY_LOCKS;
+ if (cfdata->client->remember->apply == 0)
{
- e_remember_unuse(cfdata->border->remember);
- e_remember_del(cfdata->border->remember);
- cfdata->border->remember = NULL;
+ e_remember_unuse(cfdata->client->remember);
+ e_remember_del(cfdata->client->remember);
+ cfdata->client->remember = NULL;
}
}
}
diff --git a/src/bin/e_int_border_locks.h b/src/bin/e_int_client_locks.h
index 1d3b943750..9cf421cfe5 100644
--- a/src/bin/e_int_border_locks.h
+++ b/src/bin/e_int_client_locks.h
@@ -3,7 +3,7 @@
#ifndef E_INT_BORDER_LOCKS_H
#define E_INT_BORDER_LOCKS_H
-EAPI void e_int_border_locks(E_Border *bd);
+EAPI void e_int_client_locks(E_Client *ec);
#endif
#endif
diff --git a/src/bin/e_int_border_menu.c b/src/bin/e_int_client_menu.c
index 2dc9419bc9..f6ada3f863 100644
--- a/src/bin/e_int_border_menu.c
+++ b/src/bin/e_int_client_menu.c
@@ -1,64 +1,64 @@
#include "e.h"
-static void _e_border_cb_border_menu_end(void *data, E_Menu *m);
-static void _e_border_menu_cb_locks(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_remember(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_borderless(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_border(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_close(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_iconify(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_kill(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_move(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_resize(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_maximize_pre(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_maximize(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_maximize_vertically(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_maximize_horizontally(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_maximize_left(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_maximize_right(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_unmaximize(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_shade(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_resistance(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_application_pre(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi);
-static void _e_border_menu_cb_prop(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_stick(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_stacking_pre(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_on_top(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_normal(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_below(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_fullscreen(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_skip_winlist(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_skip_pager(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_skip_taskbar(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_sendto_pre(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_sendto(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_pin(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_unpin(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_raise(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_lower(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_skip_pre(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_fav_add(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_kbdshrtct_add(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_ibar_add_pre(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_ibar_add(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_border_pre(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_iconpref_e(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_iconpref_netwm(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_iconpref_user(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_default_icon(void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_border_menu_cb_netwm_icon(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_cb_border_menu_end(void *data, E_Menu *m);
+static void _e_client_menu_cb_locks(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_remember(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_borderless(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_border(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_close(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_iconify(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_kill(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_move(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_resize(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_maximize_pre(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_maximize(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_maximize_vertically(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_maximize_horizontally(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_maximize_left(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_maximize_right(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_unmaximize(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_shade(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_resistance(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_application_pre(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi);
+static void _e_client_menu_cb_prop(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_stick(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_stacking_pre(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_on_top(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_normal(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_below(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_fullscreen(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_skip_winlist(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_skip_pager(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_skip_taskbar(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_sendto_pre(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_sendto(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_pin(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_unpin(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_raise(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_lower(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_skip_pre(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_fav_add(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_kbdshrtct_add(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_ibar_add_pre(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_ibar_add(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_border_pre(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_iconpref_e(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_iconpref_netwm(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_iconpref_user(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_default_icon(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _e_client_menu_cb_netwm_icon(void *data, E_Menu *m, E_Menu_Item *mi);
static Eina_List *menu_hooks = NULL;
-EAPI E_Border_Menu_Hook *
-e_int_border_menu_hook_add(E_Border_Menu_Hook_Cb cb, const void *data)
+EAPI E_Client_Menu_Hook *
+e_int_client_menu_hook_add(E_Client_Menu_Hook_Cb cb, const void *data)
{
- E_Border_Menu_Hook *h;
+ E_Client_Menu_Hook *h;
if (!cb) return NULL;
- h = E_NEW(E_Border_Menu_Hook, 1);
+ h = E_NEW(E_Client_Menu_Hook, 1);
if (!h) return NULL;
h->cb = cb;
@@ -68,9 +68,9 @@ e_int_border_menu_hook_add(E_Border_Menu_Hook_Cb cb, const void *data)
}
EAPI void
-e_int_border_menu_hook_del(E_Border_Menu_Hook *hook)
+e_int_client_menu_hook_del(E_Client_Menu_Hook *hook)
{
- E_Border_Menu_Hook *h;
+ E_Client_Menu_Hook *h;
Eina_List *l;
if (!hook) return;
@@ -85,49 +85,49 @@ e_int_border_menu_hook_del(E_Border_Menu_Hook *hook)
}
EAPI void
-e_int_border_menu_hooks_clear(void)
+e_int_client_menu_hooks_clear(void)
{
- E_Border_Menu_Hook *h;
+ E_Client_Menu_Hook *h;
EINA_LIST_FREE(menu_hooks, h)
free(h);
}
EAPI void
-e_int_border_menu_create(E_Border *bd)
+e_int_client_menu_create(E_Client *ec)
{
E_Menu *m;
E_Menu_Item *mi;
Eina_List *l;
- E_Border_Menu_Hook *h;
+ E_Client_Menu_Hook *h;
char buf[128];
Eina_Bool borderless;
- if (bd->border_menu) return;
+ if (ec->border_menu) return;
m = e_menu_new();
e_menu_category_set(m, "border");
- e_menu_category_data_set("border", bd);
- e_object_data_set(E_OBJECT(m), bd);
- bd->border_menu = m;
- e_menu_post_deactivate_callback_set(m, _e_border_cb_border_menu_end, NULL);
+ e_menu_category_data_set("border", ec);
+ e_object_data_set(E_OBJECT(m), ec);
+ ec->border_menu = m;
+ e_menu_post_deactivate_callback_set(m, _e_client_cb_border_menu_end, NULL);
- if (!bd->internal)
+ if (!ec->internal)
{
- if (bd->client.icccm.class)
- snprintf(buf, sizeof(buf), "%s", bd->client.icccm.class);
+ if (ec->icccm.class)
+ snprintf(buf, sizeof(buf), "%s", ec->icccm.class);
else
snprintf(buf, sizeof(buf), _("Application"));
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, buf);
- e_menu_item_submenu_pre_callback_set(mi, _e_border_menu_cb_application_pre, bd);
- if (bd->desktop)
- e_util_desktop_menu_item_icon_add(bd->desktop, 16, mi);
+ e_menu_item_submenu_pre_callback_set(mi, _e_client_menu_cb_application_pre, ec);
+ if (ec->desktop)
+ e_util_desktop_menu_item_icon_add(ec->desktop, 16, mi);
}
- borderless = bd->borderless || (!bd->client.border.name) || (!e_util_strcmp("borderless", bd->client.border.name));
+ borderless = ec->borderless || (!ec->border.name) || (!e_util_strcmp("borderless", ec->border.name));
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Window"));
- e_menu_item_submenu_pre_callback_set(mi, _e_border_menu_cb_window_pre, bd);
+ e_menu_item_submenu_pre_callback_set(mi, _e_client_menu_cb_window_pre, ec);
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/window"),
@@ -136,11 +136,11 @@ e_int_border_menu_create(E_Border *bd)
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
- if ((!bd->sticky) && ((bd->zone->desk_x_count > 1) || (bd->zone->desk_y_count > 1)))
+ if ((!ec->sticky) && ((ec->zone->desk_x_count > 1) || (ec->zone->desk_y_count > 1)))
{
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Move to"));
- e_menu_item_submenu_pre_callback_set(mi, _e_border_menu_cb_sendto_pre, bd);
+ e_menu_item_submenu_pre_callback_set(mi, _e_client_menu_cb_sendto_pre, ec);
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/sendto"),
@@ -150,105 +150,105 @@ e_int_border_menu_create(E_Border *bd)
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Always on Top"));
e_menu_item_check_set(mi, 1);
- e_menu_item_toggle_set(mi, (bd->layer == 150 ? 1 : 0));
- if (bd->layer == 150)
- e_menu_item_callback_set(mi, _e_border_menu_cb_normal, bd);
+ e_menu_item_toggle_set(mi, (ec->layer == 150 ? 1 : 0));
+ if (ec->layer == 150)
+ e_menu_item_callback_set(mi, _e_client_menu_cb_normal, ec);
else
- e_menu_item_callback_set(mi, _e_border_menu_cb_on_top, bd);
+ e_menu_item_callback_set(mi, _e_client_menu_cb_on_top, ec);
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stack_on_top"),
"e/widgets/border/default/stack_on_top");
- if (!bd->lock_user_sticky)
+ if (!ec->lock_user_sticky)
{
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Sticky"));
e_menu_item_check_set(mi, 1);
- e_menu_item_toggle_set(mi, (bd->sticky ? 1 : 0));
- e_menu_item_callback_set(mi, _e_border_menu_cb_stick, bd);
+ e_menu_item_toggle_set(mi, (ec->sticky ? 1 : 0));
+ e_menu_item_callback_set(mi, _e_client_menu_cb_stick, ec);
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stick"),
"e/widgets/border/default/stick");
}
- if ((!bd->lock_user_shade) && (!bd->fullscreen) && (!bd->maximized) &&
- ((!bd->client.border.name) || (!borderless)))
+ if ((!ec->lock_user_shade) && (!ec->fullscreen) && (!ec->maximized) &&
+ ((!ec->border.name) || (!borderless)))
{
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Shade"));
e_menu_item_check_set(mi, 1);
- e_menu_item_toggle_set(mi, (bd->shaded ? 1 : 0));
- e_menu_item_callback_set(mi, _e_border_menu_cb_shade, bd);
+ e_menu_item_toggle_set(mi, (ec->shaded ? 1 : 0));
+ e_menu_item_callback_set(mi, _e_client_menu_cb_shade, ec);
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/shade"),
"e/widgets/border/default/shade");
}
- if ((!bd->fullscreen) && (!bd->lock_border) && (!bd->shading) && (!bd->shaded))
+ if ((!ec->fullscreen) && (!ec->lock_border) && (!ec->shading) && (!ec->shaded))
{
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Borderless"));
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, borderless);
- e_menu_item_callback_set(mi, _e_border_menu_cb_borderless, bd);
+ e_menu_item_callback_set(mi, _e_client_menu_cb_borderless, ec);
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/borderless"),
"e/widgets/border/default/borderless");
}
- if (!bd->lock_close)
+ if (!ec->lock_close)
{
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Close"));
- e_menu_item_callback_set(mi, _e_border_menu_cb_close, bd);
+ e_menu_item_callback_set(mi, _e_client_menu_cb_close, ec);
e_menu_item_icon_edje_set(mi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/close"),
"e/widgets/border/default/close");
}
EINA_LIST_FOREACH(menu_hooks, l, h)
- h->cb(h->data, bd);
+ h->cb(h->data, ec);
}
EAPI void
-e_int_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key, Ecore_X_Time timestamp)
+e_int_client_menu_show(E_Client *ec, Evas_Coord x, Evas_Coord y, int key, Ecore_X_Time timestamp)
{
- e_int_border_menu_create(bd);
+ e_int_client_menu_create(ec);
if (key)
- e_menu_activate_key(bd->border_menu, bd->zone, x, y, 1, 1,
+ e_menu_activate_key(ec->border_menu, ec->zone, x, y, 1, 1,
E_MENU_POP_DIRECTION_DOWN);
else
- e_menu_activate_mouse(bd->border_menu, bd->zone, x, y, 1, 1,
+ e_menu_activate_mouse(ec->border_menu, ec->zone, x, y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, timestamp);
}
EAPI void
-e_int_border_menu_del(E_Border *bd)
+e_int_client_menu_del(E_Client *ec)
{
- if (bd->border_menu)
+ if (ec->border_menu)
{
- e_object_del(E_OBJECT(bd->border_menu));
- bd->border_menu = NULL;
+ e_object_del(E_OBJECT(ec->border_menu));
+ ec->border_menu = NULL;
}
}
static void
-_e_border_cb_border_menu_end(void *data __UNUSED__, E_Menu *m)
+_e_client_cb_border_menu_end(void *data __UNUSED__, E_Menu *m)
{
- E_Border *bd;
+ E_Client *ec;
- bd = e_object_data_get(E_OBJECT(m));
- if (bd)
+ ec = e_object_data_get(E_OBJECT(m));
+ if (ec)
{
- /* If the border exists, delete all associated menus */
- e_int_border_menu_del(bd);
+ /* If the client exists, delete all associated menus */
+ e_int_client_menu_del(ec);
}
else
{
@@ -258,159 +258,159 @@ _e_border_cb_border_menu_end(void *data __UNUSED__, E_Menu *m)
}
static void
-_e_border_menu_cb_locks(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_locks(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (bd->border_locks_dialog)
+ ec = data;
+ if (ec->border_locks_dialog)
{
- e_border_desk_set(bd->border_locks_dialog->dia->win->border, bd->desk);
- e_win_raise(bd->border_locks_dialog->dia->win);
- e_border_focus_set(bd->border_locks_dialog->dia->win->border, 1, 1);
+ e_client_desk_set(ec->border_locks_dialog->dia->win->client, ec->desk);
+ e_win_raise(ec->border_locks_dialog->dia->win);
+ evas_object_focus_set(ec->border_locks_dialog->dia->win->client->frame, 1);
return;
}
- e_int_border_locks(bd);
+ e_int_client_locks(ec);
}
static void
-_e_border_menu_cb_remember(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_remember(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (bd->border_remember_dialog)
+ ec = data;
+ if (ec->border_remember_dialog)
{
- e_border_desk_set(bd->border_remember_dialog->dia->win->border, bd->desk);
- e_win_raise(bd->border_remember_dialog->dia->win);
- e_border_focus_set(bd->border_remember_dialog->dia->win->border, 1, 1);
+ e_client_desk_set(ec->border_remember_dialog->dia->win->client, ec->desk);
+ e_win_raise(ec->border_remember_dialog->dia->win);
+ evas_object_focus_set(ec->border_remember_dialog->dia->win->client->frame, 1);
return;
}
- e_int_border_remember(bd);
+ e_int_client_remember(ec);
}
static void
-_e_border_menu_cb_border(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_border(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
char buf[256];
- bd = data;
- if (bd->border_border_dialog)
+ ec = data;
+ if (ec->border_border_dialog)
{
- e_border_desk_set(bd->border_border_dialog->dia->win->border, bd->desk);
- e_win_raise(bd->border_border_dialog->dia->win);
- e_border_focus_set(bd->border_border_dialog->dia->win->border, 1, 1);
+ e_client_desk_set(ec->border_border_dialog->dia->win->client, ec->desk);
+ e_win_raise(ec->border_border_dialog->dia->win);
+ evas_object_focus_set(ec->border_border_dialog->dia->win->client->frame, 1);
return;
}
- snprintf(buf, sizeof(buf), "%p", bd);
- e_configure_registry_call("internal/borders_border", bd->zone->container, buf);
+ snprintf(buf, sizeof(buf), "%p", ec);
+ e_configure_registry_call("internal/borders_border", ec->zone->comp, buf);
}
static void
-_e_border_menu_cb_borderless(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_borderless(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
- E_Border *bd = data;
+ E_Client *ec = data;
- BD_CHANGED(bd);
- bd->client.border.changed = 1;
- bd->borderless = mi->toggle;
+ EC_CHANGED(ec);
+ ec->border.changed = 1;
+ ec->borderless = mi->toggle;
}
static void
-_e_border_menu_cb_close(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_close(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_close) e_border_act_close_begin(bd);
+ ec = data;
+ if (!ec->lock_close) e_client_act_close_begin(ec);
}
static void
-_e_border_menu_cb_iconify(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_iconify(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_user_iconify)
+ ec = data;
+ if (!ec->lock_user_iconify)
{
- if (bd->iconic)
- e_border_uniconify(bd);
+ if (ec->iconic)
+ e_client_uniconify(ec);
else
- e_border_iconify(bd);
+ e_client_iconify(ec);
}
}
static void
-_e_border_menu_cb_kill(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_kill(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
E_Action *a;
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if ((bd->lock_close) || (bd->internal)) return;
+ ec = data;
+ if ((ec->lock_close) || (ec->internal)) return;
a = e_action_find("window_kill");
- if ((a) && (a->func.go)) a->func.go(E_OBJECT(bd), NULL);
+ if ((a) && (a->func.go)) a->func.go(E_OBJECT(ec), NULL);
}
static void
-_e_border_menu_cb_move(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_move(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
+ ec = data;
- if (!bd->lock_user_location)
- e_border_act_move_keyboard(bd);
+ if (!ec->lock_user_location)
+ e_client_act_move_keyboard(ec);
}
static void
-_e_border_menu_cb_resize(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_resize(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
+ ec = data;
- if (!bd->lock_user_size)
- e_border_act_resize_keyboard(bd);
+ if (!ec->lock_user_size)
+ e_client_act_resize_keyboard(ec);
}
static void
-_e_border_menu_cb_maximize_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_maximize_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
E_Menu *subm;
E_Menu_Item *submi;
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
subm = e_menu_new();
- e_object_data_set(E_OBJECT(subm), bd);
+ e_object_data_set(E_OBJECT(subm), ec);
e_menu_item_submenu_set(mi, subm);
e_object_unref(E_OBJECT(subm));
- if ((!bd->lock_user_fullscreen) && (!bd->shaded))
+ if ((!ec->lock_user_fullscreen) && (!ec->shaded))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Fullscreen"));
e_menu_item_check_set(submi, 1);
- e_menu_item_toggle_set(submi, bd->fullscreen);
- e_menu_item_callback_set(submi, _e_border_menu_cb_fullscreen, bd);
+ e_menu_item_toggle_set(submi, ec->fullscreen);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_fullscreen, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/fullscreen"),
"e/widgets/border/default/fullscreen");
}
- if (!bd->fullscreen)
+ if (!ec->fullscreen)
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Maximize"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 3);
- e_menu_item_toggle_set(submi, (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH);
- e_menu_item_callback_set(submi, _e_border_menu_cb_maximize, bd);
+ e_menu_item_toggle_set(submi, (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_maximize, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/maximize"),
@@ -420,8 +420,8 @@ _e_border_menu_cb_maximize_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
e_menu_item_label_set(submi, _("Maximize Vertically"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 3);
- e_menu_item_toggle_set(submi, (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL);
- e_menu_item_callback_set(submi, _e_border_menu_cb_maximize_vertically, bd);
+ e_menu_item_toggle_set(submi, (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_maximize_vertically, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/maximize"),
@@ -431,8 +431,8 @@ _e_border_menu_cb_maximize_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
e_menu_item_label_set(submi, _("Maximize Horizontally"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 3);
- e_menu_item_toggle_set(submi, (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL);
- e_menu_item_callback_set(submi, _e_border_menu_cb_maximize_horizontally, bd);
+ e_menu_item_toggle_set(submi, (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_maximize_horizontally, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/maximize"),
@@ -442,8 +442,8 @@ _e_border_menu_cb_maximize_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
e_menu_item_label_set(submi, _("Maximize Left"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 3);
- e_menu_item_toggle_set(submi, (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_LEFT);
- e_menu_item_callback_set(submi, _e_border_menu_cb_maximize_left, bd);
+ e_menu_item_toggle_set(submi, (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_LEFT);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_maximize_left, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/maximize"),
@@ -453,8 +453,8 @@ _e_border_menu_cb_maximize_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
e_menu_item_label_set(submi, _("Maximize Right"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 3);
- e_menu_item_toggle_set(submi, (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_RIGHT);
- e_menu_item_callback_set(submi, _e_border_menu_cb_maximize_right, bd);
+ e_menu_item_toggle_set(submi, (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_RIGHT);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_maximize_right, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/maximize"),
@@ -464,8 +464,8 @@ _e_border_menu_cb_maximize_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
e_menu_item_label_set(submi, _("Unmaximize"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 3);
- e_menu_item_toggle_set(submi, (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_NONE);
- e_menu_item_callback_set(submi, _e_border_menu_cb_unmaximize, bd);
+ e_menu_item_toggle_set(submi, (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_NONE);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_unmaximize, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/maximize"),
@@ -474,145 +474,145 @@ _e_border_menu_cb_maximize_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
}
static void
-_e_border_menu_cb_maximize(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_maximize(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_user_maximize)
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
+ ec = data;
+ if (!ec->lock_user_maximize)
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
E_MAXIMIZE_BOTH);
}
static void
-_e_border_menu_cb_maximize_vertically(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_maximize_vertically(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_user_maximize)
+ ec = data;
+ if (!ec->lock_user_maximize)
{
- if ((bd->maximized & E_MAXIMIZE_HORIZONTAL))
- e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL);
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
+ if ((ec->maximized & E_MAXIMIZE_HORIZONTAL))
+ e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
E_MAXIMIZE_VERTICAL);
}
}
static void
-_e_border_menu_cb_maximize_horizontally(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_maximize_horizontally(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_user_maximize)
+ ec = data;
+ if (!ec->lock_user_maximize)
{
- if ((bd->maximized & E_MAXIMIZE_VERTICAL))
- e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL);
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
+ if ((ec->maximized & E_MAXIMIZE_VERTICAL))
+ e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
E_MAXIMIZE_HORIZONTAL);
}
}
static void
-_e_border_menu_cb_maximize_left(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_maximize_left(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_user_maximize)
+ ec = data;
+ if (!ec->lock_user_maximize)
{
- if ((bd->maximized & E_MAXIMIZE_DIRECTION))
- e_border_unmaximize(bd, bd->maximized & E_MAXIMIZE_DIRECTION);
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
+ if ((ec->maximized & E_MAXIMIZE_DIRECTION))
+ e_client_unmaximize(ec, ec->maximized & E_MAXIMIZE_DIRECTION);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
E_MAXIMIZE_LEFT);
}
}
static void
-_e_border_menu_cb_maximize_right(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_maximize_right(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_user_maximize)
+ ec = data;
+ if (!ec->lock_user_maximize)
{
- if ((bd->maximized & E_MAXIMIZE_DIRECTION))
- e_border_unmaximize(bd, bd->maximized & E_MAXIMIZE_DIRECTION);
- e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
+ if ((ec->maximized & E_MAXIMIZE_DIRECTION))
+ e_client_unmaximize(ec, ec->maximized & E_MAXIMIZE_DIRECTION);
+ e_client_maximize(ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) |
E_MAXIMIZE_RIGHT);
}
}
static void
-_e_border_menu_cb_unmaximize(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_unmaximize(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
+ ec = data;
+ e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
}
static void
-_e_border_menu_cb_shade(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_shade(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_user_shade)
+ ec = data;
+ if (!ec->lock_user_shade)
{
- if (bd->shaded)
- e_border_unshade(bd, bd->shade.dir);
+ if (ec->shaded)
+ e_client_unshade(ec, ec->shade_dir);
else
- e_border_shade(bd, E_DIRECTION_UP);
+ e_client_shade(ec, E_DIRECTION_UP);
}
}
static void
-_e_border_menu_cb_resistance(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_resistance(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- bd->offer_resistance = !bd->offer_resistance;
+ ec = data;
+ ec->offer_resistance = !ec->offer_resistance;
}
static void
-_e_border_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- e_desktop_border_edit(m->zone->container, bd);
+ ec = data;
+ e_desktop_border_edit(m->zone->comp, ec);
}
static void
-_e_border_menu_cb_application_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_application_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
E_Menu *subm;
E_Menu_Item *submi;
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
subm = e_menu_new();
- e_object_data_set(E_OBJECT(subm), bd);
+ e_object_data_set(E_OBJECT(subm), ec);
e_menu_item_submenu_set(mi, subm);
e_object_unref(E_OBJECT(subm));
- if (bd->desktop)
+ if (ec->desktop)
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Edit Icon"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_icon_edit, bd);
- e_util_desktop_menu_item_icon_add(bd->desktop, 16, submi);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_icon_edit, ec);
+ e_util_desktop_menu_item_icon_add(ec->desktop, 16, submi);
}
- else if (bd->client.icccm.class)
+ else if (ec->icccm.class)
{
/* icons with no class useless to borders */
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Create Icon"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_icon_edit, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_icon_edit, ec);
}
submi = e_menu_item_new(subm);
@@ -620,54 +620,54 @@ _e_border_menu_cb_application_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Add to Favorites Menu"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_fav_add, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_fav_add, ec);
e_util_menu_item_theme_icon_set(submi, "user-bookmarks");
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Add to IBar"));
e_menu_item_submenu_pre_callback_set(submi,
- _e_border_menu_cb_ibar_add_pre, bd);
+ _e_client_menu_cb_ibar_add_pre, ec);
e_util_menu_item_theme_icon_set(submi, "preferences-applications-ibar");
if (e_configure_registry_exists("keyboard_and_mouse/key_bindings"))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Create Keyboard Shortcut"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_kbdshrtct_add, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_kbdshrtct_add, ec);
e_util_menu_item_theme_icon_set(submi, "preferences-desktop-keyboard");
}
}
static void
-_e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
E_Menu *subm;
E_Menu_Item *submi;
- E_Border *bd;
+ E_Client *ec;
Eina_Bool resize = EINA_FALSE;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
subm = e_menu_new();
- e_object_data_set(E_OBJECT(subm), bd);
+ e_object_data_set(E_OBJECT(subm), ec);
e_menu_item_submenu_set(mi, subm);
e_object_unref(E_OBJECT(subm));
/* internal dialog which is resizable */
- if (bd->internal && (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))
- resize = (bd->client.icccm.max_w != bd->client.icccm.min_w);
- if (resize || (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) ||
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN))
+ if (ec->internal && (ec->netwm.type == E_WINDOW_TYPE_DIALOG))
+ resize = (ec->icccm.max_w != ec->icccm.min_w);
+ if (resize || (ec->netwm.type == E_WINDOW_TYPE_NORMAL) ||
+ (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN))
{
- if (!(((bd->client.icccm.min_w == bd->client.icccm.max_w) &&
- (bd->client.icccm.min_h == bd->client.icccm.max_h)) ||
- (bd->lock_user_maximize)))
+ if (!(((ec->icccm.min_w == ec->icccm.max_w) &&
+ (ec->icccm.min_h == ec->icccm.max_h)) ||
+ (ec->lock_user_maximize)))
{
- if ((!bd->lock_user_maximize) && (!bd->shaded))
+ if ((!ec->lock_user_maximize) && (!ec->shaded))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Maximize"));
- e_menu_item_submenu_pre_callback_set(submi, _e_border_menu_cb_maximize_pre, bd);
+ e_menu_item_submenu_pre_callback_set(submi, _e_client_menu_cb_maximize_pre, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/maximize"),
@@ -675,11 +675,11 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
}
}
- if ((!bd->lock_user_iconify) && (!bd->fullscreen))
+ if ((!ec->lock_user_iconify) && (!ec->fullscreen))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Iconify"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_iconify, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_iconify, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/minimize"),
@@ -687,26 +687,26 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
}
}
- if ((!bd->lock_user_location) && (!bd->fullscreen) &&
- (((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH) || e_config->allow_manip))
+ if ((!ec->lock_user_location) && (!ec->fullscreen) &&
+ (((ec->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH) || e_config->allow_manip))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Move"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_move, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_move, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/move_icon"),
"e/widgets/border/default/move_icon");
}
- if (((!bd->lock_user_size) && (!bd->fullscreen) &&
- (((bd->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH) || e_config->allow_manip)) &&
- ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) ||
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN)))
+ if (((!ec->lock_user_size) && (!ec->fullscreen) &&
+ (((ec->maximized & E_MAXIMIZE_DIRECTION) != E_MAXIMIZE_BOTH) || e_config->allow_manip)) &&
+ ((ec->netwm.type == E_WINDOW_TYPE_NORMAL) ||
+ (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN)))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Resize"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_resize, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_resize, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/resize_icon"),
@@ -716,11 +716,11 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
submi = e_menu_item_new(subm);
e_menu_item_separator_set(submi, 1);
- if ((!bd->lock_user_stacking) && (!bd->fullscreen))
+ if ((!ec->lock_user_stacking) && (!ec->fullscreen))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Stacking"));
- e_menu_item_submenu_pre_callback_set(submi, _e_border_menu_cb_stacking_pre, bd);
+ e_menu_item_submenu_pre_callback_set(submi, _e_client_menu_cb_stacking_pre, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stacking"),
@@ -729,17 +729,17 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Skip"));
- e_menu_item_submenu_pre_callback_set(submi, _e_border_menu_cb_skip_pre, bd);
+ e_menu_item_submenu_pre_callback_set(submi, _e_client_menu_cb_skip_pre, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/skip"),
"e/widgets/border/default/skip");
- if (!bd->lock_border)
+ if (!ec->lock_border)
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Border"));
- e_menu_item_submenu_pre_callback_set(submi, _e_border_menu_cb_border_pre, bd);
+ e_menu_item_submenu_pre_callback_set(submi, _e_client_menu_cb_border_pre, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/borderless"),
@@ -751,7 +751,7 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Locks"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_locks, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_locks, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/locks"),
@@ -759,7 +759,7 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Remember"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_remember, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_remember, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/remember"),
@@ -768,11 +768,11 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
submi = e_menu_item_new(subm);
e_menu_item_separator_set(submi, 1);
- if ((!bd->internal) && (!bd->lock_close))
+ if ((!ec->internal) && (!ec->lock_close))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Kill"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_kill, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_kill, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/kill"),
@@ -781,7 +781,7 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("ICCCM/NetWM"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_prop, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_prop, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/properties"),
@@ -789,126 +789,126 @@ _e_border_menu_cb_window_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
}
static void
-_e_border_menu_cb_prop(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_prop(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- e_int_border_prop(bd);
+ ec = data;
+ e_int_client_prop(ec);
}
static void
-_e_border_menu_cb_stick(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_stick(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (!bd->lock_user_sticky)
+ ec = data;
+ if (!ec->lock_user_sticky)
{
- if (bd->sticky)
- e_border_unstick(bd);
+ if (ec->sticky)
+ e_client_unstick(ec);
else
- e_border_stick(bd);
+ e_client_stick(ec);
}
}
static void
-_e_border_menu_cb_on_top(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_on_top(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (bd->layer != E_LAYER_ABOVE)
- e_border_layer_set(bd, E_LAYER_ABOVE);
+ ec = data;
+ if (ec->layer != E_LAYER_CLIENT_ABOVE)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
}
static void
-_e_border_menu_cb_below(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_below(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (bd->layer != E_LAYER_BELOW)
- e_border_layer_set(bd, E_LAYER_BELOW);
+ ec = data;
+ if (ec->layer != E_LAYER_CLIENT_BELOW)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_BELOW);
}
static void
-_e_border_menu_cb_normal(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_normal(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- if (bd->layer != E_LAYER_NORMAL)
- e_border_layer_set(bd, E_LAYER_NORMAL);
+ ec = data;
+ if (ec->layer != E_LAYER_CLIENT_NORMAL)
+ evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
}
static void
-_e_border_menu_cb_fullscreen(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_fullscreen(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
- E_Border *bd;
+ E_Client *ec;
int toggle;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
- if (!bd->lock_user_fullscreen)
+ if (!ec->lock_user_fullscreen)
{
toggle = e_menu_item_toggle_get(mi);
if (toggle)
- e_border_fullscreen(bd, e_config->fullscreen_policy);
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
else
- e_border_unfullscreen(bd);
+ e_client_unfullscreen(ec);
}
}
static void
-_e_border_menu_cb_skip_winlist(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_skip_winlist(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
- if (((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus)) &&
- (!bd->client.netwm.state.skip_taskbar))
- bd->user_skip_winlist = e_menu_item_toggle_get(mi);
+ if (((ec->icccm.accepts_focus) || (ec->icccm.take_focus)) &&
+ (!ec->netwm.state.skip_taskbar))
+ ec->user_skip_winlist = e_menu_item_toggle_get(mi);
else
- bd->user_skip_winlist = 0;
- bd->changed = 1;
- e_remember_update(bd);
+ ec->user_skip_winlist = 0;
+ ec->changed = 1;
+ e_remember_update(ec);
}
static void
-_e_border_menu_cb_skip_pager(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_skip_pager(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
- if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
- bd->client.netwm.state.skip_pager = e_menu_item_toggle_get(mi);
+ if ((ec->icccm.accepts_focus) || (ec->icccm.take_focus))
+ ec->netwm.state.skip_pager = e_menu_item_toggle_get(mi);
else
- bd->client.netwm.state.skip_pager = 0;
- bd->changed = 1;
- e_remember_update(bd);
+ ec->netwm.state.skip_pager = 0;
+ ec->changed = 1;
+ e_remember_update(ec);
}
static void
-_e_border_menu_cb_skip_taskbar(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_skip_taskbar(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
- if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus))
- bd->client.netwm.state.skip_taskbar = e_menu_item_toggle_get(mi);
+ if ((ec->icccm.accepts_focus) || (ec->icccm.take_focus))
+ ec->netwm.state.skip_taskbar = e_menu_item_toggle_get(mi);
else
- bd->client.netwm.state.skip_taskbar = 0;
- bd->changed = 1;
- e_remember_update(bd);
+ ec->netwm.state.skip_taskbar = 0;
+ ec->changed = 1;
+ e_remember_update(ec);
}
#ifndef DESKMIRROR_TEST
static void
-_e_border_menu_cb_sendto_icon_pre(void *data, E_Menu *m, E_Menu_Item *mi)
+_e_client_menu_cb_sendto_icon_pre(void *data, E_Menu *m, E_Menu_Item *mi)
{
E_Desk *desk = NULL;
Evas_Object *o = NULL;
@@ -920,7 +920,7 @@ _e_border_menu_cb_sendto_icon_pre(void *data, E_Menu *m, E_Menu_Item *mi)
tw = 50;
th = (tw * desk->zone->h) / desk->zone->w;
- bgfile = e_bg_file_get(desk->zone->container->num, desk->zone->num,
+ bgfile = e_bg_file_get(desk->zone->comp->num, desk->zone->num,
desk->x, desk->y);
o = e_thumb_icon_add(m->evas);
e_thumb_icon_file_set(o, bgfile, "e/desktop/background");
@@ -932,25 +932,25 @@ _e_border_menu_cb_sendto_icon_pre(void *data, E_Menu *m, E_Menu_Item *mi)
#endif
static void
-_e_border_menu_cb_sendto_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_sendto_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
E_Menu *subm;
E_Menu_Item *submi;
- E_Border *bd;
+ E_Client *ec;
E_Zone *zone;
Eina_List *l = NULL;
char buf[128];
int zones, i;
- bd = data;
- zones = eina_list_count(bd->zone->container->zones);
+ ec = data;
+ zones = eina_list_count(ec->zone->comp->zones);
subm = e_menu_new();
- e_object_data_set(E_OBJECT(subm), bd);
+ e_object_data_set(E_OBJECT(subm), ec);
e_menu_item_submenu_set(mi, subm);
e_object_unref(E_OBJECT(subm));
- EINA_LIST_FOREACH(bd->zone->container->zones, l, zone)
+ EINA_LIST_FOREACH(ec->comp->zones, l, zone)
{
if (zones > 1)
{
@@ -977,16 +977,16 @@ _e_border_menu_cb_sendto_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
#ifdef DESKMIRROR_TEST
e_menu_item_icon_file_set(submi, "sup");
#endif
- if ((bd->zone == zone) && (!bd->iconic) && (bd->desk == desk))
+ if ((ec->zone == zone) && (!ec->iconic) && (ec->desk == desk))
e_menu_item_toggle_set(submi, 1);
else
- e_menu_item_callback_set(submi, _e_border_menu_cb_sendto, desk);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_sendto, desk);
#ifdef DESKMIRROR_TEST
submi->icon_object = e_deskmirror_add(desk);
edje_extern_object_min_size_set(submi->icon_object, tw, th);
evas_object_show(submi->icon_object);
#else
- e_menu_item_realize_callback_set(submi, _e_border_menu_cb_sendto_icon_pre,
+ e_menu_item_realize_callback_set(submi, _e_client_menu_cb_sendto_icon_pre,
desk);
#endif
}
@@ -994,59 +994,59 @@ _e_border_menu_cb_sendto_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
}
static void
-_e_border_menu_cb_sendto(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_sendto(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
E_Desk *desk;
- E_Border *bd;
+ E_Client *ec;
desk = data;
- bd = e_object_data_get(E_OBJECT(m));
- if ((bd) && (desk))
- e_border_desk_set(bd, desk);
+ ec = e_object_data_get(E_OBJECT(m));
+ if ((ec) && (desk))
+ e_client_desk_set(ec, desk);
}
static void
-_e_border_menu_cb_pin(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_pin(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = e_object_data_get(E_OBJECT(m));
- if (bd) e_border_pinned_set(bd, 1);
+ ec = e_object_data_get(E_OBJECT(m));
+ if (ec) e_client_pinned_set(ec, 1);
}
static void
-_e_border_menu_cb_unpin(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_unpin(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = e_object_data_get(E_OBJECT(m));
- if (bd) e_border_pinned_set(bd, 0);
+ ec = e_object_data_get(E_OBJECT(m));
+ if (ec) e_client_pinned_set(ec, 0);
}
static void
-_e_border_menu_cb_stacking_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_stacking_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
E_Menu *subm;
E_Menu_Item *submi;
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
subm = e_menu_new();
- e_object_data_set(E_OBJECT(subm), bd);
+ e_object_data_set(E_OBJECT(subm), ec);
e_menu_item_submenu_set(mi, subm);
e_object_unref(E_OBJECT(subm));
/* Only allow to change layer for windows in "normal" layers */
e_menu_category_set(subm, "border/stacking");
- e_menu_category_data_set("border/stacking", bd);
+ e_menu_category_data_set("border/stacking", ec);
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Always on Top"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 2);
- e_menu_item_toggle_set(submi, (bd->layer == 150 ? 1 : 0));
- e_menu_item_callback_set(submi, _e_border_menu_cb_on_top, bd);
+ e_menu_item_toggle_set(submi, (ec->layer == 150 ? 1 : 0));
+ e_menu_item_callback_set(submi, _e_client_menu_cb_on_top, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stack_on_top"),
@@ -1056,8 +1056,8 @@ _e_border_menu_cb_stacking_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
e_menu_item_label_set(submi, _("Normal"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 2);
- e_menu_item_toggle_set(submi, (bd->layer == 100 ? 1 : 0));
- e_menu_item_callback_set(submi, _e_border_menu_cb_normal, bd);
+ e_menu_item_toggle_set(submi, (ec->layer == 100 ? 1 : 0));
+ e_menu_item_callback_set(submi, _e_client_menu_cb_normal, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stack_normal"),
@@ -1067,8 +1067,8 @@ _e_border_menu_cb_stacking_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
e_menu_item_label_set(submi, _("Always Below"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 2);
- e_menu_item_toggle_set(submi, (bd->layer == 50 ? 1 : 0));
- e_menu_item_callback_set(submi, _e_border_menu_cb_below, bd);
+ e_menu_item_toggle_set(submi, (ec->layer == 50 ? 1 : 0));
+ e_menu_item_callback_set(submi, _e_client_menu_cb_below, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stack_below"),
@@ -1078,12 +1078,12 @@ _e_border_menu_cb_stacking_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
e_menu_item_separator_set(submi, 1);
// Only allow to change layer for windows in "normal" layers
- if ((!bd->lock_user_stacking) &&
- ((bd->layer == 50) || (bd->layer == 100) || (bd->layer == 150)))
+ if ((!ec->lock_user_stacking) &&
+ ((ec->layer == 50) || (ec->layer == 100) || (ec->layer == 150)))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Raise"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_raise, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_raise, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stack_on_top"),
@@ -1091,7 +1091,7 @@ _e_border_menu_cb_stacking_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Lower"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_lower, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_lower, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stack_below"),
@@ -1101,26 +1101,26 @@ _e_border_menu_cb_stacking_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
submi = e_menu_item_new(subm);
e_menu_item_separator_set(submi, 1);
- if ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) ||
- (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN))
+ if ((ec->netwm.type == E_WINDOW_TYPE_NORMAL) ||
+ (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN))
{
- if ((bd->client.netwm.state.stacking != E_STACKING_BELOW) ||
- (!bd->user_skip_winlist) || (!bd->borderless))
+ if ((ec->netwm.state.stacking != E_STACKING_BELOW) ||
+ (!ec->user_skip_winlist) || (!ec->borderless))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Pin to Desktop"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_pin, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_pin, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stick"),
"e/widgets/border/default/stick");
}
- if ((bd->client.netwm.state.stacking == E_STACKING_BELOW) &&
- (bd->user_skip_winlist) && (bd->borderless))
+ if ((ec->netwm.state.stacking == E_STACKING_BELOW) &&
+ (ec->user_skip_winlist) && (ec->borderless))
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Unpin from Desktop"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_unpin, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_unpin, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/stick"),
@@ -1130,79 +1130,77 @@ _e_border_menu_cb_stacking_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
}
static void
-_e_border_menu_cb_raise(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_raise(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec = data;
- bd = data;
- if ((!bd->lock_user_stacking) && (!bd->internal) &&
- ((bd->layer == 50) || (bd->layer == 100) || (bd->layer == 150)))
+ if ((!ec->lock_user_stacking) && (!ec->internal) &&
+ ((ec->layer >= E_LAYER_CLIENT_DESKTOP) && (ec->layer <= E_LAYER_CLIENT_NORMAL)))
{
- e_border_raise(bd);
+ evas_object_raise(ec->frame);
}
}
static void
-_e_border_menu_cb_lower(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_lower(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec = data;
- bd = data;
- if ((!bd->lock_user_stacking) && (!bd->internal) &&
- ((bd->layer == 50) || (bd->layer == 100) || (bd->layer == 150)))
+ if ((!ec->lock_user_stacking) && (!ec->internal) &&
+ ((ec->layer >= E_LAYER_CLIENT_DESKTOP) && (ec->layer <= E_LAYER_CLIENT_NORMAL)))
{
- e_border_lower(bd);
+ evas_object_lower(ec->frame);
}
}
static void
-_e_border_menu_cb_default_icon(void *data, E_Menu *m, E_Menu_Item *mi)
+_e_client_menu_cb_default_icon(void *data, E_Menu *m, E_Menu_Item *mi)
{
- E_Border *bd;
+ E_Client *ec;
Evas_Object *o;
unsigned char prev_icon_pref;
- bd = data;
- E_OBJECT_CHECK(bd);
+ ec = data;
+ E_OBJECT_CHECK(ec);
- prev_icon_pref = bd->icon_preference;
- bd->icon_preference = E_ICON_PREF_E_DEFAULT;
- o = e_border_icon_add(bd, m->evas);
- bd->icon_preference = prev_icon_pref;
+ prev_icon_pref = ec->icon_preference;
+ ec->icon_preference = E_ICON_PREF_E_DEFAULT;
+ o = e_client_icon_add(ec, m->evas);
+ ec->icon_preference = prev_icon_pref;
mi->icon_object = o;
}
static void
-_e_border_menu_cb_netwm_icon(void *data, E_Menu *m, E_Menu_Item *mi)
+_e_client_menu_cb_netwm_icon(void *data, E_Menu *m, E_Menu_Item *mi)
{
- E_Border *bd;
+ E_Client *ec;
Evas_Object *o;
- bd = data;
- E_OBJECT_CHECK(bd);
+ ec = data;
+ E_OBJECT_CHECK(ec);
- if (bd->client.netwm.icons)
+ if (ec->netwm.icons)
{
o = e_icon_add(m->evas);
- e_icon_data_set(o, bd->client.netwm.icons[0].data,
- bd->client.netwm.icons[0].width,
- bd->client.netwm.icons[0].height);
+ e_icon_data_set(o, ec->netwm.icons[0].data,
+ ec->netwm.icons[0].width,
+ ec->netwm.icons[0].height);
e_icon_alpha_set(o, 1);
mi->icon_object = o;
}
}
static void
-_e_border_menu_cb_border_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_border_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
E_Menu *subm;
E_Menu_Item *submi;
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
subm = e_menu_new();
- e_object_data_set(E_OBJECT(subm), bd);
+ e_object_data_set(E_OBJECT(subm), ec);
e_menu_item_submenu_set(mi, subm);
e_object_unref(E_OBJECT(subm));
@@ -1210,7 +1208,7 @@ _e_border_menu_cb_border_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Select Border Style"));
- e_menu_item_callback_set(submi, _e_border_menu_cb_border, bd);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_border, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/borderless"),
@@ -1224,32 +1222,32 @@ _e_border_menu_cb_border_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
e_menu_item_label_set(submi, _("Use Enlightenment Default Icon Preference"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 2);
- e_menu_item_toggle_set(submi, (bd->icon_preference == E_ICON_PREF_E_DEFAULT ? 1 : 0));
- e_menu_item_realize_callback_set(submi, _e_border_menu_cb_default_icon, bd);
- e_menu_item_callback_set(submi, _e_border_menu_cb_iconpref_e, bd);
+ e_menu_item_toggle_set(submi, (ec->icon_preference == E_ICON_PREF_E_DEFAULT ? 1 : 0));
+ e_menu_item_realize_callback_set(submi, _e_client_menu_cb_default_icon, ec);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_iconpref_e, ec);
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Use Application Provided Icon"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 2);
- e_menu_item_toggle_set(submi, (bd->icon_preference == E_ICON_PREF_NETWM ? 1 : 0));
- e_menu_item_realize_callback_set(submi, _e_border_menu_cb_netwm_icon, bd);
- e_menu_item_callback_set(submi, _e_border_menu_cb_iconpref_netwm, bd);
+ e_menu_item_toggle_set(submi, (ec->icon_preference == E_ICON_PREF_NETWM ? 1 : 0));
+ e_menu_item_realize_callback_set(submi, _e_client_menu_cb_netwm_icon, ec);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_iconpref_netwm, ec);
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Use User Defined Icon"));
e_menu_item_radio_set(submi, 1);
e_menu_item_radio_group_set(submi, 2);
- e_menu_item_toggle_set(submi, (bd->icon_preference == E_ICON_PREF_USER ? 1 : 0));
- e_util_desktop_menu_item_icon_add(bd->desktop, 16, submi);
- e_menu_item_callback_set(submi, _e_border_menu_cb_iconpref_user, bd);
+ e_menu_item_toggle_set(submi, (ec->icon_preference == E_ICON_PREF_USER ? 1 : 0));
+ e_util_desktop_menu_item_icon_add(ec->desktop, 16, submi);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_iconpref_user, ec);
e_menu_item_separator_set(submi, 1);
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Offer Resistance"));
e_menu_item_check_set(submi, 1);
- e_menu_item_toggle_set(submi, (bd->offer_resistance ? 1 : 0));
- e_menu_item_callback_set(submi, _e_border_menu_cb_resistance, bd);
+ e_menu_item_toggle_set(submi, (ec->offer_resistance ? 1 : 0));
+ e_menu_item_callback_set(submi, _e_client_menu_cb_resistance, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/borderless"),
@@ -1257,60 +1255,60 @@ _e_border_menu_cb_border_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
}
static void
-_e_border_menu_cb_iconpref_e(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_iconpref_e(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
- bd->icon_preference = E_ICON_PREF_E_DEFAULT;
- bd->changes.icon = 1;
- bd->changed = 1;
+ ec->icon_preference = E_ICON_PREF_E_DEFAULT;
+ ec->changes.icon = 1;
+ ec->changed = 1;
}
static void
-_e_border_menu_cb_iconpref_user(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_iconpref_user(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
- bd->icon_preference = E_ICON_PREF_USER;
- bd->changes.icon = 1;
- bd->changed = 1;
+ ec->icon_preference = E_ICON_PREF_USER;
+ ec->changes.icon = 1;
+ ec->changed = 1;
}
static void
-_e_border_menu_cb_iconpref_netwm(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_iconpref_netwm(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
- bd->icon_preference = E_ICON_PREF_NETWM;
- bd->changes.icon = 1;
- bd->changed = 1;
+ ec->icon_preference = E_ICON_PREF_NETWM;
+ ec->changes.icon = 1;
+ ec->changed = 1;
}
static void
-_e_border_menu_cb_skip_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_skip_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
- E_Border *bd;
+ E_Client *ec;
E_Menu *subm;
E_Menu_Item *submi;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
subm = e_menu_new();
- e_object_data_set(E_OBJECT(subm), bd);
+ e_object_data_set(E_OBJECT(subm), ec);
e_menu_item_submenu_set(mi, subm);
e_object_unref(E_OBJECT(subm));
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Window List"));
e_menu_item_check_set(submi, 1);
- e_menu_item_toggle_set(submi, bd->user_skip_winlist);
- e_menu_item_callback_set(submi, _e_border_menu_cb_skip_winlist, bd);
+ e_menu_item_toggle_set(submi, ec->user_skip_winlist);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_skip_winlist, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/skip_winlist"),
@@ -1319,8 +1317,8 @@ _e_border_menu_cb_skip_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Pager"));
e_menu_item_check_set(submi, 1);
- e_menu_item_toggle_set(submi, bd->client.netwm.state.skip_pager);
- e_menu_item_callback_set(submi, _e_border_menu_cb_skip_pager, bd);
+ e_menu_item_toggle_set(submi, ec->netwm.state.skip_pager);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_skip_pager, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/skip_pager"),
@@ -1329,8 +1327,8 @@ _e_border_menu_cb_skip_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
submi = e_menu_item_new(subm);
e_menu_item_label_set(submi, _("Taskbar"));
e_menu_item_check_set(submi, 1);
- e_menu_item_toggle_set(submi, bd->client.netwm.state.skip_taskbar);
- e_menu_item_callback_set(submi, _e_border_menu_cb_skip_taskbar, bd);
+ e_menu_item_toggle_set(submi, ec->netwm.state.skip_taskbar);
+ e_menu_item_callback_set(submi, _e_client_menu_cb_skip_taskbar, ec);
e_menu_item_icon_edje_set(submi,
e_theme_edje_file_get("base/theme/borders",
"e/widgets/border/default/skip_taskbar"),
@@ -1338,47 +1336,47 @@ _e_border_menu_cb_skip_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
}
static void
-_e_border_menu_cb_fav_add(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_fav_add(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
Efreet_Menu *menu;
char buf[PATH_MAX];
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
e_user_dir_concat_static(buf, "applications/menu/favorite.menu");
menu = efreet_menu_parse(buf);
if (!menu)
menu = efreet_menu_new("Favorites");
if (!menu) return;
- efreet_menu_desktop_insert(menu, bd->desktop, -1);
+ efreet_menu_desktop_insert(menu, ec->desktop, -1);
efreet_menu_save(menu, buf);
efreet_menu_free(menu);
}
static void
-_e_border_menu_cb_kbdshrtct_add(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_kbdshrtct_add(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
E_Zone *zone;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
zone = e_util_zone_current_get(e_manager_current_get());
if (!zone) return;
e_configure_registry_call("keyboard_and_mouse/key_bindings",
- zone->container, bd->desktop->exec);
+ zone->comp, ec->desktop->exec);
}
static void
-_e_border_menu_cb_ibar_add_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
+_e_client_menu_cb_ibar_add_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
{
E_Menu *sm;
- E_Border *bd;
+ E_Client *ec;
Eina_List *dirs;
Eina_List *l;
char buf[PATH_MAX], *file;
size_t len;
- if (!(bd = data)) return;
+ if (!(ec = data)) return;
len = e_user_dir_concat_static(buf, "applications/bar");
if (len + 1 >= sizeof(buf)) return;
dirs = ecore_file_ls(buf);
@@ -1399,29 +1397,29 @@ _e_border_menu_cb_ibar_add_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
{
smi = e_menu_item_new(sm);
e_menu_item_label_set(smi, file);
- e_menu_item_callback_set(smi, _e_border_menu_cb_ibar_add, file);
+ e_menu_item_callback_set(smi, _e_client_menu_cb_ibar_add, file);
}
}
- e_object_data_set(E_OBJECT(sm), bd);
+ e_object_data_set(E_OBJECT(sm), ec);
e_menu_item_submenu_set(mi, sm);
e_object_unref(E_OBJECT(sm));
}
static void
-_e_border_menu_cb_ibar_add(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__)
+_e_client_menu_cb_ibar_add(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
E_Order *od;
- E_Border *bd;
+ E_Client *ec;
char buf[PATH_MAX];
- bd = e_object_data_get(E_OBJECT(m));
- if ((!bd) || (!bd->desktop)) return;
+ ec = e_object_data_get(E_OBJECT(m));
+ if ((!ec) || (!ec->desktop)) return;
e_user_dir_snprintf(buf, sizeof(buf), "applications/bar/%s/.order",
(const char *)data);
od = e_order_new(buf);
if (!od) return;
- e_order_append(od, bd->desktop);
+ e_order_append(od, ec->desktop);
e_object_del(E_OBJECT(od));
}
diff --git a/src/bin/e_int_client_menu.h b/src/bin/e_int_client_menu.h
new file mode 100644
index 0000000000..e5cbe4c758
--- /dev/null
+++ b/src/bin/e_int_client_menu.h
@@ -0,0 +1,22 @@
+#ifdef E_TYPEDEFS
+
+#else
+#ifndef E_INT_BORDER_MENU_H
+#define E_INT_BORDER_MENU_H
+
+typedef void (*E_Client_Menu_Hook_Cb)(void *, E_Client *);
+typedef struct E_Client_Menu_Hook
+{
+ E_Client_Menu_Hook_Cb cb;
+ void *data;
+} E_Client_Menu_Hook;
+
+EAPI E_Client_Menu_Hook *e_int_client_menu_hook_add(E_Client_Menu_Hook_Cb cb, const void *data);
+EAPI void e_int_client_menu_hook_del(E_Client_Menu_Hook *hook);
+EAPI void e_int_client_menu_hooks_clear(void);
+EAPI void e_int_client_menu_create(E_Client *ec);
+EAPI void e_int_client_menu_show(E_Client *ec, Evas_Coord x, Evas_Coord y, int key, Ecore_X_Time timestamp);
+EAPI void e_int_client_menu_del(E_Client *ec);
+
+#endif
+#endif
diff --git a/src/bin/e_int_border_prop.c b/src/bin/e_int_client_prop.c
index e75a76e923..8fb112944f 100644
--- a/src/bin/e_int_border_prop.c
+++ b/src/bin/e_int_client_prop.c
@@ -6,17 +6,17 @@
#define MODE_GEOMETRY_LOCKS 3
#define MODE_ALL 4
-static void _bd_cb_dialog_del(void *obj);
-static void _bd_cb_dialog_close(void *data, E_Dialog *dia);
-static Evas_Object *_bd_icccm_create(E_Dialog *dia, void *data);
-static Evas_Object *_bd_netwm_create(E_Dialog *dia, void *data);
-static void _bd_go(void *data, void *data2);
-static void _create_data(E_Dialog *cfd, E_Border *bd);
+static void _ec_cb_dialog_del(void *obj);
+static void _ec_cb_dialog_close(void *data, E_Dialog *dia);
+static Evas_Object *_ec_icccm_create(E_Dialog *dia, void *data);
+static Evas_Object *_ec_netwm_create(E_Dialog *dia, void *data);
+static void _ec_go(void *data, void *data2);
+static void _create_data(E_Dialog *cfd, E_Client *ec);
static void _free_data(E_Dialog *cfd, E_Config_Dialog_Data *cfdata);
struct _E_Config_Dialog_Data
{
- E_Border *border;
+ E_Client *client;
/*- BASIC -*/
struct
{
@@ -65,89 +65,89 @@ struct _E_Config_Dialog_Data
};
EAPI void
-e_int_border_prop(E_Border *bd)
+e_int_client_prop(E_Client *ec)
{
E_Dialog *dia;
- if (bd->border_prop_dialog) return;
+ if (ec->border_prop_dialog) return;
- dia = e_dialog_new(bd->zone->container, "E", "_window_props");
- e_object_del_attach_func_set(E_OBJECT(dia), _bd_cb_dialog_del);
+ dia = e_dialog_new(ec->zone->comp, "E", "_window_props");
+ e_object_del_attach_func_set(E_OBJECT(dia), _ec_cb_dialog_del);
- _create_data(dia, bd);
+ _create_data(dia, ec);
- _bd_go(dia, (void *)0);
+ _ec_go(dia, (void *)0);
- e_dialog_button_add(dia, _("Close"), NULL, _bd_cb_dialog_close, dia);
+ e_dialog_button_add(dia, _("Close"), NULL, _ec_cb_dialog_close, dia);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
e_dialog_border_icon_set(dia, "preferences-system-windows");
}
static void
-_create_data(E_Dialog *cfd, E_Border *bd)
+_create_data(E_Dialog *cfd, E_Client *ec)
{
E_Config_Dialog_Data *cfdata;
char buf[4096];
cfdata = E_NEW(E_Config_Dialog_Data, 1);
- cfdata->border = bd;
- bd->border_prop_dialog = cfd;
+ cfdata->client = ec;
+ ec->border_prop_dialog = cfd;
#define IFDUP(prop, dest) \
- if (cfdata->border->prop) \
- cfdata->dest = strdup(cfdata->border->prop)
+ if (cfdata->client->prop) \
+ cfdata->dest = strdup(cfdata->client->prop)
- IFDUP(client.icccm.title, icccm.title);
- IFDUP(client.icccm.name, icccm.name);
- IFDUP(client.icccm.class, icccm.class);
- IFDUP(client.icccm.icon_name, icccm.icon_name);
- IFDUP(client.icccm.machine, icccm.machine);
- IFDUP(client.icccm.window_role, icccm.role);
+ IFDUP(icccm.title, icccm.title);
+ IFDUP(icccm.name, icccm.name);
+ IFDUP(icccm.class, icccm.class);
+ IFDUP(icccm.icon_name, icccm.icon_name);
+ IFDUP(icccm.machine, icccm.machine);
+ IFDUP(icccm.window_role, icccm.role);
- if (cfdata->border->client.icccm.min_w >= 0)
+ if (cfdata->client->icccm.min_w >= 0)
{
snprintf(buf, sizeof(buf), _("%i×%i"),
- cfdata->border->client.icccm.min_w,
- cfdata->border->client.icccm.min_h);
+ cfdata->client->icccm.min_w,
+ cfdata->client->icccm.min_h);
cfdata->icccm.min = strdup(buf);
}
- if (cfdata->border->client.icccm.max_w >= 0)
+ if (cfdata->client->icccm.max_w >= 0)
{
snprintf(buf, sizeof(buf), _("%i×%i"),
- cfdata->border->client.icccm.max_w,
- cfdata->border->client.icccm.max_h);
+ cfdata->client->icccm.max_w,
+ cfdata->client->icccm.max_h);
cfdata->icccm.max = strdup(buf);
}
- if (cfdata->border->client.icccm.base_w >= 0)
+ if (cfdata->client->icccm.base_w >= 0)
{
snprintf(buf, sizeof(buf), _("%i×%i"),
- cfdata->border->client.icccm.base_w,
- cfdata->border->client.icccm.base_h);
+ cfdata->client->icccm.base_w,
+ cfdata->client->icccm.base_h);
cfdata->icccm.base = strdup(buf);
}
- if (cfdata->border->client.icccm.step_w >= 0)
+ if (cfdata->client->icccm.step_w >= 0)
{
snprintf(buf, sizeof(buf), _("%i,%i"),
- cfdata->border->client.icccm.step_w,
- cfdata->border->client.icccm.step_h);
+ cfdata->client->icccm.step_w,
+ cfdata->client->icccm.step_h);
cfdata->icccm.step = strdup(buf);
}
- if ((cfdata->border->client.icccm.min_aspect > 0.0) &&
- (cfdata->border->client.icccm.max_aspect > 0.0))
+ if ((cfdata->client->icccm.min_aspect > 0.0) &&
+ (cfdata->client->icccm.max_aspect > 0.0))
{
- if (cfdata->border->client.icccm.min_aspect == cfdata->border->client.icccm.max_aspect)
+ if (cfdata->client->icccm.min_aspect == cfdata->client->icccm.max_aspect)
snprintf(buf, sizeof(buf), _("%1.3f"),
- cfdata->border->client.icccm.min_aspect);
+ cfdata->client->icccm.min_aspect);
else
snprintf(buf, sizeof(buf), _("%1.3f–%1.3f"),
- cfdata->border->client.icccm.min_aspect,
- cfdata->border->client.icccm.max_aspect);
+ cfdata->client->icccm.min_aspect,
+ cfdata->client->icccm.max_aspect);
cfdata->icccm.aspect = strdup(buf);
}
- if (cfdata->border->client.icccm.initial_state != ECORE_X_WINDOW_STATE_HINT_NONE)
+ if (cfdata->client->icccm.initial_state != ECORE_X_WINDOW_STATE_HINT_NONE)
{
- switch (cfdata->border->client.icccm.initial_state)
+ switch (cfdata->client->icccm.initial_state)
{
case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
snprintf(buf, sizeof(buf), _("Withdrawn"));
@@ -167,9 +167,9 @@ _create_data(E_Dialog *cfd, E_Border *bd)
}
cfdata->icccm.initial_state = strdup(buf);
}
- if (cfdata->border->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_NONE)
+ if (cfdata->client->icccm.state != ECORE_X_WINDOW_STATE_HINT_NONE)
{
- switch (cfdata->border->client.icccm.state)
+ switch (cfdata->client->icccm.state)
{
case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
snprintf(buf, sizeof(buf), _("Withdrawn"));
@@ -190,27 +190,27 @@ _create_data(E_Dialog *cfd, E_Border *bd)
cfdata->icccm.state = strdup(buf);
}
snprintf(buf, sizeof(buf), "0x%08x",
- cfdata->border->client.win);
+ (unsigned int)e_client_util_win_get(cfdata->client));
cfdata->icccm.window_id = strdup(buf);
- if (cfdata->border->client.icccm.window_group != 0)
+ if (cfdata->client->icccm.window_group != 0)
{
snprintf(buf, sizeof(buf), "0x%08x",
- cfdata->border->client.icccm.window_group);
+ cfdata->client->icccm.window_group);
cfdata->icccm.window_group = strdup(buf);
}
- if (cfdata->border->client.icccm.transient_for != 0)
+ if (cfdata->client->icccm.transient_for != 0)
{
snprintf(buf, sizeof(buf), "0x%08x",
- cfdata->border->client.icccm.transient_for);
+ cfdata->client->icccm.transient_for);
cfdata->icccm.transient_for = strdup(buf);
}
- if (cfdata->border->client.icccm.client_leader != 0)
+ if (cfdata->client->icccm.client_leader != 0)
{
snprintf(buf, sizeof(buf), "0x%08x",
- cfdata->border->client.icccm.client_leader);
+ cfdata->client->icccm.client_leader);
cfdata->icccm.client_leader = strdup(buf);
}
- switch (cfdata->border->client.icccm.gravity)
+ switch (cfdata->client->icccm.gravity)
{
case ECORE_X_GRAVITY_FORGET:
snprintf(buf, sizeof(buf), _("Forget/Unmap"));
@@ -261,38 +261,38 @@ _create_data(E_Dialog *cfd, E_Border *bd)
break;
}
cfdata->icccm.gravity = strdup(buf);
- if (cfdata->border->client.icccm.command.argv)
+ if (cfdata->client->icccm.command.argv)
{
int i;
buf[0] = 0;
- for (i = 0; i < cfdata->border->client.icccm.command.argc; i++)
+ for (i = 0; i < cfdata->client->icccm.command.argc; i++)
{
if ((sizeof(buf) - strlen(buf)) <
- (strlen(cfdata->border->client.icccm.command.argv[i]) - 2))
+ (strlen(cfdata->client->icccm.command.argv[i]) - 2))
break;
- strcat(buf, cfdata->border->client.icccm.command.argv[i]);
+ strcat(buf, cfdata->client->icccm.command.argv[i]);
strcat(buf, " ");
}
cfdata->icccm.command = strdup(buf);
}
- cfdata->icccm.take_focus = cfdata->border->client.icccm.take_focus;
- cfdata->icccm.accepts_focus = cfdata->border->client.icccm.accepts_focus;
- cfdata->icccm.urgent = cfdata->border->client.icccm.urgent;
- cfdata->icccm.delete_request = cfdata->border->client.icccm.delete_request;
- cfdata->icccm.request_pos = cfdata->border->client.icccm.request_pos;
-
- IFDUP(client.netwm.name, netwm.name);
- IFDUP(client.netwm.icon_name, netwm.icon_name);
- cfdata->netwm.modal = cfdata->border->client.netwm.state.modal;
- cfdata->netwm.sticky = cfdata->border->client.netwm.state.sticky;
- cfdata->netwm.shaded = cfdata->border->client.netwm.state.shaded;
- cfdata->netwm.skip_taskbar = cfdata->border->client.netwm.state.skip_taskbar;
- cfdata->netwm.skip_pager = cfdata->border->client.netwm.state.skip_pager;
- cfdata->netwm.hidden = cfdata->border->client.netwm.state.hidden;
- cfdata->netwm.fullscreen = cfdata->border->client.netwm.state.fullscreen;
- switch (cfdata->border->client.netwm.state.stacking)
+ cfdata->icccm.take_focus = cfdata->client->icccm.take_focus;
+ cfdata->icccm.accepts_focus = cfdata->client->icccm.accepts_focus;
+ cfdata->icccm.urgent = cfdata->client->icccm.urgent;
+ cfdata->icccm.delete_request = cfdata->client->icccm.delete_request;
+ cfdata->icccm.request_pos = cfdata->client->icccm.request_pos;
+
+ IFDUP(netwm.name, netwm.name);
+ IFDUP(netwm.icon_name, netwm.icon_name);
+ cfdata->netwm.modal = cfdata->client->netwm.state.modal;
+ cfdata->netwm.sticky = cfdata->client->netwm.state.sticky;
+ cfdata->netwm.shaded = cfdata->client->netwm.state.shaded;
+ cfdata->netwm.skip_taskbar = cfdata->client->netwm.state.skip_taskbar;
+ cfdata->netwm.skip_pager = cfdata->client->netwm.state.skip_pager;
+ cfdata->netwm.hidden = cfdata->client->netwm.state.hidden;
+ cfdata->netwm.fullscreen = cfdata->client->netwm.state.fullscreen;
+ switch (cfdata->client->netwm.state.stacking)
{
case 0:
cfdata->netwm.stacking = strdup(_("None"));
@@ -313,8 +313,8 @@ _create_data(E_Dialog *cfd, E_Border *bd)
static void
_free_data(E_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
- if (cfdata->border)
- cfdata->border->border_prop_dialog = NULL;
+ if (cfdata->client)
+ cfdata->client->border_prop_dialog = NULL;
/* Free the cfdata */
#define IFREE(x) E_FREE(cfdata->x)
@@ -347,7 +347,7 @@ _free_data(E_Dialog *cfd, E_Config_Dialog_Data *cfdata)
}
static void
-_bd_cb_dialog_del(void *obj)
+_ec_cb_dialog_del(void *obj)
{
E_Dialog *dia;
@@ -357,7 +357,7 @@ _bd_cb_dialog_del(void *obj)
}
static void
-_bd_cb_dialog_close(void *data __UNUSED__, E_Dialog *dia)
+_ec_cb_dialog_close(void *data __UNUSED__, E_Dialog *dia)
{
if (dia->data)
_free_data(dia, dia->data);
@@ -365,7 +365,7 @@ _bd_cb_dialog_close(void *data __UNUSED__, E_Dialog *dia)
}
static void
-_bd_go(void *data, void *data2)
+_ec_go(void *data, void *data2)
{
E_Dialog *dia;
Evas_Object *c, *o, *ob;
@@ -381,19 +381,19 @@ _bd_go(void *data, void *data2)
if (!data2)
{
- o = _bd_icccm_create(dia, NULL);
+ o = _ec_icccm_create(dia, NULL);
e_dialog_title_set(dia, _("ICCCM Properties"));
e_widget_list_object_append(c, o, 1, 1, 0.0);
ob = e_widget_button_add(e_win_evas_get(dia->win), _("NetWM"), "go-next",
- _bd_go, dia, (void *)1);
+ _ec_go, dia, (void *)1);
}
else
{
- o = _bd_netwm_create(dia, NULL);
+ o = _ec_netwm_create(dia, NULL);
e_dialog_title_set(dia, _("NetWM Properties"));
e_widget_list_object_append(c, o, 1, 1, 0.0);
ob = e_widget_button_add(e_win_evas_get(dia->win), _("ICCCM"), "go-next",
- _bd_go, dia, (void *)0);
+ _ec_go, dia, (void *)0);
}
e_widget_list_object_append(c, ob, 0, 0, 1.0);
@@ -425,7 +425,7 @@ _bd_go(void *data, void *data2)
}
static Evas_Object *
-_bd_icccm_create(E_Dialog *dia, void *data __UNUSED__)
+_ec_icccm_create(E_Dialog *dia, void *data __UNUSED__)
{
Evas *evas;
Evas_Object *o, *ob, *otb;
@@ -481,7 +481,7 @@ _bd_icccm_create(E_Dialog *dia, void *data __UNUSED__)
}
static Evas_Object *
-_bd_netwm_create(E_Dialog *dia, void *data __UNUSED__)
+_ec_netwm_create(E_Dialog *dia, void *data __UNUSED__)
{
Evas *evas;
Evas_Object *o, *ob, *otb;
diff --git a/src/bin/e_int_border_prop.h b/src/bin/e_int_client_prop.h
index 089a9837c3..85464572bc 100644
--- a/src/bin/e_int_border_prop.h
+++ b/src/bin/e_int_client_prop.h
@@ -3,7 +3,7 @@
#ifndef E_INT_BORDER_PROP_H
#define E_INT_BORDER_PROP_H
-EAPI void e_int_border_prop(E_Border *bd);
+EAPI void e_int_client_prop(E_Client *ec);
#endif
#endif
diff --git a/src/bin/e_int_border_remember.c b/src/bin/e_int_client_remember.c
index 17ce596c9e..013b325b63 100644
--- a/src/bin/e_int_border_remember.c
+++ b/src/bin/e_int_client_remember.c
@@ -21,7 +21,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E
E_REMEMBER_APPLY_OFFER_RESISTANCE | E_REMEMBER_APPLY_OPACITY
struct _E_Config_Dialog_Data
{
- E_Border *border;
+ E_Client *client;
E_Remember *rem;
/*- BASIC -*/
int mode;
@@ -69,7 +69,7 @@ struct _E_Config_Dialog_Data
/* a nice easy setup function that does the dirty work */
EAPI E_Config_Dialog *
-e_int_border_remember_edit(E_Remember *rem)
+e_int_client_remember_edit(E_Remember *rem)
{
E_Config_Dialog_View *v;
@@ -81,14 +81,14 @@ e_int_border_remember_edit(E_Remember *rem)
v->basic.create_widgets = _advanced_create_widgets;
v->override_auto_apply = 1;
- /* create config dialog for bd object/data */
+ /* create config dialog for ec object/data */
return e_config_dialog_new(NULL, _("Window Remember"),
"E", "_border_remember_edit_dialog",
NULL, 0, v, rem);
}
EAPI void
-e_int_border_remember(E_Border *bd)
+e_int_client_remember(E_Client *ec)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
@@ -105,12 +105,12 @@ e_int_border_remember(E_Border *bd)
v->advanced.create_widgets = _advanced_create_widgets;
v->override_auto_apply = 1;
- /* create config dialog for bd object/data */
- cfd = e_config_dialog_new(bd->zone->container,
+ /* create config dialog for ec object/data */
+ cfd = e_config_dialog_new(ec->zone->comp,
_("Window Remember"),
"E", "_border_remember_dialog",
- NULL, 0, v, bd);
- bd->border_remember_dialog = cfd;
+ NULL, 0, v, ec);
+ ec->border_remember_dialog = cfd;
}
}
@@ -131,12 +131,12 @@ _clear_data(E_Config_Dialog_Data *cfdata)
static void
_fill_data(E_Config_Dialog_Data *cfdata)
{
- E_Border *bd;
+ E_Client *ec;
E_Remember *rem;
- bd = cfdata->border;
- if (bd)
- rem = bd->remember;
+ ec = cfdata->client;
+ if (ec)
+ rem = ec->remember;
else
rem = cfdata->rem;
@@ -158,64 +158,64 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->remember.apply_desktop_file = 1;
}
- if (bd)
+ if (ec)
{
if (!cfdata->name &&
- bd->client.icccm.name &&
- bd->client.icccm.name[0])
- cfdata->name = strdup(bd->client.icccm.name);
+ ec->icccm.name &&
+ ec->icccm.name[0])
+ cfdata->name = strdup(ec->icccm.name);
if (!cfdata->class &&
- bd->client.icccm.class &&
- bd->client.icccm.class[0])
- cfdata->class = strdup(bd->client.icccm.class);
+ ec->icccm.class &&
+ ec->icccm.class[0])
+ cfdata->class = strdup(ec->icccm.class);
if (!cfdata->role &&
- bd->client.icccm.window_role &&
- bd->client.icccm.window_role[0])
- cfdata->role = strdup(bd->client.icccm.window_role);
+ ec->icccm.window_role &&
+ ec->icccm.window_role[0])
+ cfdata->role = strdup(ec->icccm.window_role);
if (!cfdata->title)
{
- const char *title = e_border_name_get(bd);
+ const char *title = e_client_name_get(ec);
if (title && title[0])
cfdata->title = strdup(title);
}
- if (!cfdata->desktop && bd->desktop)
- cfdata->desktop = strdup(bd->desktop->name);
+ if (!cfdata->desktop && ec->desktop)
+ cfdata->desktop = strdup(ec->desktop->name);
if (!cfdata->command &&
- (bd->client.icccm.command.argc > 0) &&
- (bd->client.icccm.command.argv))
+ (ec->icccm.command.argc > 0) &&
+ (ec->icccm.command.argv))
{
char buf[4096];
int i, j, k;
buf[0] = 0;
k = 0;
- for (i = 0; i < bd->client.icccm.command.argc; i++)
+ for (i = 0; i < ec->icccm.command.argc; i++)
{
if (i > 0)
{
buf[k] = ' ';
k++;
}
- for (j = 0; bd->client.icccm.command.argv[i][j]; j++)
+ for (j = 0; ec->icccm.command.argv[i][j]; j++)
{
if (k >= (int)(sizeof(buf) - 10))
{
buf[k] = 0;
goto done;
}
- if ((bd->client.icccm.command.argv[i][j] == ' ') ||
- (bd->client.icccm.command.argv[i][j] == '\t') ||
- (bd->client.icccm.command.argv[i][j] == '\\') ||
- (bd->client.icccm.command.argv[i][j] == '\"') ||
- (bd->client.icccm.command.argv[i][j] == '\'') ||
- (bd->client.icccm.command.argv[i][j] == '$') ||
- (bd->client.icccm.command.argv[i][j] == '%'))
+ if ((ec->icccm.command.argv[i][j] == ' ') ||
+ (ec->icccm.command.argv[i][j] == '\t') ||
+ (ec->icccm.command.argv[i][j] == '\\') ||
+ (ec->icccm.command.argv[i][j] == '\"') ||
+ (ec->icccm.command.argv[i][j] == '\'') ||
+ (ec->icccm.command.argv[i][j] == '$') ||
+ (ec->icccm.command.argv[i][j] == '%'))
{
buf[k] = '\\';
k++;
}
- buf[k] = bd->client.icccm.command.argv[i][j];
+ buf[k] = ec->icccm.command.argv[i][j];
k++;
}
}
@@ -295,7 +295,7 @@ _create_data(E_Config_Dialog *cfd)
cfdata = E_NEW(E_Config_Dialog_Data, 1);
if (!strcmp(cfd->class, "_border_remember_dialog"))
- cfdata->border = cfd->data;
+ cfdata->client = cfd->data;
else
cfdata->rem = cfd->data;
cfdata->applied = 1;
@@ -313,26 +313,26 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
free(cfdata->command);
free(cfdata->desktop);
- if (cfdata->border)
+ if (cfdata->client)
{
- if (!cfdata->applied && cfdata->border->remember)
+ if (!cfdata->applied && cfdata->client->remember)
{
- e_remember_unuse(cfdata->border->remember);
- e_remember_del(cfdata->border->remember);
+ e_remember_unuse(cfdata->client->remember);
+ e_remember_del(cfdata->client->remember);
e_config_save_queue();
}
- cfdata->border->border_remember_dialog = NULL;
+ cfdata->client->border_remember_dialog = NULL;
}
free(cfdata);
}
static void
-_warning_dialog_show(E_Container *con)
+_warning_dialog_show(E_Comp *c)
{
E_Dialog *dia;
- dia = e_dialog_new(con, "E", "_border_remember_error_multi_dialog");
+ dia = e_dialog_new(c, "E", "_border_remember_error_multi_dialog");
e_dialog_title_set(dia, _("Window properties are not a unique match"));
e_dialog_text_set
(dia,
@@ -358,52 +358,54 @@ _warning_dialog_show(E_Container *con)
static int
_check_matches(E_Remember *rem, int update)
{
- Eina_List *l;
- E_Border *bd;
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Comp *c;
const char *title;
int n = 0;
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- {
- int match = rem->match;
- title = e_border_name_get(bd);
-
- if ((match & E_REMEMBER_MATCH_NAME) &&
- (e_util_glob_match(bd->client.icccm.name, rem->name)))
- match &= ~E_REMEMBER_MATCH_NAME;
-
- if ((match & E_REMEMBER_MATCH_CLASS) &&
- (e_util_glob_match(bd->client.icccm.class, rem->class)))
- match &= ~E_REMEMBER_MATCH_CLASS;
-
- if ((match & E_REMEMBER_MATCH_TITLE) &&
- (e_util_glob_match(title, rem->title)))
- match &= ~E_REMEMBER_MATCH_TITLE;
-
- if ((match & E_REMEMBER_MATCH_ROLE) &&
- ((!e_util_strcmp(rem->role, bd->client.icccm.window_role)) ||
- (e_util_both_str_empty(rem->role, bd->client.icccm.window_role))))
- match &= ~E_REMEMBER_MATCH_ROLE;
-
- if ((match & E_REMEMBER_MATCH_TYPE) &&
- (rem->type == (int)bd->client.netwm.type))
- match &= ~E_REMEMBER_MATCH_TYPE;
-
- if ((match & E_REMEMBER_MATCH_TRANSIENT) &&
- ((rem->transient && bd->client.icccm.transient_for != 0) ||
- (!rem->transient && (bd->client.icccm.transient_for == 0))))
- match &= ~E_REMEMBER_MATCH_TRANSIENT;
-
- if (match == 0) n++;
-
- if (update)
- {
- bd->changed = 1;
- bd->changes.icon = 1;
- }
- else if (n > 1)
- break;
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ int match = rem->match;
+ title = e_client_name_get(ec);
+
+ if ((match & E_REMEMBER_MATCH_NAME) &&
+ (e_util_glob_match(ec->icccm.name, rem->name)))
+ match &= ~E_REMEMBER_MATCH_NAME;
+
+ if ((match & E_REMEMBER_MATCH_CLASS) &&
+ (e_util_glob_match(ec->icccm.class, rem->class)))
+ match &= ~E_REMEMBER_MATCH_CLASS;
+
+ if ((match & E_REMEMBER_MATCH_TITLE) &&
+ (e_util_glob_match(title, rem->title)))
+ match &= ~E_REMEMBER_MATCH_TITLE;
+
+ if ((match & E_REMEMBER_MATCH_ROLE) &&
+ ((!e_util_strcmp(rem->role, ec->icccm.window_role)) ||
+ (e_util_both_str_empty(rem->role, ec->icccm.window_role))))
+ match &= ~E_REMEMBER_MATCH_ROLE;
+
+ if ((match & E_REMEMBER_MATCH_TYPE) &&
+ (rem->type == (int)ec->netwm.type))
+ match &= ~E_REMEMBER_MATCH_TYPE;
+
+ if ((match & E_REMEMBER_MATCH_TRANSIENT) &&
+ ((rem->transient && ec->icccm.transient_for != 0) ||
+ (!rem->transient && (ec->icccm.transient_for == 0))))
+ match &= ~E_REMEMBER_MATCH_TRANSIENT;
+
+ if (match == 0) n++;
+
+ if (update)
+ {
+ ec->changed = 1;
+ ec->changes.icon = 1;
+ }
+ else if (n > 1)
+ break;
+ }
return n;
}
@@ -411,8 +413,8 @@ static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
/* Actually take our cfdata settings and apply them in real life */
- E_Border *bd = cfdata->border;
- E_Remember *rem = bd->remember;
+ E_Client *ec = cfdata->client;
+ E_Remember *rem = ec->remember;
if (cfdata->mode == MODE_NOTHING)
{
@@ -430,18 +432,18 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
rem = e_remember_new();
if (rem)
{
- bd->remember = rem;
+ ec->remember = rem;
cfdata->applied = 0;
}
else
return 0;
}
- e_remember_default_match_set(rem, cfdata->border);
+ e_remember_default_match_set(rem, cfdata->client);
if ((!cfdata->warned) && (_check_matches(rem, 0) > 1))
{
- _warning_dialog_show(cfd->con);
+ _warning_dialog_show(cfd->comp);
cfdata->warned = 1;
return 0;
}
@@ -450,7 +452,7 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
rem->apply_first_only = 0;
e_remember_use(rem);
- e_remember_update(bd);
+ e_remember_update(ec);
cfdata->applied = 1;
e_config_save_queue();
return 1; /* Apply was OK */
@@ -459,10 +461,10 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
static int
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
- E_Border *bd = cfdata->border;
+ E_Client *ec = cfdata->client;
E_Remember *rem;
- if (bd) rem = bd->remember;
+ if (ec) rem = ec->remember;
else rem = cfdata->rem;
if (!rem)
@@ -513,18 +515,18 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
rem->match |= E_REMEMBER_MATCH_ROLE;
rem->role = eina_stringshare_add(cfdata->role);
}
- if (bd)
+ if (ec)
{
if (cfdata->remember.match_type)
{
rem->match |= E_REMEMBER_MATCH_TYPE;
- rem->type = bd->client.netwm.type;
+ rem->type = ec->netwm.type;
}
if (cfdata->remember.match_transient)
{
rem->match |= E_REMEMBER_MATCH_TRANSIENT;
- if (bd->client.icccm.transient_for != 0)
+ if (ec->icccm.transient_for != 0)
rem->transient = 1;
else
rem->transient = 0;
@@ -535,7 +537,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
E_Dialog *dia;
- dia = e_dialog_new(cfd->con, "E", "_border_remember_error_noprop_dialog");
+ dia = e_dialog_new(cfd->comp, "E", "_border_remember_error_noprop_dialog");
e_dialog_title_set(dia, _("No match properties set"));
e_dialog_text_set
(dia,
@@ -548,8 +550,8 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
- if (bd)
- cfdata->border->remember = rem;
+ if (ec)
+ cfdata->client->remember = rem;
return 0;
}
@@ -561,7 +563,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
if ((!cfdata->remember.apply_first_only) &&
(_check_matches(rem, 0) > 1))
{
- _warning_dialog_show(cfd->con);
+ _warning_dialog_show(cfd->comp);
cfdata->warned = 1;
return 0;
}
@@ -610,21 +612,21 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
if (cfdata->remember.apply_opacity)
rem->apply |= E_REMEMBER_APPLY_OPACITY;
- if (bd && (!rem->apply && !rem->prop.desktop_file))
+ if (ec && (!rem->apply && !rem->prop.desktop_file))
{
e_remember_unuse(rem);
e_remember_del(rem);
- if (cfdata->border->remember)
+ if (cfdata->client->remember)
e_config_save_queue();
return 1;
}
- if (bd)
+ if (ec)
{
_check_matches(rem, 1);
rem->keep_settings = 0;
- cfdata->border->remember = rem;
- e_remember_update(cfdata->border);
+ cfdata->client->remember = rem;
+ e_remember_update(cfdata->client);
cfdata->applied = 1;
}
rem->keep_settings = cfdata->remember.keep_settings;
@@ -717,9 +719,9 @@ _advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_D
{
cfdata->remember.match_role = 0;
}
- if (cfdata->border)
+ if (cfdata->client)
{
- if (cfdata->border->client.netwm.type != ECORE_X_WINDOW_TYPE_UNKNOWN)
+ if (cfdata->client->netwm.type != E_WINDOW_TYPE_UNKNOWN)
{
ob = e_widget_check_add(evas, _("Window type"),
&(cfdata->remember.match_type));
diff --git a/src/bin/e_int_client_remember.h b/src/bin/e_int_client_remember.h
new file mode 100644
index 0000000000..379db8242b
--- /dev/null
+++ b/src/bin/e_int_client_remember.h
@@ -0,0 +1,10 @@
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_INT_BORDER_REMEMBER_H
+#define E_INT_BORDER_REMEMBER_H
+
+EAPI void e_int_client_remember(E_Client *ec);
+EAPI E_Config_Dialog *e_int_client_remember_edit(E_Remember *rem);
+
+#endif
+#endif
diff --git a/src/bin/e_int_config_modules.c b/src/bin/e_int_config_modules.c
index f4d274604c..8a33d5eb2a 100644
--- a/src/bin/e_int_config_modules.c
+++ b/src/bin/e_int_config_modules.c
@@ -83,7 +83,7 @@ static void _btn_cb_unload(void *data, void *data2);
static void _btn_cb_load(void *data, void *data2);
EAPI E_Config_Dialog *
-e_int_config_modules(E_Container *con, const char *params __UNUSED__)
+e_int_config_modules(E_Comp *c, const char *params __UNUSED__)
{
E_Config_Dialog *cfd = NULL;
E_Config_Dialog_View *v = NULL;
@@ -95,7 +95,7 @@ e_int_config_modules(E_Container *con, const char *params __UNUSED__)
v->free_cfdata = _free_data;
v->basic.create_widgets = _basic_create;
- cfd = e_config_dialog_new(con, _("Module Settings"),
+ cfd = e_config_dialog_new(c, _("Module Settings"),
"E", "extensions/modules",
"preferences-plugin", 0, v, NULL);
return cfd;
diff --git a/src/bin/e_int_config_modules.h b/src/bin/e_int_config_modules.h
index f1ad81ce72..982d3918bc 100644
--- a/src/bin/e_int_config_modules.h
+++ b/src/bin/e_int_config_modules.h
@@ -3,7 +3,7 @@
#ifndef E_INT_CONFIG_MODULES_H
#define E_INT_CONFIG_MODULES_H
-EAPI E_Config_Dialog *e_int_config_modules(E_Container *con, const char *params);
+EAPI E_Config_Dialog *e_int_config_modules(E_Comp *c, const char *params);
#endif
#endif
diff --git a/src/bin/e_int_gadcon_config.c b/src/bin/e_int_gadcon_config.c
index f89d967b01..a0b98b1e69 100644
--- a/src/bin/e_int_gadcon_config.c
+++ b/src/bin/e_int_gadcon_config.c
@@ -51,12 +51,11 @@ static void
_create_dialog(E_Gadcon *gc, const char *title, E_Gadcon_Site site)
{
E_Config_Dialog_View *v;
- E_Container *con;
if (gc->config_dialog)
{
e_win_raise(gc->config_dialog->dia->win);
- e_border_focus_set(gc->config_dialog->dia->win->border, 1, 1);
+ evas_object_focus_set(gc->config_dialog->dia->win->client->frame, 1);
return;
}
if (!(v = E_NEW(E_Config_Dialog_View, 1))) return;
@@ -66,9 +65,8 @@ _create_dialog(E_Gadcon *gc, const char *title, E_Gadcon_Site site)
v->basic.create_widgets = _basic_create;
v->advanced.create_widgets = _advanced_create;
- con = e_container_current_get(e_manager_current_get());
gc->config_dialog =
- e_config_dialog_new(con, title, "E", "_gadcon_config_dialog",
+ e_config_dialog_new(NULL, title, "E", "_gadcon_config_dialog",
"preferences-desktop-shelf", 0, v, gc);
if (site) gc->config_dialog->cfdata->site = site;
e_win_centered_set(gc->config_dialog->dia->win, EINA_TRUE);
diff --git a/src/bin/e_int_menus.c b/src/bin/e_int_menus.c
index 8eb8637809..79b092d44e 100644
--- a/src/bin/e_int_menus.c
+++ b/src/bin/e_int_menus.c
@@ -26,7 +26,7 @@ static void _e_int_menus_apps_drag(void *data, E_Menu *m, E_Menu_Item *m
static void _e_int_menus_config_pre_cb(void *data, E_Menu *m);
static void _e_int_menus_config_free_hook(void *obj);
static void _e_int_menus_clients_pre_cb(void *data, E_Menu *m);
-static void _e_int_menus_clients_item_create(E_Border *bd, E_Menu *m);
+static void _e_int_menus_clients_item_create(E_Client *ec, E_Menu *m);
static void _e_int_menus_clients_free_hook(void *obj);
static void _e_int_menus_clients_item_cb(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_int_menus_clients_icon_cb(void *data, E_Menu *m, E_Menu_Item *mi);
@@ -35,10 +35,10 @@ static int _e_int_menus_clients_group_desk_cb(const void *d1, const voi
static int _e_int_menus_clients_group_class_cb(const void *d1, const void *d2);
static int _e_int_menus_clients_sort_alpha_cb(const void *d1, const void *d2);
static int _e_int_menus_clients_sort_z_order_cb(const void *d1, const void *d2);
-static void _e_int_menus_clients_add_by_class(Eina_List *borders, E_Menu *m);
-static void _e_int_menus_clients_add_by_desk(E_Desk *curr_desk, Eina_List *borders, E_Menu *m);
-static void _e_int_menus_clients_add_by_none(Eina_List *borders, E_Menu *m);
-static void _e_int_menus_clients_menu_add_iconified(Eina_List *borders, E_Menu *m);
+static void _e_int_menus_clients_add_by_class(Eina_List *clients, E_Menu *m);
+static void _e_int_menus_clients_add_by_desk(E_Desk *curr_desk, Eina_List *clients, E_Menu *m);
+static void _e_int_menus_clients_add_by_none(Eina_List *clients, E_Menu *m);
+static void _e_int_menus_clients_menu_add_iconified(Eina_List *clients, E_Menu *m);
static const char *_e_int_menus_clients_title_abbrv(const char *title);
static void _e_int_menus_virtuals_pre_cb(void *data, E_Menu *m);
static void _e_int_menus_virtuals_item_cb(void *data, E_Menu *m, E_Menu_Item *mi);
@@ -109,7 +109,7 @@ _TEST(void *d __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
Evas_Object *o_list;
Evas *e;
- dia = e_dialog_normal_win_new(m->zone->container, "E", "_widget_playground_dialog");
+ dia = e_dialog_normal_win_new(m->zone->comp, "E", "_widget_playground_dialog");
e = e_win_evas_get(dia->win);
o_list = e_widget_ilist_add(e, 32, 32, NULL);
e_dialog_button_add(dia, "Add", NULL, _TEST_ADD, o_list);
@@ -587,7 +587,7 @@ _e_int_menus_main_about(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item
{
E_About *about;
- about = e_about_new(e_container_current_get(e_manager_current_get()));
+ about = e_about_new(e_util_comp_current_get());
if (about) e_about_show(about);
}
@@ -596,7 +596,7 @@ _e_int_menus_themes_about(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_It
{
E_Theme_About *about;
- about = e_theme_about_new(e_container_current_get(e_manager_current_get()));
+ about = e_theme_about_new(e_util_comp_current_get());
if (about) e_theme_about_show(about);
}
@@ -604,7 +604,7 @@ _e_int_menus_themes_about(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_It
static void
_e_int_menus_fwin_favorites_item_cb(void *data, E_Menu *m, E_Menu_Item *mi)
{
- e_fwin_new(m->zone->container, "favorites", "/");
+ e_fwin_new(m->zone->comp, "favorites", "/");
}
*/
@@ -988,7 +988,7 @@ _e_int_menus_apps_drag(void *data, E_Menu *m, E_Menu_Item *mi)
evas_object_geometry_get(mi->icon_object, &x, &y, &w, &h);
efreet_desktop_ref(desktop);
- drag = e_drag_new(m->zone->container, x, y, drag_types, 1, desktop, -1,
+ drag = e_drag_new(m->zone->comp, x, y, drag_types, 1, desktop, -1,
NULL, NULL);
size = MIN(w, h);
@@ -1062,7 +1062,7 @@ _e_int_menus_desktops_free_hook(void *obj)
static void
_e_int_menus_desk_item_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
- e_configure_registry_call("screen/virtual_desktops", m->zone->container, NULL);
+ e_configure_registry_call("screen/virtual_desktops", m->zone->comp, NULL);
}
static void
@@ -1088,7 +1088,7 @@ _e_int_menus_virtuals_icon_cb(void *data, E_Menu *m, E_Menu_Item *mi)
tw = 50;
th = (tw * desk->zone->h) / desk->zone->w;
- bgfile = e_bg_file_get(desk->zone->container->num, desk->zone->num, desk->x, desk->y);
+ bgfile = e_bg_file_get(desk->zone->comp->num, desk->zone->num, desk->x, desk->y);
o = e_thumb_icon_add(m->evas);
e_thumb_icon_file_set(o, bgfile, "e/desktop/background");
eina_stringshare_del(bgfile);
@@ -1144,18 +1144,18 @@ _e_int_menus_config_free_hook(void *obj)
static int
_e_int_menus_clients_group_desk_cb(const void *d1, const void *d2)
{
- const E_Border *bd1;
- const E_Border *bd2;
+ const E_Client *ec1;
+ const E_Client *ec2;
int j, k;
if (!d1) return 1;
if (!d2) return -1;
- bd1 = d1;
- bd2 = d2;
+ ec1 = d1;
+ ec2 = d2;
- j = bd1->desk->y * 12 + bd1->desk->x;
- k = bd2->desk->y * 12 + bd2->desk->x;
+ j = ec1->desk->y * 12 + ec1->desk->x;
+ k = ec2->desk->y * 12 + ec2->desk->x;
if (j > k) return 1;
if (j < k) return -1;
@@ -1165,35 +1165,35 @@ _e_int_menus_clients_group_desk_cb(const void *d1, const void *d2)
static int
_e_int_menus_clients_group_class_cb(const void *d1, const void *d2)
{
- const E_Border *bd1, *bd2;
+ const E_Client *ec1, *ec2;
if (!d1) return 1;
if (!d2) return -1;
- bd1 = d1;
- bd2 = d2;
+ ec1 = d1;
+ ec2 = d2;
- if (!bd1->client.icccm.class)
+ if (!ec1->icccm.class)
return -1;
- if (!bd2->client.icccm.class)
+ if (!ec2->icccm.class)
return 1;
- return strcmp(bd1->client.icccm.class, bd2->client.icccm.class) > 0 ? 1 : -1;
+ return strcmp(ec1->icccm.class, ec2->icccm.class) > 0 ? 1 : -1;
}
static int
_e_int_menus_clients_sort_alpha_cb(const void *d1, const void *d2)
{
- const E_Border *bd1, *bd2;
+ const E_Client *ec1, *ec2;
const char *name1, *name2;
if (!d1) return 1;
if (!d2) return -1;
- bd1 = d1;
- bd2 = d2;
- name1 = e_border_name_get(bd1);
- name2 = e_border_name_get(bd2);
+ ec1 = d1;
+ ec2 = d2;
+ name1 = e_client_name_get(ec1);
+ name2 = e_client_name_get(ec2);
if (strcasecmp(name1, name2) > 0) return 1;
if (strcasecmp(name1, name2) < 0) return -1;
@@ -1203,62 +1203,60 @@ _e_int_menus_clients_sort_alpha_cb(const void *d1, const void *d2)
static int
_e_int_menus_clients_sort_z_order_cb(const void *d1, const void *d2)
{
- const E_Border *bd1, *bd2;
+ const E_Client *ec1, *ec2;
if (!d1) return 1;
if (!d2) return -1;
- bd1 = d1;
- bd2 = d2;
+ ec1 = d1;
+ ec2 = d2;
- if (bd1->layer < bd2->layer) return 1;
- if (bd1->layer > bd2->layer) return -1;
+ if (ec1->layer < ec2->layer) return 1;
+ if (ec1->layer > ec2->layer) return -1;
return 0;
}
static void
-_e_int_menus_clients_menu_add_iconified(Eina_List *borders, E_Menu *m)
+_e_int_menus_clients_menu_add_iconified(Eina_List *clients, E_Menu *m)
{
- if (eina_list_count(borders) > 0)
- {
- Eina_List *l = NULL;
- E_Border *bd = NULL;
- E_Menu_Item *mi = NULL;
+ Eina_List *l = NULL;
+ E_Client *ec = NULL;
+ E_Menu_Item *mi = NULL;
- mi = e_menu_item_new(m);
- e_menu_item_separator_set(mi, 1);
+ if (!eina_list_count(clients)) return;
+ mi = e_menu_item_new(m);
+ e_menu_item_separator_set(mi, 1);
- EINA_LIST_FOREACH(borders, l, bd)
- _e_int_menus_clients_item_create(bd, m);
- }
+ EINA_LIST_FOREACH(clients, l, ec)
+ _e_int_menus_clients_item_create(ec, m);
}
static void
-_e_int_menus_clients_add_by_class(Eina_List *borders, E_Menu *m)
+_e_int_menus_clients_add_by_class(Eina_List *clients, E_Menu *m)
{
Eina_List *l = NULL, *ico = NULL;
- E_Border *bd;
+ E_Client *ec;
E_Menu *subm = NULL;
E_Menu_Item *mi = NULL;
char *class = NULL;
- EINA_LIST_FOREACH(borders, l, bd)
+ EINA_LIST_FOREACH(clients, l, ec)
{
- if ((bd->iconic) &&
+ if ((ec->iconic) &&
(e_config->clientlist_separate_iconified_apps == E_CLIENTLIST_GROUPICONS_SEP))
{
- ico = eina_list_append(ico, bd);
+ ico = eina_list_append(ico, ec);
continue;
}
- if (((e_util_strcmp(class, bd->client.icccm.class)) &&
+ if (((e_util_strcmp(class, ec->icccm.class)) &&
e_config->clientlist_separate_with != E_CLIENTLIST_GROUP_SEP_NONE))
{
if (e_config->clientlist_separate_with == E_CLIENTLIST_GROUP_SEP_MENU)
{
if ((subm) && (mi)) e_menu_item_submenu_set(mi, subm);
mi = e_menu_item_new(m);
- e_menu_item_label_set(mi, bd->client.icccm.class);
+ e_menu_item_label_set(mi, ec->icccm.class);
e_util_menu_item_theme_icon_set(mi, "preferences-system-windows");
subm = e_menu_new();
}
@@ -1268,12 +1266,12 @@ _e_int_menus_clients_add_by_class(Eina_List *borders, E_Menu *m)
e_menu_item_separator_set(mi, 1);
}
free(class);
- class = strdup(bd->client.icccm.class);
+ class = strdup(ec->icccm.class);
}
if (subm && (e_config->clientlist_separate_with == E_CLIENTLIST_GROUP_SEP_MENU))
- _e_int_menus_clients_item_create(bd, subm);
+ _e_int_menus_clients_item_create(ec, subm);
else
- _e_int_menus_clients_item_create(bd, m);
+ _e_int_menus_clients_item_create(ec, m);
}
if ((e_config->clientlist_separate_with == E_CLIENTLIST_GROUP_SEP_MENU)
@@ -1285,35 +1283,35 @@ _e_int_menus_clients_add_by_class(Eina_List *borders, E_Menu *m)
}
static void
-_e_int_menus_clients_add_by_desk(E_Desk *curr_desk, Eina_List *borders, E_Menu *m)
+_e_int_menus_clients_add_by_desk(E_Desk *curr_desk, Eina_List *clients, E_Menu *m)
{
E_Desk *desk = NULL;
Eina_List *l = NULL, *alt = NULL, *ico = NULL;
- E_Border *bd;
+ E_Client *ec;
E_Menu *subm;
E_Menu_Item *mi = NULL;
/* Deal with present desk first */
- EINA_LIST_FOREACH(borders, l, bd)
+ EINA_LIST_FOREACH(clients, l, ec)
{
- if (bd->iconic && e_config->clientlist_separate_iconified_apps && E_CLIENTLIST_GROUPICONS_SEP)
+ if (ec->iconic && e_config->clientlist_separate_iconified_apps && E_CLIENTLIST_GROUPICONS_SEP)
{
- ico = eina_list_append(ico, bd);
+ ico = eina_list_append(ico, ec);
continue;
}
- if (bd->desk != curr_desk)
+ if (ec->desk != curr_desk)
{
- if ((!bd->iconic) ||
- (bd->iconic && e_config->clientlist_separate_iconified_apps ==
+ if ((!ec->iconic) ||
+ (ec->iconic && e_config->clientlist_separate_iconified_apps ==
E_CLIENTLIST_GROUPICONS_OWNER))
{
- alt = eina_list_append(alt, bd);
+ alt = eina_list_append(alt, ec);
continue;
}
}
else
- _e_int_menus_clients_item_create(bd, m);
+ _e_int_menus_clients_item_create(ec, m);
}
desk = NULL;
@@ -1326,16 +1324,16 @@ _e_int_menus_clients_add_by_desk(E_Desk *curr_desk, Eina_List *borders, E_Menu *
e_menu_item_separator_set(mi, 1);
}
- EINA_LIST_FOREACH(alt, l, bd)
+ EINA_LIST_FOREACH(alt, l, ec)
{
- if ((bd->desk != desk) &&
+ if ((ec->desk != desk) &&
(e_config->clientlist_separate_with != E_CLIENTLIST_GROUP_SEP_NONE))
{
if (e_config->clientlist_separate_with == E_CLIENTLIST_GROUP_SEP_MENU)
{
if (subm && mi) e_menu_item_submenu_set(mi, subm);
mi = e_menu_item_new(m);
- e_menu_item_label_set(mi, bd->desk->name);
+ e_menu_item_label_set(mi, ec->desk->name);
e_util_menu_item_theme_icon_set(mi, "preferences-desktop");
subm = e_menu_new();
}
@@ -1344,12 +1342,12 @@ _e_int_menus_clients_add_by_desk(E_Desk *curr_desk, Eina_List *borders, E_Menu *
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
}
- desk = bd->desk;
+ desk = ec->desk;
}
if (subm && (e_config->clientlist_separate_with == E_CLIENTLIST_GROUP_SEP_MENU))
- _e_int_menus_clients_item_create(bd, subm);
+ _e_int_menus_clients_item_create(ec, subm);
else
- _e_int_menus_clients_item_create(bd, m);
+ _e_int_menus_clients_item_create(ec, m);
}
if (e_config->clientlist_separate_with == E_CLIENTLIST_GROUP_SEP_MENU
&& (subm) && (mi))
@@ -1360,20 +1358,20 @@ _e_int_menus_clients_add_by_desk(E_Desk *curr_desk, Eina_List *borders, E_Menu *
}
static void
-_e_int_menus_clients_add_by_none(Eina_List *borders, E_Menu *m)
+_e_int_menus_clients_add_by_none(Eina_List *clients, E_Menu *m)
{
Eina_List *l = NULL, *ico = NULL;
- E_Border *bd;
+ E_Client *ec;
- EINA_LIST_FOREACH(borders, l, bd)
+ EINA_LIST_FOREACH(clients, l, ec)
{
- if ((bd->iconic) && (e_config->clientlist_separate_iconified_apps) &&
+ if ((ec->iconic) && (e_config->clientlist_separate_iconified_apps) &&
(E_CLIENTLIST_GROUPICONS_SEP))
{
- ico = eina_list_append(ico, bd);
+ ico = eina_list_append(ico, ec);
continue;
}
- _e_int_menus_clients_item_create(bd, m);
+ _e_int_menus_clients_item_create(ec, m);
}
_e_int_menus_clients_menu_add_iconified(ico, m);
}
@@ -1383,33 +1381,33 @@ _e_int_menus_clients_pre_cb(void *data __UNUSED__, E_Menu *m)
{
E_Menu *subm;
E_Menu_Item *mi = NULL;
- Eina_List *l = NULL, *borders = NULL;
- E_Border *border;
+ Eina_List *l = NULL, *clients = NULL;
+ E_Client *ec;
E_Zone *zone = NULL;
E_Desk *desk = NULL;
Main_Data *dat;
e_menu_pre_activate_callback_set(m, NULL, NULL);
/* get the current clients */
- zone = e_zone_current_get(e_container_current_get(e_manager_current_get()));
+ zone = e_zone_current_get(e_util_comp_current_get());
desk = e_desk_current_get(zone);
if (e_config->clientlist_sort_by == E_CLIENTLIST_SORT_MOST_RECENT)
- l = e_border_focus_stack_get();
+ l = e_client_focus_stack_get();
else
- l = e_border_client_list();
- EINA_LIST_FOREACH(l, l, border)
+ l = zone->comp->clients;
+ EINA_LIST_FOREACH(l, l, ec)
{
- if (border->user_skip_winlist) continue;
- if ((border->zone == zone) || (border->iconic) ||
- (border->zone != zone && e_config->clientlist_include_all_zones))
- borders = eina_list_append(borders, border);
+ if (ec->user_skip_winlist || e_client_util_ignored_get(ec)) continue;
+ if ((ec->zone == zone) || (ec->iconic) ||
+ (ec->zone != zone && e_config->clientlist_include_all_zones))
+ clients = eina_list_append(clients, ec);
}
dat = (Main_Data *)e_object_data_get(E_OBJECT(m));
if (!dat) e_menu_title_set(m, _("Windows"));
- if (!borders)
+ if (!clients)
{
/* FIXME here we want nothing, but that crashes!!! */
mi = e_menu_item_new(m);
@@ -1417,32 +1415,32 @@ _e_int_menus_clients_pre_cb(void *data __UNUSED__, E_Menu *m)
e_menu_item_disabled_set(mi, 1);
}
- if (borders)
+ if (clients)
{
- /* Sort the borders */
+ /* Sort the clients */
if (e_config->clientlist_sort_by == E_CLIENTLIST_SORT_ALPHA)
- borders = eina_list_sort(borders, eina_list_count(borders),
+ clients = eina_list_sort(clients, eina_list_count(clients),
_e_int_menus_clients_sort_alpha_cb);
if (e_config->clientlist_sort_by == E_CLIENTLIST_SORT_ZORDER)
- borders = eina_list_sort(borders, eina_list_count(borders),
+ clients = eina_list_sort(clients, eina_list_count(clients),
_e_int_menus_clients_sort_z_order_cb);
- /* Group the borders */
+ /* Group the clients */
if (e_config->clientlist_group_by == E_CLIENTLIST_GROUP_DESK)
{
- borders = eina_list_sort(borders, eina_list_count(borders),
+ clients = eina_list_sort(clients, eina_list_count(clients),
_e_int_menus_clients_group_desk_cb);
- _e_int_menus_clients_add_by_desk(desk, borders, m);
+ _e_int_menus_clients_add_by_desk(desk, clients, m);
}
if (e_config->clientlist_group_by == E_CLIENTLIST_GROUP_CLASS)
{
- borders = eina_list_sort(borders, eina_list_count(borders),
+ clients = eina_list_sort(clients, eina_list_count(clients),
_e_int_menus_clients_group_class_cb);
- _e_int_menus_clients_add_by_class(borders, m);
+ _e_int_menus_clients_add_by_class(clients, m);
}
if (e_config->clientlist_group_by == E_CLIENTLIST_GROUP_NONE)
- _e_int_menus_clients_add_by_none(borders, m);
+ _e_int_menus_clients_add_by_none(clients, m);
}
mi = e_menu_item_new(m);
@@ -1468,7 +1466,7 @@ _e_int_menus_clients_pre_cb(void *data __UNUSED__, E_Menu *m)
}
e_object_free_attach_func_set(E_OBJECT(m), _e_int_menus_clients_free_hook);
- e_object_data_set(E_OBJECT(m), borders);
+ e_object_data_set(E_OBJECT(m), clients);
}
static const char *
@@ -1512,74 +1510,72 @@ _e_int_menus_clients_title_abbrv(const char *title)
}
static void
-_e_int_menus_clients_item_create(E_Border *bd, E_Menu *m)
+_e_int_menus_clients_item_create(E_Client *ec, E_Menu *m)
{
E_Menu_Item *mi;
const char *title;
- title = _e_int_menus_clients_title_abbrv(e_border_name_get(bd));
+ title = _e_int_menus_clients_title_abbrv(e_client_name_get(ec));
mi = e_menu_item_new(m);
e_menu_item_check_set(mi, 1);
if ((title) && (title[0]))
e_menu_item_label_set(mi, title);
else
e_menu_item_label_set(mi, _("Untitled window"));
- /* ref the border as we implicitly unref it in the callback */
- e_object_ref(E_OBJECT(bd));
-/* e_object_breadcrumb_add(E_OBJECT(bd), "clients_menu");*/
- e_menu_item_callback_set(mi, _e_int_menus_clients_item_cb, bd);
- e_menu_item_realize_callback_set(mi, _e_int_menus_clients_icon_cb, bd);
- if (!bd->iconic) e_menu_item_toggle_set(mi, 1);
+ /* ref the client as we implicitly unref it in the callback */
+ e_object_ref(E_OBJECT(ec));
+/* e_object_breadcrumb_add(E_OBJECT(ec), "clients_menu");*/
+ e_menu_item_callback_set(mi, _e_int_menus_clients_item_cb, ec);
+ e_menu_item_realize_callback_set(mi, _e_int_menus_clients_icon_cb, ec);
+ if (!ec->iconic) e_menu_item_toggle_set(mi, 1);
}
static void
_e_int_menus_clients_free_hook(void *obj)
{
- Eina_List *borders;
- E_Border *bd;
+ Eina_List *clients;
+ E_Client *ec;
E_Menu *m;
m = obj;
- borders = e_object_data_get(E_OBJECT(m));
- EINA_LIST_FREE(borders, bd)
- e_object_unref(E_OBJECT(bd));
+ clients = e_object_data_get(E_OBJECT(m));
+ EINA_LIST_FREE(clients, ec)
+ e_object_unref(E_OBJECT(ec));
}
static void
_e_int_menus_clients_item_cb(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- E_OBJECT_CHECK(bd);
+ ec = data;
+ E_OBJECT_CHECK(ec);
- if (bd->iconic)
+ if (ec->iconic)
{
if (e_config->clientlist_warp_to_iconified_desktop == 1)
- e_desk_show(bd->desk);
- if (!bd->lock_user_iconify)
- e_border_uniconify(bd);
+ e_desk_show(ec->desk);
+ if (!ec->lock_user_iconify)
+ e_client_uniconify(ec);
}
- if (!bd->iconic) e_desk_show(bd->desk);
- if (!bd->lock_user_stacking) e_border_raise(bd);
- if (!bd->lock_focus_out)
+ if (!ec->iconic) e_desk_show(ec->desk);
+ if (!ec->lock_user_stacking) evas_object_raise(ec->frame);
+ if (!ec->lock_focus_out)
{
- if (e_config->focus_policy != E_FOCUS_CLICK)
- ecore_x_pointer_warp(bd->zone->container->win,
- bd->x + (bd->w / 2), bd->y + (bd->h / 2));
- e_border_focus_set(bd, 1, 1);
+ e_util_pointer_center(ec);
+ evas_object_focus_set(ec->frame, 1);
}
}
static void
_e_int_menus_clients_icon_cb(void *data, E_Menu *m, E_Menu_Item *mi)
{
- E_Border *bd;
+ E_Client *ec;
- bd = data;
- E_OBJECT_CHECK(bd);
- mi->icon_object = e_border_icon_add(bd, m->evas);
+ ec = data;
+ E_OBJECT_CHECK(ec);
+ mi->icon_object = e_client_icon_add(ec, m->evas);
}
static void
@@ -1595,8 +1591,8 @@ static void
_e_int_menus_lost_clients_pre_cb(void *data __UNUSED__, E_Menu *m)
{
E_Menu_Item *mi;
- Eina_List *l, *borders = NULL;
- E_Border *bd;
+ Eina_List *l, *clients = NULL;
+ E_Client *ec;
E_Menu *root;
E_Zone *zone = NULL;
@@ -1604,9 +1600,9 @@ _e_int_menus_lost_clients_pre_cb(void *data __UNUSED__, E_Menu *m)
root = e_menu_root_get(m);
/* get the current clients */
if (root) zone = root->zone;
- borders = e_border_lost_windows_get(zone);
+ clients = e_client_lost_windows_get(zone);
- if (!borders)
+ if (!clients)
{
/* FIXME here we want nothing, but that crashes!!! */
mi = e_menu_item_new(m);
@@ -1614,52 +1610,52 @@ _e_int_menus_lost_clients_pre_cb(void *data __UNUSED__, E_Menu *m)
e_menu_item_disabled_set(mi, 1);
return;
}
- EINA_LIST_FOREACH(borders, l, bd)
+ EINA_LIST_FOREACH(clients, l, ec)
{
const char *title = "";
- title = e_border_name_get(bd);
+ title = e_client_name_get(ec);
mi = e_menu_item_new(m);
if ((title) && (title[0]))
e_menu_item_label_set(mi, title);
else
e_menu_item_label_set(mi, _("Untitled window"));
- /* ref the border as we implicitly unref it in the callback */
- e_object_ref(E_OBJECT(bd));
- e_menu_item_callback_set(mi, _e_int_menus_lost_clients_item_cb, bd);
- if (bd->desktop)
- e_util_desktop_menu_item_icon_add(bd->desktop, 24, mi);
+ /* ref the client as we implicitly unref it in the callback */
+ e_object_ref(E_OBJECT(ec));
+ e_menu_item_callback_set(mi, _e_int_menus_lost_clients_item_cb, ec);
+ if (ec->desktop)
+ e_util_desktop_menu_item_icon_add(ec->desktop, 24, mi);
}
e_object_free_attach_func_set(E_OBJECT(m),
_e_int_menus_lost_clients_free_hook);
- e_object_data_set(E_OBJECT(m), borders);
+ e_object_data_set(E_OBJECT(m), clients);
}
static void
_e_int_menus_lost_clients_free_hook(void *obj)
{
- Eina_List *borders;
- E_Border *bd;
+ Eina_List *clients;
+ E_Client *ec;
E_Menu *m;
m = obj;
- borders = e_object_data_get(E_OBJECT(m));
- EINA_LIST_FREE(borders, bd)
- e_object_unref(E_OBJECT(bd));
+ clients = e_object_data_get(E_OBJECT(m));
+ EINA_LIST_FREE(clients, ec)
+ e_object_unref(E_OBJECT(ec));
}
static void
_e_int_menus_lost_clients_item_cb(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- E_Border *bd = data;
+ E_Client *ec = data;
- E_OBJECT_CHECK(bd);
- if (bd->iconic) e_border_uniconify(bd);
- if (bd->desk) e_desk_show(bd->desk);
- e_border_center(bd);
- e_border_raise(bd);
- if (!bd->lock_focus_out)
- e_border_focus_set(bd, 1, 1);
+ E_OBJECT_CHECK(ec);
+ if (ec->iconic) e_client_uniconify(ec);
+ if (ec->desk) e_desk_show(ec->desk);
+ e_comp_object_util_center(ec->frame);
+ evas_object_raise(ec->frame);
+ if (!ec->lock_focus_out)
+ evas_object_focus_set(ec->frame, 1);
}
static void
@@ -1700,12 +1696,12 @@ _e_int_menus_shelves_pre_cb(void *data __UNUSED__, E_Menu *m)
E_Menu_Item *mi;
Eina_List *l, *shelves = NULL;
E_Shelf *es;
- E_Container *con;
E_Zone *zone;
+ E_Comp *c;
e_menu_pre_activate_callback_set(m, NULL, NULL);
- con = e_container_current_get(e_manager_current_get());
- zone = e_zone_current_get(con);
+ c = e_util_comp_current_get();
+ zone = e_zone_current_get(c);
/* get the current clients */
shelves = e_shelf_list();
@@ -1716,7 +1712,7 @@ _e_int_menus_shelves_pre_cb(void *data __UNUSED__, E_Menu *m)
if (!es) continue;
if (es->zone->num != zone->num) continue;
- if (es->cfg->container != (int)con->num) continue;
+ if (es->cfg->manager != (int)c->num) continue;
if (es->name)
name = es->name;
@@ -1825,7 +1821,7 @@ _e_int_menus_shelves_add_cb(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_
static void
_e_int_menus_shelves_del_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
- e_configure_registry_call("extensions/shelves", m->zone->container, NULL);
+ e_configure_registry_call("extensions/shelves", m->zone->comp, NULL);
}
static void
diff --git a/src/bin/e_int_shelf_config.c b/src/bin/e_int_shelf_config.c
index a03f1d7ab6..130e34f3e8 100644
--- a/src/bin/e_int_shelf_config.c
+++ b/src/bin/e_int_shelf_config.c
@@ -43,7 +43,7 @@ e_int_shelf_config(E_Shelf *es)
v->basic.check_changed = _basic_check_changed;
es->config_dialog =
- e_config_dialog_new(es->zone->container, _("Shelf Settings"),
+ e_config_dialog_new(es->zone->comp, _("Shelf Settings"),
"E", "_shelf_config_dialog",
"preferences-desktop-shelf", 0, v, es);
e_win_centered_set(es->config_dialog->dia->win, EINA_TRUE);
@@ -84,10 +84,7 @@ static void
_fill_data(E_Config_Dialog_Data *cfdata)
{
/* stacking */
- if (cfdata->escfg->popup)
- cfdata->layer = 1 + (!!cfdata->escfg->layer);
- else
- cfdata->layer = 0;
+ cfdata->layer = cfdata->escfg->layer;
cfdata->overlap = cfdata->escfg->overlap;
/* position */
@@ -117,15 +114,8 @@ _fill_data(E_Config_Dialog_Data *cfdata)
static int
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
- if (cfdata->escfg->popup)
- {
- if (cfdata->layer != 1 + (!!cfdata->escfg->layer)) return 1;
- }
- else
- {
- if (cfdata->layer) return 1;
- }
#define CHECK(X) if (cfdata->X != cfdata->escfg->X) return 1
+ CHECK(layer);
CHECK(overlap);
CHECK(orient);
CHECK(fit_along);
@@ -164,11 +154,11 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
/* Stacking */
ol = e_widget_list_add(evas, 0, 0);
rg = e_widget_radio_group_new(&(cfdata->layer));
- ow = e_widget_radio_add(evas, _("Above Everything"), 2, rg);
+ ow = e_widget_radio_add(evas, _("Above Everything"), E_LAYER_CLIENT_ABOVE, rg);
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
- ow = e_widget_radio_add(evas, _("Below Windows"), 1, rg);
+ ow = e_widget_radio_add(evas, _("Below Windows"), E_LAYER_CLIENT_DESKTOP, rg);
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
- ow = e_widget_radio_add(evas, _("Below Everything"), 0, rg);
+ ow = e_widget_radio_add(evas, _("Below Everything"), E_LAYER_DESKTOP, rg);
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
e_widget_toolbook_page_append(otb, NULL, _("Stacking"), ol,
1, 0, 1, 0, 0.5, 0.0);
@@ -323,34 +313,8 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
recreate = 1;
}
- if (cfdata->layer == 0)
- {
- if ((cfdata->escfg->popup != 0) || (cfdata->escfg->layer != 1))
- {
- cfdata->escfg->popup = 0;
- cfdata->escfg->layer = E_COMP_CANVAS_LAYER_DESKTOP_TOP;
- recreate = 1;
- }
- }
- else if (cfdata->layer == 1)
- {
- if ((cfdata->escfg->popup != 1) || (cfdata->escfg->layer != 0))
- {
- cfdata->escfg->popup = 1;
- cfdata->escfg->layer = 0;
- recreate = 1;
- }
- }
- else if (cfdata->layer == 2)
- {
- if ((cfdata->escfg->popup != 1) || (cfdata->escfg->layer != E_LAYER_ABOVE))
- {
- cfdata->escfg->popup = 1;
- cfdata->escfg->layer = E_LAYER_ABOVE;
- recreate = 1;
- }
- }
-
+ cfdata->escfg->layer = cfdata->layer;
+ evas_object_layer_set(cfdata->es->comp_object, cfdata->escfg->layer);
cfdata->escfg->overlap = cfdata->overlap;
e_shelf_autohide_set(cfdata->es, cfdata->autohide + (cfdata->autohide * cfdata->autohide_show_action));
cfdata->escfg->autohide_show_action = cfdata->autohide_show_action;
diff --git a/src/bin/e_int_toolbar_config.c b/src/bin/e_int_toolbar_config.c
index 37b4523477..4faa96373f 100644
--- a/src/bin/e_int_toolbar_config.c
+++ b/src/bin/e_int_toolbar_config.c
@@ -18,16 +18,14 @@ e_int_toolbar_config(E_Toolbar *tbar)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
- E_Container *con;
v = E_NEW(E_Config_Dialog_View, 1);
if (!v) return;
- con = e_container_current_get(e_manager_current_get());
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply;
v->basic.create_widgets = _basic_create;
- cfd = e_config_dialog_new(con, _("Toolbar Settings"), "E",
+ cfd = e_config_dialog_new(NULL, _("Toolbar Settings"), "E",
"_toolbar_config_dialog", "preferences-desktop-shelf",
0, v, tbar);
tbar->cfg_dlg = cfd;
diff --git a/src/bin/e_main.c b/src/bin/e_main.c
index ee25b08ec9..5d5b6db6f3 100644
--- a/src/bin/e_main.c
+++ b/src/bin/e_main.c
@@ -67,11 +67,9 @@ static double t0, t1, t2;
static void _e_main_shutdown(int errcode);
static void _e_main_shutdown_push(int (*func)(void));
static void _e_main_parse_arguments(int argc, char **argv);
-static void _e_main_cb_x_fatal(void *data __UNUSED__);
static Eina_Bool _e_main_cb_signal_exit(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__);
static Eina_Bool _e_main_cb_signal_hup(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__);
static Eina_Bool _e_main_cb_signal_user(void *data __UNUSED__, int ev_type __UNUSED__, void *ev);
-static int _e_main_x_shutdown(void);
static int _e_main_dirs_init(void);
static int _e_main_dirs_shutdown(void);
static int _e_main_path_init(void);
@@ -80,10 +78,9 @@ static void _e_main_test_formats(void);
static int _e_main_screens_init(void);
static int _e_main_screens_shutdown(void);
static void _e_main_desk_save(void);
-static void _e_main_desk_restore(E_Manager *man, E_Container *con);
+static void _e_main_desk_restore(void);
static void _e_main_efreet_paths_init(void);
static void _e_main_modules_load(Eina_Bool safe_mode);
-static void _e_main_manage_all(void);
static Eina_Bool _e_main_cb_x_flusher(void *data __UNUSED__);
static Eina_Bool _e_main_cb_idle_before(void *data __UNUSED__);
static Eina_Bool _e_main_cb_idle_after(void *data __UNUSED__);
@@ -355,17 +352,6 @@ main(int argc, char **argv)
_idle_before = ecore_idle_enterer_before_add(_e_main_cb_idle_before, NULL);
- TS("Ecore_X Init");
- if (!ecore_x_init(NULL))
- {
- e_error_message_show(_("Enlightenment cannot initialize Ecore_X!\n"));
- _e_main_shutdown(-1);
- }
- TS("Ecore_X Init Done");
- _e_main_shutdown_push(_e_main_x_shutdown);
-
- ecore_x_io_error_handler_set(_e_main_cb_x_fatal, NULL);
-
_xdg_data_dirs_augment();
TS("Ecore_Evas Init");
@@ -450,10 +436,6 @@ main(int argc, char **argv)
TS("E_Alert Init Done");
_e_main_shutdown_push(e_alert_shutdown);
- TS("E_Hints Init");
- e_hints_init();
- TS("E_Hints Init Done");
-
TS("E_Configure Init");
e_configure_init();
TS("E_Configure Init Done");
@@ -496,15 +478,6 @@ main(int argc, char **argv)
_e_main_shutdown_push(e_randr_shutdown);
TS("E_Randr Init Done");
- TS("E_Xinerama Init");
- if (!e_xinerama_init())
- {
- e_error_message_show(_("Enlightenment cannot initialize E_Xinerama!\n"));
- _e_main_shutdown(-1);
- }
- TS("E_Xinerama Init Done");
- _e_main_shutdown_push(e_xinerama_shutdown);
-
TS("E_Env Init");
if (!e_env_init())
{
@@ -521,15 +494,6 @@ main(int argc, char **argv)
s = getenv("E_DESKLOCK_LOCKED");
if ((s) && (!strcmp(s, "locked"))) waslocked = EINA_TRUE;
- TS("E_Scale Init");
- if (!e_scale_init())
- {
- e_error_message_show(_("Enlightenment cannot set up its scale system.\n"));
- _e_main_shutdown(-1);
- }
- TS("E_Scale Init Done");
- _e_main_shutdown_push(e_scale_shutdown);
-
TS("E_Pointer Init");
if (!e_pointer_init())
{
@@ -587,6 +551,13 @@ main(int argc, char **argv)
TS("E_Moveresize Init Done");
_e_main_shutdown_push(e_moveresize_shutdown);
+ if (e_config->show_splash)
+ e_init_status_set(_("Setup Message Bus"));
+ TS("E_Msgbus Init");
+ if (e_msgbus_init())
+ _e_main_shutdown_push(e_msgbus_shutdown);
+ TS("E_Msgbus Init Done");
+
TS("Efreet Init");
if (!efreet_init())
{
@@ -622,6 +593,14 @@ main(int argc, char **argv)
TS("E_Actions Init Done");
_e_main_shutdown_push(e_actions_shutdown);
+ /* these just add event handlers and can't fail
+ * timestamping them is dumb.
+ */
+ e_zone_init();
+ e_desk_init();
+ e_menu_init();
+ e_exehist_init();
+
if (e_config->show_splash)
e_init_status_set(_("Setup Screens"));
TS("Screens Init");
@@ -634,6 +613,16 @@ main(int argc, char **argv)
TS("Screens Init Done");
_e_main_shutdown_push(_e_main_screens_shutdown);
+
+ TS("E_Scale Init");
+ if (!e_scale_init())
+ {
+ e_error_message_show(_("Enlightenment cannot set up its scale system.\n"));
+ _e_main_shutdown(-1);
+ }
+ TS("E_Scale Init Done");
+ _e_main_shutdown_push(e_scale_shutdown);
+
if (e_config->show_splash)
{
TS("E_Splash Init");
@@ -723,28 +712,10 @@ main(int argc, char **argv)
TS("E_Desklock Init Done");
_e_main_shutdown_push(e_desklock_shutdown);
- if (e_config->show_splash)
- e_init_status_set(_("Setup Popups"));
- TS("E_Popups Init");
- if (!e_popup_init())
- {
- e_error_message_show(_("Enlightenment cannot set up its popup system.\n"));
- _e_main_shutdown(-1);
- }
- TS("E_Popups Init Done");
- _e_main_shutdown_push(e_popup_shutdown);
-
if (waslocked || (locked && ((!after_restart) || (!getenv("E_DESKLOCK_UNLOCKED")))))
e_desklock_show(EINA_TRUE);
if (e_config->show_splash)
- e_init_status_set(_("Setup Message Bus"));
- TS("E_Msgbus Init");
- if (e_msgbus_init())
- _e_main_shutdown_push(e_msgbus_shutdown);
- TS("E_Msgbus Init Done");
-
- if (e_config->show_splash)
e_init_status_set(_("Setup Paths"));
TS("Efreet Paths");
_e_main_efreet_paths_init();
@@ -770,11 +741,10 @@ main(int argc, char **argv)
_e_main_shutdown(-1);
}
TS("E_Exec Init Done");
- _e_main_shutdown_push(e_exec_shutdown);
- TS("E_Container Freeze");
- e_container_all_freeze();
- TS("E_Container Freeze Done");
+ TS("E_Comp Freeze");
+ e_comp_all_freeze();
+ TS("E_Comp Freeze Done");
if (e_config->show_splash)
e_init_status_set(_("Setup Filemanager"));
@@ -916,15 +886,6 @@ main(int argc, char **argv)
TS("E_Icon Init Done");
_e_main_shutdown_push(e_icon_shutdown);
- TS("E_XSettings Init");
- if (!e_xsettings_init())
- {
- e_error_message_show(_("Enlightenment cannot initialize the XSettings system.\n"));
- _e_main_shutdown(-1);
- }
- TS("E_XSettings Init Done");
- _e_main_shutdown_push(e_xsettings_shutdown);
-
TS("E_Update Init");
if (!e_update_init())
{
@@ -983,9 +944,9 @@ main(int argc, char **argv)
if (e_config->show_splash && (!after_restart))
ecore_timer_add(2.0, _e_main_cb_startup_fake_end, NULL);
- TS("E_Container Thaw");
- e_container_all_thaw();
- TS("E_Container Thaw Done");
+ TS("E_Comp Thaw");
+ e_comp_all_thaw();
+ TS("E_Comp Thaw Done");
TS("E_Test Init");
e_test();
@@ -1000,13 +961,9 @@ main(int argc, char **argv)
_e_main_shutdown(-1);
}
TS("E_Shelf Init Done");
- _e_main_shutdown_push(e_shelf_shutdown);
ecore_idle_enterer_before_add(_e_main_shelf_init_job, NULL);
- TS("Manage all windows");
- _e_main_manage_all();
-
_idle_after = ecore_idle_enterer_add(_e_main_cb_idle_after, NULL);
if (e_config->show_splash)
@@ -1085,7 +1042,7 @@ _e_main_shutdown(int errcode)
{
int i = 0;
- printf("E18: Begin Shutdown Procedure!\n");
+ printf("E19: Begin Shutdown Procedure!\n");
if (_idle_before) ecore_idle_enterer_del(_idle_before);
_idle_before = NULL;
@@ -1234,7 +1191,7 @@ _e_main_parse_arguments(int argc, char **argv)
}
}
-static void
+EINTERN void
_e_main_cb_x_fatal(void *data __UNUSED__)
{
e_error_message_show("Lost X Connection.\n");
@@ -1276,17 +1233,7 @@ _e_main_cb_signal_user(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
// comp module has its own handler for this for enabling/disabling fps debug
}
return ECORE_CALLBACK_RENEW;
-}
-static int
-_e_main_x_shutdown(void)
-{
- if (x_fatal) return 1;
- /* ecore_x_ungrab(); */
- ecore_x_focus_reset();
- ecore_x_events_allow_all();
- ecore_x_shutdown();
- return 1;
}
static int
@@ -1559,62 +1506,13 @@ _e_main_test_formats(void)
static int
_e_main_screens_init(void)
{
- Ecore_X_Window *roots;
- int num, i;
-
- TS("\tscreens: atoms");
- if (!e_atoms_init()) return 0;
TS("\tscreens: manager");
if (!e_manager_init()) return 0;
- TS("\tscreens: container");
- if (!e_container_init()) return 0;
- TS("\tscreens: zone");
- if (!e_zone_init()) return 0;
- TS("\tscreens: desk");
- if (!e_desk_init()) return 0;
- TS("\tscreens: menu");
- if (!e_menu_init()) return 0;
- TS("\tscreens: exehist");
- if (!e_exehist_init()) return 0;
-
- TS("\tscreens: get roots");
- num = 0;
- roots = ecore_x_window_root_list(&num);
- if ((!roots) || (num <= 0))
- {
- free(roots);
- e_error_message_show("X reports there are no root windows and %i screens!\n",
- num);
- return 0;
- }
- TS("\tscreens: focus");
- if (!e_focus_init())
- {
- free(roots);
- return 0;
- }
- TS("\tscreens: border");
- if (!e_border_init())
- {
- free(roots);
- return 0;
- }
-
- TS("E_Comp Init");
- if (!e_comp_init())
- {
- e_error_message_show(_("Enlightenment cannot setup compositing.\n"));
- _e_main_shutdown(-1);
- }
- TS("E_Comp Init Done");
+ TS("\tscreens: client");
+ if (!e_client_init()) return 0;
TS("\tscreens: win");
- if (!e_win_init())
- {
- free(roots);
- return 0;
- }
-
+ if (!e_win_init()) return 0;
TS("E_Xkb Init");
if (!e_xkb_init())
{
@@ -1623,6 +1521,15 @@ _e_main_screens_init(void)
}
TS("E_Xkb Init Done");
+ TS("Compositor Init");
+ if (!e_comp_init())
+ {
+ e_error_message_show(_("Enlightenment cannot create a compositor.\n"));
+ _e_main_shutdown(-1);
+ }
+
+ _e_main_desk_restore();
+
if (e_config->show_splash)
e_init_status_set(_("Setup DND"));
TS("E_Dnd Init");
@@ -1634,48 +1541,6 @@ _e_main_screens_init(void)
TS("E_Dnd Init Done");
_e_main_shutdown_push(e_dnd_shutdown);
- TS("\tscreens: manage roots");
- for (i = 0; i < num; i++)
- {
- E_Manager *man;
- E_Container *con;
-
- man = e_manager_new(roots[i], i);
- if (man)
- e_manager_show(man);
- else
- {
- e_error_message_show("Cannot create manager object for screen %i\n",
- i);
- free(roots);
- return 0;
- }
- con = e_container_new(man);
- if (con)
- {
- e_container_show(con);
- e_grabinput_focus(con->bg_win, E_FOCUS_METHOD_PASSIVE);
- e_hints_manager_init(man);
- _e_main_desk_restore(man, con);
-// e_manager_manage_windows(man);
- }
- else
- {
- e_error_message_show("Cannot create desktop object for manager on screen %i\n",
- i);
- free(roots);
- return 0;
- }
-#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
- ecore_x_e_window_profile_supported_set(roots[i],
- e_config->use_desktop_window_profile);
-#endif
- }
- free(roots);
-
- TS("\tscreens: sync");
- ecore_x_sync();
-
return 1;
}
@@ -1683,12 +1548,13 @@ static int
_e_main_screens_shutdown(void)
{
e_win_shutdown();
+ e_menu_shutdown();
+ e_shelf_shutdown();
e_comp_shutdown();
- e_border_shutdown();
- e_focus_shutdown();
+ e_client_shutdown();
e_exehist_shutdown();
- e_menu_shutdown();
e_backlight_shutdown();
+ e_exec_shutdown();
// ecore_evas closes evas - deletes objs - deletes fm widgets which tries to
// ipc to slave to stop monitoring - but ipc has been shut down. dont shut
// down.
@@ -1696,58 +1562,53 @@ _e_main_screens_shutdown(void)
// e_zone_shutdown();
// e_container_shutdown();
// e_manager_shutdown();
- e_atoms_shutdown();
return 1;
}
static void
_e_main_desk_save(void)
{
- Eina_List *ml;
- E_Manager *man;
+ E_Comp *c;
+ const Eina_List *l;
char env[1024], name[1024];
- EINA_LIST_FOREACH(e_manager_list(), ml, man)
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
{
- Eina_List *cl;
- E_Container *con;
+ Eina_List *zl;
+ E_Zone *zone;
- EINA_LIST_FOREACH(man->containers, cl, con)
+ EINA_LIST_FOREACH(c->zones, zl, zone)
{
- Eina_List *zl;
- E_Zone *zone;
-
- EINA_LIST_FOREACH(con->zones, zl, zone)
- {
- snprintf(name, sizeof(name), "DESK_%d_%d_%d", man->num, con->num, zone->num);
- snprintf(env, sizeof(env), "%d,%d", zone->desk_x_current, zone->desk_y_current);
- e_util_env_set(name, env);
- }
+ snprintf(name, sizeof(name), "DESK_%d_%d", c->num, zone->num);
+ snprintf(env, sizeof(env), "%d,%d", zone->desk_x_current, zone->desk_y_current);
+ e_util_env_set(name, env);
}
}
}
static void
-_e_main_desk_restore(E_Manager *man, E_Container *con)
+_e_main_desk_restore(void)
{
- Eina_List *zl;
+ E_Comp *c;
+ const Eina_List *l, *ll;
E_Zone *zone;
char *env;
char name[1024];
- EINA_LIST_FOREACH(con->zones, zl, zone)
- {
- E_Desk *desk;
- int desk_x, desk_y;
-
- snprintf(name, sizeof(name), "DESK_%d_%d_%d", man->num, con->num, zone->num);
- env = getenv(name);
- if (!env) continue;
- if (!sscanf(env, "%d,%d", &desk_x, &desk_y)) continue;
- desk = e_desk_at_xy_get(zone, desk_x, desk_y);
- if (!desk) continue;
- e_desk_show(desk);
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ {
+ E_Desk *desk;
+ int desk_x, desk_y;
+
+ snprintf(name, sizeof(name), "DESK_%d_%d", c->num, zone->num);
+ env = getenv(name);
+ if (!env) continue;
+ if (!sscanf(env, "%d,%d", &desk_x, &desk_y)) continue;
+ desk = e_desk_at_xy_get(zone, desk_x, desk_y);
+ if (!desk) continue;
+ e_desk_show(desk);
+ }
}
static void
@@ -1825,19 +1686,6 @@ _e_main_modules_load(Eina_Bool safe_mode)
}
}
-static void
-_e_main_manage_all(void)
-{
- Eina_List *l;
- E_Manager *man;
-
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- e_manager_manage_windows(man);
- e_comp_populate(man->comp);
- }
-}
-
static Eina_Bool
_e_main_cb_idle_before(void *data __UNUSED__)
{
@@ -1845,8 +1693,7 @@ _e_main_cb_idle_before(void *data __UNUSED__)
E_Before_Idler *eb;
e_menu_idler_before();
- e_focus_idler_before();
- e_border_idler_before();
+ e_client_idler_before();
e_pointer_idler_before();
EINA_LIST_FOREACH(_idle_before_list, l, eb)
{
@@ -1875,7 +1722,7 @@ _e_main_cb_idle_after(void *data __UNUSED__)
edje_freeze();
-#ifdef E18_RELEASE_BUILD
+#ifdef E19_RELEASE_BUILD
if (first_idle)
{
TS("SLEEP");
diff --git a/src/bin/e_manager.c b/src/bin/e_manager.c
index 3d167cd021..0e1480c0d2 100644
--- a/src/bin/e_manager.c
+++ b/src/bin/e_manager.c
@@ -1,65 +1,90 @@
#include "e.h"
-/* local subsystem functions */
-static void _e_manager_free(E_Manager *man);
+EAPI int E_EVENT_MANAGER_KEYS_GRAB = -1;
+
+static Eina_List *managers = NULL;
+
+static Ecore_Timer *timer_post_screensaver_lock = NULL;
-static Eina_Bool _e_manager_cb_window_show_request(void *data, int ev_type, void *ev);
-static Eina_Bool _e_manager_cb_window_configure(void *data, int ev_type, void *ev);
-static Eina_Bool _e_manager_cb_key_up(void *data, int ev_type, void *ev);
-static Eina_Bool _e_manager_cb_key_down(void *data, int ev_type, void *ev);
-static Eina_Bool _e_manager_cb_frame_extents_request(void *data, int ev_type, void *ev);
-static Eina_Bool _e_manager_cb_ping(void *data, int ev_type, void *ev);
-static Eina_Bool _e_manager_cb_screensaver_on(void *data, int ev_type, void *ev);
-static Eina_Bool _e_manager_cb_screensaver_off(void *data, int ev_type, void *ev);
-static Eina_Bool _e_manager_cb_client_message(void *data, int ev_type, void *ev);
+static void
+_e_manager_free(E_Manager *man)
+{
+ E_FREE_LIST(man->handlers, ecore_event_handler_del);
+ managers = eina_list_remove(managers, man);
+ free(man);
+}
-static Eina_Bool _e_manager_frame_extents_free_cb(const Eina_Hash *hash __UNUSED__,
- const void *key __UNUSED__,
- void *data, void *fdata __UNUSED__);
-static E_Manager *_e_manager_get_for_root(Ecore_X_Window root);
-static Eina_Bool _e_manager_clear_timer(void *data);
-#if 0 /* use later - maybe */
-static int _e_manager_cb_window_destroy(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_hide(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_reparent(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_create(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_configure_request(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_gravity(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_stack(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_stack_request(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_property(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_colormap(void *data, int ev_type, void *ev);
-static int _e_manager_cb_window_shape(void *data, int ev_type, void *ev);
-static int _e_manager_cb_client_message(void *data, int ev_type, void *ev);
-#endif
+static Eina_Bool
+_e_manager_cb_key_down(void *data, int ev_type EINA_UNUSED, Ecore_Event_Key *ev)
+{
+ E_Manager *man = data;
-/* local subsystem globals */
+ if (ev->event_window != man->root)
+ {
+ E_Client *ec;
-typedef struct _Frame_Extents Frame_Extents;
+ ec = e_client_focused_get();
+ /* *block actions when no client is focused (probably something else did a grab here so we'll play nice)
+ * *block actions when client menu is up
+ * *block actions when event (grab) window isn't comp window
+ * *other cases?
+ */
+ if (!ec) return ECORE_CALLBACK_RENEW;
+ if ((ec->border_menu) || (ev->event_window != man->comp->ee_win))
+ return ECORE_CALLBACK_PASS_ON;
+ }
+ if (ev->root_window != man->root) man = e_manager_find_by_root(ev->root_window);
+ if (!man) man = eina_list_data_get(managers);
+ return !e_bindings_key_down_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(man), ev);
+}
-struct _Frame_Extents
+static Eina_Bool
+_e_manager_cb_key_up(void *data, int ev_type EINA_UNUSED, Ecore_Event_Key *ev)
{
- int l, r, t, b;
-};
+ E_Manager *man = data;
-EAPI int E_EVENT_MANAGER_KEYS_GRAB = -1;
-EAPI int E_EVENT_MANAGER_COMP_SET = -1;
+ if (ev->event_window != man->root) return ECORE_CALLBACK_PASS_ON;
+ if (ev->root_window != man->root) man = e_manager_find_by_root(ev->root_window);
+ if (!man) man = eina_list_data_get(managers);
+ return !e_bindings_key_up_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(man), ev);
+}
-static Eina_List *managers = NULL;
-static Eina_Hash *frame_extents = NULL;
-static Ecore_Timer *timer_post_screensaver_lock = NULL;
-static Ecore_Event_Handler *_show_request_handler = NULL;
+static Eina_Bool
+_e_manager_cb_timer_post_screensaver_lock(void *data EINA_UNUSED)
+{
+ e_desklock_show_autolocked();
+ timer_post_screensaver_lock = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool
+_e_manager_cb_screensaver_on(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED)
+{
+ if (e_config->desklock_autolock_screensaver)
+ {
+ E_FREE_FUNC(timer_post_screensaver_lock, ecore_timer_del);
+ if (e_config->desklock_post_screensaver_time <= 1.0)
+ e_desklock_show_autolocked();
+ else
+ timer_post_screensaver_lock = ecore_timer_add
+ (e_config->desklock_post_screensaver_time,
+ _e_manager_cb_timer_post_screensaver_lock, NULL);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_manager_cb_screensaver_off(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED)
+{
+ E_FREE_FUNC(timer_post_screensaver_lock, ecore_timer_del);
+ return ECORE_CALLBACK_PASS_ON;
+}
/* externally accessible functions */
EINTERN int
e_manager_init(void)
{
- ecore_x_screensaver_event_listen_set(1);
- frame_extents = eina_hash_string_superfast_new(NULL);
E_EVENT_MANAGER_KEYS_GRAB = ecore_event_type_new();
- E_EVENT_MANAGER_COMP_SET = ecore_event_type_new();
- _show_request_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST,
- _e_manager_cb_window_show_request, NULL);
return 1;
}
@@ -67,20 +92,7 @@ EINTERN int
e_manager_shutdown(void)
{
E_FREE_LIST(managers, e_object_del);
- E_FREE_FUNC(_show_request_handler, ecore_event_handler_del);
-
- if (frame_extents)
- {
- eina_hash_foreach(frame_extents, _e_manager_frame_extents_free_cb, NULL);
- eina_hash_free(frame_extents);
- frame_extents = NULL;
- }
-
- if (timer_post_screensaver_lock)
- {
- ecore_timer_del(timer_post_screensaver_lock);
- timer_post_screensaver_lock = NULL;
- }
+ E_FREE_FUNC(timer_post_screensaver_lock, ecore_timer_del);
return 1;
}
@@ -92,359 +104,40 @@ e_manager_list(void)
}
EAPI E_Manager *
-e_manager_new(Ecore_X_Window root, int num)
+e_manager_new(Ecore_Window root, E_Comp *c, int w, int h)
{
E_Manager *man;
- if (!ecore_x_window_manage(root)) return NULL;
man = E_OBJECT_ALLOC(E_Manager, E_MANAGER_TYPE, _e_manager_free);
if (!man) return NULL;
man->root = root;
- man->num = num;
- ecore_x_window_size_get(man->root, &(man->w), &(man->h));
- man->win = man->root;
- if (!e_comp_manager_init(man))
- {
- e_object_del(E_OBJECT(man));
- return NULL;
- }
+ man->num = c->num;
+ man->w = w;
+ man->h = h;
+ man->comp = c;
+
managers = eina_list_append(managers, man);
- E_LIST_HANDLER_APPEND(man->handlers, ECORE_X_EVENT_WINDOW_CONFIGURE,
- _e_manager_cb_window_configure, man);
E_LIST_HANDLER_APPEND(man->handlers, ECORE_EVENT_KEY_DOWN,
_e_manager_cb_key_down, man);
E_LIST_HANDLER_APPEND(man->handlers, ECORE_EVENT_KEY_UP,
_e_manager_cb_key_up, man);
- E_LIST_HANDLER_APPEND(man->handlers, ECORE_X_EVENT_FRAME_EXTENTS_REQUEST,
- _e_manager_cb_frame_extents_request, man);
- E_LIST_HANDLER_APPEND(man->handlers, ECORE_X_EVENT_PING,
- _e_manager_cb_ping, man);
E_LIST_HANDLER_APPEND(man->handlers, E_EVENT_SCREENSAVER_ON,
_e_manager_cb_screensaver_on, man);
E_LIST_HANDLER_APPEND(man->handlers, E_EVENT_SCREENSAVER_OFF,
_e_manager_cb_screensaver_off, man);
- E_LIST_HANDLER_APPEND(man->handlers, ECORE_X_EVENT_CLIENT_MESSAGE,
- _e_manager_cb_client_message, man);
-
- man->pointer = e_pointer_window_new(man->root, 1);
-
- ecore_x_window_background_color_set(man->root, 0, 0, 0);
- man->clear_timer = ecore_timer_add(10.0, _e_manager_clear_timer, man);
return man;
}
EAPI void
-e_manager_manage_windows(E_Manager *man)
-{
- Ecore_X_Window *windows;
- int wnum;
-
- /* a manager is designated for each root. lets get all the windows in
- the managers root */
- windows = ecore_x_window_children_get(man->root, &wnum);
- if (windows)
- {
- int i;
- const char *atom_names[] =
- {
- "_XEMBED_INFO",
- "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR",
- "KWM_DOCKWINDOW"
- };
- Ecore_X_Atom atoms[3];
- Ecore_X_Atom atom_xmbed, atom_kde_netwm_systray, atom_kwm_dockwindow;
- unsigned char *data = NULL;
- int count;
-
- ecore_x_atoms_get(atom_names, 3, atoms);
- atom_xmbed = atoms[0];
- atom_kde_netwm_systray = atoms[1];
- atom_kwm_dockwindow = atoms[2];
- for (i = 0; i < wnum; i++)
- {
- Ecore_X_Window_Attributes att;
- unsigned int ret_val, deskxy[2];
- int ret;
-
- if (e_border_find_by_client_window(windows[i]))
- continue;
- ecore_x_window_attributes_get(windows[i], &att);
- if ((att.override) || (att.input_only))
- {
- if (att.override)
- {
- char *wname = NULL, *wclass = NULL;
-
- ecore_x_icccm_name_class_get(windows[i],
- &wname, &wclass);
- if ((wname) && (wclass) &&
- (!strcmp(wname, "E")) &&
- (!strcmp(wclass, "Init_Window")))
- {
- free(wname);
- free(wclass);
- man->initwin = windows[i];
- }
- else
- {
- free(wname);
- free(wclass);
- continue;
- }
- }
- else
- continue;
- }
- /* XXX manage xembed windows as long as they are not override_redirect..
- * if (!ecore_x_window_prop_property_get(windows[i],
- * atom_xmbed,
- * atom_xmbed, 32,
- * &data, &count))
- * data = NULL;
- * if (!data) */
- {
- if (!ecore_x_window_prop_property_get(windows[i],
- atom_kde_netwm_systray,
- atom_xmbed, 32,
- &data, &count))
- data = NULL;
- }
- if (!data)
- {
- if (!ecore_x_window_prop_property_get(windows[i],
- atom_kwm_dockwindow,
- atom_kwm_dockwindow, 32,
- &data, &count))
- data = NULL;
- }
- if (data)
- {
- E_FREE(data);
- continue;
- }
- ret = ecore_x_window_prop_card32_get(windows[i],
- E_ATOM_MANAGED,
- &ret_val, 1);
-
- /* we have seen this window before */
- if ((ret > -1) && (ret_val == 1))
- {
- E_Container *con = NULL;
- E_Zone *zone = NULL;
- E_Desk *desk = NULL;
- E_Border *bd = NULL;
- unsigned int id;
- char *path;
- Efreet_Desktop *desktop = NULL;
-
- /* get all information from window before it is
- * reset by e_border_new */
- ret = ecore_x_window_prop_card32_get(windows[i],
- E_ATOM_CONTAINER,
- &id, 1);
- if (ret == 1)
- con = e_container_number_get(man, id);
- if (!con)
- con = e_container_current_get(man);
-
- ret = ecore_x_window_prop_card32_get(windows[i],
- E_ATOM_ZONE,
- &id, 1);
- if (ret == 1)
- zone = e_container_zone_number_get(con, id);
- if (!zone)
- zone = e_zone_current_get(con);
- ret = ecore_x_window_prop_card32_get(windows[i],
- E_ATOM_DESK,
- deskxy, 2);
- if (ret == 2)
- desk = e_desk_at_xy_get(zone,
- deskxy[0],
- deskxy[1]);
-
- path = ecore_x_window_prop_string_get(windows[i],
- E_ATOM_DESKTOP_FILE);
- if (path)
- {
- desktop = efreet_desktop_get(path);
- free(path);
- }
-
- {
- bd = e_border_new(con, windows[i], 1, 0);
- if (bd)
- {
- bd->ignore_first_unmap = 1;
- /* FIXME:
- * It's enough to set the desk, the zone will
- * be set according to the desk */
-// if (zone) e_border_zone_set(bd, zone);
- if (desk) e_border_desk_set(bd, desk);
- bd->desktop = desktop;
- }
- }
- }
- else if ((att.visible) && (!att.override) &&
- (!att.input_only))
- {
- /* We have not seen this window, and X tells us it
- * should be seen */
- E_Container *con;
- E_Border *bd;
-
- con = e_container_current_get(man);
- bd = e_border_new(con, windows[i], 1, 0);
- if (bd)
- {
- bd->ignore_first_unmap = 1;
- e_border_show(bd);
- }
- }
- }
- free(windows);
- }
-}
-
-EAPI void
-e_manager_show(E_Manager *man)
-{
- Eina_List *l;
- E_Container *con;
-
- E_OBJECT_CHECK(man);
- E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE);
- if (man->visible) return;
- EINA_LIST_FOREACH(man->containers, l, con)
- {
- e_container_show(con);
- }
- if (man->root != man->win)
- {
- Ecore_X_Window mwin;
-
- mwin = e_menu_grab_window_get();
- if (!mwin) mwin = man->initwin;
- if (!mwin)
- ecore_x_window_raise(man->win);
- else
- ecore_x_window_configure(man->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- mwin, ECORE_X_WINDOW_STACK_BELOW);
- ecore_x_window_show(man->win);
- }
- man->visible = 1;
-}
-
-EAPI void
-e_manager_hide(E_Manager *man)
-{
- Eina_List *l;
- E_Container *con;
-
- E_OBJECT_CHECK(man);
- E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE);
- if (!man->visible) return;
- EINA_LIST_FOREACH(man->containers, l, con)
- {
- e_container_hide(con);
- }
- if (man->root != man->win)
- ecore_x_window_hide(man->win);
- man->visible = 0;
-}
-
-EAPI void
-e_manager_move(E_Manager *man, int x, int y)
-{
- E_OBJECT_CHECK(man);
- E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE);
- if ((x == man->x) && (y == man->y)) return;
- if (man->root != man->win)
- {
- man->x = x;
- man->y = y;
- ecore_x_window_move(man->win, man->x, man->y);
- }
-}
-
-EAPI void
e_manager_resize(E_Manager *man, int w, int h)
{
- Eina_List *l;
- E_Container *con;
-
E_OBJECT_CHECK(man);
E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE);
- if ((man->w == w) && (man->h == h)) return;
man->w = w;
man->h = h;
- if (man->root != man->win)
- ecore_x_window_resize(man->win, man->w, man->h);
-
- EINA_LIST_FOREACH(man->containers, l, con)
- {
- e_container_resize(con, man->w, man->h);
- }
-
- ecore_x_netwm_desk_size_set(man->root, man->w, man->h);
-}
-
-EAPI void
-e_manager_move_resize(E_Manager *man, int x, int y, int w, int h)
-{
- Eina_List *l;
- E_Container *con;
-
- E_OBJECT_CHECK(man);
- E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE);
- if (man->root != man->win)
- {
- man->x = x;
- man->y = y;
- }
- man->w = w;
- man->h = h;
- ecore_x_window_move_resize(man->win, man->x, man->y, man->w, man->h);
-
- EINA_LIST_FOREACH(man->containers, l, con)
- {
- e_container_resize(con, man->w, man->h);
- }
-}
-
-EAPI void
-e_manager_raise(E_Manager *man)
-{
- E_OBJECT_CHECK(man);
- E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE);
- if (man->root != man->win)
- {
- Ecore_X_Window mwin;
-
- mwin = e_menu_grab_window_get();
- if (!mwin) mwin = man->initwin;
- if (!mwin)
- ecore_x_window_raise(man->win);
- else
- ecore_x_window_configure(man->win,
- ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
- ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
- 0, 0, 0, 0, 0,
- mwin, ECORE_X_WINDOW_STACK_BELOW);
- }
-}
-
-EAPI void
-e_manager_lower(E_Manager *man)
-{
- E_OBJECT_CHECK(man);
- E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE);
- if (man->root != man->win)
- ecore_x_window_lower(man->win);
+ ecore_evas_resize(man->comp->ee, w, h);
}
EAPI E_Manager *
@@ -459,7 +152,7 @@ e_manager_current_get(void)
return eina_list_data_get(managers);
EINA_LIST_FOREACH(managers, l, man)
{
- ecore_x_pointer_xy_get(man->win, &x, &y);
+ ecore_evas_pointer_xy_get(man->comp->ee, &x, &y);
if (x == -1 && y == -1)
continue;
if (E_INSIDE(x, y, man->x, man->y, man->w, man->h))
@@ -507,407 +200,3 @@ e_managers_keys_ungrab(void)
e_bindings_key_ungrab(E_BINDING_CONTEXT_ANY, man->root);
}
}
-
-/* local subsystem functions */
-static void
-_e_manager_free(E_Manager *man)
-{
- Eina_List *l;
-
- E_FREE_LIST(man->handlers, ecore_event_handler_del);
- l = man->containers;
- man->containers = NULL;
- E_FREE_LIST(l, e_object_del);
- if (man->root != man->win)
- {
- ecore_x_window_free(man->win);
- }
- if (man->pointer) e_object_del(E_OBJECT(man->pointer));
- managers = eina_list_remove(managers, man);
- if (man->clear_timer) ecore_timer_del(man->clear_timer);
- free(man);
-}
-
-static Eina_Bool
-_e_manager_cb_window_show_request(void *data EINA_UNUSED, int ev_type __UNUSED__, void *ev)
-{
- E_Manager *man;
- Ecore_X_Event_Window_Show_Request *e;
-
- e = ev;
- if (e_stolen_win_get(e->win)) return 1;
- man = e_manager_find_by_root(ecore_x_window_parent_get(e->win));
- if (!man)
- return ECORE_CALLBACK_PASS_ON; /* try other handlers for this */
-
- {
- E_Container *con;
- E_Border *bd;
-
- con = e_container_current_get(man);
- if (!e_border_find_by_client_window(e->win))
- {
- bd = e_border_new(con, e->win, 0, 0);
- if (!bd)
- ecore_x_window_show(e->win);
- }
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_cb_window_configure(void *data, int ev_type __UNUSED__, void *ev)
-{
- E_Manager *man;
- Ecore_X_Event_Window_Configure *e;
-
- man = data;
- e = ev;
- if (e->win != man->root) return ECORE_CALLBACK_PASS_ON;
- e_manager_resize(man, e->w, e->h);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_cb_key_down(void *data, int ev_type __UNUSED__, void *ev)
-{
- E_Manager *man = data;
- Ecore_Event_Key *e = ev;
-
- if (e->event_window != man->root)
- {
- E_Border *bd;
-
- bd = e_border_focused_get();
- /* *block actions when no border is focused (probably something else did a grab here so we'll play nice)
- * *block actions when border menu is up
- * *block actions when event (grab) window isn't comp window
- * *other cases?
- */
- if (!bd) return ECORE_CALLBACK_RENEW;
- if ((bd->border_menu) || (e->event_window != e_comp_get(bd)->ee_win))
- return ECORE_CALLBACK_PASS_ON;
- }
- if (e->root_window != man->root) man = _e_manager_get_for_root(e->root_window);
- if (e_bindings_key_down_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(man), ev))
- return ECORE_CALLBACK_DONE;
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_cb_key_up(void *data, int ev_type __UNUSED__, void *ev)
-{
- E_Manager *man;
- Ecore_Event_Key *e;
-
- man = data;
- e = ev;
-
- if (e->event_window != man->root) return ECORE_CALLBACK_PASS_ON;
- if (e->root_window != man->root) man = _e_manager_get_for_root(e->root_window);
- if (e_bindings_key_up_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(man), ev))
- return ECORE_CALLBACK_DONE;
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_cb_frame_extents_request(void *data, int ev_type __UNUSED__, void *ev)
-{
- E_Manager *man;
- E_Container *con;
- Ecore_X_Event_Frame_Extents_Request *e;
- Ecore_X_Window_Type type;
- Ecore_X_MWM_Hint_Decor decor;
- Ecore_X_Window_State *state;
- Frame_Extents *extents;
- const char *border, *sig, *key;
- int ok;
- unsigned int i, num;
-
- man = data;
- con = e_container_current_get(man);
- e = ev;
-
- if (ecore_x_window_parent_get(e->win) != man->root) return ECORE_CALLBACK_PASS_ON;
-
- /* TODO:
- * * We need to check if we remember this window, and border locking is set
- */
- border = "default";
- key = border;
- ok = ecore_x_mwm_hints_get(e->win, NULL, &decor, NULL);
- if ((ok) &&
- (!(decor & ECORE_X_MWM_HINT_DECOR_ALL)) &&
- (!(decor & ECORE_X_MWM_HINT_DECOR_TITLE)) &&
- (!(decor & ECORE_X_MWM_HINT_DECOR_BORDER)))
- {
- border = "borderless";
- key = border;
- }
-
- ok = ecore_x_netwm_window_type_get(e->win, &type);
- if ((ok) &&
- ((type == ECORE_X_WINDOW_TYPE_DESKTOP) ||
- (type == ECORE_X_WINDOW_TYPE_DOCK)))
- {
- border = "borderless";
- key = border;
- }
-
- sig = NULL;
- ecore_x_netwm_window_state_get(e->win, &state, &num);
- if (state)
- {
- int maximized = 0;
-
- for (i = 0; i < num; i++)
- {
- switch (state[i])
- {
- case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
- maximized++;
- break;
-
- case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
- maximized++;
- break;
-
- case ECORE_X_WINDOW_STATE_FULLSCREEN:
- border = "borderless";
- key = border;
- break;
-
- case ECORE_X_WINDOW_STATE_SHADED:
- case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
- case ECORE_X_WINDOW_STATE_SKIP_PAGER:
- case ECORE_X_WINDOW_STATE_HIDDEN:
- case ECORE_X_WINDOW_STATE_ICONIFIED:
- case ECORE_X_WINDOW_STATE_MODAL:
- case ECORE_X_WINDOW_STATE_STICKY:
- case ECORE_X_WINDOW_STATE_ABOVE:
- case ECORE_X_WINDOW_STATE_BELOW:
- case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
- case ECORE_X_WINDOW_STATE_UNKNOWN:
- break;
- }
- }
- if ((maximized == 2) &&
- (e_config->maximize_policy == E_MAXIMIZE_FULLSCREEN))
- {
- sig = "e,action,maximize,fullscreen";
- key = "maximize,fullscreen";
- }
- free(state);
- }
-
- extents = eina_hash_find(frame_extents, key);
- if (!extents)
- {
- extents = E_NEW(Frame_Extents, 1);
- if (extents)
- {
- Evas_Object *o;
- char buf[1024];
-
- o = edje_object_add(con->bg_evas);
- snprintf(buf, sizeof(buf), "e/widgets/border/%s/border", border);
- ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
- if (ok)
- {
- Evas_Coord x, y, w, h;
-
- if (sig)
- {
- edje_object_signal_emit(o, sig, "e");
- edje_object_message_signal_process(o);
- }
-
- evas_object_resize(o, 1000, 1000);
- edje_object_calc_force(o);
- edje_object_part_geometry_get(o, "e.swallow.client",
- &x, &y, &w, &h);
- extents->l = x;
- extents->r = 1000 - (x + w);
- extents->t = y;
- extents->b = 1000 - (y + h);
- }
- else
- {
- extents->l = 0;
- extents->r = 0;
- extents->t = 0;
- extents->b = 0;
- }
- evas_object_del(o);
- eina_hash_add(frame_extents, key, extents);
- }
- }
-
- if (extents)
- ecore_x_netwm_frame_size_set(e->win, extents->l, extents->r, extents->t, extents->b);
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_cb_ping(void *data, int ev_type __UNUSED__, void *ev)
-{
- E_Manager *man;
- E_Border *bd;
- Ecore_X_Event_Ping *e;
-
- man = data;
- e = ev;
-
- if (e->win != man->root) return ECORE_CALLBACK_PASS_ON;
-
- bd = e_border_find_by_client_window(e->event_win);
- if (!bd) return ECORE_CALLBACK_PASS_ON;
-
- bd->ping_ok = 1;
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_cb_timer_post_screensaver_lock(void *data __UNUSED__)
-{
- e_desklock_show_autolocked();
- timer_post_screensaver_lock = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
-static Eina_Bool
-_e_manager_cb_screensaver_on(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
-{
- if (e_config->desklock_autolock_screensaver)
- {
- if (timer_post_screensaver_lock)
- {
- ecore_timer_del(timer_post_screensaver_lock);
- timer_post_screensaver_lock = NULL;
- }
- if (e_config->desklock_post_screensaver_time <= 1.0)
- e_desklock_show_autolocked();
- else
- timer_post_screensaver_lock = ecore_timer_add
- (e_config->desklock_post_screensaver_time,
- _e_manager_cb_timer_post_screensaver_lock, NULL);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_cb_screensaver_off(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
-{
- if (timer_post_screensaver_lock)
- {
- ecore_timer_del(timer_post_screensaver_lock);
- timer_post_screensaver_lock = NULL;
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_cb_client_message(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
-{
- Ecore_X_Event_Client_Message *e;
- E_Border *bd;
-
- e = ev;
-
- if (e->message_type != ECORE_X_ATOM_NET_ACTIVE_WINDOW) return ECORE_CALLBACK_RENEW;
- bd = e_border_find_by_client_window(e->win);
- if (!bd) return ECORE_CALLBACK_RENEW;
-#if 0 /* notes */
- if (e->data.l[0] == 0 /* 0 == old, 1 == client, 2 == pager */)
- {
- }
- timestamp = e->data.l[1];
- requestor_id e->data.l[2];
-#endif
- switch (e_config->window_activehint_policy)
- {
- case 0: break;
-
- case 1:
- edje_object_signal_emit(bd->bg_object, "e,state,urgent", "e");
- break;
-
- default:
- if ((!starting) && (!bd->focused)) e_border_activate(bd, EINA_TRUE);
- else e_border_raise(bd);
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_manager_frame_extents_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__,
- void *data, void *fdata __UNUSED__)
-{
- free(data);
- return EINA_TRUE;
-}
-
-static E_Manager *
-_e_manager_get_for_root(Ecore_X_Window root)
-{
- Eina_List *l;
- E_Manager *man;
-
- if (!managers) return NULL;
- EINA_LIST_FOREACH(managers, l, man)
- {
- if (man->root == root)
- return man;
- }
- return eina_list_data_get(managers);
-}
-
-static Eina_Bool
-_e_manager_clear_timer(void *data)
-{
- E_Manager *man = data;
- ecore_x_window_background_color_set(man->root, 0, 0, 0);
- man->clear_timer = NULL;
- return EINA_FALSE;
-}
-
-#if 0 /* use later - maybe */
-static int
-_e_manager_cb_window_destroy(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_hide(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_reparent(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_create(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_configure_request(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_configure(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_gravity(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_stack(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_stack_request(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_property(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_colormap(void *data, int ev_type, void *ev){return 1; }
-
-static int
-_e_manager_cb_window_shape(void *data, int ev_type, void *ev){return 1; }
-
-#endif
diff --git a/src/bin/e_manager.h b/src/bin/e_manager.h
index 38224edcab..72957d336a 100644
--- a/src/bin/e_manager.h
+++ b/src/bin/e_manager.h
@@ -9,40 +9,28 @@ typedef struct _E_Manager E_Manager;
#define E_MANAGER_TYPE (int) 0xE0b01008
extern EAPI int E_EVENT_MANAGER_KEYS_GRAB;
-extern EAPI int E_EVENT_MANAGER_COMP_SET;
struct _E_Manager
{
E_Object e_obj_inherit;
- Ecore_X_Window win;
int num;
int x, y, w, h;
- char visible : 1;
- Ecore_X_Window root;
+ Ecore_Window root;
Eina_List *handlers;
- Eina_List *containers;
- E_Pointer *pointer;
- Ecore_X_Window initwin;
E_Comp *comp;
- Ecore_Timer *clear_timer;
+ Eina_Bool visible : 1;
};
EINTERN int e_manager_init(void);
EINTERN int e_manager_shutdown(void);
EAPI Eina_List *e_manager_list(void);
-EAPI E_Manager *e_manager_new(Ecore_X_Window root, int num);
+EAPI E_Manager *e_manager_new(Ecore_Window root, E_Comp *c, int w, int h);
EAPI void e_manager_manage_windows(E_Manager *man);
-EAPI void e_manager_show(E_Manager *man);
-EAPI void e_manager_hide(E_Manager *man);
-EAPI void e_manager_move(E_Manager *man, int x, int y);
EAPI void e_manager_resize(E_Manager *man, int w, int h);
-EAPI void e_manager_move_resize(E_Manager *man, int x, int y, int w, int h);
-EAPI void e_manager_raise(E_Manager *man);
-EAPI void e_manager_lower(E_Manager *man);
EAPI E_Manager *e_manager_current_get(void);
EAPI E_Manager *e_manager_number_get(int num);
@@ -50,7 +38,7 @@ EAPI void e_managers_keys_grab(void);
EAPI void e_managers_keys_ungrab(void);
static inline E_Manager *
-e_manager_find_by_root(Ecore_X_Window root)
+e_manager_find_by_root(Ecore_Window root)
{
Eina_List *l;
E_Manager *man;
diff --git a/src/bin/e_maximize.c b/src/bin/e_maximize.c
index 0ec2e2f9be..f6e092af58 100644
--- a/src/bin/e_maximize.c
+++ b/src/bin/e_maximize.c
@@ -14,38 +14,36 @@ struct _E_Maximize_Rect
rects = eina_list_append(rects, r); \
}
-static void _e_maximize_border_rects_fill(E_Border *bd, Eina_List *list, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir);
-static void _e_maximize_border_rects_fill_both(E_Border *bd, Eina_List *rects, int *x1, int *yy1, int *x2, int *y2);
-static void _e_maximize_border_rects_fill_horiz(E_Border *bd, Eina_List *rects, int *x1, int *x2, int *bx, int *by, int *bw, int *bh);
-static void _e_maximize_border_rects_fill_vert(E_Border *bd, Eina_List *rects, int *yy1, int *y2, int *bx, int *by, int *bw, int *bh);
+static void _e_maximize_client_rects_fill(E_Client *ec, Eina_List *list, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir);
+static void _e_maximize_client_rects_fill_both(E_Client *ec, Eina_List *rects, int *x1, int *yy1, int *x2, int *y2);
+static void _e_maximize_client_rects_fill_horiz(E_Client *ec, Eina_List *rects, int *x1, int *x2, int *bx, int *by, int *bw, int *bh);
+static void _e_maximize_client_rects_fill_vert(E_Client *ec, Eina_List *rects, int *yy1, int *y2, int *bx, int *by, int *bw, int *bh);
EAPI void
-e_maximize_border_shelf_fit(E_Border *bd, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir)
+e_maximize_client_shelf_fit(E_Client *ec, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir)
{
- e_maximize_border_shelf_fill(bd, x1, yy1, x2, y2, dir);
+ e_maximize_client_shelf_fill(ec, x1, yy1, x2, y2, dir);
}
EAPI void
-e_maximize_border_dock_fit(E_Border *bd, int *x1, int *yy1, int *x2, int *y2)
+e_maximize_client_dock_fit(E_Client *ec, int *x1, int *yy1, int *x2, int *y2)
{
- E_Border_List *bl;
- E_Border *bd2;
+ E_Client *ec2;
int cx1, cx2, cy1, cy2;
- cx1 = bd->zone->x;
+ cx1 = ec->zone->x;
if (x1) cx1 = *x1;
- cy1 = bd->zone->y;
+ cy1 = ec->zone->y;
if (yy1) cy1 = *yy1;
- cx2 = bd->zone->x + bd->zone->w;
+ cx2 = ec->zone->x + ec->zone->w;
if (x2) cx2 = *x2;
- cy2 = bd->zone->y + bd->zone->h;
+ cy2 = ec->zone->y + ec->zone->h;
if (y2) cy2 = *y2;
- bl = e_container_border_list_first(bd->zone->container);
- while ((bd2 = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(ec->comp, ec2)
{
enum
{
@@ -56,61 +54,61 @@ e_maximize_border_dock_fit(E_Border *bd, int *x1, int *yy1, int *x2, int *y2)
LEFT
} edge = NONE;
- if ((bd2->zone != bd->zone) || (bd2 == bd) ||
- (bd2->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK))
+ if ((ec2->zone != ec->zone) || (ec2 == ec) ||
+ (ec2->netwm.type != E_WINDOW_TYPE_DOCK))
continue;
- if (((bd2->x == bd2->zone->x) || ((bd2->x + bd2->w) == (bd2->zone->x + bd2->zone->w))) &&
- ((bd2->y == bd2->zone->y) || ((bd2->x + bd2->h) == (bd2->zone->x + bd2->zone->h))))
+ if (((ec2->x == ec2->zone->x) || ((ec2->x + ec2->w) == (ec2->zone->x + ec2->zone->w))) &&
+ ((ec2->y == ec2->zone->y) || ((ec2->x + ec2->h) == (ec2->zone->x + ec2->zone->h))))
{
/* corner */
- if (bd2->w > bd2->h)
+ if (ec2->w > ec2->h)
{
- if (bd2->y == bd2->zone->y)
+ if (ec2->y == ec2->zone->y)
edge = TOP;
- else if ((bd2->y + bd2->h) == (bd2->zone->y + bd2->zone->h))
+ else if ((ec2->y + ec2->h) == (ec2->zone->y + ec2->zone->h))
edge = BOTTOM;
}
else
{
- if ((bd2->x + bd2->w) == (bd2->zone->x + bd2->zone->w))
+ if ((ec2->x + ec2->w) == (ec2->zone->x + ec2->zone->w))
edge = RIGHT;
- else if (bd2->x == bd2->zone->x)
+ else if (ec2->x == ec2->zone->x)
edge = LEFT;
}
}
else
{
- if (bd2->y == bd2->zone->y)
+ if (ec2->y == ec2->zone->y)
edge = TOP;
- else if ((bd2->y + bd2->h) == (bd2->zone->y + bd2->zone->h))
+ else if ((ec2->y + ec2->h) == (ec2->zone->y + ec2->zone->h))
edge = BOTTOM;
- else if (bd2->x == bd2->zone->x)
+ else if (ec2->x == ec2->zone->x)
edge = LEFT;
- else if ((bd2->x + bd2->w) == (bd2->zone->x + bd2->zone->w))
+ else if ((ec2->x + ec2->w) == (ec2->zone->x + ec2->zone->w))
edge = RIGHT;
}
switch (edge)
{
case TOP:
- if ((bd2->y + bd2->h) > cy1)
- cy1 = (bd2->y + bd2->h);
+ if ((ec2->y + ec2->h) > cy1)
+ cy1 = (ec2->y + ec2->h);
break;
case RIGHT:
- if (bd2->x < cx2)
- cx2 = bd2->x;
+ if (ec2->x < cx2)
+ cx2 = ec2->x;
break;
case BOTTOM:
- if (bd2->y < cy2)
- cy2 = bd2->y;
+ if (ec2->y < cy2)
+ cy2 = ec2->y;
break;
case LEFT:
- if ((bd2->x + bd2->w) > cx1)
- cx1 = (bd2->x + bd2->w);
+ if ((ec2->x + ec2->w) > cx1)
+ cx1 = (ec2->x + ec2->w);
break;
case NONE:
@@ -118,7 +116,6 @@ e_maximize_border_dock_fit(E_Border *bd, int *x1, int *yy1, int *x2, int *y2)
break;
}
}
- e_container_border_list_free(bl);
if (x1) *x1 = cx1;
if (yy1) *yy1 = cy1;
@@ -127,7 +124,7 @@ e_maximize_border_dock_fit(E_Border *bd, int *x1, int *yy1, int *x2, int *y2)
}
EAPI void
-e_maximize_border_shelf_fill(E_Border *bd, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir)
+e_maximize_client_shelf_fill(E_Client *ec, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir)
{
Eina_List *l, *rects = NULL;
E_Shelf *es;
@@ -139,13 +136,13 @@ e_maximize_border_shelf_fill(E_Border *bd, int *x1, int *yy1, int *x2, int *y2,
E_Config_Shelf_Desk *sd;
if (es->cfg->overlap) continue;
- if (es->zone != bd->zone) continue;
+ if (es->zone != ec->zone) continue;
if (es->cfg->desk_show_mode)
{
EINA_LIST_FOREACH(es->cfg->desk_list, ll, sd)
{
if (!sd) continue;
- if ((sd->x == bd->desk->x) && (sd->y == bd->desk->y))
+ if ((sd->x == ec->desk->x) && (sd->y == ec->desk->y))
{
OBSTACLE(es->x + es->zone->x, es->y + es->zone->y,
es->x + es->zone->x + es->w, es->y + es->zone->y + es->h);
@@ -161,91 +158,88 @@ e_maximize_border_shelf_fill(E_Border *bd, int *x1, int *yy1, int *x2, int *y2,
}
if (rects)
{
- _e_maximize_border_rects_fill(bd, rects, x1, yy1, x2, y2, dir);
+ _e_maximize_client_rects_fill(ec, rects, x1, yy1, x2, y2, dir);
E_FREE_LIST(rects, free);
}
}
EAPI void
-e_maximize_border_border_fill(E_Border *bd, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir)
+e_maximize_client_client_fill(E_Client *ec, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir)
{
Eina_List *rects = NULL;
- E_Border_List *bl;
E_Maximize_Rect *r;
- E_Border *bd2;
+ E_Client *ec2;
- bl = e_container_border_list_first(bd->zone->container);
- while ((bd2 = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(ec->comp, ec2)
{
- if ((bd2->zone != bd->zone) || (bd == bd2) || (bd2->desk != bd->desk && !bd2->sticky) || (bd2->iconic))
+ if ((ec2->zone != ec->zone) || (ec == ec2) || (ec2->desk != ec->desk && !ec2->sticky) || (ec2->iconic))
continue;
- OBSTACLE(bd2->x, bd2->y, bd2->x + bd2->w, bd2->y + bd2->h);
+ OBSTACLE(ec2->x, ec2->y, ec2->x + ec2->w, ec2->y + ec2->h);
}
- e_container_border_list_free(bl);
if (rects)
{
- _e_maximize_border_rects_fill(bd, rects, x1, yy1, x2, y2, dir);
+ _e_maximize_client_rects_fill(ec, rects, x1, yy1, x2, y2, dir);
E_FREE_LIST(rects, free);
}
}
static void
-_e_maximize_border_rects_fill(E_Border *bd, Eina_List *rects, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir)
+_e_maximize_client_rects_fill(E_Client *ec, Eina_List *rects, int *x1, int *yy1, int *x2, int *y2, E_Maximize dir)
{
if ((dir & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_BOTH)
{
- _e_maximize_border_rects_fill_both(bd, rects, x1, yy1, x2, y2);
+ _e_maximize_client_rects_fill_both(ec, rects, x1, yy1, x2, y2);
}
else
{
int bx, by, bw, bh;
- bx = bd->x;
- by = bd->y;
- bw = bd->w;
- bh = bd->h;
+ bx = ec->x;
+ by = ec->y;
+ bw = ec->w;
+ bh = ec->h;
if ((dir & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL)
- _e_maximize_border_rects_fill_horiz(bd, rects, x1, x2, &bx, &by, &bw, &bh);
+ _e_maximize_client_rects_fill_horiz(ec, rects, x1, x2, &bx, &by, &bw, &bh);
else if ((dir & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL)
- _e_maximize_border_rects_fill_vert(bd, rects, yy1, y2, &bx, &by, &bw, &bh);
+ _e_maximize_client_rects_fill_vert(ec, rects, yy1, y2, &bx, &by, &bw, &bh);
}
}
static void
-_e_maximize_border_rects_fill_both(E_Border *bd, Eina_List *rects, int *x1, int *yy1, int *x2, int *y2)
+_e_maximize_client_rects_fill_both(E_Client *ec, Eina_List *rects, int *x1, int *yy1, int *x2, int *y2)
{
int hx1, hy1, hx2, hy2;
int vx1, vy1, vx2, vy2;
int bx, by, bw, bh;
- hx1 = vx1 = bd->zone->x;
+ hx1 = vx1 = ec->zone->x;
if (x1) hx1 = vx1 = *x1;
- hy1 = vy1 = bd->zone->y;
+ hy1 = vy1 = ec->zone->y;
if (yy1) hy1 = vy1 = *yy1;
- hx2 = vx2 = bd->zone->x + bd->zone->w;
+ hx2 = vx2 = ec->zone->x + ec->zone->w;
if (x2) hx2 = vx2 = *x2;
- hy2 = vy2 = bd->zone->y + bd->zone->h;
+ hy2 = vy2 = ec->zone->y + ec->zone->h;
if (y2) hy2 = vy2 = *y2;
/* Init working values, try maximizing horizontally first */
- bx = bd->x;
- by = bd->y;
- bw = bd->w;
- bh = bd->h;
- _e_maximize_border_rects_fill_horiz(bd, rects, &hx1, &hx2, &bx, &by, &bw, &bh);
- _e_maximize_border_rects_fill_vert(bd, rects, &hy1, &hy2, &bx, &by, &bw, &bh);
+ bx = ec->x;
+ by = ec->y;
+ bw = ec->w;
+ bh = ec->h;
+ _e_maximize_client_rects_fill_horiz(ec, rects, &hx1, &hx2, &bx, &by, &bw, &bh);
+ _e_maximize_client_rects_fill_vert(ec, rects, &hy1, &hy2, &bx, &by, &bw, &bh);
/* Reset working values, try maximizing vertically first */
- bx = bd->x;
- by = bd->y;
- bw = bd->w;
- bh = bd->h;
- _e_maximize_border_rects_fill_vert(bd, rects, &vy1, &vy2, &bx, &by, &bw, &bh);
- _e_maximize_border_rects_fill_horiz(bd, rects, &vx1, &vx2, &bx, &by, &bw, &bh);
+ bx = ec->x;
+ by = ec->y;
+ bw = ec->w;
+ bh = ec->h;
+ _e_maximize_client_rects_fill_vert(ec, rects, &vy1, &vy2, &bx, &by, &bw, &bh);
+ _e_maximize_client_rects_fill_horiz(ec, rects, &vx1, &vx2, &bx, &by, &bw, &bh);
/* Use the result set that gives the largest volume */
if (((hx2 - hx1) * (hy2 - hy1)) > ((vx2 - vx1) * (vy2 - vy1)))
@@ -265,23 +259,23 @@ _e_maximize_border_rects_fill_both(E_Border *bd, Eina_List *rects, int *x1, int
}
static void
-_e_maximize_border_rects_fill_horiz(E_Border *bd, Eina_List *rects, int *x1, int *x2, int *bx, int *by, int *bw, int *bh)
+_e_maximize_client_rects_fill_horiz(E_Client *ec, Eina_List *rects, int *x1, int *x2, int *bx, int *by, int *bw, int *bh)
{
Eina_List *l;
E_Maximize_Rect *rect;
int cx1, cx2;
- cx1 = bd->zone->x;
+ cx1 = ec->zone->x;
if (x1) cx1 = *x1;
- cx2 = bd->zone->x + bd->zone->w;
+ cx2 = ec->zone->x + ec->zone->w;
if (x2) cx2 = *x2;
/* Expand left */
EINA_LIST_FOREACH(rects, l, rect)
{
if ((rect->x2 > cx1) && (rect->x2 <= *bx) &&
- E_INTERSECTS(0, rect->yy1, bd->zone->w, (rect->y2 - rect->yy1), 0, *by, bd->zone->w, *bh))
+ E_INTERSECTS(0, rect->yy1, ec->zone->w, (rect->y2 - rect->yy1), 0, *by, ec->zone->w, *bh))
{
cx1 = rect->x2;
}
@@ -293,7 +287,7 @@ _e_maximize_border_rects_fill_horiz(E_Border *bd, Eina_List *rects, int *x1, int
EINA_LIST_FOREACH(rects, l, rect)
{
if ((rect->x1 < cx2) && (rect->x1 >= (*bx + *bw)) &&
- E_INTERSECTS(0, rect->yy1, bd->zone->w, (rect->y2 - rect->yy1), 0, *by, bd->zone->w, *bh))
+ E_INTERSECTS(0, rect->yy1, ec->zone->w, (rect->y2 - rect->yy1), 0, *by, ec->zone->w, *bh))
{
cx2 = rect->x1;
}
@@ -305,23 +299,23 @@ _e_maximize_border_rects_fill_horiz(E_Border *bd, Eina_List *rects, int *x1, int
}
static void
-_e_maximize_border_rects_fill_vert(E_Border *bd, Eina_List *rects, int *yy1, int *y2, int *bx, int *by, int *bw, int *bh)
+_e_maximize_client_rects_fill_vert(E_Client *ec, Eina_List *rects, int *yy1, int *y2, int *bx, int *by, int *bw, int *bh)
{
Eina_List *l;
E_Maximize_Rect *rect;
int cy1, cy2;
- cy1 = bd->zone->y;
+ cy1 = ec->zone->y;
if (yy1) cy1 = *yy1;
- cy2 = bd->zone->y + bd->zone->h;
+ cy2 = ec->zone->y + ec->zone->h;
if (y2) cy2 = *y2;
/* Expand up */
EINA_LIST_FOREACH(rects, l, rect)
{
if ((rect->y2 > cy1) && (rect->y2 <= *by) &&
- E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), bd->zone->h, *bx, 0, *bw, bd->zone->h))
+ E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), ec->zone->h, *bx, 0, *bw, ec->zone->h))
{
cy1 = rect->y2;
}
@@ -333,7 +327,7 @@ _e_maximize_border_rects_fill_vert(E_Border *bd, Eina_List *rects, int *yy1, int
EINA_LIST_FOREACH(rects, l, rect)
{
if ((rect->yy1 < cy2) && (rect->yy1 >= (*by + *bh)) &&
- E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), bd->zone->h, *bx, 0, *bw, bd->zone->h))
+ E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), ec->zone->h, *bx, 0, *bw, ec->zone->h))
{
cy2 = rect->yy1;
}
diff --git a/src/bin/e_maximize.h b/src/bin/e_maximize.h
index e081e059b3..95d3aa416f 100644
--- a/src/bin/e_maximize.h
+++ b/src/bin/e_maximize.h
@@ -3,10 +3,10 @@
#ifndef E_MAXIMIZE_H
#define E_MAXIMIZE_H
-EAPI void e_maximize_border_shelf_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2, E_Maximize dir);
-EAPI void e_maximize_border_dock_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2);
-EAPI void e_maximize_border_shelf_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2, E_Maximize dir);
-EAPI void e_maximize_border_border_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2, E_Maximize dir);
+EAPI void e_maximize_client_shelf_fit(E_Client *ec, int *x1, int *y1, int *x2, int *y2, E_Maximize dir);
+EAPI void e_maximize_client_dock_fit(E_Client *ec, int *x1, int *y1, int *x2, int *y2);
+EAPI void e_maximize_client_shelf_fill(E_Client *ec, int *x1, int *y1, int *x2, int *y2, E_Maximize dir);
+EAPI void e_maximize_client_client_fill(E_Client *ec, int *x1, int *y1, int *x2, int *y2, E_Maximize dir);
#endif
#endif
diff --git a/src/bin/e_menu.c b/src/bin/e_menu.c
index a94ce9513a..5c426fc89a 100644
--- a/src/bin/e_menu.c
+++ b/src/bin/e_menu.c
@@ -72,16 +72,15 @@ static void _e_menu_cb_intercept_container_move(void *data, Evas_Object
static void _e_menu_cb_intercept_container_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
static void _e_menu_cb_item_in(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_menu_cb_item_out(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static Eina_Bool _e_menu_cb_key_down(void *data, int type, void *event);
-static Eina_Bool _e_menu_cb_key_up(void *data, int type, void *event);
+static Eina_Bool _e_menu_cb_key_down(void *data EINA_UNUSED, Ecore_Event_Key *ev);
static Eina_Bool _e_menu_cb_mouse_down(void *data, int type, void *event);
static Eina_Bool _e_menu_cb_mouse_up(void *data, int type, void *event);
static Eina_Bool _e_menu_cb_mouse_move(void *data, int type, void *event);
static Eina_Bool _e_menu_cb_mouse_wheel(void *data, int type, void *event);
static Eina_Bool _e_menu_cb_scroll_animator(void *data);
static void _e_menu_cb_item_submenu_post_default(void *data, E_Menu *m, E_Menu_Item *mi);
-static Eina_Bool _e_menu_categories_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
-static void _e_menu_cb_mouse_evas_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _e_menu_category_free_cb(E_Menu_Category *cat);
+static void _e_menu_cb_mouse_evas_down(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED);
/* local subsystem globals */
static Ecore_X_Window _e_menu_win = 0;
@@ -101,14 +100,8 @@ static int _e_menu_y = 0;
static Ecore_X_Time _e_menu_time = 0;
static int _e_menu_autoscroll_x = 0;
static int _e_menu_autoscroll_y = 0;
-static Ecore_Event_Handler *_e_menu_key_down_handler = NULL;
-static Ecore_Event_Handler *_e_menu_key_up_handler = NULL;
-static Ecore_Event_Handler *_e_menu_mouse_down_handler = NULL;
-static Ecore_Event_Handler *_e_menu_mouse_up_handler = NULL;
-static Ecore_Event_Handler *_e_menu_mouse_move_handler = NULL;
-static Ecore_Event_Handler *_e_menu_mouse_wheel_handler = NULL;
+static Eina_List *handlers = NULL;
static Eina_Bool _e_menu_lock = EINA_FALSE;
-static Evas_Object *_e_menu_event_rect = NULL;
static void
_mouse_up_feed(Evas *e, Ecore_X_Time activate_time)
@@ -173,23 +166,11 @@ _e_menu_list_free_unref(Eina_List *l)
EINTERN int
e_menu_init(void)
{
- _e_menu_key_down_handler =
- ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_menu_cb_key_down, NULL);
- _e_menu_key_up_handler =
- ecore_event_handler_add(ECORE_EVENT_KEY_UP, _e_menu_cb_key_up, NULL);
- _e_menu_mouse_down_handler =
- ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
- _e_menu_cb_mouse_down, NULL);
- _e_menu_mouse_up_handler =
- ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
- _e_menu_cb_mouse_up, NULL);
- _e_menu_mouse_move_handler =
- ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
- _e_menu_cb_mouse_move, NULL);
- _e_menu_mouse_wheel_handler =
- ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
- _e_menu_cb_mouse_wheel, NULL);
- _e_menu_categories = eina_hash_string_superfast_new(NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_menu_cb_mouse_down, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_menu_cb_mouse_up, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, _e_menu_cb_mouse_move, NULL);
+ E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_WHEEL, _e_menu_cb_mouse_wheel, NULL);
+ _e_menu_categories = eina_hash_string_superfast_new((Eina_Free_Cb)_e_menu_category_free_cb);
e_int_menus_init();
return 1;
@@ -198,32 +179,12 @@ e_menu_init(void)
EINTERN int
e_menu_shutdown(void)
{
- E_Menu *m;
-
- E_FREE_FUNC(_e_menu_key_down_handler, ecore_event_handler_del);
- E_FREE_FUNC(_e_menu_key_up_handler, ecore_event_handler_del);
- E_FREE_FUNC(_e_menu_mouse_down_handler, ecore_event_handler_del);
- E_FREE_FUNC(_e_menu_mouse_up_handler, ecore_event_handler_del);
- E_FREE_FUNC(_e_menu_mouse_move_handler, ecore_event_handler_del);
- E_FREE_FUNC(_e_menu_mouse_wheel_handler, ecore_event_handler_del);
+ E_FREE_LIST(handlers, ecore_event_handler_del);
if (!x_fatal)
- {
- EINA_LIST_FREE(_e_active_menus, m)
- {
- m->active = 0;
- _e_menu_unrealize(m);
- m->in_active_list = 0;
- e_object_unref(E_OBJECT(m));
- }
- }
+ e_menu_hide_all();
_e_active_menus = NULL;
- if (_e_menu_categories)
- {
- eina_hash_foreach(_e_menu_categories, _e_menu_categories_free_cb, NULL);
- eina_hash_free(_e_menu_categories);
- _e_menu_categories = NULL;
- }
+ E_FREE_FUNC(_e_menu_categories, eina_hash_free);
_e_menu_lock = EINA_FALSE;
e_int_menus_shutdown();
@@ -1023,6 +984,8 @@ e_menu_item_active_set(E_Menu_Item *mi, int active)
E_OBJECT_CHECK(mi);
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
if (mi->separator) return;
+ active = !!active;
+ if (active == mi->active) return;
if ((active) && (!mi->active))
{
E_Menu_Item *pmi;
@@ -1155,13 +1118,20 @@ e_menu_idler_before(void)
if ((!m->cur.visible) && (m->prev.visible))
{
m->prev.visible = m->cur.visible;
- if (m->cw) e_comp_win_hide(m->cw);
+ e_object_ref(E_OBJECT(m));
+ evas_object_pass_events_set(m->comp_object, 1);
+ if (m->container_object)
+ {
+ evas_object_intercept_move_callback_del(m->container_object, _e_menu_cb_intercept_container_move);
+ evas_object_intercept_resize_callback_del(m->container_object, _e_menu_cb_intercept_container_resize);
+ }
+ evas_object_hide(m->comp_object);
}
}
/* phase 2. move & reisze all the menus that want to moves/resized */
EINA_LIST_FOREACH(_e_active_menus, l, m)
{
- if (m->frozen) continue;
+ if (m->frozen || (!m->active)) continue;
if (!m->realized) _e_menu_realize(m);
if (!m->realized) continue;
if (((m->cur.w) != (m->prev.w)) ||
@@ -1173,8 +1143,7 @@ e_menu_idler_before(void)
m->prev.h = m->cur.h;
w = m->cur.w;
h = m->cur.h;
- if (m->cw)
- e_comp_win_resize(m->cw, w, h);
+ evas_object_resize(m->comp_object, w, h);
}
if (((m->cur.x) != (m->prev.x)) ||
((m->cur.y) != (m->prev.y)))
@@ -1197,8 +1166,7 @@ e_menu_idler_before(void)
}
m->prev.x = m->cur.x;
m->prev.y = m->cur.y;
- if (m->cw)
- e_comp_win_move(m->cw, m->cur.x, m->cur.y);
+ evas_object_move(m->comp_object, m->cur.x, m->cur.y);
}
}
@@ -1210,22 +1178,16 @@ e_menu_idler_before(void)
if ((m->cur.visible) && (!m->prev.visible))
{
m->prev.visible = m->cur.visible;
- if (!m->cw)
- {
- evas_object_move(m->bg_object, m->cur.x, m->cur.y);
- evas_object_resize(m->bg_object, m->cur.w, m->cur.h);
- E_LAYER_SET(m->bg_object, E_COMP_CANVAS_LAYER_MENU);
- }
- e_comp_win_show(m->cw);
+ evas_object_pass_events_set(m->comp_object, 0);
+ evas_object_show(m->comp_object);
}
}
/* phase 4. de-activate... */
EINA_LIST_REVERSE_FOREACH(_e_active_menus, l, m)
{
- if (!m->active)
+ if ((!m->active) && (!evas_object_visible_get(m->comp_object)))
{
- if (m->cw) e_comp_win_del(m->cw);
- else _e_menu_unrealize(m);
+ _e_menu_unrealize(m);
removals = eina_list_append(removals, m);
}
}
@@ -1246,9 +1208,8 @@ e_menu_idler_before(void)
if (_e_menu_win)
{
e_grabinput_release(_e_menu_win, _e_menu_win);
+ _mouse_up_feed(e_comp_find_by_window(_e_menu_win)->evas, 0);
_e_menu_win = 0;
- _mouse_up_feed(evas_object_evas_get(_e_menu_event_rect), 0);
- E_FREE_FUNC(_e_menu_event_rect, evas_object_del);
}
}
}
@@ -1287,10 +1248,11 @@ _e_menu_free(E_Menu *m)
if (cb->free) cb->free(cb->data);
}
}
+ eina_stringshare_replace(&m->category, NULL);
if (m->parent_item)
m->parent_item->submenu = NULL;
- /* del callback causes this to unrealize the menu */
- if (m->bg_object) evas_object_del(m->bg_object);
+ _e_menu_unrealize(m);
+ if (m->realized) return;
EINA_LIST_FOREACH_SAFE(m->items, l, l_next, mi)
e_object_del(E_OBJECT(mi));
if (m->in_active_list)
@@ -1394,12 +1356,9 @@ _e_menu_cb_intercept_container_resize(void *data, Evas_Object *o, Evas_Coord w,
}
static void
-_e_menu_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+_e_menu_hide_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- E_Menu *m = data;
-
- m->bg_object = NULL;
- _e_menu_unrealize(m);
+ e_object_unref(data);
}
static void
@@ -1701,15 +1660,11 @@ _e_menu_realize(E_Menu *m)
m->zone = m->parent_item->menu->zone;
if (!m->zone) return; //menu not ready!
m->evas = e_comp_get(m)->evas;
- m->shape = e_container_shape_add(m->zone->container);
evas_event_freeze(m->evas);
o = edje_object_add(m->evas);
- evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _e_menu_del_cb, m);
m->bg_object = o;
evas_object_name_set(o, "menu->bg_object");
- evas_object_data_set(o, "e_menu", m);
- evas_object_data_set(o, "eobj", m);
e_theme_edje_object_set(o, "base/theme/menus", "e/widgets/menu/default/background");
if (m->header.title)
{
@@ -1718,13 +1673,21 @@ _e_menu_realize(E_Menu *m)
edje_object_message_signal_process(o);
}
+ m->comp_object = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_MENU);
+ if (!m->parent_item)
+ e_comp_object_util_autoclose(m->comp_object, _e_menu_cb_mouse_evas_down, _e_menu_cb_key_down, m);
+ evas_object_name_set(m->comp_object, "m->comp_object");
+ evas_object_event_callback_add(m->comp_object, EVAS_CALLBACK_HIDE, _e_menu_hide_cb, m);
+ evas_object_layer_set(m->comp_object, E_LAYER_MENU);
+ evas_object_move(m->comp_object, m->cur.x, m->cur.y);
+ evas_object_resize(m->comp_object, m->cur.w, m->cur.h);
+
o = e_box_add(m->evas);
evas_object_name_set(o, "menu->container_object");
m->container_object = o;
evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_container_move, m);
evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_container_resize, m);
e_box_freeze(o);
- evas_object_show(o);
e_box_homogenous_set(o, 0);
edje_object_part_swallow(m->bg_object, "e.swallow.content", m->container_object);
@@ -1980,21 +1943,37 @@ _e_menu_unrealize(E_Menu *m)
if (!m->realized) return;
/* freeze+thaw here breaks the universe. don't do it. */
//evas_event_freeze(m->evas);
- E_FREE_FUNC(m->shape, e_object_del);
+ if (m->cur.visible && m->comp_object && (!stopping))
+ {
+ /* force unref in smart object */
+ if (m->container_object)
+ {
+ evas_object_intercept_move_callback_del(m->container_object, _e_menu_cb_intercept_container_move);
+ evas_object_intercept_resize_callback_del(m->container_object, _e_menu_cb_intercept_container_resize);
+ }
+ evas_object_pass_events_set(m->comp_object, 1);
+ evas_object_hide(m->comp_object);
+ E_FREE_FUNC(m->comp_object, evas_object_del);
+ e_object_ref(E_OBJECT(m));
+ return;
+ }
+ if (m->comp_object)
+ {
+ evas_object_event_callback_del_full(m->comp_object, EVAS_CALLBACK_HIDE, _e_menu_hide_cb, m);
+ }
+ evas_object_hide(m->comp_object);
+ evas_object_del(m->comp_object);
+ if (stopping && m->comp_object) evas_object_unref(m->comp_object);
e_box_freeze(m->container_object);
EINA_LIST_FOREACH(m->items, l, mi)
_e_menu_item_unrealize(mi);
- if (m->header.icon) evas_object_del(m->header.icon);
- m->header.icon = NULL;
- if (m->bg_object) evas_object_del(m->bg_object);
- m->bg_object = NULL;
- if (m->container_object) evas_object_del(m->container_object);
- m->container_object = NULL;
+ E_FREE_FUNC(m->header.icon, evas_object_del);
+ E_FREE_FUNC(m->bg_object, evas_object_del);
+ E_FREE_FUNC(m->container_object, evas_object_del);
m->cur.visible = 0;
m->prev.visible = 0;
m->realized = 0;
m->zone = NULL;
- m->cw = NULL;
//evas_event_thaw(m->evas);
m->evas = NULL;
}
@@ -2011,22 +1990,15 @@ _e_menu_activate_internal(E_Menu *m, E_Zone *zone)
m->pending_new_submenu = 0;
if (!_e_menu_win)
{
- _e_menu_win = e_comp_get(zone)->ee_win;
+ _e_menu_win = zone->comp->ee_win;
if (!e_grabinput_get(_e_menu_win, 0, _e_menu_win))
{
_e_menu_win = 0;
return;
}
- _e_menu_event_rect = evas_object_rectangle_add(e_comp_get(zone)->evas);
- evas_object_color_set(_e_menu_event_rect, 0, 0, 0, 0);
- evas_object_resize(_e_menu_event_rect, e_comp_get(zone)->man->w, e_comp_get(zone)->man->h);
- evas_object_event_callback_add(_e_menu_event_rect, EVAS_CALLBACK_MOUSE_DOWN, _e_menu_cb_mouse_evas_down, NULL);
- evas_object_layer_set(_e_menu_event_rect, E_COMP_CANVAS_LAYER_MENU - 1);
- evas_object_show(_e_menu_event_rect);
}
- if ((m->zone) && (m->zone->container != zone->container))
+ if ((m->zone) && (m->zone->comp != zone->comp))
{
- printf("FIXME: cannot move menus between containers yet\n");
return;
}
m->zone = zone;
@@ -2119,6 +2091,7 @@ _e_menu_submenu_activate(E_Menu_Item *mi)
_e_menu_activate_internal(m, mi->menu->zone);
_e_menu_reposition(m);
e_object_unref(E_OBJECT(m));
+ mi->menu->have_submenu = 1;
}
}
@@ -2126,6 +2099,7 @@ static void
_e_menu_submenu_deactivate(E_Menu_Item *mi)
{
if (!mi->menu->active) return;
+ mi->menu->have_submenu = 0;
if (mi->submenu_post_cb.func)
mi->submenu_post_cb.func(mi->submenu_post_cb.data, mi->menu, mi);
}
@@ -2782,12 +2756,8 @@ _e_menu_cb_item_out(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED
}
static Eina_Bool
-_e_menu_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
+_e_menu_cb_key_down(void *data EINA_UNUSED, Ecore_Event_Key *ev)
{
- Ecore_Event_Key *ev;
-
- ev = event;
- if (ev->window != _e_menu_win) return ECORE_CALLBACK_PASS_ON;
if ((!strcmp(ev->key, "Up")) || (!strcmp(ev->key, "KP_Up")))
_e_menu_item_activate_previous();
else if ((!strcmp(ev->key, "Down")) || (!strcmp(ev->key, "KP_Down")))
@@ -2834,23 +2804,13 @@ _e_menu_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
return ECORE_CALLBACK_PASS_ON;
}
-static Eina_Bool
-_e_menu_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
-{
- Ecore_Event_Key *ev;
-
- ev = event;
- if (ev->window != _e_menu_win) return ECORE_CALLBACK_PASS_ON;
- return ECORE_CALLBACK_PASS_ON;
-}
-
/* we need all of these because menus are special and grab the mouse and
* keyboard and thus the normal event mechanism doesn't work, so we feed
* events directly to the canvases from our grab window
*/
static void
-_e_menu_cb_mouse_evas_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+_e_menu_cb_mouse_evas_down(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED)
{
_e_menu_deactivate_all();
}
@@ -2907,7 +2867,11 @@ _e_menu_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
E_Menu_Item *mi;
mi = _e_menu_item_active_get();
- if ((!mi) || (E_INSIDE(ev->root.x, ev->root.y, mi->x, mi->y, mi->w, mi->h)))
+ if ((!mi) ||
+ (E_INSIDE(e_comp_canvas_x_root_adjust(e_comp_get(mi), ev->root.x),
+ e_comp_canvas_y_root_adjust(e_comp_get(mi), ev->root.y),
+ mi->x, mi->y, mi->w, mi->h))
+ )
ret = _e_menu_active_call();
}
_e_menu_activate_maybe_drag = 0;
@@ -3085,16 +3049,10 @@ _e_menu_cb_item_submenu_post_default(void *data __UNUSED__, E_Menu *m __UNUSED__
e_object_del(E_OBJECT(subm));
}
-static Eina_Bool
-_e_menu_categories_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
+static void
+_e_menu_category_free_cb(E_Menu_Category *cat)
{
- E_Menu_Category_Callback *cb;
- E_Menu_Category *cat;
-
- cat = (E_Menu_Category *)data;
- EINA_LIST_FREE(cat->callbacks, cb)
- free(cb); /* free the callback struct */
+ E_FREE_LIST(cat->callbacks, free);
free(cat);
- return EINA_TRUE;
}
diff --git a/src/bin/e_menu.h b/src/bin/e_menu.h
index 8c4d05c299..46fbf1def4 100644
--- a/src/bin/e_menu.h
+++ b/src/bin/e_menu.h
@@ -52,10 +52,9 @@ struct _E_Menu
E_Menu_Item *parent_item;
/* only useful if realized != 0 (ie menu is ACTUALLY realized) */
- E_Comp_Win *cw;
- E_Container_Shape *shape;
Ecore_Job *dangling_job;
Evas *evas;
+ Evas_Object *comp_object;
Evas_Object *bg_object;
Evas_Object *container_object;
Evas_Coord container_x, container_y, container_w, container_h;
diff --git a/src/bin/e_module.c b/src/bin/e_module.c
index b5981e1ec4..f57a5ef550 100644
--- a/src/bin/e_module.c
+++ b/src/bin/e_module.c
@@ -569,11 +569,10 @@ EAPI void
e_module_dialog_show(E_Module *m, const char *title, const char *body)
{
E_Dialog *dia;
- E_Border *bd;
char buf[PATH_MAX];
const char *icon = NULL;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
+ dia = e_dialog_new(NULL,
"E", "_module_dialog");
if (!dia) return;
@@ -611,9 +610,8 @@ e_module_dialog_show(E_Module *m, const char *title, const char *body)
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
if (!m) return;
- bd = dia->win->border;
- if (!bd) return;
- bd->internal_icon = eina_stringshare_add(icon);
+ if (dia->win->client)
+ dia->win->client->internal_icon = eina_stringshare_add(icon);
}
EAPI void
@@ -785,7 +783,7 @@ _e_module_cb_idler(void *data __UNUSED__)
if (name) m = e_module_new(name);
if (m)
{
-#ifndef E18_RELEASE_BUILD
+#ifndef E19_RELEASE_BUILD
char buf[1024];
snprintf(buf, sizeof(buf), "DELAYED MODULE LOAD: %s", name);
e_main_ts(buf);
@@ -981,7 +979,7 @@ _e_module_whitelist_check(void)
ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
_x_tainted, &_e_tainted, 1);
- e_env_set("E18_TAINTED", state);
+ e_env_set("E19_TAINTED", state);
}
if (eina_list_count(badl) != known)
@@ -989,7 +987,7 @@ _e_module_whitelist_check(void)
E_Dialog *dia;
Eina_Strbuf *sbuf;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
+ dia = e_dialog_new(NULL,
"E", "_module_whitelist_dialog");
if (!dia)
{
diff --git a/src/bin/e_moveresize.c b/src/bin/e_moveresize.c
index 07debc3863..d449900718 100644
--- a/src/bin/e_moveresize.c
+++ b/src/bin/e_moveresize.c
@@ -1,38 +1,34 @@
#include "e.h"
-static void _e_resize_begin(void *data, void *bd);
-static void _e_resize_update(void *data, void *bd);
-static void _e_resize_end(void *data, void *bd);
-static void _e_resize_border_extents(E_Border *bd, int *w, int *h);
-static void _e_move_begin(void *data, void *bd);
-static void _e_move_update(void *data, void *bd);
-static void _e_move_end(void *data, void *bd);
-static void _e_move_resize_object_coords_set(int x, int y, int w, int h);
-
-static E_Popup *_disp_pop = NULL;
+static void _e_resize_begin(void *data, E_Client *ec);
+static void _e_resize_update(void *data, E_Client *ec);
+static void _e_resize_end(void *data, E_Client *ec);
+static void _e_resize_client_extents(E_Client *ec, int *w, int *h);
+static void _e_move_begin(void *data, E_Client *ec);
+static void _e_move_update(void *data, E_Client *ec);
+static void _e_move_end(void *data, E_Client *ec);
+
+static Evas_Object *_disp_obj = NULL;
+static Evas_Object *_disp_content = NULL;
static Eina_List *hooks = NULL;
static int visible = 0;
-static int obj_x = 0;
-static int obj_y = 0;
-static int obj_w = 0;
-static int obj_h = 0;
EINTERN int
e_moveresize_init(void)
{
- E_Border_Hook *h;
+ E_Client_Hook *h;
- h = e_border_hook_add(E_BORDER_HOOK_RESIZE_BEGIN, _e_resize_begin, NULL);
+ h = e_client_hook_add(E_CLIENT_HOOK_RESIZE_BEGIN, _e_resize_begin, NULL);
if (h) hooks = eina_list_append(hooks, h);
- h = e_border_hook_add(E_BORDER_HOOK_RESIZE_UPDATE, _e_resize_update, NULL);
+ h = e_client_hook_add(E_CLIENT_HOOK_RESIZE_UPDATE, _e_resize_update, NULL);
if (h) hooks = eina_list_append(hooks, h);
- h = e_border_hook_add(E_BORDER_HOOK_RESIZE_END, _e_resize_end, NULL);
+ h = e_client_hook_add(E_CLIENT_HOOK_RESIZE_END, _e_resize_end, NULL);
if (h) hooks = eina_list_append(hooks, h);
- h = e_border_hook_add(E_BORDER_HOOK_MOVE_BEGIN, _e_move_begin, NULL);
+ h = e_client_hook_add(E_CLIENT_HOOK_MOVE_BEGIN, _e_move_begin, NULL);
if (h) hooks = eina_list_append(hooks, h);
- h = e_border_hook_add(E_BORDER_HOOK_MOVE_UPDATE, _e_move_update, NULL);
+ h = e_client_hook_add(E_CLIENT_HOOK_MOVE_UPDATE, _e_move_update, NULL);
if (h) hooks = eina_list_append(hooks, h);
- h = e_border_hook_add(E_BORDER_HOOK_MOVE_END, _e_move_end, NULL);
+ h = e_client_hook_add(E_CLIENT_HOOK_MOVE_END, _e_move_end, NULL);
if (h) hooks = eina_list_append(hooks, h);
return 1;
@@ -41,40 +37,32 @@ e_moveresize_init(void)
EINTERN int
e_moveresize_shutdown(void)
{
- E_Border_Hook *h;
+ E_Client_Hook *h;
EINA_LIST_FREE(hooks, h)
- e_border_hook_del(h);
+ e_client_hook_del(h);
return 1;
}
static void
-_e_resize_begin(void *data __UNUSED__, void *border)
+_e_resize_begin(void *data __UNUSED__, E_Client *ec)
{
- E_Border *bd = border;
Evas_Object *o;
Evas_Coord ew, eh;
char buf[40];
int w, h;
- if (_disp_pop) e_object_del(E_OBJECT(_disp_pop));
- _disp_pop = NULL;
+ if (_disp_obj) evas_object_hide(_disp_obj);
+ E_FREE_FUNC(_disp_obj, evas_object_del);
if (!e_config->resize_info_visible)
return;
- if (e_config->resize_info_follows)
- _e_move_resize_object_coords_set(bd->x, bd->y, bd->w, bd->h);
- else
- _e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
-
- _e_resize_border_extents(bd, &w, &h);
+ _e_resize_client_extents(ec, &w, &h);
- _disp_pop = e_popup_new(bd->zone, 0, 0, 1, 1);
- if (!_disp_pop) return;
- e_popup_ignore_events_set(_disp_pop, 1);
- o = edje_object_add(_disp_pop->evas);
+ _disp_content = o = edje_object_add(e_comp_get(ec)->evas);
+ evas_object_name_set(o, "resizeinfo->_disp_content");
e_theme_edje_object_set(o, "base/theme/borders",
"e/widgets/border/default/resize");
snprintf(buf, sizeof(buf), "9999x9999");
@@ -82,29 +70,31 @@ _e_resize_begin(void *data __UNUSED__, void *border)
edje_object_size_min_calc(o, &ew, &eh);
snprintf(buf, sizeof(buf), _("%i×%i"), w, h);
- edje_object_part_text_set(_disp_pop->content, "e.text.label", buf);
+ edje_object_part_text_set(o, "e.text.label", buf);
- e_popup_move_resize(_disp_pop,
- (obj_x - _disp_pop->zone->x) +
- ((obj_w - ew) / 2),
- (obj_y - _disp_pop->zone->y) +
- ((obj_h - eh) / 2),
- ew, eh);
- e_popup_content_set(_disp_pop, o);
+ _disp_obj = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_POPUP);
+ evas_object_name_set(o, "resizeinfo->_disp_obj");
+ evas_object_layer_set(_disp_obj, E_LAYER_POPUP);
+ evas_object_pass_events_set(_disp_obj, 1);
- snprintf(buf, sizeof(buf), _("%i×%i"), w, h);
- edje_object_part_text_set(o, "e.text.label", buf);
+ evas_object_resize(_disp_obj, ew, eh);
+ if (e_config->resize_info_follows)
+ e_comp_object_util_center_on(_disp_obj, ec->frame);
+ else
+ e_comp_object_util_center(_disp_obj);
}
static void
-_e_resize_end(void *data __UNUSED__, void *border __UNUSED__)
+_e_resize_end(void *data __UNUSED__, E_Client *ec __UNUSED__)
{
if (e_config->resize_info_visible)
{
- if (_disp_pop)
+ if (_disp_obj)
{
- e_object_del(E_OBJECT(_disp_pop));
- _disp_pop = NULL;
+ evas_object_hide(_disp_obj);
+ evas_object_del(_disp_obj);
+ _disp_obj = NULL;
+ _disp_content = NULL;
}
}
@@ -112,105 +102,105 @@ _e_resize_end(void *data __UNUSED__, void *border __UNUSED__)
}
static void
-_e_resize_update(void *data __UNUSED__, void *border)
+_e_resize_update(void *data __UNUSED__, E_Client *ec)
{
- E_Border *bd = border;
char buf[40];
int w, h;
- if (!_disp_pop) return;
+ if (!_disp_obj) return;
if (e_config->resize_info_follows)
- _e_move_resize_object_coords_set(bd->x, bd->y, bd->w, bd->h);
+ e_comp_object_util_center_on(_disp_obj, ec->frame);
- _e_resize_border_extents(bd, &w, &h);
+ _e_resize_client_extents(ec, &w, &h);
if (!visible)
{
- e_popup_show(_disp_pop);
+ evas_object_show(_disp_obj);
visible = 1;
}
snprintf(buf, sizeof(buf), _("%i×%i"), w, h);
- edje_object_part_text_set(_disp_pop->content, "e.text.label", buf);
+ edje_object_part_text_set(_disp_content, "e.text.label", buf);
}
static void
-_e_resize_border_extents(E_Border *bd, int *w, int *h)
+_e_resize_client_extents(E_Client *ec, int *w, int *h)
{
- if ((bd->client.icccm.base_w >= 0) &&
- (bd->client.icccm.base_h >= 0))
+ if ((ec->icccm.base_w >= 0) &&
+ (ec->icccm.base_h >= 0))
{
- if (bd->client.icccm.step_w > 0)
- *w = (bd->client.w - bd->client.icccm.base_w) / bd->client.icccm.step_w;
+ if (ec->icccm.step_w > 0)
+ *w = (ec->client.w - ec->icccm.base_w) / ec->icccm.step_w;
else
- *w = bd->client.w;
- if (bd->client.icccm.step_h > 0)
- *h = (bd->client.h - bd->client.icccm.base_h) / bd->client.icccm.step_h;
+ *w = ec->client.w;
+ if (ec->icccm.step_h > 0)
+ *h = (ec->client.h - ec->icccm.base_h) / ec->icccm.step_h;
else
- *h = bd->client.h;
+ *h = ec->client.h;
}
else
{
- if (bd->client.icccm.step_w > 0)
- *w = (bd->client.w - bd->client.icccm.min_w) / bd->client.icccm.step_w;
+ if (ec->icccm.step_w > 0)
+ *w = (ec->client.w - ec->icccm.min_w) / ec->icccm.step_w;
else
- *w = bd->client.w;
- if (bd->client.icccm.step_h > 0)
- *h = (bd->client.h - bd->client.icccm.min_h) / bd->client.icccm.step_h;
+ *w = ec->client.w;
+ if (ec->icccm.step_h > 0)
+ *h = (ec->client.h - ec->icccm.min_h) / ec->icccm.step_h;
else
- *h = bd->client.h;
+ *h = ec->client.h;
}
}
static void
-_e_move_begin(void *data __UNUSED__, void *border)
+_e_move_begin(void *data __UNUSED__, E_Client *ec)
{
- E_Border *bd = border;
Evas_Object *o;
Evas_Coord ew, eh;
char buf[40];
- if (_disp_pop) e_object_del(E_OBJECT(_disp_pop));
- _disp_pop = NULL;
+ if (_disp_obj)
+ {
+ evas_object_hide(_disp_obj);
+ evas_object_del(_disp_obj);
+ }
+ _disp_obj = NULL;
if (!e_config->move_info_visible)
return;
- if (e_config->move_info_follows)
- _e_move_resize_object_coords_set(bd->x, bd->y, bd->w, bd->h);
- else
- _e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
-
- _disp_pop = e_popup_new(bd->zone, 0, 0, 1, 1);
- e_popup_ignore_events_set(_disp_pop, 1);
- o = edje_object_add(_disp_pop->evas);
+ _disp_content = o = edje_object_add(e_comp_get(ec)->evas);
+ evas_object_name_set(o, "moveinfo->_disp_content");
e_theme_edje_object_set(o, "base/theme/borders",
"e/widgets/border/default/move");
snprintf(buf, sizeof(buf), "9999 9999");
edje_object_part_text_set(o, "e.text.label", buf);
edje_object_size_min_calc(o, &ew, &eh);
- snprintf(buf, sizeof(buf), "%i %i", bd->x, bd->y);
+ snprintf(buf, sizeof(buf), "%i %i", ec->x, ec->y);
edje_object_part_text_set(o, "e.text.label", buf);
- e_popup_move_resize(_disp_pop,
- (obj_x - _disp_pop->zone->x) +
- ((obj_w - ew) / 2),
- (obj_y - _disp_pop->zone->y) +
- ((obj_h - eh) / 2),
- ew, eh);
- e_popup_content_set(_disp_pop, o);
+ _disp_obj = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_POPUP);
+ evas_object_name_set(o, "moveinfo->_disp_obj");
+ evas_object_layer_set(_disp_obj, E_LAYER_POPUP);
+ evas_object_pass_events_set(_disp_obj, 1);
+
+ evas_object_resize(_disp_obj, ew, eh);
+ if (e_config->move_info_follows)
+ e_comp_object_util_center_on(_disp_obj, ec->frame);
+ else
+ e_comp_object_util_center(_disp_obj);
}
static void
-_e_move_end(void *data __UNUSED__, void *border __UNUSED__)
+_e_move_end(void *data __UNUSED__, E_Client *ec __UNUSED__)
{
if (e_config->move_info_visible)
{
- if (_disp_pop)
+ if (_disp_obj)
{
- e_object_del(E_OBJECT(_disp_pop));
- _disp_pop = NULL;
+ evas_object_hide(_disp_obj);
+ E_FREE_FUNC(_disp_obj, evas_object_del);
+ _disp_content = NULL;
}
}
@@ -218,40 +208,20 @@ _e_move_end(void *data __UNUSED__, void *border __UNUSED__)
}
static void
-_e_move_update(void *data __UNUSED__, void *border)
+_e_move_update(void *data __UNUSED__, E_Client *ec)
{
- E_Border *bd = border;
char buf[40];
- if (!_disp_pop) return;
+ if (!_disp_obj) return;
if (e_config->move_info_follows)
- _e_move_resize_object_coords_set(bd->x, bd->y, bd->w, bd->h);
+ e_comp_object_util_center_on(_disp_obj, ec->frame);
if (!visible)
{
- e_popup_show(_disp_pop);
+ evas_object_show(_disp_obj);
visible = 1;
}
- snprintf(buf, sizeof(buf), "%i %i", bd->x, bd->y);
- edje_object_part_text_set(_disp_pop->content, "e.text.label", buf);
+ snprintf(buf, sizeof(buf), "%i %i", ec->x, ec->y);
+ edje_object_part_text_set(_disp_content, "e.text.label", buf);
}
-
-static void
-_e_move_resize_object_coords_set(int x, int y, int w, int h)
-{
- obj_x = x;
- obj_y = y;
- obj_w = w;
- obj_h = h;
- if ((_disp_pop) && (e_config->move_info_visible) && (visible))
- {
- e_popup_move(_disp_pop,
- (obj_x - _disp_pop->zone->x) +
- ((obj_w - _disp_pop->w) / 2),
- (obj_y - _disp_pop->zone->y) +
- ((obj_h - _disp_pop->h) / 2)
- );
- }
-}
-
diff --git a/src/bin/e_msgbus.c b/src/bin/e_msgbus.c
index 483b94fc2f..1d3f4eb7e9 100644
--- a/src/bin/e_msgbus.c
+++ b/src/bin/e_msgbus.c
@@ -411,8 +411,9 @@ static Eldbus_Message *
_e_msgbus_window_list_cb(const Eldbus_Service_Interface *iface __UNUSED__,
const Eldbus_Message *msg)
{
- Eina_List *l;
- E_Border *bd;
+ const Eina_List *l, *ll;
+ E_Comp *c;
+ E_Client *ec;
Eldbus_Message *reply;
Eldbus_Message_Iter *main_iter, *array;
@@ -425,16 +426,19 @@ _e_msgbus_window_list_cb(const Eldbus_Service_Interface *iface __UNUSED__,
eldbus_message_iter_arguments_append(main_iter, "a(si)", &array);
EINA_SAFETY_ON_FALSE_RETURN_VAL(array, reply);
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- {
- Eldbus_Message_Iter *s;
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ Eldbus_Message_Iter *s;
- eldbus_message_iter_arguments_append(array, "(si)", &s);
- if (!s) continue;
- eldbus_message_iter_arguments_append(s, "si", bd->client.icccm.name,
- bd->client.win);
- eldbus_message_iter_container_close(array, s);
- }
+ if (e_client_util_ignored_get(ec)) continue;
+
+ eldbus_message_iter_arguments_append(array, "(si)", &s);
+ if (!s) continue;
+ eldbus_message_iter_arguments_append(s, "si", ec->icccm.name,
+ e_client_util_win_get(ec));
+ eldbus_message_iter_container_close(array, s);
+ }
eldbus_message_iter_container_close(main_iter, array);
return reply;
@@ -445,13 +449,13 @@ _e_msgbus_window_list_cb(const Eldbus_Service_Interface *iface __UNUSED__,
_e_msgbus_window_##NAME##_cb(const Eldbus_Service_Interface * iface __UNUSED__, \
const Eldbus_Message * msg) \
{ \
- E_Border *bd; \
+ E_Client *ec; \
int xwin; \
\
if (!eldbus_message_arguments_get(msg, "i", &xwin)) \
return eldbus_message_method_return_new(msg); \
- bd = e_border_find_by_client_window(xwin); \
- if (bd) \
+ ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, xwin); \
+ if (ec) \
{
#define E_MSGBUS_WIN_ACTION_CB_END \
} \
@@ -460,29 +464,29 @@ _e_msgbus_window_list_cb(const Eldbus_Service_Interface *iface __UNUSED__,
}
E_MSGBUS_WIN_ACTION_CB_BEGIN(close)
- e_border_act_close_begin(bd);
+ e_client_act_close_begin(ec);
E_MSGBUS_WIN_ACTION_CB_END
E_MSGBUS_WIN_ACTION_CB_BEGIN(kill)
- e_border_act_kill_begin(bd);
+ e_client_act_kill_begin(ec);
E_MSGBUS_WIN_ACTION_CB_END
E_MSGBUS_WIN_ACTION_CB_BEGIN(focus)
- e_border_activate(bd, 1);
+ e_client_activate(ec, 1);
E_MSGBUS_WIN_ACTION_CB_END
E_MSGBUS_WIN_ACTION_CB_BEGIN(iconify)
- e_border_iconify(bd);
+ e_client_iconify(ec);
E_MSGBUS_WIN_ACTION_CB_END
E_MSGBUS_WIN_ACTION_CB_BEGIN(uniconify)
- e_border_uniconify(bd);
+ e_client_uniconify(ec);
E_MSGBUS_WIN_ACTION_CB_END
E_MSGBUS_WIN_ACTION_CB_BEGIN(maximize)
- e_border_maximize(bd, e_config->maximize_policy);
+ e_client_maximize(ec, e_config->maximize_policy);
E_MSGBUS_WIN_ACTION_CB_END
E_MSGBUS_WIN_ACTION_CB_BEGIN(unmaximize)
- e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
+ e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
E_MSGBUS_WIN_ACTION_CB_END
diff --git a/src/bin/e_obj_dialog.c b/src/bin/e_obj_dialog.c
index bafe057d9a..600cfc8e67 100644
--- a/src/bin/e_obj_dialog.c
+++ b/src/bin/e_obj_dialog.c
@@ -20,25 +20,17 @@ _key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *
}
EAPI E_Obj_Dialog *
-e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class)
+e_obj_dialog_new(E_Comp *c, char *title, char *class_name, char *class_class)
{
E_Obj_Dialog *od;
- E_Manager *man;
Evas_Object *o;
Eina_Bool kg;
Evas_Modifier_Mask mask;
- if (!con)
- {
- man = e_manager_current_get();
- if (!man) return NULL;
- con = e_container_current_get(man);
- if (!con) con = e_container_number_get(man, 0);
- if (!con) return NULL;
- }
+ if (!c) c = e_util_comp_current_get();
od = E_OBJECT_ALLOC(E_Obj_Dialog, E_OBJ_DIALOG_TYPE, _e_obj_dialog_free);
if (!od) return NULL;
- od->win = e_win_new(con);
+ od->win = e_win_new(c);
if (!od->win)
{
free(od);
@@ -78,14 +70,8 @@ e_obj_dialog_icon_set(E_Obj_Dialog *od, char *icon)
{
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
- if (od->win->border->internal_icon)
- {
- eina_stringshare_del(od->win->border->internal_icon);
- od->win->border->internal_icon = NULL;
- }
- if (icon)
- od->win->border->internal_icon = eina_stringshare_add(icon);
-}
+ eina_stringshare_replace(&od->win->client->internal_icon, icon);
+ }
EAPI void
e_obj_dialog_show(E_Obj_Dialog *od)
diff --git a/src/bin/e_obj_dialog.h b/src/bin/e_obj_dialog.h
index 2316b5ee8b..1f26079895 100644
--- a/src/bin/e_obj_dialog.h
+++ b/src/bin/e_obj_dialog.h
@@ -18,7 +18,7 @@ struct _E_Obj_Dialog
void (*cb_delete)(E_Obj_Dialog *od);
};
-EAPI E_Obj_Dialog *e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class);
+EAPI E_Obj_Dialog *e_obj_dialog_new(E_Comp *c, char *title, char *class_name, char *class_class);
EAPI void e_obj_dialog_icon_set(E_Obj_Dialog *od, char *icon);
EAPI void e_obj_dialog_show(E_Obj_Dialog *od);
EAPI void e_obj_dialog_obj_part_text_set(E_Obj_Dialog *od, const char *part, const char *text);
diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c
new file mode 100644
index 0000000000..72d91ac95c
--- /dev/null
+++ b/src/bin/e_pixmap.c
@@ -0,0 +1,671 @@
+#include "e.h"
+
+#ifdef HAVE_WAYLAND_CLIENTS
+# include "e_comp_wl.h"
+#endif
+
+static Eina_Hash *pixmaps[2] = {NULL};
+
+struct _E_Pixmap
+{
+ unsigned int refcount;
+ E_Pixmap_Type type;
+ Ecore_Window win;
+ void *visual;
+ void *image;
+ Eina_List *images_cache;
+ unsigned int cmap;
+ int ibpp, ibpl;
+ Ecore_Window parent;
+#ifdef HAVE_WAYLAND_CLIENTS
+ struct wl_resource *resource;
+#endif
+#ifndef WAYLAND_ONLY
+ uint32_t pixmap;
+#endif
+ int w, h;
+ E_Client *client;
+ unsigned int failures;
+ Eina_Bool usable : 1;
+ Eina_Bool dirty : 1;
+ Eina_Bool image_argb : 1;
+#ifdef HAVE_WAYLAND_CLIENTS
+ Eina_Bool copy_image : 1;
+#endif
+};
+
+static void
+_e_pixmap_clear(E_Pixmap *cp, Eina_Bool cache)
+{
+ cp->w = cp->h = 0;
+ cp->image_argb = EINA_FALSE;
+ switch (cp->type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ if (cp->pixmap)
+ {
+ ecore_x_pixmap_free(cp->pixmap);
+ cp->pixmap = 0;
+ ecore_x_e_comp_pixmap_set(cp->parent ?: cp->win, 0);
+ e_pixmap_image_clear(cp, cache);
+ }
+ break;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL:
+ e_pixmap_image_clear(cp, cache);
+ break;
+#endif
+ default: break;
+ }
+}
+
+#ifndef WAYLAND_ONLY
+static void
+_e_pixmap_image_clear_x(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_FREE_LIST(data, ecore_x_image_free);
+}
+#endif
+
+static void
+_e_pixmap_free(E_Pixmap *cp)
+{
+ switch (cp->type)
+ {
+ case E_PIXMAP_TYPE_X:
+#ifndef WAYLAND_ONLY
+ if (!cp->images_cache) break;
+ if (cp->client)
+ evas_object_event_callback_add(cp->client->frame, EVAS_CALLBACK_FREE, _e_pixmap_image_clear_x, cp->images_cache);
+ else
+ {
+ void *i;
+
+ EINA_LIST_FREE(cp->images_cache, i)
+ ecore_job_add((Ecore_Cb)ecore_x_image_free, i);
+ }
+ cp->images_cache = NULL;
+#endif
+ break;
+ case E_PIXMAP_TYPE_WL:
+#ifdef HAVE_WAYLAND_CLIENTS
+ if (!cp->copy_image) break;
+ /* maybe delay image free here... */
+#endif
+ break;
+ default:
+ break;
+ }
+ _e_pixmap_clear(cp, 1);
+ free(cp);
+}
+
+static E_Pixmap *
+_e_pixmap_new(E_Pixmap_Type type)
+{
+ E_Pixmap *cp;
+
+ cp = E_NEW(E_Pixmap, 1);
+ cp->type = type;
+ cp->w = cp->h = 0;
+ cp->refcount = 1;
+ cp->dirty = 1;
+ return cp;
+}
+
+static E_Pixmap *
+_e_pixmap_find(E_Pixmap_Type type, va_list *l)
+{
+#ifndef WAYLAND_ONLY
+ Ecore_X_Window xwin;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ unsigned int id;
+#endif
+
+ if (!pixmaps[type]) return NULL;
+ switch (type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ xwin = va_arg(*l, uint32_t);
+ return eina_hash_find(pixmaps[type], &xwin);
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL:
+ id = va_arg(*l, unsigned int);
+ return eina_hash_find(pixmaps[type], &id);
+#endif
+ default: break;
+ }
+ return NULL;
+}
+
+EAPI int
+e_pixmap_free(E_Pixmap *cp)
+{
+ if (!cp) return 0;
+ if (--cp->refcount) return cp->refcount;
+ e_pixmap_image_clear(cp, 0);
+ switch (cp->type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ if (cp->parent) eina_hash_set(pixmaps[cp->type], &cp->parent, NULL);
+ break;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL:
+ if (cp->parent) eina_hash_set(pixmaps[cp->type], &cp->parent, NULL);
+ break;
+#endif
+ }
+ eina_hash_del_by_key(pixmaps[cp->type], &cp->win);
+ return 0;
+}
+
+EAPI E_Pixmap *
+e_pixmap_ref(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, NULL);
+ cp->refcount++;
+ return cp;
+}
+
+EAPI E_Pixmap *
+e_pixmap_new(E_Pixmap_Type type, ...)
+{
+ E_Pixmap *cp = NULL;
+ va_list l;
+#ifndef WAYLAND_ONLY
+ Ecore_X_Window xwin;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ unsigned int id;
+#endif
+
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((type != E_PIXMAP_TYPE_WL) && (type != E_PIXMAP_TYPE_X), NULL);
+ va_start(l, type);
+ switch (type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ xwin = va_arg(l, uint32_t);
+ if (pixmaps[type])
+ {
+ cp = eina_hash_find(pixmaps[type], &xwin);
+ if (cp)
+ {
+ cp->refcount++;
+ return cp;
+ }
+ }
+ else
+ pixmaps[type] = eina_hash_int32_new((Eina_Free_Cb)_e_pixmap_free);
+ cp = _e_pixmap_new(type);
+ cp->win = xwin;
+ eina_hash_add(pixmaps[type], &xwin, cp);
+ break;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL:
+ id = va_arg(l, unsigned int);
+ if (pixmaps[type])
+ {
+ cp = eina_hash_find(pixmaps[type], &id);
+ if (cp)
+ {
+ cp->refcount++;
+ return cp;
+ }
+ }
+ else
+ pixmaps[type] = eina_hash_int32_new((Eina_Free_Cb)_e_pixmap_free);
+ cp = _e_pixmap_new(type);
+ cp->win = id;
+ eina_hash_add(pixmaps[type], &id, cp);
+ break;
+#endif
+ }
+ va_end(l);
+ return cp;
+}
+
+EAPI E_Pixmap_Type
+e_pixmap_type_get(const E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, 9999);
+ return cp->type;
+}
+
+EAPI void
+e_pixmap_parent_window_set(E_Pixmap *cp, Ecore_Window win)
+{
+ EINA_SAFETY_ON_NULL_RETURN(cp);
+ if (cp->parent == win) return;
+ e_pixmap_usable_set(cp, 0);
+ e_pixmap_clear(cp);
+ if (cp->parent)
+ eina_hash_set(pixmaps[cp->type], &cp->parent, NULL);
+ cp->parent = win;
+ if (win) eina_hash_add(pixmaps[cp->type], &win, cp);
+}
+
+EAPI void
+e_pixmap_visual_cmap_set(E_Pixmap *cp, void *visual, unsigned int cmap)
+{
+ EINA_SAFETY_ON_NULL_RETURN(cp);
+ cp->visual = visual;
+ cp->cmap = cmap;
+}
+
+EAPI void *
+e_pixmap_visual_get(const E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, NULL);
+ return cp->visual;
+}
+
+EAPI void
+e_pixmap_usable_set(E_Pixmap *cp, Eina_Bool set)
+{
+ EINA_SAFETY_ON_NULL_RETURN(cp);
+ cp->usable = !!set;
+}
+
+EAPI Eina_Bool
+e_pixmap_usable_get(const E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ return cp->usable;
+}
+
+EAPI Eina_Bool
+e_pixmap_dirty_get(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ return cp->dirty;
+}
+
+EAPI void
+e_pixmap_clear(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN(cp);
+ _e_pixmap_clear(cp, 0);
+ e_pixmap_dirty(cp);
+}
+
+EAPI void
+e_pixmap_dirty(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN(cp);
+ cp->dirty = 1;
+}
+
+EAPI Eina_Bool
+e_pixmap_refresh(E_Pixmap *cp)
+{
+ Eina_Bool success = EINA_FALSE;
+ int pw, ph;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ if (!cp->usable)
+ {
+ cp->failures++;
+ return EINA_FALSE;
+ }
+ if (!cp->dirty) return EINA_TRUE;
+ switch (cp->type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ {
+ uint32_t pixmap;
+
+ pixmap = ecore_x_composite_name_window_pixmap_get(cp->parent ?: cp->win);
+ if (cp->client)
+ e_comp_object_native_surface_set(cp->client->frame, 0);
+ success = !!pixmap;
+ if (!success) break;
+ ecore_x_pixmap_geometry_get(pixmap, NULL, NULL, &pw, &ph);
+ success = (pw > 0) && (ph > 0);
+ if (success)
+ {
+ if ((pw != cp->w) || (ph != cp->h))
+ {
+ ecore_x_pixmap_free(cp->pixmap);
+ cp->pixmap = pixmap;
+ cp->w = pw, cp->h = ph;
+ ecore_x_e_comp_pixmap_set(cp->parent ?: cp->win, cp->pixmap);
+ e_pixmap_image_clear(cp, 0);
+ }
+ else
+ ecore_x_pixmap_free(pixmap);
+ }
+ else
+ ecore_x_pixmap_free(pixmap);
+ }
+ break;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL:
+ {
+ E_Wayland_Surface *ews;
+ E_Wayland_Buffer *buff;
+ struct wl_shm_buffer *shm_buffer;
+
+ ews = (E_Wayland_Surface*)cp->parent;
+ buff = ews->buffer_reference.buffer;
+
+ cp->resource = buff->wl.resource;
+ shm_buffer = wl_shm_buffer_get(cp->resource);
+ cp->w = wl_shm_buffer_get_width(shm_buffer);
+ cp->h = wl_shm_buffer_get_height(shm_buffer);
+ success = (cp->w > 0) && (cp->h > 0);
+ break;
+ }
+#endif
+ default: break;
+ }
+ if (success)
+ {
+ cp->dirty = 0;
+ cp->failures = 0;
+ }
+ else
+ cp->failures++;
+ return success;
+}
+
+EAPI Eina_Bool
+e_pixmap_size_changed(E_Pixmap *cp, int w, int h)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ if (cp->dirty) return EINA_TRUE;
+ return (w != cp->w) || (h != cp->h);
+}
+
+EAPI Eina_Bool
+e_pixmap_size_get(E_Pixmap *cp, int *w, int *h)
+{
+ if (w) *w = 0;
+ if (h) *h = 0;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ if (w) *w = cp->w;
+ if (h) *h = cp->h;
+ return (cp->w > 0) && (cp->h > 0);
+}
+
+EAPI unsigned int
+e_pixmap_failures_get(const E_Pixmap *cp)
+{
+ return cp->failures;
+}
+
+EAPI void
+e_pixmap_client_set(E_Pixmap *cp, E_Client *ec)
+{
+ cp->client = ec;
+}
+
+EAPI E_Pixmap *
+e_pixmap_find(E_Pixmap_Type type, ...)
+{
+ va_list l;
+ E_Pixmap *cp;
+
+ va_start(l, type);
+ cp = _e_pixmap_find(type, &l);
+ va_end(l);
+ return cp;
+}
+
+EAPI E_Client *
+e_pixmap_find_client(E_Pixmap_Type type, ...)
+{
+ va_list l;
+ E_Pixmap *cp;
+
+ va_start(l, type);
+ cp = _e_pixmap_find(type, &l);
+ va_end(l);
+ return (!cp) ? NULL : cp->client;
+}
+
+EAPI Ecore_Window
+e_pixmap_window_get(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, 0);
+ return cp->win;
+}
+
+EAPI void *
+e_pixmap_resource_get(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, 0);
+ if (cp->type != E_PIXMAP_TYPE_WL)
+ CRI("ACK!");
+#ifdef HAVE_WAYLAND_CLIENTS
+ return cp->resource;
+#else
+ return NULL;
+#endif
+}
+
+EAPI Ecore_Window
+e_pixmap_parent_window_get(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, 0);
+ return cp->parent;
+}
+
+EAPI Eina_Bool
+e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ns, EINA_FALSE);
+
+ ns->version = EVAS_NATIVE_SURFACE_VERSION;
+ switch (cp->type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ ns->type = EVAS_NATIVE_SURFACE_X11;
+ ns->data.x11.visual = cp->visual;
+ ns->data.x11.pixmap = cp->pixmap;
+ break;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL:
+ return EINA_FALSE;
+#warning FIXME WL NATIVE SURFACES!
+ ns->type = EVAS_NATIVE_SURFACE_OPENGL;
+ ns->version = EVAS_NATIVE_SURFACE_VERSION;
+ ns->data.opengl.texture_id = NULL;
+ ns->data.opengl.framebuffer_id = NULL;
+ ns->data.opengl.x = 0;
+ ns->data.opengl.y = 0;
+ ns->data.opengl.w = cp->w;
+ ns->data.opengl.h = cp->h;
+ break;
+#endif
+ default:
+ break;
+ }
+ return EINA_TRUE;
+}
+
+EAPI void
+e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache)
+{
+ EINA_SAFETY_ON_NULL_RETURN(cp);
+
+ if ((!cache) && (!cp->image)) return;
+ cp->failures = 0;
+ switch (cp->type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ if (cache)
+ {
+ void *i;
+
+ EINA_LIST_FREE(cp->images_cache, i)
+ ecore_job_add((Ecore_Cb)ecore_x_image_free, i);
+ }
+ else
+ {
+ cp->images_cache = eina_list_append(cp->images_cache, cp->image);
+ cp->image = NULL;
+ }
+ break;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL: //lel wayland
+ if (cache)
+ {
+ if (cp->copy_image)
+ {
+ //INF("IMG FREE");
+ E_FREE(cp->image);
+ }
+ else
+ cp->image = NULL;
+ cp->copy_image = 0;
+ }
+ else if (!cp->copy_image)
+ {
+ void *copy;
+ size_t size;
+
+ size = cp->w * cp->h * sizeof(int);
+ copy = malloc(size);
+ memcpy(copy, cp->image, size);
+ cp->image = copy;
+ cp->copy_image = 1;
+ }
+#endif
+ default:
+ break;
+ }
+}
+
+EAPI Eina_Bool
+e_pixmap_image_refresh(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+
+ if (cp->image) return EINA_TRUE;
+ if (cp->dirty)
+ {
+ CRI("BUG! PIXMAP %p IS DIRTY!", cp);
+ return EINA_FALSE;
+ }
+ switch (cp->type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ if ((!cp->visual) || (!cp->client->depth)) return EINA_FALSE;
+ cp->image = ecore_x_image_new(cp->w, cp->h, cp->visual, cp->client->depth);
+ if (cp->image)
+ cp->image_argb = ecore_x_image_is_argb32_get(cp->image);
+ break;
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL:
+ {
+ struct wl_shm_buffer *shm_buffer;
+
+ cp->image_argb = EINA_TRUE; //for now...
+ //size = cp->w * cp->h * sizeof(int);
+ shm_buffer = wl_shm_buffer_get(cp->resource);
+ if (cp->w != wl_shm_buffer_get_width(shm_buffer))
+ CRI("ACK!");
+ if (cp->h != wl_shm_buffer_get_height(shm_buffer))
+ CRI("ACK!");
+ cp->image = wl_shm_buffer_get_data(shm_buffer);
+ break;
+ }
+#endif
+ default:
+ break;
+ }
+ return !!cp->image;
+}
+
+EAPI Eina_Bool
+e_pixmap_image_exists(const E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ return !!cp->image;
+}
+
+EAPI Eina_Bool
+e_pixmap_image_is_argb(const E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ return cp->image && cp->image_argb;
+}
+
+EAPI void *
+e_pixmap_image_data_get(E_Pixmap *cp)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, NULL);
+ if (!cp->image) return NULL;
+ switch (cp->type)
+ {
+#ifndef WAYLAND_ONLY
+ case E_PIXMAP_TYPE_X:
+ return ecore_x_image_data_get(cp->image, &cp->ibpl, NULL, &cp->ibpp);
+#endif
+#ifdef HAVE_WAYLAND_CLIENTS
+ case E_PIXMAP_TYPE_WL:
+ cp->copy_image = 0;
+ return cp->image;
+#endif
+ default:
+ break;
+ }
+ return NULL;
+}
+
+EAPI Eina_Bool
+e_pixmap_image_data_argb_convert(E_Pixmap *cp, void *pix, void *ipix, Eina_Rectangle *r, int stride)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ if (!cp->image) return EINA_FALSE;
+ switch (cp->type)
+ {
+ case E_PIXMAP_TYPE_X:
+ if (cp->image_argb) return EINA_FALSE;
+ return ecore_x_image_to_argb_convert(ipix, cp->ibpp, cp->ibpl,
+ cp->cmap, cp->visual,
+ r->x, r->y, r->w, r->h,
+ pix, stride, r->x, r->y);
+ case E_PIXMAP_TYPE_WL:
+ return EINA_TRUE; //already guaranteed to be argb
+ default:
+ break;
+ }
+ return EINA_FALSE;
+}
+
+EAPI Eina_Bool
+e_pixmap_image_draw(E_Pixmap *cp, const Eina_Rectangle *r)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+ if (!cp->image) return EINA_FALSE;
+ switch (cp->type)
+ {
+ case E_PIXMAP_TYPE_X:
+ if (!cp->pixmap) return EINA_FALSE;
+ return ecore_x_image_get(cp->image, cp->pixmap, r->x, r->y, r->x, r->y, r->w, r->h);
+ case E_PIXMAP_TYPE_WL:
+ return EINA_TRUE; //this call is a NOP
+ default:
+ break;
+ }
+ return EINA_FALSE;
+}
diff --git a/src/bin/e_pixmap.h b/src/bin/e_pixmap.h
new file mode 100644
index 0000000000..4aabd7eded
--- /dev/null
+++ b/src/bin/e_pixmap.h
@@ -0,0 +1,54 @@
+#ifdef E_TYPEDEFS
+
+typedef struct _E_Pixmap E_Pixmap;
+
+typedef enum
+{
+ E_PIXMAP_TYPE_X,
+ E_PIXMAP_TYPE_WL,
+} E_Pixmap_Type;
+
+#else
+# ifndef E_PIXMAP_H
+# define E_PIXMAP_H
+
+EAPI int e_pixmap_free(E_Pixmap *cp);
+EAPI E_Pixmap *e_pixmap_ref(E_Pixmap *cp);
+EAPI E_Pixmap *e_pixmap_new(E_Pixmap_Type type, ...);
+EAPI E_Pixmap_Type e_pixmap_type_get(const E_Pixmap *cp);
+EAPI void *e_pixmap_resource_get(E_Pixmap *cp);
+EAPI void e_pixmap_parent_window_set(E_Pixmap *cp, Ecore_Window win);
+EAPI void e_pixmap_visual_cmap_set(E_Pixmap *cp, void *visual, unsigned int cmap);
+EAPI unsigned int e_pixmap_failures_get(const E_Pixmap *cp);
+EAPI void *e_pixmap_visual_get(const E_Pixmap *cp);
+EAPI Eina_Bool e_pixmap_dirty_get(E_Pixmap *cp);
+EAPI void e_pixmap_clear(E_Pixmap *cp);
+EAPI void e_pixmap_usable_set(E_Pixmap *cp, Eina_Bool set);
+EAPI Eina_Bool e_pixmap_usable_get(const E_Pixmap *cp);
+EAPI void e_pixmap_dirty(E_Pixmap *cp);
+EAPI Eina_Bool e_pixmap_refresh(E_Pixmap *cp);
+EAPI Eina_Bool e_pixmap_size_changed(E_Pixmap *cp, int w, int h);
+EAPI Eina_Bool e_pixmap_size_get(E_Pixmap *cp, int *w, int *h);
+EAPI void e_pixmap_client_set(E_Pixmap *cp, E_Client *ec);
+EAPI E_Pixmap *e_pixmap_find(E_Pixmap_Type type, ...);
+EAPI E_Client *e_pixmap_find_client(E_Pixmap_Type type, ...);
+EAPI Ecore_Window e_pixmap_window_get(E_Pixmap *cp);
+EAPI Ecore_Window e_pixmap_parent_window_get(E_Pixmap *cp);
+EAPI Eina_Bool e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns);
+EAPI void e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache);
+EAPI Eina_Bool e_pixmap_image_refresh(E_Pixmap *cp);
+EAPI Eina_Bool e_pixmap_image_exists(const E_Pixmap *cp);
+EAPI Eina_Bool e_pixmap_image_is_argb(const E_Pixmap *cp);
+EAPI void *e_pixmap_image_data_get(E_Pixmap *cp);
+EAPI Eina_Bool e_pixmap_image_data_argb_convert(E_Pixmap *cp, void *pix, void *ipix, Eina_Rectangle *r, int stride);
+EAPI Eina_Bool e_pixmap_image_draw(E_Pixmap *cp, const Eina_Rectangle *r);
+
+static inline Eina_Bool
+e_pixmap_is_x(const E_Pixmap *cp)
+{
+ return e_pixmap_type_get(cp) == E_PIXMAP_TYPE_X;
+}
+
+# endif
+
+#endif
diff --git a/src/bin/e_place.c b/src/bin/e_place.c
index e7878cc920..7086f6b6e9 100644
--- a/src/bin/e_place.c
+++ b/src/bin/e_place.c
@@ -4,51 +4,48 @@ EAPI void
e_place_zone_region_smart_cleanup(E_Zone *zone)
{
E_Desk *desk;
- Eina_List *borders = NULL;
- E_Border_List *bl;
- E_Border *border;
+ Eina_List *clients = NULL;
+ E_Client *ec;
E_OBJECT_CHECK(zone);
desk = e_desk_current_get(zone);
- bl = e_container_border_list_first(desk->zone->container);
- while ((border = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(zone->comp, ec)
{
/* Build a list of windows on this desktop and not iconified. */
- if ((border->desk == desk) && (!border->iconic) &&
- (!border->lock_user_location))
+ if ((ec->desk == desk) && (!ec->iconic) &&
+ (!ec->lock_user_location) && (!e_client_util_ignored_get(ec)))
{
int area;
Eina_List *ll;
- E_Border *bd;
+ E_Client *ec2;
/* Ordering windows largest to smallest gives better results */
- area = border->w * border->h;
- EINA_LIST_FOREACH(borders, ll, bd)
+ area = ec->w * ec->h;
+ EINA_LIST_FOREACH(clients, ll, ec2)
{
int testarea;
- testarea = bd->w * bd->h;
- /* Insert the border if larger than the current border */
+ testarea = ec2->w * ec2->h;
+ /* Insert the ec if larger than the current ec */
if (area >= testarea)
{
- borders = eina_list_prepend_relative(borders, border, bd);
+ clients = eina_list_prepend_relative(clients, ec2, ec);
break;
}
}
- /* Looped over all borders without placing, so place at end */
- if (!ll) borders = eina_list_append(borders, border);
+ /* Looped over all clients without placing, so place at end */
+ if (!ll) clients = eina_list_append(clients, ec);
}
}
- e_container_border_list_free(bl);
- /* Loop over the borders moving each one using the smart placement */
- EINA_LIST_FREE(borders, border)
+ /* Loop over the clients moving each one using the smart placement */
+ EINA_LIST_FREE(clients, ec)
{
int new_x, new_y;
- e_place_zone_region_smart(zone, borders, border->x, border->y,
- border->w, border->h, &new_x, &new_y);
- e_border_move(border, new_x, new_y);
+ e_place_zone_region_smart(zone, clients, ec->x, ec->y,
+ ec->w, ec->h, &new_x, &new_y);
+ evas_object_move(ec->frame, new_x, new_y);
}
}
@@ -59,33 +56,21 @@ _e_place_cb_sort_cmp(const void *v1, const void *v2)
}
static int
-_e_place_coverage_border_add(E_Desk *desk, Eina_List *skiplist, int ar, int x, int y, int w, int h)
+_e_place_coverage_client_add(E_Desk *desk, Eina_List *skiplist, int ar, int x, int y, int w, int h)
{
- Eina_List *ll;
- E_Border_List *bl;
- E_Border *bd, *bd2;
+ E_Client *ec;
int x2, y2, w2, h2;
- int ok;
int iw, ih;
int x0, x00, yy0, y00;
- bl = e_container_border_list_first(desk->zone->container);
- while ((bd = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(desk->zone->comp, ec)
{
- ok = 1;
- x2 = (bd->x - desk->zone->x); y2 = (bd->y - desk->zone->y); w2 = bd->w; h2 = bd->h;
- EINA_LIST_FOREACH(skiplist, ll, bd2)
- {
- if (bd2 == bd)
- {
- ok = 0;
- break;
- }
- }
- if ((ok) &&
- E_INTERSECTS(x, y, w, h, x2, y2, w2, h2) &&
- ((bd->sticky) || (bd->desk == desk)) &&
- (!bd->iconic) && (bd->visible))
+ if (eina_list_data_find(skiplist, ec)) continue;
+ if (e_client_util_ignored_get(ec)) continue;
+ x2 = (ec->x - desk->zone->x); y2 = (ec->y - desk->zone->y); w2 = ec->w; h2 = ec->h;
+ if (E_INTERSECTS(x, y, w, h, x2, y2, w2, h2) &&
+ ((ec->sticky) || (ec->desk == desk)) &&
+ (!ec->iconic) && (ec->visible))
{
x0 = x;
if (x < x2) x0 = x2;
@@ -100,7 +85,6 @@ _e_place_coverage_border_add(E_Desk *desk, Eina_List *skiplist, int ar, int x, i
ar += (iw * ih);
}
}
- e_container_border_list_free(bl);
return ar;
}
@@ -144,9 +128,7 @@ e_place_desk_region_smart(E_Desk *desk, Eina_List *skiplist, int x, int y, int w
int *a_x = NULL, *a_y = NULL;
int zw, zh;
char *u_x = NULL, *u_y = NULL;
- Eina_List *ll;
- E_Border_List *bl;
- E_Border *bd, *bd2;
+ E_Client *ec;
*rx = x;
*ry = y;
@@ -263,29 +245,20 @@ e_place_desk_region_smart(E_Desk *desk, Eina_List *skiplist, int x, int y, int w
}
}
- bl = e_container_border_list_first(desk->zone->container);
- while ((bd = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(desk->zone->comp, ec)
{
- int ok;
int bx, by, bw, bh;
- ok = 1;
- EINA_LIST_FOREACH(skiplist, ll, bd2)
- {
- if (bd2 == bd)
- {
- ok = 0;
- break;
- }
- }
- if (!ok) continue;
+ if (e_client_util_ignored_get(ec)) continue;
+
+ if (eina_list_data_find(skiplist, ec)) continue;
- if (!((bd->sticky) || (bd->desk == desk))) continue;
+ if (!((ec->sticky) || (ec->desk == desk))) continue;
- bx = bd->x - desk->zone->x;
- by = bd->y - desk->zone->y;
- bw = bd->w;
- bh = bd->h;
+ bx = ec->x - desk->zone->x;
+ by = ec->y - desk->zone->y;
+ bw = ec->w;
+ bh = ec->h;
if (E_INTERSECTS(bx, by, bw, bh, 0, 0, zw, zh))
{
@@ -351,7 +324,6 @@ e_place_desk_region_smart(E_Desk *desk, Eina_List *skiplist, int x, int y, int w
}
qsort(a_x, a_w, sizeof(int), _e_place_cb_sort_cmp);
qsort(a_y, a_h, sizeof(int), _e_place_cb_sort_cmp);
- e_container_border_list_free(bl);
free(u_x);
free(u_y);
@@ -368,7 +340,7 @@ e_place_desk_region_smart(E_Desk *desk, Eina_List *skiplist, int x, int y, int w
{
int ar = 0;
- ar = _e_place_coverage_border_add(desk, skiplist, ar,
+ ar = _e_place_coverage_client_add(desk, skiplist, ar,
a_x[i], a_y[j],
w, h);
if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
@@ -387,7 +359,7 @@ e_place_desk_region_smart(E_Desk *desk, Eina_List *skiplist, int x, int y, int w
{
int ar = 0;
- ar = _e_place_coverage_border_add(desk, skiplist, ar,
+ ar = _e_place_coverage_client_add(desk, skiplist, ar,
a_x[i + 1] - w, a_y[j],
w, h);
if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
@@ -406,7 +378,7 @@ e_place_desk_region_smart(E_Desk *desk, Eina_List *skiplist, int x, int y, int w
{
int ar = 0;
- ar = _e_place_coverage_border_add(desk, skiplist, ar,
+ ar = _e_place_coverage_client_add(desk, skiplist, ar,
a_x[i + 1] - w, a_y[j + 1] - h,
w, h);
if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
@@ -425,7 +397,7 @@ e_place_desk_region_smart(E_Desk *desk, Eina_List *skiplist, int x, int y, int w
{
int ar = 0;
- ar = _e_place_coverage_border_add(desk, skiplist, ar,
+ ar = _e_place_coverage_client_add(desk, skiplist, ar,
a_x[i], a_y[j + 1] - h,
w, h);
if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
@@ -474,7 +446,7 @@ e_place_zone_cursor(E_Zone *zone, int x __UNUSED__, int y __UNUSED__, int w, int
E_OBJECT_CHECK_RETURN(zone, 0);
- ecore_x_pointer_xy_get(zone->container->win, &cursor_x, &cursor_y);
+ ecore_evas_pointer_xy_get(zone->comp->ee, &cursor_x, &cursor_y);
*rx = cursor_x - (w >> 1);
*ry = cursor_y - (it >> 1);
@@ -503,7 +475,7 @@ e_place_zone_manual(E_Zone *zone, int w, int h, int *rx, int *ry)
E_OBJECT_CHECK_RETURN(zone, 0);
- ecore_x_pointer_xy_get(zone->container->win, &cursor_x, &cursor_y);
+ ecore_evas_pointer_xy_get(zone->comp->ee, &cursor_x, &cursor_y);
if (rx) *rx = cursor_x - (w >> 1);
if (ry) *ry = cursor_y - (h >> 1);
diff --git a/src/bin/e_popup.c b/src/bin/e_popup.c
deleted file mode 100644
index 33b6b47e27..0000000000
--- a/src/bin/e_popup.c
+++ /dev/null
@@ -1,289 +0,0 @@
-#include "e.h"
-
-/* local subsystem globals */
-static Eina_List *_e_popup_list = NULL;
-static E_Popup *autoclose_popup = NULL;
-static Evas_Object *event_rect = NULL;
-static Ecore_Event_Handler *key_handler = NULL;
-
-/* local subsystem functions */
-
-static void
-_e_popup_autoclose_cleanup(void)
-{
- if (autoclose_popup)
- {
- e_grabinput_release(0, e_comp_get(autoclose_popup)->ee_win);
- autoclose_popup->autoclose = 0;
- if (autoclose_popup->del_cb)
- autoclose_popup->del_cb(autoclose_popup->cb_data, autoclose_popup);
- else
- E_FREE_FUNC(autoclose_popup, e_object_del);
- }
- autoclose_popup = NULL;
- E_FREE_FUNC(event_rect, evas_object_del);
- E_FREE_FUNC(key_handler, ecore_event_handler_del);
-}
-
-static void
-_e_popup_free(E_Popup *pop)
-{
- e_object_unref(E_OBJECT(pop->zone));
- if (pop->autoclose)
- _e_popup_autoclose_cleanup();
- E_FREE_FUNC(pop->shape, e_object_del);
- E_FREE_LIST(pop->objects, evas_object_del);
- pop->zone->popups = eina_list_remove(pop->zone->popups, pop);
- eina_stringshare_del(pop->name);
- _e_popup_list = eina_list_remove(_e_popup_list, pop);
- free(pop);
-}
-
-static Eina_Bool
-_e_popup_autoclose_key_down_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_Event_Key *ev = event;
- Eina_Bool del = EINA_TRUE;
-
- if (autoclose_popup->key_cb)
- del = !autoclose_popup->key_cb(autoclose_popup->cb_data, ev);
- if (del) _e_popup_autoclose_cleanup();
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_e_popup_autoclose_mouse_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- _e_popup_autoclose_cleanup();
-}
-
-static void
-_e_popup_autoclose_setup(E_Popup *pop)
-{
- E_FREE_FUNC(autoclose_popup, e_object_del);
- E_FREE_FUNC(event_rect, evas_object_del);
-
- event_rect = evas_object_rectangle_add(e_comp_get(pop)->evas);
- evas_object_color_set(event_rect, 0, 0, 0, 0);
- evas_object_resize(event_rect, pop->zone->container->w, pop->zone->container->h);
- evas_object_event_callback_add(event_rect, EVAS_CALLBACK_MOUSE_UP, _e_popup_autoclose_mouse_up_cb, NULL);
- if (pop->comp_layer == E_COMP_CANVAS_LAYER_LAYOUT)
- {
- e_layout_pack(e_comp_get(pop)->layout, event_rect);
- e_layout_child_lower_below(event_rect, pop->cw->effect_obj);
- }
- else
- evas_object_layer_set(event_rect, pop->comp_layer - 1);
- evas_object_show(event_rect);
- key_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_popup_autoclose_key_down_cb, NULL);
- e_grabinput_get(0, 0, e_comp_get(pop)->ee_win);
- autoclose_popup = pop;
-}
-
-static void
-_e_popup_delay_del_cb(E_Popup *pop)
-{
- e_popup_hide(pop);
- if (pop->cw) e_comp_win_del(pop->cw);
-}
-
-/* externally accessible functions */
-
-EINTERN int
-e_popup_init(void)
-{
- return 1;
-}
-
-EINTERN int
-e_popup_shutdown(void)
-{
- _e_popup_autoclose_cleanup();
- return 1;
-}
-
-EAPI E_Popup *
-e_popup_new(E_Zone *zone, int x, int y, int w, int h)
-{
- E_Popup *pop;
-
- pop = E_OBJECT_ALLOC(E_Popup, E_POPUP_TYPE, _e_popup_free);
- if (!pop) return NULL;
- e_object_delay_del_set(E_OBJECT(pop), _e_popup_delay_del_cb);
- pop->zone = zone;
- pop->ecore_evas = zone->container->bg_ecore_evas;
- pop->zx = pop->zone->x;
- pop->zy = pop->zone->y;
- pop->x = x;
- pop->y = y;
- pop->w = w;
- pop->h = h;
- pop->layer = E_LAYER_POPUP;
- pop->comp_layer = E_COMP_CANVAS_LAYER_LAYOUT;
-
- pop->evas = e_comp_get(zone)->evas;
- pop->shape = e_container_shape_add(zone->container);
- e_object_ref(E_OBJECT(pop->zone));
- pop->zone->popups = eina_list_append(pop->zone->popups, pop);
- _e_popup_list = eina_list_append(_e_popup_list, pop);
- return pop;
-}
-
-EAPI void
-e_popup_content_set(E_Popup *pop, Evas_Object *obj)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
-
- if (pop->content) evas_object_del(pop->content);
- pop->content = obj;
- evas_object_data_set(obj, "eobj", pop);
- evas_object_move(obj, pop->zone->x + pop->x, pop->zone->y + pop->y);
- evas_object_resize(obj, pop->w, pop->h);
- evas_object_show(obj);
- e_popup_layer_set(pop, pop->comp_layer, pop->layer);
- e_popup_ignore_events_set(pop, pop->ignore_events);
- if (pop->visible)
- e_comp_win_moveresize(pop->cw, pop->zone->x + pop->x, pop->zone->y + pop->y, pop->w, pop->h);
-}
-
-EAPI void
-e_popup_show(E_Popup *pop)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
- EINA_SAFETY_ON_NULL_RETURN(pop->content);
-
- if (pop->visible) return;
-
- pop->visible = 1;
- e_comp_win_moveresize(pop->cw, pop->zone->x + pop->x, pop->zone->y + pop->y, pop->w, pop->h);
- e_comp_win_show(pop->cw);
- if (pop->autoclose) _e_popup_autoclose_setup(pop);
-}
-
-EAPI void
-e_popup_hide(E_Popup *pop)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
- if (!pop->visible) return;
- pop->visible = 0;
- if (pop->cw)
- {
- e_comp_win_hide(pop->cw);
- if (e_object_is_del(E_OBJECT(pop)))
- e_comp_win_del(pop->cw);
- }
- if (!pop->autoclose) return;
- if (e_object_is_del(E_OBJECT(pop))) return;
- _e_popup_autoclose_cleanup();
-}
-
-EAPI void
-e_popup_move(E_Popup *pop, int x, int y)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
- if ((pop->x == x) && (pop->y == y) &&
- (pop->zone->x == pop->zx) && (pop->zone->y == pop->zy)) return;
- pop->zx = pop->zone->x;
- pop->zy = pop->zone->y;
- pop->x = x;
- pop->y = y;
- if (!pop->cw) return;
- e_comp_win_move(pop->cw, pop->zone->x + pop->x, pop->zone->y + pop->y);
-}
-
-EAPI void
-e_popup_resize(E_Popup *pop, int w, int h)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
- if ((pop->w == w) && (pop->h == h)) return;
- pop->w = w;
- pop->h = h;
- if (!pop->cw) return;
- e_comp_win_resize(pop->cw, pop->w, pop->h);
-}
-
-EAPI void
-e_popup_move_resize(E_Popup *pop, int x, int y, int w, int h)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
- if ((pop->x == x) && (pop->y == y) &&
- (pop->w == w) && (pop->h == h) &&
- (pop->zone->x == pop->zx) && (pop->zone->y == pop->zy)) return;
- pop->x = x;
- pop->y = y;
- pop->w = w;
- pop->h = h;
- if (!pop->cw) return;
- e_comp_win_moveresize(pop->cw, pop->zone->x + x, pop->zone->y + y, w, h);
-}
-
-EAPI void
-e_popup_ignore_events_set(E_Popup *pop, int ignore)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
-
- ignore = !!ignore;
- pop->ignore_events = ignore;
- if (pop->cw)
- e_comp_win_ignore_events_set(pop->cw, ignore);
-}
-
-EAPI void
-e_popup_layer_set(E_Popup *pop, E_Comp_Canvas_Layer comp_layer, E_Layer layer)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
- pop->comp_layer = comp_layer;
- pop->layer = layer;
- if (!pop->content) return;
- if (comp_layer == E_COMP_CANVAS_LAYER_LAYOUT)
- E_LAYER_LAYOUT_ADD(pop->content, layer);
- else
- E_LAYER_SET_ABOVE(pop->content, comp_layer);
-}
-
-EAPI void
-e_popup_name_set(E_Popup *pop, const char *name)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
- eina_stringshare_replace(&pop->name, name);
-}
-
-EAPI void
-e_popup_object_add(E_Popup *pop, Evas_Object *obj)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
-
- pop->objects = eina_list_append(pop->objects, obj);
-}
-
-EAPI void
-e_popup_object_remove(E_Popup *pop, Evas_Object *obj)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
-
- pop->objects = eina_list_remove(pop->objects, obj);
-}
-
-EAPI void
-e_popup_autoclose(E_Popup *pop, Ecore_End_Cb del_cb, E_Popup_Key_Cb cb, const void *data)
-{
- E_OBJECT_CHECK(pop);
- E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
-
- pop->autoclose = 1;
- pop->del_cb = del_cb;
- pop->key_cb = cb;
- pop->cb_data = (void*)data;
- if (pop->visible) _e_popup_autoclose_setup(pop);
-}
diff --git a/src/bin/e_popup.h b/src/bin/e_popup.h
deleted file mode 100644
index 86107b3a2a..0000000000
--- a/src/bin/e_popup.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifdef E_TYPEDEFS
-
-typedef struct _E_Popup E_Popup;
-typedef Eina_Bool (*E_Popup_Key_Cb)(void *, Ecore_Event_Key *);
-
-#else
-#ifndef E_POPUP_H
-#define E_POPUP_H
-
-#define E_POPUP_TYPE 0xE0b0100e
-
-struct _E_Popup
-{
- E_Object e_obj_inherit;
-
- int x, y, w, h, zx, zy;
- E_Comp_Canvas_Layer comp_layer;
- E_Layer layer;
-
- Evas *evas;
- E_Comp_Win *cw;
- E_Zone *zone;
- Ecore_Evas *ecore_evas;
- E_Container_Shape *shape;
- Evas_Object *content;
- Eina_List *objects;
- Eina_Stringshare *name;
- E_Popup_Key_Cb key_cb;
- Ecore_End_Cb del_cb;
- void *cb_data;
-
- Eina_Bool visible : 1;
- Eina_Bool ignore_events : 1;
- Eina_Bool autoclose : 1;
-};
-
-EINTERN int e_popup_init(void);
-EINTERN int e_popup_shutdown(void);
-
-EAPI E_Popup *e_popup_new(E_Zone *zone, int x, int y, int w, int h);
-EAPI void e_popup_show(E_Popup *pop);
-EAPI void e_popup_hide(E_Popup *pop);
-EAPI void e_popup_move(E_Popup *pop, int x, int y);
-EAPI void e_popup_resize(E_Popup *pop, int w, int h);
-EAPI void e_popup_content_set(E_Popup *pop, Evas_Object *obj);
-EAPI void e_popup_move_resize(E_Popup *pop, int x, int y, int w, int h);
-EAPI void e_popup_ignore_events_set(E_Popup *pop, int ignore);
-EAPI void e_popup_layer_set(E_Popup *pop, E_Comp_Canvas_Layer comp_layer, E_Layer layer);
-EAPI void e_popup_name_set(E_Popup *pop, const char *name);
-EAPI void e_popup_object_add(E_Popup *pop, Evas_Object *obj);
-EAPI void e_popup_object_remove(E_Popup *pop, Evas_Object *obj);
-EAPI void e_popup_autoclose(E_Popup *pop, Ecore_End_Cb del_cb, E_Popup_Key_Cb cb, const void *data);
-#endif
-#endif
diff --git a/src/bin/e_remember.c b/src/bin/e_remember.c
index d670367c2a..1e42a6a091 100644
--- a/src/bin/e_remember.c
+++ b/src/bin/e_remember.c
@@ -14,10 +14,10 @@ struct _E_Remember_List
/* local subsystem functions */
static void _e_remember_free(E_Remember *rem);
-static void _e_remember_update(E_Border *bd, E_Remember *rem);
-static E_Remember *_e_remember_find(E_Border *bd, int check_usable);
-static void _e_remember_cb_hook_pre_post_fetch(void *data, void *bd);
-static void _e_remember_cb_hook_eval_post_new_border(void *data, void *bd);
+static void _e_remember_update(E_Client *ec, E_Remember *rem);
+static E_Remember *_e_remember_find(E_Client *ec, int check_usable);
+static void _e_remember_cb_hook_pre_post_fetch(void *data, E_Client *ec);
+static void _e_remember_cb_hook_eval_post_new_client(void *data, E_Client *ec);
static void _e_remember_init_edd(void);
static Eina_Bool _e_remember_restore_cb(void *data, int type, void *event);
@@ -38,7 +38,7 @@ e_remember_init(E_Startup_Mode mode)
{
Eina_List *l = NULL;
E_Remember *rem;
- E_Border_Hook *h;
+ E_Client_Hook *h;
if (mode == E_STARTUP_START)
{
@@ -50,11 +50,11 @@ e_remember_init(E_Startup_Mode mode)
}
E_EVENT_REMEMBER_UPDATE = ecore_event_type_new();
- h = e_border_hook_add(E_BORDER_HOOK_EVAL_PRE_POST_FETCH,
+ h = e_client_hook_add(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH,
_e_remember_cb_hook_pre_post_fetch, NULL);
if (h) hooks = eina_list_append(hooks, h);
- h = e_border_hook_add(E_BORDER_HOOK_EVAL_POST_NEW_BORDER,
- _e_remember_cb_hook_eval_post_new_border, NULL);
+ h = e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT,
+ _e_remember_cb_hook_eval_post_new_client, NULL);
if (h) hooks = eina_list_append(hooks, h);
_e_remember_init_edd();
@@ -73,7 +73,7 @@ e_remember_init(E_Startup_Mode mode)
EINTERN int
e_remember_shutdown(void)
{
- E_FREE_LIST(hooks, e_border_hook_del);
+ E_FREE_LIST(hooks, e_client_hook_del);
E_CONFIG_DD_FREE(e_remember_edd);
E_CONFIG_DD_FREE(e_remember_list_edd);
@@ -89,9 +89,10 @@ e_remember_shutdown(void)
EAPI void
e_remember_internal_save(void)
{
- Eina_List *l;
- E_Border *bd;
+ const Eina_List *l, *ll;
+ E_Client *ec;
E_Remember *rem;
+ E_Comp *c;
//printf("internal save %d\n", restart);
if (!remembers)
@@ -103,27 +104,28 @@ e_remember_internal_save(void)
remember_idler_list = eina_list_free(remember_idler_list);
}
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- {
- if (!bd->internal) continue;
-
- rem = E_NEW(E_Remember, 1);
- if (!rem) break;
-
- e_remember_default_match_set(rem, bd);
- rem->apply = (E_REMEMBER_APPLY_POS | E_REMEMBER_APPLY_SIZE |
- E_REMEMBER_APPLY_BORDER | E_REMEMBER_APPLY_LAYER |
- E_REMEMBER_APPLY_SHADE | E_REMEMBER_APPLY_ZONE |
- E_REMEMBER_APPLY_DESKTOP | E_REMEMBER_APPLY_LOCKS |
- E_REMEMBER_APPLY_SKIP_WINLIST |
- E_REMEMBER_APPLY_SKIP_PAGER |
- E_REMEMBER_APPLY_SKIP_TASKBAR |
- E_REMEMBER_APPLY_OFFER_RESISTANCE |
- E_REMEMBER_APPLY_OPACITY);
- _e_remember_update(bd, rem);
-
- remembers->list = eina_list_append(remembers->list, rem);
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (!ec->internal) continue;
+
+ rem = E_NEW(E_Remember, 1);
+ if (!rem) break;
+
+ e_remember_default_match_set(rem, ec);
+ rem->apply = (E_REMEMBER_APPLY_POS | E_REMEMBER_APPLY_SIZE |
+ E_REMEMBER_APPLY_BORDER | E_REMEMBER_APPLY_LAYER |
+ E_REMEMBER_APPLY_SHADE | E_REMEMBER_APPLY_ZONE |
+ E_REMEMBER_APPLY_DESKTOP | E_REMEMBER_APPLY_LOCKS |
+ E_REMEMBER_APPLY_SKIP_WINLIST |
+ E_REMEMBER_APPLY_SKIP_PAGER |
+ E_REMEMBER_APPLY_SKIP_TASKBAR |
+ E_REMEMBER_APPLY_OFFER_RESISTANCE |
+ E_REMEMBER_APPLY_OPACITY);
+ _e_remember_update(ec, rem);
+
+ remembers->list = eina_list_append(remembers->list, rem);
+ }
e_config_domain_save("e_remember_restart", e_remember_list_edd, remembers);
}
@@ -133,11 +135,8 @@ _e_remember_restore_idler_cb(void *d __UNUSED__)
{
E_Remember *rem;
E_Action *act_fm = NULL, *act;
- E_Container *con;
Eina_Bool done = EINA_FALSE;
- con = e_container_current_get(e_manager_current_get());
-
EINA_LIST_FREE(remember_idler_list, rem)
{
if (!rem->class) continue;
@@ -171,7 +170,7 @@ _e_remember_restore_idler_cb(void *d __UNUSED__)
if (e_configure_registry_exists(path))
{
- e_configure_registry_call(path, con, param);
+ e_configure_registry_call(path, NULL, param);
}
}
else if (!strcmp(rem->class, "_configure"))
@@ -235,35 +234,37 @@ e_remember_unuse(E_Remember *rem)
EAPI void
e_remember_del(E_Remember *rem)
{
- Eina_List *l = NULL;
- E_Border *bd;
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Comp *c;
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- {
- if (bd->remember != rem) continue;
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (ec->remember != rem) continue;
- bd->remember = NULL;
- e_remember_unuse(rem);
- }
+ ec->remember = NULL;
+ e_remember_unuse(rem);
+ }
_e_remember_free(rem);
}
EAPI E_Remember *
-e_remember_find_usable(E_Border *bd)
+e_remember_find_usable(E_Client *ec)
{
E_Remember *rem;
- rem = _e_remember_find(bd, 1);
+ rem = _e_remember_find(ec, 1);
return rem;
}
EAPI E_Remember *
-e_remember_find(E_Border *bd)
+e_remember_find(E_Client *ec)
{
E_Remember *rem;
- rem = _e_remember_find(bd, 0);
+ rem = _e_remember_find(ec, 0);
return rem;
}
@@ -304,7 +305,7 @@ e_remember_match_update(E_Remember *rem)
}
EAPI int
-e_remember_default_match_set(E_Remember *rem, E_Border *bd)
+e_remember_default_match_set(E_Remember *rem, E_Client *ec)
{
const char *title, *clasz, *name, *role;
int match;
@@ -314,15 +315,15 @@ e_remember_default_match_set(E_Remember *rem, E_Border *bd)
eina_stringshare_replace(&rem->title, NULL);
eina_stringshare_replace(&rem->role, NULL);
- name = bd->client.icccm.name;
+ name = ec->icccm.name;
if (!name || name[0] == 0) name = NULL;
- clasz = bd->client.icccm.class;
+ clasz = ec->icccm.class;
if (!clasz || clasz[0] == 0) clasz = NULL;
- role = bd->client.icccm.window_role;
+ role = ec->icccm.window_role;
if (!role || role[0] == 0) role = NULL;
match = E_REMEMBER_MATCH_TRANSIENT;
- if (bd->client.icccm.transient_for != 0)
+ if (ec->icccm.transient_for != 0)
rem->transient = 1;
else
rem->transient = 0;
@@ -333,7 +334,7 @@ e_remember_default_match_set(E_Remember *rem, E_Border *bd)
rem->name = eina_stringshare_ref(name);
rem->class = eina_stringshare_ref(clasz);
}
- else if ((title = e_border_name_get(bd)) && title[0])
+ else if ((title = e_client_name_get(ec)) && title[0])
{
match |= E_REMEMBER_MATCH_TITLE;
rem->title = eina_stringshare_ref(title);
@@ -343,10 +344,10 @@ e_remember_default_match_set(E_Remember *rem, E_Border *bd)
match |= E_REMEMBER_MATCH_ROLE;
rem->role = eina_stringshare_ref(role);
}
- if (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_UNKNOWN)
+ if (ec->netwm.type != E_WINDOW_TYPE_UNKNOWN)
{
match |= E_REMEMBER_MATCH_TYPE;
- rem->type = bd->client.netwm.type;
+ rem->type = ec->netwm.type;
}
rem->match = match;
@@ -355,128 +356,137 @@ e_remember_default_match_set(E_Remember *rem, E_Border *bd)
}
EAPI void
-e_remember_update(E_Border *bd)
+e_remember_update(E_Client *ec)
{
- if (bd->new_client) return;
- if (!bd->remember) return;
- if (bd->remember->keep_settings) return;
- _e_remember_update(bd, bd->remember);
+ if (ec->new_client) return;
+ if (!ec->remember) return;
+ if (ec->remember->keep_settings) return;
+ _e_remember_update(ec, ec->remember);
e_config_save_queue();
}
static void
-_e_remember_update(E_Border *bd, E_Remember *rem)
+_e_remember_event_free(void *d EINA_UNUSED, void *event)
+{
+ E_Event_Remember_Update *ev = event;
+ e_object_unref(E_OBJECT(ev->ec));
+ free(ev);
+}
+
+static void
+_e_remember_update(E_Client *ec, E_Remember *rem)
{
if (rem->apply & E_REMEMBER_APPLY_POS ||
rem->apply & E_REMEMBER_APPLY_SIZE)
{
- if (bd->fullscreen || bd->maximized)
+ if (ec->fullscreen || ec->maximized)
{
- rem->prop.pos_x = bd->saved.x;
- rem->prop.pos_y = bd->saved.y;
- rem->prop.pos_w = bd->saved.w;
- rem->prop.pos_h = bd->saved.h;
+ rem->prop.pos_x = ec->saved.x;
+ rem->prop.pos_y = ec->saved.y;
+ rem->prop.pos_w = ec->saved.w;
+ rem->prop.pos_h = ec->saved.h;
}
else
{
- rem->prop.pos_x = bd->x - bd->zone->x;
- rem->prop.pos_y = bd->y - bd->zone->y;
- rem->prop.res_x = bd->zone->w;
- rem->prop.res_y = bd->zone->h;
- rem->prop.pos_w = bd->client.w;
- rem->prop.pos_h = bd->client.h;
- rem->prop.w = bd->client.w;
- rem->prop.h = bd->client.h;
+ rem->prop.pos_x = ec->x - ec->zone->x;
+ rem->prop.pos_y = ec->y - ec->zone->y;
+ rem->prop.res_x = ec->zone->w;
+ rem->prop.res_y = ec->zone->h;
+ rem->prop.pos_w = ec->client.w;
+ rem->prop.pos_h = ec->client.h;
+ rem->prop.w = ec->client.w;
+ rem->prop.h = ec->client.h;
}
- if (bd->internal)
- rem->prop.maximize = bd->maximized & E_MAXIMIZE_DIRECTION;
+ if (ec->internal)
+ rem->prop.maximize = ec->maximized & E_MAXIMIZE_DIRECTION;
else
rem->prop.maximize = 0;
}
if (rem->apply & E_REMEMBER_APPLY_LAYER)
{
- if (bd->fullscreen)
- rem->prop.layer = bd->saved.layer;
+ if (ec->fullscreen)
+ rem->prop.layer = ec->saved.layer;
else
- rem->prop.layer = bd->layer;
+ rem->prop.layer = ec->layer;
}
if (rem->apply & E_REMEMBER_APPLY_LOCKS)
{
- rem->prop.lock_user_location = bd->lock_user_location;
- rem->prop.lock_client_location = bd->lock_client_location;
- rem->prop.lock_user_size = bd->lock_user_size;
- rem->prop.lock_client_size = bd->lock_client_size;
- rem->prop.lock_user_stacking = bd->lock_user_stacking;
- rem->prop.lock_client_stacking = bd->lock_client_stacking;
- rem->prop.lock_user_iconify = bd->lock_user_iconify;
- rem->prop.lock_client_iconify = bd->lock_client_iconify;
- rem->prop.lock_user_desk = bd->lock_user_desk;
- rem->prop.lock_client_desk = bd->lock_client_desk;
- rem->prop.lock_user_sticky = bd->lock_user_sticky;
- rem->prop.lock_client_sticky = bd->lock_client_sticky;
- rem->prop.lock_user_shade = bd->lock_user_shade;
- rem->prop.lock_client_shade = bd->lock_client_shade;
- rem->prop.lock_user_maximize = bd->lock_user_maximize;
- rem->prop.lock_client_maximize = bd->lock_client_maximize;
- rem->prop.lock_user_fullscreen = bd->lock_user_fullscreen;
- rem->prop.lock_client_fullscreen = bd->lock_client_fullscreen;
- rem->prop.lock_border = bd->lock_border;
- rem->prop.lock_close = bd->lock_close;
- rem->prop.lock_focus_in = bd->lock_focus_in;
- rem->prop.lock_focus_out = bd->lock_focus_out;
- rem->prop.lock_life = bd->lock_life;
+ rem->prop.lock_user_location = ec->lock_user_location;
+ rem->prop.lock_client_location = ec->lock_client_location;
+ rem->prop.lock_user_size = ec->lock_user_size;
+ rem->prop.lock_client_size = ec->lock_client_size;
+ rem->prop.lock_user_stacking = ec->lock_user_stacking;
+ rem->prop.lock_client_stacking = ec->lock_client_stacking;
+ rem->prop.lock_user_iconify = ec->lock_user_iconify;
+ rem->prop.lock_client_iconify = ec->lock_client_iconify;
+ rem->prop.lock_user_desk = ec->lock_user_desk;
+ rem->prop.lock_client_desk = ec->lock_client_desk;
+ rem->prop.lock_user_sticky = ec->lock_user_sticky;
+ rem->prop.lock_client_sticky = ec->lock_client_sticky;
+ rem->prop.lock_user_shade = ec->lock_user_shade;
+ rem->prop.lock_client_shade = ec->lock_client_shade;
+ rem->prop.lock_user_maximize = ec->lock_user_maximize;
+ rem->prop.lock_client_maximize = ec->lock_client_maximize;
+ rem->prop.lock_user_fullscreen = ec->lock_user_fullscreen;
+ rem->prop.lock_client_fullscreen = ec->lock_client_fullscreen;
+ rem->prop.lock_border = ec->lock_border;
+ rem->prop.lock_close = ec->lock_close;
+ rem->prop.lock_focus_in = ec->lock_focus_in;
+ rem->prop.lock_focus_out = ec->lock_focus_out;
+ rem->prop.lock_life = ec->lock_life;
}
if (rem->apply & E_REMEMBER_APPLY_SHADE)
{
- if (bd->shaded)
- rem->prop.shaded = (100 + bd->shade.dir);
+ if (ec->shaded)
+ rem->prop.shaded = (100 + ec->shade_dir);
else
- rem->prop.shaded = (50 + bd->shade.dir);
+ rem->prop.shaded = (50 + ec->shade_dir);
}
if (rem->apply & E_REMEMBER_APPLY_ZONE)
{
- rem->prop.zone = bd->zone->num;
- rem->prop.head = bd->zone->container->manager->num;
+ rem->prop.zone = ec->zone->num;
+ rem->prop.head = ec->zone->comp->num;
}
if (rem->apply & E_REMEMBER_APPLY_SKIP_WINLIST)
- rem->prop.skip_winlist = bd->user_skip_winlist;
+ rem->prop.skip_winlist = ec->user_skip_winlist;
if (rem->apply & E_REMEMBER_APPLY_STICKY)
- rem->prop.sticky = bd->sticky;
+ rem->prop.sticky = ec->sticky;
if (rem->apply & E_REMEMBER_APPLY_SKIP_PAGER)
- rem->prop.skip_pager = bd->client.netwm.state.skip_pager;
+ rem->prop.skip_pager = ec->netwm.state.skip_pager;
if (rem->apply & E_REMEMBER_APPLY_SKIP_TASKBAR)
- rem->prop.skip_taskbar = bd->client.netwm.state.skip_taskbar;
+ rem->prop.skip_taskbar = ec->netwm.state.skip_taskbar;
if (rem->apply & E_REMEMBER_APPLY_ICON_PREF)
- rem->prop.icon_preference = bd->icon_preference;
+ rem->prop.icon_preference = ec->icon_preference;
if (rem->apply & E_REMEMBER_APPLY_DESKTOP)
- e_desk_xy_get(bd->desk, &rem->prop.desk_x, &rem->prop.desk_y);
+ e_desk_xy_get(ec->desk, &rem->prop.desk_x, &rem->prop.desk_y);
if (rem->apply & E_REMEMBER_APPLY_FULLSCREEN)
- rem->prop.fullscreen = bd->fullscreen;
+ rem->prop.fullscreen = ec->fullscreen;
if (rem->apply & E_REMEMBER_APPLY_OFFER_RESISTANCE)
- rem->prop.offer_resistance = bd->offer_resistance;
+ rem->prop.offer_resistance = ec->offer_resistance;
if (rem->apply & E_REMEMBER_APPLY_OPACITY)
- rem->prop.opacity = bd->client.netwm.opacity;
+ rem->prop.opacity = ec->netwm.opacity;
if (rem->apply & E_REMEMBER_APPLY_BORDER)
{
- if (bd->borderless)
+ if (ec->borderless)
eina_stringshare_replace(&rem->prop.border, "borderless");
else
- eina_stringshare_replace(&rem->prop.border, bd->bordername);
+ eina_stringshare_replace(&rem->prop.border, ec->bordername);
}
- rem->no_reopen = bd->internal_no_reopen;
+ rem->no_reopen = ec->internal_no_reopen;
{
E_Event_Remember_Update *ev;
ev = malloc(sizeof(E_Event_Remember_Update));
if (!ev) return;
- ev->border = bd;
- ecore_event_add(E_EVENT_REMEMBER_UPDATE, ev, NULL, NULL);
+ ev->ec = ec;
+ e_object_ref(E_OBJECT(ec));
+ ecore_event_add(E_EVENT_REMEMBER_UPDATE, ev, _e_remember_event_free, NULL);
}
}
/* local subsystem functions */
static E_Remember *
-_e_remember_find(E_Border *bd, int check_usable)
+_e_remember_find(E_Client *ec, int check_usable)
{
Eina_List *l = NULL;
E_Remember *rem;
@@ -497,31 +507,31 @@ _e_remember_find(E_Border *bd, int check_usable)
if (rem->match & E_REMEMBER_MATCH_TYPE) required_matches++;
if (rem->match & E_REMEMBER_MATCH_TRANSIENT) required_matches++;
- if (bd->client.netwm.name) title = bd->client.netwm.name;
- else title = bd->client.icccm.title;
+ if (ec->netwm.name) title = ec->netwm.name;
+ else title = ec->icccm.title;
if ((rem->match & E_REMEMBER_MATCH_NAME) &&
- ((!e_util_strcmp(rem->name, bd->client.icccm.name)) ||
- (e_util_both_str_empty(rem->name, bd->client.icccm.name))))
+ ((!e_util_strcmp(rem->name, ec->icccm.name)) ||
+ (e_util_both_str_empty(rem->name, ec->icccm.name))))
matches++;
if ((rem->match & E_REMEMBER_MATCH_CLASS) &&
- ((!e_util_strcmp(rem->class, bd->client.icccm.class)) ||
- (e_util_both_str_empty(rem->class, bd->client.icccm.class))))
+ ((!e_util_strcmp(rem->class, ec->icccm.class)) ||
+ (e_util_both_str_empty(rem->class, ec->icccm.class))))
matches++;
if ((rem->match & E_REMEMBER_MATCH_TITLE) &&
((!e_util_strcmp(rem->title, title)) ||
(e_util_both_str_empty(rem->title, title))))
matches++;
if ((rem->match & E_REMEMBER_MATCH_ROLE) &&
- ((!e_util_strcmp(rem->role, bd->client.icccm.window_role)) ||
- (e_util_both_str_empty(rem->role, bd->client.icccm.window_role))))
+ ((!e_util_strcmp(rem->role, ec->icccm.window_role)) ||
+ (e_util_both_str_empty(rem->role, ec->icccm.window_role))))
matches++;
if ((rem->match & E_REMEMBER_MATCH_TYPE) &&
- (rem->type == bd->client.netwm.type))
+ (rem->type == ec->netwm.type))
matches++;
if ((rem->match & E_REMEMBER_MATCH_TRANSIENT) &&
- (((rem->transient) && (bd->client.icccm.transient_for != 0)) ||
- ((!rem->transient) && (bd->client.icccm.transient_for == 0))))
+ (((rem->transient) && (ec->icccm.transient_for != 0)) ||
+ ((!rem->transient) && (ec->icccm.transient_for == 0))))
matches++;
if (matches >= required_matches)
return rem;
@@ -541,31 +551,31 @@ _e_remember_find(E_Border *bd, int check_usable)
if ((check_usable) && (!e_remember_usable_get(rem)))
continue;
- if (bd->client.netwm.name) title = bd->client.netwm.name;
- else title = bd->client.icccm.title;
+ if (ec->netwm.name) title = ec->netwm.name;
+ else title = ec->icccm.title;
/* For each type of match, check whether the match is
* required, and if it is, check whether there's a match. If
* it fails, then go to the next remember */
if (rem->match & E_REMEMBER_MATCH_NAME &&
- !e_util_glob_match(bd->client.icccm.name, rem->name))
+ !e_util_glob_match(ec->icccm.name, rem->name))
continue;
if (rem->match & E_REMEMBER_MATCH_CLASS &&
- !e_util_glob_match(bd->client.icccm.class, rem->class))
+ !e_util_glob_match(ec->icccm.class, rem->class))
continue;
if (rem->match & E_REMEMBER_MATCH_TITLE &&
!e_util_glob_match(title, rem->title))
continue;
if (rem->match & E_REMEMBER_MATCH_ROLE &&
- e_util_strcmp(rem->role, bd->client.icccm.window_role) &&
- !e_util_both_str_empty(rem->role, bd->client.icccm.window_role))
+ e_util_strcmp(rem->role, ec->icccm.window_role) &&
+ !e_util_both_str_empty(rem->role, ec->icccm.window_role))
continue;
if (rem->match & E_REMEMBER_MATCH_TYPE &&
- rem->type != (int)bd->client.netwm.type)
+ rem->type != (int)ec->netwm.type)
continue;
if (rem->match & E_REMEMBER_MATCH_TRANSIENT &&
- !(rem->transient && bd->client.icccm.transient_for != 0) &&
- !(!rem->transient) && (bd->client.icccm.transient_for == 0))
+ !(rem->transient && ec->icccm.transient_for != 0) &&
+ !(!rem->transient) && (ec->icccm.transient_for == 0))
continue;
return rem;
@@ -590,23 +600,19 @@ _e_remember_free(E_Remember *rem)
}
static void
-_e_remember_cb_hook_eval_post_new_border(void *data __UNUSED__, void *border)
+_e_remember_cb_hook_eval_post_new_client(void *data __UNUSED__, E_Client *ec)
{
- E_Border *bd;
-
- bd = border;
-
// remember only when window was modified
- // if (!bd->new_client) return;
+ // if (!ec->new_client) return;
- if ((bd->internal) && (!bd->remember) &&
+ if ((ec->internal) && (!ec->remember) &&
(e_config->remember_internal_windows) &&
- (!bd->internal_no_remember) &&
- (bd->client.icccm.class && bd->client.icccm.class[0]))
+ (!ec->internal_no_remember) &&
+ (ec->icccm.class && ec->icccm.class[0]))
{
E_Remember *rem;
- if (!strncmp(bd->client.icccm.class, "e_fwin", 6))
+ if (!strncmp(ec->icccm.class, "e_fwin", 6))
{
if (!e_config->remember_internal_fm_windows) return;
}
@@ -619,41 +625,40 @@ _e_remember_cb_hook_eval_post_new_border(void *data __UNUSED__, void *border)
rem = e_remember_new();
if (!rem) return;
- e_remember_default_match_set(rem, bd);
+ e_remember_default_match_set(rem, ec);
rem->apply = E_REMEMBER_APPLY_POS | E_REMEMBER_APPLY_SIZE | E_REMEMBER_APPLY_BORDER;
e_remember_use(rem);
- e_remember_update(bd);
- bd->remember = rem;
+ e_remember_update(ec);
+ ec->remember = rem;
}
}
static void
-_e_remember_cb_hook_pre_post_fetch(void *data __UNUSED__, void *border)
+_e_remember_cb_hook_pre_post_fetch(void *data __UNUSED__, E_Client *ec)
{
- E_Border *bd = border;
E_Remember *rem = NULL;
int temporary = 0;
- if ((!bd->new_client) || (bd->internal_no_remember)) return;
+ if ((!ec->new_client) || ec->internal_no_remember || e_client_util_ignored_get(ec)) return;
- if (!bd->remember)
+ if (!ec->remember)
{
- rem = e_remember_find_usable(bd);
+ rem = e_remember_find_usable(ec);
if (rem)
{
- bd->remember = rem;
+ ec->remember = rem;
e_remember_use(rem);
}
}
- if (bd->internal && remembers && bd->client.icccm.class && bd->client.icccm.class[0])
+ if (ec->internal && remembers && ec->icccm.class && ec->icccm.class[0])
{
Eina_List *l;
EINA_LIST_FOREACH(remembers->list, l, rem)
{
- if (rem->class && !strcmp(rem->class, bd->client.icccm.class))
+ if (rem->class && !strcmp(rem->class, ec->icccm.class))
break;
}
if (rem)
@@ -665,7 +670,7 @@ _e_remember_cb_hook_pre_post_fetch(void *data __UNUSED__, void *border)
e_config_domain_save("e_remember_restart",
e_remember_list_edd, remembers);
}
- else rem = bd->remember;
+ else rem = ec->remember;
}
if (!rem)
@@ -675,243 +680,249 @@ _e_remember_cb_hook_pre_post_fetch(void *data __UNUSED__, void *border)
{
E_Zone *zone;
- zone = e_container_zone_number_get(bd->zone->container, rem->prop.zone);
+ zone = e_comp_zone_number_get(ec->zone->comp, rem->prop.zone);
if (zone)
- e_border_zone_set(bd, zone);
+ e_client_zone_set(ec, zone);
}
if (rem->apply & E_REMEMBER_APPLY_DESKTOP)
{
E_Desk *desk;
- desk = e_desk_at_xy_get(bd->zone, rem->prop.desk_x, rem->prop.desk_y);
+ desk = e_desk_at_xy_get(ec->zone, rem->prop.desk_x, rem->prop.desk_y);
if (desk)
{
- e_border_desk_set(bd, desk);
+ e_client_desk_set(ec, desk);
if (e_config->desk_auto_switch)
e_desk_show(desk);
}
}
if (rem->apply & E_REMEMBER_APPLY_SIZE)
{
- bd->client.w = rem->prop.w;
- bd->client.h = rem->prop.h;
+ int w, h;
+
+ w = ec->client.w;
+ h = ec->client.h;
+ ec->client.w = rem->prop.w;
+ ec->client.h = rem->prop.h;
/* we can trust internal windows */
- if (bd->internal)
+ if (ec->internal)
{
- if (bd->zone->w != rem->prop.res_x)
+ if (ec->zone->w != rem->prop.res_x)
{
- if (bd->client.w > (bd->zone->w - 64))
- bd->client.w = bd->zone->w - 64;
+ if (ec->client.w > (ec->zone->w - 64))
+ ec->client.w = ec->zone->w - 64;
}
- if (bd->zone->h != rem->prop.res_y)
+ if (ec->zone->h != rem->prop.res_y)
{
- if (bd->client.h > (bd->zone->h - 64))
- bd->client.h = bd->zone->h - 64;
+ if (ec->client.h > (ec->zone->h - 64))
+ ec->client.h = ec->zone->h - 64;
}
- if (bd->client.icccm.min_w > bd->client.w)
- bd->client.w = bd->client.icccm.min_w;
- if (bd->client.icccm.max_w < bd->client.w)
- bd->client.w = bd->client.icccm.max_w;
- if (bd->client.icccm.min_h > bd->client.h)
- bd->client.h = bd->client.icccm.min_h;
- if (bd->client.icccm.max_h < bd->client.h)
- bd->client.h = bd->client.icccm.max_h;
+ if (ec->icccm.min_w > ec->client.w)
+ ec->client.w = ec->icccm.min_w;
+ if (ec->icccm.max_w < ec->client.w)
+ ec->client.w = ec->icccm.max_w;
+ if (ec->icccm.min_h > ec->client.h)
+ ec->client.h = ec->icccm.min_h;
+ if (ec->icccm.max_h < ec->client.h)
+ ec->client.h = ec->icccm.max_h;
}
- bd->w = bd->client.w + bd->client_inset.l + bd->client_inset.r;
- bd->h = bd->client.h + bd->client_inset.t + bd->client_inset.b;
+ e_comp_object_frame_wh_adjust(ec->frame, ec->client.w, ec->client.h, &ec->w, &ec->h);
if (rem->prop.maximize)
{
- bd->saved.x = rem->prop.pos_x;
- bd->saved.y = rem->prop.pos_y;
- bd->saved.w = bd->w;
- bd->saved.h = bd->h;
- bd->maximized = rem->prop.maximize | e_config->maximize_policy;
+ ec->saved.x = rem->prop.pos_x;
+ ec->saved.y = rem->prop.pos_y;
+ ec->saved.w = ec->client.w;
+ ec->saved.h = ec->client.h;
+ ec->maximized = rem->prop.maximize | e_config->maximize_policy;
+ }
+ if ((w != ec->client.w) || (h != ec->client.h))
+ {
+ ec->changes.size = 1;
+ ec->changes.shape = 1;
+ EC_CHANGED(ec);
}
- bd->changes.size = 1;
- bd->changes.shape = 1;
- BD_CHANGED(bd);
}
- if ((rem->apply & E_REMEMBER_APPLY_POS) && (!bd->re_manage))
+ if ((rem->apply & E_REMEMBER_APPLY_POS) && (!ec->re_manage))
{
- bd->x = rem->prop.pos_x;
- bd->y = rem->prop.pos_y;
- if (bd->zone->w != rem->prop.res_x)
+ ec->x = rem->prop.pos_x;
+ ec->y = rem->prop.pos_y;
+ if (ec->zone->w != rem->prop.res_x)
{
int px;
- px = bd->x + (bd->w / 2);
+ px = ec->x + (ec->w / 2);
if (px < ((rem->prop.res_x * 1) / 3))
{
- if (bd->zone->w >= (rem->prop.res_x / 3))
- bd->x = rem->prop.pos_x;
+ if (ec->zone->w >= (rem->prop.res_x / 3))
+ ec->x = rem->prop.pos_x;
else
- bd->x = ((rem->prop.pos_x - 0) * bd->zone->w) /
+ ec->x = ((rem->prop.pos_x - 0) * ec->zone->w) /
(rem->prop.res_x / 3);
}
else if (px < ((rem->prop.res_x * 2) / 3))
{
- if (bd->zone->w >= (rem->prop.res_x / 3))
- bd->x = (bd->zone->w / 2) +
+ if (ec->zone->w >= (rem->prop.res_x / 3))
+ ec->x = (ec->zone->w / 2) +
(px - (rem->prop.res_x / 2)) -
- (bd->w / 2);
+ (ec->w / 2);
else
- bd->x = (bd->zone->w / 2) +
- (((px - (rem->prop.res_x / 2)) * bd->zone->w) /
+ ec->x = (ec->zone->w / 2) +
+ (((px - (rem->prop.res_x / 2)) * ec->zone->w) /
(rem->prop.res_x / 3)) -
- (bd->w / 2);
+ (ec->w / 2);
}
else
{
- if (bd->zone->w >= (rem->prop.res_x / 3))
- bd->x = bd->zone->w +
+ if (ec->zone->w >= (rem->prop.res_x / 3))
+ ec->x = ec->zone->w +
rem->prop.pos_x - rem->prop.res_x +
- (rem->prop.w - bd->client.w);
+ (rem->prop.w - ec->client.w);
else
- bd->x = bd->zone->w +
- (((rem->prop.pos_x - rem->prop.res_x) * bd->zone->w) /
+ ec->x = ec->zone->w +
+ (((rem->prop.pos_x - rem->prop.res_x) * ec->zone->w) /
(rem->prop.res_x / 3)) +
- (rem->prop.w - bd->client.w);
+ (rem->prop.w - ec->client.w);
}
- if ((rem->prop.pos_x >= 0) && (bd->x < 0))
- bd->x = 0;
+ if ((rem->prop.pos_x >= 0) && (ec->x < 0))
+ ec->x = 0;
else if (((rem->prop.pos_x + rem->prop.w) < rem->prop.res_x) &&
- ((bd->x + bd->w) > bd->zone->w))
- bd->x = bd->zone->w - bd->w;
+ ((ec->x + ec->w) > ec->zone->w))
+ ec->x = ec->zone->w - ec->w;
}
- if (bd->zone->h != rem->prop.res_y)
+ if (ec->zone->h != rem->prop.res_y)
{
int py;
- py = bd->y + (bd->h / 2);
+ py = ec->y + (ec->h / 2);
if (py < ((rem->prop.res_y * 1) / 3))
{
- if (bd->zone->h >= (rem->prop.res_y / 3))
- bd->y = rem->prop.pos_y;
+ if (ec->zone->h >= (rem->prop.res_y / 3))
+ ec->y = rem->prop.pos_y;
else
- bd->y = ((rem->prop.pos_y - 0) * bd->zone->h) /
+ ec->y = ((rem->prop.pos_y - 0) * ec->zone->h) /
(rem->prop.res_y / 3);
}
else if (py < ((rem->prop.res_y * 2) / 3))
{
- if (bd->zone->h >= (rem->prop.res_y / 3))
- bd->y = (bd->zone->h / 2) +
+ if (ec->zone->h >= (rem->prop.res_y / 3))
+ ec->y = (ec->zone->h / 2) +
(py - (rem->prop.res_y / 2)) -
- (bd->h / 2);
+ (ec->h / 2);
else
- bd->y = (bd->zone->h / 2) +
- (((py - (rem->prop.res_y / 2)) * bd->zone->h) /
+ ec->y = (ec->zone->h / 2) +
+ (((py - (rem->prop.res_y / 2)) * ec->zone->h) /
(rem->prop.res_y / 3)) -
- (bd->h / 2);
+ (ec->h / 2);
}
else
{
- if (bd->zone->h >= (rem->prop.res_y / 3))
- bd->y = bd->zone->h +
+ if (ec->zone->h >= (rem->prop.res_y / 3))
+ ec->y = ec->zone->h +
rem->prop.pos_y - rem->prop.res_y +
- (rem->prop.h - bd->client.h);
+ (rem->prop.h - ec->client.h);
else
- bd->y = bd->zone->h +
- (((rem->prop.pos_y - rem->prop.res_y) * bd->zone->h) /
+ ec->y = ec->zone->h +
+ (((rem->prop.pos_y - rem->prop.res_y) * ec->zone->h) /
(rem->prop.res_y / 3)) +
- (rem->prop.h - bd->client.h);
+ (rem->prop.h - ec->client.h);
}
- if ((rem->prop.pos_y >= 0) && (bd->y < 0))
- bd->y = 0;
+ if ((rem->prop.pos_y >= 0) && (ec->y < 0))
+ ec->y = 0;
else if (((rem->prop.pos_y + rem->prop.h) < rem->prop.res_y) &&
- ((bd->y + bd->h) > bd->zone->h))
- bd->y = bd->zone->h - bd->h;
+ ((ec->y + ec->h) > ec->zone->h))
+ ec->y = ec->zone->h - ec->h;
}
- // if (bd->zone->w != rem->prop.res_x)
- // bd->x = (rem->prop.pos_x * bd->zone->w) / rem->prop.res_x;
- // if (bd->zone->h != rem->prop.res_y)
- // bd->y = (rem->prop.pos_y * bd->zone->h) / rem->prop.res_y;
+ // if (ec->zone->w != rem->prop.res_x)
+ // ec->x = (rem->prop.pos_x * ec->zone->w) / rem->prop.res_x;
+ // if (ec->zone->h != rem->prop.res_y)
+ // ec->y = (rem->prop.pos_y * ec->zone->h) / rem->prop.res_y;
if (
/* upper left */
- (!E_INSIDE(bd->x, bd->y, 0, 0, bd->zone->w, bd->zone->h)) &&
+ (!E_INSIDE(ec->x, ec->y, 0, 0, ec->zone->w, ec->zone->h)) &&
/* upper right */
- (!E_INSIDE(bd->x + bd->w, bd->y, 0, 0, bd->zone->w, bd->zone->h)) &&
+ (!E_INSIDE(ec->x + ec->w, ec->y, 0, 0, ec->zone->w, ec->zone->h)) &&
/* lower left */
- (!E_INSIDE(bd->x, bd->y + bd->h, 0, 0, bd->zone->w, bd->zone->h)) &&
+ (!E_INSIDE(ec->x, ec->y + ec->h, 0, 0, ec->zone->w, ec->zone->h)) &&
/* lower right */
- (!E_INSIDE(bd->x + bd->w, bd->y + bd->h, 0, 0, bd->zone->w, bd->zone->h))
+ (!E_INSIDE(ec->x + ec->w, ec->y + ec->h, 0, 0, ec->zone->w, ec->zone->h))
)
{
- e_border_center_pos_get(bd, &bd->x, &bd->y);
- rem->prop.pos_x = bd->x, rem->prop.pos_y = bd->y;
+ e_comp_object_util_center_pos_get(ec->frame, &ec->x, &ec->y);
+ rem->prop.pos_x = ec->x, rem->prop.pos_y = ec->y;
}
- bd->x += bd->zone->x;
- bd->y += bd->zone->y;
- bd->placed = 1;
- bd->changes.pos = 1;
- BD_CHANGED(bd);
+ ec->x += ec->zone->x;
+ ec->y += ec->zone->y;
+ ec->placed = 1;
+ ec->changes.pos = 1;
+ EC_CHANGED(ec);
}
if (rem->apply & E_REMEMBER_APPLY_LAYER)
{
- e_border_layer_set(bd, rem->prop.layer);
+ evas_object_layer_set(ec->frame, rem->prop.layer);
}
if (rem->apply & E_REMEMBER_APPLY_BORDER)
{
- eina_stringshare_replace(&bd->bordername, NULL);
- bd->bordername = eina_stringshare_ref(rem->prop.border);
- bd->client.border.changed = 1;
- BD_CHANGED(bd);
+ eina_stringshare_replace(&ec->bordername, NULL);
+ ec->bordername = eina_stringshare_ref(rem->prop.border);
+ ec->border.changed = 1;
+ EC_CHANGED(ec);
}
if (rem->apply & E_REMEMBER_APPLY_FULLSCREEN)
{
if (rem->prop.fullscreen)
- e_border_fullscreen(bd, e_config->fullscreen_policy);
+ e_client_fullscreen(ec, e_config->fullscreen_policy);
}
if (rem->apply & E_REMEMBER_APPLY_STICKY)
{
- if (rem->prop.sticky) e_border_stick(bd);
+ if (rem->prop.sticky) e_client_stick(ec);
}
if (rem->apply & E_REMEMBER_APPLY_SHADE)
{
if (rem->prop.shaded >= 100)
- e_border_shade(bd, rem->prop.shaded - 100);
+ e_client_shade(ec, rem->prop.shaded - 100);
else if (rem->prop.shaded >= 50)
- e_border_unshade(bd, rem->prop.shaded - 50);
+ e_client_unshade(ec, rem->prop.shaded - 50);
}
if (rem->apply & E_REMEMBER_APPLY_LOCKS)
{
- bd->lock_user_location = rem->prop.lock_user_location;
- bd->lock_client_location = rem->prop.lock_client_location;
- bd->lock_user_size = rem->prop.lock_user_size;
- bd->lock_client_size = rem->prop.lock_client_size;
- bd->lock_user_stacking = rem->prop.lock_user_stacking;
- bd->lock_client_stacking = rem->prop.lock_client_stacking;
- bd->lock_user_iconify = rem->prop.lock_user_iconify;
- bd->lock_client_iconify = rem->prop.lock_client_iconify;
- bd->lock_user_desk = rem->prop.lock_user_desk;
- bd->lock_client_desk = rem->prop.lock_client_desk;
- bd->lock_user_sticky = rem->prop.lock_user_sticky;
- bd->lock_client_sticky = rem->prop.lock_client_sticky;
- bd->lock_user_shade = rem->prop.lock_user_shade;
- bd->lock_client_shade = rem->prop.lock_client_shade;
- bd->lock_user_maximize = rem->prop.lock_user_maximize;
- bd->lock_client_maximize = rem->prop.lock_client_maximize;
- bd->lock_user_fullscreen = rem->prop.lock_user_fullscreen;
- bd->lock_client_fullscreen = rem->prop.lock_client_fullscreen;
- bd->lock_border = rem->prop.lock_border;
- bd->lock_close = rem->prop.lock_close;
- bd->lock_focus_in = rem->prop.lock_focus_in;
- bd->lock_focus_out = rem->prop.lock_focus_out;
- bd->lock_life = rem->prop.lock_life;
+ ec->lock_user_location = rem->prop.lock_user_location;
+ ec->lock_client_location = rem->prop.lock_client_location;
+ ec->lock_user_size = rem->prop.lock_user_size;
+ ec->lock_client_size = rem->prop.lock_client_size;
+ ec->lock_user_stacking = rem->prop.lock_user_stacking;
+ ec->lock_client_stacking = rem->prop.lock_client_stacking;
+ ec->lock_user_iconify = rem->prop.lock_user_iconify;
+ ec->lock_client_iconify = rem->prop.lock_client_iconify;
+ ec->lock_user_desk = rem->prop.lock_user_desk;
+ ec->lock_client_desk = rem->prop.lock_client_desk;
+ ec->lock_user_sticky = rem->prop.lock_user_sticky;
+ ec->lock_client_sticky = rem->prop.lock_client_sticky;
+ ec->lock_user_shade = rem->prop.lock_user_shade;
+ ec->lock_client_shade = rem->prop.lock_client_shade;
+ ec->lock_user_maximize = rem->prop.lock_user_maximize;
+ ec->lock_client_maximize = rem->prop.lock_client_maximize;
+ ec->lock_user_fullscreen = rem->prop.lock_user_fullscreen;
+ ec->lock_client_fullscreen = rem->prop.lock_client_fullscreen;
+ ec->lock_border = rem->prop.lock_border;
+ ec->lock_close = rem->prop.lock_close;
+ ec->lock_focus_in = rem->prop.lock_focus_in;
+ ec->lock_focus_out = rem->prop.lock_focus_out;
+ ec->lock_life = rem->prop.lock_life;
}
if (rem->apply & E_REMEMBER_APPLY_SKIP_WINLIST)
- bd->user_skip_winlist = rem->prop.skip_winlist;
+ ec->user_skip_winlist = rem->prop.skip_winlist;
if (rem->apply & E_REMEMBER_APPLY_SKIP_PAGER)
- bd->client.netwm.state.skip_pager = rem->prop.skip_pager;
+ ec->netwm.state.skip_pager = rem->prop.skip_pager;
if (rem->apply & E_REMEMBER_APPLY_SKIP_TASKBAR)
- bd->client.netwm.state.skip_taskbar = rem->prop.skip_taskbar;
+ ec->netwm.state.skip_taskbar = rem->prop.skip_taskbar;
if (rem->apply & E_REMEMBER_APPLY_ICON_PREF)
- bd->icon_preference = rem->prop.icon_preference;
+ ec->icon_preference = rem->prop.icon_preference;
if (rem->apply & E_REMEMBER_APPLY_OFFER_RESISTANCE)
- bd->offer_resistance = rem->prop.offer_resistance;
+ ec->offer_resistance = rem->prop.offer_resistance;
if (rem->apply & E_REMEMBER_SET_FOCUS_ON_START)
- bd->want_focus = 1;
+ ec->want_focus = 1;
if (rem->apply & E_REMEMBER_APPLY_OPACITY)
- bd->client.netwm.opacity = rem->prop.opacity;
+ ec->netwm.opacity = rem->prop.opacity;
if (temporary)
_e_remember_free(rem);
diff --git a/src/bin/e_remember.h b/src/bin/e_remember.h
index c5d79cbf79..e5c9f36ae4 100644
--- a/src/bin/e_remember.h
+++ b/src/bin/e_remember.h
@@ -4,7 +4,7 @@ EAPI extern int E_EVENT_REMEMBER_UPDATE;
typedef struct E_Event_Remember_Update
{
- void *border;
+ E_Client *ec;
} E_Event_Remember_Update;
typedef struct _E_Remember E_Remember;
@@ -116,11 +116,11 @@ EAPI int e_remember_usable_get(E_Remember *rem);
EAPI void e_remember_use(E_Remember *rem);
EAPI void e_remember_unuse(E_Remember *rem);
EAPI void e_remember_del(E_Remember *rem);
-EAPI E_Remember *e_remember_find(E_Border *bd);
-EAPI E_Remember *e_remember_find_usable(E_Border *bd);
+EAPI E_Remember *e_remember_find(E_Client *ec);
+EAPI E_Remember *e_remember_find_usable(E_Client *ec);
EAPI void e_remember_match_update(E_Remember *rem);
-EAPI void e_remember_update(E_Border *bd);
-EAPI int e_remember_default_match_set(E_Remember *rem, E_Border *bd);
+EAPI void e_remember_update(E_Client *ec);
+EAPI int e_remember_default_match_set(E_Remember *rem, E_Client *ec);
EAPI void e_remember_internal_save(void);
#endif
#endif
diff --git a/src/bin/e_resist.c b/src/bin/e_resist.c
index c760eb759f..6f65481330 100644
--- a/src/bin/e_resist.c
+++ b/src/bin/e_resist.c
@@ -12,15 +12,14 @@ struct _E_Resist_Rect
static void _e_resist_rects(Eina_List *rects, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry, int *rw, int *rh);
EAPI int
-e_resist_container_border_position(E_Container *con, Eina_List *skiplist,
+e_resist_client_position(E_Comp *c, Eina_List *skiplist,
int px, int py, int pw, int ph,
int x, int y, int w, int h,
int *rx, int *ry, int *rw, int *rh)
{
- Eina_List *l, *ll, *rects = NULL;
+ Eina_List *l, *rects = NULL;
E_Resist_Rect *r;
- E_Border_List *bl;
- E_Border *bd, *bd2;
+ E_Client *ec;
E_Desk *desk;
E_Shelf *es;
E_Zone *zone;
@@ -50,45 +49,33 @@ e_resist_container_border_position(E_Container *con, Eina_List *skiplist,
rects = eina_list_append(rects, r); \
}
- EINA_LIST_FOREACH(con->zones, l, zone)
+ EINA_LIST_FOREACH(c->zones, l, zone)
{
HOLDER(zone->x, zone->y, zone->w, zone->h, e_config->desk_resist);
}
/* FIXME: need to add resist or complete BLOCKS for things like ibar */
/* can add code here to add more fake obstacles with custom resist values */
/* here if need be - ie xinerama middle between screens and panels etc. */
-
- bl = e_container_border_list_first(con);
- while ((bd = e_container_border_list_next(bl)))
+ ec = e_client_bottom_get(c);
+ do
{
- if (bd->visible)
+ if (ec->visible && (!e_client_util_ignored_get(ec)))
{
- int ok;
-
- ok = 1;
- EINA_LIST_FOREACH(skiplist, ll, bd2)
- {
- if (bd2 == bd)
- {
- ok = 0;
- break;
- }
- }
- if (ok && bd->offer_resistance)
+ if (ec->offer_resistance && (!eina_list_data_find(skiplist, ec)))
{
- OBSTACLE(bd->x, bd->y, bd->w, bd->h, e_config->window_resist);
+ OBSTACLE(ec->x, ec->y, ec->w, ec->h, e_config->window_resist);
}
}
- }
- e_container_border_list_free(bl);
+ ec = e_client_above_get(ec);
+ } while (ec);
- desk = e_desk_current_get(e_zone_current_get(con));
+ desk = e_desk_current_get(e_zone_current_get(c));
EINA_LIST_FOREACH(e_shelf_list(), l, es)
{
Eina_List *ll2;
E_Config_Shelf_Desk *sd;
- if (es->zone->container == con)
+ if (es->zone->comp == c)
{
if (es->cfg->desk_show_mode)
{
@@ -123,7 +110,7 @@ e_resist_container_border_position(E_Container *con, Eina_List *skiplist,
}
EAPI int
-e_resist_container_gadman_position(E_Container *con, Eina_List *skiplist __UNUSED__,
+e_resist_gadman_position(E_Comp *c, Eina_List *skiplist __UNUSED__,
int px, int py, int pw, int ph,
int x, int y, int w, int h,
int *rx, int *ry)
@@ -141,7 +128,7 @@ e_resist_container_gadman_position(E_Container *con, Eina_List *skiplist __UNUSE
EINA_LIST_FOREACH(e_shelf_list(), l, es)
{
- if (es->zone->container == con)
+ if (es->zone->comp == c)
{
OBSTACLE(es->x + es->zone->x, es->y + es->zone->y, es->w, es->h,
e_config->gadget_resist);
diff --git a/src/bin/e_resist.h b/src/bin/e_resist.h
index 212fc983a9..c61b7d31f1 100644
--- a/src/bin/e_resist.h
+++ b/src/bin/e_resist.h
@@ -3,8 +3,8 @@
#ifndef E_RESIST_H
#define E_RESIST_H
-EAPI int e_resist_container_border_position(E_Container *con, Eina_List *skiplist, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry, int *rw, int *rh);
-EAPI int e_resist_container_gadman_position(E_Container *con, Eina_List *skiplist, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry);
+EAPI int e_resist_client_position(E_Comp *c, Eina_List *skiplist, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry, int *rw, int *rh);
+EAPI int e_resist_gadman_position(E_Comp *c, Eina_List *skiplist, int px, int py, int pw, int ph, int x, int y, int w, int h, int *rx, int *ry);
#endif
#endif
diff --git a/src/bin/e_screensaver.c b/src/bin/e_screensaver.c
index 9a05ab8b95..5383547d50 100644
--- a/src/bin/e_screensaver.c
+++ b/src/bin/e_screensaver.c
@@ -166,15 +166,11 @@ _e_screensaver_ask_presentation_key_down(void *data, Evas *e __UNUSED__, Evas_Ob
static void
_e_screensaver_ask_presentation_mode(void)
{
- E_Manager *man;
- E_Container *con;
E_Dialog *dia;
if (_e_screensaver_ask_presentation_dia) return;
- if (!(man = e_manager_current_get())) return;
- if (!(con = e_container_current_get(man))) return;
- if (!(dia = e_dialog_new(con, "E", "_screensaver_ask_presentation"))) return;
+ if (!(dia = e_dialog_new(NULL, "E", "_screensaver_ask_presentation"))) return;
e_dialog_title_set(dia, _("Activate Presentation Mode?"));
e_dialog_icon_set(dia, "dialog-ask", 64);
@@ -397,17 +393,17 @@ e_screensaver_init(void)
(E_EVENT_CONFIG_MODE_CHANGED, _e_screensaver_handler_config_mode_cb, NULL);
_e_screensaver_handler_border_fullscreen = ecore_event_handler_add
- (E_EVENT_BORDER_FULLSCREEN, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_FULLSCREEN, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_unfullscreen = ecore_event_handler_add
- (E_EVENT_BORDER_UNFULLSCREEN, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_UNFULLSCREEN, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_remove = ecore_event_handler_add
- (E_EVENT_BORDER_REMOVE, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_REMOVE, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_iconify = ecore_event_handler_add
- (E_EVENT_BORDER_ICONIFY, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_ICONIFY, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_uniconify = ecore_event_handler_add
- (E_EVENT_BORDER_UNICONIFY, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
+ (E_EVENT_CLIENT_UNICONIFY, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_desk_set = ecore_event_handler_add
- (E_EVENT_BORDER_DESK_SET, _e_screensaver_handler_border_desk_set_cb, NULL);
+ (E_EVENT_CLIENT_DESK_SET, _e_screensaver_handler_border_desk_set_cb, NULL);
_e_screensaver_handler_desk_show = ecore_event_handler_add
(E_EVENT_DESK_SHOW, _e_screensaver_handler_desk_show_cb, NULL);
diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c
index 471f76c72c..a53436c3ad 100644
--- a/src/bin/e_shelf.c
+++ b/src/bin/e_shelf.c
@@ -6,7 +6,7 @@ static void _e_shelf_free(E_Shelf *es);
static void _e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style);
-static void _e_shelf_toggle_border_fix(E_Shelf *es);
+static void _e_shelf_toggle_client_fix(E_Shelf *es);
static void _e_shelf_cb_menu_config(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_shelf_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_shelf_cb_menu_contents(void *data, E_Menu *m, E_Menu_Item *mi);
@@ -138,7 +138,7 @@ e_shelf_config_update(void)
E_Zone *zone;
if (cf_es->id <= 0) cf_es->id = id + 1;
- zone = e_util_container_zone_number_get(cf_es->container, cf_es->zone);
+ zone = e_util_comp_zone_number_get(cf_es->manager, cf_es->zone);
if (zone)
e_shelf_config_new(zone, cf_es);
id = cf_es->id;
@@ -195,10 +195,11 @@ e_shelf_zone_dummy_new(E_Zone *zone, Evas_Object *obj, int id)
}
EAPI E_Shelf *
-e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, E_Layer layer, int id)
+e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, E_Layer layer, int id)
{
E_Shelf *es;
char buf[1024];
+ E_Comp_Object_Type type = E_COMP_OBJECT_TYPE_POPUP;
es = E_OBJECT_ALLOC(E_Shelf, E_SHELF_TYPE, _e_shelf_free);
if (!es) return NULL;
@@ -210,43 +211,28 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, E
es->zone = zone;
e_object_del_attach_func_set(E_OBJECT(es), _e_shelf_del_cb);
e_zone_useful_geometry_dirty(zone);
- if (popup)
- {
- es->popup = e_popup_new(zone, es->x, es->y, es->w, es->h);
- e_popup_name_set(es->popup, "shelf");
- if (layer)
- e_popup_layer_set(es->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_ABOVE);
- else
- e_popup_layer_set(es->popup, E_COMP_CANVAS_LAYER_DESKTOP_TOP, 0);
- }
- es->ee = zone->container->bg_ecore_evas;
- es->evas = zone->container->bg_evas;
+
+
+ es->ee = zone->comp->ee;
+ es->evas = zone->comp->evas;
es->fit_along = 1;
es->layer = layer;
- es->handlers =
- eina_list_append(es->handlers,
- ecore_event_handler_add(E_EVENT_ZONE_EDGE_MOVE,
- _e_shelf_cb_mouse_in, es));
+ E_LIST_HANDLER_APPEND(es->handlers, E_EVENT_ZONE_EDGE_MOVE, _e_shelf_cb_mouse_in, es);
es->o_base = edje_object_add(es->evas);
+ evas_object_name_set(es->o_base, "shelf");
evas_object_event_callback_add(es->o_base, EVAS_CALLBACK_MOUSE_DOWN,
_e_shelf_cb_mouse_down, es);
- evas_object_name_set(es->o_base, name);
es->name = eina_stringshare_add(name);
evas_object_resize(es->o_base, es->w, es->h);
e_shelf_style_set(es, style);
-
- if (es->popup)
- {
- e_popup_show(es->popup);
- }
- else
- {
- evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y);
- evas_object_show(es->o_base);
- es->cw = E_LAYER_SET(es->o_base, layer);
- }
+ evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y);
+ if (layer == E_LAYER_DESKTOP)
+ type = E_COMP_OBJECT_TYPE_NONE;
+ es->comp_object = e_comp_object_util_add(es->o_base, type);
+ evas_object_name_set(es->comp_object, es->name);
+ evas_object_layer_set(es->comp_object, layer);
es->gadcon =
e_gadcon_swallowed_new(es->name, es->id, es->o_base, "e.swallow.content");
@@ -278,8 +264,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, E
e_gadcon_shelf_set(es->gadcon, es);
e_gadcon_xdnd_window_set(es->gadcon, e_comp_get(es)->ee_win);
e_gadcon_dnd_window_set(es->gadcon, e_comp_get(es)->ee_win);
- if (!es->popup)
- evas_object_clip_set(es->o_base, es->zone->bg_clip_object);
+ evas_object_clip_set(es->comp_object, es->zone->bg_clip_object);
e_gadcon_util_menu_attach_func_set(es->gadcon,
_e_shelf_cb_menu_items_append, es);
@@ -359,10 +344,7 @@ e_shelf_show(E_Shelf *es)
{
E_OBJECT_CHECK(es);
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
- if (es->popup)
- e_popup_show(es->popup);
- else
- evas_object_show(es->o_base);
+ evas_object_show(es->comp_object);
}
EAPI void
@@ -370,10 +352,7 @@ e_shelf_hide(E_Shelf *es)
{
E_OBJECT_CHECK(es);
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
- if (es->popup)
- e_popup_hide(es->popup);
- else
- evas_object_hide(es->o_base);
+ evas_object_hide(es->comp_object);
}
EAPI void
@@ -493,10 +472,7 @@ e_shelf_move(E_Shelf *es, int x, int y)
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
es->x = x;
es->y = y;
- if (es->popup)
- e_popup_move(es->popup, es->x, es->y);
- else
- e_comp_win_move(es->cw, es->zone->x + es->x, es->zone->y + es->y);
+ evas_object_move(es->comp_object, es->zone->x + es->x, es->zone->y + es->y);
}
EAPI void
@@ -506,10 +482,7 @@ e_shelf_resize(E_Shelf *es, int w, int h)
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
es->w = w;
es->h = h;
- if (es->popup)
- e_popup_resize(es->popup, es->w, es->h);
- else
- e_comp_win_resize(es->cw, es->w, es->h);
+ evas_object_resize(es->comp_object, es->w, es->h);
}
EAPI void
@@ -521,10 +494,8 @@ e_shelf_move_resize(E_Shelf *es, int x, int y, int w, int h)
es->y = y;
es->w = w;
es->h = h;
- if (es->popup)
- e_popup_move_resize(es->popup, es->x, es->y, es->w, es->h);
- else
- e_comp_win_moveresize(es->cw, es->zone->x + es->x, es->zone->y + es->y, es->w, es->h);
+ evas_object_move(es->comp_object, es->zone->x + es->x, es->zone->y + es->y);
+ evas_object_resize(es->comp_object, es->w, es->h);
}
EAPI void
@@ -544,9 +515,8 @@ e_shelf_save(E_Shelf *es)
cf_es = E_NEW(E_Config_Shelf, 1);
cf_es->name = eina_stringshare_add(es->name);
- cf_es->container = es->zone->container->num;
+ cf_es->manager = es->zone->comp->num;
cf_es->zone = es->zone->num;
- if (es->popup) cf_es->popup = 1;
cf_es->layer = es->layer;
e_config->shelves = eina_list_append(e_config->shelves, cf_es);
cf_es->orient = es->gadcon->orient;
@@ -806,7 +776,7 @@ e_shelf_position_calc(E_Shelf *es)
if (!es->cfg) break;
if (!es->zone) break;
- if ((!es->cfg->popup) || (!es->cfg->autohide)) break;
+ if (!es->cfg->autohide) break;
switch (es->cfg->orient)
{
case E_GADCON_ORIENT_LEFT:
@@ -856,7 +826,7 @@ e_shelf_desk_visible(const E_Shelf *es, const E_Desk *desk)
EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
if (!desk)
{
- EINA_LIST_FOREACH(e_util_container_current_get()->zones, ll, zone)
+ EINA_LIST_FOREACH(e_util_comp_current_get()->zones, ll, zone)
{
desk = e_desk_current_get(zone);
if (e_shelf_desk_visible(es, desk)) return EINA_TRUE;
@@ -911,12 +881,6 @@ e_shelf_style_set(E_Shelf *es, const char *style)
es->instant_delay = atof(option);
else
es->instant_delay = -1.0;
-
- if (es->popup && (es->popup->content != es->o_base))
- {
- e_popup_content_set(es->popup, es->o_base);
- evas_object_clip_set(es->popup->cw->effect_obj, es->zone->bg_clip_object);
- }
}
EAPI void
@@ -967,8 +931,7 @@ e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es)
{
E_Shelf *es;
- es = e_shelf_zone_new(zone, cf_es->name, cf_es->style,
- cf_es->popup, cf_es->layer, cf_es->id);
+ es = e_shelf_zone_new(zone, cf_es->name, cf_es->style, cf_es->layer, cf_es->id);
if (!es) return NULL;
if (!cf_es->hide_timeout) cf_es->hide_timeout = 1.0;
@@ -1029,10 +992,9 @@ _e_shelf_new_dialog_ok(void *data, char *text)
cfg = E_NEW(E_Config_Shelf, 1);
cfg->name = eina_stringshare_add(text);
- cfg->container = zone->container->num;
+ cfg->manager = zone->comp->num;
cfg->zone = zone->num;
- cfg->popup = 1;
- cfg->layer = 200;
+ cfg->layer = E_LAYER_CLIENT_ABOVE;
EINA_LIST_FOREACH(e_config->shelves, l, es_cf)
orient *= orientations[es_cf->orient];
for (x = 3; x < (sizeof(orientations) / sizeof(orientations[0])); x++)
@@ -1114,39 +1076,18 @@ _e_shelf_free(E_Shelf *es)
e_zone_useful_geometry_dirty(es->zone);
E_FREE_LIST(es->handlers, ecore_event_handler_del);
- if (es->autohide)
- {
- ecore_event_handler_del(es->autohide);
- es->autohide = NULL;
- }
-
- if (es->hide_timer)
- {
- ecore_timer_del(es->hide_timer);
- es->hide_timer = NULL;
- }
- if (es->hide_animator)
- {
- ecore_animator_del(es->hide_animator);
- es->hide_animator = NULL;
- }
- if (es->instant_timer)
- {
- ecore_timer_del(es->instant_timer);
- es->instant_timer = NULL;
- }
-
+ E_FREE_FUNC(es->autohide, ecore_event_handler_del);
+ E_FREE_FUNC(es->hide_animator, ecore_animator_del);
+ E_FREE_FUNC(es->autohide_timer, ecore_timer_del);
+ E_FREE_FUNC(es->hide_timer, ecore_timer_del);
+ E_FREE_FUNC(es->instant_timer, ecore_timer_del);
+ E_FREE_FUNC(es->module_init_end_timer, ecore_timer_del);
if (es->menu)
{
e_menu_post_deactivate_callback_set(es->menu, NULL, NULL);
e_object_del(E_OBJECT(es->menu));
es->menu = NULL;
}
- if (es->module_init_end_timer)
- {
- ecore_timer_del(es->module_init_end_timer);
- es->module_init_end_timer = NULL;
- }
if (es->dummy)
{
evas_object_event_callback_del_full(es->o_base, EVAS_CALLBACK_DEL,
@@ -1166,12 +1107,12 @@ _e_shelf_free(E_Shelf *es)
}
if (es->config_dialog) e_object_del(E_OBJECT(es->config_dialog));
es->config_dialog = NULL;
- evas_object_del(es->o_base);
- es->o_base = NULL;
- if (es->popup) e_object_del(E_OBJECT(es->popup));
- if (es->autohide_timer) ecore_timer_del(es->autohide_timer);
- es->autohide_timer = NULL;
- es->popup = NULL;
+ if (stopping)
+ evas_object_unref(es->comp_object);
+ else
+ evas_object_hide(es->comp_object);
+ E_FREE_FUNC(es->comp_object, evas_object_del);
+ E_FREE_FUNC(es->o_base, evas_object_del);
ev = E_NEW(E_Event_Shelf, 1);
ev->shelf = es;
@@ -1407,40 +1348,40 @@ _e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *styl
}
static void
-_e_shelf_toggle_border_fix(E_Shelf *es)
+_e_shelf_toggle_client_fix(E_Shelf *es)
{
Eina_List *l;
- E_Border *bd;
+ E_Client *ec;
if (!e_config->border_fix_on_shelf_toggle)
return;
if (es->cfg->overlap)
return;
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
+ EINA_LIST_FOREACH(e_comp_get(es)->clients, l, ec)
{
- if ((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_NONE)
+ if ((ec->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_NONE)
{
- if (bd->lock_client_location) continue;
+ if (ec->lock_client_location) continue;
if (es->hidden)
{
- if (!bd->shelf_fix.modified) continue;
- if (!--bd->shelf_fix.modified)
+ if (!ec->shelf_fix.modified) continue;
+ if (!--ec->shelf_fix.modified)
{
- e_border_move(bd, bd->shelf_fix.x, bd->shelf_fix.y);
+ evas_object_move(ec->frame, ec->shelf_fix.x, ec->shelf_fix.y);
continue;
}
}
- if (!E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
+ if (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
es->x, es->y, es->w, es->h))
continue;
if (!es->hidden)
{
- if (!bd->shelf_fix.modified++)
- bd->shelf_fix.x = bd->x;
- bd->shelf_fix.y = bd->y;
+ if (!ec->shelf_fix.modified++)
+ ec->shelf_fix.x = ec->x;
+ ec->shelf_fix.y = ec->y;
}
switch (es->gadcon->orient)
@@ -1449,28 +1390,28 @@ _e_shelf_toggle_border_fix(E_Shelf *es)
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
if (!es->hidden)
- e_border_move(bd, bd->x, bd->y + es->h);
+ evas_object_move(ec->frame, ec->x, ec->y + es->h);
break;
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
if (!es->hidden)
- e_border_move(bd, bd->x, bd->y - es->h);
+ evas_object_move(ec->frame, ec->x, ec->y - es->h);
break;
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LB:
case E_GADCON_ORIENT_CORNER_LT:
if (!es->hidden)
- e_border_move(bd, bd->x + es->w, bd->y);
+ evas_object_move(ec->frame, ec->x + es->w, ec->y);
break;
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RB:
case E_GADCON_ORIENT_CORNER_RT:
if (!es->hidden)
- e_border_move(bd, bd->x - es->w, bd->y);
+ evas_object_move(ec->frame, ec->x - es->w, ec->y);
break;
default:
@@ -1481,9 +1422,9 @@ _e_shelf_toggle_border_fix(E_Shelf *es)
{
E_Maximize max;
- max = bd->maximized;
- e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
- e_border_maximize(bd, max);
+ max = ec->maximized;
+ e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
+ e_client_maximize(ec, max);
}
}
}
@@ -1721,8 +1662,9 @@ _e_shelf_cb_mouse_move_autohide_fuck_systray(E_Shelf *es)
Ecore_Event_Mouse_Move ev;
memset(&ev, 0, sizeof(Ecore_Event_Mouse_Move));
- ecore_x_pointer_xy_get(es->zone->container->manager->root, &x, &y);
- ev.root.x = x, ev.root.y = y;
+ ecore_evas_pointer_xy_get(es->zone->comp->ee, &x, &y);
+ ev.root.x = e_comp_canvas_x_root_unadjust(es->zone->comp, x);
+ ev.root.y = e_comp_canvas_y_root_unadjust(es->zone->comp, y);
_e_shelf_cb_mouse_in(es, ECORE_EVENT_MOUSE_MOVE, &ev);
return EINA_TRUE;
}
@@ -1839,18 +1781,21 @@ _e_shelf_cb_mouse_in(void *data, int type, void *event)
* mouse in/out events. in the future, when we remove systray, we should go
* back to mouse in/out events
*/
- inside = (es->popup && ((ev->event_window == e_comp_get(es)->win)));
+ inside = (ev->event_window == e_comp_get(es)->win);
if (!inside)
{
- inside = E_INSIDE(ev->root.x, ev->root.y, es->zone->x, es->zone->y, es->zone->w + 4, es->zone->h + 4);
- x = ev->root.x - es->zone->x, y = ev->root.y - es->zone->y;
+ inside = E_INSIDE(e_comp_canvas_x_root_adjust(e_comp_get(es), ev->root.x),
+ e_comp_canvas_x_root_adjust(e_comp_get(es), ev->root.y),
+ es->zone->x, es->zone->y, es->zone->w + 4, es->zone->h + 4);
+ x = e_comp_canvas_x_root_adjust(e_comp_get(es), ev->root.x) - es->zone->x;
+ y = e_comp_canvas_x_root_adjust(e_comp_get(es), ev->root.y) - es->zone->y;
if (inside)
inside = (
((E_INSIDE(x, y, es->x, es->y, es->w, es->h)) ||
(E_INSIDE(x, y, es->x - 2, es->y - 2, es->w + 4, es->h + 4)) ||
(E_INSIDE(x, y, es->x + 2, es->y + 2, es->w + 4, es->h + 4)))
);
- if (inside && es->popup)
+ if (inside)
{
if (es->autohide_timer)
ecore_timer_reset(es->autohide_timer);
@@ -1896,14 +1841,10 @@ _e_shelf_cb_mouse_out(void *data, int type, void *event)
if (type == ECORE_X_EVENT_MOUSE_OUT)
{
- Ecore_X_Event_Mouse_Out *ev;
+ Ecore_X_Event_Mouse_Out *ev = event;
int x, y, w, h;
- ev = event;
-
- if (es->popup) win = es->popup->evas_win;
- else win = es->zone->container->event_win;
- if (ev->win != win) return ECORE_CALLBACK_PASS_ON;
+ if (ev->win != e_comp_get(es)->ee_win) return ECORE_CALLBACK_PASS_ON;
/*
* ECORE_X_EVENT_DETAIL_INFERIOR means focus went to children windows
@@ -2072,7 +2013,7 @@ end:
else if (es->urgent_show)
e_shelf_toggle(es, 0);
else
- _e_shelf_toggle_border_fix(es);
+ _e_shelf_toggle_client_fix(es);
if ((!es->hidden) && es->cfg->autohide_show_action)
{
edje_object_signal_emit(es->o_base, "e,state,hidden", "e");
@@ -2154,7 +2095,7 @@ _e_shelf_cb_instant_hide_timer(void *data)
break;
}
es->instant_timer = NULL;
- _e_shelf_toggle_border_fix(es);
+ _e_shelf_toggle_client_fix(es);
return ECORE_CALLBACK_CANCEL;
}
diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h
index 2ca4b9bf92..0a234044d8 100644
--- a/src/bin/e_shelf.h
+++ b/src/bin/e_shelf.h
@@ -15,9 +15,8 @@ struct _E_Shelf
int id;
int x, y, w, h;
E_Layer layer;
- E_Popup *popup; /* NULL if its within an existing canvas */
+ Evas_Object *comp_object;
E_Zone *zone;
- E_Comp_Win *cw;
Evas_Object *o_base;
Ecore_Evas *ee;
Evas *evas;
@@ -71,7 +70,7 @@ EAPI void e_shelf_config_update(void);
EAPI E_Entry_Dialog *e_shelf_new_dialog(E_Zone *zone);
EAPI Eina_List *e_shelf_list(void);
EAPI Eina_List *e_shelf_list_all(void); // includes dummy shelves
-EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, E_Layer layer, int id);
+EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, E_Layer layer, int id);
EAPI E_Shelf *e_shelf_zone_dummy_new(E_Zone *zone, Evas_Object *obj, int id);
EAPI void e_shelf_zone_move_resize_handle(E_Zone *zone);
EAPI void e_shelf_populate(E_Shelf *es);
diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c
index b29d35bd78..f4f5578b40 100644
--- a/src/bin/e_start_main.c
+++ b/src/bin/e_start_main.c
@@ -559,7 +559,7 @@ main(int argc, char **argv)
}
#ifdef HAVE_SYS_PTRACE_H
if (!really_know)
- /* E18 should be in pause, we can detach */
+ /* E19 should be in pause, we can detach */
ptrace(PT_DETACH, child, NULL, back);
#endif
/* And call gdb if available */
diff --git a/src/bin/e_stolen.c b/src/bin/e_stolen.c
deleted file mode 100644
index 1b58f9a566..0000000000
--- a/src/bin/e_stolen.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "e.h"
-
-typedef struct _E_Stolen_Window E_Stolen_Window;
-
-struct _E_Stolen_Window
-{
- Ecore_X_Window win;
- int refcount;
-};
-
-static Eina_Hash *_e_stolen_windows = NULL;
-
-/* externally accessible functions */
-EAPI int
-e_stolen_win_get(Ecore_X_Window win)
-{
- E_Stolen_Window *esw;
-
- esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
- if (esw) return 1;
- return 0;
-}
-
-EAPI void
-e_stolen_win_add(Ecore_X_Window win)
-{
- E_Stolen_Window *esw;
-
- esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
- if (esw)
- {
- esw->refcount++;
- }
- else
- {
- esw = E_NEW(E_Stolen_Window, 1);
- esw->win = win;
- esw->refcount = 1;
- if (!_e_stolen_windows) _e_stolen_windows = eina_hash_string_superfast_new(NULL);
- eina_hash_add(_e_stolen_windows, e_util_winid_str_get(win), esw);
- }
- return;
-}
-
-EAPI void
-e_stolen_win_del(Ecore_X_Window win)
-{
- E_Stolen_Window *esw;
-
- esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win));
- if (esw)
- {
- esw->refcount--;
- if (esw->refcount == 0)
- {
- eina_hash_del(_e_stolen_windows, e_util_winid_str_get(win), esw);
- if (!eina_hash_population(_e_stolen_windows))
- {
- eina_hash_free(_e_stolen_windows);
- _e_stolen_windows = NULL;
- }
- free(esw);
- }
- }
- return;
-}
-
diff --git a/src/bin/e_stolen.h b/src/bin/e_stolen.h
deleted file mode 100644
index 36205ac7e4..0000000000
--- a/src/bin/e_stolen.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef E_TYPEDEFS
-#else
-#ifndef E_STOLEN_H
-#define E_STOLEN_H
-
-EAPI int e_stolen_win_get(Ecore_X_Window win);
-EAPI void e_stolen_win_add(Ecore_X_Window win);
-EAPI void e_stolen_win_del(Ecore_X_Window win);
-
-#endif
-#endif
diff --git a/src/bin/e_surface.c b/src/bin/e_surface.c
index 1e6136250b..7e13f4141a 100644
--- a/src/bin/e_surface.c
+++ b/src/bin/e_surface.c
@@ -139,14 +139,14 @@ e_surface_image_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h, void *pixels)
}
EAPI void
-e_surface_border_input_set(Evas_Object *obj, E_Border *bd)
+e_surface_border_input_set(Evas_Object *obj, E_Client *ec)
{
E_Smart_Data *sd = NULL;
/* try to get the objects smart data */
if (!(sd = evas_object_smart_data_get(obj))) return;
- e_border_input_object_set(bd, sd->o_input);
+ //e_client_input_object_set(bd, sd->o_input);
}
/* smart functions */
diff --git a/src/bin/e_surface.h b/src/bin/e_surface.h
index 2aebbd1d93..9bf8223387 100644
--- a/src/bin/e_surface.h
+++ b/src/bin/e_surface.h
@@ -7,7 +7,7 @@ EAPI Evas_Object *e_surface_add(Evas *evas);
EAPI void e_surface_input_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
EAPI void e_surface_damage_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
EAPI void e_surface_image_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h, void *pixels);
-EAPI void e_surface_border_input_set(Evas_Object *obj, E_Border *bd);
+EAPI void e_surface_border_input_set(Evas_Object *obj, E_Client *ec);
# endif
#endif
diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c
index 29c6a2f48f..cddbe779b1 100644
--- a/src/bin/e_sys.c
+++ b/src/bin/e_sys.c
@@ -589,14 +589,16 @@ _e_sys_logout_confirm_dialog_update(int remaining)
static Eina_Bool
_e_sys_cb_logout_timer(void *data __UNUSED__)
{
- Eina_List *l;
- E_Border *bd;
+ const Eina_List *l, *ll;
+ E_Comp *c;
+ E_Client *ec;
int pending = 0;
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- {
- if (!bd->internal) pending++;
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ if (!ec->internal) pending++;
+ }
if (pending == 0) goto after;
else if (_e_sys_logout_confirm_dialog)
{
@@ -632,7 +634,7 @@ _e_sys_cb_logout_timer(void *data __UNUSED__)
{
E_Dialog *dia;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_sys_error_logout_slow");
+ dia = e_dialog_new(NULL, "E", "_sys_error_logout_slow");
if (dia)
{
_e_sys_logout_confirm_dialog = dia;
@@ -677,14 +679,15 @@ _e_sys_logout_after(void)
static void
_e_sys_logout_begin(E_Sys_Action a_after, Eina_Bool raw)
{
- Eina_List *l;
- E_Border *bd;
+ const Eina_List *l, *ll;
+ E_Comp *c;
+ E_Client *ec;
E_Obj_Dialog *od;
/* start logout - at end do the a_after action */
if (!raw)
{
- od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
+ od = e_obj_dialog_new(e_util_comp_current_get(),
_("Logout in progress"), "E", "_sys_logout");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/logout");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
@@ -697,10 +700,11 @@ _e_sys_logout_begin(E_Sys_Action a_after, Eina_Bool raw)
}
_e_sys_action_after = a_after;
_e_sys_action_after_raw = raw;
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- {
- e_border_act_close_begin(bd);
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ {
+ e_client_act_close_begin(ec);
+ }
/* and poll to see if all pending windows are gone yet every 0.5 sec */
_e_sys_logout_begin_time = ecore_time_get();
if (_e_sys_logout_timer) ecore_timer_del(_e_sys_logout_timer);
@@ -713,7 +717,7 @@ _e_sys_current_action(void)
/* display dialog that currently an action is in progress */
E_Dialog *dia;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
+ dia = e_dialog_new(NULL,
"E", "_sys_error_action_busy");
if (!dia) return;
@@ -768,7 +772,7 @@ _e_sys_action_failed(void)
/* display dialog that the current action failed */
E_Dialog *dia;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
+ dia = e_dialog_new(NULL,
"E", "_sys_error_action_failed");
if (!dia) return;
@@ -899,7 +903,7 @@ _e_sys_action_do(E_Sys_Action a, char *param __UNUSED__, Eina_Bool raw)
_e_sys_exe = ecore_exe_run(buf, NULL);
ret = 1;
}
- od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
+ od = e_obj_dialog_new(NULL,
_("Power off"), "E", "_sys_halt");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/halt");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
@@ -958,7 +962,7 @@ _e_sys_action_do(E_Sys_Action a, char *param __UNUSED__, Eina_Bool raw)
_e_sys_exe = ecore_exe_run(buf, NULL);
ret = 1;
}
- od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
+ od = e_obj_dialog_new(NULL,
_("Resetting"), "E", "_sys_reboot");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/reboot");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
@@ -1025,7 +1029,7 @@ _e_sys_action_do(E_Sys_Action a, char *param __UNUSED__, Eina_Bool raw)
_e_sys_exe = ecore_exe_run(buf, NULL);
ret = 1;
}
- od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
+ od = e_obj_dialog_new(NULL,
_("Suspending"), "E", "_sys_suspend");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/suspend");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
@@ -1092,7 +1096,7 @@ _e_sys_action_do(E_Sys_Action a, char *param __UNUSED__, Eina_Bool raw)
_e_sys_exe = ecore_exe_run(buf, NULL);
ret = 1;
}
- od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
+ od = e_obj_dialog_new(NULL,
_("Hibernating"), "E", "_sys_hibernate");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/hibernate");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
diff --git a/src/bin/e_test.c b/src/bin/e_test.c
index 4d9a14c575..154ec843e7 100644
--- a/src/bin/e_test.c
+++ b/src/bin/e_test.c
@@ -1,6 +1,6 @@
#include "e.h"
-static void _e_test_internal(E_Container *con);
+static void _e_test_internal(E_Comp *c);
#ifdef DESKMIRROR_TEST
@@ -8,14 +8,15 @@ static Eina_Bool
deskmirror_test(void *d EINA_UNUSED)
{
E_Zone *zone;
- Evas_Object *o;
- E_Popup *pop;
+ Evas_Object *o, *com;
zone = e_util_zone_current_get(e_manager_current_get());
- pop = e_popup_new(zone, zone->x + zone->w / 4, zone->y + zone->h / 4, zone->w / 2, zone->h / 2);
o = e_deskmirror_add(e_desk_current_get(zone));
- e_popup_content_set(pop, o);
- e_popup_show(pop);
+ com = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_POPUP);
+ evas_object_move(com, zone->x + zone->w / 4, zone->y + zone->h / 4);
+ evas_object_resize(com, zone->w / 2, zone->h / 2);
+ evas_object_layer_set(com, E_LAYER_POPUP);
+ evas_object_show(com);
return EINA_FALSE;
}
@@ -24,17 +25,7 @@ deskmirror_test(void *d EINA_UNUSED)
EAPI void
e_test(void)
{
- Eina_List *l, *ll;
- E_Manager *man;
- E_Container *con;
-
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- EINA_LIST_FOREACH(man->containers, ll, con)
- {
- _e_test_internal(con);
- }
- }
+ E_LIST_FOREACH(e_comp_list(), _e_test_internal);
#ifdef DESKMIRROR_TEST
ecore_timer_add(2.0, deskmirror_test, NULL);
@@ -62,7 +53,7 @@ _e_test_timer(void *data)
{
m = e_int_menus_main_new();
e_menu_activate_mouse(m,
- e_container_zone_number_get(e_container_current_get(man), 0),
+ eina_list_data_get(man->comp->zones),
0, 0, 1, 1, E_MENU_POP_DIRECTION_DOWN, 0);
ecore_timer_add(0.05, _e_test_timer, m);
return 0;
@@ -71,7 +62,7 @@ _e_test_timer(void *data)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
_e_test_timer(NULL);
}
@@ -96,12 +87,12 @@ _e_test_delete(E_Win *win)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Win *win;
Evas_Object *o;
- win = e_win_new(con);
+ win = e_win_new(c);
e_win_resize_callback_set(win, _e_test_resize);
e_win_delete_callback_set(win, _e_test_delete);
e_win_placed_set(win, 0);
@@ -134,7 +125,7 @@ _e_test_timer(void *data)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Menu *m;
Eina_List *l;
@@ -144,7 +135,7 @@ _e_test_internal(E_Container *con)
{
m = e_int_menus_main_new();
e_menu_activate_mouse(m,
- e_container_zone_number_get(e_container_current_get(man), 0),
+ eina_list_data_get(man->comp->zones),
0, 0, 1, 1, E_MENU_POP_DIRECTION_DOWN, 0);
ecore_timer_add(0.02, _e_test_timer, m);
}
@@ -161,11 +152,11 @@ _e_test_dialog_del(void *obj)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Dialog *dia;
- dia = e_dialog_new(con, "E", "_test");
+ dia = e_dialog_new(c, "E", "_test");
e_object_del_attach_func_set(E_OBJECT(dia), _e_test_dialog_del);
e_dialog_title_set(dia, "A Test Dialog");
e_dialog_text_set(dia, "A Test Dialog<br>And another line<br><hilight>Hilighted Text</hilight>");
@@ -192,12 +183,12 @@ _e_test_click(void *data, Evas *e, Evas_Object *obj, void *event_info)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Dialog *dia;
Evas_Object *o, *o2, *o3;
- dia = e_dialog_new(con, "E", "_test");
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
o = e_icon_add(dia->win->evas);
@@ -228,15 +219,15 @@ _e_test_internal(E_Container *con)
#elif 0
static E_Dialog *
-_e_test_dia(E_Container *con)
+_e_test_dia(E_Comp *c)
{
E_Config_Dialog *dia;
- dia = e_int_config_modules(con);
+ dia = e_int_config_modules(c);
return dia;
}
-static E_Container *tcon = NULL;
+static E_Comp *tcon = NULL;
static int
_e_test_timer(void *data)
@@ -258,9 +249,9 @@ _e_test_timer(void *data)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
- tcon = con;
+ tcon = c;
_e_test_timer(NULL);
}
@@ -297,13 +288,13 @@ _e_test_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Dialog *dia;
Evas_Coord mw, mh, vw, vh;
Evas_Object *o, *o2, *o3, *o4;
- dia = e_dialog_new(con, "E", "_test");
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
o = e_ilist_add(dia->win->evas);
@@ -385,13 +376,13 @@ _e_test_cb_e_smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_in
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Dialog *dia;
Evas_Object *o;
Evas_Coord mw, mh;
- dia = e_dialog_new(con, "E", "_test");
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
o = e_slider_add(dia->win->evas);
@@ -414,13 +405,13 @@ _e_test_internal(E_Container *con)
#elif 0
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Dialog *dia;
Evas_Object *o;
Evas_Coord mw, mh;
- dia = e_dialog_new(con, "E", "_test");
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
o = e_widget_textblock_add(dia->win->evas);
@@ -532,14 +523,14 @@ _e_test_cb_selected(void *data, Evas_Object *obj, void *event_info)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Dialog *dia;
Evas_Object *ofm, *ofm2, *of, *ob, *ot;
Evas_Coord mw, mh;
E_Fm2_Config fmc;
- dia = e_dialog_new(con, "E", "_test");
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
/* a table for layout */
@@ -645,13 +636,13 @@ _e_test_cb_selected(void *data, Evas_Object *obj)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Dialog *dia;
Evas_Object *o;
Evas_Coord mw, mh;
- dia = e_dialog_new(con, "E", "_test");
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
o = e_widget_fsel_add(dia->win->evas, "~/", "/tst", NULL, NULL,
@@ -678,25 +669,25 @@ _e_test_cb_ok(E_Color_Dialog *dia, E_Color *color, void *data)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Color_Dialog *d;
- d = e_color_dialog_new(con, NULL, EINA_FALSE);
+ d = e_color_dialog_new(c, NULL, EINA_FALSE);
e_color_dialog_show(d);
e_color_dialog_select_callback_set(d, _e_test_cb_ok, NULL);
}
#elif 0
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
E_Dialog *dia;
Evas_Object *o, *ob, *of;
Evas_Coord mw, mh;
int i;
- dia = e_dialog_new(con, "E", "_test");
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
of = e_scrollframe_add(dia->win->evas);
@@ -758,9 +749,9 @@ _e_test_internal(E_Container *con)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
- ecore_timer_add(1.0, _e_test_timer, con);
+ ecore_timer_add(1.0, _e_test_timer, c);
}
#elif 0
@@ -768,13 +759,13 @@ _e_test_internal(E_Container *con)
static int
_e_test_timer(void *data)
{
- E_Container *con;
+ E_Comp *c;
E_Dialog *dia;
Evas_Object *o, *ic;
Evas_Coord mw, mh;
- con = data;
- dia = e_dialog_new(con, "E", "_test");
+ c = data;
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
o = e_widget_toolbar_add(dia->win->evas, 48, 48);
@@ -825,9 +816,9 @@ _e_test_timer(void *data)
}
static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
- ecore_timer_add(1.0, _e_test_timer, con);
+ ecore_timer_add(1.0, _e_test_timer, c);
}
#elif 0
@@ -835,13 +826,13 @@ _e_test_internal(E_Container *con)
static int
_e_test_timer(void *data)
{
- E_Container *con;
+ E_Comp *c;
E_Dialog *dia;
Evas_Object *o, *ic;
Evas_Coord mw, mh;
- con = data;
- dia = e_dialog_new(con, "E", "_test");
+ c = data;
+ dia = e_dialog_new(c, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
o = e_widget_toolbar_add(dia->win->evas, 48, 48);
@@ -892,133 +883,14 @@ _e_test_timer(void *data)
}
static void
-_e_test_internal(E_Container *con)
-{
- ecore_timer_add(1.0, _e_test_timer, con);
-}
-
-#elif 0
-static void
-delorig(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- evas_object_del(data);
-}
-
-static void
-movorig(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Evas_Coord x, y;
- evas_object_geometry_get(obj, &x, &y, NULL, NULL);
- evas_object_move(data, x, y);
-}
-
-static void
-reszorig(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Evas_Coord w, h;
- evas_object_geometry_get(obj, NULL, NULL, &w, &h);
- evas_object_resize(data, w / 8, h / 8);
-}
-
-static void
-newwin(Evas *e, E_Manager *man, E_Manager_Comp_Source *src)
-{
- Evas_Object *o, *orig;
- Evas_Coord x, y, w, h;
-
- if (!e_manager_comp_src_image_get(man, src)) return;
-
- orig = e_manager_comp_src_shadow_get(man, src);
- o = e_manager_comp_src_image_mirror_add(man, src);
- evas_object_color_set(o, 200, 200, 200, 200);
- evas_object_event_callback_add(orig, EVAS_CALLBACK_DEL, delorig, o);
- evas_object_event_callback_add(orig, EVAS_CALLBACK_MOVE, movorig, o);
- evas_object_event_callback_add(orig, EVAS_CALLBACK_RESIZE, reszorig, o);
- evas_object_geometry_get(orig, &x, &y, &w, &h);
-
- evas_object_move(o, x, y);
- evas_object_resize(o, w / 8, h / 8);
-
- evas_object_show(o);
- e_manager_comp_evas_update(man);
-}
-
-static void
-setup(E_Manager *man)
-{
- Eina_List *list, *l;
- E_Manager_Comp_Source *src;
- Evas *e;
-
- e = e_manager_comp_evas_get(man);
- list = (Eina_List *)e_manager_comp_src_list(man);
- EINA_LIST_FOREACH(list, l, src)
- {
- newwin(e, man, src);
- }
-}
-
-static void
-handler(void *data, const char *name, const char *info, int val,
- E_Object *obj, void *msgdata)
-{
- E_Manager *man = (E_Manager *)obj;
- E_Manager_Comp_Source *src = (E_Manager_Comp_Source *)msgdata;
- Evas *e;
-
- printf("handler... '%s' '%s'\n", name, info);
- if (strcmp(name, "comp.manager")) return;
-
- e = e_manager_comp_evas_get(man);
- if (!strcmp(info, "resize.comp"))
- {
- printf("%s: %p | %p\n", info, man, src);
- }
- else if (!strcmp(info, "add.src"))
- {
- printf("%s: %p | %p\n", info, man, src);
- newwin(e, man, src);
- }
- else if (!strcmp(info, "del.src"))
- {
- printf("%s: %p | %p\n", info, man, src);
- }
- else if (!strcmp(info, "config.src"))
- {
- printf("%s: %p | %p\n", info, man, src);
- }
- else if (!strcmp(info, "visibility.src"))
- {
- printf("%s: %p | %p\n", info, man, src);
- }
-}
-
-static Eina_Bool
-_e_test_timer(void *data)
-{
- Eina_List *list, *l, *wins;
- E_Manager *man;
-
- printf("shetup\n");
- e_msg_handler_add(handler, NULL);
- list = e_manager_list();
- EINA_LIST_FOREACH(list, l, man)
- {
- Evas *e = e_manager_comp_evas_get(man);
- if (e) setup(man);
- }
- return 0;
-}
-
-static void
-_e_test_internal(E_Container *con)
+_e_test_internal(E_Comp *c)
{
- ecore_timer_add(3.0, _e_test_timer, con);
+ ecore_timer_add(1.0, _e_test_timer, c);
}
#else
static void
-_e_test_internal(E_Container *con __UNUSED__)
+_e_test_internal(E_Comp *c __UNUSED__)
{
}
diff --git a/src/bin/e_theme.c b/src/bin/e_theme.c
index e1378a4efa..89d656ff36 100644
--- a/src/bin/e_theme.c
+++ b/src/bin/e_theme.c
@@ -155,7 +155,7 @@ e_theme_comp_border_find(const char *comp)
int found = 0;
const char *str;
- comps = e_theme_collection_items_find(NULL, "e/comp/border");
+ comps = e_theme_collection_items_find(NULL, "e/comp/frame");
if (eina_list_search_sorted(comps, EINA_COMPARE_CB(strcmp), comp))
found = 1;
EINA_LIST_FREE(comps, str) eina_stringshare_del(str);
@@ -165,7 +165,7 @@ e_theme_comp_border_find(const char *comp)
EAPI Eina_List *
e_theme_comp_border_list(void)
{
- return e_theme_collection_items_find(NULL, "e/comp/border");
+ return e_theme_collection_items_find(NULL, "e/comp/frame");
}
/* local subsystem functions */
diff --git a/src/bin/e_theme_about.c b/src/bin/e_theme_about.c
index f431e2727e..fbecdac3bf 100644
--- a/src/bin/e_theme_about.c
+++ b/src/bin/e_theme_about.c
@@ -6,7 +6,7 @@ _cb_settings_theme(void *data, Evas_Object *obj __UNUSED__, const char *emission
{
E_Obj_Dialog *od = data;
- e_configure_registry_call("appearance/theme", od->win->container, NULL);
+ e_configure_registry_call("appearance/theme", od->win->comp, NULL);
}
/* local subsystem globals */
@@ -14,11 +14,11 @@ _cb_settings_theme(void *data, Evas_Object *obj __UNUSED__, const char *emission
/* externally accessible functions */
EAPI E_Theme_About *
-e_theme_about_new(E_Container *con)
+e_theme_about_new(E_Comp *c)
{
E_Obj_Dialog *od;
- od = e_obj_dialog_new(con, _("About Theme"), "E", "_theme_about");
+ od = e_obj_dialog_new(c, _("About Theme"), "E", "_theme_about");
if (!od) return NULL;
e_obj_dialog_obj_theme_set(od, "base/theme", "e/theme/about");
e_obj_dialog_obj_part_text_set(od, "e.text.label", _("Close"));
diff --git a/src/bin/e_theme_about.h b/src/bin/e_theme_about.h
index c8a12ba8f9..2bc38e737d 100644
--- a/src/bin/e_theme_about.h
+++ b/src/bin/e_theme_about.h
@@ -6,7 +6,7 @@ typedef struct _E_Obj_Dialog E_Theme_About;
#ifndef E_THEME_ABOUT_H
#define E_THEME_ABOUT_H
-EAPI E_Theme_About *e_theme_about_new (E_Container *con);
+EAPI E_Theme_About *e_theme_about_new (E_Comp *c);
EAPI void e_theme_about_show (E_Theme_About *about);
#endif
diff --git a/src/bin/e_toolbar.c b/src/bin/e_toolbar.c
index b5b57927da..b7926d699d 100644
--- a/src/bin/e_toolbar.c
+++ b/src/bin/e_toolbar.c
@@ -314,7 +314,7 @@ _e_toolbar_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __U
tbar->menu = mn;
_e_toolbar_menu_append(tbar, mn);
zone = e_util_zone_current_get(e_manager_current_get());
- ecore_x_pointer_xy_get(zone->container->win, &x, &y);
+ ecore_evas_pointer_xy_get(zone->comp->ee, &x, &y);
e_menu_activate_mouse(mn, zone, x, y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
}
diff --git a/src/bin/e_update.c b/src/bin/e_update.c
index b9a0597496..fe77066b62 100644
--- a/src/bin/e_update.c
+++ b/src/bin/e_update.c
@@ -60,17 +60,11 @@ _never_tell_me_cb(void *data __UNUSED__, E_Dialog *dia __UNUSED__)
static void
_new_version(const char *ver)
{
- E_Manager *man;
- E_Container *con;
char text[2048];
if (dialog) return;
- man = e_manager_current_get();
- if (!man) return;
- con = e_container_current_get(man);
- if (!con) return;
- dialog = e_dialog_new(con, "E", "_update_available");
+ dialog = e_dialog_new(NULL, "E", "_update_available");
e_object_del_attach_func_set(E_OBJECT(dialog), _delete_cb);
e_dialog_button_add(dialog, _("OK"), NULL,
diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c
index 93f4daae77..e4a9dce638 100644
--- a/src/bin/e_utils.c
+++ b/src/bin/e_utils.c
@@ -54,19 +54,9 @@ e_util_env_set(const char *var, const char *val)
EAPI E_Zone *
e_util_zone_current_get(E_Manager *man)
{
- E_Container *con;
-
E_OBJECT_CHECK_RETURN(man, NULL);
E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL);
- con = e_container_current_get(man);
- if (con)
- {
- E_Zone *zone;
-
- zone = e_zone_current_get(con);
- return zone;
- }
- return NULL;
+ return e_zone_current_get(man->comp);
}
EAPI int
@@ -107,40 +97,25 @@ e_util_glob_case_match(const char *str, const char *pattern)
return 0;
}
-EAPI E_Container *
-e_util_container_number_get(int num)
-{
- Eina_List *l;
- E_Manager *man;
-
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- E_Container *con;
-
- con = e_container_number_get(man, num);
- if (con) return con;
- }
- return NULL;
-}
EAPI E_Zone *
-e_util_container_zone_number_get(int con_num, int zone_num)
+e_util_comp_zone_number_get(int c_num, int zone_num)
{
- E_Container *con;
+ E_Comp *c;
- con = e_util_container_number_get(con_num);
- if (!con) return NULL;
- return e_container_zone_number_get(con, zone_num);
+ c = e_comp_number_get(c_num);
+ if (!c) return NULL;
+ return e_comp_zone_number_get(c, zone_num);
}
EAPI E_Zone *
-e_util_container_zone_id_get(int con_num, int id)
+e_util_comp_zone_id_get(int c_num, int id)
{
- E_Container *con;
+ E_Comp *c;
- con = e_util_container_number_get(con_num);
- if (!con) return NULL;
- return e_container_zone_id_get(con, id);
+ c = e_comp_number_get(c_num);
+ if (!c) return NULL;
+ return e_comp_zone_id_get(c, id);
}
EAPI int
@@ -225,7 +200,7 @@ e_util_immortal_check(void)
{
Eina_List *wins;
- wins = e_border_immortal_windows_get();
+ wins = e_clients_immortal_list(NULL);
if (wins)
{
e_util_dialog_show(_("Cannot exit - immortal windows."),
@@ -526,127 +501,48 @@ e_util_mime_icon_get(const char *mime, unsigned int size)
return efreet_mime_type_icon_get(mime, e_config->icon_theme, e_util_icon_size_normalize(size));
}
-EAPI E_Container *
-e_util_container_window_find(Ecore_X_Window win)
-{
- Eina_List *l, *ll;
- E_Manager *man;
- E_Container *con;
-
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- EINA_LIST_FOREACH(man->containers, ll, con)
- {
- if ((con->win == win) || (con->bg_win == win) ||
- (con->event_win == win))
- return con;
- }
- }
- return NULL;
-}
-
EAPI E_Zone *
e_util_zone_window_find(Ecore_X_Window win)
{
- Eina_List *l, *ll, *lll;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *l, *ll;
+ E_Comp *c;
E_Zone *zone;
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- EINA_LIST_FOREACH(man->containers, ll, con)
- EINA_LIST_FOREACH(con->zones, lll, zone)
- if (zone->black_win == win) return zone;
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ if (zone->black_win == win) return zone;
return NULL;
}
-static int
-_e_util_layer_map(int layer)
+EAPI E_Client *
+e_util_desk_client_above(E_Client *ec)
{
- int pos = 0;
+ E_Client *ec2;
- if (layer < 0) layer = 0;
- pos = 1 + (layer / 50);
- if (pos > 10) pos = 10;
- return pos;
-}
-
-EAPI E_Border *
-e_util_desk_border_above(E_Border *bd)
-{
- E_Border *bd2, *above = NULL;
- Eina_List *l;
- int pos, i;
+ E_OBJECT_CHECK_RETURN(ec, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
- E_OBJECT_CHECK_RETURN(bd, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, NULL);
-
- pos = _e_util_layer_map(bd->layer);
-
- EINA_LIST_FOREACH(eina_list_data_find_list(bd->zone->container->layers[pos].clients, bd), l, bd2)
+ for (ec2 = e_client_above_get(ec); ec2; ec2 = e_client_above_get(ec2))
{
- if (!eina_list_next(l) || above) break;
- above = eina_list_data_get(eina_list_next(l));
- if ((above->desk != bd->desk) && (!above->sticky))
- above = NULL;
+ if ((ec2->desk == ec->desk) || (ec2->sticky)) return ec2;
}
- if (!above)
- {
- /* Need to check the layers above */
- for (i = pos + 1; (i < 7) && (!above); i++)
- {
- EINA_LIST_FOREACH(bd->zone->container->layers[i].clients, l, bd2)
- {
- if (above) break;
- above = bd2;
- if ((above->desk != bd->desk) && (!above->sticky))
- above = NULL;
- }
- }
- }
- return above;
+ return NULL;
}
-EAPI E_Border *
-e_util_desk_border_below(E_Border *bd)
+EAPI E_Client *
+e_util_desk_client_below(E_Client *ec)
{
- E_Border *below = NULL, *bd2;
- Eina_List *l;
- int pos, i;
-
- E_OBJECT_CHECK_RETURN(bd, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, NULL);
+ E_Client *ec2;
- pos = _e_util_layer_map(bd->layer);
+ E_OBJECT_CHECK_RETURN(ec, NULL);
+ E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
- for (l = eina_list_data_find_list(bd->zone->container->layers[pos].clients, bd); l; l = l->prev)
+ for (ec2 = e_client_below_get(ec); ec2; ec2 = e_client_below_get(ec2))
{
- if (!eina_list_prev(l) || below) break;
- below = eina_list_data_get(eina_list_prev(l));
- if ((below->desk != bd->desk) && (!below->sticky))
- below = NULL;
+ if ((ec2->desk == ec->desk) || (ec2->sticky)) return ec2;
}
- if (!below)
- {
- /* Need to check the layers below */
- for (i = pos - 1; (i >= 0) && (!below); i--)
- {
- if (bd->zone->container->layers[i].clients)
- {
- l = eina_list_data_find_list(bd->zone->container->layers[pos].clients, bd);
- for (; l && !below; l = l->prev)
- {
- bd2 = l->data;
- below = bd2;
- if ((below->desk != bd->desk) && (!below->sticky))
- below = NULL;
- }
- }
- }
- }
-
- return below;
+ return NULL;
}
EAPI int
@@ -671,7 +567,7 @@ e_util_dialog_internal(const char *title, const char *txt)
{
E_Dialog *dia;
- dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_error_dialog");
+ dia = e_dialog_new(NULL, "E", "_error_dialog");
if (!dia) return NULL;
e_dialog_title_set(dia, title);
e_dialog_text_set(dia, txt);
@@ -1074,10 +970,10 @@ e_util_win_auto_resize_fill(E_Win *win)
{
E_Zone *zone = NULL;
- if (win->border)
- zone = win->border->zone;
- if ((!zone) && (win->container))
- zone = e_util_zone_current_get(win->container->manager);
+ if (win->client)
+ zone = win->client->zone;
+ if ((!zone) && (win->comp))
+ zone = e_zone_current_get(win->comp);
if (zone)
{
@@ -1092,15 +988,15 @@ e_util_win_auto_resize_fill(E_Win *win)
}
EAPI int
-e_util_container_desk_count_get(E_Container *con)
+e_util_comp_desk_count_get(E_Comp *c)
{
Eina_List *zl;
E_Zone *zone;
int count = 0;
- E_OBJECT_CHECK_RETURN(con, 0);
- E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, 0);
- EINA_LIST_FOREACH(con->zones, zl, zone)
+ E_OBJECT_CHECK_RETURN(c, 0);
+ E_OBJECT_TYPE_CHECK_RETURN(c, E_COMP_TYPE, 0);
+ EINA_LIST_FOREACH(c->zones, zl, zone)
{
int x, y;
int cx = 0, cy = 0;
@@ -1230,51 +1126,46 @@ e_util_module_config_check(const char *module_name, int loaded, int current)
}
/**
- * Checks whenever the current manager/container/zone have fullscreen windows.
+ * Checks whenever the current manager/comp/zone have fullscreen windows.
*/
EAPI Eina_Bool
e_util_fullscreen_current_any(void)
{
E_Manager *man = e_manager_current_get();
- E_Container *con = e_container_current_get(man);
- E_Zone *zone = e_zone_current_get(con);
+ E_Zone *zone = e_util_zone_current_get(man);
E_Desk *desk;
if ((zone) && (zone->fullscreen > 0)) return EINA_TRUE;
desk = e_desk_current_get(zone);
- if ((desk) && (desk->fullscreen_borders > 0)) return EINA_TRUE;
+ if ((desk) && (desk->fullscreen_clients)) return EINA_TRUE;
return EINA_FALSE;
}
/**
- * Checks whenever any manager/container/zone have fullscreen windows.
+ * Checks whenever any manager/comp/zone have fullscreen windows.
*/
EAPI Eina_Bool
e_util_fullscreen_any(void)
{
E_Zone *zone;
- Eina_List *lm, *lc, *lz;
- E_Container *con;
- E_Manager *man;
+ const Eina_List *lc, *lz;
+ E_Comp *c;
E_Desk *desk;
int x, y;
- EINA_LIST_FOREACH(e_manager_list(), lm, man)
+ EINA_LIST_FOREACH(e_comp_list(), lc, c)
{
- EINA_LIST_FOREACH(man->containers, lc, con)
+ EINA_LIST_FOREACH(c->zones, lz, zone)
{
- EINA_LIST_FOREACH(con->zones, lz, zone)
- {
- if (zone->fullscreen > 0) return EINA_TRUE;
-
- for (x = 0; x < zone->desk_x_count; x++)
- for (y = 0; y < zone->desk_y_count; y++)
- {
- desk = e_desk_at_xy_get(zone, x, y);
- if ((desk) && (desk->fullscreen_borders > 0))
- return EINA_TRUE;
- }
- }
+ if (zone->fullscreen > 0) return EINA_TRUE;
+
+ for (x = 0; x < zone->desk_x_count; x++)
+ for (y = 0; y < zone->desk_y_count; y++)
+ {
+ desk = e_desk_at_xy_get(zone, x, y);
+ if ((desk) && (desk->fullscreen_clients))
+ return EINA_TRUE;
+ }
}
}
return EINA_FALSE;
@@ -1334,7 +1225,7 @@ _e_util_size_debug_free(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *
evas_object_geometry_get(obj, &x, &y, &w, &h);
name = evas_object_name_get(obj);
- fprintf(stderr, "FREE %s OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", name ?: "", name ? "|" : "", obj, x, y, w, h);
+ fprintf(stderr, "FREE %s %d OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", evas_object_layer_get(obj), name ?: "", name ? "|" : "", obj, x, y, w, h);
}
static void
@@ -1345,7 +1236,18 @@ _e_util_size_debug_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o
evas_object_geometry_get(obj, &x, &y, &w, &h);
name = evas_object_name_get(obj);
- fprintf(stderr, "DEL %s OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", name ?: "", name ? "|" : "", obj, x, y, w, h);
+ fprintf(stderr, "DEL %s %d OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", evas_object_layer_get(obj), name ?: "", name ? "|" : "", obj, x, y, w, h);
+}
+
+static void
+_e_util_size_debug_stack(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ int x, y, w, h;
+ const char *name;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ name = evas_object_name_get(obj);
+ fprintf(stderr, "RESTACK %s %d OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", evas_object_layer_get(obj), name ?: "", name ? "|" : "", obj, x, y, w, h);
}
static void
@@ -1356,7 +1258,7 @@ _e_util_size_debug(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
evas_object_geometry_get(obj, &x, &y, &w, &h);
name = evas_object_name_get(obj);
- fprintf(stderr, "%s OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", name ?: "", name ? "|" : "", obj, x, y, w, h);
+ fprintf(stderr, "%s %d OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", evas_object_layer_get(obj), name ?: "", name ? "|" : "", obj, x, y, w, h);
}
EAPI void
@@ -1372,6 +1274,8 @@ e_util_size_debug_set(Evas_Object *obj, Eina_Bool enable)
_e_util_size_debug, NULL);
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE,
_e_util_size_debug, NULL);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_RESTACK,
+ _e_util_size_debug_stack, NULL);
evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
_e_util_size_debug_del, NULL);
evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
@@ -1749,13 +1653,13 @@ e_util_evas_objects_above_print_smart(Evas_Object *o)
}
EAPI Eina_Bool
-e_util_border_shadow_state_get(const E_Border *bd)
+e_util_client_shadow_state_get(const E_Client *ec)
{
Eina_Bool on;
- on = !bd->client.e.state.video;
+ on = !ec->e.state.video;
if (on)
- on = !bd->fullscreen;
+ on = !ec->fullscreen;
if (on)
- on = !!e_util_strcmp(bd->client.border.name, "borderless");
+ on = !!e_util_strcmp(ec->border.name, "borderless");
return on;
}
diff --git a/src/bin/e_utils.h b/src/bin/e_utils.h
index 8e0aa3d8ce..6ab2b0bcb0 100644
--- a/src/bin/e_utils.h
+++ b/src/bin/e_utils.h
@@ -17,9 +17,8 @@ EAPI void e_util_env_set(const char *var, const char *val);
EAPI E_Zone *e_util_zone_current_get(E_Manager *man);
EAPI int e_util_glob_match(const char *str, const char *glob);
EAPI int e_util_glob_case_match(const char *str, const char *glob);
-EAPI E_Container *e_util_container_number_get(int num);
-EAPI E_Zone *e_util_container_zone_id_get(int con_num, int id);
-EAPI E_Zone *e_util_container_zone_number_get(int con_num, int zone_num);
+EAPI E_Zone *e_util_comp_zone_id_get(int con_num, int id);
+EAPI E_Zone *e_util_comp_zone_number_get(int con_num, int zone_num);
EAPI int e_util_head_exec(int head, const char *cmd);
EAPI int e_util_strcasecmp(const char *s1, const char *s2);
EAPI int e_util_strcmp(const char *s1, const char *s2);
@@ -34,10 +33,9 @@ EAPI int e_util_icon_theme_set(Evas_Object *obj, const char *icon);
EAPI unsigned int e_util_icon_size_normalize(unsigned int desired);
EAPI int e_util_menu_item_theme_icon_set(E_Menu_Item *mi, const char *icon);
EAPI const char *e_util_mime_icon_get(const char *mime, unsigned int size);
-EAPI E_Container *e_util_container_window_find(Ecore_X_Window win);
EAPI E_Zone *e_util_zone_window_find(Ecore_X_Window win);
-EAPI E_Border *e_util_desk_border_above(E_Border *bd);
-EAPI E_Border *e_util_desk_border_below(E_Border *bd);
+EAPI E_Client *e_util_desk_client_above(E_Client *ec);
+EAPI E_Client *e_util_desk_client_below(E_Client *ec);
EAPI int e_util_edje_collection_exists(const char *file, const char *coll);
EAPI E_Dialog *e_util_dialog_internal(const char *title, const char *txt);
EAPI const char *e_util_filename_escape(const char *filename);
@@ -57,7 +55,7 @@ EAPI void e_util_win_auto_resize_fill(E_Win *win);
dialog warning if loaded version is older or newer than current */
EAPI Eina_Bool e_util_module_config_check(const char *module_name, int loaded, int current);
-EAPI int e_util_container_desk_count_get(E_Container *con);
+EAPI int e_util_comp_desk_count_get(E_Comp *con);
EAPI E_Config_Binding_Key *e_util_binding_match(const Eina_List *bindlist, Ecore_Event_Key *ev, unsigned int *num, const E_Config_Binding_Key *skip);
EAPI Eina_Bool e_util_fullscreen_current_any(void);
EAPI Eina_Bool e_util_fullscreen_any(void);
@@ -73,21 +71,28 @@ EAPI char *e_util_string_append_quoted(char *str, size_t *size, size_t *len, con
EAPI void e_util_evas_objects_above_print(Evas_Object *o);
EAPI void e_util_evas_objects_above_print_smart(Evas_Object *o);
-EAPI Eina_Bool e_util_border_shadow_state_get(const E_Border *bd);
+EAPI Eina_Bool e_util_client_shadow_state_get(const E_Client *ec);
EAPI void e_util_string_list_free(Eina_List *l);
-static inline E_Container *
-e_util_container_current_get(void)
-{
- return e_container_current_get(e_manager_current_get());
-}
-
static inline E_Comp *
e_util_comp_current_get(void)
{
return e_manager_current_get()->comp;
}
+static inline void
+e_util_pointer_center(const E_Client *ec)
+{
+ int x = 0, y = 0;
+
+ if (ec->zone)
+ x = ec->zone->x, y = ec->zone->y;
+ if ((e_config->focus_policy != E_FOCUS_CLICK) && (!e_config->disable_all_pointer_warps))
+ ecore_evas_pointer_warp(ec->comp->ee,
+ x + ec->x + (ec->w / 2),
+ y + ec->y + (ec->h / 2));
+}
+
#endif
#endif
diff --git a/src/bin/e_widget_bgpreview.c b/src/bin/e_widget_bgpreview.c
index df724a469e..00883b6354 100644
--- a/src/bin/e_widget_bgpreview.c
+++ b/src/bin/e_widget_bgpreview.c
@@ -11,7 +11,7 @@ typedef struct _E_Widget_Desk_Data E_Widget_Desk_Data;
struct _E_Widget_Desk_Data
{
Evas_Object *icon, *thumb;
- int zone, con, x, y;
+ int zone, manager, x, y;
Ecore_Event_Handler *bg_upd_hdl;
Eina_Bool configurable : 1;
};
@@ -69,10 +69,10 @@ e_widget_bgpreview_desk_add(Evas *e, E_Zone *zone, int x, int y)
E_Widget_Desk_Data *dd;
const char *bgfile;
- bgfile = e_bg_file_get(zone->container->num, zone->num, x, y);
+ bgfile = e_bg_file_get(zone->comp->num, zone->num, x, y);
dd = E_NEW(E_Widget_Desk_Data, 1);
- dd->con = zone->container->num;
+ dd->manager = zone->comp->num;
dd->zone = zone->num;
dd->x = x;
dd->y = y;
@@ -233,13 +233,11 @@ _e_wid_desk_cb_config(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUS
if (!(dd = data)) return;
if (ev->button == 1)
{
- E_Container *con;
char buff[256];
- con = e_container_current_get(e_manager_current_get());
snprintf(buff, sizeof(buff), "%i %i %i %i",
- dd->con, dd->zone, dd->x, dd->y);
- e_configure_registry_call("internal/desk", con, buff);
+ dd->manager, dd->zone, dd->x, dd->y);
+ e_configure_registry_call("internal/desk", e_util_comp_current_get(), buff);
}
}
@@ -262,14 +260,14 @@ _e_wid_cb_bg_update(void *data, int type, void *event)
if (!(dd = data)) return ECORE_CALLBACK_PASS_ON;
ev = event;
- if (((ev->container < 0) || (dd->con == ev->container)) &&
+ if (((ev->manager < 0) || (dd->manager == ev->manager)) &&
((ev->zone < 0) || (dd->zone == ev->zone)) &&
((ev->desk_x < 0) || (dd->x == ev->desk_x)) &&
((ev->desk_y < 0) || (dd->y == ev->desk_y)))
{
const char *bgfile;
- bgfile = e_bg_file_get(dd->con, dd->zone, dd->x, dd->y);
+ bgfile = e_bg_file_get(dd->manager, dd->zone, dd->x, dd->y);
e_icon_file_edje_set(dd->thumb, bgfile, "e/desktop/background");
eina_stringshare_del(bgfile);
}
diff --git a/src/bin/e_widget_color_well.c b/src/bin/e_widget_color_well.c
index 31ce383857..2c19ed08ec 100644
--- a/src/bin/e_widget_color_well.c
+++ b/src/bin/e_widget_color_well.c
@@ -9,7 +9,6 @@ struct _E_Widget_Data
E_Color_Dialog *dia;
E_Color *color;
- E_Container *con; /* container to pop a color dialog up on */
Eina_Bool show_color_dialog;
Eina_Bool alpha_enabled;
};
@@ -43,10 +42,10 @@ _e_wid_signal_cb1(void *data, Evas_Object *obj __UNUSED__, const char *emission
wid = data;
wd = e_widget_data_get(wid);
- if (!wd->show_color_dialog || !wd->con) return;
+ if (!wd->show_color_dialog) return;
if (!wd->dia)
{
- wd->dia = e_color_dialog_new(wd->con, wd->color, wd->alpha_enabled);
+ wd->dia = e_color_dialog_new(NULL, wd->color, wd->alpha_enabled);
e_color_dialog_select_callback_set(wd->dia, _e_wid_color_select_cb, wd);
e_color_dialog_cancel_callback_set(wd->dia, _e_wid_color_cancel_cb, wd);
e_color_dialog_change_callback_set(wd->dia, _e_wid_color_change_cb, wd);
@@ -119,7 +118,6 @@ _e_wid_disable_hook(Evas_Object *obj)
/**
* Add a color well widget to an evas.
- * An optional E_Container may be passed in.
* If not NULL, when clicked a color dialog will pop up.
*/
Evas_Object *
@@ -127,7 +125,6 @@ e_widget_color_well_add_full(Evas *evas, E_Color *color, Eina_Bool show_color_di
{
Evas_Object *obj, *o;
E_Widget_Data *wd;
- E_Win *win;
obj = e_widget_add(evas);
e_widget_del_hook_set(obj, _e_wid_del_hook);
@@ -138,8 +135,6 @@ e_widget_color_well_add_full(Evas *evas, E_Color *color, Eina_Bool show_color_di
wd->obj = obj;
wd->color = color;
- win = e_win_evas_object_win_get(obj);
- wd->con = win->container;
wd->show_color_dialog = show_color_dialog;
wd->alpha_enabled = alpha_enabled;
@@ -172,7 +167,6 @@ e_widget_color_well_add_full(Evas *evas, E_Color *color, Eina_Bool show_color_di
/**
* Add a color well widget to an evas.
- * An optional E_Container may be passed in.
If not NULL, when clicked a color dialog will pop up.
*/
Evas_Object *
diff --git a/src/bin/e_win.c b/src/bin/e_win.c
index a93f229085..ef348d6b16 100644
--- a/src/bin/e_win.c
+++ b/src/bin/e_win.c
@@ -7,15 +7,20 @@ static void _e_win_state_update(E_Win *win);
static void _e_win_cb_move(Ecore_Evas *ee);
static void _e_win_cb_resize(Ecore_Evas *ee);
static void _e_win_cb_delete(Ecore_Evas *ee);
+static void _e_win_cb_destroy(Ecore_Evas *ee);
static void _e_win_cb_state(Ecore_Evas *ee);
/* local subsystem globals */
static Eina_List *wins = NULL;
+/* intercept elm_win operations so we talk directly to e_client */
+
+#include <Elementary.h>
+
typedef struct _Elm_Win_Trap_Ctx
{
- E_Border *border;
- Ecore_X_Window xwin;
+ E_Client *client;
+ Ecore_Window xwin;
Eina_Bool centered : 1;
Eina_Bool placed : 1;
} Elm_Win_Trap_Ctx;
@@ -23,13 +28,8 @@ typedef struct _Elm_Win_Trap_Ctx
static void
_elm_win_prop_update(Elm_Win_Trap_Ctx *ctx)
{
- ecore_x_icccm_size_pos_hints_set(ctx->xwin,
- ctx->border->placed, ctx->border->client.icccm.gravity,
- ctx->border->client.icccm.min_w, ctx->border->client.icccm.min_h,
- ctx->border->client.icccm.max_w, ctx->border->client.icccm.max_h,
- ctx->border->client.icccm.base_w, ctx->border->client.icccm.base_h,
- ctx->border->client.icccm.step_w, ctx->border->client.icccm.step_h,
- ctx->border->client.icccm.min_aspect, ctx->border->client.icccm.max_aspect);
+ EC_CHANGED(ctx->client);
+ ctx->client->changes.internal_props = 1;
}
static void *
@@ -45,11 +45,11 @@ _elm_win_trap_del(void *data, Evas_Object *o)
{
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN(ctx);
- if (ctx->border)
+ if (ctx->client)
{
- e_border_hide(ctx->border, 1);
- e_object_del(E_OBJECT(ctx->border));
- evas_object_data_set(o, "E_Border", NULL);
+ evas_object_hide(ctx->client->frame);
+ e_object_del(E_OBJECT(ctx->client));
+ evas_object_data_set(o, "E_Client", NULL);
}
free(ctx);
}
@@ -59,8 +59,8 @@ _elm_win_trap_hide(void *data, Evas_Object *o __UNUSED__)
{
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
- if (!ctx->border) return EINA_TRUE;
- e_border_hide(ctx->border, 1);
+ if (!ctx->client) return EINA_TRUE;
+ evas_object_hide(ctx->client->frame);
return EINA_FALSE;
}
@@ -69,44 +69,33 @@ _elm_win_trap_show(void *data, Evas_Object *o)
{
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
- if (!ctx->border)
+ if (!ctx->client)
{
Ecore_X_Window xwin = elm_win_xwindow_get(o);
- E_Container *con = e_util_container_window_find(xwin);
+ E_Client *ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, xwin);
Evas *e = evas_object_evas_get(o);
Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
- Ecore_X_Window_Type type;
-
- if (!con)
- {
- E_Manager *man = e_manager_current_get();
- EINA_SAFETY_ON_NULL_RETURN_VAL(man, EINA_TRUE);
- con = e_container_current_get(man);
- if (!con) con = e_container_number_get(man, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(con, EINA_TRUE);
- }
ctx->xwin = xwin;
- ctx->border = e_border_new(con, xwin, 0, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ctx->border, EINA_TRUE);
- if (ecore_x_netwm_window_type_get(xwin, &type))
+
+ if (ec)
+ ctx->client = ec;
+ else
{
- if (type == ECORE_X_WINDOW_TYPE_TOOLTIP)
- {
- eina_stringshare_replace(&ctx->border->bordername, "borderless");
- ctx->border->client.border.changed = 1;
- ctx->border->client.netwm.state.skip_pager =
- ctx->border->client.netwm.state.skip_taskbar = 1;
- ctx->border->client.icccm.accepts_focus = 0;
- }
+ E_Pixmap *cp;
+
+ cp = e_pixmap_new(E_PIXMAP_TYPE_X, xwin);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_TRUE);
+ ctx->client = e_client_new(e_comp_find_by_window(ecore_x_window_root_get(xwin)), cp, 0, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ctx->client, EINA_TRUE);
}
- ctx->border->placed = ctx->placed;
- ctx->border->internal = 1;
- ctx->border->internal_ecore_evas = ee;
- evas_object_data_set(o, "E_Border", ctx->border);
+ ctx->client->placed = ctx->placed;
+ ctx->client->internal = 1;
+ ctx->client->internal_ecore_evas = ee;
+ evas_object_data_set(o, "E_Client", ctx->client);
}
- if (ctx->centered) e_border_center(ctx->border);
- e_border_show(ctx->border);
+ if (ctx->centered) e_comp_object_util_center(ctx->client->frame);
+ evas_object_show(ctx->client->frame);
return EINA_FALSE;
}
@@ -117,8 +106,8 @@ _elm_win_trap_move(void *data, Evas_Object *o __UNUSED__, int x, int y)
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
ctx->centered = EINA_FALSE;
ctx->placed = EINA_TRUE;
- if (!ctx->border) return EINA_TRUE;
- e_border_move_without_border(ctx->border, x, y);
+ if (!ctx->client) return EINA_TRUE;
+ e_client_util_move_without_frame(ctx->client, x, y);
return EINA_FALSE;
}
@@ -128,9 +117,9 @@ _elm_win_trap_resize(void *data, Evas_Object *o __UNUSED__, int w, int h)
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
ctx->centered = EINA_FALSE;
- if (!ctx->border) return EINA_TRUE;
- e_border_resize_limit(ctx->border, &w, &h);
- e_border_resize_without_border(ctx->border, w, h);
+ if (!ctx->client) return EINA_TRUE;
+ e_client_resize_limit(ctx->client, &w, &h);
+ e_client_util_resize_without_frame(ctx->client, w, h);
return EINA_FALSE;
}
@@ -140,8 +129,8 @@ _elm_win_trap_center(void *data, Evas_Object *o __UNUSED__)
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
ctx->centered = EINA_TRUE;
- if (!ctx->border) return EINA_TRUE;
- if (ctx->centered) e_border_center(ctx->border);
+ if (!ctx->client) return EINA_TRUE;
+ if (ctx->centered) e_comp_object_util_center(ctx->client->frame);
return EINA_FALSE;
}
@@ -150,8 +139,8 @@ _elm_win_trap_lower(void *data, Evas_Object *o __UNUSED__)
{
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
- if (!ctx->border) return EINA_TRUE;
- e_border_lower(ctx->border);
+ if (!ctx->client) return EINA_TRUE;
+ evas_object_lower(ctx->client->frame);
return EINA_FALSE;
}
@@ -160,8 +149,8 @@ _elm_win_trap_raise(void *data, Evas_Object *o __UNUSED__)
{
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
- if (!ctx->border) return EINA_TRUE;
- e_border_raise(ctx->border);
+ if (!ctx->client) return EINA_TRUE;
+ evas_object_raise(ctx->client->frame);
return EINA_FALSE;
}
@@ -170,9 +159,10 @@ _elm_win_trap_activate(void *data, Evas_Object *o __UNUSED__)
{
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
- if (!ctx->border) return EINA_TRUE;
- e_border_focus_set(ctx->border, 1, 1);
- e_border_raise(ctx->border);
+ if (!ctx->client) return EINA_TRUE;
+ evas_object_focus_set(ctx->client->frame, 1);
+ if (!ctx->client->lock_user_stacking)
+ evas_object_raise(ctx->client->frame);
return EINA_FALSE;
}
@@ -181,9 +171,9 @@ _elm_win_trap_size_base_set(void *data, Evas_Object *o __UNUSED__, int w, int h)
{
Elm_Win_Trap_Ctx *ctx = data;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE);
- if (!ctx->border) return EINA_TRUE;
- ctx->border->client.icccm.base_w = w;
- ctx->border->client.icccm.base_h = h;
+ if (!ctx->client) return EINA_TRUE;
+ ctx->client->icccm.base_w = w;
+ ctx->client->icccm.base_h = h;
_elm_win_prop_update(ctx);
return EINA_FALSE;
@@ -233,10 +223,26 @@ static void
_e_win_hide(void *obj)
{
E_Win *win = obj;
-
- if (!win->border) return;
- if (win->border->visible) e_border_hide(win->border, 1);
- e_object_del(E_OBJECT(win->border));
+ Ecore_Cb cb;
+
+ if (!win->client) return;
+ e_object_ref(E_OBJECT(win));
+ cb = win->cb_delete;
+ win->cb_delete = NULL;
+ if (cb) cb(win);
+ if (!e_object_unref(E_OBJECT(win)))
+ return;
+ E_FREE_FUNC(win->pointer, e_object_del);
+ e_canvas_del(win->ecore_evas);
+ ecore_evas_callback_move_set(win->ecore_evas, NULL);
+ ecore_evas_callback_resize_set(win->ecore_evas, NULL);
+ ecore_evas_callback_delete_request_set(win->ecore_evas, NULL);
+ ecore_evas_callback_state_change_set(win->ecore_evas, NULL);
+ ecore_evas_callback_destroy_set(win->ecore_evas, NULL);
+ /* prevent any more rendering at this point */
+ ecore_evas_manual_render_set(win->ecore_evas, 1);
+ if (win->client->visible) evas_object_hide(win->client->frame);
+ e_object_del(E_OBJECT(win->client));
}
/* externally accessible functions */
@@ -266,7 +272,7 @@ e_win_elm_available(void)
}
EAPI E_Win *
-e_win_new(E_Container *con)
+e_win_new(E_Comp *c)
{
E_Win *win;
Evas_Object *obj;
@@ -274,15 +280,16 @@ e_win_new(E_Container *con)
win = E_OBJECT_ALLOC(E_Win, E_WIN_TYPE, _e_win_free);
if (!win) return NULL;
e_object_delay_del_set(E_OBJECT(win), _e_win_hide);
- win->container = con;
- win->ecore_evas = e_canvas_new(con->manager->root,
+ win->comp = c;
+ win->ecore_evas = e_canvas_new(c->man->root,
0, 0, 1, 1, 1, 0,
- &(win->evas_win));
+ (Ecore_X_Window*)&win->evas_win);
e_canvas_add(win->ecore_evas);
ecore_evas_data_set(win->ecore_evas, "E_Win", win);
ecore_evas_callback_move_set(win->ecore_evas, _e_win_cb_move);
ecore_evas_callback_resize_set(win->ecore_evas, _e_win_cb_resize);
ecore_evas_callback_delete_request_set(win->ecore_evas, _e_win_cb_delete);
+ ecore_evas_callback_destroy_set(win->ecore_evas, _e_win_cb_destroy);
ecore_evas_callback_state_change_set(win->ecore_evas, _e_win_cb_state);
win->evas = ecore_evas_get(win->ecore_evas);
ecore_evas_name_class_set(win->ecore_evas, "E", "_e_internal_window");
@@ -307,7 +314,7 @@ e_win_new(E_Container *con)
win->max_aspect = 0.0;
wins = eina_list_append(wins, win);
- win->pointer = e_pointer_window_new(win->evas_win, 0);
+ win->pointer = e_pointer_window_new(win->evas_win, 1);
return win;
}
@@ -316,35 +323,22 @@ e_win_show(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
- if (!win->border)
+ if (!win->client)
{
- _e_win_prop_update(win);
- ecore_evas_lower(win->ecore_evas);
- win->border = e_border_new(win->container, win->evas_win, 1, 1);
+ win->client = e_client_new(win->comp, e_pixmap_new(E_PIXMAP_TYPE_X, win->evas_win), 1, 1);
// dont need this - special stuff
-// win->border->ignore_first_unmap = 1;
+// win->client->ignore_first_unmap = 1;
if (!win->placed)
- win->border->re_manage = 0;
- win->border->internal = 1;
+ win->client->re_manage = 0;
if (win->ecore_evas)
- win->border->internal_ecore_evas = win->ecore_evas;
- if (win->state.no_remember) win->border->internal_no_remember = 1;
- win->border->internal_no_reopen = win->state.no_reopen;
+ win->client->internal_ecore_evas = win->ecore_evas;
+ if (win->state.no_remember) win->client->internal_no_remember = 1;
+ win->client->internal_no_reopen = win->state.no_reopen;
+ win->client->changes.size = win->client->changes.pos = 1;
+ EC_CHANGED(win->client);
}
_e_win_prop_update(win);
- if (win->state.dialog)
- {
- ecore_x_icccm_transient_for_set(win->evas_win, win->container->manager->root);
- ecore_x_netwm_window_type_set(win->evas_win, ECORE_X_WINDOW_TYPE_DIALOG);
- }
- else
- {
- ecore_x_icccm_transient_for_unset(win->evas_win);
- ecore_x_netwm_window_type_set(win->evas_win, ECORE_X_WINDOW_TYPE_NORMAL);
- }
- e_border_show(win->border);
-// done now by e_border specially
-// ecore_evas_show(win->ecore_evas);
+ ecore_evas_show(win->ecore_evas);
}
EAPI void
@@ -352,15 +346,11 @@ e_win_hide(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
- if (win->border) e_border_hide(win->border, 1);
+ if (win->client) evas_object_hide(win->client->frame);
}
/**
- * This will move window to position, automatically accounts border decorations.
- *
- * Don't need to account win->border->client_inset, it's done
- * automatically, so it will work fine with new windows that still
- * don't have the border.
+ * This will move window to position, automatically accounts client decorations.
*
* @parm x horizontal position to place window.
* @parm y vertical position to place window.
@@ -370,18 +360,14 @@ e_win_move(E_Win *win, int x, int y)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
- if (win->border)
- e_border_move_without_border(win->border, x, y);
+ if (win->client)
+ e_client_util_move_without_frame(win->client, x, y);
else
ecore_evas_move(win->ecore_evas, x, y);
}
/**
- * This will resize window, automatically accounts border decorations.
- *
- * Don't need to account win->border->client_inset, it's done
- * automatically, so it will work fine with new windows that still
- * don't have the border.
+ * This will resize window, automatically accounts client decorations.
*
* @parm w horizontal window size.
* @parm h vertical window size.
@@ -391,19 +377,15 @@ e_win_resize(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
- if (win->border)
- e_border_resize_without_border(win->border, w, h);
+ if (win->client)
+ e_client_util_resize_without_frame(win->client, w, h);
else
ecore_evas_resize(win->ecore_evas, w, h);
}
/**
* This will move and resize window to position, automatically
- * accounts border decorations.
- *
- * Don't need to account win->border->client_inset, it's done
- * automatically, so it will work fine with new windows that still
- * don't have the border.
+ * accounts client decorations.
*
* @parm x horizontal position to place window.
* @parm y vertical position to place window.
@@ -415,8 +397,8 @@ e_win_move_resize(E_Win *win, int x, int y, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
- if (win->border)
- e_border_move_resize_without_border(win->border, x, y, w, h);
+ if (win->client)
+ e_client_util_move_resize_without_frame(win->client, x, y, w, h);
else
ecore_evas_move_resize(win->ecore_evas, x, y, w, h);
}
@@ -426,8 +408,8 @@ e_win_raise(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
- if (win->border)
- e_border_raise(win->border);
+ if (win->client)
+ evas_object_raise(win->client->frame);
}
EAPI void
@@ -435,8 +417,8 @@ e_win_lower(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
- if (win->border)
- e_border_lower(win->border);
+ if (win->client)
+ evas_object_lower(win->client->frame);
}
EAPI void
@@ -445,7 +427,7 @@ e_win_placed_set(E_Win *win, int placed)
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->placed = placed;
- if (win->border)
+ if (win->client)
_e_win_prop_update(win);
}
@@ -526,10 +508,12 @@ e_win_size_min_set(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
+ w = MIN(w, 32768);
+ h = MIN(h, 32768);
win->min_w = w;
win->min_h = h;
- if (win->border)
- _e_win_prop_update(win);
+ if (!win->client) return;
+ _e_win_prop_update(win);
}
EAPI void
@@ -537,10 +521,12 @@ e_win_size_max_set(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
+ w = MIN(w, 32768);
+ h = MIN(h, 32768);
win->max_w = w;
win->max_h = h;
- if (win->border)
- _e_win_prop_update(win);
+ if (!win->client) return;
+ _e_win_prop_update(win);
}
EAPI void
@@ -548,10 +534,12 @@ e_win_size_base_set(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
+ w = MIN(w, 32768);
+ h = MIN(h, 32768);
win->base_w = w;
win->base_h = h;
- if (win->border)
- _e_win_prop_update(win);
+ if (!win->client) return;
+ _e_win_prop_update(win);
}
EAPI void
@@ -561,8 +549,8 @@ e_win_step_set(E_Win *win, int x, int y)
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->step_x = x;
win->step_y = y;
- if (win->border)
- _e_win_prop_update(win);
+ if (!win->client) return;
+ _e_win_prop_update(win);
}
EAPI void
@@ -596,8 +584,6 @@ e_win_centered_set(E_Win *win, int centered)
win->state.centered = 1;
_e_win_state_update(win);
}
- if ((win->border) && (centered))
- e_border_center(win->border);
}
EAPI void
@@ -641,35 +627,17 @@ e_win_evas_object_win_get(Evas_Object *obj)
}
EAPI void
-e_win_border_icon_set(E_Win *win, const char *icon)
+e_win_client_icon_set(E_Win *win, const char *icon)
{
- E_Border *border;
-
- border = win->border;
- if (!border) return;
- if (border->internal_icon)
- {
- eina_stringshare_del(border->internal_icon);
- border->internal_icon = NULL;
- }
- if (icon)
- border->internal_icon = eina_stringshare_add(icon);
+ if (win->client)
+ eina_stringshare_replace(&win->client->internal_icon, icon);
}
EAPI void
-e_win_border_icon_key_set(E_Win *win, const char *key)
+e_win_client_icon_key_set(E_Win *win, const char *key)
{
- E_Border *border;
-
- border = win->border;
- if (!border) return;
- if (border->internal_icon_key)
- {
- eina_stringshare_del(border->internal_icon_key);
- border->internal_icon_key = NULL;
- }
- if (key)
- border->internal_icon_key = eina_stringshare_add(key);
+ if (win->client)
+ eina_stringshare_replace(&win->client->internal_icon_key, key);
}
/* local subsystem functions */
@@ -679,17 +647,12 @@ _e_win_free(E_Win *win)
if (win->pointer)
e_object_del(E_OBJECT(win->pointer));
- if (win->border)
+ if (win->ecore_evas)
{
ecore_evas_callback_move_set(win->ecore_evas, NULL);
ecore_evas_callback_resize_set(win->ecore_evas, NULL);
- ecore_evas_callback_delete_request_set(win->ecore_evas, NULL);
ecore_evas_callback_state_change_set(win->ecore_evas, NULL);
- }
- else
- {
- e_canvas_del(win->ecore_evas);
- ecore_evas_free(win->ecore_evas);
+ ecore_evas_callback_destroy_set(win->ecore_evas, NULL);
}
wins = eina_list_remove(wins, win);
free(win);
@@ -698,28 +661,29 @@ _e_win_free(E_Win *win)
static void
_e_win_prop_update(E_Win *win)
{
- ecore_x_icccm_size_pos_hints_set(win->evas_win,
- win->placed, ECORE_X_GRAVITY_NW,
- win->min_w, win->min_h,
- win->max_w, win->max_h,
- win->base_w, win->base_h,
- win->step_x, win->step_y,
- win->min_aspect, win->max_aspect);
+ if (!win->client) return;
+ EC_CHANGED(win->client);
+ win->client->icccm.min_w = win->min_w;
+ win->client->icccm.min_h = win->min_h;
+ win->client->icccm.max_w = win->max_w;
+ win->client->icccm.max_h = win->max_h;
+ win->client->icccm.base_w = win->base_w;
+ win->client->icccm.base_h = win->base_h;
+ win->client->icccm.step_w = win->step_x;
+ win->client->icccm.step_h = win->step_y;
+ win->client->icccm.min_aspect = win->min_aspect;
+ win->client->icccm.max_aspect = win->max_aspect;
+ win->client->changes.internal_props = 1;
}
static void
_e_win_state_update(E_Win *win)
{
- Ecore_X_Atom state[1];
- int num = 0;
-
+ if (!win->client) return;
+ EC_CHANGED(win->client);
+ win->client->changes.internal_state = 1;
if (win->state.centered)
- state[num++] = E_ATOM_WINDOW_STATE_CENTERED;
-
- if (num)
- ecore_x_window_prop_card32_set(win->evas_win, E_ATOM_WINDOW_STATE, state, num);
- else
- ecore_x_window_prop_property_del(win->evas_win, E_ATOM_WINDOW_STATE);
+ e_comp_object_util_center(win->client->frame);
}
static void
@@ -729,8 +693,8 @@ _e_win_cb_move(Ecore_Evas *ee)
win = ecore_evas_data_get(ee, "E_Win");
if (!win) return;
- if (win->border)
- win->x = win->border->x, win->y = win->border->y;
+ if (win->client)
+ win->x = win->client->x, win->y = win->client->y;
else
ecore_evas_geometry_get(win->ecore_evas, &win->x, &win->y, NULL, NULL);
if (win->cb_move) win->cb_move(win);
@@ -748,13 +712,37 @@ _e_win_cb_resize(Ecore_Evas *ee)
}
static void
+_e_win_cb_destroy(Ecore_Evas *ee)
+{
+ E_Win *win;
+
+ win = ecore_evas_data_get(ee, "E_Win");
+ if (!win) return;
+ e_object_ref(E_OBJECT(win));
+ if (win->cb_delete) win->cb_delete(win);
+ win->cb_delete = NULL;
+ e_object_unref(E_OBJECT(win));
+ E_FREE_FUNC(win->pointer, e_object_del);
+ if (!win->client) return;
+ win->client->internal_ecore_evas = NULL;
+ e_canvas_del(ee);
+ e_pixmap_usable_set(win->client->pixmap, 0);
+ if (win->client->visible) evas_object_hide(win->client->frame);
+ win->ecore_evas = NULL;
+ e_object_del(E_OBJECT(win->client));
+}
+
+static void
_e_win_cb_delete(Ecore_Evas *ee)
{
E_Win *win;
win = ecore_evas_data_get(ee, "E_Win");
if (!win) return;
+ e_object_ref(E_OBJECT(win));
if (win->cb_delete) win->cb_delete(win);
+ win->cb_delete = NULL;
+ e_object_unref(E_OBJECT(win));
}
static void
@@ -764,7 +752,8 @@ _e_win_cb_state(Ecore_Evas *ee)
win = ecore_evas_data_get(ee, "E_Win");
if (!win) return;
- if (!win->border) return;
- win->border->changed = win->border->changes.size = 1;
+ if (!win->client) return;
+ EC_CHANGED(win->client);
+ win->client->changes.size = 1;
}
diff --git a/src/bin/e_win.h b/src/bin/e_win.h
index 4845d5c1f0..e63137e755 100644
--- a/src/bin/e_win.h
+++ b/src/bin/e_win.h
@@ -20,11 +20,11 @@ struct _E_Win
E_Object e_obj_inherit;
int x, y, w, h;
- E_Container *container;
- E_Border *border;
+ E_Comp *comp;
+ E_Client *client;
Ecore_Evas *ecore_evas;
Evas *evas;
- Ecore_X_Window evas_win;
+ Ecore_Window evas_win;
unsigned char placed : 1;
int min_w, min_h, max_w, max_h, base_w, base_h;
int step_x, step_y;
@@ -47,7 +47,7 @@ struct _E_Win
EINTERN int e_win_init (void);
EINTERN int e_win_shutdown (void);
EAPI Eina_Bool e_win_elm_available(void);
-EAPI E_Win *e_win_new (E_Container *con);
+EAPI E_Win *e_win_new (E_Comp *c);
EAPI void e_win_show (E_Win *win);
EAPI void e_win_hide (E_Win *win);
EAPI void e_win_move (E_Win *win, int x, int y);
@@ -71,8 +71,8 @@ EAPI void e_win_size_base_set (E_Win *win, int w, int h);
EAPI void e_win_step_set (E_Win *win, int x, int y);
EAPI void e_win_name_class_set (E_Win *win, const char *name, const char *class);
EAPI void e_win_title_set (E_Win *win, const char *title);
-EAPI void e_win_border_icon_set (E_Win *win, const char *icon);
-EAPI void e_win_border_icon_key_set(E_Win *win, const char *key);
+EAPI void e_win_client_icon_set (E_Win *win, const char *icon);
+EAPI void e_win_client_icon_key_set(E_Win *win, const char *key);
EAPI void e_win_centered_set (E_Win *win, int centered);
EAPI void e_win_dialog_set (E_Win *win, int dialog);
EAPI void e_win_no_remember_set (E_Win *win, int no_remember);
diff --git a/src/bin/e_xinerama.c b/src/bin/e_xinerama.c
index 43f7ac8cac..a975bad329 100644
--- a/src/bin/e_xinerama.c
+++ b/src/bin/e_xinerama.c
@@ -11,7 +11,6 @@ static Eina_List *fake_screens = NULL;
EINTERN int
e_xinerama_init(void)
{
- _e_xinerama_update();
return 1;
}
@@ -44,6 +43,15 @@ e_xinerama_screens_all_get(void)
}
EAPI void
+e_xinerama_screens_set(Eina_List *screens)
+{
+ E_FREE_LIST(all_screens, free);
+ chosen_screens = eina_list_free(chosen_screens);
+ all_screens = screens;
+ _e_xinerama_update();
+}
+
+EAPI void
e_xinerama_fake_screen_add(int x, int y, int w, int h)
{
E_Screen *scr;
@@ -68,78 +76,18 @@ e_xinerama_fake_screens_exist(void)
static void
_e_xinerama_clean(void)
{
- E_FREE_LIST(all_screens, E_FREE);
+ E_FREE_LIST(all_screens, free);
chosen_screens = eina_list_free(chosen_screens);
- E_FREE_LIST(fake_screens, E_FREE);
+ E_FREE_LIST(fake_screens, free);
}
static void
_e_xinerama_update(void)
{
- int n;
- Ecore_X_Window *roots;
Eina_List *l;
E_Screen *scr;
+ unsigned int n = 0;
- roots = ecore_x_window_root_list(&n);
- if (roots)
- {
- int i;
- int rw, rh;
- Ecore_X_Window root;
-
- /* more than 1 root window - xinerama wont be active */
- if (n > 1)
- {
- free(roots);
- return;
- }
- /* first (and only) root window */
- root = roots[0];
- free(roots);
- /* get root size */
- ecore_x_window_size_get(root, &rw, &rh);
- /* get number of xinerama screens */
- n = ecore_x_xinerama_screen_count_get();
- if (n < 1)
- {
- E_Screen *screen;
-
- screen = E_NEW(E_Screen, 1);
- screen->screen = 0;
- screen->escreen = screen->screen;
- screen->x = 0;
- screen->y = 0;
- screen->w = rw;
- screen->h = rh;
- all_screens = eina_list_append(all_screens, screen);
- }
- else
- {
- for (i = 0; i < n; i++)
- {
- int x, y, w, h;
-
- /* get each xinerama screen geometry */
- if (ecore_x_xinerama_screen_geometry_get(i, &x, &y, &w, &h))
- {
- E_Screen *screen;
-
- INF("E18 INIT: XINERAMA SCREEN: [%i][%i], %ix%i+%i+%i",
- i, i, w, h, x, y);
- /* add it to our list */
- screen = E_NEW(E_Screen, 1);
- screen->screen = i;
- screen->escreen = screen->screen;
- screen->x = x;
- screen->y = y;
- screen->w = w;
- screen->h = h;
- all_screens = eina_list_append(all_screens, screen);
- }
- }
- }
- }
/* now go through all_screens... and build a list of chosen screens */
EINA_LIST_FOREACH(all_screens, l, scr)
{
@@ -182,11 +130,10 @@ _e_xinerama_update(void)
eina_list_count(chosen_screens),
_e_xinerama_cb_screen_sort);
INF("======================= screens:");
- n = 0;
EINA_LIST_FOREACH(chosen_screens, l, scr)
{
scr->escreen = n;
- INF("E18 INIT: XINERAMA CHOSEN: [%i][%i], %ix%i+%i+%i",
+ INF("E19 INIT: XINERAMA CHOSEN: [%i][%i], %ix%i+%i+%i",
scr->screen, scr->escreen, scr->w, scr->h, scr->x, scr->y);
n++;
}
diff --git a/src/bin/e_xinerama.h b/src/bin/e_xinerama.h
index 544154b7f0..f802bc3ffe 100644
--- a/src/bin/e_xinerama.h
+++ b/src/bin/e_xinerama.h
@@ -17,6 +17,7 @@ EINTERN int e_xinerama_shutdown(void);
EAPI void e_xinerama_update(void);
EAPI const Eina_List *e_xinerama_screens_get(void);
EAPI const Eina_List *e_xinerama_screens_all_get(void);
+EAPI void e_xinerama_screens_set(Eina_List *screens);
EAPI void e_xinerama_fake_screen_add(int x, int y, int w, int h);
EAPI Eina_Bool e_xinerama_fake_screens_exist(void);
diff --git a/src/bin/e_xsettings.c b/src/bin/e_xsettings.c
index f1aacb034e..ba4d1a716b 100644
--- a/src/bin/e_xsettings.c
+++ b/src/bin/e_xsettings.c
@@ -28,6 +28,7 @@ struct _Settings_Manger
Ecore_Timer *timer_retry;
unsigned long serial;
Ecore_X_Atom _atom_xsettings_screen;
+ Eina_Bool enabled : 1;
};
struct _Setting
@@ -90,14 +91,14 @@ _e_xsettings_selection_owner_set(Settings_Manager *sm)
Eina_Bool ret;
atom = _e_xsettings_atom_screen_get(sm->man->num);
- ecore_x_selection_owner_set(sm->selection, atom, ecore_x_current_time_get());
+ ecore_x_selection_owner_set(sm->man->comp->cm_selection, atom, ecore_x_current_time_get());
ecore_x_sync();
cur_selection = ecore_x_selection_owner_get(atom);
- ret = (cur_selection == sm->selection);
+ ret = (cur_selection == sm->man->comp->cm_selection);
if (!ret)
ERR("XSETTINGS: tried to set selection to %#x, but got %#x",
- sm->selection, cur_selection);
+ (unsigned int)sm->man->comp->cm_selection, cur_selection);
return ret;
}
@@ -105,15 +106,12 @@ _e_xsettings_selection_owner_set(Settings_Manager *sm)
static void
_e_xsettings_deactivate(Settings_Manager *sm)
{
- Ecore_X_Window old;
-
- if (sm->selection == 0) return;
+ Ecore_X_Atom atom;
- old = sm->selection;
- sm->selection = 0;
- _e_xsettings_selection_owner_set(sm);
+ atom = _e_xsettings_atom_screen_get(sm->man->num);
+ ecore_x_selection_owner_set(0, atom, ecore_x_current_time_get());
ecore_x_sync();
- ecore_x_window_free(old);
+ sm->enabled = 0;
}
static Eina_Bool
@@ -122,29 +120,22 @@ _e_xsettings_activate(Settings_Manager *sm)
Ecore_X_Atom atom;
Ecore_X_Window old_win;
- if (sm->selection != 0) return 1;
+ if (sm->enabled) return 1;
atom = _e_xsettings_atom_screen_get(sm->man->num);
old_win = ecore_x_selection_owner_get(atom);
if (old_win != 0) return 0;
- sm->selection = ecore_x_window_input_new(0, 0, 0, 1, 1);
- if (sm->selection == 0)
- return 0;
-
if (!_e_xsettings_selection_owner_set(sm))
- {
- ecore_x_window_free(sm->selection);
- sm->selection = 0;
- return 0;
- }
+ return 0;
- ecore_x_client_message32_send(e_manager_current_get()->root, _atom_manager,
+ ecore_x_client_message32_send(sm->man->root, _atom_manager,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
ecore_x_current_time_get(), atom,
- sm->selection, 0, 0);
+ sm->man->comp->cm_selection, 0, 0);
if (settings) _e_xsettings_apply(sm);
+ sm->enabled = 1;
return 1;
}
@@ -361,7 +352,7 @@ _e_xsettings_apply(Settings_Manager *sm)
EINA_LIST_FOREACH(settings, l, s)
pos = _e_xsettings_copy(pos, s);
- ecore_x_window_prop_property_set(sm->selection,
+ ecore_x_window_prop_property_set(sm->man->comp->cm_selection,
_atom_xsettings,
_atom_xsettings,
8, data, len);
@@ -375,27 +366,33 @@ _e_xsettings_update(void)
Eina_List *l;
EINA_LIST_FOREACH(managers, l, sm)
- if (sm->selection) _e_xsettings_apply(sm);
+ if (sm->man->comp->cm_selection) _e_xsettings_apply(sm);
}
static void
_e_xsettings_gtk_icon_update(void)
{
- Eina_List *l;
- E_Border *bd;
-
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- if (bd->client.icccm.state) ecore_x_client_message8_send(bd->client.win, _atom_gtk_iconthemes, NULL, 0);
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Comp *c;
+
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ if (ec->icccm.state)
+ ecore_x_client_message8_send(e_client_util_win_get(ec), _atom_gtk_iconthemes, NULL, 0);
}
static void
_e_xsettings_gtk_rcfiles_update(void)
{
- Eina_List *l;
- E_Border *bd;
-
- EINA_LIST_FOREACH(e_border_client_list(), l, bd)
- if (bd->client.icccm.state) ecore_x_client_message8_send(bd->client.win, _atom_gtk_rcfiles, NULL, 0);
+ const Eina_List *l, *ll;
+ E_Client *ec;
+ E_Comp *c;
+
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->clients, ll, ec)
+ if (ec->icccm.state)
+ ecore_x_client_message8_send(e_client_util_win_get(ec), _atom_gtk_rcfiles, NULL, 0);
}
static void
diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c
index 1ada6114f5..efd54afd8c 100644
--- a/src/bin/e_zone.c
+++ b/src/bin/e_zone.c
@@ -1,6 +1,6 @@
#include "e.h"
-/* E_Zone is a child object of E_Container. There is one zone per screen
+/* E_Zone is a child object of E_Comp. There is one zone per screen
* in a xinerama setup. Each zone has one or more desktops.
*/
@@ -15,21 +15,6 @@ static void _e_zone_cb_bg_mouse_up(void *data,
void *event_info);
static void _e_zone_event_zone_desk_count_set_free(void *data,
void *ev);
-static Eina_Bool _e_zone_cb_mouse_in(void *data,
- int type,
- void *event);
-static Eina_Bool _e_zone_cb_mouse_out(void *data,
- int type,
- void *event);
-static Eina_Bool _e_zone_cb_mouse_down(void *data,
- int type,
- void *event);
-static Eina_Bool _e_zone_cb_mouse_up(void *data,
- int type,
- void *event);
-static Eina_Bool _e_zone_cb_mouse_move(void *data,
- int type,
- void *event);
static Eina_Bool _e_zone_cb_desk_after_show(void *data,
int type,
void *event);
@@ -41,10 +26,8 @@ static void _e_zone_event_add_free(void *data,
static void _e_zone_event_del_free(void *data,
void *ev);
static void _e_zone_object_del_attach(void *o);
-static E_Zone_Edge _e_zone_detect_edge(E_Zone *zone,
- Ecore_X_Window win);
+static E_Zone_Edge _e_zone_detect_edge(E_Zone *zone, Evas_Object *obj);
static void _e_zone_edge_move_resize(E_Zone *zone);
-static void _e_zone_border_geometry_update(E_Zone *zone);
EAPI int E_EVENT_ZONE_DESK_COUNT_SET = 0;
EAPI int E_EVENT_POINTER_WARP = 0;
@@ -85,21 +68,13 @@ e_zone_shutdown(void)
EAPI void
e_zone_all_edge_flip_eval(void)
{
- Eina_List *l, *ll, *lll;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *l, *ll;
+ E_Comp *c;
E_Zone *zone;
- EINA_LIST_FOREACH(e_manager_list(), l, man)
- {
- EINA_LIST_FOREACH(man->containers, ll, con)
- {
- EINA_LIST_FOREACH(con->zones, lll, zone)
- {
- e_zone_edge_flip_eval(zone);
- }
- }
- }
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ e_zone_edge_flip_eval(zone);
}
static void
@@ -109,9 +84,9 @@ _e_zone_black_new(E_Zone *zone)
char name[256];
if (zone->black_ecore_evas) return;
- zone->black_ecore_evas = e_canvas_new(zone->container->win,
+ zone->black_ecore_evas = e_canvas_new(zone->comp->win,
zone->x, zone->y, 1, 1, 1, 1,
- &(zone->black_win));
+ (Ecore_X_Window*)&zone->black_win);
e_canvas_add(zone->black_ecore_evas);
ecore_evas_layer_set(zone->black_ecore_evas, 6);
zone->black_evas = ecore_evas_get(zone->black_ecore_evas);
@@ -161,14 +136,134 @@ _e_zone_black_unget(E_Zone *zone)
}
}
+static void
+_e_zone_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_In *ev = event_info;
+ E_Event_Zone_Edge *zev;
+ E_Zone_Edge edge;
+ E_Zone *zone = data;
+ const Eina_List *l;
+ Ecore_Evas *ee;
+
+ edge = _e_zone_detect_edge(zone, obj);
+ if (edge == E_ZONE_EDGE_NONE) return;
+
+ zev = E_NEW(E_Event_Zone_Edge, 1);
+ zev->zone = zone;
+ zev->edge = edge;
+ zev->x = ev->output.x;
+ zev->y = ev->output.y;
+ zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
+ EINA_LIST_FOREACH(e_canvas_list(), l, ee)
+ {
+ /* FIXME: comp */
+ if (!evas_pointer_button_down_mask_get(ecore_evas_get(ee))) continue;
+ zev->drag = 1;
+ break;
+ }
+
+ ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL);
+ e_bindings_edge_in_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
+}
+
+static void
+_e_zone_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Out *ev = event_info;
+ E_Event_Zone_Edge *zev;
+ E_Zone_Edge edge;
+ E_Zone *zone = data;
+ const Eina_List *l;
+ Ecore_Evas *ee;
+
+ edge = _e_zone_detect_edge(zone, obj);
+ if (edge == E_ZONE_EDGE_NONE) return;
+
+ zev = E_NEW(E_Event_Zone_Edge, 1);
+ zev->zone = zone;
+ zev->edge = edge;
+ zev->x = ev->output.x;
+ zev->y = ev->output.y;
+ zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
+ EINA_LIST_FOREACH(e_canvas_list(), l, ee)
+ {
+ /* FIXME: comp */
+ if (!evas_pointer_button_down_mask_get(ecore_evas_get(ee))) continue;
+ zev->drag = 1;
+ break;
+ }
+
+ ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
+ e_bindings_edge_out_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
+}
+
+static void
+_e_zone_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Down *ev = event_info;
+ E_Event_Zone_Edge *zev;
+ E_Zone_Edge edge;
+ E_Zone *zone = data;
+
+ edge = _e_zone_detect_edge(zone, obj);
+ if (edge == E_ZONE_EDGE_NONE) return;
+
+ zev = E_NEW(E_Event_Zone_Edge, 1);
+ zev->zone = zone;
+ zev->edge = edge;
+ zev->x = ev->output.x;
+ zev->y = ev->output.y;
+ zev->button = ev->button;
+ zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
+ ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
+ e_bindings_edge_down_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
+}
+
+static void
+_e_zone_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ E_Event_Zone_Edge *zev;
+ E_Zone_Edge edge;
+ E_Zone *zone = data;
+
+ edge = _e_zone_detect_edge(zone, obj);
+ if (edge == E_ZONE_EDGE_NONE) return;
+
+ zev = E_NEW(E_Event_Zone_Edge, 1);
+ zev->zone = zone;
+ zev->edge = edge;
+ zev->x = ev->output.x;
+ zev->y = ev->output.y;
+ zev->button = ev->button;
+ zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
+ ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
+ e_bindings_edge_up_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
+}
+
+static void
+_e_zone_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Move *ev = event_info;
+ E_Event_Zone_Edge *zev;
+ E_Zone_Edge edge;
+ E_Zone *zone = data;
+
+ edge = _e_zone_detect_edge(zone, obj);
+ if (edge == E_ZONE_EDGE_NONE) return;
+
+ zev = E_NEW(E_Event_Zone_Edge, 1);
+ zev->zone = zone;
+ zev->edge = edge;
+ zev->x = ev->cur.output.x;
+ zev->y = ev->cur.output.y;
+ zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
+ ecore_event_add(E_EVENT_ZONE_EDGE_MOVE, zev, NULL, NULL);
+}
+
EAPI E_Zone *
-e_zone_new(E_Container *con,
- int num,
- int id,
- int x,
- int y,
- int w,
- int h)
+e_zone_new(E_Comp *c, int num, int id, int x, int y, int w, int h)
{
E_Zone *zone;
Evas_Object *o;
@@ -178,7 +273,7 @@ e_zone_new(E_Container *con,
zone = E_OBJECT_ALLOC(E_Zone, E_ZONE_TYPE, _e_zone_free);
if (!zone) return NULL;
- zone->container = con;
+ zone->comp = c;
zone->x = x;
zone->y = y;
@@ -186,53 +281,37 @@ e_zone_new(E_Container *con,
zone->h = h;
zone->num = num;
zone->id = id;
- e_zone_useful_geometry_dirty(zone);
- //printf("@@@@@@@@@@ e_zone_new: %i %i | %i %i %ix%i = %p\n", num, id, x, y, w, h, zone);
+ zone->useful_geometry.dirty = 1;
+ zone->useful_geometry.x = -1;
+ zone->useful_geometry.y = -1;
+ zone->useful_geometry.w = -1;
+ zone->useful_geometry.h = -1;
- zone->handlers =
- eina_list_append(zone->handlers,
- ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN,
- _e_zone_cb_mouse_in, zone));
- zone->handlers =
- eina_list_append(zone->handlers,
- ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT,
- _e_zone_cb_mouse_out, zone));
- zone->handlers =
- eina_list_append(zone->handlers,
- ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
- _e_zone_cb_mouse_down, zone));
- zone->handlers =
- eina_list_append(zone->handlers,
- ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
- _e_zone_cb_mouse_up, zone));
- zone->handlers =
- eina_list_append(zone->handlers,
- ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
- _e_zone_cb_mouse_move, zone));
- zone->handlers =
- eina_list_append(zone->handlers,
- ecore_event_handler_add(E_EVENT_DESK_AFTER_SHOW,
- _e_zone_cb_desk_after_show, zone));
+ //printf("@@@@@@@@@@ e_zone_new: %i %i | %i %i %ix%i = %p\n", num, id, x, y, w, h, zone);
+ E_LIST_HANDLER_APPEND(zone->handlers, E_EVENT_DESK_AFTER_SHOW,
+ _e_zone_cb_desk_after_show, zone);
snprintf(name, sizeof(name), "Zone %d", zone->num);
zone->name = eina_stringshare_add(name);
- con->zones = eina_list_append(con->zones, zone);
+ c->zones = eina_list_append(c->zones, zone);
- o = evas_object_rectangle_add(con->bg_evas);
+ o = evas_object_rectangle_add(c->evas);
zone->bg_clip_object = o;
evas_object_repeat_events_set(o, 1);
+ evas_object_layer_set(o, E_LAYER_BG);
evas_object_name_set(o, "zone->bg_clip_object");
evas_object_move(o, x, y);
evas_object_resize(o, w, h);
evas_object_color_set(o, 255, 255, 255, 255);
evas_object_show(o);
- o = evas_object_rectangle_add(con->bg_evas);
+ o = evas_object_rectangle_add(c->evas);
zone->bg_event_object = o;
evas_object_name_set(o, "zone->bg_event_object");
evas_object_clip_set(o, zone->bg_clip_object);
+ evas_object_layer_set(o, E_LAYER_BG);
evas_object_repeat_events_set(o, 1);
evas_object_move(o, x, y);
evas_object_resize(o, w, h);
@@ -255,12 +334,15 @@ e_zone_new(E_Container *con,
_e_zone_black_new(zone);
+ e_zone_all_edge_flip_eval();
+
+ if (starting) return zone;
+
ev = E_NEW(E_Event_Zone_Add, 1);
ev->zone = zone;
e_object_ref(E_OBJECT(ev->zone));
ecore_event_add(E_EVENT_ZONE_ADD, ev, _e_zone_event_add_free, NULL);
- e_zone_all_edge_flip_eval();
return zone;
}
@@ -304,7 +386,6 @@ e_zone_move(E_Zone *zone,
ecore_evas_move(zone->black_ecore_evas, zone->x, zone->y);
ecore_evas_resize(zone->black_ecore_evas, zone->w, zone->h);
}
- _e_zone_border_geometry_update(zone);
}
EAPI void
@@ -337,10 +418,9 @@ e_zone_resize(E_Zone *zone,
ecore_evas_move(zone->black_ecore_evas, zone->x, zone->y);
ecore_evas_resize(zone->black_ecore_evas, zone->w, zone->h);
}
- _e_zone_border_geometry_update(zone);
}
-EAPI void
+EAPI Eina_Bool
e_zone_move_resize(E_Zone *zone,
int x,
int y,
@@ -349,11 +429,11 @@ e_zone_move_resize(E_Zone *zone,
{
E_Event_Zone_Move_Resize *ev;
- E_OBJECT_CHECK(zone);
+ E_OBJECT_CHECK_RETURN(zone, EINA_FALSE);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
if ((x == zone->x) && (y == zone->y) && (w == zone->w) && (h == zone->h))
- return;
+ return EINA_FALSE;
zone->x = x;
zone->y = y;
@@ -381,52 +461,29 @@ e_zone_move_resize(E_Zone *zone,
ecore_evas_move(zone->black_ecore_evas, zone->x, zone->y);
ecore_evas_resize(zone->black_ecore_evas, zone->w, zone->h);
}
- _e_zone_border_geometry_update(zone);
-}
-
-EAPI void
-e_zone_fullscreen_set(E_Zone *zone,
- int on)
-{
- E_OBJECT_CHECK(zone);
- E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
-
- if ((!zone->fullscreen) && (on))
- {
- _e_zone_black_get(zone);
- ecore_evas_show(zone->black_ecore_evas);
- e_container_window_raise(zone->container, zone->black_win, E_LAYER_POPUP);
- zone->fullscreen = 1;
- }
- else if ((zone->fullscreen) && (!on))
- {
- ecore_evas_hide(zone->black_ecore_evas);
- zone->fullscreen = 0;
- _e_zone_black_unget(zone);
- }
+ return EINA_TRUE;
}
EAPI E_Zone *
-e_zone_current_get(E_Container *con)
+e_zone_current_get(E_Comp *c)
{
Eina_List *l = NULL;
E_Zone *zone;
- E_OBJECT_CHECK_RETURN(con, NULL);
- E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
+ E_OBJECT_CHECK_RETURN(c, NULL);
if (!starting)
{
int x, y;
- ecore_x_pointer_xy_get(con->win, &x, &y);
- EINA_LIST_FOREACH(con->zones, l, zone)
+ ecore_x_pointer_xy_get(c->win, &x, &y);
+ EINA_LIST_FOREACH(c->zones, l, zone)
{
if (E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h))
return zone;
}
}
- if (!con->zones) return NULL;
- return (E_Zone *)eina_list_data_get(con->zones);
+ if (!c->zones) return NULL;
+ return eina_list_data_get(c->zones);
}
EAPI void
@@ -457,13 +514,13 @@ e_zone_flip_coords_handle(E_Zone *zone,
if (!e_config->edge_flip_dragging || zone->flip.switching) return;
/* if we have only 1 row we can flip up/down even if we have xinerama */
- if (eina_list_count(zone->container->zones) > 1)
+ if (eina_list_count(zone->comp->zones) > 1)
{
Eina_List *zones;
E_Zone *next_zone;
int cx, cy;
- zones = zone->container->zones;
+ zones = zone->comp->zones;
next_zone = (E_Zone *)eina_list_data_get(zones);
cx = next_zone->x;
cy = next_zone->y;
@@ -474,7 +531,7 @@ e_zone_flip_coords_handle(E_Zone *zone,
if (next_zone->y != cy) one_row = 0;
}
}
- if (eina_list_count(zone->container->manager->containers) > 1)
+ if (eina_list_count(e_comp_list()) > 1)
goto noflip;
if (!E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h))
goto noflip;
@@ -585,9 +642,8 @@ e_zone_desk_count_set(E_Zone *zone,
{
E_Desk **new_desks;
E_Desk *desk, *new_desk;
- E_Border *bd;
+ E_Client *ec;
E_Event_Zone_Desk_Count_Set *ev;
- E_Border_List *bl;
int x, y, xx, yy, moved, nx, ny;
E_OBJECT_CHECK(zone);
@@ -634,13 +690,11 @@ e_zone_desk_count_set(E_Zone *zone,
{
desk = zone->desks[x + (y * zone->desk_x_count)];
- bl = e_container_border_list_first(zone->container);
- while ((bd = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(zone->comp, ec)
{
- if (bd->desk == desk)
- e_border_desk_set(bd, new_desk);
+ if (ec->desk == desk)
+ e_client_desk_set(ec, new_desk);
}
- e_container_border_list_free(bl);
e_object_del(E_OBJECT(desk));
}
}
@@ -654,13 +708,11 @@ e_zone_desk_count_set(E_Zone *zone,
{
desk = zone->desks[x + (y * zone->desk_x_count)];
- bl = e_container_border_list_first(zone->container);
- while ((bd = e_container_border_list_next(bl)))
+ E_CLIENT_FOREACH(zone->comp, ec)
{
- if (bd->desk == desk)
- e_border_desk_set(bd, new_desk);
+ if (ec->desk == desk)
+ e_client_desk_set(ec, new_desk);
}
- e_container_border_list_free(bl);
e_object_del(E_OBJECT(desk));
}
}
@@ -785,31 +837,27 @@ e_zone_desk_linear_flip_to(E_Zone *zone,
EAPI void
e_zone_edge_enable(void)
{
- Eina_List *l, *ll, *lll;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *l, *ll;
+ E_Comp *c;
E_Zone *zone;
- EINA_LIST_FOREACH(e_manager_list(), l, man)
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
{
- EINA_LIST_FOREACH(man->containers, ll, con)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
{
- EINA_LIST_FOREACH(con->zones, lll, zone)
- {
- if (zone->edge.left) ecore_x_window_show(zone->edge.left);
- if (zone->edge.right) ecore_x_window_show(zone->edge.right);
- if (zone->edge.top) ecore_x_window_show(zone->edge.top);
- if (zone->edge.bottom) ecore_x_window_show(zone->edge.bottom);
- if (zone->corner.left_top) ecore_x_window_show(zone->corner.left_top);
- if (zone->corner.top_left) ecore_x_window_show(zone->corner.top_left);
- if (zone->corner.top_right) ecore_x_window_show(zone->corner.top_right);
- if (zone->corner.right_top) ecore_x_window_show(zone->corner.right_top);
- if (zone->corner.right_bottom) ecore_x_window_show(zone->corner.right_bottom);
- if (zone->corner.bottom_right) ecore_x_window_show(zone->corner.bottom_right);
- if (zone->corner.bottom_left) ecore_x_window_show(zone->corner.bottom_left);
- if (zone->corner.left_bottom) ecore_x_window_show(zone->corner.left_bottom);
- e_zone_edge_flip_eval(zone);
- }
+ if (zone->edge.left) evas_object_show(zone->edge.left);
+ if (zone->edge.right) evas_object_show(zone->edge.right);
+ if (zone->edge.top) evas_object_show(zone->edge.top);
+ if (zone->edge.bottom) evas_object_show(zone->edge.bottom);
+ if (zone->corner.left_top) evas_object_show(zone->corner.left_top);
+ if (zone->corner.top_left) evas_object_show(zone->corner.top_left);
+ if (zone->corner.top_right) evas_object_show(zone->corner.top_right);
+ if (zone->corner.right_top) evas_object_show(zone->corner.right_top);
+ if (zone->corner.right_bottom) evas_object_show(zone->corner.right_bottom);
+ if (zone->corner.bottom_right) evas_object_show(zone->corner.bottom_right);
+ if (zone->corner.bottom_left) evas_object_show(zone->corner.bottom_left);
+ if (zone->corner.left_bottom) evas_object_show(zone->corner.left_bottom);
+ e_zone_edge_flip_eval(zone);
}
}
}
@@ -817,30 +865,26 @@ e_zone_edge_enable(void)
EAPI void
e_zone_edge_disable(void)
{
- Eina_List *l, *ll, *lll;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *l, *ll;
+ E_Comp *c;
E_Zone *zone;
- EINA_LIST_FOREACH(e_manager_list(), l, man)
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
{
- EINA_LIST_FOREACH(man->containers, ll, con)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
{
- EINA_LIST_FOREACH(con->zones, lll, zone)
- {
- if (zone->edge.left) ecore_x_window_hide(zone->edge.left);
- if (zone->edge.right) ecore_x_window_hide(zone->edge.right);
- if (zone->edge.top) ecore_x_window_hide(zone->edge.top);
- if (zone->edge.bottom) ecore_x_window_hide(zone->edge.bottom);
- if (zone->corner.left_top) ecore_x_window_hide(zone->corner.left_top);
- if (zone->corner.top_left) ecore_x_window_hide(zone->corner.top_left);
- if (zone->corner.top_right) ecore_x_window_hide(zone->corner.top_right);
- if (zone->corner.right_top) ecore_x_window_hide(zone->corner.right_top);
- if (zone->corner.right_bottom) ecore_x_window_hide(zone->corner.right_bottom);
- if (zone->corner.bottom_right) ecore_x_window_hide(zone->corner.bottom_right);
- if (zone->corner.bottom_left) ecore_x_window_hide(zone->corner.bottom_left);
- if (zone->corner.left_bottom) ecore_x_window_hide(zone->corner.left_bottom);
- }
+ if (zone->edge.left) evas_object_hide(zone->edge.left);
+ if (zone->edge.right) evas_object_hide(zone->edge.right);
+ if (zone->edge.top) evas_object_hide(zone->edge.top);
+ if (zone->edge.bottom) evas_object_hide(zone->edge.bottom);
+ if (zone->corner.left_top) evas_object_hide(zone->corner.left_top);
+ if (zone->corner.top_left) evas_object_hide(zone->corner.top_left);
+ if (zone->corner.top_right) evas_object_hide(zone->corner.top_right);
+ if (zone->corner.right_top) evas_object_hide(zone->corner.right_top);
+ if (zone->corner.right_bottom) evas_object_hide(zone->corner.right_bottom);
+ if (zone->corner.bottom_right) evas_object_hide(zone->corner.bottom_right);
+ if (zone->corner.bottom_left) evas_object_hide(zone->corner.bottom_left);
+ if (zone->corner.left_bottom) evas_object_hide(zone->corner.left_bottom);
}
}
}
@@ -852,17 +896,17 @@ e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool
(e_bindings_edge_flippable_get(x) || e_bindings_edge_non_flippable_get(x))
#define NEED_EDGE(x) \
(e_bindings_edge_non_flippable_get(x))
-#define CHECK_EDGE(v, ed, win) \
+#define CHECK_EDGE(v, ed, obj) \
do { \
if (v) { \
- if (NEED_FLIP_EDGE(ed)) { if (zone->edge.win) ecore_x_window_show(zone->edge.win); } \
- else if (zone->edge.win) \
- ecore_x_window_hide(zone->edge.win); \
+ if (NEED_FLIP_EDGE(ed)) { if (zone->edge.obj) evas_object_show(zone->edge.obj); } \
+ else if (zone->edge.obj) \
+ evas_object_hide(zone->edge.obj); \
} \
else { \
- if (NEED_EDGE(ed)) { if (zone->edge.win) ecore_x_window_show(zone->edge.win); } \
- else if (zone->edge.win) \
- ecore_x_window_hide(zone->edge.win); \
+ if (NEED_EDGE(ed)) { if (zone->edge.obj) evas_object_show(zone->edge.obj); } \
+ else if (zone->edge.obj) \
+ evas_object_hide(zone->edge.obj); \
} \
} while (0)
@@ -871,25 +915,25 @@ e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool
CHECK_EDGE(t, E_ZONE_EDGE_TOP, top);
CHECK_EDGE(b, E_ZONE_EDGE_BOTTOM, bottom);
-#define CHECK_CORNER(v1, v2, ed, win1, win2) \
+#define CHECK_CORNER(v1, v2, ed, obj1, obj2) \
if ((!v1) && (!v2)) { \
if (NEED_EDGE(ed)) { \
- if (zone->corner.win1) ecore_x_window_show(zone->corner.win1); \
- if (zone->corner.win2) ecore_x_window_show(zone->corner.win2); \
+ if (zone->corner.obj1) evas_object_show(zone->corner.obj1); \
+ if (zone->corner.obj2) evas_object_show(zone->corner.obj2); \
} \
else { \
- if (zone->corner.win1) ecore_x_window_hide(zone->corner.win1); \
- if (zone->corner.win2) ecore_x_window_hide(zone->corner.win2); \
+ if (zone->corner.obj1) evas_object_hide(zone->corner.obj1); \
+ if (zone->corner.obj2) evas_object_hide(zone->corner.obj2); \
} \
} \
else { \
if (NEED_FLIP_EDGE(ed)) { \
- if (zone->corner.win1) ecore_x_window_show(zone->corner.win1); \
- if (zone->corner.win2) ecore_x_window_show(zone->corner.win2); \
+ if (zone->corner.obj1) evas_object_show(zone->corner.obj1); \
+ if (zone->corner.obj2) evas_object_show(zone->corner.obj2); \
} \
else { \
- if (zone->corner.win1) ecore_x_window_hide(zone->corner.win1); \
- if (zone->corner.win2) ecore_x_window_hide(zone->corner.win2); \
+ if (zone->corner.obj1) evas_object_hide(zone->corner.obj1); \
+ if (zone->corner.obj2) evas_object_hide(zone->corner.obj2); \
} \
}
@@ -905,7 +949,7 @@ e_zone_exists_direction(E_Zone *zone, E_Zone_Edge edge)
Eina_List *l;
E_Zone *z2;
- EINA_LIST_FOREACH(zone->container->zones, l, z2)
+ EINA_LIST_FOREACH(zone->comp->zones, l, z2)
{
if (zone == z2) continue;
@@ -999,239 +1043,193 @@ e_zone_edge_flip_eval(E_Zone *zone)
EAPI void
e_zone_edge_new(E_Zone_Edge edge)
{
- Eina_List *l, *ll, *lll;
- E_Manager *man;
- E_Container *con;
+ const Eina_List *l, *ll;
+ E_Comp *c;
E_Zone *zone;
int cw, ch;
+ if (edge == E_ZONE_EDGE_NONE) return;
// configurably disallow edge bindings when we have more than 1 root
// window (ie pure old multihead) since we don't know which direction
// other root windows are in
- if ((!e_config->multiscreen_flip) && (eina_list_count(e_manager_list()) > 1)) return;
- EINA_LIST_FOREACH(e_manager_list(), l, man)
+ if ((!e_config->multiscreen_flip) && (eina_list_count(e_comp_list()) > 1)) return;
+
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
{
- EINA_LIST_FOREACH(man->containers, ll, con)
+ EINA_LIST_FOREACH(c->zones, ll, zone)
{
- EINA_LIST_FOREACH(con->zones, lll, zone)
+ // don't allow bindings on edges that are on the boundary
+ // between zones
+ if (e_zone_exists_direction(zone, edge)) continue;
+ cw = zone->w * E_ZONE_CORNER_RATIO;
+ ch = zone->h * E_ZONE_CORNER_RATIO;
+ switch (edge)
{
- // don't allow bindings on edges that are on the boundary
- // between zones
- if (e_zone_exists_direction(zone, edge)) continue;
- cw = zone->w * E_ZONE_CORNER_RATIO;
- ch = zone->h * E_ZONE_CORNER_RATIO;
- switch (edge)
- {
- case E_ZONE_EDGE_NONE:
- /* noop */
- break;
+#define EDGE_NEW(MEMBER, X, Y, W, H) do { \
+ if (!zone->MEMBER) \
+ { \
+ zone->MEMBER = evas_object_rectangle_add(c->evas); \
+ evas_object_name_set(zone->MEMBER, #MEMBER); \
+ evas_object_move(zone->MEMBER, (X), (Y)); \
+ evas_object_resize(zone->MEMBER, (W), (H)); \
+ evas_object_color_set(zone->MEMBER, 0, 0, 0, 0); \
+ evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_MOVE, _e_zone_cb_mouse_move, zone); \
+ evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_IN, _e_zone_cb_mouse_in, zone); \
+ evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_OUT, _e_zone_cb_mouse_out, zone); \
+ evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_DOWN, _e_zone_cb_mouse_down, zone); \
+ evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_UP, _e_zone_cb_mouse_up, zone); \
+ evas_object_show(zone->MEMBER); \
+ } \
+ } while (0)
+
+ case E_ZONE_EDGE_LEFT:
+ EDGE_NEW(edge.left, zone->x, zone->y + ch, 1, zone->h - 2 * ch);
+ break;
+ case E_ZONE_EDGE_RIGHT:
+ EDGE_NEW(edge.right, zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch);
+ break;
+ case E_ZONE_EDGE_TOP:
+ EDGE_NEW(edge.top, zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1);
+ break;
+ case E_ZONE_EDGE_BOTTOM:
+ EDGE_NEW(edge.bottom, zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1);
+ break;
+ case E_ZONE_EDGE_TOP_LEFT:
+ EDGE_NEW(corner.left_top, zone->x, zone->y, 1, ch);
+ EDGE_NEW(corner.top_left, zone->x + 1, zone->y, cw, 1);
+ break;
+ case E_ZONE_EDGE_TOP_RIGHT:
+ EDGE_NEW(corner.top_right, zone->x + zone->w - cw - 2, zone->y, cw, 1);
+ EDGE_NEW(corner.right_top, zone->x + zone->w - 1, zone->y, 1, ch);
+ break;
+ case E_ZONE_EDGE_BOTTOM_RIGHT:
+ EDGE_NEW(corner.right_bottom, zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch);
+ EDGE_NEW(corner.bottom_right, zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1);
+ break;
+ case E_ZONE_EDGE_BOTTOM_LEFT:
+ EDGE_NEW(corner.bottom_left, zone->x + 1, zone->y + zone->h - 1, cw, 1);
+ EDGE_NEW(corner.left_bottom, zone->x, zone->y + zone->h - ch, 1, ch);
+ break;
+ default: continue;
+ }
+ if (e_config->fullscreen_flip)
+ e_zone_edge_win_layer_set(zone, E_LAYER_CLIENT_EDGE_FULLSCREEN);
+ else
+ e_zone_edge_win_layer_set(zone, E_LAYER_CLIENT_EDGE);
+ }
+ }
+}
- case E_ZONE_EDGE_LEFT:
- if (!zone->edge.left)
- {
- zone->edge.left = ecore_x_window_input_new(con->win,
- zone->x, zone->y + ch, 1,
- zone->h - 2 * ch);
- ecore_x_window_show(zone->edge.left);
- }
- break;
+EAPI void
+e_zone_edge_free(E_Zone_Edge edge)
+{
+ const Eina_List *l, *ll;
+ E_Comp *c;
+ E_Zone *zone;
- case E_ZONE_EDGE_RIGHT:
- if (!zone->edge.right)
- {
- zone->edge.right = ecore_x_window_input_new(con->win,
- zone->x + zone->w - 1,
- zone->y + ch, 1, zone->h - 2 * ch);
- ecore_x_window_show(zone->edge.right);
- }
- break;
+ if (edge == E_ZONE_EDGE_NONE) return;
+ EINA_LIST_FOREACH(e_comp_list(), l, c)
+ {
+ EINA_LIST_FOREACH(c->zones, ll, zone)
+ {
+ switch (edge)
+ {
+ case E_ZONE_EDGE_NONE:
+ /* noop */
+ break;
- case E_ZONE_EDGE_TOP:
- if (!zone->edge.top)
- {
- zone->edge.top = ecore_x_window_input_new(con->win,
- zone->x + 1 + cw, zone->y,
- zone->w - 2 * cw - 2, 1);
- ecore_x_window_show(zone->edge.top);
- }
- break;
+ case E_ZONE_EDGE_LEFT:
+ E_FREE_FUNC(zone->edge.left, evas_object_del);
+ break;
- case E_ZONE_EDGE_BOTTOM:
- if (!zone->edge.bottom)
- {
- zone->edge.bottom = ecore_x_window_input_new(con->win,
- zone->x + 1 + cw, zone->y + zone->h - 1,
- zone->w - 2 - 2 * cw, 1);
- ecore_x_window_show(zone->edge.bottom);
- }
- break;
+ case E_ZONE_EDGE_RIGHT:
+ E_FREE_FUNC(zone->edge.right, evas_object_del);
+ break;
- case E_ZONE_EDGE_TOP_LEFT:
- if (!zone->corner.left_top)
- {
- zone->corner.left_top = ecore_x_window_input_new(con->win,
- zone->x, zone->y, 1, ch);
- ecore_x_window_show(zone->corner.left_top);
- }
- if (!zone->corner.top_left)
- {
- zone->corner.top_left = ecore_x_window_input_new(con->win,
- zone->x + 1, zone->y, cw, 1);
- ecore_x_window_show(zone->corner.top_left);
- }
- break;
+ case E_ZONE_EDGE_TOP:
+ E_FREE_FUNC(zone->edge.top, evas_object_del);
+ break;
- case E_ZONE_EDGE_TOP_RIGHT:
- if (!zone->corner.top_right)
- {
- zone->corner.top_right = ecore_x_window_input_new(con->win,
- zone->x + zone->w - cw - 2,
- zone->y, cw, 1);
- ecore_x_window_show(zone->corner.top_right);
- }
- if (!zone->corner.right_top)
- {
- zone->corner.right_top = ecore_x_window_input_new(con->win,
- zone->x + zone->w - 1,
- zone->y, 1, ch);
- ecore_x_window_show(zone->corner.right_top);
- }
- break;
+ case E_ZONE_EDGE_BOTTOM:
+ E_FREE_FUNC(zone->edge.bottom, evas_object_del);
+ break;
- case E_ZONE_EDGE_BOTTOM_RIGHT:
- if (!zone->corner.right_bottom)
- {
- zone->corner.right_bottom = ecore_x_window_input_new(con->win,
- zone->x + zone->w - 1,
- zone->y + zone->h - ch, 1, ch);
- ecore_x_window_show(zone->corner.right_bottom);
- }
- if (!zone->corner.bottom_right)
- {
- zone->corner.bottom_right = ecore_x_window_input_new(con->win,
- zone->x + zone->w - cw - 2,
- zone->y + zone->h - 1, cw, 1);
+ case E_ZONE_EDGE_TOP_LEFT:
+ E_FREE_FUNC(zone->corner.left_top, evas_object_del);
+ E_FREE_FUNC(zone->corner.top_left, evas_object_del);
+ break;
- ecore_x_window_show(zone->corner.bottom_right);
- }
- break;
+ case E_ZONE_EDGE_TOP_RIGHT:
+ E_FREE_FUNC(zone->corner.top_right, evas_object_del);
+ E_FREE_FUNC(zone->corner.right_top, evas_object_del);
+ break;
- case E_ZONE_EDGE_BOTTOM_LEFT:
- if (!zone->corner.bottom_left)
- {
- zone->corner.bottom_left = ecore_x_window_input_new(con->win,
- zone->x + 1,
- zone->y + zone->h - 1, cw, 1);
- ecore_x_window_show(zone->corner.bottom_left);
- }
- if (!zone->corner.left_bottom)
- {
- zone->corner.left_bottom = ecore_x_window_input_new(con->win,
- zone->x, zone->y + zone->h - ch,
- 1, ch);
- ecore_x_window_show(zone->corner.left_bottom);
- }
- break;
- }
- if (e_config->fullscreen_flip)
- e_zone_edge_win_layer_set(zone, E_LAYER_EDGE_FULLSCREEN);
- else
- e_zone_edge_win_layer_set(zone, E_LAYER_EDGE);
+ case E_ZONE_EDGE_BOTTOM_RIGHT:
+ E_FREE_FUNC(zone->corner.right_bottom, evas_object_del);
+ E_FREE_FUNC(zone->corner.bottom_right, evas_object_del);
+ break;
+
+ case E_ZONE_EDGE_BOTTOM_LEFT:
+ E_FREE_FUNC(zone->corner.bottom_left, evas_object_del);
+ E_FREE_FUNC(zone->corner.left_bottom, evas_object_del);
+ break;
}
}
}
}
EAPI void
-e_zone_edge_free(E_Zone_Edge edge)
+e_zone_edge_win_layer_set(E_Zone *zone, E_Layer layer)
{
- Eina_List *l, *ll, *lll;
- E_Manager *man;
- E_Container *con;
- E_Zone *zone;
+#define EDGE_STACK(EDGE) do { \
+ if (zone->EDGE) \
+ { \
+ evas_object_layer_set(zone->EDGE, layer); \
+ evas_object_stack_below(zone->EDGE, zone->comp->layers[e_comp_canvas_layer_map(layer)].obj); \
+ } \
+ } while (0)
+
+ EDGE_STACK(corner.left_bottom);
+ EDGE_STACK(corner.left_top);
+ EDGE_STACK(corner.top_left);
+ EDGE_STACK(corner.top_right);
+ EDGE_STACK(corner.right_top);
+ EDGE_STACK(corner.right_bottom);
+ EDGE_STACK(corner.bottom_right);
+ EDGE_STACK(corner.bottom_left);
+
+ EDGE_STACK(edge.left);
+ EDGE_STACK(edge.right);
+ EDGE_STACK(edge.top);
+ EDGE_STACK(edge.bottom);
+}
- EINA_LIST_FOREACH(e_manager_list(), l, man)
+EAPI void
+e_zone_fade_handle(E_Zone *zone, int out, double tim)
+{
+ EINA_SAFETY_ON_NULL_RETURN(zone);
+ if (out == 1)
{
- EINA_LIST_FOREACH(man->containers, ll, con)
+ if ((e_backlight_exists()) && (!e_comp_config_get()->nofade))
{
- EINA_LIST_FOREACH(con->zones, lll, zone)
- {
- switch (edge)
- {
- case E_ZONE_EDGE_NONE:
- /* noop */
- break;
-
- case E_ZONE_EDGE_LEFT:
- if (zone->edge.left) ecore_x_window_free(zone->edge.left);
- zone->edge.left = 0;
- break;
-
- case E_ZONE_EDGE_RIGHT:
- if (zone->edge.right) ecore_x_window_free(zone->edge.right);
- zone->edge.right = 0;
- break;
-
- case E_ZONE_EDGE_TOP:
- if (zone->edge.top) ecore_x_window_free(zone->edge.top);
- zone->edge.top = 0;
- break;
-
- case E_ZONE_EDGE_BOTTOM:
- if (zone->edge.bottom) ecore_x_window_free(zone->edge.bottom);
- zone->edge.bottom = 0;
- break;
-
- case E_ZONE_EDGE_TOP_LEFT:
- if (zone->corner.left_top) ecore_x_window_free(zone->corner.left_top);
- if (zone->corner.top_left) ecore_x_window_free(zone->corner.top_left);
- zone->corner.left_top = 0;
- zone->corner.top_left = 0;
- break;
-
- case E_ZONE_EDGE_TOP_RIGHT:
- if (zone->corner.top_right) ecore_x_window_free(zone->corner.top_right);
- if (zone->corner.right_top) ecore_x_window_free(zone->corner.right_top);
- zone->corner.top_right = 0;
- zone->corner.right_top = 0;
- break;
-
- case E_ZONE_EDGE_BOTTOM_RIGHT:
- if (zone->corner.right_bottom) ecore_x_window_free(zone->corner.right_bottom);
- if (zone->corner.bottom_right) ecore_x_window_free(zone->corner.bottom_right);
- zone->corner.right_bottom = 0;
- zone->corner.bottom_right = 0;
- break;
-
- case E_ZONE_EDGE_BOTTOM_LEFT:
- if (zone->corner.bottom_left) ecore_x_window_free(zone->corner.bottom_left);
- if (zone->corner.left_bottom) ecore_x_window_free(zone->corner.left_bottom);
- zone->corner.bottom_left = 0;
- zone->corner.left_bottom = 0;
- break;
- }
- }
+ e_backlight_update();
+ zone->bloff = EINA_TRUE;
+ zone->bl = e_backlight_level_get(zone);
+ e_backlight_level_set(zone, 0.0, tim);
+ }
+ }
+ else
+ {
+ if ((e_backlight_exists()) && (!e_comp_config_get()->nofade))
+ {
+ zone->bloff = EINA_FALSE;
+ e_backlight_update();
+ if (e_backlight_mode_get(zone) != E_BACKLIGHT_MODE_NORMAL)
+ e_backlight_mode_set(zone, E_BACKLIGHT_MODE_NORMAL);
+ else
+ e_backlight_level_set(zone, e_config->backlight.normal, tim);
}
}
-}
-
-EAPI void
-e_zone_edge_win_layer_set(E_Zone *zone,
- E_Layer layer)
-{
- if (zone->corner.left_bottom) e_container_window_raise(zone->container, zone->corner.left_bottom, layer);
- if (zone->corner.left_top) e_container_window_raise(zone->container, zone->corner.left_top, layer);
- if (zone->corner.top_left) e_container_window_raise(zone->container, zone->corner.top_left, layer);
- if (zone->corner.top_right) e_container_window_raise(zone->container, zone->corner.top_right, layer);
- if (zone->corner.right_top) e_container_window_raise(zone->container, zone->corner.right_top, layer);
- if (zone->corner.right_bottom) e_container_window_raise(zone->container, zone->corner.right_bottom, layer);
- if (zone->corner.bottom_right) e_container_window_raise(zone->container, zone->corner.bottom_right, layer);
- if (zone->corner.bottom_left) e_container_window_raise(zone->container, zone->corner.bottom_left, layer);
-
- if (zone->edge.left) e_container_window_raise(zone->container, zone->edge.left, layer);
- if (zone->edge.right) e_container_window_raise(zone->container, zone->edge.right, layer);
- if (zone->edge.top) e_container_window_raise(zone->container, zone->edge.top, layer);
- if (zone->edge.bottom) e_container_window_raise(zone->container, zone->edge.bottom, layer);
}
static void
@@ -1398,23 +1396,22 @@ e_zone_useful_geometry_dirty(E_Zone *zone)
static void
_e_zone_free(E_Zone *zone)
{
- E_Container *con;
int x, y;
//printf("@@@@@@@@@@ e_zone_free: %i %i | %i %i %ix%i = %p\n", zone->num, zone->id, zone->x, zone->y, zone->w, zone->h, zone);
/* Delete the edge windows if they exist */
- if (zone->edge.top) ecore_x_window_free(zone->edge.top);
- if (zone->edge.bottom) ecore_x_window_free(zone->edge.bottom);
- if (zone->edge.left) ecore_x_window_free(zone->edge.left);
- if (zone->edge.right) ecore_x_window_free(zone->edge.right);
- if (zone->corner.left_bottom) ecore_x_window_free(zone->corner.left_bottom);
- if (zone->corner.left_top) ecore_x_window_free(zone->corner.left_top);
- if (zone->corner.top_left) ecore_x_window_free(zone->corner.top_left);
- if (zone->corner.top_right) ecore_x_window_free(zone->corner.top_right);
- if (zone->corner.right_top) ecore_x_window_free(zone->corner.right_top);
- if (zone->corner.right_bottom) ecore_x_window_free(zone->corner.right_bottom);
- if (zone->corner.bottom_right) ecore_x_window_free(zone->corner.bottom_right);
- if (zone->corner.bottom_left) ecore_x_window_free(zone->corner.bottom_left);
+ E_FREE_FUNC(zone->edge.top, evas_object_del);
+ E_FREE_FUNC(zone->edge.bottom, evas_object_del);
+ E_FREE_FUNC(zone->edge.left, evas_object_del);
+ E_FREE_FUNC(zone->edge.right, evas_object_del);
+ E_FREE_FUNC(zone->corner.left_bottom, evas_object_del);
+ E_FREE_FUNC(zone->corner.left_top, evas_object_del);
+ E_FREE_FUNC(zone->corner.top_left, evas_object_del);
+ E_FREE_FUNC(zone->corner.top_right, evas_object_del);
+ E_FREE_FUNC(zone->corner.right_top, evas_object_del);
+ E_FREE_FUNC(zone->corner.right_bottom, evas_object_del);
+ E_FREE_FUNC(zone->corner.bottom_right, evas_object_del);
+ E_FREE_FUNC(zone->corner.bottom_left, evas_object_del);
/* Delete the object event callbacks */
evas_object_event_callback_del(zone->bg_event_object,
@@ -1430,24 +1427,31 @@ _e_zone_free(E_Zone *zone)
ecore_evas_free(zone->black_ecore_evas);
zone->black_ecore_evas = NULL;
}
- if (zone->cur_mouse_action)
- {
- e_object_unref(E_OBJECT(zone->cur_mouse_action));
- zone->cur_mouse_action = NULL;
- }
+ E_FREE_FUNC(zone->cur_mouse_action, e_object_unref);
/* remove handlers */
E_FREE_LIST(zone->handlers, ecore_event_handler_del);
- con = zone->container;
if (zone->name) eina_stringshare_del(zone->name);
- con->zones = eina_list_remove(con->zones, zone);
+ zone->comp->zones = eina_list_remove(zone->comp->zones, zone);
evas_object_del(zone->bg_event_object);
evas_object_del(zone->bg_clip_object);
evas_object_del(zone->bg_object);
if (zone->prev_bg_object) evas_object_del(zone->prev_bg_object);
if (zone->transition_object) evas_object_del(zone->transition_object);
+ evas_object_del(zone->base);
+ evas_object_del(zone->over);
+ if (!e_comp_config_get()->nofade)
+ {
+ if (zone->bloff)
+ {
+ if (e_backlight_mode_get(zone) != E_BACKLIGHT_MODE_NORMAL)
+ e_backlight_mode_set(zone, E_BACKLIGHT_MODE_NORMAL);
+ e_backlight_level_set(zone, e_config->backlight.normal, 0.0);
+ }
+ }
+
/* free desks */
for (x = 0; x < zone->desk_x_count; x++)
{
@@ -1532,163 +1536,6 @@ _e_zone_event_zone_desk_count_set_free(void *data __UNUSED__,
}
static Eina_Bool
-_e_zone_cb_mouse_in(void *data,
- int type __UNUSED__,
- void *event)
-{
- Ecore_X_Event_Mouse_In *ev;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone;
- const Eina_List *l;
- Ecore_Evas *ee;
-
- ev = event;
- zone = data;
-
- edge = _e_zone_detect_edge(zone, ev->win);
- if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->root.x;
- zev->y = ev->root.y;
- zev->modifiers = ev->modifiers;
- EINA_LIST_FOREACH(e_canvas_list(), l, ee)
- {
- /* FIXME: comp */
- if (!evas_pointer_button_down_mask_get(ecore_evas_get(ee))) continue;
- zev->drag = 1;
- break;
- }
-
- ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL);
- e_bindings_edge_in_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_zone_cb_mouse_out(void *data,
- int type __UNUSED__,
- void *event)
-{
- Ecore_X_Event_Mouse_Out *ev;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone;
- const Eina_List *l;
- Ecore_Evas *ee;
-
- ev = event;
- zone = data;
-
- edge = _e_zone_detect_edge(zone, ev->win);
- if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->root.x;
- zev->y = ev->root.y;
- zev->modifiers = ev->modifiers;
- EINA_LIST_FOREACH(e_canvas_list(), l, ee)
- {
- /* FIXME: comp */
- if (!evas_pointer_button_down_mask_get(ecore_evas_get(ee))) continue;
- zev->drag = 1;
- break;
- }
-
- ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
- e_bindings_edge_out_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_zone_cb_mouse_down(void *data,
- int type __UNUSED__,
- void *event)
-{
- Ecore_Event_Mouse_Button *ev;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone;
-
- ev = event;
- zone = data;
-
- edge = _e_zone_detect_edge(zone, ev->window);
- if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->root.x;
- zev->y = ev->root.y;
- zev->button = ev->buttons;
- zev->modifiers = ev->modifiers;
- ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
- e_bindings_edge_down_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_zone_cb_mouse_up(void *data,
- int type __UNUSED__,
- void *event)
-{
- Ecore_Event_Mouse_Button *ev;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone;
-
- ev = event;
- zone = data;
-
- edge = _e_zone_detect_edge(zone, ev->window);
- if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->root.x;
- zev->y = ev->root.y;
- zev->button = ev->buttons;
- zev->modifiers = ev->modifiers;
- ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
- e_bindings_edge_up_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_zone_cb_mouse_move(void *data,
- int type __UNUSED__,
- void *event)
-{
- Ecore_Event_Mouse_Move *ev;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone;
-
- ev = event;
- zone = data;
-
- edge = _e_zone_detect_edge(zone, ev->window);
- if (edge == E_ZONE_EDGE_NONE) return ECORE_CALLBACK_PASS_ON;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->root.x;
- zev->y = ev->root.y;
- zev->modifiers = ev->modifiers;
- ecore_event_add(E_EVENT_ZONE_EDGE_MOVE, zev, NULL, NULL);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
_e_zone_cb_desk_after_show(void *data,
int type __UNUSED__,
void *event)
@@ -1776,30 +1623,29 @@ _e_zone_object_del_attach(void *o)
}
static E_Zone_Edge
-_e_zone_detect_edge(E_Zone *zone,
- Ecore_X_Window win)
+_e_zone_detect_edge(E_Zone *zone, Evas_Object *obj)
{
E_Zone_Edge edge = E_ZONE_EDGE_NONE;
- if (win == zone->edge.left)
+ if (obj == zone->edge.left)
edge = E_ZONE_EDGE_LEFT;
- else if (win == zone->edge.top)
+ else if (obj == zone->edge.top)
edge = E_ZONE_EDGE_TOP;
- else if (win == zone->edge.right)
+ else if (obj == zone->edge.right)
edge = E_ZONE_EDGE_RIGHT;
- else if (win == zone->edge.bottom)
+ else if (obj == zone->edge.bottom)
edge = E_ZONE_EDGE_BOTTOM;
- else if ((win == zone->corner.left_top) ||
- (win == zone->corner.top_left))
+ else if ((obj == zone->corner.left_top) ||
+ (obj == zone->corner.top_left))
edge = E_ZONE_EDGE_TOP_LEFT;
- else if ((win == zone->corner.right_top) ||
- (win == zone->corner.top_right))
+ else if ((obj == zone->corner.right_top) ||
+ (obj == zone->corner.top_right))
edge = E_ZONE_EDGE_TOP_RIGHT;
- else if ((win == zone->corner.right_bottom) ||
- (win == zone->corner.bottom_right))
+ else if ((obj == zone->corner.right_bottom) ||
+ (obj == zone->corner.bottom_right))
edge = E_ZONE_EDGE_BOTTOM_RIGHT;
- else if ((win == zone->corner.left_bottom) ||
- (win == zone->corner.bottom_left))
+ else if ((obj == zone->corner.left_bottom) ||
+ (obj == zone->corner.bottom_left))
edge = E_ZONE_EDGE_BOTTOM_LEFT;
return edge;
}
@@ -1813,65 +1659,31 @@ _e_zone_edge_move_resize(E_Zone *zone)
cw = zone->w * E_ZONE_CORNER_RATIO;
ch = zone->h * E_ZONE_CORNER_RATIO;
- if (zone->corner.left_bottom)
- ecore_x_window_move_resize(zone->corner.left_bottom,
- zone->x, zone->y + zone->h - ch, 1, ch);
- if (zone->edge.left)
- ecore_x_window_move_resize(zone->edge.left,
- zone->x, zone->y + ch, 1, zone->h - 2 * ch);
- if (zone->corner.left_top)
- ecore_x_window_move_resize(zone->corner.left_top,
- zone->x, zone->y, 1, ch);
-
- if (zone->corner.top_left)
- ecore_x_window_move_resize(zone->corner.top_left,
- zone->x + 1, zone->y, cw, 1);
- if (zone->edge.top)
- ecore_x_window_move_resize(zone->edge.top,
- zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1);
- if (zone->corner.top_right)
- ecore_x_window_move_resize(zone->corner.top_right,
- zone->x + zone->w - cw - 2, zone->y, cw, 1);
-
- if (zone->corner.right_top)
- ecore_x_window_move_resize(zone->corner.right_top,
- zone->x + zone->w - 1, zone->y, 1, ch);
- if (zone->edge.right)
- ecore_x_window_move_resize(zone->edge.right,
- zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch);
- if (zone->corner.right_bottom)
- ecore_x_window_move_resize(zone->corner.right_bottom,
- zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch);
-
- if (zone->corner.bottom_right)
- ecore_x_window_move_resize(zone->corner.bottom_right,
- zone->x + 1, zone->y + zone->h - 1, cw, 1);
- if (zone->edge.bottom)
- ecore_x_window_move_resize(zone->edge.bottom,
- zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1);
- if (zone->corner.bottom_left)
- ecore_x_window_move_resize(zone->corner.bottom_left,
- zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1);
-}
-
-static void
-_e_zone_border_geometry_update(E_Zone *zone)
-{
- Eina_List *borders, *l;
- E_Border *bd;
- unsigned int zgeom[4];
-
- zgeom[0] = zone->x;
- zgeom[1] = zone->y;
- zgeom[2] = zone->w;
- zgeom[3] = zone->h;
- borders = e_border_client_list();
- EINA_LIST_FOREACH(borders, l, bd)
- {
- if (bd->zone == zone)
- ecore_x_window_prop_card32_set(bd->client.win,
- E_ATOM_ZONE_GEOMETRY,
- zgeom, 4);
- }
+ evas_object_geometry_set(zone->corner.left_bottom,
+ zone->x, zone->y + zone->h - ch, 1, ch);
+ evas_object_geometry_set(zone->edge.left,
+ zone->x, zone->y + ch, 1, zone->h - 2 * ch);
+ evas_object_geometry_set(zone->corner.left_top,
+ zone->x, zone->y, 1, ch);
+
+ evas_object_geometry_set(zone->corner.top_left,
+ zone->x + 1, zone->y, cw, 1);
+ evas_object_geometry_set(zone->edge.top,
+ zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1);
+ evas_object_geometry_set(zone->corner.top_right,
+ zone->x + zone->w - cw - 2, zone->y, cw, 1);
+
+ evas_object_geometry_set(zone->corner.right_top,
+ zone->x + zone->w - 1, zone->y, 1, ch);
+ evas_object_geometry_set(zone->edge.right,
+ zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch);
+ evas_object_geometry_set(zone->corner.right_bottom,
+ zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch);
+
+ evas_object_geometry_set(zone->corner.bottom_right,
+ zone->x + 1, zone->y + zone->h - 1, cw, 1);
+ evas_object_geometry_set(zone->edge.bottom,
+ zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1);
+ evas_object_geometry_set(zone->corner.bottom_left,
+ zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1);
}
-
diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h
index f8e79c4390..bc749235e7 100644
--- a/src/bin/e_zone.h
+++ b/src/bin/e_zone.h
@@ -38,8 +38,7 @@ struct _E_Zone
/* num matches the id of the xinerama screen
* this zone belongs to. */
unsigned int num;
- E_Container *container;
- E_Comp_Zone *comp_zone;
+ E_Comp *comp;
int fullscreen;
Evas_Object *bg_object;
@@ -55,6 +54,12 @@ struct _E_Zone
Eina_List *handlers;
+ /* formerly E_Comp_Zone */
+ Evas_Object *base;
+ Evas_Object *over;
+ double bl;
+ Eina_Bool bloff;
+
struct
{
unsigned char switching : 1;
@@ -65,12 +70,12 @@ struct _E_Zone
struct
{
- Ecore_X_Window top, right, bottom, left;
+ Evas_Object *top, *right, *bottom, *left;
} edge;
struct
{
- Ecore_X_Window left_top, top_left, top_right, right_top,
- right_bottom, bottom_right, bottom_left, left_bottom;
+ Evas_Object *left_top, *top_left, *top_right, *right_top,
+ *right_bottom, *bottom_right, *bottom_left, *left_bottom;
} corner;
E_Action *cur_mouse_action;
@@ -78,7 +83,7 @@ struct _E_Zone
Ecore_Evas *black_ecore_evas;
Evas *black_evas;
- Ecore_X_Window black_win;
+ Ecore_Window black_win;
int black_need;
int id;
@@ -133,13 +138,12 @@ struct _E_Event_Zone_Edge
EINTERN int e_zone_init(void);
EINTERN int e_zone_shutdown(void);
-EAPI E_Zone *e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h);
+EAPI E_Zone *e_zone_new(E_Comp *con, int num, int id, int x, int y, int w, int h);
EAPI void e_zone_name_set(E_Zone *zone, const char *name);
EAPI void e_zone_move(E_Zone *zone, int x, int y);
EAPI void e_zone_resize(E_Zone *zone, int w, int h);
-EAPI void e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h);
-EAPI void e_zone_fullscreen_set(E_Zone *zone, int on);
-EAPI E_Zone *e_zone_current_get(E_Container *con);
+EAPI Eina_Bool e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h);
+EAPI E_Zone *e_zone_current_get(E_Comp *c);
EAPI void e_zone_bg_reconfigure(E_Zone *zone);
EAPI void e_zone_flip_coords_handle(E_Zone *zone, int x, int y);
EAPI void e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count);
@@ -160,6 +164,8 @@ EAPI void e_zone_edge_win_layer_set(E_Zone *zone, E_Layer layer);
EAPI void e_zone_useful_geometry_dirty(E_Zone *zone);
EAPI void e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w, int *h);
+EAPI void e_zone_fade_handle(E_Zone *zone, int out, double tim);
+
extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET;
extern EAPI int E_EVENT_ZONE_MOVE_RESIZE;
extern EAPI int E_EVENT_ZONE_ADD;