[KDE/Mac] Fixing graphics problems in KDE/Qt on Apple OS X
nicos at macports.org
Sat Apr 26 11:57:21 UTC 2014
Thanks for the impressively detailed discussion. I do not intend to discuss the details of the
graphical approaches as I am essentially ignorant about them, but more on the way of introducing
this change in practice.
> I found I could force it to switch in one of three ways :
> 1. Put --args -graphicssystem raster on the "open" command-line.
> 2. Define environment variable QT_GRAPHICSSYSTEM=raster,
> either by exporting it or by prepending it to the command line.
> 3. Execute QApplication::setGraphicsSystem("raster") in the app's
> code before the QApplication object is constructed.
> I think either of 1 or 2 could be made part of MacPorts installations of
> all KDE apps and maybe also Qt apps.
> So can we proceed with method 1 or 2 in MacPorts as soon as possible?
Indeed method 3 seems overkill, as patching is usually not the preferred option.
However, I see some possible complications with approaches 1 and 2. To my
understanding, they both imply launching applications from the command line, which
is not the usual way on Mac, with most KDE applications being shipped as Mac application
So, method 1 would not work, unless the whole process of application bundle generation
is modified, which seems rather drastic. It would require to create wrapper bundles in which
a specific bash command is prepared to launch the application with the desired arguments.
Similarly method 2 would be in the same situation, as application bundles blatantly ignore
all environment variables set the “normal” way through a .bash_profile, for example. And
while Macports can create its own build environment, it does not set anything at runtime
(I imagine Homebrew is the same, even though I don’t really know).
Method 2 could eventually be automated by setting an environment variable for bundle
applications, but this approach has been pretty unreliable to my experience.
One way is to globally set variables in the file ~/.MacOSX/environment.plist, but this
global approach would be up to the user, and is not supported from 10.7.
There is also the possibility of assigning application-specific variables in the Info.plist
file of bundles, through the LSEnvironment key. This approach could be used by automatically
patching the Info.plist of KDE applications, but I don’t know how well it is supported (I remember
cases with previous OSs where it did not seem to work for me). I made a dummy Cocoa
application on 10.9, where it seems to work, but I don’t know if it is also a valid approach for
More information about the kde-mac