Enlightenment CVS committal Author : moom Project : e17 Module : proto
Dir : e17/proto/etk/src/lib Modified Files: Etk.h Makefile.am etk_engine.c etk_engine.h etk_popup_window.c etk_utils.h etk_window.c etk_window.h Log Message: * Some work to clean up the engine's API =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/Etk.h,v retrieving revision 1.41 retrieving revision 1.42 diff -u -3 -r1.41 -r1.42 --- Etk.h 31 Aug 2006 17:32:06 -0000 1.41 +++ Etk.h 1 Sep 2006 06:41:17 -0000 1.42 @@ -10,6 +10,7 @@ #endif #include "etk_argument.h" +#include "etk_config.h" #include "etk_main.h" #include "etk_marshallers.h" #include "etk_object.h" @@ -19,9 +20,8 @@ #include "etk_string.h" #include "etk_type.h" #include "etk_types.h" -#include "etk_config.h" #include "etk_utils.h" - + #include "etk_alignment.h" #include "etk_bin.h" #include "etk_box.h" @@ -76,7 +76,7 @@ #include "etk_viewport.h" #include "etk_widget.h" #include "etk_window.h" - + #ifdef __cplusplus } #endif =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/Makefile.am,v retrieving revision 1.45 retrieving revision 1.46 diff -u -3 -r1.45 -r1.46 --- Makefile.am 31 Aug 2006 17:32:06 -0000 1.45 +++ Makefile.am 1 Sep 2006 06:41:17 -0000 1.46 @@ -28,6 +28,7 @@ etk_clipboard.h \ etk_colorpicker.h \ etk_combobox.h \ +etk_config.h \ etk_container.h \ etk_dialog.h \ etk_dnd.h \ @@ -83,8 +84,7 @@ etk_utils.h \ etk_viewport.h \ etk_widget.h \ -etk_window.h \ -etk_config.h +etk_window.h libetk_la_SOURCES = \ etk_alignment.c \ @@ -98,6 +98,7 @@ etk_clipboard.c \ etk_colorpicker.c \ etk_combobox.c \ +etk_config.c \ etk_container.c \ etk_dialog.c \ etk_dnd.c \ @@ -153,7 +154,6 @@ etk_viewport.c \ etk_widget.c \ etk_window.c \ -etk_config.c \ $(ETKHEADERS) installed_headersdir = $(prefix)/include/etk =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_engine.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- etk_engine.c 30 Jul 2006 21:09:32 -0000 1.7 +++ etk_engine.c 1 Sep 2006 06:41:17 -0000 1.8 @@ -1,14 +1,16 @@ /** @file etk_engine.c */ +#include "etk_engine.h" #include <stdlib.h> #include <string.h> #include <limits.h> #include <dlfcn.h> - #include <Ecore_Data.h> #include <Ecore_File.h> -#include <Evas.h> - -#include "etk_engine.h" +#include "etk_object.h" +#include "etk_window.h" +#include "etk_popup_window.h" +#include "etk_drag.h" +#include "etk_widget.h" #include "etk_utils.h" #include "config.h" @@ -35,9 +37,8 @@ /** * @internal - * @brief Initializes the engine system + * @brief Initializes the engine subsystem * @return Returns ETK_TRUE on success, ETK_FALSE on failure - * @warning You should not call it manually, it's called by etk_init() */ Etk_Bool etk_engine_init() { @@ -49,7 +50,7 @@ files = ecore_file_ls(PACKAGE_LIB_DIR "/etk/engines"); if (!files || (ecore_list_nodes(files) == 0)) - return ETK_FALSE; + return ETK_FALSE; ecore_list_goto_first(files); while ((file = ecore_list_next(files))) @@ -70,8 +71,7 @@ /** * @internal - * @brief Shutdowns the engine system - * @warning You should not call it manually, it's called by etk_shutdown() + * @brief Shutdowns the engine subsystem */ void etk_engine_shutdown() { @@ -79,7 +79,8 @@ while (_loaded_engines) { Etk_Engine *engine; - void *(*engine_close)(); + void *(*engine_close)(); + engine = _loaded_engines->data; _loaded_engines = evas_list_remove(_loaded_engines, engine); @@ -122,6 +123,9 @@ { Evas_List *l; + if (!engine_name) + return ETK_FALSE; + for (l = _etk_engines; l; l = l->next) { if (strcmp(l->data, engine_name) == 0) @@ -132,8 +136,8 @@ } /** - * @brief Gets the engine used by Etk - * @return Returns the engine used by Etk or NULL if no engine is loaded yet + * @brief Gets the engine currently used by Etk + * @return Returns the engine currently used by Etk or NULL if no engine is loaded yet */ Etk_Engine *etk_engine_get() { @@ -145,7 +149,6 @@ * @brief Loads an engine. The loaded engine will automatically become the engine used by Etk * @param engine_name the name of the engine to load * @return Returns the loaded engine, or NULL if the engine could not be loaded - * @warning You should not call this function yourself, etk_init() calls it automatically */ Etk_Engine *etk_engine_load(const char *engine_name) { @@ -161,7 +164,7 @@ if (!ecore_file_exists(filename)) { - ETK_WARNING("Etk can not find requested engine!"); + ETK_WARNING("Etk can not find the requested engine!"); return NULL; } @@ -202,7 +205,7 @@ } /** - * @brief Makes the engine inherit from another exising engine: the methods of the base engine + * @brief Makes the engine inherit from another existing engine: the methods of the base engine * will be used by the inheriting engine * @param engine the engine which will inherit from the methods of the base engine * @param inherit_name the name of the engine from which @a engine will inherit @@ -229,7 +232,7 @@ **************************/ /** - * @brief Calls the engine's method to initialize a window + * @brief Calls the engine's method to create a window * @param window a window */ void etk_engine_window_constructor(Etk_Window *window) @@ -395,8 +398,8 @@ /** * @brief Calls the engines's method to get the size of a window * @param window a window - * @param x the location where to store the width of the window - * @param y the location where to store the height of the window + * @param w the location where to store the width of the window + * @param h the location where to store the height of the window */ void etk_engine_window_size_get(Etk_Window *window, int *w, int *h) { @@ -408,7 +411,29 @@ _engine->window_size_get(window, w, h); } -void etk_engine_window_center_on_window(Etk_Window *window_to_center, Etk_Window *window) +/** + * @brief Calls the engines's method to get the geometry of the screen containing @a window + * @param window a window + * @param x the location where to store x position of the screen + * @param y the location where to store y position of the screen + * @param w the location where to store the width of the screen + * @param h the location where to store the height of the screen + */ +void etk_engine_window_screen_geometry_get(Etk_Window *window, int *x, int *y, int *w, int *h) +{ + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + + if (!_engine || !_engine->window_screen_geometry_get) + return; + _engine->window_screen_geometry_get(window, x, y, w, h); + +} + +/* TODO: remove */ +/*void etk_engine_window_center_on_window(Etk_Window *window_to_center, Etk_Window *window) { if (!_engine || !_engine->window_center_on_window) return; @@ -420,7 +445,7 @@ if (!_engine || !_engine->window_move_to_mouse) return; _engine->window_move_to_mouse(window); -} +}*/ void etk_engine_window_modal_for_window(Etk_Window *window_to_modal, Etk_Window *window) { @@ -569,20 +594,6 @@ return _engine->window_skip_pager_hint_get(window); } -void etk_engine_window_dnd_aware_set(Etk_Window *window, Etk_Bool on) -{ - if (!_engine || !_engine->window_dnd_aware_set) - return; - _engine->window_dnd_aware_set(window, on); -} - -Etk_Bool etk_engine_window_dnd_aware_get(Etk_Window *window) -{ - if (!_engine || !_engine->window_dnd_aware_get) - return ETK_FALSE; - return _engine->window_dnd_aware_get(window); -} - void etk_engine_window_pointer_set(Etk_Window *window, Etk_Pointer_Type pointer_type) { if (!_engine || !_engine->window_pointer_set) @@ -604,12 +615,13 @@ _engine->popup_window_popup_at_xy(popup_window, x, y); } -void etk_engine_popup_window_popup(Etk_Popup_Window *popup_window) +/* TODO: remove */ +/*void etk_engine_popup_window_popup(Etk_Popup_Window *popup_window) { if (!_engine || !_engine->popup_window_popup) return; _engine->popup_window_popup(popup_window); -} +}*/ void etk_engine_popup_window_popdown(Etk_Popup_Window *popup_window) { @@ -618,6 +630,7 @@ _engine->popup_window_popdown(popup_window); } +/* TODO: remove?? */ Evas_List **etk_engine_popup_window_popped_get() { if (!_engine || !_engine->popup_window_popped_get) @@ -625,11 +638,39 @@ return _engine->popup_window_popped_get(); } +/** + * @brief Calls the engines's method to get the position of the mouse pointer, relative to the screen + * @param window a window + * @param x the location where to store the x position of the mouse pointer + * @param y the location where to store the y position of the mouse pointer + */ +void etk_engine_mouse_position_get(int *x, int *y) +{ + if (x) *x = 0; + if (y) *y = 0; + + if (!_engine || !_engine->mouse_position_get) + return; + return _engine->mouse_position_get(x, y); +} + +void etk_engine_mouse_screen_geometry_get(int *x, int *y, int *w, int *h) +{ + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + + if (!_engine || !_engine->mouse_screen_geometry_get) + return; + return _engine->mouse_screen_geometry_get(x, y, w, h); +} + void etk_engine_drag_constructor(Etk_Drag *drag) { if (!_engine || !_engine->drag_constructor) return; - return _engine->drag_constructor(drag); + return _engine->drag_constructor(drag); } void etk_engine_drag_begin(Etk_Drag *drag) @@ -716,8 +757,7 @@ INHERIT(window_evas_position_get); INHERIT(window_screen_position_get); INHERIT(window_size_get); - INHERIT(window_center_on_window); - INHERIT(window_move_to_mouse); + INHERIT(window_screen_geometry_get); INHERIT(window_modal_for_window); INHERIT(window_iconified_set); INHERIT(window_iconified_get); @@ -739,15 +779,15 @@ INHERIT(window_skip_taskbar_hint_get); INHERIT(window_skip_pager_hint_set); INHERIT(window_skip_pager_hint_get); - INHERIT(window_dnd_aware_set); - INHERIT(window_dnd_aware_get); INHERIT(window_pointer_set); INHERIT(popup_window_constructor); INHERIT(popup_window_popup_at_xy); - INHERIT(popup_window_popup); INHERIT(popup_window_popdown); INHERIT(popup_window_popped_get); + + INHERIT(mouse_position_get); + INHERIT(mouse_screen_geometry_get); INHERIT(drag_constructor); INHERIT(drag_begin); =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_engine.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- etk_engine.h 30 Jul 2006 21:09:32 -0000 1.7 +++ etk_engine.h 1 Sep 2006 06:41:17 -0000 1.8 @@ -2,12 +2,9 @@ #ifndef _ETK_ENGINE_H_ #define _ETK_ENGINE_H_ -#include "etk_object.h" -#include "etk_window.h" -#include "etk_popup_window.h" -#include "etk_drag.h" -#include "etk_widget.h" +#include "Evas.h" #include "etk_toplevel_widget.h" +#include "etk_types.h" struct Etk_Engine { @@ -20,10 +17,10 @@ void (*engine_shutdown)(); void (*window_constructor)(Etk_Window *window); - void (*window_destructor)(Etk_Window *window); + void (*window_destructor)(Etk_Window *window); void (*window_show)(Etk_Window *window); void (*window_hide)(Etk_Window *window); - Evas *(*window_evas_get)(Etk_Window *window); + Evas *(*window_evas_get)(Etk_Window *window); void (*window_title_set)(Etk_Window *window, const char *title); const char *(*window_title_get)(Etk_Window *window); void (*window_wmclass_set)(Etk_Window *window, const char *window_name, const char *window_class); @@ -33,8 +30,10 @@ void (*window_evas_position_get)(Etk_Window *window, int *x, int *y); void (*window_screen_position_get)(Etk_Window *window, int *x, int *y); void (*window_size_get)(Etk_Window *window, int *w, int *h); - void (*window_center_on_window)(Etk_Window *window_to_center, Etk_Window *window); - void (*window_move_to_mouse)(Etk_Window *window); + /* ++ */ + void (*window_screen_geometry_get)(Etk_Window *window, int *x, int *y, int *w, int *h); + //void (*window_center_on_window)(Etk_Window *window_to_center, Etk_Window *window); + //void (*window_move_to_mouse)(Etk_Window *window); void (*window_modal_for_window)(Etk_Window *window_to_modal, Etk_Window *window); void (*window_iconified_set)(Etk_Window *window, Etk_Bool iconified); Etk_Bool (*window_iconified_get)(Etk_Window *window); @@ -56,16 +55,21 @@ Etk_Bool (*window_skip_taskbar_hint_get)(Etk_Window *window); void (*window_skip_pager_hint_set)(Etk_Window *window, Etk_Bool skip_pager_hint); Etk_Bool (*window_skip_pager_hint_get)(Etk_Window *window); - void (*window_dnd_aware_set)(Etk_Window *window, Etk_Bool on); - Etk_Bool (*window_dnd_aware_get)(Etk_Window *window); + /*void (*window_dnd_aware_set)(Etk_Window *window, Etk_Bool on); + Etk_Bool (*window_dnd_aware_get)(Etk_Window *window);*/ void (*window_pointer_set)(Etk_Window *window, Etk_Pointer_Type pointer_type); void (*popup_window_constructor)(Etk_Popup_Window *popup_window); void (*popup_window_popup_at_xy)(Etk_Popup_Window *popup_window, int x, int y); - void (*popup_window_popup)(Etk_Popup_Window *popup_window); + //void (*popup_window_popup)(Etk_Popup_Window *popup_window); void (*popup_window_popdown)(Etk_Popup_Window *popup_window); Evas_List **(*popup_window_popped_get)(void); + /* ++ */ + void (*mouse_position_get)(int *x, int *y); + /* ++ */ + void (*mouse_screen_geometry_get)(int *x, int *y, int *w, int *h); + void (*drag_constructor)(Etk_Drag *drag); void (*drag_begin)(Etk_Drag *drag); @@ -105,8 +109,10 @@ void etk_engine_window_evas_position_get(Etk_Window *window, int *x, int *y); void etk_engine_window_screen_position_get(Etk_Window *window, int *x, int *y); void etk_engine_window_size_get(Etk_Window *window, int *w, int *h); -void etk_engine_window_center_on_window(Etk_Window *window_to_center, Etk_Window *window); -void etk_engine_window_move_to_mouse(Etk_Window *window); +/* TODO: ++*/ +void etk_engine_window_root_geometry_get(Etk_Window *window, int *x, int *y, int *w, int *h); +//void etk_engine_window_center_on_window(Etk_Window *window_to_center, Etk_Window *window); +//void etk_engine_window_move_to_mouse(Etk_Window *window); void etk_engine_window_modal_for_window(Etk_Window *window_to_modal, Etk_Window *window); void etk_engine_window_iconified_set(Etk_Window *window, Etk_Bool iconified); Etk_Bool etk_engine_window_iconified_get(Etk_Window *window); @@ -127,16 +133,19 @@ void etk_engine_window_skip_taskbar_hint_set(Etk_Window *window, Etk_Bool skip_taskbar_hint); Etk_Bool etk_engine_window_skip_taskbar_hint_get(Etk_Window *window); void etk_engine_window_skip_pager_hint_set(Etk_Window *window, Etk_Bool skip_pager_hint); -Etk_Bool etk_engine_window_skip_pager_hint_get(Etk_Window *window); +Etk_Bool etk_engine_window_skip_pager_hint_get(Etk_Window *window);/* void etk_engine_window_dnd_aware_set(Etk_Window *window, Etk_Bool on); -Etk_Bool etk_engine_window_dnd_aware_get(Etk_Window *window); +Etk_Bool etk_engine_window_dnd_aware_get(Etk_Window *window);*/ void etk_engine_window_pointer_set(Etk_Window *window, Etk_Pointer_Type pointer_type); void etk_engine_popup_window_constructor(Etk_Popup_Window *popup_window); void etk_engine_popup_window_popup_at_xy(Etk_Popup_Window *popup_window, int x, int y); -void etk_engine_popup_window_popup(Etk_Popup_Window *popup_window); +//void etk_engine_popup_window_popup(Etk_Popup_Window *popup_window); void etk_engine_popup_window_popdown(Etk_Popup_Window *popup_window); Evas_List **etk_engine_popup_window_popped_get(); + +void etk_engine_mouse_position_get(int *x, int *y); +void etk_engine_mouse_screen_geometry_get(int *x, int *y, int *w, int *h); void etk_engine_drag_constructor(Etk_Drag *drag); void etk_engine_drag_begin(Etk_Drag *drag); =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_popup_window.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- etk_popup_window.c 27 Jul 2006 01:04:52 -0000 1.6 +++ etk_popup_window.c 1 Sep 2006 06:41:17 -0000 1.7 @@ -77,7 +77,10 @@ */ void etk_popup_window_popup(Etk_Popup_Window *popup_window) { - etk_engine_popup_window_popup(popup_window); + int x, y; + + etk_engine_mouse_position_get(&x, &y); + etk_engine_popup_window_popup_at_xy(popup_window, x, y); } /** =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_utils.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- etk_utils.h 24 Aug 2006 18:09:16 -0000 1.10 +++ etk_utils.h 1 Sep 2006 06:41:17 -0000 1.11 @@ -28,7 +28,7 @@ /** Displays a warning in the output console */ #define ETK_WARNING(format, ...) \ - fprintf(stderr, "[Etk: Warning] [%s:%d - %s]: " format "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) + fprintf(stderr, "[Etk-Warning] [%s:%d - %s]: " format "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) void etk_accumulator_bool_or(void *return_value, const void *value_to_accum, void *data); =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_window.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- etk_window.c 13 Aug 2006 22:42:23 -0000 1.35 +++ etk_window.c 1 Sep 2006 06:41:17 -0000 1.36 @@ -197,9 +197,25 @@ */ void etk_window_center_on_window(Etk_Window *window_to_center, Etk_Window *window) { + int x, y, w, h; + int cw, ch; + if (!window_to_center) return; - etk_engine_window_center_on_window(window_to_center, window); + + if (window_to_center->wait_size_request) + { + window_to_center->center = ETK_TRUE; + window_to_center->center_on_window = window; + if (window) + etk_object_weak_pointer_add(ETK_OBJECT(window), (void **)(&window_to_center->center_on_window)); + } + else + { + etk_engine_mouse_screen_geometry_get(&x, &y, &w, &h); + etk_window_geometry_get(window_to_center, NULL, NULL, &cw, &ch); + etk_window_move(window_to_center, x + (w - cw) / 2, y + (h - ch) / 2); + } } /** @@ -208,15 +224,19 @@ */ void etk_window_move_to_mouse(Etk_Window *window) { + int x, y; + if (!window) return; - etk_engine_window_move_to_mouse(window); + + etk_engine_mouse_position_get(&x, &y); + etk_window_move(window, x, y); } /** * @brief Makes a window modal for another window * @param window_to_modal the window to make modal - * @param window the window on which @a window_to_modal will modal'ed on + * @param window the window on which @a window_to_modal will modal'ed on, or NULL */ void etk_window_modal_for_window(Etk_Window *window_to_modal, Etk_Window *window) { @@ -453,26 +473,6 @@ Etk_Bool etk_window_skip_pager_hint_get(Etk_Window *window) { return etk_engine_window_skip_pager_hint_get(window); -} - -/** - * @brief Sets whether the window is dnd-aware (true by default) - * @param window a window - * @param on ETK_TRUE to set the window dnd-aware, ETK_FALSE otherwise - */ -void etk_window_dnd_aware_set(Etk_Window *window, Etk_Bool on) -{ - etk_engine_window_dnd_aware_set(window, on); -} - -/** - * @brief Gets whether the window is dnd-aware - * @param window a window - * @return Returns ETK_TRUE if the window is dnd-aware, ETK_FALSE otherwise - */ -Etk_Bool etk_window_dnd_aware_get(Etk_Window *window) -{ - return etk_engine_window_dnd_aware_get(window); } /** =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_window.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- etk_window.h 28 Jul 2006 00:57:05 -0000 1.14 +++ etk_window.h 1 Sep 2006 06:41:17 -0000 1.15 @@ -87,10 +87,7 @@ void etk_window_skip_pager_hint_set(Etk_Window *window, Etk_Bool skip_pager_hint); Etk_Bool etk_window_skip_pager_hint_get(Etk_Window *window); -void etk_window_dnd_aware_set(Etk_Window *window, Etk_Bool on); -Etk_Bool etk_window_dnd_aware_get(Etk_Window *window); - - +/* Misc */ Etk_Bool etk_window_hide_on_delete(Etk_Object *window, void *data); ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs