/* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
round down even for negative values. */
if (gx < 0)
gx -= width - 1;
if (gy < 0)
gy -= height - 1;
gx = (gx + width - 1) / width * width;
gy = (gy + height - 1) / height * height;
last_mouse_glyph.width = width;
last_mouse_glyph.height = height;
last_mouse_glyph.x = gx;
last_mouse_glyph.y = gy;
gx and gy are initially the position of the mouse. We are trying to
find the rectangle around the glyph under the mouse here.
On Windows, I found that this code returns the rectangle of a glyph
diagonally adjacent to the glyph we want. I am not sure if I am
missing something about the way X co-ordinates work, but I think the
two lines that round gx and gy should be simply:
gx = gx / width * width;
gy = gy / height * height;