From 86656e4df9d9125d594e9b24ba793c252b6a0a9f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 14 Jan 2014 20:19:12 -0500 Subject: [PATCH] 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 --- config/Makefile.mk | 2 +- config/standard/e.src | 2 +- po/POTFILES.in | 13 +- src/bin/Makefile.mk | 43 +- src/bin/e_about.c | 4 +- src/bin/e_about.h | 2 +- src/bin/e_actions.c | 949 +- src/bin/e_alert_main.c | 12 +- src/bin/e_atoms.c | 27 +- src/bin/e_atoms.h | 1 - src/bin/e_backlight.c | 75 +- src/bin/e_bg.c | 82 +- src/bin/e_bg.h | 10 +- src/bin/e_bindings.c | 71 +- src/bin/e_bindings.h | 4 +- src/bin/e_border.c | 10232 ---------------- src/bin/e_border.h | 885 -- src/bin/e_canvas.c | 2 +- src/bin/e_client.c | 4465 +++++++ src/bin/e_client.h | 846 ++ src/bin/e_client.x | 98 + src/bin/e_color_dialog.c | 6 +- src/bin/e_color_dialog.h | 3 +- src/bin/e_comp.c | 5054 +------- src/bin/e_comp.h | 333 +- src/bin/e_comp_canvas.c | 559 + src/bin/e_comp_canvas.h | 81 + src/bin/e_comp_object.c | 3364 +++++ src/bin/e_comp_object.h | 79 + src/bin/e_comp_render_update.c | 248 - src/bin/e_comp_render_update.h | 46 - src/bin/e_comp_wl.c | 151 +- src/bin/e_comp_wl.h | 20 +- src/bin/e_comp_x.c | 4851 ++++++++ src/bin/e_comp_x.h | 7 + src/bin/e_config.c | 113 +- src/bin/e_config.h | 14 +- src/bin/e_config_dialog.c | 29 +- src/bin/e_config_dialog.h | 4 +- src/bin/e_configure.c | 66 +- src/bin/e_configure.h | 14 +- src/bin/e_confirm_dialog.c | 2 +- src/bin/e_container.c | 1095 -- src/bin/e_container.h | 157 - src/bin/e_desk.c | 375 +- src/bin/e_desk.h | 16 +- src/bin/e_desklock.c | 59 +- src/bin/e_deskmirror.c | 5 +- src/bin/e_desktop_editor.c | 43 +- src/bin/e_desktop_editor.h | 6 +- src/bin/e_dialog.c | 36 +- src/bin/e_dialog.h | 4 +- src/bin/e_dnd.c | 188 +- src/bin/e_dnd.h | 6 +- src/bin/e_dpms.c | 12 +- src/bin/e_entry.c | 44 +- src/bin/e_entry_dialog.c | 3 +- src/bin/e_exec.c | 82 +- src/bin/e_exec.h | 6 +- src/bin/e_fm.c | 124 +- src/bin/e_fm_prop.c | 6 +- src/bin/e_fm_prop.h | 2 +- src/bin/e_focus.c | 141 +- src/bin/e_focus.h | 20 +- src/bin/e_font.c | 27 +- src/bin/e_gadcon.c | 55 +- src/bin/e_gadcon_popup.c | 86 +- src/bin/e_gadcon_popup.h | 5 +- src/bin/e_grab_dialog.c | 21 +- src/bin/e_grabinput.c | 26 +- src/bin/e_grabinput.h | 10 +- src/bin/e_hints.c | 1265 +- src/bin/e_hints.h | 58 +- src/bin/e_import_config_dialog.c | 10 +- src/bin/e_import_config_dialog.h | 2 +- src/bin/e_import_dialog.c | 14 +- src/bin/e_import_dialog.h | 2 +- src/bin/e_includes.h | 19 +- src/bin/e_init.c | 21 +- src/bin/e_int_border_menu.h | 22 - src/bin/e_int_border_remember.h | 10 - ...nt_border_locks.c => e_int_client_locks.c} | 208 +- ...nt_border_locks.h => e_int_client_locks.h} | 2 +- ..._int_border_menu.c => e_int_client_menu.c} | 940 +- src/bin/e_int_client_menu.h | 22 + ..._int_border_prop.c => e_int_client_prop.c} | 170 +- ..._int_border_prop.h => e_int_client_prop.h} | 2 +- ...der_remember.c => e_int_client_remember.c} | 206 +- src/bin/e_int_client_remember.h | 10 + src/bin/e_int_config_modules.c | 4 +- src/bin/e_int_config_modules.h | 2 +- src/bin/e_int_gadcon_config.c | 6 +- src/bin/e_int_menus.c | 316 +- src/bin/e_int_shelf_config.c | 52 +- src/bin/e_int_toolbar_config.c | 4 +- src/bin/e_main.c | 309 +- src/bin/e_manager.c | 879 +- src/bin/e_manager.h | 20 +- src/bin/e_maximize.c | 164 +- src/bin/e_maximize.h | 8 +- src/bin/e_menu.c | 206 +- src/bin/e_menu.h | 3 +- src/bin/e_module.c | 14 +- src/bin/e_moveresize.c | 216 +- src/bin/e_msgbus.c | 46 +- src/bin/e_obj_dialog.c | 24 +- src/bin/e_obj_dialog.h | 2 +- src/bin/e_pixmap.c | 671 + src/bin/e_pixmap.h | 54 + src/bin/e_place.c | 114 +- src/bin/e_popup.c | 289 - src/bin/e_popup.h | 54 - src/bin/e_remember.c | 595 +- src/bin/e_remember.h | 10 +- src/bin/e_resist.c | 43 +- src/bin/e_resist.h | 4 +- src/bin/e_screensaver.c | 18 +- src/bin/e_shelf.c | 207 +- src/bin/e_shelf.h | 5 +- src/bin/e_start_main.c | 2 +- src/bin/e_stolen.c | 67 - src/bin/e_stolen.h | 11 - src/bin/e_surface.c | 4 +- src/bin/e_surface.h | 2 +- src/bin/e_sys.c | 44 +- src/bin/e_test.c | 228 +- src/bin/e_theme.c | 4 +- src/bin/e_theme_about.c | 6 +- src/bin/e_theme_about.h | 2 +- src/bin/e_toolbar.c | 2 +- src/bin/e_update.c | 8 +- src/bin/e_utils.c | 262 +- src/bin/e_utils.h | 33 +- src/bin/e_widget_bgpreview.c | 16 +- src/bin/e_widget_color_well.c | 10 +- src/bin/e_win.c | 349 +- src/bin/e_win.h | 12 +- src/bin/e_xinerama.c | 79 +- src/bin/e_xinerama.h | 1 + src/bin/e_xsettings.c | 61 +- src/bin/e_zone.c | 1058 +- src/bin/e_zone.h | 26 +- src/modules/access/e_mod_config.c | 4 +- src/modules/access/e_mod_main.c | 32 +- src/modules/appmenu/e_mod_appmenu_render.c | 4 +- src/modules/appmenu/e_mod_main.c | 10 +- src/modules/backlight/e_mod_main.c | 17 +- src/modules/battery/e_mod_config.c | 4 +- src/modules/battery/e_mod_main.c | 14 +- src/modules/battery/e_mod_main.h | 2 +- src/modules/bluez4/agent.c | 4 +- src/modules/bluez4/e_mod_main.c | 19 +- src/modules/clock/e_mod_config.c | 4 +- src/modules/clock/e_mod_main.c | 40 +- src/modules/clock/e_mod_main.h | 2 +- src/modules/conf/e_conf.c | 38 +- src/modules/conf/e_mod_config.c | 4 +- src/modules/conf/e_mod_main.c | 14 +- src/modules/conf/e_mod_main.h | 4 +- .../conf_applications/e_int_config_apps.c | 38 +- .../e_int_config_apps_personal.c | 14 +- .../conf_applications/e_int_config_defapps.c | 4 +- .../conf_applications/e_int_config_deskenv.c | 4 +- src/modules/conf_applications/e_mod_main.h | 22 +- .../conf_bindings/e_int_config_acpibindings.c | 6 +- .../conf_bindings/e_int_config_edgebindings.c | 22 +- .../conf_bindings/e_int_config_keybindings.c | 4 +- .../e_int_config_mousebindings.c | 12 +- .../e_int_config_signalbindings.c | 4 +- src/modules/conf_bindings/e_mod_main.h | 10 +- src/modules/conf_comp/e_mod_config.c | 4 +- src/modules/conf_comp/e_mod_config_match.c | 4 +- src/modules/conf_comp/e_mod_main.c | 2 +- src/modules/conf_comp/e_mod_main.h | 4 +- .../conf_dialogs/e_int_config_dialogs.c | 4 +- .../conf_dialogs/e_int_config_profiles.c | 4 +- src/modules/conf_dialogs/e_mod_main.h | 4 +- src/modules/conf_display/e_int_config_desk.c | 45 +- .../conf_display/e_int_config_desklock.c | 46 +- .../conf_display/e_int_config_desklock_fsel.c | 8 +- src/modules/conf_display/e_int_config_desks.c | 39 +- .../conf_display/e_int_config_display.c | 6 +- src/modules/conf_display/e_int_config_dpms.c | 4 +- .../conf_display/e_int_config_screensaver.c | 4 +- src/modules/conf_display/e_mod_main.h | 12 +- .../e_int_config_interaction.c | 4 +- .../conf_interaction/e_int_config_mouse.c | 18 +- src/modules/conf_interaction/e_mod_main.h | 4 +- src/modules/conf_intl/e_int_config_imc.c | 4 +- .../conf_intl/e_int_config_imc_import.c | 4 +- src/modules/conf_intl/e_int_config_intl.c | 8 +- src/modules/conf_intl/e_mod_main.h | 6 +- src/modules/conf_menus/e_int_config_menus.c | 4 +- src/modules/conf_menus/e_mod_main.h | 2 +- src/modules/conf_paths/e_int_config_env.c | 4 +- src/modules/conf_paths/e_int_config_paths.c | 4 +- src/modules/conf_paths/e_mod_main.h | 4 +- .../conf_performance/e_int_config_engine.c | 4 +- .../e_int_config_performance.c | 4 +- .../e_int_config_powermanagement.c | 4 +- src/modules/conf_performance/e_mod_main.h | 6 +- src/modules/conf_randr/e_int_config_randr.c | 4 +- src/modules/conf_randr/e_int_config_randr.h | 2 +- src/modules/conf_randr/e_smart_monitor.c | 18 +- src/modules/conf_shelves/e_int_config_shelf.c | 20 +- src/modules/conf_shelves/e_int_config_shelf.h | 2 +- src/modules/conf_shelves/e_mod_main.c | 2 +- src/modules/conf_shelves/e_mod_main.h | 2 +- src/modules/conf_theme/e_int_config_borders.c | 111 +- .../conf_theme/e_int_config_color_classes.c | 4 +- src/modules/conf_theme/e_int_config_fonts.c | 4 +- src/modules/conf_theme/e_int_config_scale.c | 18 +- src/modules/conf_theme/e_int_config_theme.c | 16 +- .../conf_theme/e_int_config_theme_import.c | 21 +- .../conf_theme/e_int_config_transitions.c | 6 +- .../conf_theme/e_int_config_wallpaper.c | 78 +- .../conf_theme/e_int_config_xsettings.c | 4 +- src/modules/conf_theme/e_mod_main.c | 4 +- src/modules/conf_theme/e_mod_main.h | 23 +- .../conf_wallpaper2/e_int_config_wallpaper.c | 38 +- src/modules/conf_wallpaper2/e_mod_main.c | 2 +- src/modules/conf_wallpaper2/e_mod_main.h | 2 +- .../e_int_config_clientlist.c | 4 +- .../e_int_config_focus.c | 12 +- .../e_int_config_window_display.c | 4 +- .../e_int_config_window_geometry.c | 4 +- .../e_int_config_window_process.c | 4 +- .../conf_window_manipulation/e_mod_main.h | 10 +- .../e_int_config_remembers.c | 6 +- .../conf_window_remembers/e_mod_main.h | 2 +- src/modules/connman/e_mod_config.c | 4 +- src/modules/connman/e_mod_main.c | 21 +- src/modules/connman/e_mod_main.h | 2 +- src/modules/contact/e_edges.c | 20 +- src/modules/contact/e_mod_main.c | 60 +- src/modules/contact/e_policy.c | 243 +- src/modules/contact/e_policy.h | 4 +- src/modules/cpufreq/e_mod_config.c | 4 +- src/modules/cpufreq/e_mod_main.c | 18 +- src/modules/cpufreq/e_mod_main.h | 2 +- src/modules/everything/e_mod_main.c | 6 +- src/modules/everything/e_mod_main.h | 4 +- src/modules/everything/evry.c | 33 +- src/modules/everything/evry_api.h | 2 +- src/modules/everything/evry_config.c | 12 +- src/modules/everything/evry_gadget.c | 50 +- src/modules/everything/evry_plug_apps.c | 8 +- src/modules/everything/evry_plug_files.c | 4 +- src/modules/everything/evry_plug_settings.c | 2 +- src/modules/everything/evry_plug_windows.c | 207 +- src/modules/fileman/e_fwin.c | 201 +- src/modules/fileman/e_fwin_nav.c | 2 +- src/modules/fileman/e_int_config_mime.c | 4 +- src/modules/fileman/e_int_config_mime_edit.c | 6 +- src/modules/fileman/e_mod_config.c | 5 +- src/modules/fileman/e_mod_dbus.c | 2 +- src/modules/fileman/e_mod_main.c | 73 +- src/modules/fileman/e_mod_main.h | 8 +- src/modules/fileman/e_mod_menu.c | 12 +- src/modules/fileman_opinfo/e_mod_main.c | 16 +- src/modules/gadman/e_mod_config.c | 6 +- src/modules/gadman/e_mod_gadman.c | 81 +- src/modules/gadman/e_mod_gadman.h | 7 +- src/modules/gadman/e_mod_main.c | 2 +- src/modules/ibar/e_mod_config.c | 5 +- src/modules/ibar/e_mod_main.c | 167 +- src/modules/ibox/e_mod_config.c | 24 +- src/modules/ibox/e_mod_main.c | 223 +- src/modules/illume-home/e_mod_config.c | 4 +- src/modules/illume-home/e_mod_config.h | 2 +- src/modules/illume-home/e_mod_main.c | 133 +- src/modules/illume-indicator/e_mod_ind_win.c | 64 +- src/modules/illume-indicator/e_mod_main.c | 36 +- src/modules/illume-indicator/e_mod_notify.c | 6 +- src/modules/illume-kbd-toggle/e_mod_main.c | 46 +- src/modules/illume-keyboard/e_kbd_int.c | 86 +- src/modules/illume-keyboard/e_kbd_int.h | 8 +- src/modules/illume-keyboard/e_mod_config.c | 4 +- src/modules/illume-keyboard/e_mod_config.h | 2 +- src/modules/illume-softkey/e_mod_main.c | 30 +- src/modules/illume-softkey/e_mod_sft_win.c | 47 +- src/modules/illume2/e_illume.c | 409 +- src/modules/illume2/e_illume.h | 66 +- src/modules/illume2/e_mod_config.c | 8 +- src/modules/illume2/e_mod_config_animation.c | 4 +- src/modules/illume2/e_mod_config_policy.c | 4 +- src/modules/illume2/e_mod_config_windows.c | 4 +- src/modules/illume2/e_mod_kbd.c | 237 +- src/modules/illume2/e_mod_main.c | 39 +- src/modules/illume2/e_mod_main.h | 6 +- src/modules/illume2/e_mod_policy.c | 159 +- src/modules/illume2/e_mod_quickpanel.c | 191 +- src/modules/illume2/e_mod_select_window.c | 45 +- src/modules/illume2/policies/illume/policy.c | 1367 +-- src/modules/illume2/policies/illume/policy.h | 20 +- src/modules/illume2/policies/tablet/policy.c | 1121 +- src/modules/illume2/policies/tablet/policy.h | 22 +- src/modules/layout/e_mod_main.c | 40 +- src/modules/mixer/app_mixer.c | 4 +- src/modules/mixer/conf_gadget.c | 4 +- src/modules/mixer/conf_module.c | 8 +- src/modules/mixer/e_mod_main.c | 36 +- src/modules/mixer/e_mod_main.h | 6 +- src/modules/msgbus/msgbus_desktop.c | 30 +- src/modules/music-control/ui.c | 12 +- src/modules/notification/e_mod_config.c | 4 +- src/modules/notification/e_mod_main.h | 4 +- src/modules/notification/e_mod_popup.c | 136 +- src/modules/pager/e_mod_config.c | 6 +- src/modules/pager/e_mod_main.c | 621 +- src/modules/quickaccess/e_mod_config.c | 4 +- src/modules/quickaccess/e_mod_main.h | 4 +- src/modules/quickaccess/e_mod_quickaccess.c | 254 +- src/modules/shot/e_mod_main.c | 84 +- src/modules/syscon/e_int_config_syscon.c | 4 +- src/modules/syscon/e_mod_main.c | 6 +- src/modules/syscon/e_mod_main.h | 2 +- src/modules/syscon/e_syscon.c | 76 +- src/modules/syscon/e_syscon_gadget.c | 2 +- src/modules/systray/e_mod_main.c | 10 +- src/modules/systray/e_mod_main.h | 2 +- src/modules/systray/e_mod_notifier_host.c | 2 +- src/modules/systray/e_mod_xembed.c | 134 +- src/modules/tasks/e_mod_config.c | 6 +- src/modules/tasks/e_mod_main.c | 320 +- src/modules/tasks/e_mod_main.h | 2 +- src/modules/teamwork/e_mod_config.c | 4 +- src/modules/teamwork/e_mod_main.h | 4 +- src/modules/teamwork/e_mod_tw.c | 99 +- src/modules/temperature/e_mod_config.c | 2 +- src/modules/tiling/e_mod_config.c | 12 +- src/modules/tiling/e_mod_tiling.c | 1586 ++- src/modules/tiling/e_mod_tiling.h | 6 +- src/modules/winlist/e_int_config_winlist.c | 4 +- src/modules/winlist/e_mod_main.c | 6 +- src/modules/winlist/e_mod_main.h | 2 +- src/modules/winlist/e_winlist.c | 573 +- src/modules/wizard/e_wizard.c | 80 +- src/modules/wizard/page_050.c | 2 +- src/modules/wl_desktop_shell/e_mod_main.c | 1038 +- src/modules/xkbswitch/e_mod_config.c | 6 +- src/modules/xkbswitch/e_mod_main.c | 2 +- src/modules/xkbswitch/e_mod_main.h | 2 +- 343 files changed, 26382 insertions(+), 30784 deletions(-) delete mode 100644 src/bin/e_border.c delete mode 100644 src/bin/e_border.h create mode 100644 src/bin/e_client.c create mode 100644 src/bin/e_client.h create mode 100644 src/bin/e_client.x create mode 100644 src/bin/e_comp_canvas.c create mode 100644 src/bin/e_comp_canvas.h create mode 100644 src/bin/e_comp_object.c create mode 100644 src/bin/e_comp_object.h delete mode 100644 src/bin/e_comp_render_update.c delete mode 100644 src/bin/e_comp_render_update.h create mode 100644 src/bin/e_comp_x.c create mode 100644 src/bin/e_comp_x.h delete mode 100644 src/bin/e_container.c delete mode 100644 src/bin/e_container.h delete mode 100644 src/bin/e_int_border_menu.h delete mode 100644 src/bin/e_int_border_remember.h rename src/bin/{e_int_border_locks.c => e_int_client_locks.c} (63%) rename src/bin/{e_int_border_locks.h => e_int_client_locks.h} (69%) rename src/bin/{e_int_border_menu.c => e_int_client_menu.c} (54%) create mode 100644 src/bin/e_int_client_menu.h rename src/bin/{e_int_border_prop.c => e_int_client_prop.c} (71%) rename src/bin/{e_int_border_prop.h => e_int_client_prop.h} (69%) rename src/bin/{e_int_border_remember.c => e_int_client_remember.c} (84%) create mode 100644 src/bin/e_int_client_remember.h create mode 100644 src/bin/e_pixmap.c create mode 100644 src/bin/e_pixmap.h delete mode 100644 src/bin/e_popup.c delete mode 100644 src/bin/e_popup.h delete mode 100644 src/bin/e_stolen.c delete mode 100644 src/bin/e_stolen.h diff --git a/config/Makefile.mk b/config/Makefile.mk index 34fef4822..cfd0e1eb8 100644 --- a/config/Makefile.mk +++ b/config/Makefile.mk @@ -12,7 +12,7 @@ SUFFIXES = .cfg $(MKDIR_P) $(@D) $(EET_EET) -e \ $(top_builddir)/$@ config \ - $< 0 + $< 1 include config/default/Makefile.mk include config/standard/Makefile.mk diff --git a/config/standard/e.src b/config/standard/e.src index 95e63cdaa..c550b1629 100644 --- a/config/standard/e.src +++ b/config/standard/e.src @@ -604,7 +604,7 @@ group "E_Config" struct { } value "name" string: "shelf"; value "id" int: 1; - value "container" int: 0; + value "manager" int: 0; value "zone" int: 0; value "layer" int: 200; value "popup" uchar: 1; diff --git a/po/POTFILES.in b/po/POTFILES.in index 133d05d81..830293e58 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -4,9 +4,9 @@ src/bin/e_alert.c src/bin/e_atoms.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 @@ -15,7 +15,6 @@ src/bin/e_config.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_desk.c src/bin/e_desklock.c @@ -47,10 +46,10 @@ src/bin/e_imc_main.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_int_menus.c @@ -76,7 +75,6 @@ src/bin/e_pan.c src/bin/e_path.c src/bin/e_place.c src/bin/e_pointer.c -src/bin/e_popup.c src/bin/e_prefix.c src/bin/e_randr.c src/bin/e_remember.c @@ -90,7 +88,6 @@ src/bin/e_slider.c src/bin/e_spectrum.c src/bin/e_start_main.c src/bin/e_startup.c -src/bin/e_stolen.c src/bin/e_sys.c src/bin/e_sys_main.c src/bin/e_table.c diff --git a/src/bin/Makefile.mk b/src/bin/Makefile.mk index 0e58521fa..d5f994efb 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 b1a64f891..5c6e4c2de 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 7636b8a52..612c765a6 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 002650bd6..4c93c702b 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
" "which has not yet been saved will be lost!

" "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); + ec = (E_Client *)obj; + e_comp_object_util_center(ec->frame); - if ((x != bd->x) || (y != bd->y)) - { - e_border_move(bd, x, y); - - 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); + e_desk_show(ec->desk); - /* Warp the pointer */ - if (e_config->focus_policy != E_FOCUS_CLICK) - e_border_pointer_warp_to_center(bd); - - 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 2ba2fad46..61cb20cd8 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 889921d31..436a772f8 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 831fa3836..d01b364f4 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 ca2b7d991..683a34007 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 6b1619d6e..3139157d3 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 a1bc42f55..a042c0819 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 65a6bbce4..a8e972539 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 489f825f8..6014ddd3b 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 874b01b45..000000000 --- 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 fff74992f..000000000 --- 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 636aa8cb0..14a4bee5c 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 000000000..c55e4d47f --- /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 000000000..9e62881b1 --- /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 000000000..69bff4b8f --- /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 a536c2a23..5a5e10aea 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 415be7478..ade222658 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 d6531b69a..bc756872b 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)) - 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) - ) - { - // check for objects above... - Evas_Object *parent = NULL, *o = NULL; + Evas_Object *o = ec->frame; - 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_client_util_ignored_get(ec) || (!evas_object_visible_get(ec->frame))) + continue; + if (!e_comp_util_client_is_fullscreen(ec)) return NULL; + while (o) + { + 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); + if (c->fps_bg) return; - 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); - } + 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); + + 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); } 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; - } + E_FREE_FUNC(c->fps_fg, evas_object_del); + E_FREE_FUNC(c->fps_bg, evas_object_del); } } -static void -_e_comp_win_release(E_Comp_Win *cw) -{ - Eina_List *l; - Evas_Object *o; - - 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; - } -} - -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) - { - cw->update = 1; - cw->c->updates = eina_list_append(cw->c->updates, cw); - } - 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; - } + E_FREE_FUNC(c->nocomp_delay_timer, ecore_timer_del); - cwf = _e_comp_fullscreen_check(c); - if (!cwf) return; + ecf = _e_comp_fullscreen_check(c); + if (!ecf) return; + E_CLIENT_FOREACH(c, ec) + if (ec != ecf) e_client_redirected_set(ec, 0); - if (cwf->bd) - e_border_raise(cwf->bd); - - EINA_INLIST_FOREACH(c->wins, cw) - { - _e_comp_win_release(cw); - } - cw = cwf; - - INF("NOCOMP win %x effect_obj %p", cw->win, cw->effect_obj); - - _e_comp_win_release(cw); - - ecore_x_composite_unredirect_subwindows - (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL); + INF("NOCOMP %p: frame %p", ecf, ecf->frame); 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); + + evas_object_raise(ecf->frame); + e_client_redirected_set(ecf, 0); + + //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 (conf->grab && c->grabbed) { - if (c->grabbed) - { - c->grabbed = 0; - ecore_x_ungrab(); - } + if (c->grab_cb) c->grab_cb(c); + c->grabbed = 0; } - if (new_updates) - { - 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); - } - 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,1664 +486,301 @@ _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); - } + +static Eina_Bool +_e_comp_cb_zone_change(void *data EINA_UNUSED, int type EINA_UNUSED, EINA_UNUSED void *event) +{ + E_LIST_FOREACH(compositors, e_comp_canvas_update); + return ECORE_CALLBACK_PASS_ON; +} + +#ifdef SHAPE_DEBUG +static void +_e_comp_shape_debug_rect(E_Comp *c, Eina_Rectangle *rect, E_Color *color) +{ + Evas_Object *o; + +#define COLOR_INCREMENT 30 + o = evas_object_rectangle_add(c->evas); + if (color->r < 256 - COLOR_INCREMENT) + evas_object_color_set(o, (color->r += COLOR_INCREMENT), 0, 0, 255); + else if (color->g < 256 - COLOR_INCREMENT) + evas_object_color_set(o, 0, (color->g += COLOR_INCREMENT), 0, 255); 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); - } + evas_object_color_set(o, 0, 0, (color->b += COLOR_INCREMENT), 255); + evas_object_repeat_events_set(o, 1); + 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); } +#endif -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) +static Eina_Bool +_e_comp_shapes_update_object_checker_function_thingy(E_Comp *c, Evas_Object *o) { Eina_List *l; - E_Comp *c; + E_Zone *zone; - // fixme: use hash if compositors list > 4 - EINA_LIST_FOREACH(compositors, l, c) + if (o == c->bg_blank_object) return EINA_TRUE; + EINA_LIST_FOREACH(c->zones, l, zone) { - if (c->man->root == root) return c; + 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 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; + return EINA_FALSE; } 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)) +#ifdef SHAPE_DEBUG +_e_comp_shapes_update_comp_client_shape_comp_helper(E_Client *ec, Eina_Tiler *tb, Eina_List **rl) #else - if (cw->bd->bg_object && (edje_object_part_swallow_get(cw->shobj, "e.swallow.content") == cw->bd->bg_object)) +_e_comp_shapes_update_comp_client_shape_comp_helper(E_Client *ec, Eina_Tiler *tb) #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) + /* ignore deleted shapes */ + if (e_object_is_del(E_OBJECT(ec))) { - switch (eobj->type) + SHAPE_INF("IGNORING DELETED: %p", ec); + return; + } + if ((!ec->visible) || (ec->hidden) || (!evas_object_visible_get(ec->frame)) || evas_object_pass_events_get(ec->frame)) + { + SHAPE_DBG("SKIPPING SHAPE FOR %p", ec); + return; + } +#ifdef SHAPE_DEBUG + INF("COMP EC: %p", ec); +#endif + + if (ec->shape_input_rects || ec->shape_rects) + { + int num, tot; + int l, r, t, b; + Eina_Rectangle *rect, *rects; + + /* add the frame */ + e_comp_object_frame_geometry_get(ec->frame, &l, &r, &t, &b); + if (l || r || t || b) { - 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"); + if (t) + { + 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); + } } - cw->eobj = eobj; - e_object_ref(E_OBJECT(cw->eobj)); + 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; + 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); + //EINA_RECTANGLE_SET(r, x, y, w, h); + //rl = eina_list_append(rl, r); + //#endif + eina_tiler_rect_del(tb, &(Eina_Rectangle){x, y, w, h}); + SHAPE_INF("DEL: %d,%d@%dx%d", x, y, w, h); + } + return; } - 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) +#ifdef SHAPE_DEBUG { - cw->zoomobj = e_zoomap_add(c->evas); - e_zoomap_smooth_set(cw->zoomobj, conf->smooth_windows); + Eina_Rectangle *r; + + r = E_NEW(Eina_Rectangle, 1); + EINA_RECTANGLE_SET(r, ec->client.x, ec->client.y, ec->client.w, ec->client.h); + *rl = eina_list_append(*rl, r); } - _e_comp_win_shadow_setup(cw); - edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj); +#endif - 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) + if ((!ec->borderless) && (e_util_strcmp(ec->border.name, "borderless"))) { - 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"); + /* 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->menu) + + if ((!ec->shaded) && (!ec->shading)) { - 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"); + /* 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); } - - 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) +_e_comp_shapes_update_object_shape_comp_helper(E_Comp *c, Evas_Object *o, Eina_Tiler *tb) { - 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; + 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_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) +_e_comp_shapes_update_job(E_Comp *c) { + Eina_Tiler *tb; Evas_Object *o; + Eina_Rectangle *tr; + Eina_Iterator *ti; + Eina_Rectangle *exr; + unsigned int i, tile_count; +#ifdef SHAPE_DEBUG + Eina_Rectangle *r; + Eina_List *rl = NULL; + E_Color color = {0}; +#endif - if (cw->eobj) + 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)) { - e_object_unref(E_OBJECT(cw->eobj)); - cw->eobj = NULL; + int layer; + E_Client *ec; + + layer = evas_object_layer_get(o); + if (e_comp_canvas_client_layer_map(layer) == 9999) //not a client layer + { + /* 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 +#endif + ); + + else + _e_comp_shapes_update_object_shape_comp_helper(c, o, tb); } - E_FREE_FUNC(cw->opacity_set_timer, ecore_timer_del); - if (cw->animating) + + ti = eina_tiler_iterator_new(tb); + tile_count = 128; + exr = malloc(sizeof(Eina_Rectangle) * tile_count); + i = 0; + EINA_ITERATOR_FOREACH(ti, tr) { - 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; + exr[i++] = *(Eina_Rectangle*)((char*)tr); + if (i == tile_count - 1) + exr = realloc(exr, sizeof(Eina_Rectangle) * (tile_count *= 2)); +#ifdef SHAPE_DEBUG 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) + _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].w, exr[i - 1].h); + EINA_LIST_FOREACH(rl, l, r) { - 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; + if (E_INTERSECTS(r->x, r->y, r->w, r->h, tr->x, tr->y, tr->w, tr->h)) + ERR("POSSIBLE RECT FAIL!!!!"); } +#endif } - - 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; + ecore_x_window_shape_input_rectangles_set(c->win, (Ecore_X_Rectangle*)exr, i); +#ifdef SHAPE_DEBUG + E_FREE_LIST(rl, free); + printf("\n"); +#endif + free(exr); + eina_iterator_free(ti); + eina_tiler_free(tb); + c->shape_job = NULL; } ////////////////////////////////////////////////////////////////////////// -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) +_e_comp_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Key *ev) { - 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) + if ((!strcasecmp(ev->keyname, "f")) && + (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) && + (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && + (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)) { - 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); - } + e_comp_canvas_fps_toggle(); } return ECORE_CALLBACK_PASS_ON; } static Eina_Bool -_e_comp_stack(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_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->number == 1) { - 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; - } + // e uses this to pop up config panel + } + else if (ev->number == 2) + { + e_comp_canvas_fps_toggle(); } return ECORE_CALLBACK_PASS_ON; } +////////////////////////////////////////////////////////////////////////// + +static void +_e_comp_free(E_Comp *c) +{ + E_FREE_LIST(c->zones, e_object_del); + + e_comp_canvas_clear(c); + + ecore_evas_free(c->ee); + eina_stringshare_del(c->name); + + 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); + + free(c); +} + +////////////////////////////////////////////////////////////////////////// + static Eina_Bool _e_comp_override_expire(void *data) { @@ -3125,65 +797,29 @@ _e_comp_override_expire(void *data) 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_Zone *zone; E_Comp *c; // fixme: use hash if compositors list > 4 EINA_LIST_FOREACH(compositors, l, c) { - if (!c->saver) + if (c->saver) continue; + c->saver = EINA_TRUE; + EINA_LIST_FOREACH(c->zones, ll, zone) { - 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"); - } + 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"); } } + return ECORE_CALLBACK_PASS_ON; } @@ -3191,1037 +827,26 @@ 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_Zone *zone; E_Comp *c; // fixme: use hash if compositors list > 4 EINA_LIST_FOREACH(compositors, l, c) { - if (c->saver) + if (!c->saver) continue; + c->saver = EINA_FALSE; + EINA_LIST_FOREACH(c->zones, ll, zone) { - 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); - } + 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); } } + 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_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? - 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) -{ - Evas_Object *o; - -#define COLOR_INCREMENT 30 - o = evas_object_rectangle_add(c->evas); - if (color->r < 256 - COLOR_INCREMENT) - evas_object_color_set(o, (color->r += COLOR_INCREMENT), 0, 0, 255); - else if (color->g < 256 - COLOR_INCREMENT) - evas_object_color_set(o, 0, (color->g += COLOR_INCREMENT), 0, 255); - 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); - c->debug_rects = eina_list_append(c->debug_rects, o); - evas_object_show(o); -} -#endif - -static Eina_Bool -_e_comp_shapes_update_object_checker_function_thingy(E_Comp *c, Evas_Object *o) -{ - Eina_List *l, *ll; - E_Container *con; - 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 == 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; - } - 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) -#else -_e_comp_shapes_update_comp_win_shape_comp_helper(E_Comp_Win *cw, Eina_Tiler *tb) -#endif -{ - int x, y, w, h; - - /* ignore deleted shapes */ - if (!cw->shape) - { - SHAPE_INF("IGNORING DELETED: %u", cw->win); - 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)) - { - SHAPE_DBG("SKIPPING SHAPE"); - 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); -#endif - - if (cw->shape->shape_input_rects || cw->shape->shape_rects) - { - int num, tot; - Eina_Rectangle *rect, *rects; - - /* add the frame */ - if (cw->bd) - { - if (cw->bd->client_inset.calc) - { - 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); - } - } - } - rects = cw->shape->shape_rects ?: cw->shape->shape_input_rects; - tot = cw->shape->shape_rects_num ?: cw->shape->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); - if ((w < 1) || (h < 1)) continue; - //#ifdef SHAPE_DEBUG not sure we can shape check these? - //r = E_NEW(Eina_Rectangle, 1); - //EINA_RECTANGLE_SET(r, x, y, w, h); - //rl = eina_list_append(rl, r); - //#endif - eina_tiler_rect_del(tb, &(Eina_Rectangle){x, y, w, h}); - SHAPE_INF("DEL: %d,%d@%dx%d", x, y, w, h); - } - 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); - *rl = eina_list_append(*rl, r); - } -#endif - if (cw->real_obj) - { - eina_tiler_rect_add(tb, &(Eina_Rectangle){x, y, w, h}); - SHAPE_INF("ADD: %d,%d@%dx%d", x, y, w, 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); - } - } -} - -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; - 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; - E_Color color = {0}; -#endif - - 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); - 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; - - 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))) - { - 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 -#ifdef SHAPE_DEBUG - ,&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); - } - } - - ti = eina_tiler_iterator_new(tb); - tile_count = 128; - exr = malloc(sizeof(Ecore_X_Rectangle) * tile_count); - i = 0; - EINA_ITERATOR_FOREACH(ti, tr) - { - exr[i++] = *(Ecore_X_Rectangle*)((char*)tr); - if (i == tile_count - 1) - exr = realloc(exr, sizeof(Ecore_X_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); - 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)) - ERR("POSSIBLE RECT FAIL!!!!"); - } -#endif - } - ecore_x_window_shape_input_rectangles_set(c->win, exr, i); -#ifdef SHAPE_DEBUG - E_FREE_LIST(rl, free); - printf("\n"); -#endif - free(exr); - eina_iterator_free(ti); - eina_tiler_free(tb); - 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) -{ - 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(); - } - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_e_comp_signal_user(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Event_Signal_User *ev = event; - - if (ev->number == 1) - { - // e17 uses this to pop up config panel - } - else if (ev->number == 2) - { - _e_comp_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_util_dialog_internal - (_("Compositor Warning"), - _("Your display driver does not support OpenGL, GLSL
" - "shaders or no OpenGL engines were compiled or installed
" - "for Evas or Ecore-Evas. Falling back to software engine.
" - "
" - "You will need an OpenGL 2.0 (or OpenGL ES 2.0) capable
" - "GPU to use OpenGL with compositing.")); -} - -static E_Comp * -_e_comp_add(E_Manager *man) -{ - E_Comp *c; - Ecore_X_Window_Attributes att; - Eina_Bool res; - - c = calloc(1, sizeof(E_Comp)); - if (!c) return NULL; - - res = ecore_x_screen_is_composited(man->num); - if (res) - { - e_util_dialog_internal - (_("Compositor Error"), _("Another compositor is already running
" - "on your display server.")); - free(c); - return NULL; - } - - 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); - - 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
" - "compositor overlay window. This is needed
" - "for it to function.")); - free(c); - return NULL; - } - - 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.
" - "This is required to be your default depth
" - "setting for the compositor to work properly.")); - ecore_x_composite_render_window_disable(c->win); - free(c); - return NULL; - */ - } - - 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; - - 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) - { - c->gl = 1; - ecore_evas_gl_x11_pre_post_swap_callback_set - (c->ee, c, _e_comp_pre_swap, NULL); - } - } - 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); -} - -static void -_e_comp_del(E_Comp *c) -{ - 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_FREE(c->zones, cz) - { - if (cz->zone) cz->zone->comp_zone = NULL; - evas_object_del(cz->base); - evas_object_del(cz->over); - if (!conf->nofade) - { - 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); - } - } - 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); -} - -////////////////////////////////////////////////////////////////////////// - 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) +static Evas_Object * +_e_comp_act_opacity_obj_finder(E_Object *obj) { - 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) -{ - 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,19 +1153,44 @@ 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 void +e_comp_render_queue(E_Comp *c) +{ + E_OBJECT_CHECK(c); + E_OBJECT_TYPE_CHECK(c, E_COMP_TYPE); + if (!c) return; + + if (conf->lock_fps) + { + ecore_animator_thaw(c->render_animator); + } + else + { + if (c->update_job) + { + 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_shape_queue(E_Comp *c) +{ + EINA_SAFETY_ON_NULL_RETURN(c); + + if (!c->shape_job) + c->shape_job = ecore_job_add((Ecore_Cb)_e_comp_shapes_update_job, c); +} + EAPI E_Comp_Config * e_comp_config_get(void) { @@ -4619,145 +1211,47 @@ e_comp_shadows_reset(void) EINA_LIST_FOREACH(compositors, l, c) { - E_Comp_Win *cw; + E_Client *ec; - // 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) - { - if ((!cw->shobj) || (!cw->obj)) continue; - _e_comp_win_shadow_setup(cw); - } - } -} - -EAPI void -e_comp_render_update(E_Comp *c) -{ - _e_comp_render_queue(c); -} - -EAPI E_Comp_Win * -e_comp_win_find_client_win(Ecore_X_Window win) -{ - return _e_comp_border_client_find(win); -} - -EAPI E_Comp_Win * -e_comp_win_find(Ecore_X_Window win) -{ - return _e_comp_win_find(win); -} - -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) -{ - if ((!cw) || (!cw->c)) return NULL; - return _e_comp_win_mirror_add(cw); -} - -EAPI void -e_comp_win_hidden_set(E_Comp_Win *cw, Eina_Bool hidden) -{ - 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); - } -} - -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) - { - 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_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) + +EAPI Ecore_Window +e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y) { + E_Client *ec; 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) -{ - E_Comp_Win *cw; - 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; -} - -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) -{ - 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); -} - -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) - { - 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); -} - -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); - 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)); - } - } - } - 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; + 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_util_wins_print(const E_Comp *c) { - E_Comp_Win *cw; + Evas_Object *o; if (!c) c = e_comp_get(NULL); - EINA_INLIST_FOREACH(c->wins, cw) + o = evas_object_top_get(c->evas); + while (o) { - 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)); + E_Client *ec; + int x, y, w, h; + + 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 - { - 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" : ""); - } + 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); } + fputc('\n', stderr); } EAPI void -e_comp_ignore_win_add(Ecore_X_Window win) +e_comp_ignore_win_add(E_Pixmap_Type type, Ecore_Window win) { - E_Comp_Win *cw; + E_Client *ec; - 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); + 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_win_opacity_set(E_Comp_Win *cw, unsigned int opacity) +e_comp_ignore_win_del(E_Pixmap_Type type, 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); - } + 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 Eina_Bool +e_comp_ignore_win_find(Ecore_Window win) +{ + 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,167 +1424,57 @@ 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_List *l; + E_Comp *c; - EINA_SAFETY_ON_NULL_RETURN(cw); - 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)) + EINA_LIST_FOREACH(compositors, l, c) { - 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; + if ((c->win == win) || (c->ee_win == win) || (c->man->root == win)) return c; } - edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj); - if (cw->effect_clip) - { - evas_object_clip_unset(cw->effect_obj); - cw->effect_clip = 0; - } - 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); -} - -static void -_e_comp_win_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_win_effect_end_cb, NULL); -} - -EAPI void -e_comp_win_effect_clip(E_Comp_Win *cw) -{ - 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; -} - -EAPI void -e_comp_win_effect_unclip(E_Comp_Win *cw) -{ - EINA_SAFETY_ON_NULL_RETURN(cw); - if (!cw->effect_clip) return; - evas_object_clip_unset(cw->effect_obj); - cw->effect_clip = 0; -} - -EAPI void -e_comp_win_effect_start(E_Comp_Win *cw, Edje_Signal_Cb end_cb, const void *end_data) -{ - 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"); -} - -EAPI void -e_comp_win_effect_stop(E_Comp_Win *cw, Edje_Signal_Cb end_cb EINA_UNUSED) -{ - 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); + 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); } EAPI unsigned int e_comp_e_object_layer_get(const E_Object *obj) { + E_Gadcon *gc = NULL; + 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; + 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; case E_WIN_TYPE: - return E_COMP_CANVAS_LAYER_LAYOUT + ((E_Win *)(obj))->border->layer; + return ((E_Win *)(obj))->client->layer; case E_ZONE_TYPE: - return E_COMP_CANVAS_LAYER_DESKTOP; + return E_LAYER_DESKTOP; - case E_BORDER_TYPE: - return E_COMP_CANVAS_LAYER_LAYOUT + ((E_Border *)(obj))->layer; - - case E_POPUP_TYPE: - return ((E_Popup *)(obj))->comp_layer + ((E_Popup *)(obj))->layer; + case E_CLIENT_TYPE: + return ((E_Client *)(obj))->layer; /* FIXME: add more types as needed */ default: @@ -5349,9 +1483,61 @@ e_comp_e_object_layer_get(const E_Object *obj) return 0; } -EAPI void -e_comp_shape_queue(E_Comp *c) +EAPI Eina_Bool +e_comp_grab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd) { - if (!c->shape_job) - c->shape_job = ecore_job_add((Ecore_Cb)_e_comp_shapes_update_job, c); + return e_grabinput_get((!!mouse) * c->ee_win, 0, (!!kbd) * c->ee_win); +} + +EAPI void +e_comp_ungrab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd) +{ + 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_gl_set(Eina_Bool set) +{ + gl_avail = !!set; +} + +EAPI Eina_Bool +e_comp_gl_get(void) +{ + return gl_avail; +} + +EAPI E_Comp * +e_comp_evas_find(const Evas *e) +{ + Eina_List *l; + E_Comp *c; + + EINA_LIST_FOREACH(compositors, l, c) + if (c->evas == e) return c; + return NULL; +} + +EAPI void +e_comp_button_bindings_ungrab_all(void) +{ + Eina_List *l; + E_Comp *c; + + EINA_LIST_FOREACH(compositors, l, c) + if (c->bindings_ungrab_cb) + c->bindings_ungrab_cb(c); +} + +EAPI void +e_comp_button_bindings_grab_all(void) +{ + 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 5e8c9c1b7..d360aeb11 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_util_client_is_fullscreen(const E_Client *ec) { - E_Comp *c; - - EINA_SAFETY_ON_NULL_RETURN_VAL(o, EINA_FALSE); - c = e_comp_get(o); - return c ? !!c->evas : EINA_FALSE; + 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) + ); } -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) -{ - 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; -} - -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 000000000..87b5915ea --- /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 000000000..30d6af5d4 --- /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 000000000..da32b1af2 --- /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 000000000..040a174f2 --- /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 dae8c021d..000000000 --- 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 3b355f1b2..000000000 --- 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 2f23abf00..159254b99 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 /* 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 912f9bf05..c264fc21b 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 000000000..e0ca54526 --- /dev/null +++ b/src/bin/e_comp_x.c @@ -0,0 +1,4851 @@ +#include "e.h" +#include + +#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
" + "shaders or no OpenGL engines were compiled or installed
" + "for Evas or Ecore-Evas. Falling back to software engine.
" + "
" + "You will need an OpenGL 2.0 (or OpenGL ES 2.0) capable
" + "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
" + "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
" + "compositor overlay window. This is needed
" + "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.
" + "This is required to be your default depth
" + "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 000000000..a2d6fcaa5 --- /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 d8f8f4c0b..1f37bba55 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; + E_Dialog *dia; + char buf[8192]; - dia = e_dialog_new(e_container_current_get(e_manager_current_get()), - "E", "_sys_error_logout_slow"); - if (dia) - { - char buf[8192]; + if (_e_config_error_dialog) return; - 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
" - "from:
" - "%s
" - "
" - "to:
" - "%s
" - "
" - "The rest of the write has been aborted for safety.
"), - 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; - } - } + 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
" + "from:
" + "%s
" + "
" + "to:
" + "%s
" + "
" + "The rest of the write has been aborted for safety.
"), + 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 a7e3f5928..f873eeec9 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 cf2263dbc..8f56a0e2b 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 7e1e5b4bf..3b50eb08b 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 6d0459c1a..f16af30b7 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 4e5466e9a..cd6851c8a 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 7dc862d36..14dbc5dbd 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 fc354af76..000000000 --- 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 4619a7502..000000000 --- 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 b156e1989..f080e8411 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) { - desk = zone->desks[d_x + zone->desk_x_count * d_y]; - ok = 0; + 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; + } - 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); - } + if (!ok) + { + 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 (ec->deskshow) { - if (bd->deskshow) - { - bd->deskshow = 0; - e_border_uniconify(bd); - } - } - else - { - 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) { - desk = zone->desks[d_x + zone->desk_x_count * d_y]; - ok = 0; + 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; + } - 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); - } + if (!ok) + { + 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 b8d06dc0c..4d6985b46 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 cddd54198..009871bca 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 6306f9665..374a4d0b0 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 d0cb1fb88..ef8459de5 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 a6d8bd6dd..786e1d756 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 b923d04b4..f6609d5a4 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 9ec238db5..44adc67d8 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 52a3b7c73..73e82ff5a 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 37614b6ac..33f2613c1 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 2544b75b2..866c90314 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 83bdf35f0..a5115cc76 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 d0236ce13..5944f4285 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 eb0a5d180..f3c9a5a39 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; + const Eina_List *l, *ll; + E_Client *ec; + E_Comp *c; - 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; - } - } + 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 86090b80b..c76c8fff8 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 fb662d5a2..67fcd32e8 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 10abca6a7..853194d9d 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 275bfc860..e2d25caec 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 28b70952b..d5ab2d949 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 ce069b8ab..9b20560cd 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 a575077f2..c977a3392 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 979c3b463..e7ce99905 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 47629480b..b09a253f2 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; } @@ -40,6 +40,14 @@ _e_gadcon_popup_locked_set(E_Gadcon_Popup *pop, Eina_Bool locked) pop->gadcon_was_locked = 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) { @@ -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 1368adf82..bb5c0c5c8 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 c875a413d..9bd5296f2 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 2dfd3cdf0..48c1057bc 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 b3acbc000..b6715573b 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 40ba968b2..61de71943 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 (strcmp(name, "Enlightenment")) { - if (name) - { - if (strcmp(name, "Enlightenment")) - { - free(name); - break; - } - free(name); - } + free(name); + break; } - ecore_x_sync(); - 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(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); } } - - /* 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). - */ -/* 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. - */ -/* 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"); -/* this makes openoffice.org read gtk settings so it doesn't look like shit */ - e_hints_openoffice_gnome_fake(roots[i]); - - ecore_x_netwm_supported_set(roots[i], 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"); + 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); } - free(roots); } + +/* +* 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. +*/ +/* 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(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(root); + + 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"); + 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); - } - } + unsigned int i = 0; + Ecore_X_Window *clients = NULL; - clients = calloc(num, sizeof(Ecore_X_Window)); - if (!clients) - return; + if (man->comp->clients) + { + E_Client *ec; + const Eina_List *ll; - /* Fetch window IDs and add to array */ - if (num > 0) - { - EINA_LIST_FOREACH(e_manager_list(), ml, m) - { - i = 0; - EINA_LIST_FOREACH(m->containers, cl, c) + clients = calloc(e_clients_count(man->comp), sizeof(Ecore_X_Window)); + EINA_LIST_FOREACH(man->comp->clients, ll, ec) { - 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 - { - 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; } - e_container_border_list_free(bl); + 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; + } + } + + 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; + 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(bd->client.win, &state, &num); + 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; + 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(bd->client.win, &action, &num); + 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 a4746dd1a..d945df5f4 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 5248f6120..e29afdf30 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 0bf09e121..805998e23 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 9b29932b2..c08682125 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 5e3e22752..6722cb862 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 8cb36ee5b..cba8d036b 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 e1755ffd1..a7e3fd5c0 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 150824680..000000000 --- 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 460036fc2..000000000 --- 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 similarity index 63% rename from src/bin/e_int_border_locks.c rename to src/bin/e_int_client_locks.c index a7f267c08..a15b28ec2 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 similarity index 69% rename from src/bin/e_int_border_locks.h rename to src/bin/e_int_client_locks.h index 1d3b94375..9cf421cfe 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 similarity index 54% rename from src/bin/e_int_border_menu.c rename to src/bin/e_int_client_menu.c index 2dc9419bc..f6ada3f86 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 000000000..e5cbe4c75 --- /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 similarity index 71% rename from src/bin/e_int_border_prop.c rename to src/bin/e_int_client_prop.c index e75a76e92..8fb112944 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; + 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(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) + 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 similarity index 69% rename from src/bin/e_int_border_prop.h rename to src/bin/e_int_client_prop.h index 089a9837c..85464572b 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 similarity index 84% rename from src/bin/e_int_border_remember.c rename to src/bin/e_int_client_remember.c index 17ce596c9..013b325b6 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); + 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(bd->client.icccm.name, rem->name))) - match &= ~E_REMEMBER_MATCH_NAME; + 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(bd->client.icccm.class, rem->class))) - match &= ~E_REMEMBER_MATCH_CLASS; + 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_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_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)bd->client.netwm.type)) - match &= ~E_REMEMBER_MATCH_TYPE; + 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 && bd->client.icccm.transient_for != 0) || - (!rem->transient && (bd->client.icccm.transient_for == 0)))) - match &= ~E_REMEMBER_MATCH_TRANSIENT; + 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 (match == 0) n++; - if (update) - { - bd->changed = 1; - bd->changes.icon = 1; - } - else if (n > 1) - break; - } + 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 000000000..379db8242 --- /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 f4d274604..8a33d5eb2 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 f1ad81ce7..982d3918b 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 f89d967b0..a0b98b1e6 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 8eb863780..79b092d44 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 a03f1d7ab..130e34f3e 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 37b452347..4faa96373 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 ee25b08ec..5d5b6db6f 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,27 +712,9 @@ 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"); @@ -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_comp_shutdown(); - e_border_shutdown(); - e_focus_shutdown(); - e_exehist_shutdown(); e_menu_shutdown(); + e_shelf_shutdown(); + e_comp_shutdown(); + e_client_shutdown(); + e_exehist_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; + 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_%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); - } + 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 3d167cd02..0e1480c0d 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); - -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 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 - -/* local subsystem globals */ - -typedef struct _Frame_Extents Frame_Extents; - -struct _Frame_Extents -{ - int l, r, t, b; -}; - EAPI int E_EVENT_MANAGER_KEYS_GRAB = -1; -EAPI int E_EVENT_MANAGER_COMP_SET = -1; 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 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_cb_key_down(void *data, int ev_type EINA_UNUSED, Ecore_Event_Key *ev) +{ + E_Manager *man = data; + + if (ev->event_window != man->root) + { + E_Client *ec; + + 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); +} + +static Eina_Bool +_e_manager_cb_key_up(void *data, int ev_type EINA_UNUSED, Ecore_Event_Key *ev) +{ + E_Manager *man = data; + + 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_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 38224edca..72957d336 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 0ec2e2f9b..f6e092af5 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 e081e059b..95d3aa416 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 a94ce9513..5c426fc89 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 8c4d05c29..46fbf1def 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 b5981e1ec..f57a5ef55 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 07debc386..d44990071 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 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 E_Popup *_disp_pop = NULL; +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,70 +37,64 @@ 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_client_extents(ec, &w, &h); - _e_resize_border_extents(bd, &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"); edje_object_part_text_set(o, "e.text.label", buf); 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); - - 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); - snprintf(buf, sizeof(buf), _("%i×%i"), w, h); edje_object_part_text_set(o, "e.text.label", buf); + + _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); + + 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 483b94fc2..1d3f4eb7e 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 bafe057d9..600cfc8e6 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 2316b5ee8..1f2607989 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 000000000..72d91ac95 --- /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 000000000..4aabd7ede --- /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 e7878cc92..7086f6b6e 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 (!((bd->sticky) || (bd->desk == desk))) continue; + if (eina_list_data_find(skiplist, ec)) continue; - bx = bd->x - desk->zone->x; - by = bd->y - desk->zone->y; - bw = bd->w; - bh = bd->h; + if (!((ec->sticky) || (ec->desk == desk))) continue; + + 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 33b6b47e2..000000000 --- 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 86107b3a2..000000000 --- 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 d670367c2..1e42a6a09 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; + 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; + 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); + 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); - } + 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 c5d79cbf7..e5c9f36ae 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 c760eb759..6f6548133 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 (ec->offer_resistance && (!eina_list_data_find(skiplist, ec))) { - if (bd2 == bd) - { - ok = 0; - break; - } - } - if (ok && bd->offer_resistance) - { - 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 212fc983a..c61b7d31f 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 9a05ab8b9..5383547d5 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 471f76c72..a53436c3a 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 2ca4b9bf9..0a234044d 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 b29d35bd7..f4f5578b4 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 1b58f9a56..000000000 --- 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 36205ac7e..000000000 --- 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 1e6136250..7e13f4141 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 2aebbd1d9..9bf822338 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 29c6a2f48..cddbe779b 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 4d9a14c57..154ec843e 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
And another line
Hilighted Text"); @@ -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) +_e_test_internal(E_Comp *c) { - 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) -{ - 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 e1378a4ef..89d656ff3 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 f431e2727..fbecdac3b 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 c8a12ba8f..2bc38e737 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 b5b57927d..b7926d699 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 b9a059749..fe77066b6 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 93f4daae7..e4a9dce63 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) + +EAPI E_Zone * +e_util_comp_zone_number_get(int c_num, int zone_num) { - Eina_List *l; - E_Manager *man; + E_Comp *c; - EINA_LIST_FOREACH(e_manager_list(), l, man) - { - E_Container *con; - - con = e_container_number_get(man, num); - if (con) return con; - } - return NULL; + 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_number_get(int con_num, int zone_num) +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_number_get(con, zone_num); -} - -EAPI E_Zone * -e_util_container_zone_id_get(int con_num, int id) -{ - E_Container *con; - - 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; + E_OBJECT_CHECK_RETURN(ec, NULL); + E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL); + + for (ec2 = e_client_above_get(ec); ec2; ec2 = e_client_above_get(ec2)) + { + if ((ec2->desk == ec->desk) || (ec2->sticky)) return ec2; + } + return NULL; } -EAPI E_Border * -e_util_desk_border_above(E_Border *bd) +EAPI E_Client * +e_util_desk_client_below(E_Client *ec) { - E_Border *bd2, *above = NULL; - Eina_List *l; - int pos, i; + E_Client *ec2; - E_OBJECT_CHECK_RETURN(bd, NULL); - E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, NULL); + E_OBJECT_CHECK_RETURN(ec, NULL); + E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_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_below_get(ec); ec2; ec2 = e_client_below_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; -} - -EAPI E_Border * -e_util_desk_border_below(E_Border *bd) -{ - 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); - - pos = _e_util_layer_map(bd->layer); - - for (l = eina_list_data_find_list(bd->zone->container->layers[pos].clients, bd); l; l = l->prev) - { - 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 (!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; + 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; - } - } + 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 8e0aa3d8c..6ab2b0bcb 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 df724a469..00883b635 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 31ce38385..2c19ed08e 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 a93f22908..ef348d6b1 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 + 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; + Ecore_Cb cb; - if (!win->border) return; - if (win->border->visible) e_border_hide(win->border, 1); - e_object_del(E_OBJECT(win->border)); + 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); @@ -747,6 +711,27 @@ _e_win_cb_resize(Ecore_Evas *ee) if (win->cb_resize) win->cb_resize(win); } +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) { @@ -754,7 +739,10 @@ _e_win_cb_delete(Ecore_Evas *ee) 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 4845d5c1f..e63137e75 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 43f7ac8ca..a975bad32 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; } @@ -43,6 +42,15 @@ e_xinerama_screens_all_get(void) return all_screens; } +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) { @@ -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 544154b7f..f802bc3ff 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 f1aacb034..ba4d1a716 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; + Ecore_X_Atom atom; - if (sm->selection == 0) return; - - 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) + if (!_e_xsettings_selection_owner_set(sm)) return 0; - if (!_e_xsettings_selection_owner_set(sm)) - { - ecore_x_window_free(sm->selection); - sm->selection = 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; + const Eina_List *l, *ll; + E_Client *ec; + E_Comp *c; - 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); + 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; + const Eina_List *l, *ll; + E_Client *ec; + E_Comp *c; - 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); + 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 1ada6114f..efd54afd8 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); + + 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; //printf("@@@@@@@@@@ e_zone_new: %i %i | %i %i %ix%i = %p\n", num, id, x, y, w, h, zone); - - 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)); + 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,145 +1043,79 @@ 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: - 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; - - 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; - - 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_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_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_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_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); - - ecore_x_window_show(zone->corner.bottom_right); - } - 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_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); } } } @@ -1145,93 +1123,113 @@ e_zone_edge_new(E_Zone_Edge edge) EAPI void e_zone_edge_free(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; - EINA_LIST_FOREACH(e_manager_list(), l, man) + if (edge == E_ZONE_EDGE_NONE) 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) + switch (edge) { - switch (edge) - { - case E_ZONE_EDGE_NONE: - /* noop */ - break; + 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_LEFT: + E_FREE_FUNC(zone->edge.left, evas_object_del); + 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_RIGHT: + E_FREE_FUNC(zone->edge.right, evas_object_del); + 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_TOP: + E_FREE_FUNC(zone->edge.top, evas_object_del); + 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_BOTTOM: + E_FREE_FUNC(zone->edge.bottom, evas_object_del); + 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_LEFT: + E_FREE_FUNC(zone->corner.left_top, evas_object_del); + E_FREE_FUNC(zone->corner.top_left, evas_object_del); + 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_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_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_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: - 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; - } + 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_win_layer_set(E_Zone *zone, - E_Layer layer) +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); +#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) - 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); + 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); +} + +EAPI void +e_zone_fade_handle(E_Zone *zone, int out, double tim) +{ + EINA_SAFETY_ON_NULL_RETURN(zone); + if (out == 1) + { + if ((e_backlight_exists()) && (!e_comp_config_get()->nofade)) + { + 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); + } + } } 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++) { @@ -1531,163 +1535,6 @@ _e_zone_event_zone_desk_count_set_free(void *data __UNUSED__, free(e); } -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__, @@ -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); + 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); - 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); + 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); - 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); + 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); - 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); + 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); } - -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); - } -} - diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h index f8e79c439..bc749235e 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; diff --git a/src/modules/access/e_mod_config.c b/src/modules/access/e_mod_config.c index af15db087..b57a0fa27 100644 --- a/src/modules/access/e_mod_config.c +++ b/src/modules/access/e_mod_config.c @@ -19,7 +19,6 @@ void _config_pager_module(void) { E_Config_Dialog_View *v; - E_Container *con; if (e_config_dialog_find("E", "_e_mod_access_config_dialog")) return; @@ -31,8 +30,7 @@ _config_pager_module(void) v->basic.create_widgets = _basic_create; v->basic.apply_cfdata = _basic_apply; - con = e_container_current_get(e_manager_current_get()); - e_config_dialog_new(con, _("Access Settings"), "E", + e_config_dialog_new(NULL, _("Access Settings"), "E", "_e_mod_access_config_dialog", "preferences-desktop-access", 0, v, NULL); } diff --git a/src/modules/access/e_mod_main.c b/src/modules/access/e_mod_main.c index 32e97ecd3..3ea6a1bf4 100644 --- a/src/modules/access/e_mod_main.c +++ b/src/modules/access/e_mod_main.c @@ -58,7 +58,7 @@ typedef struct int device; } Multi; -static E_Border *_prev_bd; +static E_Client *_prev_bd; static Ecore_X_Atom _atom_access = 0; static Ecore_X_Window target_win = 0; @@ -89,7 +89,7 @@ _mouse_in_win_get(Cover *cov, int x, int y) then previous target window which has the highlight object should get the message. how? */ target_win = ecore_x_window_shadow_tree_at_xy_with_skip_get - (cov->zone->container->manager->root, x, y, skip, i); + (cov->zone->comp->manager->root, x, y, skip, i); } static unsigned int @@ -353,7 +353,7 @@ _mouse_up(Cover *cov, Ecore_Event_Mouse_Button *ev) /* activate message would change focused window FIXME: but it is possibe to create unfocused window in this case, the message should go to unfocused window? */ - _prev_bd = e_border_focused_get(); + _prev_bd = e_client_focused_get(); INFO(cov, "double_click"); ecore_x_e_illume_access_action_activate_send(target_win); @@ -505,7 +505,7 @@ _cb_mouse_down(void *data __UNUSED__, Cover *cov; int i = 0; int x, y; - E_Border *bd; + E_Client *ec; for (i = 0; i < 3; i++) { @@ -520,7 +520,7 @@ _cb_mouse_down(void *data __UNUSED__, /* activate message would change focused window FIXME: but it is possibe to create unfocused window in this case, the message should go to focused window? */ - bd = e_border_focused_get(); + bd = e_client_focused_get(); if (bd && (bd != _prev_bd)) target_win = bd->client.win; EINA_LIST_FOREACH(covers, l, cov) @@ -738,8 +738,8 @@ _cover_new(E_Zone *zone) #if DEBUG_INFO Ecore_Evas *ee; ee = ecore_evas_new(NULL, - zone->container->x + zone->x, - zone->container->y + zone->y, + zone->comp->x + zone->x, + zone->comp->y + zone->y, zone->w, zone->h, NULL); ecore_evas_alpha_set(ee, EINA_TRUE); @@ -750,7 +750,7 @@ _cover_new(E_Zone *zone) e = ecore_evas_get(ee); cov->info = evas_object_rectangle_add(e); evas_object_color_set(cov->info, 255, 255, 255, 100); - evas_object_move(cov->info, zone->container->x + zone->x, zone->container->y + zone->y); + evas_object_move(cov->info, zone->comp->x + zone->x, zone->comp->y + zone->y); evas_object_resize(cov->info, zone->w, 30); evas_object_show(cov->info); @@ -761,13 +761,13 @@ _cover_new(E_Zone *zone) evas_object_color_set(cov->text, 0, 0, 0, 255); evas_object_resize(cov->text, (zone->w / 8), 20); - evas_object_move(cov->text, zone->container->x + zone->x + 5, zone->container->y + zone->y + 5); + evas_object_move(cov->text, zone->comp->x + zone->x + 5, zone->comp->y + zone->y + 5); evas_object_show(cov->text); #else - cov->win = ecore_x_window_input_new(zone->container->manager->root, - zone->container->x + zone->x, - zone->container->y + zone->y, + cov->win = ecore_x_window_input_new(zone->comp->manager->root, + zone->comp->x + zone->x, + zone->comp->y + zone->y, zone->w, zone->h); #endif @@ -781,7 +781,7 @@ _cover_new(E_Zone *zone) ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, 0, 0, 0, 0, 0, - zone->container->layers[8].win, + zone->comp->layers[8].win, ECORE_X_WINDOW_STACK_ABOVE); ecore_x_window_show(cov->win); ecore_x_window_raise(cov->win); @@ -798,7 +798,7 @@ _covers_init(void) EINA_LIST_FOREACH(e_manager_list(), l, man) { - E_Container *con; + E_Comp *comp; EINA_LIST_FOREACH(man->containers, l2, con) { E_Zone *zone; @@ -928,12 +928,12 @@ _cb_property_change(void *data __UNUSED__, int type __UNUSED__, void *ev) { - E_Border *bd; + E_Client *ec; Ecore_X_Event_Window_Property *event = ev; if (event->atom == ECORE_X_ATOM_NET_ACTIVE_WINDOW) { - bd = e_border_focused_get(); + bd = e_client_focused_get(); if (bd) target_win = bd->client.win; } diff --git a/src/modules/appmenu/e_mod_appmenu_render.c b/src/modules/appmenu/e_mod_appmenu_render.c index 8842f690f..654fef4cc 100644 --- a/src/modules/appmenu/e_mod_appmenu_render.c +++ b/src/modules/appmenu/e_mod_appmenu_render.c @@ -84,8 +84,8 @@ item_menu_open(E_DBusMenu_Item *item, E_Gadcon *gadcon) e_gadcon_locked_set(gadcon, 1); e_menu_post_deactivate_callback_set(m, menu_post_deactivate, gadcon); - 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(e_comp_get(gadcon)->ee, &x, &y); + zone = e_comp_zone_xy_get(e_comp_get(gadcon), x, y); e_menu_activate_mouse(m, zone, x, y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ecore_x_current_time_get()); } diff --git a/src/modules/appmenu/e_mod_main.c b/src/modules/appmenu/e_mod_main.c index 9415078c9..1cc862b83 100644 --- a/src/modules/appmenu/e_mod_main.c +++ b/src/modules/appmenu/e_mod_main.c @@ -119,14 +119,14 @@ static Eina_Bool cb_focus_in(void *data, int type __UNUSED__, void *event) { E_AppMenu_Context *ctxt = data; - E_Event_Border_Focus_In *ev = event; + E_Event_Client *ev = event; Eina_List *l; E_AppMenu_Window *w, *found = NULL; - ctxt->window_with_focus = ev->border->client.win; + ctxt->window_with_focus = e_client_util_win_get(ev->ec); EINA_LIST_FOREACH(ctxt->windows, l, w) { - if (w->window_id == ev->border->client.win) + if (w->window_id == ctxt->window_with_focus) { found = w; break; @@ -168,9 +168,9 @@ e_modapi_init(E_Module *m) eldbus_init(); ctxt->conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); - event = ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN, cb_focus_in, ctxt); + event = ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_IN, cb_focus_in, ctxt); ctxt->events[0] = event; - event = ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT, cb_focus_out, ctxt); + event = ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_OUT, cb_focus_out, ctxt); ctxt->events[1] = event; e_gadcon_provider_register(&_gc_class); diff --git a/src/modules/backlight/e_mod_main.c b/src/modules/backlight/e_mod_main.c index f23396e2a..e7a5e4f6e 100644 --- a/src/modules/backlight/e_mod_main.c +++ b/src/modules/backlight/e_mod_main.c @@ -164,7 +164,7 @@ _backlight_settings_cb(void *d1, void *d2 __UNUSED__) { Instance *inst = d1; e_configure_registry_call("screen/power_management", - inst->gcc->gadcon->zone->container, NULL); + inst->gcc->gadcon->zone->comp, NULL); _backlight_popup_free(inst); } @@ -184,6 +184,12 @@ _backlight_popup_del_cb(void *obj) _backlight_popup_free(e_object_data_get(obj)); } +static void +_backlight_popup_comp_del_cb(void *data, Evas_Object *obj EINA_UNUSED) +{ + _backlight_popup_free(data); +} + static void _backlight_popup_new(Instance *inst) { @@ -197,8 +203,8 @@ _backlight_popup_new(Instance *inst) inst->val = e_backlight_level_get(inst->gcc->gadcon->zone); _backlight_gadget_update(inst); - inst->popup = e_gadcon_popup_new(inst->gcc); - evas = inst->popup->win->evas; + inst->popup = e_gadcon_popup_new(inst->gcc, 0); + evas = e_comp_get(inst->popup)->evas; inst->o_table = e_widget_table_add(evas, 0); @@ -214,8 +220,9 @@ _backlight_popup_new(Instance *inst) 0, 1, 1, 1, 0, 0, 0, 0, 0.5, 1.0); e_gadcon_popup_content_set(inst->popup, inst->o_table); - e_popup_autoclose(inst->popup->win, NULL, _backlight_win_key_down_cb, inst); e_gadcon_popup_show(inst->popup); + e_comp_object_util_autoclose(inst->popup->comp_object, _backlight_popup_comp_del_cb, + _backlight_win_key_down_cb, inst); e_object_data_set(E_OBJECT(inst->popup), inst); E_OBJECT_DEL_SET(inst->popup, _backlight_popup_del_cb); } @@ -233,7 +240,7 @@ _backlight_menu_cb_cfg(void *data, E_Menu *menu __UNUSED__, E_Menu_Item *mi __UN _backlight_popup_free(inst); e_configure_registry_call("screen/power_management", - inst->gcc->gadcon->zone->container, NULL); + inst->gcc->gadcon->zone->comp, NULL); } static void diff --git a/src/modules/battery/e_mod_config.c b/src/modules/battery/e_mod_config.c index c08be45f2..456e89d0e 100644 --- a/src/modules/battery/e_mod_config.c +++ b/src/modules/battery/e_mod_config.c @@ -43,7 +43,7 @@ static int _advanced_check_changed(E_Config_Dialog *cfd, E_Config_Dialo static void _cb_radio_changed(void *data, Evas_Object *obj __UNUSED__); E_Config_Dialog * -e_int_config_battery_module(E_Container *con, const char *params __UNUSED__) +e_int_config_battery_module(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -61,7 +61,7 @@ e_int_config_battery_module(E_Container *con, const char *params __UNUSED__) snprintf(buf, sizeof(buf), "%s/e-module-battery.edj", e_module_dir_get(battery_config->module)); - cfd = e_config_dialog_new(con, _("Battery Monitor Settings"), + cfd = e_config_dialog_new(comp, _("Battery Monitor Settings"), "E", "_e_mod_battery_config_dialog", buf, 0, v, NULL); battery_config->config_dialog = cfd; diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c index 3a2edeaab..a2d16938c 100644 --- a/src/modules/battery/e_mod_main.c +++ b/src/modules/battery/e_mod_main.c @@ -246,7 +246,7 @@ _battery_face_time_set(Evas_Object *battery, int t) static void _battery_face_cb_menu_powermanagement(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__) { - e_configure_registry_call("advanced/powermanagement", m->zone->container, NULL); + e_configure_registry_call("advanced/powermanagement", m->zone->comp, NULL); } static void @@ -254,7 +254,7 @@ _battery_face_cb_menu_configure(void *data __UNUSED__, E_Menu *m, E_Menu_Item *m { if (!battery_config) return; if (battery_config->config_dialog) return; - e_int_config_battery_module(m->zone->container, NULL); + e_int_config_battery_module(m->zone->comp, NULL); } Battery * @@ -423,9 +423,8 @@ _battery_warning_popup_destroy(Instance *inst) battery_config->alert_timer = NULL; } if ((!inst) || (!inst->warning)) return; - e_object_del(E_OBJECT(inst->warning)); - inst->warning = NULL; - inst->popup_battery = NULL; + E_FREE_FUNC(inst->popup_battery, evas_object_del); + E_FREE_FUNC(inst->warning, e_object_del); } #ifdef HAVE_ENOTIFY @@ -462,10 +461,10 @@ _battery_warning_popup(Instance *inst, int t, double percent) return; } #endif - inst->warning = e_gadcon_popup_new(inst->gcc); + inst->warning = e_gadcon_popup_new(inst->gcc, 0); if (!inst->warning) return; - e = inst->warning->win->evas; + e = e_comp_get(inst->warning)->evas; popup_bg = edje_object_add(e); inst->popup_battery = edje_object_add(e); @@ -486,7 +485,6 @@ _battery_warning_popup(Instance *inst, int t, double percent) else edje_object_part_swallow(popup_bg, "battery", inst->popup_battery); - e_popup_object_add(inst->warning->win, inst->popup_battery); edje_object_part_text_set(popup_bg, "e.text.title", _("Your battery is low!")); edje_object_part_text_set(popup_bg, "e.text.label", diff --git a/src/modules/battery/e_mod_main.h b/src/modules/battery/e_mod_main.h index a647cf7a1..72ae42a45 100644 --- a/src/modules/battery/e_mod_main.h +++ b/src/modules/battery/e_mod_main.h @@ -139,7 +139,7 @@ EAPI void *e_modapi_init (E_Module *m); EAPI int e_modapi_shutdown (E_Module *m); EAPI int e_modapi_save (E_Module *m); -E_Config_Dialog *e_int_config_battery_module(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_battery_module(E_Comp *comp, const char *params __UNUSED__); void _battery_config_updated(void); extern Config *battery_config; diff --git a/src/modules/bluez4/agent.c b/src/modules/bluez4/agent.c index e60a032e2..27f138888 100644 --- a/src/modules/bluez4/agent.c +++ b/src/modules/bluez4/agent.c @@ -52,11 +52,9 @@ static E_Dialog * _create_dialog(const char *title, const char *msg, const char *icon, const char *class) { - E_Container *con; E_Dialog *dialog; - con = e_container_current_get(e_manager_current_get()); - dialog = e_dialog_new(con, title, class); + dialog = e_dialog_new(NULL, title, class); e_dialog_title_set(dialog, _(title)); e_dialog_icon_set(dialog, icon, 64); e_dialog_text_set(dialog, msg); diff --git a/src/modules/bluez4/e_mod_main.c b/src/modules/bluez4/e_mod_main.c index 5a7b74578..a6a4c4538 100644 --- a/src/modules/bluez4/e_mod_main.c +++ b/src/modules/bluez4/e_mod_main.c @@ -106,16 +106,13 @@ static void _ebluez4_cb_search(void *data, E_Menu *m, E_Menu_Item *mi) { Instance *inst = data; - E_Container *con; E_Dialog *dialog; Evas *evas; if (inst->search_dialog) _ebluez4_search_dialog_del(inst); - con = e_container_current_get(e_manager_current_get()); - - dialog = e_dialog_new(con, "Search Dialog", "search"); + dialog = e_dialog_new(NULL, "Search Dialog", "search"); e_dialog_title_set(dialog, _("Searching for Devices...")); e_dialog_resizable_set(dialog, EINA_TRUE); e_win_delete_callback_set(dialog->win, _ebluez4_cb_search_dialog_del); @@ -173,7 +170,6 @@ static void _ebluez4_cb_adap_settings(void *data) { Adapter *adap = data; - E_Container *con; E_Dialog *dialog; Evas *evas; Evas_Object *list; @@ -184,9 +180,7 @@ _ebluez4_cb_adap_settings(void *data) if (adap->dialog) ebluez4_adapter_settings_del(adap->dialog); - con = e_container_current_get(e_manager_current_get()); - - dialog = e_dialog_new(con, "Adapter Dialog", "adapter"); + dialog = e_dialog_new(NULL, "Adapter Dialog", "adapter"); e_dialog_title_set(dialog, _("Adapter Settings")); e_dialog_resizable_set(dialog, EINA_TRUE); e_win_delete_callback_set(dialog->win, _ebluez4_cb_adap_settings_dialog_del); @@ -251,16 +245,13 @@ static void _ebluez4_cb_adap_list(void *data, E_Menu *m, E_Menu_Item *mi) { Instance *inst = data; - E_Container *con; E_Dialog *dialog; Evas *evas; if (inst->adapters_dialog) _ebluez4_adap_list_dialog_del(inst); - con = e_container_current_get(e_manager_current_get()); - - dialog = e_dialog_new(con, "Adapters Dialog", "adapters"); + dialog = e_dialog_new(NULL, "Adapters Dialog", "adapters"); e_dialog_title_set(dialog, _("Adapters Available")); e_dialog_resizable_set(dialog, EINA_TRUE); e_win_delete_callback_set(dialog->win, _ebluez4_cb_adap_list_dialog_del); @@ -461,8 +452,8 @@ _ebluez4_menu_new(Instance *inst) e_menu_item_label_set(mi, _("Adapter Settings")); e_menu_item_callback_set(mi, _ebluez4_cb_adap_list, inst); - 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(e_comp_get(inst->gcc)->ee, &x, &y); + zone = e_comp_zone_xy_get(e_comp_get(inst->gcc), x, y); e_menu_activate_mouse(m, zone, x, y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ecore_x_current_time_get()); } diff --git a/src/modules/clock/e_mod_config.c b/src/modules/clock/e_mod_config.c index ca3ed4e72..9e2ac8c07 100644 --- a/src/modules/clock/e_mod_config.c +++ b/src/modules/clock/e_mod_config.c @@ -17,7 +17,7 @@ static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); void -e_int_config_clock_module(E_Container *con, Config_Item *ci) +e_int_config_clock_module(E_Comp *comp, Config_Item *ci) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -33,7 +33,7 @@ e_int_config_clock_module(E_Container *con, Config_Item *ci) snprintf(buf, sizeof(buf), "%s/e-module-clock.edj", e_module_dir_get(clock_config->module)); - cfd = e_config_dialog_new(con, _("Clock Settings"), + cfd = e_config_dialog_new(comp, _("Clock Settings"), "E", "utils/clock", buf, 0, v, ci); clock_config->config_dialog = cfd; } diff --git a/src/modules/clock/e_mod_main.c b/src/modules/clock/e_mod_main.c index 86625c8ec..ac28c2361 100644 --- a/src/modules/clock/e_mod_main.c +++ b/src/modules/clock/e_mod_main.c @@ -12,7 +12,6 @@ struct _Instance E_Gadcon_Client *gcc; Evas_Object *o_clock, *o_table, *o_popclock, *o_cal; E_Gadcon_Popup *popup; - Eina_List *handlers; int madj; @@ -283,28 +282,12 @@ static void _clock_settings_cb(void *d1, void *d2 __UNUSED__) { Instance *inst = d1; - e_int_config_clock_module(inst->popup->win->zone->container, inst->cfg); + e_int_config_clock_module(e_comp_get(inst->popup), inst->cfg); e_object_del(E_OBJECT(inst->popup)); inst->popup = NULL; inst->o_popclock = NULL; } -static Eina_Bool -_clock_popup_fullscreen_change(Instance *inst, int type __UNUSED__, void *ev __UNUSED__) -{ - _clock_popup_free(inst); - return ECORE_CALLBACK_RENEW; -} - -static Eina_Bool -_clock_popup_desk_change(Instance *inst, int type __UNUSED__, E_Event_Desk_After_Show *ev) -{ - if ((!inst->gcc) || (!inst->gcc->gadcon) || (!inst->gcc->gadcon->shelf)) return ECORE_CALLBACK_RENEW; - if (e_shelf_desk_visible(inst->gcc->gadcon->shelf, ev->desk)) return ECORE_CALLBACK_RENEW; - _clock_popup_free(inst); - return ECORE_CALLBACK_RENEW; -} - static void _popclock_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *info __UNUSED__) { @@ -331,8 +314,8 @@ _clock_popup_new(Instance *inst) _time_eval(inst); - inst->popup = e_gadcon_popup_new(inst->gcc); - evas = inst->popup->win->evas; + inst->popup = e_gadcon_popup_new(inst->gcc, 0); + evas = e_comp_get(inst->popup)->evas; inst->o_table = e_widget_table_add(evas, 0); @@ -392,9 +375,6 @@ _clock_popup_new(Instance *inst) e_gadcon_popup_content_set(inst->popup, inst->o_table); e_gadcon_popup_show(inst->popup); - - E_LIST_HANDLER_APPEND(inst->handlers, E_EVENT_DESK_AFTER_SHOW, _clock_popup_desk_change, inst); - E_LIST_HANDLER_APPEND(inst->handlers, E_EVENT_BORDER_FULLSCREEN, _clock_popup_fullscreen_change, inst); } static void @@ -565,9 +545,7 @@ static void _clock_popup_free(Instance *inst) { if (!inst->popup) return; - if (inst->popup) e_object_del(E_OBJECT(inst->popup)); - E_FREE_LIST(inst->handlers, ecore_event_handler_del); - inst->popup = NULL; + E_FREE_FUNC(inst->popup, e_object_del); inst->o_popclock = NULL; } @@ -575,15 +553,9 @@ static void _clock_menu_cb_cfg(void *data, E_Menu *menu __UNUSED__, E_Menu_Item *mi __UNUSED__) { Instance *inst = data; - E_Container *con; - if (inst->popup) - { - e_object_del(E_OBJECT(inst->popup)); - inst->popup = NULL; - } - con = e_container_current_get(e_manager_current_get()); - e_int_config_clock_module(con, inst->cfg); + E_FREE_FUNC(inst->popup, e_object_del); + e_int_config_clock_module(NULL, inst->cfg); } static void diff --git a/src/modules/clock/e_mod_main.h b/src/modules/clock/e_mod_main.h index 66614a6da..6953f7f31 100644 --- a/src/modules/clock/e_mod_main.h +++ b/src/modules/clock/e_mod_main.h @@ -34,7 +34,7 @@ struct _Config_Item Eina_Bool changed; }; -void e_int_config_clock_module(E_Container *con, Config_Item *ci); +void e_int_config_clock_module(E_Comp *comp, Config_Item *ci); void e_int_clock_instances_redo(Eina_Bool all); extern Config *clock_config; diff --git a/src/modules/conf/e_conf.c b/src/modules/conf/e_conf.c index 192c41cc3..11a4e3a7a 100644 --- a/src/modules/conf/e_conf.c +++ b/src/modules/conf/e_conf.c @@ -11,7 +11,7 @@ struct _E_Configure { E_Object e_obj_inherit; - E_Container *con; + E_Comp *comp; E_Win *win; Evas *evas; Evas_Object *edje; @@ -62,10 +62,9 @@ static Eina_Bool _e_configure_module_update_cb(void *data, int type, static E_Configure *_e_configure = NULL; void -e_configure_show(E_Container *con, const char *params) +e_configure_show(E_Comp *comp, const char *params) { E_Configure *eco; - E_Manager *man; Evas_Coord ew, eh, mw, mh; Evas_Object *o; Evas_Modifier_Mask mask; @@ -80,22 +79,22 @@ e_configure_show(E_Container *con, const char *params) eco = _e_configure; z = e_util_zone_current_get(e_manager_current_get()); - z2 = eco->win->border->zone; + z2 = eco->win->client->zone; e_win_show(eco->win); e_win_raise(eco->win); - if (z->container == z2->container) - e_border_desk_set(eco->win->border, e_desk_current_get(z)); + if (z->comp == z2->comp) + e_client_desk_set(eco->win->client, e_desk_current_get(z)); else { - if (!eco->win->border->sticky) - e_desk_show(eco->win->border->desk); - ecore_x_pointer_warp(z2->container->win, + if (!eco->win->client->sticky) + e_desk_show(eco->win->client->desk); + ecore_evas_pointer_warp(z2->comp->ee, z2->x + (z2->w / 2), z2->y + (z2->h / 2)); } - e_border_unshade(eco->win->border, eco->win->border->shade.dir); + e_client_unshade(eco->win->client, eco->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(eco->win->border, 1, 1); + evas_object_focus_set(eco->win->client->frame, 1); EINA_LIST_FOREACH(e_widget_toolbar_items_get(eco->cat_list), l, it) { if (e_widget_toolbar_item_label_get(it) == params) @@ -108,25 +107,16 @@ e_configure_show(E_Container *con, const char *params) return; } - if (!con) - { - man = e_manager_current_get(); - if (!man) return; - con = e_container_current_get(man); - if (!con) con = e_container_number_get(man, 0); - if (!con) return; - } - eco = E_OBJECT_ALLOC(E_Configure, E_CONFIGURE_TYPE, _e_configure_free); if (!eco) return; - eco->win = e_win_new(con); + eco->win = e_win_new(comp); if (!eco->win) { free(eco); return; } eco->win->data = eco; - eco->con = con; + eco->comp = comp; eco->evas = e_win_evas_get(eco->win); /* Event Handler for Module Updates */ @@ -188,7 +178,7 @@ e_configure_show(E_Container *con, const char *params) evas_object_show(eco->edje); e_win_show(eco->win); - e_win_border_icon_set(eco->win, "preferences-system"); + e_win_client_icon_set(eco->win, "preferences-system"); /* Preselect "Appearance" */ e_widget_focus_set(eco->cat_list, 1); @@ -377,7 +367,7 @@ _e_configure_item_cb(void *data) if (!(ci = data)) return; cb = ci->cb; - if (cb->path) e_configure_registry_call(cb->path, cb->eco->con, NULL); + if (cb->path) e_configure_registry_call(cb->path, cb->eco->comp, NULL); } static void diff --git a/src/modules/conf/e_mod_config.c b/src/modules/conf/e_mod_config.c index 81bf88e7c..8f45717cc 100644 --- a/src/modules/conf/e_mod_config.c +++ b/src/modules/conf/e_mod_config.c @@ -13,7 +13,7 @@ static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfd static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); E_Config_Dialog * -e_int_config_conf_module(E_Container *con, const char *params __UNUSED__) +e_int_config_conf_module(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd = NULL; E_Config_Dialog_View *v = NULL; @@ -32,7 +32,7 @@ e_int_config_conf_module(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; snprintf(buf, sizeof(buf), "%s/e-module-conf.edj", conf->module->dir); - cfd = e_config_dialog_new(con, _("Configuration Panel"), "Conf", + cfd = e_config_dialog_new(comp, _("Configuration Panel"), "Conf", "advanced/conf", buf, 0, v, NULL); conf->cfd = cfd; diff --git a/src/modules/conf/e_mod_main.c b/src/modules/conf/e_mod_main.c index 6700cfa78..04f40f015 100644 --- a/src/modules/conf/e_mod_main.c +++ b/src/modules/conf/e_mod_main.c @@ -162,7 +162,7 @@ _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__) if ((eci->pri >= 0) && (eci == data)) { snprintf(buf, sizeof(buf), "%s/%s", ecat->cat, eci->item); - e_configure_registry_call(buf, m->zone->container, NULL); + e_configure_registry_call(buf, m->zone->comp, NULL); } } } @@ -201,7 +201,7 @@ static void _config_item_activate_cb(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__) { E_Configure_Cat *ecat = data; - e_configure_show(m->zone->container, ecat ? ecat->cat : NULL); + e_configure_show(m->zone->comp, ecat ? ecat->cat : NULL); } static void @@ -377,8 +377,8 @@ _e_mod_action_conf_cb(E_Object *obj, const char *params) { if (obj->type == E_MANAGER_TYPE) zone = e_util_zone_current_get((E_Manager *)obj); - else if (obj->type == E_CONTAINER_TYPE) - zone = e_util_zone_current_get(((E_Container *)obj)->manager); + else if (obj->type == E_COMP_TYPE) + zone = e_zone_current_get((E_Comp*)obj); else if (obj->type == E_ZONE_TYPE) zone = ((E_Zone *)obj); else @@ -386,16 +386,16 @@ _e_mod_action_conf_cb(E_Object *obj, const char *params) } if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); if ((zone) && (params)) - e_configure_registry_call(params, zone->container, params); + e_configure_registry_call(params, zone->comp, params); else if (zone) - e_configure_show(zone->container, params); + e_configure_show(zone->comp, params); } /* menu item callback(s) */ static void _e_mod_conf_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__) { - e_configure_show(m->zone->container, NULL); + e_configure_show(m->zone->comp, NULL); } static void diff --git a/src/modules/conf/e_mod_main.h b/src/modules/conf/e_mod_main.h index 8e2f324a6..25cbd3ce0 100644 --- a/src/modules/conf/e_mod_main.h +++ b/src/modules/conf/e_mod_main.h @@ -17,10 +17,10 @@ struct _Config int menu_augmentation; }; -void e_configure_show(E_Container *con, const char *params); +void e_configure_show(E_Comp *comp, const char *params); void e_configure_del(void); -E_Config_Dialog *e_int_config_conf_module(E_Container *con, const char *params); +E_Config_Dialog *e_int_config_conf_module(E_Comp *comp, const char *params); void e_mod_config_menu_add(void *data, E_Menu *m); extern Config *conf; diff --git a/src/modules/conf_applications/e_int_config_apps.c b/src/modules/conf_applications/e_int_config_apps.c index f3d939df4..d6b4818be 100644 --- a/src/modules/conf_applications/e_int_config_apps.c +++ b/src/modules/conf_applications/e_int_config_apps.c @@ -25,7 +25,7 @@ struct _E_Config_Dialog_Data }; /* local function prototypes */ -static E_Config_Dialog *_create_dialog(E_Container *con, E_Config_Data *data); +static E_Config_Dialog *_create_dialog(E_Comp *comp, E_Config_Data *data); static void *_create_data(E_Config_Dialog *cfd); static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata); @@ -49,16 +49,16 @@ static void _cb_order_del(void *data, void *data2 __UNUSED__); static Eina_Bool _cb_fill_delay(void *data); E_Config_Dialog * -e_int_config_apps_add(E_Container *con, const char *params __UNUSED__) +e_int_config_apps_add(E_Comp *comp, const char *params __UNUSED__) { E_Desktop_Edit *ed; - if (!(ed = e_desktop_edit(con, NULL))) return NULL; + if (!(ed = e_desktop_edit(comp, NULL))) return NULL; return ed->cfd; } E_Config_Dialog * -e_int_config_apps_favs(E_Container *con, const char *params __UNUSED__) +e_int_config_apps_favs(E_Comp *comp, const char *params __UNUSED__) { E_Config_Data *data; char buff[PATH_MAX]; @@ -69,11 +69,11 @@ e_int_config_apps_favs(E_Container *con, const char *params __UNUSED__) data->dialog = eina_stringshare_add("menus/favorites_menu"); data->icon = eina_stringshare_add("user-bookmarks"); data->filename = eina_stringshare_add(buff); - return _create_dialog(con, data); + return _create_dialog(comp, data); } E_Config_Dialog * -e_int_config_apps_ibar(E_Container *con, const char *params __UNUSED__) +e_int_config_apps_ibar(E_Comp *comp, const char *params __UNUSED__) { E_Config_Data *data; char buff[PATH_MAX]; @@ -84,11 +84,11 @@ e_int_config_apps_ibar(E_Container *con, const char *params __UNUSED__) data->dialog = eina_stringshare_add("applications/ibar_applications"); data->icon = eina_stringshare_add("preferences-applications-ibar"); data->filename = eina_stringshare_add(buff); - return _create_dialog(con, data); + return _create_dialog(comp, data); } E_Config_Dialog * -e_int_config_apps_ibar_other(E_Container *con, const char *path) +e_int_config_apps_ibar_other(E_Comp *comp, const char *path) { E_Config_Data *data; @@ -98,11 +98,11 @@ e_int_config_apps_ibar_other(E_Container *con, const char *path) data->dialog = eina_stringshare_add("internal/ibar_other"); data->icon = eina_stringshare_add("preferences-applications-ibar"); data->filename = eina_stringshare_add(path); - return _create_dialog(con, data); + return _create_dialog(comp, data); } E_Config_Dialog * -e_int_config_apps_startup(E_Container *con, const char *params __UNUSED__) +e_int_config_apps_startup(E_Comp *comp, const char *params __UNUSED__) { E_Config_Data *data; char buff[PATH_MAX]; @@ -114,11 +114,11 @@ e_int_config_apps_startup(E_Container *con, const char *params __UNUSED__) data->icon = eina_stringshare_add("preferences-applications-startup"); data->filename = eina_stringshare_add(buff); data->show_autostart = EINA_TRUE; - return _create_dialog(con, data); + return _create_dialog(comp, data); } E_Config_Dialog * -e_int_config_apps_restart(E_Container *con, const char *params __UNUSED__) +e_int_config_apps_restart(E_Comp *comp, const char *params __UNUSED__) { E_Config_Data *data; char buff[PATH_MAX]; @@ -129,11 +129,11 @@ e_int_config_apps_restart(E_Container *con, const char *params __UNUSED__) data->dialog = eina_stringshare_add("applications/restart_applications"); data->icon = eina_stringshare_add("preferences-applications-restart"); data->filename = eina_stringshare_add(buff); - return _create_dialog(con, data); + return _create_dialog(comp, data); } E_Config_Dialog * -e_int_config_apps_desk_lock(E_Container *con, const char *params __UNUSED__) +e_int_config_apps_desk_lock(E_Comp *comp, const char *params __UNUSED__) { E_Config_Data *data; char buff[PATH_MAX]; @@ -144,11 +144,11 @@ e_int_config_apps_desk_lock(E_Container *con, const char *params __UNUSED__) data->dialog = eina_stringshare_add("applications/screen_lock_applications"); data->icon = eina_stringshare_add("preferences-applications-screen-lock"); data->filename = eina_stringshare_add(buff); - return _create_dialog(con, data); + return _create_dialog(comp, data); } E_Config_Dialog * -e_int_config_apps_desk_unlock(E_Container *con, const char *params __UNUSED__) +e_int_config_apps_desk_unlock(E_Comp *comp, const char *params __UNUSED__) { E_Config_Data *data; char buff[PATH_MAX]; @@ -159,12 +159,12 @@ e_int_config_apps_desk_unlock(E_Container *con, const char *params __UNUSED__) data->dialog = eina_stringshare_add("applications/screen_unlock_applications"); data->icon = eina_stringshare_add("preferences-applications-screen-unlock"); data->filename = eina_stringshare_add(buff); - return _create_dialog(con, data); + return _create_dialog(comp, data); } /* local function prototypes */ static E_Config_Dialog * -_create_dialog(E_Container *con, E_Config_Data *data) +_create_dialog(E_Comp *comp, E_Config_Data *data) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -185,7 +185,7 @@ _create_dialog(E_Container *con, E_Config_Data *data) v->basic.create_widgets = _basic_create; v->basic.apply_cfdata = _basic_apply; - cfd = e_config_dialog_new(con, data->title, "E", data->dialog, + cfd = e_config_dialog_new(comp, data->title, "E", data->dialog, data->icon, 0, v, data); return cfd; } diff --git a/src/modules/conf_applications/e_int_config_apps_personal.c b/src/modules/conf_applications/e_int_config_apps_personal.c index 85e8bd167..6d5e88be6 100644 --- a/src/modules/conf_applications/e_int_config_apps_personal.c +++ b/src/modules/conf_applications/e_int_config_apps_personal.c @@ -23,7 +23,7 @@ static void _btn_cb_del(void *data, void *data2); static void _widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__); E_Config_Dialog * -e_int_config_apps_personal(E_Container *con, const char *params __UNUSED__) +e_int_config_apps_personal(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -36,7 +36,7 @@ e_int_config_apps_personal(E_Container *con, const char *params __UNUSED__) v->free_cfdata = _free_data; v->basic.create_widgets = _basic_create; - cfd = e_config_dialog_new(con, _("Personal Application Launchers"), + cfd = e_config_dialog_new(comp, _("Personal Application Launchers"), "E", "applications/personal_applications", "preferences-applications-personal", 0, v, NULL); return cfd; @@ -182,15 +182,7 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il) static void _btn_cb_add(void *data __UNUSED__, void *data2 __UNUSED__) { - E_Manager *man; - E_Container *con; - - man = e_manager_current_get(); - if (!man) return; - con = e_container_current_get(man); - if (!con) return; - - e_desktop_edit(con, NULL); + e_desktop_edit(NULL, NULL); } static void diff --git a/src/modules/conf_applications/e_int_config_defapps.c b/src/modules/conf_applications/e_int_config_defapps.c index 1e7b95898..23cd16940 100644 --- a/src/modules/conf_applications/e_int_config_defapps.c +++ b/src/modules/conf_applications/e_int_config_defapps.c @@ -57,7 +57,7 @@ static int _cb_desks_sort(const void *data1, const void *data2); static void _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il, const char **desktop, int general); E_Config_Dialog * -e_int_config_defapps(E_Container *con, const char *params __UNUSED__) +e_int_config_defapps(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -71,7 +71,7 @@ e_int_config_defapps(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.apply_cfdata = _basic_apply; - cfd = e_config_dialog_new(con, _("Default Applications"), + cfd = e_config_dialog_new(comp, _("Default Applications"), "E", "applications/default_applications", "preferences-desktop-default-applications", 0, v, NULL); return cfd; diff --git a/src/modules/conf_applications/e_int_config_deskenv.c b/src/modules/conf_applications/e_int_config_deskenv.c index e05664486..50cfb8af5 100644 --- a/src/modules/conf_applications/e_int_config_deskenv.c +++ b/src/modules/conf_applications/e_int_config_deskenv.c @@ -20,7 +20,7 @@ struct _E_Config_Dialog_Data /* a nice easy setup function that does the dirty work */ E_Config_Dialog * -e_int_config_deskenv(E_Container *con, const char *params __UNUSED__) +e_int_config_deskenv(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -37,7 +37,7 @@ e_int_config_deskenv(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; /* create config diaolg for NULL object/data */ - cfd = e_config_dialog_new(con, _("Desktop Environments"), "E", + cfd = e_config_dialog_new(comp, _("Desktop Environments"), "E", "windows/desktop_environments", "preferences-desktop-environments", 0, v, NULL); return cfd; diff --git a/src/modules/conf_applications/e_mod_main.h b/src/modules/conf_applications/e_mod_main.h index df851fdca..ed5de927c 100644 --- a/src/modules/conf_applications/e_mod_main.h +++ b/src/modules/conf_applications/e_mod_main.h @@ -1,20 +1,20 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_apps_favs(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_apps_add(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_apps_ibar(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_apps_ibar_other(E_Container *con, const char *path); -E_Config_Dialog *e_int_config_apps_startup(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_apps_restart(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_apps_desk_lock(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_apps_desk_unlock(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_apps_favs(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_apps_add(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_apps_ibar(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_apps_ibar_other(E_Comp *comp, const char *path); +E_Config_Dialog *e_int_config_apps_startup(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_apps_restart(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_apps_desk_lock(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_apps_desk_unlock(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_defapps(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_defapps(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_apps_personal(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_apps_personal(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_deskenv(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_deskenv(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_bindings/e_int_config_acpibindings.c b/src/modules/conf_bindings/e_int_config_acpibindings.c index e5973717a..347504b95 100644 --- a/src/modules/conf_bindings/e_int_config_acpibindings.c +++ b/src/modules/conf_bindings/e_int_config_acpibindings.c @@ -53,7 +53,7 @@ static Ecore_X_Window grab_win = 0; static Eina_List *grab_hdls = NULL; E_Config_Dialog * -e_int_config_acpibindings(E_Container *con, +e_int_config_acpibindings(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; @@ -68,7 +68,7 @@ e_int_config_acpibindings(E_Container *con, v->basic.apply_cfdata = _basic_apply; v->basic.create_widgets = _basic_create; - cfd = e_config_dialog_new(con, _("ACPI Bindings"), "E", + cfd = e_config_dialog_new(comp, _("ACPI Bindings"), "E", "advanced/acpi_bindings", "preferences-system-power-management", 0, v, NULL); @@ -517,7 +517,7 @@ _cb_add_binding(void *data, if (grab_win != 0) return; if (!(cfdata = data)) return; man = e_manager_current_get(); - grab_dlg = e_dialog_new(e_container_current_get(man), "E", + grab_dlg = e_dialog_new(NULL, "E", "_acpibind_getbind_dialog"); if (!grab_dlg) return; e_dialog_title_set(grab_dlg, _("ACPI Binding")); diff --git a/src/modules/conf_bindings/e_int_config_edgebindings.c b/src/modules/conf_bindings/e_int_config_edgebindings.c index de3a31c72..b594a6387 100644 --- a/src/modules/conf_bindings/e_int_config_edgebindings.c +++ b/src/modules/conf_bindings/e_int_config_edgebindings.c @@ -89,7 +89,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_edgebindings(E_Container *con, const char *params) +e_int_config_edgebindings(E_Comp *comp, const char *params) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -103,7 +103,7 @@ e_int_config_edgebindings(E_Container *con, const char *params) v->basic.create_widgets = _basic_create_widgets; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Edge Bindings Settings"), "E", + cfd = e_config_dialog_new(comp, _("Edge Bindings Settings"), "E", "keyboard_and_mouse/edge_bindings", "enlightenment/edges", 0, v, NULL); if ((params) && (params[0])) @@ -187,9 +187,8 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) static int _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { - Eina_List *l, *ll, *lll; - E_Manager *man; - E_Container *con; + const Eina_List *l, *ll; + E_Comp *comp; E_Zone *zone; E_Config_Binding_Edge *bi, *bi2; E_Layer layer; @@ -228,17 +227,14 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) if (cfdata->fullscreen_flip != e_config->fullscreen_flip) { if (cfdata->fullscreen_flip) - layer = E_LAYER_EDGE_FULLSCREEN; + layer = E_LAYER_CLIENT_EDGE_FULLSCREEN; else - layer = E_LAYER_EDGE; + layer = E_LAYER_CLIENT_EDGE; - EINA_LIST_FOREACH(e_manager_list(), l, man) + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - EINA_LIST_FOREACH(man->containers, ll, con) - { - EINA_LIST_FOREACH(con->zones, lll, zone) - e_zone_edge_win_layer_set(zone, layer); - } + EINA_LIST_FOREACH(comp->zones, ll, zone) + e_zone_edge_win_layer_set(zone, layer); } } diff --git a/src/modules/conf_bindings/e_int_config_keybindings.c b/src/modules/conf_bindings/e_int_config_keybindings.c index 20541e201..c0e1fa3a3 100644 --- a/src/modules/conf_bindings/e_int_config_keybindings.c +++ b/src/modules/conf_bindings/e_int_config_keybindings.c @@ -88,7 +88,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_keybindings(E_Container *con, +e_int_config_keybindings(E_Comp *comp, const char *params) { E_Config_Dialog *cfd; @@ -103,7 +103,7 @@ e_int_config_keybindings(E_Container *con, v->basic.create_widgets = _basic_create_widgets; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Key Bindings Settings"), "E", + cfd = e_config_dialog_new(comp, _("Key Bindings Settings"), "E", "keyboard_and_mouse/key_bindings", "preferences-desktop-keyboard-shortcuts", 0, v, NULL); if ((params) && (params[0])) diff --git a/src/modules/conf_bindings/e_int_config_mousebindings.c b/src/modules/conf_bindings/e_int_config_mousebindings.c index c2e818ba3..ef234466a 100644 --- a/src/modules/conf_bindings/e_int_config_mousebindings.c +++ b/src/modules/conf_bindings/e_int_config_mousebindings.c @@ -91,7 +91,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_mousebindings(E_Container *con, const char *params __UNUSED__) +e_int_config_mousebindings(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -105,7 +105,7 @@ e_int_config_mousebindings(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create_widgets; v->override_auto_apply = 0; - cfd = e_config_dialog_new(con, + cfd = e_config_dialog_new(comp, _("Mouse Bindings Settings"), "E", "keyboard_and_mouse/mouse_bindings", "preferences-desktop-mouse", 0, v, NULL); @@ -204,7 +204,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) _auto_apply_changes(cfdata); - e_border_button_bindings_ungrab_all(); + e_comp_button_bindings_ungrab_all(); e_managers_keys_ungrab(); EINA_LIST_FREE(e_bindings->mouse_bindings, eb) @@ -268,7 +268,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) e_bindings_wheel_add(bw2->context, bw2->direction, bw2->z, bw2->modifiers, bw2->any_mod, bw2->action, bw2->params); } - e_border_button_bindings_grab_all(); + e_comp_button_bindings_grab_all(); e_managers_keys_grab(); e_config_save_queue(); @@ -349,7 +349,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf cfdata->gui.context.o_zone = ob; e_widget_disabled_set(ob, 1); e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 1, 1, 1); - ob = e_widget_radio_add(evas, _("Container"), E_BINDING_CONTEXT_CONTAINER, rg); + ob = e_widget_radio_add(evas, _("Container"), E_BINDING_CONTEXT_COMPOSITOR, rg); cfdata->gui.context.o_container = ob; e_widget_disabled_set(ob, 1); e_widget_frametable_object_append(of, ob, 2, 0, 1, 1, 1, 1, 1, 1); @@ -967,7 +967,7 @@ _update_binding_context(E_Config_Dialog_Data *cfdata) e_widget_radio_toggle_set(cfdata->gui.context.o_popup, 1); else if (ctxt == E_BINDING_CONTEXT_ZONE) e_widget_radio_toggle_set(cfdata->gui.context.o_zone, 1); - else if (ctxt == E_BINDING_CONTEXT_CONTAINER) + else if (ctxt == E_BINDING_CONTEXT_COMPOSITOR) e_widget_radio_toggle_set(cfdata->gui.context.o_container, 1); else if (ctxt == E_BINDING_CONTEXT_MANAGER) e_widget_radio_toggle_set(cfdata->gui.context.o_manager, 1); diff --git a/src/modules/conf_bindings/e_int_config_signalbindings.c b/src/modules/conf_bindings/e_int_config_signalbindings.c index f57faca52..e98043762 100644 --- a/src/modules/conf_bindings/e_int_config_signalbindings.c +++ b/src/modules/conf_bindings/e_int_config_signalbindings.c @@ -812,7 +812,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf E_Config_Dialog * -e_int_config_signalbindings(E_Container *con, const char *params) +e_int_config_signalbindings(E_Comp *comp, const char *params) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -826,7 +826,7 @@ e_int_config_signalbindings(E_Container *con, const char *params) v->basic.create_widgets = _basic_create_widgets; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Signal Bindings Settings"), "E", + cfd = e_config_dialog_new(comp, _("Signal Bindings Settings"), "E", "keyboard_and_mouse/signal_bindings", "enlightenment/signals", 0, v, NULL); if ((params) && (params[0])) diff --git a/src/modules/conf_bindings/e_mod_main.h b/src/modules/conf_bindings/e_mod_main.h index e69f88dcd..c323141ed 100644 --- a/src/modules/conf_bindings/e_mod_main.h +++ b/src/modules/conf_bindings/e_mod_main.h @@ -1,11 +1,11 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_acpibindings(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_keybindings(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_mousebindings(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_edgebindings(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_signalbindings(E_Container *con, const char *params); +E_Config_Dialog *e_int_config_acpibindings(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_keybindings(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_mousebindings(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_edgebindings(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_signalbindings(E_Comp *comp, const char *params); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_comp/e_mod_config.c b/src/modules/conf_comp/e_mod_config.c index e28d2a554..519ac3777 100644 --- a/src/modules/conf_comp/e_mod_config.c +++ b/src/modules/conf_comp/e_mod_config.c @@ -68,7 +68,7 @@ static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); EINTERN E_Config_Dialog * -e_int_config_comp_module(E_Container *con, const char *params __UNUSED__) +e_int_config_comp_module(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -84,7 +84,7 @@ e_int_config_comp_module(E_Container *con, const char *params __UNUSED__) v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.create_widgets = _advanced_create_widgets; - cfd = e_config_dialog_new(con, _("Composite Settings"), + cfd = e_config_dialog_new(comp, _("Composite Settings"), "E", "appearance/comp", "preferences-composite", 0, v, mod); mod->config_dialog = cfd; e_dialog_resizable_set(cfd->dia, 1); diff --git a/src/modules/conf_comp/e_mod_config_match.c b/src/modules/conf_comp/e_mod_config_match.c index 4823404b6..a5c6a32e6 100644 --- a/src/modules/conf_comp/e_mod_config_match.c +++ b/src/modules/conf_comp/e_mod_config_match.c @@ -843,7 +843,7 @@ _create_data(E_Config_Dialog *cfd) } EINTERN E_Config_Dialog * -e_int_config_comp_match(E_Container *con, const char *params __UNUSED__) +e_int_config_comp_match(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -857,7 +857,7 @@ e_int_config_comp_match(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_apply_data; v->basic.create_widgets = _basic_create_widgets; - cfd = e_config_dialog_new(con, _("Composite Match Settings"), + cfd = e_config_dialog_new(comp, _("Composite Match Settings"), "E", "_comp_matches", "preferences-composite", 0, v, mod); mod->match_config_dialog = cfd; e_dialog_resizable_set(cfd->dia, 1); diff --git a/src/modules/conf_comp/e_mod_main.c b/src/modules/conf_comp/e_mod_main.c index 9a5630493..f5ab8f1c6 100644 --- a/src/modules/conf_comp/e_mod_main.c +++ b/src/modules/conf_comp/e_mod_main.c @@ -154,7 +154,7 @@ _style_selector(Evas *evas, const char **source) oo = edje_object_add(e_livethumb_evas_get(ob)); ds_it->preview = oo; - snprintf(buf, sizeof(buf), "e/comp/border/%s", style); + snprintf(buf, sizeof(buf), "e/comp/frame/%s", style); e_theme_edje_object_set(oo, "base/theme/borders", buf); e_layout_pack(oly, oo); e_layout_child_move(oo, 39, 39); diff --git a/src/modules/conf_comp/e_mod_main.h b/src/modules/conf_comp/e_mod_main.h index 68ef92fae..de641365c 100644 --- a/src/modules/conf_comp/e_mod_main.h +++ b/src/modules/conf_comp/e_mod_main.h @@ -39,7 +39,7 @@ typedef struct _E_Demo_Style_Item * @} */ EINTERN Evas_Object *_style_selector(Evas *evas, const char **source); -EINTERN E_Config_Dialog *e_int_config_comp_module(E_Container *con, const char *params EINA_UNUSED); -EINTERN E_Config_Dialog *e_int_config_comp_match(E_Container *con, const char *params EINA_UNUSED); +EINTERN E_Config_Dialog *e_int_config_comp_module(E_Comp *comp, const char *params EINA_UNUSED); +EINTERN E_Config_Dialog *e_int_config_comp_match(E_Comp *comp, const char *params EINA_UNUSED); #endif diff --git a/src/modules/conf_dialogs/e_int_config_dialogs.c b/src/modules/conf_dialogs/e_int_config_dialogs.c index e1884e725..eed6513b9 100644 --- a/src/modules/conf_dialogs/e_int_config_dialogs.c +++ b/src/modules/conf_dialogs/e_int_config_dialogs.c @@ -20,7 +20,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_dialogs(E_Container *con, const char *params __UNUSED__) +e_int_config_dialogs(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -35,7 +35,7 @@ e_int_config_dialogs(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Dialog Settings"), + cfd = e_config_dialog_new(comp, _("Dialog Settings"), "E", "settings/dialogs", "preferences-system", 0, v, NULL); return cfd; diff --git a/src/modules/conf_dialogs/e_int_config_profiles.c b/src/modules/conf_dialogs/e_int_config_profiles.c index ea3283ff2..ff954666a 100644 --- a/src/modules/conf_dialogs/e_int_config_profiles.c +++ b/src/modules/conf_dialogs/e_int_config_profiles.c @@ -37,7 +37,7 @@ struct _Del_Profile_Confirm_Data }; E_Config_Dialog * -e_int_config_profiles(E_Container *con, const char *params __UNUSED__) +e_int_config_profiles(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -50,7 +50,7 @@ e_int_config_profiles(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _apply_cfdata; v->basic.create_widgets = _create_widgets; - cfd = e_config_dialog_new(con, _("Profile Selector"), + cfd = e_config_dialog_new(comp, _("Profile Selector"), "E", "settings/profiles", "preferences-profiles", 0, v, NULL); e_config_dialog_changed_auto_set(cfd, 0); diff --git a/src/modules/conf_dialogs/e_mod_main.h b/src/modules/conf_dialogs/e_mod_main.h index 8265b5484..9bab87bf8 100644 --- a/src/modules/conf_dialogs/e_mod_main.h +++ b/src/modules/conf_dialogs/e_mod_main.h @@ -1,8 +1,8 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_profiles(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_dialogs(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_profiles(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_dialogs(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_display/e_int_config_desk.c b/src/modules/conf_display/e_int_config_desk.c index 3869139e3..18e8cf337 100644 --- a/src/modules/conf_display/e_int_config_desk.c +++ b/src/modules/conf_display/e_int_config_desk.c @@ -9,7 +9,7 @@ static Eina_Bool _cb_bg_change(void *data, int type, void *event); struct _E_Config_Dialog_Data { - int con_num; + int man_num; int zone_num; int desk_x; int desk_y; @@ -23,16 +23,16 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_desk(E_Container *con, const char *params) +e_int_config_desk(E_Comp *comp, const char *params) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; E_Config_Dialog_Data *cfdata; - int con_num, zone_num, dx, dy; + int man_num, zone_num, dx, dy; if (!params) return NULL; - con_num = zone_num = dx = dy = -1; - if (sscanf(params, "%i %i %i %i", &con_num, &zone_num, &dx, &dy) != 4) + man_num = zone_num = dx = dy = -1; + if (sscanf(params, "%i %i %i %i", &man_num, &zone_num, &dx, &dy) != 4) return NULL; if (e_config_dialog_find("E", "internal/desk")) return NULL; @@ -40,7 +40,7 @@ e_int_config_desk(E_Container *con, const char *params) v = E_NEW(E_Config_Dialog_View, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1); - cfdata->con_num = con_num; + cfdata->man_num = man_num; cfdata->zone_num = zone_num; cfdata->desk_x = dx; cfdata->desk_y = dy; @@ -51,7 +51,7 @@ e_int_config_desk(E_Container *con, const char *params) v->basic.create_widgets = _basic_create; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Desk Settings"), "E", "internal/desk", + cfd = e_config_dialog_new(comp, _("Desk Settings"), "E", "internal/desk", "preferences-desktop", 0, v, cfdata); return cfd; } @@ -65,7 +65,7 @@ _fill_data(E_Config_Dialog_Data *cfdata) #if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) E_Config_Desktop_Window_Profile *prof; #endif - cfdata->bg = e_bg_file_get(cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); + cfdata->bg = e_bg_file_get(cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); for (l = e_config->desktop_names; l; l = l->next) { @@ -73,7 +73,7 @@ _fill_data(E_Config_Dialog_Data *cfdata) dn = l->data; if (!dn) continue; - if (dn->container != cfdata->con_num) continue; + if (dn->manager != cfdata->man_num) continue; if (dn->zone != cfdata->zone_num) continue; if ((dn->desk_x != cfdata->desk_x) || (dn->desk_y != cfdata->desk_y)) continue; @@ -88,11 +88,10 @@ _fill_data(E_Config_Dialog_Data *cfdata) snprintf(name, sizeof(name), _(e_config->desktop_default_name), cfdata->desk_x, cfdata->desk_y); cfdata->name = strdup(name); } -#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) ok = 0; EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, prof) { - if (!((prof->container == cfdata->con_num) && + if (!((prof->manager == cfdata->man_num) && (prof->zone == cfdata->zone_num) && (prof->desk_x == cfdata->desk_x) && (prof->desk_y == cfdata->desk_y))) @@ -106,7 +105,6 @@ _fill_data(E_Config_Dialog_Data *cfdata) if (!ok) cfdata->profile = strdup(e_config->desktop_default_window_profile); -#endif } static void * @@ -150,21 +148,21 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) if (!cfdata->profile[0]) cfdata->profile = strdup(e_config->desktop_default_window_profile); #endif - e_desk_name_del(cfdata->con_num, cfdata->zone_num, + e_desk_name_del(cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); - e_desk_name_add(cfdata->con_num, cfdata->zone_num, + e_desk_name_add(cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y, cfdata->name); e_desk_name_update(); #if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) - e_desk_window_profile_del(cfdata->con_num, cfdata->zone_num, + e_desk_window_profile_del(cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); - e_desk_window_profile_add(cfdata->con_num, cfdata->zone_num, + e_desk_window_profile_add(cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y, cfdata->profile); e_desk_window_profile_update(); #endif - e_bg_del(cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); - e_bg_add(cfdata->con_num, cfdata->zone_num, + e_bg_del(cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); + e_bg_add(cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y, cfdata->bg); e_bg_update(); @@ -178,7 +176,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) Evas_Object *o, *of, *ol, *ob; E_Zone *zone; - zone = e_zone_current_get(cfd->con); + zone = e_zone_current_get(cfd->comp); o = e_widget_list_add(evas, 0, 0); @@ -224,10 +222,9 @@ _cb_config(void *data, void *data2 __UNUSED__) cfdata = data; if (!cfdata) return; snprintf(buf, sizeof(buf), "%i %i %i %i", - cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); + cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); e_configure_registry_call("internal/wallpaper_desk", - e_container_current_get(e_manager_current_get()), - buf); + NULL, buf); } static Eina_Bool @@ -241,12 +238,12 @@ _cb_bg_change(void *data, int type, void *event) cfdata = data; ev = event; - if (ev->container != cfdata->con_num) return ECORE_CALLBACK_PASS_ON; + if (ev->manager != cfdata->man_num) return ECORE_CALLBACK_PASS_ON; if (ev->zone != cfdata->zone_num) return ECORE_CALLBACK_PASS_ON; if (ev->desk_x != cfdata->desk_x) return ECORE_CALLBACK_PASS_ON; if (ev->desk_y != cfdata->desk_y) return ECORE_CALLBACK_PASS_ON; - file = e_bg_file_get(cfdata->con_num, cfdata->zone_num, + file = e_bg_file_get(cfdata->man_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); eina_stringshare_replace(&cfdata->bg, file); e_widget_preview_edje_set(cfdata->preview, cfdata->bg, diff --git a/src/modules/conf_display/e_int_config_desklock.c b/src/modules/conf_display/e_int_config_desklock.c index 1208899db..143d254ce 100644 --- a/src/modules/conf_display/e_int_config_desklock.c +++ b/src/modules/conf_display/e_int_config_desklock.c @@ -58,7 +58,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_desklock(E_Container *con, const char *params __UNUSED__) +e_int_config_desklock(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -74,7 +74,7 @@ e_int_config_desklock(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Screen Lock Settings"), "E", + cfd = e_config_dialog_new(comp, _("Screen Lock Settings"), "E", "screen/screen_lock", "preferences-system-lock-screen", 0, v, NULL); return cfd; @@ -181,11 +181,10 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data E_Config_XKB_Layout *cl; int grp = 0; Evas_Object *otb, *ol, *ow, *of, *ot, *oc; - Eina_List *l, *ll, *lll; + const Eina_List *l, *ll; E_Zone *zone; E_Radio_Group *rg; - E_Manager *man; - E_Container *con; + E_Comp *comp; int screen_count, x = 0; screen_count = ecore_x_xinerama_screen_count_get(); @@ -340,18 +339,17 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data cfdata->gui.o_table = ot = e_widget_table_add(evas, 1); - EINA_LIST_FOREACH(e_manager_list(), l, man) - EINA_LIST_FOREACH(man->containers, ll, con) - EINA_LIST_FOREACH(con->zones, lll, zone) - { - ow = e_widget_preview_add(evas, 100, 140); - cfdata->gui.bgs = eina_list_append(cfdata->gui.bgs, ow); - evas_object_data_set(ow, "zone", zone); - e_widget_disabled_set(ow, - (cfdata->bg_method < E_DESKLOCK_BACKGROUND_METHOD_CUSTOM)); - evas_object_event_callback_add(ow, EVAS_CALLBACK_MOUSE_DOWN, _cb_bg_mouse_down, cfdata); - e_widget_table_object_append(cfdata->gui.o_table, ow, x++, 0, 1, 1, 1, 1, 1, 1); - } + EINA_LIST_FOREACH(e_comp_list(), l, comp) + EINA_LIST_FOREACH(comp->zones, ll, zone) + { + ow = e_widget_preview_add(evas, 100, 140); + cfdata->gui.bgs = eina_list_append(cfdata->gui.bgs, ow); + evas_object_data_set(ow, "zone", zone); + e_widget_disabled_set(ow, + (cfdata->bg_method < E_DESKLOCK_BACKGROUND_METHOD_CUSTOM)); + evas_object_event_callback_add(ow, EVAS_CALLBACK_MOUSE_DOWN, _cb_bg_mouse_down, cfdata); + e_widget_table_object_append(cfdata->gui.o_table, ow, x++, 0, 1, 1, 1, 1, 1, 1); + } _cb_method_change(cfdata, NULL, NULL); e_widget_list_object_append(ol, cfdata->gui.o_table, 1, 1, 0.5); e_widget_toolbook_page_append(otb, NULL, _("Wallpaper"), ol, @@ -611,17 +609,11 @@ static int _zone_count_get(void) { int num = 0; - E_Manager *m; - Eina_List *ml; + const Eina_List *l; + E_Comp *comp; - EINA_LIST_FOREACH(e_manager_list(), ml, m) - { - Eina_List *cl; - E_Container *con; - - EINA_LIST_FOREACH(m->containers, cl, con) - num += eina_list_count(con->zones); - } + EINA_LIST_FOREACH(e_comp_list(), l, comp) + num += eina_list_count(comp->zones); return num; } diff --git a/src/modules/conf_display/e_int_config_desklock_fsel.c b/src/modules/conf_display/e_int_config_desklock_fsel.c index 5f950ab49..6e3ec5685 100644 --- a/src/modules/conf_display/e_int_config_desklock_fsel.c +++ b/src/modules/conf_display/e_int_config_desklock_fsel.c @@ -22,14 +22,12 @@ static void _cb_dir_up(void *data1, void *data2); E_Config_Dialog * e_int_config_desklock_fsel(E_Config_Dialog *parent, Evas_Object *bg) { - E_Container *con; + E_Comp *comp = NULL; E_Config_Dialog *cfd; E_Config_Dialog_View *v; if (parent) - con = parent->con; - else - con = e_container_current_get(e_manager_current_get()); + comp = parent->comp; v = E_NEW(E_Config_Dialog_View, 1); v->create_cfdata = _create_data; @@ -38,7 +36,7 @@ e_int_config_desklock_fsel(E_Config_Dialog *parent, Evas_Object *bg) v->basic_only = 1; v->normal_win = 1; - cfd = e_config_dialog_new(con, _("Select a Background..."), + cfd = e_config_dialog_new(comp, _("Select a Background..."), "E", "_desklock_fsel_dialog", "enlightenment/background", 0, v, parent); e_object_data_set(E_OBJECT(cfd), bg); diff --git a/src/modules/conf_display/e_int_config_desks.c b/src/modules/conf_display/e_int_config_desks.c index a0e4bb668..af6c5c252 100644 --- a/src/modules/conf_display/e_int_config_desks.c +++ b/src/modules/conf_display/e_int_config_desks.c @@ -30,7 +30,7 @@ struct _E_Config_Dialog_Data /* a nice easy setup function that does the dirty work */ E_Config_Dialog * -e_int_config_desks(E_Container *con, const char *params __UNUSED__) +e_int_config_desks(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -48,7 +48,7 @@ e_int_config_desks(E_Container *con, const char *params __UNUSED__) v->advanced.create_widgets = NULL; v->advanced.check_changed = NULL; /* create config diaolg for NULL object/data */ - cfd = e_config_dialog_new(con, _("Virtual Desktops Settings"), + cfd = e_config_dialog_new(comp, _("Virtual Desktops Settings"), "E", "screen/virtual_desktops", "preferences-desktop", 0, v, NULL); return cfd; @@ -121,14 +121,13 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) if ((cfdata->x != e_config->zone_desks_x_count) || (cfdata->y != e_config->zone_desks_y_count)) { - const Eina_List *l, *ll, *lll; - E_Manager *man; - E_Container *con; + const Eina_List *l, *ll; + E_Comp *comp; 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_desk_count_set(zone, cfdata->x, cfdata->y); + + EINA_LIST_FOREACH(e_comp_list(), l, comp) + EINA_LIST_FOREACH(comp->zones, ll, zone) + e_zone_desk_count_set(zone, cfdata->x, cfdata->y); } eina_stringshare_replace(&e_config->desk_flip_animate_type, NULL); @@ -153,21 +152,19 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) static int _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { - const Eina_List *l, *ll, *lll; - E_Manager *man; - E_Container *con; + const Eina_List *l, *ll; + E_Comp *comp; 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) - { - int x, y; + EINA_LIST_FOREACH(e_comp_list(), l, comp) + EINA_LIST_FOREACH(comp->zones, ll, zone) + { + int x, y; - e_zone_desk_count_get(zone, &x, &y); - if ((x != cfdata->x) || (y != cfdata->y)) - return 1; - } + e_zone_desk_count_get(zone, &x, &y); + if ((x != cfdata->x) || (y != cfdata->y)) + return 1; + } return ((e_util_strcasecmp(eina_list_nth(cfdata->comp_effects, cfdata->flip_mode), e_config->desk_flip_animate_type)) || (e_config->desk_flip_animate_interpolation != cfdata->flip_interp) || diff --git a/src/modules/conf_display/e_int_config_display.c b/src/modules/conf_display/e_int_config_display.c index 49a629bce..93709a9b7 100644 --- a/src/modules/conf_display/e_int_config_display.c +++ b/src/modules/conf_display/e_int_config_display.c @@ -182,7 +182,7 @@ _surebox_new(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) SureBox *sb; sb = E_NEW(SureBox, 1); - sb->dia = e_dialog_new(cfd->con, "E", "_display_res_sure_dialog"); + sb->dia = e_dialog_new(cfd->comp, "E", "_display_res_sure_dialog"); sb->timer = ecore_timer_add(1.0, _surebox_timer_cb, sb); sb->iterations = 15; sb->cfd = cfd; @@ -206,7 +206,7 @@ _surebox_new(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) } E_Config_Dialog * -e_int_config_display(E_Container *con, const char *params __UNUSED__) +e_int_config_display(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -227,7 +227,7 @@ e_int_config_display(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Screen Resolution Settings"), + cfd = e_config_dialog_new(comp, _("Screen Resolution Settings"), "E", "screen/screen_resolution", "preferences-system-screen-resolution", 0, v, NULL); return cfd; diff --git a/src/modules/conf_display/e_int_config_dpms.c b/src/modules/conf_display/e_int_config_dpms.c index f7625807f..d95b65271 100644 --- a/src/modules/conf_display/e_int_config_dpms.c +++ b/src/modules/conf_display/e_int_config_dpms.c @@ -37,7 +37,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_dpms(E_Container *con, const char *params __UNUSED__) +e_int_config_dpms(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -54,7 +54,7 @@ e_int_config_dpms(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _advanced_check_changed; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Backlight Settings"), "E", + cfd = e_config_dialog_new(comp, _("Backlight Settings"), "E", "screen/power_management", "preferences-system-power-management", 0, v, NULL); return cfd; diff --git a/src/modules/conf_display/e_int_config_screensaver.c b/src/modules/conf_display/e_int_config_screensaver.c index 7e0246ca2..010f154d8 100644 --- a/src/modules/conf_display/e_int_config_screensaver.c +++ b/src/modules/conf_display/e_int_config_screensaver.c @@ -35,7 +35,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_screensaver(E_Container *con, const char *params __UNUSED__) +e_int_config_screensaver(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -51,7 +51,7 @@ e_int_config_screensaver(E_Container *con, const char *params __UNUSED__) v->override_auto_apply = 1; - cfd = e_config_dialog_new(con,_("Screen Saver Settings"), + cfd = e_config_dialog_new(comp,_("Screen Saver Settings"), "E", "screen/screen_saver", "preferences-desktop-screensaver", 0, v, NULL); return cfd; diff --git a/src/modules/conf_display/e_mod_main.h b/src/modules/conf_display/e_mod_main.h index 8e7fd01e5..1424890dc 100644 --- a/src/modules/conf_display/e_mod_main.h +++ b/src/modules/conf_display/e_mod_main.h @@ -1,12 +1,12 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_desk(E_Container *con, const char *params); -E_Config_Dialog *e_int_config_screensaver(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_dpms(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_display(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_desks(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_desklock(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_desk(E_Comp *comp, const char *params); +E_Config_Dialog *e_int_config_screensaver(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_dpms(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_display(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_desks(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_desklock(E_Comp *comp, const char *params __UNUSED__); void e_int_config_desklock_fsel_done(E_Config_Dialog *cfd, Evas_Object *bg, const char *bg_file); E_Config_Dialog *e_int_config_desklock_fsel(E_Config_Dialog *parent, Evas_Object *bg); void e_int_config_desklock_fsel_del(E_Config_Dialog *cfd); diff --git a/src/modules/conf_interaction/e_int_config_interaction.c b/src/modules/conf_interaction/e_int_config_interaction.c index 5ece12e00..35f2901cd 100644 --- a/src/modules/conf_interaction/e_int_config_interaction.c +++ b/src/modules/conf_interaction/e_int_config_interaction.c @@ -17,7 +17,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_interaction(E_Container *con, const char *params __UNUSED__) +e_int_config_interaction(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -33,7 +33,7 @@ e_int_config_interaction(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, _("Interaction Settings"), + cfd = e_config_dialog_new(comp, _("Interaction Settings"), "E", "keyboard_and_mouse/interaction", "preferences-interaction", 0, v, NULL); return cfd; diff --git a/src/modules/conf_interaction/e_int_config_mouse.c b/src/modules/conf_interaction/e_int_config_mouse.c index b906cf09e..702141491 100644 --- a/src/modules/conf_interaction/e_int_config_mouse.c +++ b/src/modules/conf_interaction/e_int_config_mouse.c @@ -27,7 +27,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_mouse(E_Container *con, const char *params __UNUSED__) +e_int_config_mouse(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -43,7 +43,7 @@ e_int_config_mouse(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create_widgets; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Mouse Settings"), "E", + cfd = e_config_dialog_new(comp, _("Mouse Settings"), "E", "keyboard_and_mouse/mouse_settings", "preferences-desktop-mouse", 0, v, NULL); return cfd; @@ -98,8 +98,8 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) static int _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { - Eina_List *l; - E_Manager *man; + const Eina_List *l; + E_Comp *comp; e_config->use_e_cursor = cfdata->use_e_cursor; e_config->show_cursor = cfdata->show_cursor; @@ -113,15 +113,15 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) e_config_save_queue(); /* Apply the above settings */ - EINA_LIST_FOREACH(e_manager_list(), l, man) + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - if (man->pointer && !e_config->show_cursor) + if (comp->pointer && !e_config->show_cursor) { - e_pointer_hide(man->pointer); + e_pointer_hide(comp->pointer); continue; } - if (man->pointer) e_object_del(E_OBJECT(man->pointer)); - man->pointer = e_pointer_window_new(man->root, 1); + if (comp->pointer) e_object_del(E_OBJECT(comp->pointer)); + comp->pointer = e_pointer_window_new(comp->man->root, 1); } e_mouse_update(); diff --git a/src/modules/conf_interaction/e_mod_main.h b/src/modules/conf_interaction/e_mod_main.h index 3851f50f9..2e4edc6c9 100644 --- a/src/modules/conf_interaction/e_mod_main.h +++ b/src/modules/conf_interaction/e_mod_main.h @@ -1,8 +1,8 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_interaction(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_mouse(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_interaction(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_mouse(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_intl/e_int_config_imc.c b/src/modules/conf_intl/e_int_config_imc.c index 734cebe1e..043ea0a82 100644 --- a/src/modules/conf_intl/e_int_config_imc.c +++ b/src/modules/conf_intl/e_int_config_imc.c @@ -84,7 +84,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_imc(E_Container *con, const char *params __UNUSED__) +e_int_config_imc(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -99,7 +99,7 @@ e_int_config_imc(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create_widgets; v->basic.apply_cfdata = _basic_apply_data; - cfd = e_config_dialog_new(con, + cfd = e_config_dialog_new(comp, _("Input Method Settings"), "E", "language/input_method_settings", "preferences-imc", 0, v, NULL); diff --git a/src/modules/conf_intl/e_int_config_imc_import.c b/src/modules/conf_intl/e_int_config_imc_import.c index fa8d4ef98..005bd6e75 100644 --- a/src/modules/conf_intl/e_int_config_imc_import.c +++ b/src/modules/conf_intl/e_int_config_imc_import.c @@ -50,7 +50,7 @@ e_int_config_imc_import(E_Config_Dialog *parent) import = E_NEW(Import, 1); if (!import) return NULL; - win = e_win_new(parent->con); + win = e_win_new(parent->comp); if (!win) { E_FREE(import); @@ -140,7 +140,7 @@ e_int_config_imc_import(E_Config_Dialog *parent) e_win_size_min_set(win, w, h); e_win_size_max_set(win, 99999, 99999); e_win_show(win); - e_win_border_icon_set(win, "preferences-imc"); + e_win_client_icon_set(win, "preferences-imc"); win->data = import; diff --git a/src/modules/conf_intl/e_int_config_intl.c b/src/modules/conf_intl/e_int_config_intl.c index 59a2f4ce2..265b74232 100644 --- a/src/modules/conf_intl/e_int_config_intl.c +++ b/src/modules/conf_intl/e_int_config_intl.c @@ -579,7 +579,7 @@ const E_Intl_Pair charset_predefined_pairs[] = { }; E_Config_Dialog * -e_int_config_intl(E_Container *con, const char *params __UNUSED__) +e_int_config_intl(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -596,7 +596,7 @@ e_int_config_intl(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_advanced_apply_data; v->basic.check_changed = _basic_advanced_check_changed; - cfd = e_config_dialog_new(con, + cfd = e_config_dialog_new(comp, _("Language Settings"), "E", "language/language_settings", "preferences-desktop-locale", 0, v, NULL); @@ -604,7 +604,7 @@ e_int_config_intl(E_Container *con, const char *params __UNUSED__) } E_Config_Dialog * -e_int_config_desklock_intl(E_Container *con, const char *params __UNUSED__) +e_int_config_desklock_intl(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -621,7 +621,7 @@ e_int_config_desklock_intl(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_advanced_apply_data; v->basic.check_changed = _basic_advanced_check_changed; - cfd = e_config_dialog_new(con, + cfd = e_config_dialog_new(comp, _("Desklock Language Settings"), "E", "language/desklock_language_settings", "preferences-desktop-locale", 0, v, NULL); diff --git a/src/modules/conf_intl/e_mod_main.h b/src/modules/conf_intl/e_mod_main.h index fa8657dc8..aab511e86 100644 --- a/src/modules/conf_intl/e_mod_main.h +++ b/src/modules/conf_intl/e_mod_main.h @@ -1,15 +1,15 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_imc(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_imc(E_Comp *comp, const char *params __UNUSED__); void e_int_config_imc_import_done(E_Config_Dialog *dia); void e_int_config_imc_update(E_Config_Dialog *dia, const char *file); E_Win *e_int_config_imc_import(E_Config_Dialog *parent); void e_int_config_imc_import_del(E_Win *win); -E_Config_Dialog *e_int_config_intl(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_desklock_intl(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_intl(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_desklock_intl(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_menus/e_int_config_menus.c b/src/modules/conf_menus/e_int_config_menus.c index 8d504cde1..bc422018d 100644 --- a/src/modules/conf_menus/e_int_config_menus.c +++ b/src/modules/conf_menus/e_int_config_menus.c @@ -21,7 +21,7 @@ static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); E_Config_Dialog * -e_int_config_menus(E_Container *con, const char *params __UNUSED__) +e_int_config_menus(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -35,7 +35,7 @@ e_int_config_menus(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_apply; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Menu Settings"), "E", "menus/menu_settings", + cfd = e_config_dialog_new(comp, _("Menu Settings"), "E", "menus/menu_settings", "preferences-menus", 0, v, NULL); return cfd; } diff --git a/src/modules/conf_menus/e_mod_main.h b/src/modules/conf_menus/e_mod_main.h index fd261160d..3686f005c 100644 --- a/src/modules/conf_menus/e_mod_main.h +++ b/src/modules/conf_menus/e_mod_main.h @@ -1,7 +1,7 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_menus(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_menus(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_paths/e_int_config_env.c b/src/modules/conf_paths/e_int_config_env.c index 803fc3803..710781159 100644 --- a/src/modules/conf_paths/e_int_config_env.c +++ b/src/modules/conf_paths/e_int_config_env.c @@ -20,7 +20,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_env(E_Container *con, const char *params __UNUSED__) +e_int_config_env(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -33,7 +33,7 @@ e_int_config_env(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create_widgets; v->basic.apply_cfdata = _basic_apply_data; - cfd = e_config_dialog_new(con, _("Environment Variables"), + cfd = e_config_dialog_new(comp, _("Environment Variables"), "E", "advanced/environment_variables", "preferences-system", 0, v, NULL); return cfd; diff --git a/src/modules/conf_paths/e_int_config_paths.c b/src/modules/conf_paths/e_int_config_paths.c index 0ba50bc0e..d971ecab0 100644 --- a/src/modules/conf_paths/e_int_config_paths.c +++ b/src/modules/conf_paths/e_int_config_paths.c @@ -43,7 +43,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_paths(E_Container *con, const char *params __UNUSED__) +e_int_config_paths(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -56,7 +56,7 @@ e_int_config_paths(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create_widgets; v->basic.apply_cfdata = _basic_apply_data; - cfd = e_config_dialog_new(con, _("Search Path Settings"), + cfd = e_config_dialog_new(comp, _("Search Path Settings"), "E", "advanced/search_directories", "preferences-directories", 0, v, NULL); return cfd; diff --git a/src/modules/conf_paths/e_mod_main.h b/src/modules/conf_paths/e_mod_main.h index 3d2c518b3..9afe3ded9 100644 --- a/src/modules/conf_paths/e_mod_main.h +++ b/src/modules/conf_paths/e_mod_main.h @@ -1,8 +1,8 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_env(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_paths(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_env(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_paths(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_performance/e_int_config_engine.c b/src/modules/conf_performance/e_int_config_engine.c index 191e73daf..71fc3d7fe 100644 --- a/src/modules/conf_performance/e_int_config_engine.c +++ b/src/modules/conf_performance/e_int_config_engine.c @@ -19,7 +19,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_engine(E_Container *con, const char *params __UNUSED__) +e_int_config_engine(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -34,7 +34,7 @@ e_int_config_engine(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create_widgets; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Engine Settings"), "E", "advanced/engine", + cfd = e_config_dialog_new(comp, _("Engine Settings"), "E", "advanced/engine", "preferences-engine", 0, v, NULL); return cfd; } diff --git a/src/modules/conf_performance/e_int_config_performance.c b/src/modules/conf_performance/e_int_config_performance.c index 6d05f82c0..c94f4d6cc 100644 --- a/src/modules/conf_performance/e_int_config_performance.c +++ b/src/modules/conf_performance/e_int_config_performance.c @@ -19,7 +19,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_performance(E_Container *con, const char *params __UNUSED__) +e_int_config_performance(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -33,7 +33,7 @@ e_int_config_performance(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Performance Settings"), + cfd = e_config_dialog_new(comp, _("Performance Settings"), "E", "advanced/performance", "preferences-system-performance", 0, v, NULL); return cfd; diff --git a/src/modules/conf_performance/e_int_config_powermanagement.c b/src/modules/conf_performance/e_int_config_powermanagement.c index 9f89161fb..f5f113825 100644 --- a/src/modules/conf_performance/e_int_config_powermanagement.c +++ b/src/modules/conf_performance/e_int_config_powermanagement.c @@ -24,7 +24,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_powermanagement(E_Container *con, const char *params __UNUSED__) +e_int_config_powermanagement(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -38,7 +38,7 @@ e_int_config_powermanagement(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Power Management Settings"), + cfd = e_config_dialog_new(comp, _("Power Management Settings"), "E", "advanced/powermanagement", "preferences-system-power-management", 0, v, NULL); return cfd; diff --git a/src/modules/conf_performance/e_mod_main.h b/src/modules/conf_performance/e_mod_main.h index 6394e39ae..eb6ec34c2 100644 --- a/src/modules/conf_performance/e_mod_main.h +++ b/src/modules/conf_performance/e_mod_main.h @@ -1,9 +1,9 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_engine(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_performance(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_powermanagement(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_engine(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_performance(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_powermanagement(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_randr/e_int_config_randr.c b/src/modules/conf_randr/e_int_config_randr.c index e93614eea..885e403e5 100644 --- a/src/modules/conf_randr/e_int_config_randr.c +++ b/src/modules/conf_randr/e_int_config_randr.c @@ -23,7 +23,7 @@ static void _randr_cb_changed(void *data, Evas_Object *obj, void *event EINA_UNU /* public functions */ E_Config_Dialog * -e_int_config_randr(E_Container *con, const char *params EINA_UNUSED) +e_int_config_randr(E_Comp *comp, const char *params EINA_UNUSED) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -45,7 +45,7 @@ e_int_config_randr(E_Container *con, const char *params EINA_UNUSED) v->override_auto_apply = EINA_TRUE; /* create new dialog */ - cfd = e_config_dialog_new(con, _("Screen Setup"), + cfd = e_config_dialog_new(comp, _("Screen Setup"), "E", "screen/screen_setup", "preferences-system-screen-resolution", 0, v, NULL); diff --git a/src/modules/conf_randr/e_int_config_randr.h b/src/modules/conf_randr/e_int_config_randr.h index f7760c8a3..4a80bad02 100644 --- a/src/modules/conf_randr/e_int_config_randr.h +++ b/src/modules/conf_randr/e_int_config_randr.h @@ -3,7 +3,7 @@ # ifndef E_INT_CONFIG_RANDR_H # define E_INT_CONFIG_RANDR_H -E_Config_Dialog *e_int_config_randr(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_randr(E_Comp *comp, const char *params __UNUSED__); # endif #endif diff --git a/src/modules/conf_randr/e_smart_monitor.c b/src/modules/conf_randr/e_smart_monitor.c index 4ab07ee28..c33e9ada5 100644 --- a/src/modules/conf_randr/e_smart_monitor.c +++ b/src/modules/conf_randr/e_smart_monitor.c @@ -67,8 +67,8 @@ struct _E_Smart_Data Evas_Coord vw, vh; } grid; - /* container number */ - unsigned int con_num; + /* manager number */ + unsigned int man_num; /* zone number */ unsigned int zone_num; @@ -437,7 +437,6 @@ e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy) { E_Smart_Data *sd; E_Manager *man; - E_Container *con; E_Zone *zone; E_Desk *desk; @@ -448,13 +447,10 @@ e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy) /* get the current manager */ man = e_manager_current_get(); - - /* get the current container */ - con = e_container_current_get(man); - sd->con_num = con->num; + sd->man_num = man->num; /* get the zone number */ - if (!(zone = e_container_zone_at_point_get(con, dx, dy))) + if (!(zone = e_comp_zone_xy_get(man->comp, dx, dy))) zone = e_util_zone_current_get(man); sd->zone_num = zone->num; @@ -1350,7 +1346,7 @@ _e_smart_monitor_background_set(E_Smart_Data *sd, int dx, int dy) if (!sd) return; /* try to get the background file for this desktop */ - if ((bg = e_bg_file_get(sd->con_num, sd->zone_num, dx, dy))) + if ((bg = e_bg_file_get(sd->man_num, sd->zone_num, dx, dy))) { Evas_Object *o; @@ -1379,8 +1375,8 @@ _e_smart_monitor_background_update(void *data, int type EINA_UNUSED, void *event ev = event; - /* check this bg event happened on our container */ - if (((ev->container < 0) || (ev->container == (int)sd->con_num)) && + /* check this bg event happened on our manager */ + if (((ev->manager < 0) || (ev->manager == (int)sd->man_num)) && ((ev->zone < 0) || (ev->zone == (int)sd->zone_num))) { /* check this bg event happened on our desktop */ diff --git a/src/modules/conf_shelves/e_int_config_shelf.c b/src/modules/conf_shelves/e_int_config_shelf.c index 072b69d98..3d97d0712 100644 --- a/src/modules/conf_shelves/e_int_config_shelf.c +++ b/src/modules/conf_shelves/e_int_config_shelf.c @@ -39,7 +39,7 @@ struct _E_Config_Dialog_Data static E_Config_Dialog_Data *_cfdata; E_Config_Dialog * -e_int_config_shelf(E_Container *con, const char *params __UNUSED__) +e_int_config_shelf(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -52,7 +52,7 @@ e_int_config_shelf(E_Container *con, const char *params __UNUSED__) v->free_cfdata = _free_data; v->basic.create_widgets = _basic_create; - cfd = e_config_dialog_new(con, _("Shelf Settings"), "E", + cfd = e_config_dialog_new(comp, _("Shelf Settings"), "E", "extensions/shelves", "preferences-desktop-shelf", 0, v, NULL); return cfd; @@ -78,8 +78,8 @@ _shelf_handler_cb(E_Config_Dialog_Data *cfdata, int type __UNUSED__, E_Event_She { E_Zone *zone; - if (!cfdata->cfd->dia->win->border) return ECORE_CALLBACK_RENEW; - zone = cfdata->cfd->dia->win->border->zone; + if (!cfdata->cfd->dia->win->client) return ECORE_CALLBACK_RENEW; + zone = cfdata->cfd->dia->win->client->zone; if (ev->shelf->zone == zone) _ilist_item_new(cfdata, 1, ev->shelf); return ECORE_CALLBACK_RENEW; @@ -125,7 +125,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) e_dialog_resizable_set(cfd->dia, 1); ol = e_widget_list_add(evas, 0, 0); - zone = cfdata->cfd->dia->win->border ? cfdata->cfd->dia->win->border->zone : e_zone_current_get(cfdata->cfd->con); + zone = cfdata->cfd->dia->win->client ? cfdata->cfd->dia->win->client->zone : e_zone_current_get(cfdata->cfd->comp); snprintf(buf, sizeof(buf), _("Configured Shelves: Display %d"), zone->num); of = e_widget_framelist_add(evas, buf, 0); cfdata->o_list = e_widget_ilist_add(evas, 24, 24, &(cfdata->cur_shelf)); @@ -212,10 +212,10 @@ _ilist_empty(E_Config_Dialog_Data *cfdata) E_Desk *desk; E_Zone *zone; - if ((!cfdata) || (!cfdata->cfd) || (!cfdata->cfd->con) || (!cfdata->cfd->con->manager)) return; - zone = cfdata->cfd->dia->win->border ? cfdata->cfd->dia->win->border->zone : e_zone_current_get(cfdata->cfd->con); + if ((!cfdata) || (!cfdata->cfd) || (!cfdata->cfd->comp) || (!cfdata->cfd->comp->man)) return; + zone = cfdata->cfd->dia->win->client ? cfdata->cfd->dia->win->client->zone : e_zone_current_get(cfdata->cfd->comp); if (!zone) return; - desk = cfdata->cfd->dia->win->border ? cfdata->cfd->dia->win->border->desk : e_desk_current_get(zone); + desk = cfdata->cfd->dia->win->client ? cfdata->cfd->dia->win->client->desk : e_desk_current_get(zone); EINA_LIST_FOREACH(e_shelf_list(), l, es) { if (es->zone != zone) continue; @@ -265,7 +265,7 @@ _ilist_fill(E_Config_Dialog_Data *cfdata) e_widget_ilist_freeze(cfdata->o_list); e_widget_ilist_clear(cfdata->o_list); e_widget_ilist_go(cfdata->o_list); - zone = cfdata->cfd->dia->win->border ? cfdata->cfd->dia->win->border->zone : e_zone_current_get(cfdata->cfd->con); + zone = cfdata->cfd->dia->win->client ? cfdata->cfd->dia->win->client->zone : e_zone_current_get(cfdata->cfd->comp); desk = e_desk_current_get(zone); EINA_LIST_FOREACH(e_shelf_list(), l, es) @@ -346,7 +346,7 @@ _cb_add(void *data, void *data2 __UNUSED__) cfdata = data; if (!cfdata) return; - zone = cfdata->cfd->dia->win->border ? cfdata->cfd->dia->win->border->zone : e_zone_current_get(cfdata->cfd->con); + zone = cfdata->cfd->dia->win->client ? cfdata->cfd->dia->win->client->zone : e_zone_current_get(cfdata->cfd->comp); cfdata->dia_new_shelf = e_shelf_new_dialog(zone); e_object_data_set(E_OBJECT(cfdata->dia_new_shelf), cfdata); e_object_del_attach_func_set(E_OBJECT(cfdata->dia_new_shelf), _new_shelf_cb_close); diff --git a/src/modules/conf_shelves/e_int_config_shelf.h b/src/modules/conf_shelves/e_int_config_shelf.h index 3d814fd3f..ff2e03230 100644 --- a/src/modules/conf_shelves/e_int_config_shelf.h +++ b/src/modules/conf_shelves/e_int_config_shelf.h @@ -3,7 +3,7 @@ #ifndef E_INT_CONFIG_SHELF_H #define E_INT_CONFIG_SHELF_H -E_Config_Dialog *e_int_config_shelf(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_shelf(E_Comp *comp, const char *params __UNUSED__); #endif #endif diff --git a/src/modules/conf_shelves/e_mod_main.c b/src/modules/conf_shelves/e_mod_main.c index ee87f0a3f..21b7e7cfd 100644 --- a/src/modules/conf_shelves/e_mod_main.c +++ b/src/modules/conf_shelves/e_mod_main.c @@ -63,7 +63,7 @@ e_modapi_save(E_Module *m __UNUSED__) static void _e_mod_run_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); } /* menu item add hook */ diff --git a/src/modules/conf_shelves/e_mod_main.h b/src/modules/conf_shelves/e_mod_main.h index a97598a43..0b10cb4c4 100644 --- a/src/modules/conf_shelves/e_mod_main.h +++ b/src/modules/conf_shelves/e_mod_main.h @@ -1,7 +1,7 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_shelf(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_shelf(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_theme/e_int_config_borders.c b/src/modules/conf_theme/e_int_config_borders.c index aeb5615df..58167e540 100644 --- a/src/modules/conf_theme/e_int_config_borders.c +++ b/src/modules/conf_theme/e_int_config_borders.c @@ -12,14 +12,14 @@ static void _basic_apply_border(E_Config_Dialog_Data *cfdata); struct _E_Config_Dialog_Data { - E_Border *border; - E_Container *container; + E_Client *client; + E_Comp *comp; const char *bordername; int remember_border; }; E_Config_Dialog * -e_int_config_borders(E_Container *con, const char *params __UNUSED__) +e_int_config_borders(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -27,30 +27,30 @@ e_int_config_borders(E_Container *con, const char *params __UNUSED__) if (e_config_dialog_find("E", "appearance/borders")) return NULL; v = _config_view_new(); if (!v) return NULL; - cfd = e_config_dialog_new(con, _("Default Border Style"), + cfd = e_config_dialog_new(comp, _("Default Border Style"), "E", "appearance/borders", - "preferences-system-windows", 0, v, con); + "preferences-system-windows", 0, v, comp); return cfd; } E_Config_Dialog * -e_int_config_borders_border(E_Container *con __UNUSED__, const char *params) +e_int_config_borders_border(E_Comp *comp __UNUSED__, const char *params) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; - E_Border *bd; + E_Client *ec; if (!params) return NULL; - bd = NULL; - sscanf(params, "%p", &bd); - if (!bd) return NULL; + ec = NULL; + sscanf(params, "%p", &ec); + if (!ec) return NULL; v = _config_view_new(); if (!v) return NULL; - cfd = e_config_dialog_new(bd->zone->container, + cfd = e_config_dialog_new(ec->zone->comp, _("Window Border Selection"), "E", "_config_border_border_style_dialog", - "preferences-system-windows", 0, v, bd); - bd->border_border_dialog = cfd; + "preferences-system-windows", 0, v, ec); + ec->border_border_dialog = cfd; return cfd; } @@ -76,12 +76,12 @@ _create_data(E_Config_Dialog *cfd) E_Config_Dialog_Data *cfdata; cfdata = E_NEW(E_Config_Dialog_Data, 1); - cfdata->container = NULL; - cfdata->border = NULL; - if (E_OBJECT(cfd->data)->type == E_CONTAINER_TYPE) - cfdata->container = cfd->data; + cfdata->comp = NULL; + cfdata->client = NULL; + if (E_OBJECT(cfd->data)->type == E_COMP_TYPE) + cfdata->comp = cfd->data; else - cfdata->border = cfd->data; + cfdata->client = cfd->data; _fill_data(cfdata); return cfdata; @@ -90,14 +90,14 @@ _create_data(E_Config_Dialog *cfd) static void _fill_data(E_Config_Dialog_Data *cfdata) { - if (cfdata->border) + if (cfdata->client) { - if ((cfdata->border->remember) && - (cfdata->border->remember->apply & E_REMEMBER_APPLY_BORDER)) + if ((cfdata->client->remember) && + (cfdata->client->remember->apply & E_REMEMBER_APPLY_BORDER)) { cfdata->remember_border = 1; } - cfdata->bordername = eina_stringshare_add(cfdata->border->client.border.name); + cfdata->bordername = eina_stringshare_add(cfdata->client->border.name); } else cfdata->bordername = eina_stringshare_add(e_config->theme_default_border_style); @@ -106,8 +106,8 @@ _fill_data(E_Config_Dialog_Data *cfdata) static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { - if (cfdata->border) - cfdata->border->border_border_dialog = NULL; + if (cfdata->client) + cfdata->client->border_border_dialog = NULL; eina_stringshare_del(cfdata->bordername); E_FREE(cfdata); @@ -117,13 +117,13 @@ static int _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { Eina_Bool remch = ((cfdata->remember_border && - !((cfdata->border->remember) && - (cfdata->border->remember->apply & E_REMEMBER_APPLY_BORDER))) || - (!cfdata->remember_border && cfdata->border && - ((cfdata->border->remember) && - (cfdata->border->remember->apply & E_REMEMBER_APPLY_BORDER)))); - if (cfdata->border) - return (cfdata->bordername != cfdata->border->client.border.name) || (remch); + !((cfdata->client->remember) && + (cfdata->client->remember->apply & E_REMEMBER_APPLY_BORDER))) || + (!cfdata->remember_border && cfdata->client && + ((cfdata->client->remember) && + (cfdata->client->remember->apply & E_REMEMBER_APPLY_BORDER)))); + if (cfdata->client) + return (cfdata->bordername != cfdata->client->border.name) || (remch); else return (cfdata->bordername != e_config->theme_default_border_style) || (remch); } @@ -131,17 +131,18 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { - if (cfdata->border) + if (cfdata->client) _basic_apply_border(cfdata); - else if (cfdata->container) + else if (cfdata->comp) { Eina_List *l; - E_Border *bd; + E_Client *ec; eina_stringshare_replace(&e_config->theme_default_border_style, cfdata->bordername); - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(cfdata->comp->clients, l, ec) { - bd->changed = 1; - bd->client.border.changed = 1; + if (e_client_util_ignored_get(ec)) continue; + EC_CHANGED(ec); + ec->border.changed = 1; } } e_config_save_queue(); @@ -151,15 +152,15 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) static void _basic_apply_border(E_Config_Dialog_Data *cfdata) { - if ((!cfdata->border->lock_border) && (!cfdata->border->shaded)) + if ((!cfdata->client->lock_border) && (!cfdata->client->shaded)) { - eina_stringshare_replace(&cfdata->border->bordername, cfdata->bordername); - cfdata->border->client.border.changed = 1; - cfdata->border->changed = 1; + eina_stringshare_replace(&cfdata->client->bordername, cfdata->bordername); + cfdata->client->border.changed = 1; + EC_CHANGED(cfdata->client); } if (cfdata->remember_border) { - E_Remember *rem = cfdata->border->remember; + E_Remember *rem = cfdata->client->remember; if (!rem) { @@ -169,22 +170,22 @@ _basic_apply_border(E_Config_Dialog_Data *cfdata) if (rem) { rem->apply |= E_REMEMBER_APPLY_BORDER; - e_remember_default_match_set(rem, cfdata->border); - eina_stringshare_replace(&rem->prop.border, cfdata->border->bordername); - cfdata->border->remember = rem; - e_remember_update(cfdata->border); + e_remember_default_match_set(rem, cfdata->client); + eina_stringshare_replace(&rem->prop.border, cfdata->client->bordername); + cfdata->client->remember = rem; + e_remember_update(cfdata->client); } } else { - if (cfdata->border->remember) + if (cfdata->client->remember) { - cfdata->border->remember->apply &= ~E_REMEMBER_APPLY_BORDER; - if (cfdata->border->remember->apply == 0) + cfdata->client->remember->apply &= ~E_REMEMBER_APPLY_BORDER; + 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; } } } @@ -200,8 +201,8 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) const char *str, *tmp; e_dialog_resizable_set(cfd->dia, 1); - if (cfdata->border) - tmp = cfdata->border->client.border.name; + if (cfdata->client) + tmp = cfdata->client->border.name; else tmp = e_config->theme_default_border_style; @@ -250,7 +251,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) e_widget_framelist_object_append(of, ol); e_widget_list_object_append(o, of, 1, 1, 0.5); - if (cfdata->border) + if (cfdata->client) { ob = e_widget_check_add(evas, _("Remember this Border for this window next time it appears"), &(cfdata->remember_border)); diff --git a/src/modules/conf_theme/e_int_config_color_classes.c b/src/modules/conf_theme/e_int_config_color_classes.c index 95550f290..f3fc39e00 100644 --- a/src/modules/conf_theme/e_int_config_color_classes.c +++ b/src/modules/conf_theme/e_int_config_color_classes.c @@ -146,7 +146,7 @@ static Eina_Bool _fill_data_delayed(void *data); static Eina_Bool _color_changed_delay(void *data); E_Config_Dialog * -e_int_config_color_classes(E_Container *con, const char *params __UNUSED__) +e_int_config_color_classes(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -160,7 +160,7 @@ e_int_config_color_classes(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_apply_data; v->basic.create_widgets = _basic_create_widgets; - cfd = e_config_dialog_new(con, _("Colors"), "E", "appearance/colors", + cfd = e_config_dialog_new(comp, _("Colors"), "E", "appearance/colors", "preferences-desktop-color", 0, v, NULL); return cfd; } diff --git a/src/modules/conf_theme/e_int_config_fonts.c b/src/modules/conf_theme/e_int_config_fonts.c index 43dfe59a9..2f4dc00de 100644 --- a/src/modules/conf_theme/e_int_config_fonts.c +++ b/src/modules/conf_theme/e_int_config_fonts.c @@ -149,7 +149,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_fonts(E_Container *con, const char *params __UNUSED__) +e_int_config_fonts(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -164,7 +164,7 @@ e_int_config_fonts(E_Container *con, const char *params __UNUSED__) v->advanced.create_widgets = _advanced_create_widgets; v->advanced.apply_cfdata = _advanced_apply_data; - cfd = e_config_dialog_new(con, _("Font Settings"), + cfd = e_config_dialog_new(comp, _("Font Settings"), "E", "appearance/fonts", "preferences-desktop-font", 0, v, NULL); return cfd; diff --git a/src/modules/conf_theme/e_int_config_scale.c b/src/modules/conf_theme/e_int_config_scale.c index 6e22b1890..8024b5bc4 100644 --- a/src/modules/conf_theme/e_int_config_scale.c +++ b/src/modules/conf_theme/e_int_config_scale.c @@ -106,7 +106,7 @@ _scale_preview_new(E_Config_Dialog_Data *cfdata, Evas *e, double sc, double *scp evas_object_show(bg); cm = edje_object_add(e_widget_preview_evas_get(ob)); - e_theme_edje_object_set(cm, "base/theme/borders", "e/comp/border/default"); + e_theme_edje_object_set(cm, "base/theme/borders", "e/comp/frame/default"); evas_object_move(cm, 16, 16); evas_object_resize(cm, 180 * sc, 70); evas_object_show(cm); @@ -135,9 +135,9 @@ _scale_preview_new(E_Config_Dialog_Data *cfdata, Evas *e, double sc, double *scp else edje_object_part_text_set(bd, "e.text.title", tit); edje_object_signal_emit(bd, "e,state,focused", "e"); + edje_object_signal_emit(bd, "e,state,shadow,on", "e"); - edje_object_signal_emit(cm, "e,state,visible,on", "e"); - edje_object_signal_emit(cm, "e,state,shadow,on", "e"); + edje_object_signal_emit(cm, "e,state,visible", "e"); edje_object_signal_emit(cm, "e,state,focus,on", "e"); edje_object_scale_set(bd, sc); @@ -161,7 +161,7 @@ _scale_preview_new(E_Config_Dialog_Data *cfdata, Evas *e, double sc, double *scp } E_Config_Dialog * -e_int_config_scale(E_Container *con, const char *params __UNUSED__) +e_int_config_scale(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -177,7 +177,7 @@ e_int_config_scale(E_Container *con, const char *params __UNUSED__) v->advanced.apply_cfdata = _adv_apply; v->advanced.check_changed = _adv_changed; - cfd = e_config_dialog_new(con, _("Scale Settings"), "E", "appearance/scale", + cfd = e_config_dialog_new(comp, _("Scale Settings"), "E", "appearance/scale", "preferences-scale", 0, v, NULL); e_config_dialog_changed_auto_set(cfd, 1); return cfd; @@ -275,8 +275,8 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) e_config->scale.min, e_config->scale.max, e_config->scale.factor, e_config->scale.base_dpi); - cfd->dia->win->border->internal_no_reopen = 1; - e_remember_update(cfd->dia->win->border); + cfd->dia->win->client->internal_no_reopen = 1; + e_remember_update(cfd->dia->win->client); e_config_save_queue(); a = e_action_find("restart"); @@ -368,8 +368,8 @@ _adv_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) e_config->scale.factor = cfdata->factor; e_config->scale.base_dpi = cfdata->base_dpi; - cfd->dia->win->border->internal_no_reopen = 1; - e_remember_update(cfd->dia->win->border); + cfd->dia->win->client->internal_no_reopen = 1; + e_remember_update(cfd->dia->win->client); e_config_save_queue(); a = e_action_find("restart"); diff --git a/src/modules/conf_theme/e_int_config_theme.c b/src/modules/conf_theme/e_int_config_theme.c index 56c1dc15b..2b7f8741c 100644 --- a/src/modules/conf_theme/e_int_config_theme.c +++ b/src/modules/conf_theme/e_int_config_theme.c @@ -69,7 +69,7 @@ _e_int_theme_preview_set(Evas_Object *preview, const char *file) objs = eina_list_append(objs, o); o = edje_object_add(e); - _e_int_theme_edje_file_set(o, file, "e/comp/border/popup"); + _e_int_theme_edje_file_set(o, file, "e/comp/frame/popup"); evas_object_move(o, (w - (400 * e_scale)) / 2, h - (40 * e_scale)); evas_object_resize(o, 400 * e_scale, (40 * e_scale)); evas_object_show(o); @@ -177,7 +177,7 @@ _e_int_theme_preview_set(Evas_Object *preview, const char *file) o = edje_object_add(e); - _e_int_theme_edje_file_set(o, file, "e/comp/border/default"); + _e_int_theme_edje_file_set(o, file, "e/comp/frame/default"); evas_object_move(o, w / 2, h / 9); evas_object_resize(o, w / 3, h / 3); evas_object_show(o); @@ -211,7 +211,7 @@ _e_int_theme_preview_set(Evas_Object *preview, const char *file) o = edje_object_add(e); - _e_int_theme_edje_file_set(o, file, "e/comp/border/default"); + _e_int_theme_edje_file_set(o, file, "e/comp/frame/default"); evas_object_move(o, w / 10, h / 5); evas_object_resize(o, w / 2, h / 3); evas_object_show(o); @@ -294,7 +294,7 @@ _e_int_theme_preview_set(Evas_Object *preview, const char *file) } E_Config_Dialog * -e_int_config_theme(E_Container *con, const char *params __UNUSED__) +e_int_config_theme(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -307,7 +307,7 @@ e_int_config_theme(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_apply_data; v->basic.create_widgets = _basic_create_widgets; v->override_auto_apply = 1; - cfd = e_config_dialog_new(con, + cfd = e_config_dialog_new(comp, _("Theme Selector"), "E", "appearance/theme", "preferences-desktop-theme", 0, v, NULL); @@ -627,9 +627,7 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) Eio_File *ls; Eet_File *ef; - if (cfdata->win_import) - e_int_config_theme_del(cfdata->win_import); - cfdata->win_import = NULL; + E_FREE_FUNC(cfdata->win_import, e_object_del); if (cfdata->eio[0]) eio_file_cancel(cfdata->eio[0]); if (cfdata->eio[1]) eio_file_cancel(cfdata->eio[1]); EINA_LIST_FOREACH(cfdata->theme_init, l, ls) @@ -651,7 +649,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf char path[PATH_MAX]; e_dialog_resizable_set(cfd->dia, 1); - z = e_zone_current_get(cfd->con); + z = e_zone_current_get(cfd->comp); ot = e_widget_table_add(evas, 0); ol = e_widget_table_add(evas, 0); diff --git a/src/modules/conf_theme/e_int_config_theme_import.c b/src/modules/conf_theme/e_int_config_theme_import.c index 5a8993574..cbe8a833f 100644 --- a/src/modules/conf_theme/e_int_config_theme_import.c +++ b/src/modules/conf_theme/e_int_config_theme_import.c @@ -49,7 +49,7 @@ e_int_config_theme_import(E_Config_Dialog *parent) import = E_NEW(Import, 1); if (!import) return NULL; - win = e_win_new(parent->con); + win = e_win_new(parent->comp); if (!win) { E_FREE(import); @@ -140,15 +140,15 @@ e_int_config_theme_import(E_Config_Dialog *parent) e_win_size_min_set(win, w, h); e_win_size_max_set(win, 99999, 99999); e_win_show(win); - e_win_border_icon_set(win, "preferences-desktop-theme"); + e_win_client_icon_set(win, "preferences-desktop-theme"); win->data = import; return win; } -void -e_int_config_theme_del(E_Win *win) +static void +_theme_import_cb_delete(E_Win *win) { Import *import; @@ -163,12 +163,6 @@ e_int_config_theme_del(E_Win *win) return; } -static void -_theme_import_cb_delete(E_Win *win) -{ - e_int_config_theme_del(win); -} - static void _theme_import_cb_resize(E_Win *win) { @@ -298,16 +292,13 @@ _theme_import_cb_ok(void *data, void *data2 __UNUSED__) } } - e_int_config_theme_del(import->win); + e_object_del(E_OBJECT(import->win)); } static void _theme_import_cb_close(void *data, void *data2 __UNUSED__) { - E_Win *win; - - win = data; - e_int_config_theme_del(win); + e_object_del(data); } static void diff --git a/src/modules/conf_theme/e_int_config_transitions.c b/src/modules/conf_theme/e_int_config_transitions.c index 3c8255ed5..7b3cd06c6 100644 --- a/src/modules/conf_theme/e_int_config_transitions.c +++ b/src/modules/conf_theme/e_int_config_transitions.c @@ -28,7 +28,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_transitions(E_Container *con, const char *params __UNUSED__) +e_int_config_transitions(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -43,7 +43,7 @@ e_int_config_transitions(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create_widgets; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Transition Settings"), + cfd = e_config_dialog_new(comp, _("Transition Settings"), "E", "appearance/transitions", "preferences-transitions", 0, v, NULL); return cfd; @@ -166,7 +166,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf Eina_List *l; char *t; - zone = e_zone_current_get(cfd->con); + zone = e_zone_current_get(cfd->comp); o = e_widget_table_add(evas, 0); diff --git a/src/modules/conf_theme/e_int_config_wallpaper.c b/src/modules/conf_theme/e_int_config_wallpaper.c index c35e6d2be..a4e25d921 100644 --- a/src/modules/conf_theme/e_int_config_wallpaper.c +++ b/src/modules/conf_theme/e_int_config_wallpaper.c @@ -9,7 +9,7 @@ static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config static int _adv_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static Evas_Object *_adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); -static E_Config_Dialog *_e_int_config_wallpaper_desk(E_Container *con, int con_num, int zone_num, int desk_x, int desk_y); +static E_Config_Dialog *_e_int_config_wallpaper_desk(E_Comp *comp, int man_num, int zone_num, int desk_x, int desk_y); static void _cb_button_up(void *data1, void *data2); static void _cb_files_changed(void *data, Evas_Object *obj, void *event_info); @@ -27,7 +27,7 @@ static void _cb_import(void *data1, void *data2); struct _E_Config_Wallpaper { int specific_config; - int con_num, zone_num; + int man_num, zone_num; int desk_x, desk_y; }; @@ -52,25 +52,25 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_wallpaper(E_Container *con, const char *params __UNUSED__) +e_int_config_wallpaper(E_Comp *comp, const char *params __UNUSED__) { - return _e_int_config_wallpaper_desk(con, -1, -1, -1, -1); + return _e_int_config_wallpaper_desk(comp, -1, -1, -1, -1); } E_Config_Dialog * -e_int_config_wallpaper_desk(E_Container *con, const char *params) +e_int_config_wallpaper_desk(E_Comp *comp, const char *params) { - int con_num, zone_num, desk_x, desk_y; + int man_num, zone_num, desk_x, desk_y; if (!params) return NULL; - con_num = zone_num = desk_x = desk_y = -1; - if (sscanf(params, "%i %i %i %i", &con_num, &zone_num, &desk_x, &desk_y) != 4) + man_num = zone_num = desk_x = desk_y = -1; + if (sscanf(params, "%i %i %i %i", &man_num, &zone_num, &desk_x, &desk_y) != 4) return NULL; - return _e_int_config_wallpaper_desk(con, con_num, zone_num, desk_x, desk_y); + return _e_int_config_wallpaper_desk(comp, man_num, zone_num, desk_x, desk_y); } static E_Config_Dialog * -_e_int_config_wallpaper_desk(E_Container *con, int con_num, int zone_num, int desk_x, int desk_y) +_e_int_config_wallpaper_desk(E_Comp *comp, int man_num, int zone_num, int desk_x, int desk_y) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -85,7 +85,7 @@ _e_int_config_wallpaper_desk(E_Container *con, int con_num, int zone_num, int de v->basic.apply_cfdata = _basic_apply; v->basic.create_widgets = _basic_create; - if (!(con_num == -1 && zone_num == -1 && desk_x == -1 && desk_y == -1)) + if (!(man_num == -1 && zone_num == -1 && desk_x == -1 && desk_y == -1)) cw->specific_config = 1; else { @@ -95,12 +95,12 @@ _e_int_config_wallpaper_desk(E_Container *con, int con_num, int zone_num, int de v->override_auto_apply = 1; - cw->con_num = con_num; + cw->man_num = man_num; cw->zone_num = zone_num; cw->desk_x = desk_x; cw->desk_y = desk_y; - cfd = e_config_dialog_new(con, _("Wallpaper Settings"), "E", + cfd = e_config_dialog_new(comp, _("Wallpaper Settings"), "E", "appearance/wallpaper", "preferences-desktop-wallpaper", 0, v, cw); return cfd; @@ -317,7 +317,7 @@ _cb_import(void *data1, void *data2 __UNUSED__) e_win_raise(cfdata->win_import->dia->win); return; } - cfdata->win_import = e_import_dialog_show(cfdata->cfd->dia->win->container, NULL, NULL, (Ecore_End_Cb)_cb_import_ok, NULL); + cfdata->win_import = e_import_dialog_show(cfdata->cfd->dia->win->comp, NULL, NULL, (Ecore_End_Cb)_cb_import_ok, NULL); e_object_data_set(E_OBJECT(cfdata->win_import), cfdata); e_object_del_attach_func_set(E_OBJECT(cfdata->win_import), _cb_import_del); } @@ -333,24 +333,24 @@ _fill_data(E_Config_Dialog_Data *cfdata) if (cw->specific_config) { /* specific config passed in. set for that only */ - cfdata->bg = e_bg_file_get(cw->con_num, cw->zone_num, cw->desk_x, cw->desk_y); + cfdata->bg = e_bg_file_get(cw->man_num, cw->zone_num, cw->desk_x, cw->desk_y); } else { /* get current desk. advanced mode allows selecting all, screen or desk */ - E_Container *c; - E_Zone *z; - E_Desk *d; + E_Comp *comp; + E_Zone *zone; + E_Desk *desk; - c = e_container_current_get(e_manager_current_get()); - z = e_zone_current_get(c); - d = e_desk_current_get(z); + comp = e_manager_current_get()->comp; + zone = e_zone_current_get(comp); + desk = e_desk_current_get(zone); - cfbg = e_bg_config_get(c->num, z->num, d->x, d->y); + cfbg = e_bg_config_get(comp->num, zone->num, desk->x, desk->y); /* if we have a config for this bg, use it. */ if (cfbg) { - if (cfbg->container >= 0 && cfbg->zone >= 0) + if (cfbg->manager >= 0 && cfbg->zone >= 0) { if (cfbg->desk_x >= 0 && cfbg->desk_y >= 0) cfdata->all_this_desk_screen = E_CONFIG_WALLPAPER_DESK; @@ -412,7 +412,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) e_dialog_resizable_set(cfd->dia, 1); - zone = e_zone_current_get(cfd->con); + zone = e_zone_current_get(cfd->comp); o = e_widget_list_add(evas, 0, 1); rg = e_widget_radio_group_new(&(cfdata->fmdir)); @@ -529,8 +529,8 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) if (cw->specific_config) { /* update a specific config */ - e_bg_del(cw->con_num, cw->zone_num, cw->desk_x, cw->desk_y); - e_bg_add(cw->con_num, cw->zone_num, cw->desk_x, cw->desk_y, cfdata->bg); + e_bg_del(cw->man_num, cw->zone_num, cw->desk_x, cw->desk_y); + e_bg_add(cw->man_num, cw->zone_num, cw->desk_x, cw->desk_y, cfdata->bg); } else { @@ -540,7 +540,7 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) E_Config_Desktop_Background *cfbg; cfbg = e_config->desktop_backgrounds->data; - e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y); + e_bg_del(cfbg->manager, cfbg->zone, cfbg->desk_x, cfbg->desk_y); } if ((cfdata->use_theme_bg) || (!cfdata->bg)) e_bg_default_set(NULL); @@ -567,7 +567,7 @@ _adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) e_dialog_resizable_set(cfd->dia, 1); - zone = e_zone_current_get(cfd->con); + zone = e_zone_current_get(cfd->comp); o = e_widget_list_add(evas, 0, 1); rg = e_widget_radio_group_new(&(cfdata->fmdir)); @@ -638,8 +638,8 @@ _adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) ow = e_widget_radio_add(evas, _("This Desktop"), E_CONFIG_WALLPAPER_DESK, rg); e_widget_frametable_object_append(of, ow, 0, 1, 1, 1, 1, 0, 1, 0); ow = e_widget_radio_add(evas, _("This Screen"), E_CONFIG_WALLPAPER_SCREEN, rg); - if (!(e_util_container_zone_number_get(0, 1) || - (e_util_container_zone_number_get(1, 0)))) + if (!(e_util_comp_zone_number_get(0, 1) || + (e_util_comp_zone_number_get(1, 0)))) e_widget_disabled_set(ow, 1); e_widget_frametable_object_append(of, ow, 0, 2, 1, 1, 1, 0, 1, 0); e_widget_table_object_append(ot, of, 0, 3, 2, 1, 1, 0, 1, 0); @@ -656,7 +656,7 @@ _adv_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) E_Zone *z; E_Desk *d; - if (!(z = e_zone_current_get(cfdata->cfd->con))) return 0; + if (!(z = e_zone_current_get(cfdata->cfd->comp))) return 0; if (!(d = e_desk_current_get(z))) return 0; if (cfdata->use_theme_bg) { @@ -665,7 +665,7 @@ _adv_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) E_Config_Desktop_Background *cfbg; cfbg = e_config->desktop_backgrounds->data; - e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y); + e_bg_del(cfbg->manager, cfbg->zone, cfbg->desk_x, cfbg->desk_y); } e_bg_default_set(NULL); } @@ -678,17 +678,17 @@ _adv_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) E_Config_Desktop_Background *cfbg; cfbg = e_config->desktop_backgrounds->data; - e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y); + e_bg_del(cfbg->manager, cfbg->zone, cfbg->desk_x, cfbg->desk_y); } e_bg_default_set(cfdata->bg); } else if (cfdata->all_this_desk_screen == E_CONFIG_WALLPAPER_DESK) { - e_bg_del(z->container->num, z->num, d->x, d->y); - e_bg_del(z->container->num, -1, d->x, d->y); + e_bg_del(z->comp->num, z->num, d->x, d->y); + e_bg_del(z->comp->num, -1, d->x, d->y); e_bg_del(-1, z->num, d->x, d->y); e_bg_del(-1, -1, d->x, d->y); - e_bg_add(z->container->num, z->num, d->x, d->y, cfdata->bg); + e_bg_add(z->comp->num, z->num, d->x, d->y, cfdata->bg); } else if (cfdata->all_this_desk_screen == E_CONFIG_WALLPAPER_SCREEN) { @@ -697,7 +697,7 @@ _adv_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) E_Config_Desktop_Background *cfbg; cfbg = l->data; - if ((cfbg->container == (int)z->container->num) && + if ((cfbg->manager == (int)z->comp->num) && (cfbg->zone == (int)z->num)) fl = eina_list_append(fl, cfbg); } @@ -706,11 +706,11 @@ _adv_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) E_Config_Desktop_Background *cfbg; cfbg = fl->data; - e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, + e_bg_del(cfbg->manager, cfbg->zone, cfbg->desk_x, cfbg->desk_y); fl = eina_list_remove_list(fl, fl); } - e_bg_add(z->container->num, z->num, -1, -1, cfdata->bg); + e_bg_add(z->comp->num, z->num, -1, -1, cfdata->bg); } } e_bg_update(); diff --git a/src/modules/conf_theme/e_int_config_xsettings.c b/src/modules/conf_theme/e_int_config_xsettings.c index 291f7cee5..ee0c77ed5 100644 --- a/src/modules/conf_theme/e_int_config_xsettings.c +++ b/src/modules/conf_theme/e_int_config_xsettings.c @@ -44,7 +44,7 @@ static const char *_icon_previews[4] = #define PREVIEW_SIZE (48) E_Config_Dialog * -e_int_config_xsettings(E_Container *con, const char *params __UNUSED__) +e_int_config_xsettings(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -58,7 +58,7 @@ e_int_config_xsettings(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_apply; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Application Theme Settings"), + cfd = e_config_dialog_new(comp, _("Application Theme Settings"), "E", "appearance/xsettings", "preferences-desktop-theme", 0, v, NULL); return cfd; diff --git a/src/modules/conf_theme/e_mod_main.c b/src/modules/conf_theme/e_mod_main.c index d8083c879..5b24e0935 100644 --- a/src/modules/conf_theme/e_mod_main.c +++ b/src/modules/conf_theme/e_mod_main.c @@ -16,7 +16,7 @@ EAPI E_Module_Api e_modapi = static void _e_mod_run_wallpaper_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__) { - e_configure_registry_call("appearance/wallpaper", m->zone->container, NULL); + e_configure_registry_call("appearance/wallpaper", m->zone->comp, NULL); } static void @@ -33,7 +33,7 @@ _e_mod_menu_wallpaper_add(void *data __UNUSED__, E_Menu *m) static void _e_mod_run_theme_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__) { - e_configure_registry_call("appearance/theme", m->zone->container, NULL); + e_configure_registry_call("appearance/theme", m->zone->comp, NULL); } static void diff --git a/src/modules/conf_theme/e_mod_main.h b/src/modules/conf_theme/e_mod_main.h index 6b3a1d717..8f9cdcfe5 100644 --- a/src/modules/conf_theme/e_mod_main.h +++ b/src/modules/conf_theme/e_mod_main.h @@ -3,7 +3,7 @@ typedef struct _E_Config_Wallpaper E_Config_Wallpaper; -E_Config_Dialog *e_int_config_xsettings(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_xsettings(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf @@ -16,31 +16,28 @@ E_Config_Dialog *e_int_config_xsettings(E_Container *con, const char *params __U * @} */ -E_Config_Dialog *e_int_config_borders(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_borders_border(E_Container *con, const char *params); +E_Config_Dialog *e_int_config_borders(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_borders_border(E_Comp *comp, const char *params); -E_Config_Dialog *e_int_config_color_classes(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_color_classes(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_fonts(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_fonts(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_scale(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_scale(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_theme(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_theme(E_Comp *comp, const char *params __UNUSED__); void e_int_config_theme_import_done(E_Config_Dialog *dia); void e_int_config_theme_update(E_Config_Dialog *dia, char *file); -void e_int_config_theme_web_done(E_Config_Dialog *dia); E_Win *e_int_config_theme_import (E_Config_Dialog *parent); -void e_int_config_theme_del (E_Win *win); -E_Config_Dialog *e_int_config_transitions(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_transitions(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_wallpaper(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_wallpaper_desk(E_Container *con, const char *params); +E_Config_Dialog *e_int_config_wallpaper(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_wallpaper_desk(E_Comp *comp, const char *params); void e_int_config_wallpaper_update(E_Config_Dialog *dia, char *file); void e_int_config_wallpaper_import_done(E_Config_Dialog *dia); -void e_int_config_wallpaper_web_done(E_Config_Dialog *dia); #endif diff --git a/src/modules/conf_wallpaper2/e_int_config_wallpaper.c b/src/modules/conf_wallpaper2/e_int_config_wallpaper.c index a29f18d7a..38b82cef9 100644 --- a/src/modules/conf_wallpaper2/e_int_config_wallpaper.c +++ b/src/modules/conf_wallpaper2/e_int_config_wallpaper.c @@ -24,7 +24,7 @@ struct _Info Eina_Iterator *dir; Ecore_Idler *idler; int scans; - int con_num, zone_num, desk_x, desk_y; + int man_num, zone_num, desk_x, desk_y; int use_theme_bg; int mode; }; @@ -989,7 +989,7 @@ _apply(void *data, void *data2 __UNUSED__) E_Config_Desktop_Background *cfbg; cfbg = e_config->desktop_backgrounds->data; - e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y); + e_bg_del(cfbg->manager, cfbg->zone, cfbg->desk_x, cfbg->desk_y); } if ((info->use_theme_bg) || (!info->bg_file)) e_bg_default_set(NULL); @@ -999,8 +999,8 @@ _apply(void *data, void *data2 __UNUSED__) else if (info->mode == 1) { /* specific desk */ - e_bg_del(info->con_num, info->zone_num, info->desk_x, info->desk_y); - e_bg_add(info->con_num, info->zone_num, info->desk_x, info->desk_y, + e_bg_del(info->man_num, info->zone_num, info->desk_x, info->desk_y); + e_bg_add(info->man_num, info->zone_num, info->desk_x, info->desk_y, info->bg_file); } else @@ -1015,8 +1015,8 @@ _apply(void *data, void *data2 __UNUSED__) dlist = eina_list_append(dlist, cfbg); } EINA_LIST_FREE(dlist, cfbg) - e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y); - e_bg_add(info->con_num, info->zone_num, -1, -1, info->bg_file); + e_bg_del(cfbg->manager, cfbg->zone, cfbg->desk_x, cfbg->desk_y); + e_bg_add(info->man_num, info->zone_num, -1, -1, info->bg_file); } e_bg_update(); e_config_save_queue(); @@ -1114,7 +1114,7 @@ _scan(Info *info) } Info * -wp_browser_new(E_Container *con) +wp_browser_new(E_Comp *comp) { Info *info; E_Win *win; @@ -1129,17 +1129,17 @@ wp_browser_new(E_Container *con) info = calloc(1, sizeof(Info)); if (!info) return NULL; - zone = e_util_zone_current_get(con->manager); + zone = e_zone_current_get(comp); desk = e_desk_current_get(zone); - info->con_num = con->num; + info->man_num = comp->num; info->zone_num = zone->num; info->desk_x = desk->x; info->desk_y = desk->y; info->mode = 0; - cfbg = e_bg_config_get(con->num, zone->num, desk->x, desk->y); + cfbg = e_bg_config_get(comp->num, zone->num, desk->x, desk->y); if (cfbg) { - if ((cfbg->container >= 0) && (cfbg->zone >= 0)) + if ((cfbg->manager >= 0) && (cfbg->zone >= 0)) { if ((cfbg->desk_x >= 0) && (cfbg->desk_y >= 0)) info->mode = 1; @@ -1156,7 +1156,7 @@ wp_browser_new(E_Container *con) info->iw = (120 * e_scale); info->ih = (zone->h * info->iw) / (zone->w); - win = e_win_new(con); + win = e_win_new(comp); if (!win) { eina_stringshare_del(info->bg_file); @@ -1176,7 +1176,7 @@ wp_browser_new(E_Container *con) e_win_resize_callback_set(win, _resize); e_win_delete_callback_set(win, _delete); - // bg + container + // bg + manager info->bg = edje_object_add(info->win->evas); e_theme_edje_object_set(info->bg, "base/theme/widgets", "e/conf/wallpaper/main/window"); @@ -1252,7 +1252,7 @@ wp_browser_new(E_Container *con) o2 = e_widget_radio_add(info->win->evas, _("All Desktops"), 0, rg); evas_object_smart_callback_add(o2, "changed", _wp_changed, info); e_widget_list_object_append(o, o2, 1, 0, 0.5); - e_widget_disabled_set(o2, (e_util_container_desk_count_get(con) < 2)); + e_widget_disabled_set(o2, (e_util_comp_desk_count_get(comp) < 2)); evas_object_show(o2); o2 = e_widget_radio_add(info->win->evas, _("This Desktop"), 1, rg); @@ -1263,8 +1263,8 @@ wp_browser_new(E_Container *con) o2 = e_widget_radio_add(info->win->evas, _("This Screen"), 2, rg); evas_object_smart_callback_add(o2, "changed", _wp_changed, info); e_widget_list_object_append(o, o2, 1, 0, 0.5); - if (!(e_util_container_zone_number_get(0, 1) || - (e_util_container_zone_number_get(1, 0)))) + if (!(e_util_comp_zone_number_get(0, 1) || + (e_util_comp_zone_number_get(1, 0)))) e_widget_disabled_set(o2, EINA_TRUE); evas_object_show(o2); @@ -1299,7 +1299,7 @@ wp_browser_new(E_Container *con) e_win_resize(win, mw, mh); e_win_centered_set(win, 1); e_win_show(win); - e_win_border_icon_set(win, "preferences-desktop-wallpaper"); + e_win_client_icon_set(win, "preferences-desktop-wallpaper"); evas_object_resize(info->bg, info->win->w, info->win->h); evas_object_show(info->bg); @@ -1329,14 +1329,14 @@ wp_broser_free(Info *info) } E_Config_Dialog * -wp_conf_show(E_Container *con, const char *params __UNUSED__) +wp_conf_show(E_Comp *comp, const char *params __UNUSED__) { if (global_info) { e_win_show(global_info->win); e_win_raise(global_info->win); } - global_info = wp_browser_new(con); + global_info = wp_browser_new(comp); return NULL; } diff --git a/src/modules/conf_wallpaper2/e_mod_main.c b/src/modules/conf_wallpaper2/e_mod_main.c index 695bd5f0c..7ca3adc08 100644 --- a/src/modules/conf_wallpaper2/e_mod_main.c +++ b/src/modules/conf_wallpaper2/e_mod_main.c @@ -78,7 +78,7 @@ e_modapi_save(E_Module *m __UNUSED__) static void _e_mod_run_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__) { - e_configure_registry_call("appearance/wallpaper2", m->zone->container, NULL); + e_configure_registry_call("appearance/wallpaper2", m->zone->comp, NULL); } /* menu item add hook */ diff --git a/src/modules/conf_wallpaper2/e_mod_main.h b/src/modules/conf_wallpaper2/e_mod_main.h index 87abfb1fe..dac60a7a9 100644 --- a/src/modules/conf_wallpaper2/e_mod_main.h +++ b/src/modules/conf_wallpaper2/e_mod_main.h @@ -1,7 +1,7 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *wp_conf_show(E_Container *con, const char *params); +E_Config_Dialog *wp_conf_show(E_Comp *comp, const char *params); void wp_conf_hide(void); /** diff --git a/src/modules/conf_window_manipulation/e_int_config_clientlist.c b/src/modules/conf_window_manipulation/e_int_config_clientlist.c index c81cbfa93..2803c6c57 100644 --- a/src/modules/conf_window_manipulation/e_int_config_clientlist.c +++ b/src/modules/conf_window_manipulation/e_int_config_clientlist.c @@ -20,7 +20,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_clientlist(E_Container *con, const char *params __UNUSED__) +e_int_config_clientlist(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -35,7 +35,7 @@ e_int_config_clientlist(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Window List Menu Settings"), "E", + cfd = e_config_dialog_new(comp, _("Window List Menu Settings"), "E", "windows/window_list_menu", "preferences-winlist", 0, v, NULL); return cfd; diff --git a/src/modules/conf_window_manipulation/e_int_config_focus.c b/src/modules/conf_window_manipulation/e_int_config_focus.c index 97b6bda31..61cd94c92 100644 --- a/src/modules/conf_window_manipulation/e_int_config_focus.c +++ b/src/modules/conf_window_manipulation/e_int_config_focus.c @@ -35,7 +35,7 @@ struct _E_Config_Dialog_Data /* a nice easy setup function that does the dirty work */ E_Config_Dialog * -e_int_config_focus(E_Container *con, const char *params __UNUSED__) +e_int_config_focus(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -54,7 +54,7 @@ e_int_config_focus(E_Container *con, const char *params __UNUSED__) v->advanced.check_changed = _advanced_check_changed; /* create config diaolg for NULL object/data */ - cfd = e_config_dialog_new(con, _("Focus Settings"), "E", + cfd = e_config_dialog_new(comp, _("Focus Settings"), "E", "windows/window_focus", "preferences-focus", 0, v, NULL); return cfd; @@ -111,7 +111,7 @@ static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { /* Actually take our cfdata settings and apply them in real life */ - e_border_button_bindings_ungrab_all(); + e_comp_button_bindings_ungrab_all(); if (cfdata->mode == E_FOCUS_CLICK) { e_config->focus_policy = E_FOCUS_CLICK; @@ -152,7 +152,7 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) e_config->disable_all_pointer_warps = 0; } e_config->use_auto_raise = cfdata->use_auto_raise; - e_border_button_bindings_grab_all(); + e_comp_button_bindings_grab_all(); e_config_save_queue(); return 1; /* Apply was OK */ } @@ -168,7 +168,7 @@ static int _advanced_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { /* Actually take our cfdata settings and apply them in real life */ - e_border_button_bindings_ungrab_all(); + e_comp_button_bindings_ungrab_all(); e_config->focus_policy = cfdata->focus_policy; e_config->focus_setting = cfdata->focus_setting; e_config->pass_click_on = cfdata->pass_click_on; @@ -186,7 +186,7 @@ _advanced_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) e_config->use_auto_raise = cfdata->use_auto_raise; e_config->auto_raise_delay = cfdata->auto_raise_delay; e_config->border_raise_on_mouse_action = cfdata->border_raise_on_mouse_action; - e_border_button_bindings_grab_all(); + e_comp_button_bindings_grab_all(); e_config_save_queue(); return 1; /* Apply was OK */ } diff --git a/src/modules/conf_window_manipulation/e_int_config_window_display.c b/src/modules/conf_window_manipulation/e_int_config_window_display.c index 6da79be71..b52fccdd7 100644 --- a/src/modules/conf_window_manipulation/e_int_config_window_display.c +++ b/src/modules/conf_window_manipulation/e_int_config_window_display.c @@ -25,7 +25,7 @@ struct _E_Config_Dialog_Data /* a nice easy setup function that does the dirty work */ E_Config_Dialog * -e_int_config_window_display(E_Container *con, const char *params __UNUSED__) +e_int_config_window_display(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -41,7 +41,7 @@ e_int_config_window_display(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; /* create config diaolg for NULL object/data */ - cfd = e_config_dialog_new(con, _("Window Display"), + cfd = e_config_dialog_new(comp, _("Window Display"), "E", "windows/window_display", "preferences-system-windows", 0, v, NULL); return cfd; diff --git a/src/modules/conf_window_manipulation/e_int_config_window_geometry.c b/src/modules/conf_window_manipulation/e_int_config_window_geometry.c index b4ebad98e..2251e09ce 100644 --- a/src/modules/conf_window_manipulation/e_int_config_window_geometry.c +++ b/src/modules/conf_window_manipulation/e_int_config_window_geometry.c @@ -45,7 +45,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_window_geometry(E_Container *con, const char *params __UNUSED__) +e_int_config_window_geometry(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -61,7 +61,7 @@ e_int_config_window_geometry(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; /* create config diaolg for NULL object/data */ - cfd = e_config_dialog_new(con, _("Window Geometry"), + cfd = e_config_dialog_new(comp, _("Window Geometry"), "E", "windows/window_geometry", "preferences-window-geometry", 0, v, NULL); return cfd; diff --git a/src/modules/conf_window_manipulation/e_int_config_window_process.c b/src/modules/conf_window_manipulation/e_int_config_window_process.c index b3eed2190..ccbbac548 100644 --- a/src/modules/conf_window_manipulation/e_int_config_window_process.c +++ b/src/modules/conf_window_manipulation/e_int_config_window_process.c @@ -19,7 +19,7 @@ struct _E_Config_Dialog_Data /* a nice easy setup function that does the dirty work */ E_Config_Dialog * -e_int_config_window_process(E_Container *con, const char *params __UNUSED__) +e_int_config_window_process(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -36,7 +36,7 @@ e_int_config_window_process(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; /* create config diaolg for NULL object/data */ - cfd = e_config_dialog_new(con, _("Window Process Management"), + cfd = e_config_dialog_new(comp, _("Window Process Management"), "E", "windows/window_process", "preferences-window-process", 0, v, NULL); return cfd; diff --git a/src/modules/conf_window_manipulation/e_mod_main.h b/src/modules/conf_window_manipulation/e_mod_main.h index 3a80c3151..3275eb8ce 100644 --- a/src/modules/conf_window_manipulation/e_mod_main.h +++ b/src/modules/conf_window_manipulation/e_mod_main.h @@ -1,14 +1,14 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_window_geometry(E_Container *con, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_window_process(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_window_geometry(E_Comp *comp, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_window_process(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_window_display(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_window_display(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_focus(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_focus(E_Comp *comp, const char *params __UNUSED__); -E_Config_Dialog *e_int_config_clientlist(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_clientlist(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf diff --git a/src/modules/conf_window_remembers/e_int_config_remembers.c b/src/modules/conf_window_remembers/e_int_config_remembers.c index eca507b4d..64a6b27d7 100644 --- a/src/modules/conf_window_remembers/e_int_config_remembers.c +++ b/src/modules/conf_window_remembers/e_int_config_remembers.c @@ -21,7 +21,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_remembers(E_Container *con, const char *params __UNUSED__) +e_int_config_remembers(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -35,7 +35,7 @@ e_int_config_remembers(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Window Remembers"), "E", + cfd = e_config_dialog_new(comp, _("Window Remembers"), "E", "windows/window_remembers", "preferences-desktop-window-remember", 0, v, NULL); return cfd; @@ -306,7 +306,7 @@ _cb_edit(void *data, void *data2 __UNUSED__) E_Config_Dialog *cfd; rem = e_widget_ilist_item_data_get(ili); - cfd = e_int_border_remember_edit(rem); + cfd = e_int_client_remember_edit(rem); e_object_data_set(E_OBJECT(cfd), cfdata); E_OBJECT_DEL_SET(cfd, _cb_edit_del); cfdata->cfds = eina_list_append(cfdata->cfds, cfd); diff --git a/src/modules/conf_window_remembers/e_mod_main.h b/src/modules/conf_window_remembers/e_mod_main.h index 5d04cb1d3..2b9e9e600 100644 --- a/src/modules/conf_window_remembers/e_mod_main.h +++ b/src/modules/conf_window_remembers/e_mod_main.h @@ -1,7 +1,7 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -E_Config_Dialog *e_int_config_remembers(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_remembers(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Conf * @{ diff --git a/src/modules/connman/e_mod_config.c b/src/modules/connman/e_mod_config.c index 35eadf5de..cc5a3c476 100644 --- a/src/modules/connman/e_mod_config.c +++ b/src/modules/connman/e_mod_config.c @@ -48,7 +48,7 @@ _create_data(E_Config_Dialog *dialog) } E_Config_Dialog * -e_connman_config_dialog_new(E_Container *con, +e_connman_config_dialog_new(E_Comp *comp, E_Connman_Module_Context *ctxt) { E_Config_Dialog *dialog; @@ -66,7 +66,7 @@ e_connman_config_dialog_new(E_Container *con, view->basic.apply_cfdata = _basic_apply; dialog = e_config_dialog_new - (con, _("Connection Manager"), + (comp, _("Connection Manager"), _e_connman_Name, "e_connman_config_dialog_new", e_connman_theme_path(), 0, view, ctxt); diff --git a/src/modules/connman/e_mod_main.c b/src/modules/connman/e_mod_main.c index 54aaaa353..31a31a66c 100644 --- a/src/modules/connman/e_mod_main.c +++ b/src/modules/connman/e_mod_main.c @@ -250,6 +250,14 @@ _econnman_popup_del_cb(void *obj) econnman_popup_del(e_object_data_get(obj)); } +static void +_econnman_popup_del(void *data, Evas_Object *obj EINA_UNUSED) +{ + E_Connman_Instance *inst = data; + + E_FREE_FUNC(inst->popup, e_object_del); +} + static void _econnman_popup_new(E_Connman_Instance *inst) { @@ -262,8 +270,8 @@ _econnman_popup_new(E_Connman_Instance *inst) if (!ctxt->cm) return; - inst->popup = e_gadcon_popup_new(inst->gcc); - evas = inst->popup->win->evas; + inst->popup = e_gadcon_popup_new(inst->gcc, 0); + evas = e_comp_get(inst->gcc)->evas; list = e_widget_list_add(evas, 0, 0); inst->ui.popup.list = e_widget_ilist_add(evas, 24, 24, NULL); @@ -285,7 +293,7 @@ _econnman_popup_new(E_Connman_Instance *inst) /* 30,40 % -- min vga, max uvga */ _e_connman_widget_size_set(inst, list, 30, 40, 192, 192, 384, 384); e_gadcon_popup_content_set(inst->popup, list); - e_popup_autoclose(inst->popup->win, NULL, NULL, NULL); + e_comp_object_util_autoclose(inst->popup->comp_object, _econnman_popup_del, NULL, inst); e_gadcon_popup_show(inst->popup); e_object_data_set(E_OBJECT(inst->popup), inst); E_OBJECT_DEL_SET(inst->popup, _econnman_popup_del_cb); @@ -295,6 +303,7 @@ void econnman_popup_del(E_Connman_Instance *inst) { E_FREE_FUNC(inst->popup, e_object_del); + inst->ui.popup.powered = inst->ui.popup.list = NULL; } static void @@ -438,8 +447,6 @@ _econnman_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event) { if (!inst->popup) _econnman_popup_new(inst); - else - econnman_popup_del(inst); } else if (ev->button == 3) _econnman_menu_new(inst, ev); @@ -565,7 +572,7 @@ static const E_Gadcon_Client_Class _gc_class = EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, _e_connman_Name }; static E_Config_Dialog * -_econnman_config(E_Container *con, const char *params) +_econnman_config(E_Comp *comp, const char *params) { E_Connman_Module_Context *ctxt; @@ -577,7 +584,7 @@ _econnman_config(E_Container *con, const char *params) return NULL; if (!ctxt->conf_dialog) - ctxt->conf_dialog = e_connman_config_dialog_new(con, ctxt); + ctxt->conf_dialog = e_connman_config_dialog_new(comp, ctxt); return ctxt->conf_dialog; } diff --git a/src/modules/connman/e_mod_main.h b/src/modules/connman/e_mod_main.h index 2f1338356..2dee8ed21 100644 --- a/src/modules/connman/e_mod_main.h +++ b/src/modules/connman/e_mod_main.h @@ -57,7 +57,7 @@ EAPI int e_modapi_save(E_Module *m); void econnman_popup_del(E_Connman_Instance *inst); const char *e_connman_theme_path(void); -E_Config_Dialog *e_connman_config_dialog_new(E_Container *con, +E_Config_Dialog *e_connman_config_dialog_new(E_Comp *comp, E_Connman_Module_Context *ctxt); E_Connman_Agent *econnman_agent_new(Eldbus_Connection *eldbus_conn) EINA_ARG_NONNULL(1); diff --git a/src/modules/contact/e_edges.c b/src/modules/contact/e_edges.c index 6d906f27c..74e22a42c 100644 --- a/src/modules/contact/e_edges.c +++ b/src/modules/contact/e_edges.c @@ -36,21 +36,17 @@ static Eina_List *handlers = NULL; void e_edges_init(void) { - Eina_List *l, *ll, *lll; - E_Manager *man; - E_Container *con; + const Eina_List *l, *ll; + E_Comp *comp; E_Zone *zone; - EINA_LIST_FOREACH(e_manager_list(), l, man) + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - EINA_LIST_FOREACH(man->containers, ll, con) + EINA_LIST_FOREACH(comp->zones, ll, zone) { - EINA_LIST_FOREACH(con->zones, lll, zone) - { - Edgeset *es = _edgeset_new(zone); - - if (es) edges = eina_list_append(edges, es); - } + Edgeset *es = _edgeset_new(zone); + + if (es) edges = eina_list_append(edges, es); } } } @@ -112,7 +108,7 @@ _handler_call(E_Edges_Event event, int d, double v) static Evas_Object * _input_obj(Edgeset *es, int x, int y, int w, int h) { - E_Comp *c = es->zone->container->manager->comp; + E_Comp *c = e_comp_get(es->zone); Evas_Object *o = evas_object_rectangle_add(c->evas); evas_object_color_set(o, 0, 0, 0, 0); evas_object_move(o, x, y); diff --git a/src/modules/contact/e_mod_main.c b/src/modules/contact/e_mod_main.c index 1e309f4ff..def007e6c 100644 --- a/src/modules/contact/e_mod_main.c +++ b/src/modules/contact/e_mod_main.c @@ -7,28 +7,28 @@ _cb_in_left(void *data __UNUSED__, int d __UNUSED__, double v __UNUSED__) { // show PREV window in list from urrent focused window on top of current // window but in an inital "off to the right" state in comp - Eina_List *borders = (Eina_List *)e_policy_borders_get(); - E_Border *bd_active = (E_Border *)e_polict_border_active_get(); - E_Border *bd = NULL; - Eina_List *bd_active_l = NULL; - if (!bd_active) + Eina_List *clients = (Eina_List *)e_policy_clients_get(); + E_Client *ec_active = (E_Client *)e_policy_client_active_get(); + E_Client *ec = NULL; + Eina_List *ec_active_l = NULL; + if (!ec_active) { - if (!borders) return; - bd = eina_list_last(borders)->data; + if (!clients) return; + ec = eina_list_last(clients)->data; } - if (!bd) + if (!ec) { - if (bd_active) - bd_active_l = eina_list_data_find_list(borders, bd_active); - if ((bd_active_l) && (bd_active_l->prev)) bd = bd_active_l->prev->data; + if (ec_active) + ec_active_l = eina_list_data_find_list(clients, ec_active); + if ((ec_active_l) && (ec_active_l->prev)) ec = ec_active_l->prev->data; } - if ((!bd) && (bd_active)) + if ((!ec) && (ec_active)) { - e_border_iconify(bd_active); + e_client_iconify(ec_active); return; } - if (!bd) return; - e_border_activate(bd, EINA_TRUE); + if (!ec) return; + e_client_activate(ec, EINA_TRUE); } static void @@ -43,28 +43,28 @@ _cb_in_right(void *data __UNUSED__, int d __UNUSED__, double v __UNUSED__) { // show NEXT window in list from urrent focused window on top of current // window but in an inital "off to the right" state in comp - Eina_List *borders = (Eina_List *)e_policy_borders_get(); - E_Border *bd_active = (E_Border *)e_polict_border_active_get(); - E_Border *bd = NULL; - Eina_List *bd_active_l = NULL; - if (!bd_active) + Eina_List *clients = (Eina_List *)e_policy_clients_get(); + E_Client *ec_active = (E_Client *)e_policy_client_active_get(); + E_Client *ec = NULL; + Eina_List *ec_active_l = NULL; + if (!ec_active) { - if (!borders) return; - bd = borders->data; + if (!clients) return; + ec = clients->data; } - if (!bd) + if (!ec) { - if (bd_active) - bd_active_l = eina_list_data_find_list(borders, bd_active); - if ((bd_active_l) && (bd_active_l->next)) bd = bd_active_l->next->data; + if (ec_active) + ec_active_l = eina_list_data_find_list(clients, ec_active); + if ((ec_active_l) && (ec_active_l->next)) ec = ec_active_l->next->data; } - if ((!bd) && (bd_active)) + if ((!ec) && (ec_active)) { - e_border_iconify(bd_active); + e_client_iconify(ec_active); return; } - if (!bd) return; - e_border_activate(bd, EINA_TRUE); + if (!ec) return; + e_client_activate(ec, EINA_TRUE); } static void diff --git a/src/modules/contact/e_policy.c b/src/modules/contact/e_policy.c index f4c40d08a..fd7241607 100644 --- a/src/modules/contact/e_policy.c +++ b/src/modules/contact/e_policy.c @@ -4,191 +4,186 @@ static Eina_Bool _cb_event_add(void *data __UNUSED__, int type __UNUSED__, void static Eina_Bool _cb_event_del(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _cb_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _cb_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); -static void _cb_hook_post_fetch(void *data __UNUSED__, void *data2); -static void _cb_hook_post_assign(void *data __UNUSED__, void *data2); -static void _cb_hook_layout(void *data __UNUSED__, void *data2); +static void _cb_hook_post_fetch(void *data __UNUSED__, E_Client *ec); +static void _cb_hook_post_assign(void *data __UNUSED__, E_Client *ec); +static void _cb_hook_layout(void *data __UNUSED__, E_Comp *comp); static Eina_List *hooks = NULL; static Eina_List *handlers = NULL; static Eina_Bool kbd_on = EINA_FALSE; static Eina_Bool kbd_override = EINA_FALSE; -static Eina_List *borders = NULL; -static E_Border *bd_active = NULL; +static Eina_List *clients = NULL; +static E_Client *ec_active = NULL; #define LADD(l, f) l = eina_list_append(l, f) void e_policy_init(void) { - LADD(hooks, e_border_hook_add(E_BORDER_HOOK_EVAL_POST_FETCH, + LADD(hooks, e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_FETCH, _cb_hook_post_fetch, NULL)); - LADD(hooks, e_border_hook_add(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN, + LADD(hooks, e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, _cb_hook_post_assign, NULL)); - LADD(hooks, e_border_hook_add(E_BORDER_HOOK_CONTAINER_LAYOUT, - _cb_hook_layout, NULL)); - LADD(handlers, ecore_event_handler_add(E_EVENT_BORDER_ADD, + LADD(hooks, e_client_hook_add(E_CLIENT_HOOK_CANVAS_LAYOUT, + (E_Client_Hook_Cb)_cb_hook_layout, NULL)); + LADD(handlers, ecore_event_handler_add(E_EVENT_CLIENT_ADD, _cb_event_add, NULL)); - LADD(handlers, ecore_event_handler_add(E_EVENT_BORDER_REMOVE, + LADD(handlers, ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, _cb_event_del, NULL)); - LADD(handlers, ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN, + LADD(handlers, ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_IN, _cb_event_focus_in, NULL)); - LADD(handlers, ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT, + LADD(handlers, ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_OUT, _cb_event_focus_out, NULL)); } void e_policy_shutdown(void) { - E_Border_Hook *bh; + E_Client_Hook *bh; Ecore_Event_Handler *eh; - EINA_LIST_FREE(hooks, bh) e_border_hook_del(bh); + EINA_LIST_FREE(hooks, bh) e_client_hook_del(bh); EINA_LIST_FREE(handlers, eh) ecore_event_handler_del(eh); } void e_policy_kbd_override_set(Eina_Bool override) { - Eina_List *l; - E_Border *bd, *kbd = NULL;; + const Eina_List *l, *ll; + E_Client *ec, *kbd = NULL;; + E_Comp *comp; if (kbd_override == override) return; kbd_override = override; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) - { - if (bd->client.vkbd.vkbd) - { - kbd = bd; - } - } + EINA_LIST_FOREACH(e_comp_list(), l, comp) + EINA_LIST_FOREACH(comp->clients, ll, ec) + { + if (ec->vkbd.vkbd) + { + kbd = ec; + } + } if (kbd) { - bd = kbd; - e_border_uniconify(bd); - e_border_raise(bd); - e_border_show(bd); + ec = kbd; + e_client_uniconify(ec); + evas_object_raise(ec->frame); + evas_object_show(ec->frame); } } const Eina_List * -e_policy_borders_get(void) +e_policy_clients_get(void) { - return borders; + return clients; } -const E_Border * -e_polict_border_active_get(void) +const E_Client * +e_policy_client_active_get(void) { - return bd_active; + return ec_active; } static Eina_Bool _cb_event_add(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Add *ev = event; - E_Border *bd = ev->border; + E_Event_Client *ev = event; + E_Client *ec = ev->ec; - if (bd_active) borders = eina_list_append_relative(borders, bd, bd_active); - else borders = eina_list_prepend(borders, bd); + if (ec_active) clients = eina_list_append_relative(clients, ec, ec_active); + else clients = eina_list_prepend(clients, ec); return ECORE_CALLBACK_PASS_ON; } static Eina_Bool _cb_event_del(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev = event; - E_Border *bd = ev->border; + E_Event_Client *ev = event; + E_Client *ec = ev->ec; - borders = eina_list_remove(borders, bd); - if (bd_active == bd) bd_active = NULL; + clients = eina_list_remove(clients, ec); + if (ec_active == ec) ec_active = NULL; return ECORE_CALLBACK_PASS_ON; } static Eina_Bool _cb_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_In *ev = event; - E_Border *bd = ev->border; + E_Event_Client *ev = event; + E_Client *ec = ev->ec; - bd_active = bd; + ec_active = ec; return ECORE_CALLBACK_PASS_ON; } static Eina_Bool _cb_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_Out *ev = event; - E_Border *bd = ev->border; + E_Event_Client *ev = event; + E_Client *ec = ev->ec; - if (bd_active == bd) bd_active = NULL; + if (ec_active == ec) ec_active = NULL; if (kbd_on) e_policy_kbd_override_set(EINA_FALSE); return ECORE_CALLBACK_PASS_ON; } static void -_cb_hook_post_fetch(void *data __UNUSED__, void *data2) +_cb_hook_post_fetch(void *data __UNUSED__, E_Client *ec) { - E_Border *bd = data2; + /* NB: for this policy we disable all remembers set on a client */ + if (ec->remember) e_remember_del(ec->remember); + ec->remember = NULL; - if (!bd) return; - /* NB: for this policy we disable all remembers set on a border */ - if (bd->remember) e_remember_del(bd->remember); - bd->remember = NULL; - - /* set this border to borderless */ - bd->borderless = 1; - bd->client.border.changed = 1; + /* set this client to borderless */ + ec->borderless = 1; + EC_CHANGED(ec); } static void -_cb_hook_post_assign(void *data __UNUSED__, void *data2) +_cb_hook_post_assign(void *data __UNUSED__, E_Client *ec) { - E_Border *bd = data2; - - if (!bd) return; - - bd->internal_no_remember = 1; + ec->internal_no_remember = 1; /* do not allow client to change these properties */ - bd->lock_client_size = 1; - bd->lock_client_shade = 1; - bd->lock_client_maximize = 1; - bd->lock_client_location = 1; - bd->lock_client_stacking = 1; + ec->lock_client_size = 1; + ec->lock_client_shade = 1; + ec->lock_client_maximize = 1; + ec->lock_client_location = 1; + ec->lock_client_stacking = 1; /* do not allow the user to change these properties */ - bd->lock_user_location = 1; - bd->lock_user_size = 1; - bd->lock_user_shade = 1; + ec->lock_user_location = 1; + ec->lock_user_size = 1; + ec->lock_user_shade = 1; /* clear any centered states */ /* NB: this is mainly needed for E's main config dialog */ - bd->client.e.state.centered = 0; + ec->e.state.centered = 0; /* lock the border type so user/client cannot change */ - bd->lock_border = 1; + ec->lock_border = 1; } static void -_cb_hook_layout(void *data __UNUSED__, void *data2) +_cb_hook_layout(void *data __UNUSED__, E_Comp *comp) { - E_Container *con = data2; Eina_List *l; - E_Border *bd, *kbd = NULL;; + E_Client *ec, *kbd = NULL;; Eina_Bool want_kbd = EINA_FALSE; Eina_Bool have_focused = EINA_FALSE; int kx = 0, ky = 0, kw = 0, kh = 0; - if (!con) return; + if (!comp) return; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(comp->clients, l, ec) { - if (bd->focused) have_focused = EINA_TRUE; - if ((bd->focused) && - (bd->client.vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)) + if (e_client_util_ignored_get(ec)) continue; + if (ec->focused) have_focused = EINA_TRUE; + if ((ec->focused) && + (ec->vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)) want_kbd = EINA_TRUE; - if (bd->client.vkbd.vkbd) kbd = bd; + if (ec->vkbd.vkbd) kbd = ec; } if ((have_focused) && (kbd_override)) want_kbd = EINA_TRUE; @@ -196,59 +191,60 @@ _cb_hook_layout(void *data __UNUSED__, void *data2) if (kbd) { kw = kbd->zone->w; - kh = kbd->client.icccm.min_h; + kh = kbd->icccm.min_h; kx = kbd->zone->x; ky = kbd->zone->y + kbd->zone->h - kh; } - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(comp->clients, l, ec) { int x, y, w, h; - if (!bd->zone) continue; + if (!ec->zone) continue; + if (e_client_util_ignored_get(ec)) continue; - w = bd->zone->w; - h = bd->zone->h; - x = bd->zone->x; - y = bd->zone->y; + w = ec->zone->w; + h = ec->zone->h; + x = ec->zone->x; + y = ec->zone->y; - if (bd->client.vkbd.vkbd) + if (ec->vkbd.vkbd) { x = kx; y = ky; w = kw; h = kh; if (want_kbd) { - e_border_uniconify(bd); - e_border_raise(bd); - e_border_show(bd); + e_client_uniconify(ec); + evas_object_raise(ec->frame); + evas_object_show(ec->frame); } else { - e_border_iconify(bd); + e_client_iconify(ec); } } - else if (((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG) || - (bd->client.icccm.transient_for != 0)) && - ((bd->client.icccm.min_w == bd->client.icccm.max_w) && - (bd->client.icccm.min_h == bd->client.icccm.max_h))) + else if (((ec->netwm.type == E_WINDOW_TYPE_DIALOG) || + (ec->icccm.transient_for != 0)) && + ((ec->icccm.min_w == ec->icccm.max_w) && + (ec->icccm.min_h == ec->icccm.max_h))) { // center dialog at min size - w = bd->client.icccm.min_w; - h = bd->client.icccm.min_h; - if (w > (bd->zone->w)) w = bd->zone->w; - if (h > (bd->zone->h - kh)) h = (bd->zone->h - kh); - x = bd->zone->x + ((bd->zone->w - w) / 2); - y = bd->zone->y + ((bd->zone->h - kh - h) / 2); + w = ec->icccm.min_w; + h = ec->icccm.min_h; + if (w > (ec->zone->w)) w = ec->zone->w; + if (h > (ec->zone->h - kh)) h = (ec->zone->h - kh); + x = ec->zone->x + ((ec->zone->w - w) / 2); + y = ec->zone->y + ((ec->zone->h - kh - h) / 2); } else { - if (bd->client.illume.conformant.conformant) + if (ec->illume.conformant.conformant) { if (kbd_on != want_kbd) { if (want_kbd) - ecore_x_e_illume_keyboard_geometry_set(bd->client.win, + ecore_x_e_illume_keyboard_geometry_set(e_client_util_win_get(ec), kx, ky, kw, kh); else - ecore_x_e_illume_keyboard_geometry_set(bd->client.win, + ecore_x_e_illume_keyboard_geometry_set(e_client_util_win_get(ec), 0, 0, 0, 0); } } @@ -257,31 +253,30 @@ _cb_hook_layout(void *data __UNUSED__, void *data2) // just make all windows fill the zone... if (want_kbd) { - w = bd->zone->w; - h = bd->zone->h - kh; - x = bd->zone->x; - y = bd->zone->y; + w = ec->zone->w; + h = ec->zone->h - kh; + x = ec->zone->x; + y = ec->zone->y; } } } // implement the positioning/sizing - if ((bd->x != x) || (bd->y != y)) + if ((ec->x != x) || (ec->y != y)) { - bd->placed = 1; - bd->x = x; - bd->y = y; - bd->changes.pos = 1; - bd->changed = 1; + ec->placed = 1; + ec->x = x; + ec->y = y; + ec->changes.pos = 1; + EC_CHANGED(ec); } - if ((bd->w != w) || (bd->h != h)) + if ((ec->w != w) || (ec->h != h)) { - bd->w = w; - bd->h = h; - bd->client.w = (bd->w - (bd->client_inset.l + bd->client_inset.r)); - bd->client.h = (bd->h - (bd->client_inset.t + bd->client_inset.b)); - bd->changes.size = 1; - bd->changed = 1; + ec->w = w; + ec->h = h; + e_comp_object_frame_wh_unadjust(ec->frame, ec->w, ec->h, &ec->client.w, &ec->client.h); + ec->changes.size = 1; + EC_CHANGED(ec); } } diff --git a/src/modules/contact/e_policy.h b/src/modules/contact/e_policy.h index 6c98fca2a..9f8a8ed3c 100644 --- a/src/modules/contact/e_policy.h +++ b/src/modules/contact/e_policy.h @@ -4,7 +4,7 @@ void e_policy_init(void); void e_policy_shutdown(void); void e_policy_kbd_override_set(Eina_Bool override); -const Eina_List *e_policy_borders_get(void); -const E_Border *e_polict_border_active_get(void); +const Eina_List *e_policy_clients_get(void); +const E_Client *e_policy_client_active_get(void); #endif diff --git a/src/modules/cpufreq/e_mod_config.c b/src/modules/cpufreq/e_mod_config.c index a6ac0ca62..4564e5b84 100644 --- a/src/modules/cpufreq/e_mod_config.c +++ b/src/modules/cpufreq/e_mod_config.c @@ -20,7 +20,7 @@ static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); E_Config_Dialog * -e_int_config_cpufreq_module(E_Container *con, const char *params __UNUSED__) +e_int_config_cpufreq_module(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -35,7 +35,7 @@ e_int_config_cpufreq_module(E_Container *con, const char *params __UNUSED__) snprintf(buf, sizeof(buf), "%s/e-module-cpufreq.edj", e_module_dir_get(cpufreq_config->module)); - cfd = e_config_dialog_new(con, _("Cpu Frequency Control Settings"), + cfd = e_config_dialog_new(comp, _("Cpu Frequency Control Settings"), "E", "_e_mod_cpufreq_config_dialog", buf, 0, v, NULL); cpufreq_config->config_dialog = cfd; diff --git a/src/modules/cpufreq/e_mod_main.c b/src/modules/cpufreq/e_mod_main.c index 7183cb3f1..10a5b1d78 100644 --- a/src/modules/cpufreq/e_mod_main.c +++ b/src/modules/cpufreq/e_mod_main.c @@ -164,7 +164,7 @@ _cpufreq_cb_menu_configure(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __U { if (!cpufreq_config) return; if (cpufreq_config->config_dialog) return; - e_int_config_cpufreq_module(m->zone->container, NULL); + e_int_config_cpufreq_module(m->zone->comp, NULL); } static void @@ -498,10 +498,8 @@ _cpufreq_set_governor(const char *governor) if (ret != 0) { E_Dialog *dia; - E_Container *con; - con = e_container_current_get(e_manager_current_get()); - if (!(dia = e_dialog_new(con, "E", "_e_mod_cpufreq_error_setfreq"))) + if (!(dia = e_dialog_new(NULL, "E", "_e_mod_cpufreq_error_setfreq"))) return; e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); e_dialog_icon_set(dia, "enlightenment", 64); @@ -526,10 +524,8 @@ _cpufreq_set_frequency(int frequency) if (!cpufreq_config->status->can_set_frequency) { E_Dialog *dia; - E_Container *con; - con = e_container_current_get(e_manager_current_get()); - if (!(dia = e_dialog_new(con, "E", "_e_mod_cpufreq_error_setfreq"))) + if (!(dia = e_dialog_new(NULL, "E", "_e_mod_cpufreq_error_setfreq"))) return; e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); e_dialog_icon_set(dia, "enlightenment", 64); @@ -554,10 +550,8 @@ _cpufreq_set_frequency(int frequency) if (ret != 0) { E_Dialog *dia; - E_Container *con; - con = e_container_current_get(e_manager_current_get()); - if (!(dia = e_dialog_new(con, "E", "_e_mod_cpufreq_error_setfreq"))) + if (!(dia = e_dialog_new(NULL, "E", "_e_mod_cpufreq_error_setfreq"))) return; e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); e_dialog_icon_set(dia, "enlightenment", 64); @@ -582,10 +576,8 @@ _cpufreq_set_pstate(int min, int max, int turbo) if (ret != 0) { E_Dialog *dia; - E_Container *con; - con = e_container_current_get(e_manager_current_get()); - if (!(dia = e_dialog_new(con, "E", "_e_mod_cpufreq_error_setfreq"))) + if (!(dia = e_dialog_new(NULL, "E", "_e_mod_cpufreq_error_setfreq"))) return; e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); e_dialog_icon_set(dia, "enlightenment", 64); diff --git a/src/modules/cpufreq/e_mod_main.h b/src/modules/cpufreq/e_mod_main.h index 5879cb805..c701f6b5f 100644 --- a/src/modules/cpufreq/e_mod_main.h +++ b/src/modules/cpufreq/e_mod_main.h @@ -60,7 +60,7 @@ EAPI void *e_modapi_init (E_Module *m); EAPI int e_modapi_shutdown (E_Module *m); EAPI int e_modapi_save (E_Module *m); -E_Config_Dialog *e_int_config_cpufreq_module(E_Container *con, const char *params); +E_Config_Dialog *e_int_config_cpufreq_module(E_Comp *comp, const char *params); void _cpufreq_poll_interval_update(void); void _cpufreq_set_governor(const char *governor); void _cpufreq_set_pstate(int min, int max, int turbo); diff --git a/src/modules/everything/e_mod_main.c b/src/modules/everything/e_mod_main.c index b41f5e551..1ad490a61 100644 --- a/src/modules/everything/e_mod_main.c +++ b/src/modules/everything/e_mod_main.c @@ -549,10 +549,10 @@ _e_mod_action_cb(E_Object *obj, const char *params) { if (obj->type == E_MANAGER_TYPE) zone = e_util_zone_current_get((E_Manager *)obj); - else if (obj->type == E_CONTAINER_TYPE) - zone = e_util_zone_current_get(((E_Container *)obj)->manager); + else if (obj->type == E_COMP_TYPE) + zone = e_zone_current_get((E_Comp *)obj); else if (obj->type == E_ZONE_TYPE) - zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager); + zone = e_zone_current_get(((E_Zone *)obj)->comp); else zone = e_util_zone_current_get(e_manager_current_get()); } diff --git a/src/modules/everything/e_mod_main.h b/src/modules/everything/e_mod_main.h index d05811569..ed1788144 100644 --- a/src/modules/everything/e_mod_main.h +++ b/src/modules/everything/e_mod_main.h @@ -355,8 +355,8 @@ extern E_Module *_mod_evry; EAPI void *e_modapi_init (E_Module *m); EAPI int e_modapi_shutdown (E_Module *m); EAPI int e_modapi_save (E_Module *m); -EAPI E_Config_Dialog *evry_config_dialog(E_Container *con, const char *params); -EAPI E_Config_Dialog *evry_collection_conf_dialog(E_Container *con, const char *params); +EAPI E_Config_Dialog *evry_config_dialog(E_Comp *comp, const char *params); +EAPI E_Config_Dialog *evry_collection_conf_dialog(E_Comp *comp, const char *params); EAPI extern E_Module_Api e_modapi; /* #define CHECK_REFS 1 diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 4dae6eff7..caaf311b1 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -185,7 +185,8 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup) ecore_evas_name_class_set(win->ewin->ecore_evas, "E", "everything"); e_win_show(win->ewin); - win->ewin->border->client.netwm.state.skip_taskbar = win->ewin->border->changed = 1; + win->ewin->client->netwm.state.skip_taskbar = 1; + EC_CHANGED(win->ewin->client); win->grab = 1; } @@ -278,6 +279,7 @@ evry_hide(Evry_Window *win, int clear) if (!win) return; + e_win_delete_callback_set(win->ewin, NULL); e_win_hide(win->ewin); _evry_state_clear(win); @@ -331,8 +333,11 @@ evry_hide(Evry_Window *win, int clear) win->visible = EINA_FALSE; - for (i = 0; win->sel_list[i]; i++) - _evry_selector_free(win->sel_list[i]); + if (win->sel_list) + { + for (i = 0; win->sel_list[i]; i++) + _evry_selector_free(win->sel_list[i]); + } E_FREE(win->sel_list); @@ -758,7 +763,7 @@ _evry_window_new(E_Zone *zone, E_Zone_Edge edge) int offset_s = 0; win = E_NEW(Evry_Window, 1); - win->ewin = e_win_new(zone->container); + win->ewin = e_win_new(zone->comp); e_win_borderless_set(win->ewin, 1); e_win_no_remember_set(win->ewin, 1); e_win_placed_set(win->ewin, 1); @@ -933,7 +938,7 @@ _evry_cb_mouse(void *data, int type, void *event) memcpy(sel + sel_length + s_len, "\r\n", 2); sel_length += s_len + 2; - d = e_drag_new(e_container_current_get(e_manager_current_get()), + d = e_drag_new(e_util_comp_current_get()), ev->x, ev->y, drag_types, 1, sel, sel_length, NULL, _evry_cb_drag_finished); @@ -956,7 +961,8 @@ _evry_cb_mouse(void *data, int type, void *event) { win->mouse_out = 0; - if (!E_INSIDE(ev->x, ev->y, 0, 0, w->w, w->h)) + if (!E_INSIDE(e_comp_canvas_x_root_adjust(w->comp, ev->root.x), + e_comp_canvas_y_root_adjust(w->comp, ev->root.y), w->x, w->y, w->w, w->h)) { win->mouse_out = 1; return ECORE_CALLBACK_PASS_ON; @@ -969,7 +975,8 @@ _evry_cb_mouse(void *data, int type, void *event) win->mouse_button = 0; if (win->mouse_out && - !E_INSIDE(ev->x, ev->y, 0, 0, w->w, w->h)) + (!E_INSIDE(e_comp_canvas_x_root_adjust(w->comp, ev->root.x), + e_comp_canvas_y_root_adjust(w->comp, ev->root.y), w->x, w->y, w->w, w->h))) { evry_hide(win, 0); return ECORE_CALLBACK_PASS_ON; @@ -1913,14 +1920,14 @@ _evry_cb_key_down(void *data, int type __UNUSED__, void *event) E_Win *ewin = win->ewin; e_grabinput_release(ewin->evas_win, ewin->evas_win); - e_border_layer_set(ewin->border, E_LAYER_NORMAL); + evas_object_layer_set(ewin->client->frame, E_LAYER_CLIENT_NORMAL); ecore_x_netwm_window_type_set(ewin->evas_win, ECORE_X_WINDOW_TYPE_DIALOG); - ewin->border->client.netwm.fetch.type = 1; - ewin->border->client.netwm.state.skip_taskbar = 0; - ewin->border->changed = 1; - ewin->border->client.netwm.update.state = 1; - ewin->border->internal_no_remember = 1; + EC_CHANGED(ewin->client); + ewin->client->netwm.fetch.type = 1; + ewin->client->netwm.state.skip_taskbar = 0; + ewin->client->netwm.update.state = 1; + ewin->client->internal_no_remember = 1; e_win_borderless_set(ewin, 0); win->grab = 0; diff --git a/src/modules/everything/evry_api.h b/src/modules/everything/evry_api.h index 1b83e00c4..27997f9ab 100644 --- a/src/modules/everything/evry_api.h +++ b/src/modules/everything/evry_api.h @@ -33,7 +33,7 @@ #define EVRY_TYPE_APP 3 #define EVRY_TYPE_ACTION 4 #define EVRY_TYPE_PLUGIN 5 -#define EVRY_TYPE_BORDER 6 +#define EVRY_TYPE_CLIENT 6 #define EVRY_TYPE_TEXT 7 #define NUM_EVRY_TYPES 8 diff --git a/src/modules/everything/evry_config.c b/src/modules/everything/evry_config.c index 04f20126d..b71cc33d9 100644 --- a/src/modules/everything/evry_config.c +++ b/src/modules/everything/evry_config.c @@ -60,7 +60,7 @@ struct _E_Config_Dialog_Data }; EAPI E_Config_Dialog * -evry_config_dialog(E_Container *con, const char *params __UNUSED__) +evry_config_dialog(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -74,7 +74,7 @@ evry_config_dialog(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create_widgets; v->advanced.apply_cfdata = NULL; v->advanced.create_widgets = NULL; - cfd = e_config_dialog_new(con, + cfd = e_config_dialog_new(comp, _("Everything Settings"), "E", "extensions/run_everything", "system-run", 0, v, NULL); @@ -349,9 +349,7 @@ _plugin_config_cb(void *data, void *data2 __UNUSED__) if (!p) return; printf(" %s\n", p->name); - e_configure_registry_call(p->config_path, - e_container_current_get(e_manager_current_get()), - p->name); + e_configure_registry_call(p->config_path, NULL, p->name); } static Evas_Object * @@ -607,7 +605,7 @@ static Evas_Object *_cat_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, static int _cat_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); EAPI E_Config_Dialog * -evry_collection_conf_dialog(E_Container *con, const char *params) +evry_collection_conf_dialog(E_Comp *comp, const char *params) { E_Config_Dialog *cfd = NULL; E_Config_Dialog_View *v = NULL; @@ -630,7 +628,7 @@ evry_collection_conf_dialog(E_Container *con, const char *params) snprintf(title, sizeof(title), "%s: %s", _("Everything Collection"), p->name); - cfd = e_config_dialog_new(con, title, p->config_path, p->config_path, + cfd = e_config_dialog_new(comp, title, p->config_path, p->config_path, EVRY_ITEM(p)->icon, 0, v, p); /* FIXME free dialogs on shutdown diff --git a/src/modules/everything/evry_gadget.c b/src/modules/everything/evry_gadget.c index 5ff75ca06..450eb0bb7 100644 --- a/src/modules/everything/evry_gadget.c +++ b/src/modules/everything/evry_gadget.c @@ -114,7 +114,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) inst->illume_mode = EINA_TRUE; inst->handlers = eina_list_append(inst->handlers, - ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT, + ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_OUT, _cb_focus_out, inst)); } @@ -237,8 +237,8 @@ _hide_done(void *data, Evas_Object *obj EINA_UNUSED, const char *s EINA_UNUSED, evry_selectors_switch(inst->win, -1, 0); evry_selectors_switch(inst->win, -1, 0); - e_border_iconify(inst->win->ewin->border); - e_comp_win_effect_set(inst->win->ewin->border->cw, "none"); + e_client_iconify(inst->win->ewin->client); + e_comp_object_effect_set(inst->win->ewin->client->frame, "none"); inst->animating = 0; } @@ -247,22 +247,22 @@ _evry_hide_func(Evry_Window *win, int finished __UNUSED__) { Instance *inst = win->data; - e_comp_win_effect_set(inst->win->ewin->border->cw, "pane"); + e_comp_object_effect_set(inst->win->ewin->client->frame, "pane"); /* set geoms */ - e_comp_win_effect_params_set(inst->win->ewin->border->cw, 1, + e_comp_object_effect_params_set(inst->win->ewin->client->frame, 1, (int[]){inst->win->ewin->x, inst->win->ewin->y, inst->win->ewin->w, inst->win->ewin->h, - inst->win->ewin->border->zone->w, inst->win->ewin->border->zone->h, + inst->win->ewin->client->zone->w, inst->win->ewin->client->zone->h, inst->hide_x, inst->hide_y}, 8); - e_comp_win_effect_params_set(inst->win->ewin->border->cw, 0, (int[]){0}, 1); - e_comp_win_effect_start(inst->win->ewin->border->cw, _hide_done, inst); + e_comp_object_effect_params_set(inst->win->ewin->client->frame, 0, (int[]){0}, 1); + e_comp_object_effect_start(inst->win->ewin->client->frame, _hide_done, inst); inst->hidden = inst->animating = EINA_TRUE; } static Eina_Bool _cb_focus_out(void *data, int type __UNUSED__, void *event) { - E_Event_Border_Focus_Out *ev; + E_Event_Client *ev; Instance *inst; ev = event; @@ -273,7 +273,7 @@ _cb_focus_out(void *data, int type __UNUSED__, void *event) if ((!inst) || (!inst->win)) return ECORE_CALLBACK_PASS_ON; - if (inst->win->ewin->border != ev->border) + if (inst->win->ewin->client != ev->ec) return ECORE_CALLBACK_PASS_ON; _evry_hide_func(inst->win, 0); @@ -410,10 +410,10 @@ _gadget_window_show(Instance *inst) e_win_resize(ewin, pw, ph); e_win_show(ewin); - e_border_focus_set(ewin->border, 1, 1); - ewin->border->client.netwm.state.skip_pager = 1; - ewin->border->client.netwm.state.skip_taskbar = 1; - ewin->border->sticky = 1; + evas_object_focus_set(ewin->client->frame, 1); + ewin->client->netwm.state.skip_pager = 1; + ewin->client->netwm.state.skip_taskbar = 1; + ewin->client->sticky = 1; inst->hidden = EINA_FALSE; } @@ -434,21 +434,21 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_ if (ev->button == 1) { Evry_Window *win; - E_Border *bd; + E_Client *ec; if (inst->win) { win = inst->win; - bd = win->ewin->border; + ec = win->ewin->client; - if (inst->hidden || !bd->focused) + if (inst->hidden || !ec->focused) { if (inst->animating) - e_comp_win_effect_stop(bd->cw, NULL); - e_comp_win_effect_set(bd->cw, "none"); - e_border_uniconify(bd); - e_border_raise(bd); - e_border_focus_set(bd, 1, 1); + e_comp_object_effect_stop(ec->frame, NULL); + e_comp_object_effect_set(ec->frame, "none"); + e_client_uniconify(ec); + evas_object_raise(ec->frame); + evas_object_focus_set(ec->frame, 1); inst->hidden = EINA_FALSE; return; } @@ -546,7 +546,6 @@ static void _conf_dialog(Instance *inst) { E_Config_Dialog_View *v = NULL; - E_Container *con; if (inst->cfd) return; @@ -562,8 +561,7 @@ _conf_dialog(Instance *inst) v->basic.create_widgets = _basic_create; v->basic.apply_cfdata = _basic_apply; - con = e_container_current_get(e_manager_current_get()); - inst->cfd = e_config_dialog_new(con, _("Everything Gadgets"), "everything-gadgets", + inst->cfd = e_config_dialog_new(NULL, _("Everything Gadgets"), "everything-gadgets", "launcher/everything-gadgets", NULL, 0, v, inst); /* _conf->cfd = cfd; */ @@ -602,7 +600,7 @@ _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) static void _cb_button_settings(void *data __UNUSED__, void *data2 __UNUSED__) { - /* evry_collection_conf_dialog(e_container_current_get(e_manager_current_get()), "Start"); */ + /* evry_collection_conf_dialog(e_util_comp_current_get()), "Start"); */ } static void diff --git a/src/modules/everything/evry_plug_apps.c b/src/modules/everything/evry_plug_apps.c index 06b0f1017..b37241ed9 100644 --- a/src/modules/everything/evry_plug_apps.c +++ b/src/modules/everything/evry_plug_apps.c @@ -932,7 +932,7 @@ _edit_app_action(Evry_Action *act) desktop->exec = strdup(app->file); } - e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop); + e_desktop_edit(NULL, desktop); return 1; } @@ -1009,7 +1009,7 @@ _new_app_action(Evry_Action *act) desktop->mime_types = eina_list_clone(app->desktop->mime_types); } if (desktop) - e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop); + e_desktop_edit(NULL, desktop); return 1; } @@ -1284,7 +1284,7 @@ static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dia static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static E_Config_Dialog * -_conf_dialog(E_Container *con, const char *params __UNUSED__) +_conf_dialog(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd = NULL; E_Config_Dialog_View *v = NULL; @@ -1299,7 +1299,7 @@ _conf_dialog(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.apply_cfdata = _basic_apply; - cfd = e_config_dialog_new(con, _("Everything Applications"), "everything-apps", + cfd = e_config_dialog_new(comp, _("Everything Applications"), "everything-apps", "launcher/everything-apps", _module_icon, 0, v, NULL); _conf->cfd = cfd; diff --git a/src/modules/everything/evry_plug_files.c b/src/modules/everything/evry_plug_files.c index d8ea5d2da..310320285 100644 --- a/src/modules/everything/evry_plug_files.c +++ b/src/modules/everything/evry_plug_files.c @@ -1439,7 +1439,7 @@ static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dia static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static E_Config_Dialog * -_conf_dialog(E_Container *con, const char *params __UNUSED__) +_conf_dialog(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd = NULL; E_Config_Dialog_View *v = NULL; @@ -1454,7 +1454,7 @@ _conf_dialog(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.apply_cfdata = _basic_apply; - cfd = e_config_dialog_new(con, _("Everything Files"), "everything-files", + cfd = e_config_dialog_new(comp, _("Everything Files"), "everything-files", "extensions/everything-files", _module_icon, 0, v, NULL); _conf->cfd = cfd; diff --git a/src/modules/everything/evry_plug_settings.c b/src/modules/everything/evry_plug_settings.c index af1e7b258..2b48977c0 100644 --- a/src/modules/everything/evry_plug_settings.c +++ b/src/modules/everything/evry_plug_settings.c @@ -165,7 +165,7 @@ _action(Evry_Action *action) snprintf(buf, sizeof(buf), "%s/%s", it->ecat->cat, it->eci->item); - e_configure_registry_call(buf, e_container_current_get(e_manager_current_get()), NULL); + e_configure_registry_call(buf, NULL, NULL); return EVRY_ACTION_FINISHED; } diff --git a/src/modules/everything/evry_plug_windows.c b/src/modules/everything/evry_plug_windows.c index 4ff937a5f..43d321d1b 100644 --- a/src/modules/everything/evry_plug_windows.c +++ b/src/modules/everything/evry_plug_windows.c @@ -8,12 +8,12 @@ #define BORDER_CLOSE 5 typedef struct _Plugin Plugin; -typedef struct _Border_Item Border_Item; +typedef struct _Border_Item Client_Item; struct _Plugin { Evry_Plugin base; - Eina_List *borders; + Eina_List *clients; Eina_List *handlers; const char *input; }; @@ -21,7 +21,7 @@ struct _Plugin struct _Border_Item { Evry_Item base; - E_Border *border; + E_Client *client; }; static const Evry_API *evry = NULL; @@ -33,41 +33,43 @@ static Evas_Object *_icon_get(Evry_Item *it, Evas *e); /***************************************************************************/ -#define GET_BORDER(_bd, _it) Border_Item * _bd = (Border_Item *)_it; +#define GET_BORDER(_bd, _it) Client_Item * _bd = (Client_Item *)_it; static void -_border_item_free(Evry_Item *it) +_client_item_free(Evry_Item *it) { GET_BORDER(bi, it); - e_object_unref(E_OBJECT(bi->border)); + e_object_unref(E_OBJECT(bi->client)); E_FREE(bi); } static int -_border_item_add(Plugin *p, E_Border *bd) +_client_item_add(Plugin *p, E_Client *ec) { - Border_Item *bi; + Client_Item *bi; char buf[1024]; - if (bd->client.netwm.state.skip_taskbar) + if (ec->netwm.state.skip_taskbar) return 0; - if (bd->client.netwm.state.skip_pager) + if (ec->netwm.state.skip_pager) + return 0; + if (e_client_util_ignored_get(ec)) return 0; - bi = EVRY_ITEM_NEW(Border_Item, p, e_border_name_get(bd), - _icon_get, _border_item_free); + bi = EVRY_ITEM_NEW(Client_Item, p, e_client_name_get(ec), + _icon_get, _client_item_free); snprintf(buf, sizeof(buf), "%d:%d %s", - bd->desk->x, bd->desk->y, - (bd->desktop ? bd->desktop->name : "")); + ec->desk->x, ec->desk->y, + (ec->desktop ? ec->desktop->name : "")); EVRY_ITEM_DETAIL_SET(bi, buf); - bi->border = bd; - e_object_ref(E_OBJECT(bd)); + bi->client = ec; + e_object_ref(E_OBJECT(ec)); - p->borders = eina_list_append(p->borders, bi); + p->clients = eina_list_append(p->clients, bi); return 1; } @@ -75,23 +77,23 @@ _border_item_add(Plugin *p, E_Border *bd) static Eina_Bool _cb_border_remove(void *data, __UNUSED__ int type, void *event) { - E_Event_Border_Remove *ev = event; - Border_Item *bi; + E_Event_Client *ev = event; + Client_Item *bi; Eina_List *l; Plugin *p = data; - EINA_LIST_FOREACH (p->borders, l, bi) - if (bi->border == ev->border) + EINA_LIST_FOREACH(p->clients, l, bi) + if (bi->client == ev->ec) break; if (!bi) return ECORE_CALLBACK_PASS_ON; EVRY_PLUGIN_ITEMS_CLEAR(p); - p->borders = eina_list_remove(p->borders, bi); + p->clients = eina_list_remove(p->clients, bi); EVRY_ITEM_FREE(bi); - EVRY_PLUGIN_ITEMS_ADD(p, p->borders, p->input, 1, 0); + EVRY_PLUGIN_ITEMS_ADD(p, p->clients, p->input, 1, 0); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); @@ -99,17 +101,18 @@ _cb_border_remove(void *data, __UNUSED__ int type, void *event) } static Eina_Bool -_cb_border_add(void *data, __UNUSED__ int type, void *event) +_cb_client_add(void *data, __UNUSED__ int type, void *event) { - E_Event_Border_Add *ev = event; + E_Event_Client *ev = event; Plugin *p = data; - if (!_border_item_add(p, ev->border)) + if (e_client_util_ignored_get(ev->ec)) return ECORE_CALLBACK_RENEW; + if (!_client_item_add(p, ev->ec)) return ECORE_CALLBACK_PASS_ON; EVRY_PLUGIN_ITEMS_CLEAR(p); - EVRY_PLUGIN_ITEMS_ADD(p, p->borders, p->input, 1, 0); + EVRY_PLUGIN_ITEMS_ADD(p, p->clients, p->input, 1, 0); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); @@ -120,21 +123,21 @@ static Evry_Plugin * _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__) { Plugin *p; - E_Border *bd; + E_Client *ec; Eina_List *l; EVRY_PLUGIN_INSTANCE(p, plugin); p->handlers = eina_list_append (p->handlers, ecore_event_handler_add - (E_EVENT_BORDER_REMOVE, _cb_border_remove, p)); + (E_EVENT_CLIENT_REMOVE, _cb_border_remove, p)); p->handlers = eina_list_append (p->handlers, ecore_event_handler_add - (E_EVENT_BORDER_ADD, _cb_border_add, p)); + (E_EVENT_CLIENT_ADD, _cb_client_add, p)); - EINA_LIST_FOREACH (e_border_focus_stack_get(), l, bd) - _border_item_add(p, bd); + EINA_LIST_FOREACH (e_client_focus_stack_get(), l, ec) + _client_item_add(p, ec); return EVRY_PLUGIN(p); } @@ -143,7 +146,7 @@ static void _finish(Evry_Plugin *plugin) { Ecore_Event_Handler *h; - Border_Item *bi; + Client_Item *bi; GET_PLUGIN(p, plugin); @@ -151,7 +154,7 @@ _finish(Evry_Plugin *plugin) EVRY_PLUGIN_ITEMS_CLEAR(p); - EINA_LIST_FREE (p->borders, bi) + EINA_LIST_FREE (p->clients, bi) EVRY_ITEM_FREE(bi); EINA_LIST_FREE (p->handlers, h) @@ -174,7 +177,7 @@ _fetch(Evry_Plugin *plugin, const char *input) if (input) p->input = eina_stringshare_add(input); - return EVRY_PLUGIN_ITEMS_ADD(p, p->borders, input, 1, 0); + return EVRY_PLUGIN_ITEMS_ADD(p, p->clients, input, 1, 0); } return 0; @@ -186,87 +189,87 @@ _icon_get(Evry_Item *it, Evas *e) GET_BORDER(bi, it); Evas_Object *o = NULL; - E_Border *bd = bi->border; + E_Client *ec = bi->client; - if (bd->internal) + if (ec->internal) { - if (!bd->internal_icon) + if (!ec->internal_icon) { o = e_icon_add(e); e_util_icon_theme_set(o, "enlightenment"); } - else if (!bd->internal_icon_key) + else if (!ec->internal_icon_key) { char *ext; - ext = strrchr(bd->internal_icon, '.'); + ext = strrchr(ec->internal_icon, '.'); if ((ext) && ((!strcmp(ext, ".edj")))) { o = edje_object_add(e); - if (!edje_object_file_set(o, bd->internal_icon, "icon")) + if (!edje_object_file_set(o, ec->internal_icon, "icon")) e_util_icon_theme_set(o, "enlightenment"); } else if (ext) { o = e_icon_add(e); - e_icon_file_set(o, bd->internal_icon); + e_icon_file_set(o, ec->internal_icon); } else { o = e_icon_add(e); e_icon_scale_size_set(o, 128); - if (!e_util_icon_theme_set(o, bd->internal_icon)) + if (!e_util_icon_theme_set(o, ec->internal_icon)) e_util_icon_theme_set(o, "enlightenment"); } } else { o = edje_object_add(e); - edje_object_file_set(o, bd->internal_icon, bd->internal_icon_key); + edje_object_file_set(o, ec->internal_icon, ec->internal_icon_key); } return o; } - if (bd->client.netwm.icons) + if (ec->netwm.icons) { if (e_config->use_app_icon) goto _use_netwm_icon; - if (bd->remember && (bd->remember->prop.icon_preference == E_ICON_PREF_NETWM)) + if (ec->remember && (ec->remember->prop.icon_preference == E_ICON_PREF_NETWM)) goto _use_netwm_icon; } - if (bd->desktop) + if (ec->desktop) { - o = e_util_desktop_icon_add(bd->desktop, 128, e); + o = e_util_desktop_icon_add(ec->desktop, 128, e); if (o) return o; } _use_netwm_icon: - if (bd->client.netwm.icons) + if (ec->netwm.icons) { int i, size, tmp, found = 0; o = e_icon_add(e); - size = bd->client.netwm.icons[0].width; + size = ec->netwm.icons[0].width; - for (i = 1; i < bd->client.netwm.num_icons; i++) + for (i = 1; i < ec->netwm.num_icons; i++) { - if ((tmp = bd->client.netwm.icons[i].width) > size) + if ((tmp = ec->netwm.icons[i].width) > size) { size = tmp; found = i; } } - e_icon_data_set(o, bd->client.netwm.icons[found].data, - bd->client.netwm.icons[found].width, - bd->client.netwm.icons[found].height); + e_icon_data_set(o, ec->netwm.icons[found].data, + ec->netwm.icons[found].width, + ec->netwm.icons[found].height); e_icon_alpha_set(o, 1); return o; } - o = e_border_icon_add(bd, e); + o = e_client_icon_add(ec, e); if (o) return o; o = edje_object_add(e); @@ -283,39 +286,39 @@ _check_border(Evry_Action *act, const Evry_Item *it) GET_BORDER(bi, it); int action = EVRY_ITEM_DATA_INT_GET(act); - E_Border *bd = bi->border; + E_Client *ec = bi->client; E_Zone *zone = e_util_zone_current_get(e_manager_current_get()); - if (!bd) + if (!ec) { - ERR("no border"); + ERR("no client"); return 0; } switch (action) { case BORDER_CLOSE: - if (bd->lock_close) + if (ec->lock_close) return 0; break; case BORDER_SHOW: - if (bd->lock_focus_in) + if (ec->lock_focus_in) return 0; break; case BORDER_HIDE: - if (bd->lock_user_iconify) + if (ec->lock_user_iconify) return 0; break; case BORDER_FULLSCREEN: - if (!bd->lock_user_fullscreen) + if (!ec->lock_user_fullscreen) return 0; break; case BORDER_TODESK: - if (bd->desk == (e_desk_current_get(zone))) + if (ec->desk == (e_desk_current_get(zone))) return 0; break; } @@ -329,42 +332,42 @@ _act_border(Evry_Action *act) GET_BORDER(bi, act->it1.item); int action = EVRY_ITEM_DATA_INT_GET(act); - E_Border *bd = bi->border; + E_Client *ec = bi->client; E_Zone *zone = e_util_zone_current_get(e_manager_current_get()); int focus = 0; - if (!bd) + if (!ec) { - ERR("no border"); + ERR("no client"); return 0; } switch (action) { case BORDER_CLOSE: - e_border_act_close_begin(bd); + e_client_act_close_begin(ec); break; case BORDER_SHOW: - if (bd->desk != (e_desk_current_get(zone))) - e_desk_show(bd->desk); + if (ec->desk != (e_desk_current_get(zone))) + e_desk_show(ec->desk); focus = 1; break; case BORDER_HIDE: - e_border_iconify(bd); + e_client_iconify(ec); break; case BORDER_FULLSCREEN: - if (!bd->fullscreen) - e_border_fullscreen(bd, E_FULLSCREEN_RESIZE); + if (!ec->fullscreen) + e_client_fullscreen(ec, E_FULLSCREEN_RESIZE); else - e_border_unfullscreen(bd); + e_client_unfullscreen(ec); break; case BORDER_TODESK: - if (bd->desk != (e_desk_current_get(zone))) - e_border_desk_set(bd, e_desk_current_get(zone)); + if (ec->desk != (e_desk_current_get(zone))) + e_client_desk_set(ec, e_desk_current_get(zone)); focus = 1; break; @@ -374,39 +377,39 @@ _act_border(Evry_Action *act) if (focus) { - if (bd->shaded) - e_border_unshade(bd, bd->shade.dir); + if (ec->shaded) + e_client_unshade(ec, ec->shade_dir); - if (bd->iconic) - e_border_uniconify(bd); + if (ec->iconic) + e_client_uniconify(ec); else - e_border_raise(bd); + evas_object_raise(ec->frame); - if (!bd->lock_focus_out) + if (!ec->lock_focus_out) { - e_border_focus_set(bd, 1, 1); - e_border_focus_latest_set(bd); + evas_object_focus_set(ec->frame, 1); + e_client_focus_latest_set(ec); } if ((e_config->focus_policy != E_FOCUS_CLICK) || (e_config->winlist_warp_at_end) || (e_config->winlist_warp_while_selecting)) { - int 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 - 1)) - warp_to_x = (bd->zone->x + bd->zone->w + bd->x) / 2; + int 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 - 1)) + warp_to_x = (ec->zone->x + ec->zone->w + ec->x) / 2; - int 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 - 1)) - warp_to_y = (bd->zone->y + bd->zone->h + bd->y) / 2; + int 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 - 1)) + warp_to_y = (ec->zone->y + ec->zone->h + ec->y) / 2; - ecore_x_pointer_warp(bd->zone->container->win, warp_to_x, warp_to_y); + ecore_x_pointer_warp(ec->zone->comp->win, warp_to_x, warp_to_y); } - /* e_border_focus_set_with_pointer(bd); */ + /* e_client_focus_set_with_pointer(ec); */ } return 1; @@ -423,12 +426,12 @@ _plugins_init(const Evry_API *_api) return EINA_FALSE; _plug = EVRY_PLUGIN_BASE(N_("Windows"), "preferences-system-windows", - EVRY_TYPE_BORDER, _begin, _finish, _fetch); + EVRY_TYPE_CLIENT, _begin, _finish, _fetch); _plug->transient = EINA_TRUE; evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 2); act = EVRY_ACTION_NEW(N_("Switch to Window"), - EVRY_TYPE_BORDER, 0, "go-next", + EVRY_TYPE_CLIENT, 0, "go-next", _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_SHOW); evry->action_register(act, 1); @@ -436,28 +439,28 @@ _plugins_init(const Evry_API *_api) _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW(N_("Iconify"), - EVRY_TYPE_BORDER, 0, "go-down", + EVRY_TYPE_CLIENT, 0, "go-down", _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_HIDE); _actions = eina_list_append(_actions, act); evry->action_register(act, 2); act = EVRY_ACTION_NEW(N_("Toggle Fullscreen"), - EVRY_TYPE_BORDER, 0, "view-fullscreen", + EVRY_TYPE_CLIENT, 0, "view-fullscreen", _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_FULLSCREEN); _actions = eina_list_append(_actions, act); evry->action_register(act, 4); act = EVRY_ACTION_NEW(N_("Close"), - EVRY_TYPE_BORDER, 0, "list-remove", + EVRY_TYPE_CLIENT, 0, "list-remove", _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_CLOSE); _actions = eina_list_append(_actions, act); evry->action_register(act, 3); act = EVRY_ACTION_NEW(N_("Send to Desktop"), - EVRY_TYPE_BORDER, 0, "go-previous", + EVRY_TYPE_CLIENT, 0, "go-previous", _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_TODESK); _actions = eina_list_append(_actions, act); diff --git a/src/modules/fileman/e_fwin.c b/src/modules/fileman/e_fwin.c index ca7bf1651..fe4beae98 100644 --- a/src/modules/fileman/e_fwin.c +++ b/src/modules/fileman/e_fwin.c @@ -44,7 +44,7 @@ struct _E_Fwin Ecore_Job *popup_del_job; Eina_List *popup_handlers; E_Fm2_Icon_Info *popup_icon; - E_Popup *popup; + Evas_Object *popup; Ecore_Timer *spring_timer; Ecore_Timer *spring_close_timer; @@ -104,7 +104,7 @@ static void _e_fwin_page_favorites_add(E_Fwin_Page *page); static void _e_fwin_icon_mouse_out(void *data, Evas_Object *obj __UNUSED__, void *event_info); static void _e_fwin_icon_mouse_in(void *data, Evas_Object *obj __UNUSED__, void *event_info); static E_Fwin *_e_fwin_open(E_Fwin_Page *page, E_Fm2_Icon_Info *ici, Eina_Bool force, int *need_dia); -static E_Fwin *_e_fwin_new(E_Container *con, +static E_Fwin *_e_fwin_new(E_Comp *comp, const char *dev, const char *path); static void _e_fwin_free(E_Fwin *fwin); @@ -229,16 +229,31 @@ static void _e_fwin_op_registry_abort_cb(void *data, static E_Fwin *drag_fwin = NULL; +static E_Client_Hook *focus_out_hook = NULL; + /* local subsystem globals */ static Eina_List *fwins = NULL; static E_Fm2_Mime_Handler *dir_handler = NULL; static Efreet_Desktop *tdesktop = NULL; static Eina_Stringshare *fwin_class = NULL; +static void +_e_fwin_client_hook_focus_unset(void *d EINA_UNUSED, E_Client *ec) +{ + E_Fwin *fwin; + + /* if there is no new focused, set focus to zone fwin */ + if (e_client_focused_get()) return; + fwin = e_fwin_zone_find(ec->zone); + if (fwin) + evas_object_focus_set(fwin->cur_page->fm_obj, 1); +} + /* externally accessible functions */ int e_fwin_init(void) { + focus_out_hook = e_client_hook_add(E_CLIENT_HOOK_FOCUS_UNSET, _e_fwin_client_hook_focus_unset, NULL); fwin_class = eina_stringshare_add("e_fwin"); tdesktop = e_util_terminal_desktop_get(); if (!tdesktop) return 1; @@ -276,11 +291,11 @@ e_fwin_shutdown(void) * "fwin" window */ void -e_fwin_new(E_Container *con, +e_fwin_new(E_Comp *comp, const char *dev, const char *path) { - _e_fwin_new(con, dev, path); + _e_fwin_new(comp, dev, path); } static Eina_Bool @@ -434,7 +449,7 @@ e_fwin_zone_new(E_Zone *zone, void *p) fwins = eina_list_append(fwins, fwin); - o = e_fm2_add(zone->container->bg_evas); + o = e_fm2_add(zone->comp->evas); evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _e_fwin_zone_shutdown, fwin); page->fm_obj = o; _e_fwin_config_set(page); @@ -462,9 +477,10 @@ e_fwin_zone_new(E_Zone *zone, void *p) evas_object_smart_callback_add(o, "icon_mouse_out", (Evas_Smart_Cb)_e_fwin_icon_mouse_out, fwin); e_fm2_icon_menu_start_extend_callback_set(o, _e_fwin_cb_menu_extend_start, page); e_fm2_underlay_hide(o); + evas_object_focus_set(o, !e_client_focused_get()); evas_object_show(o); - o = e_scrollframe_add(zone->container->bg_evas); + o = e_scrollframe_add(zone->comp->evas); e_scrollframe_custom_theme_set(o, "base/theme/fileman", "e/fileman/desktop/scrollframe"); /* FIXME: this theme object will have more versions and options later @@ -496,13 +512,12 @@ e_fwin_zone_new(E_Zone *zone, void *p) evas_object_move(o, x, y); evas_object_resize(o, w, h); evas_object_show(o); - E_LAYER_SET_UNDER(o, E_COMP_CANVAS_LAYER_DESKTOP); + evas_object_layer_set(o, E_LAYER_DESKTOP); + evas_object_lower(o); page->scrollframe_obj = page->scr = o; e_fm2_window_object_set(page->fm_obj, E_OBJECT(fwin->zone)); - evas_object_focus_set(page->fm_obj, 1); - e_fm2_path_set(page->fm_obj, path->dev, path->path); fwin->cur_page = page; @@ -544,9 +559,8 @@ _e_fwin_cb_toolbar_del(void *obj) void e_fwin_reload_all(void) { - Eina_List *l, *ll, *lll; - E_Container *con; - E_Manager *man; + const Eina_List *l, *ll; + E_Comp *comp; E_Fwin *fwin; E_Zone *zone; @@ -607,25 +621,24 @@ e_fwin_reload_all(void) } /* Hook into zones */ - EINA_LIST_FOREACH(e_manager_list(), l, man) - EINA_LIST_FOREACH(man->containers, ll, con) - EINA_LIST_FOREACH(con->zones, lll, zone) - { - if (e_fwin_zone_find(zone)) continue; - if (e_config->show_desktop_icons) - e_fwin_zone_new(zone, e_mod_fileman_path_find(zone)); - } + EINA_LIST_FOREACH(e_comp_list(), l, comp) + EINA_LIST_FOREACH(comp->zones, ll, zone) + { + if (e_fwin_zone_find(zone)) continue; + if (e_config->show_desktop_icons) + e_fwin_zone_new(zone, e_mod_fileman_path_find(zone)); + } } -int +void * e_fwin_zone_find(E_Zone *zone) { Eina_List *f; E_Fwin *win; EINA_LIST_FOREACH(fwins, f, win) - if (win->zone == zone) return 1; - return 0; + if (win->zone == zone) return win; + return NULL; } /* local subsystem functions */ @@ -634,10 +647,10 @@ _e_fwin_bg_mouse_down(E_Fwin *fwin, Evas_Object *obj __UNUSED__, void *event __U { int x, y, w, h, zx, zy, zw, zh, cx, cy, cw, ch; - if (fwin->win->border->maximized) e_border_unmaximize(fwin->win->border, fwin->win->border->maximized); - if (fwin->win->border->fullscreen) e_border_unfullscreen(fwin->win->border); - e_zone_useful_geometry_get(fwin->win->border->zone, &zx, &zy, &zw, &zh); - x = fwin->win->border->x, y = fwin->win->border->y; + if (fwin->win->client->maximized) e_client_unmaximize(fwin->win->client, fwin->win->client->maximized); + if (fwin->win->client->fullscreen) e_client_unfullscreen(fwin->win->client); + e_zone_useful_geometry_get(fwin->win->client->zone, &zx, &zy, &zw, &zh); + x = fwin->win->client->x, y = fwin->win->client->y; if (!e_fm2_optimal_size_calc(fwin->cur_page->fm_obj, zw - x, zh - y, &w, &h)) return; evas_object_geometry_get(fwin->cur_page->fm_obj, &cx, &cy, &cw, &ch); if (x + w > zx + zw) @@ -650,7 +663,7 @@ _e_fwin_bg_mouse_down(E_Fwin *fwin, Evas_Object *obj __UNUSED__, void *event __U } static E_Fwin * -_e_fwin_new(E_Container *con, +_e_fwin_new(E_Comp *comp, const char *dev, const char *path) { @@ -661,7 +674,7 @@ _e_fwin_new(E_Container *con, fwin = E_OBJECT_ALLOC(E_Fwin, E_FWIN_TYPE, _e_fwin_free); if (!fwin) return NULL; - fwin->win = e_win_new(con); + fwin->win = e_win_new(comp); if (!fwin->win) { free(fwin); @@ -719,8 +732,8 @@ _e_fwin_new(E_Container *con, e_win_show(fwin->win); if (fwin->win->evas_win) e_drop_xdnd_register_set(fwin->win->evas_win, 1); - if (fwin->win->border) - eina_stringshare_replace(&fwin->win->border->internal_icon, + if (fwin->win->client) + eina_stringshare_replace(&fwin->win->client->internal_icon, "system-file-manager"); return fwin; @@ -756,7 +769,7 @@ _e_fwin_free(E_Fwin *fwin) fwin->fad = NULL; } if (fwin->popup_del_job) ecore_job_del(fwin->popup_del_job); - if (fwin->popup) e_object_del(E_OBJECT(fwin->popup)); + if (fwin->popup) evas_object_del(fwin->popup); if (fwin->popup_timer) ecore_timer_del(fwin->popup_timer); fwin->popup_timer = NULL; E_FREE_LIST(fwin->popup_handlers, ecore_event_handler_del); @@ -774,19 +787,19 @@ _e_fwin_icon_popup_handler(void *data, int type, void *event) E_Fwin *fwin = data; Ecore_Event_Mouse_IO *ev = event; - if (type == ECORE_X_EVENT_MOUSE_IN) + if (type == ECORE_EVENT_MOUSE_IN) { if (fwin->zone) { - if (ev->event_window == fwin->zone->container->event_win) return ECORE_CALLBACK_RENEW; + if (ev->event_window == fwin->zone->comp->ee_win) return ECORE_CALLBACK_RENEW; } else { - if (ev->event_window == fwin->win->border->client.win) return ECORE_CALLBACK_RENEW; + if (ev->event_window == e_client_util_win_get(fwin->win->client)) return ECORE_CALLBACK_RENEW; } } if (fwin->popup_timer) ecore_timer_del(fwin->popup_timer); - if (fwin->popup) e_object_del(E_OBJECT(fwin->popup)); + if (fwin->popup) evas_object_del(fwin->popup); E_FREE_LIST(fwin->popup_handlers, ecore_event_handler_del); fwin->popup_icon = NULL; fwin->popup_timer = NULL; @@ -807,23 +820,19 @@ _e_fwin_icon_popup(void *data) if (!fwin->popup_icon) return EINA_FALSE; snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(fwin->cur_page->fm_obj), fwin->popup_icon->file); if (!ecore_file_can_read(buf)) return EINA_FALSE; - if (fwin->popup) e_object_del(E_OBJECT(fwin->popup)); - zone = fwin->zone ?: fwin->win->border->zone; + if (fwin->popup) + { + evas_object_hide(fwin->popup); + evas_object_del(fwin->popup); + } + zone = fwin->zone ?: fwin->win->client->zone; e_fm2_icon_geometry_get(fwin->popup_icon->ic, &x, &y, &w, &h); if (fwin->zone) - { - evas_object_geometry_get(fwin->popup_icon->fm, &fx, &fy, NULL, NULL); - fx -= fwin->zone->x; - x -= fwin->zone->x; - fy -= fwin->zone->y; - y -= fwin->zone->y; - } + evas_object_geometry_get(fwin->popup_icon->fm, &fx, &fy, NULL, NULL); else - fx = fwin->win->border->x, fy = fwin->win->border->y; - fwin->popup = e_popup_new(eina_list_data_get(zone->container->zones), 0, 0, 1, 1); - e_popup_ignore_events_set(fwin->popup, 1); + fx = fwin->win->client->x, fy = fwin->win->client->y; - bg = edje_object_add(fwin->popup->evas); + bg = edje_object_add(e_comp_get(zone)->evas); e_theme_edje_object_set(bg, "base/theme/fileman", "e/fileman/popup/default"); mw = zone->w * fileman_config->tooltip.size / 100.0; @@ -833,9 +842,9 @@ _e_fwin_icon_popup(void *data) fwin->popup_icon->label ? fwin->popup_icon->label : fwin->popup_icon->file); - list = e_widget_list_add(fwin->popup->evas, 0, 0); + list = e_widget_list_add(e_comp_get(zone)->evas, 0, 0); - o = e_widget_filepreview_add(fwin->popup->evas, mw, mh, 0); + o = e_widget_filepreview_add(e_comp_get(zone)->evas, mw, mh, 0); e_widget_filepreview_path_set(o, buf, fwin->popup_icon->mime); e_widget_list_object_append(list, o, 1, 0, 0.5); e_widget_size_min_get(list, &mw, &mh); @@ -843,7 +852,6 @@ _e_fwin_icon_popup(void *data) edje_object_part_swallow(bg, "e.swallow.content", list); edje_object_size_min_calc(bg, &mw, &mh); - e_popup_object_add(fwin->popup, list); /* prefer tooltip left of icon */ px = (fx + x) - mw - 3; @@ -864,8 +872,12 @@ _e_fwin_icon_popup(void *data) py = (y + h / 2) - (mh / 2); /* give up */ if (py < 0) py = 0; - e_popup_move_resize(fwin->popup, px, py, mw, mh); - e_popup_content_set(fwin->popup, bg); + fwin->popup = e_comp_object_util_add(bg, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(fwin->popup, E_LAYER_POPUP); + evas_object_geometry_set(fwin->popup, px, py, mw, mh); + e_comp_object_util_del_list_append(fwin->popup, list); + e_comp_object_util_del_list_append(fwin->popup, o); + evas_object_pass_events_set(fwin->popup, 1); if (!fwin->popup_handlers) { E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_X_EVENT_XDND_ENTER, _e_fwin_icon_popup_handler, fwin); @@ -874,14 +886,15 @@ _e_fwin_icon_popup(void *data) E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_fwin_icon_popup_handler, fwin); E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_X_EVENT_MOUSE_OUT, _e_fwin_icon_popup_handler, fwin); } - e_popup_show(fwin->popup); + evas_object_show(fwin->popup); return EINA_FALSE; } static void _e_fwin_icon_popup_del(E_Fwin *fwin) { - E_FREE_FUNC(fwin->popup, e_object_del); + evas_object_hide(fwin->popup); + E_FREE_FUNC(fwin->popup, evas_object_del); fwin->popup_del_job = NULL; } @@ -1313,7 +1326,7 @@ _e_fwin_desktop_run(Efreet_Desktop *desktop, } if ((fwin->win) && (desktop)) { - e_exec(fwin->win->border->zone, desktop, NULL, files, "fwin"); + e_exec(fwin->win->client->zone, desktop, NULL, files, "fwin"); ici = selected->data; if ((ici) && (ici->mime) && (desktop) && !(skip_history)) e_exehist_mime_desktop_add(ici->mime, desktop); @@ -1415,7 +1428,7 @@ _e_fwin_file_exec(E_Fwin_Page *page, case E_FWIN_EXEC_DIRECT: snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(fwin->cur_page->fm_obj), ici->file); if (fwin->win) - e_exec(fwin->win->border->zone, NULL, buf, NULL, "fwin"); + e_exec(fwin->win->client->zone, NULL, buf, NULL, "fwin"); else if (fwin->zone) e_exec(fwin->zone, NULL, buf, NULL, "fwin"); break; @@ -1423,7 +1436,7 @@ _e_fwin_file_exec(E_Fwin_Page *page, case E_FWIN_EXEC_SH: snprintf(buf, sizeof(buf), "/bin/sh %s", e_util_filename_escape(ici->file)); if (fwin->win) - e_exec(fwin->win->border->zone, NULL, buf, NULL, "fwin"); + e_exec(fwin->win->client->zone, NULL, buf, NULL, "fwin"); else if (fwin->zone) e_exec(fwin->zone, NULL, buf, NULL, "fwin"); break; @@ -1431,7 +1444,7 @@ _e_fwin_file_exec(E_Fwin_Page *page, case E_FWIN_EXEC_TERMINAL_DIRECT: snprintf(buf, sizeof(buf), "%s %s", e_config->exebuf_term_cmd, e_util_filename_escape(ici->file)); if (fwin->win) - e_exec(fwin->win->border->zone, NULL, buf, NULL, "fwin"); + e_exec(fwin->win->client->zone, NULL, buf, NULL, "fwin"); else if (fwin->zone) e_exec(fwin->zone, NULL, buf, NULL, "fwin"); break; @@ -1439,7 +1452,7 @@ _e_fwin_file_exec(E_Fwin_Page *page, case E_FWIN_EXEC_TERMINAL_SH: snprintf(buf, sizeof(buf), "%s /bin/sh %s", e_config->exebuf_term_cmd, e_util_filename_escape(ici->file)); if (fwin->win) - e_exec(fwin->win->border->zone, NULL, buf, NULL, "fwin"); + e_exec(fwin->win->client->zone, NULL, buf, NULL, "fwin"); else if (fwin->zone) e_exec(fwin->zone, NULL, buf, NULL, "fwin"); break; @@ -1450,7 +1463,7 @@ _e_fwin_file_exec(E_Fwin_Page *page, if (desktop) { if (fwin->win) - e_exec(fwin->win->border->zone, desktop, NULL, NULL, "fwin"); + e_exec(fwin->win->client->zone, desktop, NULL, NULL, "fwin"); else if (fwin->zone) e_exec(fwin->zone, desktop, NULL, NULL, "fwin"); e_exehist_mime_desktop_add(ici->mime, desktop); @@ -1645,7 +1658,7 @@ _e_fwin_cb_resize(E_Win *win) } _e_fwin_toolbar_resize(fwin->cur_page); if (fwin->zone) - e_comp_win_resize(evas_object_data_get(fwin->cur_page->scrollframe_obj, "comp_win"), fwin->zone->w, fwin->zone->h); + evas_object_resize(fwin->cur_page->scrollframe_obj, fwin->zone->w, fwin->zone->h); /* _e_fwin_geom_save(fwin); */ } @@ -1891,12 +1904,12 @@ _e_fwin_cb_key_down(void *data, { if (!strcmp(ev->key, "n")) { - E_Container *con; + E_Comp *comp; const char *dev, *path; - con = e_container_current_get(e_manager_current_get()); + comp = e_util_comp_current_get(); e_fm2_path_get(page->fm_obj, &dev, &path); - e_fwin_new(con, dev, path); + e_fwin_new(comp, dev, path); return; } if (!strcmp(ev->key, "w")) @@ -1954,7 +1967,6 @@ _e_fwin_zone_move_resize(void *data, int type __UNUSED__, void *event) { E_Event_Zone_Move_Resize *ev = event; E_Fwin *fwin = data; - E_Comp_Win *cw; int x, y, w, h, sx, sy, sw, sh; if (!fwin) return ECORE_CALLBACK_PASS_ON; @@ -1964,8 +1976,7 @@ _e_fwin_zone_move_resize(void *data, int type __UNUSED__, void *event) evas_object_geometry_get(fwin->cur_page->scrollframe_obj, &sx, &sy, &sw, &sh); /* if same, do nothing */ if ((sx == x) && (sy == y) && (sw == w) && (sh == h)) return ECORE_CALLBACK_RENEW; - cw = evas_object_data_get(fwin->cur_page->scrollframe_obj, "comp_win"); - e_comp_win_moveresize(cw, x, y, w, h); + evas_object_geometry_set(fwin->cur_page->scrollframe_obj, x, y, w, h); e_fm2_refresh(fwin->cur_page->fm_obj); return ECORE_CALLBACK_RENEW; } @@ -2092,9 +2103,9 @@ _e_fwin_path(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) path = e_fm2_real_path_get(data); page = evas_object_data_get(data, "fm_page"); if (page->fwin->win) - xwin = page->fwin->win->border->client.win; + xwin = e_client_util_win_get(page->fwin->win->client); else - xwin = page->fwin->zone->container->event_win; + xwin = page->fwin->zone->comp->ee_win; ecore_x_selection_clipboard_set(xwin, path, strlen(path) + 1); } @@ -2107,7 +2118,7 @@ _e_fwin_clone(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) /* path of least resistance! */ act_fm = e_action_find("fileman"); if (!act_fm) return; - act_fm->func.go(NULL, fwin->win->border->client.icccm.class + 8); + act_fm->func.go(NULL, fwin->win->client->icccm.class + 8); } static void @@ -2243,28 +2254,28 @@ _e_fwin_border_set(E_Fwin_Page *page, E_Fwin *fwin, E_Fm2_Icon_Info *ici) ici->ic, NULL, NULL, 0, &itype); if (!oic) return; - eina_stringshare_replace(&fwin->win->border->internal_icon, NULL); - eina_stringshare_replace(&fwin->win->border->internal_icon_key, NULL); + eina_stringshare_replace(&fwin->win->client->internal_icon, NULL); + eina_stringshare_replace(&fwin->win->client->internal_icon_key, NULL); if (!strcmp(evas_object_type_get(oic), "edje")) { edje_object_file_get(oic, &file, &group); - fwin->win->border->internal_icon = eina_stringshare_ref(file); - fwin->win->border->internal_icon_key = eina_stringshare_ref(group); + fwin->win->client->internal_icon = eina_stringshare_ref(file); + fwin->win->client->internal_icon_key = eina_stringshare_ref(group); } else { e_icon_file_get(oic, &file, &group); - fwin->win->border->internal_icon = eina_stringshare_ref(file); - fwin->win->border->internal_icon_key = eina_stringshare_ref(group); + fwin->win->client->internal_icon = eina_stringshare_ref(file); + fwin->win->client->internal_icon_key = eina_stringshare_ref(group); } evas_object_del(oic); - if (fwin->win->border->placed) return; + if (fwin->win->client->placed) return; if (e_config->remember_internal_fm_windows_globally) class = fwin_class; else class = eina_stringshare_printf("e_fwin::%s", e_fm2_real_path_get(fwin->cur_page->fm_obj)); - e_zone_useful_geometry_get(fwin->win->border->zone, + e_zone_useful_geometry_get(fwin->win->client->zone, NULL, NULL, &zw, &zh); EINA_LIST_FOREACH(e_config->remembers, ll, rem) if (rem->class == class) @@ -2303,13 +2314,13 @@ _e_fwin_border_set(E_Fwin_Page *page, E_Fwin *fwin, E_Fm2_Icon_Info *ici) h = zh; /* iff going out of zone - adjust to be in */ - if ((fwin->win->border->zone->x + fwin->win->border->zone->w) < (w + nx)) + if ((fwin->win->client->zone->x + fwin->win->client->zone->w) < (w + nx)) nx -= w; - if ((fwin->win->border->zone->y + fwin->win->border->zone->h) < (h + ny)) + if ((fwin->win->client->zone->y + fwin->win->client->zone->h) < (h + ny)) ny -= h; e_win_move_resize(fwin->win, nx, ny, w, h); - fwin->win->border->placed = 1; + fwin->win->client->placed = 1; } static E_Fwin * @@ -2326,9 +2337,9 @@ _e_fwin_open(E_Fwin_Page *page, E_Fm2_Icon_Info *ici, Eina_Bool force, int *need if (new_fwin) { if (page->fwin->win) - fwin = _e_fwin_new(page->fwin->win->container, ici->link, "/"); + fwin = _e_fwin_new(page->fwin->win->comp, ici->link, "/"); else if (page->fwin->zone) - fwin = _e_fwin_new(page->fwin->zone->container, ici->link, "/"); + fwin = _e_fwin_new(page->fwin->zone->comp, ici->link, "/"); } else { @@ -2343,9 +2354,9 @@ _e_fwin_open(E_Fwin_Page *page, E_Fm2_Icon_Info *ici, Eina_Bool force, int *need if (new_fwin) { if (page->fwin->win) - fwin = _e_fwin_new(page->fwin->win->container, buf, "/"); + fwin = _e_fwin_new(page->fwin->win->comp, buf, "/"); else if (page->fwin->zone) - fwin = _e_fwin_new(page->fwin->zone->container, buf, "/"); + fwin = _e_fwin_new(page->fwin->zone->comp, buf, "/"); } else { @@ -2361,9 +2372,9 @@ _e_fwin_open(E_Fwin_Page *page, E_Fm2_Icon_Info *ici, Eina_Bool force, int *need if (new_fwin) { if (page->fwin->win) - fwin = _e_fwin_new(page->fwin->win->container, NULL, ici->real_link); + fwin = _e_fwin_new(page->fwin->win->comp, NULL, ici->real_link); else if (page->fwin->zone) - fwin = _e_fwin_new(page->fwin->zone->container, NULL, ici->real_link); + fwin = _e_fwin_new(page->fwin->zone->comp, NULL, ici->real_link); } else { @@ -2385,9 +2396,9 @@ _e_fwin_open(E_Fwin_Page *page, E_Fm2_Icon_Info *ici, Eina_Bool force, int *need if (new_fwin) { if (page->fwin->win) - fwin = _e_fwin_new(page->fwin->win->container, NULL, ici->link ?: buf); + fwin = _e_fwin_new(page->fwin->win->comp, NULL, ici->link ?: buf); else if (page->fwin->zone) - fwin = _e_fwin_new(page->fwin->zone->container, NULL, ici->link ?: buf); + fwin = _e_fwin_new(page->fwin->zone->comp, NULL, ici->link ?: buf); } else { @@ -2402,7 +2413,7 @@ _e_fwin_open(E_Fwin_Page *page, E_Fm2_Icon_Info *ici, Eina_Bool force, int *need } } if (!fwin) return NULL; - if ((!fwin->win) || (!fwin->win->border)) + if ((!fwin->win) || (!fwin->win->client)) { _e_fwin_free(fwin); return NULL; @@ -2503,7 +2514,7 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page, { if (fwin->win) { - if (e_exec(fwin->win->border->zone, desk, NULL, files_list, "fwin")) + if (e_exec(fwin->win->client->zone, desk, NULL, files_list, "fwin")) need_dia = 0; } else if (fwin->zone) @@ -2531,10 +2542,10 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page, } if (fwin->win) - dia = e_dialog_new(fwin->win->border->zone->container, + dia = e_dialog_new(fwin->win->comp, "E", "_fwin_open_apps"); else if (fwin->zone) - dia = e_dialog_new(fwin->zone->container, + dia = e_dialog_new(fwin->zone->comp, "E", "_fwin_open_apps"); else return; /* make clang happy */ diff --git a/src/modules/fileman/e_fwin_nav.c b/src/modules/fileman/e_fwin_nav.c index fffcd1980..898c95cb6 100644 --- a/src/modules/fileman/e_fwin_nav.c +++ b/src/modules/fileman/e_fwin_nav.c @@ -514,7 +514,7 @@ _cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void m = e_menu_new(); m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0); - ecore_x_pointer_xy_get(zone->container->win, &x, &y); + ecore_x_pointer_xy_get(zone->comp->win, &x, &y); e_menu_activate_mouse(m, zone, x, y, 1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp); evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, diff --git a/src/modules/fileman/e_int_config_mime.c b/src/modules/fileman/e_int_config_mime.c index a552f5259..f992cb342 100644 --- a/src/modules/fileman/e_int_config_mime.c +++ b/src/modules/fileman/e_int_config_mime.c @@ -45,7 +45,7 @@ static void _cb_config(void *data, void *data2); Eina_List *types = NULL; E_Config_Dialog * -e_int_config_mime(E_Container *con, const char *params __UNUSED__) +e_int_config_mime(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -57,7 +57,7 @@ e_int_config_mime(E_Container *con, const char *params __UNUSED__) v->free_cfdata = _free_data; v->basic.create_widgets = _basic_create; - cfd = e_config_dialog_new(con, _("File Icons"), "E", "fileman/file_icons", + cfd = e_config_dialog_new(comp, _("File Icons"), "E", "fileman/file_icons", "preferences-file-icons", 0, v, NULL); return cfd; } diff --git a/src/modules/fileman/e_int_config_mime_edit.c b/src/modules/fileman/e_int_config_mime_edit.c index 63f98500d..24b876dc6 100644 --- a/src/modules/fileman/e_int_config_mime_edit.c +++ b/src/modules/fileman/e_int_config_mime_edit.c @@ -49,7 +49,6 @@ e_int_config_mime_edit(E_Config_Mime_Icon *data, void *data2) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; - E_Container *con; E_Config_Dialog_Data *cfdata; if (e_config_dialog_find("E", "fileman/mime_edit_dialog")) return NULL; @@ -57,7 +56,6 @@ e_int_config_mime_edit(E_Config_Mime_Icon *data, void *data2) cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata->data = data; cfdata->data2 = data2; - con = e_container_current_get(e_manager_current_get()); v = E_NEW(E_Config_Dialog_View, 1); v->create_cfdata = _create_data; @@ -66,7 +64,7 @@ e_int_config_mime_edit(E_Config_Mime_Icon *data, void *data2) v->basic.check_changed = _basic_check; v->basic.apply_cfdata = _basic_apply; - cfd = e_config_dialog_new(con, _("File Icon"), "E", + cfd = e_config_dialog_new(NULL, _("File Icon"), "E", "fileman/mime_edit_dialog", "preferences-file-icons", 0, v, cfdata); return cfd; @@ -293,7 +291,7 @@ _cb_icon_sel(void *data, void *data2) cfd = data2; if (!cfd) return; - dia = e_dialog_new(cfd->con, "E", "_mime_icon_select_dialog"); + dia = e_dialog_new(cfd->comp, "E", "_mime_icon_select_dialog"); if (!dia) return; if (cfdata->type == EDJ) e_dialog_title_set(dia, _("Select an Edje file")); diff --git a/src/modules/fileman/e_mod_config.c b/src/modules/fileman/e_mod_config.c index bce0193c8..6ec2c71a5 100644 --- a/src/modules/fileman/e_mod_config.c +++ b/src/modules/fileman/e_mod_config.c @@ -105,8 +105,7 @@ static Evas_Object *_basic_create(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); E_Config_Dialog * -e_int_config_fileman(E_Container *con, - const char *params __UNUSED__) +e_int_config_fileman(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -119,7 +118,7 @@ e_int_config_fileman(E_Container *con, v->basic.create_widgets = _basic_create; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("File Manager Settings"), "E", + cfd = e_config_dialog_new(comp, _("File Manager Settings"), "E", "fileman/fileman", "system-file-manager", 0, v, NULL); return cfd; diff --git a/src/modules/fileman/e_mod_dbus.c b/src/modules/fileman/e_mod_dbus.c index 28ad61ca5..f9f79f90c 100644 --- a/src/modules/fileman/e_mod_dbus.c +++ b/src/modules/fileman/e_mod_dbus.c @@ -120,7 +120,7 @@ _e_fileman_dbus_daemon_open_directory_cb(const Eldbus_Service_Interface *iface _ directory = "/"; } - e_fwin_new(zone->container, dev, directory); + e_fwin_new(zone->comp, dev, directory); free(dev); free(to_free); return eldbus_message_method_return_new(msg); diff --git a/src/modules/fileman/e_mod_main.c b/src/modules/fileman/e_mod_main.c index ecb96ec4e..2ade38014 100644 --- a/src/modules/fileman/e_mod_main.c +++ b/src/modules/fileman/e_mod_main.c @@ -30,9 +30,8 @@ EAPI E_Module_Api e_modapi = EAPI void * e_modapi_init(E_Module *m) { - Eina_List *l, *ll, *lll; - E_Manager *man; - E_Container *con; + const Eina_List *l, *ll; + E_Comp *comp; E_Zone *zone; conf_module = m; @@ -66,21 +65,13 @@ e_modapi_init(E_Module *m) e_fwin_init(); /* Hook into zones */ - for (l = e_manager_list(); l; l = l->next) - { - man = l->data; - for (ll = man->containers; ll; ll = ll->next) - { - con = ll->data; - for (lll = con->zones; lll; lll = lll->next) - { - zone = lll->data; - if (e_fwin_zone_find(zone)) continue; - if (e_config->show_desktop_icons) - e_fwin_zone_new(zone, e_mod_fileman_path_find(zone)); - } - } - } + EINA_LIST_FOREACH(e_comp_list(), l, comp) + EINA_LIST_FOREACH(comp->zones, ll, zone) + { + if (e_fwin_zone_find(zone)) continue; + if (e_config->show_desktop_icons) + e_fwin_zone_new(zone, e_mod_fileman_path_find(zone)); + } zone_add_handler = ecore_event_handler_add(E_EVENT_ZONE_ADD, _e_mod_zone_add, NULL); @@ -96,9 +87,8 @@ e_modapi_init(E_Module *m) EAPI int e_modapi_shutdown(E_Module *m __UNUSED__) { - Eina_List *l, *ll, *lll; - E_Manager *man; - E_Container *con; + const Eina_List *l, *ll; + E_Comp *comp; E_Zone *zone; E_Config_Dialog *cfd; @@ -108,20 +98,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__) zone_add_handler = NULL; /* Unhook zone fm */ - for (l = e_manager_list(); l; l = l->next) - { - man = l->data; - for (ll = man->containers; ll; ll = ll->next) - { - con = ll->data; - for (lll = con->zones; lll; lll = lll->next) - { - zone = lll->data; - if (!zone) continue; - e_fwin_zone_shutdown(zone); - } - } - } + EINA_LIST_FOREACH(e_comp_list(), l, comp) + EINA_LIST_FOREACH(comp->zones, ll, zone) + e_fwin_zone_shutdown(zone); e_fwin_nav_shutdown(); @@ -191,32 +170,32 @@ _e_mod_action_fileman_cb(E_Object *obj, { if (obj->type == E_MANAGER_TYPE) zone = e_util_zone_current_get((E_Manager *)obj); - else if (obj->type == E_CONTAINER_TYPE) - zone = e_util_zone_current_get(((E_Container *)obj)->manager); + else if (obj->type == E_COMP_TYPE) + zone = e_zone_current_get((E_Comp *)obj); else if (obj->type == E_ZONE_TYPE) - zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager); + zone = e_zone_current_get(((E_Zone *)obj)->comp); else - zone = e_util_zone_current_get(e_manager_current_get()); + zone = e_zone_current_get(e_comp_get(NULL)); } if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); if (zone) { if (params && params[0] == '/') - e_fwin_new(zone->container, "/", params); + e_fwin_new(zone->comp, "/", params); else if (params && params[0] == '~') - e_fwin_new(zone->container, "~/", params + 1); + e_fwin_new(zone->comp, "~/", params + 1); else if (params && strcmp(params, "(none)")) /* avoid matching paths that no longer exist */ { char *path; path = e_util_shell_env_path_eval(params); if (path) { - e_fwin_new(zone->container, path, "/"); + e_fwin_new(zone->comp, path, "/"); free(path); } } else - e_fwin_new(zone->container, "favorites", "/"); + e_fwin_new(zone->comp, "favorites", "/"); } } @@ -375,7 +354,7 @@ e_mod_fileman_path_find(E_Zone *zone) Fileman_Path *path; EINA_LIST_FOREACH(fileman_config->paths, l, path) - if (path->zone == zone->container->num + zone->num) break; + if (path->zone == zone->comp->num + zone->num) break; if (l && fileman_config->view.desktop_navigation) return path; if (l) { @@ -385,14 +364,14 @@ e_mod_fileman_path_find(E_Zone *zone) else { path = E_NEW(Fileman_Path, 1); - path->zone = zone->container->num + zone->num; + path->zone = zone->comp->num + zone->num; path->dev = eina_stringshare_add("desktop"); fileman_config->paths = eina_list_append(fileman_config->paths, path); path->desktop_mode = E_FM2_VIEW_MODE_CUSTOM_ICONS; } - if ((zone->container->num == 0) && (zone->num == 0)) + if ((zone->comp->num == 0) && (zone->num == 0)) path->path = eina_stringshare_add("/"); else - path->path = eina_stringshare_printf("%d", (zone->container->num + zone->num)); + path->path = eina_stringshare_printf("%d", (zone->comp->num + zone->num)); return path; } diff --git a/src/modules/fileman/e_mod_main.h b/src/modules/fileman/e_mod_main.h index d5eccee9e..ea36267e3 100644 --- a/src/modules/fileman/e_mod_main.h +++ b/src/modules/fileman/e_mod_main.h @@ -109,9 +109,9 @@ Fileman_Path *e_mod_fileman_path_find(E_Zone *zone); E_Menu *e_mod_menu_add(E_Menu *m, const char *path); -E_Config_Dialog *e_int_config_fileman(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_fileman(E_Comp *comp, const char *params __UNUSED__); E_Config_Dialog *e_int_config_mime_edit(E_Config_Mime_Icon *data, void *data2); -E_Config_Dialog *e_int_config_mime(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_mime(E_Comp *comp, const char *params __UNUSED__); void e_int_config_mime_edit_done(void *data); void e_fileman_dbus_init(void); @@ -119,12 +119,12 @@ void e_fileman_dbus_shutdown(void); int e_fwin_init (void); int e_fwin_shutdown (void); -void e_fwin_new (E_Container *con, const char *dev, const char *path); +void e_fwin_new (E_Comp *comp, const char *dev, const char *path); void e_fwin_zone_new (E_Zone *zone, void *path); void e_fwin_zone_shutdown (E_Zone *zone); void e_fwin_all_unsel (void *data); void e_fwin_reload_all (void); -int e_fwin_zone_find (E_Zone *zone); +void *e_fwin_zone_find (E_Zone *zone); Eina_Bool e_fwin_nav_init(void); Eina_Bool e_fwin_nav_shutdown(void); diff --git a/src/modules/fileman/e_mod_menu.c b/src/modules/fileman/e_mod_menu.c index b98306e0f..fc81cf588 100644 --- a/src/modules/fileman/e_mod_menu.c +++ b/src/modules/fileman/e_mod_menu.c @@ -27,7 +27,7 @@ _e_mod_menu_gtk_cb(void *data, if (fm && ((fileman_config->view.open_dirs_in_place && evas_object_data_get(fm, "page_is_window")) || (fileman_config->view.desktop_navigation && evas_object_data_get(fm, "page_is_zone")))) e_fm2_path_set(fm, NULL, data); - else if (m->zone) e_fwin_new(m->zone->container, NULL, data); + else if (m->zone) e_fwin_new(m->zone->comp, NULL, data); } static void @@ -43,7 +43,7 @@ _e_mod_menu_virtual_cb(void *data, if (fm && ((fileman_config->view.open_dirs_in_place && evas_object_data_get(fm, "page_is_window")) || (fileman_config->view.desktop_navigation && evas_object_data_get(fm, "page_is_zone")))) e_fm2_path_set(fm, data, path ?: "/"); - else if (m->zone) e_fwin_new(m->zone->container, data, path ?: "/"); + else if (m->zone) e_fwin_new(m->zone->comp, data, path ?: "/"); } static void @@ -62,7 +62,7 @@ _e_mod_menu_volume_cb(void *data, (fileman_config->view.desktop_navigation && evas_object_data_get(fm, "page_is_zone")))) e_fm2_path_set(fm, NULL, vol->mount_point); else if (m->zone) - e_fwin_new(m->zone->container, NULL, vol->mount_point); + e_fwin_new(m->zone->comp, NULL, vol->mount_point); } else { @@ -73,7 +73,7 @@ _e_mod_menu_volume_cb(void *data, (fileman_config->view.desktop_navigation && evas_object_data_get(fm, "page_is_zone")))) e_fm2_path_set(fm, buf, "/"); else if (m->zone) - e_fwin_new(m->zone->container, buf, "/"); + e_fwin_new(m->zone->comp, buf, "/"); } } @@ -94,7 +94,7 @@ _e_mod_menu_populate_cb(void *data, (fileman_config->view.desktop_navigation && evas_object_data_get(fm, "page_is_zone")))) e_fm2_path_set(fm, data, path ?: "/"); else if (m->zone) - e_fwin_new(m->zone->container, data, path ?: "/"); + e_fwin_new(m->zone->comp, data, path ?: "/"); } static void @@ -486,7 +486,7 @@ static void _e_mod_menu_navigate_cb(void *d EINA_UNUSED, E_Menu *m, E_Menu_Item *mi EINA_UNUSED) { if (m->zone) - e_fwin_new(m->zone->container, "~/", "/"); + e_fwin_new(m->zone->comp, "~/", "/"); } /* returns submenu so we can add Go to Parent */ diff --git a/src/modules/fileman_opinfo/e_mod_main.c b/src/modules/fileman_opinfo/e_mod_main.c index 2b57cff28..03056b598 100644 --- a/src/modules/fileman_opinfo/e_mod_main.c +++ b/src/modules/fileman_opinfo/e_mod_main.c @@ -262,21 +262,21 @@ _opinfo_op_registry_window_jump_cb(void *data, Evas_Object *obj __UNUSED__, cons : e_win_evas_object_win_get(ere->e_fm); if (!win) return; - if (win->border) + if (win->client) { - if (win->border->iconic) - e_border_uniconify(win->border); - if (win->border->shaded) - e_border_unshade(win->border, win->border->shade.dir); + if (win->client->iconic) + e_client_uniconify(win->client); + if (win->client->shaded) + e_client_unshade(win->client, win->client->shade_dir); } else e_win_show(win); e_win_raise(win); - e_desk_show(win->border->desk); - e_border_focus_set_with_pointer(win->border); + e_desk_show(win->client->desk); + e_client_focus_set_with_pointer(win->client); if (ere->needs_attention && e_config->pointer_slide) - e_border_pointer_warp_to_center(win->border); + e_client_pointer_warp_to_center(win->client); } static Eina_Bool diff --git a/src/modules/gadman/e_mod_config.c b/src/modules/gadman/e_mod_config.c index 29f8de4bc..f56bdc02a 100644 --- a/src/modules/gadman/e_mod_config.c +++ b/src/modules/gadman/e_mod_config.c @@ -57,7 +57,7 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda } E_Config_Dialog * -_config_gadman_module(E_Container *con, const char *params __UNUSED__) +_config_gadman_module(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -76,7 +76,7 @@ _config_gadman_module(E_Container *con, const char *params __UNUSED__) v->basic.check_changed = _basic_check_changed; snprintf(buf, sizeof(buf), "%s/e-module-gadman.edj", Man->module->dir); - cfd = e_config_dialog_new(con, _("Desktop Gadgets"), + cfd = e_config_dialog_new(comp, _("Desktop Gadgets"), "E", "extensions/gadman", buf, 0, v, Man); @@ -151,7 +151,7 @@ _cb_config(void *data, void *data2 __UNUSED__) EINA_LIST_FOREACH(Man->gadcons[x], l, gc) { - if (gc->zone != cfdata->cfd->dia->win->border->zone) continue; + if (gc->zone != cfdata->cfd->dia->win->client->zone) continue; if (gc->config_dialog) return; e_int_gadcon_config_hook(gc, _("Desktop Gadgets"), E_GADCON_SITE_DESKTOP); if (!Man->add) diff --git a/src/modules/gadman/e_mod_gadman.c b/src/modules/gadman/e_mod_gadman.c index 0c417f486..5e3d62e90 100644 --- a/src/modules/gadman/e_mod_gadman.c +++ b/src/modules/gadman/e_mod_gadman.c @@ -60,23 +60,23 @@ gadman_reset(void *d EINA_UNUSED) E_FREE_FUNC(gadman_reset_job, ecore_job_del); if (gadman_locked) return; - evas_event_freeze(e_comp_get(Man->container)->evas); + evas_event_freeze(Man->comp->evas); for (layer = 0; layer < GADMAN_LAYER_COUNT; layer++) { E_FREE_LIST(Man->gadcons[layer], e_object_del); Man->gadgets[layer] = eina_list_free(Man->gadgets[layer]); E_FREE_FUNC(Man->movers[layer], evas_object_del); } - E_FREE_FUNC(Man->overlay, e_object_del); + evas_object_hide(Man->overlay); + E_FREE_FUNC(Man->overlay, evas_object_del); E_FREE_FUNC(Man->full_bg, evas_object_del); - E_FREE_FUNC(Man->overlay_layer, evas_object_del); if (_gadman_gadgets) { eina_hash_free_cb_set(_gadman_gadgets, EINA_FREE_CB(eina_list_free)); eina_hash_free(_gadman_gadgets); } /* iterating through zones - and making gadmans on each */ - EINA_LIST_FOREACH(Man->container->zones, l, zone) + EINA_LIST_FOREACH(Man->comp->zones, l, zone) { const char *layer_name[] = {"gadman", "gadman_top"}; @@ -98,7 +98,7 @@ gadman_reset(void *d EINA_UNUSED) Man->conf->anim_bg = prev; } edje_object_message_signal_process(Man->full_bg); - evas_event_thaw(e_comp_get(Man->container)->evas); + evas_event_thaw(Man->comp->evas); } void @@ -112,9 +112,9 @@ gadman_init(E_Module *m) Man->module = m; gadman_locked = e_module_loading_get(); - Man->container = e_container_current_get(e_manager_current_get()); - Man->width = Man->container->w; - Man->height = Man->container->h; + Man->comp = e_util_comp_current_get(); + Man->width = Man->comp->man->w; + Man->height = Man->comp->man->h; /* create and register "desktop" location */ location = Man->location[GADMAN_LAYER_BG] = e_gadcon_location_new(_("Desktop"), E_GADCON_SITE_DESKTOP, @@ -156,8 +156,8 @@ gadman_shutdown(void) eina_stringshare_del(Man->icon_name); /* free manager */ - E_FREE_FUNC(Man->overlay, e_object_del); - E_FREE_FUNC(Man->overlay_layer, evas_object_del); + evas_object_hide(Man->overlay); + E_FREE_FUNC(Man->overlay, evas_object_del); if (_gadman_gadgets) { eina_hash_free_cb_set(_gadman_gadgets, EINA_FREE_CB(eina_list_free)); @@ -325,10 +325,10 @@ gadman_gadget_place(E_Gadcon_Client *gcc, const E_Gadcon_Client_Class *cc, E_Con if (gcc->gadcon->id == ID_GADMAN_LAYER_TOP) { edje_object_signal_emit(gcc->o_frame, "e,state,visibility,hide", "e"); - evas_object_layer_set(gcc->o_frame, E_COMP_CANVAS_LAYER_POPUP); + evas_object_layer_set(gcc->o_frame, E_LAYER_POPUP); } else - evas_object_layer_set(gcc->o_frame, E_COMP_CANVAS_LAYER_DESKTOP); + evas_object_layer_set(gcc->o_frame, E_LAYER_DESKTOP); if (cc->name) { l = eina_hash_find(_gadman_gadgets, cc->name); @@ -505,7 +505,7 @@ gadman_gadgets_show(void) Eina_Bool editing = EINA_FALSE; Man->visible = 1; - e_popup_show(Man->overlay); + evas_object_show(Man->overlay); if (Man->conf->bg_type == BG_STD) { @@ -631,7 +631,7 @@ gadman_update_bg(void) r = (double)Man->conf->color_r * (200. / 255.); g = (double)Man->conf->color_g * (200. / 255.); b = (double)Man->conf->color_b * (200. / 255.); - obj = evas_object_rectangle_add(e_comp_get(Man->container)->evas); + obj = evas_object_rectangle_add(Man->comp->evas); evas_object_color_set(obj, lround(r), lround(g), lround(b), 200); edje_object_part_swallow(Man->full_bg, "e.swallow.bg", obj); } @@ -641,18 +641,18 @@ gadman_update_bg(void) ext = strrchr(Man->conf->custom_bg, '.'); if (!strcmp(ext, ".edj") || !strcmp(ext, ".EDJ")) { - //THIS IS FOR E18 backgrounds - obj = edje_object_add(e_comp_get(Man->container)->evas); + //THIS IS FOR E19 backgrounds + obj = edje_object_add(Man->comp->evas); edje_object_file_set(obj, Man->conf->custom_bg, "e/desktop/background"); } else { //THIS IS FOR A NORMAL IMAGE - obj = evas_object_image_add(e_comp_get(Man->container)->evas); + obj = evas_object_image_add(Man->comp->evas); evas_object_image_file_set(obj, Man->conf->custom_bg, NULL); - evas_object_image_fill_set(obj, 0, 0, Man->container->w, - Man->container->h); + evas_object_image_fill_set(obj, 0, 0, Man->comp->man->w, + Man->comp->man->h); } edje_object_part_swallow(Man->full_bg, "e.swallow.bg", obj); break; @@ -776,7 +776,7 @@ _gadman_gadcon_dnd_drop_cb(E_Gadcon *gc, E_Gadcon_Client *gcc) /* checking if zone was changed for dragged gadget */ mover = _get_mover(gcc); evas_object_geometry_get(mover, &gx, &gy, NULL, NULL); - dst_zone = e_container_zone_at_point_get(e_container_current_get(e_manager_current_get()), gx, gy); + dst_zone = e_comp_zone_xy_get(e_util_comp_current_get(), gx, gy); if (dst_zone && (gcc->gadcon->zone != dst_zone)) { unsigned int layer = gcc->gadcon->id - ID_GADMAN_LAYER_BASE; @@ -798,12 +798,9 @@ _gadman_overlay_create(void) Eina_List *l; E_Gadcon *gc; - Man->overlay = e_popup_new(eina_list_data_get(Man->container->zones), 0, 0, Man->container->w, Man->container->h); - e_popup_name_set(Man->overlay, "noshadow_gadman"); - e_popup_layer_set(Man->overlay, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_FULLSCREEN); - /* create full background object */ - Man->full_bg = edje_object_add(e_comp_get(Man->container)->evas); + Man->full_bg = edje_object_add(Man->comp->evas); + evas_object_geometry_set(Man->full_bg, 0, 0, Man->comp->man->w, Man->comp->man->h); e_theme_edje_object_set(Man->full_bg, "base/theme/gadman", "e/gadman/full_bg"); edje_object_signal_callback_add(Man->full_bg, "mouse,down,*", @@ -811,14 +808,13 @@ _gadman_overlay_create(void) edje_object_signal_callback_add(Man->full_bg, "e,action,hide,stop", "", on_hide_stop, NULL); - e_popup_content_set(Man->overlay, Man->full_bg); + Man->overlay = e_comp_object_util_add(Man->full_bg, E_COMP_OBJECT_TYPE_NONE); + evas_object_layer_set(Man->overlay, E_LAYER_CLIENT_FULLSCREEN); /* create placeholder rect to maintain our dnd stacking layer */ - Man->overlay_layer = evas_object_rectangle_add(e_comp_get(Man->container)->evas); - evas_object_layer_set(Man->overlay_layer, E_COMP_CANVAS_LAYER_LAYOUT + E_LAYER_FULLSCREEN); EINA_LIST_FOREACH(Man->gadcons[GADMAN_LAYER_TOP], l, gc) { - gc->drop_handler->base = Man->overlay_layer; + gc->drop_handler->base = Man->overlay; gc->drop_handler->hidden = 1; } } @@ -839,10 +835,10 @@ _gadman_gadcon_new(const char *name, Gadman_Layer_Type layer, E_Zone *zone, E_Ga gc->orient = E_GADCON_ORIENT_FLOAT; gc->location = loc; - gc->evas = e_comp_get(Man->container)->evas; - e_gadcon_ecore_evas_set(gc, e_comp_get(Man->container)->ee); - e_gadcon_xdnd_window_set(gc, e_comp_get(Man->container)->ee_win); - e_gadcon_dnd_window_set(gc, e_comp_get(Man->container)->ee_win); + gc->evas = Man->comp->evas; + e_gadcon_ecore_evas_set(gc, Man->comp->ee); + e_gadcon_xdnd_window_set(gc, Man->comp->ee_win); + e_gadcon_dnd_window_set(gc, Man->comp->ee_win); e_gadcon_drop_handler_add(gc, _gadman_gadcon_dnd_enter_cb, _gadman_gadcon_dnd_leave_cb, _gadman_gadcon_dnd_move_cb, _gadman_gadcon_dnd_drop_cb, @@ -916,11 +912,11 @@ _create_mover(E_Gadcon *gc) mover = edje_object_add(gc->evas); if (gc->id == ID_GADMAN_LAYER_BG) { - evas_object_layer_set(mover, E_COMP_CANVAS_LAYER_DESKTOP); + evas_object_layer_set(mover, E_LAYER_DESKTOP); evas_object_event_callback_add(mover, EVAS_CALLBACK_DEL, _mover_del, NULL); } else - evas_object_layer_set(mover, E_COMP_CANVAS_LAYER_MENU); + evas_object_layer_set(mover, E_LAYER_MENU); e_theme_edje_object_set(mover, "base/theme/gadman", "e/gadman/control"); edje_object_signal_callback_add(mover, "e,action,move,start", "", @@ -1235,7 +1231,7 @@ on_menu_add(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__) { if (Man->visible) gadman_gadgets_hide(); - e_configure_registry_call("extensions/gadman", m->zone->container, NULL); + e_configure_registry_call("extensions/gadman", m->zone->comp, NULL); } static void @@ -1540,7 +1536,7 @@ on_move(void *data, Evas_Object *o __UNUSED__, const char *em __UNUSED__, const drag_gcc->dx = mx - ox; drag_gcc->dy = my - oy; - drag_gcc->drag.drag = drag = e_drag_new(gc->zone->container, mx, my, + drag_gcc->drag.drag = drag = e_drag_new(gc->zone->comp, mx, my, drag_types, 1, drag_gcc, -1, NULL, e_gadcon_drag_finished_cb); if (!drag) return; @@ -1569,7 +1565,7 @@ on_bg_click(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *em __U static void on_hide_stop(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *em __UNUSED__, const char *src __UNUSED__) { - e_popup_hide(Man->overlay); + evas_object_hide(Man->overlay); } static int @@ -1642,6 +1638,7 @@ _e_gadman_cb_zone_change(void *data __UNUSED__, int type, void *event) E_Gadcon_Client *gcc; if (!Man) return ECORE_CALLBACK_RENEW; + if (gadman_locked) return ECORE_CALLBACK_RENEW; if (type == E_EVENT_ZONE_MOVE_RESIZE) { /* probably zone dirty being set */ @@ -1666,10 +1663,10 @@ _e_gadman_cb_zone_change(void *data __UNUSED__, int type, void *event) break; } } - if (ev->zone == Man->overlay->zone) + if (ev->zone->comp == Man->comp) { - E_FREE_FUNC(Man->overlay, e_object_del); - E_FREE_FUNC(Man->overlay_layer, evas_object_del); + evas_object_hide(Man->overlay); + E_FREE_FUNC(Man->overlay, evas_object_del); _gadman_overlay_create(); } return ECORE_CALLBACK_RENEW; @@ -1687,7 +1684,7 @@ _e_gadman_cb_zone_change(void *data __UNUSED__, int type, void *event) if (found) continue; gc = _gadman_gadcon_new(layer_name[layer], layer, ev->zone, Man->location[layer]); Man->gadcons[layer] = eina_list_append(Man->gadcons[layer], gc); - gc->drop_handler->base = Man->overlay_layer; + gc->drop_handler->base = Man->overlay; gc->drop_handler->hidden = 1; } return ECORE_CALLBACK_PASS_ON; diff --git a/src/modules/gadman/e_mod_gadman.h b/src/modules/gadman/e_mod_gadman.h index 0db978a54..0d7e53381 100644 --- a/src/modules/gadman/e_mod_gadman.h +++ b/src/modules/gadman/e_mod_gadman.h @@ -52,7 +52,6 @@ struct _Manager Eina_List *gadgets[GADMAN_LAYER_COUNT]; Evas_Object *movers[GADMAN_LAYER_COUNT]; Evas_Object *full_bg; - Evas_Object *overlay_layer; const char *icon_name; E_Gadcon_Client *drag_gcc[GADMAN_LAYER_COUNT]; @@ -60,8 +59,8 @@ struct _Manager Ecore_Event_Handler *add; int visible; - E_Popup *overlay; - E_Container *container; + Evas_Object *overlay; + E_Comp *comp; int width, height; @@ -86,7 +85,7 @@ void gadman_gadgets_toggle(void); void gadman_update_bg(void); Eina_Bool gadman_gadget_add_handler(void *d, int type, E_Event_Gadcon_Client_Add *ev); -E_Config_Dialog *_config_gadman_module(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *_config_gadman_module(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Gadgets diff --git a/src/modules/gadman/e_mod_main.c b/src/modules/gadman/e_mod_main.c index 21d9ac605..149d4ad48 100644 --- a/src/modules/gadman/e_mod_main.c +++ b/src/modules/gadman/e_mod_main.c @@ -191,7 +191,7 @@ _gadman_desktop_menu(void *d __UNUSED__, E_Menu *m, void *icon) static void _gadman_maug_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__) { - e_configure_registry_call("extensions/gadman", m->zone->container, NULL); + e_configure_registry_call("extensions/gadman", m->zone->comp, NULL); } static void diff --git a/src/modules/ibar/e_mod_config.c b/src/modules/ibar/e_mod_config.c index bc35d2d97..dc91fc877 100644 --- a/src/modules/ibar/e_mod_config.c +++ b/src/modules/ibar/e_mod_config.c @@ -52,7 +52,7 @@ _config_ibar_module(Config_Item *ci) e_module_dir_get(ibar_config->module)); /* Create The Dialog */ - cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()), + cfd = e_config_dialog_new(NULL, _("IBar Settings"), "E", "_e_mod_ibar_config_dialog", buf, 0, v, ci); @@ -222,8 +222,7 @@ _cb_config(void *data, void *data2 __UNUSED__) e_user_dir_snprintf(path, sizeof(path), "applications/bar/%s/.order", cfdata->dir); e_configure_registry_call("internal/ibar_other", - e_container_current_get(e_manager_current_get()), - path); + NULL, path); } static void diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index f6dc7ba8e..9089f41a1 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -532,13 +532,13 @@ _ibar_fill(IBar *b) { EINA_LIST_FOREACH(l, ll, exe) { - E_Border *bd; + E_Client *ec; Eina_List *lll; Eina_Bool skip = EINA_TRUE; if (!exe->desktop) continue; - EINA_LIST_FOREACH(exe->borders, lll, bd) - if (!bd->client.netwm.state.skip_taskbar) + EINA_LIST_FOREACH(exe->clients, lll, ec) + if (!ec->netwm.state.skip_taskbar) { skip = EINA_FALSE; break; @@ -790,6 +790,7 @@ _ibar_icon_new(IBar *b, Efreet_Desktop *desktop, Eina_Bool notinorder) evas_object_show(ic->o_holder); ic->o_holder2 = edje_object_add(evas_object_evas_get(b->o_box)); + evas_object_name_set(ic->o_holder2, "ibar_icon->o_holder2"); e_theme_edje_object_set(ic->o_holder2, "base/theme/modules/ibar", "e/modules/ibar/icon_overlay"); evas_object_layer_set(ic->o_holder2, 9999); @@ -942,11 +943,8 @@ _ibar_cb_obj_moveresize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE static void _ibar_cb_menu_icon_new(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) { - E_Container *con; - if (!e_configure_registry_exists("applications/new_application")) return; - con = e_container_current_get(e_manager_current_get()); - e_configure_registry_call("applications/new_application", con, NULL); + e_configure_registry_call("applications/new_application", e_comp_get(NULL), NULL); } static void @@ -959,8 +957,7 @@ _ibar_cb_menu_icon_add(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSE e_user_dir_snprintf(path, sizeof(path), "applications/bar/%s/.order", b->inst->ci->dir); e_configure_registry_call("internal/ibar_other", - e_container_current_get(e_manager_current_get()), - path); + NULL, path); } static void @@ -969,7 +966,7 @@ _ibar_cb_menu_icon_properties(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi IBar_Icon *ic; ic = data; - e_desktop_edit(ic->ibar->inst->gcc->gadcon->zone->container, ic->app); + e_desktop_edit(e_comp_get(ic->ibar->inst->gcc), ic->app); } static void @@ -1006,16 +1003,16 @@ static void _ibar_cb_icon_menu_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { IBar_Icon *ic; - E_Border *bd = data; + E_Client *ec = data; Evas_Event_Mouse_Up *ev = event_info; ic = evas_object_data_get(obj, "ibar_icon"); if (ev->button == 3) { - e_int_border_menu_show(bd, ev->canvas.x, ev->canvas.y, 0, ev->timestamp); + e_int_client_menu_show(ec, ev->canvas.x, ev->canvas.y, 0, ev->timestamp); return; } - e_border_activate(bd, 1); + e_client_activate(ec, 1); if (!ic) return; edje_object_signal_emit(ic->menu->o_bg, "e,action,hide", "e"); } @@ -1028,7 +1025,7 @@ _ibar_cb_icon_menu_del(void *obj) } static void -_ibar_cb_icon_menu_autodel(void *data, void *pop EINA_UNUSED) +_ibar_cb_icon_menu_autodel(void *data, Evas_Object *obj EINA_UNUSED) { IBar_Icon *ic = data; @@ -1065,16 +1062,19 @@ _ibar_cb_icon_menu_img_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EIN edje_extern_object_min_size_set(ic->menu->o_bg, w, h); if (e_box_orientation_get(ic->ibar->o_box)) { - int ny; + int cx, cy, cw, ch, ny; + E_Zone *zone; - if (ic->menu->win->y > (ic->menu->win->zone->h / 2)) - ny = ic->menu->win->y - (h - ic->menu->win->h); + evas_object_geometry_get(ic->menu->comp_object, &cx, &cy, &cw, &ch); + zone = e_comp_zone_xy_get(e_comp_get(ic->menu), cx, cy); + if (cy > (zone->h / 2)) + ny = cy - (h - ch); else - ny = ic->menu->win->y; - e_popup_move_resize(ic->menu->win, ic->menu->win->x, ny, w, h); + ny = cy; + evas_object_geometry_set(ic->menu->comp_object, cx, ny, w, h); } else - e_popup_resize(ic->menu->win, w, h); + evas_object_resize(ic->menu->comp_object, w, h); } static void @@ -1085,37 +1085,44 @@ _ibar_icon_menu(IBar_Icon *ic, Eina_Bool grab) E_Exec_Instance *exe; Evas *e; int w, h; + Eina_Bool empty = EINA_TRUE; if (!ic->exes) return; //FIXME - ic->menu = e_gadcon_popup_new(ic->ibar->inst->gcc); - e_popup_name_set(ic->menu->win, "noshadow-ibarmenu"); + ic->menu = e_gadcon_popup_new(ic->ibar->inst->gcc, 1); e_object_data_set(E_OBJECT(ic->menu), ic); E_OBJECT_DEL_SET(ic->menu, _ibar_cb_icon_menu_del); e = e_comp_get(ic->menu)->evas; o = edje_object_add(e); e_theme_edje_object_set(o, "base/theme/modules/ibar", "e/modules/ibar/menu"); + /* gadcon popups don't really prevent this, + * so away we go! + */ + evas_object_del(ic->menu->comp_object); + ic->menu->o_bg = o; + ic->menu->comp_object = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_NONE); + evas_object_layer_set(ic->menu->comp_object, E_LAYER_POPUP); EINA_LIST_FOREACH(ic->exes, l, exe) { Evas_Object *img; const char *txt; Eina_List *ll; - E_Border *bd; + E_Client *ec; - EINA_LIST_FOREACH(exe->borders, ll, bd) + EINA_LIST_FOREACH(exe->clients, ll, ec) { - if (bd->client.netwm.state.skip_taskbar) continue; + if (ec->netwm.state.skip_taskbar) continue; it = edje_object_add(e); - e_popup_object_add(ic->menu->win, it); + e_comp_object_util_del_list_append(ic->menu->comp_object, it); e_theme_edje_object_set(it, "base/theme/modules/ibar", "e/modules/ibar/menu/item"); - img = e_comp_win_image_mirror_add(bd->cw); + img = e_comp_object_util_mirror_add(ec->frame); evas_object_event_callback_add(img, EVAS_CALLBACK_DEL, _ibar_cb_icon_menu_img_del, it); - txt = e_border_name_get(bd); - w = bd->cw->pw; - h = bd->cw->ph; - e_popup_object_add(ic->menu->win, img); + txt = e_client_name_get(ec); + w = ec->client.w; + h = ec->client.h; + e_comp_object_util_del_list_append(ic->menu->comp_object, img); evas_object_show(img); edje_extern_object_aspect_set(img, EDJE_ASPECT_CONTROL_BOTH, w, h); edje_object_part_swallow(it, "e.swallow.icon", img); @@ -1126,12 +1133,13 @@ _ibar_icon_menu(IBar_Icon *ic, Eina_Bool grab) evas_object_size_hint_min_set(it, w, h); evas_object_show(it); evas_object_event_callback_add(it, EVAS_CALLBACK_MOUSE_UP, - _ibar_cb_icon_menu_mouse_up, bd); + _ibar_cb_icon_menu_mouse_up, ec); evas_object_data_set(it, "ibar_icon", ic); edje_object_part_box_append(o, "e.box", it); + empty = EINA_FALSE; } } - if (!ic->menu->win->objects) + if (empty) { /* something crazy happened */ evas_object_del(o); @@ -1141,15 +1149,11 @@ _ibar_icon_menu(IBar_Icon *ic, Eina_Bool grab) edje_object_calc_force(o); edje_object_size_min_calc(o, &w, &h); edje_extern_object_min_size_set(o, w, h); - /* gadcon popups don't really prevent this, - * so away we go! - */ - evas_object_del(ic->menu->o_bg); - ic->menu->o_bg = o; + ic->menu->w = w, ic->menu->h = h; edje_object_signal_callback_add(o, "e,action,hide,done", "*", _ibar_cb_icon_menu_hidden, ic); - e_popup_resize(ic->menu->win, w, h); + evas_object_resize(ic->menu->comp_object, w, h); edje_object_signal_emit(o, "e,state,hidden", "e"); edje_object_message_signal_process(o); e_gadcon_popup_show(ic->menu); @@ -1157,19 +1161,17 @@ _ibar_icon_menu(IBar_Icon *ic, Eina_Bool grab) { Evas_Coord x, y, iw, ih, ox, oy; evas_object_geometry_get(ic->o_holder, &x, &y, &iw, &ih); - x -= ic->menu->win->zone->x; - y -= ic->menu->win->zone->y; - ox = ic->menu->win->x, oy = ic->menu->win->y; + evas_object_geometry_get(ic->menu->comp_object, &ox, &oy, NULL, NULL); if (e_box_orientation_get(ic->ibar->o_box)) ox = (x + (iw / 2)) - (w / 2); else oy = (y + (ih / 2)) - (h / 2); - e_popup_move(ic->menu->win, ox, oy); + evas_object_move(ic->menu->comp_object, ox, oy); } edje_object_signal_emit(o, "e,action,show", "e"); ic->menu_grabbed = grab; if (grab) - e_popup_autoclose(ic->menu->win, _ibar_cb_icon_menu_autodel, NULL, ic); + e_comp_object_util_autoclose(ic->menu->comp_object, _ibar_cb_icon_menu_autodel, NULL, ic); } static void @@ -1379,12 +1381,12 @@ _ibar_cb_icon_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Wheel *ev = event_info; E_Exec_Instance *exe; IBar_Icon *ic = data; - E_Border *cur, *sel = NULL; + E_Client *cur, *sel = NULL; Eina_List *l; if (!ic->exes) return; - cur = e_border_focused_get(); + cur = e_client_focused_get(); if (!ic->exe_current) ic->exe_current = ic->exes; @@ -1393,7 +1395,7 @@ _ibar_cb_icon_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, { if (cur && (cur->exe_inst == exe)) { - l = eina_list_data_find_list(exe->borders, cur); + l = eina_list_data_find_list(exe->clients, cur); if (l) sel = eina_list_data_get(eina_list_next(l)); } if (!sel) @@ -1407,7 +1409,7 @@ _ibar_cb_icon_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, { if (cur && (cur->exe_inst == exe)) { - l = eina_list_data_find_list(exe->borders, cur); + l = eina_list_data_find_list(exe->clients, cur); if (l) sel = eina_list_data_get(eina_list_prev(l)); } if (!sel) @@ -1421,11 +1423,11 @@ _ibar_cb_icon_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, if (!sel) { exe = eina_list_data_get(ic->exe_current); - sel = eina_list_data_get(exe->borders); + sel = eina_list_data_get(exe->clients); } if (sel) - e_border_activate(sel, 1); + e_client_activate(sel, 1); } static void @@ -1454,12 +1456,12 @@ _ibar_icon_go(IBar_Icon *ic, Eina_Bool keep_going) { Eina_List *l, *ll; E_Exec_Instance *exe; - E_Border *bd, *bdlast = NULL; + E_Client *ec, *eclast = NULL; unsigned int count = 0; EINA_LIST_FOREACH(ic->exes, l, exe) { - EINA_LIST_FOREACH(exe->borders, ll, bd) + EINA_LIST_FOREACH(exe->clients, ll, ec) { count++; if (count > 1) @@ -1467,11 +1469,11 @@ _ibar_icon_go(IBar_Icon *ic, Eina_Bool keep_going) ecore_job_add((Ecore_Cb)_ibar_cb_icon_menu_cb, ic); return; } - bdlast = bd; + eclast = ec; } } - if (bdlast) - e_border_activate(bdlast, 1); + if (eclast) + e_client_activate(eclast, 1); return; } if (ic->app->type == EFREET_DESKTOP_TYPE_APPLICATION) @@ -1483,7 +1485,6 @@ _ibar_icon_go(IBar_Icon *ic, Eina_Bool keep_going) { E_Exec_Instance *einst; - if (ic->exe_inst) return; einst = e_exec(ic->ibar->inst->gcc->gadcon->zone, ic->app, NULL, NULL, "ibar"); if (einst) @@ -1556,7 +1557,7 @@ _ibar_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (ic->ibar->inst->ci->lock_move) return; evas_object_geometry_get(ic->o_icon, &x, &y, &w, &h); - d = e_drag_new(ic->ibar->inst->gcc->gadcon->zone->container, + d = e_drag_new(ic->ibar->inst->gcc->gadcon->zone->comp, x, y, drag_types, 1, ic->app, -1, NULL, _ibar_cb_drag_finished); efreet_desktop_ref(ic->app); @@ -1585,7 +1586,6 @@ _ibar_cb_icon_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, ic = data; evas_object_geometry_get(ic->o_holder, &x, &y, NULL, NULL); evas_object_move(ic->o_holder2, x, y); - evas_object_raise(ic->o_holder2); } static void @@ -1597,7 +1597,6 @@ _ibar_cb_icon_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ ic = data; evas_object_geometry_get(ic->o_holder, NULL, NULL, &w, &h); evas_object_resize(ic->o_holder2, w, h); - evas_object_raise(ic->o_holder2); } static void @@ -1765,16 +1764,15 @@ _ibar_inst_cb_drop(void *data, const char *type, void *event_info) app = ev->data; else if (!strcmp(type, "enlightenment/border")) { - E_Border *bd; + E_Client *ec; - bd = ev->data; - app = bd->desktop; + ec = ev->data; + app = ec->desktop; if (!app) { - app = e_desktop_border_create(bd); + app = e_desktop_client_create(ec); efreet_desktop_save(app); - e_desktop_edit(e_container_current_get(e_manager_current_get()), - app); + e_desktop_edit(NULL, app); } } else if (!strcmp(type, "text/uri-list")) @@ -1904,8 +1902,8 @@ _ibar_cb_sort(IBar *b1, IBar *b2) { int id1, id2; - id1 = z1->id + (z1->container->num * 100) + (z1->container->manager->num * 10000); - id2 = z2->id + (z2->container->num * 100) + (z2->container->manager->num * 10000); + id1 = z1->id + (z1->comp->num * 100) + (z1->comp->num * 10000); + id2 = z2->id + (z2->comp->num * 100) + (z2->comp->num * 10000); return id2 - id1; } return 0; @@ -2270,19 +2268,20 @@ _ibar_cb_action_focus(E_Object *obj __UNUSED__, const char *params __UNUSED__, E } static Eina_Bool -_ibar_cb_bd_prop(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Border_Property *ev) +_ibar_cb_client_prop(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Property *ev) { IBar *b; Eina_List *l; Eina_Bool skip; - if ((!ev->border->exe_inst) || (!ev->border->exe_inst->desktop)) return ECORE_CALLBACK_RENEW; - skip = ev->border->client.netwm.state.skip_taskbar; + if (e_client_util_ignored_get(ev->ec) || (!ev->ec->exe_inst) || (!ev->ec->exe_inst->desktop)) return ECORE_CALLBACK_RENEW; + if (!(ev->property & E_CLIENT_PROPERTY_NETWM_STATE)) return ECORE_CALLBACK_RENEW; + skip = ev->ec->netwm.state.skip_taskbar; EINA_LIST_FOREACH(ibars, l, b) { IBar_Icon *ic; - ic = eina_hash_find(b->icon_hash, _desktop_name_get(ev->border->exe_inst->desktop)); + ic = eina_hash_find(b->icon_hash, _desktop_name_get(ev->ec->exe_inst->desktop)); if (skip && (!ic)) continue; if (!skip) { @@ -2290,20 +2289,20 @@ _ibar_cb_bd_prop(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Border_Property { _ibar_icon_signal_emit(ic, "e,state,started", "e"); if (!ic->exes) _ibar_icon_signal_emit(ic, "e,state,on", "e"); - if (!eina_list_data_find(ic->exes, ev->border->exe_inst)) - ic->exes = eina_list_append(ic->exes, ev->border->exe_inst); + if (!eina_list_data_find(ic->exes, ev->ec->exe_inst)) + ic->exes = eina_list_append(ic->exes, ev->ec->exe_inst); } else if (!b->inst->ci->dont_add_nonorder) { _ibar_sep_create(b); - ic = _ibar_icon_notinorder_new(b, ev->border->exe_inst); + ic = _ibar_icon_notinorder_new(b, ev->ec->exe_inst); _ibar_resize_handle(b); } } else { - ic->exes = eina_list_remove(ic->exes, ev->border->exe_inst); - if (ic->exe_inst == ev->border->exe_inst) ic->exe_inst = NULL; + ic->exes = eina_list_remove(ic->exes, ev->ec->exe_inst); + if (ic->exe_inst == ev->ec->exe_inst) ic->exe_inst = NULL; if (!ic->exes) { if (ic->not_in_order) @@ -2363,14 +2362,14 @@ static Eina_Bool _ibar_cb_exec_new_client(void *d EINA_UNUSED, int t EINA_UNUSED, E_Exec_Instance *exe) { IBar *b; - E_Border *bd; + E_Client *ec; Eina_List *l; Eina_Bool skip; if (!exe->desktop) return ECORE_CALLBACK_RENEW; //can't do anything here :( if (!exe->desktop->icon) return ECORE_CALLBACK_RENEW; - bd = eina_list_last_data_get(exe->borders); //only care about last (new) one - skip = bd->client.netwm.state.skip_taskbar; + ec = eina_list_last_data_get(exe->clients); //only care about last (new) one + skip = ec->netwm.state.skip_taskbar; EINA_LIST_FOREACH(ibars, l, b) { IBar_Icon *ic; @@ -2399,14 +2398,14 @@ static Eina_Bool _ibar_cb_exec_new(void *d EINA_UNUSED, int t EINA_UNUSED, E_Exec_Instance *exe) { IBar *b; - E_Border *bd; + E_Client *ec; Eina_List *l; Eina_Bool skip = EINA_TRUE; if (!exe->desktop) return ECORE_CALLBACK_RENEW; //can't do anything here :( if (!exe->desktop->icon) return ECORE_CALLBACK_RENEW; - EINA_LIST_FOREACH(exe->borders, l, bd) - if (!bd->client.netwm.state.skip_taskbar) + EINA_LIST_FOREACH(exe->clients, l, ec) + if (!ec->netwm.state.skip_taskbar) skip = EINA_FALSE; EINA_LIST_FOREACH(ibars, l, b) { @@ -2494,8 +2493,8 @@ e_modapi_init(E_Module *m) _ibar_cb_exec_new_client, NULL); E_LIST_HANDLER_APPEND(ibar_config->handlers, E_EVENT_EXEC_DEL, _ibar_cb_exec_del, NULL); - E_LIST_HANDLER_APPEND(ibar_config->handlers, E_EVENT_BORDER_PROPERTY, - _ibar_cb_bd_prop, NULL); + E_LIST_HANDLER_APPEND(ibar_config->handlers, E_EVENT_CLIENT_PROPERTY, + _ibar_cb_client_prop, NULL); e_gadcon_provider_register(&_gadcon_class); ibar_orders = eina_hash_string_superfast_new(NULL); diff --git a/src/modules/ibox/e_mod_config.c b/src/modules/ibox/e_mod_config.c index ae4685500..84226f5e4 100644 --- a/src/modules/ibox/e_mod_config.c +++ b/src/modules/ibox/e_mod_config.c @@ -45,7 +45,7 @@ _config_ibox_module(Config_Item *ci) /* Create The Dialog */ snprintf(buf, sizeof(buf), "%s/e-module-ibox.edj", e_module_dir_get(ibox_config->module)); - cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()), + cfd = e_config_dialog_new(NULL, _("IBox Settings"), "E", "_e_mod_ibox_config_dialog", buf, 0, v, ci); @@ -88,9 +88,9 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial E_Radio_Group *rg; Evas_Object *o, *of, *ob; Evas_Object *show_check = NULL; - - Eina_List *l, *l2; - int zone_count; + E_Comp *comp; + const Eina_List *l; + int zone_count = 0; o = e_widget_list_add(evas, 0, 0); @@ -134,20 +134,8 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial of = e_widget_framelist_add(evas, _("Screen"), 0); - zone_count = 0; - for (l = e_manager_list(); l; l = l->next) - { - E_Manager *man; - man = l->data; - - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - - con = l2->data; - zone_count += eina_list_count(con->zones); - } - } + EINA_LIST_FOREACH(e_comp_list(), l, comp) + zone_count += eina_list_count(comp->zones); if (zone_count <= 1) cfdata->zone_policy = 1; diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c index b01a71dee..8627267b1 100644 --- a/src/modules/ibox/e_mod_main.c +++ b/src/modules/ibox/e_mod_main.c @@ -59,7 +59,7 @@ struct _IBox_Icon Evas_Object *o_icon; Evas_Object *o_holder2; Evas_Object *o_icon2; - E_Border *border; + E_Client *client; struct { unsigned char start : 1; @@ -78,9 +78,9 @@ static void _ibox_empty(IBox *b); static void _ibox_orient_set(IBox *b, int horizontal); static void _ibox_resize_handle(IBox *b); static void _ibox_instance_drop_zone_recalc(Instance *inst); -static IBox_Icon *_ibox_icon_find(IBox *b, E_Border *bd); +static IBox_Icon *_ibox_icon_find(IBox *b, E_Client *ec); static IBox_Icon *_ibox_icon_at_coord(IBox *b, Evas_Coord x, Evas_Coord y); -static IBox_Icon *_ibox_icon_new(IBox *b, E_Border *bd); +static IBox_Icon *_ibox_icon_new(IBox *b, E_Client *ec); static void _ibox_icon_free(IBox_Icon *ic); static void _ibox_icon_fill(IBox_Icon *ic); static void _ibox_icon_fill_label(IBox_Icon *ic); @@ -103,13 +103,11 @@ static void _ibox_inst_cb_leave(void *data, const char *type, void *even static void _ibox_inst_cb_drop(void *data, const char *type, void *event_info); static void _ibox_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y); static void _ibox_inst_cb_scroll(void *data); -static Eina_Bool _ibox_cb_event_border_add(void *data, int type, void *event); -static Eina_Bool _ibox_cb_event_border_remove(void *data, int type, void *event); -static Eina_Bool _ibox_cb_event_border_iconify(void *data, int type, void *event); -static Eina_Bool _ibox_cb_event_border_uniconify(void *data, int type, void *event); -static Eina_Bool _ibox_cb_event_border_icon_change(void *data, int type, void *event); -static Eina_Bool _ibox_cb_event_border_urgent_change(void *data, int type, void *event); -static Eina_Bool _ibox_cb_event_border_zone_set(void *data, int type, void *event); +static Eina_Bool _ibox_cb_event_client_add(void *data, int type, void *event); +static Eina_Bool _ibox_cb_event_client_remove(void *data, int type, void *event); +static Eina_Bool _ibox_cb_event_client_iconify(void *data, int type, void *event); +static Eina_Bool _ibox_cb_event_client_uniconify(void *data, int type, void *event); +static Eina_Bool _ibox_cb_event_client_zone_set(void *data, int type, void *event); static Eina_Bool _ibox_cb_event_desk_show(void *data, int type, void *event); static Config_Item *_ibox_config_item_get(const char *id); @@ -354,31 +352,30 @@ static void _ibox_fill(IBox *b) { IBox_Icon *ic; - E_Border_List *bl; - E_Border *bd; + E_Client *ec; int ok; int mw, mh, h; - bl = e_container_border_list_first(b->zone->container); - while ((bd = e_container_border_list_next(bl))) + E_CLIENT_FOREACH(b->zone->comp, ec) { + if (e_client_util_ignored_get(ec)) continue; ok = 0; - if ((b->inst->ci->show_zone == 0) && (bd->iconic)) + if ((b->inst->ci->show_zone == 0) && (ec->iconic)) { ok = 1; } - else if ((b->inst->ci->show_zone == 1) && (bd->iconic)) + else if ((b->inst->ci->show_zone == 1) && (ec->iconic)) { - if (bd->sticky) + if (ec->sticky) { ok = 1; } - else if ((b->inst->ci->show_desk == 0) && (bd->zone == b->zone)) + else if ((b->inst->ci->show_desk == 0) && (ec->zone == b->zone)) { ok = 1; } - else if ((b->inst->ci->show_desk == 1) && (bd->zone == b->zone) && - (bd->desk == e_desk_current_get(b->zone))) + else if ((b->inst->ci->show_desk == 1) && (ec->zone == b->zone) && + (ec->desk == e_desk_current_get(b->zone))) { ok = 1; } @@ -386,12 +383,11 @@ _ibox_fill(IBox *b) if (ok) { - ic = _ibox_icon_new(b, bd); + ic = _ibox_icon_new(b, ec); b->icons = eina_list_append(b->icons, ic); e_box_pack_end(b->o_box, ic->o_holder); } } - e_container_border_list_free(bl); _ibox_empty_handle(b); _ibox_resize_handle(b); @@ -453,14 +449,14 @@ _ibox_instance_drop_zone_recalc(Instance *inst) } static IBox_Icon * -_ibox_icon_find(IBox *b, E_Border *bd) +_ibox_icon_find(IBox *b, E_Client *ec) { Eina_List *l; IBox_Icon *ic; EINA_LIST_FOREACH(b->icons, l, ic) { - if (ic->border == bd) return ic; + if (ic->client == ec) return ic; } return NULL; } @@ -482,14 +478,14 @@ _ibox_icon_at_coord(IBox *b, Evas_Coord x, Evas_Coord y) } static IBox_Icon * -_ibox_icon_new(IBox *b, E_Border *bd) +_ibox_icon_new(IBox *b, E_Client *ec) { IBox_Icon *ic; ic = E_NEW(IBox_Icon, 1); - e_object_ref(E_OBJECT(bd)); + e_object_ref(E_OBJECT(ec)); ic->ibox = b; - ic->border = bd; + ic->client = ec; ic->o_holder = edje_object_add(evas_object_evas_get(b->o_box)); e_theme_edje_object_set(ic->o_holder, "base/theme/modules/ibox", "e/modules/ibox/icon"); @@ -521,18 +517,18 @@ _ibox_icon_free(IBox_Icon *ic) _ibox_icon_empty(ic); evas_object_del(ic->o_holder); evas_object_del(ic->o_holder2); - e_object_unref(E_OBJECT(ic->border)); + e_object_unref(E_OBJECT(ic->client)); free(ic); } static void _ibox_icon_fill(IBox_Icon *ic) { - ic->o_icon = e_border_icon_add(ic->border, evas_object_evas_get(ic->ibox->o_box)); + ic->o_icon = e_client_icon_add(ic->client, evas_object_evas_get(ic->ibox->o_box)); edje_object_part_swallow(ic->o_holder, "e.swallow.content", ic->o_icon); evas_object_pass_events_set(ic->o_icon, 1); evas_object_show(ic->o_icon); - ic->o_icon2 = e_border_icon_add(ic->border, evas_object_evas_get(ic->ibox->o_box)); + ic->o_icon2 = e_client_icon_add(ic->client, evas_object_evas_get(ic->ibox->o_box)); edje_object_part_swallow(ic->o_holder2, "e.swallow.content", ic->o_icon2); evas_object_pass_events_set(ic->o_icon2, 1); evas_object_show(ic->o_icon2); @@ -548,27 +544,27 @@ _ibox_icon_fill_label(IBox_Icon *ic) switch (ic->ibox->inst->ci->icon_label) { case 0: - label = ic->border->client.netwm.name; + label = ic->client->netwm.name; if (!label) - label = ic->border->client.icccm.name; + label = ic->client->icccm.name; break; case 1: - label = ic->border->client.icccm.title; + label = ic->client->icccm.title; break; case 2: - label = ic->border->client.icccm.class; + label = ic->client->icccm.class; break; case 3: - label = ic->border->client.netwm.icon_name; + label = ic->client->netwm.icon_name; if (!label) - label = ic->border->client.icccm.icon_name; + label = ic->client->icccm.icon_name; break; case 4: - label = e_border_name_get(ic->border); + label = e_client_name_get(ic->client); break; } @@ -700,8 +696,8 @@ _ibox_cb_icon_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED ic = data; if ((ev->button == 1) && (!ic->drag.dnd)) { - e_border_uniconify(ic->border); - e_border_focus_set(ic->border, 1, 1); + e_client_uniconify(ic->client); + evas_object_focus_set(ic->client->frame, 1); } } @@ -731,15 +727,15 @@ _ibox_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS ic->drag.start = 0; evas_object_geometry_get(ic->o_icon, &x, &y, &w, &h); - d = e_drag_new(ic->ibox->inst->gcc->gadcon->zone->container, + d = e_drag_new(ic->ibox->inst->gcc->gadcon->zone->comp, x, y, drag_types, 1, - ic->border, -1, NULL, _ibox_cb_drag_finished); - o = e_border_icon_add(ic->border, e_drag_evas_get(d)); + ic->client, -1, NULL, _ibox_cb_drag_finished); + o = e_client_icon_add(ic->client, e_drag_evas_get(d)); e_drag_object_set(d, o); e_drag_resize(d, w, h); e_drag_start(d, ic->drag.x, ic->drag.y); - e_object_ref(E_OBJECT(ic->border)); + e_object_ref(E_OBJECT(ic->client)); ic->ibox->icons = eina_list_remove(ic->ibox->icons, ic); _ibox_resize_handle(ic->ibox); gcc = ic->ibox->inst->gcc; @@ -776,11 +772,11 @@ _ibox_cb_icon_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ static void _ibox_cb_drag_finished(E_Drag *drag, int dropped) { - E_Border *bd; + E_Client *ec; - bd = drag->data; - if (!dropped) e_border_uniconify(bd); - e_object_unref(E_OBJECT(bd)); + ec = drag->data; + if (!dropped) e_client_uniconify(ec); + e_object_unref(E_OBJECT(ec)); } static void @@ -920,7 +916,7 @@ _ibox_inst_cb_drop(void *data, const char *type, void *event_info) { E_Event_Dnd_Drop *ev; Instance *inst; - E_Border *bd = NULL; + E_Client *ec = NULL; IBox *b; IBox_Icon *ic, *ic2; Eina_List *l; @@ -929,12 +925,12 @@ _ibox_inst_cb_drop(void *data, const char *type, void *event_info) inst = data; if (!strcmp(type, "enlightenment/border")) { - bd = ev->data; - if (!bd) return; + ec = ev->data; + if (!ec) return; } else return; - if (!bd->iconic) e_border_iconify(bd); + if (!ec->iconic) e_client_iconify(ec); ic2 = inst->ibox->ic_drop_before; if (ic2) @@ -953,8 +949,8 @@ _ibox_inst_cb_drop(void *data, const char *type, void *event_info) } if (!ic2) goto atend; b = inst->ibox; - if (_ibox_icon_find(b, bd)) return; - ic = _ibox_icon_new(b, bd); + if (_ibox_icon_find(b, ec)) return; + ic = _ibox_icon_new(b, ec); if (!ic) return; b->icons = eina_list_prepend_relative(b->icons, ic, ic2); e_box_pack_before(b->o_box, ic->o_holder, ic2->o_holder); @@ -963,8 +959,8 @@ _ibox_inst_cb_drop(void *data, const char *type, void *event_info) { atend: b = inst->ibox; - if (_ibox_icon_find(b, bd)) return; - ic = _ibox_icon_new(b, bd); + if (_ibox_icon_find(b, ec)) return; + ic = _ibox_icon_new(b, ec); if (!ic) return; b->icons = eina_list_append(b->icons, ic); e_box_pack_end(b->o_box, ic->o_holder); @@ -981,25 +977,25 @@ atend: } static Eina_Bool -_ibox_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *event) +_ibox_cb_event_client_add(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Add *ev = event; + E_Event_Client *ev = event; IBox *b; IBox_Icon *ic; E_Desk *desk; Eina_List *ibox; /* add if iconic */ - if (!ev->border->iconic) return ECORE_CALLBACK_RENEW; - if (!ev->border->zone) return ECORE_CALLBACK_RENEW; - desk = e_desk_current_get(ev->border->zone); + if (!ev->ec->iconic) return ECORE_CALLBACK_RENEW; + if (!ev->ec->zone) return ECORE_CALLBACK_RENEW; + desk = e_desk_current_get(ev->ec->zone); - ibox = _ibox_zone_find(ev->border->zone); + ibox = _ibox_zone_find(ev->ec->zone); EINA_LIST_FREE(ibox, b) { - if (_ibox_icon_find(b, ev->border)) continue; - if ((b->inst->ci->show_desk) && (ev->border->desk != desk) && (!ev->border->sticky)) continue; - ic = _ibox_icon_new(b, ev->border); + if (_ibox_icon_find(b, ev->ec)) continue; + if ((b->inst->ci->show_desk) && (ev->ec->desk != desk) && (!ev->ec->sticky)) continue; + ic = _ibox_icon_new(b, ev->ec); if (!ic) continue; b->icons = eina_list_append(b->icons, ic); e_box_pack_end(b->o_box, ic->o_holder); @@ -1011,19 +1007,19 @@ _ibox_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *even } static Eina_Bool -_ibox_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event) +_ibox_cb_event_client_remove(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev; + E_Event_Client *ev; IBox *b; IBox_Icon *ic; Eina_List *ibox; ev = event; /* find icon and remove if there */ - ibox = _ibox_zone_find(ev->border->zone); + ibox = _ibox_zone_find(ev->ec->zone); EINA_LIST_FREE(ibox, b) { - ic = _ibox_icon_find(b, ev->border); + ic = _ibox_icon_find(b, ev->ec); if (!ic) continue; _ibox_icon_free(ic); b->icons = eina_list_remove(b->icons, ic); @@ -1036,9 +1032,9 @@ _ibox_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void *e } static Eina_Bool -_ibox_cb_event_border_iconify(void *data __UNUSED__, int type __UNUSED__, void *event) +_ibox_cb_event_client_iconify(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Iconify *ev; + E_Event_Client *ev; IBox *b; IBox_Icon *ic; Eina_List *ibox; @@ -1047,14 +1043,14 @@ _ibox_cb_event_border_iconify(void *data __UNUSED__, int type __UNUSED__, void * ev = event; /* add icon for ibox for right zone */ /* do some sort of anim when iconifying */ - desk = e_desk_current_get(ev->border->zone); - ibox = _ibox_zone_find(ev->border->zone); + desk = e_desk_current_get(ev->ec->zone); + ibox = _ibox_zone_find(ev->ec->zone); EINA_LIST_FREE(ibox, b) { int h, mw, mh; - if (_ibox_icon_find(b, ev->border)) continue; - if ((b->inst->ci->show_desk) && (ev->border->desk != desk) && (!ev->border->sticky)) continue; - ic = _ibox_icon_new(b, ev->border); + if (_ibox_icon_find(b, ev->ec)) continue; + if ((b->inst->ci->show_desk) && (ev->ec->desk != desk) && (!ev->ec->sticky)) continue; + ic = _ibox_icon_new(b, ev->ec); if (!ic) continue; b->icons = eina_list_append(b->icons, ic); e_box_pack_end(b->o_box, ic->o_holder); @@ -1071,9 +1067,9 @@ _ibox_cb_event_border_iconify(void *data __UNUSED__, int type __UNUSED__, void * } static Eina_Bool -_ibox_cb_event_border_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event) +_ibox_cb_event_client_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Uniconify *ev; + E_Event_Client *ev; IBox *b; IBox_Icon *ic; Eina_List *ibox; @@ -1081,11 +1077,11 @@ _ibox_cb_event_border_uniconify(void *data __UNUSED__, int type __UNUSED__, void ev = event; /* del icon for ibox for right zone */ /* do some sort of anim when uniconifying */ - ibox = _ibox_zone_find(ev->border->zone); + ibox = _ibox_zone_find(ev->ec->zone); EINA_LIST_FREE(ibox, b) { int mw, mh, h; - ic = _ibox_icon_find(b, ev->border); + ic = _ibox_icon_find(b, ev->ec); if (!ic) continue; _ibox_icon_free(ic); b->icons = eina_list_remove(b->icons, ic); @@ -1103,43 +1099,25 @@ _ibox_cb_event_border_uniconify(void *data __UNUSED__, int type __UNUSED__, void } static Eina_Bool -_ibox_cb_event_border_icon_change(void *data __UNUSED__, int type __UNUSED__, void *event) +_ibox_cb_event_client_property(void *data __UNUSED__, int type __UNUSED__, E_Event_Client_Property *ev) { - E_Event_Border_Icon_Change *ev; IBox *b; IBox_Icon *ic; Eina_List *ibox; - ev = event; - /* update icon */ - ibox = _ibox_zone_find(ev->border->zone); + if ((ev->property & ~E_CLIENT_PROPERTY_ICON) && (ev->property & ~E_CLIENT_PROPERTY_URGENCY)) return ECORE_CALLBACK_RENEW; + ibox = _ibox_zone_find(ev->ec->zone); EINA_LIST_FREE(ibox, b) { - ic = _ibox_icon_find(b, ev->border); + ic = _ibox_icon_find(b, ev->ec); if (!ic) continue; - _ibox_icon_empty(ic); - _ibox_icon_fill(ic); - } - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_ibox_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - E_Event_Border_Urgent_Change *ev; - IBox *b; - IBox_Icon *ic; - Eina_List *ibox; - - ev = event; - /* update icon */ - ibox = _ibox_zone_find(ev->border->zone); - EINA_LIST_FREE(ibox, b) - { - ic = _ibox_icon_find(b, ev->border); - if (!ic) continue; - if (ev->border->client.icccm.urgent) + if ((ev->property & E_CLIENT_PROPERTY_ICON)) + { + _ibox_icon_empty(ic); + _ibox_icon_fill(ic); + continue; + } + if (ev->ec->icccm.urgent) { e_gadcon_urgent_show(b->inst->gcc->gadcon); edje_object_signal_emit(ic->o_holder, "e,state,urgent", "e"); @@ -1156,13 +1134,13 @@ _ibox_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, } static Eina_Bool -_ibox_cb_event_border_zone_set(void *data __UNUSED__, int type __UNUSED__, void *event) +_ibox_cb_event_client_zone_set(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Zone_Set *ev; + E_Event_Client_Zone_Set *ev; ev = event; /* delete from current zone ibox, add to new one */ - if (ev->border->iconic) + if (ev->ec->iconic) { } return 1; @@ -1295,31 +1273,30 @@ e_modapi_init(E_Module *m) ibox_config->module = m; - E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_BORDER_ADD, _ibox_cb_event_border_add, NULL); - E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_BORDER_REMOVE, _ibox_cb_event_border_remove, NULL); - E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_BORDER_ICONIFY, _ibox_cb_event_border_iconify, NULL); - E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_BORDER_UNICONIFY, _ibox_cb_event_border_uniconify, NULL); - E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_BORDER_ICON_CHANGE, _ibox_cb_event_border_icon_change, NULL); - E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_BORDER_URGENT_CHANGE, _ibox_cb_event_border_urgent_change, NULL); - E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_BORDER_ZONE_SET, _ibox_cb_event_border_zone_set, NULL); + E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_CLIENT_ADD, _ibox_cb_event_client_add, NULL); + E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_CLIENT_REMOVE, _ibox_cb_event_client_remove, NULL); + E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_CLIENT_ICONIFY, _ibox_cb_event_client_iconify, NULL); + E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_CLIENT_UNICONIFY, _ibox_cb_event_client_uniconify, NULL); + E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_CLIENT_PROPERTY, _ibox_cb_event_client_property, NULL); + E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_CLIENT_ZONE_SET, _ibox_cb_event_client_zone_set, NULL); E_LIST_HANDLER_APPEND(ibox_config->handlers, E_EVENT_DESK_SHOW, _ibox_cb_event_desk_show, NULL); /* FIXME: add these later for things taskbar-like functionality ibox_config->handlers = eina_list_append (ibox_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_DESK_SET, _ibox_cb_event_border_zone_set, NULL)); + (E_EVENT_CLIENT_DESK_SET, _ibox_cb_event_client_zone_set, NULL)); ibox_config->handlers = eina_list_append (ibox_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_SHOW, _ibox_cb_event_border_zone_set, NULL)); + (E_EVENT_CLIENT_SHOW, _ibox_cb_event_client_zone_set, NULL)); ibox_config->handlers = eina_list_append (ibox_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_HIDE, _ibox_cb_event_border_zone_set, NULL)); + (E_EVENT_CLIENT_HIDE, _ibox_cb_event_client_zone_set, NULL)); ibox_config->handlers = eina_list_append (ibox_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_STACK, _ibox_cb_event_border_zone_set, NULL)); + (E_EVENT_CLIENT_STACK, _ibox_cb_event_client_zone_set, NULL)); ibox_config->handlers = eina_list_append (ibox_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_STICK, _ibox_cb_event_border_zone_set, NULL)); + (E_EVENT_CLIENT_STICK, _ibox_cb_event_client_zone_set, NULL)); */ e_gadcon_provider_register(&_gadcon_class); return m; diff --git a/src/modules/illume-home/e_mod_config.c b/src/modules/illume-home/e_mod_config.c index 6e8e0b13e..df489fd1d 100644 --- a/src/modules/illume-home/e_mod_config.c +++ b/src/modules/illume-home/e_mod_config.c @@ -92,7 +92,7 @@ il_home_config_save(void) } void -il_home_config_show(E_Container *con, const char *params __UNUSED__) +il_home_config_show(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v = NULL; @@ -107,7 +107,7 @@ il_home_config_show(E_Container *con, const char *params __UNUSED__) v->normal_win = 1; v->scroll = 1; - cfd = e_config_dialog_new(con, _("Home Settings"), "E", + cfd = e_config_dialog_new(comp, _("Home Settings"), "E", "_config_illume_home_settings", "enlightenment/launcher_settings", 0, v, NULL); il_home_cfg->cfd = cfd; diff --git a/src/modules/illume-home/e_mod_config.h b/src/modules/illume-home/e_mod_config.h index b7b04a9ff..5e9eef1b2 100644 --- a/src/modules/illume-home/e_mod_config.h +++ b/src/modules/illume-home/e_mod_config.h @@ -20,7 +20,7 @@ struct _Il_Home_Config int il_home_config_init(E_Module *m); int il_home_config_shutdown(void); int il_home_config_save(void); -void il_home_config_show(E_Container *con, const char *params); +void il_home_config_show(E_Comp *comp, const char *params); extern EAPI Il_Home_Config *il_home_cfg; diff --git a/src/modules/illume-home/e_mod_main.c b/src/modules/illume-home/e_mod_main.c index f5f24d9d8..539fd2e23 100644 --- a/src/modules/illume-home/e_mod_main.c +++ b/src/modules/illume-home/e_mod_main.c @@ -24,7 +24,7 @@ struct _Il_Home_Exec E_Busycover *cover; Efreet_Desktop *desktop; Ecore_Exe *exec; - E_Border *border; + E_Client *client; E_Zone *zone; Ecore_Timer *timeout; int startup_id; @@ -37,7 +37,7 @@ static void _il_home_apps_populate(void); static void _il_home_apps_unpopulate(void); static void _il_home_desks_populate(void); static void _il_home_desktop_run(Il_Home_Win *hwin, Efreet_Desktop *desktop); -static E_Border *_il_home_desktop_find_border(E_Zone *zone, Efreet_Desktop *desktop); +static E_Client *_il_home_desktop_find_border(E_Zone *zone, Efreet_Desktop *desktop); static void _il_home_win_new(E_Zone *zone); static void _il_home_win_cb_free(Il_Home_Win *hwin); static void _il_home_win_cb_resize(E_Win *win); @@ -70,8 +70,8 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Home" }; EAPI void * e_modapi_init(E_Module *m) { - E_Manager *man; - Eina_List *ml; + const Eina_List *l; + E_Comp *comp; if (!il_home_config_init(m)) return NULL; @@ -86,11 +86,11 @@ e_modapi_init(E_Module *m) hdls = eina_list_append(hdls, - ecore_event_handler_add(E_EVENT_BORDER_ADD, + ecore_event_handler_add(E_EVENT_CLIENT_ADD, _il_home_cb_border_add, NULL)); hdls = eina_list_append(hdls, - ecore_event_handler_add(E_EVENT_BORDER_REMOVE, + ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, _il_home_cb_border_del, NULL)); hdls = eina_list_append(hdls, @@ -111,25 +111,19 @@ e_modapi_init(E_Module *m) ecore_event_handler_add(E_EVENT_BG_UPDATE, _il_home_cb_bg_change, NULL)); - EINA_LIST_FOREACH(e_manager_list(), ml, man) + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - E_Container *con; - Eina_List *cl; + E_Zone *zone; + Eina_List *zl; - EINA_LIST_FOREACH(man->containers, cl, con) + EINA_LIST_FOREACH(comp->zones, zl, zone) { - E_Zone *zone; - Eina_List *zl; + Ecore_X_Illume_Mode mode; - EINA_LIST_FOREACH(con->zones, zl, zone) - { - Ecore_X_Illume_Mode mode; - - mode = ecore_x_e_illume_mode_get(zone->black_win); - _il_home_win_new(zone); - if (mode > ECORE_X_ILLUME_MODE_SINGLE) - _il_home_win_new(zone); - } + mode = ecore_x_e_illume_mode_get(zone->black_win); + _il_home_win_new(zone); + if (mode > ECORE_X_ILLUME_MODE_SINGLE) + _il_home_win_new(zone); } } @@ -284,26 +278,26 @@ _il_home_desktop_run(Il_Home_Win *hwin, Efreet_Desktop *desktop) E_Exec_Instance *eins; Il_Home_Exec *exec; Eina_List *l; - E_Border *bd; + E_Client *ec; char buff[4096]; if ((!hwin) || (!desktop) || (!desktop->exec)) return; EINA_LIST_FOREACH(exes, l, exec) { if (exec->desktop != desktop) continue; - if ((exec->border) && (exec->border->zone == hwin->zone)) + if ((exec->client) && (exec->client->zone == hwin->zone)) { - e_border_uniconify(exec->border); - e_border_raise(exec->border); - e_border_focus_set(exec->border, 1, 1); + e_client_uniconify(exec->client); + evas_object_raise(exec->client->frame); + evas_object_focus_set(exec->client->frame, 1); return; } } - if ((bd = _il_home_desktop_find_border(hwin->zone, desktop))) + if ((ec = _il_home_desktop_find_border(hwin->zone, desktop))) { - e_border_uniconify(bd); - e_border_raise(bd); - e_border_focus_set(bd, 1, 1); + e_client_uniconify(ec); + evas_object_raise(ec->frame); + evas_object_focus_set(ec->frame, 1); return; } @@ -326,11 +320,11 @@ _il_home_desktop_run(Il_Home_Win *hwin, Efreet_Desktop *desktop) exes = eina_list_append(exes, exec); } -static E_Border * +static E_Client * _il_home_desktop_find_border(E_Zone *zone, Efreet_Desktop *desktop) { Eina_List *l; - E_Border *bd; + E_Client *ec; char *exe = NULL, *p; if (!desktop) return NULL; @@ -350,34 +344,35 @@ _il_home_desktop_find_border(E_Zone *zone, Efreet_Desktop *desktop) if (p) strcpy(exe, p + 1); } - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { - if (bd->zone != zone) continue; - if (e_exec_startup_id_pid_find(bd->client.netwm.pid, - bd->client.netwm.startup_id) == desktop) + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (e_exec_startup_id_pid_find(ec->netwm.pid, + ec->netwm.startup_id) == desktop) { free(exe); - return bd; + return ec; } if (exe) { - if (bd->client.icccm.command.argv) + if (ec->icccm.command.argv) { char *pp; - pp = strrchr(bd->client.icccm.command.argv[0], '/'); - if (!pp) pp = bd->client.icccm.command.argv[0]; + pp = strrchr(ec->icccm.command.argv[0], '/'); + if (!pp) pp = ec->icccm.command.argv[0]; if (!strcmp(exe, pp)) { free(exe); - return bd; + return ec; } } - if ((bd->client.icccm.name) && - (!strcasecmp(bd->client.icccm.name, exe))) + if ((ec->icccm.name) && + (!strcasecmp(ec->icccm.name, exe))) { free(exe); - return bd; + return ec; } } } @@ -398,7 +393,7 @@ _il_home_win_new(E_Zone *zone) if (!hwin) return; hwin->zone = zone; - hwin->win = e_win_new(zone->container); + hwin->win = e_win_new(zone->comp); if (!hwin->win) { e_object_del(E_OBJECT(hwin)); @@ -417,9 +412,9 @@ _il_home_win_new(E_Zone *zone) 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); hwin->o_bg = edje_object_add(evas); edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background"); @@ -453,7 +448,7 @@ _il_home_win_new(E_Zone *zone) e_win_move_resize(hwin->win, zone->x, zone->y, zone->w, (zone->h / 2)); e_win_show(hwin->win); - e_border_zone_set(hwin->win->border, zone); + e_client_zone_set(hwin->win->client, zone); if (hwin->win->evas_win) e_drop_xdnd_register_set(hwin->win->evas_win, EINA_TRUE); @@ -572,29 +567,29 @@ _il_home_desktop_cache_update(void *data __UNUSED__, int type __UNUSED__, void * static Eina_Bool _il_home_cb_border_add(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Add *ev; + E_Event_Client *ev; Il_Home_Exec *exe; Eina_List *l; ev = event; EINA_LIST_FOREACH(exes, l, exe) { - if (!exe->border) + if (!exe->client) { - if ((exe->startup_id == ev->border->client.netwm.startup_id) || - (exe->pid == ev->border->client.netwm.pid)) + if ((exe->startup_id == ev->ec->netwm.startup_id) || + (exe->pid == ev->ec->netwm.pid)) { - exe->border = ev->border; + exe->client = ev->ec; } } - if (!exe->border) continue; - if (exe->border->zone != exe->zone) + if (!exe->client) continue; + if (exe->client->zone != exe->zone) { - exe->border->zone = exe->zone; - exe->border->x = exe->zone->x; - exe->border->y = exe->zone->y; - exe->border->changes.pos = 1; - BD_CHANGED(exe->border); + exe->client->zone = exe->zone; + exe->client->x = exe->zone->x; + exe->client->y = exe->zone->y; + exe->client->changes.pos = 1; + EC_CHANGED(exe->client); } if (exe->handle) { @@ -610,19 +605,19 @@ _il_home_cb_border_add(void *data __UNUSED__, int type __UNUSED__, void *event) static Eina_Bool _il_home_cb_border_del(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev; + E_Event_Client *ev; Il_Home_Exec *exe; Eina_List *l; ev = event; EINA_LIST_FOREACH(exes, l, exe) { - if (exe->border == ev->border) + if (exe->client == ev->ec) { exe->exec = NULL; if (exe->handle) e_busycover_pop(exe->cover, exe->handle); exe->handle = NULL; - exe->border = NULL; + exe->client = NULL; exes = eina_list_remove(exes, exe); E_FREE(exe); break; @@ -666,7 +661,7 @@ _il_home_cb_exe_timeout(void *data) if (!(exe = data)) return ECORE_CALLBACK_CANCEL; if (exe->handle) e_busycover_pop(exe->cover, exe->handle); exe->handle = NULL; - if (!exe->border) + if (!exe->client) { exes = eina_list_remove(exes, exe); if (exe->desktop) efreet_desktop_free(exe->desktop); @@ -693,14 +688,14 @@ _il_home_cb_client_message(void *data __UNUSED__, int type __UNUSED__, void *eve } else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_HOME_DEL) { - E_Border *bd; + E_Client *ec; Eina_List *l; Il_Home_Win *hwin; - if (!(bd = e_border_find_by_client_window(ev->win))) return ECORE_CALLBACK_PASS_ON; + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->win))) return ECORE_CALLBACK_PASS_ON; EINA_LIST_FOREACH(hwins, l, hwin) { - if (hwin->win->border == bd) + if (hwin->win->client == ec) { hwins = eina_list_remove_list(hwins, hwins); e_object_del(E_OBJECT(hwin)); @@ -747,9 +742,9 @@ _il_home_cb_bg_change(void *data __UNUSED__, int type, void *event __UNUSED__) zone = hwin->zone; 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); edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background"); eina_stringshare_del(bgfile); } diff --git a/src/modules/illume-indicator/e_mod_ind_win.c b/src/modules/illume-indicator/e_mod_ind_win.c index ae549d866..f7ec45ea6 100644 --- a/src/modules/illume-indicator/e_mod_ind_win.c +++ b/src/modules/illume-indicator/e_mod_ind_win.c @@ -36,7 +36,7 @@ e_mod_ind_win_new(E_Zone *zone) iwin->zone = zone; /* create new window */ - iwin->win = e_win_new(zone->container); + iwin->win = e_win_new(zone->comp); iwin->win->data = iwin; /* set some properties on the window */ @@ -130,14 +130,14 @@ e_mod_ind_win_new(E_Zone *zone) e_win_show(iwin->win); /* set this window on proper zone */ - e_border_zone_set(iwin->win->border, zone); - iwin->win->border->user_skip_winlist = 1; - iwin->win->border->lock_focus_in = 1; - iwin->win->border->lock_focus_out = 1; + e_client_zone_set(iwin->win->client, zone); + iwin->win->client->user_skip_winlist = 1; + iwin->win->client->lock_focus_in = 1; + iwin->win->client->lock_focus_out = 1; /* set this window to be a dock window. This needs to be done after show * as E will sometimes reset the window type */ - ecore_x_netwm_window_type_set(iwin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK); + ecore_x_netwm_window_type_set(iwin->win->evas_win, E_WINDOW_TYPE_DOCK); /* tell conformant apps our position and size */ ecore_x_e_illume_indicator_geometry_set(zone->black_win, zone->x, zone->y, @@ -195,7 +195,7 @@ _e_mod_ind_win_cb_win_prop(void *data, int type __UNUSED__, void *event) ev = event; if (!(iwin = data)) return ECORE_CALLBACK_PASS_ON; - if (ev->win != iwin->win->container->manager->root) + if (ev->win != iwin->win->comp->man->root) return ECORE_CALLBACK_PASS_ON; if (ev->atom != ATM_ENLIGHTENMENT_SCALE) return ECORE_CALLBACK_PASS_ON; @@ -208,7 +208,7 @@ _e_mod_ind_win_cb_win_prop(void *data, int type __UNUSED__, void *event) /* NB: Not sure why, but we need to tell this border to fetch icccm * size position hints now :( (NOTE: This was not needed a few days ago) * If we do not do this, than indicator does not change w/ scale anymore */ - iwin->win->border->client.icccm.fetch.size_pos_hints = 1; + iwin->win->client->icccm.fetch.size_pos_hints = 1; /* resize this window */ e_win_resize(iwin->win, iwin->zone->w, mh); @@ -269,12 +269,12 @@ _e_mod_ind_win_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj iwin->mouse_down = 1; /* make sure we can drag */ - if (iwin->win->border->client.illume.drag.locked) return; + if (iwin->win->client->illume.drag.locked) return; iwin->drag.start = 1; iwin->drag.dnd = 0; iwin->drag.y = ev->output.y; - iwin->drag.by = iwin->win->border->y; + iwin->drag.by = iwin->win->client->y; } else if (ev->button == 3) { @@ -312,32 +312,32 @@ _e_mod_ind_win_cb_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj _ { Ecore_X_Window xwin; - xwin = iwin->win->border->zone->black_win; + xwin = iwin->win->client->zone->black_win; ecore_x_e_illume_quickpanel_state_toggle(xwin); } else if (iwin->drag.dnd) { - E_Border *bd; + E_Client *ec; - bd = iwin->win->border; + ec = iwin->win->client; /* reset mouse pointer */ - e_pointer_type_pop(e_comp_get(bd)->pointer, bd, "move"); + e_pointer_type_pop(e_comp_get(ec)->pointer, ec, "move"); /* tell edj we are done moving */ edje_object_signal_emit(iwin->o_base, "e,action,move,stop", "e"); /* send message that we are done dragging */ - ecore_x_e_illume_drag_end_send(bd->client.win); + ecore_x_e_illume_drag_end_send(e_client_util_win_get(ec)); /* update quickpanel position if needed */ - if (bd->y != iwin->drag.by) - ecore_x_e_illume_quickpanel_position_update_send(bd->client.win); + if (ec->y != iwin->drag.by) + ecore_x_e_illume_quickpanel_position_update_send(e_client_util_win_get(ec)); /* tell conformant apps our position and size */ ecore_x_e_illume_indicator_geometry_set(iwin->zone->black_win, - bd->x, bd->y, - bd->w, bd->h); + ec->x, ec->y, + ec->w, ec->h); } iwin->drag.start = 0; iwin->drag.dnd = 0; @@ -351,11 +351,11 @@ _e_mod_ind_win_cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj { Ind_Win *iwin; Evas_Event_Mouse_Move *ev; - E_Border *bd; + E_Client *ec; ev = event; if (!(iwin = data)) return; - bd = iwin->win->border; + ec = iwin->win->client; if (iwin->drag.start) { iwin->drag.dnd = 1; @@ -363,17 +363,17 @@ _e_mod_ind_win_cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj /* change mouse pointer to indicate we are dragging */ e_pointer_type_push(e_comp_get(iwin->win)->pointer, - iwin->win->border, "move"); + iwin->win->client, "move"); /* tell edj we are going to start moving */ edje_object_signal_emit(iwin->o_base, "e,action,move,start", "e"); /* tell quickpanel to hide because we are going to drag */ - ecore_x_e_illume_quickpanel_state_send(bd->zone->black_win, + ecore_x_e_illume_quickpanel_state_send(ec->zone->black_win, ECORE_X_ILLUME_QUICKPANEL_STATE_OFF); /* send message that we are going to start dragging */ - ecore_x_e_illume_drag_start_send(bd->client.win); + ecore_x_e_illume_drag_start_send(e_client_util_win_get(ec)); } /* make sure we are dragging */ @@ -385,7 +385,7 @@ _e_mod_ind_win_cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj py = ev->cur.output.y; /* do moves in 'chunks' of screen size */ - dy = ((bd->zone->h - bd->h) / 8); + dy = ((ec->zone->h - ec->h) / 8); /* are we moving up or down ? */ if (ev->cur.output.y > ev->prev.output.y) @@ -401,23 +401,23 @@ _e_mod_ind_win_cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj else return; if (py > iwin->drag.y) - ny = bd->y + dy; + ny = ec->y + dy; else if (py < iwin->drag.y) - ny = bd->y - dy; + ny = ec->y - dy; else return; /* make sure we don't drag off the screen */ if (ny < iwin->zone->y) ny = iwin->zone->y; - else if ((ny + bd->h) > (iwin->zone->y + iwin->zone->h)) + else if ((ny + ec->h) > (iwin->zone->y + iwin->zone->h)) return; /* move the border if we need to */ - if (bd->y != ny) + if (ec->y != ny) { - bd->y = ny; - bd->changes.pos = 1; - BD_CHANGED(bd); + ec->y = ny; + ec->changes.pos = 1; + EC_CHANGED(ec); e_win_move(iwin->win, iwin->win->x, ny); } } diff --git a/src/modules/illume-indicator/e_mod_main.c b/src/modules/illume-indicator/e_mod_main.c index f79299702..15ee34aeb 100644 --- a/src/modules/illume-indicator/e_mod_main.c +++ b/src/modules/illume-indicator/e_mod_main.c @@ -18,8 +18,8 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume-Indicator" }; EAPI void * e_modapi_init(E_Module *m) { - E_Manager *man; - Eina_List *ml; + const Eina_List *l; + E_Comp *comp; /* set module priority so we load before others */ e_module_priority_set(m, 90); @@ -49,30 +49,22 @@ e_modapi_init(E_Module *m) } #endif - /* loop through the managers (root windows) */ - EINA_LIST_FOREACH(e_manager_list(), ml, man) + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - E_Container *con; - Eina_List *cl; + E_Zone *zone; + Eina_List *zl; - /* loop through containers */ - EINA_LIST_FOREACH(man->containers, cl, con) + /* TODO: Make this configurable so illume2 can be run + * on just one zone/screen/etc */ + + /* for each zone, create an indicator window */ + EINA_LIST_FOREACH(comp->zones, zl, zone) { - E_Zone *zone; - Eina_List *zl; + Ind_Win *iwin; - /* TODO: Make this configurable so illume2 can be run - * on just one zone/screen/etc */ - - /* for each zone, create an indicator window */ - EINA_LIST_FOREACH(con->zones, zl, zone) - { - Ind_Win *iwin; - - /* try to create new indicator window */ - if (!(iwin = e_mod_ind_win_new(zone))) continue; - iwins = eina_list_append(iwins, iwin); - } + /* try to create new indicator window */ + if (!(iwin = e_mod_ind_win_new(zone))) continue; + iwins = eina_list_append(iwins, iwin); } } diff --git a/src/modules/illume-indicator/e_mod_notify.c b/src/modules/illume-indicator/e_mod_notify.c index 75d7b843b..7f655f0dd 100644 --- a/src/modules/illume-indicator/e_mod_notify.c +++ b/src/modules/illume-indicator/e_mod_notify.c @@ -180,7 +180,7 @@ _e_mod_notify_new(E_Notification_Notify *n, unsigned id) zone = e_util_zone_current_get(e_manager_current_get()); nwin->zone = zone; - nwin->win = e_win_new(zone->container); + nwin->win = e_win_new(zone->comp); nwin->win->data = nwin; e_win_name_class_set(nwin->win, "Illume-Notify", "Illume-Notify"); @@ -214,8 +214,8 @@ _e_mod_notify_new(E_Notification_Notify *n, unsigned id) _e_mod_notify_refresh(nwin); e_win_show(nwin->win); - e_border_zone_set(nwin->win->border, zone); - nwin->win->border->user_skip_winlist = 1; + e_client_zone_set(nwin->win->client, zone); + nwin->win->client->user_skip_winlist = 1; return nwin; } diff --git a/src/modules/illume-kbd-toggle/e_mod_main.c b/src/modules/illume-kbd-toggle/e_mod_main.c index ee5accd51..eafb8f43f 100644 --- a/src/modules/illume-kbd-toggle/e_mod_main.c +++ b/src/modules/illume-kbd-toggle/e_mod_main.c @@ -83,11 +83,11 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) inst->handlers = eina_list_append(inst->handlers, - ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN, + ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_IN, _cb_border_focus_in, inst)); inst->handlers = eina_list_append(inst->handlers, - ecore_event_handler_add(E_EVENT_BORDER_REMOVE, + ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, _cb_border_remove, inst)); inst->handlers = eina_list_append(inst->handlers, @@ -151,14 +151,14 @@ static void _cb_action_vkbd_enable(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { Instance *inst; - E_Border *bd; + E_Client *ec; if (!(inst = data)) return; - if (!(bd = e_border_focused_get())) return; - if (bd->zone != inst->gcc->gadcon->zone) return; - if (bd->client.vkbd.state >= ECORE_X_VIRTUAL_KEYBOARD_STATE_ON) return; + if (!(ec = e_client_focused_get())) return; + if (ec->zone != inst->gcc->gadcon->zone) return; + if (ec->vkbd.state >= ECORE_X_VIRTUAL_KEYBOARD_STATE_ON) return; - ecore_x_e_virtual_keyboard_state_set(bd->client.win, + ecore_x_e_virtual_keyboard_state_set(e_client_util_win_get(ec), ECORE_X_VIRTUAL_KEYBOARD_STATE_ON); } @@ -166,14 +166,14 @@ static void _cb_action_vkbd_disable(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { Instance *inst; - E_Border *bd; + E_Client *ec; if (!(inst = data)) return; - if (!(bd = e_border_focused_get())) return; - if (bd->zone != inst->gcc->gadcon->zone) return; - if (bd->client.vkbd.state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) return; + if (!(ec = e_client_focused_get())) return; + if (ec->zone != inst->gcc->gadcon->zone) return; + if (ec->vkbd.state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) return; - ecore_x_e_virtual_keyboard_state_set(bd->client.win, + ecore_x_e_virtual_keyboard_state_set(e_client_util_win_get(ec), ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF); } @@ -181,15 +181,15 @@ static Eina_Bool _cb_border_focus_in(void *data, int type __UNUSED__, void *event) { Instance *inst; - E_Event_Border_Focus_In *ev; - E_Border *bd; + E_Event_Client *ev; + E_Client *ec; if (!(inst = data)) return ECORE_CALLBACK_PASS_ON; ev = event; - if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON; - if (!(bd = ev->border)) return ECORE_CALLBACK_PASS_ON; - if (bd->zone != inst->gcc->gadcon->zone) return ECORE_CALLBACK_PASS_ON; - _set_btn_icon(inst->o_toggle, bd->client.vkbd.state); + if (ev->ec->stolen) return ECORE_CALLBACK_PASS_ON; + if (!(ec = ev->ec)) return ECORE_CALLBACK_PASS_ON; + if (ec->zone != inst->gcc->gadcon->zone) return ECORE_CALLBACK_PASS_ON; + _set_btn_icon(inst->o_toggle, ec->vkbd.state); return ECORE_CALLBACK_PASS_ON; } @@ -208,17 +208,17 @@ _cb_border_property(void *data, int type __UNUSED__, void *event) { Instance *inst; Ecore_X_Event_Window_Property *ev; - E_Border *bd; + E_Client *ec; ev = event; if (ev->atom != ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE) return ECORE_CALLBACK_PASS_ON; - if (!(bd = e_border_find_by_client_window(ev->win))) + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->win))) return ECORE_CALLBACK_PASS_ON; - if (!bd->focused) return ECORE_CALLBACK_PASS_ON; + if (!ec->focused) return ECORE_CALLBACK_PASS_ON; if (!(inst = data)) return ECORE_CALLBACK_PASS_ON; - if (bd->zone != inst->gcc->gadcon->zone) return ECORE_CALLBACK_PASS_ON; - _set_btn_icon(inst->o_toggle, bd->client.vkbd.state); + if (ec->zone != inst->gcc->gadcon->zone) return ECORE_CALLBACK_PASS_ON; + _set_btn_icon(inst->o_toggle, ec->vkbd.state); return ECORE_CALLBACK_PASS_ON; } diff --git a/src/modules/illume-keyboard/e_kbd_int.c b/src/modules/illume-keyboard/e_kbd_int.c index 9ac965ee0..180f762f1 100644 --- a/src/modules/illume-keyboard/e_kbd_int.c +++ b/src/modules/illume-keyboard/e_kbd_int.c @@ -505,7 +505,8 @@ _e_kbd_int_zoomkey_down(E_Kbd_Int *ki) const Eina_List *l; if (!ki->zoomkey.popup) return; - e_object_del(E_OBJECT(ki->zoomkey.popup)); + evas_object_hide(ki->zoomkey.popup); + evas_object_del(ki->zoomkey.popup); ki->zoomkey.popup = NULL; ki->zoomkey.layout_obj = NULL; ki->zoomkey.sublayout_obj = NULL; @@ -528,14 +529,12 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki) int sx, sy, sw, sh; if (ki->zoomkey.popup) return; - ki->zoomkey.popup = e_popup_new(ki->win->border->zone, -1, -1, 1, 1); - e_popup_layer_set(ki->zoomkey.popup, E_COMP_CANVAS_LAYER_LAYOUT, 190); - o = _theme_obj_new(ki->zoomkey.popup->evas, ki->themedir, + o = _theme_obj_new(e_comp_get(ki->win)->evas, ki->themedir, "e/modules/kbd/zoom/default"); ki->zoomkey.base_obj = o; - o = e_layout_add(ki->zoomkey.popup->evas); + o = e_layout_add(e_comp_get(ki->win)->evas); e_layout_virtual_size_set(o, 100, 100); edje_object_part_swallow(ki->zoomkey.base_obj, "e.swallow.content", o); evas_object_show(o); @@ -543,7 +542,7 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki) e_layout_virtual_size_get(ki->layout_obj, &vw, &vh); - o = e_layout_add(ki->zoomkey.popup->evas); + o = e_layout_add(e_comp_get(ki->win)->evas); e_layout_virtual_size_set(o, vw, vh); e_layout_pack(ki->zoomkey.layout_obj, o); e_layout_child_move(o, 0, 0); @@ -561,7 +560,7 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki) int selected; ky = l->data; - o = _theme_obj_new(ki->zoomkey.popup->evas, ki->themedir, + o = _theme_obj_new(e_comp_get(ki->win)->evas, ki->themedir, "e/modules/kbd/zoomkey/default"); label = ""; icon = NULL; @@ -574,7 +573,7 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki) edje_object_part_text_set(o, "e.text.label", label); - o2 = e_icon_add(ki->zoomkey.popup->evas); + o2 = e_icon_add(e_comp_get(ki->win)->evas); e_icon_fill_inside_set(o2, 1); // e_icon_scale_up_set(o2, 0); edje_object_part_swallow(o, "e.swallow.content", o2); @@ -613,21 +612,18 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki) } edje_object_size_min_calc(ki->zoomkey.base_obj, &vw, &vh); - e_zone_useful_geometry_get(ki->win->border->zone, &sx, &sy, &sw, &sh); + e_zone_useful_geometry_get(ki->win->client->zone, &sx, &sy, &sw, &sh); sh -= ki->win->h; mw = sw; if ((vw > 0) && (mw > vw)) mw = vw; mh = sh; if ((vh > 0) && (mh > vh)) mh = vh; - e_popup_move_resize(ki->zoomkey.popup, + ki->zoomkey.popup = e_comp_object_util_add(ki->zoomkey.base_obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(ki->zoomkey.popup, E_LAYER_CLIENT_EDGE); + evas_object_geometry_set(ki->zoomkey.popup, sx + ((sw - mw) / 2), sy + ((sh - mh) / 2), mw, mh); - evas_object_resize(ki->zoomkey.base_obj, - ki->zoomkey.popup->w, ki->zoomkey.popup->h); - evas_object_show(ki->zoomkey.base_obj); - e_popup_content_set(ki->zoomkey.popup, ki->zoomkey.base_obj); - e_popup_show(ki->zoomkey.popup); - e_popup_layer_set(ki->zoomkey.popup, E_COMP_CANVAS_LAYER_LAYOUT, 190); + evas_object_show(ki->zoomkey.popup); } static void @@ -1410,7 +1406,8 @@ _e_kbd_int_dictlist_down(E_Kbd_Int *ki) char *str; if (!ki->dictlist.popup) return; - e_object_del(E_OBJECT(ki->dictlist.popup)); + evas_object_hide(ki->dictlist.popup); + evas_object_del(ki->dictlist.popup); ki->dictlist.popup = NULL; EINA_LIST_FREE(ki->dictlist.matches, str) eina_stringshare_del(str); @@ -1452,14 +1449,11 @@ _e_kbd_int_dictlist_up(E_Kbd_Int *ki) if (ki->dictlist.popup) return; - ki->dictlist.popup = e_popup_new(ki->win->border->zone, -1, -1, 1, 1); - e_popup_layer_set(ki->dictlist.popup, E_COMP_CANVAS_LAYER_LAYOUT, 190); - - o = _theme_obj_new(ki->dictlist.popup->evas, ki->themedir, + o = _theme_obj_new(e_comp_get(ki->win)->evas, ki->themedir, "e/modules/kbd/match/default"); ki->dictlist.base_obj = o; - o = e_widget_ilist_add(ki->dictlist.popup->evas, + o = e_widget_ilist_add(e_comp_get(ki->win)->evas, (32 * e_scale), (32 * e_scale), NULL); e_widget_ilist_selector_set(o, 1); e_widget_ilist_freeze(o); @@ -1545,16 +1539,15 @@ _e_kbd_int_dictlist_up(E_Kbd_Int *ki) ki->dictlist.ilist_obj); edje_object_size_min_calc(ki->dictlist.base_obj, &mw, &mh); - e_zone_useful_geometry_get(ki->win->border->zone, NULL, NULL, NULL, &sh); + e_zone_useful_geometry_get(ki->win->client->zone, NULL, NULL, NULL, &sh); mw = ki->win->w; if (mh > (sh - ki->win->h)) mh = (sh - ki->win->h); - e_popup_move_resize(ki->dictlist.popup, 0, ki->win->y - mh, mw, mh); - evas_object_resize(ki->dictlist.base_obj, - ki->dictlist.popup->w, ki->dictlist.popup->h); - evas_object_show(ki->dictlist.base_obj); - e_popup_content_set(ki->dictlist.popup, ki->dictlist.base_obj); - e_popup_show(ki->dictlist.popup); + ki->dictlist.popup = e_comp_object_util_add(ki->dictlist.base_obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(ki->dictlist.popup, E_LAYER_CLIENT_EDGE); + evas_object_geometry_set(ki->dictlist.popup, 0, ki->win->y - mh, mw, mh); + + evas_object_show(ki->dictlist.popup); _e_kbd_int_matchlist_down(ki); } @@ -1564,7 +1557,8 @@ _e_kbd_int_matchlist_down(E_Kbd_Int *ki) char *str; if (!ki->matchlist.popup) return; - e_object_del(E_OBJECT(ki->matchlist.popup)); + evas_object_hide(ki->matchlist.popup); + evas_object_del(ki->matchlist.popup); ki->matchlist.popup = NULL; EINA_LIST_FREE(ki->matchlist.matches, str) eina_stringshare_del(str); @@ -1599,14 +1593,12 @@ _e_kbd_int_matchlist_up(E_Kbd_Int *ki) if (!e_kbd_buf_string_matches_get(ki->kbuf)) return; if (ki->matchlist.popup) return; - ki->matchlist.popup = e_popup_new(ki->win->border->zone, -1, -1, 1, 1); - e_popup_layer_set(ki->matchlist.popup, E_COMP_CANVAS_LAYER_LAYOUT, 190); - o = _theme_obj_new(ki->matchlist.popup->evas, ki->themedir, + o = _theme_obj_new(e_comp_get(ki->win)->evas, ki->themedir, "e/modules/kbd/match/default"); ki->matchlist.base_obj = o; - o = e_widget_ilist_add(ki->matchlist.popup->evas, + o = e_widget_ilist_add(e_comp_get(ki->win)->evas, (32 * e_scale), (32 * e_scale), NULL); e_widget_ilist_selector_set(o, 1); ki->matchlist.ilist_obj = o; @@ -1649,16 +1641,14 @@ _e_kbd_int_matchlist_up(E_Kbd_Int *ki) edje_extern_object_min_size_set(ki->matchlist.ilist_obj, 0, 0); edje_object_part_swallow(ki->matchlist.base_obj, "e.swallow.content", ki->matchlist.ilist_obj); - e_zone_useful_geometry_get(ki->win->border->zone, NULL, NULL, NULL, &sh); + e_zone_useful_geometry_get(ki->win->client->zone, NULL, NULL, NULL, &sh); mw = ki->win->w; if (mh > (sh - ki->win->h)) mh = (sh - ki->win->h); - e_popup_move_resize(ki->matchlist.popup, + ki->matchlist.popup = e_comp_object_util_add(ki->matchlist.base_obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(ki->matchlist.popup, E_LAYER_CLIENT_EDGE); + evas_object_geometry_set(ki->matchlist.popup, ki->win->x, ki->win->y - mh, mw, mh); - evas_object_resize(ki->matchlist.base_obj, - ki->matchlist.popup->w, ki->matchlist.popup->h); - evas_object_show(ki->matchlist.base_obj); - e_popup_content_set(ki->matchlist.popup, ki->matchlist.base_obj); - e_popup_show(ki->matchlist.popup); + evas_object_show(ki->matchlist.popup); _e_kbd_int_dictlist_down(ki); } @@ -1736,7 +1726,7 @@ e_kbd_int_new(const char *themedir, const char *syskbds, const char *sysdicts) if (syskbds) ki->syskbds = eina_stringshare_add(syskbds); if (sysdicts) ki->sysdicts = eina_stringshare_add(sysdicts); zone = e_util_zone_current_get(e_manager_current_get()); - ki->win = e_win_new(zone->container); + ki->win = e_win_new(zone->comp); states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER; ecore_x_netwm_window_state_set(ki->win->evas_win, states, 2); @@ -1813,13 +1803,13 @@ e_kbd_int_new(const char *themedir, const char *syskbds, const char *sysdicts) ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _e_kbd_int_cb_client_message, ki); ki->kbd_move_hdl = - ecore_event_handler_add(E_EVENT_BORDER_MOVE, + ecore_event_handler_add(E_EVENT_CLIENT_MOVE, _e_kbd_int_cb_border_move, ki); e_win_show(ki->win); - ki->win->border->user_skip_winlist = 1; - ki->win->border->lock_focus_in = 1; - ki->win->border->lock_focus_out = 1; + ki->win->client->user_skip_winlist = 1; + ki->win->client->lock_focus_in = 1; + ki->win->client->lock_focus_out = 1; return ki; } @@ -1866,12 +1856,12 @@ _theme_obj_new(Evas *e, const char *custom_dir, const char *group) static Eina_Bool _e_kbd_int_cb_border_move(void *data, int type __UNUSED__, void *event) { - E_Event_Border_Move *ev; + E_Event_Client *ev; E_Kbd_Int *ki; ev = event; if (!(ki = data)) return ECORE_CALLBACK_PASS_ON; - if (ki->win->border != ev->border) return ECORE_CALLBACK_PASS_ON; + if (ki->win->client != ev->ec) return ECORE_CALLBACK_PASS_ON; _e_kbd_int_zoomkey_down(ki); _e_kbd_int_matchlist_down(ki); _e_kbd_int_dictlist_down(ki); diff --git a/src/modules/illume-keyboard/e_kbd_int.h b/src/modules/illume-keyboard/e_kbd_int.h index 033a89149..f8ada480b 100644 --- a/src/modules/illume-keyboard/e_kbd_int.h +++ b/src/modules/illume-keyboard/e_kbd_int.h @@ -63,21 +63,21 @@ struct _E_Kbd_Int unsigned char zoom : 1; } down; struct { - E_Popup *popup; + Evas_Object *popup; Evas_Object *base_obj, *ilist_obj; } layoutlist; struct { - E_Popup *popup; + Evas_Object *popup; Evas_Object *base_obj, *ilist_obj; Eina_List *matches; } matchlist; struct { - E_Popup *popup; + Evas_Object *popup; Evas_Object *base_obj, *ilist_obj; Eina_List *matches; } dictlist; struct { - E_Popup *popup; + Evas_Object *popup; Evas_Object *base_obj, *layout_obj, *sublayout_obj; E_Kbd_Int_Key *pressed; } zoomkey; diff --git a/src/modules/illume-keyboard/e_mod_config.c b/src/modules/illume-keyboard/e_mod_config.c index 561166d73..234bda67f 100644 --- a/src/modules/illume-keyboard/e_mod_config.c +++ b/src/modules/illume-keyboard/e_mod_config.c @@ -110,7 +110,7 @@ il_kbd_config_save(void) } EAPI void -il_kbd_config_show(E_Container *con, const char *params __UNUSED__) +il_kbd_config_show(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -125,7 +125,7 @@ il_kbd_config_show(E_Container *con, const char *params __UNUSED__) v->normal_win = 1; v->scroll = 1; - cfd = e_config_dialog_new(con, _("Keyboard Settings"), "E", + cfd = e_config_dialog_new(comp, _("Keyboard Settings"), "E", "_config_illume_keyboard_settings", "enlightenment/keyboard_settings", 0, v, NULL); il_kbd_cfg->cfd = cfd; diff --git a/src/modules/illume-keyboard/e_mod_config.h b/src/modules/illume-keyboard/e_mod_config.h index d529a3f5d..403c6afff 100644 --- a/src/modules/illume-keyboard/e_mod_config.h +++ b/src/modules/illume-keyboard/e_mod_config.h @@ -28,7 +28,7 @@ EAPI int il_kbd_config_init(E_Module *m); EAPI int il_kbd_config_shutdown(void); EAPI int il_kbd_config_save(void); -EAPI void il_kbd_config_show(E_Container *con, const char *params); +EAPI void il_kbd_config_show(E_Comp *comp, const char *params); extern EAPI Il_Kbd_Config *il_kbd_cfg; diff --git a/src/modules/illume-softkey/e_mod_main.c b/src/modules/illume-softkey/e_mod_main.c index 4ccf737b0..801343a38 100644 --- a/src/modules/illume-softkey/e_mod_main.c +++ b/src/modules/illume-softkey/e_mod_main.c @@ -14,8 +14,8 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume-Softkey" }; EAPI void * e_modapi_init(E_Module *m) { - E_Manager *man; - Eina_List *ml; + const Eina_List *l; + E_Comp *comp; /* set module priority so we load before others */ e_module_priority_set(m, 85); @@ -32,27 +32,19 @@ e_modapi_init(E_Module *m) return NULL; } - /* loop through the managers (root windows) */ - EINA_LIST_FOREACH(e_manager_list(), ml, man) + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - E_Container *con; - Eina_List *cl; + E_Zone *zone; + Eina_List *zl; - /* loop through containers */ - EINA_LIST_FOREACH(man->containers, cl, con) + /* for each zone, create a softkey window */ + EINA_LIST_FOREACH(comp->zones, zl, zone) { - E_Zone *zone; - Eina_List *zl; + Sft_Win *swin; - /* for each zone, create a softkey window */ - EINA_LIST_FOREACH(con->zones, zl, zone) - { - Sft_Win *swin; - - /* try to create new softkey window */ - if (!(swin = e_mod_sft_win_new(zone))) continue; - swins = eina_list_append(swins, swin); - } + /* try to create new softkey window */ + if (!(swin = e_mod_sft_win_new(zone))) continue; + swins = eina_list_append(swins, swin); } } diff --git a/src/modules/illume-softkey/e_mod_sft_win.c b/src/modules/illume-softkey/e_mod_sft_win.c index 5937d5908..c2fd2d04a 100644 --- a/src/modules/illume-softkey/e_mod_sft_win.c +++ b/src/modules/illume-softkey/e_mod_sft_win.c @@ -16,7 +16,7 @@ static void _e_mod_sft_win_cb_forward(void *data, void *data2 __UNUSED__); static void _e_mod_sft_win_cb_win_pos(void *data, void *data2 __UNUSED__); static void _e_mod_sft_win_pos_toggle_top(Sft_Win *swin); static void _e_mod_sft_win_pos_toggle_left(Sft_Win *swin); -static E_Border *_e_mod_sft_win_border_get(E_Zone *zone, int x, int y); +static E_Client *_e_mod_sft_win_border_get(E_Zone *zone, int x, int y); Sft_Win * e_mod_sft_win_new(E_Zone *zone) @@ -45,7 +45,7 @@ e_mod_sft_win_new(E_Zone *zone) swin)); /* create new window */ - swin->win = e_win_new(zone->container); + swin->win = e_win_new(zone->comp); swin->win->data = swin; /* set some properties on the window */ @@ -100,15 +100,15 @@ e_mod_sft_win_new(E_Zone *zone) /* show the window */ e_win_show(swin->win); - e_border_zone_set(swin->win->border, zone); - swin->win->border->user_skip_winlist = 1; + e_client_zone_set(swin->win->client, zone); + swin->win->client->user_skip_winlist = 1; - swin->win->border->lock_focus_in = 1; - swin->win->border->lock_focus_out = 1; + swin->win->client->lock_focus_in = 1; + swin->win->client->lock_focus_out = 1; /* set this window to be a dock window. This needs to be done after show * as E will sometimes reset the window type */ - ecore_x_netwm_window_type_set(swin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK); + ecore_x_netwm_window_type_set(swin->win->evas_win, E_WINDOW_TYPE_DOCK); /* tell conformant apps our position and size */ ecore_x_e_illume_softkey_geometry_set(zone->black_win, @@ -179,7 +179,7 @@ _e_mod_sft_win_cb_win_prop(void *data, int type __UNUSED__, void *event) ev = event; if (!(swin = data)) return ECORE_CALLBACK_PASS_ON; - if (ev->win != swin->win->container->manager->root) + if (ev->win != swin->win->comp->man->root) return ECORE_CALLBACK_PASS_ON; if (ev->atom != ATM_ENLIGHTENMENT_SCALE) return ECORE_CALLBACK_PASS_ON; @@ -189,7 +189,7 @@ _e_mod_sft_win_cb_win_prop(void *data, int type __UNUSED__, void *event) /* NB: Not sure why, but we need to tell this border to fetch icccm * size position hints now :( (NOTE: This was not needed a few days ago) * If we do not do this, than softkey does not change w/ scale anymore */ - swin->win->border->client.icccm.fetch.size_pos_hints = 1; + swin->win->client->icccm.fetch.size_pos_hints = 1; /* resize this window */ e_win_resize(swin->win, swin->zone->w, (il_sft_cfg->height * e_scale)); @@ -393,7 +393,7 @@ _e_mod_sft_win_cb_win_pos(void *data, void *data2 __UNUSED__) static void _e_mod_sft_win_pos_toggle_top(Sft_Win *swin) { - E_Border *t, *b; + E_Client *t, *b; int y, h, tpos, bpos; if (!swin) return; @@ -415,14 +415,14 @@ _e_mod_sft_win_pos_toggle_top(Sft_Win *swin) t = _e_mod_sft_win_border_get(swin->zone, swin->zone->x, tpos); b = _e_mod_sft_win_border_get(swin->zone, swin->zone->x, bpos); - if (t) e_border_move(t, t->x, bpos); - if (b) e_border_move(b, b->x, tpos); + if (t) evas_object_move(t->frame, t->x, bpos); + if (b) evas_object_move(b->frame, b->x, tpos); } static void _e_mod_sft_win_pos_toggle_left(Sft_Win *swin) { - E_Border *l, *r; + E_Client *l, *r; int h, lpos, rpos; if (!swin) return; @@ -437,25 +437,26 @@ _e_mod_sft_win_pos_toggle_left(Sft_Win *swin) l = _e_mod_sft_win_border_get(swin->zone, lpos, h); r = _e_mod_sft_win_border_get(swin->zone, rpos, h); - if (l) e_border_move(l, rpos, l->y); - if (r) e_border_move(r, lpos, r->y); + if (l) evas_object_move(l->frame, rpos, l->y); + if (r) evas_object_move(r->frame, lpos, r->y); } -static E_Border * +static E_Client * _e_mod_sft_win_border_get(E_Zone *zone, int x, int y) { Eina_List *l; - E_Border *bd; + E_Client *ec; if (!zone) return NULL; - EINA_LIST_REVERSE_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_REVERSE_FOREACH(zone->comp->clients, l, ec) { - if (bd->zone != zone) continue; - if (!bd->visible) continue; - if ((bd->x != x) || (bd->y != y)) continue; - if (bd->client.illume.quickpanel.quickpanel) continue; + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (!ec->visible) continue; + if ((ec->x != x) || (ec->y != y)) continue; + if (ec->illume.quickpanel.quickpanel) continue; - return bd; + return ec; } return NULL; } diff --git a/src/modules/illume2/e_illume.c b/src/modules/illume2/e_illume.c index 96d21a667..09644ac0a 100644 --- a/src/modules/illume2/e_illume.c +++ b/src/modules/illume2/e_illume.c @@ -56,32 +56,32 @@ e_illume_zone_config_get(int id) /** * Determine if a given border is an Indicator window. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is an Indicator window, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @note It is assumed that Indicator windows are of type - * ECORE_X_WINDOW_TYPE_DOCK. + * E_WINDOW_TYPE_DOCK. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_indicator(E_Border *bd) +e_illume_client_is_indicator(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* indicator windows should be set to dock type, so check for that */ - if (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) return EINA_FALSE; + if (ec->netwm.type != E_WINDOW_TYPE_DOCK) return EINA_FALSE; /* we have a dock window, check against any matches in config */ /* check if we are matching on name */ if (_e_illume_cfg->policy.indicator.match.name) { - if ((bd->client.icccm.name) && - (!strcmp(bd->client.icccm.name, + if ((ec->icccm.name) && + (!strcmp(ec->icccm.name, _e_illume_cfg->policy.indicator.name))) return EINA_TRUE; } @@ -89,8 +89,8 @@ e_illume_border_is_indicator(E_Border *bd) /* check if we are matching on class */ if (_e_illume_cfg->policy.indicator.match.class) { - if ((bd->client.icccm.class) && - (!strcmp(bd->client.icccm.class, + if ((ec->icccm.class) && + (!strcmp(ec->icccm.class, _e_illume_cfg->policy.indicator.class))) return EINA_TRUE; } @@ -100,7 +100,7 @@ e_illume_border_is_indicator(E_Border *bd) { const char *title; - if ((title = e_border_name_get(bd))) + if ((title = e_client_name_get(ec))) if (!strcmp(title, _e_illume_cfg->policy.indicator.title)) return EINA_TRUE; } @@ -112,35 +112,35 @@ e_illume_border_is_indicator(E_Border *bd) /** * Determine if a given border is a Softkey window. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is a Softkey window, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @note It is assumed that Softkey windows are of type - * ECORE_X_WINDOW_TYPE_DOCK. + * E_WINDOW_TYPE_DOCK. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_softkey(E_Border *bd) +e_illume_client_is_softkey(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* legacy code from illume 1 */ - if (bd->client.qtopia.soft_menu) return EINA_TRUE; + if (ec->qtopia.soft_menu) return EINA_TRUE; /* softkey windows should be set to dock type, so check for that */ - if (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) return EINA_FALSE; + if (ec->netwm.type != E_WINDOW_TYPE_DOCK) return EINA_FALSE; /* we have a softkey window, check against any matches in config */ /* check if we are matching on name */ if (_e_illume_cfg->policy.softkey.match.name) { - if ((bd->client.icccm.name) && - (!strcmp(bd->client.icccm.name, + if ((ec->icccm.name) && + (!strcmp(ec->icccm.name, _e_illume_cfg->policy.softkey.name))) return EINA_TRUE; } @@ -148,8 +148,8 @@ e_illume_border_is_softkey(E_Border *bd) /* check if we are matching on class */ if (_e_illume_cfg->policy.softkey.match.class) { - if ((bd->client.icccm.class) && - (!strcmp(bd->client.icccm.class, + if ((ec->icccm.class) && + (!strcmp(ec->icccm.class, _e_illume_cfg->policy.softkey.class))) return EINA_TRUE; } @@ -159,7 +159,7 @@ e_illume_border_is_softkey(E_Border *bd) { const char *title; - if ((title = e_border_name_get(bd))) + if ((title = e_client_name_get(ec))) if (!strcmp(title, _e_illume_cfg->policy.softkey.title)) return EINA_TRUE; } @@ -171,34 +171,34 @@ e_illume_border_is_softkey(E_Border *bd) /** * Determine if a given border is a Keyboard window. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is a Keyboard window, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_keyboard(E_Border *bd) +e_illume_client_is_keyboard(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* check for specific flag first */ - if (bd->client.vkbd.vkbd) return EINA_TRUE; + if (ec->vkbd.vkbd) return EINA_TRUE; /* legacy code from illume 1 */ - if ((bd->client.icccm.name) && - ((!strcmp(bd->client.icccm.name, "multitap-pad"))) && - (bd->client.netwm.state.skip_taskbar) && - (bd->client.netwm.state.skip_pager)) + if ((ec->icccm.name) && + ((!strcmp(ec->icccm.name, "multitap-pad"))) && + (ec->netwm.state.skip_taskbar) && + (ec->netwm.state.skip_pager)) return EINA_TRUE; /* check if we are matching on name */ if (_e_illume_cfg->policy.vkbd.match.name) { - if ((bd->client.icccm.name) && - (!strcmp(bd->client.icccm.name, + if ((ec->icccm.name) && + (!strcmp(ec->icccm.name, _e_illume_cfg->policy.vkbd.name))) return EINA_TRUE; } @@ -206,8 +206,8 @@ e_illume_border_is_keyboard(E_Border *bd) /* check if we are matching on class */ if (_e_illume_cfg->policy.vkbd.match.class) { - if ((bd->client.icccm.class) && - (!strcmp(bd->client.icccm.class, + if ((ec->icccm.class) && + (!strcmp(ec->icccm.class, _e_illume_cfg->policy.vkbd.class))) return EINA_TRUE; } @@ -217,7 +217,7 @@ e_illume_border_is_keyboard(E_Border *bd) { const char *title; - if ((title = e_border_name_get(bd))) + if ((title = e_client_name_get(ec))) if (!strcmp(title, _e_illume_cfg->policy.vkbd.title)) return EINA_TRUE; } @@ -229,30 +229,30 @@ e_illume_border_is_keyboard(E_Border *bd) /** * Determine if a given border is a Home window. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is a Home window, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_home(E_Border *bd) +e_illume_client_is_home(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* skip windows which are not either 'normal' windows, or 'unknown' windows * NB: Let 'unknown' windows pass through as a safety */ - 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)) return EINA_FALSE; /* check if we are matching on name */ if (_e_illume_cfg->policy.home.match.name) { - if ((bd->client.icccm.name) && - (!strcmp(bd->client.icccm.name, + if ((ec->icccm.name) && + (!strcmp(ec->icccm.name, _e_illume_cfg->policy.home.name))) return EINA_TRUE; } @@ -260,8 +260,8 @@ e_illume_border_is_home(E_Border *bd) /* check if we are matching on class */ if (_e_illume_cfg->policy.home.match.class) { - if ((bd->client.icccm.class) && - (!strcmp(bd->client.icccm.class, + if ((ec->icccm.class) && + (!strcmp(ec->icccm.class, _e_illume_cfg->policy.home.class))) return EINA_TRUE; } @@ -271,7 +271,7 @@ e_illume_border_is_home(E_Border *bd) { const char *title; - if ((title = e_border_name_get(bd))) + if ((title = e_client_name_get(ec))) if (!strcmp(title, _e_illume_cfg->policy.home.title)) return EINA_TRUE; } @@ -283,28 +283,28 @@ e_illume_border_is_home(E_Border *bd) /** * Determine if a given border is a splash screen. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is a splash screen, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_splash(E_Border *bd) +e_illume_client_is_splash(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* check actual type */ - if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_SPLASH) return EINA_TRUE; + if (ec->netwm.type == E_WINDOW_TYPE_SPLASH) return EINA_TRUE; /* check for transient flag */ -// if (bd->client.icccm.transient_for != 0) return EINA_TRUE; +// if (ec->icccm.transient_for != 0) return EINA_TRUE; /* NB: may or may not need to handle these. Needs Testing - if (bd->client.netwm.extra_types) - printf("\t\tBorder has extra types: %s\n", bd->client.icccm.class); + if (ec->netwm.extra_types) + printf("\t\tBorder has extra types: %s\n", ec->icccm.class); */ /* return a fallback */ @@ -314,33 +314,33 @@ e_illume_border_is_splash(E_Border *bd) /** * Determine if a given border is a dialog. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is a dialog, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_dialog(E_Border *bd) +e_illume_client_is_dialog(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* check actual type */ - if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG) return EINA_TRUE; + if (ec->netwm.type == E_WINDOW_TYPE_DIALOG) return EINA_TRUE; /* check for transient flag */ - if (bd->client.icccm.transient_for != 0) return EINA_TRUE; + if (ec->icccm.transient_for != 0) return EINA_TRUE; /* check for client leader */ /* NB: disabled currently as some GTK windows set this even tho they are * not a dialog. */ -// if (bd->client.icccm.client_leader) return EINA_TRUE; +// if (ec->icccm.client_leader) return EINA_TRUE; /* NB: may or may not need to handle these. Needs Testing - if (bd->client.netwm.extra_types) - printf("\t\tBorder has extra types: %s\n", bd->client.icccm.class); + if (ec->netwm.extra_types) + printf("\t\tBorder has extra types: %s\n", ec->icccm.class); */ /* return a fallback */ @@ -350,22 +350,22 @@ e_illume_border_is_dialog(E_Border *bd) /** * Determine if a given border is a QT VCLSalFrame. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is a VCLSalFrame, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_qt_frame(E_Border *bd) +e_illume_client_is_qt_frame(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* make sure we have the icccm name and compare it */ - if ((bd->client.icccm.name) && - (!strncmp(bd->client.icccm.name, "VCLSalFrame", 11))) + if ((ec->icccm.name) && + (!strncmp(ec->icccm.name, "VCLSalFrame", 11))) return EINA_TRUE; /* return a fallback */ @@ -375,21 +375,21 @@ e_illume_border_is_qt_frame(E_Border *bd) /** * Determine if a given border is a fullscreen window. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is fullscreen, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_fullscreen(E_Border *bd) +e_illume_client_is_fullscreen(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* check for fullscreen */ - if ((bd->fullscreen) || (bd->need_fullscreen)) return EINA_TRUE; + if ((ec->fullscreen) || (ec->need_fullscreen)) return EINA_TRUE; /* return a fallback */ return EINA_FALSE; @@ -398,67 +398,67 @@ e_illume_border_is_fullscreen(E_Border *bd) /** * Determine if a given border is an illume conformant window. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is conformant, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_conformant(E_Border *bd) +e_illume_client_is_conformant(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* return if it is conformant or not */ - return bd->client.illume.conformant.conformant; + return ec->illume.conformant.conformant; } /** * Determine if a given border is a quickpanel window. * - * @param bd The border to test. + * @param ec The border to test. * @return EINA_TRUE if it is a quickpanel, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_quickpanel(E_Border *bd) +e_illume_client_is_quickpanel(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; /* return if it is a quickpanel or not */ - return bd->client.illume.quickpanel.quickpanel; + return ec->illume.quickpanel.quickpanel; } /** * Determine if the border request a fixed size. * - * @param bd The border to get the minium space for. + * @param ec The border to get the minium space for. * @return EINA_TRUE if border requested fixed size, EINA_FALSE otherwise. * - * @note If @p bd is NULL then this function will return EINA_FALSE. + * @note If @p ec is NULL then this function will return EINA_FALSE. * * @ingroup E_Illume_Main_Group */ EAPI Eina_Bool -e_illume_border_is_fixed_size(E_Border *bd) +e_illume_client_is_fixed_size(E_Client *ec) { /* make sure we have a border */ - if (!bd) return EINA_FALSE; + if (!ec) return EINA_FALSE; - if ((bd->client.icccm.min_w == bd->client.icccm.max_w) && - (bd->client.icccm.min_h == bd->client.icccm.max_h)) + if ((ec->icccm.min_w == ec->icccm.max_w) && + (ec->icccm.min_h == ec->icccm.max_h)) return EINA_TRUE; - if ((bd->client.mwm.exists) && - !((bd->client.mwm.func & ECORE_X_MWM_HINT_FUNC_ALL) || - (bd->client.mwm.func & ECORE_X_MWM_HINT_FUNC_MAXIMIZE) || - (bd->client.mwm.func & ECORE_X_MWM_HINT_FUNC_RESIZE))) + if ((ec->mwm.exists) && + !((ec->mwm.func & ECORE_X_MWM_HINT_FUNC_ALL) || + (ec->mwm.func & ECORE_X_MWM_HINT_FUNC_MAXIMIZE) || + (ec->mwm.func & ECORE_X_MWM_HINT_FUNC_RESIZE))) return EINA_TRUE; return EINA_FALSE; @@ -467,34 +467,34 @@ e_illume_border_is_fixed_size(E_Border *bd) /** * Retrieves the minimum space required to display this border. * - * @param bd The border to get the minium space for. + * @param ec The border to get the minium space for. * @param w Pointer to an integer into which the width is to be stored. * @param h Pointer to an integer into which the height is to be stored. * - * @note if @p bd is NULL then @p w and @p h will return @c 0. + * @note if @p ec is NULL then @p w and @p h will return @c 0. * * @ingroup E_Illume_Main_Group */ EAPI void -e_illume_border_min_get(E_Border *bd, int *w, int *h) +e_illume_client_min_get(E_Client *ec, int *w, int *h) { if (w) *w = 0; if (h) *h = 0; - if (!bd) return; + if (!ec) return; if (w) { - if (bd->client.icccm.base_w > bd->client.icccm.min_w) - *w = bd->client.icccm.base_w; + if (ec->icccm.base_w > ec->icccm.min_w) + *w = ec->icccm.base_w; else - *w = bd->client.icccm.min_w; + *w = ec->icccm.min_w; } if (h) { - if (bd->client.icccm.base_h > bd->client.icccm.min_h) - *h = bd->client.icccm.base_h; + if (ec->icccm.base_h > ec->icccm.min_h) + *h = ec->icccm.base_h; else - *h = bd->client.icccm.min_h; + *h = ec->icccm.min_h; } } @@ -511,39 +511,38 @@ e_illume_border_min_get(E_Border *bd, int *w, int *h) * * @ingroup E_Illume_Main_Group */ -EAPI E_Border * -e_illume_border_at_xy_get(E_Zone *zone, int x, int y) +EAPI E_Client * +e_illume_client_at_xy_get(E_Zone *zone, int x, int y) { Eina_List *l; - E_Border *bd; + E_Client *ec; /* make sure we have a zone */ if (!zone) return NULL; /* loop the border client list */ - /* NB: We use e_border_client_list here, rather than - * e_container_border_list, because e_border_client_list is faster. - * This is done in reverse order so we get the most recent border first */ - EINA_LIST_REVERSE_FOREACH(e_border_client_list(), l, bd) + /* This is done in reverse order so we get the most recent border first */ + EINA_LIST_REVERSE_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* check zone and skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* skip invisibles */ - if (!bd->visible) continue; + if (!ec->visible) continue; /* check position against given coordinates */ - if ((bd->x != x) || (bd->y != y)) continue; + if ((ec->x != x) || (ec->y != y)) continue; /* filter out borders we don't want */ - if (e_illume_border_is_indicator(bd)) continue; - if (e_illume_border_is_softkey(bd)) continue; - if (e_illume_border_is_keyboard(bd)) continue; - if (e_illume_border_is_quickpanel(bd)) continue; - if (e_illume_border_is_home(bd)) continue; + if (e_illume_client_is_indicator(ec)) continue; + if (e_illume_client_is_softkey(ec)) continue; + if (e_illume_client_is_keyboard(ec)) continue; + if (e_illume_client_is_quickpanel(ec)) continue; + if (e_illume_client_is_home(ec)) continue; /* found one, return it */ - return bd; + return ec; } /* return a fallback */ @@ -553,36 +552,36 @@ e_illume_border_at_xy_get(E_Zone *zone, int x, int y) /** * Retrieve the parent of a given dialog. * - * @param bd The border to get the parent of. + * @param ec The border to get the parent of. * @return The border's parent, or NULL if no parent exists. * - * @note If @p bd is NULL then this function will return NULL. + * @note If @p ec is NULL then this function will return NULL. * * @ingroup E_Illume_Main_Group */ -EAPI E_Border * -e_illume_border_parent_get(E_Border *bd) +EAPI E_Client * +e_illume_client_parent_get(E_Client *ec) { /* make sure we have a border */ - if (!bd) return NULL; + if (!ec) return NULL; /* check for border's parent */ - if (bd->parent) return bd->parent; + if (ec->parent) return ec->parent; - /* NB: TEST CODE - may need to check bd->leader here */ - if (bd->leader) - printf("\tDialog Has Leader: %s\n", bd->client.icccm.name); + /* NB: TEST CODE - may need to check ec->leader here */ + if (ec->leader) + printf("\tDialog Has Leader: %s\n", ec->icccm.name); /* check for transient */ - if (bd->client.icccm.transient_for) + if (ec->icccm.transient_for) { /* try to find this borders parent */ - return e_border_find_by_client_window(bd->client.icccm.transient_for); + return e_pixmap_find_client(E_PIXMAP_TYPE_X, ec->icccm.transient_for); } - else if (bd->client.icccm.client_leader) + else if (ec->icccm.client_leader) { /* NB: using client_leader as parent. THIS NEEDS THOROUGH TESTING !! */ - return e_border_find_by_client_window(bd->client.icccm.client_leader); + return e_pixmap_find_client(E_PIXMAP_TYPE_X, ec->icccm.client_leader); } /* return a fallback */ @@ -592,67 +591,67 @@ e_illume_border_parent_get(E_Border *bd) /** * Show a given border. * - * @param bd The border to show. + * @param ec The border to show. * - * @note If @p bd is NULL then this function will return. + * @note If @p ec is NULL then this function will return. * * @ingroup E_Illume_Main_Group */ EAPI void -e_illume_border_show(E_Border *bd) +e_illume_client_show(E_Client *ec) { /* make sure we have a border */ - if (!bd) return; + if (!ec) return; - e_border_uniconify(bd); - e_border_raise(bd); - e_border_show(bd); + e_client_uniconify(ec); + evas_object_raise(ec->frame); + evas_object_show(ec->frame); return; #if 0 unsigned int visible = 1; - +#error this is totally fucked /* NB: We handle shows this way so we don't get extra layout events from * the e_border calls */ - e_container_border_lower(bd); - e_container_shape_show(bd->shape); - if (!bd->need_reparent) ecore_x_window_show(bd->client.win); - e_hints_window_visible_set(bd); - bd->visible = 1; - bd->changes.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); + evas_object_lower(ec->frame); + e_container_shape_show(ec->shape); + if (!ec->need_reparent) ecore_x_window_show(e_client_util_win_get(ec)); + e_hints_window_visible_set(ec); + ec->visible = 1; + ec->changes.visible = 1; + ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_MAPPED, &visible, 1); + ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_MANAGED, &visible, 1); #endif } /** * Hide a given border. * - * @param bd The border to hide. + * @param ec The border to hide. * - * @note If @p bd is NULL then this function will return. + * @note If @p ec is NULL then this function will return. * * @ingroup E_Illume_Main_Group */ EAPI void -e_illume_border_hide(E_Border *bd) +e_illume_client_hide(E_Client *ec) { /* make sure we have a border */ - if (!bd) return; + if (!ec) return; - e_border_iconify(bd); + e_client_iconify(ec); return; #if 0 unsigned int visible = 0; - +#error this is totally fucked /* NB: We handle hides this way so we don't get extra layout events from * the e_border calls */ - e_container_shape_hide(bd->shape); - if (!bd->iconic) e_hints_window_hidden_set(bd); - bd->visible = 0; - bd->changes.visible = 1; - ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &visible, 1); + e_container_shape_hide(ec->shape); + if (!ec->iconic) e_hints_window_hidden_set(ec); + ec->visible = 0; + ec->changes.visible = 1; + ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_MAPPED, &visible, 1); #endif } @@ -666,28 +665,27 @@ e_illume_border_hide(E_Border *bd) * * @ingroup E_Illume_Main_Group */ -EAPI E_Border * -e_illume_border_indicator_get(E_Zone *zone) +EAPI E_Client * +e_illume_client_indicator_get(E_Zone *zone) { Eina_List *l; - E_Border *bd; + E_Client *ec; /* make sure we have a zone */ if (!zone) return NULL; - /* loop the border client list */ - /* NB: We use e_border_client_list here, rather than - * e_container_border_list, because e_border_client_list is faster */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + /* loop the client list */ + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* check zone and skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* skip borders that are not indicators */ - if (!e_illume_border_is_indicator(bd)) continue; + if (!e_illume_client_is_indicator(ec)) continue; /* found one, return it */ - return bd; + return ec; } /* return a fallback */ @@ -706,9 +704,9 @@ e_illume_border_indicator_get(E_Zone *zone) * @ingroup E_Illume_Main_Group */ EAPI void -e_illume_border_indicator_pos_get(E_Zone *zone, int *x, int *y) +e_illume_client_indicator_pos_get(E_Zone *zone, int *x, int *y) { - E_Border *ind; + E_Client *ind; if (x) *x = 0; if (y) *y = 0; @@ -721,7 +719,7 @@ e_illume_border_indicator_pos_get(E_Zone *zone, int *x, int *y) if (y) *y = zone->y; /* try and get the Indicator on this zone */ - if (!(ind = e_illume_border_indicator_get(zone))) return; + if (!(ind = e_illume_client_indicator_get(zone))) return; /* return Indicator position(s) */ if (x) *x = ind->x; @@ -738,28 +736,27 @@ e_illume_border_indicator_pos_get(E_Zone *zone, int *x, int *y) * * @ingroup E_Illume_Main_Group */ -EAPI E_Border * -e_illume_border_softkey_get(E_Zone *zone) +EAPI E_Client * +e_illume_client_softkey_get(E_Zone *zone) { Eina_List *l; - E_Border *bd; + E_Client *ec; /* make sure we have a zone */ if (!zone) return NULL; /* loop the border client list */ - /* NB: We use e_border_client_list here, rather than - * e_container_border_list, because e_border_client_list is faster */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* check zone and skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* skip borders that are not indicators */ - if (!e_illume_border_is_softkey(bd)) continue; + if (!e_illume_client_is_softkey(ec)) continue; /* found one, return it */ - return bd; + return ec; } /* return a fallback */ @@ -778,9 +775,9 @@ e_illume_border_softkey_get(E_Zone *zone) * @ingroup E_Illume_Main_Group */ EAPI void -e_illume_border_softkey_pos_get(E_Zone *zone, int *x, int *y) +e_illume_client_softkey_pos_get(E_Zone *zone, int *x, int *y) { - E_Border *sft; + E_Client *sft; if (x) *x = 0; if (y) *y = 0; @@ -793,7 +790,7 @@ e_illume_border_softkey_pos_get(E_Zone *zone, int *x, int *y) if (y) *y = zone->y; /* try and get the Softkey on this zone */ - if (!(sft = e_illume_border_softkey_get(zone))) return; + if (!(sft = e_illume_client_softkey_get(zone))) return; /* return Indicator position(s) */ if (x) *x = sft->x; @@ -856,16 +853,16 @@ e_illume_keyboard_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int /* if we don't have a border, get out */ /* NB: This basically means that we have the vkbd structure, but no * app or module present to act as the vkbd */ - if (!_e_illume_kbd->border) return; + if (!_e_illume_kbd->client) return; /* if the keyboard border is not on this zone, get out */ - if (_e_illume_kbd->border->zone != zone) return; + if (_e_illume_kbd->client->zone != zone) return; if (!_e_illume_kbd->animator) { if (h) { - *h -= _e_illume_kbd->border->h; + *h -= _e_illume_kbd->client->h; if (*h < 0) *h = 0; } } @@ -881,28 +878,27 @@ e_illume_keyboard_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int * * @ingroup E_Illume_Main_Group */ -EAPI E_Border * -e_illume_border_home_get(E_Zone *zone) +EAPI E_Client * +e_illume_client_home_get(E_Zone *zone) { - E_Border *bd; + E_Client *ec; Eina_List *l; /* make sure we have a zone */ if (!zone) return NULL; /* loop the border client list */ - /* NB: We use e_border_client_list here, rather than - * e_container_border_list, because e_border_client_list is faster */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* check zone and skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* skip borders that are not home windows */ - if (!e_illume_border_is_home(bd)) continue; + if (!e_illume_client_is_home(ec)) continue; /* found one, return it */ - return bd; + return ec; } /* return a fallback */ @@ -920,27 +916,26 @@ e_illume_border_home_get(E_Zone *zone) * @ingroup E_Illume_Main_Group */ EAPI Eina_List * -e_illume_border_home_borders_get(E_Zone *zone) +e_illume_client_home_borders_get(E_Zone *zone) { Eina_List *ret = NULL, *l; - E_Border *bd; + E_Client *ec; /* make sure we have a zone */ if (!zone) return NULL; /* loop the border client list */ - /* NB: We use e_border_client_list here, rather than - * e_container_border_list, because e_border_client_list is faster */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* check zone and skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* skip borders that are not home windows */ - if (!e_illume_border_is_home(bd)) continue; + if (!e_illume_client_is_home(ec)) continue; /* found one, append it to the list */ - ret = eina_list_append(ret, bd); + ret = eina_list_append(ret, ec); } /* return the list */ diff --git a/src/modules/illume2/e_illume.h b/src/modules/illume2/e_illume.h index 4db00b753..010fcb8e6 100644 --- a/src/modules/illume2/e_illume.h +++ b/src/modules/illume2/e_illume.h @@ -64,7 +64,7 @@ struct _E_Illume_Keyboard { E_Object e_obj_inherit; - E_Border *border; + E_Client *client; Ecore_Timer *timer; Ecore_Animator *animator; @@ -150,35 +150,35 @@ struct _E_Illume_Policy * do in here. * @warning Policies are required to implement this function. */ - void (*border_add) (E_Border *bd); + void (*border_add) (E_Client *ec); /**< pointer to the function that Illume will call when a new border * gets added. @note This function is optional. */ - void (*border_del) (E_Border *bd); + void (*border_del) (E_Client *ec); /**< pointer to the function that Illume will call when a border gets * deleted. @note This function is optional. */ - void (*border_focus_in) (E_Border *bd); + void (*border_focus_in) (E_Client *ec); /**< pointer to the function that Illume will call when a border gets * focus. @note This function is optional. */ - void (*border_focus_out) (E_Border *bd); + void (*border_focus_out) (E_Client *ec); /**< pointer to the function that Illume will call when a border loses * focus. @note This function is optional. */ - void (*border_activate) (E_Border *bd); + void (*border_activate) (E_Client *ec); /**< pointer to the function that Illume will call when a border gets * an activate message. @note This function is optional. */ - void (*border_post_fetch) (E_Border *bd); + void (*border_post_fetch) (E_Client *ec); /**< pointer to the function that Illume will call when E signals a * border post fetch. @note This function is optional. */ - void (*border_post_assign) (E_Border *bd); + void (*border_post_assign) (E_Client *ec); /**< pointer to the function that Illume will call when E signals a * border post assign. @note This function is optional. */ - void (*border_show) (E_Border *bd); + void (*border_show) (E_Client *ec); /**< pointer to the function that Illume will call when a border gets * shown. @note This function is optional. */ @@ -199,12 +199,12 @@ struct _E_Illume_Policy * requested a border get closed. This is usually signaled from the * Softkey window. @note This function is optional. */ - void (*drag_start) (E_Border *bd); + void (*drag_start) (E_Client *ec); /**< pointer to the function that Illume will call when the user has * started to drag the Indicator/Softkey windows. * @note This function is optional. */ - void (*drag_end) (E_Border *bd); + void (*drag_end) (E_Client *ec); /**< pointer to the function that Illume will call when the user has * stopped draging the Indicator/Softkey windows. * @note This function is optional. */ @@ -337,39 +337,39 @@ struct _E_Illume_Quickpanel EAPI E_Illume_Config_Zone *e_illume_zone_config_get(int id); /* general functions */ -EAPI Eina_Bool e_illume_border_is_indicator(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_softkey(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_keyboard(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_home(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_splash(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_dialog(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_qt_frame(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_fullscreen(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_conformant(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_quickpanel(E_Border *bd); -EAPI Eina_Bool e_illume_border_is_fixed_size(E_Border *bd); +EAPI Eina_Bool e_illume_client_is_indicator(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_softkey(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_keyboard(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_home(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_splash(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_dialog(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_qt_frame(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_fullscreen(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_conformant(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_quickpanel(E_Client *ec); +EAPI Eina_Bool e_illume_client_is_fixed_size(E_Client *ec); -EAPI void e_illume_border_min_get(E_Border *bd, int *w, int *h); -EAPI E_Border *e_illume_border_at_xy_get(E_Zone *zone, int x, int y); -EAPI E_Border *e_illume_border_parent_get(E_Border *bd); -EAPI void e_illume_border_show(E_Border *bd); -EAPI void e_illume_border_hide(E_Border *bd); +EAPI void e_illume_client_min_get(E_Client *ec, int *w, int *h); +EAPI E_Client *e_illume_client_at_xy_get(E_Zone *zone, int x, int y); +EAPI E_Client *e_illume_client_parent_get(E_Client *ec); +EAPI void e_illume_client_show(E_Client *ec); +EAPI void e_illume_client_hide(E_Client *ec); /* indicator functions */ -EAPI E_Border *e_illume_border_indicator_get(E_Zone *zone); -EAPI void e_illume_border_indicator_pos_get(E_Zone *zone, int *x, int *y); +EAPI E_Client *e_illume_client_indicator_get(E_Zone *zone); +EAPI void e_illume_client_indicator_pos_get(E_Zone *zone, int *x, int *y); /* softkey functions */ -EAPI E_Border *e_illume_border_softkey_get(E_Zone *zone); -EAPI void e_illume_border_softkey_pos_get(E_Zone *zone, int *x, int *y); +EAPI E_Client *e_illume_client_softkey_get(E_Zone *zone); +EAPI void e_illume_client_softkey_pos_get(E_Zone *zone, int *x, int *y); /* keyboard functions */ EAPI E_Illume_Keyboard *e_illume_keyboard_get(void); EAPI void e_illume_keyboard_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h); /* home functions */ -EAPI E_Border *e_illume_border_home_get(E_Zone *zone); -EAPI Eina_List *e_illume_border_home_borders_get(E_Zone *zone); +EAPI E_Client *e_illume_client_home_get(E_Zone *zone); +EAPI Eina_List *e_illume_client_home_borders_get(E_Zone *zone); /* quickpanel functions */ EAPI E_Illume_Quickpanel *e_illume_quickpanel_by_zone_get(E_Zone *zone); diff --git a/src/modules/illume2/e_mod_config.c b/src/modules/illume2/e_mod_config.c index 25623168b..22dab15bd 100644 --- a/src/modules/illume2/e_mod_config.c +++ b/src/modules/illume2/e_mod_config.c @@ -203,7 +203,7 @@ _e_mod_illume_config_new(void) _e_illume_cfg->policy.vkbd.class = eina_stringshare_add("Virtual-Keyboard"); _e_illume_cfg->policy.vkbd.name = eina_stringshare_add("Virtual-Keyboard"); _e_illume_cfg->policy.vkbd.title = eina_stringshare_add("Virtual Keyboard"); - _e_illume_cfg->policy.vkbd.type = ECORE_X_WINDOW_TYPE_NORMAL; + _e_illume_cfg->policy.vkbd.type = E_WINDOW_TYPE_NORMAL; _e_illume_cfg->policy.vkbd.match.class = 0; _e_illume_cfg->policy.vkbd.match.name = 1; _e_illume_cfg->policy.vkbd.match.title = 1; @@ -215,7 +215,7 @@ _e_mod_illume_config_new(void) eina_stringshare_add("Illume-Indicator"); _e_illume_cfg->policy.indicator.title = eina_stringshare_add("Illume Indicator"); - _e_illume_cfg->policy.indicator.type = ECORE_X_WINDOW_TYPE_DOCK; + _e_illume_cfg->policy.indicator.type = E_WINDOW_TYPE_DOCK; _e_illume_cfg->policy.indicator.match.class = 0; _e_illume_cfg->policy.indicator.match.name = 1; _e_illume_cfg->policy.indicator.match.title = 1; @@ -227,7 +227,7 @@ _e_mod_illume_config_new(void) eina_stringshare_add("Illume-Softkey"); _e_illume_cfg->policy.softkey.title = eina_stringshare_add("Illume Softkey"); - _e_illume_cfg->policy.softkey.type = ECORE_X_WINDOW_TYPE_DOCK; + _e_illume_cfg->policy.softkey.type = E_WINDOW_TYPE_DOCK; _e_illume_cfg->policy.softkey.match.class = 0; _e_illume_cfg->policy.softkey.match.name = 1; _e_illume_cfg->policy.softkey.match.title = 1; @@ -236,7 +236,7 @@ _e_mod_illume_config_new(void) _e_illume_cfg->policy.home.class = eina_stringshare_add("Illume-Home"); _e_illume_cfg->policy.home.name = eina_stringshare_add("Illume-Home"); _e_illume_cfg->policy.home.title = eina_stringshare_add("Illume Home"); - _e_illume_cfg->policy.home.type = ECORE_X_WINDOW_TYPE_NORMAL; + _e_illume_cfg->policy.home.type = E_WINDOW_TYPE_NORMAL; _e_illume_cfg->policy.home.match.class = 0; _e_illume_cfg->policy.home.match.name = 1; _e_illume_cfg->policy.home.match.title = 1; diff --git a/src/modules/illume2/e_mod_config_animation.c b/src/modules/illume2/e_mod_config_animation.c index 9091789fd..ea420d47c 100644 --- a/src/modules/illume2/e_mod_config_animation.c +++ b/src/modules/illume2/e_mod_config_animation.c @@ -11,7 +11,7 @@ static Eina_Bool _e_mod_illume_config_animation_timeout(void *data); Ecore_Timer *_anim_change_timer = NULL; void -e_mod_illume_config_animation_show(E_Container *con, const char *params __UNUSED__) +e_mod_illume_config_animation_show(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -28,7 +28,7 @@ e_mod_illume_config_animation_show(E_Container *con, const char *params __UNUSED v->normal_win = 1; v->scroll = 1; - cfd = e_config_dialog_new(con, _("Animation Settings"), "E", + cfd = e_config_dialog_new(comp, _("Animation Settings"), "E", "illume/animation", "enlightenment/animation_settings", 0, v, NULL); if (!cfd) return; diff --git a/src/modules/illume2/e_mod_config_policy.c b/src/modules/illume2/e_mod_config_policy.c index eec6131ee..9b4561fcc 100644 --- a/src/modules/illume2/e_mod_config_policy.c +++ b/src/modules/illume2/e_mod_config_policy.c @@ -14,7 +14,7 @@ Ecore_Timer *_policy_change_timer = NULL; const char *_policy_name = NULL; void -e_mod_illume_config_policy_show(E_Container *con, const char *params __UNUSED__) +e_mod_illume_config_policy_show(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -30,7 +30,7 @@ e_mod_illume_config_policy_show(E_Container *con, const char *params __UNUSED__) v->basic_only = 1; v->normal_win = 1; v->scroll = 1; - cfd = e_config_dialog_new(con, _("Policy"), "E", "illume/policy", + cfd = e_config_dialog_new(comp, _("Policy"), "E", "illume/policy", "enlightenment/policy", 0, v, NULL); if (!cfd) return; } diff --git a/src/modules/illume2/e_mod_config_windows.c b/src/modules/illume2/e_mod_config_windows.c index af6d1387a..57a235407 100644 --- a/src/modules/illume2/e_mod_config_windows.c +++ b/src/modules/illume2/e_mod_config_windows.c @@ -18,7 +18,7 @@ Ecore_Timer *_windows_change_timer = NULL; /* public functions */ void -e_mod_illume_config_windows_show(E_Container *con, const char *params __UNUSED__) +e_mod_illume_config_windows_show(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -34,7 +34,7 @@ e_mod_illume_config_windows_show(E_Container *con, const char *params __UNUSED__ v->basic_only = 1; v->normal_win = 1; v->scroll = 1; - cfd = e_config_dialog_new(con, _("Window Settings"), "E", + cfd = e_config_dialog_new(comp, _("Window Settings"), "E", "illume/windows", "preferences-system-windows", 0, v, NULL); if (!cfd) return; diff --git a/src/modules/illume2/e_mod_kbd.c b/src/modules/illume2/e_mod_kbd.c index 6a7bab5a1..98aa1af3a 100644 --- a/src/modules/illume2/e_mod_kbd.c +++ b/src/modules/illume2/e_mod_kbd.c @@ -7,23 +7,23 @@ static Eina_Bool _e_mod_kbd_cb_border_remove(void *data __UNUSED__, int type __U static Eina_Bool _e_mod_kbd_cb_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _e_mod_kbd_cb_border_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _e_mod_kbd_cb_border_property(void *data __UNUSED__, int type __UNUSED__, void *event); -static void _e_mod_kbd_cb_border_pre_post_fetch(void *data __UNUSED__, void *data2); +static void _e_mod_kbd_cb_border_pre_post_fetch(void *data __UNUSED__, E_Client *ec); static void _e_mod_kbd_cb_free(E_Illume_Keyboard *kbd); static Eina_Bool _e_mod_kbd_cb_delay_hide(void *data __UNUSED__); static void _e_mod_kbd_hide(void); static void _e_mod_kbd_slide(int visible, double len); static Eina_Bool _e_mod_kbd_cb_animate(void *data __UNUSED__); -static E_Illume_Keyboard *_e_mod_kbd_by_border_get(E_Border *bd); -static void _e_mod_kbd_border_adopt(E_Border *bd); +static E_Illume_Keyboard *_e_mod_kbd_by_border_get(E_Client *ec); +static void _e_mod_kbd_border_adopt(E_Client *ec); static void _e_mod_kbd_layout_send(void); static void _e_mod_kbd_geometry_send(void); static void _e_mod_kbd_changes_send(void); /* local variables */ static Eina_List *_kbd_hdls = NULL; -static E_Border_Hook *_kbd_hook = NULL; +static E_Client_Hook *_kbd_hook = NULL; static Ecore_X_Atom _focused_state = 0; -static E_Border *_focused_border = NULL, *_prev_focused_border = NULL; +static E_Client *_focused_border = NULL, *_prev_focused_border = NULL; int e_mod_kbd_init(void) @@ -36,17 +36,17 @@ e_mod_kbd_init(void) NULL)); _kbd_hdls = eina_list_append(_kbd_hdls, - ecore_event_handler_add(E_EVENT_BORDER_REMOVE, + ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, _e_mod_kbd_cb_border_remove, NULL)); _kbd_hdls = eina_list_append(_kbd_hdls, - ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN, + ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_IN, _e_mod_kbd_cb_border_focus_in, NULL)); _kbd_hdls = eina_list_append(_kbd_hdls, - ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT, + ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_OUT, _e_mod_kbd_cb_border_focus_out, NULL)); _kbd_hdls = @@ -56,7 +56,7 @@ e_mod_kbd_init(void) NULL)); /* add hooks for events we are interested in */ - _kbd_hook = e_border_hook_add(E_BORDER_HOOK_EVAL_PRE_POST_FETCH, + _kbd_hook = e_client_hook_add(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, _e_mod_kbd_cb_border_pre_post_fetch, NULL); /* initialize the device subsystem */ @@ -74,7 +74,7 @@ e_mod_kbd_shutdown(void) e_mod_kbd_device_shutdown(); /* destroy the hook */ - e_border_hook_del(_kbd_hook); + e_client_hook_del(_kbd_hook); /* destroy the handlers and free the list */ EINA_LIST_FREE(_kbd_hdls, hdl) @@ -137,10 +137,10 @@ e_mod_kbd_show(void) if (_e_illume_kbd->animator) ecore_animator_del(_e_illume_kbd->animator); _e_illume_kbd->animator = NULL; - if ((_focused_border) && (_e_illume_kbd->border)) + if ((_focused_border) && (_e_illume_kbd->client)) { - if (_e_illume_kbd->border->zone != _focused_border->zone) - e_border_zone_set(_e_illume_kbd->border, _focused_border->zone); + if (_e_illume_kbd->client->zone != _focused_border->zone) + e_client_zone_set(_e_illume_kbd->client, _focused_border->zone); } /* if it's disabled, get out */ @@ -152,14 +152,14 @@ e_mod_kbd_show(void) if (_e_illume_cfg->animation.vkbd.duration <= 0) { /* show the border */ - if (_e_illume_kbd->border) + if (_e_illume_kbd->client) { - e_comp_win_effect_set(_e_illume_kbd->border->cw, "move"); + e_comp_object_effect_set(_e_illume_kbd->client->frame, "move"); /* unuse location */ - e_comp_win_effect_params_set(_e_illume_kbd->border->cw, 0, (int[]){0}, 1); - if (!_e_illume_kbd->border->visible) - e_border_show(_e_illume_kbd->border); - e_border_raise(_e_illume_kbd->border); + e_comp_object_effect_params_set(_e_illume_kbd->client->frame, 0, (int[]){0}, 1); + if (!_e_illume_kbd->client->visible) + evas_object_show(_e_illume_kbd->client->frame); + evas_object_raise(_e_illume_kbd->client->frame); } _e_illume_kbd->visible = 1; @@ -170,11 +170,11 @@ e_mod_kbd_show(void) else { /* show the border */ - if (_e_illume_kbd->border) + if (_e_illume_kbd->client) { - if (!_e_illume_kbd->border->visible) - e_border_show(_e_illume_kbd->border); - e_border_raise(_e_illume_kbd->border); + if (!_e_illume_kbd->client->visible) + evas_object_show(_e_illume_kbd->client->frame); + evas_object_raise(_e_illume_kbd->client->frame); } /* animate it */ @@ -207,8 +207,8 @@ e_mod_kbd_toggle(void) void e_mod_kbd_fullscreen_set(E_Zone *zone, int fullscreen) { - if (!_e_illume_kbd->border) return; - if (_e_illume_kbd->border->zone != zone) return; + if (!_e_illume_kbd->client) return; + if (_e_illume_kbd->client->zone != zone) return; if ((!!fullscreen) != _e_illume_kbd->fullscreen) _e_illume_kbd->fullscreen = fullscreen; } @@ -216,7 +216,7 @@ e_mod_kbd_fullscreen_set(E_Zone *zone, int fullscreen) void e_mod_kbd_layout_set(E_Illume_Keyboard_Layout layout) { - if (!_e_illume_kbd->border) return; + if (!_e_illume_kbd->client) return; _e_illume_kbd->layout = layout; _e_mod_kbd_layout_send(); } @@ -245,15 +245,15 @@ _e_mod_kbd_cb_client_message(void *data __UNUSED__, int type __UNUSED__, void *e static Eina_Bool _e_mod_kbd_cb_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev; + E_Event_Client *ev; E_Illume_Keyboard *kbd; ev = event; /* if we removed the focused border, reset some variables */ - if ((_prev_focused_border) && (_prev_focused_border == ev->border)) + if ((_prev_focused_border) && (_prev_focused_border == ev->ec)) _prev_focused_border = NULL; - if ((_focused_border) && (_focused_border == ev->border)) + if ((_focused_border) && (_focused_border == ev->ec)) { e_mod_kbd_hide(); _focused_border = NULL; @@ -262,30 +262,30 @@ _e_mod_kbd_cb_border_remove(void *data __UNUSED__, int type __UNUSED__, void *ev } /* try to find the keyboard for this border */ - if (!(kbd = _e_mod_kbd_by_border_get(ev->border))) + if (!(kbd = _e_mod_kbd_by_border_get(ev->ec))) return ECORE_CALLBACK_PASS_ON; - if ((kbd->border) && (kbd->border == ev->border)) + if ((kbd->client) && (kbd->client == ev->ec)) { - kbd->border = NULL; + kbd->client = NULL; if (kbd->waiting_borders) { - E_Border *bd; + E_Client *ec; - bd = kbd->waiting_borders->data; + ec = kbd->waiting_borders->data; kbd->waiting_borders = eina_list_remove_list(kbd->waiting_borders, kbd->waiting_borders); - _e_mod_kbd_border_adopt(bd); + _e_mod_kbd_border_adopt(ec); } if (kbd->visible) { - e_border_hide(ev->border, 2); + evas_object_hide(ev->ec->frame); e_mod_kbd_hide(); } } - else if (!kbd->border) - kbd->waiting_borders = eina_list_remove(kbd->waiting_borders, ev->border); + else if (!kbd->client) + kbd->waiting_borders = eina_list_remove(kbd->waiting_borders, ev->ec); return ECORE_CALLBACK_PASS_ON; } @@ -293,14 +293,14 @@ _e_mod_kbd_cb_border_remove(void *data __UNUSED__, int type __UNUSED__, void *ev static Eina_Bool _e_mod_kbd_cb_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_In *ev; + E_Event_Client *ev; ev = event; - if (_e_mod_kbd_by_border_get(ev->border)) return ECORE_CALLBACK_PASS_ON; + if (_e_mod_kbd_by_border_get(ev->ec)) return ECORE_CALLBACK_PASS_ON; /* set focused border for kbd */ - _focused_border = ev->border; - _focused_state = ev->border->client.vkbd.state; + _focused_border = ev->ec; + _focused_state = ev->ec->vkbd.state; if (_focused_state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) e_mod_kbd_hide(); @@ -313,10 +313,10 @@ _e_mod_kbd_cb_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void * static Eina_Bool _e_mod_kbd_cb_border_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_Out *ev; + E_Event_Client *ev; ev = event; - if (_e_mod_kbd_by_border_get(ev->border)) return ECORE_CALLBACK_PASS_ON; + if (_e_mod_kbd_by_border_get(ev->ec)) return ECORE_CALLBACK_PASS_ON; _prev_focused_border = _focused_border; @@ -326,10 +326,10 @@ _e_mod_kbd_cb_border_focus_out(void *data __UNUSED__, int type __UNUSED__, void /* tell the focused border it changed so layout gets udpated */ if (_prev_focused_border && (!e_object_is_del(E_OBJECT(_prev_focused_border)))) { - if (!e_illume_border_is_conformant(_prev_focused_border)) + if (!e_illume_client_is_conformant(_prev_focused_border)) { _prev_focused_border->changes.size = 1; - BD_CHANGED(_prev_focused_border); + EC_CHANGED(_prev_focused_border); } } @@ -344,7 +344,7 @@ static Eina_Bool _e_mod_kbd_cb_border_property(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_X_Event_Window_Property *ev; - E_Border *bd; + E_Client *ec; int fullscreen = 0; ev = event; @@ -354,36 +354,36 @@ _e_mod_kbd_cb_border_property(void *data __UNUSED__, int type __UNUSED__, void * return ECORE_CALLBACK_PASS_ON; /* make sure we have a border */ - if (!(bd = e_border_find_by_client_window(ev->win))) + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->win))) return ECORE_CALLBACK_PASS_ON; -// printf("Kbd Border Property Change: %s\n", bd->client.icccm.name); +// printf("Kbd Border Property Change: %s\n", ec->icccm.name); /* if it's not focused, we don't care */ - if ((!bd->focused) || (_e_mod_kbd_by_border_get(bd))) + if ((!ec->focused) || (_e_mod_kbd_by_border_get(ec))) return ECORE_CALLBACK_PASS_ON; /* NB: Not sure why, but we seem to need to fetch kbd state here. This could * be a result of filtering the container_hook_layout. Not real happy * with this because it is an X round-trip, but it is here because this * needs more time to investigate. */ - e_hints_window_virtual_keyboard_state_get(bd); + e_hints_window_virtual_keyboard_state_get(ec); - if ((_focused_border) && (_focused_border == bd)) + if ((_focused_border) && (_focused_border == ec)) { /* if focused state is the same, get out */ - if (_focused_state == bd->client.vkbd.state) + if (_focused_state == ec->vkbd.state) return ECORE_CALLBACK_PASS_ON; } /* set our variables */ - _focused_border = bd; - _focused_state = bd->client.vkbd.state; + _focused_border = ec; + _focused_state = ec->vkbd.state; /* handle a border needing fullscreen keyboard */ - if ((bd->need_fullscreen) || (bd->fullscreen)) fullscreen = 1; + if ((ec->need_fullscreen) || (ec->fullscreen)) fullscreen = 1; if (_e_illume_kbd->fullscreen != fullscreen) - e_mod_kbd_fullscreen_set(bd->zone, fullscreen); + e_mod_kbd_fullscreen_set(ec->zone, fullscreen); if (_focused_state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) e_mod_kbd_hide(); @@ -394,30 +394,27 @@ _e_mod_kbd_cb_border_property(void *data __UNUSED__, int type __UNUSED__, void * } static void -_e_mod_kbd_cb_border_pre_post_fetch(void *data __UNUSED__, void *data2) +_e_mod_kbd_cb_border_pre_post_fetch(void *data __UNUSED__, E_Client *ec) { - E_Border *bd; - - if (!(bd = data2)) return; - if (!bd->new_client) return; - if (_e_mod_kbd_by_border_get(bd)) return; - if (e_illume_border_is_keyboard(bd)) + if (!ec->new_client) return; + if (_e_mod_kbd_by_border_get(ec)) return; + if (e_illume_client_is_keyboard(ec)) { - if (!_e_illume_kbd->border) - _e_mod_kbd_border_adopt(bd); + if (!_e_illume_kbd->client) + _e_mod_kbd_border_adopt(ec); else { _e_illume_kbd->waiting_borders = - eina_list_append(_e_illume_kbd->waiting_borders, bd); + eina_list_append(_e_illume_kbd->waiting_borders, ec); } - bd->stolen = 1; + ec->stolen = 1; } } static void _e_mod_kbd_cb_free(E_Illume_Keyboard *kbd) { - E_Border *bd; + E_Client *ec; /* destroy the animator if it exists */ if (kbd->animator) ecore_animator_del(kbd->animator); @@ -428,8 +425,8 @@ _e_mod_kbd_cb_free(E_Illume_Keyboard *kbd) kbd->timer = NULL; /* free the list of waiting borders */ - EINA_LIST_FREE(kbd->waiting_borders, bd) - bd->stolen = 0; + EINA_LIST_FREE(kbd->waiting_borders, ec) + ec->stolen = 0; /* free the keyboard structure */ E_FREE(kbd); @@ -461,14 +458,14 @@ _e_mod_kbd_hide(void) /* if we are not animating, just hide it */ if (_e_illume_cfg->animation.vkbd.duration <= 0) { - if (_e_illume_kbd->border) + if (_e_illume_kbd->client) { - e_comp_win_effect_set(_e_illume_kbd->border->cw, "move"); + e_comp_object_effect_set(_e_illume_kbd->client->frame, "move"); /* set location */ - e_comp_win_effect_params_set(_e_illume_kbd->border->cw, 1, (int[]){0, _e_illume_kbd->border->h}, 2); + e_comp_object_effect_params_set(_e_illume_kbd->client->frame, 1, (int[]){0, _e_illume_kbd->client->h}, 2); /* use location */ - e_comp_win_effect_params_set(_e_illume_kbd->border->cw, 0, (int[]){1}, 1); - e_border_hide(_e_illume_kbd->border, 2); + e_comp_object_effect_params_set(_e_illume_kbd->client->frame, 0, (int[]){1}, 1); + evas_object_hide(_e_illume_kbd->client->frame); } } else @@ -488,8 +485,8 @@ _e_mod_kbd_slide(int visible, double len) _e_illume_kbd->len = len; _e_illume_kbd->adjust_start = _e_illume_kbd->adjust; _e_illume_kbd->adjust_end = 0; - if ((visible) && (_e_illume_kbd->border)) - _e_illume_kbd->adjust_end = _e_illume_kbd->border->h; + if ((visible) && (_e_illume_kbd->client)) + _e_illume_kbd->adjust_end = _e_illume_kbd->client->h; if (!_e_illume_kbd->animator) _e_illume_kbd->animator = ecore_animator_add(_e_mod_kbd_cb_animate, NULL); } @@ -516,14 +513,14 @@ _e_mod_kbd_cb_animate(void *data __UNUSED__) _e_illume_kbd->adjust = ((_e_illume_kbd->adjust_end * v) + (_e_illume_kbd->adjust_start * (1.0 - v))); - if ((_e_illume_kbd->border && _e_illume_kbd->border->cw)) + if (_e_illume_kbd->client) { - e_comp_win_effect_set(_e_illume_kbd->border->cw, "move"); + e_comp_object_effect_set(_e_illume_kbd->client->frame, "move"); /* set location */ - e_comp_win_effect_params_set(_e_illume_kbd->border->cw, 1, - (int[]){0, _e_illume_kbd->border->h - _e_illume_kbd->adjust}, 2); + e_comp_object_effect_params_set(_e_illume_kbd->client->frame, 1, + (int[]){0, _e_illume_kbd->client->h - _e_illume_kbd->adjust}, 2); /* use location */ - e_comp_win_effect_params_set(_e_illume_kbd->border->cw, 0, (int[]){1}, 1); + e_comp_object_effect_params_set(_e_illume_kbd->client->frame, 0, (int[]){1}, 1); } if (t == _e_illume_kbd->len) @@ -531,8 +528,8 @@ _e_mod_kbd_cb_animate(void *data __UNUSED__) _e_illume_kbd->animator = NULL; if (_focused_state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) { - if (_e_illume_kbd->border) - e_border_hide(_e_illume_kbd->border, 2); + if (_e_illume_kbd->client) + evas_object_hide(_e_illume_kbd->client->frame); _e_illume_kbd->visible = 0; } else @@ -548,43 +545,37 @@ _e_mod_kbd_cb_animate(void *data __UNUSED__) } static E_Illume_Keyboard * -_e_mod_kbd_by_border_get(E_Border *bd) +_e_mod_kbd_by_border_get(E_Client *ec) { Eina_List *l; - E_Border *over; + E_Client *over; - if ((!bd) || (!bd->stolen)) return NULL; + if ((!ec) || (!ec->stolen)) return NULL; /* if this border is the one that vkbd is working with, return the kbd */ - if (_e_illume_kbd->border == bd) return _e_illume_kbd; + if (_e_illume_kbd->client == ec) return _e_illume_kbd; /* loop the waiting borders */ EINA_LIST_FOREACH(_e_illume_kbd->waiting_borders, l, over) - if (over == bd) return _e_illume_kbd; + if (over == ec) return _e_illume_kbd; return NULL; } static void -_e_mod_kbd_border_adopt(E_Border *bd) +_e_mod_kbd_border_adopt(E_Client *ec) { - if ((!_e_illume_kbd) || (!bd)) return; + if ((!_e_illume_kbd) || (!ec)) return; - _e_illume_kbd->border = bd; + _e_illume_kbd->client = ec; if (!_e_illume_kbd->visible) { - E_Comp_Win *cw = bd->cw; - - if (!cw) cw = e_comp_win_find(bd->win); - if (cw) - { - e_comp_win_effect_set(cw, "move"); - /* set location */ - e_comp_win_effect_params_set(cw, 1, (int[]){0, bd->h}, 2); - /* use location */ - e_comp_win_effect_params_set(cw, 0, (int[]){1}, 1); - } + e_comp_object_effect_set(ec->frame, "move"); + /* set location */ + e_comp_object_effect_params_set(ec->frame, 1, (int[]){0, ec->h}, 2); + /* use location */ + e_comp_object_effect_params_set(ec->frame, 0, (int[]){1}, 1); _e_mod_kbd_layout_send(); } } @@ -629,8 +620,8 @@ _e_mod_kbd_layout_send(void) else if (_e_illume_kbd->layout == E_ILLUME_KEYBOARD_LAYOUT_NONE) type = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF; } - if (_e_illume_kbd->border) - ecore_x_e_virtual_keyboard_state_send(_e_illume_kbd->border->client.win, type); + if (_e_illume_kbd->client) + ecore_x_e_virtual_keyboard_state_send(e_client_util_win_get(_e_illume_kbd->client), type); } static void @@ -640,28 +631,28 @@ _e_mod_kbd_geometry_send(void) int y = 0; /* make sure we have a keyboard border */ - if (!_e_illume_kbd->border) return; + if (!_e_illume_kbd->client) return; /* no need. we send geometry only when kbd is visible or invisible */ /* adjust Y for keyboard visibility */ - //if (_e_illume_kbd->border->fx.y <= 0) - y = _e_illume_kbd->border->y; + //if (_e_illume_kbd->client->fx.y <= 0) + y = _e_illume_kbd->client->y; if (_focused_border) zone = _focused_border->zone; - else zone = _e_illume_kbd->border->zone; + else zone = _e_illume_kbd->client->zone; if (_e_illume_kbd->visible) ecore_x_e_illume_keyboard_geometry_set(zone->black_win, - _e_illume_kbd->border->x, + _e_illume_kbd->client->x, y, - _e_illume_kbd->border->w, - _e_illume_kbd->border->h); + _e_illume_kbd->client->w, + _e_illume_kbd->client->h); else ecore_x_e_illume_keyboard_geometry_set(zone->black_win, - _e_illume_kbd->border->x, - _e_illume_kbd->border->h + y, - _e_illume_kbd->border->w, - _e_illume_kbd->border->h); + _e_illume_kbd->client->x, + _e_illume_kbd->client->h + y, + _e_illume_kbd->client->w, + _e_illume_kbd->client->h); } static void @@ -671,26 +662,26 @@ _e_mod_kbd_changes_send(void) (_prev_focused_border != _focused_border)) { /* tell previous focused border it changed so layout udpates */ - if (_prev_focused_border->client.vkbd.state > + if (_prev_focused_border->vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN) { - if (!e_illume_border_is_conformant(_prev_focused_border)) + if (!e_illume_client_is_conformant(_prev_focused_border)) { _prev_focused_border->changes.size = 1; - BD_CHANGED(_prev_focused_border); + EC_CHANGED(_prev_focused_border); } } } /* tell the focused border it changed so layout gets udpated */ if ((_focused_border) && - (_focused_border->client.vkbd.state > + (_focused_border->vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN)) { - if (!e_illume_border_is_conformant(_focused_border)) + if (!e_illume_client_is_conformant(_focused_border)) { _focused_border->changes.size = 1; - BD_CHANGED(_focused_border); + EC_CHANGED(_focused_border); } } } diff --git a/src/modules/illume2/e_mod_main.c b/src/modules/illume2/e_mod_main.c index 52e4f805e..bd2fc4d60 100644 --- a/src/modules/illume2/e_mod_main.c +++ b/src/modules/illume2/e_mod_main.c @@ -15,9 +15,8 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume2" }; EAPI void * e_modapi_init(E_Module *m) { - Eina_List *ml, *cl, *zl; - E_Manager *man; - E_Container *con; + const Eina_List *cl, *zl; + E_Comp *comp; E_Zone *zone; Ecore_X_Window *zones; int zcount = 0; @@ -66,10 +65,9 @@ e_modapi_init(E_Module *m) e_mod_kbd_hide(); /* loop zones and get count */ - EINA_LIST_FOREACH(e_manager_list(), ml, man) - EINA_LIST_FOREACH(man->containers, cl, con) - EINA_LIST_FOREACH(con->zones, zl, zone) - zcount++; + EINA_LIST_FOREACH(e_comp_list(), cl, comp) + EINA_LIST_FOREACH(comp->zones, zl, zone) + zcount++; /* allocate enough zones */ zones = calloc(zcount, sizeof(Ecore_X_Window)); @@ -95,31 +93,28 @@ e_modapi_init(E_Module *m) zcount = 0; /* loop the zones and create quickpanels for each one */ - EINA_LIST_FOREACH(e_manager_list(), ml, man) + EINA_LIST_FOREACH(e_comp_list(), cl, comp) { - EINA_LIST_FOREACH(man->containers, cl, con) + EINA_LIST_FOREACH(comp->zones, zl, zone) { - EINA_LIST_FOREACH(con->zones, zl, zone) - { - E_Illume_Quickpanel *qp; + E_Illume_Quickpanel *qp; - /* set zone window in list of zones */ - zones[zcount] = zone->black_win; + /* set zone window in list of zones */ + zones[zcount] = zone->black_win; - /* increment zone count */ - zcount++; + /* increment zone count */ + zcount++; - /* try to create a new quickpanel for this zone */ - if (!(qp = e_mod_quickpanel_new(zone))) continue; + /* try to create a new quickpanel for this zone */ + if (!(qp = e_mod_quickpanel_new(zone))) continue; - /* append new qp to list */ - _e_illume_qps = eina_list_append(_e_illume_qps, qp); - } + /* append new qp to list */ + _e_illume_qps = eina_list_append(_e_illume_qps, qp); } /* set the zone list on this root. This is needed for some * elm apps like elm_indicator so that they know how many * indicators to create at startup */ - ecore_x_e_illume_zone_list_set(man->root, zones, zcount); + ecore_x_e_illume_zone_list_set(comp->man->root, zones, zcount); } /* free zones variable */ diff --git a/src/modules/illume2/e_mod_main.h b/src/modules/illume2/e_mod_main.h index fd4580ce9..1d01dfe1f 100644 --- a/src/modules/illume2/e_mod_main.h +++ b/src/modules/illume2/e_mod_main.h @@ -40,9 +40,9 @@ int e_mod_illume_config_init(void); int e_mod_illume_config_shutdown(void); int e_mod_illume_config_save(void); -void e_mod_illume_config_animation_show(E_Container *con, const char *params __UNUSED__); -void e_mod_illume_config_policy_show(E_Container *con, const char *params __UNUSED__); -void e_mod_illume_config_windows_show(E_Container *con, const char *params __UNUSED__); +void e_mod_illume_config_animation_show(E_Comp *comp, const char *params __UNUSED__); +void e_mod_illume_config_policy_show(E_Comp *comp, const char *params __UNUSED__); +void e_mod_illume_config_windows_show(E_Comp *comp, const char *params __UNUSED__); void e_mod_kbd_device_init(void); void e_mod_kbd_device_shutdown(void); int e_mod_policy_init(void); diff --git a/src/modules/illume2/e_mod_policy.c b/src/modules/illume2/e_mod_policy.c index 70e038900..05dcba341 100644 --- a/src/modules/illume2/e_mod_policy.c +++ b/src/modules/illume2/e_mod_policy.c @@ -16,9 +16,9 @@ static Eina_Bool _e_mod_policy_cb_zone_move_resize(void *data __UNUSED__, int ty static Eina_Bool _e_mod_policy_cb_client_message(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _e_mod_policy_cb_window_property(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _e_mod_policy_cb_policy_change(void *data __UNUSED__, int type, void *event __UNUSED__); -static void _e_mod_policy_cb_hook_post_fetch(void *data __UNUSED__, void *data2); -static void _e_mod_policy_cb_hook_post_assign(void *data __UNUSED__, void *data2); -static void _e_mod_policy_cb_hook_layout(void *data __UNUSED__, void *data2 __UNUSED__); +static void _e_mod_policy_cb_hook_post_fetch(void *data __UNUSED__, E_Client *ec); +static void _e_mod_policy_cb_hook_post_assign(void *data __UNUSED__, E_Client *ec); +static void _e_mod_policy_cb_hook_layout(void *data __UNUSED__, E_Comp *comp); /* local variables */ static E_Illume_Policy *_policy = NULL; @@ -30,8 +30,8 @@ int E_ILLUME_POLICY_EVENT_CHANGE = 0; int e_mod_policy_init(void) { - Eina_List *ml; - E_Manager *man; + const Eina_List *l; + E_Comp *comp; char *file; /* try to find the policy specified in config */ @@ -60,39 +60,32 @@ e_mod_policy_init(void) _e_mod_policy_hooks_add(); /* loop the root windows */ - EINA_LIST_FOREACH(e_manager_list(), ml, man) + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - Eina_List *cl; - E_Container *con; + Eina_List *zl; + E_Zone *zone; - /* loop the containers */ - EINA_LIST_FOREACH(man->containers, cl, con) + /* loop the zones */ + EINA_LIST_FOREACH(comp->zones, zl, zone) { - Eina_List *zl; - E_Zone *zone; + E_Illume_Config_Zone *cz; + Ecore_X_Illume_Mode mode = ECORE_X_ILLUME_MODE_SINGLE; - /* loop the zones */ - EINA_LIST_FOREACH(con->zones, zl, zone) + /* check for zone config */ + if (!(cz = e_illume_zone_config_get(zone->num))) + continue; + + /* set mode on this zone */ + if (cz->mode.dual == 0) + mode = ECORE_X_ILLUME_MODE_SINGLE; + else { - E_Illume_Config_Zone *cz; - Ecore_X_Illume_Mode mode = ECORE_X_ILLUME_MODE_SINGLE; - - /* check for zone config */ - if (!(cz = e_illume_zone_config_get(zone->num))) - continue; - - /* set mode on this zone */ - if (cz->mode.dual == 0) - mode = ECORE_X_ILLUME_MODE_SINGLE; - else - { - if ((cz->mode.dual == 1) && (cz->mode.side == 0)) - mode = ECORE_X_ILLUME_MODE_DUAL_TOP; - else if ((cz->mode.dual == 1) && (cz->mode.side == 1)) - mode = ECORE_X_ILLUME_MODE_DUAL_LEFT; - } - ecore_x_e_illume_mode_set(zone->black_win, mode); + if ((cz->mode.dual == 1) && (cz->mode.side == 0)) + mode = ECORE_X_ILLUME_MODE_DUAL_TOP; + else if ((cz->mode.dual == 1) && (cz->mode.side == 1)) + mode = ECORE_X_ILLUME_MODE_DUAL_LEFT; } + ecore_x_e_illume_mode_set(zone->black_win, mode); } } @@ -103,7 +96,7 @@ int e_mod_policy_shutdown(void) { Ecore_Event_Handler *hdl; - E_Border_Hook *hook; + E_Client_Hook *hook; /* remove the ecore event handlers */ EINA_LIST_FREE(_policy_hdls, hdl) @@ -111,7 +104,7 @@ e_mod_policy_shutdown(void) /* remove the border hooks */ EINA_LIST_FREE(_policy_hooks, hook) - e_border_hook_del(hook); + e_client_hook_del(hook); /* destroy the policy if it exists */ if (_policy) e_object_del(E_OBJECT(_policy)); @@ -231,25 +224,25 @@ _e_mod_policy_handlers_add(void) { _policy_hdls = eina_list_append(_policy_hdls, - ecore_event_handler_add(E_EVENT_BORDER_ADD, + ecore_event_handler_add(E_EVENT_CLIENT_ADD, _e_mod_policy_cb_border_add, NULL)); _policy_hdls = eina_list_append(_policy_hdls, - ecore_event_handler_add(E_EVENT_BORDER_REMOVE, + ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, _e_mod_policy_cb_border_del, NULL)); _policy_hdls = eina_list_append(_policy_hdls, - ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN, + ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_IN, _e_mod_policy_cb_border_focus_in, NULL)); _policy_hdls = eina_list_append(_policy_hdls, - ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT, + ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_OUT, _e_mod_policy_cb_border_focus_out, NULL)); _policy_hdls = eina_list_append(_policy_hdls, - ecore_event_handler_add(E_EVENT_BORDER_SHOW, + ecore_event_handler_add(E_EVENT_CLIENT_SHOW, _e_mod_policy_cb_border_show, NULL)); _policy_hdls = @@ -279,16 +272,16 @@ _e_mod_policy_hooks_add(void) { _policy_hooks = eina_list_append(_policy_hooks, - e_border_hook_add(E_BORDER_HOOK_EVAL_POST_FETCH, + e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_FETCH, _e_mod_policy_cb_hook_post_fetch, NULL)); _policy_hooks = eina_list_append(_policy_hooks, - e_border_hook_add(E_BORDER_HOOK_EVAL_POST_BORDER_ASSIGN, + e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, _e_mod_policy_cb_hook_post_assign, NULL)); _policy_hooks = eina_list_append(_policy_hooks, - e_border_hook_add(E_BORDER_HOOK_CONTAINER_LAYOUT, - _e_mod_policy_cb_hook_layout, NULL)); + e_client_hook_add(E_CLIENT_HOOK_CANVAS_LAYOUT, + (E_Client_Hook_Cb)_e_mod_policy_cb_hook_layout, NULL)); } static void @@ -311,11 +304,11 @@ _e_mod_policy_cb_free(E_Illume_Policy *p) static Eina_Bool _e_mod_policy_cb_border_add(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Add *ev; + E_Event_Client *ev; ev = event; if ((_policy) && (_policy->funcs.border_add)) - _policy->funcs.border_add(ev->border); + _policy->funcs.border_add(ev->ec); return ECORE_CALLBACK_PASS_ON; } @@ -323,11 +316,11 @@ _e_mod_policy_cb_border_add(void *data __UNUSED__, int type __UNUSED__, void *ev static Eina_Bool _e_mod_policy_cb_border_del(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev; + E_Event_Client *ev; ev = event; if ((_policy) && (_policy->funcs.border_del)) - _policy->funcs.border_del(ev->border); + _policy->funcs.border_del(ev->ec); return ECORE_CALLBACK_PASS_ON; } @@ -335,11 +328,11 @@ _e_mod_policy_cb_border_del(void *data __UNUSED__, int type __UNUSED__, void *ev static Eina_Bool _e_mod_policy_cb_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_In *ev; + E_Event_Client *ev; ev = event; if ((_policy) && (_policy->funcs.border_focus_in)) - _policy->funcs.border_focus_in(ev->border); + _policy->funcs.border_focus_in(ev->ec); return ECORE_CALLBACK_PASS_ON; } @@ -347,11 +340,11 @@ _e_mod_policy_cb_border_focus_in(void *data __UNUSED__, int type __UNUSED__, voi static Eina_Bool _e_mod_policy_cb_border_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_Out *ev; + E_Event_Client *ev; ev = event; if ((_policy) && (_policy->funcs.border_focus_out)) - _policy->funcs.border_focus_out(ev->border); + _policy->funcs.border_focus_out(ev->ec); return ECORE_CALLBACK_PASS_ON; } @@ -359,11 +352,11 @@ _e_mod_policy_cb_border_focus_out(void *data __UNUSED__, int type __UNUSED__, vo static Eina_Bool _e_mod_policy_cb_border_show(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Show *ev; + E_Event_Client *ev; ev = event; if ((_policy) && (_policy->funcs.border_show)) - _policy->funcs.border_show(ev->border); + _policy->funcs.border_show(ev->ec); return ECORE_CALLBACK_PASS_ON; } @@ -384,13 +377,13 @@ static E_Zone * _e_mod_zone_win_get(Ecore_X_Window win) { E_Zone *zone = NULL; - E_Border *bd; + E_Client *ec; - if (!(bd = e_border_find_by_client_window(win))) + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, win))) { if (!(zone = e_util_zone_window_find(win))) return NULL; } - else if (bd->zone) zone = bd->zone; + else if (ec->zone) zone = ec->zone; return zone; } @@ -402,11 +395,11 @@ _e_mod_policy_cb_client_message(void *data __UNUSED__, int type __UNUSED__, void ev = event; if (ev->message_type == ECORE_X_ATOM_NET_ACTIVE_WINDOW) { - E_Border *bd; + E_Client *ec; - if (!(bd = e_border_find_by_client_window(ev->win))) return ECORE_CALLBACK_PASS_ON; + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->win))) return ECORE_CALLBACK_PASS_ON; if ((_policy) && (_policy->funcs.border_activate)) - _policy->funcs.border_activate(bd); + _policy->funcs.border_activate(ec); } else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_MODE) { @@ -450,19 +443,19 @@ _e_mod_policy_cb_client_message(void *data __UNUSED__, int type __UNUSED__, void } else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_DRAG_START) { - E_Border *bd; + E_Client *ec; - if (!(bd = e_border_find_by_client_window(ev->win))) return ECORE_CALLBACK_PASS_ON; + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->win))) return ECORE_CALLBACK_PASS_ON; if ((_policy) && (_policy->funcs.drag_start)) - _policy->funcs.drag_start(bd); + _policy->funcs.drag_start(ec); } else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_DRAG_END) { - E_Border *bd; + E_Client *ec; - if (!(bd = e_border_find_by_client_window(ev->win))) return ECORE_CALLBACK_PASS_ON; + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->win))) return ECORE_CALLBACK_PASS_ON; if ((_policy) && (_policy->funcs.drag_end)) - _policy->funcs.drag_end(bd); + _policy->funcs.drag_end(ec); } return ECORE_CALLBACK_PASS_ON; @@ -499,44 +492,40 @@ _e_mod_policy_cb_policy_change(void *data __UNUSED__, int type, void *event __UN } static void -_e_mod_policy_cb_hook_post_fetch(void *data __UNUSED__, void *data2) +_e_mod_policy_cb_hook_post_fetch(void *data __UNUSED__, E_Client *ec) { - E_Border *bd; - - if (!(bd = data2)) return; if ((_policy) && (_policy->funcs.border_post_fetch)) - _policy->funcs.border_post_fetch(bd); + _policy->funcs.border_post_fetch(ec); } static void -_e_mod_policy_cb_hook_post_assign(void *data __UNUSED__, void *data2) +_e_mod_policy_cb_hook_post_assign(void *data __UNUSED__, E_Client *ec) { - E_Border *bd; - - if (!(bd = data2)) return; if ((_policy) && (_policy->funcs.border_post_assign)) - _policy->funcs.border_post_assign(bd); + _policy->funcs.border_post_assign(ec); } static void -_e_mod_policy_cb_hook_layout(void *data __UNUSED__, void *data2 __UNUSED__) +_e_mod_policy_cb_hook_layout(void *data __UNUSED__, E_Comp *comp) { E_Zone *zone; - E_Border *bd; - Eina_List *zl = NULL, *l; + E_Client *ec; + Eina_List *zl = NULL; + const Eina_List *l; - /* loop through border list and find what changed */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + /* loop through client list and find what changed */ + EINA_LIST_FOREACH(comp->clients, l, ec) { - if ((bd->new_client) || (bd->pending_move_resize) || - (bd->changes.pos) || (bd->changes.size) || (bd->changes.visible) || - (bd->need_shape_export) || (bd->need_shape_merge)) + if (e_client_util_ignored_get(ec)) continue; + if ((ec->new_client) || + (ec->changes.pos) || (ec->changes.size) || (ec->changes.visible) || + (ec->need_shape_export) || (ec->need_shape_merge)) { /* NB: this border changed. add it's zone to list of what needs * updating. This is done so we do not waste cpu cycles * updating zones where nothing changed */ - if (!eina_list_data_find(zl, bd->zone)) - zl = eina_list_append(zl, bd->zone); + if (!eina_list_data_find(zl, ec->zone)) + zl = eina_list_append(zl, ec->zone); } } diff --git a/src/modules/illume2/e_mod_quickpanel.c b/src/modules/illume2/e_mod_quickpanel.c index fb7d9ca61..8b2913bfd 100644 --- a/src/modules/illume2/e_mod_quickpanel.c +++ b/src/modules/illume2/e_mod_quickpanel.c @@ -8,7 +8,7 @@ static Eina_Bool _e_mod_quickpanel_cb_border_add(void *data __UNUSED__, int type static Eina_Bool _e_mod_quickpanel_cb_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _e_mod_quickpanel_cb_border_resize(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _e_mod_quickpanel_cb_border_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event); -static void _e_mod_quickpanel_cb_post_fetch(void *data __UNUSED__, void *data2); +static void _e_mod_quickpanel_cb_post_fetch(void *data __UNUSED__, E_Client *ec); static void _e_mod_quickpanel_cb_free(E_Illume_Quickpanel *qp); static Eina_Bool _e_mod_quickpanel_cb_delay_hide(void *data); static void _e_mod_quickpanel_slide(E_Illume_Quickpanel *qp, int visible, double len); @@ -22,7 +22,7 @@ static void _e_mod_quickpanel_clickwin_hide(E_Illume_Quickpanel *qp); /* local variables */ static Eina_List *_qp_hdls = NULL; -static E_Border_Hook *_qp_hook = NULL; +static E_Client_Hook *_qp_hook = NULL; int e_mod_quickpanel_init(void) @@ -35,27 +35,27 @@ e_mod_quickpanel_init(void) NULL)); _qp_hdls = eina_list_append(_qp_hdls, - ecore_event_handler_add(E_EVENT_BORDER_ADD, + ecore_event_handler_add(E_EVENT_CLIENT_ADD, _e_mod_quickpanel_cb_border_add, NULL)); _qp_hdls = eina_list_append(_qp_hdls, - ecore_event_handler_add(E_EVENT_BORDER_REMOVE, + ecore_event_handler_add(E_EVENT_CLIENT_REMOVE, _e_mod_quickpanel_cb_border_remove, NULL)); _qp_hdls = eina_list_append(_qp_hdls, - ecore_event_handler_add(E_EVENT_BORDER_RESIZE, + ecore_event_handler_add(E_EVENT_CLIENT_RESIZE, _e_mod_quickpanel_cb_border_resize, NULL)); _qp_hdls = eina_list_append(_qp_hdls, - ecore_event_handler_add(E_EVENT_BORDER_UNICONIFY, + ecore_event_handler_add(E_EVENT_CLIENT_UNICONIFY, _e_mod_quickpanel_cb_border_uniconify, NULL)); /* add hook for new borders so we can test for qp borders */ - _qp_hook = e_border_hook_add(E_BORDER_HOOK_EVAL_PRE_POST_FETCH, + _qp_hook = e_client_hook_add(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, _e_mod_quickpanel_cb_post_fetch, NULL); return 1; @@ -71,7 +71,7 @@ e_mod_quickpanel_shutdown(void) ecore_event_handler_del(hdl); /* delete the border hook */ - if (_qp_hook) e_border_hook_del(_qp_hook); + if (_qp_hook) e_client_hook_del(_qp_hook); _qp_hook = NULL; return 1; @@ -125,24 +125,24 @@ e_mod_quickpanel_show(E_Illume_Quickpanel *qp) if (duration <= 0) { Eina_List *l; - E_Border *bd; + E_Client *ec; int ny = 0; ny = qp->vert.isize; if (qp->vert.dir == 1) ny = 0; /* if we are not animating, just show the borders */ - EINA_LIST_FOREACH(qp->borders, l, bd) + EINA_LIST_FOREACH(qp->borders, l, ec) { - if (!bd->visible) e_illume_border_show(bd); + if (!ec->visible) e_illume_client_show(ec); - if (qp->vert.dir) ny -= bd->h; - e_comp_win_effect_set(bd->cw, "move"); + if (qp->vert.dir) ny -= ec->h; + e_comp_object_effect_set(ec->frame, "move"); /* set location */ - e_comp_win_effect_params_set(bd->cw, 1, (int[]){0, ny}, 2); + e_comp_object_effect_params_set(ec->frame, 1, (int[]){0, ny}, 2); /* use location */ - e_comp_win_effect_params_set(bd->cw, 0, (int[]){1}, 1); - if (qp->vert.dir == 0) ny += bd->h; + e_comp_object_effect_params_set(ec->frame, 0, (int[]){1}, 1); + if (qp->vert.dir == 0) ny += ec->h; } qp->visible = 1; _e_mod_quickpanel_clickwin_show(qp); @@ -202,12 +202,12 @@ _e_mod_quickpanel_cb_client_message(void *data __UNUSED__, int type __UNUSED__, } else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE) { - E_Border *bd; + E_Client *ec; E_Illume_Quickpanel *qp; - if (!(bd = e_border_find_by_client_window(ev->win))) + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->win))) return ECORE_CALLBACK_PASS_ON; - if (!(qp = e_illume_quickpanel_by_zone_get(bd->zone))) + if (!(qp = e_illume_quickpanel_by_zone_get(ec->zone))) return ECORE_CALLBACK_PASS_ON; _e_mod_quickpanel_position_update(qp); } @@ -231,29 +231,29 @@ _e_mod_quickpanel_cb_mouse_up(void *data, int type __UNUSED__, void *event) static Eina_Bool _e_mod_quickpanel_cb_border_add(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Add *ev; + E_Event_Client *ev; E_Illume_Quickpanel *qp; E_Zone *zone; int iy; ev = event; - if (!ev->border->client.illume.quickpanel.quickpanel) + if (!ev->ec->illume.quickpanel.quickpanel) return ECORE_CALLBACK_PASS_ON; - if (!(zone = ev->border->zone)) return ECORE_CALLBACK_PASS_ON; + if (!(zone = ev->ec->zone)) return ECORE_CALLBACK_PASS_ON; /* if this border should be on a different zone, get requested zone */ - if ((int)zone->num != ev->border->client.illume.quickpanel.zone) + if ((int)zone->num != ev->ec->illume.quickpanel.zone) { - E_Container *con; + E_Comp *comp; int zn = 0; /* find this zone */ - if (!(con = e_container_current_get(e_manager_current_get()))) + if (!(comp = e_util_comp_current_get())) return ECORE_CALLBACK_PASS_ON; - zn = ev->border->client.illume.quickpanel.zone; - zone = e_util_container_zone_number_get(con->num, zn); - if (!zone) zone = e_util_container_zone_number_get(con->num, 0); + zn = ev->ec->illume.quickpanel.zone; + zone = e_util_comp_zone_number_get(comp->num, zn); + if (!zone) zone = e_util_comp_zone_number_get(comp->num, 0); if (!zone) return ECORE_CALLBACK_PASS_ON; } @@ -261,19 +261,19 @@ _e_mod_quickpanel_cb_border_add(void *data __UNUSED__, int type __UNUSED__, void return ECORE_CALLBACK_PASS_ON; /* set position and zone */ - e_illume_border_indicator_pos_get(zone, NULL, &iy); - if ((ev->border->x != zone->x) || (ev->border->y != iy)) - e_border_move(ev->border, zone->x, iy); - if (ev->border->zone != zone) - e_border_zone_set(ev->border, zone); + e_illume_client_indicator_pos_get(zone, NULL, &iy); + if ((ev->ec->x != zone->x) || (ev->ec->y != iy)) + evas_object_move(ev->ec->frame, zone->x, iy); + if (ev->ec->zone != zone) + e_client_zone_set(ev->ec, zone); /* hide this border */ - e_illume_border_hide(ev->border); + e_illume_client_hide(ev->ec); - qp->vert.size += ev->border->h; + qp->vert.size += ev->ec->h; /* add this border to QP border collection */ - qp->borders = eina_list_append(qp->borders, ev->border); + qp->borders = eina_list_append(qp->borders, ev->ec); return ECORE_CALLBACK_PASS_ON; } @@ -281,30 +281,30 @@ _e_mod_quickpanel_cb_border_add(void *data __UNUSED__, int type __UNUSED__, void static Eina_Bool _e_mod_quickpanel_cb_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev; + E_Event_Client *ev; E_Illume_Quickpanel *qp; E_Zone *zone; Eina_List *l; - E_Border *bd; + E_Client *ec; ev = event; - if (!ev->border->client.illume.quickpanel.quickpanel) + if (!ev->ec->illume.quickpanel.quickpanel) return ECORE_CALLBACK_PASS_ON; - if (!(zone = ev->border->zone)) return ECORE_CALLBACK_PASS_ON; + if (!(zone = ev->ec->zone)) return ECORE_CALLBACK_PASS_ON; /* if this border should be on a different zone, get requested zone */ - if ((int)zone->num != ev->border->client.illume.quickpanel.zone) + if ((int)zone->num != ev->ec->illume.quickpanel.zone) { - E_Container *con; + E_Comp *comp; int zn = 0; /* find this zone */ - if (!(con = e_container_current_get(e_manager_current_get()))) + if (!(comp = e_util_comp_current_get())) return ECORE_CALLBACK_PASS_ON; - zn = ev->border->client.illume.quickpanel.zone; - zone = e_util_container_zone_number_get(con->num, zn); - if (!zone) zone = e_util_container_zone_number_get(con->num, 0); + zn = ev->ec->illume.quickpanel.zone; + zone = e_util_comp_zone_number_get(comp->num, zn); + if (!zone) zone = e_util_comp_zone_number_get(comp->num, 0); if (!zone) return ECORE_CALLBACK_PASS_ON; } @@ -313,11 +313,11 @@ _e_mod_quickpanel_cb_border_remove(void *data __UNUSED__, int type __UNUSED__, v /* add this border to QP border collection */ if (qp->borders) - qp->borders = eina_list_remove(qp->borders, ev->border); + qp->borders = eina_list_remove(qp->borders, ev->ec); qp->vert.size = 0; - EINA_LIST_FOREACH(qp->borders, l, bd) - qp->vert.size += bd->h; + EINA_LIST_FOREACH(qp->borders, l, ec) + qp->vert.size += ec->h; return ECORE_CALLBACK_PASS_ON; } @@ -325,20 +325,20 @@ _e_mod_quickpanel_cb_border_remove(void *data __UNUSED__, int type __UNUSED__, v static Eina_Bool _e_mod_quickpanel_cb_border_resize(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Resize *ev; + E_Event_Client *ev; E_Illume_Quickpanel *qp; Eina_List *l; - E_Border *bd; + E_Client *ec; ev = event; - if (!ev->border->client.illume.quickpanel.quickpanel) + if (!ev->ec->illume.quickpanel.quickpanel) return ECORE_CALLBACK_PASS_ON; - if (!(qp = e_illume_quickpanel_by_zone_get(ev->border->zone))) + if (!(qp = e_illume_quickpanel_by_zone_get(ev->ec->zone))) return ECORE_CALLBACK_PASS_ON; qp->vert.size = 0; - EINA_LIST_FOREACH(qp->borders, l, bd) - qp->vert.size += bd->h; + EINA_LIST_FOREACH(qp->borders, l, ec) + qp->vert.size += ec->h; return ECORE_CALLBACK_PASS_ON; } @@ -346,32 +346,29 @@ _e_mod_quickpanel_cb_border_resize(void *data __UNUSED__, int type __UNUSED__, v static Eina_Bool _e_mod_quickpanel_cb_border_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Uniconify *ev; + E_Event_Client *ev; E_Illume_Quickpanel *qp; ev = event; - if (!ev->border->client.illume.quickpanel.quickpanel) + if (!ev->ec->illume.quickpanel.quickpanel) return ECORE_CALLBACK_PASS_ON; - if (!(qp = e_illume_quickpanel_by_zone_get(ev->border->zone))) + if (!(qp = e_illume_quickpanel_by_zone_get(ev->ec->zone))) return ECORE_CALLBACK_PASS_ON; e_mod_quickpanel_show(qp); return ECORE_CALLBACK_PASS_ON; } static void -_e_mod_quickpanel_cb_post_fetch(void *data __UNUSED__, void *data2) +_e_mod_quickpanel_cb_post_fetch(void *data __UNUSED__, E_Client *ec) { - E_Border *bd; - - if (!(bd = data2)) return; - if (!bd->client.illume.quickpanel.quickpanel) return; - bd->stolen = 1; + if (!ec->illume.quickpanel.quickpanel) return; + ec->stolen = 1; } static void _e_mod_quickpanel_cb_free(E_Illume_Quickpanel *qp) { - E_Border *bd; + E_Client *ec; /* delete the animator if it exists */ if (qp->animator) ecore_animator_del(qp->animator); @@ -390,8 +387,8 @@ _e_mod_quickpanel_cb_free(E_Illume_Quickpanel *qp) qp->mouse_hdl = NULL; /* set the borders of this quickpanel to not stolen */ - EINA_LIST_FREE(qp->borders, bd) - bd->stolen = 0; + EINA_LIST_FREE(qp->borders, ec) + ec->stolen = 0; /* free the structure */ E_FREE(qp); @@ -451,15 +448,15 @@ _e_mod_quickpanel_hide(E_Illume_Quickpanel *qp) if (duration <= 0) { Eina_List *l; - E_Border *bd; + E_Client *ec; /* if we are not animating, hide the qp borders */ - EINA_LIST_REVERSE_FOREACH(qp->borders, l, bd) + EINA_LIST_REVERSE_FOREACH(qp->borders, l, ec) { - e_comp_win_effect_set(bd->cw, "move"); + e_comp_object_effect_set(ec->frame, "move"); /* unuse location */ - e_comp_win_effect_params_set(bd->cw, 0, (int[]){0}, 1); - if (bd->visible) e_illume_border_hide(bd); + e_comp_object_effect_params_set(ec->frame, 0, (int[]){0}, 1); + if (ec->visible) e_illume_client_hide(ec); } qp->visible = 0; _e_mod_quickpanel_clickwin_hide(qp); @@ -516,15 +513,15 @@ static void _e_mod_quickpanel_position_update(E_Illume_Quickpanel *qp) { Eina_List *l; - E_Border *bd; + E_Client *ec; int iy = 0; if (!qp) return; _e_mod_quickpanel_hide(qp); if (!qp->zone) return; - e_illume_border_indicator_pos_get(qp->zone, NULL, &iy); - EINA_LIST_FOREACH(qp->borders, l, bd) - e_border_move(bd, qp->zone->x, iy); + e_illume_client_indicator_pos_get(qp->zone, NULL, &iy); + EINA_LIST_FOREACH(qp->borders, l, ec) + evas_object_move(ec->frame, qp->zone->x, iy); qp->vert.dir = 0; if ((iy + qp->vert.isize + qp->vert.size) > qp->zone->h) qp->vert.dir = 1; @@ -534,35 +531,35 @@ static void _e_mod_quickpanel_animate_down(E_Illume_Quickpanel *qp) { Eina_List *l; - E_Border *bd; + E_Client *ec; int pbh = 0; if (!qp) return; pbh = (qp->vert.isize - qp->vert.size); - EINA_LIST_FOREACH(qp->borders, l, bd) + EINA_LIST_FOREACH(qp->borders, l, ec) { /* don't adjust borders that are being deleted */ - if (e_object_is_del(E_OBJECT(bd))) continue; - e_comp_win_effect_set(bd->cw, "move"); + if (e_object_is_del(E_OBJECT(ec))) continue; + e_comp_object_effect_set(ec->frame, "move"); /* set location */ - e_comp_win_effect_params_set(bd->cw, 1, + e_comp_object_effect_params_set(ec->frame, 1, (int[]){0, qp->vert.adjust + pbh}, 2); /* use location */ - e_comp_win_effect_params_set(bd->cw, 0, (int[]){1}, 1); - pbh += bd->h; + e_comp_object_effect_params_set(ec->frame, 0, (int[]){1}, 1); + pbh += ec->h; if (!qp->visible) { if (qp->vert.adjust + pbh > 0) { - if (!bd->visible) e_illume_border_show(bd); + if (!ec->visible) e_illume_client_show(ec); } } else { if (qp->vert.adjust + pbh <= 10) { - if (bd->visible) e_illume_border_hide(bd); + if (ec->visible) e_illume_client_hide(ec); } } } @@ -572,35 +569,35 @@ static void _e_mod_quickpanel_animate_up(E_Illume_Quickpanel *qp) { Eina_List *l; - E_Border *bd; + E_Client *ec; int pbh = 0; if (!qp) return; pbh = qp->vert.size; - EINA_LIST_FOREACH(qp->borders, l, bd) + EINA_LIST_FOREACH(qp->borders, l, ec) { /* don't adjust borders that are being deleted */ - if (e_object_is_del(E_OBJECT(bd))) continue; - pbh -= bd->h; - e_comp_win_effect_set(bd->cw, "move"); + if (e_object_is_del(E_OBJECT(ec))) continue; + pbh -= ec->h; + e_comp_object_effect_set(ec->frame, "move"); /* set location */ - e_comp_win_effect_params_set(bd->cw, 1, + e_comp_object_effect_params_set(ec->frame, 1, (int[]){0, qp->vert.adjust + pbh}, 2); /* use location */ - e_comp_win_effect_params_set(bd->cw, 0, (int[]){1}, 1); + e_comp_object_effect_params_set(ec->frame, 0, (int[]){1}, 1); if (!qp->visible) { if (qp->vert.adjust + pbh < 0) { - if (!bd->visible) e_illume_border_show(bd); + if (!ec->visible) e_illume_client_show(ec); } } else { if (qp->vert.adjust + pbh >= -10) { - if (bd->visible) e_illume_border_hide(bd); + if (ec->visible) e_illume_client_hide(ec); } } } @@ -609,14 +606,14 @@ _e_mod_quickpanel_animate_up(E_Illume_Quickpanel *qp) static void _e_mod_quickpanel_clickwin_show(E_Illume_Quickpanel *qp) { - E_Border *ind; + E_Client *ind; if ((!qp) || (!qp->borders) || (!qp->zone)) return; if (!(ind = eina_list_nth(qp->borders, 0))) return; if (qp->clickwin) ecore_x_window_free(qp->clickwin); qp->clickwin = 0; - qp->clickwin = ecore_x_window_input_new(qp->zone->container->win, + qp->clickwin = ecore_x_window_input_new(qp->zone->comp->win, qp->zone->x, qp->zone->y, qp->zone->w, qp->zone->h); @@ -625,7 +622,7 @@ _e_mod_quickpanel_clickwin_show(E_Illume_Quickpanel *qp) ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, qp->zone->x, qp->zone->y, qp->zone->w, qp->zone->h, 0, - ind->win, ECORE_X_WINDOW_STACK_BELOW); + e_client_util_pwin_get(ind), ECORE_X_WINDOW_STACK_BELOW); ecore_x_window_show(qp->clickwin); } diff --git a/src/modules/illume2/e_mod_select_window.c b/src/modules/illume2/e_mod_select_window.c index 49fb12f63..9f53aaadb 100644 --- a/src/modules/illume2/e_mod_select_window.c +++ b/src/modules/illume2/e_mod_select_window.c @@ -7,7 +7,7 @@ static void _e_mod_illume_config_select_window_free_data(E_Config_Dialog *cfd, E static Evas_Object *_e_mod_illume_config_select_window_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static void _e_mod_illume_config_select_window_list_changed(void *data); static Eina_Bool _e_mod_illume_config_select_window_change_timeout(void *data); -static int _e_mod_illume_config_select_window_match(E_Border *bd); +static int _e_mod_illume_config_select_window_match(E_Client *ec); /* local variables */ E_Illume_Select_Window_Type stype; @@ -32,7 +32,7 @@ e_mod_illume_config_select_window(E_Illume_Select_Window_Type type) v->basic_only = 1; v->normal_win = 1; v->scroll = 1; - cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()), + cfd = e_config_dialog_new(NULL, _("Select Home Window"), "E", "_config_illume_select_window", "enlightenment/windows", 0, v, NULL); @@ -56,7 +56,7 @@ static Evas_Object * _e_mod_illume_config_select_window_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata __UNUSED__) { Evas_Object *list, *ow; - Eina_List *bds, *l; + Eina_List *ecs, *l; E_Zone *zone; int i, sel = -1; @@ -70,21 +70,22 @@ _e_mod_illume_config_select_window_create(E_Config_Dialog *cfd __UNUSED__, Evas e_widget_ilist_clear(ow); e_widget_ilist_go(ow); - if ((bds = e_border_client_list())) + if ((ecs = zone->comp->clients)) { - for (i = 0, l = bds; l; l = l->next, i++) + for (i = 0, l = ecs; l; l = l->next, i++) { - E_Border *bd; + E_Client *ec; const char *name; - if (!(bd = l->data)) continue; - if (bd->zone != zone) continue; - if (e_object_is_del(E_OBJECT(bd))) continue; - if (!(name = e_border_name_get(bd))) continue; - if (_e_mod_illume_config_select_window_match(bd)) sel = i; + if (!(ec = l->data)) continue; + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (e_object_is_del(E_OBJECT(ec))) continue; + if (!(name = e_client_name_get(ec))) continue; + if (_e_mod_illume_config_select_window_match(ec)) sel = i; e_widget_ilist_append(ow, NULL, name, _e_mod_illume_config_select_window_list_changed, - bd, name); + ec, name); } } @@ -101,14 +102,14 @@ _e_mod_illume_config_select_window_create(E_Config_Dialog *cfd __UNUSED__, Evas static void _e_mod_illume_config_select_window_list_changed(void *data) { - E_Border *bd; + E_Client *ec; Ecore_X_Window_Type wtype; char *title, *name, *class; - if (!(bd = data)) return; - title = ecore_x_icccm_title_get(bd->client.win); - ecore_x_icccm_name_class_get(bd->client.win, &name, &class); - ecore_x_netwm_window_type_get(bd->client.win, &wtype); + if (!(ec = data)) return; + title = ecore_x_icccm_title_get(e_client_util_win_get(ec)); + ecore_x_icccm_name_class_get(e_client_util_win_get(ec), &name, &class); + ecore_x_netwm_window_type_get(e_client_util_win_get(ec), &wtype); switch (stype) { @@ -152,16 +153,16 @@ _e_mod_illume_config_select_window_change_timeout(__UNUSED__ void *data) } static int -_e_mod_illume_config_select_window_match(E_Border *bd) +_e_mod_illume_config_select_window_match(E_Client *ec) { Ecore_X_Window_Type wtype; char *title, *name, *class; int match = 0; - if (!bd) return 0; - title = ecore_x_icccm_title_get(bd->client.win); - ecore_x_icccm_name_class_get(bd->client.win, &name, &class); - ecore_x_netwm_window_type_get(bd->client.win, &wtype); + if (!ec) return 0; + title = ecore_x_icccm_title_get(e_client_util_win_get(ec)); + ecore_x_icccm_name_class_get(e_client_util_win_get(ec), &name, &class); + ecore_x_netwm_window_type_get(e_client_util_win_get(ec), &wtype); switch (stype) { diff --git a/src/modules/illume2/policies/illume/policy.c b/src/modules/illume2/policies/illume/policy.c index 5e619a2c4..7de78af06 100644 --- a/src/modules/illume2/policies/illume/policy.c +++ b/src/modules/illume2/policies/illume/policy.c @@ -9,67 +9,67 @@ #define DIALOG_USES_PIXEL_BORDER 1 /* local function prototypes */ -static void _policy_border_set_focus(E_Border *bd); -static void _policy_border_move(E_Border *bd, int x, int y); -static void _policy_border_resize(E_Border *bd, int w, int h); -static void _policy_border_hide_above(E_Border *bd); -static void _policy_border_hide_below(E_Border *bd); -static void _policy_border_show_below(E_Border *bd); +static void _policy_border_set_focus(E_Client *ec); +static void _policy_border_move(E_Client *ec, int x, int y); +static void _policy_border_resize(E_Client *ec, int w, int h); +static void _policy_border_hide_above(E_Client *ec); +static void _policy_border_hide_below(E_Client *ec); +static void _policy_border_show_below(E_Client *ec); static void _policy_zone_layout_update(E_Zone *zone); -static void _policy_zone_layout_indicator(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_quickpanel(E_Border *bd); -static void _policy_zone_layout_softkey(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_keyboard(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_home_single(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_home_dual_top(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_home_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_home_dual_left(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_fullscreen(E_Border *bd); -static void _policy_zone_layout_app_single(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_app_dual_top(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_app_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_app_dual_left(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_splash(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_conformant_single(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_conformant_dual_top(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_conformant_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_conformant_dual_left(E_Border *bd, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_indicator(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_quickpanel(E_Client *ec); +static void _policy_zone_layout_softkey(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_keyboard(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_home_single(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_home_dual_top(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_home_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_home_dual_left(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_fullscreen(E_Client *ec); +static void _policy_zone_layout_app_single(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_app_dual_top(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_app_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_app_dual_left(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_dialog(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_splash(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_conformant_single(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_conformant_dual_top(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_conformant_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_conformant_dual_left(E_Client *ec, E_Illume_Config_Zone *cz); static Eina_List *_pol_focus_stack; /* local functions */ static void -_policy_border_set_focus(E_Border *bd) +_policy_border_set_focus(E_Client *ec) { - if (!bd) return; + if (!ec) return; /* if focus is locked out then get out */ - if (bd->lock_focus_out) return; + if (ec->lock_focus_out) return; /* make sure the border can accept or take focus */ - if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus)) + if ((ec->icccm.accepts_focus) || (ec->icccm.take_focus)) { /* check E's focus settings */ if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) || - ((bd->parent) && + ((ec->parent) && ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) || - ((bd->parent->focused) && + ((ec->parent->focused) && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED))))) { /* if the border was hidden due to layout, we need to unhide */ - if (!bd->visible) e_illume_border_show(bd); + if (!ec->visible) e_illume_client_show(ec); - if ((bd->iconic) && (!bd->lock_user_iconify)) - e_border_uniconify(bd); + if ((ec->iconic) && (!ec->lock_user_iconify)) + e_client_uniconify(ec); - if (!bd->lock_user_stacking) e_border_raise(bd); + if (!ec->lock_user_stacking) evas_object_raise(ec->frame); /* focus the border */ - e_border_focus_set(bd, 1, 1); + evas_object_focus_set(ec->frame, 1); /* hide the border below this one */ - _policy_border_hide_below(bd); + _policy_border_hide_below(ec); /* NB: since we skip needless border evals when container layout * is called (to save cpu cycles), we need to @@ -79,202 +79,166 @@ _policy_border_set_focus(E_Border *bd) * This is potentially useless as THIS policy * makes all windows borderless anyway, but it's in here for * completeness - e_border_focus_latest_set(bd); - if (bd->bg_object) - 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"); - e_focus_event_focus_in(bd); + e_client_focus_latest_set(ec); + if (ec->bg_object) + edje_object_signal_emit(ec->bg_object, "e,state,focused", "e"); + if (ec->icon_object) + edje_object_signal_emit(ec->icon_object, "e,state,focused", "e"); + e_focus_event_focus_in(ec); */ } } } static void -_policy_border_move(E_Border *bd, int x, int y) +_policy_border_move(E_Client *ec, int x, int y) { - if (!bd) return; + if (!ec) return; /* NB: Qt uses a weird window type called 'VCLSalFrame' that needs to - * have bd->placed set else it doesn't position correctly... + * have ec->placed set else it doesn't position correctly... * this could be a result of E honoring the icccm request position, * not sure */ /* NB: Seems something similar happens with elementary windows also - * so for now just set bd->placed on all windows until this + * so for now just set ec->placed on all windows until this * gets investigated */ - bd->placed = 1; - bd->x = x; - bd->y = y; - bd->changes.pos = 1; - BD_CHANGED(bd); + ec->placed = 1; + ec->x = x; + ec->y = y; + ec->changes.pos = 1; + EC_CHANGED(ec); } static void -_policy_border_resize(E_Border *bd, int w, int h) +_policy_border_resize(E_Client *ec, int w, int h) { - if (!bd) return; + if (!ec) return; - bd->w = w; - bd->h = h; - bd->client.w = (bd->w - (bd->client_inset.l + bd->client_inset.r)); - bd->client.h = (bd->h - (bd->client_inset.t + bd->client_inset.b)); - bd->changes.size = 1; - BD_CHANGED(bd); + ec->w = w; + ec->h = h; + e_comp_object_frame_wh_unadjust(ec->frame, ec->w, ec->h, &ec->client.w, &ec->client.h); + ec->changes.size = 1; + EC_CHANGED(ec); } static void -_policy_border_hide_above(E_Border *bd) +_policy_border_hide_above(E_Client *ec) { - int pos = 0, layer = 0, i; + E_Client *b; - if (!bd) return; + if (!ec) return; - /* determine layering position */ - layer = bd->layer; - if (layer < 0) layer = 0; - pos = 1 + (layer / 50); - if (pos > 10) pos = 10; - - /* Find the windows above this one */ - for (i = (pos + 1); i < 11; i++) + E_CLIENT_REVERSE_FOREACH(ec->comp, b) { - Eina_List *l; - E_Border *b; + if (e_client_util_ignored_get(b)) continue; + if (b->layer <= ec->layer) break; + /* skip if it's the same border */ + if (b == ec) continue; - EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b) - { - /* skip if it's the same border */ - if (b == bd) continue; + /* skip if it's not on this zone */ + if (b->zone != ec->zone) continue; - /* skip if it's not on this zone */ - if (b->zone != bd->zone) continue; + /* skip special borders */ + if (e_illume_client_is_indicator(b)) continue; + if (e_illume_client_is_softkey(b)) continue; + if (e_illume_client_is_keyboard(b)) continue; + if (e_illume_client_is_quickpanel(b)) continue; + if (e_illume_client_is_home(b)) continue; - /* skip special borders */ - if (e_illume_border_is_indicator(b)) continue; - if (e_illume_border_is_softkey(b)) continue; - if (e_illume_border_is_keyboard(b)) continue; - if (e_illume_border_is_quickpanel(b)) continue; - if (e_illume_border_is_home(b)) continue; - - e_border_iconify(b); - } + e_client_iconify(b); } } static void -_policy_border_hide_below(E_Border *bd) +_policy_border_hide_below(E_Client *ec) { - int pos = 0, layer = 0, i; + E_Client *b; - if (!bd) return; + if (!ec) return; - /* determine layering position */ - layer = bd->layer; - if (layer < 0) layer = 0; - pos = 1 + (layer / 50); - if (pos > 10) pos = 10; - - /* Find the windows below this one */ - for (i = (pos - 1); i >= 0; i--) + E_CLIENT_FOREACH(ec->comp, b) { - Eina_List *l; - E_Border *b; + if (e_client_util_ignored_get(b)) continue; + /* break if it's the same client */ + if (b == ec) break; - EINA_LIST_FOREACH(bd->zone->container->layers[i].clients, l, b) + /* skip if it's not on this zone */ + if (b->zone != ec->zone) continue; + + /* skip special borders */ + if (e_illume_client_is_indicator(b)) continue; + if (e_illume_client_is_softkey(b)) continue; + if (e_illume_client_is_keyboard(b)) continue; + if (e_illume_client_is_quickpanel(b)) continue; + if (e_illume_client_is_home(b)) continue; + + if ((ec->fullscreen) || (ec->need_fullscreen)) { - /* skip if it's the same border */ - if (b == bd) continue; - - /* skip if it's not on this zone */ - if (b->zone != bd->zone) continue; - - /* skip special borders */ - if (e_illume_border_is_indicator(b)) continue; - if (e_illume_border_is_softkey(b)) continue; - if (e_illume_border_is_keyboard(b)) continue; - if (e_illume_border_is_quickpanel(b)) continue; - if (e_illume_border_is_home(b)) continue; - - if ((bd->fullscreen) || (bd->need_fullscreen)) + if (b->visible) e_illume_client_hide(b); + } + else + { + /* we need to check x/y position */ + if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, + b->x, b->y, b->w, b->h)) { - if (b->visible) e_illume_border_hide(b); - } - else - { - /* we need to check x/y position */ - if (E_CONTAINS(bd->x, bd->y, bd->w, bd->h, - b->x, b->y, b->w, b->h)) - { - if (b->visible) e_illume_border_hide(b); - } + if (b->visible) e_illume_client_hide(b); } } } } static void -_policy_border_show_below(E_Border *bd) +_policy_border_show_below(E_Client *ec) { Eina_List *l; - E_Border *prev; - int pos = 0, layer = 0, i; + E_Client *prev, *b; // printf("Show Borders Below: %s %d %d\n", -// bd->client.icccm.class, bd->x, bd->y); +// ec->icccm.class, ec->x, ec->y); - if (!bd) return; + if (!ec) return; - if (bd->client.icccm.transient_for) + if (ec->icccm.transient_for) { - if ((prev = e_border_find_by_client_window(bd->client.icccm.transient_for))) + if ((prev = e_pixmap_find_client(E_PIXMAP_TYPE_X, ec->icccm.transient_for))) { _policy_border_set_focus(prev); return; } } - /* determine layering position */ - layer = bd->layer; - if (layer < 0) layer = 0; - pos = 1 + (layer / 50); - if (pos > 10) pos = 10; - - /* Find the windows below this one */ - for (i = (pos + 1); i < 11; i++) + E_CLIENT_FOREACH(ec->comp, b) { - E_Border *b; + if (e_client_util_ignored_get(b)) continue; + /* break if it's the same border */ + if (b == ec) break; - EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b) + /* skip if it's not on this zone */ + if (b->zone != ec->zone) continue; + + /* skip special borders */ + if (e_illume_client_is_indicator(b)) continue; + if (e_illume_client_is_softkey(b)) continue; + if (e_illume_client_is_keyboard(b)) continue; + if (e_illume_client_is_quickpanel(b)) continue; + if (e_illume_client_is_home(b)) continue; + + if ((ec->fullscreen) || (ec->need_fullscreen)) { - /* skip if it's the same border */ - if (b == bd) continue; - - /* skip if it's not on this zone */ - if (b->zone != bd->zone) continue; - - /* skip special borders */ - if (e_illume_border_is_indicator(b)) continue; - if (e_illume_border_is_softkey(b)) continue; - if (e_illume_border_is_keyboard(b)) continue; - if (e_illume_border_is_quickpanel(b)) continue; - if (e_illume_border_is_home(b)) continue; - - if ((bd->fullscreen) || (bd->need_fullscreen)) + _policy_border_set_focus(b); + return; + } + else + { + /* need to check x/y position */ + if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, + b->x, b->y, b->w, b->h)) { _policy_border_set_focus(b); return; } - else - { - /* need to check x/y position */ - if (E_CONTAINS(bd->x, bd->y, bd->w, bd->h, - b->x, b->y, b->w, b->h)) - { - _policy_border_set_focus(b); - return; - } - } } } @@ -282,85 +246,86 @@ _policy_border_show_below(E_Border *bd) * this one, so show previous window in stack */ EINA_LIST_REVERSE_FOREACH(_pol_focus_stack, l, prev) { - if (prev->zone != bd->zone) continue; + if (prev->zone != ec->zone) continue; _policy_border_set_focus(prev); return; } /* Fallback to focusing home if all above fails */ - _policy_focus_home(bd->zone); + _policy_focus_home(ec->zone); } static void _policy_zone_layout_update(E_Zone *zone) { Eina_List *l; - E_Border *bd; + E_Client *ec; if (!zone) return; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* skip special windows */ - if (e_object_is_del(E_OBJECT(bd))) continue; - if (e_illume_border_is_keyboard(bd)) continue; - if (e_illume_border_is_quickpanel(bd)) continue; + if (e_object_is_del(E_OBJECT(ec))) continue; + if (e_illume_client_is_keyboard(ec)) continue; + if (e_illume_client_is_quickpanel(ec)) continue; /* signal a changed pos here so layout gets updated */ - bd->changes.pos = 1; - BD_CHANGED(bd); + ec->changes.pos = 1; + EC_CHANGED(ec); } } static void -_policy_zone_layout_indicator(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_indicator(E_Client *ec, E_Illume_Config_Zone *cz) { - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; /* grab minimum indicator size */ - e_illume_border_min_get(bd, NULL, &cz->indicator.size); + e_illume_client_min_get(ec, NULL, &cz->indicator.size); /* no point in doing anything here if indicator is hidden */ - if ((!bd->new_client) && (!bd->visible)) + if ((!ec->new_client) && (!ec->visible)) { - ecore_x_e_illume_indicator_geometry_set(bd->zone->black_win, + ecore_x_e_illume_indicator_geometry_set(ec->zone->black_win, 0, 0, 0, 0); return; } /* if we are dragging, then skip it for now */ - if (bd->client.illume.drag.drag) + if (ec->illume.drag.drag) { /* when dragging indicator, we need to trigger a layout update */ - ecore_x_e_illume_indicator_geometry_set(bd->zone->black_win, + ecore_x_e_illume_indicator_geometry_set(ec->zone->black_win, 0, 0, 0, 0); - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); return; } -// printf("\tLayout Indicator: %d\n", bd->zone->num); +// printf("\tLayout Indicator: %d\n", ec->zone->num); /* lock indicator window from dragging if we need to */ if ((cz->mode.dual == 1) && (cz->mode.side == 0)) - ecore_x_e_illume_drag_locked_set(bd->client.win, 0); + ecore_x_e_illume_drag_locked_set(e_client_util_win_get(ec), 0); else - ecore_x_e_illume_drag_locked_set(bd->client.win, 1); + ecore_x_e_illume_drag_locked_set(e_client_util_win_get(ec), 1); /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != cz->indicator.size)) - _policy_border_resize(bd, bd->zone->w, cz->indicator.size); + if ((ec->w != ec->zone->w) || (ec->h != cz->indicator.size)) + _policy_border_resize(ec, ec->zone->w, cz->indicator.size); /* are we in single mode ? */ if (!cz->mode.dual) { /* move to 0, 0 (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != bd->zone->y)) + if ((ec->x != ec->zone->x) || (ec->y != ec->zone->y)) { - _policy_border_move(bd, bd->zone->x, bd->zone->y); - ecore_x_e_illume_quickpanel_position_update_send(bd->client.win); + _policy_border_move(ec, ec->zone->x, ec->zone->y); + ecore_x_e_illume_quickpanel_position_update_send(e_client_util_win_get(ec)); } } else @@ -372,377 +337,377 @@ _policy_zone_layout_indicator(E_Border *bd, E_Illume_Config_Zone *cz) * in this case, the indicator itself should be responsible for * sending the quickpanel position update message when it is * finished dragging */ - if (bd->x != bd->zone->x) - _policy_border_move(bd, bd->zone->x, bd->y); + if (ec->x != ec->zone->x) + _policy_border_move(ec, ec->zone->x, ec->y); } else { /* move to 0, 0 (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != bd->zone->y)) + if ((ec->x != ec->zone->x) || (ec->y != ec->zone->y)) { - _policy_border_move(bd, bd->zone->x, bd->zone->y); - ecore_x_e_illume_quickpanel_position_update_send(bd->client.win); + _policy_border_move(ec, ec->zone->x, ec->zone->y); + ecore_x_e_illume_quickpanel_position_update_send(e_client_util_win_get(ec)); } } } - ecore_x_e_illume_indicator_geometry_set(bd->zone->black_win, - bd->x, bd->y, - bd->w, bd->h); + ecore_x_e_illume_indicator_geometry_set(ec->zone->black_win, + ec->x, ec->y, + ec->w, ec->h); /* set layer if needed */ - if (bd->layer != POL_INDICATOR_LAYER) - e_border_layer_set(bd, POL_INDICATOR_LAYER); + if (ec->layer != POL_INDICATOR_LAYER) + evas_object_layer_set(ec->frame, POL_INDICATOR_LAYER); } static void -_policy_zone_layout_quickpanel(E_Border *bd) +_policy_zone_layout_quickpanel(E_Client *ec) { int mh; - if (!bd) return; + if (!ec) return; /* grab minimum size */ - e_illume_border_min_get(bd, NULL, &mh); + e_illume_client_min_get(ec, NULL, &mh); /* resize if needed */ - if ((bd->w != bd->zone->w) || (bd->h != mh)) - _policy_border_resize(bd, bd->zone->w, mh); + if ((ec->w != ec->zone->w) || (ec->h != mh)) + _policy_border_resize(ec, ec->zone->w, mh); /* set layer if needed */ - if (bd->layer != POL_QUICKPANEL_LAYER) - e_border_layer_set(bd, POL_QUICKPANEL_LAYER); + if (ec->layer != POL_QUICKPANEL_LAYER) + evas_object_layer_set(ec->frame, POL_QUICKPANEL_LAYER); } static void -_policy_zone_layout_softkey(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_softkey(E_Client *ec, E_Illume_Config_Zone *cz) { int ny; - if (!bd) return; + if (!ec) return; /* grab minimum softkey size */ - e_illume_border_min_get(bd, NULL, &cz->softkey.size); + e_illume_client_min_get(ec, NULL, &cz->softkey.size); /* no point in doing anything here if softkey is hidden */ - if (!bd->visible) + if (!ec->visible) { - ecore_x_e_illume_softkey_geometry_set(bd->zone->black_win, + ecore_x_e_illume_softkey_geometry_set(ec->zone->black_win, 0, 0, 0, 0); return; } /* if we are dragging, then skip it for now */ /* NB: Disabled currently until we confirm that softkey should be draggable */ -// if (bd->client.illume.drag.drag) return; +// if (ec->illume.drag.drag) return; /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != cz->softkey.size)) - _policy_border_resize(bd, bd->zone->w, cz->softkey.size); + if ((ec->w != ec->zone->w) || (ec->h != cz->softkey.size)) + _policy_border_resize(ec, ec->zone->w, cz->softkey.size); /* make sure it's in the correct position */ - ny = ((bd->zone->y + bd->zone->h) - cz->softkey.size); + ny = ((ec->zone->y + ec->zone->h) - cz->softkey.size); /* NB: not sure why yet, but on startup the border->y is reporting * that it is already in this position...but it's actually not. * So for now, just disable the ny check until this gets sorted out */ -// if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); +// if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); // set property for apps to find out they are - ecore_x_e_illume_softkey_geometry_set(bd->zone->black_win, - bd->x, bd->y, - bd->w, bd->h); + ecore_x_e_illume_softkey_geometry_set(ec->zone->black_win, + ec->x, ec->y, + ec->w, ec->h); /* set layer if needed */ - if (bd->layer != POL_SOFTKEY_LAYER) - e_border_layer_set(bd, POL_SOFTKEY_LAYER); + if (ec->layer != POL_SOFTKEY_LAYER) + evas_object_layer_set(ec->frame, POL_SOFTKEY_LAYER); } static void -_policy_zone_layout_keyboard(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_keyboard(E_Client *ec, E_Illume_Config_Zone *cz) { int ny, layer; // printf("\tLayout Keyboard\n"); - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; /* no point in adjusting size or position if it's not visible */ - if (!bd->visible) return; + if (!ec->visible) return; /* grab minimum keyboard size */ - e_illume_border_min_get(bd, NULL, &cz->vkbd.size); + e_illume_client_min_get(ec, NULL, &cz->vkbd.size); /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != cz->vkbd.size)) - _policy_border_resize(bd, bd->zone->w, cz->vkbd.size); + if ((ec->w != ec->zone->w) || (ec->h != cz->vkbd.size)) + _policy_border_resize(ec, ec->zone->w, cz->vkbd.size); /* make sure it's in the correct position */ - ny = ((bd->zone->y + bd->zone->h) - cz->vkbd.size); - if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); + ny = ((ec->zone->y + ec->zone->h) - cz->vkbd.size); + if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); /* check layer according to fullscreen state */ - if ((bd->fullscreen) || (bd->need_fullscreen)) + if ((ec->fullscreen) || (ec->need_fullscreen)) layer = POL_FULLSCREEN_LAYER; else layer = POL_KEYBOARD_LAYER; /* set layer if needed */ - if ((int)bd->layer != layer) e_border_layer_set(bd, layer); + if ((int)ec->layer != layer) evas_object_layer_set(ec->frame, layer); } static void -_policy_zone_layout_home_single(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_home_single(E_Client *ec, E_Illume_Config_Zone *cz) { int ny, nh, indsz = 0, sftsz = 0; - E_Border *ind, *sft; + E_Client *ind, *sft; - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; /* no point in adjusting size or position if it's not visible */ - if (!bd->visible) return; + if (!ec->visible) return; -// printf("\tLayout Home Single: %s\n", bd->client.icccm.class); +// printf("\tLayout Home Single: %s\n", ec->icccm.class); indsz = cz->indicator.size; sftsz = cz->softkey.size; - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { if (!ind->visible) indsz = 0; } - if ((sft = e_illume_border_softkey_get(bd->zone))) + if ((sft = e_illume_client_softkey_get(ec->zone))) { if (!sft->visible) sftsz = 0; } /* make sure it's the required width & height */ - if (e_illume_border_is_conformant(bd)) nh = bd->zone->h; - else nh = (bd->zone->h - indsz - sftsz); + if (e_illume_client_is_conformant(ec)) nh = ec->zone->h; + else nh = (ec->zone->h - indsz - sftsz); - if ((bd->w != bd->zone->w) || (bd->h != nh)) - _policy_border_resize(bd, bd->zone->w, nh); + if ((ec->w != ec->zone->w) || (ec->h != nh)) + _policy_border_resize(ec, ec->zone->w, nh); /* move to correct position (relative to zone) if needed */ - if (e_illume_border_is_conformant(bd)) ny = bd->zone->y; - else ny = (bd->zone->y + indsz); - if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); + if (e_illume_client_is_conformant(ec)) ny = ec->zone->y; + else ny = (ec->zone->y + indsz); + if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); /* set layer if needed */ - if (bd->layer != POL_HOME_LAYER) e_border_layer_set(bd, POL_HOME_LAYER); + if (ec->layer != POL_HOME_LAYER) evas_object_layer_set(ec->frame, POL_HOME_LAYER); } static void -_policy_zone_layout_home_dual_top(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_home_dual_top(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *home, *ind, *sft; + E_Client *home, *ind, *sft; int ny, nh, indsz = 0, sftsz = 0; - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; /* no point in adjusting size or position if it's not visible */ - if (!bd->visible) return; + if (!ec->visible) return; indsz = cz->indicator.size; sftsz = cz->softkey.size; - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { if (!ind->visible) indsz = 0; } - if ((sft = e_illume_border_softkey_get(bd->zone))) + if ((sft = e_illume_client_softkey_get(ec->zone))) { if (!sft->visible) sftsz = 0; } /* set some defaults */ - ny = (bd->zone->y + indsz); - nh = ((bd->zone->h - indsz - sftsz) / 2); + ny = (ec->zone->y + indsz); + nh = ((ec->zone->h - indsz - sftsz) / 2); /* see if there are any other home windows */ - home = e_illume_border_home_get(bd->zone); + home = e_illume_client_home_get(ec->zone); if (home) { - if (bd != home) ny = (home->y + nh); + if (ec != home) ny = (home->y + nh); } /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != nh)) - _policy_border_resize(bd, bd->zone->w, nh); + if ((ec->w != ec->zone->w) || (ec->h != nh)) + _policy_border_resize(ec, ec->zone->w, nh); /* move to correct position (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); + if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); /* set layer if needed */ - if (bd->layer != POL_HOME_LAYER) e_border_layer_set(bd, POL_HOME_LAYER); + if (ec->layer != POL_HOME_LAYER) evas_object_layer_set(ec->frame, POL_HOME_LAYER); } static void -_policy_zone_layout_home_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_home_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *home; + E_Client *home; int iy, ny, nh; -// printf("\tLayout Home Dual Custom: %s\n", bd->client.icccm.class); +// printf("\tLayout Home Dual Custom: %s\n", ec->icccm.class); - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; /* no point in adjusting size or position if it's not visible */ - if (!bd->visible) return; + if (!ec->visible) return; /* grab indicator position */ - e_illume_border_indicator_pos_get(bd->zone, NULL, &iy); + e_illume_client_indicator_pos_get(ec->zone, NULL, &iy); /* set some defaults */ - ny = bd->zone->y; + ny = ec->zone->y; nh = iy; /* see if there are any other home windows */ - home = e_illume_border_home_get(bd->zone); - if ((home) && (bd != home)) + home = e_illume_client_home_get(ec->zone); + if ((home) && (ec != home)) { ny = (iy + cz->indicator.size); - nh = ((bd->zone->y + bd->zone->h) - ny - cz->softkey.size); + nh = ((ec->zone->y + ec->zone->h) - ny - cz->softkey.size); } /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != nh)) - _policy_border_resize(bd, bd->zone->w, nh); + if ((ec->w != ec->zone->w) || (ec->h != nh)) + _policy_border_resize(ec, ec->zone->w, nh); /* move to correct position (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); + if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); /* set layer if needed */ - if (bd->layer != POL_HOME_LAYER) e_border_layer_set(bd, POL_HOME_LAYER); + if (ec->layer != POL_HOME_LAYER) evas_object_layer_set(ec->frame, POL_HOME_LAYER); } static void -_policy_zone_layout_home_dual_left(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_home_dual_left(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *home; + E_Client *home; int nx, nw, nh; -// printf("\tLayout Home Dual Left: %s\n", bd->client.icccm.class); +// printf("\tLayout Home Dual Left: %s\n", ec->icccm.class); - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; /* no point in adjusting size or position if it's not visible */ - if (!bd->visible) return; + if (!ec->visible) return; - nh = (bd->zone->h - cz->indicator.size - cz->softkey.size); + nh = (ec->zone->h - cz->indicator.size - cz->softkey.size); /* set some defaults */ - nx = bd->zone->x; - nw = (bd->zone->w / 2); + nx = ec->zone->x; + nw = (ec->zone->w / 2); /* see if there are any other home windows */ - home = e_illume_border_home_get(bd->zone); - if ((home) && (bd != home)) nx = (home->x + nw); + home = e_illume_client_home_get(ec->zone); + if ((home) && (ec != home)) nx = (home->x + nw); /* make sure it's the required width & height */ - if ((bd->w != nw) || (bd->h != nh)) - _policy_border_resize(bd, nw, nh); + if ((ec->w != nw) || (ec->h != nh)) + _policy_border_resize(ec, nw, nh); /* move to correct position (relative to zone) if needed */ - if ((bd->x != nx) || (bd->y != (bd->zone->y + cz->indicator.size))) - _policy_border_move(bd, nx, (bd->zone->y + cz->indicator.size)); + if ((ec->x != nx) || (ec->y != (ec->zone->y + cz->indicator.size))) + _policy_border_move(ec, nx, (ec->zone->y + cz->indicator.size)); /* set layer if needed */ - if (bd->layer != POL_HOME_LAYER) e_border_layer_set(bd, POL_HOME_LAYER); + if (ec->layer != POL_HOME_LAYER) evas_object_layer_set(ec->frame, POL_HOME_LAYER); } static void -_policy_zone_layout_fullscreen(E_Border *bd) +_policy_zone_layout_fullscreen(E_Client *ec) { int kh; -// printf("\tLayout Fullscreen: %s\n", bd->client.icccm.name); +// printf("\tLayout Fullscreen: %s\n", ec->icccm.name); - if (!bd) return; + if (!ec) return; /* grab keyboard safe region */ - e_illume_keyboard_safe_app_region_get(bd->zone, NULL, NULL, NULL, &kh); + e_illume_keyboard_safe_app_region_get(ec->zone, NULL, NULL, NULL, &kh); /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != kh)) - _policy_border_resize(bd, bd->zone->w, kh); + if ((ec->w != ec->zone->w) || (ec->h != kh)) + _policy_border_resize(ec, ec->zone->w, kh); /* set layer if needed */ - if (bd->layer != POL_FULLSCREEN_LAYER) - e_border_layer_set(bd, POL_FULLSCREEN_LAYER); + if (ec->layer != POL_FULLSCREEN_LAYER) + evas_object_layer_set(ec->frame, POL_FULLSCREEN_LAYER); } static void -_policy_zone_layout_app_single(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_app_single(E_Client *ec, E_Illume_Config_Zone *cz) { int ky, kh, ny, nh; - if ((!bd) || (!cz)) return; - if ((!bd->new_client) && (!bd->visible)) return; + if ((!ec) || (!cz)) return; + if ((!ec->new_client) && (!ec->visible)) return; -// printf("\tLayout App Single: %s\n", bd->client.icccm.name); +// printf("\tLayout App Single: %s\n", ec->icccm.name); /* grab keyboard safe region */ - e_illume_keyboard_safe_app_region_get(bd->zone, NULL, &ky, NULL, &kh); + e_illume_keyboard_safe_app_region_get(ec->zone, NULL, &ky, NULL, &kh); /* make sure it's the required width & height */ - if (kh >= bd->zone->h) + if (kh >= ec->zone->h) nh = (kh - cz->indicator.size - cz->softkey.size); else nh = (kh - cz->indicator.size); /* resize if needed */ - if ((bd->w != bd->zone->w) || (bd->h != nh)) - _policy_border_resize(bd, bd->zone->w, nh); + if ((ec->w != ec->zone->w) || (ec->h != nh)) + _policy_border_resize(ec, ec->zone->w, nh); /* move to correct position (relative to zone) if needed */ - ny = (bd->zone->y + cz->indicator.size); - if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); + ny = (ec->zone->y + cz->indicator.size); + if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); /* set layer if needed */ - if (bd->layer != POL_APP_LAYER) e_border_layer_set(bd, POL_APP_LAYER); + if (ec->layer != POL_APP_LAYER) evas_object_layer_set(ec->frame, POL_APP_LAYER); } static void -_policy_zone_layout_app_dual_top(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_app_dual_top(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *b; + E_Client *b; int kh, ny, nh; -// printf("\tLayout App Dual Top: %s\n", bd->client.icccm.name); +// printf("\tLayout App Dual Top: %s\n", ec->icccm.name); - if ((!bd) || (!cz)) return; - if ((!bd->new_client) && (!bd->visible)) return; + if ((!ec) || (!cz)) return; + if ((!ec->new_client) && (!ec->visible)) return; /* set a default Y position */ - ny = (bd->zone->y + cz->indicator.size); + ny = (ec->zone->y + cz->indicator.size); - if ((bd->focused) && - (bd->client.vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)) + if ((ec->focused) && + (ec->vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)) { /* grab keyboard safe region */ - e_illume_keyboard_safe_app_region_get(bd->zone, NULL, NULL, NULL, &kh); + e_illume_keyboard_safe_app_region_get(ec->zone, NULL, NULL, NULL, &kh); nh = (kh - cz->indicator.size); } else { /* make sure it's the required width & height */ - nh = ((bd->zone->h - cz->indicator.size - cz->softkey.size) / 2); + nh = ((ec->zone->h - cz->indicator.size - cz->softkey.size) / 2); } /* see if there is a border already there. if so, check placement based on * virtual keyboard usage */ - b = e_illume_border_at_xy_get(bd->zone, bd->zone->x, ny); - if ((b) && (b != bd)) + b = e_illume_client_at_xy_get(ec->zone, ec->zone->x, ny); + if ((b) && (b != ec)) { /* does this border need keyboard ? */ - if ((bd->focused) && - (bd->client.vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)) + if ((ec->focused) && + (ec->vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)) { int h; /* move existing border to bottom if needed */ - h = ((bd->zone->h - cz->indicator.size - cz->softkey.size) / 2); + h = ((ec->zone->h - cz->indicator.size - cz->softkey.size) / 2); if ((b->x != b->zone->x) || (b->y != (ny + h))) _policy_border_move(b, b->zone->x, (ny + h)); @@ -755,115 +720,115 @@ _policy_zone_layout_app_dual_top(E_Border *bd, E_Illume_Config_Zone *cz) } /* resize if needed */ - if ((bd->w != bd->zone->w) || (bd->h != nh)) - _policy_border_resize(bd, bd->zone->w, nh); + if ((ec->w != ec->zone->w) || (ec->h != nh)) + _policy_border_resize(ec, ec->zone->w, nh); /* move to correct position (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); + if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); /* set layer if needed */ - if (bd->layer != POL_APP_LAYER) e_border_layer_set(bd, POL_APP_LAYER); + if (ec->layer != POL_APP_LAYER) evas_object_layer_set(ec->frame, POL_APP_LAYER); } static void -_policy_zone_layout_app_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_app_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *app; + E_Client *app; int iy, ny, nh; -// printf("\tLayout App Dual Custom: %s\n", bd->client.icccm.class); +// printf("\tLayout App Dual Custom: %s\n", ec->icccm.class); - if ((!bd) || (!cz)) return; - if ((!bd->new_client) && (!bd->visible)) return; + if ((!ec) || (!cz)) return; + if ((!ec->new_client) && (!ec->visible)) return; /* grab indicator position */ - e_illume_border_indicator_pos_get(bd->zone, NULL, &iy); + e_illume_client_indicator_pos_get(ec->zone, NULL, &iy); /* set a default position */ - ny = bd->zone->y; + ny = ec->zone->y; nh = iy; - app = e_illume_border_at_xy_get(bd->zone, bd->zone->x, bd->zone->y); - if ((app) && (bd != app)) + app = e_illume_client_at_xy_get(ec->zone, ec->zone->x, ec->zone->y); + if ((app) && (ec != app)) { ny = (iy + cz->indicator.size); - nh = ((bd->zone->y + bd->zone->h) - ny - cz->softkey.size); + nh = ((ec->zone->y + ec->zone->h) - ny - cz->softkey.size); } /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != nh)) - _policy_border_resize(bd, bd->zone->w, nh); + if ((ec->w != ec->zone->w) || (ec->h != nh)) + _policy_border_resize(ec, ec->zone->w, nh); /* move to correct position (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); + if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); /* set layer if needed */ - if (bd->layer != POL_APP_LAYER) e_border_layer_set(bd, POL_APP_LAYER); + if (ec->layer != POL_APP_LAYER) evas_object_layer_set(ec->frame, POL_APP_LAYER); } static void -_policy_zone_layout_app_dual_left(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_app_dual_left(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *b; + E_Client *b; int ky, kh, nx, nw; -// printf("\tLayout App Dual Left: %s\n", bd->client.icccm.name); +// printf("\tLayout App Dual Left: %s\n", ec->icccm.name); - if ((!bd) || (!cz)) return; - if ((!bd->new_client) && (!bd->visible)) return; + if ((!ec) || (!cz)) return; + if ((!ec->new_client) && (!ec->visible)) return; /* grab keyboard safe region */ - e_illume_keyboard_safe_app_region_get(bd->zone, NULL, &ky, NULL, &kh); + e_illume_keyboard_safe_app_region_get(ec->zone, NULL, &ky, NULL, &kh); - if (kh >= bd->zone->h) + if (kh >= ec->zone->h) kh = (kh - cz->indicator.size - cz->softkey.size); else kh = (kh - cz->indicator.size); /* set some defaults */ - nx = bd->zone->x; - nw = (bd->zone->w / 2); + nx = ec->zone->x; + nw = (ec->zone->w / 2); /* see if there is a border already there. if so, place at right */ - b = e_illume_border_at_xy_get(bd->zone, nx, (ky + cz->indicator.size)); - if ((b) && (bd != b)) nx = b->x + nw; + b = e_illume_client_at_xy_get(ec->zone, nx, (ky + cz->indicator.size)); + if ((b) && (ec != b)) nx = b->x + nw; /* resize if needed */ - if ((bd->w != nw) || (bd->h != kh)) - _policy_border_resize(bd, nw, kh); + if ((ec->w != nw) || (ec->h != kh)) + _policy_border_resize(ec, nw, kh); /* move to correct position (relative to zone) if needed */ - if ((bd->x != nx) || (bd->y != (ky + cz->indicator.size))) - _policy_border_move(bd, nx, (ky + cz->indicator.size)); + if ((ec->x != nx) || (ec->y != (ky + cz->indicator.size))) + _policy_border_move(ec, nx, (ky + cz->indicator.size)); /* set layer if needed */ - if (bd->layer != POL_APP_LAYER) e_border_layer_set(bd, POL_APP_LAYER); + if (ec->layer != POL_APP_LAYER) evas_object_layer_set(ec->frame, POL_APP_LAYER); } static void -_policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_dialog(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *parent; + E_Client *parent; int mw, mh, nx, ny; -// printf("\tLayout Dialog: %s\n", bd->client.icccm.name); +// printf("\tLayout Dialog: %s\n", ec->icccm.name); /* NB: This policy ignores any ICCCM requested positions and centers the * dialog on it's parent (if it exists) or on the zone */ - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; - mw = bd->w; - mh = bd->h; + mw = ec->w; + mh = ec->h; /* make sure it fits in this zone */ - if (mw > bd->zone->w) mw = bd->zone->w; - if (mh > bd->zone->h) mh = bd->zone->h; + if (mw > ec->zone->w) mw = ec->zone->w; + if (mh > ec->zone->h) mh = ec->zone->h; /* try to get this dialog's parent if it exists */ - parent = e_illume_border_parent_get(bd); + parent = e_illume_client_parent_get(ec); /* if we have no parent, or we are in dual mode, then center on zone */ /* NB: we check dual mode because if we are in dual mode, dialogs tend to @@ -872,8 +837,8 @@ _policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz) if ((!parent) || (cz->mode.dual == 1)) { /* no parent or dual mode, center on screen */ - nx = (bd->zone->x + ((bd->zone->w - mw) / 2)); - ny = (bd->zone->y + ((bd->zone->h - mh) / 2)); + nx = (ec->zone->x + ((ec->zone->w - mw) / 2)); + ny = (ec->zone->y + ((ec->zone->h - mh) / 2)); } else { @@ -890,43 +855,43 @@ _policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz) } /* make sure it's the required width & height */ - if ((bd->w != mw) || (bd->h != mh)) - _policy_border_resize(bd, mw, mh); + if ((ec->w != mw) || (ec->h != mh)) + _policy_border_resize(ec, mw, mh); /* make sure it's in the correct position */ - if ((bd->x != nx) || (bd->y != ny)) - _policy_border_move(bd, nx, ny); + if ((ec->x != nx) || (ec->y != ny)) + _policy_border_move(ec, nx, ny); /* set layer if needed */ - if (bd->layer != POL_DIALOG_LAYER) - e_border_layer_set(bd, POL_DIALOG_LAYER); + if (ec->layer != POL_DIALOG_LAYER) + evas_object_layer_set(ec->frame, POL_DIALOG_LAYER); } static void -_policy_zone_layout_splash(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_splash(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *parent = NULL; + E_Client *parent = NULL; int mw, mh, nx, ny; /* NB: This code is almost exactly the same as the dialog layout code * (_policy_zone_layout_dialog) except for setting a different layer */ -// printf("\tLayout Splash: %s\n", bd->client.icccm.name); +// printf("\tLayout Splash: %s\n", ec->icccm.name); /* NB: This policy ignores any ICCCM requested positions and centers the * splash screen on it's parent (if it exists) or on the zone */ - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; /* no point in adjusting size or position if it's not visible */ - if (!bd->visible) return; + if (!ec->visible) return; /* grab minimum size */ - e_illume_border_min_get(bd, &mw, &mh); + e_illume_client_min_get(ec, &mw, &mh); /* make sure it fits in this zone */ - if (mw > bd->zone->w) mw = bd->zone->w; - if (mh > bd->zone->h) mh = bd->zone->h; + if (mw > ec->zone->w) mw = ec->zone->w; + if (mh > ec->zone->h) mh = ec->zone->h; /* if we have no parent, or we are in dual mode, then center on zone */ /* NB: we check dual mode because if we are in dual mode, dialogs tend to @@ -935,8 +900,8 @@ _policy_zone_layout_splash(E_Border *bd, E_Illume_Config_Zone *cz) if ((!parent) || (cz->mode.dual == 1)) { /* no parent or in dual mode, center on screen */ - nx = (bd->zone->x + ((bd->zone->w - mw) / 2)); - ny = (bd->zone->y + ((bd->zone->h - mh) / 2)); + nx = (ec->zone->x + ((ec->zone->w - mw) / 2)); + ny = (ec->zone->y + ((ec->zone->h - mh) / 2)); } else { @@ -953,128 +918,128 @@ _policy_zone_layout_splash(E_Border *bd, E_Illume_Config_Zone *cz) } /* make sure it's the required width & height */ - if ((bd->w != mw) || (bd->h != mh)) - _policy_border_resize(bd, mw, mh); + if ((ec->w != mw) || (ec->h != mh)) + _policy_border_resize(ec, mw, mh); /* make sure it's in the correct position */ - if ((bd->x != nx) || (bd->y != ny)) - _policy_border_move(bd, nx, ny); + if ((ec->x != nx) || (ec->y != ny)) + _policy_border_move(ec, nx, ny); /* set layer if needed */ - if (bd->layer != POL_SPLASH_LAYER) e_border_layer_set(bd, POL_SPLASH_LAYER); + if (ec->layer != POL_SPLASH_LAYER) evas_object_layer_set(ec->frame, POL_SPLASH_LAYER); } static void -_policy_zone_layout_conformant_single(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_conformant_single(E_Client *ec, E_Illume_Config_Zone *cz) { - if ((!bd) || (!cz)) return; - if ((!bd->new_client) && (!bd->visible)) return; + if ((!ec) || (!cz)) return; + if ((!ec->new_client) && (!ec->visible)) return; /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != bd->zone->h)) - _policy_border_resize(bd, bd->zone->w, bd->zone->h); + if ((ec->w != ec->zone->w) || (ec->h != ec->zone->h)) + _policy_border_resize(ec, ec->zone->w, ec->zone->h); /* move to correct position (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != bd->zone->y)) - _policy_border_move(bd, bd->zone->x, bd->zone->y); + if ((ec->x != ec->zone->x) || (ec->y != ec->zone->y)) + _policy_border_move(ec, ec->zone->x, ec->zone->y); /* set layer if needed */ - if (bd->layer != POL_CONFORMANT_LAYER) - e_border_layer_set(bd, POL_CONFORMANT_LAYER); + if (ec->layer != POL_CONFORMANT_LAYER) + evas_object_layer_set(ec->frame, POL_CONFORMANT_LAYER); } static void -_policy_zone_layout_conformant_dual_top(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_conformant_dual_top(E_Client *ec, E_Illume_Config_Zone *cz) { int nh, ny; /* according to the docs I have, conformant windows are always on the * bottom in dual-top mode */ - if ((!bd) || (!cz)) return; - if ((!bd->new_client) && (!bd->visible)) return; + if ((!ec) || (!cz)) return; + if ((!ec->new_client) && (!ec->visible)) return; /* set some defaults */ - nh = ((bd->zone->h - cz->indicator.size - cz->softkey.size) / 2); - ny = (bd->zone->y + cz->indicator.size) + nh; + nh = ((ec->zone->h - cz->indicator.size - cz->softkey.size) / 2); + ny = (ec->zone->y + cz->indicator.size) + nh; nh += cz->softkey.size; /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != nh)) - _policy_border_resize(bd, bd->zone->w, nh); + if ((ec->w != ec->zone->w) || (ec->h != nh)) + _policy_border_resize(ec, ec->zone->w, nh); /* move to correct position (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != ny)) - _policy_border_move(bd, bd->zone->x, ny); + if ((ec->x != ec->zone->x) || (ec->y != ny)) + _policy_border_move(ec, ec->zone->x, ny); /* set layer if needed */ - if (bd->layer != POL_CONFORMANT_LAYER) - e_border_layer_set(bd, POL_CONFORMANT_LAYER); + if (ec->layer != POL_CONFORMANT_LAYER) + evas_object_layer_set(ec->frame, POL_CONFORMANT_LAYER); } static void -_policy_zone_layout_conformant_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_conformant_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz) { int iy, nh; -// printf("\tLayout Conformant Dual Custom: %s\n", bd->client.icccm.class); +// printf("\tLayout Conformant Dual Custom: %s\n", ec->icccm.class); - if ((!bd) || (!cz)) return; - if ((!bd->new_client) && (!bd->visible)) return; + if ((!ec) || (!cz)) return; + if ((!ec->new_client) && (!ec->visible)) return; /* grab indicator position */ - e_illume_border_indicator_pos_get(bd->zone, NULL, &iy); + e_illume_client_indicator_pos_get(ec->zone, NULL, &iy); /* set some defaults */ - nh = ((bd->zone->y + bd->zone->h) - iy); + nh = ((ec->zone->y + ec->zone->h) - iy); /* make sure it's the required width & height */ - if ((bd->w != bd->zone->w) || (bd->h != nh)) - _policy_border_resize(bd, bd->zone->w, nh); + if ((ec->w != ec->zone->w) || (ec->h != nh)) + _policy_border_resize(ec, ec->zone->w, nh); /* move to correct position (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != iy)) - _policy_border_move(bd, bd->zone->x, iy); + if ((ec->x != ec->zone->x) || (ec->y != iy)) + _policy_border_move(ec, ec->zone->x, iy); /* set layer if needed */ - if (bd->layer != POL_CONFORMANT_LAYER) - e_border_layer_set(bd, POL_CONFORMANT_LAYER); + if (ec->layer != POL_CONFORMANT_LAYER) + evas_object_layer_set(ec->frame, POL_CONFORMANT_LAYER); } static void -_policy_zone_layout_conformant_dual_left(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_conformant_dual_left(E_Client *ec, E_Illume_Config_Zone *cz) { int nw, nx; /* according to the docs I have, conformant windows are always on the * left in dual-left mode */ - if ((!bd) || (!cz)) return; - if ((!bd->new_client) && (!bd->visible)) return; + if ((!ec) || (!cz)) return; + if ((!ec->new_client) && (!ec->visible)) return; /* set some defaults */ - nw = (bd->zone->w / 2); - nx = (bd->zone->x); + nw = (ec->zone->w / 2); + nx = (ec->zone->x); /* make sure it's the required width & height */ - if ((bd->w != nw) || (bd->h != bd->zone->h)) - _policy_border_resize(bd, nw, bd->zone->h); + if ((ec->w != nw) || (ec->h != ec->zone->h)) + _policy_border_resize(ec, nw, ec->zone->h); /* move to correct position (relative to zone) if needed */ - if ((bd->x != nx) || (bd->y != bd->zone->y)) - _policy_border_move(bd, nx, bd->zone->y); + if ((ec->x != nx) || (ec->y != ec->zone->y)) + _policy_border_move(ec, nx, ec->zone->y); /* set layer if needed */ - if (bd->layer != POL_CONFORMANT_LAYER) - e_border_layer_set(bd, POL_CONFORMANT_LAYER); + if (ec->layer != POL_CONFORMANT_LAYER) + evas_object_layer_set(ec->frame, POL_CONFORMANT_LAYER); } /* policy functions */ void -_policy_border_add(E_Border *bd) +_policy_border_add(E_Client *ec) { - if (!bd) return; + if (!ec) return; -// printf("\nBorder added: %s\n", bd->client.icccm.class); +// printf("\nBorder added: %s\n", ec->icccm.class); /* NB: this call sets an atom on the window that specifices the zone. * the logic here is that any new windows created can access the zone @@ -1084,174 +1049,174 @@ _policy_border_add(E_Border *bd) * that apply to their respective zone only. Example: softkey sends close * messages (or back messages to cycle focus) that should pertain just * to it's current zone */ - ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win); + ecore_x_e_illume_zone_set(e_client_util_win_get(ec), ec->zone->black_win); /* ignore stolen borders. These are typically quickpanel or keyboards */ - if (bd->stolen) return; + if (ec->stolen) return; /* if this is a fullscreen window, than we need to hide indicator window */ - /* NB: we could use the e_illume_border_is_fullscreen function here + /* NB: we could use the e_illume_client_is_fullscreen function here * but we save ourselves a function call this way */ - if ((bd->fullscreen) || (bd->need_fullscreen)) + if ((ec->fullscreen) || (ec->need_fullscreen)) { - E_Border *ind, *sft; + E_Client *ind, *sft; /* try to get the Indicator on this zone */ - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { /* we have the indicator, hide it if needed */ - if (ind->visible) e_illume_border_hide(ind); + if (ind->visible) e_illume_client_hide(ind); } /* conformant - may not need softkey */ - if ((sft = e_illume_border_softkey_get(bd->zone))) + if ((sft = e_illume_client_softkey_get(ec->zone))) { - if (e_illume_border_is_conformant(bd)) + if (e_illume_client_is_conformant(ec)) { - if (sft->visible) e_illume_border_hide(sft); + if (sft->visible) e_illume_client_hide(sft); } else { - if (!sft->visible) e_illume_border_show(sft); + if (!sft->visible) e_illume_client_show(sft); } } } /* Add this border to our focus stack if it can accept or take focus */ - if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus)) - _pol_focus_stack = eina_list_append(_pol_focus_stack, bd); + if ((ec->icccm.accepts_focus) || (ec->icccm.take_focus)) + _pol_focus_stack = eina_list_append(_pol_focus_stack, ec); - if ((e_illume_border_is_softkey(bd)) || (e_illume_border_is_indicator(bd))) - _policy_zone_layout_update(bd->zone); + if ((e_illume_client_is_softkey(ec)) || (e_illume_client_is_indicator(ec))) + _policy_zone_layout_update(ec->zone); else { /* set focus on new border if we can */ - _policy_border_set_focus(bd); + _policy_border_set_focus(ec); } } void -_policy_border_del(E_Border *bd) +_policy_border_del(E_Client *ec) { -// printf("Policy Border deleted: %s\n", bd->client.icccm.class); +// printf("Policy Border deleted: %s\n", ec->icccm.class); - if (!bd) return; + if (!ec) return; /* if this is a fullscreen window, than we need to show indicator window */ - /* NB: we could use the e_illume_border_is_fullscreen function here + /* NB: we could use the e_illume_client_is_fullscreen function here * but we save ourselves a function call this way */ - if ((bd->fullscreen) || (bd->need_fullscreen)) + if ((ec->fullscreen) || (ec->need_fullscreen)) { - E_Border *ind; + E_Client *ind; /* try to get the Indicator on this zone */ - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { /* we have the indicator, show it if needed */ - if (!ind->visible) e_illume_border_show(ind); + if (!ind->visible) e_illume_client_show(ind); } - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); } /* remove from our focus stack */ - if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus)) - _pol_focus_stack = eina_list_remove(_pol_focus_stack, bd); + if ((ec->icccm.accepts_focus) || (ec->icccm.take_focus)) + _pol_focus_stack = eina_list_remove(_pol_focus_stack, ec); - if (e_illume_border_is_softkey(bd)) + if (e_illume_client_is_softkey(ec)) { E_Illume_Config_Zone *cz; /* get the config for this zone */ - cz = e_illume_zone_config_get(bd->zone->num); + cz = e_illume_zone_config_get(ec->zone->num); cz->softkey.size = 0; - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); } - else if (e_illume_border_is_indicator(bd)) + else if (e_illume_client_is_indicator(ec)) { E_Illume_Config_Zone *cz; /* get the config for this zone */ - cz = e_illume_zone_config_get(bd->zone->num); + cz = e_illume_zone_config_get(ec->zone->num); cz->indicator.size = 0; - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); } else { /* show the border below this one */ - _policy_border_show_below(bd); + _policy_border_show_below(ec); } } void -_policy_border_focus_in(E_Border *bd) +_policy_border_focus_in(E_Client *ec) { - E_Border *ind; + E_Client *ind; -// printf("Border focus in: %s\n", bd->client.icccm.name); - if ((bd->fullscreen) || (bd->need_fullscreen)) +// printf("Border focus in: %s\n", ec->icccm.name); + if ((ec->fullscreen) || (ec->need_fullscreen)) { /* try to get the Indicator on this zone */ - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { /* we have the indicator, hide it if needed */ - if (ind->visible) e_illume_border_hide(ind); + if (ind->visible) e_illume_client_hide(ind); } } else { /* try to get the Indicator on this zone */ - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { /* we have the indicator, show it if needed */ - if (!ind->visible) e_illume_border_show(ind); + if (!ind->visible) e_illume_client_show(ind); } } - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); } void -_policy_border_focus_out(E_Border *bd) +_policy_border_focus_out(E_Client *ec) { - if (!bd) return; + if (!ec) return; -// printf("Border focus out: %s\n", bd->client.icccm.name); +// printf("Border focus out: %s\n", ec->icccm.name); /* NB: if we got this focus_out event on a deleted border, we check if * it is a transient (child) of another window. If it is, then we * transfer focus back to the parent window */ - if (e_object_is_del(E_OBJECT(bd))) + if (e_object_is_del(E_OBJECT(ec))) { - if (e_illume_border_is_dialog(bd)) + if (e_illume_client_is_dialog(ec)) { - E_Border *parent; + E_Client *parent; - if ((parent = e_illume_border_parent_get(bd))) + if ((parent = e_illume_client_parent_get(ec))) _policy_border_set_focus(parent); } } } void -_policy_border_activate(E_Border *bd) +_policy_border_activate(E_Client *ec) { - E_Border *sft; + E_Client *sft; - if (!bd) return; + if (!ec) return; - printf("Border Activate: %s\n", bd->client.icccm.name); + printf("Border Activate: %s\n", ec->icccm.name); /* NB: stolen borders may or may not need focus call...have to test */ - if (bd->stolen) return; + if (ec->stolen) return; /* conformant windows hide the softkey */ - if ((sft = e_illume_border_softkey_get(bd->zone))) + if ((sft = e_illume_client_softkey_get(ec->zone))) { - if (e_illume_border_is_conformant(bd)) + if (e_illume_client_is_conformant(ec)) { - if (sft->visible) e_illume_border_hide(sft); + if (sft->visible) e_illume_client_hide(sft); } else { - if (!sft->visible) e_illume_border_show(sft); + if (!sft->visible) e_illume_client_show(sft); } } @@ -1260,18 +1225,18 @@ _policy_border_activate(E_Border *bd) * parts and use here :) */ /* if the border is iconified then uniconify if allowed */ - if ((bd->iconic) && (!bd->lock_user_iconify)) - e_border_uniconify(bd); + if ((ec->iconic) && (!ec->lock_user_iconify)) + e_client_uniconify(ec); /* set very high layer for this window as it needs attention and thus * should show above everything */ - e_border_layer_set(bd, POL_ACTIVATE_LAYER); + evas_object_layer_set(ec->frame, POL_ACTIVATE_LAYER); /* if we can raise the border do it */ - if (!bd->lock_user_stacking) e_border_raise(bd); + if (!ec->lock_user_stacking) evas_object_raise(ec->frame); /* focus the border */ - e_border_focus_set(bd, 1, 1); + evas_object_focus_set(ec->frame, 1); /* NB: since we skip needless border evals when container layout * is called (to save cpu cycles), we need to @@ -1281,86 +1246,86 @@ _policy_border_activate(E_Border *bd) * This is potentially useless as THIS policy * makes all windows borderless anyway, but it's in here for * completeness - e_border_focus_latest_set(bd); - if (bd->bg_object) - 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"); - e_focus_event_focus_in(bd); + e_client_focus_latest_set(ec); + if (ec->bg_object) + edje_object_signal_emit(ec->bg_object, "e,state,focused", "e"); + if (ec->icon_object) + edje_object_signal_emit(ec->icon_object, "e,state,focused", "e"); + e_focus_event_focus_in(ec); */ } void -_policy_border_post_fetch(E_Border *bd) +_policy_border_post_fetch(E_Client *ec) { // printf("Border post fetch\n"); - if (!bd) return; + if (!ec) return; /* NB: for this policy we disable all remembers set on a border */ - if (bd->remember) e_remember_del(bd->remember); - bd->remember = NULL; + if (ec->remember) e_remember_del(ec->remember); + ec->remember = NULL; /* set this border to borderless */ #ifdef DIALOG_USES_PIXEL_BORDER - if ((e_illume_border_is_dialog(bd)) && (e_illume_border_parent_get(bd))) - eina_stringshare_replace(&bd->bordername, "pixel"); + if ((e_illume_client_is_dialog(ec)) && (e_illume_client_parent_get(ec))) + eina_stringshare_replace(&ec->bordername, "pixel"); else - bd->borderless = 1; + ec->borderless = 1; #else - bd->borderless = 1; + ec->borderless = 1; #endif /* tell E the border has changed */ - bd->client.border.changed = 1; + ec->border.changed = 1; } void -_policy_border_post_assign(E_Border *bd) +_policy_border_post_assign(E_Client *ec) { // printf("Border post assign\n"); - if (!bd) return; + if (!ec) return; - bd->internal_no_remember = 1; + ec->internal_no_remember = 1; /* do not allow client to change these properties */ - bd->lock_client_size = 1; - bd->lock_client_shade = 1; - bd->lock_client_maximize = 1; - bd->lock_client_location = 1; - bd->lock_client_stacking = 1; + ec->lock_client_size = 1; + ec->lock_client_shade = 1; + ec->lock_client_maximize = 1; + ec->lock_client_location = 1; + ec->lock_client_stacking = 1; /* do not allow the user to change these properties */ - bd->lock_user_location = 1; - bd->lock_user_size = 1; - bd->lock_user_shade = 1; + ec->lock_user_location = 1; + ec->lock_user_size = 1; + ec->lock_user_shade = 1; /* clear any centered states */ /* NB: this is mainly needed for E's main config dialog */ - bd->client.e.state.centered = 0; + ec->e.state.centered = 0; /* lock the border type so user/client cannot change */ - bd->lock_border = 1; + ec->lock_border = 1; } void -_policy_border_show(E_Border *bd) +_policy_border_show(E_Client *ec) { - if (!bd) return; + if (!ec) return; /* make sure we have a name so that we don't handle windows like E's root */ - if (!bd->client.icccm.name) return; + if (!ec->icccm.name) return; -// printf("Border Show: %s\n", bd->client.icccm.class); +// printf("Border Show: %s\n", ec->icccm.class); /* trap for special windows so we can ignore hides below them */ - if (e_illume_border_is_indicator(bd)) return; - if (e_illume_border_is_softkey(bd)) return; - if (e_illume_border_is_quickpanel(bd)) return; - if (e_illume_border_is_keyboard(bd)) return; + if (e_illume_client_is_indicator(ec)) return; + if (e_illume_client_is_softkey(ec)) return; + if (e_illume_client_is_quickpanel(ec)) return; + if (e_illume_client_is_keyboard(ec)) return; - _policy_border_hide_below(bd); + _policy_border_hide_below(ec); } void @@ -1368,7 +1333,7 @@ _policy_zone_layout(E_Zone *zone) { E_Illume_Config_Zone *cz; Eina_List *l; - E_Border *bd; + E_Client *ec; if (!zone) return; @@ -1378,40 +1343,41 @@ _policy_zone_layout(E_Zone *zone) cz = e_illume_zone_config_get(zone->num); /* loop through border list and update layout */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* skip borders that are being deleted */ - if (e_object_is_del(E_OBJECT(bd))) continue; + if (e_object_is_del(E_OBJECT(ec))) continue; /* skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* only update layout for this border if it really needs it */ - if ((!bd->new_client) && (!bd->changes.pos) && (!bd->changes.size) && - (!bd->changes.visible) && (!bd->pending_move_resize) && - (!bd->need_shape_export) && (!bd->need_shape_merge)) continue; + if ((!ec->new_client) && (!ec->changes.pos) && (!ec->changes.size) && + (!ec->changes.visible) && + (!ec->need_shape_export) && (!ec->need_shape_merge)) continue; /* are we laying out an indicator ? */ - if (e_illume_border_is_indicator(bd)) - _policy_zone_layout_indicator(bd, cz); + if (e_illume_client_is_indicator(ec)) + _policy_zone_layout_indicator(ec, cz); /* are we layout out a quickpanel ? */ - else if (e_illume_border_is_quickpanel(bd)) - _policy_zone_layout_quickpanel(bd); + else if (e_illume_client_is_quickpanel(ec)) + _policy_zone_layout_quickpanel(ec); /* are we laying out a softkey ? */ - else if (e_illume_border_is_softkey(bd)) - _policy_zone_layout_softkey(bd, cz); + else if (e_illume_client_is_softkey(ec)) + _policy_zone_layout_softkey(ec, cz); /* are we laying out a keyboard ? */ - else if (e_illume_border_is_keyboard(bd)) - _policy_zone_layout_keyboard(bd, cz); + else if (e_illume_client_is_keyboard(ec)) + _policy_zone_layout_keyboard(ec, cz); /* are we layout out a home window ? */ - else if (e_illume_border_is_home(bd)) + else if (e_illume_client_is_home(ec)) { if (!cz->mode.dual) - _policy_zone_layout_home_single(bd, cz); + _policy_zone_layout_home_single(ec, cz); else { /* we are in dual-mode, check orientation */ @@ -1419,38 +1385,38 @@ _policy_zone_layout(E_Zone *zone) { int ty; - e_illume_border_indicator_pos_get(bd->zone, NULL, &ty); - if (ty <= bd->zone->y) - _policy_zone_layout_home_dual_top(bd, cz); + e_illume_client_indicator_pos_get(ec->zone, NULL, &ty); + if (ty <= ec->zone->y) + _policy_zone_layout_home_dual_top(ec, cz); else - _policy_zone_layout_home_dual_custom(bd, cz); + _policy_zone_layout_home_dual_custom(ec, cz); } else - _policy_zone_layout_home_dual_left(bd, cz); + _policy_zone_layout_home_dual_left(ec, cz); } } /* are we laying out a fullscreen window ? */ - /* NB: we could use the e_illume_border_is_fullscreen function here + /* NB: we could use the e_illume_client_is_fullscreen function here * but we save ourselves a function call this way. */ - else if ((bd->fullscreen) || (bd->need_fullscreen)) - _policy_zone_layout_fullscreen(bd); + else if ((ec->fullscreen) || (ec->need_fullscreen)) + _policy_zone_layout_fullscreen(ec); /* are we laying out a splash screen ? */ /* NB: we check splash before dialog so if a splash screen does not * register as a splash, than the dialog trap should catch it */ - else if (e_illume_border_is_splash(bd)) - _policy_zone_layout_splash(bd, cz); + else if (e_illume_client_is_splash(ec)) + _policy_zone_layout_splash(ec, cz); /* are we laying out a dialog ? */ - else if (e_illume_border_is_dialog(bd)) - _policy_zone_layout_dialog(bd, cz); + else if (e_illume_client_is_dialog(ec)) + _policy_zone_layout_dialog(ec, cz); /* are we layout out a conformant window ? */ - else if (e_illume_border_is_conformant(bd)) + else if (e_illume_client_is_conformant(ec)) { if (!cz->mode.dual) - _policy_zone_layout_conformant_single(bd, cz); + _policy_zone_layout_conformant_single(ec, cz); else { /* we are in dual-mode, check orientation */ @@ -1458,14 +1424,14 @@ _policy_zone_layout(E_Zone *zone) { int ty; - e_illume_border_indicator_pos_get(bd->zone, NULL, &ty); - if (ty <= bd->zone->y) - _policy_zone_layout_conformant_dual_top(bd, cz); + e_illume_client_indicator_pos_get(ec->zone, NULL, &ty); + if (ty <= ec->zone->y) + _policy_zone_layout_conformant_dual_top(ec, cz); else - _policy_zone_layout_conformant_dual_custom(bd, cz); + _policy_zone_layout_conformant_dual_custom(ec, cz); } else - _policy_zone_layout_conformant_dual_left(bd, cz); + _policy_zone_layout_conformant_dual_left(ec, cz); } } @@ -1474,7 +1440,7 @@ _policy_zone_layout(E_Zone *zone) { /* are we in single mode ? */ if (!cz->mode.dual) - _policy_zone_layout_app_single(bd, cz); + _policy_zone_layout_app_single(ec, cz); else { /* we are in dual-mode, check orientation */ @@ -1484,14 +1450,14 @@ _policy_zone_layout(E_Zone *zone) /* grab the indicator position so we can tell if it * is in a custom position or not (user dragged it) */ - e_illume_border_indicator_pos_get(bd->zone, NULL, &ty); - if (ty <= bd->zone->y) - _policy_zone_layout_app_dual_top(bd, cz); + e_illume_client_indicator_pos_get(ec->zone, NULL, &ty); + if (ty <= ec->zone->y) + _policy_zone_layout_app_dual_top(ec, cz); else - _policy_zone_layout_app_dual_custom(bd, cz); + _policy_zone_layout_app_dual_custom(ec, cz); } else - _policy_zone_layout_app_dual_left(bd, cz); + _policy_zone_layout_app_dual_left(ec, cz); } } } @@ -1501,20 +1467,21 @@ void _policy_zone_move_resize(E_Zone *zone) { Eina_List *l; - E_Border *bd; + E_Client *ec; // printf("Zone move resize\n"); if (!zone) return; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* signal a changed pos here so layout gets updated */ - bd->changes.pos = 1; - BD_CHANGED(bd); + ec->changes.pos = 1; + EC_CHANGED(ec); } } @@ -1523,7 +1490,7 @@ _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode) { E_Illume_Config_Zone *cz; Eina_List *homes = NULL; - E_Border *bd; + E_Client *ec; int count; // printf("Zone mode change: %d\n", zone->num); @@ -1547,25 +1514,25 @@ _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode) e_config_save_queue(); /* lock indicator window from dragging if we need to */ - bd = e_illume_border_indicator_get(zone); - if (bd) + ec = e_illume_client_indicator_get(zone); + if (ec) { /* only dual-top mode can drag */ if ((cz->mode.dual == 1) && (cz->mode.side == 0)) { /* only set locked if we need to */ - if (bd->client.illume.drag.locked != 0) - ecore_x_e_illume_drag_locked_set(bd->client.win, 0); + if (ec->illume.drag.locked != 0) + ecore_x_e_illume_drag_locked_set(e_client_util_win_get(ec), 0); } else { /* only set locked if we need to */ - if (bd->client.illume.drag.locked != 1) - ecore_x_e_illume_drag_locked_set(bd->client.win, 1); + if (ec->illume.drag.locked != 1) + ecore_x_e_illume_drag_locked_set(e_client_util_win_get(ec), 1); } } - if (!(homes = e_illume_border_home_borders_get(zone))) return; + if (!(homes = e_illume_client_home_borders_get(zone))) return; count = eina_list_count(homes); @@ -1580,11 +1547,11 @@ _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode) /* if we went to single mode, delete any extra home windows */ if (count >= 2) { - E_Border *home; + E_Client *home; /* try to get a home window on this zone and remove it */ - if ((home = e_illume_border_home_get(zone))) - ecore_x_e_illume_home_del_send(home->client.win); + if ((home = e_illume_client_home_get(zone))) + ecore_x_e_illume_home_del_send(e_client_util_win_get(home)); } } @@ -1595,79 +1562,79 @@ _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode) void _policy_zone_close(E_Zone *zone) { - E_Border *bd; + E_Client *ec; if (!zone) return; /* make sure we have a focused border */ - if (!(bd = e_border_focused_get())) return; + if (!(ec = e_client_focused_get())) return; /* make sure focused border is on this zone */ - if (bd->zone != zone) return; + if (ec->zone != zone) return; /* close this border */ - e_border_act_close_begin(bd); + e_client_act_close_begin(ec); } void -_policy_drag_start(E_Border *bd) +_policy_drag_start(E_Client *ec) { // printf("Drag start\n"); - if (!bd) return; + if (!ec) return; /* ignore stolen borders */ - if (bd->stolen) return; + if (ec->stolen) return; /* set property on this border to say we are dragging */ - ecore_x_e_illume_drag_set(bd->client.win, 1); + ecore_x_e_illume_drag_set(e_client_util_win_get(ec), 1); /* set property on zone window that a drag is happening */ - ecore_x_e_illume_drag_set(bd->zone->black_win, 1); + ecore_x_e_illume_drag_set(ec->zone->black_win, 1); } void -_policy_drag_end(E_Border *bd) +_policy_drag_end(E_Client *ec) { // printf("Drag end\n"); - if (!bd) return; + if (!ec) return; /* ignore stolen borders */ - if (bd->stolen) return; + if (ec->stolen) return; /* set property on this border to say we are done dragging */ - ecore_x_e_illume_drag_set(bd->client.win, 0); + ecore_x_e_illume_drag_set(e_client_util_win_get(ec), 0); /* set property on zone window that a drag is finished */ - ecore_x_e_illume_drag_set(bd->zone->black_win, 0); + ecore_x_e_illume_drag_set(ec->zone->black_win, 0); } void _policy_focus_back(E_Zone *zone) { Eina_List *l, *fl = NULL; - E_Border *bd, *fbd; + E_Client *ec, *fbd; if (!zone) return; if (eina_list_count(_pol_focus_stack) < 1) return; // printf("Focus back\n"); - EINA_LIST_REVERSE_FOREACH(_pol_focus_stack, l, bd) + EINA_LIST_REVERSE_FOREACH(_pol_focus_stack, l, ec) { - if (bd->zone != zone) continue; - fl = eina_list_append(fl, bd); + if (ec->zone != zone) continue; + fl = eina_list_append(fl, ec); } - if (!(fbd = e_border_focused_get())) return; + if (!(fbd = e_client_focused_get())) return; if (fbd->parent) return; - EINA_LIST_REVERSE_FOREACH(fl, l, bd) + EINA_LIST_REVERSE_FOREACH(fl, l, ec) { - if ((fbd) && (bd == fbd)) + if ((fbd) && (ec == fbd)) { - E_Border *b; + E_Client *b; if ((l->next) && (b = l->next->data)) { @@ -1692,27 +1659,27 @@ void _policy_focus_forward(E_Zone *zone) { Eina_List *l, *fl = NULL; - E_Border *bd, *fbd; + E_Client *ec, *fbd; if (!zone) return; if (eina_list_count(_pol_focus_stack) < 1) return; // printf("Focus forward\n"); - EINA_LIST_FOREACH(_pol_focus_stack, l, bd) + EINA_LIST_FOREACH(_pol_focus_stack, l, ec) { - if (bd->zone != zone) continue; - fl = eina_list_append(fl, bd); + if (ec->zone != zone) continue; + fl = eina_list_append(fl, ec); } - if (!(fbd = e_border_focused_get())) return; + if (!(fbd = e_client_focused_get())) return; if (fbd->parent) return; - EINA_LIST_FOREACH(fl, l, bd) + EINA_LIST_FOREACH(fl, l, ec) { - if ((fbd) && (bd == fbd)) + if ((fbd) && (ec == fbd)) { - E_Border *b; + E_Client *b; if ((l->next) && (b = l->next->data)) { @@ -1736,24 +1703,24 @@ _policy_focus_forward(E_Zone *zone) void _policy_focus_home(E_Zone *zone) { - E_Border *bd; + E_Client *ec; if (!zone) return; - if (!(bd = e_illume_border_home_get(zone))) return; + if (!(ec = e_illume_client_home_get(zone))) return; /* if the border was hidden due to layout, we need to unhide */ - if (!bd->visible) e_illume_border_show(bd); + if (!ec->visible) e_illume_client_show(ec); - if ((bd->iconic) && (!bd->lock_user_iconify)) - e_border_uniconify(bd); + if ((ec->iconic) && (!ec->lock_user_iconify)) + e_client_uniconify(ec); - if (!bd->lock_user_stacking) e_border_raise(bd); + if (!ec->lock_user_stacking) evas_object_raise(ec->frame); /* hide the border(s) above this one */ - _policy_border_hide_above(bd); + _policy_border_hide_above(ec); /* focus the border */ - e_border_focus_set(bd, 1, 1); + evas_object_focus_set(ec->frame, 1); } void @@ -1764,43 +1731,43 @@ _policy_property_change(Ecore_X_Event_Window_Property *event) /* we are interested in state changes here */ if (event->atom == ECORE_X_ATOM_NET_WM_STATE) { - E_Border *bd, *ind; + E_Client *ec, *ind; - if (!(bd = e_border_find_by_client_window(event->win))) return; + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, event->win))) return; /* not interested in stolen or invisible borders */ - if ((bd->stolen) || (!bd->visible)) return; + if ((ec->stolen) || (!ec->visible)) return; /* make sure the border has a name or class */ /* NB: this check is here because some E borders get State Changes * but do not have a name/class associated with them. Not entirely sure * which ones they are, but I would guess Managers, Containers, or Zones. * At any rate, we're not interested in those types of borders */ - if ((!bd->client.icccm.name) || (!bd->client.icccm.class)) return; + if ((!ec->icccm.name) || (!ec->icccm.class)) return; /* NB: If we have reached this point, then it should be a fullscreen * border that has toggled fullscreen on/off */ /* try to get the Indicator on this zone */ - if (!(ind = e_illume_border_indicator_get(bd->zone))) return; + if (!(ind = e_illume_client_indicator_get(ec->zone))) return; /* if we are fullscreen, hide the indicator...else we show it */ - /* NB: we could use the e_illume_border_is_fullscreen function here + /* NB: we could use the e_illume_client_is_fullscreen function here * but we save ourselves a function call this way */ - if ((bd->fullscreen) || (bd->need_fullscreen)) + if ((ec->fullscreen) || (ec->need_fullscreen)) { if (ind->visible) { - e_illume_border_hide(ind); - _policy_zone_layout_update(bd->zone); + e_illume_client_hide(ind); + _policy_zone_layout_update(ec->zone); } } else { if (!ind->visible) { - e_illume_border_show(ind); - _policy_zone_layout_update(bd->zone); + e_illume_client_show(ind); + _policy_zone_layout_update(ec->zone); } } } @@ -1808,57 +1775,59 @@ _policy_property_change(Ecore_X_Event_Window_Property *event) { Eina_List *l; E_Zone *zone; - E_Border *bd; + E_Client *ec; int x, y, w, h; /* make sure this property changed on a zone */ if (!(zone = e_util_zone_window_find(event->win))) return; /* get the geometry */ - if (!(bd = e_illume_border_indicator_get(zone))) return; - x = bd->x; - y = bd->y; - w = bd->w; - h = bd->h; + if (!(ec = e_illume_client_indicator_get(zone))) return; + x = ec->x; + y = ec->y; + w = ec->w; + h = ec->h; /* look for conformant borders */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { - if (bd->zone != zone) continue; - if (!e_illume_border_is_conformant(bd)) continue; + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (!e_illume_client_is_conformant(ec)) continue; /* set indicator geometry on conformant window */ /* NB: This is needed so that conformant apps get told about * the indicator size/position...else they have no way of * knowing that the geometry has been updated */ - ecore_x_e_illume_indicator_geometry_set(bd->client.win, x, y, w, h); + ecore_x_e_illume_indicator_geometry_set(e_client_util_win_get(ec), x, y, w, h); } } else if (event->atom == ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY) { Eina_List *l; E_Zone *zone; - E_Border *bd; + E_Client *ec; int x, y, w, h; /* make sure this property changed on a zone */ if (!(zone = e_util_zone_window_find(event->win))) return; - if (!(bd = e_illume_border_softkey_get(zone))) return; - x = bd->x; - y = bd->y; - w = bd->w; - h = bd->h; + if (!(ec = e_illume_client_softkey_get(zone))) return; + x = ec->x; + y = ec->y; + w = ec->w; + h = ec->h; /* look for conformant borders */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { - if (bd->zone != zone) continue; - if (!e_illume_border_is_conformant(bd)) continue; + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (!e_illume_client_is_conformant(ec)) continue; /* set softkey geometry on conformant window */ /* NB: This is needed so that conformant apps get told about * the softkey size/position...else they have no way of * knowing that the geometry has been updated */ - ecore_x_e_illume_softkey_geometry_set(bd->client.win, x, y, w, h); + ecore_x_e_illume_softkey_geometry_set(e_client_util_win_get(ec), x, y, w, h); } } else if (event->atom == ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY) @@ -1866,7 +1835,7 @@ _policy_property_change(Ecore_X_Event_Window_Property *event) Eina_List *l; E_Zone *zone; E_Illume_Keyboard *kbd; - E_Border *bd; + E_Client *ec; int x, y, w, h; /* make sure this property changed on a zone */ @@ -1874,50 +1843,48 @@ _policy_property_change(Ecore_X_Event_Window_Property *event) /* get the keyboard */ if (!(kbd = e_illume_keyboard_get())) return; - if (!kbd->border) return; + if (!kbd->client) return; /* get the geometry */ - x = kbd->border->x; - w = kbd->border->w; - h = kbd->border->h; + x = kbd->client->x; + w = kbd->client->w; + h = kbd->client->h; /* adjust for keyboard visibility because keyboard uses fx_offset */ y = 0; - if (kbd->border->cw && - (!e_util_strcmp(edje_object_part_state_get(kbd->border->cw->effect_obj, "mover", NULL), "custom"))) - y = kbd->border->y; +#warning this is totally broken on so many levels + //if (kbd->client->frame && + //(!e_util_strcmp(edje_object_part_state_get(kbd->client->cw->effect_obj, "mover", NULL), "custom"))) + //y = kbd->client->y; /* look for conformant borders */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { - if (bd->zone != zone) continue; - if (!e_illume_border_is_conformant(bd)) continue; + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (!e_illume_client_is_conformant(ec)) continue; /* set keyboard geometry on conformant window */ /* NB: This is needed so that conformant apps get told about * the keyboard size/position...else they have no way of * knowing that the geometry has been updated */ - ecore_x_e_illume_keyboard_geometry_set(bd->client.win, x, y, w, h); + ecore_x_e_illume_keyboard_geometry_set(e_client_util_win_get(ec), x, y, w, h); } } else if (event->atom == ATM_ENLIGHTENMENT_SCALE) { - Eina_List *ml; - E_Manager *man; + const Eina_List *l; + E_Comp *comp; - EINA_LIST_FOREACH(e_manager_list(), ml, man) + + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - Eina_List *cl; - E_Container *con; + Eina_List *zl; + E_Zone *zone; - if (event->win != man->root) continue; - EINA_LIST_FOREACH(man->containers, cl, con) - { - Eina_List *zl; - E_Zone *zone; + if (event->win != comp->man->root) continue; - EINA_LIST_FOREACH(con->zones, zl, zone) - _policy_zone_layout_update(zone); - } + EINA_LIST_FOREACH(comp->zones, zl, zone) + _policy_zone_layout_update(zone); } } } diff --git a/src/modules/illume2/policies/illume/policy.h b/src/modules/illume2/policies/illume/policy.h index 30dbbe45d..717017c3f 100644 --- a/src/modules/illume2/policies/illume/policy.h +++ b/src/modules/illume2/policies/illume/policy.h @@ -14,20 +14,20 @@ # define POL_APP_LAYER 100 # define POL_HOME_LAYER 90 -void _policy_border_add(E_Border *bd); -void _policy_border_del(E_Border *bd); -void _policy_border_focus_in(E_Border *bd); -void _policy_border_focus_out(E_Border *bd); -void _policy_border_activate(E_Border *bd); -void _policy_border_post_fetch(E_Border *bd); -void _policy_border_post_assign(E_Border *bd); -void _policy_border_show(E_Border *bd); +void _policy_border_add(E_Client *ec); +void _policy_border_del(E_Client *ec); +void _policy_border_focus_in(E_Client *ec); +void _policy_border_focus_out(E_Client *ec); +void _policy_border_activate(E_Client *ec); +void _policy_border_post_fetch(E_Client *ec); +void _policy_border_post_assign(E_Client *ec); +void _policy_border_show(E_Client *ec); void _policy_zone_layout(E_Zone *zone); void _policy_zone_move_resize(E_Zone *zone); void _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode); void _policy_zone_close(E_Zone *zone); -void _policy_drag_start(E_Border *bd); -void _policy_drag_end(E_Border *bd); +void _policy_drag_start(E_Client *ec); +void _policy_drag_end(E_Client *ec); void _policy_focus_back(E_Zone *zone); void _policy_focus_forward(E_Zone *zone); void _policy_focus_home(E_Zone *zone); diff --git a/src/modules/illume2/policies/tablet/policy.c b/src/modules/illume2/policies/tablet/policy.c index 935c540d4..5f9810b9b 100644 --- a/src/modules/illume2/policies/tablet/policy.c +++ b/src/modules/illume2/policies/tablet/policy.c @@ -3,64 +3,64 @@ #include "e.h" /* local function prototypes */ -static void _policy_border_set_focus(E_Border *bd); -static void _policy_border_move(E_Border *bd, int x, int y); -static void _policy_border_resize(E_Border *bd, int w, int h); -static void _policy_border_hide_below(E_Border *bd); +static void _policy_border_set_focus(E_Client *ec); +static void _policy_border_move(E_Client *ec, int x, int y); +static void _policy_border_resize(E_Client *ec, int w, int h); +static void _policy_border_hide_below(E_Client *ec); static void _policy_zone_layout_update(E_Zone *zone); -static void _policy_zone_layout_indicator(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_quickpanel(E_Border *bd); -static void _policy_zone_layout_softkey(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_keyboard(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_home_single(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_fullscreen(E_Border *bd); -static void _policy_zone_layout_app_single(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_app_dual_top(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_app_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_app_dual_left(E_Border *bd, E_Illume_Config_Zone *cz, Eina_Bool force); -static void _policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_splash(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_conformant_single(E_Border *bd, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_indicator(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_quickpanel(E_Client *ec); +static void _policy_zone_layout_softkey(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_keyboard(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_home_single(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_fullscreen(E_Client *ec); +static void _policy_zone_layout_app_single(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_app_dual_top(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_app_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_app_dual_left(E_Client *ec, E_Illume_Config_Zone *cz, Eina_Bool force); +static void _policy_zone_layout_dialog(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_splash(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_conformant_single(E_Client *ec, E_Illume_Config_Zone *cz); #if 0 -static void _policy_zone_layout_conformant_dual_top(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_conformant_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz); -static void _policy_zone_layout_conformant_dual_left(E_Border *bd, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_conformant_dual_top(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_conformant_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz); +static void _policy_zone_layout_conformant_dual_left(E_Client *ec, E_Illume_Config_Zone *cz); #endif static Eina_List *_pol_focus_stack; /* local functions */ static void -_policy_border_set_focus(E_Border *bd) +_policy_border_set_focus(E_Client *ec) { - if (!bd) return; - /* printf("_policy_border_set_focus %s\n", e_border_name_get(bd)); */ + if (!ec) return; + /* printf("_policy_border_set_focus %s\n", e_client_name_get(ec)); */ /* if focus is locked out then get out */ - if (bd->lock_focus_out) return; + if (ec->lock_focus_out) return; - if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus)) + if ((ec->icccm.accepts_focus) || (ec->icccm.take_focus)) { /* check E's focus settings */ if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) || - ((bd->parent) && + ((ec->parent) && ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) || - ((bd->parent->focused) && + ((ec->parent->focused) && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED))))) { /* if the border was hidden due to layout, we need to unhide */ - if (!bd->visible) e_illume_border_show(bd); + if (!ec->visible) e_illume_client_show(ec); - if ((bd->iconic) && (!bd->lock_user_iconify)) - e_border_uniconify(bd); + if ((ec->iconic) && (!ec->lock_user_iconify)) + e_client_uniconify(ec); - if (!bd->lock_user_stacking) e_border_raise(bd); + if (!ec->lock_user_stacking) evas_object_raise(ec->frame); /* focus the border */ - e_border_focus_set(bd, 1, 1); - /* e_border_raise(bd); */ + evas_object_focus_set(ec->frame, 1); + /* evas_object_raise(ec->frame); */ /* hide the border below this one */ - _policy_border_hide_below(bd); + _policy_border_hide_below(ec); /* NB: since we skip needless border evals when container layout * is called (to save cpu cycles), we need to @@ -70,178 +70,152 @@ _policy_border_set_focus(E_Border *bd) * This is potentially useless as THIS policy * makes all windows borderless anyway, but it's in here for * completeness - e_border_focus_latest_set(bd); - if (bd->bg_object) - 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"); - e_focus_event_focus_in(bd); + e_client_focus_latest_set(ec); + if (ec->bg_object) + edje_object_signal_emit(ec->bg_object, "e,state,focused", "e"); + if (ec->icon_object) + edje_object_signal_emit(ec->icon_object, "e,state,focused", "e"); + e_focus_event_focus_in(ec); */ } } } static void -_policy_border_move(E_Border *bd, int x, int y) +_policy_border_move(E_Client *ec, int x, int y) { - if (!bd) return; + if (!ec) return; - bd->x = x; - bd->y = y; - bd->changes.pos = 1; - BD_CHANGED(bd); + ec->x = x; + ec->y = y; + ec->changes.pos = 1; + EC_CHANGED(ec); } static void -_policy_border_resize(E_Border *bd, int w, int h) +_policy_border_resize(E_Client *ec, int w, int h) { - if (!bd) return; + if (!ec) return; - bd->w = w; - bd->h = h; - bd->client.w = (bd->w - (bd->client_inset.l + bd->client_inset.r)); - bd->client.h = (bd->h - (bd->client_inset.t + bd->client_inset.b)); - bd->changes.size = 1; - BD_CHANGED(bd); + ec->w = w; + ec->h = h; + e_comp_object_frame_wh_unadjust(ec->frame, ec->w, ec->h, &ec->client.w, &ec->client.h); + ec->changes.size = 1; + EC_CHANGED(ec); } static void -_policy_border_hide_below(E_Border *bd) +_policy_border_hide_below(E_Client *ec) { - int pos = 0, i; + E_Client *b; return; // printf("Hide Borders Below: %s %d %d\n", - // bd->client.icccm.name, bd->x, bd->y); + // ec->icccm.name, ec->x, ec->y); - if (!bd) return; - /* printf("_policy_border_hide_below %s\n", e_border_name_get(bd)); */ - /* determine layering position */ - if (bd->layer <= 0) pos = 0; - else if ((bd->layer > 0) && (bd->layer <= 50)) pos = 1; - else if ((bd->layer > 50) && (bd->layer <= 100)) pos = 2; - else if ((bd->layer > 100) && (bd->layer <= 150)) pos = 3; - else if ((bd->layer > 150) && (bd->layer <= 200)) pos = 4; - else pos = 5; + if (!ec) return; /* Find the windows below this one */ - for (i = pos; i >= 2; i--) + E_CLIENT_FOREACH(ec->comp, b) { - Eina_List *l; - E_Border *b; + if (e_client_util_ignored_get(b)) continue; + if (b->layer < E_LAYER_CLIENT_BELOW) continue; + /* skip if it's the same border */ + if (b == ec) break; - EINA_LIST_FOREACH(bd->zone->container->layers[i].clients, l, b) - { - /* skip if it's the same border */ - if (b == bd) continue; + /* skip if it's not on this zone */ + if (b->zone != ec->zone) continue; - /* skip if it's not on this zone */ - if (b->zone != bd->zone) continue; + /* skip special borders */ + if (e_illume_client_is_indicator(b)) continue; + if (e_illume_client_is_softkey(b)) continue; + if (e_illume_client_is_keyboard(b)) continue; + if (e_illume_client_is_quickpanel(b)) continue; + if (e_illume_client_is_home(b)) continue; - /* skip special borders */ - if (e_illume_border_is_indicator(b)) continue; - if (e_illume_border_is_softkey(b)) continue; - if (e_illume_border_is_keyboard(b)) continue; - if (e_illume_border_is_quickpanel(b)) continue; - if (e_illume_border_is_home(b)) continue; - - if ((bd->fullscreen) || (bd->need_fullscreen)) - { - if (b->visible) e_illume_border_hide(b); - } - else - { - /* we need to check x/y position */ - if (E_CONTAINS(bd->x, bd->y, bd->w, bd->h, - b->x, b->y, b->w, b->h)) - { - if (b->visible) e_illume_border_hide(b); - } - } - } + if ((ec->fullscreen) || (ec->need_fullscreen)) + { + if (b->visible) e_illume_client_hide(b); + } + else + { + /* we need to check x/y position */ + if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, + b->x, b->y, b->w, b->h)) + { + if (b->visible) e_illume_client_hide(b); + } + } } } #if 0 static void -_policy_border_show_below(E_Border *bd) +_policy_border_show_below(E_Client *ec) { Eina_List *l; - E_Border *prev; - int pos = 0, i; + E_Client *prev, *b; // printf("Show Borders Below: %s %d %d\n", - // bd->client.icccm.class, bd->x, bd->y); + // ec->icccm.class, ec->x, ec->y); - if (!bd) return; - /* printf("_policy_border_show_below %s\n", e_border_name_get(bd)); */ - if (bd->client.icccm.transient_for) + if (!ec) return; + /* printf("_policy_border_show_below %s\n", e_client_name_get(ec)); */ + if (ec->icccm.transient_for) { - if ((prev = e_border_find_by_client_window(bd->client.icccm.transient_for))) + if ((prev = e_pixmap_find_client(E_PIXMAP_TYPE_X, ec->icccm.transient_for))) { _policy_border_set_focus(prev); return; } } - /* determine layering position */ - if (bd->layer <= 0) pos = 0; - else if ((bd->layer > 0) && (bd->layer <= 50)) pos = 1; - else if ((bd->layer > 50) && (bd->layer <= 100)) pos = 2; - else if ((bd->layer > 100) && (bd->layer <= 150)) pos = 3; - else if ((bd->layer > 150) && (bd->layer <= 200)) pos = 4; - else pos = 5; - /* Find the windows below this one */ - for (i = pos; i >= 2; i--) + E_CLIENT_FOREACH(ec->comp, b) { - E_Border *b; + if (e_client_util_ignored_get(b)) continue; + if (b->layer < E_LAYER_CLIENT_BELOW) continue; + if (b == ec) break; - EINA_LIST_REVERSE_FOREACH(bd->zone->container->layers[i].clients, l, b) - { - /* skip if it's the same border */ - if (b == bd) continue; + /* skip if it's not on this zone */ + if (b->zone != ec->zone) continue; - /* skip if it's not on this zone */ - if (b->zone != bd->zone) continue; + /* skip special borders */ + if (e_illume_client_is_indicator(b)) continue; + if (e_illume_client_is_softkey(b)) continue; + if (e_illume_client_is_keyboard(b)) continue; + if (e_illume_client_is_quickpanel(b)) continue; + if (e_illume_client_is_home(b)) continue; - /* skip special borders */ - if (e_illume_border_is_indicator(b)) continue; - if (e_illume_border_is_softkey(b)) continue; - if (e_illume_border_is_keyboard(b)) continue; - if (e_illume_border_is_quickpanel(b)) continue; - if (e_illume_border_is_home(b)) continue; - - if ((bd->fullscreen) || (bd->need_fullscreen)) - { - _policy_border_set_focus(b); - return; - } - else - { - /* need to check x/y position */ - if (E_CONTAINS(bd->x, bd->y, bd->w, bd->h, - b->x, b->y, b->w, b->h)) - { - _policy_border_set_focus(b); - return; - } - } - } + if ((ec->fullscreen) || (ec->need_fullscreen)) + { + _policy_border_set_focus(b); + return; + } + else + { + /* need to check x/y position */ + if (E_CONTAINS(ec->x, ec->y, ec->w, ec->h, + b->x, b->y, b->w, b->h)) + { + _policy_border_set_focus(b); + return; + } + } } /* if we reach here, then there is a problem with showing a window below * this one, so show previous window in stack */ EINA_LIST_REVERSE_FOREACH(_pol_focus_stack, l, prev) { - if (prev->zone != bd->zone) continue; + if (prev->zone != ec->zone) continue; _policy_border_set_focus(prev); return; } /* Fallback to focusing home if all above fails */ - _policy_focus_home(bd->zone); + _policy_focus_home(ec->zone); } #endif @@ -249,70 +223,71 @@ static void _policy_zone_layout_update(E_Zone *zone) { Eina_List *l; - E_Border *bd; + E_Client *ec; if (!zone) return; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { + if (e_client_util_ignored_get(ec)) continue; /* skip borders not on this zone */ - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; /* skip special windows */ - if (e_object_is_del(E_OBJECT(bd))) continue; - if (e_illume_border_is_keyboard(bd)) continue; - if (e_illume_border_is_quickpanel(bd)) continue; + if (e_object_is_del(E_OBJECT(ec))) continue; + if (e_illume_client_is_keyboard(ec)) continue; + if (e_illume_client_is_quickpanel(ec)) continue; /* signal a changed pos here so layout gets updated */ - bd->changes.pos = 1; - BD_CHANGED(bd); + ec->changes.pos = 1; + EC_CHANGED(ec); } } static void -_policy_zone_layout_indicator(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_indicator(E_Client *ec, E_Illume_Config_Zone *cz) { - if ((!bd) || (!cz)) return; + if ((!ec) || (!cz)) return; /* grab minimum indicator size */ - e_illume_border_min_get(bd, NULL, &cz->indicator.size); + e_illume_client_min_get(ec, NULL, &cz->indicator.size); /* no point in doing anything here if indicator is hidden */ - if ((!bd->new_client) && (!bd->visible)) + if ((!ec->new_client) && (!ec->visible)) { - ecore_x_e_illume_indicator_geometry_set(bd->zone->black_win, + ecore_x_e_illume_indicator_geometry_set(ec->zone->black_win, 0, 0, 0, 0); return; } /* if we are dragging, then skip it for now */ - if (bd->client.illume.drag.drag) + if (ec->illume.drag.drag) { /* when dragging indicator, we need to trigger a layout update */ - ecore_x_e_illume_indicator_geometry_set(bd->zone->black_win, + ecore_x_e_illume_indicator_geometry_set(ec->zone->black_win, 0, 0, 0, 0); - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); return; } - // printf("\tLayout Indicator: %d\n", bd->zone->num); + // printf("\tLayout Indicator: %d\n", ec->zone->num); /* lock indicator window from dragging if we need to */ if ((cz->mode.dual == 1) && (cz->mode.side == 0)) - ecore_x_e_illume_drag_locked_set(bd->client.win, 0); + ecore_x_e_illume_drag_locked_set(e_client_util_win_get(ec), 0); else - ecore_x_e_illume_drag_locked_set(bd->client.win, 1); + ecore_x_e_illume_drag_locked_set(e_client_util_win_get(ec), 1); - if ((bd->w != bd->zone->w) || (bd->h != cz->indicator.size)) - _policy_border_resize(bd, bd->zone->w, cz->indicator.size); + if ((ec->w != ec->zone->w) || (ec->h != cz->indicator.size)) + _policy_border_resize(ec, ec->zone->w, cz->indicator.size); if (!cz->mode.dual) { /* move to 0, 0 (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != bd->zone->y)) + if ((ec->x != ec->zone->x) || (ec->y != ec->zone->y)) { - _policy_border_move(bd, bd->zone->x, bd->zone->y); - ecore_x_e_illume_quickpanel_position_update_send(bd->client.win); + _policy_border_move(ec, ec->zone->x, ec->zone->y); + ecore_x_e_illume_quickpanel_position_update_send(e_client_util_win_get(ec)); } } else @@ -323,100 +298,100 @@ _policy_zone_layout_indicator(E_Border *bd, E_Illume_Config_Zone *cz) * in this case, the indicator itself should be responsible for * sending the quickpanel position update message when it is * finished dragging */ - if (bd->x != bd->zone->x) - _policy_border_move(bd, bd->zone->x, bd->y); + if (ec->x != ec->zone->x) + _policy_border_move(ec, ec->zone->x, ec->y); } else { /* move to 0, 0 (relative to zone) if needed */ - if ((bd->x != bd->zone->x) || (bd->y != bd->zone->y)) + if ((ec->x != ec->zone->x) || (ec->y != ec->zone->y)) { - _policy_border_move(bd, bd->zone->x, bd->zone->y); - ecore_x_e_illume_quickpanel_position_update_send(bd->client.win); + _policy_border_move(ec, ec->zone->x, ec->zone->y); + ecore_x_e_illume_quickpanel_position_update_send(e_client_util_win_get(ec)); } } } - ecore_x_e_illume_indicator_geometry_set(bd->zone->black_win, - bd->x, bd->y, - bd->w, bd->h); + ecore_x_e_illume_indicator_geometry_set(ec->zone->black_win, + ec->x, ec->y, + ec->w, ec->h); - if (bd->layer != POL_INDICATOR_LAYER) - e_border_layer_set(bd, POL_INDICATOR_LAYER); + if (ec->layer != POL_INDICATOR_LAYER) + evas_object_layer_set(ec->frame, POL_INDICATOR_LAYER); } #define ZONE_GEOMETRY \ int x, y, w, h; \ - e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h); \ - x += bd->zone->x; \ - y += bd->zone->y; \ + e_zone_useful_geometry_get(ec->zone, &x, &y, &w, &h); \ + x += ec->zone->x; \ + y += ec->zone->y; \ static void -_border_geometry_set(E_Border *bd, int x, int y, int w, int h, int layer) +_border_geometry_set(E_Client *ec, int x, int y, int w, int h, int layer) { - if ((bd->w != w) || (bd->h != h)) - _policy_border_resize(bd, w, h); + if ((ec->w != w) || (ec->h != h)) + _policy_border_resize(ec, w, h); - if ((bd->x != x) || (bd->y != y)) - _policy_border_move(bd, x, y); + if ((ec->x != x) || (ec->y != y)) + _policy_border_move(ec, x, y); - if ((int)bd->layer != layer) e_border_layer_set(bd, layer); + if ((int)ec->layer != layer) evas_object_layer_set(ec->frame, layer); } static void -_policy_zone_layout_quickpanel(E_Border *bd) +_policy_zone_layout_quickpanel(E_Client *ec) { int mh; - if (!bd) return; + if (!ec) return; - e_illume_border_min_get(bd, NULL, &mh); + e_illume_client_min_get(ec, NULL, &mh); - if ((bd->w != bd->zone->w) || (bd->h != mh)) - _policy_border_resize(bd, bd->zone->w, mh); + if ((ec->w != ec->zone->w) || (ec->h != mh)) + _policy_border_resize(ec, ec->zone->w, mh); - if (bd->layer != POL_QUICKPANEL_LAYER) - e_border_layer_set(bd, POL_QUICKPANEL_LAYER); + if (ec->layer != POL_QUICKPANEL_LAYER) + evas_object_layer_set(ec->frame, POL_QUICKPANEL_LAYER); } static void -_policy_zone_layout_softkey(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_softkey(E_Client *ec, E_Illume_Config_Zone *cz) { int ny; - if ((!bd) || (!cz)) return; - if (!bd->visible) + if ((!ec) || (!cz)) return; + if (!ec->visible) { - ecore_x_e_illume_softkey_geometry_set(bd->zone->black_win, 0, 0, 0, 0); + ecore_x_e_illume_softkey_geometry_set(ec->zone->black_win, 0, 0, 0, 0); return; } ZONE_GEOMETRY; - e_illume_border_min_get(bd, NULL, &cz->softkey.size); + e_illume_client_min_get(ec, NULL, &cz->softkey.size); /* if we are dragging, then skip it for now */ /* NB: Disabled currently until we confirm that softkey should be draggable */ - // if (bd->client.illume.drag.drag) return; + // if (ec->illume.drag.drag) return; - if ((bd->w != w) || (bd->h != cz->softkey.size)) - _policy_border_resize(bd, w, cz->softkey.size); + if ((ec->w != w) || (ec->h != cz->softkey.size)) + _policy_border_resize(ec, w, cz->softkey.size); - ny = ((bd->zone->y + bd->zone->h) - cz->softkey.size); + ny = ((ec->zone->y + ec->zone->h) - cz->softkey.size); /* NB: not sure why yet, but on startup the border->y is reporting * that it is already in this position...but it's actually not. * So for now, just disable the ny check until this gets sorted out */ - if ((bd->x != x) || (bd->y != ny)) - _policy_border_move(bd, x, ny); + if ((ec->x != x) || (ec->y != ny)) + _policy_border_move(ec, x, ny); - /* _border_geometry_set(bd, x, ny, nw, nh, bd, POL_CONFORMANT_LAYER); */ + /* _border_geometry_set(ec, x, ny, nw, nh, ec, POL_CONFORMANT_LAYER); */ - ecore_x_e_illume_softkey_geometry_set(bd->zone->black_win, - bd->x, bd->y, - bd->w, bd->h); + ecore_x_e_illume_softkey_geometry_set(ec->zone->black_win, + ec->x, ec->y, + ec->w, ec->h); - if (bd->layer != POL_SOFTKEY_LAYER) e_border_layer_set(bd, POL_SOFTKEY_LAYER); + if (ec->layer != POL_SOFTKEY_LAYER) evas_object_layer_set(ec->frame, POL_SOFTKEY_LAYER); } @@ -424,15 +399,15 @@ _policy_zone_layout_softkey(E_Border *bd, E_Illume_Config_Zone *cz) #define MIN_HEIGHT 100 static Eina_Bool -_policy_layout_app_check(E_Border *bd) +_policy_layout_app_check(E_Client *ec) { - if (!bd) + if (!ec) return EINA_FALSE; - if (!bd->visible) + if (!ec->visible) return EINA_FALSE; - if ((bd->desk != e_desk_current_get(bd->zone)) && (!bd->sticky)) + if ((ec->desk != e_desk_current_get(ec->zone)) && (!ec->sticky)) return EINA_FALSE; return EINA_TRUE; @@ -440,14 +415,14 @@ _policy_layout_app_check(E_Border *bd) static void -_policy_keyboard_restrict(E_Border *bd, int *h) +_policy_keyboard_restrict(E_Client *ec, int *h) { int kh; - if (bd->client.vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) + if (ec->vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) { - e_illume_keyboard_safe_app_region_get(bd->zone, NULL, NULL, NULL, &kh); - kh -= bd->zone->h - *h; + e_illume_keyboard_safe_app_region_get(ec->zone, NULL, NULL, NULL, &kh); + kh -= ec->zone->h - *h; if ((kh < *h) && (kh > MIN_HEIGHT)) *h = kh; } @@ -471,125 +446,125 @@ _policy_softkey_restrict(E_Illume_Config_Zone *cz, int *y, int *h) } static void -_policy_zone_layout_keyboard(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_keyboard(E_Client *ec, E_Illume_Config_Zone *cz) { int ny, layer; - if ((!bd) || (!cz) || (!bd->visible)) return; + if ((!ec) || (!cz) || (!ec->visible)) return; ZONE_GEOMETRY; - e_illume_border_min_get(bd, NULL, &cz->vkbd.size); + e_illume_client_min_get(ec, NULL, &cz->vkbd.size); - ny = ((bd->zone->y + bd->zone->h) - cz->vkbd.size); + ny = ((ec->zone->y + ec->zone->h) - cz->vkbd.size); - /* if ((bd->fullscreen) || (bd->need_fullscreen)) + /* if ((ec->fullscreen) || (ec->need_fullscreen)) * layer = POL_FULLSCREEN_LAYER; * else */ layer = POL_KEYBOARD_LAYER; - _border_geometry_set(bd, x, ny, w, cz->vkbd.size, layer); + _border_geometry_set(ec, x, ny, w, cz->vkbd.size, layer); } static void -_policy_zone_layout_home_single(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_home_single(E_Client *ec, E_Illume_Config_Zone *cz) { - if ((!bd) || (!cz) || (!bd->visible)) return; + if ((!ec) || (!cz) || (!ec->visible)) return; ZONE_GEOMETRY; _policy_indicator_restrict(cz, &y, &h); - _border_geometry_set(bd, x, y, w, h, POL_HOME_LAYER); + _border_geometry_set(ec, x, y, w, h, POL_HOME_LAYER); } static void -_policy_zone_layout_fullscreen(E_Border *bd) +_policy_zone_layout_fullscreen(E_Client *ec) { - if (!_policy_layout_app_check(bd)) return; + if (!_policy_layout_app_check(ec)) return; ZONE_GEOMETRY; - _policy_keyboard_restrict(bd, &h); + _policy_keyboard_restrict(ec, &h); - _border_geometry_set(bd, x, y, w, h, POL_FULLSCREEN_LAYER); + _border_geometry_set(ec, x, y, w, h, POL_FULLSCREEN_LAYER); } static void -_policy_zone_layout_app_single(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_app_single(E_Client *ec, E_Illume_Config_Zone *cz) { - if (!_policy_layout_app_check(bd)) return; + if (!_policy_layout_app_check(ec)) return; ZONE_GEOMETRY; - _policy_keyboard_restrict(bd, &h); + _policy_keyboard_restrict(ec, &h); _policy_indicator_restrict(cz, &y, &h); _policy_softkey_restrict(cz, &y, &h); - _border_geometry_set(bd, x, y, w, h, POL_APP_LAYER); + _border_geometry_set(ec, x, y, w, h, POL_APP_LAYER); } static void -_policy_zone_layout_app_dual_top(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_app_dual_top(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *bd2; + E_Client *ec2; - if (!_policy_layout_app_check(bd)) return; + if (!_policy_layout_app_check(ec)) return; ZONE_GEOMETRY; - _policy_keyboard_restrict(bd, &h); + _policy_keyboard_restrict(ec, &h); _policy_indicator_restrict(cz, &y, &h); _policy_softkey_restrict(cz, &y, &h); - bd2 = e_illume_border_at_xy_get(bd->zone, x, y); - if ((bd2) && (bd2 != bd)) + ec2 = e_illume_client_at_xy_get(ec->zone, x, y); + if ((ec2) && (ec2 != ec)) { - if ((bd->focused) && (bd->client.vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)) - _border_geometry_set(bd2, x, h/2 + y, w, h/2, POL_APP_LAYER); + if ((ec->focused) && (ec->vkbd.state > ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)) + _border_geometry_set(ec2, x, h/2 + y, w, h/2, POL_APP_LAYER); else y += h/2; } - _border_geometry_set(bd, x, y, w, h/2, POL_APP_LAYER); + _border_geometry_set(ec, x, y, w, h/2, POL_APP_LAYER); } static void -_policy_zone_layout_app_dual_custom(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_app_dual_custom(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *app; + E_Client *app; int iy, ny, nh; - if (!_policy_layout_app_check(bd)) return; + if (!_policy_layout_app_check(ec)) return; ZONE_GEOMETRY; - e_illume_border_indicator_pos_get(bd->zone, NULL, &iy); + e_illume_client_indicator_pos_get(ec->zone, NULL, &iy); - ny = bd->zone->y; + ny = ec->zone->y; nh = iy; - app = e_illume_border_at_xy_get(bd->zone, bd->zone->x, bd->zone->y); - if ((app) && (bd != app)) + app = e_illume_client_at_xy_get(ec->zone, ec->zone->x, ec->zone->y); + if ((app) && (ec != app)) { ny = (iy + cz->indicator.size); - nh = ((bd->zone->y + bd->zone->h) - ny - cz->softkey.size); + nh = ((ec->zone->y + ec->zone->h) - ny - cz->softkey.size); } - _border_geometry_set(bd, x, ny, w, nh, POL_APP_LAYER); + _border_geometry_set(ec, x, ny, w, nh, POL_APP_LAYER); } static void -_policy_zone_layout_app_dual_left(E_Border *bd, E_Illume_Config_Zone *cz, Eina_Bool force) +_policy_zone_layout_app_dual_left(E_Client *ec, E_Illume_Config_Zone *cz, Eina_Bool force) { - E_Border *bd2; + E_Client *ec2; int ky, kh, nx, nw; - if (!_policy_layout_app_check(bd)) return; + if (!_policy_layout_app_check(ec)) return; ZONE_GEOMETRY; - e_illume_keyboard_safe_app_region_get(bd->zone, NULL, &ky, NULL, &kh); + e_illume_keyboard_safe_app_region_get(ec->zone, NULL, &ky, NULL, &kh); - if (kh >= bd->zone->h) + if (kh >= ec->zone->h) kh = (kh - cz->indicator.size - cz->softkey.size); else kh = (kh - cz->indicator.size); @@ -600,46 +575,46 @@ _policy_zone_layout_app_dual_left(E_Border *bd, E_Illume_Config_Zone *cz, Eina_B if (!force) { /* see if there is a border already there. if so, place at right */ - bd2 = e_illume_border_at_xy_get(bd->zone, nx, y); - if ((bd2) && (bd != bd2)) nx = x + nw; + ec2 = e_illume_client_at_xy_get(ec->zone, nx, y); + if ((ec2) && (ec != ec2)) nx = x + nw; } - _border_geometry_set(bd, nx, y, nw, kh, POL_APP_LAYER); + _border_geometry_set(ec, nx, y, nw, kh, POL_APP_LAYER); } static void -_policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_dialog(E_Client *ec, E_Illume_Config_Zone *cz) { - E_Border *parent; + E_Client *parent; int mw, mh, nx, ny; - /* if (!_policy_layout_app_check(bd)) return; */ - if ((!bd) || (!cz)) return; - printf("place dialog %d - %dx%d\n", bd->placed, bd->w, bd->h); + /* if (!_policy_layout_app_check(ec)) return; */ + if ((!ec) || (!cz)) return; + printf("place dialog %d - %dx%d\n", ec->placed, ec->w, ec->h); - if (bd->placed) + if (ec->placed) return; ZONE_GEOMETRY; - mw = bd->w; - mh = bd->h; + mw = ec->w; + mh = ec->h; - if (e_illume_border_is_fixed_size(bd)) + if (e_illume_client_is_fixed_size(ec)) { if (mw > w) mw = w; if (mh > h) mh = h; } else { - if (w * 2/3 > bd->w) + if (w * 2/3 > ec->w) mw = w * 2/3; - if (h * 2/3 > bd->h) + if (h * 2/3 > ec->h) mh = h * 2/3; } - parent = e_illume_border_parent_get(bd); + parent = e_illume_client_parent_get(ec); if ((!parent) || (cz->mode.dual == 1)) { @@ -655,27 +630,27 @@ _policy_zone_layout_dialog(E_Border *bd, E_Illume_Config_Zone *cz) ny = (parent->y + ((parent->h - mh) / 2)); } - bd->placed = 1; + ec->placed = 1; - _border_geometry_set(bd, nx, ny, mw, mh, POL_DIALOG_LAYER); + _border_geometry_set(ec, nx, ny, mw, mh, POL_DIALOG_LAYER); printf("set geom %d %d\n", mw, mh); } static void -_policy_zone_layout_splash(E_Border *bd, E_Illume_Config_Zone *cz) +_policy_zone_layout_splash(E_Client *ec, E_Illume_Config_Zone *cz) { - _policy_zone_layout_dialog(bd, cz); + _policy_zone_layout_dialog(ec, cz); - if (bd->layer != POL_SPLASH_LAYER) e_border_layer_set(bd, POL_SPLASH_LAYER); + if (ec->layer != POL_SPLASH_LAYER) evas_object_layer_set(ec->frame, POL_SPLASH_LAYER); } static void -_policy_zone_layout_conformant_single(E_Border *bd, E_Illume_Config_Zone *cz __UNUSED__) +_policy_zone_layout_conformant_single(E_Client *ec, E_Illume_Config_Zone *cz __UNUSED__) { - if (!_policy_layout_app_check(bd)) return; + if (!_policy_layout_app_check(ec)) return; - _border_geometry_set(bd, bd->zone->x, bd->zone->y, - bd->zone->w, bd->zone->h, + _border_geometry_set(ec, ec->zone->x, ec->zone->y, + ec->zone->w, ec->zone->h, POL_CONFORMANT_LAYER); } @@ -702,11 +677,11 @@ static Eina_List *desks = NULL; /* policy functions */ void -_policy_border_add(E_Border *bd) +_policy_border_add(E_Client *ec) { - // printf("Border added: %s\n", bd->client.icccm.class); + // printf("Border added: %s\n", ec->icccm.class); - if (!bd) return; + if (!ec) return; /* NB: this call sets an atom on the window that specifices the zone. * the logic here is that any new windows created can access the zone @@ -716,66 +691,66 @@ _policy_border_add(E_Border *bd) * that apply to their respective zone only. Example: softkey sends close * messages (or back messages to cycle focus) that should pertain just * to it's current zone */ - ecore_x_e_illume_zone_set(bd->client.win, bd->zone->black_win); + ecore_x_e_illume_zone_set(e_client_util_win_get(ec), ec->zone->black_win); - if (e_illume_border_is_keyboard(bd)) + if (e_illume_client_is_keyboard(ec)) { - bd->sticky = 1; - e_hints_window_sticky_set(bd, 1); + ec->sticky = 1; + e_hints_window_sticky_set(ec, 1); } - if (e_illume_border_is_home(bd)) + if (e_illume_client_is_home(ec)) { - bd->sticky = 1; - e_hints_window_sticky_set(bd, 1); + ec->sticky = 1; + e_hints_window_sticky_set(ec, 1); } - if (e_illume_border_is_indicator(bd)) + if (e_illume_client_is_indicator(ec)) { - bd->sticky = 1; - e_hints_window_sticky_set(bd, 1); + ec->sticky = 1; + e_hints_window_sticky_set(ec, 1); } - if (e_illume_border_is_softkey(bd)) + if (e_illume_client_is_softkey(ec)) { - bd->sticky = 1; - e_hints_window_sticky_set(bd, 1); + ec->sticky = 1; + e_hints_window_sticky_set(ec, 1); } /* ignore stolen borders. These are typically quickpanel or keyboards */ - if (bd->stolen) return; + if (ec->stolen) return; /* if this is a fullscreen window, than we need to hide indicator window */ - /* NB: we could use the e_illume_border_is_fullscreen function here + /* NB: we could use the e_illume_client_is_fullscreen function here * but we save ourselves a function call this way */ - if ((bd->fullscreen) || (bd->need_fullscreen)) + if ((ec->fullscreen) || (ec->need_fullscreen)) { - E_Border *ind, *sft; + E_Client *ind, *sft; - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { - if (ind->visible) e_illume_border_hide(ind); + if (ind->visible) e_illume_client_hide(ind); } - if ((sft = e_illume_border_softkey_get(bd->zone))) + if ((sft = e_illume_client_softkey_get(ec->zone))) { - if (e_illume_border_is_conformant(bd)) + if (e_illume_client_is_conformant(ec)) { if (sft->visible) - e_illume_border_hide(sft); + e_illume_client_hide(sft); else if (!sft->visible) - e_illume_border_show(sft); + e_illume_client_show(sft); } } } #if 0 - if (bd->client.icccm.class) + if (ec->icccm.class) { Eina_List *l; App_Desk *d; - EINA_LIST_FIND(desks, d, (d->class == bd->client.icccm.class)); + EINA_LIST_FIND(desks, d, (d->class == ec->icccm.class)); if (!d) { @@ -783,165 +758,165 @@ _policy_border_add(E_Border *bd) d->desk } - d->borders = eina_list_append(d->borders, bd); - e_border_desk_set(bd, d->desk); + d->borders = eina_list_append(d->borders, ec); + e_client_desk_set(ec, d->desk); } #endif /* Add this border to our focus stack if it can accept or take focus */ - if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus)) - _pol_focus_stack = eina_list_append(_pol_focus_stack, bd); + if ((ec->icccm.accepts_focus) || (ec->icccm.take_focus)) + _pol_focus_stack = eina_list_append(_pol_focus_stack, ec); - if ((e_illume_border_is_softkey(bd)) || (e_illume_border_is_indicator(bd))) - _policy_zone_layout_update(bd->zone); + if ((e_illume_client_is_softkey(ec)) || (e_illume_client_is_indicator(ec))) + _policy_zone_layout_update(ec->zone); else { /* set focus on new border if we can */ - _policy_border_set_focus(bd); + _policy_border_set_focus(ec); } } void -_policy_border_del(E_Border *bd) +_policy_border_del(E_Client *ec) { - // printf("Policy Border deleted: %s\n", bd->client.icccm.class); + // printf("Policy Border deleted: %s\n", ec->icccm.class); - if (!bd) return; + if (!ec) return; /* if this is a fullscreen window, than we need to show indicator window */ - /* NB: we could use the e_illume_border_is_fullscreen function here + /* NB: we could use the e_illume_client_is_fullscreen function here * but we save ourselves a function call this way */ - if ((bd->fullscreen) || (bd->need_fullscreen)) + if ((ec->fullscreen) || (ec->need_fullscreen)) { - E_Border *ind; + E_Client *ind; /* try to get the Indicator on this zone */ - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { - if (!ind->visible) e_illume_border_show(ind); + if (!ind->visible) e_illume_client_show(ind); } - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); } /* remove from focus stack */ - if ((bd->client.icccm.accepts_focus) || (bd->client.icccm.take_focus)) - _pol_focus_stack = eina_list_remove(_pol_focus_stack, bd); + if ((ec->icccm.accepts_focus) || (ec->icccm.take_focus)) + _pol_focus_stack = eina_list_remove(_pol_focus_stack, ec); - if (e_illume_border_is_softkey(bd)) + if (e_illume_client_is_softkey(ec)) { E_Illume_Config_Zone *cz; - cz = e_illume_zone_config_get(bd->zone->num); + cz = e_illume_zone_config_get(ec->zone->num); cz->softkey.size = 0; - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); } - else if (e_illume_border_is_indicator(bd)) + else if (e_illume_client_is_indicator(ec)) { E_Illume_Config_Zone *cz; - cz = e_illume_zone_config_get(bd->zone->num); + cz = e_illume_zone_config_get(ec->zone->num); cz->indicator.size = 0; - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); } /* else * { - * _policy_border_show_below(bd); + * _policy_border_show_below(ec); * } */ } void -_policy_border_focus_in(E_Border *bd __UNUSED__) +_policy_border_focus_in(E_Client *ec __UNUSED__) { - E_Border *ind; + E_Client *ind; - // printf("Border focus in: %s\n", bd->client.icccm.name); - if ((bd->fullscreen) || (bd->need_fullscreen)) + // printf("Border focus in: %s\n", ec->icccm.name); + if ((ec->fullscreen) || (ec->need_fullscreen)) { /* try to get the Indicator on this zone */ - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { /* we have the indicator, show it if needed */ - if (ind->visible) e_illume_border_hide(ind); + if (ind->visible) e_illume_client_hide(ind); } } else { /* try to get the Indicator on this zone */ - if ((ind = e_illume_border_indicator_get(bd->zone))) + if ((ind = e_illume_client_indicator_get(ec->zone))) { /* we have the indicator, show it if needed */ - if (!ind->visible) e_illume_border_show(ind); + if (!ind->visible) e_illume_client_show(ind); } } - _policy_zone_layout_update(bd->zone); + _policy_zone_layout_update(ec->zone); } void -_policy_border_focus_out(E_Border *bd) +_policy_border_focus_out(E_Client *ec) { - // printf("Border focus out: %s\n", bd->client.icccm.name); + // printf("Border focus out: %s\n", ec->icccm.name); - if (!bd) return; + if (!ec) return; /* NB: if we got this focus_out event on a deleted border, we check if * it is a transient (child) of another window. If it is, then we * transfer focus back to the parent window */ - if (e_object_is_del(E_OBJECT(bd))) + if (e_object_is_del(E_OBJECT(ec))) { - if (e_illume_border_is_dialog(bd)) + if (e_illume_client_is_dialog(ec)) { - E_Border *parent; + E_Client *parent; - if ((parent = e_illume_border_parent_get(bd))) + if ((parent = e_illume_client_parent_get(ec))) _policy_border_set_focus(parent); } } } void -_policy_border_activate(E_Border *bd) +_policy_border_activate(E_Client *ec) { - E_Border *sft; + E_Client *sft; - // printf("Border Activate: %s\n", bd->client.icccm.name); + // printf("Border Activate: %s\n", ec->icccm.name); - if (!bd) return; + if (!ec) return; /* NB: stolen borders may or may not need focus call...have to test */ - if (bd->stolen) return; + if (ec->stolen) return; /* conformant windows hide the softkey */ - if ((sft = e_illume_border_softkey_get(bd->zone))) + if ((sft = e_illume_client_softkey_get(ec->zone))) { - if (e_illume_border_is_conformant(bd)) + if (e_illume_client_is_conformant(ec)) { - if (sft->visible) e_illume_border_hide(sft); + if (sft->visible) e_illume_client_hide(sft); } else { - if (!sft->visible) e_illume_border_show(sft); + if (!sft->visible) e_illume_client_show(sft); } } /* NB: We cannot use our set_focus function here because it does, * occasionally fall through wrt E's focus policy, so cherry pick the good * parts and use here :) */ - if (bd->desk != e_desk_current_get(bd->zone)) - e_desk_show(bd->desk); + if (ec->desk != e_desk_current_get(ec->zone)) + e_desk_show(ec->desk); /* if the border is iconified then uniconify if allowed */ - if ((bd->iconic) && (!bd->lock_user_iconify)) - e_border_uniconify(bd); + if ((ec->iconic) && (!ec->lock_user_iconify)) + e_client_uniconify(ec); /* set very high layer for this window as it needs attention and thus * should show above everything */ - e_border_layer_set(bd, POL_ACTIVATE_LAYER); + evas_object_layer_set(ec->frame, POL_ACTIVATE_LAYER); /* if we can raise the border do it */ - if (!bd->lock_user_stacking) e_border_raise(bd); + if (!ec->lock_user_stacking) evas_object_raise(ec->frame); /* focus the border */ - e_border_focus_set(bd, 1, 1); + evas_object_focus_set(ec->frame, 1); /* NB: since we skip needless border evals when container layout * is called (to save cpu cycles), we need to @@ -951,32 +926,32 @@ _policy_border_activate(E_Border *bd) * This is potentially useless as THIS policy * makes all windows borderless anyway, but it's in here for * completeness - e_border_focus_latest_set(bd); - if (bd->bg_object) - 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"); - e_focus_event_focus_in(bd); + e_client_focus_latest_set(ec); + if (ec->bg_object) + edje_object_signal_emit(ec->bg_object, "e,state,focused", "e"); + if (ec->icon_object) + edje_object_signal_emit(ec->icon_object, "e,state,focused", "e"); + e_focus_event_focus_in(ec); */ } static Eina_Bool -_policy_border_is_dialog(E_Border *bd) +_policy_border_is_dialog(E_Client *ec) { - if (e_illume_border_is_dialog(bd)) + if (e_illume_client_is_dialog(ec)) return EINA_TRUE; - if (bd->client.e.state.centered) + if (ec->e.state.centered) return EINA_TRUE; - if (bd->internal) + if (ec->internal) { - if (bd->client.icccm.class) + if (ec->icccm.class) { - if (!strncmp(bd->client.icccm.class, "Illume", 6)) + if (!strncmp(ec->icccm.class, "Illume", 6)) return EINA_FALSE; - if (!strncmp(bd->client.icccm.class, "e_fwin", 6)) + if (!strncmp(ec->icccm.class, "e_fwin", 6)) return EINA_FALSE; - if (!strncmp(bd->client.icccm.class, "every", 5)) + if (!strncmp(ec->icccm.class, "every", 5)) return EINA_FALSE; } @@ -987,152 +962,153 @@ _policy_border_is_dialog(E_Border *bd) } void -_policy_border_post_fetch(E_Border *bd) +_policy_border_post_fetch(E_Client *ec) { - if (!bd) return; + if (!ec) return; /* NB: for this policy we disable all remembers set on a border */ - if (bd->remember) e_remember_del(bd->remember); - bd->remember = NULL; + if (ec->remember) e_remember_del(ec->remember); + ec->remember = NULL; - if (_policy_border_is_dialog(bd)) + if (_policy_border_is_dialog(ec)) { return; } - else if (e_illume_border_is_fixed_size(bd)) + else if (e_illume_client_is_fixed_size(ec)) { return; } - else if (!bd->borderless) + else if (!ec->borderless) { - bd->borderless = 1; - bd->client.border.changed = 1; + ec->borderless = 1; + ec->border.changed = 1; } } void -_policy_border_post_assign(E_Border *bd) +_policy_border_post_assign(E_Client *ec) { - if (!bd) return; + if (!ec) return; - bd->internal_no_remember = 1; + ec->internal_no_remember = 1; - if (_policy_border_is_dialog(bd) || - e_illume_border_is_fixed_size(bd)) + if (_policy_border_is_dialog(ec) || + e_illume_client_is_fixed_size(ec)) return; /* do not allow client to change these properties */ - bd->lock_client_size = 1; - bd->lock_client_shade = 1; - bd->lock_client_maximize = 1; - bd->lock_client_location = 1; - bd->lock_client_stacking = 1; + ec->lock_client_size = 1; + ec->lock_client_shade = 1; + ec->lock_client_maximize = 1; + ec->lock_client_location = 1; + ec->lock_client_stacking = 1; /* do not allow the user to change these properties */ - /* bd->lock_user_location = 1; - * bd->lock_user_size = 1; - * bd->lock_user_shade = 1; */ + /* ec->lock_user_location = 1; + * ec->lock_user_size = 1; + * ec->lock_user_shade = 1; */ /* clear any centered states */ /* NB: this is mainly needed for E's main config dialog */ - bd->client.e.state.centered = 0; + ec->e.state.centered = 0; /* lock the border type so user/client cannot change */ - bd->lock_border = 1; + ec->lock_border = 1; /* disable e's placement (and honoring of icccm.request_pos) */ - bd->placed = 1; + ec->placed = 1; } void -_policy_border_show(E_Border *bd) +_policy_border_show(E_Client *ec) { - if (!bd) return; + if (!ec) return; - /* printf("_policy_border_show %s\n", e_border_name_get(bd)); */ + /* printf("_policy_border_show %s\n", e_client_name_get(ec)); */ - if (!bd->client.icccm.name) return; + if (!ec->icccm.name) return; - // printf("Border Show: %s\n", bd->client.icccm.class); + // printf("Border Show: %s\n", ec->icccm.class); /* trap for special windows so we can ignore hides below them */ - if (e_illume_border_is_indicator(bd)) return; - if (e_illume_border_is_softkey(bd)) return; - if (e_illume_border_is_quickpanel(bd)) return; - if (e_illume_border_is_keyboard(bd)) return; + if (e_illume_client_is_indicator(ec)) return; + if (e_illume_client_is_softkey(ec)) return; + if (e_illume_client_is_quickpanel(ec)) return; + if (e_illume_client_is_keyboard(ec)) return; - _policy_border_hide_below(bd); + _policy_border_hide_below(ec); } -/* called on E_BORDER_HOOK_CONTAINER_LAYOUT (after e_border/eval0) */ +/* called on E_CLIENT_HOOK_CONTAINER_LAYOUT (after e_border/eval0) */ void _policy_zone_layout(E_Zone *zone) { E_Illume_Config_Zone *cz; Eina_List *l; - E_Border *bd; + E_Client *ec; if (!zone) return; cz = e_illume_zone_config_get(zone->num); - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { - if (e_object_is_del(E_OBJECT(bd))) continue; + if (e_client_util_ignored_get(ec)) continue; + if (e_object_is_del(E_OBJECT(ec))) continue; - if (bd->zone != zone) continue; + if (ec->zone != zone) continue; - if ((!bd->new_client) && (!bd->changes.pos) && (!bd->changes.size) && - (!bd->changes.visible) && (!bd->pending_move_resize) && - (!bd->need_shape_export) && (!bd->need_shape_merge)) continue; + if ((!ec->new_client) && (!ec->changes.pos) && (!ec->changes.size) && + (!ec->changes.visible) && + (!ec->need_shape_export) && (!ec->need_shape_merge)) continue; - if (e_illume_border_is_indicator(bd)) - _policy_zone_layout_indicator(bd, cz); + if (e_illume_client_is_indicator(ec)) + _policy_zone_layout_indicator(ec, cz); - else if (e_illume_border_is_quickpanel(bd)) - _policy_zone_layout_quickpanel(bd); + else if (e_illume_client_is_quickpanel(ec)) + _policy_zone_layout_quickpanel(ec); - else if (e_illume_border_is_softkey(bd)) - _policy_zone_layout_softkey(bd, cz); + else if (e_illume_client_is_softkey(ec)) + _policy_zone_layout_softkey(ec, cz); - else if (e_illume_border_is_keyboard(bd)) - _policy_zone_layout_keyboard(bd, cz); + else if (e_illume_client_is_keyboard(ec)) + _policy_zone_layout_keyboard(ec, cz); - else if (e_illume_border_is_home(bd)) - _policy_zone_layout_home_single(bd, cz); + else if (e_illume_client_is_home(ec)) + _policy_zone_layout_home_single(ec, cz); - else if ((bd->fullscreen) || (bd->need_fullscreen)) - _policy_zone_layout_fullscreen(bd); + else if ((ec->fullscreen) || (ec->need_fullscreen)) + _policy_zone_layout_fullscreen(ec); - else if (e_illume_border_is_splash(bd)) - _policy_zone_layout_splash(bd, cz); + else if (e_illume_client_is_splash(ec)) + _policy_zone_layout_splash(ec, cz); - else if (_policy_border_is_dialog(bd)) - _policy_zone_layout_dialog(bd, cz); + else if (_policy_border_is_dialog(ec)) + _policy_zone_layout_dialog(ec, cz); - else if (e_illume_border_is_conformant(bd)) - _policy_zone_layout_conformant_single(bd, cz); + else if (e_illume_client_is_conformant(ec)) + _policy_zone_layout_conformant_single(ec, cz); - else if (e_illume_border_is_fixed_size(bd)) - _policy_zone_layout_dialog(bd, cz); + else if (e_illume_client_is_fixed_size(ec)) + _policy_zone_layout_dialog(ec, cz); - else if (bd->internal && bd->client.icccm.class && - (!strcmp(bd->client.icccm.class, "everything-window"))) + else if (ec->internal && ec->icccm.class && + (!strcmp(ec->icccm.class, "everything-window"))) { - if (bd->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ON) - _policy_zone_layout_app_single(bd, cz); + if (ec->vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ON) + _policy_zone_layout_app_single(ec, cz); /* else - * _policy_zone_layout_app_dual_left(bd, cz, EINA_TRUE); */ - if (bd->layer != POL_ACTIVATE_LAYER) - e_border_layer_set(bd, POL_ACTIVATE_LAYER); + * _policy_zone_layout_app_dual_left(ec, cz, EINA_TRUE); */ + if (ec->layer != POL_ACTIVATE_LAYER) + evas_object_layer_set(ec->frame, POL_ACTIVATE_LAYER); - /* if (bd->layer != POL_SPLASH_LAYER) - * e_border_layer_set(bd, POL_SPLASH_LAYER); */ + /* if (ec->layer != POL_SPLASH_LAYER) + * evas_object_layer_set(ec->frame, POL_SPLASH_LAYER); */ } - else if (bd->client.e.state.centered) - _policy_zone_layout_dialog(bd, cz); + else if (ec->e.state.centered) + _policy_zone_layout_dialog(ec, cz); else if (!cz->mode.dual) - _policy_zone_layout_app_single(bd, cz); + _policy_zone_layout_app_single(ec, cz); else { if (cz->mode.side == 0) @@ -1141,14 +1117,14 @@ _policy_zone_layout(E_Zone *zone) /* grab the indicator position so we can tell if it * is in a custom position or not (user dragged it) */ - e_illume_border_indicator_pos_get(bd->zone, NULL, &ty); - if (ty <= bd->zone->y) - _policy_zone_layout_app_dual_top(bd, cz); + e_illume_client_indicator_pos_get(ec->zone, NULL, &ty); + if (ty <= ec->zone->y) + _policy_zone_layout_app_dual_top(ec, cz); else - _policy_zone_layout_app_dual_custom(bd, cz); + _policy_zone_layout_app_dual_custom(ec, cz); } else - _policy_zone_layout_app_dual_left(bd, cz, EINA_FALSE); + _policy_zone_layout_app_dual_left(ec, cz, EINA_FALSE); } } } @@ -1157,16 +1133,17 @@ void _policy_zone_move_resize(E_Zone *zone) { Eina_List *l; - E_Border *bd; + E_Client *ec; if (!zone) return; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) + EINA_LIST_FOREACH(zone->comp->clients, l, ec) { - if (bd->zone != zone) continue; + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; - bd->changes.pos = 1; - BD_CHANGED(bd); + ec->changes.pos = 1; + EC_CHANGED(ec); } } @@ -1175,7 +1152,7 @@ _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode) { E_Illume_Config_Zone *cz; /* Eina_List *homes = NULL; */ - E_Border *bd; + E_Client *ec; /* int count; */ if (!zone) return; @@ -1195,25 +1172,25 @@ _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode) e_config_save_queue(); /* lock indicator window from dragging if we need to */ - bd = e_illume_border_indicator_get(zone); - if (bd) + ec = e_illume_client_indicator_get(zone); + if (ec) { /* only dual-top mode can drag */ if ((cz->mode.dual == 1) && (cz->mode.side == 0)) { /* only set locked if we need to */ - if (bd->client.illume.drag.locked != 0) - ecore_x_e_illume_drag_locked_set(bd->client.win, 0); + if (ec->illume.drag.locked != 0) + ecore_x_e_illume_drag_locked_set(e_client_util_win_get(ec), 0); } else { /* only set locked if we need to */ - if (bd->client.illume.drag.locked != 1) - ecore_x_e_illume_drag_locked_set(bd->client.win, 1); + if (ec->illume.drag.locked != 1) + ecore_x_e_illume_drag_locked_set(e_client_util_win_get(ec), 1); } } #if 0 /* split home window? wtf?! go home! */ - if (!(homes = e_illume_border_home_borders_get(zone))) return; + if (!(homes = e_illume_client_home_borders_get(zone))) return; count = eina_list_count(homes); @@ -1228,11 +1205,11 @@ _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode) /* if we went to single mode, delete any extra home windows */ if (count >= 2) { - E_Border *home; + E_Client *home; /* try to get a home window on this zone and remove it */ - if ((home = e_illume_border_home_get(zone))) - ecore_x_e_illume_home_del_send(home->client.win); + if ((home = e_illume_client_home_get(zone))) + ecore_x_e_illume_home_del_send(e_client_util_win_get(home)); } } #endif @@ -1243,70 +1220,70 @@ _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode) void _policy_zone_close(E_Zone *zone) { - E_Border *bd; + E_Client *ec; if (!zone) return; - if (!(bd = e_border_focused_get())) return; + if (!(ec = e_client_focused_get())) return; - if (bd->zone != zone) return; + if (ec->zone != zone) return; /* close this border */ - e_border_act_close_begin(bd); + e_client_act_close_begin(ec); } void -_policy_drag_start(E_Border *bd) +_policy_drag_start(E_Client *ec) { - if (!bd) return; + if (!ec) return; - if (bd->stolen) return; + if (ec->stolen) return; - ecore_x_e_illume_drag_set(bd->client.win, 1); - ecore_x_e_illume_drag_set(bd->zone->black_win, 1); + ecore_x_e_illume_drag_set(e_client_util_win_get(ec), 1); + ecore_x_e_illume_drag_set(ec->zone->black_win, 1); } void -_policy_drag_end(E_Border *bd) +_policy_drag_end(E_Client *ec) { // printf("Drag end\n"); - if (!bd) return; + if (!ec) return; - if (bd->stolen) return; + if (ec->stolen) return; /* set property on this border to say we are done dragging */ - ecore_x_e_illume_drag_set(bd->client.win, 0); + ecore_x_e_illume_drag_set(e_client_util_win_get(ec), 0); /* set property on zone window that a drag is finished */ - ecore_x_e_illume_drag_set(bd->zone->black_win, 0); + ecore_x_e_illume_drag_set(ec->zone->black_win, 0); } void _policy_focus_back(E_Zone *zone) { Eina_List *l, *fl = NULL; - E_Border *bd, *fbd; + E_Client *ec, *fbd; if (!zone) return; if (eina_list_count(_pol_focus_stack) < 1) return; // printf("Focus back\n"); - EINA_LIST_REVERSE_FOREACH(_pol_focus_stack, l, bd) + EINA_LIST_REVERSE_FOREACH(_pol_focus_stack, l, ec) { - if (bd->zone != zone) continue; - fl = eina_list_append(fl, bd); + if (ec->zone != zone) continue; + fl = eina_list_append(fl, ec); } - if (!(fbd = e_border_focused_get())) return; + if (!(fbd = e_client_focused_get())) return; if (fbd->parent) return; - EINA_LIST_REVERSE_FOREACH(fl, l, bd) + EINA_LIST_REVERSE_FOREACH(fl, l, ec) { - if ((fbd) && (bd == fbd)) + if ((fbd) && (ec == fbd)) { - E_Border *b; + E_Client *b; if ((l->next) && (b = l->next->data)) { @@ -1331,27 +1308,27 @@ void _policy_focus_forward(E_Zone *zone) { Eina_List *l, *fl = NULL; - E_Border *bd, *fbd; + E_Client *ec, *fbd; if (!zone) return; if (eina_list_count(_pol_focus_stack) < 1) return; // printf("Focus forward\n"); - EINA_LIST_FOREACH(_pol_focus_stack, l, bd) + EINA_LIST_FOREACH(_pol_focus_stack, l, ec) { - if (bd->zone != zone) continue; - fl = eina_list_append(fl, bd); + if (ec->zone != zone) continue; + fl = eina_list_append(fl, ec); } - if (!(fbd = e_border_focused_get())) return; + if (!(fbd = e_client_focused_get())) return; if (fbd->parent) return; - EINA_LIST_FOREACH(fl, l, bd) + EINA_LIST_FOREACH(fl, l, ec) { - if ((fbd) && (bd == fbd)) + if ((fbd) && (ec == fbd)) { - E_Border *b; + E_Client *b; if ((l->next) && (b = l->next->data)) { @@ -1375,11 +1352,11 @@ _policy_focus_forward(E_Zone *zone) void _policy_focus_home(E_Zone *zone) { - E_Border *bd; + E_Client *ec; if (!zone) return; - if (!(bd = e_illume_border_home_get(zone))) return; - _policy_border_set_focus(bd); + if (!(ec = e_illume_client_home_get(zone))) return; + _policy_border_set_focus(ec); } void @@ -1387,43 +1364,43 @@ _policy_property_change(Ecore_X_Event_Window_Property *event) { if (event->atom == ECORE_X_ATOM_NET_WM_STATE) { - E_Border *bd, *ind; + E_Client *ec, *ind; - if (!(bd = e_border_find_by_client_window(event->win))) return; + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, event->win))) return; /* not interested in stolen or invisible borders */ - if ((bd->stolen) || (!bd->visible)) return; + if ((ec->stolen) || (!ec->visible)) return; /* make sure the border has a name or class */ /* NB: this check is here because some E borders get State Changes * but do not have a name/class associated with them. Not entirely sure * which ones they are, but I would guess Managers, Containers, or Zones. * At any rate, we're not interested in those types of borders */ - if ((!bd->client.icccm.name) || (!bd->client.icccm.class)) return; + if ((!ec->icccm.name) || (!ec->icccm.class)) return; /* NB: If we have reached this point, then it should be a fullscreen * border that has toggled fullscreen on/off */ /* try to get the Indicator on this zone */ - if (!(ind = e_illume_border_indicator_get(bd->zone))) return; + if (!(ind = e_illume_client_indicator_get(ec->zone))) return; /* if we are fullscreen, hide the indicator...else we show it */ - /* NB: we could use the e_illume_border_is_fullscreen function here + /* NB: we could use the e_illume_client_is_fullscreen function here * but we save ourselves a function call this way */ - if ((bd->fullscreen) || (bd->need_fullscreen)) + if ((ec->fullscreen) || (ec->need_fullscreen)) { if (ind->visible) { - e_illume_border_hide(ind); - _policy_zone_layout_update(bd->zone); + e_illume_client_hide(ind); + _policy_zone_layout_update(ec->zone); } } else { if (!ind->visible) { - e_illume_border_show(ind); - _policy_zone_layout_update(bd->zone); + e_illume_client_show(ind); + _policy_zone_layout_update(ec->zone); } } } @@ -1431,52 +1408,54 @@ _policy_property_change(Ecore_X_Event_Window_Property *event) { Eina_List *l; E_Zone *zone; - E_Border *bd; + E_Client *ec; int x, y, w, h; if (!(zone = e_util_zone_window_find(event->win))) return; - if (!(bd = e_illume_border_indicator_get(zone))) return; - x = bd->x; - y = bd->y; - w = bd->w; - h = bd->h; + if (!(ec = e_illume_client_indicator_get(zone))) return; + x = ec->x; + y = ec->y; + w = ec->w; + h = ec->h; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) - { - if (bd->zone != zone) continue; - if (!e_illume_border_is_conformant(bd)) continue; + EINA_LIST_FOREACH(zone->comp->clients, l, ec) + { + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (!e_illume_client_is_conformant(ec)) continue; /* set indicator geometry on conformant window */ /* NB: This is needed so that conformant apps get told about * the indicator size/position...else they have no way of * knowing that the geometry has been updated */ - ecore_x_e_illume_indicator_geometry_set(bd->client.win, x, y, w, h); + ecore_x_e_illume_indicator_geometry_set(e_client_util_win_get(ec), x, y, w, h); } } else if (event->atom == ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY) { Eina_List *l; E_Zone *zone; - E_Border *bd; + E_Client *ec; int x, y, w, h; if (!(zone = e_util_zone_window_find(event->win))) return; - if (!(bd = e_illume_border_softkey_get(zone))) return; - x = bd->x; - y = bd->y; - w = bd->w; - h = bd->h; + if (!(ec = e_illume_client_softkey_get(zone))) return; + x = ec->x; + y = ec->y; + w = ec->w; + h = ec->h; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) - { - if (bd->zone != zone) continue; - if (!e_illume_border_is_conformant(bd)) continue; + EINA_LIST_FOREACH(zone->comp->clients, l, ec) + { + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (!e_illume_client_is_conformant(ec)) continue; /* set softkey geometry on conformant window */ /* NB: This is needed so that conformant apps get told about * the softkey size/position...else they have no way of * knowing that the geometry has been updated */ - ecore_x_e_illume_softkey_geometry_set(bd->client.win, x, y, w, h); + ecore_x_e_illume_softkey_geometry_set(e_client_util_win_get(ec), x, y, w, h); } } else if (event->atom == ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY) @@ -1484,55 +1463,53 @@ _policy_property_change(Ecore_X_Event_Window_Property *event) Eina_List *l; E_Zone *zone; E_Illume_Keyboard *kbd; - E_Border *bd; + E_Client *ec; int x, y, w, h; if (!(zone = e_util_zone_window_find(event->win))) return; if (!(kbd = e_illume_keyboard_get())) return; - if (!kbd->border) return; + if (!kbd->client) return; - x = kbd->border->x; - w = kbd->border->w; - h = kbd->border->h; + x = kbd->client->x; + w = kbd->client->w; + h = kbd->client->h; /* adjust Y for keyboard visibility because keyboard uses fx_offset */ y = 0; - if (kbd->border->cw && - (!e_util_strcmp(edje_object_part_state_get(kbd->border->cw->effect_obj, "mover", NULL), "custom"))) - y = kbd->border->y; +#warning this is totally broken on so many levels + //if (kbd->client->frame && + //(!e_util_strcmp(edje_object_part_state_get(kbd->client->cw->effect_obj, "mover", NULL), "custom"))) + //y = kbd->client->y; /* look for conformant borders */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) - { - if (bd->zone != zone) continue; - if (!e_illume_border_is_conformant(bd)) continue; + EINA_LIST_FOREACH(zone->comp->clients, l, ec) + { + if (e_client_util_ignored_get(ec)) continue; + if (ec->zone != zone) continue; + if (!e_illume_client_is_conformant(ec)) continue; /* set keyboard geometry on conformant window */ /* NB: This is needed so that conformant apps get told about * the keyboard size/position...else they have no way of * knowing that the geometry has been updated */ - ecore_x_e_illume_keyboard_geometry_set(bd->client.win, x, y, w, h); + ecore_x_e_illume_keyboard_geometry_set(e_client_util_win_get(ec), x, y, w, h); } } else if (event->atom == ATM_ENLIGHTENMENT_SCALE) { - Eina_List *ml; - E_Manager *man; + const Eina_List *l; + E_Comp *comp; - EINA_LIST_FOREACH(e_manager_list(), ml, man) - { - Eina_List *cl; - E_Container *con; + + EINA_LIST_FOREACH(e_comp_list(), l, comp) + { + Eina_List *zl; + E_Zone *zone; - if (event->win != man->root) continue; - EINA_LIST_FOREACH(man->containers, cl, con) - { - Eina_List *zl; - E_Zone *zone; + if (event->win != comp->man->root) continue; - EINA_LIST_FOREACH(con->zones, zl, zone) - _policy_zone_layout_update(zone); - } - } + EINA_LIST_FOREACH(comp->zones, zl, zone) + _policy_zone_layout_update(zone); + } } } diff --git a/src/modules/illume2/policies/tablet/policy.h b/src/modules/illume2/policies/tablet/policy.h index 39af6afb0..cabe4b502 100644 --- a/src/modules/illume2/policies/tablet/policy.h +++ b/src/modules/illume2/policies/tablet/policy.h @@ -14,21 +14,21 @@ # define POL_APP_LAYER 100 # define POL_HOME_LAYER 90 -void _policy_border_add(E_Border *bd); -void _policy_border_del(E_Border *bd); -void _policy_border_focus_in(E_Border *bd); -void _policy_border_focus_out(E_Border *bd); -void _policy_border_activate(E_Border *bd); -void _policy_border_post_fetch(E_Border *bd); -void _policy_border_post_assign(E_Border *bd); -void _policy_border_show(E_Border *bd); -void _policy_border_hide(E_Border *bd); +void _policy_border_add(E_Client *ec); +void _policy_border_del(E_Client *ec); +void _policy_border_focus_in(E_Client *ec); +void _policy_border_focus_out(E_Client *ec); +void _policy_border_activate(E_Client *ec); +void _policy_border_post_fetch(E_Client *ec); +void _policy_border_post_assign(E_Client *ec); +void _policy_border_show(E_Client *ec); +void _policy_border_hide(E_Client *ec); void _policy_zone_layout(E_Zone *zone); void _policy_zone_move_resize(E_Zone *zone); void _policy_zone_mode_change(E_Zone *zone, Ecore_X_Atom mode); void _policy_zone_close(E_Zone *zone); -void _policy_drag_start(E_Border *bd); -void _policy_drag_end(E_Border *bd); +void _policy_drag_start(E_Client *ec); +void _policy_drag_end(E_Client *ec); void _policy_focus_back(E_Zone *zone); void _policy_focus_forward(E_Zone *zone); void _policy_focus_home(E_Zone *zone); diff --git a/src/modules/layout/e_mod_main.c b/src/modules/layout/e_mod_main.c index d5320a28a..7dfe00229 100644 --- a/src/modules/layout/e_mod_main.c +++ b/src/modules/layout/e_mod_main.c @@ -15,10 +15,10 @@ /* actual module specifics */ static E_Module *layout_module = NULL; -static E_Border_Hook *hook = NULL; +static E_Client_Hook *hook = NULL; static void -_e_module_layout_cb_hook(void *data, E_Border *bd) +_e_module_layout_cb_hook(void *data, E_Client *ec) { /* FIXME: make some modification based on policy */ printf("Window:\n" @@ -26,33 +26,33 @@ _e_module_layout_cb_hook(void *data, E_Border *bd) " Class: %s::%s\n" " Geometry: %ix%i+%i+%i\n" " New: %i\n" - , bd->client.icccm.title, bd->client.netwm.name - , bd->client.icccm.name, bd->client.icccm.class + , bd->icccm.title, bd->netwm.name + , bd->icccm.name, bd->icccm.class , bd->x, bd->y, bd->w, bd->h , bd->new_client ); - if ((bd->client.icccm.transient_for != 0) || - (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)) + if ((bd->icccm.transient_for != 0) || + (bd->netwm.type == ECORE_X_WINDOW_TYPE_DIALOG)) { bd->client.e.state.centered = 1; } else { - e_border_unmaximize(bd, E_MAXIMIZE_BOTH); - e_border_resize(bd, 1, 1); - e_border_center(bd); + e_client_unmaximize(bd, E_MAXIMIZE_BOTH); + e_client_resize(bd, 1, 1); + e_client_center(bd); if (bd->bordername) eina_stringshare_del(bd->bordername); bd->bordername = eina_stringshare_add("borderless"); - bd->client.icccm.base_w = 1; - bd->client.icccm.base_h = 1; - 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.min_aspect = 0.0; - bd->client.icccm.max_aspect = 0.0; + bd->icccm.base_w = 1; + bd->icccm.base_h = 1; + bd->icccm.min_w = 1; + bd->icccm.min_h = 1; + bd->icccm.max_w = 32767; + bd->icccm.max_h = 32767; + bd->icccm.min_aspect = 0.0; + bd->icccm.max_aspect = 0.0; } - e_border_maximize(bd, E_MAXIMIZE_FILL | E_MAXIMIZE_BOTH); + e_client_maximize(bd, E_MAXIMIZE_FILL | E_MAXIMIZE_BOTH); } /**/ @@ -78,7 +78,7 @@ e_modapi_init(E_Module *m) { layout_module = m; - hook = e_border_hook_add(E_BORDER_HOOK_EVAL_POST_FETCH, + hook = e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_FETCH, _e_module_layout_cb_hook, NULL); return m; } @@ -88,7 +88,7 @@ e_modapi_shutdown(E_Module *m) { if (hook) { - e_border_hook_del(hook); + e_client_hook_del(hook); hook = NULL; } layout_module = NULL; diff --git a/src/modules/mixer/app_mixer.c b/src/modules/mixer/app_mixer.c index dd4f8cea9..05f09c330 100644 --- a/src/modules/mixer/app_mixer.c +++ b/src/modules/mixer/app_mixer.c @@ -473,12 +473,12 @@ _cb_dialog_dismiss(void *data, E_Dialog *dialog) } E_Dialog * -e_mixer_app_dialog_new(E_Container *con, void (*func)(E_Dialog *dialog, void *data), void *data) +e_mixer_app_dialog_new(E_Comp *comp, void (*func)(E_Dialog *dialog, void *data), void *data) { E_Mixer_App_Dialog_Data *app; E_Dialog *dialog; - dialog = e_dialog_new(con, _e_mixer_Name, "e_mixer_app_dialog"); + dialog = e_dialog_new(comp, _e_mixer_Name, "e_mixer_app_dialog"); if (!dialog) return NULL; diff --git a/src/modules/mixer/conf_gadget.c b/src/modules/mixer/conf_gadget.c index 0a53c8c2b..28ef0c43a 100644 --- a/src/modules/mixer/conf_gadget.c +++ b/src/modules/mixer/conf_gadget.c @@ -367,7 +367,7 @@ e_mixer_config_pulse_toggle(void) } E_Config_Dialog * -e_mixer_config_dialog_new(E_Container *con, E_Mixer_Gadget_Config *conf) +e_mixer_config_dialog_new(E_Comp *comp, E_Mixer_Gadget_Config *conf) { E_Config_Dialog *dialog; E_Config_Dialog_View *view; @@ -384,7 +384,7 @@ e_mixer_config_dialog_new(E_Container *con, E_Mixer_Gadget_Config *conf) view->basic.create_widgets = _basic_create; view->basic.apply_cfdata = _basic_apply; - dialog = e_config_dialog_new(con, _("Mixer Settings"), + dialog = e_config_dialog_new(comp, _("Mixer Settings"), _e_mixer_Name, "e_mixer_config_dialog_new", e_mixer_theme_path(), 0, view, conf); diff --git a/src/modules/mixer/conf_module.c b/src/modules/mixer/conf_module.c index 9915e2e89..8c44b372c 100644 --- a/src/modules/mixer/conf_module.c +++ b/src/modules/mixer/conf_module.c @@ -138,7 +138,6 @@ static void cb_mixer_call(void *data, void *data2 __UNUSED__) { E_Mixer_Module_Context *ctxt = data; - E_Container *con; if (ctxt->mixer_dialog) { @@ -146,8 +145,7 @@ cb_mixer_call(void *data, void *data2 __UNUSED__) return; } - con = e_container_current_get(e_manager_current_get()); - ctxt->mixer_dialog = e_mixer_app_dialog_new(con, cb_mixer_app_del, ctxt); + ctxt->mixer_dialog = e_mixer_app_dialog_new(NULL, cb_mixer_app_del, ctxt); } static void @@ -173,7 +171,7 @@ _basic_create(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data *cfdata) } E_Config_Dialog * -e_mixer_config_module_dialog_new(E_Container *con, E_Mixer_Module_Context *ctxt) +e_mixer_config_module_dialog_new(E_Comp *comp, E_Mixer_Module_Context *ctxt) { E_Config_Dialog *dialog; E_Config_Dialog_View *view; @@ -190,7 +188,7 @@ e_mixer_config_module_dialog_new(E_Container *con, E_Mixer_Module_Context *ctxt) view->basic.create_widgets = _basic_create; view->basic.apply_cfdata = _basic_apply; - dialog = e_config_dialog_new(con, _("Mixer Module Settings"), + dialog = e_config_dialog_new(comp, _("Mixer Module Settings"), _e_mixer_Name, "extensions/mixer", e_mixer_theme_path(), 0, view, ctxt); diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c index 48699585f..40bb351b0 100644 --- a/src/modules/mixer/e_mod_main.c +++ b/src/modules/mixer/e_mod_main.c @@ -367,7 +367,7 @@ _mixer_popup_cb_mute_change(void *data, Evas_Object *obj, void *event __UNUSED__ static Evas_Object * _mixer_popup_add_slider(E_Mixer_Instance *inst, int value, void (*cb)(void *data, Evas_Object *obj, void *event_info)) { - Evas_Object *slider = e_slider_add(inst->popup->win->evas); + Evas_Object *slider = e_slider_add(e_comp_get(inst->popup)->evas); evas_object_show(slider); e_slider_orientation_set(slider, 0); e_slider_value_set(slider, value); @@ -451,17 +451,14 @@ _mixer_popup_key_down_cb(void *data, Ecore_Event_Key *ev) static void _mixer_popup_del(E_Mixer_Instance *inst) { - e_object_del(E_OBJECT(inst->popup)); inst->ui.label = NULL; inst->ui.left = NULL; inst->ui.right = NULL; inst->ui.mute = NULL; inst->ui.table = NULL; inst->ui.button = NULL; - inst->popup = NULL; - if (inst->popup_timer) - ecore_timer_del(inst->popup_timer); - inst->popup_timer = NULL; + E_FREE_FUNC(inst->popup, e_object_del); + E_FREE_FUNC(inst->popup_timer, ecore_timer_del); } static void @@ -470,6 +467,14 @@ _mixer_popup_del_cb(void *obj) _mixer_popup_del(e_object_data_get(obj)); } +static void +_mixer_popup_comp_del_cb(void *data, Evas_Object *obj EINA_UNUSED) +{ + E_Mixer_Instance *inst = data; + + E_FREE_FUNC(inst->popup, e_object_del); +} + static void _mixer_app_select_current(E_Dialog *dialog, E_Mixer_Instance *inst) { @@ -483,7 +488,6 @@ _mixer_popup_cb_mixer(void *data, void *data2 __UNUSED__) { E_Mixer_Instance *inst = data; E_Mixer_Module_Context *ctxt; - E_Container *con; _mixer_popup_del(inst); @@ -496,8 +500,7 @@ _mixer_popup_cb_mixer(void *data, void *data2 __UNUSED__) return; } - con = e_container_current_get(e_manager_current_get()); - ctxt->mixer_dialog = e_mixer_app_dialog_new(con, _mixer_app_cb_del, ctxt); + ctxt->mixer_dialog = e_mixer_app_dialog_new(NULL, _mixer_app_cb_del, ctxt); _mixer_app_select_current(ctxt->mixer_dialog, inst); } @@ -524,8 +527,8 @@ _mixer_popup_new(E_Mixer_Instance *inst) else colspan = 2; - inst->popup = e_gadcon_popup_new(inst->gcc); - evas = inst->popup->win->evas; + inst->popup = e_gadcon_popup_new(inst->gcc, 0); + evas = e_comp_get(inst->gcc)->evas; inst->ui.table = e_widget_table_add(evas, 0); @@ -587,7 +590,8 @@ _mixer_popup_new(E_Mixer_Instance *inst) e_widget_size_min_set(inst->ui.table, mw, mh); e_gadcon_popup_content_set(inst->popup, inst->ui.table); - e_popup_autoclose(inst->popup->win, NULL, _mixer_popup_key_down_cb, inst); + e_comp_object_util_autoclose(inst->popup->comp_object, + _mixer_popup_comp_del_cb, _mixer_popup_key_down_cb, inst); e_gadcon_popup_show(inst->popup); e_object_data_set(E_OBJECT(inst->popup), inst); E_OBJECT_DEL_SET(inst->popup, _mixer_popup_del_cb); @@ -628,12 +632,10 @@ static void _mixer_menu_cb_cfg(void *data, E_Menu *menu __UNUSED__, E_Menu_Item *mi __UNUSED__) { E_Mixer_Instance *inst = data; - E_Container *con; if (inst->popup) _mixer_popup_del(inst); - con = e_container_current_get(e_manager_current_get()); - inst->conf->dialog = e_mixer_config_dialog_new(con, inst->conf); + inst->conf->dialog = e_mixer_config_dialog_new(NULL, inst->conf); } static void @@ -1146,7 +1148,7 @@ _mixer_cb_volume_mute(E_Object *obj __UNUSED__, const char *params __UNUSED__) } static E_Config_Dialog * -_mixer_module_config(E_Container *con, const char *params __UNUSED__) +_mixer_module_config(E_Comp *comp, const char *params __UNUSED__) { E_Mixer_Module_Context *ctxt; @@ -1167,7 +1169,7 @@ _mixer_module_config(E_Container *con, const char *params __UNUSED__) return NULL; } - ctxt->conf_dialog = e_mixer_config_module_dialog_new(con, ctxt); + ctxt->conf_dialog = e_mixer_config_module_dialog_new(comp, ctxt); return ctxt->conf_dialog; } diff --git a/src/modules/mixer/e_mod_main.h b/src/modules/mixer/e_mod_main.h index d92633caa..063bf6665 100644 --- a/src/modules/mixer/e_mod_main.h +++ b/src/modules/mixer/e_mod_main.h @@ -85,9 +85,9 @@ EAPI void *e_modapi_init(E_Module *m); EAPI int e_modapi_shutdown(E_Module *m); EAPI int e_modapi_save(E_Module *m); -E_Config_Dialog *e_mixer_config_module_dialog_new(E_Container *con, E_Mixer_Module_Context *ctxt); -E_Config_Dialog *e_mixer_config_dialog_new(E_Container *con, E_Mixer_Gadget_Config *conf); -E_Dialog *e_mixer_app_dialog_new(E_Container *con, void (*func)(E_Dialog *dialog, void *data), void *data); +E_Config_Dialog *e_mixer_config_module_dialog_new(E_Comp *comp, E_Mixer_Module_Context *ctxt); +E_Config_Dialog *e_mixer_config_dialog_new(E_Comp *comp, E_Mixer_Gadget_Config *conf); +E_Dialog *e_mixer_app_dialog_new(E_Comp *comp, void (*func)(E_Dialog *dialog, void *data), void *data); int e_mixer_app_dialog_select(E_Dialog *dialog, const char *card_name, const char *channel_name); int e_mixer_update(E_Mixer_Instance *inst); diff --git a/src/modules/msgbus/msgbus_desktop.c b/src/modules/msgbus/msgbus_desktop.c index 34999dac8..7d3d36316 100644 --- a/src/modules/msgbus/msgbus_desktop.c +++ b/src/modules/msgbus/msgbus_desktop.c @@ -100,20 +100,20 @@ static Eldbus_Message * cb_desktop_bgadd(const Eldbus_Service_Interface *iface __UNUSED__, const Eldbus_Message *msg) { - int container, zone, desk_x, desk_y; + int manager, zone, desk_x, desk_y; const char *path; Eldbus_Message *reply = eldbus_message_method_return_new(msg); - if (!eldbus_message_arguments_get(msg, "iiiis", &container, &zone, &desk_x, + if (!eldbus_message_arguments_get(msg, "iiiis", &manager, &zone, &desk_x, &desk_y, &path)) { ERR("could not get Add arguments"); return reply; } - DBG("add bg container=%d, zone=%d, pos=%d,%d path=%s", - container, zone, desk_x, desk_y, path); - e_bg_add(container, zone, desk_x, desk_y, path); + DBG("add bg manager=%d, zone=%d, pos=%d,%d path=%s", + manager, zone, desk_x, desk_y, path); + e_bg_add(manager, zone, desk_x, desk_y, path); e_bg_update(); e_config_save_queue(); @@ -124,19 +124,19 @@ static Eldbus_Message * cb_desktop_bgdel(const Eldbus_Service_Interface *iface __UNUSED__, const Eldbus_Message *msg) { - int container, zone, desk_x, desk_y; + int manager, zone, desk_x, desk_y; Eldbus_Message *reply = eldbus_message_method_return_new(msg); - if (!eldbus_message_arguments_get(msg, "iiii", &container, &zone, &desk_x, + if (!eldbus_message_arguments_get(msg, "iiii", &manager, &zone, &desk_x, &desk_y)) { ERR("could not get Del arguments"); return reply; } - DBG("del bg container=%d, zone=%d, pos=%d,%d", - container, zone, desk_x, desk_y); - e_bg_del(container, zone, desk_x, desk_y); + DBG("del bg manager=%d, zone=%d, pos=%d,%d", + manager, zone, desk_x, desk_y); + e_bg_del(manager, zone, desk_x, desk_y); e_bg_update(); e_config_save_queue(); @@ -170,11 +170,11 @@ cb_desktop_bglist(const Eldbus_Service_Interface *iface __UNUSED__, { continue; } - DBG("Background container=%d zone=%d pos=%d,%d path=%s", - bg->container, bg->zone, bg->desk_x, bg->desk_y, bg->file); + DBG("Background manager=%d zone=%d pos=%d,%d path=%s", + bg->manager, bg->zone, bg->desk_x, bg->desk_y, bg->file); eldbus_message_iter_arguments_append(array, "(iiiis)", &s); if (!s) continue; - eldbus_message_iter_arguments_append(s, "iiiis", bg->container, bg->zone, + eldbus_message_iter_arguments_append(s, "iiiis", bg->manager, bg->zone, bg->desk_x, bg->desk_y, bg->file); eldbus_message_iter_container_close(array, s); } @@ -197,9 +197,9 @@ static const Eldbus_Method desktop_methods[] = { static const Eldbus_Method background_methods[] = { { "Add", - ELDBUS_ARGS({"i", "container"}, {"i", "zone"}, {"i", "desk_x"}, {"i", "desk_y"}, {"s", "path"}), + ELDBUS_ARGS({"i", "manager"}, {"i", "zone"}, {"i", "desk_x"}, {"i", "desk_y"}, {"s", "path"}), NULL, cb_desktop_bgadd }, - { "Del", ELDBUS_ARGS({"i", "container"}, {"i", "zone"}, {"i", "desk_x"}, {"i", "desk_y"}), + { "Del", ELDBUS_ARGS({"i", "manager"}, {"i", "zone"}, {"i", "desk_x"}, {"i", "desk_y"}), NULL, cb_desktop_bgdel }, { "List", ELDBUS_ARGS({"a(iiiis)", "array_of_bg"}), NULL, cb_desktop_bglist }, { } diff --git a/src/modules/music-control/ui.c b/src/modules/music-control/ui.c index 00bf2a76e..38dc84a6c 100644 --- a/src/modules/music-control/ui.c +++ b/src/modules/music-control/ui.c @@ -50,7 +50,7 @@ _metadata_update(E_Music_Control_Instance *inst) img = edje_object_part_swallow_get(inst->content_popup, "cover_swallow"); if (img) { - e_popup_object_remove(inst->popup->win, img); + e_comp_object_util_del_list_remove(inst->popup->comp_object, img); evas_object_del(img); } if (inst->ctxt->meta_cover) @@ -58,7 +58,7 @@ _metadata_update(E_Music_Control_Instance *inst) img = evas_object_image_filled_add(evas_object_evas_get(inst->content_popup)); evas_object_image_file_set(img, inst->ctxt->meta_cover, NULL); edje_object_part_swallow(inst->content_popup, "cover_swallow", img); - e_popup_object_add(inst->popup->win, img); + e_comp_object_util_del_list_append(inst->popup->comp_object, img); } } @@ -110,9 +110,9 @@ static void _popup_new(E_Music_Control_Instance *inst) { Evas_Object *o; - inst->popup = e_gadcon_popup_new(inst->gcc); + inst->popup = e_gadcon_popup_new(inst->gcc, 0); - o = edje_object_add(inst->popup->win->evas); + o = edje_object_add(e_comp_get(inst->gcc)->evas); e_theme_edje_object_set(o, "base/theme/modules/music-control", "modules/music-control/popup"); edje_object_signal_callback_add(o, "btn,clicked", "*", _btn_clicked, inst); @@ -124,7 +124,7 @@ _popup_new(E_Music_Control_Instance *inst) _player_name_update(inst); _play_state_update(inst, EINA_TRUE); _metadata_update(inst); - e_popup_autoclose(inst->popup->win, NULL, NULL, NULL); + e_comp_object_util_autoclose(inst->popup->comp_object, NULL, NULL, NULL); e_gadcon_popup_show(inst->popup); e_object_data_set(E_OBJECT(inst->popup), inst); E_OBJECT_DEL_SET(inst->popup, _popup_del_cb); @@ -237,7 +237,7 @@ _cb_menu_cfg(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__) v->basic.apply_cfdata = _cfg_data_apply; v->basic.check_changed = _cfg_check_changed; - e_config_dialog_new(m->zone->container, _("Music control Settings"), "E", + e_config_dialog_new(m->zone->comp, _("Music control Settings"), "E", "_e_mod_music_config_dialog", NULL, 0, v, data); } diff --git a/src/modules/notification/e_mod_config.c b/src/modules/notification/e_mod_config.c index 97c05306e..7270cb1e0 100644 --- a/src/modules/notification/e_mod_config.c +++ b/src/modules/notification/e_mod_config.c @@ -29,7 +29,7 @@ static void _force_timeout_changed(void *data, Evas_Object *obj __UNUSED__); E_Config_Dialog * -e_int_config_notification_module(E_Container *con, +e_int_config_notification_module(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd = NULL; @@ -48,7 +48,7 @@ e_int_config_notification_module(E_Container *con, v->basic.check_changed = _basic_check_changed; snprintf(buf, sizeof(buf), "%s/e-module-notification.edj", notification_mod->dir); - cfd = e_config_dialog_new(con, _("Notification Settings"), "Notification", + cfd = e_config_dialog_new(comp, _("Notification Settings"), "Notification", "extensions/notification", buf, 0, v, NULL); notification_cfg->cfd = cfd; return cfd; diff --git a/src/modules/notification/e_mod_main.h b/src/modules/notification/e_mod_main.h index fe06ef3c6..c25c37bd2 100644 --- a/src/modules/notification/e_mod_main.h +++ b/src/modules/notification/e_mod_main.h @@ -60,7 +60,7 @@ struct _Popup_Data { unsigned id; E_Notification_Notify *notif; - E_Popup *win; + Evas_Object *win; Eina_List *mirrors; Evas *e; Evas_Object *theme; @@ -82,7 +82,7 @@ EAPI int e_modapi_save(E_Module *m); void _gc_orient (E_Gadcon_Client *gcc, E_Gadcon_Orient orient); -E_Config_Dialog *e_int_config_notification_module(E_Container *con, const char *params); +E_Config_Dialog *e_int_config_notification_module(E_Comp *comp, const char *params); extern E_Module *notification_mod; extern Config *notification_cfg; diff --git a/src/modules/notification/e_mod_popup.c b/src/modules/notification/e_mod_popup.c index b78edd2d5..f22f3b2e7 100644 --- a/src/modules/notification/e_mod_popup.c +++ b/src/modules/notification/e_mod_popup.c @@ -74,11 +74,7 @@ notification_popup_notify(E_Notification_Notify *n, edje_object_signal_emit(popup->theme, "notification,new", "notification"); } - if (popup->timer) - { - ecore_timer_del(popup->timer); - popup->timer = NULL; - } + E_FREE_FUNC(popup->timer, ecore_timer_del); if (n->timeout < 0 || notification_cfg->force_timeout) n->timeout = notification_cfg->timeout; @@ -129,31 +125,37 @@ _notification_theme_cb_find(Popup_Data *popup, const char *emission __UNUSED__, const char *source __UNUSED__) { - Eina_List *l; - E_Border *bd; + const Eina_List *l, *ll; + E_Client *ec; + E_Comp *comp; if (!popup->app_name) return; - EINA_LIST_FOREACH(e_border_client_list(), l, bd) - { - size_t len, test; + EINA_LIST_FOREACH(e_comp_list(), l, comp) + EINA_LIST_FOREACH(comp->clients, ll, ec) + { + size_t len, test; + const char *name; - len = strlen(popup->app_name); - test = eina_strlen_bounded(bd->client.icccm.name, len + 1); + if (e_client_util_ignored_get(ec)) continue; + len = strlen(popup->app_name); + name = e_client_name_get(ec); + if (!name) continue; + test = eina_strlen_bounded(name, len + 1); - /* We can't be sure that the app_name really match the application name. - * Some plugin put their name instead. But this search gives some good - * results. - */ - if (strncasecmp(bd->client.icccm.name, popup->app_name, (test < len) ? test : len)) - continue; + /* We can't be sure that the app_name really match the application name. + * Some plugin put their name instead. But this search gives some good + * results. + */ + if (strncasecmp(name, popup->app_name, (test < len) ? test : len)) + continue; - e_desk_show(bd->desk); - e_border_show(bd); - e_border_raise(bd); - e_border_focus_set_with_pointer(bd); - break; - } + e_desk_show(ec->desk); + evas_object_show(ec->frame); + evas_object_raise(ec->frame); + e_client_focus_set_with_pointer(ec); + break; + } } static void @@ -179,9 +181,9 @@ _notification_popup_place_coords_get(int zw, int zh, int ow, int oh, int pos, in } static void -_notification_popup_del_cb(void *obj) +_notification_popup_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - Popup_Data *popup = e_object_data_get(obj); + Popup_Data *popup = data; popup->win = NULL; } @@ -189,20 +191,18 @@ _notification_popup_del_cb(void *obj) static Popup_Data * _notification_popup_new(E_Notification_Notify *n, unsigned id) { - E_Container *con; + E_Comp *comp; Popup_Data *popup; char buf[PATH_MAX]; Eina_List *l; int pos = next_pos; - E_Manager *man; E_Zone *zone = NULL; switch (notification_cfg->dual_screen) { case POPUP_DISPLAY_POLICY_FIRST: - man = eina_list_data_get(e_manager_list()); - con = eina_list_data_get(man->containers); - zone = eina_list_data_get(con->zones); + comp = e_comp_get(NULL); + zone = eina_list_data_get(comp->zones); break; case POPUP_DISPLAY_POLICY_CURRENT: case POPUP_DISPLAY_POLICY_ALL: @@ -211,9 +211,9 @@ _notification_popup_new(E_Notification_Notify *n, unsigned id) case POPUP_DISPLAY_POLICY_MULTI: if ((notification_cfg->corner == CORNER_BR) || (notification_cfg->corner == CORNER_TR)) - zone = eina_list_last_data_get(e_util_container_current_get()->zones); + zone = eina_list_last_data_get(e_util_comp_current_get()->zones); else - zone = eina_list_data_get(e_util_container_current_get()->zones); + zone = eina_list_data_get(e_util_comp_current_get()->zones); break; } @@ -225,18 +225,13 @@ _notification_popup_new(E_Notification_Notify *n, unsigned id) EINA_SAFETY_ON_NULL_RETURN_VAL(popup, NULL); popup->notif = n; popup->id = id; - /* Create the popup window */ - popup->win = e_popup_new(zone, 0, 0, 0, 0); - E_OBJECT_DEL_SET(popup->win, _notification_popup_del_cb); - e_object_data_set(E_OBJECT(popup->win), popup); - e_popup_name_set(popup->win, "_e_popup_notification"); - popup->e = popup->win->evas; + popup->e = e_comp_get(zone)->evas; /* Setup the theme */ snprintf(buf, sizeof(buf), "%s/e-module-notification.edj", notification_mod->dir); popup->theme = edje_object_add(popup->e); - evas_object_name_set(popup->theme, "notification"); + evas_object_name_set(popup->theme, "noshadow_notification"); if (!e_theme_edje_object_set(popup->theme, "base/theme/modules/notification", @@ -246,9 +241,11 @@ _notification_popup_new(E_Notification_Notify *n, unsigned id) "modules/notification/main")) edje_object_file_set(popup->theme, buf, "modules/notification/main"); - e_popup_content_set(popup->win, popup->theme); + /* Create the popup window */ + popup->win = e_comp_object_util_add(popup->theme, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(popup->win, E_LAYER_POPUP); + evas_object_event_callback_add(popup->win, EVAS_CALLBACK_DEL, _notification_popup_del_cb, popup); - evas_object_show(popup->theme); edje_object_signal_callback_add (popup->theme, "notification,deleted", "theme", (Edje_Signal_Cb)_notification_theme_cb_deleted, popup); @@ -261,20 +258,22 @@ _notification_popup_new(E_Notification_Notify *n, unsigned id) _notification_popup_refresh(popup); next_pos = _notification_popup_place(popup, next_pos); - e_popup_show(popup->win); + evas_object_show(popup->win); if (notification_cfg->dual_screen == POPUP_DISPLAY_POLICY_ALL) { - EINA_LIST_FOREACH(popup->win->zone->container->zones, l, zone) + EINA_LIST_FOREACH(e_comp_evas_find(evas_object_evas_get(popup->win))->zones, l, zone) { Evas_Object *o; - int x, y; + int x, y, w, h; - if (zone == popup->win->zone) continue; - o = e_comp_win_image_mirror_add(popup->win->cw); + if (zone == e_comp_object_util_zone_get(popup->win)) continue; + o = e_comp_object_util_mirror_add(popup->win); evas_object_name_set(o, "notification_mirror"); evas_object_data_set(o, "zone", zone); - evas_object_resize(o, popup->win->w, popup->win->h); - _notification_popup_place_coords_get(zone->w, zone->h, popup->win->w, popup->win->h, pos, &x, &y); + evas_object_geometry_get(popup->win, NULL, NULL, &w, &h); + evas_object_resize(o, w, h); + evas_object_layer_set(o, E_LAYER_POPUP); + _notification_popup_place_coords_get(zone->w, zone->h, w, h, pos, &x, &y); evas_object_move(o, zone->x + x, zone->y + y); evas_object_show(o); popup->mirrors = eina_list_append(popup->mirrors, o); @@ -286,23 +285,25 @@ _notification_popup_new(E_Notification_Notify *n, unsigned id) } static int -_notification_popup_place(Popup_Data *popup, - int pos) +_notification_popup_place(Popup_Data *popup, int pos) { - int x, y; + int x, y, w, h; Eina_List *l; Evas_Object *o; + E_Zone *zone; if (!popup->win) return pos; - _notification_popup_place_coords_get(popup->win->zone->w, popup->win->zone->h, popup->win->w, popup->win->h, pos, &x, &y); - e_popup_move(popup->win, x, y); + evas_object_geometry_get(popup->win, NULL, NULL, &w, &h); + zone = e_comp_object_util_zone_get(popup->win); + _notification_popup_place_coords_get(zone->w, zone->h, w, h, pos, &x, &y); + evas_object_move(popup->win, x, y); EINA_LIST_FOREACH(popup->mirrors, l, o) { - E_Zone *zone = evas_object_data_get(o, "zone"); - _notification_popup_place_coords_get(zone->w, zone->h, popup->win->w, popup->win->h, pos, &x, &y); + zone = evas_object_data_get(o, "zone"); + _notification_popup_place_coords_get(zone->w, zone->h, w, h, pos, &x, &y); evas_object_move(o, zone->x + x, zone->y + y); } - return pos + popup->win->h + 10; + return pos + h + 10; } static void @@ -311,6 +312,7 @@ _notification_popup_refresh(Popup_Data *popup) const char *icon_path; const char *app_icon_max; int w, h, width = 80, height = 80; + E_Zone *zone; if (!popup) return; @@ -318,9 +320,8 @@ _notification_popup_refresh(Popup_Data *popup) if (popup->app_icon) { - e_popup_object_remove(popup->win, popup->app_icon); - evas_object_del(popup->app_icon); - popup->app_icon = NULL; + e_comp_object_util_del_list_remove(popup->win, popup->app_icon); + E_FREE_FUNC(popup->app_icon, evas_object_del); } app_icon_max = edje_object_data_get(popup->theme, "app_icon_max"); @@ -420,7 +421,7 @@ _notification_popup_refresh(Popup_Data *popup) h = height; } - e_popup_object_add(popup->win, popup->app_icon); + e_comp_object_util_del_list_append(popup->win, popup->app_icon); if ((w > width) || (h > height)) { int v; @@ -441,9 +442,10 @@ _notification_popup_refresh(Popup_Data *popup) /* Compute the new size of the popup */ edje_object_calc_force(popup->theme); edje_object_size_min_calc(popup->theme, &w, &h); - w = MIN(w, popup->win->zone->w / 2); - h = MIN(h, popup->win->zone->h / 2); - e_popup_resize(popup->win, w, h); + zone = e_comp_object_util_zone_get(popup->win); + w = MIN(w, zone->w / 2); + h = MIN(h, zone->h / 2); + evas_object_resize(popup->win, w, h); } static Popup_Data * @@ -505,7 +507,11 @@ _notification_popdown(Popup_Data *popup, { E_FREE_FUNC(popup->timer, ecore_timer_del); popup->mirrors = eina_list_free(popup->mirrors); - if (popup->win) e_object_del(E_OBJECT(popup->win)); + if (popup->win) + { + evas_object_hide(popup->win); + evas_object_del(popup->win); + } if (popup->notif) { e_notification_notify_close(popup->notif, reason); diff --git a/src/modules/pager/e_mod_config.c b/src/modules/pager/e_mod_config.c index 8c974d8d2..895c02af1 100644 --- a/src/modules/pager/e_mod_config.c +++ b/src/modules/pager/e_mod_config.c @@ -55,7 +55,7 @@ _config_pager_module(Config_Item *ci) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; - E_Container *con; + E_Comp *comp; char buff[PATH_MAX]; v = E_NEW(E_Config_Dialog_View, 1); @@ -72,8 +72,8 @@ _config_pager_module(Config_Item *ci) snprintf(buff, sizeof(buff), "%s/e-module-pager.edj", pager_config->module->dir); - con = e_container_current_get(e_manager_current_get()); - cfd = e_config_dialog_new(con, _("Pager Settings"), "E", + comp = e_comp_get(NULL); + cfd = e_config_dialog_new(comp, _("Pager Settings"), "E", "_e_mod_pager_config_dialog", buff, 0, v, ci); pager_config->config_dialog = cfd; } diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index f69b11e75..616ebe840 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -73,7 +73,7 @@ struct _Pager_Desk struct _Pager_Win { - E_Border *border; + E_Client *client; Pager_Desk *desk; Evas_Object *o_window; Evas_Object *o_icon; @@ -90,7 +90,7 @@ struct _Pager_Win struct _Pager_Popup { - E_Popup *popup; + Evas_Object *popup; Pager *pager; Evas_Object *o_bg; Ecore_Timer *timer; @@ -104,25 +104,25 @@ static void _pager_inst_cb_menu_configure(void *data __UNUSED__, E_M static void _pager_inst_cb_menu_virtual_desktops_dialog(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__); static void _pager_instance_drop_zone_recalc(Instance *inst); static Eina_Bool _pager_cb_event_bg_update(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_resize(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_move(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_iconify(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_stick(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_unstick(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_desk_set(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_stack(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_icon_change(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_border_property(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_resize(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_move(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_add(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_remove(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_iconify(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_stick(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_unstick(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_desk_set(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_stack(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_icon_change(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_urgent_change(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_client_property(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _pager_cb_event_zone_desk_count_set(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _pager_cb_event_desk_show(void *data __UNUSED__, int type __UNUSED__, void *event); static Eina_Bool _pager_cb_event_desk_name_change(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _pager_cb_event_container_resize(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _pager_cb_event_compositor_resize(void *data __UNUSED__, int type __UNUSED__, void *event); static void _pager_window_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); static void _pager_window_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); static void _pager_window_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); @@ -150,15 +150,15 @@ static Pager_Desk *_pager_desk_at_coord(Pager *p, Evas_Coord x, Evas_Coord static void _pager_desk_select(Pager_Desk *pd); static Pager_Desk *_pager_desk_find(Pager *p, E_Desk *desk); static void _pager_desk_switch(Pager_Desk *pd1, Pager_Desk *pd2); -static Pager_Win *_pager_window_new(Pager_Desk *pd, E_Border *border); +static Pager_Win *_pager_window_new(Pager_Desk *pd, E_Client *client); static void _pager_window_free(Pager_Win *pw); static void _pager_window_move(Pager_Win *pw); -static Pager_Win *_pager_window_find(Pager *p, E_Border *border); -static Pager_Win *_pager_desk_window_find(Pager_Desk *pd, E_Border *border); +static Pager_Win *_pager_window_find(Pager *p, E_Client *client); +static Pager_Win *_pager_desk_window_find(Pager_Desk *pd, E_Client *client); static Pager_Popup *_pager_popup_new(E_Zone *zone, int keyaction); static void _pager_popup_free(Pager_Popup *pp); static Pager_Popup *_pager_popup_find(E_Zone *zone); -static E_Config_Dialog *_pager_config_dialog(E_Container *con, const char *params); +static E_Config_Dialog *_pager_config_dialog(E_Comp *comp, const char *params); /* functions for pager popup on key actions */ static int _pager_popup_show(void); @@ -401,7 +401,7 @@ _pager_desk_livethumb_setup(Pager_Desk *pd) o = e_livethumb_thumb_get(pd->o_bg); if (!o) o = edje_object_add(e_livethumb_evas_get(pd->o_bg)); - bgfile = e_bg_file_get(pd->desk->zone->container->num, pd->desk->zone->num, pd->desk->x, pd->desk->y); + bgfile = e_bg_file_get(pd->desk->zone->comp->num, pd->desk->zone->num, pd->desk->x, pd->desk->y); edje_object_file_set(o, bgfile, "e/desktop/background"); e_livethumb_thumb_set(pd->o_bg, o); eina_stringshare_del(bgfile); @@ -412,8 +412,7 @@ _pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos, Eina_Bool invert) { Pager_Desk *pd; Evas_Object *o, *evo; - E_Border_List *bl; - E_Border *bd; + E_Client *ec; int w, h; Evas *e; @@ -472,18 +471,17 @@ _pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos, Eina_Bool invert) edje_object_part_swallow(pd->o_desk, "e.swallow.content", pd->o_layout); evas_object_show(o); - bl = e_container_border_list_first(desk->zone->container); - while ((bd = e_container_border_list_next(bl))) + E_CLIENT_FOREACH(desk->zone->comp, ec) { Pager_Win *pw; - if ((bd->new_client) || (bd->zone != desk->zone) || - ((bd->desk != desk) && (!bd->sticky))) + if (e_client_util_ignored_get(ec)) continue; + if ((ec->new_client) || (ec->zone != desk->zone) || + ((ec->desk != desk) && (!ec->sticky))) continue; - pw = _pager_window_new(pd, bd); + pw = _pager_window_new(pd, ec); if (pw) pd->wins = eina_list_append(pd->wins, pw); } - e_container_border_list_free(bl); return pd; } @@ -564,13 +562,15 @@ _pager_desk_switch(Pager_Desk *pd1, Pager_Desk *pd2) /* Move opened windows from on desk to the other */ EINA_LIST_FOREACH(pd1->wins, l, pw) { - if ((!pw) || (!pw->border) || (pw->border->iconic)) continue; - e_border_desk_set(pw->border, desk2); + if ((!pw) || (!pw->client) || (pw->client->iconic)) continue; + pw->client->hidden = 0; + e_client_desk_set(pw->client, desk2); } EINA_LIST_FOREACH(pd2->wins, l, pw) { - if ((!pw) || (!pw->border) || (pw->border->iconic)) continue; - e_border_desk_set(pw->border, desk1); + if ((!pw) || (!pw->client) || (pw->client->iconic)) continue; + pw->client->hidden = 0; + e_client_desk_set(pw->client, desk1); } /* Modify desktop names in the config */ @@ -644,21 +644,21 @@ _pager_desk_switch(Pager_Desk *pd1, Pager_Desk *pd2) } static Pager_Win * -_pager_window_new(Pager_Desk *pd, E_Border *border) +_pager_window_new(Pager_Desk *pd, E_Client *client) { Pager_Win *pw; Evas_Object *o; int visible; - if (!border) return NULL; + if (!client) return NULL; pw = E_NEW(Pager_Win, 1); if (!pw) return NULL; - pw->border = border; - e_object_ref(E_OBJECT(border)); + pw->client = client; + e_object_ref(E_OBJECT(client)); - visible = ((!border->iconic) && (!border->client.netwm.state.skip_pager)); - pw->skip_winlist = border->client.netwm.state.skip_pager; + visible = ((!client->iconic) && (!client->netwm.state.skip_pager)); + pw->skip_winlist = client->netwm.state.skip_pager; pw->desk = pd; o = edje_object_add(evas_object_evas_get(pd->pager->o_table)); @@ -677,7 +677,7 @@ _pager_window_new(Pager_Desk *pd, E_Border *border) evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _pager_window_cb_mouse_move, pw); - o = e_border_icon_add(border, evas_object_evas_get(pd->pager->o_table)); + o = e_client_icon_add(client, evas_object_evas_get(pd->pager->o_table)); if (o) { pw->o_icon = o; @@ -685,9 +685,9 @@ _pager_window_new(Pager_Desk *pd, E_Border *border) edje_object_part_swallow(pw->o_window, "e.swallow.icon", o); } - if (border->client.icccm.urgent && !border->focused) + if (client->icccm.urgent && !client->focused) { - if (!(border->iconic)) + if (!(client->iconic)) edje_object_signal_emit(pd->o_desk, "e,state,urgent", "e"); edje_object_signal_emit(pw->o_window, "e,state,urgent", "e"); } @@ -705,7 +705,7 @@ _pager_window_free(Pager_Win *pw) pw->desk->pager->dragging = 0; if (pw->o_window) evas_object_del(pw->o_window); if (pw->o_icon) evas_object_del(pw->o_icon); - e_object_unref(E_OBJECT(pw->border)); + e_object_unref(E_OBJECT(pw->client)); free(pw); } @@ -713,13 +713,13 @@ static void _pager_window_move(Pager_Win *pw) { e_layout_child_move(pw->o_window, - pw->border->x - pw->border->zone->x, - pw->border->y - pw->border->zone->y); - e_layout_child_resize(pw->o_window, pw->border->w, pw->border->h); + pw->client->x - pw->client->zone->x, + pw->client->y - pw->client->zone->y); + e_layout_child_resize(pw->o_window, pw->client->w, pw->client->h); } static Pager_Win * -_pager_window_find(Pager *p, E_Border *border) +_pager_window_find(Pager *p, E_Client *client) { Eina_List *l; Pager_Desk *pd; @@ -728,28 +728,28 @@ _pager_window_find(Pager *p, E_Border *border) { Pager_Win *pw; - pw = _pager_desk_window_find(pd, border); + pw = _pager_desk_window_find(pd, client); if (pw) return pw; } return NULL; } static Pager_Win * -_pager_desk_window_find(Pager_Desk *pd, E_Border *border) +_pager_desk_window_find(Pager_Desk *pd, E_Client *client) { Eina_List *l; Pager_Win *pw; EINA_LIST_FOREACH(pd->wins, l, pw) - if (pw->border == border) return pw; + if (pw->client == client) return pw; return NULL; } static void -_pager_popup_cb_del(void *obj) +_pager_popup_cb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - Pager_Popup *pp = e_object_data_get(obj); + Pager_Popup *pp = data; E_FREE_FUNC(pp->timer, ecore_timer_del); _pager_free(pp->pager); free(pp); @@ -767,16 +767,7 @@ _pager_popup_new(E_Zone *zone, int keyaction) if (!pp) return NULL; /* Show popup */ - pp->popup = e_popup_new(zone, 0, 0, 1, 1); - e_popup_name_set(pp->popup, "pager_popup"); - e_popup_ignore_events_set(pp->popup, 1); - if (!pp->popup) - { - free(pp); - return NULL; - } - - pp->pager = _pager_new(pp->popup->evas, zone, NULL); + pp->pager = _pager_new(zone->comp->evas, zone, NULL); pp->pager->popup = pp; pp->urgent = 0; @@ -793,7 +784,8 @@ _pager_popup_new(E_Zone *zone, int keyaction) evas_object_move(pp->pager->o_table, 0, 0); evas_object_resize(pp->pager->o_table, width, height); - pp->o_bg = edje_object_add(pp->popup->evas); + pp->o_bg = edje_object_add(zone->comp->evas); + evas_object_name_set(pp->o_bg, "pager_popup"); e_theme_edje_object_set(pp->o_bg, "base/theme/modules/pager", "e/modules/pager/popup"); desk = e_desk_current_get(zone); @@ -805,17 +797,13 @@ _pager_popup_new(E_Zone *zone, int keyaction) edje_object_part_swallow(pp->o_bg, "e.swallow.content", pp->pager->o_table); edje_object_size_min_calc(pp->o_bg, &w, &h); - evas_object_move(pp->o_bg, 0, 0); - evas_object_resize(pp->o_bg, w, h); - e_popup_content_set(pp->popup, pp->o_bg); + pp->popup = e_comp_object_util_add(pp->o_bg, E_COMP_OBJECT_TYPE_POPUP); + evas_object_pass_events_set(pp->popup, 1); e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh); - zx -= zone->x; - zy -= zone->y; - e_popup_move_resize(pp->popup, - zx + ((zw - w) / 2), zy + ((zh - h) / 2), w, h); - e_object_free_attach_func_set(E_OBJECT(pp->popup), _pager_popup_cb_del); - e_object_data_set(E_OBJECT(pp->popup), pp); - e_popup_show(pp->popup); + evas_object_geometry_set(pp->popup, zx, zy, w, h); + e_comp_object_util_center(pp->popup); + evas_object_event_callback_add(pp->popup, EVAS_CALLBACK_DEL, _pager_popup_cb_del, pp); + evas_object_show(pp->popup); pp->timer = NULL; @@ -826,7 +814,8 @@ static void _pager_popup_free(Pager_Popup *pp) { E_FREE_FUNC(pp->timer, ecore_timer_del); - e_object_del(E_OBJECT(pp->popup)); + evas_object_hide(pp->popup); + evas_object_del(pp->popup); } static Pager_Popup * @@ -899,7 +888,7 @@ _pager_inst_cb_menu_configure(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Men } static E_Config_Dialog * -_pager_config_dialog(E_Container *con __UNUSED__, const char *params __UNUSED__) +_pager_config_dialog(E_Comp *comp __UNUSED__, const char *params __UNUSED__) { if (!pager_config) return NULL; if (pager_config->config_dialog) return NULL; @@ -915,7 +904,7 @@ _pager_inst_cb_menu_virtual_desktops_dialog(void *data, E_Menu *m __UNUSED__, E_ inst = data; e_configure_registry_call("screen/virtual_desktops", - inst->gcc->gadcon->zone->container, NULL); + inst->gcc->gadcon->zone->comp, NULL); } static void @@ -960,9 +949,9 @@ _pager_cb_config_updated(void) } static Eina_Bool -_pager_cb_event_border_resize(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_resize(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Resize *ev = event; + E_Event_Client *ev = event; Eina_List *l, *l2; Pager *p; @@ -970,12 +959,12 @@ _pager_cb_event_border_resize(void *data __UNUSED__, int type __UNUSED__, void * { Pager_Desk *pd; - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { Pager_Win *pw; - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) _pager_window_move(pw); } } @@ -983,9 +972,9 @@ _pager_cb_event_border_resize(void *data __UNUSED__, int type __UNUSED__, void * } static Eina_Bool -_pager_cb_event_border_move(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_move(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Move *ev = event; + E_Event_Client *ev = event; Eina_List *l; Pager_Win *pw; Pager_Desk *pd; @@ -995,19 +984,19 @@ _pager_cb_event_border_move(void *data __UNUSED__, int type __UNUSED__, void *ev { Eina_List *l2; - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) _pager_window_move(pw); } } - if ((act_popup) && (act_popup->pager->zone == ev->border->zone)) + if ((act_popup) && (act_popup->pager->zone == ev->ec->zone)) { EINA_LIST_FOREACH(act_popup->pager->desks, l, pd) { - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) _pager_window_move(pw); } } @@ -1016,9 +1005,9 @@ _pager_cb_event_border_move(void *data __UNUSED__, int type __UNUSED__, void *ev } static Eina_Bool -_pager_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_add(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Add *ev = event; + E_Event_Client *ev = event; Eina_List *l; Pager *p; @@ -1027,12 +1016,12 @@ _pager_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *eve Pager_Desk *pd; Pager_Win *pw; - if ((p->zone != ev->border->zone) || - (_pager_window_find(p, ev->border))) + if ((p->zone != ev->ec->zone) || + (_pager_window_find(p, ev->ec))) continue; - pd = _pager_desk_find(p, ev->border->desk); + pd = _pager_desk_find(p, ev->ec->desk); if (!pd) continue; - pw = _pager_window_new(pd, ev->border); + pw = _pager_window_new(pd, ev->ec); if (pw) pd->wins = eina_list_append(pd->wins, pw); } @@ -1040,9 +1029,9 @@ _pager_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *eve } static Eina_Bool -_pager_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_remove(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev = event; + E_Event_Client *ev = event; Eina_List *l; Pager *p; @@ -1051,13 +1040,13 @@ _pager_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void * Eina_List *l2; Pager_Desk *pd; - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { Pager_Win *pw; - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (!pw) continue; pd->wins = eina_list_remove(pd->wins, pw); _pager_window_free(pw); @@ -1067,9 +1056,9 @@ _pager_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void * } static Eina_Bool -_pager_cb_event_border_iconify(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_iconify(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Iconify *ev = event; + E_Event_Client *ev = event; Eina_List *l; Pager *p; @@ -1078,13 +1067,13 @@ _pager_cb_event_border_iconify(void *data __UNUSED__, int type __UNUSED__, void Eina_List *l2; Pager_Desk *pd; - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { Pager_Win *pw; - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (!pw) continue; if ((pw->drag.from_pager) && (pw->desk->pager->dragging)) pw->desk->pager->dragging = 0; @@ -1096,9 +1085,9 @@ _pager_cb_event_border_iconify(void *data __UNUSED__, int type __UNUSED__, void } static Eina_Bool -_pager_cb_event_border_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Uniconify *ev = event; + E_Event_Client *ev = event; Eina_List *l; Pager *p; @@ -1107,13 +1096,13 @@ _pager_cb_event_border_uniconify(void *data __UNUSED__, int type __UNUSED__, voi Eina_List *l2; Pager_Desk *pd; - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { Pager_Win *pw; - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if ((pw) && (!pw->skip_winlist)) evas_object_show(pw->o_window); } } @@ -1122,9 +1111,9 @@ _pager_cb_event_border_uniconify(void *data __UNUSED__, int type __UNUSED__, voi } static Eina_Bool -_pager_cb_event_border_stick(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_stick(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Stick *ev = event; + E_Event_Client *ev = event; Eina_List *l; Pager *p; @@ -1134,14 +1123,14 @@ _pager_cb_event_border_stick(void *data __UNUSED__, int type __UNUSED__, void *e Pager_Desk *pd; Pager_Win *pw; - if (p->zone != ev->border->zone) continue; - pw = _pager_window_find(p, ev->border); + if (p->zone != ev->ec->zone) continue; + pw = _pager_window_find(p, ev->ec); if (!pw) continue; EINA_LIST_FOREACH(p->desks, l2, pd) - if ((ev->border->desk != pd->desk) && (!_pager_desk_window_find(pd, ev->border))) + if ((ev->ec->desk != pd->desk) && (!_pager_desk_window_find(pd, ev->ec))) { - pw = _pager_window_new(pd, ev->border); + pw = _pager_window_new(pd, ev->ec); if (pw) pd->wins = eina_list_append(pd->wins, pw); } } @@ -1150,9 +1139,9 @@ _pager_cb_event_border_stick(void *data __UNUSED__, int type __UNUSED__, void *e } static Eina_Bool -_pager_cb_event_border_unstick(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_unstick(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Unstick *ev = event; + E_Event_Client *ev = event; Eina_List *l; Pager *p; @@ -1161,14 +1150,14 @@ _pager_cb_event_border_unstick(void *data __UNUSED__, int type __UNUSED__, void Pager_Desk *pd; Eina_List *l2; - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) - if (ev->border->desk != pd->desk) + if (ev->ec->desk != pd->desk) { Pager_Win *pw; - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { pd->wins = eina_list_remove(pd->wins, pw); @@ -1180,20 +1169,20 @@ _pager_cb_event_border_unstick(void *data __UNUSED__, int type __UNUSED__, void } static void -_pager_window_desk_change(Pager *pager, E_Border *bd) +_pager_window_desk_change(Pager *pager, E_Client *ec) { Eina_List *l; Pager_Win *pw; Pager_Desk *pd; - /* if this pager is not for the zone of the border */ - if (pager->zone != bd->zone) + /* if this pager is not for the zone of the client */ + if (pager->zone != ec->zone) { /* look at all desks in the pager */ EINA_LIST_FOREACH(pager->desks, l, pd) { - /* find this border in this desk */ - pw = _pager_desk_window_find(pd, bd); + /* find this client in this desk */ + pw = _pager_desk_window_find(pd, ec); if (!pw) continue; /* if it is found - remove it. it does not belong in this * pager as it probably moves zones */ @@ -1202,13 +1191,13 @@ _pager_window_desk_change(Pager *pager, E_Border *bd) } return; } - /* and this pager zone is for this border */ + /* and this pager zone is for this client */ /* see if the window is in this pager at all */ - pw = _pager_window_find(pager, bd); + pw = _pager_window_find(pager, ec); if (pw) { /* is it sticky */ - if (bd->sticky) + if (ec->sticky) { /* if its sticky and in this pager - its already everywhere, so abort * doing anything else */ @@ -1216,11 +1205,11 @@ _pager_window_desk_change(Pager *pager, E_Border *bd) } /* move it to the right desk */ /* find the pager desk of the target desk */ - pd = _pager_desk_find(pager, bd->desk); + pd = _pager_desk_find(pager, ec->desk); if (pd) { Pager_Win *pw2 = NULL; - E_Border *bd_above; + E_Client *ec_above; /* remove it from whatever desk it was on */ pw->desk->wins = eina_list_remove(pw->desk->wins, pw); @@ -1231,9 +1220,9 @@ _pager_window_desk_change(Pager *pager, E_Border *bd) pd->wins = eina_list_append(pd->wins, pw); e_layout_pack(pd->o_layout, pw->o_window); - bd_above = e_util_desk_border_above(pw->border); - if (bd_above) - pw2 = _pager_desk_window_find(pd, bd_above); + ec_above = e_util_desk_client_above(pw->client); + if (ec_above) + pw2 = _pager_desk_window_find(pd, ec_above); if (pw2) e_layout_child_lower_below(pw->o_window, pw2->o_window); else @@ -1242,26 +1231,26 @@ _pager_window_desk_change(Pager *pager, E_Border *bd) _pager_window_move(pw); } } - /* the border isn't in this pager at all - it must have moved zones */ + /* the client isn't in this pager at all - it must have moved zones */ else { - if (!bd->sticky) + if (!ec->sticky) { /* find the pager desk it needs to go to */ - pd = _pager_desk_find(pager, bd->desk); - if ((pd) && (!_pager_desk_window_find(pd, bd))) + pd = _pager_desk_find(pager, ec->desk); + if ((pd) && (!_pager_desk_window_find(pd, ec))) { /* create it and add it */ - pw = _pager_window_new(pd, bd); + pw = _pager_window_new(pd, ec); if (pw) { Pager_Win *pw2 = NULL; - E_Border *bd_above; + E_Client *ec_above; pd->wins = eina_list_append(pd->wins, pw); - bd_above = e_util_desk_border_above(pw->border); - if (bd_above) - pw2 = _pager_desk_window_find(pd, bd_above); + ec_above = e_util_desk_client_above(pw->client); + if (ec_above) + pw2 = _pager_desk_window_find(pd, ec_above); if (pw2) e_layout_child_lower_below(pw->o_window, pw2->o_window); else @@ -1276,17 +1265,17 @@ _pager_window_desk_change(Pager *pager, E_Border *bd) EINA_LIST_FOREACH(pager->desks, l, pd) { /* create it and add it */ - if (_pager_desk_window_find(pd, bd)) continue; - pw = _pager_window_new(pd, bd); + if (_pager_desk_window_find(pd, ec)) continue; + pw = _pager_window_new(pd, ec); if (pw) { Pager_Win *pw2 = NULL; - E_Border *bd_above; + E_Client *ec_above; pd->wins = eina_list_append(pd->wins, pw); - bd_above = e_util_desk_border_above(pw->border); - if (bd_above) - pw2 = _pager_desk_window_find(pd, bd_above); + ec_above = e_util_desk_client_above(pw->client); + if (ec_above) + pw2 = _pager_desk_window_find(pd, ec_above); if (pw2) e_layout_child_lower_below(pw->o_window, pw2->o_window); else @@ -1299,22 +1288,22 @@ _pager_window_desk_change(Pager *pager, E_Border *bd) } static Eina_Bool -_pager_cb_event_border_desk_set(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_desk_set(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Desk_Set *ev = event; + E_Event_Client_Desk_Set *ev = event; Eina_List *l; Pager *p; EINA_LIST_FOREACH(pagers, l, p) - _pager_window_desk_change(p, ev->border); + _pager_window_desk_change(p, ev->ec); return ECORE_CALLBACK_PASS_ON; } static Eina_Bool -_pager_cb_event_border_stack(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_stack(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Stack *ev = event; + E_Event_Client *ev = event; Eina_List *l; Pager *p; @@ -1323,25 +1312,25 @@ _pager_cb_event_border_stack(void *data __UNUSED__, int type __UNUSED__, void *e Eina_List *l2; Pager_Desk *pd; - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { Pager_Win *pw, *pw2 = NULL; - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { - E_Border *bd; + E_Client *ec; - bd = e_util_desk_border_below(ev->border); - if (bd) pw2 = _pager_desk_window_find(pd, bd); + ec = e_util_desk_client_below(ev->ec); + if (ec) pw2 = _pager_desk_window_find(pd, ec); if (pw2) { e_layout_child_raise_above(pw->o_window, pw2->o_window); continue; } - bd = e_util_desk_border_above(ev->border); - if (bd) pw2 = _pager_desk_window_find(pd, bd); + ec = e_util_desk_client_above(ev->ec); + if (ec) pw2 = _pager_desk_window_find(pd, ec); if (pw2) { e_layout_child_lower_below(pw->o_window, pw2->o_window); @@ -1355,23 +1344,24 @@ _pager_cb_event_border_stack(void *data __UNUSED__, int type __UNUSED__, void *e } static Eina_Bool -_pager_cb_event_border_icon_change(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_icon_change(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Icon_Change *ev = event; + E_Event_Client_Property *ev = event; Eina_List *l; Pager *p; + if (!(ev->property & E_CLIENT_PROPERTY_ICON)) return ECORE_CALLBACK_RENEW; EINA_LIST_FOREACH(pagers, l, p) { Eina_List *l2; Pager_Desk *pd; - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { Pager_Win *pw; - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { Evas_Object *o; @@ -1381,7 +1371,7 @@ _pager_cb_event_border_icon_change(void *data __UNUSED__, int type __UNUSED__, v evas_object_del(pw->o_icon); pw->o_icon = NULL; } - o = e_border_icon_add(ev->border, + o = e_client_icon_add(ev->ec, evas_object_evas_get(p->o_table)); if (o) { @@ -1398,9 +1388,9 @@ _pager_cb_event_border_icon_change(void *data __UNUSED__, int type __UNUSED__, v } static Eina_Bool -_pager_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_urgent_change(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Urgent_Change *ev; + E_Event_Client_Property *ev = event; Eina_List *l, *l2; Pager_Popup *pp; E_Zone *zone; @@ -1409,16 +1399,16 @@ _pager_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, Pager_Desk *pd; Pager_Win *pw; - ev = event; - zone = ev->border->zone; - urgent = ev->border->client.icccm.urgent; + if (!(ev->property & E_CLIENT_PROPERTY_URGENCY)) return ECORE_CALLBACK_RENEW; + zone = ev->ec->zone; + urgent = ev->ec->icccm.urgent; if (pager_config->popup_urgent && (pager_config->popup_urgent_focus || - (!pager_config->popup_urgent_focus && !ev->border->focused))) + (!pager_config->popup_urgent_focus && !ev->ec->focused))) { pp = _pager_popup_find(zone); - if ((!pp) && (urgent) && !(ev->border->iconic)) + if ((!pp) && (urgent) && !(ev->ec->iconic)) { pp = _pager_popup_new(zone, 0); @@ -1435,12 +1425,12 @@ _pager_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, EINA_LIST_FOREACH(p->desks, l2, pd) { - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { - if (urgent && !ev->border->focused) + if (urgent && !ev->ec->focused) { - if (!(ev->border->iconic)) + if (!(ev->ec->iconic)) { if ((pd->pager) && (pd->pager->inst) && (!pager_config->popup_urgent)) @@ -1453,7 +1443,7 @@ _pager_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, } else { - if (!(ev->border->iconic)) + if (!(ev->ec->iconic)) edje_object_signal_emit(pd->o_desk, "e,state,not_urgent", "e"); edje_object_signal_emit(pw->o_window, @@ -1467,9 +1457,9 @@ _pager_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, } static Eina_Bool -_pager_cb_event_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_In *ev; + E_Event_Client *ev = event; Instance *inst; Eina_List *l, *l2; Pager_Popup *pp; @@ -1477,8 +1467,7 @@ _pager_cb_event_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void Pager_Win *pw; E_Zone *zone; - ev = event; - zone = ev->border->zone; + zone = ev->ec->zone; EINA_LIST_FOREACH(pager_config->instances, l, inst) { @@ -1486,7 +1475,7 @@ _pager_cb_event_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void EINA_LIST_FOREACH(inst->pager->desks, l2, pd) { - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { edje_object_signal_emit(pw->o_window, @@ -1501,7 +1490,7 @@ _pager_cb_event_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void EINA_LIST_FOREACH(pp->pager->desks, l, pd) { - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { edje_object_signal_emit(pw->o_window, @@ -1514,9 +1503,9 @@ _pager_cb_event_border_focus_in(void *data __UNUSED__, int type __UNUSED__, void } static Eina_Bool -_pager_cb_event_border_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_Out *ev; + E_Event_Client *ev = event; Eina_List *l; Pager_Popup *pp; Pager_Desk *pd; @@ -1524,8 +1513,7 @@ _pager_cb_event_border_focus_out(void *data __UNUSED__, int type __UNUSED__, voi Instance *inst; E_Zone *zone; - ev = event; - zone = ev->border->zone; + zone = ev->ec->zone; EINA_LIST_FOREACH(pager_config->instances, l, inst) { @@ -1535,7 +1523,7 @@ _pager_cb_event_border_focus_out(void *data __UNUSED__, int type __UNUSED__, voi EINA_LIST_FOREACH(inst->pager->desks, l2, pd) { - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { edje_object_signal_emit(pw->o_window, @@ -1550,7 +1538,7 @@ _pager_cb_event_border_focus_out(void *data __UNUSED__, int type __UNUSED__, voi EINA_LIST_FOREACH(pp->pager->desks, l, pd) { - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { edje_object_signal_emit(pw->o_window, @@ -1563,26 +1551,27 @@ _pager_cb_event_border_focus_out(void *data __UNUSED__, int type __UNUSED__, voi } static Eina_Bool -_pager_cb_event_border_property(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_client_property(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Property *ev = event; + E_Event_Client_Property *ev = event; Eina_List *l, *l2; int found = 0; Pager *p; Pager_Win *pw; Pager_Desk *pd; + if (!(ev->property & E_CLIENT_PROPERTY_NETWM_STATE)) return ECORE_CALLBACK_RENEW; EINA_LIST_FOREACH(pagers, l, p) { - if (p->zone != ev->border->zone) continue; + if (p->zone != ev->ec->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { - pw = _pager_desk_window_find(pd, ev->border); + pw = _pager_desk_window_find(pd, ev->ec); if (pw) { found = 1; - if (ev->border->client.netwm.state.skip_pager) + if (ev->ec->netwm.state.skip_pager) { pd->wins = eina_list_remove(pd->wins, pw); _pager_window_free(pw); @@ -1596,24 +1585,24 @@ _pager_cb_event_border_property(void *data __UNUSED__, int type __UNUSED__, void * the skip_pager state may have changed to 1 */ EINA_LIST_FOREACH(pagers, l, p) { - if ((p->zone != ev->border->zone) || - (_pager_window_find(p, ev->border))) + if ((p->zone != ev->ec->zone) || + (_pager_window_find(p, ev->ec))) continue; - if (!ev->border->sticky) + if (!ev->ec->sticky) { - pd = _pager_desk_find(p, ev->border->desk); - if ((pd) && (!_pager_desk_window_find(pd, ev->border))) + pd = _pager_desk_find(p, ev->ec->desk); + if ((pd) && (!_pager_desk_window_find(pd, ev->ec))) { - pw = _pager_window_new(pd, ev->border); + pw = _pager_window_new(pd, ev->ec); if (pw) { Pager_Win *pw2 = NULL; - E_Border *bd; + E_Client *ec; pd->wins = eina_list_append(pd->wins, pw); - bd = e_util_desk_border_above(pw->border); - if (bd) - pw2 = _pager_desk_window_find(pd, bd); + ec = e_util_desk_client_above(pw->client); + if (ec) + pw2 = _pager_desk_window_find(pd, ec); if (pw2) e_layout_child_lower_below(pw->o_window, pw2->o_window); else @@ -1626,17 +1615,17 @@ _pager_cb_event_border_property(void *data __UNUSED__, int type __UNUSED__, void { EINA_LIST_FOREACH(p->desks, l2, pd) { - if (_pager_desk_window_find(pd, ev->border)) continue; - pw = _pager_window_new(pd, ev->border); + if (_pager_desk_window_find(pd, ev->ec)) continue; + pw = _pager_window_new(pd, ev->ec); if (pw) { Pager_Win *pw2 = NULL; - E_Border *bd; + E_Client *ec; pd->wins = eina_list_append(pd->wins, pw); - bd = e_util_desk_border_above(pw->border); - if (bd) - pw2 = _pager_desk_window_find(pd, bd); + ec = e_util_desk_client_above(pw->client); + if (ec) + pw2 = _pager_desk_window_find(pd, ec); if (pw2) e_layout_child_lower_below(pw->o_window, pw2->o_window); else @@ -1738,8 +1727,7 @@ _pager_cb_event_bg_update(void *data __UNUSED__, int type __UNUSED__, void *even Eina_List *l, *ll; Pager *p; Pager_Desk *pd; - E_Manager *man; - E_Container *con; + E_Comp *comp; E_Zone *zone; E_Desk *desk; @@ -1750,10 +1738,9 @@ _pager_cb_event_bg_update(void *data __UNUSED__, int type __UNUSED__, void *even _pager_desk_livethumb_setup(pd); return ECORE_CALLBACK_RENEW; } - man = e_manager_current_get(); - con = eina_list_nth(man->containers, ev->container); - if (!con) return ECORE_CALLBACK_RENEW; - zone = eina_list_nth(con->zones, ev->zone); + comp = eina_list_nth(e_comp_list(), ev->manager); + if (!comp) return ECORE_CALLBACK_RENEW; + zone = eina_list_nth(comp->zones, ev->zone); if (!zone) return ECORE_CALLBACK_RENEW; desk = e_desk_at_xy_get(zone, ev->desk_x, ev->desk_y); if (!zone) return ECORE_CALLBACK_RENEW; @@ -1768,9 +1755,9 @@ _pager_cb_event_bg_update(void *data __UNUSED__, int type __UNUSED__, void *even } static Eina_Bool -_pager_cb_event_container_resize(void *data __UNUSED__, int type __UNUSED__, void *event) +_pager_cb_event_compositor_resize(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Container_Resize *ev = event; + E_Event_Compositor_Resize *ev = event; Eina_List *l; Pager *p; @@ -1779,7 +1766,7 @@ _pager_cb_event_container_resize(void *data __UNUSED__, int type __UNUSED__, voi Eina_List *l2; Pager_Desk *pd; - if (p->zone->container != ev->container) continue; + if (p->zone->comp != ev->comp) continue; EINA_LIST_FOREACH(p->desks, l2, pd) e_layout_virtual_size_set(pd->o_layout, pd->desk->zone->w, @@ -1842,7 +1829,7 @@ _pager_window_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU if (!pw->drag.from_pager) { edje_object_signal_emit(pw->desk->o_desk, "e,action,drag,out", "e"); - e_comp_win_effect_unclip(pw->border->cw); + e_comp_object_effect_unclip(pw->client->frame); if (!pw->drag.start) p->just_dragged = 1; pw->drag.in_pager = 0; pw->drag.start = 0; @@ -1870,7 +1857,7 @@ _pager_window_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __U pw = data; if (!pw) return; - if (pw->border->lock_user_location) return; + if (pw->client->lock_user_location) return; if ((pw->desk->pager->popup) && (!act_popup)) return; /* prevent drag for a few pixels */ if (pw->drag.start) @@ -1885,7 +1872,7 @@ _pager_window_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __U pw->desk->pager->dragging = 1; pw->drag.start = 0; - e_comp_win_effect_clip(pw->border->cw); + e_comp_object_effect_clip(pw->client->frame); edje_object_signal_emit(pw->desk->o_desk, "e,action,drag,in", "e"); pw->desk->pager->active_drop_pd = pw->desk; } @@ -1910,20 +1897,21 @@ _pager_window_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __U if (pd != pw->desk) { edje_object_signal_emit(pw->desk->o_desk, "e,action,drag,out", "e"); - e_border_desk_set(pw->border, pd->desk); + pw->client->hidden = 0; + e_client_desk_set(pw->client, pd->desk); edje_object_signal_emit(pd->o_desk, "e,action,drag,in", "e"); pd->pager->active_drop_pd = pd; } - mx = E_CLAMP(vx + zx, zx, zx + zw - pw->border->w); - my = E_CLAMP(vy + zy, zy, zy + zh - pw->border->h); - e_border_move(pw->border, mx, my); + mx = E_CLAMP(vx + zx, zx, zx + zw - pw->client->w); + my = E_CLAMP(vy + zy, zy, zy + zh - pw->client->h); + evas_object_move(pw->client->frame, mx, my); } else { evas_object_geometry_get(pw->o_window, &x, &y, &w, &h); evas_object_hide(pw->o_window); - drag = e_drag_new(pw->desk->pager->zone->container, + drag = e_drag_new(pw->desk->pager->zone->comp, x, y, drag_types, 2, pw, -1, _pager_window_cb_drag_convert, _pager_window_cb_drag_finished); @@ -1933,17 +1921,17 @@ _pager_window_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __U "e/modules/pager/window"); evas_object_show(o); - oo = e_border_icon_add(pw->border, drag->evas); + oo = e_client_icon_add(pw->client, drag->evas); if (oo) { evas_object_show(oo); edje_object_part_swallow(o, "e.swallow.icon", oo); - e_popup_object_add(drag->pop, oo); } e_drag_object_set(drag, o); e_drag_resize(drag, w, h); e_drag_start(drag, x - pw->drag.dx, y - pw->drag.dy); + e_comp_object_util_del_list_append(drag->comp_object, oo); /* this prevents the desk from switching on drags */ pw->drag.from_pager = pw->desk->pager; @@ -1960,7 +1948,7 @@ _pager_window_cb_drag_convert(E_Drag *drag, const char *type) pw = drag->data; if (!strcmp(type, "enlightenment/pager_win")) return pw; - if (!strcmp(type, "enlightenment/border")) return pw->border; + if (!strcmp(type, "enlightenment/border")) return pw->client; return NULL; } @@ -1968,7 +1956,7 @@ static void _pager_window_cb_drag_finished(E_Drag *drag, int dropped) { Pager_Win *pw; - E_Container *cont; + E_Comp *comp; E_Zone *zone; E_Desk *desk; int x, y, dx, dy; @@ -1981,21 +1969,21 @@ _pager_window_cb_drag_finished(E_Drag *drag, int dropped) int zx, zy, zw, zh; /* wasn't dropped (on pager). move it to position of mouse on screen */ - cont = e_container_current_get(e_manager_current_get()); - zone = e_zone_current_get(cont); + comp = e_util_comp_current_get(); + zone = e_zone_current_get(comp); desk = e_desk_current_get(zone); - e_border_zone_set(pw->border, zone); - if ((pw->border->desk != desk) && (desk == e_desk_current_get(zone))) + e_client_zone_set(pw->client, zone); + if ((pw->client->desk != desk) && desk->visible) { - e_border_desk_set(pw->border, desk); - e_comp_win_effect_set(pw->border->cw, NULL); + pw->client->hidden = 0; + e_client_desk_set(pw->client, desk); } ecore_x_pointer_last_xy_get(&x, &y); - dx = (pw->border->w / 2); - dy = (pw->border->h / 2); + dx = (pw->client->w / 2); + dy = (pw->client->h / 2); e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh); @@ -2003,23 +1991,24 @@ _pager_window_cb_drag_finished(E_Drag *drag, int dropped) if (dx < x) { x -= dx; - if ((pw->border->w < zw) && - (x + pw->border->w > zx + zw)) - x -= x + pw->border->w - (zx + zw); + if ((pw->client->w < zw) && + (x + pw->client->w > zx + zw)) + x -= x + pw->client->w - (zx + zw); } else x = 0; if (dy < y) { y -= dy; - if ((pw->border->h < zh) && - (y + pw->border->h > zy + zh)) - y -= y + pw->border->h - (zy + zh); + if ((pw->client->h < zh) && + (y + pw->client->h > zy + zh)) + y -= y + pw->client->h - (zy + zh); } else y = 0; - e_border_move(pw->border, x, y); + evas_object_move(pw->client->frame, x, y); - if (!(pw->border->lock_user_stacking)) e_border_raise(pw->border); + if (!(pw->client->lock_user_stacking)) + evas_object_raise(pw->client->frame); } if (pw->desk->pager->active_drop_pd) { @@ -2028,7 +2017,7 @@ _pager_window_cb_drag_finished(E_Drag *drag, int dropped) } if (pw->drag.from_pager) pw->drag.from_pager->dragging = 0; pw->drag.from_pager = NULL; - e_comp_win_effect_unclip(pw->border->cw); + e_comp_object_effect_unclip(pw->client->frame); if (act_popup) { e_grabinput_get(input_window, 0, input_window); @@ -2114,7 +2103,7 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info) E_Event_Dnd_Drop *ev; Pager_Desk *pd; Pager_Desk *pd2 = NULL; - E_Border *bd = NULL; + E_Client *ec = NULL; Eina_List *l; int dx = 0, dy = 0; Pager_Win *pw = NULL; @@ -2135,18 +2124,18 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info) pw = (Pager_Win *)(ev->data); if (pw) { - bd = pw->border; + ec = pw->client; dx = pw->drag.dx; dy = pw->drag.dy; } } else if (!strcmp(type, "enlightenment/border")) { - bd = ev->data; - e_layout_coord_virtual_to_canvas(pd->o_layout, bd->x, bd->y, + ec = ev->data; + e_layout_coord_virtual_to_canvas(pd->o_layout, ec->x, ec->y, &wx, &wy); - e_layout_coord_virtual_to_canvas(pd->o_layout, bd->x + bd->w, - bd->y + bd->h, &wx2, &wy2); + e_layout_coord_virtual_to_canvas(pd->o_layout, ec->x + ec->w, + ec->y + ec->h, &wx2, &wy2); dx = (wx - wx2) / 2; dy = (wy - wy2) / 2; } @@ -2159,26 +2148,21 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info) else return; - if (bd) + if (ec) { - E_Maximize max = bd->maximized; - E_Fullscreen fs = bd->fullscreen_policy; - Eina_Bool fullscreen = bd->fullscreen; - - if (bd->iconic) e_border_uniconify(bd); - if (bd->maximized) - e_border_unmaximize(bd, E_MAXIMIZE_BOTH); - if (fullscreen) e_border_unfullscreen(bd); - if (pd->desk != e_desk_current_get(pd->desk->zone)) - e_border_hide(bd, 2); - else - { - if ((pd->desk != bd->desk) && (pw)) - e_comp_win_effect_set(pw->border->cw, NULL); - } - e_border_desk_set(bd, pd->desk); - e_border_raise(bd); + E_Maximize max = ec->maximized; + E_Fullscreen fs = ec->fullscreen_policy; + Eina_Bool fullscreen = ec->fullscreen; + if (ec->iconic) e_client_uniconify(ec); + if (ec->maximized) + e_client_unmaximize(ec, E_MAXIMIZE_BOTH); + if (fullscreen) e_client_unfullscreen(ec); + if (pd->desk->visible) + ec->hidden = 0; + e_client_desk_set(ec, pd->desk); + evas_object_raise(ec->frame); + if ((!max) && (!fullscreen)) { int zx, zy, zw, zh, mx, my; @@ -2190,12 +2174,12 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info) e_zone_useful_geometry_get(pd->desk->zone, &zx, &zy, &zw, &zh); - mx = E_CLAMP(nx + zx, zx, zx + zw - bd->w); - my = E_CLAMP(ny + zy, zy, zy + zh - bd->h); - e_border_move(bd, mx, my); + mx = E_CLAMP(nx + zx, zx, zx + zw - ec->w); + my = E_CLAMP(ny + zy, zy, zy + zh - ec->h); + evas_object_move(ec->frame, mx, my); } - if (max) e_border_maximize(bd, max); - if (fullscreen) e_border_fullscreen(bd, fs); + if (max) e_client_maximize(ec, max); + if (fullscreen) e_client_fullscreen(ec, fs); } } @@ -2304,7 +2288,7 @@ _pager_desk_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU if (pd->drag.in_pager && pd->pager) { evas_object_geometry_get(pd->o_desk, &x, &y, &w, &h); - drag = e_drag_new(pd->pager->zone->container, + drag = e_drag_new(pd->pager->zone->comp, x, y, drag_types, 1, pd, -1, NULL, _pager_desk_cb_drag_finished); @@ -2319,15 +2303,15 @@ _pager_desk_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU oo = e_layout_add(drag->evas); e_layout_virtual_size_set(oo, pd->pager->zone->w, pd->pager->zone->h); edje_object_part_swallow(o, "e.swallow.content", oo); - e_popup_object_add(drag->pop, oo); + e_comp_object_util_del_list_append(drag->comp_object, oo); evas_object_show(oo); EINA_LIST_FOREACH(pd->wins, l, pw) { int zx, zy; - if ((!pw) || (pw->border->iconic) - || (pw->border->client.netwm.state.skip_pager)) + if ((!pw) || (pw->client->iconic) + || (pw->client->netwm.state.skip_pager)) continue; o = edje_object_add(drag->evas); @@ -2337,16 +2321,16 @@ _pager_desk_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU e_layout_child_raise(o); e_zone_useful_geometry_get(pw->desk->desk->zone, &zx, &zy, NULL, NULL); - e_layout_child_move(o, pw->border->x - zx, pw->border->y - zy); - e_layout_child_resize(o, pw->border->w, pw->border->h); - e_popup_object_add(drag->pop, o); + e_layout_child_move(o, pw->client->x - zx, pw->client->y - zy); + e_layout_child_resize(o, pw->client->w, pw->client->h); + e_comp_object_util_del_list_append(drag->comp_object, o); evas_object_show(o); - if ((o_icon = e_border_icon_add(pw->border, drag->evas))) + if ((o_icon = e_client_icon_add(pw->client, drag->evas))) { evas_object_show(o_icon); edje_object_part_swallow(o, "e.swallow.icon", o_icon); - e_popup_object_add(drag->pop, o_icon); + e_comp_object_util_del_list_append(drag->comp_object, o_icon); } } e_drag_resize(drag, w, h); @@ -2444,11 +2428,11 @@ _pager_popup_show(void) E_Zone *zone; int x, y, w, h; Pager_Popup *pp; - const char *drop[] = - { - "enlightenment/pager_win", "enlightenment/border", - "enlightenment/vdesktop" - }; + //const char *drop[] = + //{ + //"enlightenment/pager_win", "enlightenment/border", + //"enlightenment/vdesktop" + //}; if ((act_popup) || (input_window)) return 0; @@ -2457,7 +2441,7 @@ _pager_popup_show(void) pp = _pager_popup_find(zone); if (pp) _pager_popup_free(pp); - input_window = ecore_x_window_input_new(zone->container->win, 0, 0, 1, 1); + input_window = ecore_x_window_input_new(zone->comp->win, 0, 0, 1, 1); ecore_x_window_show(input_window); if (!e_grabinput_get(input_window, 0, input_window)) { @@ -2487,15 +2471,8 @@ _pager_popup_show(void) act_popup = _pager_popup_new(zone, 1); - e_popup_ignore_events_set(act_popup->popup, 1); - evas_object_geometry_get(act_popup->pager->o_table, &x, &y, &w, &h); - e_drop_handler_add(E_OBJECT(act_popup->popup), act_popup->pager, - _pager_drop_cb_enter, _pager_drop_cb_move, - _pager_drop_cb_leave, _pager_drop_cb_drop, - drop, 3, x, y, w, h); - current_desk = e_desk_current_get(zone); return 1; @@ -2618,7 +2595,7 @@ _pager_popup_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *eve ev = event; if (ev->window != input_window) return ECORE_CALLBACK_PASS_ON; - evas_event_feed_mouse_down(pp->popup->evas, ev->buttons, + evas_event_feed_mouse_down(evas_object_evas_get(pp->popup), ev->buttons, 0, ev->timestamp, NULL); return ECORE_CALLBACK_PASS_ON; } @@ -2632,7 +2609,7 @@ _pager_popup_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event ev = event; if (ev->window != input_window) return ECORE_CALLBACK_PASS_ON; - evas_event_feed_mouse_up(pp->popup->evas, ev->buttons, + evas_event_feed_mouse_up(evas_object_evas_get(pp->popup), ev->buttons, 0, ev->timestamp, NULL); return ECORE_CALLBACK_PASS_ON; } @@ -2642,13 +2619,15 @@ _pager_popup_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *eve { Ecore_Event_Mouse_Move *ev; Pager_Popup *pp = act_popup; + int x, y; ev = event; if (ev->window != input_window) return 1; - evas_event_feed_mouse_move(pp->popup->evas, - ev->x - pp->popup->x + pp->pager->zone->x, - ev->y - pp->popup->y + pp->pager->zone->y, + evas_object_geometry_get(pp->popup, &x, &y, NULL, NULL); + evas_event_feed_mouse_move(evas_object_evas_get(pp->popup), + ev->x - x + pp->pager->zone->x, + ev->y - y + pp->pager->zone->y, ev->timestamp, NULL); return ECORE_CALLBACK_PASS_ON; } @@ -2872,28 +2851,26 @@ e_modapi_init(E_Module *m) E_CONFIG_LIMIT(pager_config->btn_desk, 0, 32); E_CONFIG_LIMIT(pager_config->disable_live_preview, 0, 1); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_RESIZE, _pager_cb_event_border_resize, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_MOVE, _pager_cb_event_border_move, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_ADD, _pager_cb_event_border_add, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_REMOVE, _pager_cb_event_border_remove, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_ICONIFY, _pager_cb_event_border_iconify, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_UNICONIFY, _pager_cb_event_border_uniconify, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_STICK, _pager_cb_event_border_stick, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_UNSTICK, _pager_cb_event_border_unstick, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_DESK_SET, _pager_cb_event_border_desk_set, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_STACK, _pager_cb_event_border_stack, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_ICON_CHANGE, _pager_cb_event_border_icon_change, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_URGENT_CHANGE, _pager_cb_event_border_urgent_change, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_FOCUS_IN, - _pager_cb_event_border_focus_in, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_FOCUS_OUT, - _pager_cb_event_border_focus_out, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BORDER_PROPERTY, _pager_cb_event_border_property, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_ZONE_DESK_COUNT_SET, _pager_cb_event_zone_desk_count_set, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_DESK_SHOW, _pager_cb_event_desk_show, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_DESK_NAME_CHANGE, _pager_cb_event_desk_name_change, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CONTAINER_RESIZE, _pager_cb_event_container_resize, NULL); - E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BG_UPDATE, _pager_cb_event_bg_update, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_RESIZE, _pager_cb_event_client_resize, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_MOVE, _pager_cb_event_client_move, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_ADD, _pager_cb_event_client_add, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_REMOVE, _pager_cb_event_client_remove, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_ICONIFY, _pager_cb_event_client_iconify, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_UNICONIFY, _pager_cb_event_client_uniconify, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_STICK, _pager_cb_event_client_stick, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_UNSTICK, _pager_cb_event_client_unstick, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_DESK_SET, _pager_cb_event_client_desk_set, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_STACK, _pager_cb_event_client_stack, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_PROPERTY, _pager_cb_event_client_icon_change, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_PROPERTY, _pager_cb_event_client_urgent_change, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_FOCUS_IN, _pager_cb_event_client_focus_in, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_FOCUS_OUT, _pager_cb_event_client_focus_out, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_CLIENT_PROPERTY, _pager_cb_event_client_property, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_ZONE_DESK_COUNT_SET, _pager_cb_event_zone_desk_count_set, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_DESK_SHOW, _pager_cb_event_desk_show, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_DESK_NAME_CHANGE, _pager_cb_event_desk_name_change, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_COMPOSITOR_RESIZE, _pager_cb_event_compositor_resize, NULL); + E_LIST_HANDLER_APPEND(pager_config->handlers, E_EVENT_BG_UPDATE, _pager_cb_event_bg_update, NULL); pager_config->module = m; diff --git a/src/modules/quickaccess/e_mod_config.c b/src/modules/quickaccess/e_mod_config.c index b28931f63..c36a0300b 100644 --- a/src/modules/quickaccess/e_mod_config.c +++ b/src/modules/quickaccess/e_mod_config.c @@ -542,7 +542,7 @@ e_qa_config_entry_add(E_Quick_Access_Entry *entry) } E_Config_Dialog * -e_int_config_qa_module(E_Container *con, const char *params __UNUSED__) +e_int_config_qa_module(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -561,7 +561,7 @@ e_int_config_qa_module(E_Container *con, const char *params __UNUSED__) v->advanced.check_changed = _advanced_check_changed; snprintf(buf, sizeof(buf), "%s/e-module-quickaccess.edj", e_module_dir_get(qa_mod->module)); - cfd = e_config_dialog_new(con, _("Quickaccess Settings"), + cfd = e_config_dialog_new(comp, _("Quickaccess Settings"), "E", "launcher/quickaccess", buf, 32, v, NULL); return cfd; } diff --git a/src/modules/quickaccess/e_mod_main.h b/src/modules/quickaccess/e_mod_main.h index 53b598f21..8ce758a0b 100644 --- a/src/modules/quickaccess/e_mod_main.h +++ b/src/modules/quickaccess/e_mod_main.h @@ -20,7 +20,7 @@ typedef struct E_Quick_Access_Entry const char *class; /* icccm class, stringshared */ const char *cmd; /* stringshared */ Ecore_X_Window win; /* current window */ - E_Border *border; /* associated border, if any */ + E_Client *client; /* associated client, if any */ Ecore_Event_Handler *exe_handler; /* for catching exe delete */ Ecore_Exe *exe; /* if executed cmd but still no border associated */ E_Dialog *dia; // used for option handling @@ -93,7 +93,7 @@ void *e_qa_config_dd_free(void); void e_qa_config_entry_free(E_Quick_Access_Entry *entry); void e_qa_config_entry_add(E_Quick_Access_Entry *entry); void e_qa_config_entry_transient_convert(E_Quick_Access_Entry *entry); -E_Config_Dialog *e_int_config_qa_module(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_qa_module(E_Comp *comp, const char *params __UNUSED__); char *e_qa_db_class_lookup(const char *class); diff --git a/src/modules/quickaccess/e_mod_quickaccess.c b/src/modules/quickaccess/e_mod_quickaccess.c index 92f2883bf..84ab78e95 100644 --- a/src/modules/quickaccess/e_mod_quickaccess.c +++ b/src/modules/quickaccess/e_mod_quickaccess.c @@ -15,7 +15,7 @@ static E_Grab_Dialog *eg = NULL; static Eina_List *_e_qa_border_hooks = NULL; static Eina_List *_e_qa_event_handlers = NULL; -static E_Border_Menu_Hook *border_hook = NULL; +static E_Client_Menu_Hook *border_hook = NULL; static Eina_Bool qa_running = EINA_FALSE; @@ -82,15 +82,15 @@ _e_qa_entry_find_exe(const Ecore_Exe *exe) } static E_Quick_Access_Entry * -_e_qa_entry_find_border(const E_Border *bd) +_e_qa_entry_find_border(const E_Client *ec) { E_Quick_Access_Entry *entry; const Eina_List *n; EINA_LIST_FOREACH(qa_config->transient_entries, n, entry) - if ((entry->win == bd->client.win) || (entry->border == bd)) + if ((ec->pixmap && (entry->win == e_client_util_win_get(ec))) || (entry->client == ec)) return entry; EINA_LIST_FOREACH(qa_config->entries, n, entry) - if (entry->border == bd) + if (entry->client == ec) return entry; return NULL; } @@ -127,13 +127,13 @@ _e_qa_entry_find_match_stringshared(const char *name, const char *class, Eina_Bo } static E_Quick_Access_Entry * -_e_qa_entry_find_match(const E_Border *bd, Eina_Bool nontrans) +_e_qa_entry_find_match(const E_Client *ec, Eina_Bool nontrans) { const char *name, *class; E_Quick_Access_Entry *entry; - name = bd->client.icccm.name; - class = bd->client.icccm.class; + name = ec->icccm.name; + class = ec->icccm.class; entry = _e_qa_entry_find_match_stringshared(name, class, nontrans); return entry; @@ -156,11 +156,11 @@ _e_qa_event_exe_del_cb(void *data, int type __UNUSED__, Ecore_Exe_Event_Del *ev) } static void -_e_qa_entry_border_props_restore(E_Quick_Access_Entry *entry __UNUSED__, E_Border *bd) +_e_qa_entry_border_props_restore(E_Quick_Access_Entry *entry __UNUSED__, E_Client *ec) { #undef SET #define SET(X) \ - bd->X = 0 + ec->X = 0 SET(lock_user_iconify); SET(lock_client_iconify); @@ -170,35 +170,36 @@ _e_qa_entry_border_props_restore(E_Quick_Access_Entry *entry __UNUSED__, E_Borde SET(sticky); #undef SET - bd->client.netwm.state.skip_taskbar = 0; - bd->client.netwm.state.skip_pager = 0; - bd->changed = 1; + ec->netwm.state.skip_taskbar = 0; + ec->netwm.state.skip_pager = 0; + ec->changed = 1; } static void _e_qa_border_activate(E_Quick_Access_Entry *entry) { entry->config.hidden = 0; - if (!entry->border) return; - if (entry->border->iconic) + if (!entry->client) return; + if (entry->client->iconic) { - if (!entry->border->lock_user_iconify) - e_border_uniconify(entry->border); + if (!entry->client->lock_user_iconify) + e_client_uniconify(entry->client); } - if (entry->border->shaded) + if (entry->client->shaded) { - if (!entry->border->lock_user_shade) - e_border_unshade(entry->border, entry->border->shade.dir); + if (!entry->client->lock_user_shade) + e_client_unshade(entry->client, entry->client->shade_dir); } - else if (entry->border->desk && entry->config.jump) + else if (entry->client->desk && entry->config.jump) { - if (!entry->border->sticky) e_desk_show(entry->border->desk); + if (!entry->client->sticky) e_desk_show(entry->client->desk); } - if (!entry->border->lock_user_stacking) - e_border_raise(entry->border); - e_border_show(entry->border); - if (!entry->border->lock_focus_out) - e_border_focus_set_with_pointer(entry->border); + if (!entry->client->lock_user_stacking) + evas_object_raise(entry->client->frame); + entry->client->hidden = 0; + evas_object_show(entry->client->frame); + if (!entry->client->lock_focus_out) + e_client_focus_set_with_pointer(entry->client); } static void @@ -206,33 +207,34 @@ _e_qa_border_deactivate(E_Quick_Access_Entry *entry) { if (entry->config.jump) return; entry->config.hidden = 1; - if (!entry->border) return; - e_border_hide(entry->border, 3); + if (!entry->client) return; + entry->client->hidden = 1; + evas_object_hide(entry->client->frame); } static void _e_qa_entry_border_props_apply(E_Quick_Access_Entry *entry) { - if (!entry->border) return; + if (!entry->client) return; - if (entry->config.autohide && (!entry->border->focused)) + if (entry->config.autohide && (!entry->client->focused)) _e_qa_border_deactivate(entry); #define SET(X) \ - entry->border->X = 1 + entry->client->X = 1 if (entry->config.jump) { - entry->border->client.netwm.state.skip_taskbar = 0; - entry->border->client.netwm.state.skip_pager = 0; + entry->client->netwm.state.skip_taskbar = 0; + entry->client->netwm.state.skip_pager = 0; } else { if (qa_config->skip_taskbar) - SET(client.netwm.state.skip_taskbar); + SET(netwm.state.skip_taskbar); if (qa_config->skip_pager) - SET(client.netwm.state.skip_pager); + SET(netwm.state.skip_pager); SET(sticky); } - //bd->client.e.state.centered = 1; + //ec->e.state.centered = 1; SET(lock_user_iconify); SET(lock_client_iconify); SET(lock_user_sticky); @@ -243,11 +245,11 @@ _e_qa_entry_border_props_apply(E_Quick_Access_Entry *entry) } static void -_e_qa_entry_border_associate(E_Quick_Access_Entry *entry, E_Border *bd) +_e_qa_entry_border_associate(E_Quick_Access_Entry *entry, E_Client *ec) { if (entry->exe) entry->exe = NULL; /* not waiting anymore */ - entry->border = bd; + entry->client = ec; /* FIXME: doesn't work, causes window to flicker on associate if (entry->config.hidden) _e_qa_border_deactivate(entry); @@ -264,7 +266,7 @@ _e_qa_entry_relaunch_setup_continue(void *data, E_Dialog *dia) if (dia) e_object_del(E_OBJECT(dia)); entry->dia = NULL; - if (!entry->border->client.icccm.command.argv) + if (!entry->client->icccm.command.argv) { e_util_dialog_show(_("Quickaccess Error"), _("Could not determine command for starting this application!")); /* FIXME: e_entry_dialog? */ @@ -272,12 +274,12 @@ _e_qa_entry_relaunch_setup_continue(void *data, E_Dialog *dia) } entry->config.relaunch = 1; buf[0] = 0; - for (i = 0; i < entry->border->client.icccm.command.argc; i++) + for (i = 0; i < entry->client->icccm.command.argc; i++) { if ((sizeof(buf) - strlen(buf)) < - (strlen(entry->border->client.icccm.command.argv[i]) - 2)) + (strlen(entry->client->icccm.command.argv[i]) - 2)) break; - strcat(buf, entry->border->client.icccm.command.argv[i]); + strcat(buf, entry->client->icccm.command.argv[i]); strcat(buf, " "); } entry->cmd = eina_stringshare_add(buf); @@ -390,7 +392,7 @@ _e_qa_entry_relaunch_setup(E_Quick_Access_Entry *entry) entry->config.relaunch = 0; return; } - if (!entry->border->client.icccm.command.argv) + if (!entry->client->icccm.command.argv) { free(opt); e_util_dialog_show(_("Quickaccess Error"), _("Could not determine command for starting this application!")); @@ -399,16 +401,16 @@ _e_qa_entry_relaunch_setup(E_Quick_Access_Entry *entry) } buf[0] = 0; - for (i = 0; i < entry->border->client.icccm.command.argc; i++) + for (i = 0; i < entry->client->icccm.command.argc; i++) { if ((sizeof(buf) - strlen(buf)) < - (strlen(entry->border->client.icccm.command.argv[i]) - 2)) + (strlen(entry->client->icccm.command.argv[i]) - 2)) break; - strcat(buf, entry->border->client.icccm.command.argv[i]); + strcat(buf, entry->client->icccm.command.argv[i]); strcat(buf, " "); } name = entry->name; - entry->name = eina_stringshare_printf("e-%s-%u", entry->name, entry->border->client.netwm.pid); + entry->name = eina_stringshare_printf("e-%s-%u", entry->name, entry->client->netwm.pid); while (i) { i = 0; @@ -419,7 +421,7 @@ _e_qa_entry_relaunch_setup(E_Quick_Access_Entry *entry) if ((e->name == entry->name) || (e->id == entry->name)) { eina_stringshare_del(entry->name); - entry->name = eina_stringshare_printf("e-%s-%u%d", entry->name, entry->border->client.netwm.pid, i); + entry->name = eina_stringshare_printf("e-%s-%u%d", entry->name, entry->client->netwm.pid, i); i++; break; } @@ -463,13 +465,13 @@ _e_qa_border_new(E_Quick_Access_Entry *entry) static void _e_qa_del_cb(E_Object *obj __UNUSED__, const char *params __UNUSED__) { - _e_qa_bd_menu_del(_e_qa_entry_find_border(e_border_focused_get()), NULL, NULL); + _e_qa_bd_menu_del(_e_qa_entry_find_border(e_client_focused_get()), NULL, NULL); } static void _e_qa_add_cb(E_Object *obj __UNUSED__, const char *params __UNUSED__) { - _e_qa_bd_menu_del(e_border_focused_get(), NULL, NULL); + _e_qa_bd_menu_del(e_client_focused_get(), NULL, NULL); } static void @@ -492,11 +494,11 @@ _e_qa_toggle_cb(E_Object *obj __UNUSED__, const char *params) return; } - if (entry->border) + if (entry->client) { if (entry->help_watch) _e_qa_help_activate_hook(entry); - if ((!entry->config.jump) && entry->border->visible && ((entry->border->client.icccm.accepts_focus && entry->border->focused) || entry->config.hide_when_behind)) + if ((!entry->config.jump) && evas_object_visible_get(entry->client->frame) && ((entry->client->icccm.accepts_focus && entry->client->focused) || entry->config.hide_when_behind)) { _e_qa_border_deactivate(entry); return; @@ -515,27 +517,27 @@ _e_qa_toggle_cb(E_Object *obj __UNUSED__, const char *params) } static void -_e_qa_border_eval_pre_post_fetch_cb(void *data __UNUSED__, void *border) +_e_qa_border_eval_pre_post_fetch_cb(void *data __UNUSED__, E_Client *ec) { - E_Border *bd = border; E_Quick_Access_Entry *entry; - if ((!bd->new_client) || (bd->internal)) return; - if ((!bd->client.icccm.class) || (!bd->client.icccm.class[0])) return; - if ((!bd->client.icccm.name) || (!bd->client.icccm.name[0])) return; + if (e_client_util_ignored_get(ec)) return; + if ((!ec->new_client) || (ec->internal)) return; + if ((!ec->icccm.class) || (!ec->icccm.class[0])) return; + if ((!ec->icccm.name) || (!ec->icccm.name[0])) return; - entry = _e_qa_entry_find_match(bd, 0); + entry = _e_qa_entry_find_match(ec, 0); if (!entry) return; - DBG("border=%p matches entry %s", bd, entry->id); - _e_qa_entry_border_associate(entry, bd); + DBG("border=%p matches entry %s", ec, entry->id); + _e_qa_entry_border_associate(entry, ec); } static Eina_Bool -_e_qa_event_border_focus_out_cb(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Focus_Out *ev) +_e_qa_event_border_focus_out_cb(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *ev) { E_Quick_Access_Entry *entry; - entry = _e_qa_entry_find_border(ev->border); + entry = _e_qa_entry_find_border(ev->ec); if (entry && entry->config.autohide) _e_qa_border_deactivate(entry); return ECORE_CALLBACK_RENEW; } @@ -546,17 +548,17 @@ _e_qa_event_module_init_end_cb(void *data __UNUSED__, int type __UNUSED__, void Eina_List *l, *ll; E_Quick_Access_Entry *entry; unsigned int count; - E_Border *bd; + E_Client *ec; /* assume that by now, e has successfully placed all windows */ count = eina_list_count(qa_config->transient_entries); EINA_LIST_FOREACH_SAFE(qa_config->transient_entries, l, ll, entry) { - if (entry->border) continue; - entry->border = e_border_find_by_client_window(entry->win); - if (entry->border) + if (entry->client) continue; + entry->client = e_pixmap_find_client(E_PIXMAP_TYPE_X, entry->win); + if (entry->client) { DBG("qa window for %u:transient:%s still exists; restoring", entry->win, entry->id); - _e_qa_entry_border_associate(entry, entry->border); + _e_qa_entry_border_associate(entry, entry->client); continue; } DBG("qa window for %u:transient:%s no longer exists; deleting", entry->win, entry->id); @@ -567,38 +569,42 @@ _e_qa_event_module_init_end_cb(void *data __UNUSED__, int type __UNUSED__, void count = 0; EINA_LIST_FOREACH(qa_config->entries, l, entry) { - if (entry->config.relaunch && (!entry->border)) + if (entry->config.relaunch && (!entry->client)) { DBG("qa window for relaunch entry %s not present, starting", entry->id); _e_qa_border_new(entry); } - if (entry->border) continue; + if (entry->client) continue; count++; } if (count) { + E_Comp *comp; + const Eina_List *lll; /* some non-transient entries exist without assigned borders * try assigning from existing borders */ - EINA_LIST_FOREACH(e_border_client_list(), l, bd) - { - entry = _e_qa_entry_find_match(bd, 1); - if ((!entry) || entry->border) continue; - DBG("border=%p matches entry %s", bd, entry->id); - _e_qa_entry_border_associate(entry, bd); - count--; - if (!count) break; - } + EINA_LIST_FOREACH(e_comp_list(), lll, comp) + EINA_LIST_FOREACH(comp->clients, l, ec) + { + if (e_client_util_ignored_get(ec)) continue; + entry = _e_qa_entry_find_match(ec, 1); + if ((!entry) || entry->client) continue; + DBG("border=%p matches entry %s", ec, entry->id); + _e_qa_entry_border_associate(entry, ec); + count--; + if (!count) break; + } } return ECORE_CALLBACK_RENEW; } static Eina_Bool -_e_qa_event_border_remove_cb(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Remove *ev) +_e_qa_event_border_remove_cb(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *ev) { E_Quick_Access_Entry *entry; - entry = _e_qa_entry_find_border(ev->border); + entry = _e_qa_entry_find_border(ev->ec); if (!entry) return ECORE_CALLBACK_RENEW; if (entry->transient) { @@ -607,7 +613,7 @@ _e_qa_event_border_remove_cb(void *data __UNUSED__, int type __UNUSED__, E_Event return ECORE_CALLBACK_RENEW; } else if (entry->config.relaunch) _e_qa_border_new(entry); - entry->border = NULL; + entry->client = NULL; return ECORE_CALLBACK_RENEW; } @@ -624,25 +630,25 @@ _e_qa_entry_transient_convert(E_Quick_Access_Entry *entry) return; } entry->transient = EINA_TRUE; - entry->win = entry->border->client.win; + entry->win = e_client_util_win_get(entry->client); eina_list_move(&qa_config->transient_entries, &qa_config->entries, entry); eina_stringshare_replace(&entry->cmd, NULL); entry->config.relaunch = 0; } static E_Quick_Access_Entry * -_e_qa_entry_transient_new(E_Border *bd) +_e_qa_entry_transient_new(E_Client *ec) { E_Quick_Access_Entry *entry; char buf[8192]; - snprintf(buf, sizeof(buf), "%s:%u:%s", bd->client.icccm.name ?: "", bd->client.win, bd->client.icccm.class ?: ""); + snprintf(buf, sizeof(buf), "%s:%u:%s", ec->icccm.name ?: "", (unsigned int)e_client_util_win_get(ec), ec->icccm.class ?: ""); entry = e_qa_entry_new(buf, EINA_TRUE); - entry->win = bd->client.win; - entry->name = eina_stringshare_ref(bd->client.icccm.name); - entry->class = eina_stringshare_ref(bd->client.icccm.class); - _e_qa_entry_border_associate(entry, bd); + entry->win = e_client_util_win_get(ec); + entry->name = eina_stringshare_ref(ec->icccm.name); + entry->class = eina_stringshare_ref(ec->icccm.class); + _e_qa_entry_border_associate(entry, ec); qa_config->transient_entries = eina_list_append(qa_config->transient_entries, entry); e_config_save_queue(); return entry; @@ -652,7 +658,7 @@ static Eina_Bool _grab_key_down_cb(void *data, int type __UNUSED__, void *event) { Ecore_Event_Key *ev = event; - E_Border *bd = data; + E_Client *ec = data; E_Config_Binding_Key *bi; E_Quick_Access_Entry *entry; unsigned int mod = E_BINDING_MODIFIER_NONE; @@ -678,7 +684,7 @@ _grab_key_down_cb(void *data, int type __UNUSED__, void *event) e_object_del(E_OBJECT(eg)); return ECORE_CALLBACK_RENEW; } - entry = _e_qa_entry_transient_new(bd); + entry = _e_qa_entry_transient_new(ec); bi = E_NEW(E_Config_Binding_Key, 1); @@ -732,7 +738,7 @@ _e_qa_bd_menu_jump(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) if (entry->config.jump) { entry->config.autohide = entry->config.hide_when_behind = 0; - _e_qa_entry_border_props_restore(entry, entry->border); + _e_qa_entry_border_props_restore(entry, entry->client); } else _e_qa_entry_border_props_apply(entry); @@ -780,11 +786,11 @@ _e_qa_bd_menu_config(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *m static void _e_qa_bd_menu_add(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) { - E_Border *bd = data; - if (!bd) return; + E_Client *ec = data; + if (!ec) return; if (eg) return; - eg = e_grab_dialog_show(NULL, EINA_FALSE, _grab_key_down_cb, NULL, NULL, bd); - e_object_data_set(E_OBJECT(eg), bd); + eg = e_grab_dialog_show(NULL, EINA_FALSE, _grab_key_down_cb, NULL, NULL, ec); + e_object_data_set(E_OBJECT(eg), ec); e_object_del_attach_func_set(E_OBJECT(eg), _grab_wnd_hide); } @@ -860,20 +866,20 @@ _e_qa_bd_menu_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi) } static void -_e_qa_bd_menu_hook(void *d __UNUSED__, E_Border *bd) +_e_qa_bd_menu_hook(void *d __UNUSED__, E_Client *ec) { E_Menu_Item *mi; E_Menu *m; E_Quick_Access_Entry *entry; char buf[PATH_MAX]; - if (!bd->border_menu) return; - m = bd->border_menu; + if (!ec->border_menu) return; + m = ec->border_menu; /* position menu item just before first separator */ mi = m->items->next->data; mi = e_menu_item_new_relative(m, mi); - entry = _e_qa_entry_find_border(bd); + entry = _e_qa_entry_find_border(ec); if (entry) { e_menu_item_label_set(mi, _("Quickaccess...")); @@ -883,7 +889,7 @@ _e_qa_bd_menu_hook(void *d __UNUSED__, E_Border *bd) else { e_menu_item_label_set(mi, _("Add Quickaccess")); - e_menu_item_callback_set(mi, _e_qa_bd_menu_add, bd); + e_menu_item_callback_set(mi, _e_qa_bd_menu_add, ec); } snprintf(buf, sizeof(buf), "%s/e-module-quickaccess.edj", e_module_dir_get(qa_mod->module)); e_menu_item_icon_edje_set(mi, buf, "icon"); @@ -905,7 +911,7 @@ _e_qa_help_timeout(void *data __UNUSED__) if (qa_mod->demo_dia) { E_Quick_Access_Entry *entry; - entry = _e_qa_entry_find_border(qa_mod->demo_dia->win->border); + entry = _e_qa_entry_find_border(qa_mod->demo_dia->win->client); e_qa_entry_free(entry); e_object_del(E_OBJECT(qa_mod->demo_dia)); } @@ -982,7 +988,7 @@ _e_qa_help5(void *data __UNUSED__) { char buf[PATH_MAX]; - if (_e_qa_entry_find_border(qa_mod->demo_dia->win->border)) + if (_e_qa_entry_find_border(qa_mod->demo_dia->win->client)) { qa_mod->help_timer = ecore_timer_add(1, _e_qa_help_timer_cb, NULL); return; @@ -1034,7 +1040,7 @@ _e_qa_help_activate_hook(E_Quick_Access_Entry *entry) default: snprintf(buf, sizeof(buf), "%s/e-module-quickaccess.edj", e_module_dir_get(qa_mod->module)); if (entry->config.hidden) - _e_qa_border_activate(_e_qa_entry_find_border(qa_mod->demo_dia->win->border)); + _e_qa_border_activate(_e_qa_entry_find_border(qa_mod->demo_dia->win->client)); qa_mod->help_dia = (E_Object*)e_confirm_dialog_show(_("Quickaccess Help"), buf, _("Well done.
" "Now to delete the entry we just made..."), @@ -1063,7 +1069,7 @@ _e_qa_help_qa_added_cb(void *data __UNUSED__) E_Quick_Access_Entry *entry; ecore_timer_thaw(qa_mod->help_timeout); - if ((!qa_mod->demo_dia) || (!_e_qa_entry_find_border(qa_mod->demo_dia->win->border))) + if ((!qa_mod->demo_dia) || (!_e_qa_entry_find_border(qa_mod->demo_dia->win->client))) { _e_qa_help_timeout(NULL); return; @@ -1101,11 +1107,11 @@ _e_qa_help_bd_menu2_del(void *data __UNUSED__) static Eina_Bool _e_qa_help_timer_helper(void) { - E_Border *bd; + E_Client *ec; E_Menu_Item *mi; Eina_List *items; - bd = qa_mod->demo_dia->win->border; + ec = qa_mod->demo_dia->win->client; ecore_timer_interval_set(qa_mod->help_timer, 0.2); mi = e_menu_item_active_get(); if (qa_mod->menu) @@ -1136,7 +1142,7 @@ _e_qa_help_timer_helper(void) qa_mod->help_timer = NULL; return EINA_FALSE; } - items = bd->border_menu->items; + items = ec->border_menu->items; } do { @@ -1158,17 +1164,17 @@ _e_qa_help_timer_helper(void) static Eina_Bool _e_qa_help_timer2_cb(void *data __UNUSED__) { - E_Border *bd; + E_Client *ec; - if ((!qa_mod->demo_dia) || (!qa_mod->demo_dia->win) || (!qa_mod->demo_dia->win->border)) + if ((!qa_mod->demo_dia) || (!qa_mod->demo_dia->win) || (!qa_mod->demo_dia->win->client)) /* FIXME */ return EINA_TRUE; - bd = qa_mod->demo_dia->win->border; + ec = qa_mod->demo_dia->win->client; switch (qa_mod->demo_state) { case 0: - e_object_free_attach_func_set(E_OBJECT(bd->border_menu), _e_qa_help_bd_menu2_del); + e_object_free_attach_func_set(E_OBJECT(ec->border_menu), _e_qa_help_bd_menu2_del); break; default: if (_e_qa_help_timer_helper()) break; @@ -1182,19 +1188,19 @@ _e_qa_help_timer2_cb(void *data __UNUSED__) static Eina_Bool _e_qa_help_timer_cb(void *data __UNUSED__) { - E_Border *bd; + E_Client *ec; - if ((!qa_mod->demo_dia) || (!qa_mod->demo_dia->win) || (!qa_mod->demo_dia->win->border)) + if ((!qa_mod->demo_dia) || (!qa_mod->demo_dia->win) || (!qa_mod->demo_dia->win->client)) /* wait longer */ return EINA_TRUE; - bd = qa_mod->demo_dia->win->border; + ec = qa_mod->demo_dia->win->client; switch (qa_mod->demo_state) { case 0: - e_int_border_menu_show(bd, bd->x + bd->w * .5, bd->y + 5, 0, 0); + e_int_client_menu_show(ec, ec->x + ec->w * .5, ec->y + 5, 0, 0); ecore_timer_interval_set(qa_mod->help_timer, 0.8); - e_object_free_attach_func_set(E_OBJECT(bd->border_menu), _e_qa_help_bd_menu_del); + e_object_free_attach_func_set(E_OBJECT(ec->border_menu), _e_qa_help_bd_menu_del); break; default: if (!_e_qa_help_timer_helper()) return EINA_FALSE; @@ -1298,7 +1304,7 @@ Eina_Bool e_qa_init(void) { Ecore_Event_Handler *eh; - E_Border_Hook *h; + E_Client_Hook *h; _act_toggle = eina_stringshare_add("qa_toggle"); _e_qa_toggle = e_action_add(_act_toggle); @@ -1315,7 +1321,7 @@ e_qa_init(void) return EINA_FALSE; } #define CB(id, func) \ - h = e_border_hook_add(E_BORDER_HOOK_##id, _e_qa_border_##func##_cb, NULL); \ + h = e_client_hook_add(E_CLIENT_HOOK_##id, _e_qa_border_##func##_cb, NULL); \ _e_qa_border_hooks = eina_list_append(_e_qa_border_hooks, h) CB(EVAL_PRE_POST_FETCH, eval_pre_post_fetch); @@ -1325,8 +1331,8 @@ e_qa_init(void) eh = ecore_event_handler_add(id, (Ecore_Event_Handler_Cb)_e_qa_event_##func##_cb, NULL); \ _e_qa_event_handlers = eina_list_append(_e_qa_event_handlers, eh) - CB(E_EVENT_BORDER_FOCUS_OUT, border_focus_out); - CB(E_EVENT_BORDER_REMOVE, border_remove); + CB(E_EVENT_CLIENT_FOCUS_OUT, border_focus_out); + CB(E_EVENT_CLIENT_REMOVE, border_remove); CB(E_EVENT_MODULE_INIT_END, module_init_end); CB(ECORE_EXE_EVENT_DEL, exe_del); #undef CB @@ -1339,7 +1345,7 @@ e_qa_init(void) e_action_predef_name_set(_e_qa_name, _lbl_del, _act_del, NULL, NULL, 0); INF("loaded qa module, registered %s action.", _act_toggle); - border_hook = e_int_border_menu_hook_add(_e_qa_bd_menu_hook, NULL); + border_hook = e_int_client_menu_hook_add(_e_qa_bd_menu_hook, NULL); if (!qa_config->first_run) _e_qa_first_run(); return EINA_TRUE; @@ -1371,10 +1377,10 @@ e_qa_shutdown(void) } E_FREE_LIST(_e_qa_event_handlers, ecore_event_handler_del); - E_FREE_LIST(_e_qa_border_hooks, e_border_hook_del); + E_FREE_LIST(_e_qa_border_hooks, e_client_hook_del); if (qa_mod->help_timeout) ecore_timer_del(qa_mod->help_timeout); _e_qa_help_timeout(NULL); - e_int_border_menu_hook_del(border_hook); + e_int_client_menu_hook_del(border_hook); border_hook = NULL; INF("unloaded quickaccess module, unregistered %s action.", _act_toggle); eina_stringshare_del(_act_toggle); @@ -1387,7 +1393,7 @@ e_qa_entry_free(E_Quick_Access_Entry *entry) { if (!entry) return; if (entry->exe_handler) ecore_event_handler_del(entry->exe_handler); - if (entry->border) _e_qa_entry_border_props_restore(entry, entry->border); + if (entry->client) _e_qa_entry_border_props_restore(entry, entry->client); if (entry->cfg_entry) e_qa_config_entry_free(entry); e_qa_entry_bindings_cleanup(entry); e_bindings_reset(); diff --git a/src/modules/shot/e_mod_main.c b/src/modules/shot/e_mod_main.c index 4d990dbad..2efdfea93 100644 --- a/src/modules/shot/e_mod_main.c +++ b/src/modules/shot/e_mod_main.c @@ -20,7 +20,7 @@ E_Confirm_Dialog *cd = NULL; static Evas_Object *o_bg = NULL, *o_box = NULL, *o_content = NULL; static Evas_Object *o_event = NULL, *o_img = NULL, *o_hlist = NULL; static E_Manager *sman = NULL; -static E_Container *scon = NULL; +static E_Comp *scomp = NULL; static int quality = 90; static int screen = -1; #define MAXZONES 64 @@ -36,7 +36,7 @@ static Ecore_Con_Url *url_up = NULL; static Eina_List *handlers = NULL; static char *url_ret = NULL; static E_Dialog *fsel_dia = NULL; -static E_Border_Menu_Hook *border_hook = NULL; +static E_Client_Menu_Hook *border_hook = NULL; static void _file_select_ok_cb(void *data __UNUSED__, E_Dialog *dia); static void _file_select_cancel_cb(void *data __UNUSED__, E_Dialog *dia); @@ -148,7 +148,7 @@ _screen_change_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *even Eina_List *l; E_Zone *z; - EINA_LIST_FOREACH(scon->zones, l, z) + EINA_LIST_FOREACH(scomp->zones, l, z) { if (screen == -1) evas_object_color_set(o_rectdim[z->num], 0, 0, 0, 0); @@ -181,7 +181,7 @@ _save_to(const char *file) Eina_List *l; E_Zone *z = NULL; - EINA_LIST_FOREACH(scon->zones, l, z) + EINA_LIST_FOREACH(scomp->zones, l, z) { if (screen == (int)z->num) break; z = NULL; @@ -271,7 +271,7 @@ _win_save_cb(void *data __UNUSED__, void *data2 __UNUSED__) strftime(buf, sizeof(buf), "shot-%Y-%m-%d_%H-%M-%S.png", tm); else strftime(buf, sizeof(buf), "shot-%Y-%m-%d_%H-%M-%S.jpg", tm); - fsel_dia = dia = e_dialog_new(scon, "E", "_e_shot_fsel"); + fsel_dia = dia = e_dialog_new(scomp, "E", "_e_shot_fsel"); e_dialog_resizable_set(dia, 1); e_dialog_title_set(dia, _("Select screenshot save location")); o = e_widget_fsel_add(dia->win->evas, "desktop", "/", @@ -516,7 +516,7 @@ _win_share_cb(void *data __UNUSED__, void *data2 __UNUSED__) // out of the box ecore_con_url_http_version_set(url_up, ECORE_CON_URL_HTTP_VERSION_1_0); ecore_con_url_post(url_up, fdata, fsize, "application/x-e-shot"); - dia = e_dialog_new(scon, "E", "_e_shot_share"); + dia = e_dialog_new(scomp, "E", "_e_shot_share"); e_dialog_resizable_set(dia, 1); e_dialog_title_set(dia, _("Uploading screenshot")); @@ -578,7 +578,7 @@ _rect_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (ev->button != 1) return; e_widget_radio_toggle_set(o_radio_all, 0); - EINA_LIST_FOREACH(scon->zones, l, z) + EINA_LIST_FOREACH(scomp->zones, l, z) { if (obj == o_rectdim[z->num]) { @@ -589,7 +589,7 @@ _rect_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUS e_widget_radio_toggle_set(o_radio[z->num], 0); } - EINA_LIST_FOREACH(scon->zones, l, z) + EINA_LIST_FOREACH(scomp->zones, l, z) { if (screen == -1) evas_object_color_set(o_rectdim[z->num], 0, 0, 0, 0); @@ -601,7 +601,7 @@ _rect_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUS } static void -_shot_now(E_Zone *zone, E_Border *bd) +_shot_now(E_Zone *zone, E_Client *ec) { Ecore_X_Image *img; unsigned char *src; @@ -620,11 +620,11 @@ _shot_now(E_Zone *zone, E_Border *bd) Ecore_X_Colormap colormap; int depth; - if ((!zone) && (!bd)) return; + if ((!zone) && (!ec)) return; if (zone) { - sman = zone->container->manager; - scon = zone->container; + sman = zone->comp->man; + scomp = zone->comp; xwin = sman->root; w = sw = sman->w; h = sh = sman->h; @@ -635,16 +635,16 @@ _shot_now(E_Zone *zone, E_Border *bd) } else { - xwin = e_comp_get(bd)->ee_win; - x = bd->x, y = bd->y, sw = bd->w, sh = bd->h; + xwin = e_comp_get(ec)->ee_win; + x = ec->x, y = ec->y, sw = ec->w, sh = ec->h; w = sw; h = sh; - x = E_CLAMP(x, bd->zone->x, bd->zone->x + bd->zone->w); - y = E_CLAMP(y, bd->zone->y, bd->zone->y + bd->zone->h); - sw = E_CLAMP(sw, 0, bd->zone->x + bd->zone->w - x); - sh = E_CLAMP(sh, 0, bd->zone->y + bd->zone->h - y); - visual = bd->client.initial_attributes.visual; - depth = bd->client.initial_attributes.depth; + x = E_CLAMP(x, ec->zone->x, ec->zone->x + ec->zone->w); + y = E_CLAMP(y, ec->zone->y, ec->zone->y + ec->zone->h); + sw = E_CLAMP(sw, 0, ec->zone->x + ec->zone->w - x); + sh = E_CLAMP(sh, 0, ec->zone->y + ec->zone->h - y); + visual = e_pixmap_visual_get(ec->pixmap); + depth = ec->depth; } img = ecore_x_image_new(w, h, visual, depth); ecore_x_image_get(img, xwin, x, y, 0, 0, sw, sh); @@ -658,7 +658,7 @@ _shot_now(E_Zone *zone, E_Border *bd) dst, (sw * sizeof(int)), 0, 0); if (win) e_object_del(E_OBJECT(win)); - win = e_win_new(e_container_current_get(e_manager_current_get())); + win = e_win_new(e_util_comp_current_get()); evas = e_win_evas_get(win); e_win_title_set(win, _("Where to put Screenshot...")); @@ -731,7 +731,7 @@ _shot_now(E_Zone *zone, E_Border *bd) if (zone) { screen = -1; - if (eina_list_count(scon->zones) > 1) + if (eina_list_count(scomp->zones) > 1) { Eina_List *l; E_Zone *z; @@ -746,7 +746,7 @@ _shot_now(E_Zone *zone, E_Border *bd) evas_object_smart_callback_add(o, "changed", _screen_change_cb, NULL); e_widget_framelist_object_append(ol, o); i = 0; - EINA_LIST_FOREACH(scon->zones, l, z) + EINA_LIST_FOREACH(scomp->zones, l, z) { char buf[32]; @@ -826,7 +826,7 @@ _shot_now(E_Zone *zone, E_Border *bd) e_win_size_min_set(win, w, h); e_win_size_max_set(win, 99999, 99999); e_win_show(win); - e_win_border_icon_set(win, "screenshot"); + e_win_client_icon_set(win, "screenshot"); if (!e_widget_focus_get(o_bg)) e_widget_focus_set(o_box, 1); } @@ -848,10 +848,10 @@ _shot_delay_border(void *data) } static void -_shot_border(E_Border *bd) +_shot_border(E_Client *ec) { if (border_timer) ecore_timer_del(border_timer); - border_timer = ecore_timer_add(1.0, _shot_delay_border, bd); + border_timer = ecore_timer_add(1.0, _shot_delay_border, ec); } static void @@ -876,15 +876,15 @@ _e_mod_menu_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__) static void _e_mod_action_border_cb(E_Object *obj __UNUSED__, const char *params __UNUSED__) { - E_Border *bd; - bd = e_border_focused_get(); - if (!bd) return; + E_Client *ec; + ec = e_client_focused_get(); + if (!ec) return; if (border_timer) { ecore_timer_del(border_timer); border_timer = NULL; } - _shot_now(NULL, bd); + _shot_now(NULL, ec); } static void @@ -896,8 +896,8 @@ _e_mod_action_cb(E_Object *obj, const char *params __UNUSED__) { if (obj->type == E_MANAGER_TYPE) zone = e_util_zone_current_get((E_Manager *)obj); - else if (obj->type == E_CONTAINER_TYPE) - zone = e_util_zone_current_get(((E_Container *)obj)->manager); + else if (obj->type == E_COMP_TYPE) + zone = e_zone_current_get((E_Comp *)obj); else if (obj->type == E_ZONE_TYPE) zone = ((E_Zone *)obj); else @@ -905,23 +905,19 @@ _e_mod_action_cb(E_Object *obj, const char *params __UNUSED__) } if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); if (!zone) return; - if (timer) - { - ecore_timer_del(timer); - timer = NULL; - } + E_FREE_FUNC(timer, ecore_timer_del); _shot_now(zone, NULL); } static void -_bd_hook(void *d __UNUSED__, E_Border *bd) +_bd_hook(void *d __UNUSED__, E_Client *ec) { E_Menu_Item *mi; E_Menu *m; Eina_List *l; - if (!bd->border_menu) return; - if (bd->iconic || (bd->desk != e_desk_current_get(bd->zone))) return; - m = bd->border_menu; + if (!ec->border_menu) return; + if (ec->iconic || (ec->desk != e_desk_current_get(ec->zone))) return; + m = ec->border_menu; /* position menu item just before first separator */ EINA_LIST_FOREACH(m->items, l, mi) @@ -934,7 +930,7 @@ _bd_hook(void *d __UNUSED__, E_Border *bd) mi = e_menu_item_new_relative(m, mi); e_menu_item_label_set(mi, _("Take Shot")); e_util_menu_item_theme_icon_set(mi, "screenshot"); - e_menu_item_callback_set(mi, _e_mod_menu_border_cb, bd); + e_menu_item_callback_set(mi, _e_mod_menu_border_cb, ec); } static void @@ -984,7 +980,7 @@ e_modapi_init(E_Module *m) } maug = e_int_menus_menu_augmentation_add_sorted ("main/2", _("Take Screenshot"), _e_mod_menu_add, NULL, NULL, NULL); - border_hook = e_int_border_menu_hook_add(_bd_hook, NULL); + border_hook = e_int_client_menu_hook_add(_bd_hook, NULL); return m; } @@ -1015,7 +1011,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__) act = NULL; } shot_module = NULL; - e_int_border_menu_hook_del(border_hook); + e_int_client_menu_hook_del(border_hook); ecore_con_url_shutdown(); return 1; } diff --git a/src/modules/syscon/e_int_config_syscon.c b/src/modules/syscon/e_int_config_syscon.c index 1ee28001c..2cd8e3d18 100644 --- a/src/modules/syscon/e_int_config_syscon.c +++ b/src/modules/syscon/e_int_config_syscon.c @@ -26,7 +26,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_syscon(E_Container *con, const char *params __UNUSED__) +e_int_config_syscon(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -40,7 +40,7 @@ e_int_config_syscon(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Syscon Settings"), + cfd = e_config_dialog_new(comp, _("Syscon Settings"), "E", "windows/conf_syscon", "system-shutdown", 0, v, NULL); return cfd; diff --git a/src/modules/syscon/e_mod_main.c b/src/modules/syscon/e_mod_main.c index 89ed80c51..14c08412f 100644 --- a/src/modules/syscon/e_mod_main.c +++ b/src/modules/syscon/e_mod_main.c @@ -84,10 +84,10 @@ _e_mod_action_syscon_cb(E_Object *obj, const char *params) { if (obj->type == E_MANAGER_TYPE) zone = e_util_zone_current_get((E_Manager *)obj); - else if (obj->type == E_CONTAINER_TYPE) - zone = e_util_zone_current_get(((E_Container *)obj)->manager); + else if (obj->type == E_COMP_TYPE) + zone = e_zone_current_get((E_Comp *)obj); else if (obj->type == E_ZONE_TYPE) - zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager); + zone = e_util_zone_current_get(((E_Zone *)obj)->comp->man); else zone = e_util_zone_current_get(e_manager_current_get()); } diff --git a/src/modules/syscon/e_mod_main.h b/src/modules/syscon/e_mod_main.h index eadbf1f64..37262afb1 100644 --- a/src/modules/syscon/e_mod_main.h +++ b/src/modules/syscon/e_mod_main.h @@ -7,7 +7,7 @@ int e_syscon_shutdown(void); int e_syscon_show(E_Zone *zone, const char *defact); void e_syscon_hide(void); -E_Config_Dialog *e_int_config_syscon(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_syscon(E_Comp *comp, const char *params __UNUSED__); void e_syscon_gadget_init(E_Module *m); void e_syscon_gadget_shutdown(void); diff --git a/src/modules/syscon/e_syscon.c b/src/modules/syscon/e_syscon.c index a87f758c8..6e26cd746 100644 --- a/src/modules/syscon/e_syscon.c +++ b/src/modules/syscon/e_syscon.c @@ -10,8 +10,7 @@ static void _cb_signal_action_extra(void *data, Evas_Object *obj, const cha static Eina_Bool _cb_timeout_defaction(void *data); /* local subsystem globals */ -static E_Popup *popup = NULL; -static Ecore_X_Window input_window = 0; +static Evas_Object *popup = NULL; static const char *do_defact = NULL; static Eina_List *handlers = NULL; static Evas_Object *o_bg = NULL; @@ -48,6 +47,7 @@ e_syscon_show(E_Zone *zone, const char *defact) int iw, ih; Eina_List *l; double t; + Evas *evas; t = ecore_loop_time_get(); if (popup) @@ -74,24 +74,11 @@ e_syscon_show(E_Zone *zone, const char *defact) return 0; } - input_window = e_comp_get(zone)->ee_win; - if (!e_grabinput_get(input_window, 1, input_window)) - { - input_window = 0; - return 0; - } + if (!e_comp_grab_input(e_comp_get(zone), 1, 1)) return 0; + evas = e_comp_get(zone)->evas; + evas_event_freeze(evas); - popup = e_popup_new(zone, 0, 0, 1, 1); - if (!popup) - { - e_grabinput_release(input_window, input_window); - input_window = 0; - return 0; - } - e_popup_autoclose(popup, NULL, _cb_key_down, NULL); - evas_event_freeze(popup->evas); - - o = edje_object_add(popup->evas); + o = edje_object_add(evas); o_bg = o; e_theme_edje_object_set(o, "base/theme/syscon", "e/widgets/syscon/main"); @@ -101,6 +88,9 @@ e_syscon_show(E_Zone *zone, const char *defact) edje_object_signal_callback_add(o, "e,action,syscon", "*", _cb_signal_syscon, NULL); + popup = e_comp_object_util_add(o_bg, E_COMP_OBJECT_TYPE_POPUP); + evas_object_data_set(popup, "zone", zone); + e_comp_object_util_autoclose(popup, NULL, _cb_key_down, NULL); act_count = 0; show_time = t; @@ -111,22 +101,22 @@ e_syscon_show(E_Zone *zone, const char *defact) // extra (example for illume): // home | close | kill - o = e_flowlayout_add(popup->evas); - e_popup_object_add(popup, o); + o = e_flowlayout_add(evas); + e_comp_object_util_del_list_append(popup, o); o_flow_main = o; e_flowlayout_orientation_set(o, 1); e_flowlayout_flowdirection_set(o, 1, 1); e_flowlayout_homogenous_set(o, 1); - o = e_flowlayout_add(popup->evas); - e_popup_object_add(popup, o); + o = e_flowlayout_add(evas); + e_comp_object_util_del_list_append(popup, o); o_flow_secondary = o; e_flowlayout_orientation_set(o, 1); e_flowlayout_flowdirection_set(o, 1, 1); e_flowlayout_homogenous_set(o, 1); - o = e_flowlayout_add(popup->evas); - e_popup_object_add(popup, o); + o = e_flowlayout_add(evas); + e_comp_object_util_del_list_append(popup, o); o_flow_extra = o; e_flowlayout_orientation_set(o, 1); e_flowlayout_flowdirection_set(o, 1, 1); @@ -161,7 +151,7 @@ e_syscon_show(E_Zone *zone, const char *defact) else if ((!strcmp(sca->action, "hibernate")) && (!e_sys_action_possible_get(E_SYS_HIBERNATE))) disabled = 1; - o = edje_object_add(popup->evas); + o = edje_object_add(evas); edje_object_signal_callback_add(o, "e,action,click", "", _cb_signal_action, sca); if (sca->button) @@ -177,7 +167,7 @@ e_syscon_show(E_Zone *zone, const char *defact) _(e_action_predef_label_get(sca->action, sca->params))); if (sca->icon) { - o2 = e_icon_add(popup->evas); + o2 = e_icon_add(evas); e_util_icon_theme_set(o2, sca->icon); edje_object_part_swallow(o, "e.swallow.icon", o2); evas_object_show(o2); @@ -211,7 +201,7 @@ e_syscon_show(E_Zone *zone, const char *defact) char buf[1024]; sca = l->data; - o = edje_object_add(popup->evas); + o = edje_object_add(evas); edje_object_signal_callback_add(o, "e,action,click", "", _cb_signal_action_extra, sca); if (sca->button_name) { @@ -225,7 +215,7 @@ e_syscon_show(E_Zone *zone, const char *defact) edje_object_part_text_set(o, "e.text.label", sca->label); if (sca->icon_group) { - o2 = edje_object_add(popup->evas); + o2 = edje_object_add(evas); e_util_edje_icon_set(o2, sca->icon_group); edje_object_part_swallow(o, "e.swallow.icon", o2); evas_object_show(o2); @@ -271,11 +261,7 @@ e_syscon_show(E_Zone *zone, const char *defact) if (h > zh) h = zh; y = zy - zone->y + (zh - h) / 2; - e_popup_move_resize(popup, x, y, w, h); - evas_object_move(o_bg, 0, 0); - evas_object_resize(o_bg, w, h); - evas_object_show(o_bg); - e_popup_content_set(popup, o_bg); + evas_object_geometry_set(popup, x, y, w, h); if (e_config->syscon.do_input) { @@ -284,9 +270,9 @@ e_syscon_show(E_Zone *zone, const char *defact) if (defact) do_defact = eina_stringshare_add(defact); } - evas_event_thaw(popup->evas); + evas_event_thaw(evas); inevas = 0; - e_popup_show(popup); + evas_object_show(popup); return 1; } @@ -295,18 +281,12 @@ e_syscon_hide(void) { if (!popup) return; - if (deftimer) - { - ecore_timer_del(deftimer); - deftimer = NULL; - } - if (do_defact) eina_stringshare_del(do_defact); - do_defact = NULL; + E_FREE_FUNC(deftimer, ecore_timer_del); + eina_stringshare_replace(&do_defact, NULL); E_FREE_LIST(handlers, ecore_event_handler_del); - e_object_del(E_OBJECT(popup)); - popup = NULL; - e_grabinput_release(input_window, input_window); - input_window = 0; + e_comp_ungrab_input(e_comp_util_evas_object_comp_get(popup), 1, 1); + evas_object_hide(popup); + E_FREE_FUNC(popup, evas_object_del); o_selected_flow = o_selected = o_flow_extra = o_flow_main = o_flow_secondary = NULL; } @@ -409,7 +389,7 @@ _cb_key_down(__UNUSED__ void *data, Ecore_Event_Key *ev) { if (popup) { - e_syscon_show(popup->zone, do_defact); + e_syscon_show(evas_object_data_get(popup, "zone"), do_defact); } } else diff --git a/src/modules/syscon/e_syscon_gadget.c b/src/modules/syscon/e_syscon_gadget.c index 31fe73bac..9aa415b47 100644 --- a/src/modules/syscon/e_syscon_gadget.c +++ b/src/modules/syscon/e_syscon_gadget.c @@ -74,7 +74,7 @@ _cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void e_menu_item_toggle_set(mi, syscon_config->menu); e_menu_item_callback_set(mi, _cb_menu_change, inst); m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0); - ecore_x_pointer_xy_get(zone->container->win, &x, &y); + ecore_x_pointer_xy_get(zone->comp->win, &x, &y); e_menu_activate_mouse(m, zone, x, y, 1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp); evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, diff --git a/src/modules/systray/e_mod_main.c b/src/modules/systray/e_mod_main.c index 321196720..ce97fe6c6 100644 --- a/src/modules/systray/e_mod_main.c +++ b/src/modules/systray/e_mod_main.c @@ -114,7 +114,7 @@ _cb_menu_cfg(void *data, E_Menu *m, E_Menu_Item *mi EINA_UNUSED) v->basic.create_widgets = _cfg_widgets_create; v->basic.apply_cfdata = _cfg_data_apply; - e_config_dialog_new(m->zone->container, _("Systray Settings"), "E", + e_config_dialog_new(m->zone->comp, _("Systray Settings"), "E", "_e_mod_systray_config_dialog", NULL, 0, v, data); } @@ -245,8 +245,8 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) if (!inst) return NULL; inst->evas = gc->evas; - inst->con = e_container_current_get(e_manager_current_get()); - if (!inst->con) + inst->comp = e_comp_get(NULL); + if (!inst->comp) { E_FREE(inst); return NULL; @@ -544,14 +544,14 @@ int systray_manager_number_get(const Instance *inst) { EINA_SAFETY_ON_NULL_RETURN_VAL(inst, 0); - return inst->con->manager->num; + return inst->comp->num; } Ecore_X_Window systray_root_get(const Instance *inst) { EINA_SAFETY_ON_NULL_RETURN_VAL(inst, 0); - return inst->con->manager->root; + return inst->comp->man->root; } static void diff --git a/src/modules/systray/e_mod_main.h b/src/modules/systray/e_mod_main.h index 700f5b8f8..d38e58e77 100644 --- a/src/modules/systray/e_mod_main.h +++ b/src/modules/systray/e_mod_main.h @@ -21,7 +21,7 @@ typedef struct _E_Config_Dialog_Data Systray_Config; struct _Instance { E_Gadcon_Client *gcc; - E_Container *con; + E_Comp *comp; Evas *evas; Instance_Xembed *xembed; Instance_Notifier_Host *notifier; diff --git a/src/modules/systray/e_mod_notifier_host.c b/src/modules/systray/e_mod_notifier_host.c index 7141a2738..dc0d72256 100644 --- a/src/modules/systray/e_mod_notifier_host.c +++ b/src/modules/systray/e_mod_notifier_host.c @@ -157,7 +157,7 @@ _item_menu_new(Notifier_Item_Icon *ii) e_menu_post_deactivate_callback_set(m, _menu_post_deactivate, gadcon); zone = e_util_zone_current_get(e_manager_current_get()); - ecore_x_pointer_xy_get(zone->container->win, &x, &y); + ecore_x_pointer_xy_get(zone->comp->win, &x, &y); e_menu_activate_mouse(m, zone, x, y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ecore_x_current_time_get()); } diff --git a/src/modules/systray/e_mod_xembed.c b/src/modules/systray/e_mod_xembed.c index bb8440ae6..ca7cf0c5a 100644 --- a/src/modules/systray/e_mod_xembed.c +++ b/src/modules/systray/e_mod_xembed.c @@ -65,12 +65,16 @@ struct _Instance_Xembed Ecore_Event_Handler *reparent; Ecore_Event_Handler *sel_clear; Ecore_Event_Handler *configure; + Ecore_Event_Handler *client; } handler; struct { Ecore_Timer *retry; } timer; Eina_List *icons; + + E_Client *ec; + Ecore_Timer *visibility_timer; }; static Ecore_X_Atom _atom_manager = 0; @@ -104,18 +108,53 @@ _xembed_win_resize(Instance_Xembed *xembed) ecore_x_window_move_resize(xembed->win.base, last_x, last_y, (first_x+first_w) - last_x, (first_y+first_h) - last_y); + evas_object_geometry_set(xembed->ec->frame, last_x, last_y, + (first_x+first_w) - last_x, + (first_y+first_h) - last_y); +} + +static void +_systray_xembed_restack(Instance_Xembed *xembed) +{ + E_Layer layer; + E_Shelf *es = xembed->inst->gcc->gadcon->shelf; + + if (es) + { + layer = e_comp_canvas_layer_map_to(e_comp_canvas_layer_map(es->cfg->layer) + 1); + } + else + layer = E_LAYER_CLIENT_DESKTOP; + layer = E_CLAMP(layer, E_LAYER_CLIENT_DESKTOP, E_LAYER_CLIENT_ABOVE); + evas_object_layer_set(xembed->ec->frame, layer); +} + +static Eina_Bool +_systray_xembed_visible_check(Instance_Xembed *xembed) +{ + if (eina_list_count(xembed->icons) == 0) + { + evas_object_hide(xembed->ec->frame); + e_pixmap_dirty(xembed->ec->pixmap); + } + else + { + _xembed_win_resize(xembed); + _systray_xembed_restack(xembed); + evas_object_show(xembed->ec->frame); + } + xembed->visibility_timer = NULL; + return EINA_FALSE; } void systray_xembed_size_updated(Instance_Xembed *xembed) { - if (eina_list_count(xembed->icons) == 0) - { - ecore_x_window_hide(xembed->win.base); - return; - } - ecore_x_window_show(xembed->win.base); - _xembed_win_resize(xembed); + + if (xembed->visibility_timer) + ecore_timer_reset(xembed->visibility_timer); + else + xembed->visibility_timer = ecore_timer_add(0.15, (Ecore_Task_Cb)_systray_xembed_visible_check, xembed); } static void @@ -132,6 +171,22 @@ _systray_xembed_cb_resize(void *data, Evas *evas __UNUSED__, Evas_Object *o __UN systray_size_updated(xembed->inst); } +static void +_systray_xembed_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Instance_Xembed *xembed = data; + if (xembed->ec) + evas_object_hide(xembed->ec->frame); +} + +static void +_systray_xembed_cb_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Instance_Xembed *xembed = data; + if (xembed->ec && eina_list_count(xembed->icons)) + evas_object_show(xembed->ec->frame); +} + static void _systray_xembed_icon_geometry_apply(Icon *icon) { @@ -277,7 +332,6 @@ _systray_xembed_icon_add(Instance_Xembed *xembed, const Ecore_X_Window win) 1.0, (double)w / (double)h); ecore_x_window_reparent(win, xembed->win.base, 0, 0); - ecore_x_window_raise(win); ecore_x_window_client_manage(win); ecore_x_window_save_set_add(win); ecore_x_window_shape_events_select(win, 1); @@ -398,30 +452,15 @@ _systray_xembed_base_create(Instance_Xembed *xembed) return EINA_FALSE; evas_object_geometry_get(box, &x, &y, NULL, NULL); - xembed->win.base = ecore_x_window_new(0, x, y, 1, 1); + xembed->win.base = ecore_x_window_override_new(0, x, y, 1, 1); + //fprintf(stderr, "xembed->win.base = %u\n", xembed->win.base); ecore_x_icccm_title_set(xembed->win.base, "noshadow_systray_base"); ecore_x_icccm_name_class_set(xembed->win.base, "systray", "holder"); ecore_x_netwm_name_set(xembed->win.base, "noshadow_systray_base"); - ecore_x_window_reparent(xembed->win.base, xembed->win.parent, x, y); if (!invis) ecore_x_window_background_color_set(xembed->win.base, r, g, b); ecore_x_window_show(xembed->win.base); - if (xembed->inst->gcc->gadcon->shelf) - { - E_Shelf *es = xembed->inst->gcc->gadcon->shelf; - if (es->popup) - { - if (es->layer) - e_container_window_raise(xembed->inst->con, xembed->win.base, E_LAYER_ABOVE); - else - e_container_window_raise(xembed->inst->con, xembed->win.base, E_LAYER_BELOW); - } - else - e_container_window_raise(xembed->inst->con, xembed->win.base, E_LAYER_DESKTOP); - } - else - e_container_window_raise(xembed->inst->con, xembed->win.base, E_LAYER_DESKTOP); return EINA_TRUE; } @@ -437,7 +476,7 @@ _systray_xembed_activate(Instance_Xembed *xembed) atom = _systray_xembed_atom_st_get(systray_manager_number_get(xembed->inst)); old_win = ecore_x_selection_owner_get(atom); - if (old_win && (old_win != e_comp_get(xembed->inst->con)->cm_selection)) return 0; + if (old_win && (old_win != xembed->inst->comp->cm_selection)) return 0; if (xembed->win.base == 0) { @@ -445,7 +484,7 @@ _systray_xembed_activate(Instance_Xembed *xembed) return 0; } - xembed->win.selection = e_comp_get(xembed->inst->con)->cm_selection; + xembed->win.selection = xembed->inst->comp->cm_selection; if (old_win) return 1; if (!_systray_xembed_selection_owner_set_current(xembed)) { @@ -527,7 +566,6 @@ _systray_xembed_handle_request_dock(Instance_Xembed *xembed, Ecore_X_Event_Clien { Ecore_X_Window win = (Ecore_X_Window)ev->data.l[2]; Ecore_X_Time t; - Ecore_X_Window_Attributes attr; const Eina_List *l; Icon *icon; unsigned int val[2]; @@ -537,12 +575,6 @@ _systray_xembed_handle_request_dock(Instance_Xembed *xembed, Ecore_X_Event_Clien if (icon->win == win) return; - if (!ecore_x_window_attributes_get(win, &attr)) - { - fprintf(stderr, "SYSTRAY: could not get attributes of win %#x\n", win); - return; - } - icon = _systray_xembed_icon_add(xembed, win); if (!icon) return; @@ -811,6 +843,27 @@ systray_xembed_orient_set(Instance_Xembed *xembed, E_Gadcon_Orient orient) systray_size_updated(xembed->inst); } +static Eina_Bool +_systray_xembed_client_add(Instance_Xembed *xembed, int t EINA_UNUSED, E_Event_Client *ev) +{ + if (e_client_util_win_get(ev->ec) == xembed->win.base) + { + /* this is some bullshit. */ + xembed->ec = ev->ec; + ev->ec->internal_no_remember = ev->ec->borderless = ev->ec->visible = ev->ec->internal = 1; + ev->ec->border.changed = 1; + _xembed_win_resize(xembed); + ev->ec->icccm.take_focus = ev->ec->icccm.accepts_focus = 0; + EC_CHANGED(ev->ec); + if (eina_list_count(xembed->icons) == 0) + evas_object_hide(xembed->ec->frame); + else + evas_object_show(xembed->ec->frame); + _systray_xembed_restack(xembed); + } + return ECORE_CALLBACK_RENEW; +} + Instance_Xembed * systray_xembed_new(Instance *inst) { @@ -837,7 +890,13 @@ systray_xembed_new(Instance *inst) _systray_xembed_cb_move, xembed); evas_object_event_callback_add(ui, EVAS_CALLBACK_RESIZE, _systray_xembed_cb_resize, xembed); + if (inst->gcc->gadcon->shelf) + { + evas_object_event_callback_add(inst->gcc->gadcon->shelf->comp_object, EVAS_CALLBACK_HIDE, _systray_xembed_cb_hide, xembed); + evas_object_event_callback_add(inst->gcc->gadcon->shelf->comp_object, EVAS_CALLBACK_SHOW, _systray_xembed_cb_show, xembed); + } + xembed->handler.client = ecore_event_handler_add(E_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_systray_xembed_client_add, xembed); xembed->handler.message = ecore_event_handler_add (ECORE_X_EVENT_CLIENT_MESSAGE, _systray_xembed_cb_client_message, xembed); @@ -870,8 +929,14 @@ systray_xembed_free(Instance_Xembed *xembed) _systray_xembed_cb_move); evas_object_event_callback_del(ui, EVAS_CALLBACK_RESIZE, _systray_xembed_cb_resize); + if (xembed->inst->gcc->gadcon->shelf) + { + evas_object_event_callback_del_full(xembed->inst->gcc->gadcon->shelf->comp_object, EVAS_CALLBACK_HIDE, _systray_xembed_cb_hide, xembed); + evas_object_event_callback_del_full(xembed->inst->gcc->gadcon->shelf->comp_object, EVAS_CALLBACK_SHOW, _systray_xembed_cb_show, xembed); + } _systray_xembed_deactivate(xembed); + ecore_timer_del(xembed->visibility_timer); if (xembed->handler.message) ecore_event_handler_del(xembed->handler.message); @@ -885,6 +950,7 @@ systray_xembed_free(Instance_Xembed *xembed) ecore_event_handler_del(xembed->handler.sel_clear); if (xembed->handler.configure) ecore_event_handler_del(xembed->handler.configure); + ecore_event_handler_del(xembed->handler.client); if (xembed->timer.retry) ecore_timer_del(xembed->timer.retry); diff --git a/src/modules/tasks/e_mod_config.c b/src/modules/tasks/e_mod_config.c index be190818e..f9edde3b3 100644 --- a/src/modules/tasks/e_mod_config.c +++ b/src/modules/tasks/e_mod_config.c @@ -21,7 +21,7 @@ _config_tasks_module(Config_Item *ci) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; - E_Container *con; + E_Comp *comp; v = E_NEW(E_Config_Dialog_View, 1); @@ -30,8 +30,8 @@ _config_tasks_module(Config_Item *ci) v->basic.apply_cfdata = _basic_apply_data; v->basic.create_widgets = _basic_create_widgets; - con = e_container_current_get(e_manager_current_get()); - cfd = e_config_dialog_new(con, _("Tasks Configuration"), "Tasks", + comp = e_comp_get(NULL); + cfd = e_config_dialog_new(comp, _("Tasks Configuration"), "Tasks", "_e_modules_tasks_config_dialog", NULL, 0, v, ci); if (tasks_config->config_dialog) e_object_del(E_OBJECT(tasks_config->config_dialog)); diff --git a/src/modules/tasks/e_mod_main.c b/src/modules/tasks/e_mod_main.c index ddc009bcc..1a9dedbbd 100644 --- a/src/modules/tasks/e_mod_main.c +++ b/src/modules/tasks/e_mod_main.c @@ -34,6 +34,7 @@ struct _Tasks E_Gadcon_Client *gcc; // The gadcon client Evas_Object *o_items; // Table of items Eina_List *items; // List of items + Eina_List *clients; // List of clients E_Zone *zone; // Current Zone Config_Item *config; // Configuration int horizontal; @@ -42,7 +43,7 @@ struct _Tasks struct _Tasks_Item { Tasks *tasks; // Parent tasks - E_Border *border; // The border this item points to + E_Client *client; // The client this item points to Evas_Object *o_item; // The edje theme object Evas_Object *o_icon; // The icon Eina_Bool skip_taskbar : 1; @@ -52,14 +53,14 @@ static Tasks *_tasks_new(Evas *evas, E_Zone *zone, const char *id); static void _tasks_free(Tasks *tasks); static void _tasks_refill(Tasks *tasks); static void _tasks_refill_all(); -static void _tasks_refill_border(E_Border *border); -static void _tasks_signal_emit(E_Border *border, char *sig, char *src); +static void _tasks_refill_border(E_Client *ec); +static void _tasks_signal_emit(E_Client *ec, char *sig, char *src); -static Tasks_Item *_tasks_item_find(Tasks *tasks, E_Border *border); -static Tasks_Item *_tasks_item_new(Tasks *tasks, E_Border *border); +static Tasks_Item *_tasks_item_find(Tasks *tasks, E_Client *ec); +static Tasks_Item *_tasks_item_new(Tasks *tasks, E_Client *ec); -static int _tasks_item_check_add(Tasks *tasks, E_Border *border); -static void _tasks_item_add(Tasks *tasks, E_Border *border); +static int _tasks_item_check_add(Tasks *tasks, E_Client *ec); +static void _tasks_item_add(Tasks *tasks, E_Client *ec); static void _tasks_item_remove(Tasks_Item *item); static void _tasks_item_refill(Tasks_Item *item); static void _tasks_item_fill(Tasks_Item *item); @@ -73,18 +74,18 @@ static void _tasks_cb_item_mouse_down(void *data, Evas *e, Evas_Object * static void _tasks_cb_item_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _tasks_cb_item_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); -static Eina_Bool _tasks_cb_event_border_add(void *data, int type, void *event); -static Eina_Bool _tasks_cb_event_border_remove(void *data, int type, void *event); -static Eina_Bool _tasks_cb_event_border_iconify(void *data, int type, void *event); -static Eina_Bool _tasks_cb_event_border_uniconify(void *data, int type, void *event); -static Eina_Bool _tasks_cb_event_border_icon_change(void *data, int type, void *event); -static Eina_Bool _tasks_cb_event_border_title_change(void *data, int type, void *event); -static Eina_Bool _tasks_cb_event_border_zone_set(void *data, int type, void *event); -static Eina_Bool _tasks_cb_event_border_desk_set(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_add(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_remove(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_iconify(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_uniconify(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_icon_change(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_title_change(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_zone_set(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_desk_set(void *data, int type, void *event); static Eina_Bool _tasks_cb_window_focus_in(void *data, int type, void *event); static Eina_Bool _tasks_cb_window_focus_out(void *data, int type, void *event); static Eina_Bool _tasks_cb_event_desk_show(void *data, int type, void *event); -static Eina_Bool _tasks_cb_event_border_urgent_change(void *data, int type, void *event); +static Eina_Bool _tasks_cb_event_client_urgent_change(void *data, int type, void *event); static E_Config_DD *conf_edd = NULL; static E_Config_DD *conf_item_edd = NULL; @@ -139,44 +140,18 @@ e_modapi_init(E_Module *m) tasks_config->module = m; - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_ADD, _tasks_cb_event_border_add, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_REMOVE, _tasks_cb_event_border_remove, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_ICONIFY, _tasks_cb_event_border_iconify, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_UNICONIFY, _tasks_cb_event_border_uniconify, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_ICON_CHANGE, _tasks_cb_event_border_icon_change, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_DESK_SET, _tasks_cb_event_border_desk_set, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_ZONE_SET, _tasks_cb_event_border_zone_set, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_FOCUS_IN, _tasks_cb_window_focus_in, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_FOCUS_OUT, _tasks_cb_window_focus_out, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_TITLE_CHANGE, _tasks_cb_event_border_title_change, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_DESK_SHOW, _tasks_cb_event_desk_show, NULL)); - tasks_config->handlers = eina_list_append - (tasks_config->handlers, ecore_event_handler_add - (E_EVENT_BORDER_URGENT_CHANGE, _tasks_cb_event_border_urgent_change, NULL)); - - tasks_config->borders = eina_list_clone(e_border_client_list()); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_ADD, _tasks_cb_event_client_add, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_REMOVE, _tasks_cb_event_client_remove, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_ICONIFY, _tasks_cb_event_client_iconify, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_UNICONIFY, _tasks_cb_event_client_uniconify, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_PROPERTY, _tasks_cb_event_client_icon_change, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_DESK_SET, _tasks_cb_event_client_desk_set, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_ZONE_SET, _tasks_cb_event_client_zone_set, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_FOCUS_IN, _tasks_cb_window_focus_in, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_FOCUS_OUT, _tasks_cb_window_focus_out, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_PROPERTY, _tasks_cb_event_client_title_change, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_DESK_SHOW, _tasks_cb_event_desk_show, NULL); + E_LIST_HANDLER_APPEND(tasks_config->handlers, E_EVENT_CLIENT_PROPERTY, _tasks_cb_event_client_urgent_change, NULL); e_gadcon_provider_register(&_gadcon_class); return m; @@ -210,8 +185,6 @@ e_modapi_shutdown(E_Module *m __UNUSED__) ecore_event_handler_del(eh); } - eina_list_free(tasks_config->borders); - free(tasks_config); tasks_config = NULL; E_CONFIG_DD_FREE(conf_item_edd); @@ -226,6 +199,17 @@ e_modapi_save(E_Module *m __UNUSED__) return 1; } +static Tasks * +_tasks_find(E_Comp *comp) +{ + Tasks *tasks; + Eina_List *l; + + EINA_LIST_FOREACH(tasks_config->tasks, l, tasks) + if (tasks->zone->comp == comp) return tasks; + return NULL; +} + /**************************************************************/ static E_Gadcon_Client * @@ -346,11 +330,18 @@ static Tasks * _tasks_new(Evas *evas, E_Zone *zone, const char *id) { Tasks *tasks; + Eina_List *l; + E_Client *ec; tasks = E_NEW(Tasks, 1); tasks->config = _tasks_config_item_get(id); tasks->o_items = e_box_add(evas); tasks->horizontal = 1; + EINA_LIST_FOREACH(zone->comp->clients, l, ec) + { + if (!e_client_util_ignored_get(ec)) + tasks->clients = eina_list_append(tasks->clients, ec); + } e_box_homogenous_set(tasks->o_items, 1); e_box_orientation_set(tasks->o_items, tasks->horizontal); @@ -365,6 +356,7 @@ _tasks_free(Tasks *tasks) Tasks_Item *item; EINA_LIST_FREE(tasks->items, item) _tasks_item_free(item); + eina_list_free(tasks->clients); evas_object_del(tasks->o_items); free(tasks); } @@ -373,7 +365,7 @@ static void _tasks_refill(Tasks *tasks) { Eina_List *l; - E_Border *border; + E_Client *ec; Tasks_Item *item; Evas_Coord w, h; @@ -382,9 +374,9 @@ _tasks_refill(Tasks *tasks) item = tasks->items->data; _tasks_item_remove(item); } - EINA_LIST_FOREACH(tasks_config->borders, l, border) + EINA_LIST_FOREACH(tasks->clients, l, ec) { - _tasks_item_check_add(tasks, border); + _tasks_item_check_add(tasks, ec); } if (tasks->items) { @@ -430,7 +422,7 @@ _tasks_refill_all(void) } static void -_tasks_refill_border(E_Border *border) +_tasks_refill_border(E_Client *ec) { const Eina_List *l; Tasks *tasks; @@ -442,7 +434,7 @@ _tasks_refill_border(E_Border *border) Tasks_Item *item; EINA_LIST_FOREACH(tasks->items, m, item) { - if (item->border == border) + if (item->client == ec) { _tasks_item_refill(item); found = EINA_TRUE; @@ -454,7 +446,7 @@ _tasks_refill_border(E_Border *border) } static void -_tasks_signal_emit(E_Border *border, char *sig, char *src) +_tasks_signal_emit(E_Client *ec, char *sig, char *src) { const Eina_List *l; Tasks *tasks; @@ -466,35 +458,35 @@ _tasks_signal_emit(E_Border *border, char *sig, char *src) EINA_LIST_FOREACH(tasks->items, m, item) { - if (item->border == border) + if (item->client == ec) _tasks_item_signal_emit(item, sig, src); } } } static Tasks_Item * -_tasks_item_find(Tasks *tasks, E_Border *border) +_tasks_item_find(Tasks *tasks, E_Client *ec) { const Eina_List *l; Tasks_Item *item; EINA_LIST_FOREACH(tasks->items, l, item) { - if (item->border == border) return item; + if (item->client == ec) return item; } return NULL; } static Tasks_Item * -_tasks_item_new(Tasks *tasks, E_Border *border) +_tasks_item_new(Tasks *tasks, E_Client *ec) { Tasks_Item *item; item = E_NEW(Tasks_Item, 1); - e_object_ref(E_OBJECT(border)); + e_object_ref(E_OBJECT(ec)); item->tasks = tasks; - item->border = border; - item->skip_taskbar = border->client.netwm.state.skip_taskbar; + item->client = ec; + item->skip_taskbar = ec->netwm.state.skip_taskbar; item->o_item = edje_object_add(evas_object_evas_get(tasks->o_items)); if (tasks->horizontal) e_theme_edje_object_set(item->o_item, @@ -532,29 +524,29 @@ _tasks_item_new(Tasks *tasks, E_Border *border) } static int -_tasks_item_check_add(Tasks *tasks, E_Border *border) +_tasks_item_check_add(Tasks *tasks, E_Client *ec) { - if (border->user_skip_winlist) return 1; - if (border->client.netwm.state.skip_taskbar) return 1; - if (_tasks_item_find(tasks, border)) return 1; + if (ec->user_skip_winlist) return 1; + if (ec->netwm.state.skip_taskbar) return 1; + if (_tasks_item_find(tasks, ec)) return 1; if (!tasks->config) return 1; if (!(tasks->config->show_all)) { - if (border->zone != tasks->zone) return 1; - if ((border->desk != e_desk_current_get(border->zone)) && - (!border->sticky)) + if (ec->zone != tasks->zone) return 1; + if ((ec->desk != e_desk_current_get(ec->zone)) && + (!ec->sticky)) return 1; } - _tasks_item_add(tasks, border); + _tasks_item_add(tasks, ec); return 0; } static void -_tasks_item_add(Tasks *tasks, E_Border *border) +_tasks_item_add(Tasks *tasks, E_Client *ec) { Tasks_Item *item; - item = _tasks_item_new(tasks, border); + item = _tasks_item_new(tasks, ec); e_box_pack_end(tasks->o_items, item->o_item); e_box_pack_options_set(item->o_item, 1, 1, /* fill */ @@ -578,7 +570,7 @@ static void _tasks_item_free(Tasks_Item *item) { if (item->o_icon) evas_object_del(item->o_icon); - e_object_unref(E_OBJECT(item->border)); + e_object_unref(E_OBJECT(item->client)); evas_object_del(item->o_item); free(item); } @@ -586,7 +578,7 @@ _tasks_item_free(Tasks_Item *item) static void _tasks_item_refill(Tasks_Item *item) { - if (item->border->client.netwm.state.skip_taskbar != item->skip_taskbar) + if (item->client->netwm.state.skip_taskbar != item->skip_taskbar) { _tasks_refill(item->tasks); return; @@ -604,7 +596,7 @@ _tasks_item_fill(Tasks_Item *item) item->o_icon = NULL; else { - item->o_icon = e_border_icon_add(item->border, evas_object_evas_get(item->tasks->o_items)); + item->o_icon = e_client_icon_add(item->client, evas_object_evas_get(item->tasks->o_items)); edje_object_part_swallow(item->o_item, "e.swallow.icon", item->o_icon); evas_object_pass_events_set(item->o_icon, 1); evas_object_show(item->o_icon); @@ -613,18 +605,18 @@ _tasks_item_fill(Tasks_Item *item) if (item->tasks->config->icon_only) label = ""; else - label = e_border_name_get(item->border); + label = e_client_name_get(item->client); edje_object_part_text_set(item->o_item, "e.text.label", label); - if (item->border->iconic) + if (item->client->iconic) _tasks_item_signal_emit(item, "e,state,iconified", "e"); else _tasks_item_signal_emit(item, "e,state,uniconified", "e"); - if (item->border->focused) + if (item->client->focused) _tasks_item_signal_emit(item, "e,state,focused", "e"); else _tasks_item_signal_emit(item, "e,state,unfocused", "e"); - if (item->border->client.icccm.urgent && !item->border->focused) + if (item->client->icccm.urgent && !item->client->focused) _tasks_item_signal_emit(item, "e,state,urgent", "e"); else _tasks_item_signal_emit(item, "e,state,not_urgent", "e"); @@ -718,9 +710,9 @@ _tasks_cb_item_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU e_gadcon_canvas_zone_geometry_get(item->tasks->gcc->gadcon, &cx, &cy, &cw, &ch); - e_int_border_menu_create(item->border); + e_int_client_menu_create(item->client); - mi = e_menu_item_new(item->border->border_menu); + mi = e_menu_item_new(item->client->border_menu); e_menu_item_separator_set(mi, 1); m = e_menu_new(); @@ -731,21 +723,21 @@ _tasks_cb_item_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU m = e_gadcon_client_util_menu_items_append(item->tasks->gcc, m, 0); - mi = e_menu_item_new(item->border->border_menu); + mi = e_menu_item_new(item->client->border_menu); e_menu_item_label_set(mi, _("Tasks")); e_menu_item_submenu_set(mi, m); e_object_unref(E_OBJECT(m)); e_util_menu_item_theme_icon_set(mi, "preferences-system"); - e_gadcon_client_menu_set(item->tasks->gcc, item->border->border_menu); + e_gadcon_client_menu_set(item->tasks->gcc, item->client->border_menu); - e_menu_activate_mouse(item->border->border_menu, + e_menu_activate_mouse(item->client->border_menu, e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); evas_event_feed_mouse_up(item->tasks->gcc->gadcon->evas, ev->button, EVAS_BUTTON_NONE, ev->timestamp, NULL); /* gadcon menu post cb won't remove this so we'll do it now to prevent problems later */ - item->border->border_menu = NULL; + item->client->border_menu = NULL; } } @@ -760,14 +752,14 @@ _tasks_cb_item_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UN if (ev->z < 0) { - if (item->border->iconic) - e_border_uniconify(item->border); + if (item->client->iconic) + e_client_uniconify(item->client); else - e_border_raise(item->border); - e_border_focus_set(item->border, 1, 1); + evas_object_raise(item->client->frame); + evas_object_focus_set(item->client->frame, 1); } else if (ev->z > 0) - e_border_iconify(item->border); + e_client_iconify(item->client); } static void @@ -780,178 +772,170 @@ _tasks_cb_item_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE item = data; if (ev->button == 1) { - if (!item->border->sticky && item->tasks->config->show_all) - e_desk_show(item->border->desk); + if (!item->client->sticky && item->tasks->config->show_all) + e_desk_show(item->client->desk); if (evas_key_modifier_is_set(ev->modifiers, "Alt")) { - if (item->border->iconic) - e_border_uniconify(item->border); + if (item->client->iconic) + e_client_uniconify(item->client); else - e_border_iconify(item->border); + e_client_iconify(item->client); } else if (evas_key_modifier_is_set(ev->modifiers, "Control")) { - if (item->border->maximized) - e_border_unmaximize(item->border, e_config->maximize_policy); + if (item->client->maximized) + e_client_unmaximize(item->client, e_config->maximize_policy); else - e_border_maximize(item->border, e_config->maximize_policy); + e_client_maximize(item->client, e_config->maximize_policy); } else if (evas_key_modifier_is_set(ev->modifiers, "Shift")) { - if (item->border->shaded) - e_border_unshade(item->border, item->border->shade.dir); + if (item->client->shaded) + e_client_unshade(item->client, item->client->shade_dir); else - e_border_shade(item->border, item->border->shade.dir); + e_client_shade(item->client, item->client->shade_dir); } else if (evas_key_modifier_is_set(ev->modifiers, "Super")) { - e_border_act_close_begin(item->border); + e_client_act_close_begin(item->client); } else { - if (item->border->iconic) + if (item->client->iconic) { - e_border_uniconify(item->border); - e_border_focus_set(item->border, 1, 1); + e_client_uniconify(item->client); + evas_object_focus_set(item->client->frame, 1); } else { - if (item->border->focused) + if (item->client->focused) { - e_border_iconify(item->border); + e_client_iconify(item->client); } else { - e_border_raise(item->border); - e_border_focus_set(item->border, 1, 1); + evas_object_raise(item->client->frame); + evas_object_focus_set(item->client->frame, 1); } } } } else if (ev->button == 2) { - if (!item->border->sticky && item->tasks->config->show_all) - e_desk_show(item->border->desk); - e_border_raise(item->border); - e_border_focus_set(item->border, 1, 1); - if (item->border->maximized) - e_border_unmaximize(item->border, e_config->maximize_policy); + if (!item->client->sticky && item->tasks->config->show_all) + e_desk_show(item->client->desk); + evas_object_raise(item->client->frame); + evas_object_focus_set(item->client->frame, 1); + if (item->client->maximized) + e_client_unmaximize(item->client, e_config->maximize_policy); else - e_border_maximize(item->border, e_config->maximize_policy); + e_client_maximize(item->client, e_config->maximize_policy); } } /************ BORDER CALLBACKS *********************/ static Eina_Bool -_tasks_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *event) +_tasks_cb_event_client_add(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Add *ev = event; + E_Event_Client *ev = event; + Tasks *tasks = _tasks_find(ev->ec->comp); - if ((!tasks_config->borders) || (!eina_list_data_find(tasks_config->borders, ev->border))) + if ((!tasks) || (e_client_util_ignored_get(ev->ec))) return ECORE_CALLBACK_RENEW; + if ((!tasks->clients) || (!eina_list_data_find(tasks->clients, ev->ec))) { - tasks_config->borders = eina_list_append(tasks_config->borders, ev->border); + tasks->clients = eina_list_append(tasks->clients, ev->ec); _tasks_refill_all(); } return EINA_TRUE; } static Eina_Bool -_tasks_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event) +_tasks_cb_event_client_remove(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev; + E_Event_Client *ev = event; + Tasks *tasks = _tasks_find(ev->ec->comp); - ev = event; - tasks_config->borders = eina_list_remove(tasks_config->borders, ev->border); + if ((!tasks) || (e_client_util_ignored_get(ev->ec))) return ECORE_CALLBACK_RENEW; + tasks->clients = eina_list_remove(tasks->clients, ev->ec); _tasks_refill_all(); return EINA_TRUE; } static Eina_Bool -_tasks_cb_event_border_iconify(void *data __UNUSED__, int type __UNUSED__, void *event) +_tasks_cb_event_client_iconify(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Iconify *ev; - - ev = event; - _tasks_signal_emit(ev->border, "e,state,iconified", "e"); + E_Event_Client *ev = event; + _tasks_signal_emit(ev->ec, "e,state,iconified", "e"); return EINA_TRUE; } static Eina_Bool -_tasks_cb_event_border_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event) +_tasks_cb_event_client_uniconify(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Uniconify *ev; - - ev = event; - _tasks_signal_emit(ev->border, "e,state,uniconified", "e"); + E_Event_Client *ev = event; + _tasks_signal_emit(ev->ec, "e,state,uniconified", "e"); return EINA_TRUE; } static Eina_Bool _tasks_cb_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_In *ev; - - ev = event; - _tasks_signal_emit(ev->border, "e,state,focused", "e"); + E_Event_Client *ev = event; + _tasks_signal_emit(ev->ec, "e,state,focused", "e"); return EINA_TRUE; } static Eina_Bool _tasks_cb_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Focus_Out *ev; - - ev = event; - _tasks_signal_emit(ev->border, "e,state,unfocused", "e"); + E_Event_Client *ev = event; + _tasks_signal_emit(ev->ec, "e,state,unfocused", "e"); return EINA_TRUE; } static Eina_Bool -_tasks_cb_event_border_urgent_change(void *data __UNUSED__, int type __UNUSED__, void *event) +_tasks_cb_event_client_urgent_change(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Urgent_Change *ev = event; + E_Event_Client_Property *ev = event; - if (ev->border->client.icccm.urgent) - _tasks_signal_emit(ev->border, "e,state,urgent", "e"); + if (!(ev->property & E_CLIENT_PROPERTY_URGENCY)) return ECORE_CALLBACK_RENEW; + if (ev->ec->icccm.urgent && (!ev->ec->focused)) + _tasks_signal_emit(ev->ec, "e,state,urgent", "e"); else - _tasks_signal_emit(ev->border, "e,state,not_urgent", "e"); + _tasks_signal_emit(ev->ec, "e,state,not_urgent", "e"); return EINA_TRUE; } static Eina_Bool -_tasks_cb_event_border_title_change(void *data __UNUSED__, int type __UNUSED__, void *event) +_tasks_cb_event_client_title_change(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Title_Change *ev; - E_Border *border; + E_Event_Client_Property *ev = event; - ev = event; - border = ev->border; - if (border) _tasks_refill_border(border); + if (!(ev->property & E_CLIENT_PROPERTY_TITLE)) return ECORE_CALLBACK_RENEW; + _tasks_refill_border(ev->ec); return EINA_TRUE; } static Eina_Bool -_tasks_cb_event_border_icon_change(void *data __UNUSED__, int type __UNUSED__, void *event) +_tasks_cb_event_client_icon_change(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Icon_Change *ev; - E_Border *border; + E_Event_Client_Property *ev = event; - ev = event; - border = ev->border; - if (border) _tasks_refill_border(border); + if (!(ev->property & E_CLIENT_PROPERTY_ICON)) return ECORE_CALLBACK_RENEW; + _tasks_refill_border(ev->ec); return EINA_TRUE; } static Eina_Bool -_tasks_cb_event_border_zone_set(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +_tasks_cb_event_client_zone_set(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) { _tasks_refill_all(); return EINA_TRUE; } static Eina_Bool -_tasks_cb_event_border_desk_set(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +_tasks_cb_event_client_desk_set(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) { _tasks_refill_all(); return EINA_TRUE; diff --git a/src/modules/tasks/e_mod_main.h b/src/modules/tasks/e_mod_main.h index be956fc06..caead1b9e 100644 --- a/src/modules/tasks/e_mod_main.h +++ b/src/modules/tasks/e_mod_main.h @@ -8,7 +8,7 @@ struct _Config { E_Module *module; Eina_List *tasks; - Eina_List *borders; + Eina_List *clients; Eina_List *items; E_Menu *menu; Eina_List *handlers; diff --git a/src/modules/teamwork/e_mod_config.c b/src/modules/teamwork/e_mod_config.c index d50c4d45a..d4971dcfb 100644 --- a/src/modules/teamwork/e_mod_config.c +++ b/src/modules/teamwork/e_mod_config.c @@ -150,7 +150,7 @@ _basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED, } EINTERN E_Config_Dialog * -e_int_config_teamwork_module(E_Container *con, const char *params EINA_UNUSED) +e_int_config_teamwork_module(E_Comp *comp, const char *params EINA_UNUSED) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -166,7 +166,7 @@ e_int_config_teamwork_module(E_Container *con, const char *params EINA_UNUSED) v->basic.create_widgets = _basic_create_widgets; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Teamwork Settings"), + cfd = e_config_dialog_new(comp, _("Teamwork Settings"), "E", "applications/teamwork", buf, 32, v, tw_mod); tw_mod->cfd = cfd; return cfd; diff --git a/src/modules/teamwork/e_mod_main.h b/src/modules/teamwork/e_mod_main.h index 88eb9ad67..01a7ca27c 100644 --- a/src/modules/teamwork/e_mod_main.h +++ b/src/modules/teamwork/e_mod_main.h @@ -39,7 +39,7 @@ typedef struct Mod size_t media_size; Eina_Inlist *media_list; Eina_Hash *media; - E_Popup *pop; + Evas_Object *pop; Eina_Bool sticky : 1; Eina_Bool force : 1; Eina_Bool hidden : 1; @@ -57,7 +57,7 @@ EINTERN Eina_Bool tw_hide(void *d EINA_UNUSED); EINTERN void tw_popup_opacity_set(void); EINTERN void tw_uri_show(const char *uri); -EINTERN E_Config_Dialog *e_int_config_teamwork_module(E_Container *con, const char *params EINA_UNUSED); +EINTERN E_Config_Dialog *e_int_config_teamwork_module(E_Comp *comp, const char *params EINA_UNUSED); EAPI int e_modapi_shutdown(E_Module *m __UNUSED__); #undef DBG diff --git a/src/modules/teamwork/e_mod_tw.c b/src/modules/teamwork/e_mod_tw.c index d2244527b..af6875194 100644 --- a/src/modules/teamwork/e_mod_tw.c +++ b/src/modules/teamwork/e_mod_tw.c @@ -373,7 +373,7 @@ dbus_link_show_helper(const char *uri, Eina_Bool signal_open) { Teamwork_Link_Type type; - if (tw_mod->pop && (!e_util_strcmp(e_object_data_get(E_OBJECT(tw_mod->pop)), uri))) return; + if (tw_mod->pop && (!e_util_strcmp(evas_object_data_get(tw_mod->pop, "uri"), uri))) return; type = dbus_link_uri_type_get(uri); switch (type) { @@ -428,7 +428,7 @@ dbus_link_hide_cb(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbu if (eldbus_message_arguments_get(msg, "s", &uri)) { - if (tw_mod->pop && (!tw_mod->sticky) && (!e_util_strcmp(e_object_data_get(E_OBJECT(tw_mod->pop)), uri))) + if (tw_mod->pop && (!tw_mod->sticky) && (!e_util_strcmp(evas_object_data_get(tw_mod->pop, "uri"), uri))) { tw_hide(NULL); tw_mod->force = 0; @@ -463,10 +463,8 @@ dbus_link_mouse_out_cb(const Eldbus_Service_Interface *iface EINA_UNUSED, const if (eldbus_message_arguments_get(msg, "suxii", &uri, &t, &win, &last_coords.x, &last_coords.y)) { if (tw_mod->pop && (!tw_mod->sticky) && - ( - (tw_tmpfile && (!e_util_strcmp(e_object_data_get(E_OBJECT(tw_mod->pop)), tw_tmpfile))) || - (!e_util_strcmp(e_object_data_get(E_OBJECT(tw_mod->pop)), uri)) - )) + ((tw_tmpfile && (!e_util_strcmp(evas_object_data_get(tw_mod->pop, "uri"), tw_tmpfile))) || + (!e_util_strcmp(evas_object_data_get(tw_mod->pop, "uri"), uri)))) { if (tw_config->mouse_out_delay) { @@ -758,16 +756,17 @@ tw_idler_start(void) } static void -tw_popup_del(void *obj) +tw_popup_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { - eina_stringshare_del(e_object_data_get(obj)); + eina_stringshare_del(evas_object_data_get(obj, "uri")); } EINTERN void tw_popup_opacity_set(void) { - if (tw_mod->pop && tw_mod->pop->cw) - e_comp_win_opacity_set(tw_mod->pop->cw, lround((double)255 * (tw_config->popup_opacity / 100.))); + int c = lround((double)255 * (tw_config->popup_opacity / 100.)); + if (tw_mod->pop) + evas_object_color_set(tw_mod->pop, c, c, c, c); } static void @@ -775,46 +774,51 @@ tw_show_helper(Evas_Object *o, int w, int h) { int px, py, pw, ph; double ratio = tw_config->popup_size / 100.; - E_Border *bd = NULL; + E_Client *ec = NULL; + E_Zone *zone = e_zone_current_get(e_util_comp_current_get()); - E_FREE_FUNC(tw_mod->pop, e_object_del); + evas_object_hide(tw_mod->pop); + evas_object_del(tw_mod->pop); tw_mod->sticky = 0; - tw_mod->pop = e_popup_new(e_zone_current_get(e_util_container_current_get()), 0, 0, 1, 1); - e_popup_ignore_events_set(tw_mod->pop, 1); - pw = MIN(w, (ratio * (double)tw_mod->pop->zone->w)); - pw = MIN(pw, tw_mod->pop->zone->w); + tw_mod->pop = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_POPUP); + evas_object_pass_events_set(tw_mod->pop, 1); + pw = MIN(w, (ratio * (double)zone->w)); + pw = MIN(pw, zone->w); if (pw == w) ph = h; else ph = lround((double)(pw * h) / ((double)w)); - if (ph > tw_mod->pop->zone->h) + if (ph > zone->h) { - ph = tw_mod->pop->zone->h; + ph = zone->h; pw = lround((double)(ph * w) / ((double)h)); } e_livethumb_vsize_set(o, pw, ph); - e_popup_layer_set(tw_mod->pop, E_COMP_CANVAS_LAYER_POPUP, 0); + evas_object_layer_set(tw_mod->pop, E_LAYER_POPUP); + evas_object_resize(tw_mod->pop, pw, ph); if ((!tw_win) && (last_coords.x == last_coords.y) && (last_coords.x == -1)) { - px = lround(ratio * (double)tw_mod->pop->zone->w) - (pw / 2); - py = lround(ratio * (double)tw_mod->pop->zone->h) - (ph / 2); - if (px + pw > tw_mod->pop->zone->w) - px = tw_mod->pop->zone->w - pw; - if (py + ph > tw_mod->pop->zone->h) - py = tw_mod->pop->zone->h - ph; + px = lround(ratio * (double)zone->w) - (pw / 2); + py = lround(ratio * (double)zone->h) - (ph / 2); + if (px + pw > zone->w) + px = zone->w - pw; + if (py + ph > zone->h) + py = zone->h - ph; + evas_object_move(tw_mod->pop, px, py); } - else if (tw_win && ((bd = e_border_find_by_client_window(tw_win)))) + else if (tw_win && (((ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, tw_win))) || + ((ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, tw_win))))) { int x, y; - x = bd->x + bd->client_inset.l + last_coords.x; - y = bd->y + bd->client_inset.t + last_coords.y; + x = ec->client.x + last_coords.x; + y = ec->client.y + last_coords.y; /* prefer tooltip left of last_coords */ px = x - pw - 3; /* if it's offscreen, try right of last_coords */ if (px < 0) px = x + 3; /* fuck this, stick it right on the last_coords */ - if (px + pw + 3 > tw_mod->pop->zone->w) + if (px + pw + 3 > zone->w) px = (x / 2) - (pw / 2); /* give up */ if (px < 0) px = 0; @@ -824,21 +828,19 @@ tw_show_helper(Evas_Object *o, int w, int h) /* if it's offscreen, try below last_coords */ if (py < 0) py = y + 3; /* fuck this, stick it right on the last_coords */ - if (py + ph + 3 > tw_mod->pop->zone->h) + if (py + ph + 3 > zone->h) py = (y / 2) - (ph / 2); /* give up */ if (py < 0) py = 0; + evas_object_move(tw_mod->pop, px, py); } else { - px = (tw_mod->pop->zone->w / 2) - (pw / 2); - py = (tw_mod->pop->zone->h / 2) - (pw / 2); + e_comp_object_util_center(tw_mod->pop); } - e_popup_move_resize(tw_mod->pop, px, py, pw, ph); - e_popup_content_set(tw_mod->pop, o); - e_popup_show(tw_mod->pop); + evas_object_show(tw_mod->pop); tw_popup_opacity_set(); - E_OBJECT_DEL_SET(tw_mod->pop, tw_popup_del); + evas_object_event_callback_add(tw_mod->pop, EVAS_CALLBACK_DEL, tw_popup_del, NULL); } static Eina_Bool @@ -872,7 +874,7 @@ tw_video_opened_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } emotion_object_size_get(obj, &iw, &ih); - zone = e_zone_current_get(e_util_container_current_get()); + zone = e_zone_current_get(e_util_comp_current_get()); w = MIN(zone->w, (ratio * (double)zone->w)); ratio = emotion_object_ratio_get(obj); if (ratio > 0.0) iw = (ih * ratio) + 0.5; @@ -882,8 +884,8 @@ tw_video_opened_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) h = (w * ih) / iw; e_livethumb_thumb_set(data, obj); tw_show_helper(data, w, h); - e_popup_object_add(tw_mod->pop, obj); - e_object_data_set(E_OBJECT(tw_mod->pop), eina_stringshare_add(emotion_object_file_get(obj))); + e_comp_object_util_del_list_append(tw_mod->pop, obj); + evas_object_data_set(tw_mod->pop, "uri", eina_stringshare_add(emotion_object_file_get(obj))); evas_object_smart_callback_del_full(obj, "frame_decode", tw_video_opened_cb, data); } @@ -1065,8 +1067,8 @@ tw_show(Media *i) } e_livethumb_thumb_set(prev, ic); tw_show_helper(prev, w, h); - e_object_data_set(E_OBJECT(tw_mod->pop), eina_stringshare_ref(i->addr)); - e_popup_object_add(tw_mod->pop, ic); + evas_object_data_set(tw_mod->pop, "uri", eina_stringshare_ref(i->addr)); + e_comp_object_util_del_list_append(tw_mod->pop, ic); } static void @@ -1109,8 +1111,7 @@ tw_show_local_file(const char *uri) } e_livethumb_thumb_set(prev, o); tw_show_helper(prev, w, h); - e_popup_object_add(tw_mod->pop, o); - e_object_data_set(E_OBJECT(tw_mod->pop), eina_stringshare_add(uri)); + evas_object_data_set(tw_mod->pop, "uri", eina_stringshare_add(uri)); } static void @@ -1128,14 +1129,14 @@ tw_handler_hide(void) } static Eina_Bool -desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Border_Focus_Out *ev EINA_UNUSED) +desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Desk_Show *ev EINA_UNUSED) { if (tw_mod->pop) tw_handler_hide(); return ECORE_CALLBACK_RENEW; } static Eina_Bool -focus_out(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Border_Focus_Out *ev EINA_UNUSED) +focus_out(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client *ev EINA_UNUSED) { if (e_config->focus_policy == E_FOCUS_CLICK) return ECORE_CALLBACK_RENEW; if (tw_mod->pop) tw_handler_hide(); @@ -1158,7 +1159,8 @@ tw_hide(void *d EINA_UNUSED) } eina_stringshare_replace(&tw_tmpfile, NULL); tw_win = 0; - E_FREE_FUNC(tw_mod->pop, e_object_del); + evas_object_hide(tw_mod->pop); + E_FREE_FUNC(tw_mod->pop, evas_object_del); last_coords.x = last_coords.y = 0; E_FREE_FUNC(tw_hide_timer, ecore_timer_del); download_media_cleanup(); @@ -1211,7 +1213,7 @@ e_tw_init(void) E_LIST_HANDLER_APPEND(handlers, ECORE_CON_EVENT_URL_COMPLETE, download_media_complete, tw_mod); E_LIST_HANDLER_APPEND(handlers, ECORE_CON_EVENT_URL_PROGRESS, download_media_status, tw_mod); E_LIST_HANDLER_APPEND(handlers, ECORE_CON_EVENT_URL_DATA, download_media_data, tw_mod); - E_LIST_HANDLER_APPEND(handlers, E_EVENT_BORDER_FOCUS_OUT, focus_out, tw_mod); + E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_FOCUS_OUT, focus_out, tw_mod); E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_SHOW, desk_show, tw_mod); tw_mod->media = eina_hash_string_superfast_new((Eina_Free_Cb)download_media_free); @@ -1256,7 +1258,8 @@ e_tw_shutdown(void) tw_hide(NULL); last_coords.x = last_coords.y = 0; eina_hash_free(tw_mod->media); - E_FREE_FUNC(tw_mod->pop, e_object_del); + evas_object_hide(tw_mod->pop); + E_FREE_FUNC(tw_mod->pop, evas_object_del); } EINTERN void diff --git a/src/modules/temperature/e_mod_config.c b/src/modules/temperature/e_mod_config.c index df6e936b5..90b4922ff 100644 --- a/src/modules/temperature/e_mod_config.c +++ b/src/modules/temperature/e_mod_config.c @@ -52,7 +52,7 @@ config_temperature_module(Config_Face *inst) snprintf(buff, sizeof(buff), "%s/e-module-temperature.edj", inst->module->dir); inst->config_dialog = - e_config_dialog_new(e_container_current_get(e_manager_current_get()), + e_config_dialog_new(NULL, _("Temperature Settings"), "E", "_e_mod_temperature_config_dialog", buff, 0, v, inst); } diff --git a/src/modules/tiling/e_mod_config.c b/src/modules/tiling/e_mod_config.c index 068232104..a9c6adf8e 100644 --- a/src/modules/tiling/e_mod_config.c +++ b/src/modules/tiling/e_mod_config.c @@ -168,11 +168,11 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { Evas_Object *o, *oc, *of; - E_Container *con; + E_Comp *comp; E_Zone *zone; Eina_List *l; - con = e_container_current_get(e_manager_current_get()); + comp = e_comp_get(NULL); o = e_widget_list_add(evas, 0, 0); @@ -207,7 +207,7 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, e_widget_ilist_multi_select_set(cfdata->o_zonelist, false); e_widget_size_min_set(cfdata->o_zonelist, 100, 100); e_widget_on_change_hook_set(cfdata->o_zonelist, _cb_zone_change, cfdata); - for (l = con->zones; l; l = l->next) { + for (l = comp->zones; l; l = l->next) { if (!(zone = l->data)) continue; e_widget_ilist_append(cfdata->o_zonelist, NULL, zone->name, NULL, zone, NULL); @@ -220,7 +220,7 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, /* List of individual tiling modes */ cfdata->evas = evas; - _fill_zone_config(eina_list_data_get(con->zones), cfdata); + _fill_zone_config(eina_list_data_get(comp->zones), cfdata); e_widget_ilist_selected_set(cfdata->o_zonelist, 0); @@ -331,7 +331,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, } E_Config_Dialog * -e_int_config_tiling_module(E_Container *con, +e_int_config_tiling_module(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; @@ -350,7 +350,7 @@ e_int_config_tiling_module(E_Container *con, snprintf(buf, sizeof(buf), "%s/e-module-tiling.edj", e_module_dir_get(tiling_g.module)); - cfd = e_config_dialog_new(con, + cfd = e_config_dialog_new(comp, _("Tiling Configuration"), "E", "windows/tiling", buf, 0, v, NULL); diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index 4e0c02a02..c5a3cf76a 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -33,7 +33,7 @@ typedef struct geom_t { } geom_t; typedef struct overlay_t { - E_Popup *popup; + Evas_Object *popup; Evas_Object *obj; } overlay_t; @@ -41,11 +41,11 @@ typedef struct transition_overlay_t { overlay_t overlay; int stack; char key[4]; - E_Border *bd; + E_Client *ec; } transition_overlay_t; -typedef struct Border_Extra { - E_Border *border; +typedef struct Client_Extra { + E_Client *client; geom_t expected; struct { geom_t geom; @@ -56,7 +56,7 @@ typedef struct Border_Extra { } orig; overlay_t overlay; char key[4]; -} Border_Extra; +} Client_Extra; struct tiling_g tiling_g = { .module = NULL, @@ -66,7 +66,7 @@ struct tiling_g tiling_g = { }; static void -_add_border(E_Border *bd); +_add_client(E_Client *ec); /* }}} */ /* Globals {{{ */ @@ -79,23 +79,23 @@ static struct tiling_mod_main_g int currently_switching_desktop; Ecore_X_Window action_input_win; Ecore_Event_Handler *handler_key, - *handler_border_resize, - *handler_border_move, - *handler_border_add, - *handler_border_remove, - *handler_border_iconify, - *handler_border_uniconify, - *handler_border_stick, - *handler_border_unstick, + *handler_client_resize, + *handler_client_move, + *handler_client_add, + *handler_client_remove, + *handler_client_iconify, + *handler_client_uniconify, + *handler_client_stick, + *handler_client_unstick, *handler_desk_show, *handler_desk_before_show, *handler_desk_set, - *handler_container_resize; - E_Border_Hook *pre_border_assign_hook; + *handler_compositor_resize; + E_Client_Hook *pre_client_assign_hook; Tiling_Info *tinfo; Eina_Hash *info_hash; - Eina_Hash *border_extras; + Eina_Hash *client_extras; Eina_Hash *overlays; E_Action *act_togglefloat, @@ -126,8 +126,8 @@ static struct tiling_mod_main_g overlay_t move_overlays[MOVE_COUNT]; transition_overlay_t *transition_overlay; Ecore_Timer *action_timer; - E_Border *focused_bd; - void (*action_cb)(E_Border *bd, Border_Extra *extra); + E_Client *focused_ec; + void (*action_cb)(E_Client *ec, Client_Extra *extra); tiling_input_mode_t input_mode; char keys[4]; @@ -143,7 +143,7 @@ static E_Desk * get_current_desk(void) { E_Manager *m = e_manager_current_get(); - E_Container *c = e_container_current_get(m); + E_Comp *c = m->comp; E_Zone *z = e_zone_current_get(c); return e_desk_current_get(z); @@ -182,47 +182,47 @@ check_tinfo(const E_Desk *desk) } static int -is_floating_window(const E_Border *bd) +is_floating_window(const E_Client *ec) { - return EINA_LIST_IS_IN(_G.tinfo->floating_windows, bd); + return EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec); } static int -is_tilable(const E_Border *bd) +is_tilable(const E_Client *ec) { - if (bd->client.icccm.min_h == bd->client.icccm.max_h - && bd->client.icccm.max_h > 0) + if (ec->icccm.min_h == ec->icccm.max_h + && ec->icccm.max_h > 0) return false; - if (bd->client.icccm.gravity == ECORE_X_GRAVITY_STATIC) + if (ec->icccm.gravity == ECORE_X_GRAVITY_STATIC) return false; if (!tiling_g.config->tile_dialogs - && ((bd->client.icccm.transient_for != 0) - || (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG))) + && ((ec->icccm.transient_for != 0) + || (ec->netwm.type == E_WINDOW_TYPE_DIALOG))) return false; return true; } static void -change_window_border(E_Border *bd, +change_window_border(E_Client *ec, const char *bordername) { - eina_stringshare_replace(&bd->bordername, bordername); - bd->client.border.changed = true; - bd->changes.border = true; - bd->changed = true; + eina_stringshare_replace(&ec->bordername, bordername); + ec->border.changed = true; + ec->changes.border = true; + ec->changed = true; - DBG("%p -> border %s", bd, bordername); + DBG("%p -> border %s", ec, bordername); } static int -get_stack(const E_Border *bd) +get_stack(const E_Client *ec) { int i; for (i = 0; i < TILING_MAX_STACKS; i++) { - if (EINA_LIST_IS_IN(_G.tinfo->stacks[i], bd)) + if (EINA_LIST_IS_IN(_G.tinfo->stacks[i], ec)) return i; } return -1; @@ -307,123 +307,123 @@ e_tiling_update_conf(void) } static void -_e_border_move_resize(E_Border *bd, +_e_client_move_resize(E_Client *ec, int x, int y, int w, int h) { - DBG("%p -> %dx%d+%d+%d", bd, w, h, x, y); - e_border_move_resize(bd, x, y, w, h); + DBG("%p -> %dx%d+%d+%d", ec, w, h, x, y); + evas_object_geometry_set(ec->frame, x, y, w, h); } static void -_e_border_move(E_Border *bd, +_e_client_move(E_Client *ec, int x, int y) { - DBG("%p -> +%d+%d", bd, x, y); - e_border_move(bd, x, y); + DBG("%p -> +%d+%d", ec, x, y); + evas_object_move(ec->frame, x, y); } static void -_e_border_resize(E_Border *bd, +_e_client_resize(E_Client *ec, int w, int h) { - DBG("%p -> %dx%d", bd, w, h); - e_border_resize(bd, w, h); + DBG("%p -> %dx%d", ec, w, h); + evas_object_resize(ec->frame, w, h); } static void -_e_border_maximize(E_Border *bd, E_Maximize max) +_e_client_maximize(E_Client *ec, E_Maximize max) { - DBG("%p -> %s", bd, + DBG("%p -> %s", ec, (max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_NONE ? "NONE" : (max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL ? "VERTICAL" : (max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL ? "HORIZONTAL" : "BOTH"); - DBG("new_client:%s, bd->maximized=%x", - bd->new_client? "true": "false", - bd->maximized); - e_border_maximize(bd, max); + DBG("new_client:%s, ec->maximized=%x", + ec->new_client? "true": "false", + ec->maximized); + e_client_maximize(ec, max); } static void -_e_border_unmaximize(E_Border *bd, E_Maximize max) +_e_client_unmaximize(E_Client *ec, E_Maximize max) { - DBG("%p -> %s", bd, + DBG("%p -> %s", ec, (max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_NONE ? "NONE" : (max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL ? "VERTICAL" : (max & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL ? "HORIZONTAL" : "BOTH"); - e_border_unmaximize(bd, max); + e_client_unmaximize(ec, max); } static void -_restore_border(E_Border *bd) +_restore_client(E_Client *ec) { - Border_Extra *extra; + Client_Extra *extra; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); return; } - _e_border_unmaximize(bd, E_MAXIMIZE_BOTH); - _e_border_move_resize(bd, + _e_client_unmaximize(ec, E_MAXIMIZE_BOTH); + _e_client_move_resize(ec, extra->orig.geom.x, extra->orig.geom.y, extra->orig.geom.w, extra->orig.geom.h); - e_border_layer_set(bd, extra->orig.layer); + evas_object_layer_set(ec->frame, extra->orig.layer); if (extra->orig.maximized) { - e_border_maximize(bd, extra->orig.maximized); - bd->maximized = extra->orig.maximized; + e_client_maximize(ec, extra->orig.maximized); + ec->maximized = extra->orig.maximized; } DBG("Change window border back to %s for %p", - extra->orig.bordername, bd); - change_window_border(bd, (extra->orig.bordername) + extra->orig.bordername, ec); + change_window_border(ec, (extra->orig.bordername) ? extra->orig.bordername : "default"); } -static Border_Extra * -_get_or_create_border_extra(E_Border *bd) +static Client_Extra * +_get_or_create_client_extra(E_Client *ec) { - Border_Extra *extra; + Client_Extra *extra; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - extra = E_NEW(Border_Extra, 1); - *extra = (Border_Extra) { - .border = bd, + extra = E_NEW(Client_Extra, 1); + *extra = (Client_Extra) { + .client = ec, .expected = { - .x = bd->x, - .y = bd->y, - .w = bd->w, - .h = bd->h, + .x = ec->x, + .y = ec->y, + .w = ec->w, + .h = ec->h, }, .orig = { .geom = { - .x = bd->x, - .y = bd->y, - .w = bd->w, - .h = bd->h, + .x = ec->x, + .y = ec->y, + .w = ec->w, + .h = ec->h, }, - .layer = bd->layer, - .stacking = bd->client.netwm.state.stacking, - .maximized = bd->maximized, - .bordername = eina_stringshare_add(bd->bordername), + .layer = ec->layer, + .stacking = ec->netwm.state.stacking, + .maximized = ec->maximized, + .bordername = eina_stringshare_add(ec->bordername), }, }; - eina_hash_direct_add(_G.border_extras, &extra->border, extra); + eina_hash_direct_add(_G.client_extras, &extra->client, extra); } else { extra->expected = (geom_t) { - .x = bd->x, - .y = bd->y, - .w = bd->w, - .h = bd->h, + .x = ec->x, + .y = ec->y, + .w = ec->w, + .h = ec->h, }; } @@ -436,14 +436,15 @@ _get_or_create_border_extra(E_Border *bd) static void _overlays_free_cb(void *data) { - Border_Extra *extra = data; + Client_Extra *extra = data; if (extra->overlay.obj) { evas_object_del(extra->overlay.obj); extra->overlay.obj = NULL; } if (extra->overlay.popup) { - e_object_del(E_OBJECT(extra->overlay.popup)); + evas_object_hide(extra->overlay.popup); + evas_object_del(extra->overlay.popup); extra->overlay.popup = NULL; } @@ -477,7 +478,7 @@ end_special_input(void) _G.action_timer = NULL; } - _G.focused_bd = NULL; + _G.focused_ec = NULL; _G.action_cb = NULL; switch(_G.input_mode) { @@ -490,7 +491,8 @@ end_special_input(void) overlay->obj = NULL; } if (overlay->popup) { - e_object_del(E_OBJECT(overlay->popup)); + evas_object_hide(overlay->popup); + evas_object_del(overlay->popup); overlay->popup = NULL; } } @@ -501,7 +503,8 @@ end_special_input(void) evas_object_del(_G.transition_overlay->overlay.obj); } if (_G.transition_overlay->overlay.popup) { - e_object_del(E_OBJECT(_G.transition_overlay->overlay.popup)); + evas_object_hide(_G.transition_overlay->overlay.popup); + evas_object_del(_G.transition_overlay->overlay.popup); } E_FREE(_G.transition_overlay); _G.transition_overlay = NULL; @@ -520,7 +523,7 @@ overlay_key_down(void *data __UNUSED__, void *event) { Ecore_Event_Key *ev = event; - Border_Extra *extra; + Client_Extra *extra; if (ev->event_window != _G.action_input_win) return ECORE_CALLBACK_PASS_ON; @@ -549,7 +552,7 @@ overlay_key_down(void *data __UNUSED__, extra = eina_hash_find(_G.overlays, _G.keys); if (extra) { - _G.action_cb(_G.focused_bd, extra); + _G.action_cb(_G.focused_ec, extra); } else { return ECORE_CALLBACK_RENEW; } @@ -568,8 +571,8 @@ _timeout_cb(void *data __UNUSED__) } static void -_do_overlay(E_Border *focused_bd, - void (*action_cb)(E_Border *, Border_Extra *), +_do_overlay(E_Client *focused_ec, + void (*action_cb)(E_Client *, Client_Extra *), tiling_input_mode_t input_mode) { Ecore_X_Window parent; @@ -589,7 +592,7 @@ _do_overlay(E_Border *focused_bd, _G.input_mode = input_mode; - _G.focused_bd = focused_bd; + _G.focused_ec = focused_ec; _G.action_cb = action_cb; _G.overlays = eina_hash_string_small_new(_overlays_free_cb); @@ -608,28 +611,24 @@ _do_overlay(E_Border *focused_bd, for (i = 0; i < TILING_MAX_STACKS; i++) { Eina_List *l; - E_Border *bd; + E_Client *ec; if (!_G.tinfo->stacks[i]) break; - EINA_LIST_FOREACH(_G.tinfo->stacks[i], l, bd) { - if (bd != focused_bd && n < nmax) { - Border_Extra *extra; + EINA_LIST_FOREACH(_G.tinfo->stacks[i], l, ec) { + if (ec != focused_ec && n < nmax) { + Client_Extra *extra; Evas_Coord ew, eh; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); continue; } - extra->overlay.popup = e_popup_new(bd->zone, 0, 0, 1, 1); - if (!extra->overlay.popup) - continue; - - e_popup_layer_set(extra->overlay.popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); - extra->overlay.obj = - edje_object_add(extra->overlay.popup->evas); + extra->overlay.obj = edje_object_add(ec->comp->evas); + extra->overlay.popup = e_comp_object_util_add(extra->overlay.obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(extra->overlay.popup, E_LAYER_CLIENT_NORMAL); e_theme_edje_object_set(extra->overlay.obj, "base/theme/borders", "e/widgets/border/default/resize"); @@ -658,29 +657,21 @@ _do_overlay(E_Border *focused_bd, "e.text.label", extra->key); edje_object_size_min_calc(extra->overlay.obj, &ew, &eh); - evas_object_move(extra->overlay.obj, 0, 0); - evas_object_resize(extra->overlay.obj, ew, eh); - evas_object_show(extra->overlay.obj); - e_popup_content_set(extra->overlay.popup, - extra->overlay.obj); - evas_object_show(extra->overlay.obj); - e_popup_show(extra->overlay.popup); - - e_popup_move_resize(extra->overlay.popup, - (bd->x - extra->overlay.popup->zone->x) + - ((bd->w - ew) / 2), - (bd->y - extra->overlay.popup->zone->y) + - ((bd->h - eh) / 2), + evas_object_geometry_set(extra->overlay.popup, + (ec->x - ec->zone->x) + + ((ec->w - ew) / 2), + (ec->y - ec->zone->y) + + ((ec->h - eh) / 2), ew, eh); - e_popup_show(extra->overlay.popup); + evas_object_show(extra->overlay.popup); } } } /* Get input */ - parent = _G.tinfo->desk->zone->container->win; + parent = _G.tinfo->desk->zone->comp->win; _G.action_input_win = ecore_x_window_input_new(parent, 0, 0, 1, 1); if (!_G.action_input_win) { end_special_input(); @@ -728,19 +719,19 @@ _reorganize_stack(int stack) h = _G.tinfo->size[stack]; for (l = _G.tinfo->stacks[stack]; l; l = l->next, i++) { - E_Border *bd = l->data; - Border_Extra *extra; + E_Client *ec = l->data; + Client_Extra *extra; int d = (i * 2 * zw) % count - (2 * cw) % count; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); continue; } - if ((bd->maximized & E_MAXIMIZE_HORIZONTAL) && count != 1) { - _e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL); + if ((ec->maximized & E_MAXIMIZE_HORIZONTAL) && count != 1) { + _e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL); } /* let's use a bresenham here */ @@ -750,7 +741,7 @@ _reorganize_stack(int stack) extra->expected.h = h; cw += extra->expected.w; - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, @@ -765,19 +756,19 @@ _reorganize_stack(int stack) h = zh / count; for (l = _G.tinfo->stacks[stack]; l; l = l->next, i++) { - E_Border *bd = l->data; - Border_Extra *extra; + E_Client *ec = l->data; + Client_Extra *extra; int d = (i * 2 * zh) % count - (2 * ch) % count; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); continue; } - if ((bd->maximized & E_MAXIMIZE_VERTICAL) && count != 1) { - _e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL); + if ((ec->maximized & E_MAXIMIZE_VERTICAL) && count != 1) { + _e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL); } /* let's use a bresenham here */ @@ -787,7 +778,7 @@ _reorganize_stack(int stack) extra->expected.h = h + d; ch += extra->expected.h; - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, @@ -795,12 +786,12 @@ _reorganize_stack(int stack) } } } else { - Border_Extra *extra; - E_Border *bd = _G.tinfo->stacks[stack]->data; + Client_Extra *extra; + E_Client *ec = _G.tinfo->stacks[stack]->data; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); return; } @@ -815,13 +806,13 @@ _reorganize_stack(int stack) extra->expected.w = w; extra->expected.h = _G.tinfo->size[stack]; - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); - _e_border_maximize(bd, E_MAXIMIZE_EXPAND | E_MAXIMIZE_HORIZONTAL); + _e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_HORIZONTAL); } else { int y, h; @@ -833,13 +824,13 @@ _reorganize_stack(int stack) extra->expected.w = _G.tinfo->size[stack]; extra->expected.h = h; - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); - _e_border_maximize(bd, E_MAXIMIZE_EXPAND | E_MAXIMIZE_VERTICAL); + _e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_VERTICAL); } } } @@ -851,12 +842,12 @@ _move_resize_stack(int stack, int delta_pos, int delta_size) Eina_List *l; for (l = list; l; l = l->next) { - E_Border *bd = l->data; - Border_Extra *extra; + E_Client *ec = l->data; + Client_Extra *extra; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); continue; } @@ -868,7 +859,7 @@ _move_resize_stack(int stack, int delta_pos, int delta_size) extra->expected.w += delta_size; } - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, @@ -884,12 +875,12 @@ _set_stack_geometry(int stack, int pos, int size) { Eina_List *l; for (l = _G.tinfo->stacks[stack]; l; l = l->next) { - E_Border *bd = l->data; - Border_Extra *extra; + E_Client *ec = l->data; + Client_Extra *extra; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); continue; } DBG("expected: %dx%d+%d+%d (%p)", @@ -897,31 +888,31 @@ _set_stack_geometry(int stack, int pos, int size) extra->expected.h, extra->expected.x, extra->expected.y, - bd); + ec); if (_G.tinfo->conf->use_rows) { extra->expected.y = pos; extra->expected.h = size; - if (bd->maximized) { - if (l->next && (bd->maximized & E_MAXIMIZE_HORIZONTAL)) - _e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL); - if (_G.tinfo->stacks[1] && (bd->maximized & E_MAXIMIZE_VERTICAL)) - _e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL); + if (ec->maximized) { + if (l->next && (ec->maximized & E_MAXIMIZE_HORIZONTAL)) + _e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL); + if (_G.tinfo->stacks[1] && (ec->maximized & E_MAXIMIZE_VERTICAL)) + _e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL); } } else { extra->expected.x = pos; extra->expected.w = size; - if (bd->maximized) { - if (l->next && (bd->maximized & E_MAXIMIZE_VERTICAL)) - _e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL); - if (_G.tinfo->stacks[1] && (bd->maximized & E_MAXIMIZE_HORIZONTAL)) - _e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL); + if (ec->maximized) { + if (l->next && (ec->maximized & E_MAXIMIZE_VERTICAL)) + _e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL); + if (_G.tinfo->stacks[1] && (ec->maximized & E_MAXIMIZE_HORIZONTAL)) + _e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL); } } - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, @@ -934,7 +925,7 @@ _set_stack_geometry(int stack, int pos, int size) static void _add_stack(void) { - int nb_borders; + int nb_clients; Eina_List *l; int i; @@ -944,17 +935,17 @@ _add_stack(void) _G.tinfo->conf->nb_stacks++; if (_G.tinfo->conf->nb_stacks == 1) { - for (l = e_border_focus_stack_get(); l; l = l->next) { - E_Border *bd; + for (l = e_client_focus_stack_get(); l; l = l->next) { + E_Client *ec; - bd = l->data; - if (bd->desk == _G.tinfo->desk) - _add_border(bd); + ec = l->data; + if (ec->desk == _G.tinfo->desk) + _add_client(ec); } } - nb_borders = get_window_count(); + nb_clients = get_window_count(); if (_G.tinfo->stacks[_G.tinfo->conf->nb_stacks - 2] - && nb_borders >= _G.tinfo->conf->nb_stacks) + && nb_clients >= _G.tinfo->conf->nb_stacks) { int nb_stacks = _G.tinfo->conf->nb_stacks - 1; int pos, s; @@ -982,13 +973,13 @@ _add_stack(void) _G.tinfo->stacks[i+1] = _G.tinfo->stacks[i]; _reorganize_stack(i+1); } else { - E_Border *bd = eina_list_last(_G.tinfo->stacks[i])->data; + E_Client *ec = eina_list_last(_G.tinfo->stacks[i])->data; - EINA_LIST_REMOVE(_G.tinfo->stacks[i], bd); + EINA_LIST_REMOVE(_G.tinfo->stacks[i], ec); _reorganize_stack(i); _G.tinfo->stacks[i+1] = NULL; - EINA_LIST_APPEND(_G.tinfo->stacks[i+1], bd); + EINA_LIST_APPEND(_G.tinfo->stacks[i+1], ec); _reorganize_stack(i+1); return; } @@ -1010,9 +1001,9 @@ _remove_stack(void) if (!_G.tinfo->conf->nb_stacks) { for (i = 0; i < TILING_MAX_STACKS; i++) { for (l = _G.tinfo->stacks[i]; l; l = l->next) { - E_Border *bd = l->data; + E_Client *ec = l->data; - _restore_border(bd); + _restore_client(ec); } eina_list_free(_G.tinfo->stacks[i]); _G.tinfo->stacks[i] = NULL; @@ -1055,13 +1046,13 @@ _toggle_rows_cols(void) int i; #if 0 Eina_List *wins = NULL; - E_Border *bd; + E_Client *ec; _G.tinfo->conf->use_rows = !_G.tinfo->conf->use_rows; for (i = 0; i < TILING_MAX_STACKS; i++) { - EINA_LIST_FREE(_G.tinfo->stacks[i], bd) { - EINA_LIST_APPEND(wins, bd); - _restore_border(bd); + EINA_LIST_FREE(_G.tinfo->stacks[i], ec) { + EINA_LIST_APPEND(wins, ec); + _restore_client(ec); } _G.tinfo->stacks[i] = NULL; _G.tinfo->pos[i] = 0; @@ -1071,8 +1062,8 @@ _toggle_rows_cols(void) DBG("reinsert (use_rows: %s)", _G.tinfo->conf->use_rows ? "true":"false"); - EINA_LIST_FREE(wins, bd) { - _add_border(bd); + EINA_LIST_FREE(wins, ec) { + _add_client(ec); } #else int nb_stacks = get_stack_count(); @@ -1108,7 +1099,7 @@ void change_desk_conf(struct _Config_vdesk *newconf) { E_Manager *m; - E_Container *c; + E_Comp *c; E_Zone *z; E_Desk *d; int old_nb_stacks = 0, @@ -1118,9 +1109,8 @@ change_desk_conf(struct _Config_vdesk *newconf) m = e_manager_current_get(); if (!m) return; - c = e_container_current_get(m); - if (!c) return; - z = e_container_zone_number_get(c, newconf->zone_num); + c = m->comp; + z = e_comp_zone_number_get(c, newconf->zone_num); if (!z) return; d = e_desk_at_xy_get(z, newconf->x, newconf->y); if (!d) return; @@ -1146,9 +1136,9 @@ change_desk_conf(struct _Config_vdesk *newconf) if (new_nb_stacks == 0) { for (i = 0; i < TILING_MAX_STACKS; i++) { for (l = _G.tinfo->stacks[i]; l; l = l->next) { - E_Border *bd = l->data; + E_Client *ec = l->data; - _restore_border(bd); + _restore_client(ec); } eina_list_free(_G.tinfo->stacks[i]); _G.tinfo->stacks[i] = NULL; @@ -1222,22 +1212,22 @@ _e_mod_action_tg_stack_cb(E_Object *obj __UNUSED__, /* Reorganize windows {{{*/ static void -_add_border(E_Border *bd) +_add_client(E_Client *ec) { - Border_Extra *extra; + Client_Extra *extra; int stack; int i; - if (!bd) { + if (!ec) { return; } - if (is_floating_window(bd)) { + if (is_floating_window(ec)) { return; } - if (!is_tilable(bd)) { + if (!is_tilable(ec)) { return; } - if (bd->fullscreen) { + if (ec->fullscreen) { return; } @@ -1245,12 +1235,12 @@ _add_border(E_Border *bd) return; } - extra = _get_or_create_border_extra(bd); + extra = _get_or_create_client_extra(ec); /* Stack tiled window below so that winlist doesn't mix up stacking */ - e_border_layer_set(bd, E_LAYER_BELOW); + evas_object_layer_set(ec->frame, E_LAYER_CLIENT_BELOW); - DBG("adding %p", bd); + DBG("adding %p", ec); if (_G.tinfo->stacks[0]) { DBG("got stack 0"); @@ -1259,13 +1249,13 @@ _add_border(E_Border *bd) stack = _G.tinfo->conf->nb_stacks - 1; if (!_G.tinfo->stacks[stack]->next) { - _e_border_unmaximize(_G.tinfo->stacks[stack]->data, + _e_client_unmaximize(_G.tinfo->stacks[stack]->data, E_MAXIMIZE_BOTH); } - EINA_LIST_APPEND(_G.tinfo->stacks[stack], bd); + EINA_LIST_APPEND(_G.tinfo->stacks[stack], ec); _reorganize_stack(stack); - if (bd->maximized) - _e_border_unmaximize(bd, E_MAXIMIZE_BOTH); + if (ec->maximized) + _e_client_unmaximize(ec, E_MAXIMIZE_BOTH); } else { /* Add stack */ int nb_stacks = get_stack_count(); @@ -1275,7 +1265,7 @@ _add_border(E_Border *bd) DBG("add stack"); assert((0 <= nb_stacks) && (nb_stacks < TILING_MAX_STACKS)); - e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h); + e_zone_useful_geometry_get(ec->zone, &x, &y, &w, &h); if (_G.tinfo->conf->use_rows) { pos = y; @@ -1285,7 +1275,7 @@ _add_border(E_Border *bd) s = w; } - EINA_LIST_APPEND(_G.tinfo->stacks[nb_stacks], bd); + EINA_LIST_APPEND(_G.tinfo->stacks[nb_stacks], ec); for (i = 0; i < nb_stacks; i++) { @@ -1304,17 +1294,17 @@ _add_border(E_Border *bd) extra->expected.y = pos; extra->expected.w = w; extra->expected.h = size; - _e_border_maximize(bd, E_MAXIMIZE_EXPAND | + _e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_HORIZONTAL); } else { extra->expected.x = pos; extra->expected.y = y; extra->expected.w = size; extra->expected.h = h; - _e_border_maximize(bd, E_MAXIMIZE_EXPAND | + _e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_VERTICAL); } - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, @@ -1324,27 +1314,27 @@ _add_border(E_Border *bd) } } else { DBG("lonely window"); - e_zone_useful_geometry_get(bd->zone, + e_zone_useful_geometry_get(ec->zone, &extra->expected.x, &extra->expected.y, &extra->expected.w, &extra->expected.h); - if (bd->maximized & E_MAXIMIZE_BOTH) - _e_border_unmaximize(bd, E_MAXIMIZE_BOTH); - _e_border_move_resize(bd, + if (ec->maximized & E_MAXIMIZE_BOTH) + _e_client_unmaximize(ec, E_MAXIMIZE_BOTH); + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); - _e_border_maximize(bd, E_MAXIMIZE_EXPAND | E_MAXIMIZE_BOTH); - EINA_LIST_APPEND(_G.tinfo->stacks[0], bd); + _e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_BOTH); + EINA_LIST_APPEND(_G.tinfo->stacks[0], ec); if (_G.tinfo->conf->use_rows) { - e_zone_useful_geometry_get(bd->zone, + e_zone_useful_geometry_get(ec->zone, NULL, &_G.tinfo->pos[0], NULL, &_G.tinfo->size[0]); } else { - e_zone_useful_geometry_get(bd->zone, + e_zone_useful_geometry_get(ec->zone, &_G.tinfo->pos[0], NULL, &_G.tinfo->size[0], NULL); } @@ -1355,11 +1345,11 @@ _add_border(E_Border *bd) extra->expected.h, extra->expected.x, extra->expected.y, - bd); + ec); } static void -_remove_border(E_Border *bd) +_remove_client(E_Client *ec) { int stack; int nb_stacks; @@ -1367,21 +1357,21 @@ _remove_border(E_Border *bd) nb_stacks = get_stack_count(); - stack = get_stack(bd); + stack = get_stack(ec); if (stack < 0) return; - DBG("removing %p (%d%c)", bd, stack, _G.tinfo->conf->use_rows? 'r':'c'); + DBG("removing %p (%d%c)", ec, stack, _G.tinfo->conf->use_rows? 'r':'c'); - EINA_LIST_REMOVE(_G.tinfo->stacks[stack], bd); - eina_hash_del(_G.border_extras, bd, NULL); + EINA_LIST_REMOVE(_G.tinfo->stacks[stack], ec); + eina_hash_del(_G.client_extras, ec, NULL); if (_G.tinfo->stacks[stack]) { _reorganize_stack(stack); } else { - int nb_borders = get_window_count(); + int nb_clients = get_window_count(); - if (nb_stacks > nb_borders) { + if (nb_stacks > nb_clients) { int pos, s; /* Remove stack */ @@ -1394,10 +1384,10 @@ _remove_border(E_Border *bd) } _G.tinfo->stacks[nb_stacks] = NULL; if (_G.tinfo->conf->use_rows) { - e_zone_useful_geometry_get(bd->zone, + e_zone_useful_geometry_get(ec->zone, NULL, &pos, NULL, &s); } else { - e_zone_useful_geometry_get(bd->zone, + e_zone_useful_geometry_get(ec->zone, &pos, NULL, &s, NULL); } for (i = 0; i < nb_stacks; i++) { @@ -1417,12 +1407,12 @@ _remove_border(E_Border *bd) _G.tinfo->stacks[j] = _G.tinfo->stacks[j+1]; _reorganize_stack(j); } - bd = _G.tinfo->stacks[i]->data; - EINA_LIST_REMOVE(_G.tinfo->stacks[i], bd); + ec = _G.tinfo->stacks[i]->data; + EINA_LIST_REMOVE(_G.tinfo->stacks[i], ec); _reorganize_stack(i); _G.tinfo->stacks[i-1] = NULL; - EINA_LIST_APPEND(_G.tinfo->stacks[i-1], bd); + EINA_LIST_APPEND(_G.tinfo->stacks[i-1], ec); _reorganize_stack(i-1); return; } @@ -1432,12 +1422,12 @@ _remove_border(E_Border *bd) _G.tinfo->stacks[i+1] = _G.tinfo->stacks[i]; _reorganize_stack(i+1); } else { - bd = eina_list_last(_G.tinfo->stacks[i])->data; - EINA_LIST_REMOVE(_G.tinfo->stacks[i], bd); + ec = eina_list_last(_G.tinfo->stacks[i])->data; + EINA_LIST_REMOVE(_G.tinfo->stacks[i], ec); _reorganize_stack(i); _G.tinfo->stacks[i+1] = NULL; - EINA_LIST_APPEND(_G.tinfo->stacks[i+1], bd); + EINA_LIST_APPEND(_G.tinfo->stacks[i+1], ec); _reorganize_stack(i+1); return; } @@ -1447,56 +1437,56 @@ _remove_border(E_Border *bd) } static void -_move_resize_border_stack(E_Border *bd, Border_Extra *extra, +_move_resize_client_stack(E_Client *ec, Client_Extra *extra, int stack, tiling_change_t change) { -#define _MOVE_RESIZE_BORDER_STACK(_pos, _size) \ +#define _MOVE_RESIZE_CLIENT_STACK(_pos, _size) \ if (change == TILING_RESIZE) { \ if (stack == TILING_MAX_STACKS || !_G.tinfo->stacks[stack + 1]) { \ /* You're not allowed to resize */ \ - bd->_size = extra->expected._size; \ + ec->_size = extra->expected._size; \ } else { \ - int delta = bd->_size - extra->expected._size; \ + int delta = ec->_size - extra->expected._size; \ \ if (delta + 1 > _G.tinfo->size[stack + 1]) \ delta = _G.tinfo->size[stack + 1] - 1; \ \ _move_resize_stack(stack, 0, delta); \ _move_resize_stack(stack + 1, delta, -delta); \ - extra->expected._size = bd->_size; \ + extra->expected._size = ec->_size; \ } \ } else { \ if (stack == 0) { \ /* You're not allowed to move */ \ - bd->_pos = extra->expected._pos; \ + ec->_pos = extra->expected._pos; \ } else { \ - int delta = bd->_pos - extra->expected._pos; \ + int delta = ec->_pos - extra->expected._pos; \ \ if (delta + 1 > _G.tinfo->size[stack - 1]) \ delta = _G.tinfo->size[stack - 1] - 1; \ \ _move_resize_stack(stack, delta, -delta); \ _move_resize_stack(stack - 1, 0, delta); \ - extra->expected._pos = bd->_pos; \ + extra->expected._pos = ec->_pos; \ } \ } if (_G.tinfo->conf->use_rows) { - _MOVE_RESIZE_BORDER_STACK(y, h) + _MOVE_RESIZE_CLIENT_STACK(y, h) } else { - _MOVE_RESIZE_BORDER_STACK(x, w) + _MOVE_RESIZE_CLIENT_STACK(x, w) } -#undef _MOVE_RESIZE_BORDER_STACK +#undef _MOVE_RESIZE_CLIENT_STACK } static void -_move_resize_border_in_stack(E_Border *bd, Border_Extra *extra, +_move_resize_client_in_stack(E_Client *ec, Client_Extra *extra, int stack, tiling_change_t change) { Eina_List *l; - l = eina_list_data_find_list(_G.tinfo->stacks[stack], bd); + l = eina_list_data_find_list(_G.tinfo->stacks[stack], ec); if (!l) { - ERR("unable to bd %p in stack %d", bd, stack); + ERR("unable to ec %p in stack %d", ec, stack); return; } @@ -1504,58 +1494,58 @@ _move_resize_border_in_stack(E_Border *bd, Border_Extra *extra, case TILING_RESIZE: if (!l->next) { if (l->prev) { - E_Border *prevbd = l->prev->data; - Border_Extra *prevextra; + E_Client *prevec = l->prev->data; + Client_Extra *prevextra; - prevextra = eina_hash_find(_G.border_extras, &prevbd); + prevextra = eina_hash_find(_G.client_extras, &prevec); if (!prevextra) { - ERR("No extra for %p", prevbd); + ERR("No extra for %p", prevec); return; } if (_G.tinfo->conf->use_rows) { int delta; - delta = bd->w - extra->expected.w; + delta = ec->w - extra->expected.w; prevextra->expected.w -= delta; extra->expected.x -= delta; - extra->expected.w = bd->w; + extra->expected.w = ec->w; } else { int delta; - delta = bd->h - extra->expected.h; + delta = ec->h - extra->expected.h; prevextra->expected.h -= delta; extra->expected.y -= delta; - extra->expected.h = bd->h; + extra->expected.h = ec->h; } - _e_border_resize(prevbd, + _e_client_resize(prevec, prevextra->expected.w, prevextra->expected.h); - _e_border_move(bd, + _e_client_move(ec, extra->expected.x, extra->expected.y); } else { /* You're not allowed to resize */ - _e_border_resize(bd, + _e_client_resize(ec, extra->expected.w, extra->expected.h); } } else { - E_Border *nextbd = l->next->data; - Border_Extra *nextextra; + E_Client *nextec = l->next->data; + Client_Extra *nextextra; - nextextra = eina_hash_find(_G.border_extras, &nextbd); + nextextra = eina_hash_find(_G.client_extras, &nextec); if (!nextextra) { - ERR("No extra for %p", nextbd); + ERR("No extra for %p", nextec); return; } if (_G.tinfo->conf->use_rows) { - int min_width = MAX(nextbd->client.icccm.base_w, 1); + int min_width = MAX(nextec->icccm.base_w, 1); int delta; - delta = bd->w - extra->expected.w; + delta = ec->w - extra->expected.w; if (nextextra->expected.w - delta < min_width) delta = nextextra->expected.w - min_width; @@ -1564,10 +1554,10 @@ _move_resize_border_in_stack(E_Border *bd, Border_Extra *extra, extra->expected.w += delta; } else { - int min_height = MAX(nextbd->client.icccm.base_h, 1); + int min_height = MAX(nextec->icccm.base_h, 1); int delta; - delta = bd->h - extra->expected.h; + delta = ec->h - extra->expected.h; if (nextextra->expected.h - delta < min_height) delta = nextextra->expected.h - min_height; @@ -1577,12 +1567,12 @@ _move_resize_border_in_stack(E_Border *bd, Border_Extra *extra, extra->expected.h += delta; } - _e_border_move_resize(nextbd, + _e_client_move_resize(nextec, nextextra->expected.x, nextextra->expected.y, nextextra->expected.w, nextextra->expected.h); - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, @@ -1593,27 +1583,27 @@ _move_resize_border_in_stack(E_Border *bd, Border_Extra *extra, if (!l->prev) { /* You're not allowed to move */ if (_G.tinfo->conf->use_rows) { - bd->x = extra->expected.x; + ec->x = extra->expected.x; } else { - bd->y = extra->expected.y; + ec->y = extra->expected.y; } - _e_border_move(bd, + _e_client_move(ec, extra->expected.x, extra->expected.y); - DBG("trying to move %p, but !l->prev", bd); + DBG("trying to move %p, but !l->prev", ec); } else { - E_Border *prevbd = l->prev->data; - Border_Extra *prevextra; + E_Client *prevec = l->prev->data; + Client_Extra *prevextra; - prevextra = eina_hash_find(_G.border_extras, &prevbd); + prevextra = eina_hash_find(_G.client_extras, &prevec); if (!prevextra) { - ERR("No extra for %p", prevbd); + ERR("No extra for %p", prevec); return; } if (_G.tinfo->conf->use_rows) { - int delta = bd->x - extra->expected.x; - int min_width = MAX(prevbd->client.icccm.base_w, 1); + int delta = ec->x - extra->expected.x; + int min_width = MAX(prevec->icccm.base_w, 1); if (prevextra->expected.w - delta < min_width) delta = prevextra->expected.w - min_width; @@ -1623,8 +1613,8 @@ _move_resize_border_in_stack(E_Border *bd, Border_Extra *extra, extra->expected.x += delta; extra->expected.w -= delta; } else { - int delta = bd->y - extra->expected.y; - int min_height = MAX(prevbd->client.icccm.base_h, 1); + int delta = ec->y - extra->expected.y; + int min_height = MAX(prevec->icccm.base_h, 1); if (prevextra->expected.h - delta < min_height) delta = prevextra->expected.h - min_height; @@ -1635,10 +1625,10 @@ _move_resize_border_in_stack(E_Border *bd, Border_Extra *extra, extra->expected.h -= delta; } - _e_border_resize(prevbd, + _e_client_resize(prevec, prevextra->expected.w, prevextra->expected.h); - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, @@ -1654,22 +1644,22 @@ _move_resize_border_in_stack(E_Border *bd, Border_Extra *extra, /* Toggle Floating {{{ */ static void -toggle_floating(E_Border *bd) +toggle_floating(E_Client *ec) { - if (!bd) + if (!ec) return; - check_tinfo(bd->desk); + check_tinfo(ec->desk); if (!_G.tinfo->conf || !_G.tinfo->conf->nb_stacks) return; - if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, bd)) { - EINA_LIST_REMOVE(_G.tinfo->floating_windows, bd); + if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec)) { + EINA_LIST_REMOVE(_G.tinfo->floating_windows, ec); - _add_border(bd); + _add_client(ec); } else { - _remove_border(bd); - _restore_border(bd); - EINA_LIST_APPEND(_G.tinfo->floating_windows, bd); + _remove_client(ec); + _restore_client(ec); + EINA_LIST_APPEND(_G.tinfo->floating_windows, ec); } } @@ -1679,37 +1669,37 @@ _e_mod_action_toggle_floating_cb(E_Object *obj __UNUSED__, { end_special_input(); - toggle_floating(e_border_focused_get()); + toggle_floating(e_client_focused_get()); } /* }}} */ /* {{{ Swap */ static void -_action_swap(E_Border *bd_1, - Border_Extra *extra_2) +_action_swap(E_Client *ec_1, + Client_Extra *extra_2) { - Border_Extra *extra_1; - E_Border *bd_2 = extra_2->border; + Client_Extra *extra_1; + E_Client *ec_2 = extra_2->client; Eina_List *l_1 = NULL, *l_2 = NULL; geom_t gt; - unsigned int bd_2_maximized; + unsigned int ec_2_maximized; int i; - extra_1 = eina_hash_find(_G.border_extras, &bd_1); + extra_1 = eina_hash_find(_G.client_extras, &ec_1); if (!extra_1) { - ERR("No extra for %p", bd_1); + ERR("No extra for %p", ec_1); return; } for (i = 0; i < TILING_MAX_STACKS; i++) { - if ((l_1 = eina_list_data_find_list(_G.tinfo->stacks[i], bd_1))) { + if ((l_1 = eina_list_data_find_list(_G.tinfo->stacks[i], ec_1))) { break; } } for (i = 0; i < TILING_MAX_STACKS; i++) { - if ((l_2 = eina_list_data_find_list(_G.tinfo->stacks[i], bd_2))) { + if ((l_2 = eina_list_data_find_list(_G.tinfo->stacks[i], ec_2))) { break; } } @@ -1718,29 +1708,29 @@ _action_swap(E_Border *bd_1, return; } - l_1->data = bd_2; - l_2->data = bd_1; + l_1->data = ec_2; + l_2->data = ec_1; gt = extra_2->expected; extra_2->expected = extra_1->expected; extra_1->expected = gt; - bd_2_maximized = bd_2->maximized; - if (bd_2->maximized) - _e_border_unmaximize(bd_2, E_MAXIMIZE_BOTH); - if (bd_1->maximized) { - _e_border_unmaximize(bd_1, E_MAXIMIZE_BOTH); - _e_border_maximize(bd_2, bd_1->maximized); + ec_2_maximized = ec_2->maximized; + if (ec_2->maximized) + _e_client_unmaximize(ec_2, E_MAXIMIZE_BOTH); + if (ec_1->maximized) { + _e_client_unmaximize(ec_1, E_MAXIMIZE_BOTH); + _e_client_maximize(ec_2, ec_1->maximized); } - if (bd_2_maximized) { - _e_border_maximize(bd_1, bd_2_maximized); + if (ec_2_maximized) { + _e_client_maximize(ec_1, ec_2_maximized); } - _e_border_move_resize(bd_1, + _e_client_move_resize(ec_1, extra_1->expected.x, extra_1->expected.y, extra_1->expected.w, extra_1->expected.h); - _e_border_move_resize(bd_2, + _e_client_move_resize(ec_2, extra_2->expected.x, extra_2->expected.y, extra_2->expected.w, @@ -1752,14 +1742,14 @@ _e_mod_action_swap_cb(E_Object *obj __UNUSED__, const char *params __UNUSED__) { E_Desk *desk; - E_Border *focused_bd; + E_Client *focused_ec; desk = get_current_desk(); if (!desk) return; - focused_bd = e_border_focused_get(); - if (!focused_bd || focused_bd->desk != desk) + focused_ec = e_client_focused_get(); + if (!focused_ec || focused_ec->desk != desk) return; check_tinfo(desk); @@ -1767,32 +1757,32 @@ _e_mod_action_swap_cb(E_Object *obj __UNUSED__, return; } - _do_overlay(focused_bd, _action_swap, INPUT_MODE_SWAPPING); + _do_overlay(focused_ec, _action_swap, INPUT_MODE_SWAPPING); } /* }}} */ /* Move {{{*/ static void -_check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) +_check_moving_anims(const E_Client *ec, const Client_Extra *extra, int stack) { Eina_List *l = NULL; overlay_t *overlay; int nb_stacks = get_stack_count(); if (stack < 0) { - stack = get_stack(bd); + stack = get_stack(ec); if (stack < 0) return; } if (!extra) { - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); return; } } - l = eina_list_data_find_list(_G.tinfo->stacks[stack], bd); + l = eina_list_data_find_list(_G.tinfo->stacks[stack], ec); if (!l) return; @@ -1800,49 +1790,40 @@ _check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) overlay = &_G.move_overlays[MOVE_LEFT]; if ((_G.tinfo->conf->use_rows && l->prev) || (!_G.tinfo->conf->use_rows && !_G.tinfo->stacks[TILING_MAX_STACKS -1] - && (bd != _G.tinfo->stacks[0]->data || _G.tinfo->stacks[0]->next))) + && (ec != _G.tinfo->stacks[0]->data || _G.tinfo->stacks[0]->next))) { if (overlay->popup) { Evas_Coord ew, eh; edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_move(_G.move_overlays[MOVE_LEFT].popup, + evas_object_move(_G.move_overlays[MOVE_LEFT].popup, extra->expected.x - ew/2, extra->expected.y + extra->expected.h/2 - eh/2); } else { Evas_Coord ew, eh; - overlay->popup = e_popup_new(bd->zone, 0, 0, 1, 1); - if (!overlay->popup) - return; - - e_popup_layer_set(overlay->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); - overlay->obj = edje_object_add(overlay->popup->evas); + overlay->obj = edje_object_add(ec->comp->evas); _theme_edje_object_set(overlay->obj, "modules/tiling/move/left"); edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_content_set(overlay->popup, - overlay->obj); + overlay->popup = e_comp_object_util_add(overlay->obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(overlay->popup, E_LAYER_CLIENT_NORMAL); evas_object_show(overlay->obj); - e_popup_move_resize(overlay->popup, + evas_object_geometry_set(overlay->popup, extra->expected.x - ew/2 - - overlay->popup->zone->x, + - ec->zone->x, extra->expected.y + extra->expected.h/2 - eh/2 - - overlay->popup->zone->y, + - ec->zone->y, ew, eh); - evas_object_resize(overlay->obj, ew, eh); - e_popup_show(overlay->popup); + evas_object_show(overlay->popup); } } else if (overlay->popup) { - if (overlay->obj) { - evas_object_del(overlay->obj); - overlay->obj = NULL; - } if (overlay->popup) { - e_object_del(E_OBJECT(overlay->popup)); + evas_object_hide(overlay->popup); + evas_object_del(overlay->popup); overlay->popup = NULL; } } @@ -1858,43 +1839,32 @@ _check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) Evas_Coord ew, eh; edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_move(_G.move_overlays[MOVE_RIGHT].popup, + evas_object_move(_G.move_overlays[MOVE_RIGHT].popup, extra->expected.x + extra->expected.w - ew/2, extra->expected.y + extra->expected.h/2 - eh/2); } else { Evas_Coord ew, eh; - overlay->popup = e_popup_new(bd->zone, 0, 0, 1, 1); - if (!overlay->popup) - return; - - e_popup_layer_set(overlay->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); - overlay->obj = edje_object_add(overlay->popup->evas); + overlay->obj = edje_object_add(ec->comp->evas); + overlay->popup = e_comp_object_util_add(overlay->obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(overlay->popup, E_LAYER_CLIENT_NORMAL); _theme_edje_object_set(overlay->obj, "modules/tiling/move/right"); edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_content_set(overlay->popup, - overlay->obj); - evas_object_show(overlay->obj); - e_popup_move_resize(overlay->popup, + evas_object_geometry_set(overlay->popup, extra->expected.x + extra->expected.w - ew/2 - - overlay->popup->zone->x, + - ec->zone->x, extra->expected.y + extra->expected.h/2 - eh/2 - - overlay->popup->zone->y, + - ec->zone->y, ew, eh); - evas_object_resize(overlay->obj, ew, eh); - - e_popup_show(overlay->popup); + evas_object_show(overlay->popup); } } else if (overlay->popup) { - if (overlay->obj) { - evas_object_del(overlay->obj); - overlay->obj = NULL; - } if (overlay->popup) { - e_object_del(E_OBJECT(overlay->popup)); + evas_object_hide(overlay->popup); + evas_object_del(overlay->popup); overlay->popup = NULL; } } @@ -1903,48 +1873,38 @@ _check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) overlay = &_G.move_overlays[MOVE_UP]; if ((!_G.tinfo->conf->use_rows && l->prev) || (_G.tinfo->conf->use_rows && !_G.tinfo->stacks[TILING_MAX_STACKS -1] - && (bd != _G.tinfo->stacks[0]->data || _G.tinfo->stacks[0]->next))) + && (ec != _G.tinfo->stacks[0]->data || _G.tinfo->stacks[0]->next))) { if (overlay->popup) { Evas_Coord ew, eh; edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_move(_G.move_overlays[MOVE_UP].popup, + evas_object_move(_G.move_overlays[MOVE_UP].popup, extra->expected.x + extra->expected.w/2 - ew/2, extra->expected.y - eh/2); } else { Evas_Coord ew, eh; - overlay->popup = e_popup_new(bd->zone, 0, 0, 1, 1); - if (!overlay->popup) - return; - - e_popup_layer_set(overlay->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); - overlay->obj = edje_object_add(overlay->popup->evas); + overlay->obj = edje_object_add(ec->comp->evas); + overlay->popup = e_comp_object_util_add(overlay->obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(overlay->popup, E_LAYER_CLIENT_NORMAL); _theme_edje_object_set(overlay->obj, "modules/tiling/move/up"); edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_content_set(overlay->popup, - overlay->obj); - evas_object_show(overlay->obj); - e_popup_move_resize(overlay->popup, + evas_object_geometry_set(overlay->popup, extra->expected.x + extra->expected.w/2 - ew/2 - - overlay->popup->zone->x, + - ec->zone->x, extra->expected.y - eh/2 - - overlay->popup->zone->y, + - ec->zone->y, ew, eh); - evas_object_resize(overlay->obj, ew, eh); - e_popup_show(overlay->popup); + evas_object_show(overlay->popup); } } else if (overlay->popup) { - if (overlay->obj) { - evas_object_del(overlay->obj); - overlay->obj = NULL; - } if (overlay->popup) { - e_object_del(E_OBJECT(overlay->popup)); + evas_object_hide(overlay->popup); + evas_object_del(overlay->popup); overlay->popup = NULL; } } @@ -1960,82 +1920,71 @@ _check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) Evas_Coord ew, eh; edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_move(_G.move_overlays[MOVE_DOWN].popup, + evas_object_move(_G.move_overlays[MOVE_DOWN].popup, extra->expected.x + extra->expected.w/2 - ew/2, extra->expected.y + extra->expected.h - eh/2); } else { Evas_Coord ew, eh; - overlay->popup = e_popup_new(bd->zone, 0, 0, 1, 1); - if (!overlay->popup) - return; - - e_popup_layer_set(overlay->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); - overlay->obj = edje_object_add(overlay->popup->evas); + overlay->obj = edje_object_add(ec->comp->evas); + overlay->popup = e_comp_object_util_add(overlay->obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(overlay->popup, E_LAYER_CLIENT_NORMAL); _theme_edje_object_set(overlay->obj, "modules/tiling/move/down"); edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_content_set(overlay->popup, - overlay->obj); - evas_object_show(overlay->obj); - e_popup_move_resize(overlay->popup, + evas_object_geometry_set(overlay->popup, extra->expected.x + extra->expected.w/2 - ew/2 - - overlay->popup->zone->x, + - ec->zone->x, extra->expected.y + extra->expected.h - eh/2 - - overlay->popup->zone->y, + - ec->zone->y, ew, eh); - evas_object_resize(overlay->obj, ew, eh); - - e_popup_show(overlay->popup); + evas_object_show(overlay->popup); } } else if (overlay->popup) { - if (overlay->obj) { - evas_object_del(overlay->obj); - overlay->obj = NULL; - } if (overlay->popup) { - e_object_del(E_OBJECT(overlay->popup)); + evas_object_hide(overlay->popup); + evas_object_del(overlay->popup); overlay->popup = NULL; } } } static void -_move_right_rows_or_down_cols(E_Border *bd, Eina_Bool check_moving_anims) +_move_right_rows_or_down_cols(E_Client *ec, Eina_Bool check_moving_anims) { - E_Border *bd_1 = bd, - *bd_2 = NULL; - Border_Extra *extra_1 = NULL, + E_Client *ec_1 = ec, + *ec_2 = NULL; + Client_Extra *extra_1 = NULL, *extra_2 = NULL; Eina_List *l_1 = NULL, *l_2 = NULL; int stack; - stack = get_stack(bd); + stack = get_stack(ec); if (stack < 0) return; - l_1 = eina_list_data_find_list(_G.tinfo->stacks[stack], bd_1); + l_1 = eina_list_data_find_list(_G.tinfo->stacks[stack], ec_1); if (!l_1 || !l_1->next) return; l_2 = l_1->next; - bd_2 = l_2->data; + ec_2 = l_2->data; - extra_1 = eina_hash_find(_G.border_extras, &bd_1); + extra_1 = eina_hash_find(_G.client_extras, &ec_1); if (!extra_1) { - ERR("No extra for %p", bd_1); + ERR("No extra for %p", ec_1); return; } - extra_2 = eina_hash_find(_G.border_extras, &bd_2); + extra_2 = eina_hash_find(_G.client_extras, &ec_2); if (!extra_2) { - ERR("No extra for %p", bd_2); + ERR("No extra for %p", ec_2); return; } - l_1->data = bd_2; - l_2->data = bd_1; + l_1->data = ec_2; + l_2->data = ec_1; if (_G.tinfo->conf->use_rows) { extra_2->expected.x = extra_1->expected.x; @@ -2045,57 +1994,57 @@ _move_right_rows_or_down_cols(E_Border *bd, Eina_Bool check_moving_anims) extra_1->expected.y += extra_2->expected.h; } - _e_border_move(bd_1, + _e_client_move(ec_1, extra_1->expected.x, extra_1->expected.y); - _e_border_move(bd_2, + _e_client_move(ec_2, extra_2->expected.x, extra_2->expected.y); if (check_moving_anims) - _check_moving_anims(bd_1, extra_1, stack); + _check_moving_anims(ec_1, extra_1, stack); - ecore_x_pointer_warp(_G.tinfo->desk->zone->container->win, + ecore_x_pointer_warp(_G.tinfo->desk->zone->comp->win, extra_1->expected.x + extra_1->expected.w/2, extra_1->expected.y + extra_1->expected.h/2); } static void -_move_left_rows_or_up_cols(E_Border *bd, Eina_Bool check_moving_anims) +_move_left_rows_or_up_cols(E_Client *ec, Eina_Bool check_moving_anims) { - E_Border *bd_1 = bd, - *bd_2 = NULL; - Border_Extra *extra_1 = NULL, + E_Client *ec_1 = ec, + *ec_2 = NULL; + Client_Extra *extra_1 = NULL, *extra_2 = NULL; Eina_List *l_1 = NULL, *l_2 = NULL; int stack; - stack = get_stack(bd); + stack = get_stack(ec); assert(stack >= 0); - if (_G.tinfo->stacks[stack]->data == bd) + if (_G.tinfo->stacks[stack]->data == ec) return; - l_1 = eina_list_data_find_list(_G.tinfo->stacks[stack], bd_1); + l_1 = eina_list_data_find_list(_G.tinfo->stacks[stack], ec_1); if (!l_1 || !l_1->prev) return; l_2 = l_1->prev; - bd_2 = l_2->data; + ec_2 = l_2->data; - extra_1 = eina_hash_find(_G.border_extras, &bd_1); + extra_1 = eina_hash_find(_G.client_extras, &ec_1); if (!extra_1) { - ERR("No extra for %p", bd_1); + ERR("No extra for %p", ec_1); return; } - extra_2 = eina_hash_find(_G.border_extras, &bd_2); + extra_2 = eina_hash_find(_G.client_extras, &ec_2); if (!extra_2) { - ERR("No extra for %p", bd_2); + ERR("No extra for %p", ec_2); return; } - l_1->data = bd_2; - l_2->data = bd_1; + l_1->data = ec_2; + l_2->data = ec_1; if (_G.tinfo->conf->use_rows) { extra_1->expected.x = extra_2->expected.x; @@ -2105,37 +2054,37 @@ _move_left_rows_or_up_cols(E_Border *bd, Eina_Bool check_moving_anims) extra_2->expected.y += extra_1->expected.h; } - _e_border_move(bd_1, + _e_client_move(ec_1, extra_1->expected.x, extra_1->expected.y); - _e_border_move(bd_2, + _e_client_move(ec_2, extra_2->expected.x, extra_2->expected.y); if (check_moving_anims) - _check_moving_anims(bd_1, extra_1, stack); + _check_moving_anims(ec_1, extra_1, stack); - ecore_x_pointer_warp(_G.tinfo->desk->zone->container->win, + ecore_x_pointer_warp(_G.tinfo->desk->zone->comp->win, extra_1->expected.x + extra_1->expected.w/2, extra_1->expected.y + extra_1->expected.h/2); } static void -_move_up_rows_or_left_cols(E_Border *bd, Eina_Bool check_moving_anims) +_move_up_rows_or_left_cols(E_Client *ec, Eina_Bool check_moving_anims) { - Border_Extra *extra; + Client_Extra *extra; int stack; int i; int nb_stacks; - stack = get_stack(bd); + stack = get_stack(ec); assert(stack >= 0); nb_stacks = get_stack_count(); - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); return; } @@ -2145,17 +2094,17 @@ _move_up_rows_or_left_cols(E_Border *bd, Eina_Bool check_moving_anims) if (nb_stacks >= TILING_MAX_STACKS) return; - if (_G.tinfo->stacks[0]->data == bd && !_G.tinfo->stacks[0]->next) + if (_G.tinfo->stacks[0]->data == ec && !_G.tinfo->stacks[0]->next) return; - EINA_LIST_REMOVE(_G.tinfo->stacks[0], bd); + EINA_LIST_REMOVE(_G.tinfo->stacks[0], ec); for (i = TILING_MAX_STACKS - 1; i > 0; i--) { _G.tinfo->stacks[i] = _G.tinfo->stacks[i-1]; } _G.tinfo->stacks[0] = NULL; - EINA_LIST_APPEND(_G.tinfo->stacks[0], bd); + EINA_LIST_APPEND(_G.tinfo->stacks[0], ec); - e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h); + e_zone_useful_geometry_get(ec->zone, &x, &y, &w, &h); extra->expected.x = x; extra->expected.y = y; @@ -2188,37 +2137,37 @@ _move_up_rows_or_left_cols(E_Border *bd, Eina_Bool check_moving_anims) } _reorganize_stack(1); - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); - _e_border_maximize(bd, E_MAXIMIZE_EXPAND | E_MAXIMIZE_VERTICAL); + _e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_VERTICAL); if (nb_stacks + 1 > _G.tinfo->conf->nb_stacks) { _G.tinfo->conf->nb_stacks = nb_stacks + 1; e_config_save_queue(); } if (check_moving_anims) - _check_moving_anims(bd, extra, 0); - ecore_x_pointer_warp(_G.tinfo->desk->zone->container->win, + _check_moving_anims(ec, extra, 0); + ecore_x_pointer_warp(_G.tinfo->desk->zone->comp->win, extra->expected.x + extra->expected.w/2, extra->expected.y + extra->expected.h/2); return; } - EINA_LIST_REMOVE(_G.tinfo->stacks[stack], bd); - EINA_LIST_APPEND(_G.tinfo->stacks[stack - 1], bd); + EINA_LIST_REMOVE(_G.tinfo->stacks[stack], ec); + EINA_LIST_APPEND(_G.tinfo->stacks[stack - 1], ec); if (!_G.tinfo->stacks[stack]) { int pos, s; /* Remove stack */ if (_G.tinfo->conf->use_rows) { - e_zone_useful_geometry_get(bd->zone, + e_zone_useful_geometry_get(ec->zone, NULL, &pos, NULL, &s); } else { - e_zone_useful_geometry_get(bd->zone, + e_zone_useful_geometry_get(ec->zone, &pos, NULL, &s, NULL); } @@ -2246,22 +2195,22 @@ _move_up_rows_or_left_cols(E_Border *bd, Eina_Bool check_moving_anims) } if (check_moving_anims) - _check_moving_anims(bd, extra, stack - 1); + _check_moving_anims(ec, extra, stack - 1); - ecore_x_pointer_warp(_G.tinfo->desk->zone->container->win, + ecore_x_pointer_warp(_G.tinfo->desk->zone->comp->win, extra->expected.x + extra->expected.w/2, extra->expected.y + extra->expected.h/2); } static void -_move_down_rows_or_right_cols(E_Border *bd, Eina_Bool check_moving_anims) +_move_down_rows_or_right_cols(E_Client *ec, Eina_Bool check_moving_anims) { int stack; int nb_stacks; - Border_Extra *extra; + Client_Extra *extra; int i; - stack = get_stack(bd); + stack = get_stack(ec); assert(stack >= 0); if (stack == TILING_MAX_STACKS - 1) return; @@ -2271,20 +2220,20 @@ _move_down_rows_or_right_cols(E_Border *bd, Eina_Bool check_moving_anims) if (stack == nb_stacks - 1 && !_G.tinfo->stacks[stack]->next) return; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); return; } - EINA_LIST_REMOVE(_G.tinfo->stacks[stack], bd); - EINA_LIST_APPEND(_G.tinfo->stacks[stack + 1], bd); + EINA_LIST_REMOVE(_G.tinfo->stacks[stack], ec); + EINA_LIST_APPEND(_G.tinfo->stacks[stack + 1], ec); if (_G.tinfo->stacks[stack] && _G.tinfo->stacks[stack + 1]->next) { _reorganize_stack(stack); _reorganize_stack(stack + 1); if (check_moving_anims) - _check_moving_anims(bd, extra, stack + 1); + _check_moving_anims(ec, extra, stack + 1); } else if (_G.tinfo->stacks[stack]) { /* Add stack */ @@ -2295,7 +2244,7 @@ _move_down_rows_or_right_cols(E_Border *bd, Eina_Bool check_moving_anims) _reorganize_stack(stack); - e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h); + e_zone_useful_geometry_get(ec->zone, &x, &y, &w, &h); if (_G.tinfo->conf->use_rows) { pos = y; @@ -2327,24 +2276,24 @@ _move_down_rows_or_right_cols(E_Border *bd, Eina_Bool check_moving_anims) extra->expected.w = size; extra->expected.h = h; } - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); - _e_border_maximize(bd, E_MAXIMIZE_EXPAND | E_MAXIMIZE_HORIZONTAL); + _e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_HORIZONTAL); if (nb_stacks + 1 > _G.tinfo->conf->nb_stacks) { _G.tinfo->conf->nb_stacks = nb_stacks + 1; e_config_save_queue(); } if (check_moving_anims) - _check_moving_anims(bd, extra, stack + 1); + _check_moving_anims(ec, extra, stack + 1); } else { int x, y, w, h, s, pos; /* Remove stack */ - e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h); + e_zone_useful_geometry_get(ec->zone, &x, &y, &w, &h); nb_stacks--; @@ -2376,10 +2325,10 @@ _move_down_rows_or_right_cols(E_Border *bd, Eina_Bool check_moving_anims) _G.tinfo->size[nb_stacks] = 0; _reorganize_stack(stack); if (check_moving_anims) - _check_moving_anims(bd, extra, stack); + _check_moving_anims(ec, extra, stack); } - ecore_x_pointer_warp(_G.tinfo->desk->zone->container->win, + ecore_x_pointer_warp(_G.tinfo->desk->zone->comp->win, extra->expected.x + extra->expected.w/2, extra->expected.y + extra->expected.h/2); } @@ -2402,33 +2351,33 @@ move_key_down(void *data __UNUSED__, || (strcmp(ev->key, "k") == 0)) { if (_G.tinfo->conf->use_rows) - _move_up_rows_or_left_cols(_G.focused_bd, true); + _move_up_rows_or_left_cols(_G.focused_ec, true); else - _move_left_rows_or_up_cols(_G.focused_bd, true); + _move_left_rows_or_up_cols(_G.focused_ec, true); return ECORE_CALLBACK_PASS_ON; } else if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0)) { if (_G.tinfo->conf->use_rows) - _move_down_rows_or_right_cols(_G.focused_bd, true); + _move_down_rows_or_right_cols(_G.focused_ec, true); else - _move_right_rows_or_down_cols(_G.focused_bd, true); + _move_right_rows_or_down_cols(_G.focused_ec, true); return ECORE_CALLBACK_PASS_ON; } else if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0)) { if (_G.tinfo->conf->use_rows) - _move_left_rows_or_up_cols(_G.focused_bd, true); + _move_left_rows_or_up_cols(_G.focused_ec, true); else - _move_up_rows_or_left_cols(_G.focused_bd, true); + _move_up_rows_or_left_cols(_G.focused_ec, true); return ECORE_CALLBACK_PASS_ON; } else if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0)) { if (_G.tinfo->conf->use_rows) - _move_right_rows_or_down_cols(_G.focused_bd, true); + _move_right_rows_or_down_cols(_G.focused_ec, true); else - _move_down_rows_or_right_cols(_G.focused_bd, true); + _move_down_rows_or_right_cols(_G.focused_ec, true); return ECORE_CALLBACK_PASS_ON; } @@ -2448,14 +2397,14 @@ _e_mod_action_move_direct_cb(E_Object *obj __UNUSED__, const char *params) { E_Desk *desk; - E_Border *focused_bd; + E_Client *focused_ec; desk = get_current_desk(); if (!desk) return; - focused_bd = e_border_focused_get(); - if (!focused_bd || focused_bd->desk != desk) + focused_ec = e_client_focused_get(); + if (!focused_ec || focused_ec->desk != desk) return; check_tinfo(desk); @@ -2469,27 +2418,27 @@ _e_mod_action_move_direct_cb(E_Object *obj __UNUSED__, switch (params[0]) { case 'l': /* left */ if (_G.tinfo->conf->use_rows) - _move_left_rows_or_up_cols(focused_bd, false); + _move_left_rows_or_up_cols(focused_ec, false); else - _move_up_rows_or_left_cols(focused_bd, false); + _move_up_rows_or_left_cols(focused_ec, false); break; case 'r': /* right */ if (_G.tinfo->conf->use_rows) - _move_right_rows_or_down_cols(focused_bd, false); + _move_right_rows_or_down_cols(focused_ec, false); else - _move_down_rows_or_right_cols(focused_bd, false); + _move_down_rows_or_right_cols(focused_ec, false); break; case 'u': /* up */ if (_G.tinfo->conf->use_rows) - _move_up_rows_or_left_cols(focused_bd, false); + _move_up_rows_or_left_cols(focused_ec, false); else - _move_left_rows_or_up_cols(focused_bd, false); + _move_left_rows_or_up_cols(focused_ec, false); break; case 'd': /* down */ if (_G.tinfo->conf->use_rows) - _move_down_rows_or_right_cols(focused_bd, false); + _move_down_rows_or_right_cols(focused_ec, false); else - _move_right_rows_or_down_cols(focused_bd, false); + _move_right_rows_or_down_cols(focused_ec, false); break; } } @@ -2499,15 +2448,15 @@ _e_mod_action_move_cb(E_Object *obj __UNUSED__, const char *params __UNUSED__) { E_Desk *desk; - E_Border *focused_bd; + E_Client *focused_ec; Ecore_X_Window parent; desk = get_current_desk(); if (!desk) return; - focused_bd = e_border_focused_get(); - if (!focused_bd || focused_bd->desk != desk) + focused_ec = e_client_focused_get(); + if (!focused_ec || focused_ec->desk != desk) return; check_tinfo(desk); @@ -2515,12 +2464,12 @@ _e_mod_action_move_cb(E_Object *obj __UNUSED__, return; } - _G.focused_bd = focused_bd; + _G.focused_ec = focused_ec; _G.input_mode = INPUT_MODE_MOVING; /* Get input */ - parent = focused_bd->zone->container->win; + parent = focused_ec->zone->comp->win; _G.action_input_win = ecore_x_window_input_new(parent, 0, 0, 1, 1); if (!_G.action_input_win) { end_special_input(); @@ -2537,7 +2486,7 @@ _e_mod_action_move_cb(E_Object *obj __UNUSED__, _G.handler_key = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, move_key_down, NULL); - _check_moving_anims(focused_bd, NULL, -1); + _check_moving_anims(focused_ec, NULL, -1); } /* }}} */ @@ -2548,12 +2497,9 @@ _transition_overlays_free_cb(void *data) { transition_overlay_t *trov = data; - if (trov->overlay.obj) { - evas_object_del(trov->overlay.obj); - trov->overlay.obj = NULL; - } if (trov->overlay.popup) { - e_object_del(E_OBJECT(trov->overlay.popup)); + evas_object_hide(trov->overlay.popup); + evas_object_del(trov->overlay.popup); trov->overlay.popup = NULL; } if (trov != _G.transition_overlay) { @@ -2566,36 +2512,37 @@ _transition_move_cols(tiling_move_t direction) { int delta = TILING_RESIZE_STEP; int stack; - E_Popup *popup = NULL; + Evas_Object *popup = NULL; if (!_G.transition_overlay) return; stack = _G.transition_overlay->stack; - if (_G.transition_overlay->bd) { + if (_G.transition_overlay->ec) { Eina_List *l = NULL; - E_Border *bd = _G.transition_overlay->bd, - *nextbd = NULL; - Border_Extra *extra = NULL, + E_Client *ec = _G.transition_overlay->ec, + *nextec = NULL; + Client_Extra *extra = NULL, *nextextra = NULL; int min_height = 0; + int x, y; - l = eina_list_data_find_list(_G.tinfo->stacks[stack], bd); + l = eina_list_data_find_list(_G.tinfo->stacks[stack], ec); if (!l) { - ERR("unable to bd %p in stack %d", bd, stack); + ERR("unable to ec %p in stack %d", ec, stack); return; } - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); return; } - nextbd = l->next->data; - nextextra = eina_hash_find(_G.border_extras, &nextbd); + nextec = l->next->data; + nextextra = eina_hash_find(_G.client_extras, &nextec); if (!nextextra) { - ERR("No extra for %p", nextbd); + ERR("No extra for %p", nextec); return; } @@ -2603,30 +2550,32 @@ _transition_move_cols(tiling_move_t direction) delta *= -1; } - nextbd = l->next->data; - min_height = MAX(nextbd->client.icccm.base_h, 1); + nextec = l->next->data; + min_height = MAX(nextec->icccm.base_h, 1); if (nextextra->expected.h - delta < min_height) delta = nextextra->expected.h - min_height; nextextra->expected.y += delta; nextextra->expected.h -= delta; - _e_border_move_resize(nextbd, + _e_client_move_resize(nextec, nextextra->expected.x, nextextra->expected.y, nextextra->expected.w, nextextra->expected.h); extra->expected.h += delta; - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); popup = _G.transition_overlay->overlay.popup; - e_popup_move(popup, popup->x, popup->y + delta); + evas_object_geometry_get(popup, &x, &y, NULL, NULL); + evas_object_move(popup, x, y + delta); } else { + int x, y; if (stack == TILING_MAX_STACKS || !_G.tinfo->stacks[stack + 1]) { return; @@ -2642,7 +2591,8 @@ _transition_move_cols(tiling_move_t direction) _move_resize_stack(stack+1, delta, -delta); popup = _G.transition_overlay->overlay.popup; - e_popup_move(popup, popup->x + delta, popup->y); + evas_object_geometry_get(popup, &x, &y, NULL, NULL); + evas_object_move(popup, x + delta, y); } } @@ -2651,36 +2601,37 @@ _transition_move_rows(tiling_move_t direction) { int delta = TILING_RESIZE_STEP; int stack; - E_Popup *popup = NULL; + int x, y; + Evas_Object *popup = NULL; if (!_G.transition_overlay) return; stack = _G.transition_overlay->stack; - if (_G.transition_overlay->bd) { + if (_G.transition_overlay->ec) { Eina_List *l = NULL; - E_Border *bd = _G.transition_overlay->bd, - *nextbd = NULL; - Border_Extra *extra = NULL, + E_Client *ec = _G.transition_overlay->ec, + *nextec = NULL; + Client_Extra *extra = NULL, *nextextra = NULL; int min_width = 0; - l = eina_list_data_find_list(_G.tinfo->stacks[stack], bd); + l = eina_list_data_find_list(_G.tinfo->stacks[stack], ec); if (!l) { - ERR("unable to bd %p in stack %d", bd, stack); + ERR("unable to ec %p in stack %d", ec, stack); return; } - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); return; } - nextbd = l->next->data; - nextextra = eina_hash_find(_G.border_extras, &nextbd); + nextec = l->next->data; + nextextra = eina_hash_find(_G.client_extras, &nextec); if (!nextextra) { - ERR("No extra for %p", nextbd); + ERR("No extra for %p", nextec); return; } @@ -2688,29 +2639,30 @@ _transition_move_rows(tiling_move_t direction) delta *= -1; } - nextbd = l->next->data; - min_width = MAX(nextbd->client.icccm.base_w, 1); + nextec = l->next->data; + min_width = MAX(nextec->icccm.base_w, 1); if (nextextra->expected.w - delta < min_width) delta = nextextra->expected.w - min_width; nextextra->expected.x += delta; nextextra->expected.w -= delta; - _e_border_move_resize(nextbd, + _e_client_move_resize(nextec, nextextra->expected.x, nextextra->expected.y, nextextra->expected.w, nextextra->expected.h); extra->expected.w += delta; - _e_border_move_resize(bd, + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); popup = _G.transition_overlay->overlay.popup; - e_popup_move(popup, popup->x + delta, popup->y); + evas_object_geometry_get(popup, &x, &y, NULL, NULL); + evas_object_move(popup, x + delta, y); } else { if (stack == TILING_MAX_STACKS || !_G.tinfo->stacks[stack + 1]) { @@ -2727,7 +2679,8 @@ _transition_move_rows(tiling_move_t direction) _move_resize_stack(stack+1, delta, -delta); popup = _G.transition_overlay->overlay.popup; - e_popup_move(popup, popup->x, popup->y + delta); + evas_object_geometry_get(popup, &x, &y, NULL, NULL); + evas_object_move(popup, x, y + delta); } } @@ -2752,15 +2705,15 @@ _transition_overlay_key_down(void *data __UNUSED__, if (_G.transition_overlay) { DBG("ev->key='%s'; %p %d", ev->key, - _G.transition_overlay->bd, _G.tinfo->conf->use_rows); + _G.transition_overlay->ec, _G.tinfo->conf->use_rows); if ((strcmp(ev->key, "Up") == 0) || (strcmp(ev->key, "k") == 0)) { - if (_G.transition_overlay->bd && !_G.tinfo->conf->use_rows) { + if (_G.transition_overlay->ec && !_G.tinfo->conf->use_rows) { _transition_move_cols(MOVE_UP); return ECORE_CALLBACK_PASS_ON; } else - if (!_G.transition_overlay->bd && _G.tinfo->conf->use_rows) { + if (!_G.transition_overlay->ec && _G.tinfo->conf->use_rows) { _transition_move_rows(MOVE_UP); return ECORE_CALLBACK_PASS_ON; } @@ -2768,11 +2721,11 @@ _transition_overlay_key_down(void *data __UNUSED__, if ((strcmp(ev->key, "Down") == 0) || (strcmp(ev->key, "j") == 0)) { - if (_G.transition_overlay->bd && !_G.tinfo->conf->use_rows) { + if (_G.transition_overlay->ec && !_G.tinfo->conf->use_rows) { _transition_move_cols(MOVE_DOWN); return ECORE_CALLBACK_PASS_ON; } else - if (!_G.transition_overlay->bd && _G.tinfo->conf->use_rows) { + if (!_G.transition_overlay->ec && _G.tinfo->conf->use_rows) { _transition_move_rows(MOVE_DOWN); return ECORE_CALLBACK_PASS_ON; } @@ -2780,11 +2733,11 @@ _transition_overlay_key_down(void *data __UNUSED__, if ((strcmp(ev->key, "Left") == 0) || (strcmp(ev->key, "h") == 0)) { - if (!_G.transition_overlay->bd && !_G.tinfo->conf->use_rows) { + if (!_G.transition_overlay->ec && !_G.tinfo->conf->use_rows) { _transition_move_cols(MOVE_LEFT); return ECORE_CALLBACK_PASS_ON; } else - if (_G.transition_overlay->bd && _G.tinfo->conf->use_rows) { + if (_G.transition_overlay->ec && _G.tinfo->conf->use_rows) { _transition_move_rows(MOVE_LEFT); return ECORE_CALLBACK_PASS_ON; } @@ -2792,11 +2745,11 @@ _transition_overlay_key_down(void *data __UNUSED__, if ((strcmp(ev->key, "Right") == 0) || (strcmp(ev->key, "l") == 0)) { - if (!_G.transition_overlay->bd && !_G.tinfo->conf->use_rows) { + if (!_G.transition_overlay->ec && !_G.tinfo->conf->use_rows) { _transition_move_cols(MOVE_RIGHT); return ECORE_CALLBACK_PASS_ON; } else - if (_G.transition_overlay->bd && _G.tinfo->conf->use_rows) { + if (_G.transition_overlay->ec && _G.tinfo->conf->use_rows) { _transition_move_rows(MOVE_RIGHT); return ECORE_CALLBACK_PASS_ON; } @@ -2816,8 +2769,8 @@ _transition_overlay_key_down(void *data __UNUSED__, ev->key[1])) { transition_overlay_t *trov = NULL; - E_Border *bd = NULL; - Border_Extra *extra = NULL; + E_Client *ec = NULL; + Client_Extra *extra = NULL; Evas_Coord ew, eh; char *key = _G.keys; @@ -2830,30 +2783,29 @@ _transition_overlay_key_down(void *data __UNUSED__, if (!trov) { return ECORE_CALLBACK_RENEW; } - bd = trov->bd; + ec = trov->ec; _G.transition_overlay = trov; eina_hash_free(_G.overlays); _G.overlays = NULL; - if (bd) { - extra = eina_hash_find(_G.border_extras, &bd); + if (ec) { + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); goto stop; } } - if (!trov->overlay.popup) { - trov->overlay.popup = e_popup_new(_G.tinfo->desk->zone, - 0, 0, 1, 1); - e_popup_layer_set(trov->overlay.popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); - } if (!trov->overlay.obj) { trov->overlay.obj = - edje_object_add(trov->overlay.popup->evas); + edje_object_add(e_comp_get(_G.tinfo->desk)->evas); } - if ((bd && !_G.tinfo->conf->use_rows) - || (!bd && _G.tinfo->conf->use_rows)) { + if (!trov->overlay.popup) { + trov->overlay.popup = e_comp_object_util_add(trov->overlay.obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(trov->overlay.popup, E_LAYER_CLIENT_NORMAL); + } + if ((ec && !_G.tinfo->conf->use_rows) + || (!ec && _G.tinfo->conf->use_rows)) { _theme_edje_object_set(trov->overlay.obj, "modules/tiling/transition/horizontal"); } else { @@ -2862,44 +2814,40 @@ _transition_overlay_key_down(void *data __UNUSED__, } edje_object_size_min_calc(trov->overlay.obj, &ew, &eh); - e_popup_content_set(trov->overlay.popup, - trov->overlay.obj); - evas_object_show(trov->overlay.obj); - if (bd) { + if (ec) { if (_G.tinfo->conf->use_rows) { - e_popup_move_resize(trov->overlay.popup, - (extra->expected.x - trov->overlay.popup->zone->x + + evas_object_geometry_set(trov->overlay.popup, + (extra->expected.x - trov->ec->zone->x + extra->expected.w - (ew / 2)), - (extra->expected.y - trov->overlay.popup->zone->y + + (extra->expected.y - trov->ec->zone->y + ((extra->expected.h - eh) / 2)), ew, eh); } else { - e_popup_move_resize(trov->overlay.popup, - (extra->expected.x - trov->overlay.popup->zone->x + + evas_object_geometry_set(trov->overlay.popup, + (extra->expected.x - trov->ec->zone->x + ((extra->expected.w - ew) / 2)), - (extra->expected.y - trov->overlay.popup->zone->y + + (extra->expected.y - trov->ec->zone->y + extra->expected.h - (eh / 2)), ew, eh); } } else { if (_G.tinfo->conf->use_rows) { - e_popup_move_resize(trov->overlay.popup, - (trov->overlay.popup->zone->w/2 - ew/2), + evas_object_geometry_set(trov->overlay.popup, + (trov->ec->zone->w/2 - ew/2), (_G.tinfo->pos[trov->stack] + _G.tinfo->size[trov->stack] - - trov->overlay.popup->zone->y - eh/2), + - trov->ec->zone->y - eh/2), ew, eh); } else { - e_popup_move_resize(trov->overlay.popup, + evas_object_geometry_set(trov->overlay.popup, (_G.tinfo->pos[trov->stack] + _G.tinfo->size[trov->stack] - - trov->overlay.popup->zone->x - ew/2), - (trov->overlay.popup->zone->h/2 - eh/2), + - trov->ec->zone->x - ew/2), + (trov->ec->zone->h/2 - eh/2), ew, eh); } } - evas_object_resize(trov->overlay.obj, ew, eh); - e_popup_show(trov->overlay.popup); + evas_object_show(trov->overlay.popup); return ECORE_CALLBACK_RENEW; } @@ -2946,33 +2894,27 @@ _do_transition_overlay(void) for (i = 0; i < TILING_MAX_STACKS; i++) { Eina_List *l; - E_Border *bd; + E_Client *ec; if (!_G.tinfo->stacks[i]) break; - EINA_LIST_FOREACH(_G.tinfo->stacks[i], l, bd) { + EINA_LIST_FOREACH(_G.tinfo->stacks[i], l, ec) { if (l->next && n < nmax) { - Border_Extra *extra; + Client_Extra *extra; Evas_Coord ew, eh; transition_overlay_t *trov; - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); continue; } trov = E_NEW(transition_overlay_t, 1); - trov->overlay.popup = e_popup_new(bd->zone, 0, 0, 1, 1); - if (!trov->overlay.popup) - { - E_FREE(trov); - continue; - } - - e_popup_layer_set(trov->overlay.popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); - trov->overlay.obj = edje_object_add(trov->overlay.popup->evas); + trov->overlay.obj = edje_object_add(ec->comp->evas); + trov->overlay.popup = e_comp_object_util_add(trov->overlay.obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(trov->overlay.popup, E_LAYER_CLIENT_NORMAL); e_theme_edje_object_set(trov->overlay.obj, "base/theme/borders", "e/widgets/border/default/resize"); @@ -2996,39 +2938,31 @@ _do_transition_overlay(void) } n++; trov->stack = i; - trov->bd = bd; + trov->ec = ec; eina_hash_add(_G.overlays, trov->key, trov); edje_object_part_text_set(trov->overlay.obj, "e.text.label", trov->key); edje_object_size_min_calc(trov->overlay.obj, &ew, &eh); - evas_object_move(trov->overlay.obj, 0, 0); - evas_object_resize(trov->overlay.obj, ew, eh); - evas_object_show(trov->overlay.obj); - e_popup_content_set(trov->overlay.popup, - trov->overlay.obj); - - evas_object_show(trov->overlay.obj); - e_popup_show(trov->overlay.popup); if (_G.tinfo->conf->use_rows) { - e_popup_move_resize(trov->overlay.popup, - (extra->expected.x - trov->overlay.popup->zone->x + + evas_object_geometry_set(trov->overlay.popup, + (extra->expected.x - trov->ec->zone->x + extra->expected.w - (ew / 2)), - (extra->expected.y - trov->overlay.popup->zone->y + + (extra->expected.y - trov->ec->zone->y + ((extra->expected.h - eh) / 2)), ew, eh); } else { - e_popup_move_resize(trov->overlay.popup, - (extra->expected.x - trov->overlay.popup->zone->x + + evas_object_geometry_set(trov->overlay.popup, + (extra->expected.x - trov->ec->zone->x + ((extra->expected.w - ew) / 2)), - (extra->expected.y - trov->overlay.popup->zone->y + + (extra->expected.y - trov->ec->zone->y + extra->expected.h - (eh / 2)), ew, eh); } - e_popup_show(trov->overlay.popup); + evas_object_show(trov->overlay.popup); } } if (i != (TILING_MAX_STACKS - 1) && @@ -3039,13 +2973,9 @@ _do_transition_overlay(void) trov = E_NEW(transition_overlay_t, 1); - trov->overlay.popup = e_popup_new(_G.tinfo->desk->zone, - 0, 0, 1, 1); - if (!trov->overlay.popup) - continue; - - e_popup_layer_set(trov->overlay.popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); - trov->overlay.obj = edje_object_add(trov->overlay.popup->evas); + trov->overlay.obj = edje_object_add(e_comp_get(_G.tinfo->desk)->evas); + trov->overlay.popup = e_comp_object_util_add(trov->overlay.obj, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(trov->overlay.popup, E_LAYER_CLIENT_NORMAL); e_theme_edje_object_set(trov->overlay.obj, "base/theme/borders", "e/widgets/border/default/resize"); @@ -3069,44 +2999,36 @@ _do_transition_overlay(void) } n++; trov->stack = i; - trov->bd = NULL; + trov->ec = NULL; eina_hash_add(_G.overlays, trov->key, trov); edje_object_part_text_set(trov->overlay.obj, "e.text.label", trov->key); edje_object_size_min_calc(trov->overlay.obj, &ew, &eh); - evas_object_move(trov->overlay.obj, 0, 0); - evas_object_resize(trov->overlay.obj, ew, eh); - evas_object_show(trov->overlay.obj); - e_popup_content_set(trov->overlay.popup, - trov->overlay.obj); - - evas_object_show(trov->overlay.obj); - e_popup_show(trov->overlay.popup); if (_G.tinfo->conf->use_rows) { - e_popup_move_resize(trov->overlay.popup, - (trov->overlay.popup->zone->w/2 - ew/2), + evas_object_geometry_set(trov->overlay.popup, + (trov->ec->zone->w/2 - ew/2), (_G.tinfo->pos[trov->stack] + _G.tinfo->size[trov->stack] - - trov->overlay.popup->zone->y - eh/2), + - trov->ec->zone->y - eh/2), ew, eh); } else { - e_popup_move_resize(trov->overlay.popup, + evas_object_geometry_set(trov->overlay.popup, (_G.tinfo->pos[trov->stack] + _G.tinfo->size[trov->stack] - - trov->overlay.popup->zone->x - ew/2), - (trov->overlay.popup->zone->h/2 - eh/2), + - trov->ec->zone->x - ew/2), + (trov->ec->zone->h/2 - eh/2), ew, eh); } - e_popup_show(trov->overlay.popup); + evas_object_show(trov->overlay.popup); } } /* Get input */ - parent = _G.tinfo->desk->zone->container->win; + parent = _G.tinfo->desk->zone->comp->win; _G.action_input_win = ecore_x_window_input_new(parent, 0, 0, 1, 1); if (!_G.action_input_win) { end_special_input(); @@ -3159,7 +3081,7 @@ _warp_timer(void *data __UNUSED__) _G.warp_x = (_G.warp_x * (1.0 - spd)) + (_G.warp_to_x * spd); _G.warp_y = (_G.warp_y * (1.0 - spd)) + (_G.warp_to_y * spd); - ecore_x_pointer_warp(_G.tinfo->desk->zone->container->win, + ecore_x_pointer_warp(_G.tinfo->desk->zone->comp->win, _G.warp_x, _G.warp_y); if (abs(_G.warp_x - _G.old_warp_x) <= 1 @@ -3175,16 +3097,16 @@ _warp_timer(void *data __UNUSED__) } static void -_action_go(E_Border *data __UNUSED__, - Border_Extra *extra_2) +_action_go(E_Client *data __UNUSED__, + Client_Extra *extra_2) { - E_Border *bd = extra_2->border; + E_Client *ec = extra_2->client; - _G.warp_to_x = bd->x + (bd->w / 2); - _G.warp_to_y = bd->y + (bd->h / 2); - ecore_x_pointer_xy_get(_G.tinfo->desk->zone->container->win, + _G.warp_to_x = ec->x + (ec->w / 2); + _G.warp_to_y = ec->y + (ec->h / 2); + ecore_x_pointer_xy_get(_G.tinfo->desk->zone->comp->win, &_G.warp_x, &_G.warp_y); - e_border_focus_latest_set(bd); + e_client_focus_latest_set(ec); _G.warp_timer = ecore_timer_add(0.01, _warp_timer, NULL); } @@ -3214,7 +3136,7 @@ _e_mod_action_send_cb(E_Object *obj __UNUSED__, const char *params) EINA_ARG_NONNULL(2) { E_Desk *desk; - E_Border *bd; + E_Client *ec; int x, y, w, h; geom_t g; @@ -3224,11 +3146,11 @@ _e_mod_action_send_cb(E_Object *obj __UNUSED__, if (!desk) return; - bd = e_border_focused_get(); - if (!bd || bd->desk != desk) + ec = e_client_focused_get(); + if (!ec || ec->desk != desk) return; - if (!is_tilable(bd)) + if (!is_tilable(ec)) return; check_tinfo(desk); @@ -3236,26 +3158,26 @@ _e_mod_action_send_cb(E_Object *obj __UNUSED__, return; /* Fill initial values if not already done */ - _get_or_create_border_extra(bd); + _get_or_create_client_extra(ec); if (!tiling_g.config->show_titles) { - if ((bd->bordername && strcmp(bd->bordername, "pixel")) - || !bd->bordername) + if ((ec->bordername && strcmp(ec->bordername, "pixel")) + || !ec->bordername) { - change_window_border(bd, "pixel"); + change_window_border(ec, "pixel"); } } - if (bd->maximized) - _e_border_unmaximize(bd, E_MAXIMIZE_BOTH); + if (ec->maximized) + _e_client_unmaximize(ec, E_MAXIMIZE_BOTH); /* add to floating */ - if (!EINA_LIST_IS_IN(_G.tinfo->floating_windows, bd)) { - _remove_border(bd); - EINA_LIST_APPEND(_G.tinfo->floating_windows, bd); + if (!EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec)) { + _remove_client(ec); + EINA_LIST_APPEND(_G.tinfo->floating_windows, ec); } - e_zone_useful_geometry_get(bd->zone, &x, &y, &w, &h); + e_zone_useful_geometry_get(ec->zone, &x, &y, &w, &h); g.w = w / 2; g.h = h / 2; @@ -3278,84 +3200,84 @@ _e_mod_action_send_cb(E_Object *obj __UNUSED__, g.x = w / 2; } } - _e_border_move_resize(bd, g.x, g.y, g.w, g.h); + _e_client_move_resize(ec, g.x, g.y, g.w, g.h); } /* }}} */ /* Hooks {{{*/ static void -_pre_border_assign_hook(void *data __UNUSED__, - E_Border *bd) +_pre_client_assign_hook(void *data __UNUSED__, + E_Client *ec) { if (tiling_g.config->show_titles) return; - if (!bd) { + if (!ec) { return; } - check_tinfo(bd->desk); + check_tinfo(ec->desk); if (!_G.tinfo->conf || !_G.tinfo->conf->nb_stacks) { return; } - if (is_floating_window(bd)) { + if (is_floating_window(ec)) { return; } - if (!is_tilable(bd)) { + if (!is_tilable(ec)) { return; } - if (bd->fullscreen) { + if (ec->fullscreen) { return; } /* Fill initial values if not already done */ - _get_or_create_border_extra(bd); + _get_or_create_client_extra(ec); - if ((bd->bordername && strcmp(bd->bordername, "pixel")) - || !bd->bordername) + if ((ec->bordername && strcmp(ec->bordername, "pixel")) + || !ec->bordername) { - change_window_border(bd, "pixel"); + change_window_border(ec, "pixel"); } } -static void _move_or_resize(E_Border *bd) +static void _move_or_resize(E_Client *ec) { - Border_Extra *extra; + Client_Extra *extra; int stack = -1; - if (!bd) { + if (!ec) { return; } - check_tinfo(bd->desk); + check_tinfo(ec->desk); if (!_G.tinfo->conf || !_G.tinfo->conf->nb_stacks) { return; } - stack = get_stack(bd); + stack = get_stack(ec); if (stack < 0) { return; } - DBG("Resize: %p / '%s' / '%s', (%d,%d), changes(size=%d, position=%d, border=%d)" - " g:%dx%d+%d+%d bdname:'%s' (stack:%d%c) maximized:%s fs:%s", - bd, bd->client.icccm.title, bd->client.netwm.name, - bd->desk->x, bd->desk->y, - bd->changes.size, bd->changes.pos, bd->changes.border, - bd->w, bd->h, bd->x, bd->y, bd->bordername, + DBG("Resize: %p / '%s' / '%s', (%d,%d), changes(size=%d, position=%d, client=%d)" + " g:%dx%d+%d+%d ecname:'%s' (stack:%d%c) maximized:%s fs:%s", + ec, ec->icccm.title, ec->netwm.name, + ec->desk->x, ec->desk->y, + ec->changes.size, ec->changes.pos, ec->changes.border, + ec->w, ec->h, ec->x, ec->y, ec->bordername, stack, _G.tinfo->conf->use_rows? 'r':'c', - (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_NONE ? "NONE" : - (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL ? "VERTICAL" : - (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL ? "HORIZONTAL" : - "BOTH", bd->fullscreen? "true": "false"); + (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_NONE ? "NONE" : + (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL ? "VERTICAL" : + (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL ? "HORIZONTAL" : + "BOTH", ec->fullscreen? "true": "false"); - extra = eina_hash_find(_G.border_extras, &bd); + extra = eina_hash_find(_G.client_extras, &ec); if (!extra) { - ERR("No extra for %p", bd); + ERR("No extra for %p", ec); return; } @@ -3365,61 +3287,61 @@ static void _move_or_resize(E_Border *bd) extra->expected.x, extra->expected.y); DBG("delta:%dx%d,%d,%d. step:%dx%d. base:%dx%d", - bd->w - extra->expected.w, bd->h - extra->expected.h, - bd->x - extra->expected.x, bd->y - extra->expected.y, - bd->client.icccm.step_w, bd->client.icccm.step_h, - bd->client.icccm.base_w, bd->client.icccm.base_h); + ec->w - extra->expected.w, ec->h - extra->expected.h, + ec->x - extra->expected.x, ec->y - extra->expected.y, + ec->icccm.step_w, ec->icccm.step_h, + ec->icccm.base_w, ec->icccm.base_h); if (stack == 0 && !_G.tinfo->stacks[1] && !_G.tinfo->stacks[0]->next) { - if (bd->maximized) { - extra->expected.x = bd->x; - extra->expected.y = bd->y; - extra->expected.w = bd->w; - extra->expected.h = bd->h; + if (ec->maximized) { + extra->expected.x = ec->x; + extra->expected.y = ec->y; + extra->expected.w = ec->w; + extra->expected.h = ec->h; } else { /* TODO: what if a window doesn't want to be maximized? */ - _e_border_unmaximize(bd, E_MAXIMIZE_BOTH); - _e_border_maximize(bd, E_MAXIMIZE_EXPAND | E_MAXIMIZE_BOTH); + _e_client_unmaximize(ec, E_MAXIMIZE_BOTH); + _e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_BOTH); } } - if (bd->x == extra->expected.x && bd->y == extra->expected.y - && bd->w == extra->expected.w && bd->h == extra->expected.h) + if (ec->x == extra->expected.x && ec->y == extra->expected.y + && ec->w == extra->expected.w && ec->h == extra->expected.h) { return; } - if (bd->maximized) { + if (ec->maximized) { if (_G.tinfo->conf->use_rows) { - if (bd->maximized & E_MAXIMIZE_VERTICAL) { - _e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL); - _e_border_move_resize(bd, + if (ec->maximized & E_MAXIMIZE_VERTICAL) { + _e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL); + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); } - if (bd->maximized & E_MAXIMIZE_HORIZONTAL + if (ec->maximized & E_MAXIMIZE_HORIZONTAL && eina_list_count(_G.tinfo->stacks[stack]) > 1) { - _e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL); - _e_border_move_resize(bd, + _e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL); + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); } } else { - if (bd->maximized & E_MAXIMIZE_HORIZONTAL) { - _e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL); - _e_border_move_resize(bd, + if (ec->maximized & E_MAXIMIZE_HORIZONTAL) { + _e_client_unmaximize(ec, E_MAXIMIZE_HORIZONTAL); + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, extra->expected.h); } - if (bd->maximized & E_MAXIMIZE_VERTICAL + if (ec->maximized & E_MAXIMIZE_VERTICAL && eina_list_count(_G.tinfo->stacks[stack]) > 1) { - _e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL); - _e_border_move_resize(bd, + _e_client_unmaximize(ec, E_MAXIMIZE_VERTICAL); + _e_client_move_resize(ec, extra->expected.x, extra->expected.y, extra->expected.w, @@ -3428,63 +3350,64 @@ static void _move_or_resize(E_Border *bd) } } - if (abs(extra->expected.w - bd->w) >= MAX(bd->client.icccm.step_w, 1)) { + if (abs(extra->expected.w - ec->w) >= MAX(ec->icccm.step_w, 1)) { if (_G.tinfo->conf->use_rows) - _move_resize_border_in_stack(bd, extra, stack, TILING_RESIZE); + _move_resize_client_in_stack(ec, extra, stack, TILING_RESIZE); else - _move_resize_border_stack(bd, extra, stack, TILING_RESIZE); + _move_resize_client_stack(ec, extra, stack, TILING_RESIZE); } - if (abs(extra->expected.h - bd->h) >= MAX(bd->client.icccm.step_h, 1)) { + if (abs(extra->expected.h - ec->h) >= MAX(ec->icccm.step_h, 1)) { if (_G.tinfo->conf->use_rows) - _move_resize_border_stack(bd, extra, stack, TILING_RESIZE); + _move_resize_client_stack(ec, extra, stack, TILING_RESIZE); else - _move_resize_border_in_stack(bd, extra, stack, TILING_RESIZE); + _move_resize_client_in_stack(ec, extra, stack, TILING_RESIZE); } - if (extra->expected.x != bd->x) { + if (extra->expected.x != ec->x) { if (_G.tinfo->conf->use_rows) - _move_resize_border_in_stack(bd, extra, stack, TILING_MOVE); + _move_resize_client_in_stack(ec, extra, stack, TILING_MOVE); else - _move_resize_border_stack(bd, extra, stack, TILING_MOVE); + _move_resize_client_stack(ec, extra, stack, TILING_MOVE); } - if (extra->expected.y != bd->y) { + if (extra->expected.y != ec->y) { if (_G.tinfo->conf->use_rows) - _move_resize_border_stack(bd, extra, stack, TILING_MOVE); + _move_resize_client_stack(ec, extra, stack, TILING_MOVE); else - _move_resize_border_in_stack(bd, extra, stack, TILING_MOVE); + _move_resize_client_in_stack(ec, extra, stack, TILING_MOVE); } if (_G.input_mode == INPUT_MODE_MOVING - && bd == _G.focused_bd) { - _check_moving_anims(bd, extra, stack); + && ec == _G.focused_ec) { + _check_moving_anims(ec, extra, stack); } } static Eina_Bool -_resize_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Resize *event) +_resize_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event) { - E_Border *bd = event->border; + E_Client *ec = event->ec; - _move_or_resize(bd); + _move_or_resize(ec); return true; } static Eina_Bool -_move_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Move*event) +_move_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client*event) { - E_Border *bd = event->border; + E_Client *ec = event->ec; - _move_or_resize(bd); + _move_or_resize(ec); return true; } static Eina_Bool -_add_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Add *event) +_add_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event) { - E_Border *bd = event->border; + E_Client *ec = event->ec; int stack = -1; + if (e_client_util_ignored_get(ec)) return ECORE_CALLBACK_RENEW; if (_G.input_mode != INPUT_MODE_NONE && _G.input_mode != INPUT_MODE_MOVING && _G.input_mode != INPUT_MODE_TRANSITION) @@ -3492,90 +3415,91 @@ _add_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Add *event) end_special_input(); } - check_tinfo(bd->desk); + check_tinfo(ec->desk); if (!_G.tinfo->conf || !_G.tinfo->conf->nb_stacks) { return true; } - if (!is_tilable(bd)) { + if (!is_tilable(ec)) { return true; } - stack = get_stack(bd); + stack = get_stack(ec); if (stack >= 0) { return true; } - DBG("Add: %p / '%s' / '%s', (%d,%d), changes(size=%d, position=%d, border=%d)" - " g:%dx%d+%d+%d bdname:'%s' (stack:%d%c) maximized:%s fs:%s", - bd, bd->client.icccm.title, bd->client.netwm.name, - bd->desk->x, bd->desk->y, - bd->changes.size, bd->changes.pos, bd->changes.border, - bd->w, bd->h, bd->x, bd->y, bd->bordername, + DBG("Add: %p / '%s' / '%s', (%d,%d), changes(size=%d, position=%d, client=%d)" + " g:%dx%d+%d+%d ecname:'%s' (stack:%d%c) maximized:%s fs:%s", + ec, ec->icccm.title, ec->netwm.name, + ec->desk->x, ec->desk->y, + ec->changes.size, ec->changes.pos, ec->changes.border, + ec->w, ec->h, ec->x, ec->y, ec->bordername, stack, _G.tinfo->conf->use_rows? 'r':'c', - (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_NONE ? "NONE" : - (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL ? "VERTICAL" : - (bd->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL ? "HORIZONTAL" : - "BOTH", bd->fullscreen? "true": "false"); + (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_NONE ? "NONE" : + (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_VERTICAL ? "VERTICAL" : + (ec->maximized & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL ? "HORIZONTAL" : + "BOTH", ec->fullscreen? "true": "false"); - _add_border(bd); + _add_client(ec); return true; } static Eina_Bool -_remove_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Remove *event) +_remove_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event) { - E_Border *bd = event->border; + E_Client *ec = event->ec; + if (e_client_util_ignored_get(ec)) return ECORE_CALLBACK_RENEW; end_special_input(); if (_G.currently_switching_desktop) return true; - check_tinfo(bd->desk); + check_tinfo(ec->desk); if (!_G.tinfo->conf) return true; - if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, bd)) { - EINA_LIST_REMOVE(_G.tinfo->floating_windows, bd); + if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec)) { + EINA_LIST_REMOVE(_G.tinfo->floating_windows, ec); return true; } - _remove_border(bd); + _remove_client(ec); return true; } static bool -_iconify_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Iconify *event) +_iconify_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event) { - E_Border *bd = event->border; + E_Client *ec = event->ec; - DBG("iconify hook: %p", bd); + DBG("iconify hook: %p", ec); end_special_input(); - if (bd->deskshow) + if (ec->deskshow) return true; - check_tinfo(bd->desk); + check_tinfo(ec->desk); if (!_G.tinfo->conf) return true; - if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, bd)) { + if (EINA_LIST_IS_IN(_G.tinfo->floating_windows, ec)) { return true; } - _remove_border(bd); + _remove_client(ec); return true; } static bool -_uniconify_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Uniconify *event) +_uniconify_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event) { - E_Border *bd = event->border; + E_Client *ec = event->ec; int stack = -1; if (_G.input_mode != INPUT_MODE_NONE @@ -3585,23 +3509,23 @@ _uniconify_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Unico end_special_input(); } - if (bd->deskshow) + if (ec->deskshow) return true; - check_tinfo(bd->desk); + check_tinfo(ec->desk); if (!_G.tinfo->conf || !_G.tinfo->conf->nb_stacks) { return true; } - if (!is_tilable(bd)) { + if (!is_tilable(ec)) { return true; } - stack = get_stack(bd); + stack = get_stack(ec); if (stack >= 0) { return true; } - _add_border(bd); + _add_client(ec); return true; } @@ -3641,11 +3565,11 @@ _desk_before_show_hook(void *data __UNUSED__, int type __UNUSED__, void *event _ } static bool -_desk_set_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Desk_Set *ev) +_desk_set_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client_Desk_Set *ev) { - DBG("%p: from (%d,%d) to (%d,%d)", ev->border, + DBG("%p: from (%d,%d) to (%d,%d)", ev->ec, ev->desk->x, ev->desk->y, - ev->border->desk->x, ev->border->desk->y); + ev->ec->desk->x, ev->ec->desk->y); end_special_input(); @@ -3654,39 +3578,39 @@ _desk_set_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Border_Desk_S return true; } - if (is_floating_window(ev->border)) { - EINA_LIST_REMOVE(_G.tinfo->floating_windows, ev->border); + if (is_floating_window(ev->ec)) { + EINA_LIST_REMOVE(_G.tinfo->floating_windows, ev->ec); } else { - if (get_stack(ev->border) >= 0) { - _remove_border(ev->border); - _restore_border(ev->border); + if (get_stack(ev->ec) >= 0) { + _remove_client(ev->ec); + _restore_client(ev->ec); } } - check_tinfo(ev->border->desk); + check_tinfo(ev->ec->desk); if (!_G.tinfo->conf) { return true; } - if (get_stack(ev->border) < 0) - _add_border(ev->border); + if (get_stack(ev->ec) < 0) + _add_client(ev->ec); return true; } static bool -_container_resize_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Container_Resize *ev) +_compositor_resize_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Compositor_Resize *ev) { Eina_List *l; E_Zone *zone; int x, y, i; - EINA_LIST_FOREACH(ev->container->zones, l, zone) { + EINA_LIST_FOREACH(ev->comp->zones, l, zone) { for (x = 0; x < zone->desk_x_count; x++) { for (y = 0; y < zone->desk_y_count; y++) { E_Desk *desk = zone->desks[x + (y * zone->desk_x_count)]; Eina_List *wins = NULL; - E_Border *bd; + E_Client *ec; check_tinfo(desk); if (!_G.tinfo->conf || !_G.tinfo->conf->nb_stacks) { @@ -3694,17 +3618,17 @@ _container_resize_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Conta } for (i = 0; i < TILING_MAX_STACKS; i++) { - EINA_LIST_FREE(_G.tinfo->stacks[i], bd) { - EINA_LIST_APPEND(wins, bd); - _restore_border(bd); + EINA_LIST_FREE(_G.tinfo->stacks[i], ec) { + EINA_LIST_APPEND(wins, ec); + _restore_client(ec); } _G.tinfo->stacks[i] = NULL; _G.tinfo->pos[i] = 0; _G.tinfo->size[i] = 0; } - EINA_LIST_FREE(wins, bd) { - _add_border(bd); + EINA_LIST_FREE(wins, ec) { + _add_client(ec); } } } @@ -3733,7 +3657,7 @@ _clear_info_hash(void *data) static void _clear_border_extras(void *data) { - Border_Extra *extra = data; + Client_Extra *extra = data; eina_stringshare_del(extra->orig.bordername); @@ -3762,31 +3686,30 @@ e_modapi_init(E_Module *m) } _G.info_hash = eina_hash_pointer_new(_clear_info_hash); - _G.border_extras = eina_hash_pointer_new(_clear_border_extras); + _G.client_extras = eina_hash_pointer_new(_clear_border_extras); - _G.pre_border_assign_hook = e_border_hook_add( - E_BORDER_HOOK_EVAL_PRE_BORDER_ASSIGN, - (void (*)(void*,void*))_pre_border_assign_hook, NULL); + _G.pre_client_assign_hook = e_client_hook_add( + E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, _pre_client_assign_hook, NULL); #define HANDLER(_h, _e, _f) \ _h = ecore_event_handler_add(E_EVENT_##_e, \ (Ecore_Event_Handler_Cb) _f, \ NULL); - HANDLER(_G.handler_border_resize, BORDER_RESIZE, _resize_hook); - HANDLER(_G.handler_border_move, BORDER_MOVE, _move_hook); - HANDLER(_G.handler_border_add, BORDER_ADD, _add_hook); - HANDLER(_G.handler_border_remove, BORDER_REMOVE, _remove_hook); + HANDLER(_G.handler_client_resize, CLIENT_RESIZE, _resize_hook); + HANDLER(_G.handler_client_move, CLIENT_MOVE, _move_hook); + HANDLER(_G.handler_client_add, CLIENT_ADD, _add_hook); + HANDLER(_G.handler_client_remove, CLIENT_REMOVE, _remove_hook); - HANDLER(_G.handler_border_iconify, BORDER_ICONIFY, _iconify_hook); - HANDLER(_G.handler_border_uniconify, BORDER_UNICONIFY, _uniconify_hook); - HANDLER(_G.handler_border_stick, BORDER_STICK, _stick_hook); - HANDLER(_G.handler_border_unstick, BORDER_UNSTICK, _unstick_hook); + HANDLER(_G.handler_client_iconify, CLIENT_ICONIFY, _iconify_hook); + HANDLER(_G.handler_client_uniconify, CLIENT_UNICONIFY, _uniconify_hook); + HANDLER(_G.handler_client_stick, CLIENT_STICK, _stick_hook); + HANDLER(_G.handler_client_unstick, CLIENT_UNSTICK, _unstick_hook); HANDLER(_G.handler_desk_show, DESK_SHOW, _desk_show_hook); HANDLER(_G.handler_desk_before_show, DESK_BEFORE_SHOW, _desk_before_show_hook); - HANDLER(_G.handler_desk_set, BORDER_DESK_SET, _desk_set_hook); - HANDLER(_G.handler_container_resize, CONTAINER_RESIZE, _container_resize_hook); + HANDLER(_G.handler_desk_set, CLIENT_DESK_SET, _desk_set_hook); + HANDLER(_G.handler_compositor_resize, COMPOSITOR_RESIZE, _compositor_resize_hook); #undef HANDLER #define ACTION_ADD(_act, _cb, _title, _value, _params, _example, _editable) \ @@ -3924,9 +3847,9 @@ _disable_desk(E_Desk *desk) for (i = 0; i < TILING_MAX_STACKS; i++) { for (l = _G.tinfo->stacks[i]; l; l = l->next) { - E_Border *bd = l->data; + E_Client *ec = l->data; - _restore_border(bd); + _restore_client(ec); } eina_list_free(_G.tinfo->stacks[i]); _G.tinfo->stacks[i] = NULL; @@ -3936,25 +3859,22 @@ _disable_desk(E_Desk *desk) static void _disable_all_tiling(void) { - Eina_List *l, *ll, *lll; - E_Manager *man; - E_Container *con; + const Eina_List *l, *ll; + E_Comp *comp; E_Zone *zone; E_Desk *desk; int x, y; - EINA_LIST_FOREACH(e_manager_list(), l, man) { - EINA_LIST_FOREACH(man->containers, ll, con) { - EINA_LIST_FOREACH(con->zones, lll, zone) { - for (x = 0; x < zone->desk_x_count; x++) { - for (y = 0; y < zone->desk_y_count; y++) { - desk = zone->desks[x + (y * zone->desk_x_count)]; + EINA_LIST_FOREACH(e_comp_list(), l, comp) { + EINA_LIST_FOREACH(comp->zones, ll, zone) { + for (x = 0; x < zone->desk_x_count; x++) { + for (y = 0; y < zone->desk_y_count; y++) { + desk = zone->desks[x + (y * zone->desk_x_count)]; - _disable_desk(desk); - } + _disable_desk(desk); } - e_place_zone_region_smart_cleanup(zone); } + e_place_zone_region_smart_cleanup(zone); } } } @@ -3969,9 +3889,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__) tiling_g.log_domain = -1; } - if (_G.pre_border_assign_hook) { - e_border_hook_del(_G.pre_border_assign_hook); - _G.pre_border_assign_hook = NULL; + if (_G.pre_client_assign_hook) { + e_client_hook_del(_G.pre_client_assign_hook); + _G.pre_client_assign_hook = NULL; } #define FREE_HANDLER(x) \ @@ -3979,15 +3899,15 @@ e_modapi_shutdown(E_Module *m __UNUSED__) ecore_event_handler_del(x); \ x = NULL; \ } - FREE_HANDLER(_G.handler_border_resize); - FREE_HANDLER(_G.handler_border_move); - FREE_HANDLER(_G.handler_border_add); - FREE_HANDLER(_G.handler_border_remove); + FREE_HANDLER(_G.handler_client_resize); + FREE_HANDLER(_G.handler_client_move); + FREE_HANDLER(_G.handler_client_add); + FREE_HANDLER(_G.handler_client_remove); - FREE_HANDLER(_G.handler_border_iconify); - FREE_HANDLER(_G.handler_border_uniconify); - FREE_HANDLER(_G.handler_border_stick); - FREE_HANDLER(_G.handler_border_unstick); + FREE_HANDLER(_G.handler_client_iconify); + FREE_HANDLER(_G.handler_client_uniconify); + FREE_HANDLER(_G.handler_client_stick); + FREE_HANDLER(_G.handler_client_unstick); FREE_HANDLER(_G.handler_desk_show); FREE_HANDLER(_G.handler_desk_before_show); @@ -4038,8 +3958,8 @@ e_modapi_shutdown(E_Module *m __UNUSED__) eina_hash_free(_G.info_hash); _G.info_hash = NULL; - eina_hash_free(_G.border_extras); - _G.border_extras = NULL; + eina_hash_free(_G.client_extras); + _G.client_extras = NULL; _G.tinfo = NULL; diff --git a/src/modules/tiling/e_mod_tiling.h b/src/modules/tiling/e_mod_tiling.h index d77c9de69..c7594fd80 100644 --- a/src/modules/tiling/e_mod_tiling.h +++ b/src/modules/tiling/e_mod_tiling.h @@ -2,15 +2,11 @@ #define E_MOD_TILING_H #include -#include -#include #include #include -#include "config.h" - typedef struct _Config Config; typedef struct _Tiling_Info Tiling_Info; @@ -72,7 +68,7 @@ struct _E_Config_Dialog_Data Evas *evas; }; -E_Config_Dialog *e_int_config_tiling_module(E_Container *con, +E_Config_Dialog *e_int_config_tiling_module(E_Comp *comp, const char *params); EAPI extern E_Module_Api e_modapi; diff --git a/src/modules/winlist/e_int_config_winlist.c b/src/modules/winlist/e_int_config_winlist.c index be1df80fc..6eb22dba4 100644 --- a/src/modules/winlist/e_int_config_winlist.c +++ b/src/modules/winlist/e_int_config_winlist.c @@ -36,7 +36,7 @@ struct _E_Config_Dialog_Data }; E_Config_Dialog * -e_int_config_winlist(E_Container *con, const char *params __UNUSED__) +e_int_config_winlist(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -50,7 +50,7 @@ e_int_config_winlist(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.check_changed = _basic_check_changed; - cfd = e_config_dialog_new(con, _("Window Switcher Settings"), + cfd = e_config_dialog_new(comp, _("Window Switcher Settings"), "E", "windows/window_list", "preferences-winlist", 0, v, NULL); return cfd; diff --git a/src/modules/winlist/e_mod_main.c b/src/modules/winlist/e_mod_main.c index 91be226fb..56252d10c 100644 --- a/src/modules/winlist/e_mod_main.c +++ b/src/modules/winlist/e_mod_main.c @@ -119,10 +119,10 @@ _e_mod_action_winlist_cb_helper(E_Object *obj, const char *params, int modifiers { if (obj->type == E_MANAGER_TYPE) zone = e_util_zone_current_get((E_Manager *)obj); - else if (obj->type == E_CONTAINER_TYPE) - zone = e_util_zone_current_get(((E_Container *)obj)->manager); + else if (obj->type == E_COMP_TYPE) + zone = e_util_zone_current_get(((E_Comp *)obj)->man); else if (obj->type == E_ZONE_TYPE) - zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager); + zone = e_util_zone_current_get(((E_Zone *)obj)->comp->man); else zone = e_util_zone_current_get(e_manager_current_get()); } diff --git a/src/modules/winlist/e_mod_main.h b/src/modules/winlist/e_mod_main.h index f5c259288..1f2bf7d6c 100644 --- a/src/modules/winlist/e_mod_main.h +++ b/src/modules/winlist/e_mod_main.h @@ -5,7 +5,7 @@ extern const char *_winlist_act; extern E_Action *_act_winlist; -E_Config_Dialog *e_int_config_winlist(E_Container *con, const char *params __UNUSED__); +E_Config_Dialog *e_int_config_winlist(E_Comp *comp, const char *params __UNUSED__); /** * @addtogroup Optional_Control * @{ diff --git a/src/modules/winlist/e_winlist.c b/src/modules/winlist/e_winlist.c index 67b4f84a4..555cadcad 100644 --- a/src/modules/winlist/e_winlist.c +++ b/src/modules/winlist/e_winlist.c @@ -8,14 +8,14 @@ struct _E_Winlist_Win { Evas_Object *bg_object; Evas_Object *icon_object; - E_Border *border; + E_Client *client; unsigned char was_iconified : 1; unsigned char was_shaded : 1; }; static void _e_winlist_size_adjust(void); -static void _e_winlist_border_add(E_Border *bd, E_Zone *zone, E_Desk *desk); -static void _e_winlist_border_del(E_Border *bd); +static void _e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk); +static void _e_winlist_client_del(E_Client *ec); static void _e_winlist_activate_nth(int n); static void _e_winlist_activate(void); static void _e_winlist_deactivate(void); @@ -36,7 +36,8 @@ static void _e_winlist_cb_item_mouse_in(void *data, Evas *evas, #endif /* local subsystem globals */ -static E_Popup *_winlist = NULL; +static Evas_Object *_winlist = NULL; +static E_Zone *_winlist_zone = NULL; static Evas_Object *_bg_object = NULL; static Evas_Object *_list_object = NULL; static Evas_Object *_icon_object = NULL; @@ -45,7 +46,7 @@ static Eina_List *_win_selected = NULL; static E_Desk *_last_desk = NULL; static int _last_pointer_x = 0; static int _last_pointer_y = 0; -static E_Border *_last_border = NULL; +static E_Client *_last_client = NULL; static int _hold_count = 0; static int _hold_mod = 0; static E_Winlist_Activate_Type _activate_type = 0; @@ -56,7 +57,7 @@ static double _scroll_align_to = 0.0; static double _scroll_align = 0.0; static Ecore_Timer *_scroll_timer = NULL; static Ecore_Animator *_animator = NULL; -static E_Border *_bd_next = NULL; +static E_Client *_ec_next = NULL; static Eina_Bool _wmclass_picked(const Eina_List *lst, const char *wmclass) @@ -94,7 +95,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) Evas_Object *o; Eina_List *l; E_Desk *desk; - E_Border *bd; + E_Client *ec; Eina_List *wmclasses = NULL; E_OBJECT_CHECK_RETURN(zone, 0); @@ -102,7 +103,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) if (_winlist) return 0; - _input_window = ecore_x_window_input_new(zone->container->win, 0, 0, 1, 1); + _input_window = ecore_x_window_input_new(zone->comp->win, 0, 0, 1, 1); ecore_x_window_show(_input_window); if (!e_grabinput_get(_input_window, 0, _input_window)) { @@ -116,72 +117,68 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) else if (w < e_config->winlist_pos_min_w) w = e_config->winlist_pos_min_w; if (w > zone->w) w = zone->w; - x = (double)(zone->w - w) * e_config->winlist_pos_align_x; + x = zone->x + (double)(zone->w - w) * e_config->winlist_pos_align_x; h = (double)zone->h * e_config->winlist_pos_size_h; if (h > e_config->winlist_pos_max_h) h = e_config->winlist_pos_max_h; else if (h < e_config->winlist_pos_min_h) h = e_config->winlist_pos_min_h; if (h > zone->h) h = zone->h; - y = (double)(zone->h - h) * e_config->winlist_pos_align_y; + y = zone->y + (double)(zone->h - h) * e_config->winlist_pos_align_y; - _winlist = e_popup_new(zone, x, y, w, h); - if (!_winlist) - { - ecore_x_window_free(_input_window); - e_grabinput_release(_input_window, _input_window); - _input_window = 0; - return 0; - } - e_border_move_cancel(); - e_border_resize_cancel(); - e_border_focus_track_freeze(); + _winlist_zone = zone; + e_client_move_cancel(); + e_client_resize_cancel(); + e_client_focus_track_freeze(); - evas_event_feed_mouse_in(_winlist->evas, ecore_x_current_time_get(), NULL); - evas_event_feed_mouse_move(_winlist->evas, -1000000, -1000000, + evas_event_feed_mouse_in(zone->comp->evas, ecore_x_current_time_get(), NULL); + evas_event_feed_mouse_move(zone->comp->evas, -1000000, -1000000, ecore_x_current_time_get(), NULL); - evas_event_freeze(_winlist->evas); - o = edje_object_add(_winlist->evas); + evas_event_freeze(zone->comp->evas); + o = edje_object_add(zone->comp->evas); + _winlist = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_POPUP); + evas_object_layer_set(_winlist, E_LAYER_CLIENT_POPUP); + evas_object_move(_winlist, x, y); _bg_object = o; e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/main"); - o = e_box_add(_winlist->evas); + o = e_box_add(zone->comp->evas); _list_object = o; e_box_align_set(o, 0.5, 0.0); e_box_orientation_set(o, 0); e_box_homogenous_set(o, 1); - e_popup_object_add(_winlist, o); + e_comp_object_util_del_list_append(_winlist, o); edje_object_part_swallow(_bg_object, "e.swallow.list", o); edje_object_part_text_set(_bg_object, "e.text.title", _("Select a window")); evas_object_show(o); - _last_border = e_border_focused_get(); + _last_client = e_client_focused_get(); - desk = e_desk_current_get(_winlist->zone); + desk = e_desk_current_get(_winlist_zone); e_box_freeze(_list_object); - EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd) + EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec) { Eina_Bool pick; switch (filter) { case E_WINLIST_FILTER_CLASS_WINDOWS: - if (!_last_border) + if (!_last_client) pick = EINA_FALSE; else - pick = _last_border->client.icccm.class == bd->client.icccm.class; + pick = _last_client->icccm.class == ec->icccm.class; break; case E_WINLIST_FILTER_CLASSES: - pick = (!_wmclass_picked(wmclasses, bd->client.icccm.class)); + pick = (!_wmclass_picked(wmclasses, ec->icccm.class)); if (pick) - wmclasses = eina_list_append(wmclasses, bd->client.icccm.class); + wmclasses = eina_list_append(wmclasses, ec->icccm.class); break; default: pick = EINA_TRUE; } - if (pick) _e_winlist_border_add(bd, _winlist->zone, desk); + if (pick) _e_winlist_client_add(ec, _winlist_zone, desk); } e_box_thaw(_list_object); eina_list_free(wmclasses); @@ -194,9 +191,9 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) if (e_config->winlist_list_show_other_desk_windows || e_config->winlist_list_show_other_screen_windows) - _last_desk = e_desk_current_get(_winlist->zone); + _last_desk = e_desk_current_get(_winlist_zone); if (e_config->winlist_warp_while_selecting) - ecore_x_pointer_xy_get(_winlist->zone->container->win, + ecore_evas_pointer_xy_get(_winlist_zone->comp->ee, &_last_pointer_x, &_last_pointer_y); _e_winlist_activate_nth(1); @@ -206,14 +203,14 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) E_Winlist_Win *ww; ww = eina_list_data_get(_win_selected); - if (ww && (ww->border == _last_border)) + if (ww && (ww->client == _last_client)) e_winlist_next(); } - evas_event_thaw(_winlist->evas); + evas_event_thaw(zone->comp->evas); _e_winlist_size_adjust(); - E_LIST_HANDLER_APPEND(_handlers, E_EVENT_BORDER_ADD, _e_winlist_cb_event_border_add, NULL); - E_LIST_HANDLER_APPEND(_handlers, E_EVENT_BORDER_REMOVE, _e_winlist_cb_event_border_remove, NULL); + E_LIST_HANDLER_APPEND(_handlers, E_EVENT_CLIENT_ADD, _e_winlist_cb_event_border_add, NULL); + E_LIST_HANDLER_APPEND(_handlers, E_EVENT_CLIENT_REMOVE, _e_winlist_cb_event_border_remove, NULL); E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_KEY_DOWN, _e_winlist_cb_key_down, NULL); E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_KEY_UP, _e_winlist_cb_key_up, NULL); E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_winlist_cb_mouse_down, NULL); @@ -221,36 +218,36 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_MOUSE_WHEEL, _e_winlist_cb_mouse_wheel, NULL); E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_MOUSE_MOVE, _e_winlist_cb_mouse_move, NULL); - e_popup_content_set(_winlist, _bg_object); - e_popup_show(_winlist); + evas_object_show(_winlist); return 1; } void e_winlist_hide(void) { - E_Border *bd = NULL; + E_Client *ec = NULL; E_Winlist_Win *ww; if (!_winlist) return; if (_win_selected) { ww = _win_selected->data; - bd = ww->border; + ec = ww->client; } - e_popup_hide(_winlist); + evas_object_hide(_winlist); EINA_LIST_FREE(_wins, ww) { - if ((!bd) || (ww->border != bd)) - e_object_unref(E_OBJECT(ww->border)); + if ((!ec) || (ww->client != ec)) + e_object_unref(E_OBJECT(ww->client)); free(ww); } _win_selected = NULL; _icon_object = NULL; - - e_object_del(E_OBJECT(_winlist)); - e_border_focus_track_thaw(); + + evas_object_del(_winlist); + e_client_focus_track_thaw(); _winlist = NULL; + _winlist_zone = NULL; _hold_count = 0; _hold_mod = 0; _activate_type = 0; @@ -263,45 +260,42 @@ e_winlist_hide(void) e_grabinput_release(_input_window, _input_window); ecore_x_window_free(_input_window); _input_window = 0; - if (bd) + if (ec) { - if (bd->shaded) + if (ec->shaded) { - if (!bd->lock_user_shade) - e_border_unshade(bd, bd->shade.dir); + if (!ec->lock_user_shade) + e_client_unshade(ec, ec->shade_dir); } if (e_config->winlist_list_move_after_select) { - e_border_zone_set(bd, e_zone_current_get(e_util_container_current_get())); - e_border_desk_set(bd, e_desk_current_get(bd->zone)); + e_client_zone_set(ec, e_zone_current_get(e_util_comp_current_get())); + e_client_desk_set(ec, e_desk_current_get(ec->zone)); } - else if (bd->desk) + else if (ec->desk) { - if (!bd->sticky) e_desk_show(bd->desk); + if (!ec->sticky) e_desk_show(ec->desk); } - if (!bd->lock_user_stacking) - e_border_raise(bd); + if (!ec->lock_user_stacking) + evas_object_raise(ec->frame); if ((e_config->focus_policy != E_FOCUS_CLICK) || (e_config->winlist_warp_at_end) || (e_config->winlist_warp_while_selecting)) { - if (!e_border_pointer_warp_to_center_now(bd)) - e_border_focus_set(bd, 1, 0); + e_client_pointer_warp_to_center_now(ec); } - else if (!bd->lock_focus_out) + else if (!ec->lock_focus_out) { - if (bd->iconic) - e_border_uniconify(bd); - if (bd->shaded) - e_border_unshade(bd, bd->shade.dir); - e_border_focus_set(bd, 1, 1); - e_border_focus_latest_set(bd); + if (ec->iconic) + e_client_uniconify(ec); + if (ec->shaded) + e_client_unshade(ec, ec->shade_dir); + evas_object_focus_set(ec->frame, 1); + e_client_focus_latest_set(ec); } - e_object_unref(E_OBJECT(bd)); + e_object_unref(E_OBJECT(ec)); } - - e_border_idler_before(); } void @@ -355,58 +349,58 @@ e_winlist_prev(void) void e_winlist_left(E_Zone *zone) { - E_Border *bd; + E_Client *ec; Eina_List *l; E_Desk *desk; - E_Border *bd_orig; + E_Client *ec_orig; int delta = INT_MAX; int delta2 = INT_MAX; int center; - _bd_next = NULL; + _ec_next = NULL; E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - bd_orig = e_border_focused_get(); - if (!bd_orig) return; + ec_orig = e_client_focused_get(); + if (!ec_orig) return; - center = bd_orig->x + bd_orig->w / 2; + center = ec_orig->x + ec_orig->w / 2; desk = e_desk_current_get(zone); - EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd) + EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec) { int center_next; int delta_next; int delta2_next; - if (bd == bd_orig) continue; - if ((!bd->client.icccm.accepts_focus) && - (!bd->client.icccm.take_focus)) continue; - if (bd->client.netwm.state.skip_taskbar) continue; - if (bd->user_skip_winlist) continue; - if (bd->iconic) + if (ec == ec_orig) continue; + if ((!ec->icccm.accepts_focus) && + (!ec->icccm.take_focus)) continue; + if (ec->netwm.state.skip_taskbar) continue; + if (ec->user_skip_winlist) continue; + if (ec->iconic) { if (!e_config->winlist_list_show_iconified) continue; - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_iconified)) continue; - if ((bd->desk != desk) && + if ((ec->desk != desk) && (!e_config->winlist_list_show_other_desk_iconified)) continue; } else { - if (bd->sticky) + if (ec->sticky) { - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_windows)) continue; } else { - if (bd->desk != desk) + if (ec->desk != desk) { - if ((bd->zone) && (bd->zone != zone)) + if ((ec->zone) && (ec->zone != zone)) { if (!e_config->winlist_list_show_other_screen_windows) continue; @@ -416,101 +410,98 @@ e_winlist_left(E_Zone *zone) } } } - /* bd is suitable */ - center_next = bd->x + bd->w / 2; + /* ec is suitable */ + center_next = ec->x + ec->w / 2; if (center_next >= center) continue; - delta_next = bd_orig->x - (bd->x + bd->w); + delta_next = ec_orig->x - (ec->x + ec->w); if (delta_next < 0) delta_next = center - center_next; - delta2_next = abs(bd_orig->y - bd_orig->h / 2 - bd->y + bd->h/2); + delta2_next = abs(ec_orig->y - ec_orig->h / 2 - ec->y + ec->h/2); if (delta_next >= 0 && delta_next <= delta && delta2_next >= 0 && delta2_next <= delta2) { - _bd_next = bd; + _ec_next = ec; delta = delta_next; delta2 = delta2_next; } } - if (_bd_next) + if (_ec_next) { - if (!bd_orig->lock_focus_out) - e_border_focus_set(bd_orig, 0, 0); - if ((!e_config->winlist_no_warp_on_direction) && ((e_config->focus_policy != E_FOCUS_CLICK) || (e_config->winlist_warp_at_end) || (e_config->winlist_warp_while_selecting))) { - if (!e_border_pointer_warp_to_center(_bd_next)) - e_border_focus_set(_bd_next, 1, 1); + if (!e_client_pointer_warp_to_center(_ec_next)) + evas_object_focus_set(_ec_next->frame, 1); if (!_animator) _animator = ecore_animator_add(_e_winlist_animator, NULL); } - if ((!_bd_next->lock_user_stacking) && + if ((!_ec_next->lock_user_stacking) && (e_config->winlist_list_raise_while_selecting)) - e_border_raise(_bd_next); - if ((!_bd_next->lock_focus_out) && + evas_object_raise(_ec_next->frame); + if ((!_ec_next->lock_focus_out) && (e_config->winlist_list_focus_while_selecting)) - e_border_focus_set(_bd_next, 1, 1); + evas_object_focus_set(_ec_next->frame, 1); } } void e_winlist_down(E_Zone *zone) { - E_Border *bd; + E_Client *ec; Eina_List *l; E_Desk *desk; - E_Border *bd_orig; + E_Client *ec_orig; int delta = INT_MAX; int delta2 = INT_MAX; int center; - _bd_next = NULL; + _ec_next = NULL; E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - bd_orig = e_border_focused_get(); - if (!bd_orig) return; + ec_orig = e_client_focused_get(); + if (!ec_orig) return; - center = bd_orig->y + bd_orig->h / 2; + center = ec_orig->y + ec_orig->h / 2; desk = e_desk_current_get(zone); - EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd) + EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec) { int center_next; int delta_next; int delta2_next; - if (bd == bd_orig) continue; - if ((!bd->client.icccm.accepts_focus) && - (!bd->client.icccm.take_focus)) continue; - if (bd->client.netwm.state.skip_taskbar) continue; - if (bd->user_skip_winlist) continue; - if (bd->iconic) + if (ec == ec_orig) continue; + if ((!ec->icccm.accepts_focus) && + (!ec->icccm.take_focus)) continue; + if (ec->netwm.state.skip_taskbar) continue; + if (ec->user_skip_winlist) continue; + if (ec->iconic) { if (!e_config->winlist_list_show_iconified) continue; - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_iconified)) continue; - if ((bd->desk != desk) && + if ((ec->desk != desk) && (!e_config->winlist_list_show_other_desk_iconified)) continue; } else { - if (bd->sticky) + if (ec->sticky) { - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_windows)) continue; } else { - if (bd->desk != desk) + if (ec->desk != desk) { - if ((bd->zone) && (bd->zone != zone)) + if ((ec->zone) && (ec->zone != zone)) { if (!e_config->winlist_list_show_other_screen_windows) continue; @@ -520,101 +511,98 @@ e_winlist_down(E_Zone *zone) } } } - /* bd is suitable */ - center_next = bd->y + bd->h / 2; + /* ec is suitable */ + center_next = ec->y + ec->h / 2; if (center_next <= center) continue; - delta_next = bd->y - (bd_orig->y + bd_orig->h); + delta_next = ec->y - (ec_orig->y + ec_orig->h); if (delta_next < 0) delta_next = center - center_next; - delta2_next = abs(bd_orig->x - bd_orig->w / 2 - bd->x + bd->w/2); + delta2_next = abs(ec_orig->x - ec_orig->w / 2 - ec->x + ec->w/2); if (delta_next >= 0 && delta_next <= delta && delta2_next >= 0 && delta2_next <= delta2) { - _bd_next = bd; + _ec_next = ec; delta = delta_next; delta2 = delta2_next; } } - if (_bd_next) + if (_ec_next) { - if (!bd_orig->lock_focus_out) - e_border_focus_set(bd_orig, 0, 0); - if ((!e_config->winlist_no_warp_on_direction) && ((e_config->focus_policy != E_FOCUS_CLICK) || (e_config->winlist_warp_at_end) || (e_config->winlist_warp_while_selecting))) { - if (!e_border_pointer_warp_to_center(_bd_next)) - e_border_focus_set(_bd_next, 1, 1); + if (!e_client_pointer_warp_to_center(_ec_next)) + evas_object_focus_set(_ec_next->frame, 1); if (!_animator) _animator = ecore_animator_add(_e_winlist_animator, NULL); } - if ((!_bd_next->lock_user_stacking) && + if ((!_ec_next->lock_user_stacking) && (e_config->winlist_list_raise_while_selecting)) - e_border_raise(_bd_next); - if ((!_bd_next->lock_focus_out) && + evas_object_raise(_ec_next->frame); + if ((!_ec_next->lock_focus_out) && (e_config->winlist_list_focus_while_selecting)) - e_border_focus_set(_bd_next, 1, 1); + evas_object_focus_set(_ec_next->frame, 1); } } void e_winlist_up(E_Zone *zone) { - E_Border *bd; + E_Client *ec; Eina_List *l; E_Desk *desk; - E_Border *bd_orig; + E_Client *ec_orig; int delta = INT_MAX; int delta2 = INT_MAX; int center; - _bd_next = NULL; + _ec_next = NULL; E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - bd_orig = e_border_focused_get(); - if (!bd_orig) return; + ec_orig = e_client_focused_get(); + if (!ec_orig) return; - center = bd_orig->y + bd_orig->h / 2; + center = ec_orig->y + ec_orig->h / 2; desk = e_desk_current_get(zone); - EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd) + EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec) { int center_next; int delta_next; int delta2_next; - if (bd == bd_orig) continue; - if ((!bd->client.icccm.accepts_focus) && - (!bd->client.icccm.take_focus)) continue; - if (bd->client.netwm.state.skip_taskbar) continue; - if (bd->user_skip_winlist) continue; - if (bd->iconic) + if (ec == ec_orig) continue; + if ((!ec->icccm.accepts_focus) && + (!ec->icccm.take_focus)) continue; + if (ec->netwm.state.skip_taskbar) continue; + if (ec->user_skip_winlist) continue; + if (ec->iconic) { if (!e_config->winlist_list_show_iconified) continue; - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_iconified)) continue; - if ((bd->desk != desk) && + if ((ec->desk != desk) && (!e_config->winlist_list_show_other_desk_iconified)) continue; } else { - if (bd->sticky) + if (ec->sticky) { - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_windows)) continue; } else { - if (bd->desk != desk) + if (ec->desk != desk) { - if ((bd->zone) && (bd->zone != zone)) + if ((ec->zone) && (ec->zone != zone)) { if (!e_config->winlist_list_show_other_screen_windows) continue; @@ -624,101 +612,98 @@ e_winlist_up(E_Zone *zone) } } } - /* bd is suitable */ - center_next = bd->y + bd->h / 2; + /* ec is suitable */ + center_next = ec->y + ec->h / 2; if (center_next >= center) continue; - delta_next = bd_orig->y - (bd->y + bd->h); + delta_next = ec_orig->y - (ec->y + ec->h); if (delta_next < 0) delta_next = center - center_next; - delta2_next = abs(bd_orig->x - bd_orig->w / 2 - bd->x + bd->w/2); + delta2_next = abs(ec_orig->x - ec_orig->w / 2 - ec->x + ec->w/2); if (delta_next >= 0 && delta_next <= delta && delta2_next >= 0 && delta2_next <= delta2) { - _bd_next = bd; + _ec_next = ec; delta = delta_next; delta2 = delta2_next; } } - if (_bd_next) + if (_ec_next) { - if (!bd_orig->lock_focus_out) - e_border_focus_set(bd_orig, 0, 0); - if ((!e_config->winlist_no_warp_on_direction) && ((e_config->focus_policy != E_FOCUS_CLICK) || (e_config->winlist_warp_at_end) || (e_config->winlist_warp_while_selecting))) { - if (!e_border_pointer_warp_to_center(_bd_next)) - e_border_focus_set(_bd_next, 1, 1); + if (!e_client_pointer_warp_to_center(_ec_next)) + evas_object_focus_set(_ec_next->frame, 1); if (!_animator) _animator = ecore_animator_add(_e_winlist_animator, NULL); } - if ((!_bd_next->lock_user_stacking) && + if ((!_ec_next->lock_user_stacking) && (e_config->winlist_list_raise_while_selecting)) - e_border_raise(_bd_next); - if ((!_bd_next->lock_focus_out) && + evas_object_raise(_ec_next->frame); + if ((!_ec_next->lock_focus_out) && (e_config->winlist_list_focus_while_selecting)) - e_border_focus_set(_bd_next, 1, 1); + evas_object_focus_set(_ec_next->frame, 1); } } void e_winlist_right(E_Zone *zone) { - E_Border *bd; + E_Client *ec; Eina_List *l; E_Desk *desk; - E_Border *bd_orig; + E_Client *ec_orig; int delta = INT_MAX; int delta2 = INT_MAX; int center; - _bd_next = NULL; + _ec_next = NULL; E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - bd_orig = e_border_focused_get(); - if (!bd_orig) return; + ec_orig = e_client_focused_get(); + if (!ec_orig) return; - center = bd_orig->x + bd_orig->w / 2; + center = ec_orig->x + ec_orig->w / 2; desk = e_desk_current_get(zone); - EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd) + EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec) { int center_next; int delta_next; int delta2_next; - if (bd == bd_orig) continue; - if ((!bd->client.icccm.accepts_focus) && - (!bd->client.icccm.take_focus)) continue; - if (bd->client.netwm.state.skip_taskbar) continue; - if (bd->user_skip_winlist) continue; - if (bd->iconic) + if (ec == ec_orig) continue; + if ((!ec->icccm.accepts_focus) && + (!ec->icccm.take_focus)) continue; + if (ec->netwm.state.skip_taskbar) continue; + if (ec->user_skip_winlist) continue; + if (ec->iconic) { if (!e_config->winlist_list_show_iconified) continue; - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_iconified)) continue; - if ((bd->desk != desk) && + if ((ec->desk != desk) && (!e_config->winlist_list_show_other_desk_iconified)) continue; } else { - if (bd->sticky) + if (ec->sticky) { - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_windows)) continue; } else { - if (bd->desk != desk) + if (ec->desk != desk) { - if ((bd->zone) && (bd->zone != zone)) + if ((ec->zone) && (ec->zone != zone)) { if (!e_config->winlist_list_show_other_screen_windows) continue; @@ -728,43 +713,40 @@ e_winlist_right(E_Zone *zone) } } } - /* bd is suitable */ - center_next = bd->x + bd->w / 2; + /* ec is suitable */ + center_next = ec->x + ec->w / 2; if (center_next <= center) continue; - delta_next = bd->x - (bd_orig->x + bd_orig->w); + delta_next = ec->x - (ec_orig->x + ec_orig->w); if (delta_next < 0) delta = center_next - center; - delta2_next = abs(bd_orig->y - bd_orig->h / 2 - bd->y + bd->h/2); + delta2_next = abs(ec_orig->y - ec_orig->h / 2 - ec->y + ec->h/2); if (delta_next >= 0 && delta_next <= delta && delta2_next >= 0 && delta2_next <= delta2) { - _bd_next = bd; + _ec_next = ec; delta = delta_next; delta2 = delta2_next; } } - if (_bd_next) + if (_ec_next) { - if (!bd_orig->lock_focus_out) - e_border_focus_set(bd_orig, 0, 0); - if ((!e_config->winlist_no_warp_on_direction) && ((e_config->focus_policy != E_FOCUS_CLICK) || (e_config->winlist_warp_at_end) || (e_config->winlist_warp_while_selecting))) { - if (!e_border_pointer_warp_to_center(_bd_next)) - e_border_focus_set(_bd_next, 1, 1); + if (!e_client_pointer_warp_to_center(_ec_next)) + evas_object_focus_set(_ec_next->frame, 1); if (!_animator) _animator = ecore_animator_add(_e_winlist_animator, NULL); } - if ((!_bd_next->lock_user_stacking) && + if ((!_ec_next->lock_user_stacking) && (e_config->winlist_list_raise_while_selecting)) - e_border_raise(_bd_next); - if ((!_bd_next->lock_focus_out) && + evas_object_raise(_ec_next->frame); + if ((!_ec_next->lock_focus_out) && (e_config->winlist_list_focus_while_selecting)) - e_border_focus_set(_bd_next, 1, 1); + evas_object_focus_set(_ec_next->frame, 1); } } @@ -799,60 +781,60 @@ _e_winlist_size_adjust(void) edje_object_part_swallow(_bg_object, "e.swallow.list", _list_object); e_box_thaw(_list_object); - zone = _winlist->zone; + zone = _winlist_zone; w = (double)zone->w * e_config->winlist_pos_size_w; if (w < mw) w = mw; if (w > e_config->winlist_pos_max_w) w = e_config->winlist_pos_max_w; else if (w < e_config->winlist_pos_min_w) w = e_config->winlist_pos_min_w; if (w > zone->w) w = zone->w; - x = (double)(zone->w - w) * e_config->winlist_pos_align_x; + x = zone->x + (double)(zone->w - w) * e_config->winlist_pos_align_x; h = mh; if (h > e_config->winlist_pos_max_h) h = e_config->winlist_pos_max_h; else if (h < e_config->winlist_pos_min_h) h = e_config->winlist_pos_min_h; if (h > zone->h) h = zone->h; - y = (double)(zone->h - h) * e_config->winlist_pos_align_y; + y = zone->y + (double)(zone->h - h) * e_config->winlist_pos_align_y; - e_popup_move_resize(_winlist, x, y, w, h); + evas_object_geometry_set(_winlist, x, y, w, h); } static void -_e_winlist_border_add(E_Border *bd, E_Zone *zone, E_Desk *desk) +_e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk) { E_Winlist_Win *ww; Evas_Coord mw, mh; Evas_Object *o; - if ((!bd->client.icccm.accepts_focus) && - (!bd->client.icccm.take_focus)) return; - if (bd->client.netwm.state.skip_taskbar) return; - if (bd->user_skip_winlist) return; - if (bd->iconic) + if ((!ec->icccm.accepts_focus) && + (!ec->icccm.take_focus)) return; + if (ec->netwm.state.skip_taskbar) return; + if (ec->user_skip_winlist) return; + if (ec->iconic) { if (!e_config->winlist_list_show_iconified) return; - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_iconified)) return; - if ((bd->desk != desk) && + if ((ec->desk != desk) && (!e_config->winlist_list_show_other_desk_iconified)) return; } else { - if (bd->sticky) + if (ec->sticky) { - if ((bd->zone != zone) && + if ((ec->zone != zone) && (!e_config->winlist_list_show_other_screen_windows)) return; } else { - if (bd->desk != desk) + if (ec->desk != desk) { - if ((bd->zone) && (bd->zone != zone)) + if ((ec->zone) && (ec->zone != zone)) { if (!e_config->winlist_list_show_other_screen_windows) return; - if (bd->zone && bd->desk && (bd->desk != e_desk_current_get(bd->zone))) + if (ec->zone && ec->desk && (ec->desk != e_desk_current_get(ec->zone))) { if (!e_config->winlist_list_show_other_desk_windows) return; @@ -866,30 +848,30 @@ _e_winlist_border_add(E_Border *bd, E_Zone *zone, E_Desk *desk) ww = E_NEW(E_Winlist_Win, 1); if (!ww) return; - ww->border = bd; + ww->client = ec; _wins = eina_list_append(_wins, ww); - o = edje_object_add(_winlist->evas); - e_popup_object_add(_winlist, o); + o = edje_object_add(ec->comp->evas); + e_comp_object_util_del_list_append(_winlist, o); ww->bg_object = o; e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/item"); - edje_object_part_text_set(o, "e.text.label", e_border_name_get(ww->border)); + edje_object_part_text_set(o, "e.text.label", e_client_name_get(ww->client)); evas_object_show(o); if (edje_object_part_exists(ww->bg_object, "e.swallow.icon")) { - o = e_border_icon_add(bd, _winlist->evas); + o = e_client_icon_add(ec, ec->comp->evas); ww->icon_object = o; - e_popup_object_add(_winlist, o); + e_comp_object_util_del_list_append(_winlist, o); edje_object_part_swallow(ww->bg_object, "e.swallow.icon", o); evas_object_show(o); } - if (bd->shaded) + if (ec->shaded) edje_object_signal_emit(ww->bg_object, "e,state,shaded", "e"); - else if (bd->iconic) + else if (ec->iconic) edje_object_signal_emit(ww->bg_object, "e,state,iconified", "e"); - else if (bd->desk != desk) + else if (ec->desk != desk) { - if (!((bd->sticky) && (bd->zone == zone))) + if (!((ec->sticky) && (ec->zone == zone))) edje_object_signal_emit(ww->bg_object, "e,state,invisible", "e"); } @@ -902,21 +884,21 @@ _e_winlist_border_add(E_Border *bd, E_Zone *zone, E_Desk *desk) mw, mh, /* min */ 9999, mh /* max */ ); - e_object_ref(E_OBJECT(ww->border)); + e_object_ref(E_OBJECT(ww->client)); } static void -_e_winlist_border_del(E_Border *bd) +_e_winlist_client_del(E_Client *ec) { E_Winlist_Win *ww; Eina_List *l; - if (bd == _last_border) _last_border = NULL; + if (ec == _last_client) _last_client = NULL; EINA_LIST_FOREACH(_wins, l, ww) { - if (ww->border == bd) + if (ww->client == ec) { - e_object_unref(E_OBJECT(ww->border)); + e_object_unref(E_OBJECT(ww->client)); if (l == _win_selected) { _win_selected = l->next; @@ -924,11 +906,11 @@ _e_winlist_border_del(E_Border *bd) _e_winlist_show_active(); _e_winlist_activate(); } - e_popup_object_remove(_winlist, ww->bg_object); + e_comp_object_util_del_list_remove(_winlist, ww->bg_object); evas_object_del(ww->bg_object); if (ww->icon_object) { - e_popup_object_remove(_winlist, ww->icon_object); + e_comp_object_util_del_list_remove(_winlist, ww->icon_object); evas_object_del(ww->icon_object); } E_FREE(ww); @@ -969,45 +951,42 @@ _e_winlist_activate(void) edje_object_signal_emit(ww->icon_object, "e,state,selected", "e"); - if ((ww->border->iconic) && + if ((ww->client->iconic) && (e_config->winlist_list_uncover_while_selecting)) { - if (!ww->border->lock_user_iconify) - e_border_uniconify(ww->border); + if (!ww->client->lock_user_iconify) + e_client_uniconify(ww->client); ww->was_iconified = 1; ok = 1; } - if ((!ww->border->sticky) && - (ww->border->desk != e_desk_current_get(_winlist->zone)) && + if ((!ww->client->sticky) && + (ww->client->desk != e_desk_current_get(_winlist_zone)) && (e_config->winlist_list_jump_desk_while_selecting)) { - if (ww->border->desk) e_desk_show(ww->border->desk); + if (ww->client->desk) e_desk_show(ww->client->desk); ok = 1; } - if (((ww->border->shaded) || - ((ww->border->changes.shaded) && - (ww->border->shade.val != ww->border->shaded) && - (ww->border->shade.val))) && - (ww->border->desk == e_desk_current_get(_winlist->zone)) && + if ((ww->client->shaded || ww->client->shading) && + (ww->client->desk == e_desk_current_get(_winlist_zone)) && (e_config->winlist_list_uncover_while_selecting)) { - if (!ww->border->lock_user_shade) - e_border_unshade(ww->border, ww->border->shade.dir); + if (!ww->client->lock_user_shade) + e_client_unshade(ww->client, ww->client->shade_dir); ww->was_shaded = 1; ok = 1; } - if ((!ww->border->iconic) && - ((ww->border->desk == e_desk_current_get(_winlist->zone)) || - (ww->border->sticky))) + if ((!ww->client->iconic) && + ((ww->client->desk == e_desk_current_get(_winlist_zone)) || + (ww->client->sticky))) ok = 1; if (ok) { int set = 1; if (e_config->winlist_warp_while_selecting) { - if (!e_border_pointer_warp_to_center_now(ww->border)) + if (!e_client_pointer_warp_to_center_now(ww->client)) { - e_border_focus_set(ww->border, 1, 1); + evas_object_focus_set(ww->client->frame, 1); set = 0; } if (!_animator) @@ -1018,29 +997,29 @@ _e_winlist_activate(void) E_FREE_FUNC(_animator, ecore_animator_del); } - if ((!ww->border->lock_user_stacking) && + if ((!ww->client->lock_user_stacking) && (e_config->winlist_list_raise_while_selecting)) - e_border_raise(ww->border); - if ((!ww->border->lock_focus_out) && + evas_object_raise(ww->client->frame); + if ((!ww->client->lock_focus_out) && (e_config->winlist_list_focus_while_selecting)) { - e_border_focus_set(ww->border, 1, set); - if (set) e_border_focus_set(ww->border, 1, 0); + if (set) + evas_object_focus_set(ww->client->frame, 1); } } edje_object_part_text_set(_bg_object, "e.text.label", - e_border_name_get(ww->border)); + e_client_name_get(ww->client)); if (_icon_object) { - e_popup_object_remove(_winlist, _icon_object); + e_comp_object_util_del_list_remove(_winlist, _icon_object); evas_object_del(_icon_object); _icon_object = NULL; } if (edje_object_part_exists(_bg_object, "e.swallow.icon")) { - o = e_border_icon_add(ww->border, _winlist->evas); + o = e_client_icon_add(ww->client, evas_object_evas_get(_winlist)); _icon_object = o; - e_popup_object_add(_winlist, o); + e_comp_object_util_del_list_append(_winlist, o); edje_object_part_swallow(_bg_object, "e.swallow.icon", o); evas_object_show(o); } @@ -1057,13 +1036,13 @@ _e_winlist_deactivate(void) ww = _win_selected->data; if (ww->was_shaded) { - if (!ww->border->lock_user_shade) - e_border_shade(ww->border, ww->border->shade.dir); + if (!ww->client->lock_user_shade) + e_client_shade(ww->client, ww->client->shade_dir); } if (ww->was_iconified) { - if (!ww->border->lock_user_iconify) - e_border_iconify(ww->border); + if (!ww->client->lock_user_iconify) + e_client_iconify(ww->client); } ww->was_shaded = 0; ww->was_iconified = 0; @@ -1072,8 +1051,8 @@ _e_winlist_deactivate(void) if (ww->icon_object) edje_object_signal_emit(ww->icon_object, "e,state,unselected", "e"); - if (!ww->border->lock_focus_in) - e_border_focus_set(ww->border, 0, 0); + if (!ww->client->lock_focus_in) + evas_object_focus_set(ww->client->frame, 0); } static void @@ -1113,15 +1092,15 @@ _e_winlist_restore_desktop(void) e_config->winlist_list_show_other_screen_windows)) e_desk_show(_last_desk); if (e_config->winlist_warp_while_selecting) - ecore_x_pointer_warp(_winlist->zone->container->win, + ecore_x_pointer_warp(_winlist_zone->comp->win, _last_pointer_x, _last_pointer_y); _e_winlist_deactivate(); _win_selected = NULL; e_winlist_hide(); - if (_last_border) + if (_last_client) { - e_border_focus_set(_last_border, 1, 1); - _last_border = NULL; + evas_object_focus_set(_last_client->frame, 1); + _last_client = NULL; } } @@ -1129,11 +1108,10 @@ static Eina_Bool _e_winlist_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Add *ev; + E_Event_Client *ev = event; - ev = event; - _e_winlist_border_add(ev->border, _winlist->zone, - e_desk_current_get(_winlist->zone)); + _e_winlist_client_add(ev->ec, _winlist_zone, + e_desk_current_get(_winlist_zone)); _e_winlist_size_adjust(); return ECORE_CALLBACK_PASS_ON; } @@ -1142,10 +1120,9 @@ static Eina_Bool _e_winlist_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event) { - E_Event_Border_Remove *ev; + E_Event_Client *ev = event; - ev = event; - _e_winlist_border_del(ev->border); + _e_winlist_client_del(ev->ec); _e_winlist_size_adjust(); return ECORE_CALLBACK_PASS_ON; } @@ -1217,9 +1194,9 @@ _e_winlist_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) { if (!_act_winlist) continue; if (_act_winlist->func.go_key) - _act_winlist->func.go_key(E_OBJECT(_winlist->zone), binding->params, ev); + _act_winlist->func.go_key(E_OBJECT(_winlist_zone), binding->params, ev); else if (_act_winlist->func.go) - _act_winlist->func.go(E_OBJECT(_winlist->zone), binding->params); + _act_winlist->func.go(E_OBJECT(_winlist_zone), binding->params); } } } @@ -1283,9 +1260,9 @@ _e_winlist_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event) { if (!_act_winlist) continue; if (_act_winlist->func.end_key) - _act_winlist->func.end_key(E_OBJECT(_winlist->zone), binding->params, ev); + _act_winlist->func.end_key(E_OBJECT(_winlist_zone), binding->params, ev); else if (_act_winlist->func.end) - _act_winlist->func.end(E_OBJECT(_winlist->zone), binding->params); + _act_winlist->func.end(E_OBJECT(_winlist_zone), binding->params); } } @@ -1300,7 +1277,7 @@ _e_winlist_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event ev = event; if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON; e_bindings_mouse_down_ecore_event_handle(E_BINDING_CONTEXT_WINLIST, - E_OBJECT(_winlist->zone), ev); + E_OBJECT(_winlist_zone), ev); return ECORE_CALLBACK_PASS_ON; } @@ -1311,7 +1288,7 @@ _e_winlist_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) ev = event; if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON; - if (e_bindings_mouse_up_ecore_event_handle(E_BINDING_CONTEXT_WINLIST, E_OBJECT(_winlist->zone), ev)) + if (e_bindings_mouse_up_ecore_event_handle(E_BINDING_CONTEXT_WINLIST, E_OBJECT(_winlist_zone), ev)) return ECORE_CALLBACK_RENEW; if (_activate_type != E_WINLIST_ACTIVATE_TYPE_MOUSE) return ECORE_CALLBACK_RENEW; if (!--_hold_count) e_winlist_hide(); @@ -1327,7 +1304,7 @@ _e_winlist_cb_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *even ev = event; if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON; e_bindings_wheel_ecore_event_handle(E_BINDING_CONTEXT_WINLIST, - E_OBJECT(_winlist->zone), ev); + E_OBJECT(_winlist_zone), ev); if (ev->z < 0) /* up */ { for (i = ev->z; i < 0; i++) @@ -1345,14 +1322,14 @@ static Eina_Bool _e_winlist_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Event_Mouse_Move *ev; + int x, y, w, h; ev = event; if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON; + evas_object_geometry_get(_winlist, &x, &y, &w, &h); /* only feed mouse move if it's within the winlist popup */ - if (E_INSIDE(ev->x - _winlist->zone->x, ev->y - _winlist->zone->y, _winlist->x, _winlist->y, _winlist->w, _winlist->h)) - evas_event_feed_mouse_move(_winlist->evas, ev->x - _winlist->x + - _winlist->zone->x, ev->y - _winlist->y + - _winlist->zone->y, ev->timestamp, NULL); + if (E_INSIDE(ev->x, ev->y, x, y, w, h)) + evas_event_feed_mouse_move(evas_object_evas_get(_winlist), ev->x, ev->y, ev->timestamp, NULL); return ECORE_CALLBACK_PASS_ON; } diff --git a/src/modules/wizard/e_wizard.c b/src/modules/wizard/e_wizard.c index cd3bd6e0f..05bc452cd 100644 --- a/src/modules/wizard/e_wizard.c +++ b/src/modules/wizard/e_wizard.c @@ -1,8 +1,8 @@ #include "e_wizard.h" static void _e_wizard_next_eval(void); -static E_Popup *_e_wizard_main_new(E_Zone *zone); -static E_Popup *_e_wizard_extra_new(E_Zone *zone); +static Evas_Object *_e_wizard_main_new(E_Zone *zone); +static Evas_Object *_e_wizard_extra_new(E_Zone *zone); static Eina_Bool _e_wizard_cb_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); static void _e_wizard_cb_next(void *data, Evas_Object *obj, const char *emission, const char *source); @@ -12,7 +12,7 @@ static Eina_Bool _e_wizard_cb_next_page(void *data); static Eina_Bool _e_wizard_cb_desktops_update(void *data, int ev_type, void *ev); static Eina_Bool _e_wizard_cb_icons_update(void *data, int ev_type, void *ev); -static E_Popup *pop = NULL; +static Evas_Object *pop = NULL; static Eina_List *pops = NULL; static Evas_Object *o_bg = NULL; static Evas_Object *o_content = NULL; @@ -25,9 +25,7 @@ static int next_can = 0; static Eina_List *handlers = NULL; static Eina_Bool got_desktops = EINA_FALSE; static Eina_Bool got_icons = EINA_FALSE; -#if (EFREET_VERSION_MAJOR > 1) || (EFREET_VERSION_MINOR >= 8) static Eina_Bool xdg_error = EINA_FALSE; -#endif static Eina_Bool need_xdg_desktops = EINA_FALSE; static Eina_Bool need_xdg_icons = EINA_FALSE; @@ -36,26 +34,18 @@ static Ecore_Timer *next_timer = NULL; EAPI int e_wizard_init(void) { - E_Manager *man; - Eina_List *l; + E_Comp *comp; + E_Zone *zone; + const Eina_List *l, *ll; - EINA_LIST_FOREACH(e_manager_list(), l, man) + EINA_LIST_FOREACH(e_comp_list(), l, comp) { - E_Container *con; - Eina_List *l2; - - EINA_LIST_FOREACH(man->containers, l2, con) + EINA_LIST_FOREACH(comp->zones, ll, zone) { - Eina_List *l3; - E_Zone *zone; - - EINA_LIST_FOREACH(con->zones, l3, zone) - { - if (!pop) - pop = _e_wizard_main_new(zone); - else - pops = eina_list_append(pops, _e_wizard_extra_new(zone)); - } + if (!pop) + pop = _e_wizard_main_new(zone); + else + pops = eina_list_append(pops, _e_wizard_extra_new(zone)); } } @@ -71,16 +61,9 @@ e_wizard_init(void) EAPI int e_wizard_shutdown(void) { - E_Object *eo; + E_FREE_FUNC(pop, evas_object_del); + E_FREE_LIST(pops, evas_object_del); - if (pop) - { - e_object_del(E_OBJECT(pop)); - pop = NULL; - } - - EINA_LIST_FREE(pops, eo) - e_object_del(eo); while (pages) e_wizard_page_del(pages); @@ -189,7 +172,7 @@ e_wizard_page_add(void *handle, if (!pg) return NULL; pg->handle = handle; - pg->evas = pop->evas; + pg->evas = evas_object_evas_get(pop); pg->init = init_cb; pg->shutdown = shutdown_cb; @@ -271,46 +254,37 @@ _e_wizard_next_eval(void) } } -static E_Popup * +static Evas_Object * _e_wizard_main_new(E_Zone *zone) { - E_Popup *popup; - - popup = e_popup_new(zone, 0, 0, zone->w, zone->h); - o_bg = edje_object_add(popup->evas); + o_bg = edje_object_add(zone->comp->evas); e_theme_edje_object_set(o_bg, "base/theme/wizard", "e/wizard/main"); edje_object_part_text_set(o_bg, "e.text.title", _("Welcome to Enlightenment")); edje_object_signal_callback_add(o_bg, "e,action,next", "", - _e_wizard_cb_next, popup); - e_popup_move_resize(popup, 0, 0, zone->w, zone->h); - e_popup_layer_set(popup, E_COMP_CANVAS_LAYER_POPUP, 0); - e_popup_content_set(popup, o_bg); + _e_wizard_cb_next, o_bg); + evas_object_geometry_set(o_bg, zone->x, zone->y, zone->w, zone->h); + evas_object_layer_set(o_bg, E_LAYER_POPUP); /* set up next/prev buttons */ // edje_object_signal_emit(o_bg, "e,state,next,disable", "e"); e_wizard_labels_update(); - e_popup_show(popup); - return popup; + evas_object_show(o_bg); + return o_bg; } -static E_Popup * +static Evas_Object * _e_wizard_extra_new(E_Zone *zone) { - E_Popup *popup; Evas_Object *o; - popup = e_popup_new(zone, 0, 0, zone->w, zone->h); - e_popup_layer_set(popup, E_COMP_CANVAS_LAYER_POPUP, 0); - o = edje_object_add(popup->evas); + o = edje_object_add(zone->comp->evas); e_theme_edje_object_set(o, "base/theme/wizard", "e/wizard/extra"); - evas_object_move(o, 0, 0); - evas_object_resize(o, zone->w, zone->h); + evas_object_geometry_set(o, zone->x, zone->y, zone->w, zone->h); + evas_object_layer_set(o, E_LAYER_POPUP); evas_object_show(o); - e_popup_content_set(popup, o); - e_popup_show(popup); - return popup; + return o; } static Eina_Bool diff --git a/src/modules/wizard/page_050.c b/src/modules/wizard/page_050.c index ceddfeed6..917df6e55 100644 --- a/src/modules/wizard/page_050.c +++ b/src/modules/wizard/page_050.c @@ -71,7 +71,7 @@ _scale_preview_new(Evas *e, double sc, double *scp) evas_object_show(bg); cm = edje_object_add(e_widget_preview_evas_get(ob)); - e_theme_edje_object_set(cm, "base/theme/borders", "e/comp/border/default"); + e_theme_edje_object_set(cm, "base/theme/comp", "e/comp/frame/default"); evas_object_move(cm, 16, 16); evas_object_resize(cm, 180 * sc, 80); evas_object_show(cm); diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index e3c297ccd..114516f03 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -41,24 +41,24 @@ static void _e_wl_shell_shell_surface_type_set(E_Wayland_Shell_Surface *ewss); static void _e_wl_shell_shell_surface_type_reset(E_Wayland_Shell_Surface *ewss); static void _e_wl_shell_shell_surface_cb_destroy(struct wl_listener *listener, void *data EINA_UNUSED); static int _e_wl_shell_shell_surface_cb_ping_timeout(void *data); -static void _e_wl_shell_shell_surface_cb_ee_resize(Ecore_Evas *ee); -static void _e_wl_shell_shell_surface_cb_render_post(void *data, Evas *evas EINA_UNUSED, void *event EINA_UNUSED); -static void _e_wl_shell_shell_surface_cb_focus_in(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED); -static void _e_wl_shell_shell_surface_cb_focus_out(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED); -static void _e_wl_shell_shell_surface_cb_mouse_in(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED); -static void _e_wl_shell_shell_surface_cb_mouse_out(void *data, Evas_Object *obj EINA_UNUSED, void *event); -static void _e_wl_shell_shell_surface_cb_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, void *event); -static void _e_wl_shell_shell_surface_cb_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, void *event); -static void _e_wl_shell_shell_surface_cb_mouse_down(void *data, Evas_Object *obj EINA_UNUSED, void *event); -static void _e_wl_shell_shell_surface_cb_mouse_wheel(void *data, Evas_Object *obj EINA_UNUSED, void *event); -static void _e_wl_shell_shell_surface_cb_key_up(void *data, Evas_Object *obj EINA_UNUSED, void *event); -static void _e_wl_shell_shell_surface_cb_key_down(void *data, Evas_Object *obj EINA_UNUSED, void *event); -static void _e_wl_shell_shell_surface_cb_bd_move_end(void *data, void *bd); -static void _e_wl_shell_shell_surface_cb_bd_resize_update(void *data, void *bd); -static void _e_wl_shell_shell_surface_cb_bd_resize_end(void *data, void *bd); -static void _e_wl_shell_mouse_down_helper(E_Border *bd, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev, Eina_Bool move); -static void _e_wl_shell_mouse_up_helper(E_Border *bd, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev); +static void _e_wl_shell_render_post(void *data, Evas *e EINA_UNUSED, void *event EINA_UNUSED); +static void _e_wl_shell_shell_surface_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event); +static void _e_wl_shell_shell_surface_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event); +static void _e_wl_shell_shell_surface_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event); +static void _e_wl_shell_shell_surface_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event); +static void _e_wl_shell_shell_surface_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event); +static void _e_wl_shell_shell_surface_cb_key_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event); +static void _e_wl_shell_shell_surface_cb_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED); +static void _e_wl_shell_shell_surface_cb_ec_hook_focus_set(void *data, E_Client *ec); +static void _e_wl_shell_shell_surface_cb_ec_hook_focus_unset(void *data, E_Client *ec); +static void _e_wl_shell_shell_surface_cb_ec_hook_move_end(void *data, E_Client *ec); +static void _e_wl_shell_shell_surface_cb_ec_hook_resize_update(void *data, E_Client *ec); +static void _e_wl_shell_shell_surface_cb_ec_hook_resize_end(void *data, E_Client *ec); +static void _e_wl_shell_surface_cb_smart_client_resize(void *data, Evas_Object *obj, void *event_info); + +static void _e_wl_shell_mouse_down_helper(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev, Eina_Bool move); +static void _e_wl_shell_mouse_up_helper(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev EINA_UNUSED); /* shell surface interface prototypes */ static void _e_wl_shell_shell_surface_cb_pong(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, unsigned int serial); @@ -155,6 +155,8 @@ static const struct wl_pointer_grab_interface _e_busy_grab_interface = /* local variables */ +static Eina_List *ec_hooks = NULL; + /* external variables */ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" }; @@ -165,7 +167,8 @@ e_modapi_init(E_Module *m) E_Wayland_Desktop_Shell *shell = NULL; struct wl_global *gshell = NULL; E_Wayland_Input *input = NULL; - Eina_List *l = NULL; + const Eina_List *l = NULL; + E_Comp *comp; /* test for valid compositor */ if (!_e_wl_comp) return NULL; @@ -218,6 +221,27 @@ e_modapi_init(E_Module *m) wl_signal_add(&input->wl.seat.pointer->focus_signal, lst); } + ec_hooks = eina_list_append(ec_hooks, + e_client_hook_add(E_CLIENT_HOOK_FOCUS_SET, + _e_wl_shell_shell_surface_cb_ec_hook_focus_set, NULL)); + ec_hooks = eina_list_append(ec_hooks, + e_client_hook_add(E_CLIENT_HOOK_FOCUS_UNSET, + _e_wl_shell_shell_surface_cb_ec_hook_focus_unset, NULL)); + + ec_hooks = eina_list_append(ec_hooks, + e_client_hook_add(E_CLIENT_HOOK_MOVE_END, + _e_wl_shell_shell_surface_cb_ec_hook_move_end, NULL)); + ec_hooks = eina_list_append(ec_hooks, + e_client_hook_add(E_CLIENT_HOOK_RESIZE_END, + _e_wl_shell_shell_surface_cb_ec_hook_resize_end, NULL)); + ec_hooks = eina_list_append(ec_hooks, + e_client_hook_add(E_CLIENT_HOOK_RESIZE_UPDATE, + _e_wl_shell_shell_surface_cb_ec_hook_resize_update, NULL)); + + EINA_LIST_FOREACH(e_comp_list(), l, comp) + evas_event_callback_add(comp->evas, EVAS_CALLBACK_RENDER_POST, + _e_wl_shell_render_post, NULL); + return m; err: @@ -236,6 +260,13 @@ err: EAPI int e_modapi_shutdown(E_Module *m EINA_UNUSED) { + const Eina_List *l; + E_Comp *comp; + + E_FREE_LIST(ec_hooks, e_client_hook_del); + EINA_LIST_FOREACH(e_comp_list(), l, comp) + evas_event_callback_del_full(comp->evas, EVAS_CALLBACK_RENDER_POST, + _e_wl_shell_render_post, NULL); /* nothing to do here as shell will get the destroy callback from * the compositor and we can cleanup there */ return 1; @@ -574,92 +605,49 @@ _e_wl_shell_shell_surface_create(void *shell, E_Wayland_Surface *ews, const void static void _e_wl_shell_shell_surface_create_toplevel(E_Wayland_Surface *ews) { - E_Container *con; + E_Comp *comp; /* get the current container */ - con = e_container_current_get(e_manager_current_get()); + comp = e_util_comp_current_get(); - /* create the ecore_evas */ - ews->ee = ecore_evas_new(NULL, ews->geometry.x, ews->geometry.y, - ews->geometry.w, ews->geometry.h, NULL); - ecore_evas_alpha_set(ews->ee, EINA_TRUE); - ecore_evas_borderless_set(ews->ee, EINA_TRUE); - ecore_evas_callback_resize_set(ews->ee, - _e_wl_shell_shell_surface_cb_ee_resize); - ecore_evas_data_set(ews->ee, "surface", ews); + /* create the e client for this surface */ + ews->ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, e_pixmap_window_get(ews->pixmap)); + if (!ews->ec) + ews->ec = e_client_new(comp, ews->pixmap, 1, 0); + e_pixmap_ref(ews->pixmap); + ews->ec->argb = 1; + ews->ec->no_shape_cut = 1; // specify no input shape cutting for this client + ews->ec->lock_border = ews->ec->borderless = !ews->ec->internal; + ews->ec->border.changed = ews->ec->changes.border = !ews->ec->borderless; + ews->ec->comp_data = (E_Comp_Client_Data*)ews; + ews->ec->icccm.title = eina_stringshare_ref(ews->shell_surface->title); + ews->ec->icccm.class = eina_stringshare_ref(ews->shell_surface->clas); + EC_CHANGED(ews->ec); - /* ecore_evas_input_event_unregister(ews->ee); */ - - ews->evas_win = ecore_evas_window_get(ews->ee); - - /* get a reference to the canvas */ - ews->evas = ecore_evas_get(ews->ee); - - /* setup a post_render callback */ - evas_event_callback_add(ews->evas, EVAS_CALLBACK_RENDER_POST, - _e_wl_shell_shell_surface_cb_render_post, ews); - - /* create a surface smart object */ - ews->obj = e_surface_add(ews->evas); - evas_object_move(ews->obj, 0, 0); - evas_object_resize(ews->obj, ews->geometry.w, ews->geometry.h); - evas_object_show(ews->obj); - - /* hook smart object callbacks */ - evas_object_smart_callback_add(ews->obj, "mouse_in", - _e_wl_shell_shell_surface_cb_mouse_in, ews); - evas_object_smart_callback_add(ews->obj, "mouse_out", + /* hook object callbacks */ + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_OUT, _e_wl_shell_shell_surface_cb_mouse_out, ews); - evas_object_smart_callback_add(ews->obj, "mouse_move", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_MOVE, _e_wl_shell_shell_surface_cb_mouse_move, ews); - evas_object_smart_callback_add(ews->obj, "mouse_up", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_UP, _e_wl_shell_shell_surface_cb_mouse_up, ews); - evas_object_smart_callback_add(ews->obj, "mouse_down", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_DOWN, _e_wl_shell_shell_surface_cb_mouse_down, ews); - evas_object_smart_callback_add(ews->obj, "mouse_wheel", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_WHEEL, _e_wl_shell_shell_surface_cb_mouse_wheel, ews); - evas_object_smart_callback_add(ews->obj, "key_up", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_KEY_UP, _e_wl_shell_shell_surface_cb_key_up, ews); - evas_object_smart_callback_add(ews->obj, "key_down", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_KEY_DOWN, _e_wl_shell_shell_surface_cb_key_down, ews); - evas_object_smart_callback_add(ews->obj, "focus_in", - _e_wl_shell_shell_surface_cb_focus_in, ews); - evas_object_smart_callback_add(ews->obj, "focus_out", - _e_wl_shell_shell_surface_cb_focus_out, ews); + evas_object_smart_callback_add(ews->ec->frame, "client_resize", + _e_wl_shell_surface_cb_smart_client_resize, ews); - ecore_x_icccm_size_pos_hints_set(ews->evas_win, 0, ECORE_X_GRAVITY_NW, - 0, 0, 9999, 9999, 0, 0, 1, 1, 0.0, 0.0); - ecore_x_icccm_transient_for_unset(ews->evas_win); - ecore_x_netwm_window_type_set(ews->evas_win, ECORE_X_WINDOW_TYPE_NORMAL); - - ecore_evas_lower(ews->ee); - - /* create the e border for this surface */ - ews->bd = e_border_new(con, ews->evas_win, 1, 1); - e_surface_border_input_set(ews->obj, ews->bd); - ews->bd->re_manage = 0; - ews->bd->internal = 1; - ews->bd->internal_ecore_evas = ews->ee; - ews->bd->internal_no_remember = 1; - ews->bd->internal_no_reopen = 1; - - e_border_move_resize(ews->bd, ews->geometry.x, ews->geometry.y, + ews->ec->client.w = ews->geometry.w; + ews->ec->client.h = ews->geometry.h; + evas_object_geometry_set(ews->ec->frame, ews->geometry.x, ews->geometry.y, ews->geometry.w, ews->geometry.h); - e_border_show(ews->bd); - - ews->bd_hooks = - eina_list_append(ews->bd_hooks, - e_border_hook_add(E_BORDER_HOOK_MOVE_END, - _e_wl_shell_shell_surface_cb_bd_move_end, ews)); - ews->bd_hooks = - eina_list_append(ews->bd_hooks, - e_border_hook_add(E_BORDER_HOOK_RESIZE_END, - _e_wl_shell_shell_surface_cb_bd_resize_end, ews)); - ews->bd_hooks = - eina_list_append(ews->bd_hooks, - e_border_hook_add(E_BORDER_HOOK_RESIZE_UPDATE, - _e_wl_shell_shell_surface_cb_bd_resize_update, ews)); + evas_object_show(ews->ec->frame); ews->mapped = EINA_TRUE; } @@ -668,76 +656,55 @@ static void _e_wl_shell_shell_surface_create_popup(E_Wayland_Surface *ews) { E_Wayland_Shell_Surface *ewss = NULL; - Ecore_X_Window parent = 0; struct wl_seat *seat; - char opts[PATH_MAX]; + //char opts[PATH_MAX]; + E_Comp *comp; /* try to get the shell surface */ if (!(ewss = ews->shell_surface)) return; - + /* get the current comp */ if (ewss->parent) - parent = ecore_evas_window_get(ewss->parent->ee); + comp = ewss->parent->ec->comp; + else + comp = e_util_comp_current_get(); - snprintf(opts, sizeof(opts), "parent=%d", parent); + /* create the e client for this surface */ + ews->ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, e_pixmap_window_get(ews->pixmap)); + if (!ews->ec) + ews->ec = e_client_new(comp, ews->pixmap, 1, 0); + e_pixmap_ref(ews->pixmap); + ews->ec->argb = 1; + ews->ec->no_shape_cut = 1; // specify no input shape cutting for this client + ews->ec->lock_border = ews->ec->borderless = !ews->ec->internal; + ews->ec->border.changed = ews->ec->changes.border = !ews->ec->borderless; + ews->ec->comp_data = (E_Comp_Client_Data*)ews; + ews->ec->icccm.title = eina_stringshare_ref(ewss->title); + ews->ec->icccm.class = eina_stringshare_ref(ewss->clas); + EC_CHANGED(ews->ec); - /* create an ecore evas to represent this 'popup' */ - ews->ee = ecore_evas_new(NULL, ewss->popup.x, ewss->popup.y, - ews->geometry.w, ews->geometry.h, opts); - - ecore_evas_alpha_set(ews->ee, EINA_TRUE); - ecore_evas_borderless_set(ews->ee, EINA_TRUE); - ecore_evas_override_set(ews->ee, EINA_TRUE); - ecore_evas_callback_resize_set(ews->ee, - _e_wl_shell_shell_surface_cb_ee_resize); - ecore_evas_data_set(ews->ee, "surface", ews); - - ecore_evas_input_event_unregister(ews->ee); - - ews->evas_win = ecore_evas_window_get(ews->ee); - - /* get a reference to the canvas */ - ews->evas = ecore_evas_get(ews->ee); - - /* setup a post_render callback */ - evas_event_callback_add(ews->evas, EVAS_CALLBACK_RENDER_POST, - _e_wl_shell_shell_surface_cb_render_post, ews); - - /* create a surface smart object */ - ews->obj = e_surface_add(ews->evas); - evas_object_move(ews->obj, 0, 0); - evas_object_resize(ews->obj, ews->geometry.w, ews->geometry.h); - evas_object_show(ews->obj); - - /* hook smart object callbacks */ - evas_object_smart_callback_add(ews->obj, "mouse_in", - _e_wl_shell_shell_surface_cb_mouse_in, ews); - evas_object_smart_callback_add(ews->obj, "mouse_out", + /* hook object callbacks */ + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_OUT, _e_wl_shell_shell_surface_cb_mouse_out, ews); - evas_object_smart_callback_add(ews->obj, "mouse_move", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_MOVE, _e_wl_shell_shell_surface_cb_mouse_move, ews); - evas_object_smart_callback_add(ews->obj, "mouse_up", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_UP, _e_wl_shell_shell_surface_cb_mouse_up, ews); - evas_object_smart_callback_add(ews->obj, "mouse_down", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_DOWN, _e_wl_shell_shell_surface_cb_mouse_down, ews); - evas_object_smart_callback_add(ews->obj, "mouse_wheel", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_MOUSE_WHEEL, _e_wl_shell_shell_surface_cb_mouse_wheel, ews); - evas_object_smart_callback_add(ews->obj, "key_up", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_KEY_UP, _e_wl_shell_shell_surface_cb_key_up, ews); - evas_object_smart_callback_add(ews->obj, "key_down", + evas_object_event_callback_add(ews->ec->frame, EVAS_CALLBACK_KEY_DOWN, _e_wl_shell_shell_surface_cb_key_down, ews); - evas_object_smart_callback_add(ews->obj, "focus_in", - _e_wl_shell_shell_surface_cb_focus_in, ews); - evas_object_smart_callback_add(ews->obj, "focus_out", - _e_wl_shell_shell_surface_cb_focus_out, ews); + evas_object_smart_callback_add(ews->ec->frame, "client_resize", + _e_wl_shell_surface_cb_smart_client_resize, ews); - ecore_x_icccm_size_pos_hints_set(ews->evas_win, 0, ECORE_X_GRAVITY_NW, - 0, 0, 9999, 9999, 0, 0, 1, 1, 0.0, 0.0); - - ecore_x_icccm_transient_for_set(ews->evas_win, parent); - ecore_x_netwm_window_type_set(ews->evas_win, ECORE_X_WINDOW_TYPE_POPUP_MENU); - - /* ecore_evas_lower(ews->ee); */ - ecore_evas_show(ews->ee); + ews->ec->client.w = ews->geometry.w; + ews->ec->client.h = ews->geometry.h; + evas_object_geometry_set(ews->ec->frame, ews->geometry.x, ews->geometry.y, + ews->geometry.w, ews->geometry.h); + evas_object_show(ews->ec->frame); ews->mapped = EINA_TRUE; /* set popup properties */ @@ -839,20 +806,25 @@ _e_wl_shell_shell_surface_configure(E_Wayland_Surface *ews, Evas_Coord x, Evas_C else if ((changed_type) || (x != 0) || (y != 0) || (ews->geometry.w != w) || (ews->geometry.h != h)) { - Evas_Coord fx = 0, fy = 0; - Evas_Coord tx = 0, ty = 0; - - fx += ews->geometry.x; - fy += ews->geometry.y; - - tx = x + ews->geometry.x; - ty = y + ews->geometry.y; - - ews->geometry.x = ews->geometry.x + tx - fx; - ews->geometry.y = ews->geometry.y + ty - fy; + if (ews->ec && e_client_resizing_get(ews->ec)) return; ews->geometry.w = w; ews->geometry.h = h; ews->geometry.changed = EINA_TRUE; + if (ews->ec) + { + if ((ews->geometry.x != x) || (ews->geometry.y != y)) + { + ews->ec->client.x = ews->geometry.x = x; + ews->ec->client.y = ews->geometry.y = y; + e_comp_object_frame_xy_adjust(ews->ec->frame, x, y, &ews->ec->x, &ews->ec->y); + ews->ec->changes.size = 1; + } + ews->ec->client.w = w; + ews->ec->client.h = h; + e_comp_object_frame_wh_adjust(ews->ec->frame, w, h, &ews->ec->w, &ews->ec->h); + ews->ec->changes.pos = 1; + EC_CHANGED(ews->ec); + } } } @@ -907,11 +879,10 @@ _e_wl_shell_shell_surface_map(E_Wayland_Surface *ews, Evas_Coord x, Evas_Coord y case E_WAYLAND_SHELL_SURFACE_TYPE_POPUP: _e_wl_shell_shell_surface_create_popup(ews); break; - default: - break; + default: return; } - if (ews->bd) - e_comp_wl_border_surface_add(ews->id, ews->bd); + if (ews->ec && ews->ec->icccm.title) + e_comp_object_frame_title_set(ews->ec->frame, ews->ec->icccm.title); } static void @@ -919,13 +890,9 @@ _e_wl_shell_shell_surface_unmap(E_Wayland_Surface *ews) { Eina_List *l = NULL; E_Wayland_Input *input; - E_Border_Hook *hook; if (!ews) return; - EINA_LIST_FREE(ews->bd_hooks, hook) - e_border_hook_del(hook); - EINA_LIST_FOREACH(_e_wl_comp->seats, l, input) { if ((input->wl.seat.keyboard) && @@ -936,38 +903,40 @@ _e_wl_shell_shell_surface_unmap(E_Wayland_Surface *ews) wl_pointer_set_focus(input->wl.seat.pointer, NULL, 0, 0); } - if (ews->obj) + if (ews->ec) { - /* delete smart callbacks */ - evas_object_smart_callback_del(ews->obj, "mouse_in", - _e_wl_shell_shell_surface_cb_mouse_in); - evas_object_smart_callback_del(ews->obj, "mouse_out", - _e_wl_shell_shell_surface_cb_mouse_out); - evas_object_smart_callback_del(ews->obj, "mouse_move", - _e_wl_shell_shell_surface_cb_mouse_move); - evas_object_smart_callback_del(ews->obj, "mouse_up", - _e_wl_shell_shell_surface_cb_mouse_up); - evas_object_smart_callback_del(ews->obj, "mouse_down", - _e_wl_shell_shell_surface_cb_mouse_down); - evas_object_smart_callback_del(ews->obj, "mouse_wheel", - _e_wl_shell_shell_surface_cb_mouse_wheel); - evas_object_smart_callback_del(ews->obj, "key_up", - _e_wl_shell_shell_surface_cb_key_up); - evas_object_smart_callback_del(ews->obj, "key_down", - _e_wl_shell_shell_surface_cb_key_down); - evas_object_smart_callback_del(ews->obj, "focus_in", - _e_wl_shell_shell_surface_cb_focus_in); - evas_object_smart_callback_del(ews->obj, "focus_out", - _e_wl_shell_shell_surface_cb_focus_out); + evas_object_event_callback_del_full(ews->ec->frame, EVAS_CALLBACK_MOUSE_OUT, + _e_wl_shell_shell_surface_cb_mouse_out, ews); + evas_object_event_callback_del_full(ews->ec->frame, EVAS_CALLBACK_MOUSE_MOVE, + _e_wl_shell_shell_surface_cb_mouse_move, ews); + evas_object_event_callback_del_full(ews->ec->frame, EVAS_CALLBACK_MOUSE_UP, + _e_wl_shell_shell_surface_cb_mouse_up, ews); + evas_object_event_callback_del_full(ews->ec->frame, EVAS_CALLBACK_MOUSE_DOWN, + _e_wl_shell_shell_surface_cb_mouse_down, ews); + evas_object_event_callback_del_full(ews->ec->frame, EVAS_CALLBACK_MOUSE_WHEEL, + _e_wl_shell_shell_surface_cb_mouse_wheel, ews); + evas_object_event_callback_del_full(ews->ec->frame, EVAS_CALLBACK_KEY_UP, + _e_wl_shell_shell_surface_cb_key_up, ews); + evas_object_event_callback_del_full(ews->ec->frame, EVAS_CALLBACK_KEY_DOWN, + _e_wl_shell_shell_surface_cb_key_down, ews); + evas_object_smart_callback_del_full(ews->ec->frame, "client_resize", + _e_wl_shell_surface_cb_smart_client_resize, ews); - /* delete the object */ - evas_object_del(ews->obj); - } - if (ews->bd) - { - e_comp_wl_border_surface_del(ews->id); - e_object_del(E_OBJECT(ews->bd)); + /* surface probably has render updates pending: + * - check ourselves before we wreck ourselves + * - copy image + * - re-render + */ + e_pixmap_image_clear(ews->pixmap, 0); + e_pixmap_dirty(ews->pixmap); + if (e_pixmap_refresh(ews->pixmap)) + { + e_comp_object_damage(ews->ec->frame, 0, 0, ews->ec->w, ews->ec->h); + e_comp_object_render(ews->ec->frame); + } + e_comp_object_render_update_del(ews->ec->frame); + e_object_del(E_OBJECT(ews->ec)); } ews->mapped = EINA_FALSE; @@ -1016,10 +985,9 @@ _e_wl_shell_shell_surface_type_reset(E_Wayland_Shell_Surface *ewss) switch (ewss->type) { case E_WAYLAND_SHELL_SURFACE_TYPE_FULLSCREEN: - /* ecore_evas_fullscreen_set(ewss->surface->ee, EINA_FALSE); */ - /* unfullscreen the border */ - if (ewss->surface->bd) - e_border_unfullscreen(ewss->surface->bd); + /* unfullscreen the client */ + if (ewss->surface->ec) + e_client_unfullscreen(ewss->surface->ec); /* restore the saved geometry */ ewss->surface->geometry.x = ewss->saved.x; @@ -1029,9 +997,9 @@ _e_wl_shell_shell_surface_type_reset(E_Wayland_Shell_Surface *ewss) ewss->surface->geometry.changed = EINA_TRUE; break; case E_WAYLAND_SHELL_SURFACE_TYPE_MAXIMIZED: - /* unmaximize the border */ - if (ewss->surface->bd) - e_border_unmaximize(ewss->surface->bd, + /* unmaximize the client */ + if (ewss->surface->ec) + e_client_unmaximize(ewss->surface->ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_BOTH); @@ -1080,8 +1048,9 @@ _e_wl_shell_shell_surface_cb_destroy(struct wl_listener *listener, void *data EI ewss->ping_timer = NULL; } - free(ewss->title); wl_list_remove(&ewss->wl.link); + eina_stringshare_del(ewss->clas); + eina_stringshare_del(ewss->title); free(ewss); } } @@ -1097,6 +1066,9 @@ _e_wl_shell_shell_surface_cb_ping_timeout(void *data) ewss->active = EINA_FALSE; + /* this can be NULL if there's a long enough timeout */ + if (!ewss->surface->input) return 1; + /* TODO: this should loop inputs */ /* try to allocate space for our grab structure */ @@ -1114,182 +1086,34 @@ _e_wl_shell_shell_surface_cb_ping_timeout(void *data) } static void -_e_wl_shell_shell_surface_cb_ee_resize(Ecore_Evas *ee) +_e_wl_shell_render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event EINA_UNUSED) { - E_Wayland_Surface *ews = NULL; - - /* try to get the surface structure of this ecore_evas */ - if (!(ews = ecore_evas_data_get(ee, "surface"))) - return; - - /* if we have the surface smart object */ - if (ews->obj) - { - int w = 0, h = 0; - - /* grab the requested geometry */ - ecore_evas_request_geometry_get(ee, NULL, NULL, &w, &h); - - /* resize the surface smart object */ - evas_object_resize(ews->obj, w, h); - } -} - -static void -_e_wl_shell_shell_surface_cb_render_post(void *data, Evas *evas EINA_UNUSED, void *event EINA_UNUSED) -{ - E_Wayland_Surface *ews = NULL; - unsigned int secs = 0; + E_Wayland_Surface *ews; + unsigned int secs; E_Wayland_Surface_Frame_Callback *cb = NULL, *ncb = NULL; - /* try to cast data to our surface structure */ - if (!(ews = data)) return; - /* grab the current server time */ secs = e_comp_wl_time_get(); - /* for each frame callback in the surface, signal it is done */ - wl_list_for_each_safe(cb, ncb, &ews->wl.frames, wl.link) + EINA_INLIST_FOREACH(_e_wl_comp->surfaces, ews) { - wl_callback_send_done(cb->wl.resource, secs); - wl_resource_destroy(cb->wl.resource); - } -} - -static void -_e_wl_shell_shell_surface_cb_focus_in(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) -{ - E_Wayland_Surface *ews = NULL; - E_Wayland_Input *input = NULL; - Eina_List *l = NULL; - - /* try to cast data to our surface structure */ - if (!(ews = data)) return; - - /* if this surface is not visible, get out */ - if (!ews->mapped) return; - - /* loop the list of inputs */ - EINA_LIST_FOREACH(_e_wl_comp->seats, l, input) - { - /* set keyboard focus */ - wl_keyboard_set_focus(input->wl.seat.keyboard, ews->wl.surface); - - /* update the keyboard focus in the data device */ - wl_data_device_set_keyboard_focus(&input->wl.seat); - } -} - -static void -_e_wl_shell_shell_surface_cb_focus_out(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) -{ - E_Wayland_Surface *ews = NULL; - E_Wayland_Input *input = NULL; - Eina_List *l = NULL; - struct wl_pointer *ptr; - - /* try to cast data to our surface structure */ - if (!(ews = data)) return; - - /* if this surface is not visible, get out */ - if (!ews->mapped) return; - - if ((ptr = _e_wl_comp->input->wl.seat.pointer)) - { - if (ews->wl.surface == ptr->current) - return; - } - - /* loop the list of inputs */ - EINA_LIST_FOREACH(_e_wl_comp->seats, l, input) - { - /* set keyboard focus */ - wl_keyboard_set_focus(input->wl.seat.keyboard, NULL); - - /* end any keyboard grabs */ - wl_keyboard_end_grab(input->wl.seat.keyboard); - } -} - -static void -_e_wl_shell_shell_surface_cb_mouse_in(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) -{ - E_Wayland_Surface *ews = NULL; - struct wl_pointer *ptr = NULL; - - /* try to cast data to our surface structure */ - if (!(ews = data)) return; - - /* if this surface is not visible, get out */ - if (!ews->mapped) return; - - /* try to get the pointer from this input */ - if ((ptr = _e_wl_comp->input->wl.seat.pointer)) - { - /* if the mouse entered this surface & it is not the current surface */ - if (ews->wl.surface != ptr->current) + if (!ews->updates) break; + /* for each frame callback in the surface, signal it is done */ + wl_list_for_each_safe(cb, ncb, &ews->wl.frames, wl.link) { - const struct wl_pointer_grab_interface *grab; - - /* set this surface as the current */ - grab = ptr->grab->interface; - ptr->current = ews->wl.surface; - - /* send a pointer focus event */ - grab->focus(ptr->grab, ews->wl.surface, - ptr->current_x, ptr->current_y); + wl_callback_send_done(cb->wl.resource, secs); + wl_resource_destroy(cb->wl.resource); } + ews->updates = 0; } } static void -_e_wl_shell_shell_surface_cb_mouse_out(void *data, Evas_Object *obj EINA_UNUSED, void *event) +_e_wl_shell_shell_surface_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { E_Wayland_Surface *ews = NULL; + Evas_Event_Mouse_Out *ev = event; struct wl_pointer *ptr = NULL; - Evas_Event_Mouse_Out *ev; - - ev = event; - - /* try to cast data to our surface structure */ - if (!(ews = data)) return; - - if (E_INSIDE(ev->canvas.x, ev->canvas.y, ews->geometry.x, ews->geometry.y, - ews->geometry.w, ews->geometry.h)) - return; - - /* if (!ews->input) return; */ - - /* try to get the pointer from this input */ - if ((ptr = _e_wl_comp->input->wl.seat.pointer)) - { - /* if we have a pointer grab and this is the currently focused surface */ - /* if ((ptr->grab) && (ptr->focus == ptr->current)) */ - /* return; */ - - /* unset the pointer image */ - ecore_x_window_cursor_set(ecore_evas_window_get(ews->ee), 0); - - /* set pointer focus */ - ptr->current = NULL; - - /* NB: Ideally, we should call this function to tell the - * pointer that nothing has focus, HOWEVER, when we do - * it breaks re-entrant focus of some wayland clients: - * - * NB: I sent a patch for this already to the wayland devs */ - wl_pointer_set_focus(ptr, NULL, 0, 0); - } -} - -static void -_e_wl_shell_shell_surface_cb_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, void *event) -{ - E_Wayland_Surface *ews = NULL; - Evas_Event_Mouse_Move *ev; - struct wl_pointer *ptr = NULL; - - ev = event; /* try to cast data to our surface structure */ if (!(ews = data)) return; @@ -1297,8 +1121,8 @@ _e_wl_shell_shell_surface_cb_mouse_move(void *data, Evas_Object *obj EINA_UNUSED /* try to get the pointer from this input */ if ((ptr = _e_wl_comp->input->wl.seat.pointer)) { - ptr->x = wl_fixed_from_int(ev->cur.output.x); - ptr->y = wl_fixed_from_int(ev->cur.output.y); + ptr->x = wl_fixed_from_int(ev->output.x - ews->ec->client.x); + ptr->y = wl_fixed_from_int(ev->output.y - ews->ec->client.y); ptr->current_x = ptr->x; ptr->current_y = ptr->y; @@ -1312,7 +1136,34 @@ _e_wl_shell_shell_surface_cb_mouse_move(void *data, Evas_Object *obj EINA_UNUSED } static void -_e_wl_shell_shell_surface_cb_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, void *event) +_e_wl_shell_shell_surface_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) +{ + E_Wayland_Surface *ews = NULL; + Evas_Event_Mouse_Move *ev = event; + struct wl_pointer *ptr = NULL; + + /* try to cast data to our surface structure */ + if (!(ews = data)) return; + + /* try to get the pointer from this input */ + if ((ptr = _e_wl_comp->input->wl.seat.pointer)) + { + ptr->x = wl_fixed_from_int(ev->cur.output.x - ews->ec->client.x); + ptr->y = wl_fixed_from_int(ev->cur.output.y - ews->ec->client.y); + + ptr->current_x = ptr->x; + ptr->current_y = ptr->y; + ptr->grab->x = ptr->x; + ptr->grab->y = ptr->y; + + /* send this mouse movement to wayland */ + ptr->grab->interface->motion(ptr->grab, ev->timestamp, + ptr->grab->x, ptr->grab->y); + } +} + +static void +_e_wl_shell_shell_surface_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { E_Wayland_Surface *ews = NULL; struct wl_pointer *ptr = NULL; @@ -1346,7 +1197,7 @@ _e_wl_shell_shell_surface_cb_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, } static void -_e_wl_shell_shell_surface_cb_mouse_down(void *data, Evas_Object *obj EINA_UNUSED, void *event) +_e_wl_shell_shell_surface_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { E_Wayland_Surface *ews = NULL; struct wl_pointer *ptr = NULL; @@ -1378,9 +1229,8 @@ _e_wl_shell_shell_surface_cb_mouse_down(void *data, Evas_Object *obj EINA_UNUSED /* update some pointer properties */ if (ptr->button_count == 0) { - ptr->x = wl_fixed_from_int(ev->output.x); - ptr->y = wl_fixed_from_int(ev->output.y); - + ptr->x = wl_fixed_from_int(ev->output.x - ews->ec->client.x); + ptr->y = wl_fixed_from_int(ev->output.y - ews->ec->client.y); ptr->grab_x = ptr->x; ptr->grab_y = ptr->y; ptr->grab_button = btn; @@ -1399,7 +1249,7 @@ _e_wl_shell_shell_surface_cb_mouse_down(void *data, Evas_Object *obj EINA_UNUSED } static void -_e_wl_shell_shell_surface_cb_mouse_wheel(void *data, Evas_Object *obj EINA_UNUSED, void *event) +_e_wl_shell_shell_surface_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { E_Wayland_Surface *ews = NULL; struct wl_pointer *ptr = NULL; @@ -1440,7 +1290,7 @@ _e_wl_shell_shell_surface_cb_mouse_wheel(void *data, Evas_Object *obj EINA_UNUSE } static void -_e_wl_shell_shell_surface_cb_key_up(void *data, Evas_Object *obj EINA_UNUSED, void *event) +_e_wl_shell_shell_surface_cb_key_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) { Evas_Event_Key_Up *ev; E_Wayland_Surface *ews = NULL; @@ -1490,7 +1340,7 @@ _e_wl_shell_shell_surface_cb_key_up(void *data, Evas_Object *obj EINA_UNUSED, vo } static void -_e_wl_shell_shell_surface_cb_key_down(void *data, Evas_Object *obj EINA_UNUSED, void *event) +_e_wl_shell_shell_surface_cb_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { Evas_Event_Key_Down *ev; E_Wayland_Surface *ews = NULL; @@ -1518,7 +1368,6 @@ _e_wl_shell_shell_surface_cb_key_down(void *data, Evas_Object *obj EINA_UNUSED, /* if the compositor has a ping callback, call it on this surface */ if (_e_wl_comp->ping_cb) _e_wl_comp->ping_cb(ews, serial); - /* get the keycode for this key from X */ key = ecore_x_keysym_keycode_get(ev->keyname) - 8; /* update the keyboards grab properties */ @@ -1554,19 +1403,80 @@ _e_wl_shell_shell_surface_cb_key_down(void *data, Evas_Object *obj EINA_UNUSED, } static void -_e_wl_shell_shell_surface_cb_bd_move_end(void *data, void *bd) +_e_wl_shell_shell_surface_cb_ec_hook_focus_unset(void *data EINA_UNUSED, E_Client *ec) +{ + E_Wayland_Surface *ews = NULL; + E_Wayland_Input *input = NULL; + Eina_List *l = NULL; + + if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; + /* try to cast data to our surface structure */ + if (!(ews = (E_Wayland_Surface*)ec->comp_data)) return; + + /* if this surface is not visible, get out */ + if (!ews->mapped) return; + + /* loop the list of inputs */ + EINA_LIST_FOREACH(_e_wl_comp->seats, l, input) + { + /* set keyboard focus */ + wl_keyboard_set_focus(input->wl.seat.keyboard, NULL); + + /* end any keyboard grabs */ + wl_keyboard_end_grab(input->wl.seat.keyboard); + } +} + +static void +_e_wl_shell_shell_surface_cb_ec_hook_focus_set(void *data EINA_UNUSED, E_Client *ec) +{ + E_Wayland_Surface *ews = NULL; + E_Wayland_Input *input = NULL; + struct wl_pointer *ptr = NULL; + Eina_List *l = NULL; + + if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; + /* try to cast data to our surface structure */ + if (!(ews = (E_Wayland_Surface*)ec->comp_data)) return; + + /* try to get the pointer from this input */ + if ((ptr = _e_wl_comp->input->wl.seat.pointer)) + { + /* if the mouse entered this surface & it is not the current surface */ + if (ews->wl.surface != ptr->current) + { + const struct wl_pointer_grab_interface *grab; + + /* set this surface as the current */ + grab = ptr->grab->interface; + ptr->current = ews->wl.surface; + + /* send a pointer focus event */ + grab->focus(ptr->grab, ews->wl.surface, + ptr->current_x, ptr->current_y); + } + } + /* loop the list of inputs */ + EINA_LIST_FOREACH(_e_wl_comp->seats, l, input) + { + /* set keyboard focus */ + wl_keyboard_set_focus(input->wl.seat.keyboard, ews->wl.surface); + + /* update the keyboard focus in the data device */ + wl_data_device_set_keyboard_focus(&input->wl.seat); + } +} + +static void +_e_wl_shell_shell_surface_cb_ec_hook_move_end(void *data EINA_UNUSED, E_Client *ec) { E_Wayland_Surface *ews = NULL; struct wl_pointer *ptr = NULL; - E_Border *border = NULL; - - /* FIXME: wayland move/resize with keyboard ? */ +return; + if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; /* try to cast data to our surface structure */ - if (!(ews = data)) return; - - border = bd; - if (border != ews->bd) return; + if (!(ews = (E_Wayland_Surface*)ec->comp_data)) return; /* try to get the pointer from this input */ if ((ptr = _e_wl_comp->input->wl.seat.pointer)) @@ -1593,57 +1503,14 @@ _e_wl_shell_shell_surface_cb_bd_move_end(void *data, void *bd) } static void -_e_wl_shell_shell_surface_cb_bd_resize_update(void *data, void *bd) -{ - /* E_Wayland_Shell_Grab *grab = NULL; */ - E_Wayland_Surface *ews = NULL; - struct wl_pointer *ptr = NULL; - E_Border *border = NULL; - - /* try to cast data to our surface structure */ - if (!(ews = data)) return; - - border = bd; - if (border != ews->bd) return; - - /* try to get the pointer from this input */ - if ((ptr = _e_wl_comp->input->wl.seat.pointer)) - { - Evas_Coord w = 0, h = 0; - - if (!ptr->grab) return; - - if (ptr->grab->interface != &_e_resize_grab_interface) - return; - - if (!ews->shell_surface) return; - - if ((ptr->current) && (ptr->current != ews->wl.surface)) return; - - /* if (!(grab = (E_Wayland_Shell_Grab *)ptr->grab)) return; */ - - w = border->w; - h = border->h; - - wl_shell_surface_send_configure(ews->shell_surface->wl.resource, - ptr->grab->edges, w, h); - } -} - -static void -_e_wl_shell_shell_surface_cb_bd_resize_end(void *data, void *bd) +_e_wl_shell_shell_surface_cb_ec_hook_resize_end(void *data EINA_UNUSED, E_Client *ec) { E_Wayland_Surface *ews = NULL; struct wl_pointer *ptr = NULL; - E_Border *border = NULL; - - /* FIXME: wayland move/resize with keyboard ? */ - +return; + if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; /* try to cast data to our surface structure */ - if (!(ews = data)) return; - - border = bd; - if (border != ews->bd) return; + if (!(ews = (E_Wayland_Surface*)ec->comp_data)) return; /* try to get the pointer from this input */ if ((ptr = _e_wl_comp->input->wl.seat.pointer)) @@ -1661,11 +1528,78 @@ _e_wl_shell_shell_surface_cb_bd_resize_end(void *data, void *bd) /* is the shell surface the same one in the grab ? */ if ((ptr->current) && (ptr->current != ews->wl.surface)) return; + ptr->button_count--; + /* send this button press to the pointer */ ptr->grab->interface->button(ptr->grab, ptr->grab_time, ptr->grab_button, WL_POINTER_BUTTON_STATE_RELEASED); + + if (ptr->button_count == 1) + ptr->grab_serial = wl_display_get_serial(_e_wl_comp->wl.display); + } +} + +static void +_e_wl_shell_shell_surface_cb_ec_hook_resize_update(void *data EINA_UNUSED, E_Client *ec) +{ + E_Wayland_Surface *ews = NULL; + struct wl_pointer *ptr = NULL; +return; + if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; + /* try to cast data to our surface structure */ + if (!(ews = (E_Wayland_Surface*)ec->comp_data)) return; + + /* try to get the pointer from this input */ + if ((ptr = _e_wl_comp->input->wl.seat.pointer)) + { + Evas_Coord w = 0, h = 0; + + if (!ptr->grab) return; + + if (ptr->grab->interface != &_e_resize_grab_interface) + return; + + if (!ews->shell_surface) return; + + if ((ptr->current) && (ptr->current != ews->wl.surface)) return; + + /* send this button press to the pointer */ + ptr->grab->interface->button(ptr->grab, + ptr->grab_time, + ptr->grab_button, + WL_POINTER_BUTTON_STATE_RELEASED); + w = ec->client.w; + h = ec->client.h; + + wl_shell_surface_send_configure(ews->shell_surface->wl.resource, + ptr->grab->edges, w, h); + } +} + +static void +_e_wl_shell_surface_cb_smart_client_resize(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Wayland_Shell_Grab *grab = NULL; + E_Wayland_Surface *ews = NULL; + struct wl_pointer *ptr = NULL; + + /* try to cast data to our surface structure */ + ews = data; + + /* try to get the pointer from this input */ + if ((ptr = _e_wl_comp->input->wl.seat.pointer)) + { + Evas_Coord w = 0, h = 0; + + if (!(grab = (E_Wayland_Shell_Grab *)ptr->grab)) return; + + w = ews->ec->client.w; + h = ews->ec->client.h; + + wl_shell_surface_send_configure(ews->shell_surface->wl.resource, + grab->edges, w, h); } } @@ -1711,93 +1645,94 @@ _e_wl_shell_shell_surface_cb_pong(struct wl_client *client EINA_UNUSED, struct w } static void -_e_wl_shell_mouse_down_helper(E_Border *bd, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev, Eina_Bool move) +_e_wl_shell_mouse_down_helper(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev, Eina_Bool move) { + INF("MOUSE DOWN: %dx%d", output->x, output->y); 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; + 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 { - bd->moveinfo.down.x = bd->x; - bd->moveinfo.down.y = bd->y; - bd->moveinfo.down.w = bd->w; - bd->moveinfo.down.h = bd->h; + ec->moveinfo.down.x = ec->x; + ec->moveinfo.down.y = ec->y; + ec->moveinfo.down.w = ec->w; + ec->moveinfo.down.h = ec->h; } - bd->mouse.current.mx = output->x; - bd->mouse.current.my = output->y; + ec->mouse.current.mx = output->x; + ec->mouse.current.my = output->y; if (move) { - /* tell E to start moving the border */ - e_border_act_move_begin(bd, ev); + /* tell E to start moving the client */ + e_client_act_move_begin(ec, ev); /* we have to get a reference to the window_move action here, or else - * when e_border stops the move we will never get notified */ - bd->cur_mouse_action = e_action_find("window_move"); - if (bd->cur_mouse_action) - e_object_ref(E_OBJECT(bd->cur_mouse_action)); + * when e_client stops the move we will never get notified */ + ec->cur_mouse_action = e_action_find("window_move"); + if (ec->cur_mouse_action) + e_object_ref(E_OBJECT(ec->cur_mouse_action)); } else { - /* tell E to start resizing the border */ - e_border_act_resize_begin(bd, ev); + /* tell E to start resizing the client */ + e_client_act_resize_begin(ec, ev); /* we have to get a reference to the window_resize action here, - * or else when e_border stops the resize we will never get notified */ - bd->cur_mouse_action = e_action_find("window_resize"); - if (bd->cur_mouse_action) - e_object_ref(E_OBJECT(bd->cur_mouse_action)); + * or else when e_client stops the resize we will never get notified */ + ec->cur_mouse_action = e_action_find("window_resize"); + if (ec->cur_mouse_action) + e_object_ref(E_OBJECT(ec->cur_mouse_action)); } - e_focus_event_mouse_down(bd); + e_focus_event_mouse_down(ec); 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; + 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 { - bd->moveinfo.down.x = bd->x; - bd->moveinfo.down.y = bd->y; - bd->moveinfo.down.w = bd->w; - bd->moveinfo.down.h = bd->h; + ec->moveinfo.down.x = ec->x; + ec->moveinfo.down.y = ec->y; + ec->moveinfo.down.w = ec->w; + ec->moveinfo.down.h = ec->h; } - bd->mouse.current.mx = output->x; - bd->mouse.current.my = output->y; + ec->mouse.current.mx = output->x; + ec->mouse.current.my = output->y; } static void -_e_wl_shell_mouse_up_helper(E_Border *bd, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev EINA_UNUSED) +_e_wl_shell_mouse_up_helper(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev EINA_UNUSED) { 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; + 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; } - bd->mouse.current.mx = output->x; - bd->mouse.current.my = output->y; + ec->mouse.current.mx = output->x; + ec->mouse.current.my = output->y; 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; + 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; } - bd->drag.start = 0; + ec->drag.start = 0; } static void @@ -1806,7 +1741,7 @@ _e_wl_shell_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct w E_Wayland_Input *input = NULL; E_Wayland_Shell_Surface *ewss = NULL; E_Wayland_Shell_Grab *grab = NULL; - E_Binding_Event_Mouse_Button *ev; + E_Binding_Event_Mouse_Button ev; struct wl_pointer *ptr = NULL; /* try to cast the seat resource to our input structure */ @@ -1841,27 +1776,23 @@ _e_wl_shell_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct w &_e_move_grab_interface, E_DESKTOP_SHELL_CURSOR_MOVE); - /* create a fake binding event for mouse button */ - ev = E_NEW(E_Binding_Event_Mouse_Button, 1); - /* set button property of the binding event */ if (grab->grab.pointer->grab_button == BTN_LEFT) - ev->button = 1; + ev.button = 1; else if (grab->grab.pointer->grab_button == BTN_MIDDLE) - ev->button = 2; + ev.button = 2; else if (grab->grab.pointer->grab_button == BTN_RIGHT) - ev->button = 3; + ev.button = 3; + else + ev.button = 0; /* set the clicked location in the binding event */ - ev->canvas.x = wl_fixed_to_int(ptr->x) + - (ewss->surface->bd->x + ewss->surface->bd->client_inset.l); - ev->canvas.y = wl_fixed_to_int(ptr->y) + - (ewss->surface->bd->y + ewss->surface->bd->client_inset.t); + e_comp_object_frame_xy_unadjust(ewss->surface->ec->frame, wl_fixed_to_int(ptr->x), wl_fixed_to_int(ptr->y), &ev.canvas.x, &ev.canvas.y); /* call our helper function to initiate a move */ - _e_wl_shell_mouse_down_helper(ewss->surface->bd, ev->button, - &(Evas_Point){ev->canvas.x, ev->canvas.y}, - ev, EINA_TRUE); + _e_wl_shell_mouse_down_helper(ewss->surface->ec, ev.button, + &(Evas_Point){ev.canvas.x + ewss->surface->ec->client.x, ev.canvas.y + ewss->surface->ec->client.y}, + &ev, EINA_TRUE); } static void @@ -1870,7 +1801,7 @@ _e_wl_shell_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct E_Wayland_Input *input = NULL; E_Wayland_Shell_Surface *ewss = NULL; E_Wayland_Shell_Grab *grab = NULL; - E_Binding_Event_Mouse_Button *ev; + E_Binding_Event_Mouse_Button ev; struct wl_pointer *ptr = NULL; /* try to cast the seat resource to our input structure */ @@ -1912,26 +1843,22 @@ _e_wl_shell_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct _e_wl_shell_grab_start(grab, ewss, input->wl.seat.pointer, &_e_resize_grab_interface, edges); - /* create a fake binding event for mouse button */ - ev = E_NEW(E_Binding_Event_Mouse_Button, 1); - if (grab->grab.pointer->grab_button == BTN_LEFT) - ev->button = 1; + ev.button = 1; else if (grab->grab.pointer->grab_button == BTN_MIDDLE) - ev->button = 2; + ev.button = 2; else if (grab->grab.pointer->grab_button == BTN_RIGHT) - ev->button = 3; + ev.button = 3; + else + ev.button = 0; /* set the clicked location in the binding event */ - ev->canvas.x = wl_fixed_to_int(ptr->x) + - (ewss->surface->bd->x + ewss->surface->bd->client_inset.l); - ev->canvas.y = wl_fixed_to_int(ptr->y) + - (ewss->surface->bd->y + ewss->surface->bd->client_inset.t); + e_comp_object_frame_xy_unadjust(ewss->surface->ec->frame, wl_fixed_to_int(ptr->x), wl_fixed_to_int(ptr->y), &ev.canvas.x, &ev.canvas.y); /* call our helper function to initiate a resize */ - _e_wl_shell_mouse_down_helper(ewss->surface->bd, ev->button, - &(Evas_Point){ev->canvas.x, ev->canvas.y}, - ev, EINA_FALSE); + _e_wl_shell_mouse_down_helper(ewss->surface->ec, ev.button, + &(Evas_Point){ev.canvas.x + ewss->surface->ec->client.x, ev.canvas.y + ewss->surface->ec->client.y}, + &ev, EINA_FALSE); } static void @@ -1975,7 +1902,7 @@ _e_wl_shell_shell_surface_cb_fullscreen_set(struct wl_client *client EINA_UNUSED /* NB FIXME: Disable fullscreen support for right now. * - * Appears to be some recent issue with e_border... + * Appears to be some recent issue with e_client... * * Needs looking into */ return; @@ -1987,18 +1914,16 @@ _e_wl_shell_shell_surface_cb_fullscreen_set(struct wl_client *client EINA_UNUSED /* set next surface type */ ewss->next_type = E_WAYLAND_SHELL_SURFACE_TYPE_TOPLEVEL; - /* check for valid border */ - if (ewss->surface->bd) + /* check for valid client */ + if (ewss->surface->ec) { - /* ecore_evas_fullscreen_set(ewss->surface->ee, EINA_TRUE); */ - /* tell E to fullscreen this window */ - e_border_fullscreen(ewss->surface->bd, E_FULLSCREEN_RESIZE); + e_client_fullscreen(ewss->surface->ec, E_FULLSCREEN_RESIZE); /* send configure message to the shell surface to inform of new size */ wl_shell_surface_send_configure(ewss->wl.resource, 0, - ewss->surface->bd->w, - ewss->surface->bd->h); + ewss->surface->ec->w, + ewss->surface->ec->h); } } @@ -2038,22 +1963,22 @@ _e_wl_shell_shell_surface_cb_maximized_set(struct wl_client *client EINA_UNUSED, /* set next surface type */ ewss->next_type = E_WAYLAND_SHELL_SURFACE_TYPE_MAXIMIZED; - /* check for valid border */ - if (ewss->surface->bd) + /* check for valid client */ + if (ewss->surface->ec) { unsigned int edges = 0; edges = (WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_LEFT); /* tell E to maximize this window */ - e_border_maximize(ewss->surface->bd, + e_client_maximize(ewss->surface->ec, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_BOTH); /* send configure message to the shell surface to inform of new size */ wl_shell_surface_send_configure(ewss->wl.resource, edges, - ewss->surface->bd->w, - ewss->surface->bd->h); + ewss->surface->ec->w, + ewss->surface->ec->h); } } @@ -2061,48 +1986,29 @@ static void _e_wl_shell_shell_surface_cb_title_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *title) { E_Wayland_Shell_Surface *ewss = NULL; - E_Wayland_Surface *ews = NULL; /* try to cast the resource to our shell surface */ if (!(ewss = wl_resource_get_user_data(resource))) return; - /* free any previous title */ - free(ewss->title); - - /* set new title */ - ewss->title = strdup(title); - - /* update ecore_evas with new title */ - if ((ews = ewss->surface)) - { - if (ews->ee) - ecore_evas_title_set(ews->ee, ewss->title); - } + eina_stringshare_replace(&ewss->title, title); + if (!ewss->surface->ec) return; + eina_stringshare_refplace(&ewss->surface->ec->icccm.title, ewss->title); + e_comp_object_frame_title_set(ewss->surface->ec->frame, title); } static void _e_wl_shell_shell_surface_cb_class_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *clas) { E_Wayland_Shell_Surface *ewss = NULL; - E_Wayland_Surface *ews = NULL; /* try to cast the resource to our shell surface */ if (!(ewss = wl_resource_get_user_data(resource))) return; - /* free any previous class */ - free(ewss->clas); - - /* set new class */ - ewss->clas = strdup(clas); - - /* update ecore_evas with new class */ - if ((ews = ewss->surface)) - { - if (ews->ee) - ecore_evas_name_class_set(ews->ee, ewss->title, ewss->clas); - } + eina_stringshare_replace(&ewss->clas, clas); + if (!ewss->surface->ec) return; + eina_stringshare_refplace(&ewss->surface->ec->icccm.class, clas); } /* shell move_grab interface functions */ @@ -2122,7 +2028,7 @@ static void _e_wl_shell_move_grab_cb_motion(struct wl_pointer_grab *grab EINA_UNUSED, unsigned int timestamp EINA_UNUSED, wl_fixed_t x EINA_UNUSED, wl_fixed_t y EINA_UNUSED) { /* FIXME: This needs to become a no-op as the actual surface movement - * is handled by e_border now */ + * is handled by e_client now */ } static void @@ -2156,34 +2062,32 @@ _e_wl_shell_move_grab_cb_button(struct wl_pointer_grab *grab, unsigned int times (state == WL_POINTER_BUTTON_STATE_RELEASED)) { E_Wayland_Surface *ews = NULL; - int btn = 0, x, y; + E_Binding_Event_Mouse_Button ev; if (!(ews = ewsg->shell_surface->surface)) return; /* set button property of the binding event */ if (ptr->grab_button == BTN_LEFT) - btn = 1; + ev.button = 1; else if (ptr->grab_button == BTN_MIDDLE) - btn = 2; + ev.button = 2; else if (ptr->grab_button == BTN_RIGHT) - btn = 3; + ev.button = 3; /* set the clicked location in the binding event */ - x = wl_fixed_to_int(ptr->x) + - (ews->bd->x + ews->bd->client_inset.l); - y = wl_fixed_to_int(ptr->y) + - (ews->bd->y + ews->bd->client_inset.t); + e_comp_object_frame_xy_unadjust(ews->ec->frame, wl_fixed_to_int(ptr->x), wl_fixed_to_int(ptr->y), &ev.canvas.x, &ev.canvas.y); /* call our helper function to end a move */ - _e_wl_shell_mouse_up_helper(ews->bd, btn, - &(Evas_Point){x, y}, NULL); + _e_wl_shell_mouse_up_helper(ews->ec, ev.button, + &(Evas_Point){ev.canvas.x + ews->ec->client.x, ev.canvas.y + ews->ec->client.y}, + &ev); /* end the grab */ _e_wl_shell_grab_end(ewsg); free(grab); /* set surface geometry */ - _e_wl_shell_shell_surface_configure(ews, ews->bd->x, ews->bd->y, + _e_wl_shell_shell_surface_configure(ews, ews->ec->x, ews->ec->y, ews->geometry.w, ews->geometry.h); } @@ -2206,7 +2110,7 @@ static void _e_wl_shell_resize_grab_cb_motion(struct wl_pointer_grab *grab EINA_UNUSED, unsigned int timestamp EINA_UNUSED, wl_fixed_t x EINA_UNUSED, wl_fixed_t y EINA_UNUSED) { /* FIXME: This needs to become a no-op as the actual surface resize - * is handled by e_border now */ + * is handled by e_client now */ } static void @@ -2240,34 +2144,32 @@ _e_wl_shell_resize_grab_cb_button(struct wl_pointer_grab *grab, unsigned int tim (state == WL_POINTER_BUTTON_STATE_RELEASED)) { E_Wayland_Surface *ews = NULL; - int btn = 0, x, y; + E_Binding_Event_Mouse_Button ev; if (!(ews = ewsg->shell_surface->surface)) return; /* set button property of the binding event */ if (ptr->grab_button == BTN_LEFT) - btn = 1; + ev.button = 1; else if (ptr->grab_button == BTN_MIDDLE) - btn = 2; + ev.button = 2; else if (ptr->grab_button == BTN_RIGHT) - btn = 3; + ev.button = 3; /* set the clicked location in the binding event */ - x = wl_fixed_to_int(ptr->x) + - (ews->bd->x + ews->bd->client_inset.l); - y = wl_fixed_to_int(ptr->y) + - (ews->bd->y + ews->bd->client_inset.t); + e_comp_object_frame_xy_unadjust(ews->ec->frame, wl_fixed_to_int(ptr->x), wl_fixed_to_int(ptr->y), &ev.canvas.x, &ev.canvas.y); /* call our helper function to end a move */ - _e_wl_shell_mouse_up_helper(ews->bd, btn, - &(Evas_Point){x, y}, NULL); + _e_wl_shell_mouse_up_helper(ews->ec, ev.button, + &(Evas_Point){ev.canvas.x + ews->ec->client.x, ev.canvas.y + ews->ec->client.y}, + &ev); /* end the grab */ _e_wl_shell_grab_end(ewsg); free(grab); /* set surface geometry */ - _e_wl_shell_shell_surface_configure(ews, ews->bd->x, ews->bd->y, + _e_wl_shell_shell_surface_configure(ews, ews->ec->x, ews->ec->y, ews->geometry.w, ews->geometry.h); } diff --git a/src/modules/xkbswitch/e_mod_config.c b/src/modules/xkbswitch/e_mod_config.c index 2f063d5e9..a621cbd81 100644 --- a/src/modules/xkbswitch/e_mod_config.c +++ b/src/modules/xkbswitch/e_mod_config.c @@ -57,7 +57,7 @@ static Eina_Bool _cb_fill_delay(void *data); /* Externals */ E_Config_Dialog * -_xkb_cfg_dialog(E_Container *con, const char *params __UNUSED__) +_xkb_cfg_dialog(E_Comp *comp, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -71,7 +71,7 @@ _xkb_cfg_dialog(E_Container *con, const char *params __UNUSED__) v->basic.create_widgets = _basic_create; v->basic.apply_cfdata = _basic_apply; - cfd = e_config_dialog_new(con, _("Keyboard Settings"), "E", + cfd = e_config_dialog_new(comp, _("Keyboard Settings"), "E", "keyboard_and_mouse/xkbswitch", "preferences-desktop-keyboard", 0, v, NULL); @@ -451,7 +451,7 @@ _dlg_add_new(E_Config_Dialog_Data *cfdata) Evas_Coord mw, mh; Evas_Object *mainn, *available, *modelss, *variants; - if (!(dlg = e_dialog_new(_xkb.cfd->con, "E", "xkbswitch_config_add_dialog"))) return NULL; + if (!(dlg = e_dialog_new(_xkb.cfd->comp, "E", "xkbswitch_config_add_dialog"))) return NULL; e_dialog_resizable_set(dlg, 1); dlg->data = cfdata; diff --git a/src/modules/xkbswitch/e_mod_main.c b/src/modules/xkbswitch/e_mod_main.c index ddcbb3599..213987f60 100644 --- a/src/modules/xkbswitch/e_mod_main.c +++ b/src/modules/xkbswitch/e_mod_main.c @@ -480,7 +480,7 @@ static void _e_xkb_cb_menu_configure(void *data __UNUSED__, E_Menu *mn, E_Menu_Item *mi __UNUSED__) { if (_xkb.cfd) return; - _xkb_cfg_dialog(mn->zone->container, NULL); + _xkb_cfg_dialog(mn->zone->comp, NULL); } static void diff --git a/src/modules/xkbswitch/e_mod_main.h b/src/modules/xkbswitch/e_mod_main.h index bfeefd1a3..f02adf457 100644 --- a/src/modules/xkbswitch/e_mod_main.h +++ b/src/modules/xkbswitch/e_mod_main.h @@ -17,7 +17,7 @@ typedef struct _Xkb /* Prototypes */ void _xkb_update_icon(int); -E_Config_Dialog *_xkb_cfg_dialog(E_Container *con, const char *params); +E_Config_Dialog *_xkb_cfg_dialog(E_Comp *comp, const char *params); extern Xkb _xkb;