I should have been a pair of ragged claws
Scuttling across the floors of silent seas.

While working on putting together this web site, a fedora update pulled in the new 3.8.0 version of claws-mail. I use claws-mail because I mostly like it (certainly a lot more than evolution or thunderbird), but this new update has one stoopid thing I must see if I can fix:

The folder list and message threads all have these microscopic little arrows to indicate expand or collapse. I don't care about the size of the arrows so much, but I appear to be forced to position the mouse directly over the center of the damn little speck to get it to do the expand or collapse when I click the mouse. (And the higher the resolution of your screen, the smaller those six pixels look.)

I filed this as bug 2581 in the claws-mail bugzilla, but who knows if they will care, so I want to see if I can find out how to fix it.

To fix claws-mail, I need the source code:

yumdownloader --source claws-mail
rpm -ihv claws-mail-3.8.0-1.fc16.src.rpm

That unpacks the source rpm, using the macros I have installed in my ~/.rpmmacros file:

%_topdir      /zooty/build/rpmbuild
%_smp_mflags  -j3
%__arch_install_post   /usr/lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot

I honestly don't know what most of that stuff is for, I just copied it from an example somewhere many years ago, but the important macro is %_topdir which, in this case, means the source rpm will be installed under the /zooty/build/rpmbuild directory.

So now, I need to make it actually look like source code rather than the collection of tarballs and patches that are all that exist.

cd /zooty/build/rpmbuild/SPECS/
rpmbuild -bp claws-mail.spec

That doesn't actually work though, because I don't have all the development packages I need to build it. I have two options: I could add the --nodeps option to the rpmbuild command, or I could install all the missing dependencies (from the list it just printed with the error).

At this point, I'm imagining that the tiny triangle might be a stock icon provided in some library, so in case I need to poke around in other packages, I decide to install all the dependencies:

Jan 20 21:00:58 Installed: libgnomeui-devel-2.24.5-2.fc15.x86_64
Jan 20 21:12:05 Installed: 1:glib-1.2.10-35.fc16.x86_64
Jan 20 21:12:05 Installed: 1:glib-devel-1.2.10-35.fc16.x86_64
Jan 20 21:12:06 Installed: texlive-texmf-2007-40.fc16.noarch
Jan 20 21:12:06 Installed: 1:gtk+-1.2.10-71.fc15.x86_64
Jan 20 21:12:06 Installed: 1:gtk+-devel-1.2.10-71.fc15.x86_64
Jan 20 21:12:06 Installed: 1:imlib-1.9.15-15.fc15.x86_64
Jan 20 21:12:07 Installed: texlive-texmf-dvips-2007-40.fc16.noarch
Jan 20 21:12:07 Installed: 1:ORBit-0.5.17-31.fc15.x86_64
Jan 20 21:12:07 Installed: 1:ORBit-devel-0.5.17-31.fc15.x86_64
Jan 20 21:12:14 Installed: texlive-texmf-fonts-2007-40.fc16.noarch
Jan 20 21:12:17 Installed: texlive-2007-66.fc16.x86_64
Jan 20 21:12:17 Installed: texlive-dvips-2007-66.fc16.x86_64
Jan 20 21:12:17 Installed: texlive-utils-2007-66.fc16.x86_64
Jan 20 21:12:17 Installed: 1:imlib-devel-1.9.15-15.fc15.x86_64
Jan 20 21:12:17 Installed: libpng10-1.0.56-1.fc16.x86_64
Jan 20 21:12:17 Installed: 1:gnome-libs-1.4.2-19.fc16.x86_64
Jan 20 21:12:18 Installed: 1:audiofile-devel-0.2.7-2.fc15.x86_64
Jan 20 21:12:18 Installed: 1:esound-devel-0.2.41-4.fc15.x86_64
Jan 20 21:12:18 Installed: 1:NetworkManager-0.9.2-1.fc16.x86_64
Jan 20 21:12:18 Installed: 1:NetworkManager-devel-0.9.2-1.fc16.x86_64
Jan 20 21:12:19 Installed: netpbm-progs-10.47.31-1.fc16.x86_64
Jan 20 21:12:20 Installed: texlive-texmf-latex-2007-40.fc16.noarch
Jan 20 21:12:27 Installed: texlive-latex-2007-66.fc16.x86_64
Jan 20 21:12:27 Installed: tex-preview-11.86-6.fc16.noarch
Jan 20 21:12:28 Installed: jadetex-3.13-10.fc15.noarch
Jan 20 21:12:28 Installed: docbook-utils-pdf-0.6.14-29.fc16.noarch
Jan 20 21:12:29 Installed: 1:NetworkManager-glib-devel-0.9.2-1.fc16.x86_64
Jan 20 21:12:29 Installed: 1:gnome-libs-devel-1.4.2-19.fc16.x86_64
Jan 20 21:12:29 Installed: compface-devel-1.5.2-12.x86_64
Jan 20 21:12:29 Installed: gpgme-devel-1.3.0-4.fc16.x86_64
Jan 20 21:12:29 Installed: 1:enchant-devel-1.6.0-3.fc16.x86_64
Jan 20 21:12:29 Installed: 2:pilot-link-devel-0.12.5-7.fc16.x86_64

Now I can run the rpmbuild command again, and it works, expanding all the tarballs and applying all the patches, and leaving the source in /zooty/build/rpmbuild/BUILD/claws-mail-3.7.10/ (not sure why the directory is 3.7.10, but that's what the source rpm generated, so I don't ask questions).

Some mail arrived while I was doing all that, so I tried to start my normal claws-mail client, and discovered that it now takes about 30 seconds to start. Swell. This is very typical of the twists and turns of the Game of Linux. You are looking for one bug, and a completely different one crops up. Time for a diversion.

I run strace -tt claws-mail to see if I can see what in the blue blazes it is doing for all that time, and I discover this nonsense in the trace output:

21:25:23.974684 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC, 0) = 7
21:25:23.974732 connect(7, {sa_family=AF_FILE, path="/var/run/dbus/system_bus_socket"}, 33) = 0
...
21:25:24.124108 sendmsg(7, {msg_name(0)=NULL, msg_iov(2)=[{"l\1\0\1#\0\0\0\5\0\0\0\177\0\0\0\1\1o\0\25\0\0\0/org/fre"..., 144}, {"\36\0\0\0org.freedesktop.NetworkManag"..., 35}], msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 179
...
21:25:24.124718 poll([{fd=7, events=POLLIN}], 1, 25000) = 1 ([{fd=7, revents=POLLIN}])
21:25:49.126227 recvmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"l\3\1\1;\0\0\0\5\0\0\0m\0\0\0\6\1s\0\7\0\0\0:1.1817\0"..., 2048}], msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 187

Looks like it is opening a socket to talk to dbus, asking something about NetworkManager, then sitting in a poll() call for 25 seconds. I don't have NetworkManager running. I didn't even have it installed until it got dragged in as a dependency for the build (above). Apparently if it is installed, but not running things will timeout desperately trying to talk to it (which is the sort of behavior that led me to remove it in the first place).

I find it highly unlikely that an icon for a tree view would be coming from NetworkManager, so I erase NetworkManager and, Lo and Behold, the 25 second startup delay disappears.

Just to get it on record, I file bug 2583, but since I fixed the problem by removing NetworkManager, I forget about it and go back to looking for tiny triangles.

I'm now in a position to grep -r the source code in the /zooty/build/rpmbuild/BUILD/claws-mail-3.7.10/ directory. I know it is drawing a triangle. I know the triangles are on folders. I'm pretty sure from previous google searches on the gtk toolkit that it calls those things expanders, so I have several things to grep for that might point me to the code or icon I'm looking for.

That pretty quickly discovers GTK_CMCTREE_EXPANDER_TRIANGLE in the src/gtk/gtkcmctree.c file. That has lots of the things I'm looking for, and is probably important. I start looking around at the places it is used.

That leads me to the routine gtk_cmctree_draw_expander, and examining the code in there sure makes it look like it is drawing the triangle itself by filling in a polygon. So much for the idea of finding an icon file or resource I could modify. The tiny triangles appear to be hard coded.

Now I'm no longer interested in the damn triangle, what I'm interested in now is figuring out how it determines a mouse click actually means expand or collapse. Maybe I can enlarge the region that recognizes the clicks?

More searching leads me to the ctree_is_hot_spot routine. Just as the drawing routine is doing elaborate calculations to determine where to draw the triangle, this routine is doing elaborate calculations to determine where the mouse click happened.

It is difficult to know what is going on for sure because of all the references to data structures and variables I know nothing about, but it is clear that it is using PM_SIZE for a lot of important quackqulations in the code, and it is a constant that is equal to 8, whereas a screen shot shows the row height is 18 (which is a lot bigger than 8 when it comes to positioning the mouse).

At this point, I strongly suspect that the expression clist->column[ctree->tree_column].area sounds like it is describing a rectangle that gives the area of that column in the row (just guessing from the name, mind you), and it would make a heck of a lot more sense to me to just allow a mouse click anywhere inside that cell to mean expand or collapse.

Tackling the job of learning what the actual data structures mean and determining if I really could just use the area rectangle can be left to another day when I get more pissed off at how hard it is to click the triangles. For now, I just added this analysis to the bugzilla and I'll see if anything comes of it.

So there you have the nitty gritty details of what a typical Game of Linux looks like. This game isn't won yet, but I'm pretty sure it is winnable now, and it makes a good real world example.

 
Game of Linux Entry Game of Linux Site Map Tom's Fabulous Web Page
 
Page last modified Sun Feb 12 14:41:06 2012