Hubert Chathi

February 17, 2010
09:40 -0500
Hubert Chathi: is disappointed that # won't be doing # this year http://moodle.org/mod/forum/discuss.php?d=143919
April 20, 2009
15:24 -0400
Hubert Chathi: congratulates all the students accepted for Google Summer of Code #
July 4, 2008

focus stealing prevention prevention

16:05 -0400

Recent window managers have a feature called "focus stealing prevention", which is wonderful in theory. But in practice... well, do a Google search, and see how many people don't like it. The problem is that it's a whole bunch of guesswork, and so it may cause problems when it guesses wrong.

Take, for example, GNUstep applications. GNUstep applications have their menu in a separate window (like on MacOS X), and the menu disappears when the application is inactive. If the application has no other windows, then it tries to give focus to the menu. But then focus stealing prevention kicks in and takes away the focus. The application then detects that it lost focus, deactivates itself, and hides the main menu, making it hard to interact further with the application.

That was the cause for one of the window focusing issues that I was looking at for my GSoC project.

So how do you steal focus and get away with it? Simple: ask nicely first, before you steal. The EWMH spec has an atom called _NET_ACTIVE_WINDOW, which allows windows to request focus. It turns out, if I use that, then steal focus, then the window manager will let me.

However, KWin/KDE (or at least some versions of it) needs a bit more coercing, and we need to set _NET_USER_TIME, while _NET_ACTIVE_WINDOW doesn't seem to do anything.

The final solution:

  • set _NET_USER_TIME property
  • send _NET_ACTIVE_WINDOW message
  • call XSetInputFocus
June 19, 2008

How GNUstep processes X events

10:03 -0400

As part of my GSoC project, I've been tracing through GNUstep's event handling to see how events from the X window system become OpenStep-style events. Here is a brief outline. (Non-technical readers will want to stop reading around here, if they haven't stopped already.)

First of all, the X window system communicates with applications using a socket (just like pretty much everything else in UNIX-land). GNUstep's X11 backend opens the socket, and transforms the socket into an NSFileHandle, and registers it with the GNUstep runloop. When new data is available on the socket, the runloop calls the backend's callback function, the -[XGServer processEvent:] (private) method in XGServerEvent.m. The -processEvent: method has a huge switch statement to determine what type of X event it received. It then (if necessary) creates a NSEvent, and sticks it on the GNUstep event queue.

GNUstep's runloop then picks up the event from the event queue, and then dispatches it to NSApplication through its -sendEvent: method, which basically forwards it to the window's -sendEvent: method. -[NSWindow sendEvent:] method also has big switch statement depending on what type of event it is. But this time, it uses NSEventTypes instead of XEvent types.

Aside from some simple filtering, -[NSApplication sendEvent:] doesn't modify the NSEvent at all. So, to figure out how an XEvent is handled by GNUstep, look for the appropriate branch in -[XGServer processEvent:], and then figure out what type of NSEvent (if any) is generated. Then look at -[NSWindow sendEvent:], to see how it gets handled (unless it's an NSKeyDown event, which may get sent to the main menu or the key window first).

May 6, 2008

GSoC feed

19:21 -0400

After about two years of using this CMS/blog system, I've finally implemented the ability to filter blog posts by tag. By “tags”, I mean the things at the top-right corner of my blog posts that warn non-technical readers to stay away from posts like this one. What this means is that you can look at all my posts about the news, the environment, security etc. Hmm... apparently I haven't written anything about security for over a year...

This is helpful if you're only interested in reading the pointless random stuff I say about, say, artichokes. Or zebus. (Maybe one of these days I'll make it so that you can filter out my artichoke-related posts.)

The main reason that I implemented was for Planet SoC, which is the (among other things) aggregator for Google Summer of Code participants’ blogs. And, naturally, the main page is intended to have only GSoC-related posts. etc., etc.... (One problem is that Planet SoC seems to be adding <br/> tags to my posts...)

In related news, I have finally made my CMS downloadable via my public git repository. The next step is to actually document the important bits (like how to use it). Because its mode of operation is, shall we say, “nonstandard”. (What? A CMS without a database? Is that even possible?)

In more GSoC news, I have set up a section for my project. There, I will be putting my notes, my to-do list, and any other relevant information.

I've also started collecting information for part of my project.

Now I just need to finish my thesis so I can focus on coding...

April 21, 2008

Summer: a time for coding.

18:51 -0400

My application for Google's Summer of Code 2008 has been accepted. Basically, this means that Google will be paying me to program for the summer. (It also means that I better have my thesis more-or-less done soon, so that I'll have time to work on it.) Guess which tan line I will have at the end of the summer.

According to the official timeline, I'm supposed to start working on May 26. I'll probably do some setup and background work before then, though.

While I had been interested in Google's Summer of Code since it began, my school schedule (grad school at Waterloo means no summer break) prevented me from participating. This year, though, it seems like perfect timing for me, since I should be finishing up most of my work on my Ph.D. soon, but won't have a job yet (anyone want to hire me?).

The project that I'll be working on is improving GNUstep's integration with other desktop environment. GNUstep is an implementation of the OpenStep API, which is what is used by Apple's MacOS X. GNUstep doesn't (yet) have the glitz of MacOS X (although hopefully that will change, maybe with the aid of another GSoC project) but it is a very powerful and flexible system.

One of the problems of GNUstep, though, is that it doesn't quite cooperate as well with other *nix-based desktops, such as GNOME or KDE as it should. freedesktop.org was created to create standards and software for the *nix-based desktops so that they would all be able to cooperate. My project will focus on getting GNUstep to adhere to as many of the standards as I can.

A preliminary list of the ones that I'll be looking at (in approximate order that I'll be working on them) is:

  • there are some window focusing issues that need to be fixed
  • EWMH hints
  • XDND
  • startup notification
  • XEmbed client support (so that GNUstep windows that are embedded in other apps follow the XEmbed spec — XEmbed embedder support would probably go in an extension)
  • System Tray (requires XEmbed client support)
  • gstreamer (for NSMovie, NSSound?, and related classes)
  • avahi (implementing Apple's NSNetService API)
  • .desktop file support (reading, and improved writing)
  • icon naming (so that GNUstep can share icon themes with other desktop environments)

Of course, this list is subject to change. There are a lot of other standards that I could work on. It will all depend on discussions with my mentor.

Stay tuned for more updates.

This page was made from only the finest electrons.

© Hubert Chathi <><