Although it had HIRO_GTK==3 sections, hiro/gtk/monitor.cpp was actually using
deprecated GTK+2 APIs on GTK3, and the GTK3 code was broken and wouldn't
compile.
I didn't realize that some of the Qt deprecations were already fixed in
ares. In this case, the change was handled a bit differently, always
considering the y component of scrolling even when the scroll operation
is mostly horizontal. This should work just fine, so we may as well just
adopt that behavior, especially since bsnes doesn't even currently use a
HexEdit.
Backported from ares from:
ffe97222a1
Co-authored-by: Stefan Schlosser <bsdcode@disroot.org>
There are a handful of spots in hiro/qt where methods override Qt
virtual methods, but they are not declared as such.
These are backported from ares from:
960d8a8dcb
Co-authored-by: Near <77224854+near-san@users.noreply.github.com>
The `linear` parameter to `image::scale` is a boolean, not an
enumeration.
This is a back port from ares:
960d8a8dcb
Also, remove the blob of commented code. This was removed in ares v117.
Co-authored-by: Near <77224854+near-san@users.noreply.github.com>
With Qt 6 maybe it is possible to finally start cleaning that issue up
in the first place, but for now it's probably better for bsnes and ares
to align closer.
This is backported from the following ares commits:
0d131bf4d8960d8a8dcb
Co-authored-by: Near <77224854+near-san@users.noreply.github.com>
Co-authored-by: invertego <invertego@users.noreply.github.com>
Some of the work I'd done was duplicating existing work. Let's unify to
get the best of both works.
This mostly comes from:
ffe97222a1
Co-authored-by: Stefan Schlosser <bsdcode@disroot.org>
The desired size was probably the boundingRect width and not the advance
width, so the fix from bsdcode is better than mine.
This is backported from ares:
ffe97222a1
Co-authored-by: Stefan Schlosser <bsdcode@disroot.org>
- Call XInitThreads at initialization
- Remove spaces from screensaver window name
- Restore LC_NUMERIC after Qt clobbers it
This is sourced from ares v116r07, and:
6cd4470562
Co-authored-by: Near <77224854+near-san@users.noreply.github.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Qt 6 no longer allows us to poll for the status of the event loop.
However, Qt 6 does still have a processEvents function, and the version
with the timeout actually spins the event loop and returns as early as
there are no more events in it. That's basically what we want to do. We
could run this with a really huge timeout, but that would just make it
more likely that hiro freezes up, so instead let's mirror hiro/gtk3 and
use a 50ms timeout.
This does not seem to be used anywhere in bsnes, higan or ares. It's not
really possible to implement with Qt 6, which has stop exposing this
detail of the event loop. It turns out this is actually OK, since we
don't *really* need it anyway, and in the case of hiro/qt, the
replacement should be more robust anyways.
Qt 5 introduces QScreen, which can be used to implement most of the
functionality needed by Monitor, although some of it probably won't make
sense when using Wayland.
The orientation() and delta() methods of QWheelEvent were deprecated in
Qt 5.0 in favor of angleDelta(), which expresses higher-fidelity data
for devices like trackpads. In order to keep the behavior 100%
identical, the code used to calculate the orientation() and delta()
values in Qt 5.15 is inlined instead. That logic can be seen here:
https://github.com/qt/qtbase/blob/v5.15.17-lts-lgpl/src/gui/kernel/qevent.cpp#L876-L884
Following this logic, we also break the tie for orientation in favor of
vertical scrolling.
Since there is no actual HexEdit usage in bsnes, I tested it by putting
a dummy HexEdit widget inside the bsnes Presentation window. Scrolling
seemed to work as expected.
QFontMetrics::width was deprecated in Qt 5.11 in favor of Qt
QFontMetrics::horizontalAdvance. Because QFontMetrics::horizontalAdvance
was introduced in Qt 5.11, it poses the most risk of breaking an
existing user of almost any of the deprecation changes, but Qt 5.11 is
fairly old by now (2018) and has been EOL for a while, so I still opted
to just move to the new function rather than use a version guard.
Qt 5.0 adds the QScreen API, which exposes enough information that
Desktop::{size,workspace} no longer needs to fall back to Win32/Xlib. I
manually tested that this seems to give the same exact answers as the
Xlib path (though it technically goes a different route for
Desktop::size.)
Qt 4.8 LTS was released on December 15th, 2011. It hit its official
end-of-life on December 31st, 2015. It has been dead for nearly 10
years. Qt 4 is now so old, that it has been removed from Debian long
enough that "qt4" doesn't show up in *any* of the indexed package suites
in Debian's online package search service.
With that in mind, I think we can safely say nobody is using this,
nobody will miss this, and it is beyond time to get rid of it (and
probably add Qt 6 support some day.)