@@ -515,30 +515,10 @@ static void subsurface_parent_commit(struct wlr_subsurface *subsurface,
515
515
}
516
516
}
517
517
518
- static void subsurface_commit (struct wlr_subsurface * subsurface ) {
519
- struct wlr_surface * surface = subsurface -> surface ;
520
-
521
- if (subsurface_is_synchronized (subsurface )) {
522
- if (subsurface -> has_cache ) {
523
- // We already lock a previous commit. The prevents any future
524
- // commit to be applied before we release the previous commit.
525
- return ;
526
- }
527
- subsurface -> has_cache = true;
528
- subsurface -> cached_seq = wlr_surface_lock_pending (surface );
529
- }
530
- }
531
-
532
518
static void surface_handle_commit (struct wl_client * client ,
533
519
struct wl_resource * resource ) {
534
520
struct wlr_surface * surface = wlr_surface_from_resource (resource );
535
521
536
- struct wlr_subsurface * subsurface = wlr_surface_is_subsurface (surface ) ?
537
- wlr_subsurface_from_wlr_surface (surface ) : NULL ;
538
- if (subsurface != NULL ) {
539
- subsurface_commit (subsurface );
540
- }
541
-
542
522
if (surface -> role && surface -> role -> commit_request ) {
543
523
surface -> role -> commit_request (surface );
544
524
}
@@ -551,6 +531,7 @@ static void surface_handle_commit(struct wl_client *client,
551
531
surface_commit_state (surface , & surface -> pending );
552
532
}
553
533
534
+ struct wlr_subsurface * subsurface ;
554
535
wl_list_for_each (subsurface , & surface -> current .subsurfaces_below , current .link ) {
555
536
subsurface_parent_commit (subsurface , false);
556
537
}
@@ -1061,6 +1042,24 @@ static void subsurface_unmap(struct wlr_subsurface *subsurface) {
1061
1042
}
1062
1043
}
1063
1044
1045
+ static void subsurface_role_commit_request (struct wlr_surface * surface ) {
1046
+ struct wlr_subsurface * subsurface =
1047
+ wlr_subsurface_from_wlr_surface (surface );
1048
+ if (subsurface == NULL ) {
1049
+ return ;
1050
+ }
1051
+
1052
+ if (subsurface_is_synchronized (subsurface )) {
1053
+ if (subsurface -> has_cache ) {
1054
+ // We already lock a previous commit. The prevents any future
1055
+ // commit to be applied before we release the previous commit.
1056
+ return ;
1057
+ }
1058
+ subsurface -> has_cache = true;
1059
+ subsurface -> cached_seq = wlr_surface_lock_pending (surface );
1060
+ }
1061
+ }
1062
+
1064
1063
static void subsurface_role_commit (struct wlr_surface * surface ) {
1065
1064
struct wlr_subsurface * subsurface =
1066
1065
wlr_subsurface_from_wlr_surface (surface );
@@ -1111,6 +1110,7 @@ static void subsurface_role_precommit(struct wlr_surface *surface,
1111
1110
1112
1111
const struct wlr_surface_role subsurface_role = {
1113
1112
.name = "wl_subsurface" ,
1113
+ .commit_request = subsurface_role_commit_request ,
1114
1114
.commit = subsurface_role_commit ,
1115
1115
.precommit = subsurface_role_precommit ,
1116
1116
};
0 commit comments