June 16th, 2007 @ 22:04

As part of a still unpublished (or unadvertised, whatever) project, I was looking for how to do a simple window on top of the screen that would not steal focus but would still be able to receive keyboard events. Furthermore I was also looking for how to easily make this window partly transparent. It’s just all simple code-wise, but when you have no clue on how to do it, it’s not that easy.

I learnt that popup windows aren’t stealing focus, that I could grab the keyboard only (but that I can not grab it while a key is pressed because there is already another active grab then), and that using Composite extension was just about setting the right colormap and using Cairo to draw on the window surface by hooking in the expose events.

Sadly I also learnt that it wasn’t currently possible to draw transparent widgets since they own their region so that what’s under it (in the same window) can not be used for compositing (which results into an awful dark background behind the widget). The only workaround I found was drawing the widget on its own Cairo surface and draw that surface at the right place after painting the window background.

drawing sample - thumbnail

I have included the full sample code featuring all this but the workaround for transparent widgets.

Read the rest of this entry »

June 16th, 2007 @ 01:56

I’ve just spent half of my evening packaging gtksourceview2 and it’s python bindings for Feisty.
gtksourceview2 is full of good promises with a much better and smarter highlighting engine. The gnomeprint dependancy has been dropped which basically means that it will be possible to use it on windows without too much harm (compiling gtksourceview1 on windows was a real hassle). You can read more about it at Tainted Words.

Preview :
gtksourceview2 in action

After fighting a bit with the 1.90 release, I eventually packaged current svn, since the 1.90 python module wouldn’t import.
Both packages and sources can be found at http://guillaume.segu.in/code/debs/.

Once installed, checkout the python test file and run it :)

June 15th, 2007 @ 22:10

I’ve been a huge fan of the Screenshot with Style GIMP script for a while. The result always looks cool and pretty. Nevertheless, opening the gimp, resizing the picture, finding the script through menus and applying it takes a while (at least a minute or two).
Consequently, I had a bit of fun with Cairo today, and wrote a simple but nice python script that does almost the same in a single command :)
It’s not as pretty as with the GIMP, but it’s good enough for now (I could probably improve it, but I’m a bit lazy)

Quick example (using the screenshot from the previous article) :
screenshot-beautifier sample

If you fancy trying it, just grab the code from git :)
$ git clone http://guillaume.segu.in/code/screenshot-beautifier.git/
$ cd screenshot-beautifier
$ python beautifier.py [source file] [result file]

Have fun :)

June 13th, 2007 @ 01:29

Meh, I’ve been way too busy these days with school. Happily I should be mostly done with this year in a bit more than 40 hours among which 7 hours of examinations.

Anyway, I was able to pack together a simple but nice shader editor. It currently only supports fragment programs, but it works well. It’s built around pygtkglext and python-opengl, and makes use of ctypes to bind all the fragment programs related functions. Supporting vertex programs shouldn’t be too hard, actually most of what’s needed for it is already in place, it just needs some GUIfication.
All the required dependencies are in Gutsy’s Universe (pygtkglext wasn’t in Feisty’s).

Here’s a screenshot (click on the thumbnail to view the full resolution picture) :
gShaderEdit Preview

Fresh-from-git source can be found at http://guillaume.segu.in/code/gshaderedit.git/ :
$ git clone http://guillaume.segu.in/code/gshaderedit.git/
$ cd gshaderedit
$ python gshaderedit.py

Should you find any bug, please report it to me by mail (you can find my address in the AUTHORS file).

May 30th, 2007 @ 19:46

As part of Summer of Code 2007, I’m going to work on color filtering through Compiz/Beryl.
The final goal of this project is to provide a flexible and efficient way to filter colors, switch through different filtering schemes or easily create custom filters.

Roadmap
June 18 : fragment program shaders test application to check the effect of a filter on an area of the screen or a picture (there’s currently no such software, only QShaderEdit which doesn’t support shaders on textures).
June 20 : filters (both test filters to see what color blind or vision impaired people actually see and corrective filters)
June 30 : working plugin using pre-defined filters
July 2 : easy switching through a customizable list of filters
July 10 : cumulative filters support
July 31 : configurator enabling user to preview the effects of a filter or a set of filters (using as much parts of the program used for testing filters) as well as making his own
August : debug, improvements, random ideas implementation, testing

Please note that this roadmap is just a kind of draft, especially since I might be still quite busy with school until June 17th (*sigh*, there are three written tests remaining, one per Saturday).

May 30th, 2007 @ 00:45

Blog : time eater.

There isn’t much to see around here at the moment, check my homepage for more infos (yes, I know, you’ll get stuck into a loop until you get bored).