qt: Fix paintEvent not being called until window resize on macOS. (#25)
* qt: Remove need for AppleSurfaceHelper. * qt: Fix paintEvent not being called until window resize on macOS.
This commit is contained in:
@@ -250,8 +250,6 @@ if (APPLE)
|
||||
set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE TRUE)
|
||||
set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
target_sources(citra-qt PRIVATE
|
||||
applesurfacehelper.h
|
||||
applesurfacehelper.mm
|
||||
macos_authorization.h
|
||||
macos_authorization.mm
|
||||
)
|
||||
|
@@ -1,11 +0,0 @@
|
||||
// Copyright 2022 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AppleSurfaceHelper {
|
||||
|
||||
void* GetSurfaceLayer(void* surface);
|
||||
|
||||
} // namespace AppleSurfaceHelper
|
@@ -1,16 +0,0 @@
|
||||
// Copyright 2022 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "citra_qt/applesurfacehelper.h"
|
||||
|
||||
namespace AppleSurfaceHelper {
|
||||
|
||||
void* GetSurfaceLayer(void* surface) {
|
||||
NSView* view = static_cast<NSView*>(surface);
|
||||
return view.layer;
|
||||
}
|
||||
|
||||
} // namespace AppleSurfaceHelper
|
@@ -25,7 +25,8 @@
|
||||
#include "video_core/video_core.h"
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include "citra_qt/applesurfacehelper.h"
|
||||
#include <objc/message.h>
|
||||
#include <objc/objc.h>
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32)
|
||||
@@ -351,22 +352,26 @@ static Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* window
|
||||
Frontend::EmuWindow::WindowSystemInfo wsi;
|
||||
wsi.type = GetWindowSystemType();
|
||||
|
||||
// Our Win32 Qt external doesn't have the private API.
|
||||
if (window) {
|
||||
#if defined(WIN32)
|
||||
wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr;
|
||||
// Our Win32 Qt external doesn't have the private API.
|
||||
wsi.render_surface = reinterpret_cast<void*>(window->winId());
|
||||
#elif defined(__APPLE__)
|
||||
wsi.render_surface =
|
||||
window ? AppleSurfaceHelper::GetSurfaceLayer(reinterpret_cast<void*>(window->winId()))
|
||||
: nullptr;
|
||||
wsi.render_surface = reinterpret_cast<void* (*)(id, SEL)>(objc_msgSend)(
|
||||
reinterpret_cast<id>(window->winId()), sel_registerName("layer"));
|
||||
#else
|
||||
QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface();
|
||||
wsi.display_connection = pni->nativeResourceForWindow("display", window);
|
||||
if (wsi.type == Frontend::WindowSystemType::Wayland)
|
||||
wsi.render_surface = window ? pni->nativeResourceForWindow("surface", window) : nullptr;
|
||||
else
|
||||
wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr;
|
||||
QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface();
|
||||
wsi.display_connection = pni->nativeResourceForWindow("display", window);
|
||||
if (wsi.type == Frontend::WindowSystemType::Wayland)
|
||||
wsi.render_surface = pni->nativeResourceForWindow("surface", window);
|
||||
else
|
||||
wsi.render_surface = reinterpret_cast<void*>(window->winId());
|
||||
#endif
|
||||
wsi.render_surface_scale = window ? static_cast<float>(window->devicePixelRatio()) : 1.0f;
|
||||
wsi.render_surface_scale = static_cast<float>(window->devicePixelRatio());
|
||||
} else {
|
||||
wsi.render_surface = nullptr;
|
||||
wsi.render_surface_scale = 1.0f;
|
||||
}
|
||||
|
||||
return wsi;
|
||||
}
|
||||
|
@@ -1184,10 +1184,6 @@ void GMainWindow::BootGame(const QString& filename) {
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
// show and hide the render_window to create the context
|
||||
render_window->show();
|
||||
render_window->hide();
|
||||
|
||||
loading_screen->Prepare(Core::System::GetInstance().GetAppLoader());
|
||||
loading_screen->show();
|
||||
|
||||
|
Reference in New Issue
Block a user