Skip to content

[Qt] Screenshots and Linux Wayland behavior (discussion) #832

@ClusterM

Description

@ClusterM

I recently started using Linux on my desktop, so naturally I am trying to switch to the Qt6 version of FCEUX.

I noticed that taking screenshots does not work, and there is not even an error message. After some investigation, I found that the problem is in this line:

image = screen->grabWindow( viewport_GL->winId() );

On Wayland, QScreen::grabWindow(WId window) is built around a display-server model where each top-level (or otherwise identifiable) window has a native window ID that the compositor can use to read back pixels (for example, X11 window IDs). This does not work the same way on Wayland. Moreover, the result is not checked at all, so FCEUX still reports that the screenshot was successfully taken.

For now, I made a temporary and very hacky workaround: on Wayland I simply call the old SaveSnapshot() instead.

But my main question is not even how to adapt this to Wayland.

Why does the Qt version take screenshots of what is currently displayed in the window at all?

FCEUX used to call FCEUI_SaveSnapshot(), which saves the image directly from the emulator framebuffer. In fact, that code is still there, just commented out:

//void consoleWin_t::takeScreenShot(void)
//{
//	FCEU_WRAPPER_LOCK();
//	FCEUI_SaveSnapshot();
//	FCEU_WRAPPER_UNLOCK();
//}

Isn't that approach better? @mjbudd77 ?

Why was this behavior changed? So that screenshots include all visual filters? To me, it makes more sense to capture the original image instead. If someone wants a screenshot with filters applied, they can use any generic screenshot tool. FCEUX feels more like a tool than just a gaming emulator.

For example, right now I need a pixel-perfect screenshot so I can process the image further afterward. And besides that, it would be better to keep the same screenshot logic across all platforms.

I would suggest restoring the old behavior with FCEUI_SaveSnapshot(). I would be glad to hear the reasoning for the current implementation.

Metadata

Metadata

Assignees

Labels

QtSDLBug applies to Qt/SDL portbugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions