mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 17:52:02 +02:00
macOS: Relayout layer shell windows on screen size change
This commit is contained in:
@@ -1621,6 +1621,12 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
|
|||||||
|
|
||||||
@implementation GLFWWindow
|
@implementation GLFWWindow
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_screen_size_change(_GLFWwindow *window, NSNotification *notification UNUSED) {
|
||||||
|
if (!window || !window->ns.layer_shell.is_active) return;
|
||||||
|
_glfwPlatformSetLayerShellConfig(window, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
- (instancetype)initWithGlfwWindow:(NSRect)contentRect
|
- (instancetype)initWithGlfwWindow:(NSRect)contentRect
|
||||||
styleMask:(NSWindowStyleMask)style
|
styleMask:(NSWindowStyleMask)style
|
||||||
backing:(NSBackingStoreType)backingStoreType
|
backing:(NSBackingStoreType)backingStoreType
|
||||||
@@ -1630,6 +1636,13 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
|
|||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
glfw_window = initWindow;
|
glfw_window = initWindow;
|
||||||
self.tabbingMode = NSWindowTabbingModeDisallowed;
|
self.tabbingMode = NSWindowTabbingModeDisallowed;
|
||||||
|
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||||
|
[center addObserverForName:NSApplicationDidChangeScreenParametersNotification
|
||||||
|
object:nil
|
||||||
|
queue:[NSOperationQueue mainQueue]
|
||||||
|
usingBlock:^(NSNotification * _Nonnull notification) {
|
||||||
|
handle_screen_size_change(glfw_window, notification);
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -1637,6 +1650,7 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
|
|||||||
- (void) removeGLFWWindow
|
- (void) removeGLFWWindow
|
||||||
{
|
{
|
||||||
glfw_window = NULL;
|
glfw_window = NULL;
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)validateMenuItem:(NSMenuItem *)item {
|
- (BOOL)validateMenuItem:(NSMenuItem *)item {
|
||||||
|
|||||||
Reference in New Issue
Block a user