From 30f22613b8caca8add14d087123850171eb843f0 Mon Sep 17 00:00:00 2001 From: hujianwei Date: Sun, 13 Nov 2022 13:45:11 +0000 Subject: [PATCH] Fix some minor problems * seat.c (DispatchEntryExit): Understand all kinds of entry and exit events instead of just non-grab ones. * subcompositor.c (SubcompositorComposite1): Remove redundant assignment. * xerror.c (CategorizeClients): Add new assertion. * tests/select_test.c (verify_sample_text): (verify_sample_text_multiple): Fix typos. --- seat.c | 50 ++++++++++++++++++++++----------------------- subcompositor.c | 6 +++--- tests/select_test.c | 4 ++-- xerror.c | 2 ++ 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/seat.c b/seat.c index 7889d63..a5f281b 100644 --- a/seat.c +++ b/seat.c @@ -3622,35 +3622,35 @@ DispatchEntryExit (Subcompositor *subcompositor, XIEnterEvent *event) if (!seat) return; - if (event->mode != XINotifyGrab - && event->mode != XINotifyUngrab) + /* Set the last seen subcompositor, or clear it on XI_Leave. The + last seen subcompositor is used to determine the surface to which + a grab will be released. + + All entry and exit events must be respected here, including those + resulting from grabs! Otherwise, if some other client has + grabbed the pointer, last_seen_subcompositor will not be kept up + to date. */ + + if (event->evtype == XI_Leave + || subcompositor != seat->last_seen_subcompositor) { - /* This is not an event generated by grab activation or - deactivation. Set the last seen subcompositor, or clear it - on XI_Leave. The last seen subcompositor is used to - determine the surface to which a grab will be released. */ + if (seat->last_seen_subcompositor) + SubcompositorRemoveDestroyCallback (seat->subcompositor_callback); - if (event->evtype == XI_Leave - || subcompositor != seat->last_seen_subcompositor) + seat->last_seen_subcompositor = NULL; + seat->subcompositor_callback = NULL; + + if (event->evtype == XI_Enter) { - if (seat->last_seen_subcompositor) - SubcompositorRemoveDestroyCallback (seat->subcompositor_callback); + /* Attach the new subcompositor. */ + seat->last_seen_subcompositor = subcompositor; + seat->subcompositor_callback + = SubcompositorOnDestroy (subcompositor, + HandleSubcompositorDestroy, + seat); - seat->last_seen_subcompositor = NULL; - seat->subcompositor_callback = NULL; - - if (event->evtype == XI_Enter) - { - /* Attach the new subcompositor. */ - seat->last_seen_subcompositor = subcompositor; - seat->subcompositor_callback - = SubcompositorOnDestroy (subcompositor, - HandleSubcompositorDestroy, - seat); - - /* Also set the window used. */ - seat->last_seen_subcompositor_window = event->event; - } + /* Also set the window used. */ + seat->last_seen_subcompositor_window = event->event; } } diff --git a/subcompositor.c b/subcompositor.c index 3034ba6..e639de8 100644 --- a/subcompositor.c +++ b/subcompositor.c @@ -2852,11 +2852,11 @@ SubcompositorComposite1 (Subcompositor *subcompositor, } /* This goes down the XCopyArea code path, unless presentation - happened, in which case it does nothing. */ + happened, in which case it does nothing. No key must be + returned, as the given callback is NULL. */ pixman_region32_translate (damage, -subcompositor->min_x, -subcompositor->min_y); - key = RenderFinishRender (subcompositor->target, ©, NULL, - NULL); + RenderFinishRender (subcompositor->target, ©, NULL, NULL); pixman_region32_fini (©); } diff --git a/tests/select_test.c b/tests/select_test.c index 0133b56..8389b26 100644 --- a/tests/select_test.c +++ b/tests/select_test.c @@ -198,7 +198,7 @@ verify_sample_text (Time time) die ("pipe"); display_string = DisplayString (display->x_display); - time = sprintf (time_buffer, "%lu", time); + sprintf (time_buffer, "%lu", time); pid = fork (); if (pid == -1) @@ -264,7 +264,7 @@ verify_sample_text_multiple (Time time) die ("pipe"); display_string = DisplayString (display->x_display); - time = sprintf (time_buffer, "%lu", time); + sprintf (time_buffer, "%lu", time); pid = fork (); if (pid == -1) diff --git a/xerror.c b/xerror.c index aad5c4c..85d6a80 100644 --- a/xerror.c +++ b/xerror.c @@ -229,6 +229,8 @@ CategorizeClients (struct wl_list *client_list, clients[i - 1] = client; } } + + XLAssert (i == wl_list_length (client_list)); } static void