Skip to content

Truly independent web browser

UI/Qt: Restore sidebar hover after tab layout changes on macOS

Timothy Flynnf1da2b1bf5a6
diff --git a/UI/Qt/MacWindow.mm b/UI/Qt/MacWindow.mm
index eb207f98239..e6f6d5bf737 100644
--- a/UI/Qt/MacWindow.mm
+++ b/UI/Qt/MacWindow.mm
@@ -525,9 +525,12 @@ void ensure_appkit_window_is_exposed(QWidget& widget)
if (!widget.isVisible() || !window || window->isExposed())
return;
- // Qt restores a native view's exposed state from its display callback. A view whose backing layer is already
- // clean can remain unexposed after being shown or raised, causing Qt to route hover events to the view below it.
- [reinterpret_cast<NSView*>(widget.winId()) setNeedsDisplay:YES];
+ // Qt restores a native view's exposed state from its content layer's display callback. A view whose backing layer
+ // is already clean can remain unexposed after being shown or raised, causing Qt to route hover events below it.
+ // Display the content layer directly: marking the NSView as needing display can leave that callback uncalled.
+ auto* layer = static_cast<CALayer*>(appkit_content_layer(widget));
+ [layer setNeedsDisplay];
+ [layer displayIfNeeded];
}
void set_appkit_window_content_aspect_ratio(QWidget& widget, Gfx::IntSize aspect_ratio)
diff --git a/UI/Qt/TabBar.cpp b/UI/Qt/TabBar.cpp
index cce834d2553..8b78a04a288 100644
--- a/UI/Qt/TabBar.cpp
+++ b/UI/Qt/TabBar.cpp
@@ -5302,6 +5302,10 @@ void TabWidget::update_vertical_tabs_overlay_geometry()
m_vertical_tab_bar_column->setGeometry(vertical_tabs_chrome_rect());
m_vertical_tab_bar_column->show();
m_vertical_tab_bar_column->raise();
+
+#if defined(AK_OS_MACOS)
+ ensure_appkit_window_is_exposed(*m_vertical_tab_bar_column);
+#endif
}
void TabWidget::set_vertical_tabs_hover_expanded(bool expanded)
diff --git a/UI/Qt/WindowToolbar.cpp b/UI/Qt/WindowToolbar.cpp
index 9a82e26d7bd..4d59274c060 100644
--- a/UI/Qt/WindowToolbar.cpp
+++ b/UI/Qt/WindowToolbar.cpp
@@ -1479,6 +1479,10 @@ void WindowToolbar::raise_field_panel()
QEvent z_order_change(QEvent::ZOrderChange);
QCoreApplication::sendEvent(m_field_panel, &z_order_change);
}
+
+#if defined(AK_OS_MACOS)
+ ensure_appkit_window_is_exposed(*m_field_panel);
+#endif
}
void WindowToolbar::update_field_panel()