Package: gtk

Accessor gtk:widget-opacity

Lambda List

gtk:widget-opacity (object)

Syntax

(gtk:widget-opacity object) => opacity
(setf (gtk:widget-opacity object) opacity)

Arguments

object -- a gtk:widget object
opacity -- a double float for the opacity of the widget

Details

Accessor of the opacity slot of the gtk:widget class. The gtk:widget-opacity function fetches the requested opacity for the widget. The (setf gtk:widget-opacity) function request the widget to be rendered partially transparent, with opacity 0.0 being fully transparent and 1.0 fully opaque.

Opacity works on both toplevel widgets and child widgets, although there are some limitations. For toplevel widgets, applying opacity depends on the capabilities of the windowing system. On X11, this has any effect only on X displays with a compositing manager, see the gdk:display-is-composited function. On Windows and Wayland it should always work, although setting an opacity after the window has been shown may cause some flicker.

Note that the opacity is inherited through inclusion. If you set a toplevel widget to be partially translucent, all of its content will appear translucent, since it is ultimatively rendered on that toplevel widget. The opacity value itself is not inherited by child widgets, since that would make widgets deeper in the hierarchy progressively more translucent. As a consequence, gtk:popover and other gtk:native widgets with their own surface will use their own opacity value, and thus by default appear non-translucent, even if they are attached to a toplevel widget that is translucent.
 

See also

2025-2-13