Skip to content

akozumpl/lightbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

=================
Anaconda Lightbox
=================

Red Hat Author(s): Ales Kozumplik <akozumpl@redhat.com>


Lightboxes are used to bring user's attention to a modal dialog by visually
darkening everything but the dialog and blocking most of the input into areas
outside of it. This is quite straightforward to achieve on a website or with a
composing window manager which allows transparent windows. For Anaconda
(metacity) we have to workaround on the gtk/gdk level to achieve a similarly
looking result.

What Xfce is doing
==================

It creates an override_redirect gdk window over the whole sreen and sets the
darkened screenshot of the root window as the background. Then the spotlighted
dialog is displayed, but for everything to work it also needs to be
override_redirect and gets no window manager decorations. In fact the whole
window stacking just bombs and those are the only two visible windows (hm, that
is the point in fact).

Another caveat is that we have to play smart tricks with keyboard focus so the
user can not switch into another application. For that see
xfce4-session/xfce4-session/shutdown.c.

Ray's example
=============

All in all this means that the we can save ourselves a lot of hacks if we use a
Gtk window (instead of a bare Gdk window) for the objact making the shade. Note
that we have to use some kind of a window as it's hardly conceivable X would let
us paint anywhere on the screen without having an underlying X window. Creating
a Gtk window is what Ray does and is the cleanest solution for what we want to
do (besides using compositor).

What this sample provides
=========================

lb_show_over() method based on Ray's example that darkens the top-level window
passed to it by creating an overlay window. It also goes to some length to
demonstrate how this can work with introspection (safe for a memory leak
perhaps).

See lb_test.c for a C example. See lb.py for a Python example. After running
./build.sh from the root of the project, those can be tested by:

( cd src; ./lb )

and

( cd src; ./lb-run-python )

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published