Cleaning up Ruby-EFL

Posted at 2006-02-22

Wow. I wrote most of Ruby-EFL (that's everything but Ruby-EET :P) in summer 2004, when I knew close to nothing about Ruby's internals and its C api. It shows. I recently started writing another application with it, and noticed that you couldn't even inherit from Ecore::Evas::SoftwareX11, for example. That's because I implemented Class.new for all of the classes instead of writing a proper initialize method. Fixing that up led to some great code cleanup, and I'm very happy with the codebase now. These changes are fully backwards compatible, too.

The API has changed for Ecore::EventHandler. You now add event handlers like this:

Ecore::EventHandler.new(Ecore::SignalExitEvent) { |ev| ... }

ie you just pass the event class instead of a stupid constant :)

The next thing I poked at is the Evas::Smart API. Not sure what I was thinking when I wrote the Ruby class back then...

Now it works like this:

# Inherit from Evas::Smart
# Done :D

The name for the smart class will be generated from the class path of the Ruby class. That way you cannot customize it but I don't think anyone would want to do so anyway.

Sorry 'bout the API b0rkage, but I think you'll agree that it's mucho better now :)

Update

Whoops, I forgot to write about how it's now possible to define Ecore events in Ruby :)

It's really easy, look:

class SomethingEvent < Ecore::Event
    attr_reader :foo, :bar

    def initialize(arg1, arg2)
        super()

        @foo, @bar = arg1, arg2
    end
end

To raise that event, you'd call:

SomethingEvent.raise(arg1, arg2)

Isn't that nice? :)

Tags ,

Poking at Mesa

Posted at 2006-02-12

Some weeks ago I started playing Neverwinter Nights, to put my shiny new r300 graphics card to some use.

NWN is working quite well with the r300 DRI driver, but it used to crash on me in some scenes, without any error message.

aet, one of the authors of the free r300 driver told me NWN would reopen stderr to /dev/null, which kinda explained why I didn't see any error message :)

Should anyone else want to track down bugs in Mesa with NWN, I prepared a tarball with a LD_PRELOAD'able library that can be used to stop NWN from that retarded behaviour.

aet has got a fix for that NWN crash, I guess it will hit CVS soon :) Here's the bugzilla entry for the bug.

It's also noteworthy that I also fixed my first real bug in Mesa yesterday, which was noticed while trying to investigate the NWN crash \o/ Now that I have looked at Mesa/OpenGL driver code for some days, it doesn't look as scary as it used to :)

Update

Fixed the URL for nwn-fix_stderr.tar.gz.

Tags , ,