44 #ifndef QT_NO_QWS_DIRECTFB 67 #ifndef QT_NO_DIRECTFB_LAYER 89 qCritical(
"QDirectFBMouseHandler: no screen instance found");
95 qCritical(
"QDirectFBMouseHandler: DirectFB not initialized");
99 #ifndef QT_NO_DIRECTFB_LAYER 102 qCritical(
"QDirectFBMouseHandler: Unable to get primary display layer");
107 DFBInputDeviceCapabilities caps;
108 caps = DICAPS_BUTTONS | DICAPS_AXES;
109 result = fb->CreateInputEventBuffer(fb, caps, DFB_TRUE, &
eventBuffer);
110 if (result != DFB_OK) {
111 DirectFBError(
"QDirectFBMouseHandler: " 112 "Unable to create input event buffer", result);
118 if (result != DFB_OK) {
119 DirectFBError(
"QDirectFBMouseHandler: " 120 "Unable to create file descriptor", result);
124 int flags =
fcntl(fd, F_GETFL, 0);
125 fcntl(fd, F_SETFL, flags | O_NONBLOCK);
147 #ifndef QT_NO_DIRECTFB_LAYER 149 result =
layer->SetCooperativeLevel(
layer, DLSCL_ADMINISTRATIVE);
150 if (result != DFB_OK) {
151 DirectFBError(
"QDirectFBScreenCursor::QDirectFBScreenCursor: " 152 "Unable to set cooperative level", result);
154 result =
layer->EnableCursor(
layer, on ? 1 : 0);
155 if (result != DFB_OK) {
156 DirectFBError(
"QDirectFBScreenCursor::QDirectFBScreenCursor: " 157 "Unable to enable cursor", result);
160 result =
layer->SetCooperativeLevel(
layer, DLSCL_SHARED);
161 if (result != DFB_OK) {
162 DirectFBError(
"QDirectFBScreenCursor::show: " 163 "Unable to set cooperative level", result);
166 layer->SetCooperativeLevel(
layer, DLSCL_SHARED);
183 char *buf =
reinterpret_cast<char*
>(&
event);
185 buf +
bytesRead,
sizeof(DFBEvent) - bytesRead);
191 qWarning(
"QDirectFBMouseHandlerPrivate::readMouseData(): %s",
198 if (bytesRead <
sizeof(DFBEvent))
204 const DFBInputEvent input =
event.input;
209 if (input.type == DIET_AXISMOTION) {
210 #if defined(QT_NO_DIRECTFB_LAYER) || defined(QT_DIRECTFB_WINDOW_AS_CURSOR) 211 if (input.flags & DIEF_AXISABS) {
212 switch (input.axis) {
213 case DIAI_X: x = input.axisabs;
break;
214 case DIAI_Y: y = input.axisabs;
break;
216 qWarning(
"QDirectFBMouseHandlerPrivate::readMouseData: " 217 "unknown axis (absolute) %d", input.axis);
220 }
else if (input.flags & DIEF_AXISREL) {
221 switch (input.axis) {
222 case DIAI_X: x += input.axisrel;
break;
223 case DIAI_Y: y += input.axisrel;
break;
224 case DIAI_Z: wheel = -120 * input.axisrel;
break;
226 qWarning(
"QDirectFBMouseHandlerPrivate::readMouseData: " 227 "unknown axis (releative) %d", input.axis);
231 if (input.axis == DIAI_X || input.axis == DIAI_Y) {
232 DFBResult result =
layer->GetCursorPosition(
layer, &x, &y);
233 if (result != DFB_OK) {
234 DirectFBError(
"QDirectFBMouseHandler::readMouseData",
237 }
else if (input.axis == DIAI_Z) {
238 Q_ASSERT(input.flags & DIEF_AXISREL);
239 wheel = input.axisrel;
246 if (input.flags & DIEF_BUTTONS) {
247 if (input.buttons & DIBM_LEFT)
249 if (input.buttons & DIBM_MIDDLE)
251 if (input.buttons & DIBM_RIGHT)
291 #include "qdirectfbmouse.moc" 292 #endif // QT_NO_QWS_DIRECTFB IDirectFBDisplayLayer * layer
#define QT_END_NAMESPACE
This macro expands to.
QDirectFBMouseHandler * handler
QDirectFBMouseHandlerPrivate * d
void suspend()
Implement this function to suspend reading and handling of mouse events, e.
The QWSMouseHandler class is a base class for mouse drivers in Qt for Embedded Linux.
static Qt::MouseButtons buttons
IDirectFBDisplayLayer * dfbDisplayLayer()
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
The QString class provides a Unicode character string.
void mouseChanged(const QPoint &pos, int bstate, int wheel=0)
Notifies the system of a new mouse event.
The QObject class is the base class of all Qt objects.
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
IDirectFBEventBuffer * eventBuffer
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Q_CORE_EXPORT void qWarning(const char *,...)
static QScreen * instance()
Returns a pointer to the application's QScreen instance.
~QDirectFBMouseHandlerPrivate()
void resume()
Implement this function to resume reading and handling mouse events, e.
QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler *h)
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
QSocketNotifier * mouseNotifier
The QPoint class defines a point in the plane using integer precision.
bool isEnabled() const
Returns true if the notifier is enabled; otherwise returns false.
void setEnabled(bool)
If enable is true, the notifier is enabled; otherwise the notifier is disabled.
Qt::MouseButtons prevbuttons
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
int y() const
Returns the y coordinate of this point.
static QDirectFBScreen * instance()
int x() const
Returns the x coordinate of this point.
QDirectFBMouseHandler(const QString &driver=QString(), const QString &device=QString())
void limitToScreen(QPoint &pt)
Ensures that the given position is within the screen's boundaries, changing the position if necessary...
Q_CORE_EXPORT void qCritical(const char *,...)
int socket() const
Returns the socket identifier specified to the constructor.