You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3390 lines
111 KiB

#include "e_mod_main.h"
/* FIXME: fwin - the fm2 filemanager wrapped with a window and scrollframe.
* primitive BUT enough to test generic dnd and fm stuff more easily. don't
* play with this unless u want to help with it. NOT COMPLETE! BEWARE!
*/
/* FIXME: multiple selected files across different fwins - you can only dnd the
* ones in the 1 window src - not all selected ones. also selecting a new file
Fix common misspellings Some misspellings were manually reverted since in E there are tons of .po with phrases in other languages. Other than that all the changes in the following files were reverted: * src/modules/illume/dicts/English_(US).dic * src/modules/illume-keyboard/dicts/English_(US).dic Following misspellings were fixed: acquited->acquitted adres->address adress->address alreayd->already aquire->acquire arbitarily->arbitrarily cant->can't Capetown->Cape carefull->careful causalities->casualties Celcius->Celsius certian->certain commandoes->commandos considerd->considered conveyer->conveyor dependant->dependent didnt->didn't discontentment->discontent doesnt->doesn't everytime->every exemple->example existance->existence existant->existent existince->existence Farenheit->Fahrenheit forbad->forbade funguses->fungi guage->gauge guerilla->guerrilla guerillas->guerrillas happend->happened hasnt->hasn't heros->heroes inbetween->between independant->independent inital->initial intrusted->entrusted irregardless->regardless isnt->isn't knifes->knives layed->laid loosing->losing marrage->marriage midwifes->midwives miniscule->minuscule monickers->monikers mroe->more noone->no one occured->occurred omre->more paralell->parallel payed->paid planed->planned quitted->quit quizes->quizzes seperated->separated seperate->separate shoudl->should similiar->similar simplier->simpler specifiying->specifying teh->the toke->took torpedos->torpedoes Tuscon->Tucson unecessary->unnecessary useage->usage usefull->useful useing->using waht->what wanna->want whith->with wich->which withing->within SVN revision: 52006
12 years ago
* in a new fwin doesn't deseclect other selections in other fwin's (unless
* multi-selecting)
*/
#define DEFAULT_WIDTH 600
#define DEFAULT_HEIGHT 350
#define MINIMUM_WIDTH 360
#define MINIMUM_HEIGHT 250
typedef struct _E_Fwin E_Fwin;
typedef struct _E_Fwin_Page E_Fwin_Page;
typedef struct _E_Fwin_Apps_Dialog E_Fwin_Apps_Dialog;
#define E_FWIN_TYPE 0xE0b0101f
struct _E_Fwin
{
E_Object e_obj_inherit;
Evas_Object *win;
E_Zone *zone;
Fileman_Path *path; /* not freed with fwin, actually attached to config */
Evas_Object *bg_obj;
E_Fwin_Apps_Dialog *fad;
E_Fwin_Page *cur_page;
Evas_Object *under_obj;
Evas_Object *over_obj;
const char *wallpaper_file;
Eina_Bool wallpaper_is_edj E_BITFIELD;
const char *overlay_file;
const char *scrollframe_file;
const char *theme_file;
const char *over_file;
Ecore_Timer *popup_timer;
Ecore_Job *popup_del_job;
Ecore_Job *object_del_job;
Eina_List *popup_handlers;
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
9 years ago
Evas_Object *popup;
Ecore_Timer *spring_timer;
Ecore_Timer *spring_close_timer;
E_Fwin *spring_parent;
E_Fwin *spring_child;
Ecore_Event_Handler *zone_handler;
Ecore_Event_Handler *zone_del_handler;
};
struct _E_Fwin_Page
{
E_Fwin *fwin;
Ecore_Event_Handler *fm_op_entry_add_handler;
Evas_Object *flist;
Evas_Object *flist_frame;
Evas_Object *scrollframe_obj;
Evas_Object *scr;
Evas_Object *fm_obj;
E_Toolbar *tbar;
struct
{
Evas_Coord x, y, max_x, max_y, w, h;
} fm_pan, fm_pan_last;
int index;
Eina_Bool setting E_BITFIELD;
};
struct _E_Fwin_Apps_Dialog
{
E_Dialog *dia;
E_Fwin *fwin;
const char *app2;
Evas_Object *o_filepreview;
Evas_Object *o_all;
Evas_Object *o_entry;
char *exec_cmd;
};
typedef enum
{
E_FWIN_EXEC_NONE,
E_FWIN_EXEC_DIRECT,
E_FWIN_EXEC_SH,
E_FWIN_EXEC_TERMINAL_DIRECT,
E_FWIN_EXEC_TERMINAL_SH,
E_FWIN_EXEC_DESKTOP
} E_Fwin_Exec_Type;
typedef enum
{
E_FWIN_WIN_AUTO,
E_FWIN_WIN_FORCE_INLINE,
E_FWIN_WIN_FORCE_WIN
} E_Fwin_Win_Mode;
/* local subsystem prototypes */
static int _e_fwin_cb_dir_handler_test(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path);
static void _e_fwin_cb_dir_handler(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path);
static void _e_fwin_page_favorites_add(E_Fwin_Page *page);
static void _e_fwin_icon_mouse_out(void *data, Evas_Object *obj EINA_UNUSED, void *event_info);
static void _e_fwin_icon_mouse_in(void *data, Evas_Object *obj EINA_UNUSED, void *event_info);
static E_Fwin *_e_fwin_open(E_Fwin_Page *page, E_Fm2_Icon_Info *ici, E_Fwin_Win_Mode win_mode, int *need_dia);
static E_Fwin *_e_fwin_new(const char *dev, const char *path);
static void _e_fwin_free(E_Fwin *fwin);
static E_Fwin_Page *_e_fwin_page_create(E_Fwin *fwin);
static void _e_fwin_page_free(E_Fwin_Page *page);
static void _e_fwin_cb_delete(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_fwin_cb_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_fwin_deleted(void *data,
Evas_Object *obj,
void *event_info);
static const char *_e_fwin_custom_file_path_eval(E_Fwin *fwin,
Efreet_Desktop *ef,
const char *prev_path,
const char *key);
static void _e_fwin_desktop_run(Efreet_Desktop *desktop,
E_Fwin_Page *page,
Eina_Bool skip_history);
static Eina_List *_e_fwin_suggested_apps_list_get(Eina_List *files,
Eina_List **mime_list,
Eina_Bool *has_default);
static void _e_fwin_changed(void *data,
Evas_Object *obj,
void *event_info);
static void _e_fwin_favorite_selected(void *data,
Evas_Object *obj,
void *event_info);
static void _e_fwin_selected(void *data,
Evas_Object *obj,
void *event_info);
static void _e_fwin_selection_change(void *data,
Evas_Object *obj,
void *event_info);
static void _e_fwin_cb_menu_extend_open_with(void *data,
E_Menu *m);
static void _e_fwin_cb_menu_open_fast(void *data,
E_Menu *m,
E_Menu_Item *mi);
static void _e_fwin_parent(void *data,
E_Menu *m,
E_Menu_Item *mi);
static void _e_fwin_cb_key_down(void *data,
Evas *e,
Evas_Object *obj,
void *event_info);
static void _e_fwin_cb_menu_extend_start(void *data,
Evas_Object *obj,
E_Menu *m,
E_Fm2_Icon_Info *info);
static void _e_fwin_cb_menu_open(void *data,
E_Menu *m,
E_Menu_Item *mi);
static void _e_fwin_cb_menu_open_with(void *data,
E_Menu *m,
E_Menu_Item *mi);
static void _e_fwin_cb_all_change(void *data,
Evas_Object *obj);
static void _e_fwin_cb_exec_cmd_changed(void *data,
void *data2);
static void _e_fwin_cb_open(void *data,
E_Dialog *dia);
static void _e_fwin_cb_close(void *data,
E_Dialog *dia);
static void _e_fwin_cb_dialog_free(void *obj);
static E_Fwin_Exec_Type _e_fwin_file_is_exec(E_Fm2_Icon_Info *ici);
static void _e_fwin_file_exec(E_Fwin_Page *page,
E_Fm2_Icon_Info *ici,
E_Fwin_Exec_Type ext);
static void _e_fwin_file_open_dialog(E_Fwin_Page *page,
Eina_List *files,
int always);
static void _e_fwin_file_open_dialog_preview_set(void *data1,
void *data2);
static void _e_fwin_file_open_dialog_cb_key_down(void *data,
Evas *e,
Evas_Object *obj,
void *event_info);
static void _e_fwin_pan_set(Evas_Object *obj,
Evas_Coord x,
Evas_Coord y);
static void _e_fwin_pan_get(Evas_Object *obj,
Evas_Coord *x,
Evas_Coord *y);
static void _e_fwin_pan_max_get(Evas_Object *obj,
Evas_Coord *x,
Evas_Coord *y);
static void _e_fwin_pan_child_size_get(Evas_Object *obj,
Evas_Coord *w,
Evas_Coord *h);
static void _e_fwin_pan_scroll_update(E_Fwin_Page *page);
static void _e_fwin_cb_page_obj_del(void *data, Evas *evas,
Evas_Object *obj, void *event_info);
static void _e_fwin_zone_cb_mouse_down(void *data,
Evas *evas,
Evas_Object *obj,
void *event_info);
static Eina_Bool _e_fwin_zone_move_resize(void *data,
int type,
void *event);
static Eina_Bool _e_fwin_zone_del(void *data,
int type,
void *event);
static void _e_fwin_config_set(E_Fwin_Page *page);
static void _e_fwin_window_title_set(E_Fwin_Page *page);
static void _e_fwin_toolbar_resize(E_Fwin_Page *page);
static int _e_fwin_dlg_cb_desk_sort(const void *p1,
const void *p2);
static int _e_fwin_dlg_cb_desk_list_sort(const void *data1,
const void *data2);
static void _e_fwin_op_registry_listener_cb(void *data,
const E_Fm2_Op_Registry_Entry *ere);
static Eina_Bool _e_fwin_op_registry_entry_add_cb(void *data,
int type,
void *event);
static void _e_fwin_op_registry_entry_iter(E_Fwin_Page *page);
static void _e_fwin_op_registry_abort_cb(void *data,
Evas_Object *obj,
const char *emission,
const char *source);
static E_Fwin *drag_fwin = NULL;
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
9 years ago
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;
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
9 years ago
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() ||
(!e_client_util_ignored_get(e_desk_client_top_visible_get(e_desk_current_get(ec->zone))))) return;
if (e_comp_util_kbd_grabbed()) return;
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
9 years ago
fwin = e_fwin_zone_find(ec->zone);
if (fwin)
evas_object_focus_set(fwin->cur_page->fm_obj, 1);
}
typedef struct _E_Fwin_Mime_Handler
{
const char *mime;
Efreet_Desktop *desktop;
E_Fm2_Mime_Handler *handler;
} E_Fwin_Mime_Handler;
static Ecore_Event_Handler *_e_fwin_efreet_desktop_update_handler = NULL;
static Eina_List *_e_fwin_mime_all_handlers_list = NULL;
static int
_e_fwin_cb_dir_mime_handler_test(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *path)
{
if (ecore_file_is_dir(path)) return 1;
if (e_fm2_real_path_get(obj))
{
evas_object_data_set(obj, "fileman_terminal_realpath", (void*)1);
return 1;
}
return 0;
}
static void
_e_fwin_cb_dir_mime_handler(void *data, Evas_Object *obj EINA_UNUSED, const char *path)
{
E_Fwin_Mime_Handler *h = data;
Eina_Stringshare *rp;
Eina_List *files = NULL;
rp = e_fm2_real_path_get(obj);
if (rp && (rp != path) && (evas_object_data_del(obj, "fileman_terminal_realpath"))) //icon menu; use rp
path = rp;
files = eina_list_append(files, path);
e_exec(e_zone_current_get(), h->desktop, NULL, files, "fileman");
eina_list_free(files);
}
static void
_e_fwin_mime_all_handlers_fill(void)
{
E_Fwin_Mime_Handler *h;
Eina_List *desktops;
Efreet_Desktop *desktop;
desktops = efreet_util_desktop_name_glob_list("*");
EINA_LIST_FREE(desktops, desktop)
{
const char *mime = eina_hash_find
(desktop->x, "X-Enlightenment-Action-Mime");
if (!mime) continue;
h = calloc(1, sizeof(E_Fwin_Mime_Handler));
if (!h) continue;
h->mime = eina_stringshare_add(mime);
h->desktop = desktop;
efreet_desktop_ref(desktop);
h->handler = e_fm2_mime_handler_new
(desktop->name, desktop->icon,
_e_fwin_cb_dir_mime_handler, h,
_e_fwin_cb_dir_mime_handler_test, h);
e_fm2_mime_handler_mime_add(h->handler, h->mime);
_e_fwin_mime_all_handlers_list =
eina_list_append(_e_fwin_mime_all_handlers_list, h);
}
}
static void
_e_fwin_mime_all_handlers_clear(void)
{
E_Fwin_Mime_Handler *h;
EINA_LIST_FREE(_e_fwin_mime_all_handlers_list, h)
{
efreet_desktop_free(h->desktop);
e_fm2_mime_handler_mime_del(h->handler, h->mime);
e_fm2_mime_handler_free(h->handler);
eina_stringshare_del(h->mime);
free(h);
}
}
static Eina_Bool
_e_fwin_cb_efreet_cache_update(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED)
{
_e_fwin_mime_all_handlers_clear();
_e_fwin_mime_all_handlers_fill();
return ECORE_CALLBACK_RENEW;
}
static void
_e_fwin_mime_all_handlers_init(void)
{
_e_fwin_efreet_desktop_update_handler =
ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE,
_e_fwin_cb_efreet_cache_update, NULL);
_e_fwin_mime_all_handlers_fill();
}
static void
_e_fwin_mime_all_handlers_shutdown(void)
{
_e_fwin_mime_all_handlers_clear();
ecore_event_handler_del(_e_fwin_efreet_desktop_update_handler);
}
/* externally accessible functions */
int
e_fwin_init(void)
{
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
9 years ago
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");
_e_fwin_mime_all_handlers_init();
tdesktop = e_util_terminal_desktop_get();
if (!tdesktop) return 1;
dir_handler = e_fm2_mime_handler_new(_("Open Terminal here"),
tdesktop->icon,
_e_fwin_cb_dir_handler, NULL,
_e_fwin_cb_dir_handler_test, NULL);
e_fm2_mime_handler_mime_add(dir_handler, "inode/directory");
return 1;
}
int
e_fwin_shutdown(void)
{
E_Fwin *fwin;
EINA_LIST_FREE(fwins, fwin)
e_object_del(E_OBJECT(fwin));
if (dir_handler)
{
e_fm2_mime_handler_mime_del(dir_handler, "inode/directory");
e_fm2_mime_handler_free(dir_handler);
dir_handler = NULL;
}
if (tdesktop)
{
efreet_desktop_free(tdesktop);
tdesktop = NULL;
}
_e_fwin_mime_all_handlers_shutdown();
eina_stringshare_replace(&fwin_class, NULL);
if (focus_out_hook)
{
e_client_hook_del(focus_out_hook);
focus_out_hook = NULL;
}
return 1;
}
/* FIXME: this opens a new window - we need a way to inherit a zone as the
* "fwin" window
*/
void
e_fwin_new(const char *dev,
const char *path)
{
_e_fwin_new(dev, path);
}
static Eina_Bool
_e_fwin_spring_cb(E_Fwin *fwin)
{
E_Fm2_Icon_Info *ici;
E_Fwin *f;
if (fwin->spring_child)
_e_fwin_free(fwin->spring_child);
ici = e_fm2_drop_icon_get(fwin->cur_page->fm_obj);
if (!ici)
ici = e_fm2_drop_icon_get(fwin->cur_page->flist);
while (ici)
{
/* FIXME: could use an animation here */
f = _e_fwin_open(fwin->cur_page, ici, E_FWIN_WIN_FORCE_WIN, NULL);
if (!f) break;
f->spring_parent = fwin;
fwin->spring_child = f;
break;
}
if (fwin->spring_timer) ecore_timer_del(fwin->spring_timer);
fwin->spring_timer = NULL;
return EINA_FALSE;
}
/* called on the drop source */
static void
_e_fwin_dnd_end_cb(E_Fwin *fwin, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
if (fwin->spring_timer) ecore_timer_del(fwin->spring_timer);
fwin->spring_timer = NULL;
if (!drag_fwin) return;
if (drag_fwin->spring_timer) ecore_timer_del(drag_fwin->spring_timer);
drag_fwin->spring_timer = NULL;
/* NOTE: closing the drop target window here WILL break things */
fwin = drag_fwin->spring_parent;
if (!fwin)
{
if (!drag_fwin->zone) return;
//dragging from desktop, we'll never have a parent here
if (drag_fwin->spring_child)
_e_fwin_free(drag_fwin->spring_child);
return;
}
fwin->spring_child->spring_parent = NULL;
fwin->spring_child = NULL;
while (fwin->spring_parent)
{
/* FIXME: needs closing animation? */
fwin = fwin->spring_parent;
_e_fwin_free(fwin->spring_child);
}
drag_fwin = NULL;
}
static void
_e_fwin_dnd_change_cb(E_Fwin *fwin, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
drag_fwin = fwin;
if (fwin->spring_timer)
ecore_timer_loop_reset(fwin->spring_timer);
else
fwin->spring_timer = ecore_timer_loop_add(fileman_config->view.spring_delay, (Ecore_Task_Cb)_e_fwin_spring_cb, fwin);
}
static void
_e_fwin_dnd_enter_cb(E_Fwin *fwin, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
if (drag_fwin == fwin) return;
if (fwin->spring_timer) ecore_timer_del(fwin->spring_timer);
fwin->spring_timer = NULL;
if (fwin->spring_child && (drag_fwin == fwin->spring_child)) _e_fwin_free(fwin->spring_child);
drag_fwin = fwin;
if (fwin->spring_close_timer) ecore_timer_del(fwin->spring_close_timer);
fwin->spring_close_timer = NULL;
}
static Eina_Bool
_e_fwin_dnd_close_cb(E_Fwin *fwin)
{
_e_fwin_free(fwin);
return EINA_FALSE;
}
static void
_e_fwin_dnd_leave_cb(E_Fwin *fwin, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
if (fwin->spring_timer) ecore_timer_del(fwin->spring_timer);
fwin->spring_timer = NULL;
if (fwin->spring_parent && (!fwin->spring_child))
{
if (!fwin->spring_close_timer)
fwin->spring_close_timer = ecore_timer_loop_add(0.01, (Ecore_Task_Cb)_e_fwin_dnd_close_cb, fwin);
}
drag_fwin = NULL;
}
static void
_e_fwin_dnd_begin_cb(E_Fwin *fwin EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
drag_fwin = NULL;
}
static void
_e_fwin_zone_shutdown(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
E_Fwin *fwin = data;
const char *dev, *path;
fwin->path->desktop_mode = e_fm2_view_mode_get(obj);
e_fm2_path_get(obj, &dev, &path);
eina_stringshare_replace(&fwin->path->dev, dev);
eina_stringshare_replace(&fwin->path->path, path);
e_object_del(E_OBJECT(fwin));
}
void
e_fwin_zone_new(E_Zone *zone, void *p)
{
E_Fwin *fwin;
Fileman_Path *path = p;
E_Fwin_Page *page;
Evas_Object *o;
int x, y, w, h;
fwin = E_OBJECT_ALLOC(E_Fwin, E_FWIN_TYPE, _e_fwin_free);
if (!fwin) return;
fwin->zone = zone;
page = E_NEW(E_Fwin_Page, 1);
page->fwin = fwin;
fwin->path = path;
/* Add Event Handler for zone move/resize & del */
fwin->zone_handler =
ecore_event_handler_add(E_EVENT_ZONE_USEFUL_GEOMETRY_CHANGED,
_e_fwin_zone_move_resize, fwin);
fwin->zone_del_handler =
ecore_event_handler_add(E_EVENT_ZONE_DEL,
_e_fwin_zone_del, fwin);
/* Trap the mouse_down on zone so we can unselect */
evas_object_event_callback_add(zone->bg_event_object,
EVAS_CALLBACK_MOUSE_DOWN,
_e_fwin_zone_cb_mouse_down, fwin);
fwins = eina_list_append(fwins, fwin);
o = e_fm2_add(e_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);
e_fm2_custom_theme_content_set(o, "desktop");
evas_object_smart_callback_add(o, "changed",
_e_fwin_icon_mouse_out, fwin);
evas_object_smart_callback_add(o, "dir_changed",
_e_fwin_changed, page);
evas_object_smart_callback_add(o, "dir_deleted",
_e_fwin_deleted, page);
evas_object_smart_callback_add(o, "selected",
_e_fwin_selected, page);
evas_object_smart_callback_add(o, "selection_change",
_e_fwin_selection_change, page);
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
_e_fwin_cb_page_obj_del, page);
evas_object_smart_callback_add(o, "dnd_enter", (Evas_Smart_Cb)_e_fwin_dnd_enter_cb, fwin);
evas_object_smart_callback_add(o, "dnd_leave", (Evas_Smart_Cb)_e_fwin_dnd_leave_cb, fwin);
evas_object_smart_callback_add(o, "dnd_changed", (Evas_Smart_Cb)_e_fwin_dnd_change_cb, fwin);
evas_object_smart_callback_add(o, "dnd_begin", (Evas_Smart_Cb)_e_fwin_dnd_begin_cb, fwin);
evas_object_smart_callback_add(o, "dnd_end", (Evas_Smart_Cb)_e_fwin_dnd_end_cb, fwin);
evas_object_smart_callback_add(o, "icon_mouse_in", (Evas_Smart_Cb)_e_fwin_icon_mouse_in, fwin);
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);
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
9 years ago
evas_object_focus_set(o, !e_client_focused_get());
evas_object_show(o);
o = e_scrollframe_add(e_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
* for things like swallowing widgets/buttons ot providing them - a
* gadcon for starters for fm widgets. need to register the owning
* e_object of the gadcon so gadcon clients can get it and thus do
* things like find out what dirs/path the fwin is for etc. this will
* probably be how you add optional gadgets to fwin views like empty/full
* meters for disk usage, and other dir info/stats or controls. also it
* might be possible that we can have custom frames per dir later so need
* a way to set an edje file directly
*/
/* FIXME: allow specialised scrollframe obj per dir - get from e config,
* then look in the dir itself for a magic dot-file, if not - use theme.
* same as currently done for bg & overlay. also add to fm2 the ability
* to specify the .edj files to get the list and icon theme stuff from
*/
evas_object_data_set(page->fm_obj, "fm_page", page);
evas_object_data_set(page->fm_obj, "page_is_zone", page);
e_scrollframe_extern_pan_set(o, page->fm_obj,
_e_fwin_pan_set,
_e_fwin_pan_get,
_e_fwin_pan_max_get,
_e_fwin_pan_child_size_get);
evas_object_propagate_events_set(page->fm_obj, 0);
e_widget_can_focus_set(o, 0);
evas_object_name_set(o, "zone_fwin");
e_zone_useful_geometry_get(zone, &x, &y, &w, &h);
evas_object_move(o, x, y);
evas_object_resize(o, w, h);
evas_object_show(o);
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
9 years ago
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));
e_fm2_path_set(page->fm_obj, path->dev, path->path);
fwin->cur_page = page;
}
void
e_fwin_all_unsel(void *data)
{
E_Fwin *fwin;
fwin = data;
E_OBJECT_CHECK(fwin);
E_OBJECT_TYPE_CHECK(fwin, E_FWIN_TYPE);
e_fm2_all_unsel(fwin->cur_page->fm_obj);
}
void
e_fwin_zone_shutdown(E_Zone *zone)
{
Eina_List *f, *fn;
E_Fwin *fwin;
EINA_LIST_FOREACH_SAFE(fwins, f, fn, fwin