Thanks to Brett Nash for pointing out that this integer division will

not work.


SVN revision: 8282
This commit is contained in:
xcomputerman 2004-01-06 16:45:31 +00:00 committed by xcomputerman
parent e348e59778
commit eacc3bcc49
1 changed files with 6 additions and 4 deletions

View File

@ -1094,8 +1094,10 @@ 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) void ecore_x_window_prop_window_opacity_set(Ecore_X_Window win, int opacity)
{ {
unsigned long o_val; unsigned long o_val;
double tmp;
o_val = (unsigned long) opacity / 100UL * 0xffffffff; tmp = (double) opacity/100. * 4294967295.;
o_val = (unsigned long) tmp;
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_window_opacity, ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_window_opacity,
XA_CARDINAL, 32, &o_val, 1); XA_CARDINAL, 32, &o_val, 1);
} }
@ -1110,7 +1112,7 @@ 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) int ecore_x_window_prop_window_opacity_get(Ecore_X_Window win)
{ {
unsigned char *data = NULL; unsigned char *data = NULL;
unsigned long tmp; unsigned long lval;
int ret_val = -1; int ret_val = -1;
int num; int num;
@ -1119,8 +1121,8 @@ int ecore_x_window_prop_window_opacity_get(Ecore_X_Window win)
{ {
if (data && num) if (data && num)
{ {
tmp = *(unsigned long *) data; lval = *(unsigned long *) data;
ret_val = (int) (tmp / 0xffffffff * 100UL); ret_val = (int) ((double) lval / 4294967295. * 100.);
} }
} }