Changeset View
Changeset View
Standalone View
Standalone View
src/kded/tabletfinder.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | |||||
76 | 76 | | |||
77 | bool TabletFinder::scan() | 77 | bool TabletFinder::scan() | ||
78 | { | 78 | { | ||
79 | Q_D(TabletFinder); | 79 | Q_D(TabletFinder); | ||
80 | 80 | | |||
81 | X11TabletFinder x11tabletFinder; | 81 | X11TabletFinder x11tabletFinder; | ||
82 | QMap<QString,QString> buttonMap; | 82 | QMap<QString,QString> buttonMap; | ||
83 | 83 | | |||
84 | if (x11tabletFinder.scanDevices()) { | 84 | if (QX11Info::isPlatformX11() | ||
xuetianweng: Since we only have one backend here, I would write:
if (!QX11Info::isPlatformX11()) {… | |||||
85 | && x11tabletFinder.scanDevices()) { | ||||
85 | d->tabletList = x11tabletFinder.getTablets(); | 86 | d->tabletList = x11tabletFinder.getTablets(); | ||
86 | 87 | | |||
87 | TabletFinderPrivate::TabletInformationList::Iterator iter; | 88 | TabletFinderPrivate::TabletInformationList::Iterator iter; | ||
88 | 89 | | |||
89 | for (iter = d->tabletList.begin() ; iter != d->tabletList.end() ; ++iter) { | 90 | for (iter = d->tabletList.begin() ; iter != d->tabletList.end() ; ++iter) { | ||
90 | // lookup device information and button map | 91 | // lookup device information and button map | ||
91 | lookupInformation(*iter); | 92 | lookupInformation(*iter); | ||
92 | 93 | | |||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |
Since we only have one backend here, I would write:
if (!QX11Info::isPlatformX11()) {
}
X11TabletFinder x11tabletFinder;
.....
Otherwise if there's any X11 call in X11TabletFinder's constructor, it would still cause problem.
Or you can wrap all the code in the if, but I prefer the former one for now since it has less indention.
if (QX11Info::isPlatformX11()) {
}