diff --git a/src/actions.h b/src/actions.h index 24d255d72..d3bf87467 100644 --- a/src/actions.h +++ b/src/actions.h @@ -56,6 +56,14 @@ struct _E_Action_Impl }; +/** + * e_action_init - Actions implementation initializer + * + * This function registers the various action implementations, + * i.e. the way E performs actions. + */ +void e_action_init(void); + int e_action_start(char *action, E_Action_Type act, int button, char *key, Ecore_Event_Key_Modifiers mods, void *o, void *data, int x, int y, int rx, int ry); @@ -74,6 +82,5 @@ void e_action_add_proto(char *action, void e_action_del_timer(void *o, char *name); void e_action_add_timer(void *o, char *name); void e_action_del_timer_object(void *o); -void e_action_init(void); #endif diff --git a/src/border.c b/src/border.c index 2a458ca19..106c3c845 100644 --- a/src/border.c +++ b/src/border.c @@ -28,7 +28,7 @@ static Ecore_Event *current_ev = NULL; /* Global delayed window raise action */ E_Delayed_Action *delayed_window_raise = NULL; -static void ecore_idle(void *data); +static void e_idle(void *data); static void e_map_request(Ecore_Event * ev); static void e_configure_request(Ecore_Event * ev); static void e_property(Ecore_Event * ev); @@ -37,14 +37,14 @@ static void e_destroy(Ecore_Event * ev); static void e_circulate_request(Ecore_Event * ev); static void e_reparent(Ecore_Event * ev); static void e_shape(Ecore_Event * ev); -static void ecore_focus_in(Ecore_Event * ev); -static void ecore_focus_out(Ecore_Event * ev); +static void e_focus_in(Ecore_Event * ev); +static void e_focus_out(Ecore_Event * ev); static void e_colormap(Ecore_Event * ev); static void e_mouse_down(Ecore_Event * ev); static void e_mouse_up(Ecore_Event * ev); static void e_mouse_in(Ecore_Event * ev); static void e_mouse_out(Ecore_Event * ev); -static void ecore_window_expose(Ecore_Event * ev); +static void e_window_expose(Ecore_Event * ev); static void e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); @@ -116,7 +116,7 @@ e_border_update_borders(void) } static void -ecore_idle(void *data) +e_idle(void *data) { e_border_update_borders(); return; @@ -413,7 +413,7 @@ e_shape(Ecore_Event * ev) /* */ static void -ecore_focus_in(Ecore_Event * ev) +e_focus_in(Ecore_Event * ev) { Ecore_Event_Window_Focus_In *e; @@ -434,7 +434,6 @@ ecore_focus_in(Ecore_Event * ev) { Evas_List l; - again: for (l = b->grabs; l; l = l->next) { E_Grab *g; @@ -461,7 +460,7 @@ ecore_focus_in(Ecore_Event * ev) /* */ static void -ecore_focus_out(Ecore_Event * ev) +e_focus_out(Ecore_Event * ev) { Ecore_Event_Window_Focus_Out *e; @@ -779,7 +778,7 @@ e_mouse_out(Ecore_Event * ev) /* handling expose events */ static void -ecore_window_expose(Ecore_Event * ev) +e_window_expose(Ecore_Event * ev) { Ecore_Event_Window_Expose *e; @@ -1143,7 +1142,8 @@ e_cb_border_visibility(E_Border *b) UN(b); } -static void e_border_poll(int val, void *data) +static void +e_border_poll(int val, void *data) { ecore_add_event_timer("e_border_poll()", 1.00, e_border_poll, val + 1, NULL); return; @@ -2430,7 +2430,7 @@ e_border_init(void) ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_MOVE, e_mouse_move); ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_IN, e_mouse_in); ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_OUT, e_mouse_out); - ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_EXPOSE, ecore_window_expose); + ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_EXPOSE, e_window_expose); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_MAP_REQUEST, e_map_request); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_CONFIGURE_REQUEST, e_configure_request); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_PROPERTY, e_property); @@ -2439,11 +2439,11 @@ e_border_init(void) ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_CIRCULATE_REQUEST, e_circulate_request); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_REPARENT, e_reparent); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_SHAPE, e_shape); - ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_FOCUS_IN, ecore_focus_in); - ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_FOCUS_OUT, ecore_focus_out); + ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_FOCUS_IN, e_focus_in); + ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_FOCUS_OUT, e_focus_out); ecore_event_filter_handler_add(ECORE_EVENT_MESSAGE, e_client_message); ecore_event_filter_handler_add(ECORE_EVENT_COLORMAP, e_colormap); - ecore_event_filter_idle_handler_add(ecore_idle, NULL); + ecore_event_filter_idle_handler_add(e_idle, NULL); delayed_window_raise = NEW(E_Delayed_Action, 1); E_DELAYED_ACT_INIT(delayed_window_raise, ECORE_EVENT_WINDOW_FOCUS_IN, raise_delay, e_border_raise_delayed); diff --git a/src/border.h b/src/border.h index d88f3bc40..9e8054f1a 100644 --- a/src/border.h +++ b/src/border.h @@ -133,11 +133,19 @@ struct _E_Border int changed; }; +/** + * e_border_init - Border handling initialization. + * + * This function registers the border event handlers + * against ecore. + */ +void e_border_init(void); void e_border_update_borders(void); void e_border_apply_border(E_Border *b); void e_border_reshape(E_Border *b); E_Border *e_border_adopt(Window win, int use_client_pos); +void e_border_adopt_children(Window win); E_Border *e_border_new(void); void e_border_free(E_Border *b); void e_border_remove_mouse_grabs(E_Border *b); @@ -156,8 +164,6 @@ void e_border_raise(E_Border *b); void e_border_lower(E_Border *b); void e_border_raise_above(E_Border *b, E_Border *above); void e_border_lower_below(E_Border *b, E_Border *below); -void e_border_init(void); -void e_border_adopt_children(Window win); E_Border *e_border_current_focused(void); void e_border_focus_grab_ended(void); void e_border_raise_next(void); diff --git a/src/desktops.c b/src/desktops.c index 79e7f952e..ba6b49a10 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -16,6 +16,8 @@ static void ecore_idle(void *data); static void ecore_idle(void *data) { + /* FIXME -- Raster, how is this related to the desktop code? */ + e_db_flush(); return; UN(data); diff --git a/src/desktops.h b/src/desktops.h index 37d0e29e8..a9caf8013 100644 --- a/src/desktops.h +++ b/src/desktops.h @@ -34,7 +34,16 @@ struct _E_Desktop int changed; }; +/** + * e_desktops_init - Initializes desktop handling. + * + * This function creates the necessary windows for desktop handling, + * and makes sure they're visible and lowered. It does not handle + * the loading of background graphics information. It also makes + * sure E rregisters itself as being compatible to GNOME, KDE etc. + */ void e_desktops_init(void); + void e_desktops_scroll(E_Desktop *desk, int dx, int dy); void e_desktops_free(E_Desktop *desk); void e_desktops_init_file_display(E_Desktop *desk); diff --git a/src/entry.h b/src/entry.h index 1f612d7b4..82c02aaff 100644 --- a/src/entry.h +++ b/src/entry.h @@ -39,7 +39,14 @@ struct _E_Entry }; +/** + * e_entry_init - Text entry widget event handler initialization. + * + * This function initalizes the entry widget code, it registers + * the event handlers needed for managing a text entry widget. + */ void e_entry_init(void); + void e_entry_free(E_Entry *entry); E_Entry *e_entry_new(void); void e_entry_handlecore_keypress(E_Entry *entry, Ecore_Event_Key_Down *e); diff --git a/src/fs.c b/src/fs.c index 79aee3158..57459cbc6 100644 --- a/src/fs.c +++ b/src/fs.c @@ -98,8 +98,9 @@ static void _e_fs_restarter(int val, void *data) { if (ec) return; + ec = efsd_open(); - printf("restart efsd...\n"); + if ((!ec) && (val > 0)) { if (efsd_pid <= 0) @@ -167,7 +168,18 @@ e_fs_add_event_handler(void (*func) (EfsdEvent *ev)) void e_fs_init(void) { + /* Hook in an fs handler that gets called whenever + a child of this process exits. + */ ecore_event_filter_handler_add(ECORE_EVENT_CHILD, e_fs_child_handle); + + /* Also hook in an idle handler to flush efsd's + write queue. + + FIXME: This should be handled by letting ecore + report when Efsd's file descriptor becomes + writeable, and then calling efsd_flush(). + */ ecore_event_filter_idle_handler_add(e_fs_idle, NULL); _e_fs_restarter(0, NULL); } diff --git a/src/fs.h b/src/fs.h index de6c0e496..31f248b34 100644 --- a/src/fs.h +++ b/src/fs.h @@ -12,7 +12,15 @@ struct _E_FS_Restarter void *data; }; +/** + * e_fs_init - Filesystem code initialization. + * + * This function makes sure that efsd is running, + * starts it when necessary, and makes sure that + * it can be restarted in case efsd dies. + */ void e_fs_init(void); + E_FS_Restarter *e_fs_add_restart_handler(void (*func) (void *data), void *data); void e_fs_del_restart_handler(E_FS_Restarter *rs); void e_fs_add_event_handler(void (*func) (EfsdEvent *ev)); diff --git a/src/guides.h b/src/guides.h index 864760f36..25176dcc2 100644 --- a/src/guides.h +++ b/src/guides.h @@ -19,6 +19,16 @@ typedef enum e_guides_location } E_Guides_Location; + +/** + * e_guides_init - Guides initialization. + * + * This function initializes guides handling. Guides are + * little help windows that pop up when you move or resize + * a window. + */ +void e_guides_init(void); + void e_guides_show(void); void e_guides_hide(void); void e_guides_move(int x, int y); @@ -28,6 +38,5 @@ void e_guides_display_icon(char *icon); void e_guides_set_display_location(E_Guides_Location loc); void e_guides_set_display_alignment(double x, double y); void e_guides_set_mode(E_Guides_Mode mode); -void e_guides_init(void); #endif diff --git a/src/main.c b/src/main.c index 8fc8f421d..908b7a98a 100644 --- a/src/main.c +++ b/src/main.c @@ -26,12 +26,14 @@ Evas_List __e_profiles = NULL; #endif static void cb_exit(void); +static void wm_running_error(Display * d, XErrorEvent * ev); +static void setup(void); + static void cb_exit(void) { E_PROF_DUMP; } -static void wm_running_error(Display * d, XErrorEvent * ev); static void wm_running_error(Display * d, XErrorEvent * ev) @@ -39,20 +41,23 @@ wm_running_error(Display * d, XErrorEvent * ev) if ((ev->request_code == X_ChangeWindowAttributes) && (ev->error_code == BadAccess)) { - fprintf(stderr, "A window manager is already running. No point running now is there?\n"); + fprintf(stderr, "A window manager is already running.\n"); fprintf(stderr, "Exiting Enlightenment. Error.\n"); exit(-2); } UN(d); } -void setup(void); -void +static void setup(void) { ecore_grab(); ecore_sync(); + + /* Start to manage all those windows that + we're interested in ... */ e_border_adopt_children(0); + ecore_ungrab(); } @@ -105,6 +110,8 @@ main(int argc, char **argv) exit(-1); } + /* Initialize signal handlers, clear ecore event handlers + * and hook in ecore's X event handler. */ ecore_event_signal_init(); ecore_event_filter_init(); ecore_event_x_init(); @@ -117,7 +124,8 @@ main(int argc, char **argv) ecore_sync(); ecore_reset_error_handler(); ecore_ungrab(); - + + /* Initialization for the various modules: */ e_fs_init(); e_desktops_init(); e_border_init(); @@ -145,6 +153,5 @@ main(int argc, char **argv) e_ferite_deinit(); #endif - return 0; } diff --git a/src/menu.c b/src/menu.c index 32508d348..ce0b26c3c 100644 --- a/src/menu.c +++ b/src/menu.c @@ -8,16 +8,16 @@ static int screen_w, screen_h; /* Screen width and height */ static int mouse_x, mouse_y; /* Mouse coordinates */ static int keyboard_nav = 0; /* If non-zero, navigating with keyboard */ -static void ecore_idle(void *data); +static void e_idle(void *data); static void e_wheel(Ecore_Event * ev); -static void ecore_key_down(Ecore_Event * ev); -static void ecore_key_up(Ecore_Event * ev); +static void e_key_down(Ecore_Event * ev); +static void e_key_up(Ecore_Event * ev); static void e_mouse_down(Ecore_Event * ev); static void e_mouse_up(Ecore_Event * ev); static void e_mouse_move(Ecore_Event * ev); static void e_mouse_in(Ecore_Event * ev); static void e_mouse_out(Ecore_Event * ev); -static void ecore_window_expose(Ecore_Event * ev); +static void e_window_expose(Ecore_Event * ev); static void e_scroller_timer(int val, void *data) diff --git a/src/menu.h b/src/menu.h index 7199261d8..8ac28b59e 100644 --- a/src/menu.h +++ b/src/menu.h @@ -87,11 +87,19 @@ struct _E_Menu_Item void *func_select_data; }; + +/** + * e_menu_init - Menu event handling initalization. + * + * This function hooks in the necessary event handlers for + * menu handling. + */ +void e_menu_init(void ); + void e_menu_callback_item(E_Menu *m, E_Menu_Item *mi); void e_menu_item_set_callback(E_Menu_Item *mi, void (*func) (E_Menu *m, E_Menu_Item *mi, void *data), void *data); void e_menu_hide_submenus(E_Menu *menus_after); void e_menu_select(int dx, int dy); -void e_menu_init(void ); void e_menu_event_win_show(void ); void e_menu_event_win_hide(void ); void e_menu_set_background(E_Menu *m); diff --git a/src/view.c b/src/view.c index 33682e99a..5fc071055 100644 --- a/src/view.c +++ b/src/view.c @@ -25,22 +25,22 @@ static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, i static void e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); static void e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); static void e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); -static void ecore_idle(void *data); +static void e_idle(void *data); static void e_wheel(Ecore_Event * ev); -static void ecore_key_down(Ecore_Event * ev); -static void ecore_key_up(Ecore_Event * ev); +static void e_key_down(Ecore_Event * ev); +static void e_key_up(Ecore_Event * ev); static void e_mouse_down(Ecore_Event * ev); static void e_mouse_up(Ecore_Event * ev); static void e_mouse_move(Ecore_Event * ev); static void e_mouse_in(Ecore_Event * ev); static void e_mouse_out(Ecore_Event * ev); -static void ecore_window_expose(Ecore_Event * ev); +static void e_window_expose(Ecore_Event * ev); static void e_configure(Ecore_Event * ev); static void e_property(Ecore_Event * ev); static void e_unmap(Ecore_Event * ev); static void e_visibility(Ecore_Event * ev); -static void ecore_focus_in(Ecore_Event * ev); -static void ecore_focus_out(Ecore_Event * ev); +static void e_focus_in(Ecore_Event * ev); +static void e_focus_out(Ecore_Event * ev); static void e_delete(Ecore_Event * ev); static void e_view_handle_fs(EfsdEvent *ev); static void e_view_handle_fs_restart(void *data); @@ -1138,7 +1138,7 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) } static void -ecore_idle(void *data) +e_idle(void *data) { Evas_List l; @@ -1326,7 +1326,7 @@ e_visibility(Ecore_Event * ev) } static void -ecore_focus_in(Ecore_Event * ev) +e_focus_in(Ecore_Event * ev) { Ecore_Event_Window_Focus_In *e; Evas_List l; @@ -1344,7 +1344,7 @@ ecore_focus_in(Ecore_Event * ev) } static void -ecore_focus_out(Ecore_Event * ev) +e_focus_out(Ecore_Event * ev) { Ecore_Event_Window_Focus_Out *e; Evas_List l; @@ -1400,7 +1400,7 @@ e_wheel(Ecore_Event * ev) } static void -ecore_key_down(Ecore_Event * ev) +e_key_down(Ecore_Event * ev) { Ecore_Event_Key_Down *e; Evas_List l; @@ -1448,7 +1448,7 @@ ecore_key_down(Ecore_Event * ev) } static void -ecore_key_up(Ecore_Event * ev) +e_key_up(Ecore_Event * ev) { Ecore_Event_Key_Up *e; Evas_List l; @@ -1588,7 +1588,7 @@ e_mouse_out(Ecore_Event * ev) } static void -ecore_window_expose(Ecore_Event * ev) +e_window_expose(Ecore_Event * ev) { Ecore_Event_Window_Expose *e; Evas_List l; @@ -2783,17 +2783,17 @@ e_view_init(void) ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_MOVE, e_mouse_move); ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_IN, e_mouse_in); ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_OUT, e_mouse_out); - ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_EXPOSE, ecore_window_expose); - ecore_event_filter_handler_add(ECORE_EVENT_KEY_DOWN, ecore_key_down); - ecore_event_filter_handler_add(ECORE_EVENT_KEY_UP, ecore_key_up); + ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_EXPOSE, e_window_expose); + ecore_event_filter_handler_add(ECORE_EVENT_KEY_DOWN, e_key_down); + ecore_event_filter_handler_add(ECORE_EVENT_KEY_UP, e_key_up); ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_WHEEL, e_wheel); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_CONFIGURE, e_configure); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_PROPERTY, e_property); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_UNMAP, e_unmap); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_VISIBILITY, e_visibility); - ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_FOCUS_IN, ecore_focus_in); - ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_FOCUS_OUT, ecore_focus_out); + ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_FOCUS_IN, e_focus_in); + ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_FOCUS_OUT, e_focus_out); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_DELETE, e_delete); - ecore_event_filter_idle_handler_add(ecore_idle, NULL); + ecore_event_filter_idle_handler_add(e_idle, NULL); e_fs_add_event_handler(e_view_handle_fs); } diff --git a/src/view.h b/src/view.h index 4aa2b3718..4542e9aef 100644 --- a/src/view.h +++ b/src/view.h @@ -204,6 +204,15 @@ struct _E_Icon }; +/** + * e_view_init - View event handlers initialization. + * + * This function registers event handlers for the views. + * Views are the windows in which e as a desktop shell + * displays file icons. + */ +void e_view_init(void); + void e_view_selection_update(E_View *v); void e_view_deselect_all(void); void e_view_deselect_all_except(E_Icon *not_ic); @@ -247,6 +256,5 @@ void e_view_set_background(E_View *v); void e_view_set_dir(E_View *v, char *dir); void e_view_realize(E_View *v); void e_view_update(E_View *v); -void e_view_init(void); #endif