mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-14 15:53:14 +00:00
Cocoa metal layers need their size updated before renderer updates
Also refactored event watch code so it can be shared between internal window event dispatch and public event watchers. Fixes https://github.com/libsdl-org/SDL/issues/12376
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
*/
|
||||
#include "SDL_internal.h"
|
||||
|
||||
#include "../../events/SDL_windowevents_c.h"
|
||||
|
||||
#import "SDL_cocoametalview.h"
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_COCOA) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL))
|
||||
@@ -88,7 +90,7 @@ static bool SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
|
||||
|
||||
self.layer.opaque = opaque;
|
||||
|
||||
SDL_AddEventWatch(SDL_MetalViewEventWatch, (__bridge void *)(self));
|
||||
SDL_AddWindowEventWatch(SDL_WINDOW_EVENT_WATCH_EARLY, SDL_MetalViewEventWatch, (__bridge void *)(self));
|
||||
|
||||
[self updateDrawableSize];
|
||||
}
|
||||
@@ -98,7 +100,7 @@ static bool SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
SDL_RemoveEventWatch(SDL_MetalViewEventWatch, (__bridge void *)(self));
|
||||
SDL_RemoveWindowEventWatch(SDL_WINDOW_EVENT_WATCH_EARLY, SDL_MetalViewEventWatch, (__bridge void *)(self));
|
||||
}
|
||||
|
||||
- (NSInteger)tag
|
||||
|
||||
Reference in New Issue
Block a user