@@ -4655,6 +4655,44 @@ static Tray getTray() {
4655
4655
return tray ;
4656
4656
}
4657
4657
4658
+ static Shell [] getAllVisibleShells () {
4659
+ Shell [] shells = new Shell [0 ]; // auto-incremental array
4660
+ int [] orders = new int [0 ];
4661
+ Display [] disps = Displays ;
4662
+ for (int k = 0 ; k < disps .length ; k ++) {
4663
+ if (disps [k ] == null ) continue ;
4664
+ Shell [] ss = disps [k ].getShells ();
4665
+ for (int i = 0 ; i < ss .length ; i ++) {
4666
+ if (!ss [i ].isDisposed () /*&& ss[i].parent == null*/
4667
+ && ss [i ].isVisible ()
4668
+ && ss [i ].handle .style .display != "none" ) {
4669
+ shells [shells .length ] = ss [i ];
4670
+ String idx = "" + ss [i ].handle .style .zIndex ;
4671
+ int zidx = 0 ;
4672
+ if (idx == null || idx .length () == 0 ) {
4673
+ zidx = 0 ;
4674
+ } else {
4675
+ zidx = Integer .parseInt (idx );
4676
+ }
4677
+ orders [orders .length ] = zidx ;
4678
+ }
4679
+ }
4680
+ }
4681
+ for (int i = 0 ; i < shells .length ; i ++) {
4682
+ for (int j = i + 1 ; j < shells .length ; j ++) {
4683
+ if (orders [i ] < orders [j ]) {
4684
+ Shell s = shells [i ];
4685
+ shells [i ] = shells [j ];
4686
+ shells [j ] = s ;
4687
+ int idx = orders [i ];
4688
+ orders [i ] = orders [j ];
4689
+ orders [j ] = idx ;
4690
+ }
4691
+ }
4692
+ }
4693
+ return shells ;
4694
+ }
4695
+
4658
4696
static Shell getTopShell () {
4659
4697
Shell lastShell = null ;
4660
4698
int lastZIndex = 0 ;
@@ -4868,7 +4906,16 @@ public void run() {
4868
4906
while (src != null ) {
4869
4907
String className = src .className ;
4870
4908
if (className != null && className .indexOf ("shadow-" ) != -1 ) {
4871
- return ;
4909
+ Shell [] allVisibleShells = getAllVisibleShells ();
4910
+ for (int i = 0 ; i < allVisibleShells .length ; i ++) {
4911
+ Rectangle bounds = allVisibleShells [i ].getBounds ();
4912
+ // border width is taking into consideration
4913
+ if (evt .x >= bounds .x + 2 && evt .x <= bounds .x + bounds .width - 4
4914
+ && evt .y >= bounds .y + 2 && evt .y <= bounds .y + bounds .height - 4 ) {
4915
+ allVisibleShells [i ].bringToTop ();
4916
+ return ;
4917
+ }
4918
+ }
4872
4919
}
4873
4920
if (OS .existedCSSClass (src , "shell-default" )) {
4874
4921
Display [] displs = Displays ;
0 commit comments