[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    [PATCH] Transparency support and bugfixes
From:       Geert Jansen <g.t.jansen () stud ! tue ! nl>
Date:       1999-02-21 10:59:39
[Download RAW message or body]


            ==> Transparency support and bugfixes <==


Dear KDE developers,

  appended to this message is a patch that allows KDE programs to emulate
transparent windows in a not too resource intensive and easy way. It also
contains some bugfixes for kcmdisplay and kbgndwm.

Why?

Just for fun. Also, because there seems to be increasing demand for
attractive desktops and transparent windows can IMHO contribute to that.
Modern machines with much memory can easily handle it while it is per
default disabled to be suitable for low-end machines.

How?

The only functionality needed to emulate transparent windows is that a (KDE)
program can access a Pixmap of the desktop background. Before I came up with
the final design, I tried a couple of things, they all failed:

* The application cannot access qApp->desktop()->getBackgroundPixmap()
  because this is not set by the application (but by kbgndwm).
* You cannot bitBlt() from qApp->desktop() because this will give to icons +
  windows.
* You _could_ read the destoprc files and render the background yourself.
  I think this is extremely ugly and I didn't want to add the rendering code
  another time (it already exists three times: in kbgndwm, kcmdisplay and
  in kpager).

The thing I did is modify kbgndwm so that it exports the desktop as a .ppm
file to ~/.kde/share/apps/kbgndwm/desktop_x.ppm. I chose .ppm because Qt seems
not to handle >256 color xpms. Another approach could be to store the
backgrounds in shared memory. I didn't do this because I wanted to keep this
first patch simple and also because the QPixmap class does not let you save
to memory (loading yes, but saving, no).

Implementation:

* I changed kbgndwm to export the desktop as a pixmap. Both one desktop and
  multiple desktop modes are supported. The default for this is off. It must
  be enabled first in kcmdisplay. I also made sure that when the setting is
  off, there is absolutely no penalty for having this code in there.
* I added a member to KApplication, KApplication::getDTBackground. This keeps
  a per program copy of the background pixmap and takes care of the new
  KDEChangeBackground client message I added.
* I added the member function KPixmap::loadDTBackground. This loads the
  desktop background of a widget and can apply effects such as transparency
  and transluency to that.
* I changed kwm (1 line) so that it sends a KDEChangeBackground message to
  a window that is being transported to another desktop.
* I added a new file to kdecore, kipc.{cpp,h}. I noticed that the "send a
  KDE message" functionality was impelemented 4 times in kcmdispay, of those 
  twice in one file so I thought it was a good idea to have this in kdecore.
* I updated kcmdisplay to allow GUI configuration (one checkbox :) of the
  backgound exports.

I also fixed some bugs in kcmdisplay/kbgndwm, please see the changelogs for
that.

I attached the patches to this email: kdecore-diff and kdebase-diff. I also
added a very simple test programme, trans.cpp.


Please let me know what you think of this patch! Could it be applied to the
new development branch?

Thanks,
Geert Jansen

--
    Geert Jansen,                                email: <geertj@stack.nl>
    Phylosopher and Physicist                      PGP key ID: 0xD2B5E7CE

["kde-trans.tar.gz" (application/x-gzip)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic