Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into 'master'
Fix runtime issues with -Wl,--as-needed.



See merge request !2
  • Loading branch information
Juho Hamalainen committed May 30, 2016
2 parents c00a979 + 302ed23 commit d7ea915
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 91 deletions.
27 changes: 9 additions & 18 deletions ffmemless.pro
Expand Up @@ -15,22 +15,13 @@ settings.path = $$[QT_INSTALL_PLUGINS]/feedback/
target.path = $$[QT_INSTALL_PLUGINS]/feedback
INSTALLS += target settings

equals(QT_MAJOR_VERSION, 4) {
INCLUDEPATH += . $$[MOBILITY_INCLUDE]
DEPENDPATH += . $$[MOBILITY_INCLUDE]
CONFIG += mobility
MOBILITY = feedback
}
equals(QT_MAJOR_VERSION, 5) {
DEFINES *= USING_QTFEEDBACK
OTHER_FILES += ffmemless.json
QT += feedback
plugindescription.files = ffmemless.json
plugindescription.path = $$[QT_INSTALL_PLUGINS]/feedback/
INSTALLS += plugindescription
OTHER_FILES += ffmemless.json
QT += feedback
plugindescription.files = ffmemless.json
plugindescription.path = $$[QT_INSTALL_PLUGINS]/feedback/
INSTALLS += plugindescription

# also enable profile detection. libprofile-qt5 is a bit broken, work around it here.
QT += dbus
QMAKE_CXXFLAGS += -I/usr/include/profile-qt5
QMAKE_LFLAGS += -lprofile-qt5
}
# also enable profile detection. libprofile-qt5 is a bit broken, work around it here.
QT += dbus
QMAKE_CXXFLAGS += -I/usr/include/profile-qt5
LIBS += -lprofile-qt5
24 changes: 1 addition & 23 deletions qfeedback.cpp
Expand Up @@ -49,10 +49,6 @@
#include <fcntl.h>
#include <unistd.h>

#ifndef USING_QTFEEDBACK
Q_EXPORT_PLUGIN2(feedback_ffmemless, QFeedbackFFMemless)
#endif

#define BITS_PER_LONG (sizeof(long) * 8)
#define OFF(x) ((x)%BITS_PER_LONG)
#define BIT(x) (1UL<<OFF(x))
Expand Down Expand Up @@ -101,11 +97,9 @@ int vibra_evdev_file_search(bool *supportsRumble, bool *supportsPeriodic)


QFeedbackFFMemless::QFeedbackFFMemless(QObject *parent) : QObject(parent),
#ifdef USING_QTFEEDBACK
m_profile(0),
m_profileEnablesVibra(false),
m_profileTouchscreenVibraLevel(0),
#endif
m_stateChangeTimer(0),
m_vibraSpiDevice(-1),
m_actuatorEnabled(false),
Expand Down Expand Up @@ -149,7 +143,6 @@ QFeedbackFFMemless::QFeedbackFFMemless(QObject *parent) : QObject(parent),
QFeedbackActuator *actuator = createFeedbackActuator(this, 1);
m_actuators.append(actuator);

#ifdef USING_QTFEEDBACK
m_profile = new Profile(this);
connect(m_profile, SIGNAL(activeProfileChanged(QString)),
this, SLOT(deviceProfileSettingsChanged()));
Expand All @@ -158,17 +151,14 @@ QFeedbackFFMemless::QFeedbackFFMemless(QObject *parent) : QObject(parent),
connect(m_profile, SIGNAL(touchscreenVibrationLevelChanged(QString, int)),
this, SLOT(deviceProfileSettingsChanged()));
deviceProfileSettingsChanged();
#endif
}
}

#ifdef USING_QTFEEDBACK
void QFeedbackFFMemless::deviceProfileSettingsChanged()
{
m_profileEnablesVibra = m_profile->isVibrationEnabled(m_profile->activeProfile());
m_profileTouchscreenVibraLevel = m_profile->touchscreenVibrationLevel(m_profile->activeProfile());
}
#endif

QFeedbackFFMemless::~QFeedbackFFMemless()
{
Expand Down Expand Up @@ -443,21 +433,14 @@ QFeedbackInterface::PluginPriority QFeedbackFFMemless::pluginPriority()

bool QFeedbackFFMemless::play(QFeedbackEffect::ThemeEffect effect)
{
#ifdef USING_QTFEEDBACK // use Q_UNLIKELY for performance
if (Q_UNLIKELY(!m_themeEffectsPossible || !m_profileEnablesVibra))
return false;
#else
if (!m_themeEffectsPossible)
return false;
#endif

// use Q_LIKELY to optimise for VKB key presses
if (Q_LIKELY(effect == QFeedbackEffect::ThemeBasicKeypad && m_periodicThemeEffectsPossible)) {
#ifdef USING_QTFEEDBACK
if (Q_UNLIKELY(m_profileTouchscreenVibraLevel == 0)) {
return false;
}
#endif
m_themeEffectPlayEvent.code = m_periodicThemeEffect.id;
return writeEffectEvent(&m_themeEffectPlayEvent);
}
Expand All @@ -473,23 +456,20 @@ bool QFeedbackFFMemless::play(QFeedbackEffect::ThemeEffect effect)
break;
case QFeedbackEffect::ThemeBasicKeypad:
{
#ifdef USING_QTFEEDBACK
if (Q_UNLIKELY(m_profileTouchscreenVibraLevel == 0))
return false;
#endif

m_themeEffect.u.rumble.strong_magnitude = KEYPAD_PRESS_MAX;
m_themeEffect.u.rumble.weak_magnitude = KEYPAD_PRESS_MIN;
m_themeEffect.replay.length = KEYPAD_PRESS_DURATION;
m_themeEffect.replay.delay = KEYPAD_PRESS_DELAY;
}
break;
case QFeedbackEffect::ThemeBasicButton: // BasicButton is the default.
#ifdef USING_QTFEEDBACK
{
if (Q_UNLIKELY(m_profileTouchscreenVibraLevel == 0))
return false;
}
#endif
default:
{
m_themeEffect.u.rumble.strong_magnitude = BUTTON_PRESS_MAX;
Expand Down Expand Up @@ -642,11 +622,9 @@ void QFeedbackFFMemless::restartCustomEffect(QFeedbackHapticsEffect *effect)
// write stop.
stopCustomEffect(effect);

#ifdef USING_QTFEEDBACK
// check to see if we should play.
if (Q_UNLIKELY(!m_profileEnablesVibra))
return;
#endif

// reupload the (possibly updated) effect.
int whichEffect = reuploadUpdatedEffect(effect);
Expand Down
19 changes: 2 additions & 17 deletions qfeedback.h
Expand Up @@ -40,12 +40,8 @@
#ifndef QFEEDBACK_FFMEMLESS_H
#define QFEEDBACK_FFMEMLESS_H

#ifdef USING_QTFEEDBACK
#include <profile.h>
#include <QtPlugin>
#else
#include <qmobilityglobal.h>
#endif

#include <qfeedbackplugininterfaces.h>
#include <linux/input.h>
Expand All @@ -54,27 +50,19 @@

QT_BEGIN_HEADER

#ifdef USING_QTFEEDBACK
QT_USE_NAMESPACE
#define ThemeEffect Effect
#define ThemeBasicKeypad PressWeak
#define ThemeBasicButton Press
#define ThemeLongPress PressStrong
#else
QTM_USE_NAMESPACE
#endif

class QFeedbackFFMemless : public QObject, public QFeedbackHapticsInterface, public QFeedbackThemeInterface
{
Q_OBJECT
#ifdef USING_QTFEEDBACK
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackPlugin" FILE "ffmemless.json")
Q_INTERFACES(QFeedbackHapticsInterface)
Q_INTERFACES(QFeedbackThemeInterface)
#else
Q_INTERFACES(QTM_NAMESPACE::QFeedbackHapticsInterface)
Q_INTERFACES(QTM_NAMESPACE::QFeedbackThemeInterface)
#endif

public:
QFeedbackFFMemless(QObject *parent = 0);
~QFeedbackFFMemless();
Expand All @@ -96,9 +84,7 @@ class QFeedbackFFMemless : public QObject, public QFeedbackHapticsInterface, pub

private Q_SLOTS:
void stateChangeTimerTriggered();
#ifdef USING_QTFEEDBACK
void deviceProfileSettingsChanged();
#endif

private:
void stopCustomEffect(QFeedbackHapticsEffect *effect);
Expand All @@ -110,12 +96,11 @@ private Q_SLOTS:
bool writeEffectEvent(struct input_event *event);

private:
#ifdef USING_QTFEEDBACK
// profile change detection (normal / silent / airplane etc)
Profile *m_profile;
bool m_profileEnablesVibra;
int m_profileTouchscreenVibraLevel;
#endif

// theme effects
struct input_event m_themeEffectPlayEvent;
struct ff_effect m_themeEffect;
Expand Down
33 changes: 0 additions & 33 deletions rpm/qt-mobility-haptics-ffmemless.spec

This file was deleted.

0 comments on commit d7ea915

Please sign in to comment.