~ctwm/ctwm/trunk

« back to all changes in this revision

Viewing changes to functions_warp.c

  • Committer: Olaf 'Rhialto' Seibert
  • Date: 2020-12-31 13:38:50 UTC
  • mto: This revision was merged to the branch mainline in revision 679.
  • Revision ID: rhialto@falu.nl-20201231133850-lti73298am98ligu
Slightly improve the strange test involving Scr->Focus, and also improve
the comment that "explained" it. Still it is not right and this should likely
be done in a different manner.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "win_utils.h"
24
24
 
25
25
 
 
26
bool WindowIsOnRing(TwmWindow *win);
26
27
static void WarpAlongRing(XButtonEvent *ev, bool forward);
27
28
 
28
29
 
171
172
        }
172
173
}
173
174
 
 
175
bool
 
176
WindowIsOnRing(TwmWindow *win)
 
177
{
 
178
        return win && win->ring.next;
 
179
}
 
180
 
174
181
/* Taken from vtwm version 5.3 */
175
182
DFHANDLER(ring)
176
183
{
258
265
                }
259
266
        }
260
267
 
261
 
        /* Note: (Scr->Focus != r) is necessary when we move to a workspace that
262
 
           has a single window and we want warping to warp to it. */
263
 
        if(r && (r != head || Scr->Focus != r)) {
 
268
        /*
 
269
         * Note: (Scr->Focus == NULL) is necessary when we move to (or
 
270
         * are in) a workspace that has a single window, and we're not
 
271
         * on that window (but the window is head), and we want f.warpring
 
272
         * to warp to it.
 
273
         * Generalised that is also true if we are on a window but it is
 
274
         * not on the ring.
 
275
         * TODO: on an empty screen, it still moves the mouse cursor...
 
276
         */
 
277
 
 
278
        if(r && (r != head
 
279
                        || Scr->Focus == NULL
 
280
                        || !WindowIsOnRing(Scr->Focus))) {
264
281
                TwmWindow *p = Scr->RingLeader, *t;
265
282
 
266
283
                Scr->RingLeader = r;