@@ -1225,7 +1225,8 @@ pub struct Areas {
1225
1225
/// If several layers want to be on top, they will keep their relative order.
1226
1226
/// This means closing three windows and then reopening them all in one frame
1227
1227
/// results in them being sent to the top and keeping their previous internal order.
1228
- wants_to_be_on_top : ahash:: HashSet < LayerId > ,
1228
+ // MEMBRANE: Make `move_to_top` deterministic depending on the order in which it's called.
1229
+ wants_to_be_on_top : Vec < LayerId > ,
1229
1230
1230
1231
/// The sublayers that each layer has.
1231
1232
///
@@ -1328,7 +1329,7 @@ impl Areas {
1328
1329
1329
1330
pub fn move_to_top ( & mut self , layer_id : LayerId ) {
1330
1331
self . visible_areas_current_frame . insert ( layer_id) ;
1331
- self . wants_to_be_on_top . insert ( layer_id) ;
1332
+ self . wants_to_be_on_top . push ( layer_id) ;
1332
1333
1333
1334
if !self . order . iter ( ) . any ( |x| * x == layer_id) {
1334
1335
self . order . push ( layer_id) ;
@@ -1400,7 +1401,16 @@ impl Areas {
1400
1401
std:: mem:: swap ( visible_areas_last_frame, visible_areas_current_frame) ;
1401
1402
visible_areas_current_frame. clear ( ) ;
1402
1403
1403
- order. sort_by_key ( |layer| ( layer. order , wants_to_be_on_top. contains ( layer) ) ) ;
1404
+ order. sort_by_key ( |layer| {
1405
+ (
1406
+ layer. order ,
1407
+ wants_to_be_on_top
1408
+ . iter ( )
1409
+ . position ( |l| l == layer)
1410
+ . map ( |i| i + 1 )
1411
+ . unwrap_or ( 0 ) ,
1412
+ )
1413
+ } ) ;
1404
1414
wants_to_be_on_top. clear ( ) ;
1405
1415
1406
1416
// For all layers with sublayers, put the sublayers directly after the parent layer:
0 commit comments