File: chooserastergraphicssystem.cpp

package info (click to toggle)
libkdegames-kde4 4%3A14.12.3-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 36,372 kB
  • ctags: 2,337
  • sloc: cpp: 16,003; perl: 5,276; sh: 58; makefile: 3
file content (47 lines) | stat: -rw-r--r-- 2,433 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/***************************************************************************
 *   Copyright 2011 Stefan Majewsky <majewsky@gmx.net>                     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License          *
 *   version 2 as published by the Free Software Foundation                *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU Library General Public License for more details.                  *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#include <QtGui/QApplication>

/*
 * This file is only compiled on Q_WS_X11 (see CMakeLists.txt). It chooses the
 * raster graphicssystem in anything linking against libkdegames.
 *
 * The raster graphicssystem has a much better performance in graphics-intense
 * apps like games, compared to the X11 graphicssystem which is still the
 * default in Qt 4.7. (Rumor has it that raster will become the default as of Qt
 * 4.8.)
 *
 * This header ensures that raster is always used instead of X11 to enable a
 * more fluent graphics experience. The relevant API call
 * (QApplication::setGraphicsSystem) needs to be issued *before* the
 * application object (QApplication or KApplication) is constructed, so we do it
 * in a constructor of an anonymous global object.
 *
 * Constructors of global objects are called before main() by the C++ runtime.
 */

namespace { //don't export this struct and instance, it's internal affairs
	struct ConfigureDefaultGraphicsSystem
	{
		ConfigureDefaultGraphicsSystem() {
			QApplication::setGraphicsSystem(QLatin1String("raster"));
		}
	};
	ConfigureDefaultGraphicsSystem staticObject;
}