Enlightenment CVS committal Author : moom Project : e17 Module : libs/etk
Dir : e17/libs/etk/src/lib Modified Files: etk_signal.c etk_window.c etk_window.h Log Message: * [Ecore_Evas engine] cleanup * [FB engine] windows can now be closed * [Signal] There is a big design problem with accumulators. This code fixes it if the callbacks returns an Etk_Bool but this might not work for another return-type... =================================================================== RCS file: /cvs/e/e17/libs/etk/src/lib/etk_signal.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- etk_signal.c 13 Jan 2007 16:20:11 -0000 1.21 +++ etk_signal.c 13 Jan 2007 19:29:19 -0000 1.22 @@ -406,7 +406,7 @@ Etk_Signal_Callback *callback; Etk_Signal_Emitted *emitted_signal; Etk_Bool return_value_set = ETK_FALSE; - void *result = NULL; + Etk_Bool result; va_list args2; void *object_ptr; Etk_Bool ret; @@ -434,19 +434,11 @@ default_handler = (void *)object + signal->handler_offset; if (*default_handler) { - if (!return_value_set || !signal->accumulator) - { - signal->marshaller(*default_handler, object, NULL, return_value, args2); - return_value_set = ETK_TRUE; - } - else - { - signal->marshaller(*default_handler, object, NULL, result, args2); - signal->accumulator(return_value, result, signal->accum_data); - } + signal->marshaller(*default_handler, object, NULL, return_value, args2); + return_value_set = ETK_TRUE; } } - + /* Then we call the corresponding callbacks */ if (object_ptr) { @@ -462,8 +454,8 @@ } else { - etk_signal_callback_call_valist(callback, object, result, args2); - signal->accumulator(return_value, result, signal->accum_data); + etk_signal_callback_call_valist(callback, object, &result, args2); + signal->accumulator(return_value, &result, signal->accum_data); } callbacks = evas_list_remove_list(callbacks, callbacks); } =================================================================== RCS file: /cvs/e/e17/libs/etk/src/lib/etk_window.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -3 -r1.41 -r1.42 --- etk_window.c 12 Jan 2007 02:53:56 -0000 1.41 +++ etk_window.c 13 Jan 2007 19:29:19 -0000 1.42 @@ -51,13 +51,6 @@ static void _etk_window_size_get(Etk_Toplevel *toplevel, int *w, int *h); static void _etk_window_pointer_set(Etk_Toplevel *toplevel, Etk_Pointer_Type pointer_type); -static void _etk_window_move_cb(Etk_Window *window); -static void _etk_window_resize_cb(Etk_Window *window); -static void _etk_window_focus_in_cb(Etk_Window *window); -static void _etk_window_focus_out_cb(Etk_Window *window); -static void _etk_window_sticky_changed_cb(Etk_Window *window); -static void _etk_window_delete_request_cb(Etk_Window *window); - static Etk_Signal *_etk_window_signals[ETK_WINDOW_NUM_SIGNALS]; /************************** @@ -69,9 +62,9 @@ /** * @internal * @brief Gets the type of an Etk_Window - * @return Returns the type on an Etk_Window + * @return Returns the type of an Etk_Window */ -Etk_Type *etk_window_type_get() +Etk_Type *etk_window_type_get(void) { static Etk_Type *window_type = NULL; @@ -107,12 +100,27 @@ * @brief Creates a new window * @return Returns the new window widget */ -Etk_Widget *etk_window_new() +Etk_Widget *etk_window_new(void) { return etk_widget_new(ETK_WINDOW_TYPE, "theme_group", "window", NULL); } /** + * @brief Emits a delete-request on the window: it will call all the callbacks connected to the "delete_event" signal + * and if all these callbacks return ETK_FALSE, the window will be destroyed. It has the same effect as if the user + * had clicked on the "close" button of the window + * @param window a window + */ +void etk_window_delete_request(Etk_Window *window) +{ + Etk_Bool result; + + etk_signal_emit(_etk_window_signals[ETK_WINDOW_DELETE_EVENT_SIGNAL], ETK_OBJECT(window), &result); + if (!result) + etk_object_destroy(ETK_OBJECT(window)); +} + +/** * @brief Sets the title of the window * @param window the window * @param title the title to set @@ -529,14 +537,7 @@ window->wait_size_request = ETK_TRUE; window->center = ETK_FALSE; window->center_on_window = NULL; - window->delete_event = _etk_window_delete_event_handler; - window->move_cb = _etk_window_move_cb; - window->resize_cb = _etk_window_resize_cb; - window->focus_in_cb = _etk_window_focus_in_cb; - window->focus_out_cb = _etk_window_focus_out_cb; - window->sticky_changed_cb = _etk_window_sticky_changed_cb; - window->delete_request_cb = _etk_window_delete_request_cb; etk_engine_window_constructor(window); @@ -737,49 +738,6 @@ static void _etk_window_pointer_set(Etk_Toplevel *toplevel, Etk_Pointer_Type pointer_type) { etk_engine_window_pointer_set(ETK_WINDOW(toplevel), pointer_type); -} - -/* Called when the window is moved by the engine */ -static void _etk_window_move_cb(Etk_Window *window) -{ - etk_signal_emit(_etk_window_signals[ETK_WINDOW_MOVE_SIGNAL], ETK_OBJECT(window), NULL); -} - -/* Called when the window is resized by the engine */ -static void _etk_window_resize_cb(Etk_Window *window) -{ - etk_signal_emit(_etk_window_signals[ETK_WINDOW_RESIZE_SIGNAL], ETK_OBJECT(window), NULL); - etk_widget_redraw_queue(ETK_WIDGET(window)); -} - -/* Called when the window is focused by the engine */ -static void _etk_window_focus_in_cb(Etk_Window *window) -{ - etk_signal_emit(_etk_window_signals[ETK_WINDOW_FOCUS_IN_SIGNAL], ETK_OBJECT(window), NULL); - etk_object_notify(ETK_OBJECT(window), "focused"); -} - -/* Called when the window is unfocused by the engine */ -static void _etk_window_focus_out_cb(Etk_Window *window) -{ - etk_signal_emit(_etk_window_signals[ETK_WINDOW_FOCUS_OUT_SIGNAL], ETK_OBJECT(window), NULL); - etk_object_notify(ETK_OBJECT(window), "focused"); -} - -/* Called when the window's sticky setting has changed */ -static void _etk_window_sticky_changed_cb(Etk_Window *window) -{ - etk_object_notify(ETK_OBJECT(window), "sticky"); -} - -/* Called when the engine asks to delete the window */ -static void _etk_window_delete_request_cb(Etk_Window *window) -{ - Etk_Bool result; - - etk_signal_emit(_etk_window_signals[ETK_WINDOW_DELETE_EVENT_SIGNAL], ETK_OBJECT(window), &result); - if (!result) - etk_object_destroy(ETK_OBJECT(window)); } /** @} */ =================================================================== RCS file: /cvs/e/e17/libs/etk/src/lib/etk_window.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- etk_window.h 12 Jan 2007 02:53:56 -0000 1.19 +++ etk_window.h 13 Jan 2007 19:29:19 -0000 1.20 @@ -42,17 +42,12 @@ Etk_Bool wait_size_request; Etk_Bool center; Etk_Window *center_on_window; - - void (*move_cb)(Etk_Window *window); - void (*resize_cb)(Etk_Window *window); - void (*focus_in_cb)(Etk_Window *window); - void (*focus_out_cb)(Etk_Window *window); - void (*sticky_changed_cb)(Etk_Window *window); - void (*delete_request_cb)(Etk_Window *window); }; -Etk_Type *etk_window_type_get(); -Etk_Widget *etk_window_new(); +Etk_Type *etk_window_type_get(void); + +Etk_Widget *etk_window_new(void); +void etk_window_delete_request(Etk_Window *window); void etk_window_title_set(Etk_Window *window, const char *title); const char *etk_window_title_get(Etk_Window *window); ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs