@@ -4655,6 +4655,44 @@ static Tray getTray() {
46554655 return tray ;
46564656}
46574657
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+
46584696static Shell getTopShell () {
46594697 Shell lastShell = null ;
46604698 int lastZIndex = 0 ;
@@ -4868,7 +4906,16 @@ public void run() {
48684906 while (src != null ) {
48694907 String className = src .className ;
48704908 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+ }
48724919 }
48734920 if (OS .existedCSSClass (src , "shell-default" )) {
48744921 Display [] displs = Displays ;
0 commit comments