fix: CSD window frame tiles properly on Wayland (#48836)
fix: CSD window frame tiles properly on Linux Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Mitchell Cohen <mitch.cohen@me.com>
This commit is contained in:
parent
3d5f13a44a
commit
a924f1a629
2 changed files with 22 additions and 8 deletions
|
|
@ -100,13 +100,19 @@ void ElectronDesktopWindowTreeHostLinux::OnWindowStateChanged(
|
|||
void ElectronDesktopWindowTreeHostLinux::OnWindowTiledStateChanged(
|
||||
ui::WindowTiledEdges new_tiled_edges) {
|
||||
if (auto* const view = native_window_view_->GetClientFrameViewLinux()) {
|
||||
bool maximized = new_tiled_edges.top && new_tiled_edges.left &&
|
||||
new_tiled_edges.bottom && new_tiled_edges.right;
|
||||
// GNOME on Ubuntu reports all edges as tiled
|
||||
// even if the window is only half-tiled so do not trust individual edge
|
||||
// values.
|
||||
bool maximized = native_window_view_->IsMaximized();
|
||||
bool tiled = new_tiled_edges.top || new_tiled_edges.left ||
|
||||
new_tiled_edges.bottom || new_tiled_edges.right;
|
||||
view->set_tiled(tiled && !maximized);
|
||||
}
|
||||
UpdateFrameHints();
|
||||
ScheduleRelayout();
|
||||
if (GetWidget()->non_client_view()) {
|
||||
GetWidget()->non_client_view()->SchedulePaint();
|
||||
}
|
||||
}
|
||||
|
||||
void ElectronDesktopWindowTreeHostLinux::UpdateWindowState(
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ namespace {
|
|||
|
||||
// These values should be the same as Chromium uses.
|
||||
constexpr int kResizeBorder = 10;
|
||||
constexpr int kResizeInsideBoundsSize = 5;
|
||||
|
||||
ui::NavButtonProvider::ButtonState ButtonStateToNavButtonProviderState(
|
||||
views::Button::ButtonState state) {
|
||||
|
|
@ -151,8 +150,19 @@ gfx::Insets ClientFrameViewLinux::RestoredMirroredFrameBorderInsets() const {
|
|||
|
||||
gfx::Insets ClientFrameViewLinux::RestoredFrameBorderInsets() const {
|
||||
gfx::Insets insets = GetFrameProvider()->GetFrameThicknessDip();
|
||||
insets.SetToMax(GetInputInsets());
|
||||
return insets;
|
||||
const gfx::Insets input = GetInputInsets();
|
||||
|
||||
auto expand_if_visible = [](int side_thickness, int min_band) {
|
||||
return side_thickness > 0 ? std::max(side_thickness, min_band) : 0;
|
||||
};
|
||||
|
||||
gfx::Insets merged;
|
||||
merged.set_top(expand_if_visible(insets.top(), input.top()));
|
||||
merged.set_left(expand_if_visible(insets.left(), input.left()));
|
||||
merged.set_bottom(expand_if_visible(insets.bottom(), input.bottom()));
|
||||
merged.set_right(expand_if_visible(insets.right(), input.right()));
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
gfx::Insets ClientFrameViewLinux::GetInputInsets() const {
|
||||
|
|
@ -197,9 +207,7 @@ void ClientFrameViewLinux::OnWindowButtonOrderingChange() {
|
|||
}
|
||||
|
||||
int ClientFrameViewLinux::ResizingBorderHitTest(const gfx::Point& point) {
|
||||
return ResizingBorderHitTestImpl(point,
|
||||
RestoredMirroredFrameBorderInsets() +
|
||||
gfx::Insets(kResizeInsideBoundsSize));
|
||||
return ResizingBorderHitTestImpl(point, RestoredMirroredFrameBorderInsets());
|
||||
}
|
||||
|
||||
gfx::Rect ClientFrameViewLinux::GetBoundsForClientView() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue