Changeset View
Changeset View
Standalone View
Standalone View
krfb/main.cpp
Show All 33 Lines | |||||
34 | #include <signal.h> | 34 | #include <signal.h> | ||
35 | #include <X11/extensions/XTest.h> | 35 | #include <X11/extensions/XTest.h> | ||
36 | #include <QCommandLineParser> | 36 | #include <QCommandLineParser> | ||
37 | #include <QCommandLineOption> | 37 | #include <QCommandLineOption> | ||
38 | 38 | | |||
39 | 39 | | |||
40 | static const char description[] = I18N_NOOP("VNC-compatible server to share " | 40 | static const char description[] = I18N_NOOP("VNC-compatible server to share " | ||
41 | "desktops"); | 41 | "desktops"); | ||
42 | | ||||
43 | static bool checkX11Capabilities() | 42 | static bool checkX11Capabilities() | ||
44 | { | 43 | { | ||
45 | int bp1, bp2, majorv, minorv; | 44 | int bp1, bp2, majorv, minorv; | ||
46 | Bool r = XTestQueryExtension(QX11Info::display(), &bp1, &bp2, | 45 | Bool r = XTestQueryExtension(QX11Info::display(), &bp1, &bp2, | ||
47 | &majorv, &minorv); | 46 | &majorv, &minorv); | ||
48 | 47 | | |||
49 | if ((!r) || (((majorv * 1000) + minorv) < 2002)) { | 48 | if ((!r) || (((majorv * 1000) + minorv) < 2002)) { | ||
50 | KMessageBox::error(nullptr, | 49 | KMessageBox::error(nullptr, | ||
51 | i18n("Your X11 Server does not support the required XTest extension " | 50 | i18n("Your X11 Server does not support the required XTest extension " | ||
52 | "version 2.2. Sharing your desktop is not possible."), | 51 | "version 2.2. Sharing your desktop is not possible."), | ||
53 | i18n("Desktop Sharing Error")); | 52 | i18n("Desktop Sharing Error")); | ||
54 | return false; | 53 | return false; | ||
55 | } | 54 | } | ||
56 | 55 | | |||
57 | return true; | 56 | return true; | ||
58 | } | 57 | } | ||
59 | 58 | | |||
60 | | ||||
61 | static void checkOldX11PluginConfig() { | 59 | static void checkOldX11PluginConfig() { | ||
62 | if (KrfbConfig::preferredFrameBufferPlugin() == QStringLiteral("x11")) { | 60 | if (KrfbConfig::preferredFrameBufferPlugin() == QStringLiteral("x11")) { | ||
63 | qDebug() << "Detected deprecated configuration: preferredFrameBufferPlugin = x11"; | 61 | qDebug() << "Detected deprecated configuration: preferredFrameBufferPlugin = x11"; | ||
64 | KConfigSkeletonItem *config_item = KrfbConfig::self()->findItem( | 62 | KConfigSkeletonItem *config_item = KrfbConfig::self()->findItem( | ||
65 | QStringLiteral("preferredFrameBufferPlugin")); | 63 | QStringLiteral("preferredFrameBufferPlugin")); | ||
66 | if (config_item) { | 64 | if (config_item) { | ||
67 | config_item->setProperty(QStringLiteral("xcb")); | 65 | config_item->setProperty(QStringLiteral("xcb")); | ||
68 | KrfbConfig::self()->save(); | 66 | KrfbConfig::self()->save(); | ||
69 | qDebug() << " Fixed preferredFrameBufferPlugin from x11 to xcb."; | 67 | qDebug() << " Fixed preferredFrameBufferPlugin from x11 to xcb."; | ||
70 | } | 68 | } | ||
71 | } | 69 | } | ||
72 | } | 70 | } | ||
73 | 71 | | |||
74 | | ||||
75 | int main(int argc, char *argv[]) | 72 | int main(int argc, char *argv[]) | ||
76 | { | 73 | { | ||
77 | QApplication app(argc, argv); | 74 | QApplication app(argc, argv); | ||
78 | 75 | | |||
79 | KLocalizedString::setApplicationDomain("krfb"); | 76 | KLocalizedString::setApplicationDomain("krfb"); | ||
80 | 77 | | |||
81 | KAboutData aboutData(QStringLiteral("krfb"), | 78 | KAboutData aboutData(QStringLiteral("krfb"), | ||
82 | i18n("Desktop Sharing"), | 79 | i18n("Desktop Sharing"), | ||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |