Adventures in the kdrive land

Got this bug which lead me into looking at some code in the X server. If you use gtk_widget_set_extension_events(w, GDK_EXTENSION_EVENTS_ALL); on a GtkEntry or GtkTextView motion notify events stop working. This effectively prevents selecting text.

Button press is always generated at 0,0 (root window coordinates) and the next motion notify is at the “right” position so it looks like a really quick drag and I think here gtk is getting confused. After that you get one more motion notify and then everything stops. Dragging the pointer outside the widget and back in again emits exactly one motion notify event for each time the pointer enters the widget again.

Who’s eating the motion notify events? Ideas?

Anyway.. When I first started replicating the problem I fired up the test program in Xephyr and *BOOM* Xephyr crashed. Long story short I ended up looking at the following pieces of code:

--- fb/fbpict.c:
void fbCompositeSolidMask_nx8x8888 (FbComposeData *params)

--- fb/fbmmx.c:
void fbCompositeSolidMask_nx8x8888mmx (CARD8      op,
                                       PicturePtr pSrc,
                                       PicturePtr pMask,
                                       PicturePtr pDst,
                                       INT16      xSrc,
                                       INT16      ySrc,
                                       INT16      xMask,
                                       INT16      yMask,
                                       INT16      xDst,
                                       INT16      yDst,
                                       CARD16     width,
                                       CARD16     height)

--- fb/fbpict.c:
if (fbHaveMMX())
    func = fbCompositeSolidMask_nx8x8888mmx;
else
    func = fbCompositeSolidMask_nx8x8888;

[and then later on]
(*func) (&params);

I have a pretty good idea what/who happened but to protect the guilty let’s not name any names.

Disabling MMX there let me move on to figure out the actual problem. After fixing a potential issue in gtk (no help there) I found myself staring at more X server code:

--- hw/kdrive/src/kinput.c:
if (some test) {
    [nested if doing conditional coordinate transformation]
}
else {
    [exactly the same code as in previous branch]
}

…and…

--- include/inputstr.h:
#define POINTER_RELATIVE (1

I've no idea whether that's related, but if the bug is in X server (the same testcase works with desktop X) and the rest of the code is equally (un)obvious it's going to be fun to track down.

1 comment so far ↓

#1 daniels on 11.28.06 at 9:44 pm

I blame mallum and keithp.