Skip to content

Commit

Permalink
Reduced lag when hardware acceleration is turned on
Browse files Browse the repository at this point in the history
This essentially disabled vsync, though with composited window managers
there should not be visible tearing anyway. It does seem to affect
animation timing as well though, which affects scrolling with arrow keys.

Related to issue mapeditor#3584
  • Loading branch information
bjorn committed Feb 24, 2023
1 parent 86652aa commit 1c4a269
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/tiledapp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@

#include "commandlineparser.h"
#include "exporthelper.h"
#include "languagemanager.h"
#include "logginginterface.h"
#include "mainwindow.h"
#include "mapdocument.h"
#include "mapformat.h"
#include "mapreader.h"
#include "pluginmanager.h"
#include "preferences.h"
#include "scriptmanager.h"
#ifdef TILED_SENTRY
#include "sentryhelper.h"
#endif
#include "tiledapplication.h"
#include "tileset.h"
#include "tmxmapformat.h"
Expand All @@ -40,6 +39,7 @@
#include <QFileInfo>
#include <QJsonArray>
#include <QJsonDocument>
#include <QSurfaceFormat>
#include <QtPlugin>

#include "qtcompat_p.h"
Expand Down Expand Up @@ -571,6 +571,11 @@ int main(int argc, char *argv[])

Session::initialize();

// Disable vsync to make hardware accelerated mode more responsive
QSurfaceFormat format;
format.setSwapInterval(0);
QSurfaceFormat::setDefaultFormat(format);

MainWindow w;
w.show();

Expand Down

0 comments on commit 1c4a269

Please sign in to comment.