@@ -142,7 +142,7 @@ Client *center_tiled_select(Monitor *m) {
142142 return target_c ;
143143}
144144Client * find_client_by_direction (Client * tc , const Arg * arg , bool findfloating ,
145- bool align ) {
145+ bool ignore_align ) {
146146 Client * c = NULL ;
147147 Client * * tempClients = NULL ; // 初始化为 NULL
148148 int last = -1 ;
@@ -185,21 +185,23 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
185185
186186 switch (arg -> i ) {
187187 case UP :
188- for (int _i = 0 ; _i <= last ; _i ++ ) {
189- if (tempClients [_i ]-> geom .y < sel_y &&
190- tempClients [_i ]-> geom .x == sel_x &&
191- tempClients [_i ]-> mon == tc -> mon ) {
192- int dis_x = tempClients [_i ]-> geom .x - sel_x ;
193- int dis_y = tempClients [_i ]-> geom .y - sel_y ;
194- long long int tmp_distance =
195- dis_x * dis_x + dis_y * dis_y ; // 计算距离
196- if (tmp_distance < distance ) {
197- distance = tmp_distance ;
198- tempFocusClients = tempClients [_i ];
188+ if (!ignore_align ) {
189+ for (int _i = 0 ; _i <= last ; _i ++ ) {
190+ if (tempClients [_i ]-> geom .y < sel_y &&
191+ tempClients [_i ]-> geom .x == sel_x &&
192+ tempClients [_i ]-> mon == tc -> mon ) {
193+ int dis_x = tempClients [_i ]-> geom .x - sel_x ;
194+ int dis_y = tempClients [_i ]-> geom .y - sel_y ;
195+ long long int tmp_distance =
196+ dis_x * dis_x + dis_y * dis_y ; // 计算距离
197+ if (tmp_distance < distance ) {
198+ distance = tmp_distance ;
199+ tempFocusClients = tempClients [_i ];
200+ }
199201 }
200202 }
201203 }
202- if (!tempFocusClients && ! align ) {
204+ if (!tempFocusClients ) {
203205 for (int _i = 0 ; _i <= last ; _i ++ ) {
204206 if (tempClients [_i ]-> geom .y < sel_y ) {
205207 int dis_x = tempClients [_i ]-> geom .x - sel_x ;
@@ -215,21 +217,23 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
215217 }
216218 break ;
217219 case DOWN :
218- for (int _i = 0 ; _i <= last ; _i ++ ) {
219- if (tempClients [_i ]-> geom .y > sel_y &&
220- tempClients [_i ]-> geom .x == sel_x &&
221- tempClients [_i ]-> mon == tc -> mon ) {
222- int dis_x = tempClients [_i ]-> geom .x - sel_x ;
223- int dis_y = tempClients [_i ]-> geom .y - sel_y ;
224- long long int tmp_distance =
225- dis_x * dis_x + dis_y * dis_y ; // 计算距离
226- if (tmp_distance < distance ) {
227- distance = tmp_distance ;
228- tempFocusClients = tempClients [_i ];
220+ if (!ignore_align ) {
221+ for (int _i = 0 ; _i <= last ; _i ++ ) {
222+ if (tempClients [_i ]-> geom .y > sel_y &&
223+ tempClients [_i ]-> geom .x == sel_x &&
224+ tempClients [_i ]-> mon == tc -> mon ) {
225+ int dis_x = tempClients [_i ]-> geom .x - sel_x ;
226+ int dis_y = tempClients [_i ]-> geom .y - sel_y ;
227+ long long int tmp_distance =
228+ dis_x * dis_x + dis_y * dis_y ; // 计算距离
229+ if (tmp_distance < distance ) {
230+ distance = tmp_distance ;
231+ tempFocusClients = tempClients [_i ];
232+ }
229233 }
230234 }
231235 }
232- if (!tempFocusClients && ! align ) {
236+ if (!tempFocusClients ) {
233237 for (int _i = 0 ; _i <= last ; _i ++ ) {
234238 if (tempClients [_i ]-> geom .y > sel_y ) {
235239 int dis_x = tempClients [_i ]-> geom .x - sel_x ;
@@ -245,21 +249,23 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
245249 }
246250 break ;
247251 case LEFT :
248- for (int _i = 0 ; _i <= last ; _i ++ ) {
249- if (tempClients [_i ]-> geom .x < sel_x &&
250- tempClients [_i ]-> geom .y == sel_y &&
251- tempClients [_i ]-> mon == tc -> mon ) {
252- int dis_x = tempClients [_i ]-> geom .x - sel_x ;
253- int dis_y = tempClients [_i ]-> geom .y - sel_y ;
254- long long int tmp_distance =
255- dis_x * dis_x + dis_y * dis_y ; // 计算距离
256- if (tmp_distance < distance ) {
257- distance = tmp_distance ;
258- tempFocusClients = tempClients [_i ];
252+ if (!ignore_align ) {
253+ for (int _i = 0 ; _i <= last ; _i ++ ) {
254+ if (tempClients [_i ]-> geom .x < sel_x &&
255+ tempClients [_i ]-> geom .y == sel_y &&
256+ tempClients [_i ]-> mon == tc -> mon ) {
257+ int dis_x = tempClients [_i ]-> geom .x - sel_x ;
258+ int dis_y = tempClients [_i ]-> geom .y - sel_y ;
259+ long long int tmp_distance =
260+ dis_x * dis_x + dis_y * dis_y ; // 计算距离
261+ if (tmp_distance < distance ) {
262+ distance = tmp_distance ;
263+ tempFocusClients = tempClients [_i ];
264+ }
259265 }
260266 }
261267 }
262- if (!tempFocusClients && ! align ) {
268+ if (!tempFocusClients ) {
263269 for (int _i = 0 ; _i <= last ; _i ++ ) {
264270 if (tempClients [_i ]-> geom .x < sel_x ) {
265271 int dis_x = tempClients [_i ]-> geom .x - sel_x ;
@@ -275,21 +281,23 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
275281 }
276282 break ;
277283 case RIGHT :
278- for (int _i = 0 ; _i <= last ; _i ++ ) {
279- if (tempClients [_i ]-> geom .x > sel_x &&
280- tempClients [_i ]-> geom .y == sel_y &&
281- tempClients [_i ]-> mon == tc -> mon ) {
282- int dis_x = tempClients [_i ]-> geom .x - sel_x ;
283- int dis_y = tempClients [_i ]-> geom .y - sel_y ;
284- long long int tmp_distance =
285- dis_x * dis_x + dis_y * dis_y ; // 计算距离
286- if (tmp_distance < distance ) {
287- distance = tmp_distance ;
288- tempFocusClients = tempClients [_i ];
284+ if (!ignore_align ) {
285+ for (int _i = 0 ; _i <= last ; _i ++ ) {
286+ if (tempClients [_i ]-> geom .x > sel_x &&
287+ tempClients [_i ]-> geom .y == sel_y &&
288+ tempClients [_i ]-> mon == tc -> mon ) {
289+ int dis_x = tempClients [_i ]-> geom .x - sel_x ;
290+ int dis_y = tempClients [_i ]-> geom .y - sel_y ;
291+ long long int tmp_distance =
292+ dis_x * dis_x + dis_y * dis_y ; // 计算距离
293+ if (tmp_distance < distance ) {
294+ distance = tmp_distance ;
295+ tempFocusClients = tempClients [_i ];
296+ }
289297 }
290298 }
291299 }
292- if (!tempFocusClients && ! align ) {
300+ if (!tempFocusClients ) {
293301 for (int _i = 0 ; _i <= last ; _i ++ ) {
294302 if (tempClients [_i ]-> geom .x > sel_x ) {
295303 int dis_x = tempClients [_i ]-> geom .x - sel_x ;
@@ -317,12 +325,13 @@ Client *direction_select(const Arg *arg) {
317325 if (!tc )
318326 return NULL ;
319327
320- if (tc && (tc -> isfullscreen || tc -> ismaximizescreen )) {
321- // 不支持全屏窗口的焦点切换
328+ if (tc && (tc -> isfullscreen || tc -> ismaximizescreen ) &&
329+ (! is_scroller_layout ( selmon ) || tc -> isfloating )) {
322330 return NULL ;
323331 }
324332
325- return find_client_by_direction (tc , arg , true, false);
333+ return find_client_by_direction (
334+ tc , arg , true, is_scroller_layout (selmon ) && !selmon -> isoverview );
326335}
327336
328337/* We probably should change the name of this, it sounds like
0 commit comments