Enlightenment CVS committal Author : xcomputerman Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: Ecore_X.h ecore_x_window_prop.c Log Message: Modified patch from kwo. Makes ecore_x_window_prop_withdrawn_set etc. do the right thing, provides a proper framework for the initial_state WMHint; fix a bug with client message event in prop_desktop_request() =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- Ecore_X.h 7 Feb 2004 19:37:47 -0000 1.34 +++ Ecore_X.h 15 Feb 2004 21:37:34 -0000 1.35 @@ -612,6 +612,20 @@ ECORE_X_WINDOW_INPUT_MODE_ACTIVE_GLOBAL } Ecore_X_Window_Input_Mode; +typedef enum _Ecore_X_Window_State_Hint { + /** Do not provide any state hint to the window manager */ + ECORE_X_WINDOW_STATE_HINT_NONE = -1, + + /** The window wants to remain hidden and NOT iconified */ + ECORE_X_WINDOW_STATE_HINT_WITHDRAWN, + + /** The window wants to be mapped normally */ + ECORE_X_WINDOW_STATE_HINT_NORMAL, + + /** The window wants to start in an iconified state */ + ECORE_X_WINDOW_STATE_HINT_ICONIC, +} Ecore_X_Window_State_Hint; + typedef enum _Ecore_X_Window_State { /** The window is a modal dialog box. */ ECORE_X_WINDOW_STATE_MODAL, =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- ecore_x_window_prop.c 7 Feb 2004 12:05:55 -0000 1.33 +++ ecore_x_window_prop.c 15 Feb 2004 21:37:34 -0000 1.34 @@ -680,6 +680,49 @@ } /** + * Set the initial state of an Ecore_X_Window. + * + * @param win The window whose initial state is set. + * @param withdrawn The window's new initial state. + * + * @return 1 if the input mode could be set, else 0 + * + * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> + */ +int +ecore_x_window_prop_initial_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state) +{ + XWMHints *hints; + + if (!(hints = XGetWMHints(_ecore_x_disp, win))) + if (!(hints = XAllocWMHints())) + return 0; + + switch (state) { + case ECORE_X_WINDOW_STATE_HINT_NONE: + hints->flags &= ~StateHint; + break; + case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN: + hints->initial_state = WithdrawnState; + hints->flags |= StateHint; + break; + case ECORE_X_WINDOW_STATE_HINT_NORMAL: + hints->initial_state = NormalState; + hints->flags |= StateHint; + break; + case ECORE_X_WINDOW_STATE_HINT_ICONIC: + hints->initial_state = IconicState; + hints->flags |= StateHint; + break; + } + + XSetWMHints(_ecore_x_disp, win, hints); + XFree(hints); + + return 1; +} + +/** * To be documented. * * FIXME: To be fixed. @@ -751,6 +794,7 @@ void ecore_x_window_prop_withdrawn_set(Ecore_X_Window win, int withdrawn) { +#if 0 XWMHints hints; long ret; @@ -765,6 +809,12 @@ hints.flags = WindowGroupHint | StateHint; XSetWMHints(_ecore_x_disp, win, &hints); XSetWMNormalHints(_ecore_x_disp, win, (XSizeHints *) &hints); +#else + if (withdrawn) + ecore_x_window_prop_initial_state_set(win, ECORE_X_WINDOW_STATE_HINT_WITHDRAWN); + else + ecore_x_window_prop_initial_state_set(win, ECORE_X_WINDOW_STATE_HINT_NONE); +#endif } /** @@ -778,23 +828,18 @@ void ecore_x_window_prop_desktop_request(Ecore_X_Window win, long desktop) { - XEvent *xev; - XClientMessageEvent xclient; + XEvent xev; - xev = calloc(1, sizeof(XClientMessageEvent)); - xev->xclient = xclient; - memset(&xclient, 0, sizeof(XClientMessageEvent)); - - xclient.type = ClientMessage; - xclient.display = _ecore_x_disp; - xclient.window = win; - xclient.message_type = _ecore_x_atom_net_wm_desktop; - xclient.format = 32; - xclient.data.l[0] = desktop; + memset(&xev, 0, sizeof(XEvent)); - XSendEvent(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), False, 0, xev); - XFree(xev); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = _ecore_x_atom_net_wm_desktop; + xev.xclient.format = 32; + xev.xclient.data.l[0] = desktop; + XSendEvent(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), False, 0, &xev); } /** @@ -809,26 +854,20 @@ void ecore_x_window_prop_state_request(Ecore_X_Window win, Ecore_X_Window_State state, int action) { - XEvent *xev; - XClientMessageEvent xclient; + XEvent xev; if (action < 0 || action > 2) return; - xev = calloc(1, sizeof(XClientMessageEvent)); - xev->xclient = xclient; - memset(&xclient, 0, sizeof(XClientMessageEvent)); - - xclient.type = ClientMessage; - xclient.display = _ecore_x_disp; - xclient.window = win; - xclient.message_type = _ecore_x_atom_net_wm_state; - xclient.format = 32; - xclient.data.l[0] = action; - xclient.data.l[1] = _ecore_x_window_prop_state_atom_get(state); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = _ecore_x_atom_net_wm_state; + xev.xclient.format = 32; + xev.xclient.data.l[0] = action; + xev.xclient.data.l[1] = _ecore_x_window_prop_state_atom_get(state); - XSendEvent(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), False, 0, xev); - XFree(xev); + XSendEvent(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), False, 0, &xev); } @@ -873,18 +912,6 @@ } -/* - * Suggesting a slight change of API. - * The ECORE_X_WINDOW_TYPE_...'s I think we want in Ecore_X.h anyway. - * It makes things more similar to ecore_x_window_prop_state_set(). - * It also avoids having to define all the different - * ecore_x_window_prop_window_type_..._set()'s. - * Setting a window to type desktop would then become - * ecore_x_window_prop_window_type_set(win, ECORE_X_WINDOW_TYPE_DESKTOP); - * /Kim - * Addendum: API change enforced by xcomp - */ - static Ecore_X_Atom _ecore_x_window_prop_type_atom_get(Ecore_X_Window_Type type) { ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs