@@ -378,6 +378,8 @@ void resize_tile_scroller(Client *grabc, bool isdrag, int32_t offsetx,
378378 int32_t offsety , uint32_t time , bool isvertical ) {
379379 float delta_x , delta_y ;
380380 float new_scroller_proportion ;
381+ float new_stack_proportion ;
382+ Client * stack_head = get_scroll_stack_head (grabc );
381383
382384 if (grabc && grabc -> mon -> visible_tiling_clients == 1 &&
383385 !scroller_ignore_proportion_single )
@@ -389,7 +391,8 @@ void resize_tile_scroller(Client *grabc, bool isdrag, int32_t offsetx,
389391 start_drag_window = true;
390392
391393 // 记录初始状态
392- grabc -> old_scroller_pproportion = grabc -> scroller_proportion ;
394+ stack_head -> old_scroller_pproportion = stack_head -> scroller_proportion ;
395+ grabc -> old_stack_proportion = grabc -> stack_proportion ;
393396
394397 grabc -> cursor_in_left_half =
395398 cursor -> x < grabc -> geom .x + grabc -> geom .width / 2 ;
@@ -409,15 +412,26 @@ void resize_tile_scroller(Client *grabc, bool isdrag, int32_t offsetx,
409412 grabc -> old_master_inner_per = grabc -> master_inner_per ;
410413 grabc -> old_stack_inner_per = grabc -> stack_inner_per ;
411414 grabc -> drag_begin_geom = grabc -> geom ;
412- grabc -> old_scroller_pproportion = grabc -> scroller_proportion ;
415+ stack_head -> old_scroller_pproportion =
416+ stack_head -> scroller_proportion ;
417+ grabc -> old_stack_proportion = grabc -> stack_proportion ;
413418 grabc -> cursor_in_upper_half = false;
414419 grabc -> cursor_in_left_half = false;
415420 }
416421
417- delta_x = (float )(offsetx ) * (grabc -> old_scroller_pproportion ) /
418- grabc -> drag_begin_geom .width ;
419- delta_y = (float )(offsety ) * (grabc -> old_scroller_pproportion ) /
420- grabc -> drag_begin_geom .height ;
422+ if (isvertical ) {
423+ delta_y = (float )(offsety ) *
424+ (stack_head -> old_scroller_pproportion ) /
425+ grabc -> drag_begin_geom .height ;
426+ delta_x = (float )(offsetx ) * (grabc -> old_stack_proportion ) /
427+ grabc -> drag_begin_geom .width ;
428+ } else {
429+ delta_x = (float )(offsetx ) *
430+ (stack_head -> old_scroller_pproportion ) /
431+ grabc -> drag_begin_geom .width ;
432+ delta_y = (float )(offsety ) * (grabc -> old_stack_proportion ) /
433+ grabc -> drag_begin_geom .height ;
434+ }
421435
422436 bool moving_up ;
423437 bool moving_down ;
@@ -452,18 +466,36 @@ void resize_tile_scroller(Client *grabc, bool isdrag, int32_t offsetx,
452466 delta_x = - fabsf (delta_x );
453467 }
454468
469+ if (isvertical ) {
470+ if (!grabc -> next_in_stack && grabc -> prev_in_stack && !isdrag ) {
471+ delta_x = delta_x * -1.0f ;
472+ }
473+ } else {
474+ if (!grabc -> next_in_stack && grabc -> prev_in_stack && !isdrag ) {
475+ delta_y = delta_y * -1.0f ;
476+ }
477+ }
478+
455479 // 直接设置新的比例,基于初始值 + 变化量
456480 if (isvertical ) {
457- new_scroller_proportion = grabc -> old_scroller_pproportion + delta_y ;
481+ new_scroller_proportion =
482+ stack_head -> old_scroller_pproportion + delta_y ;
483+ new_stack_proportion = grabc -> old_stack_proportion + delta_x ;
484+
458485 } else {
459- new_scroller_proportion = grabc -> old_scroller_pproportion + delta_x ;
486+ new_scroller_proportion =
487+ stack_head -> old_scroller_pproportion + delta_x ;
488+ new_stack_proportion = grabc -> old_stack_proportion + delta_y ;
460489 }
461490
462491 // 应用限制,确保比例在合理范围内
463492 new_scroller_proportion =
464493 fmaxf (0.1f , fminf (1.0f , new_scroller_proportion ));
494+ new_stack_proportion = fmaxf (0.1f , fminf (1.0f , new_stack_proportion ));
495+
496+ grabc -> stack_proportion = new_stack_proportion ;
465497
466- grabc -> scroller_proportion = new_scroller_proportion ;
498+ stack_head -> scroller_proportion = new_scroller_proportion ;
467499
468500 if (!isdrag ) {
469501 arrange (grabc -> mon , false, false);
@@ -487,6 +519,9 @@ void resize_tile_client(Client *grabc, bool isdrag, int32_t offsetx,
487519 if (grabc -> mon -> isoverview )
488520 return ;
489521
522+ int32_t animations_state_backup = animations ;
523+ animations = 0 ;
524+
490525 const Layout * current_layout =
491526 grabc -> mon -> pertag -> ltidxs [grabc -> mon -> pertag -> curtag ];
492527 if (current_layout -> id == TILE || current_layout -> id == DECK ||
@@ -505,6 +540,8 @@ void resize_tile_client(Client *grabc, bool isdrag, int32_t offsetx,
505540 } else if (current_layout -> id == VERTICAL_SCROLLER ) {
506541 resize_tile_scroller (grabc , isdrag , offsetx , offsety , time , true);
507542 }
543+
544+ animations = animations_state_backup ;
508545}
509546
510547void reset_size_per_mon (Monitor * m , int32_t tile_cilent_num ,
@@ -605,6 +642,10 @@ arrange(Monitor *m, bool want_animation, bool from_view) {
605642
606643 wl_list_for_each (c , & clients , link ) {
607644
645+ if (!client_only_in_one_tag (c ) || c -> isglobal || c -> isunglobal ) {
646+ exit_scroller_stack (c );
647+ }
648+
608649 if (from_view && (c -> isglobal || c -> isunglobal )) {
609650 set_size_per (m , c );
610651 }
@@ -627,7 +668,7 @@ arrange(Monitor *m, bool want_animation, bool from_view) {
627668 m -> visible_tiling_clients ++ ;
628669 }
629670
630- if (ISSCROLLTILED (c )) {
671+ if (ISSCROLLTILED (c ) && ! c -> prev_in_stack ) {
631672 m -> visible_scroll_tiling_clients ++ ;
632673 }
633674 }
0 commit comments