Ikke's Blog

Archives for: December 2005

Dec 31
Metacity scroll-to-become-invisible

Finished my "scroll on the titlebar to change window opacity" patch today.

Because images say more than words:



(Image is link to original)

Scroll up on the title bar to make the window more opaque, scroll down to make them more transparent, in steps of 4%.
There might be some minor bugs in the code, and the code might be not-really-acceptable (breaking Metacity standards) but hey, it works :-)

You can find a complete "cvs diff" of my current local metacity-cvs-head branch here. It contains both the composite manager changes and the scroll-on-titlebar thingy.
The current composite manager will be dropped in favour of the GL-accelerated one in the spif2 branch. I still couldn't get that one working though :-(

[edit] In Bugzilla now, GNOME bug #325373.

I started working on "Planet UGent" today, just for fun, which should aggregate everyone who is somehow related to UGent: students, teaching staff,...
Templates taken from Planet Gnome and altered thanks to Peter and RealNitro. Still a lot of design work (top banner, CSS) to do though. And obviously, we need more feeds :-)

Dec 28
More composite

In the end I decided to try the patched metacity using the binary nvidia drivers, and I must confess, it works great. Some things (like alt-tab) seem to be broken, but transparency works without any speed issue.

While I was in that second X instance, I decided to give luminocity another try too and guess what... It was working great! I attempted to make a little movie of it with my DSC. The quality is very bad, but you should be able to get an idea of what we might get one day (optional, of course ;-))

Please don't leech the movie too much, it's 23MB... You can find it here (thanks to Zeus for the hosting ;-))

Dec 28
RhythmBox bubbles

A Zeus member (the Gaim Guifications author) complained about the bubbles RhythmBox pops up when a new track starts.
As I'm always willing to help others (right :roll:) I made a little patch to make this behaviour optional.

It's small, ugly and untested, so use with care ;-) Against current RB CVS from cvs.gnome.org. Patch
You got to pass "--disable-bubbles" to ./configure, they're enabled by default.

Alver, let me know whether it works please so I can fix it if necessary :-)

Dec 28
Robin

As seen on #gnome-nl: Robin. Check it out! You do need a Mozilla-based browser (like Firefox) to use this.

Dec 28
Metacity and Xcomposite

I've been playing around a little more with Metacity and XComposite/XRender. I applied the patches from bugs #309152 and #310080 to current Metacity CVS-HEAD, fixed some things which broke the build, and replaced the running instance with the newly compiled one.

Here's the result:


(Image is link to full-size screenshot)

Some things to notice:

  • The terminal in the upper left corner is the one I used to replace the running metacity. It looks like there are some problems taking control of existing windows: I was unable to use the old terminal any longer... It became usable again once I killed the new metacity and the system one took control
  • The terminal in the center of the screen is made transparent using transset. Transset'ing a window removes the drop shadows :-(
  • My sticky notes transparency is working fine! Notes can be moved and resized fine.
  • The "Metacity compositing example" dialog box is generated using zenity. It's broken as I was dragging around the window whilst the screenshot was made, to give an example of how windows become transparent when moving them around.
  • I made my desktop background light to make the window drop shadows more apparent.

Overall all this eye candy is still fairly slow. I'm on an NVidia Geforce2 MX440 GPU, using the open-source drivers. I *think* the binary ones support XComposite, but I won't try it as the binary drivers don't allow me to run 1400x1050. If someone got a spare Ati 92xx GPU around, let me know, I'm looking for one (paid if necessary B-)).

There's still a lot of work to do, but I hope one day we'll get there :-)

If you want to play around with this stuff yourself, get today's metacity cvs head from cvs.gnome.org, and apply this patch. ./configure using "--enable-compositor --enable-render" with --prefix to some directory, make && make install, and run "${prefix}/bin/metacity --replace"

[edit]
Thanks to some xorg.conf tuning (ModeLine) I got the nvidia binary drivers working on the resolution I want them to, so I'm running a GPU accelerated desktop now. Composite is working great... I backported my patch to metacity 2.12.2 and am running the patched version on my whole system now. See Gnome bug #309152 if you want the patch.

Next tasks:

  • allow the user to set window transparency in the window menu, or by using the scrollwheel on the title bar
  • Make drop shadows configurable (both on/off, size, intensity)
  • Make the (ugly!) minimize effect optional
  • Try to enhance the (ugly!) alt-tab behaviour
Dec 26
Stickynotes alpha

As per bug #150493:


This is "true" transparency using XComposite, not blending with the background or a screenshot.

It's fairly buggy, but that's caused by xcompmgr and Metacity's ignorance of Compositing (I think):

  • When xcompmgr is running and you create a new note, it's not transparent although xprop says _NET_WM_WINDOW_OPACITY is set to a correct value. Restarting xcompmgr makes new notes transparent
  • Text of notes can't be changed
  • Notes can't be resized or moved

The "Delete" and "Sticky" buttons work fine though. Really strange.

Metacity really needs a built-in compositing manager, like XFWM's.

Dec 23
Crosswords

Only 67% :-( Guess I'm too young to know about those k* tools ;-) Some questions are a little Debian-specific too, but hey :-)

Ikke • LifePermalink 5 comments
Dec 23
GtkSpell language

I'm sorry Gnome-NL guys, but I must confess I'm running my desktop using the "C" locale (ie. english). There's one major problem with this: when I'm using Gaim with spell checking enabled, I'm always "wrong" as 99% of all time I talk to IM buddies, it's in dutch (nl_BE, or something close to that at least ;-)).
A very annoying issue that could be solved by disabling spell checking (*sigh*), which I don't want (hey, one has to *fix* problems, not go around them).

So I made this little patch (very simple, low profile patch, I know). It's against gtkspell 2.0.11, and as gtkspell seems to be no longer maintained, this is the version you got on your system most propably too.

To set a language to use for (gtkspell based) spell checking, just set the GTKSPELL_LANG environment variable, like this:
echo "export GTKSPELL_LANG=nl >> ~/.profile"
Then log out and log in again so the variable is incorporated in your environment.

Enjoy!

Dec 20
less and HTML

I didn't know about this before:

(that's "less index.html" in the lower terminal)

Cool! The image isn't fake, just try it for yourself.

Ikke • LinuxPermalink 3 comments
Dec 18
Gaim CVS and Bonjour using Avahi

So you want to play around with Gaim 2.0beta1 or CVS, you definately want the Bonjour/RendezVous protocol plugin to be able to IM with your buddies on your local LAN, but you haven't got Howl on your system as you believe Avahi is the way to go (good boy :-))?

Just apply this little patch. It's against current anoncvs from sf.net. You need to build avahi with avahi-compat-howl support.

Dec 16
GTK+ and Cairo is fun!

I've been playing with creating GTK+ widgets using Cairo lately. As I had to write some text for some bloody Word-task (university stuff) I started writing a widget for an "OXO" game, and make a little tutorial on how to make something alike. The task is done (I even had to remove some parts of the text :(), the tutorial isn't finished yet as there are some issues left with the widget.

Anyway, writing 2D drawing code using Cairo is really fun. Sometimes you need some maths to get some tasks done, but it's fun to experiment and the possibilities are almost endless.

Here's a little sample of what I got now, click on the image for a full-scale screenshot:

Some parts of the "logics" inside the widget are still buggy (-> the code to check whether a move is a winning one or not).

I start to get rid of the spammers on my blog. There's still some comment- and trackback-spam, but at least most spambots can't leech several gigabytes of my bandwith anymore. There are still requests done, but they get a 300byte answer, or even less.
One issue left: if I get 2 identical requests (same HTTP_REQUEST, HTTP_REFERER etc), one using HTTP/1.0 and one using HTTP/1.1, my mod_rewrite rules generate another response: 403 (5 bytes) when using HTTP/1.0, 301 (352 bytes) when using HTTP/1.1:

216.195.35.XX - - [16/Dec/2005:14:24:58 +0100] "GET /index.php/all?skin=stockholm HTTP/1.1" 403 5 "http://spamhost/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
216.195.35.XX - - [16/Dec/2005:14:25:05 +0100] "GET /index.php/all?skin=stockholm HTTP/1.1" 301 352 "http://spamhost/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"

Can anyone explain me what causes this?

Thanks to RubenV who helped me out when creating the mod_rewrite rules :)

Dec 13
Linus and Gnome

Sigh. Luckily we got Nat ;-)
I still got my lockups on high IO load, or my mouse starting to go all over the screen and generating random clicks while doing so on high load, after which I get warnings in dmesg the psmouse driver lost ticks. Guess what part of my machine's stack causes that B-)

Dec 13
Some great news

Although I'm not a big Ubuntu lover, this is most certainly a good thing.
Who doesn't know the "Metro"? :-)

[edit] Looks like Peter saw it too ;-)

Ikke • LinuxPermalink 4 comments
Dec 3
More valgrind abuse

After my previous article on Valgrind I started using it more and more, and discovered another nice feature of it. Just check this sample:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#define MESSAGE "test"

int main(int argc, char *argv[]) {
        char *t = NULL;

        /* Hey, everyone makes mistakes */
        t = (char *)malloc(strlen("" MESSAGE) * sizeof(char));
        assert(t != NULL);
        strcpy(t, "" MESSAGE);

        printf("%s\n", t);

        free(t);

        return 0;
}

Compiling and running looks ok:

$ gcc -g -Wall -Werror -o test2 test2.c
$ ./test2
test

But luckily there's Valgrind to tell us the code is horribly wrong:

$ valgrind --tool=memcheck ./test2
==13483== Memcheck, a memory error detector for x86-linux.
==13483== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
==13483== Using valgrind-2.2.0, a program supervision framework for x86-linux.
==13483== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==13483== For more details, rerun with: -v
==13483==
==13483== Invalid write of size 1
==13483==    at 0x1B906485: strcpy (mac_replace_strmem.c:199)
==13483==    by 0x80484B2: main (test2.c:14)
==13483==  Address 0x1BA5C02C is 0 bytes after a block of size 4 alloc'd
==13483==    at 0x1B906B82: malloc (vg_replace_malloc.c:131)
==13483==    by 0x8048472: main (test2.c:12)
==13483==
==13483== Invalid read of size 1
==13483==    at 0x1B968B6B: _IO_vfprintf (in /lib/tls/libc-2.3.5.so)
==13483==    by 0x1B96DF36: _IO_printf (in /lib/tls/libc-2.3.5.so)
==13483==    by 0x1B93DF36: __libc_start_main (in /lib/tls/libc-2.3.5.so)
==13483==  Address 0x1BA5C02C is 0 bytes after a block of size 4 alloc'd
==13483==    at 0x1B906B82: malloc (vg_replace_malloc.c:131)
==13483==    by 0x8048472: main (test2.c:12)
test
==13483==
==13483== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 13 from 1)
==13483== malloc/free: in use at exit: 0 bytes in 0 blocks.
==13483== malloc/free: 1 allocs, 1 frees, 4 bytes allocated.
==13483== For a detailed leak analysis,  rerun with: --leak-check=yes
==13483== For counts of detected errors, rerun with: -v

This should be fairly self-explaining... I guess most C programmers forgot to allocate strlen(msg)+1 (the end '\0') at least once in their life...

By the way: hello Planet Grep :-)

Dec 2
gotroot.com mod_security rules update script

Lately I've been working on the new webserver machine for VTK. Today I configured mod_security for Apache2, partially by using the rules one can find on gotroot.com.
On the site a little script is provided to update the rules automagicly (in a cronjob or something alike), but when I started using the script I didn't like it for several reasons.
So I decided to rewrite it to suit my needs. You can find my enhanced version here.

The machine now also runs PHP4 and PHP5 side by side thanks to this great documentation (and the Gentoo PHP herd developers, obviously). PHP4 as an Apache module (because this is the "default", so it must run as efficient as possible), PHP5 using the CGI interface for all .php5 files.
We can't make "the big switch" to a PHP5-only server due to our bloody PhpBB forum which is not PHP5 compatible. And as our forum is one of the biggest PHP consumers on the server, I don't want to run PHP4 as CGI and only run the forum this way.

[edit]
I enhanced the script a little more, here's a diff:

--- update_mod_security_rules.sh        2005-12-02 14:46:02.000000000 +0100
+++ update_rules_v2.sh  2005-12-04 14:34:33.000000000 +0100
@@ -15,6 +15,7 @@
 APACHESTART="/etc/init.d/apache2 restart"
 MODSECPATH="/etc/modsecurity"
 APACHEPID="/var/run/apache2.pid"
+APACHECTL="/usr/sbin/apache2ctl"

 #Modules
 #If you want the "exclude" rules, they should be the first entry in the list
@@ -59,10 +60,21 @@

 echo "Make sure you got \"Include ${MODSECPATH}/all.conf\" somewhere in your Apache config"

+${APACHECTL} configtest > /dev/null 2>&1
+if [ ! "x$?" = "x0" ]; then
+        echo
+        echo "There's something wrong in Apache's configuration:"
+        echo
+        ${APACHECTL} configtest
+        echo
+        echo "Exiting, not restarting Apache"
+        exit 1
+fi
+
 # try restart
 if [ "$UPDATED" -gt "0" ]; then
         echo -n "Restarting apache: "
-        /bin/kill -HUP ${PID} 2>/dev/null
+        ${APACHECTL} graceful
         # did it work?
         if `/bin/kill -CHLD ${PID} >/dev/null 2>&1`; then
                 echo "ok."

The script

Categories

Who's Online?

  • Guest Users: 470

Misc

XML Feeds

What is RSS?