client opacity hint handling in x - fix handling to do 0-ffffffff right

e was not properly handling the opacity hint in its 0-0xffffffff
range. in one case it converted e's color value to this range but just
with << 24 which is wrong as it then ignors the next 24 lower value
bits, so it should fill the next 3 bytes with repeats of the same
value to do this right, but far worse is on READING the value it just
used the value as-is as if it were a 0-ff (0-255) alpha value that we
use in evas and didnt "thunk it down" with val >> 24. this resulted in
renoise menus being blank as renoise set the opacity value on its
menu windows and e happily made them transparent thanks to this.

this fixes that.

not to peolpe fro the above. bitshifting DOWN is ok, but bitshifting
UP leaves the lower bits all 0 and you should fill this range with
repetitions of the value to properly scale in integert space with
bitshifts. :)

@fix
This commit is contained in:
Carsten Haitzler 2018-06-02 16:27:35 +09:00
parent 8ee7cf979f
commit f345721897
1 changed files with 3 additions and 3 deletions

View File

@ -810,7 +810,7 @@ _e_comp_x_post_client_idler_cb(void *d EINA_UNUSED)
evas_object_color_get(ec->frame, NULL, NULL, NULL, &op);
ec->netwm.opacity = op;
opacity = (op << 24);
opacity = (op << 24) | (op << 16) | (op << 8) | op;
ecore_x_window_prop_card32_set(e_client_util_win_get(ec), ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, &opacity, 1);
/* flag gets unset in property cb to avoid fetching opacity after we just set it */
}
@ -4059,11 +4059,11 @@ _e_comp_x_hook_client_fetch(void *d EINA_UNUSED, E_Client *ec)
if (ecore_x_netwm_opacity_get(win, &val))
{
val >>= 24;
if (ec->netwm.opacity != val)
{
ec->netwm.opacity = val;
evas_object_color_set(ec->frame,
ec->netwm.opacity, ec->netwm.opacity, ec->netwm.opacity, ec->netwm.opacity);
evas_object_color_set(ec->frame, val, val, val, val);
rem_change = 1;
}
ec->netwm.fetch.opacity = !ec->netwm.opacity;