Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_window.c ewl_window.h ewl_enums.h ewl_engines.h ewl_engines.c Log Message: add ewl_window_leader_set, a function to the window group and the client leader =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_window.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -3 -r1.79 -r1.80 --- ewl_window.c 2 Apr 2007 19:35:11 -0000 1.79 +++ ewl_window.c 18 May 2007 21:24:35 -0000 1.80 @@ -511,6 +511,7 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } + /** * @param win: window to set transient * @param forwin: the window to be transient for @@ -545,7 +546,7 @@ else ewl_callback_append(EWL_WIDGET(forwin), EWL_CALLBACK_REALIZE, - ewl_window_cb_realize_transient, + ewl_window_cb_realize_parent, win); } @@ -576,6 +577,124 @@ } /** + * @param win: window to set leader for + * @param leader: the window that is the leader of the window group + * @return Returns no value. + * @brief Sets the window to be client window of the leader + */ +void +ewl_window_leader_set(Ewl_Window *win, Ewl_Window *leader) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("win", win); + DCHECK_TYPE("win", win, EWL_WINDOW_TYPE); + + win->leader.ewl = leader; + win->flags &= ~EWL_WINDOW_LEADER_FOREIGN; + + /* if there is no leader remove the leader for state + * and update the window, if it already exists */ + if (!leader) { + win->flags &= ~EWL_WINDOW_LEADER; + if (win->window) { + ewl_engine_window_leader_set(win); + ewl_engine_window_hints_set(win); + } + + DRETURN(DLEVEL_STABLE); + } + + win->flags |= EWL_WINDOW_LEADER; + + if (win->window) { + if (leader->window) { + ewl_engine_window_leader_set(win); + ewl_engine_window_hints_set(win); + } + else + ewl_callback_append(EWL_WIDGET(leader), + EWL_CALLBACK_REALIZE, + ewl_window_cb_realize_parent, + win); + } + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param win: window to set leader for + * @param leader: the window that is the leader of the window group + * @return Returns no value. + * @brief Sets the window to be client window of the leader + */ +void +ewl_window_leader_foreign_set(Ewl_Window *win, Ewl_Embed_Window *leader) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("win", win); + DCHECK_TYPE("win", win, EWL_WINDOW_TYPE); + + win->leader.foreign = leader; + win->flags &= ~EWL_WINDOW_LEADER; + + /* if there is no leader remove the leader for state + * and update the window, if it already exists */ + if (!leader) + win->flags &= ~EWL_WINDOW_LEADER_FOREIGN; + else + win->flags |= EWL_WINDOW_LEADER_FOREIGN; + + if (win->window) { + ewl_engine_window_leader_set(win); + ewl_engine_window_hints_set(win); + } + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param win: window to get leader for + * @return leader of the window or NULL + * @brief Gets the leader of this window + * + * Note: this function returns even NULL if the leader + * is a foreign window + */ +Ewl_Window * +ewl_window_leader_get(Ewl_Window *win) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("win", win, NULL); + DCHECK_TYPE_RET("win", win, EWL_WINDOW_TYPE, NULL); + + if (win->flags & EWL_WINDOW_LEADER) + DRETURN_PTR(win->leader.ewl, DLEVEL_STABLE); + + DRETURN_PTR(NULL, DLEVEL_STABLE); +} + +/** + * @param win: window to get leader for + * @return Returns the leader of this window or NULL + * @brief Gets the leader of this window + * + * Note: this function returns even NULL if the leader + * is a ewl window + */ +Ewl_Embed_Window * +ewl_window_leader_foreign_get(Ewl_Window *win) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("win", win, NULL); + DCHECK_TYPE_RET("win", win, EWL_WINDOW_TYPE, NULL); + + if (win->flags & EWL_WINDOW_LEADER_FOREIGN) + DRETURN_PTR(win->leader.foreign, DLEVEL_STABLE); + + DRETURN_PTR(NULL, DLEVEL_STABLE); +} + +/** * @param win: The window to work with * @return Returns a boolean indicating if the window is modal. * @brief Gets the boolean flag indicating if @a win is modal @@ -795,6 +914,8 @@ ewl_engine_window_borderless_set(window); ewl_engine_window_dialog_set(window); ewl_engine_window_states_set(window); + ewl_engine_window_hints_set(window); + ewl_engine_window_leader_set(window); width = ewl_object_maximum_w_get(EWL_OBJECT(window)); height = ewl_object_maximum_h_get(EWL_OBJECT(window)); @@ -848,8 +969,8 @@ * @brief The realize transient callback */ void -ewl_window_cb_realize_transient(Ewl_Widget *w, void *ev_data __UNUSED__, - void *user_data) +ewl_window_cb_realize_parent(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data) { Ewl_Window *win; @@ -861,16 +982,22 @@ win = EWL_WINDOW(user_data); /* - * Make sure the window is still transient for the realized window. + * Is the window transient for the realized window. */ if (EWL_WIDGET(win->transient.ewl) == w) ewl_window_transient_for(win, EWL_WINDOW(w)); /* + * Is the window a client of the realized leader window. + */ + if (EWL_WIDGET(win->leader.ewl) == w) + ewl_window_leader_set(win, EWL_WINDOW(w)); + + /* * Both windows realized so no need to keep the callback. */ ewl_callback_del(EWL_WIDGET(win), EWL_CALLBACK_REALIZE, - ewl_window_cb_realize_transient); + ewl_window_cb_realize_parent); DLEAVE_FUNCTION(DLEVEL_STABLE); } =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_window.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- ewl_window.h 25 Mar 2007 05:11:44 -0000 1.34 +++ ewl_window.h 18 May 2007 21:24:35 -0000 1.35 @@ -55,6 +55,10 @@ Ewl_Window *ewl; Ewl_Embed_Window *foreign; } transient; /**< Window to be transient for */ + union { + Ewl_Window *ewl; + Ewl_Embed_Window *foreign; + } leader; /**< the leader of the window group */ char *title; /**< The current title on the provided window */ char *name; /**< Current name on the provided window */ @@ -95,6 +99,11 @@ void ewl_window_transient_for(Ewl_Window *win, Ewl_Window *forwin); void ewl_window_transient_for_foreign(Ewl_Window *win, Ewl_Embed_Window *forwin); +void ewl_window_leader_set(Ewl_Window *win, Ewl_Window *leader); +void ewl_window_leader_foreign_set(Ewl_Window *win, + Ewl_Embed_Window *leader); +Ewl_Window *ewl_window_leader_get(Ewl_Window *win); +Ewl_Embed_Window *ewl_window_leader_foreign_get(Ewl_Window *win); int ewl_window_modal_get(Ewl_Window *win); void ewl_window_modal_set(Ewl_Window *win, int modal); void ewl_window_keyboard_grab_set(Ewl_Window *win, int grab); @@ -110,7 +119,7 @@ */ void ewl_window_cb_realize(Ewl_Widget *w, void *ev_data, void *user_data); void ewl_window_cb_postrealize(Ewl_Widget *w, void *ev_data, void *user_data); -void ewl_window_cb_realize_transient(Ewl_Widget *w, void *ev_data, +void ewl_window_cb_realize_parent(Ewl_Widget *w, void *ev_data, void *user_data); void ewl_window_cb_unrealize(Ewl_Widget *w, void *ev_data, void *user_data); void ewl_window_cb_show(Ewl_Widget *w, void *ev_data, void *user_data); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_enums.h,v retrieving revision 1.76 retrieving revision 1.77 diff -u -3 -r1.76 -r1.77 --- ewl_enums.h 25 Mar 2007 05:11:44 -0000 1.76 +++ ewl_enums.h 18 May 2007 21:24:35 -0000 1.77 @@ -255,9 +255,11 @@ EWL_WINDOW_MODAL = 0x80, /**< Window is modal */ EWL_WINDOW_TRANSIENT = 0x100, /**< Window is transient for */ EWL_WINDOW_TRANSIENT_FOREIGN = 0x200, /**< Window is transient for */ - EWL_WINDOW_SKIP_TASKBAR = 0x400, /**< Window skips taskbar */ - EWL_WINDOW_SKIP_PAGER = 0x800, /**< Window skips pager */ - EWL_WINDOW_DEMANDS_ATTENTION = 0x1000 /**< Window requires attention */ + EWL_WINDOW_LEADER = 0x400, /**< Window HAS a leader */ + EWL_WINDOW_LEADER_FOREIGN = 0x800, /**< Window HAS a leader */ + EWL_WINDOW_SKIP_TASKBAR = 0x1000, /**< Window skips taskbar */ + EWL_WINDOW_SKIP_PAGER = 0x2000, /**< Window skips pager */ + EWL_WINDOW_DEMANDS_ATTENTION = 0x4000 /**< Window requires attention */ }; /** =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_engines.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- ewl_engines.h 16 Mar 2007 01:54:20 -0000 1.26 +++ ewl_engines.h 18 May 2007 21:24:35 -0000 1.27 @@ -15,13 +15,15 @@ EWL_ENGINE_WINDOW_HIDE, /**< Hide the window */ EWL_ENGINE_WINDOW_TITLE_SET, /**< Set the window title */ - EWL_ENGINE_WINDOW_NAME_CLASS_SET, /**< Set the window name/class */ + EWL_ENGINE_WINDOW_NAME_CLASS_SET,/**< Set the window name/class */ - EWL_ENGINE_WINDOW_BORDERLESS_SET, /**< Set the borderless + EWL_ENGINE_WINDOW_BORDERLESS_SET,/**< Set the borderless state of the window */ EWL_ENGINE_WINDOW_DIALOG_SET, /**< Set the dialog setting of the window */ EWL_ENGINE_WINDOW_STATES_SET, /**< Set the window state flags */ - EWL_ENGINE_WINDOW_TRANSIENT_FOR, /**< Set the window transient */ + EWL_ENGINE_WINDOW_HINTS_SET, /**< Set the hints */ + EWL_ENGINE_WINDOW_TRANSIENT_FOR,/**< Set the window transient */ + EWL_ENGINE_WINDOW_LEADER_SET, /**< Set the windo to be a client */ EWL_ENGINE_WINDOW_RAISE, /**< Raise the window */ EWL_ENGINE_WINDOW_LOWER, /**< Lower the window */ @@ -176,7 +178,9 @@ void ewl_engine_window_borderless_set(Ewl_Window *win); void ewl_engine_window_dialog_set(Ewl_Window *win); void ewl_engine_window_states_set(Ewl_Window *win); +void ewl_engine_window_hints_set(Ewl_Window *win); void ewl_engine_window_transient_for(Ewl_Window *win); +void ewl_engine_window_leader_set(Ewl_Window *win); void ewl_engine_window_raise(Ewl_Window *win); void ewl_engine_window_lower(Ewl_Window *win); @@ -240,7 +244,10 @@ setting of the window */ typedef void (*Ewl_Engine_Cb_Window_Transient_For)(Ewl_Window *win); /**< Set the window transient */ -typedef void (*Ewl_Engine_Cb_Window_States_Set)(Ewl_Window *win); /**< Set the window modal */ +typedef void (*Ewl_Engine_Cb_Window_Leader_Set)(Ewl_Window *win); /**< Set the window's + leader */ +typedef void (*Ewl_Engine_Cb_Window_States_Set)(Ewl_Window *win); /**< Set the window states */ +typedef void (*Ewl_Engine_Cb_Window_Hints_Set)(Ewl_Window *win); /**< Set the window hints */ typedef void (*Ewl_Engine_Cb_Window_Raise)(Ewl_Window *win); /**< Raise the window */ typedef void (*Ewl_Engine_Cb_Window_Lower)(Ewl_Window *win); /**< Lower the window */ typedef int (*Ewl_Engine_Cb_Keyboard_Grab)(Ewl_Window *win); /**< Set the keyboard grab */ =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_engines.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -3 -r1.43 -r1.44 --- ewl_engines.c 29 Mar 2007 19:25:09 -0000 1.43 +++ ewl_engines.c 18 May 2007 21:24:35 -0000 1.44 @@ -514,6 +514,32 @@ /** * @param win: the window to work with * @return Returns no value + * @brief Sets the window hints + */ +void +ewl_engine_window_hints_set(Ewl_Window *win) +{ + Ewl_Engine_Cb_Window_Hints_Set window_hints_set; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("win", win); + DCHECK_TYPE("win", win, EWL_WINDOW_TYPE); + + if (!(win->window)) + DRETURN(DLEVEL_STABLE); + + window_hints_set = ewl_engine_hook_get(EWL_EMBED(win), + EWL_ENGINE_HOOK_TYPE_WINDOW, + EWL_ENGINE_WINDOW_HINTS_SET); + if (window_hints_set) + window_hints_set(win); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param win: the window to work with + * @return Returns no value * @brief Sets the window transient */ void @@ -533,6 +559,32 @@ EWL_ENGINE_WINDOW_TRANSIENT_FOR); if (window_transient_for) window_transient_for(win); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param win: the window to work with + * @return Returns no value + * @brief Sets a leader for the window + */ +void +ewl_engine_window_leader_set(Ewl_Window *win) +{ + Ewl_Engine_Cb_Window_Leader_Set window_leader_set; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("win", win); + DCHECK_TYPE("win", win, EWL_WINDOW_TYPE); + + if (!(win->window)) + DRETURN(DLEVEL_STABLE); + + window_leader_set = ewl_engine_hook_get(EWL_EMBED(win), + EWL_ENGINE_HOOK_TYPE_WINDOW, + EWL_ENGINE_WINDOW_LEADER_SET); + if (window_leader_set) + window_leader_set(win); DLEAVE_FUNCTION(DLEVEL_STABLE); } ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs