-->

Twitter

May 8th, 2009

I just created an account on twitter: http://twitter.com/rkennke, let’s see if it’s cool or not. Seems to be all the rage these days…

-->

Cacio on X11

May 8th, 2009

The last couple of ours I quickly hacked together a small xlib based backend for Caciocavallo. It’s only purpose is to have a real example of a working Cacio backend (so far we only had the Escher example, but I guess it’s been broken now for a long time, and it was never really easy to work with). This can be compiled and used with plain OpenJDK7.

Cacio on X11

Cacio can now actually do much more than this simple button list, but I don’t have an appropriate demo at hands, except some closed stuff that I’m not allowed to show…

Ah, and right now it’s ungodly slow, doesn’t handle any events etc. It’s just the first signs of life from this implementation.

-->

Found the missing piece of the Cacio puzzle

May 8th, 2009

The last couple of weeks, we’ve been quite stuck with Caciocavallo progress, especially with the complex components as TextArea, Choice, ScrollPane, etc. The problem was in the way the Swing components (those that back the AWT widgets) were connected into the peers. Let me explain how we used to do this.

So far, we had one specially modified Swing component for each peer. For example, the CacioButtonPeer used a subclass of JButton. In this subclass we overrode a couple of methods to make the JButton think it is actually part of some component hierarchy (remember that lightweight components cannot do anything by themselves, they need a heavyweight ancestor). For example, we needed to override getGraphics() to provide it a graphics to draw with, getParent() to make it think it has a parent etc. Those overridden method then hooked directly into the peer or the backing AWT component. getGraphics() would call getGraphics() of the peer, getParent() would return the parent of the backing AWT component, etc. As you can imagine, this can become quite aweful. In the case of button it’s still fairly easy, but for complex components it’s totally ridiculous. Stuff like ScrollPane and Choice are practically impossible to implement, or at least awefully complex. Event handling is also a pain. AWT events coming from the peer need to be forwarded somehow to the Swing component. In the case of the button it’s easy, just take the event, retarget and dispatch to the button. But for complex widgets it’s a bit more, well, complex. Since the swing component doesn’t really have a heavyweight parent, all the event handling and dispatching doesn’t quite work as usual, and events don’t get dispatched correctly down the hierarchy (complex Swing components like JComboBox actually have their own hierarchy!). And last but not least, the code is ugly, because it needs duplication all over the place. The problem boils down to the fact that the Swing components don’t have a heavyweight parent and need a lot of faking to make it think it has one.

Yesterday, after some talking with Mario and James (my still-boss) we had a light going on in our heads. What if we actually DO provide the Swing component a real heavyweight ancestor? Why not let it live inside its own Window? The idea is this: for each peer Swing component, we create a proxy Window object (a special subclass of Window, called ProxyWindow), and put in the actual Swing component as (the only) child component. Then, when creating the peer for the ProxyWindow, we don’t create the usual CacioWindowPeer, but instead a ProxyWindowPeer. This guy is then responsible for providing the ProxyWindow with things like Graphics objects and all the infrastructure it needs for serving the ProxyWindow and thus the Swing component. It does so by simply forwarding the requests to the underlying CacioComponentPeer. Event o handling is similarily easy: all events that show up in the CacioComponentPeer are now simply dispatched to the ProxyWindow, and there the usual lightweight dispatching takes place. From the point of view of the Swing component, it now lives in a real heavyweight window. No more hacks required to get anything to work, even the complex widgets now become fairly straightforward. We can use plain Swing components now, instead of custom subclasses. We don’t need to duplicate lots of code anymore (I guess I just shrinked Cacio code size by 50%).

A quick test shows that TextArea now works mostly as expected, with Scrollbars and everything. For comparison, before it took us _weeks_ (really) to get anything remotely useful with TextArea, now it took just a couple of _minutes_ (really, no kidding here!). I suppose we can show some cool stuff @JavaOne :-)

In other news, Mario implemented multihead support in Cacio, yay! But I let him blog about this himself.

Into the Sun

May 6th, 2009

I just signed the contract. Start on June, 1st. Yippie! There was a lot of magic involved in the process and I’d like to thank Andrea Simon, the nice recruiting lady who worked so hard to make this happen, Gustavo Galimberti, my future boss who called me countless times to keep me updated, Mario, Dalibor and Mark for talking and giving advice and of course everybody else who worked behind the curtains (I heard quite a lot of people were involved in this).

Hope to see you at JavaOne, our Cacio BOF is on monday, 8:30pm.

Life is quite cool

May 5th, 2009

Yes it is.

Funny sunny management

April 21st, 2009

Jonathan Schwartz: Our products and services have driven the discovery of new drugs…. (yes, I know, /. is not the best news reference, but I don’t care). In some other article I found ‘We grew up from a bunch of hippies, almost with flowers in our hair.’. Hehehe. Now, should I ask an oracle if should go with the sun or not? Of course, no pun intended.

Error of the day

April 20th, 2009

qemu: fatal: Trying to execute code outside RAM or ROM at 0×53f000ff

Yay!

The times they are a changin’ 2

April 6th, 2009

So last week I effectively resigned my job @ aicas. After exactly 4 years. It was a great time, allowed me to hack on Classpath and OpenJDK more or less fulltime. But my nomad genes tell me that it’s time to move on. I still have lots of work to finish and contractual obligations, and will work for aicas for roughly 2 more months.

So what’s happening now? For one, I’m in negotiations w/ Sun for a position in the deployment team. Which is a bit crazy given Sun’s current negotiations with IBM. I really don’t know if I’d want to work for IBM. While I think I’d like Sun’ culture, I can’t say the same for IBM. So on one hand, I’m glad the deal broke up for now. On the other hand, this will probably leave Sun even more desperate. Now I’m hoping that Red Hat steps up and buys them :-D. The two would fit much better IMO. (But I’m not sure they have enough cash for this…)

If this fails for one reason or another, I should have a couple of other options. I could find another job. (If you have one, and think my resume is cool for you, simply contact me.) I could go the self-employed route. This is something I wanted to do for quite a while already, but never found the time/freedom/money to actually do.

Life seems to be quite crazy right now.

What’s a GraphicsConfiguration?

April 1st, 2009

Yesterday I asked on 2d-dev about how the classes GraphicsEnvironment, GraphicsDevice, GraphicsConfiguration and DisplayMode relate to each other, as nobody really seems to have a clear idea how those map to the real world. Dmitri took some time to answer and enlighten me. I think it makes sense to summarize, could be useful for a broader audience:

  • GraphicsEnvironment represents your particular environment, X11, Win32 or whatever. There is only one instance of this ever.
  • Each GE can have one or more GraphicsDevices. Those usually represent a screen. If you have more than one, you’ll most likely have one GD per screen. Printers can also be GDs.
  • Each GD can have one or more GraphicsConfigurations. This represents all the different configurations in which windows can be displayed simultaneously. It does not represent different resolutions/color modes that the graphics card can be switched to. Confusingly, GC are also used to distinguish screens in Xinerama mode, hence the getBounds() method, which otherwise would belong into GD.
  • DisplayMode now represents different configurations that your graphics card can be switched to.

Look up the discussion on the mailing list for more details and some examples.

Windows vs Ubuntu - Usability

March 26th, 2009

A couple of days ago I received a new laptop, and it came with Windows (Vista). I thought I’d give it a try (haven’t touched Vista at all so far). This Windows thingy came preinstalled on this laptop, so I was thinking I could jump right into it. Wrong. Of course, I had to go through the usual post-installation procedure. Ok, no problem, just enter name, password and go. Wrong. I had to click a million times on some button to confirm or deny installations of several crapwares (no), a couple of ‘do you want to register?’ (no!), some ‘please activate!’ (nooo!), accept a hundred EULAs (ok, if I don’t I can’t get into, so, hrmpf, yes). All in all, it surely took me 20 minutes to get into the OS. And it continued to not impress me. They (MS) seem to have the leading principle of getting in the way of the user. Stupid confirmation boxes around every corner. I quickly decided to remove that stupid OS that treats me either like a criminal or like an idiot, or both.

On the positive side, doing all the installation of Ubuntu was much less fuzz than go through the Windows post installation only. Click, click, click, wait 20 minutes, ready. And in the end I have all the important stuff on my computer. I can’t even imagine how painful it would be to get all the important applications and drivers on Windows (find, download, install, confirm gazillion boxes, reboot, repeat ad infinitum - *shudder*).