}
__dswlSeat->setCurrentEventTime(ev->getTimestamp());
+
+ if (ev->getType() == DSInputEvent::MouseMoveEvent)
+ {
+ //get window whose geometry has intersection with the mouse coordinates
+ auto window = getTopWindowOnPosition(ev->getX(), ev->getY());
+
+ //check if the window is equal to the current pointer focus window
+ auto currentPointerFocus = __pointer->getFocus();
+
+ //if equal, no need to set focus / pointer enter/leave activities
+ if (window.get() != currentPointerFocus.get())
+ {
+ //if not equal, send pointer leave to the current pointer focus window
+ std::shared_ptr evMouseOut = std::make_shared<DSInputMouseEvent>(ev->getDevice(), DSInputEvent::MouseOutEvent, ev->getTimestamp(), ev->getButton(), ev->getX(), ev->getY(), 0);
+ __pointer->processEvent(evMouseOut.get(), nullptr);
+ //TODO : emit MouseOut signal
+
+ //set the window as pointer focus window
+ __pointer->setFocus(window);
+
+ //send pointer enter to the new pointer focus window
+ std::shared_ptr evMouseIn = std::make_shared<DSInputMouseEvent>(ev->getDevice(), DSInputEvent::MouseInEvent, ev->getTimestamp(), ev->getButton(), 0, 0, 0);
+ __pointer->processEvent(evMouseIn.get(), nullptr);
+ //TODO : emit MouseIn signal
+ }
+ }
+
__pointer->processEvent(ev, nullptr);
}
return;
}
+ if (ev->getType() == DSInputEvent::TouchDownEvent)
+ {
+ //get window whose geometry has intersection with the touch coordinates
+ auto window = getTopWindowOnPosition(ev->getX(), ev->getY());
+
+ //set the window as touch focus window
+ __touch->setFocus(window);
+
+ //TODO : emit touch focus changed signal
+ }
+
__dswlSeat->setCurrentEventTime(ev->getTimestamp());
__touch->processEvent(ev, nullptr);
}
return EINA_TRUE;
}
+std::shared_ptr<DSWindow> DSSeat::getTopWindowOnPosition(int x, int y)
+{
+ stPosition wPos;
+ stSize wSize;
+
+ std::list<std::shared_ptr<DSWindow>> wList = __zone->getWindowList();
+ for (auto w : wList)
+ {
+ wSize = w->getSize();
+ wPos = w->getPosition();
+
+ if (x >= wPos.x && y >= wPos.y && x <= (int)(wPos.x+wSize.w) && y <= (int)(wPos.y+wSize.h))
+ {
+ DSLOG_INF("DSSeat", "window(%p, x:%d, y:%d, w:%u, h:%u) contains (x:%d, y:%d)", w.get(), wPos.x, wPos.y, wSize.w, wSize.h, x, y);
+ return w;
+ }
+ }
+}
+
} // namespace display_server