MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / createDisplayWidget

Method createDisplayWidget

pcsx2-qt/MainWindow.cpp:2834–2919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2832}
2833
2834void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main)
2835{
2836 // If we're rendering to main and were hidden (e.g. coming back from fullscreen),
2837 // make sure we're visible before trying to add ourselves. Otherwise Wayland breaks.
2838 if (!fullscreen && render_to_main && !isVisible())
2839 {
2840 setVisible(true);
2841 QGuiApplication::sync();
2842 }
2843
2844 m_display_surface = new DisplaySurface();
2845 if (fullscreen || !render_to_main)
2846 {
2847#ifdef DISPLAY_SURFACE_WINDOW
2848 m_display_surface->setTitle(windowTitle());
2849 m_display_surface->setIcon(windowIcon());
2850#else
2851 m_display_container = m_display_surface->createWindowContainer();
2852 m_display_container->setWindowTitle(windowTitle());
2853 m_display_container->setWindowIcon(windowIcon());
2854#endif
2855 }
2856 else
2857 {
2858 m_display_container = m_display_surface->createWindowContainer(getContentParent());
2859 }
2860
2861 if (fullscreen || g_emu_thread->isExclusiveFullscreen())
2862 {
2863 // On Wayland, while move/restoreGeometry can't position the window, it can influence which screen they show up on.
2864 // Other platforms can position windows fine, but the only thing that matters here is the screen.
2865
2866#ifdef DISPLAY_SURFACE_WINDOW
2867 if (isVisible() && g_emu_thread->shouldRenderToMain())
2868 m_display_surface->setGeometry(screen()->geometry());
2869 else
2870 restoreDisplayWindowGeometryFromConfig();
2871
2872 if (fullscreen)
2873 m_display_surface->showFullScreen();
2874 else
2875 m_display_surface->showNormal();
2876#else
2877 if (isVisible() && g_emu_thread->shouldRenderToMain())
2878 m_display_container->move(screen()->availableGeometry().topLeft());
2879 else
2880 restoreDisplayWindowGeometryFromConfig();
2881
2882 if (fullscreen)
2883 m_display_container->showFullScreen();
2884 else
2885 m_display_container->showNormal();
2886#endif
2887 }
2888 else if (!render_to_main)
2889 {
2890#ifdef DISPLAY_SURFACE_WINDOW
2891 if (m_is_temporarily_windowed && g_emu_thread->shouldRenderToMain())

Callers

nothing calls this directly

Calls 8

createWindowContainerMethod · 0.80
setWindowTitleMethod · 0.80
isExclusiveFullscreenMethod · 0.80
shouldRenderToMainMethod · 0.80
setGeometryMethod · 0.80
moveMethod · 0.80
addWidgetMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected