mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-12 01:26:03 +01:00
c83b3cda24
This is intended for usage with frameless windows that show the standard window buttons, where resizing the title bar height changes the button offset. Returning a different value from CefWindowDelegate::GetTitlebarHeight and forcing a resize of the NSWindow's theme frame (see ViewsWindow::NudgeWindow) will update the title bar height. To test: 1. Run `cefclient --use-views --hide-frame --show-window-buttons --url=http://tests/window` 2. Enter a new value for title bar height and click the "Set Titlebar Height" button
25 lines
728 B
Plaintext
25 lines
728 B
Plaintext
// Copyright (c) 2023 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
// can be found in the LICENSE file.
|
|
|
|
#include "tests/cefclient/browser/views_window.h"
|
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
namespace client {
|
|
|
|
void ViewsWindow::NudgeWindow() {
|
|
if (window_) {
|
|
auto view = CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(window_->GetWindowHandle());
|
|
NSWindow* main_window = view.window;
|
|
|
|
auto theme_frame = main_window.contentView.superview;
|
|
// Nudge view frame a little to force an update.
|
|
NSSize size = theme_frame.frame.size;
|
|
[theme_frame setFrameSize:NSMakeSize(size.width - 1, size.height)];
|
|
[theme_frame setFrameSize:size];
|
|
}
|
|
}
|
|
|
|
}
|