]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: remove server->last_raised_view
authortokyo4j <hrak1529@gmail.com>
Wed, 19 Mar 2025 00:54:20 +0000 (09:54 +0900)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Tue, 1 Apr 2025 07:48:40 +0000 (16:48 +0900)
We were skipping in view_move_to_front() if the raised view is already
cached as server->last_raised_view. But this was prone to bugs that
windows cannot be raised even though they are actually not placed at the
top in the scene.

This happened when a window is mapped but view_move_to_front() is not
called in view_impl_map() for some reason. Example cases were:
- a window is minimized before being mapped (#2627)
- a window is mapped while window switcher is active (#2629)

Also, this problem was the root cause of #1640 and #2582, though they are
already fixed.

Therefore, this commit removes server->last_raised_view. In order to
eliminate unnecessary communications between labwc and xwayland (ref:
db591d1), I'll introduce another caching mechanism in the next commit.

include/labwc.h
src/view-impl-common.c
src/view.c

index 16df6adf114061ace330703bb29b4ba5df25b2cf..6fe53fb6e50dd4ef899c9fea0ef0180516637038 100644 (file)
@@ -292,11 +292,6 @@ struct server {
         * Note that active_view is synced with foreign-toplevel clients.
         */
        struct view *active_view;
-       /*
-        * Most recently raised view. Used to avoid unnecessarily
-        * raising the same view over and over.
-        */
-       struct view *last_raised_view;
 
        struct ssd_hover_state *ssd_hover_state;
 
index 0731122fef13d676f1f886a27f06bac2782a5b5c..79502f91a6c7c2de2900887fb726fbcbb21eac04 100644 (file)
@@ -66,9 +66,6 @@ view_impl_unmap(struct view *view)
        if (view == server->active_view) {
                desktop_focus_topmost_view(server);
        }
-       if (view == server->last_raised_view) {
-               server->last_raised_view = NULL;
-       }
 }
 
 static bool
index f50412624c06fb27624a7c6e99487667637bedd3..ca3397fb05879c2cbbcfa6edfe1d9f1c170b002e 100644 (file)
@@ -2251,7 +2251,6 @@ move_to_front(struct view *view)
        if (view->impl->move_to_front) {
                view->impl->move_to_front(view);
        }
-       view->server->last_raised_view = view;
 }
 
 static void
@@ -2260,9 +2259,6 @@ move_to_back(struct view *view)
        if (view->impl->move_to_back) {
                view->impl->move_to_back(view);
        }
-       if (view == view->server->last_raised_view) {
-               view->server->last_raised_view = NULL;
-       }
 }
 
 /*
@@ -2275,16 +2271,6 @@ void
 view_move_to_front(struct view *view)
 {
        assert(view);
-       /*
-        * This function is called often, generally on every mouse
-        * button press (more often for focus-follows-mouse). Avoid
-        * unnecessarily raising the same view over and over, or
-        * attempting to raise a root view above its own sub-view.
-        */
-       struct view *last = view->server->last_raised_view;
-       if (view == last || (last && view == view_get_root(last))) {
-               return;
-       }
 
        struct view *root = view_get_root(view);
        assert(root);
@@ -2539,10 +2525,6 @@ view_destroy(struct view *view)
                server->session_lock_manager->last_active_view = NULL;
        }
 
-       if (server->last_raised_view == view) {
-               server->last_raised_view = NULL;
-       }
-
        if (server->seat.pressed.view == view) {
                seat_reset_pressed(&server->seat);
        }