Resize cursor (BorderResizeCursors) does not work for top and left
border if non-3D borders are used. This is because the function that
determines which cursor is needed only works properly with the
coordinate system when 3D borders are used. (Aside: it seems like a
strange design that changing the type of borders changes the coordinate
system so much).

Here's a patch. Line numbers are relative to 3.7alpha4 but it should
apply to 3.6 also with an offset of some 60 lines.

--- util.c.orig Tue Dec 11 16:38:52 2001
+++ util.c      Tue Mar 11 21:51:41 2003
@@ -3089,13 +3089,38 @@
 {
     Cursor cursor;
     XSetWindowAttributes attr;
-    int h  = Scr->TitleHeight + tmp_win->frame_bw3D;
-    int fw = tmp_win->frame_width;
-    int fh = tmp_win->frame_height;
-    int wd = tmp_win->frame_bw3D;
+    int h, fw, fh, wd;
 
     if (! tmp_win) return;
-    if ((x < 0) || (y < 0)) cursor = Scr->FrameCursor;
+
+    /* use the max of these, but since one is always 0 we can add them. */
+    wd = tmp_win->frame_bw + tmp_win->frame_bw3D;
+    h  = Scr->TitleHeight + wd;
+    fw = tmp_win->frame_width;
+    fh = tmp_win->frame_height;
+
+#if DEBUG
+    fprintf(stderr, "wd=%d h=%d, fw=%d fh=%d   x=%d y=%d\n",
+           wd, h, fw, fh, x, y);
+#endif
+
+    /*
+     * If not using 3D borders:
+     *
+     * The left border has negative x coordinates,
+     * The top border (above the title) has negative y coordinates.
+     * The title is TitleHeight high, the next wd pixels are border.
+     * The bottom border has coordinates >= the frame height.
+     * The right border has coordinates >= the frame width.
+     *
+     * If using 3D borders: all coordinates are >= 0, and all coordinates
+     * are higher by the border width.
+     *
+     * Since we only get events when we're actually in the border, we simply
+     * allow for both cases at the same time.
+     */
+
+    if ((x < -wd) || (y < -wd)) cursor = Scr->FrameCursor;
     else
     if (x < wd) {
        if (y < h) cursor = TopLeftCursor;
@@ -3111,7 +3136,7 @@
        else cursor = RightCursor;
     }
     else
-    if (y < wd) {
+    if (y < h) {
        if (x < h) cursor = TopLeftCursor;
        else
        if (x >= fw - h) cursor = TopRightCursor;

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- The evil eye is caused by the black
\X/ rhialto/at/xs4all.nl        -- tongue - Tom Poes, "Het boze oog", 4456.

Reply via email to