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.c ecore_x_private.h ecore_x_window_prop.c Log Message: Add support for the proposed _NET_WM_WINDOW_OPACITY window manager hint. At the moment does nothing useful unless you're running kdrive with a specially patched version of Metacity ... but I just felt like putting it in there anyways for later. A little bit of the upcoming selections code leaked in with one of the files in this commit. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- Ecore_X.h 3 Jan 2004 03:24:37 -0000 1.19 +++ Ecore_X.h 6 Jan 2004 03:42:05 -0000 1.20 @@ -640,10 +640,11 @@ void ecore_x_window_prop_window_type_splash_set(Ecore_X_Window win); void ecore_x_window_prop_window_type_dialog_set(Ecore_X_Window win); void ecore_x_window_prop_window_type_normal_set(Ecore_X_Window win); +void ecore_x_window_prop_window_opacity_set(Ecore_X_Window win, int opacity); +int ecore_x_window_prop_window_opacity_get(Ecore_X_Window win); void ecore_x_window_prop_state_set(Ecore_X_Window win, Ecore_X_Window_State s); int ecore_x_window_prop_state_isset(Ecore_X_Window win, Ecore_X_Window_State s); void ecore_x_window_prop_state_unset(Ecore_X_Window win, Ecore_X_Window_State s); - void ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask); Ecore_X_Pixmap ecore_x_pixmap_new(Ecore_X_Window win, int w, int h, int dep); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- ecore_x.c 3 Jan 2004 03:24:37 -0000 1.19 +++ ecore_x.c 6 Jan 2004 03:42:05 -0000 1.20 @@ -100,6 +100,8 @@ Atom _ecore_x_atom_net_wm_state_above = 0; Atom _ecore_x_atom_net_wm_state_below = 0; +Atom _ecore_x_atom_net_wm_window_opacity = 0; + Atom _ecore_x_atom_file_name = 0; Atom _ecore_x_atom_string = 0; Atom _ecore_x_atom_text = 0; @@ -353,6 +355,7 @@ _ecore_x_atom_net_wm_state_fullscreen = XInternAtom(_ecore_x_disp, "_NET_WM_STATE_FULLSCREEN", False); _ecore_x_atom_net_wm_state_above = XInternAtom(_ecore_x_disp, "_NET_WM_STATE_ABOVE", False); _ecore_x_atom_net_wm_state_below = XInternAtom(_ecore_x_disp, "_NET_WM_STATE_BELOW", False); + _ecore_x_atom_net_wm_window_opacity = XInternAtom(_ecore_x_disp, "_NET_WM_WINDOW_OPACITY", False); _ecore_x_atom_utf8_string = XInternAtom(_ecore_x_disp, "UTF8_STRING", False); _ecore_x_atom_file_name = XInternAtom(_ecore_x_disp, "FILE_NAME", False); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_private.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ecore_x_private.h 25 Nov 2003 06:10:18 -0000 1.12 +++ ecore_x_private.h 6 Jan 2004 03:42:05 -0000 1.13 @@ -34,6 +34,16 @@ void *data; }; +typedef struct _Ecore_X_Selection_Data Ecore_X_Selection_Data; + +struct _Ecore_X_Selection_Data +{ + Window win; + Atom selection; + char *data; + int length; +}; + typedef enum _Ecore_X_WM_Protocol { /** * If enabled the window manager will be asked to send a @@ -95,6 +105,8 @@ extern Atom _ecore_x_atom_net_wm_window_type_splash; extern Atom _ecore_x_atom_net_wm_window_type_dialog; extern Atom _ecore_x_atom_net_wm_window_type_normal; + +extern Atom _ecore_x_atom_net_wm_window_opacity; extern Atom _ecore_x_atom_net_wm_state_modal; extern Atom _ecore_x_atom_net_wm_state_sticky; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- ecore_x_window_prop.c 3 Nov 2003 01:19:48 -0000 1.17 +++ ecore_x_window_prop.c 6 Jan 2004 03:42:05 -0000 1.18 @@ -1080,3 +1080,50 @@ ecore_x_window_prop_window_type_set(win, _ecore_x_atom_net_wm_window_type_normal); } +/** + * Set the requested opacity of the window + * @param win The window whose opacity will be set + * @param opacity The opacity value to be applied to the window + * + * This only has an effect if the Composite extension is present and + * a compositing manager is running. This hint is still pending approval + * as part of the EWMH specification. The value supplied should be an + * integer between 0 and 100, with 100 representing full opacity. + * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> + */ +void ecore_x_window_prop_window_opacity_set(Ecore_X_Window win, int opacity) +{ + unsigned long o_val; + + o_val = (unsigned long) opacity / 100UL * 0xffffffff; + ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_window_opacity, + XA_CARDINAL, 32, &o_val, 1); +} + +/** + * Get the current opacity value of the window + * @param win The window whose opacity is being requested + * @return An int between 0 and 100 representing the window's opacity value, + * or -1 if the property is not found. + * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> + */ +int ecore_x_window_prop_window_opacity_get(Ecore_X_Window win) +{ + unsigned char *data = NULL; + unsigned long tmp; + int ret_val = -1; + int num; + + if(ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_window_opacity, + XA_CARDINAL, 32, &data, &num)) + { + if (data && num) + { + tmp = *(unsigned long *) data; + ret_val = (int) (tmp / 0xffffffff * 100UL); + } + } + + return ret_val; +} + ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs