void NotificationManager::arrangeNotifications(int deltaY) { ILOG_TRACE_F(ILX_NOTIFICATIONMAN); if (_active.empty()) return; _anim.stop(); _tween->setInitialValue(0); _tween->setEndValue(1); _deltaY += deltaY + 5; _anim.start(); ILOG_TRACE_F(ILX_NOTIFICATIONMAN); }
DFBResult DaleDFB::initDale(int* argc, char*** argv) { ILOG_TRACE_F(ILX_DALEDFB); DirectResult ret = FusionDaleInit(argc, argv); if (ret) { ILOG_THROW(ILX_DALEDFB, "FusionDaleInit() failed!\n"); return (DFBResult) ret; } if (!__dale) { DirectResult ret = FusionDaleCreate(&__dale); if (ret) { ILOG_THROW(ILX_DALEDFB, "FusionDaleCreate() failed!\n"); return (DFBResult) ret; } } if (!__coma) { DirectResult ret = __dale->EnterComa(__dale, "directfb.org", &__coma); if (ret) { ILOG_THROW( ILX_DALEDFB, "IFusionDale::EnterComa('directfb.org') failed!\n"); return (DFBResult) ret; } } return DFB_OK; }
DFBResult DaleDFB::showOSK(const Rectangle& rect, TextInputMode mode) { ILOG_TRACE_F(ILX_DALEDFB); if (getOSKComp() == DFB_FAILURE) return DFB_FAILURE; OSKRequest request; request.inputRect = rect.dfbRect(); request.mode = mode; request.process = getpid(); void *ptr; __coma->GetLocal(__coma, sizeof(OSKRequest), &ptr); OSKRequest* req = (OSKRequest*) ptr; *req = request; int ret_val; DirectResult ret = __oskComp->Call(__oskComp, 0, (void*) req, &ret_val); if (ret) { D_DERROR(ret, "WebKit/DFB: %s() failed!\n", __FUNCTION__); return (DFBResult) ret; } return DFB_OK; }
void DaleDFB::releaseDale() { ILOG_TRACE_F(ILX_DALEDFB); #if ILIXI_HAVE_COMPOSITOR if (__soundComp) { __soundComp->Release(__soundComp); __soundComp = NULL; } if (__oskComp) { __oskComp->Release(__oskComp); __oskComp = NULL; } if (__compComp) { __compComp->Release(__compComp); __compComp = NULL; } #endif if (__coma) { __coma->Release(__coma); __coma = NULL; } if (__dale) { __dale->Release(__dale); __dale = NULL; } }
void DaleDFB::releaseDale() { ILOG_TRACE_F(ILX_DALEDFB); if (__soundComp) { __soundComp->Release(__soundComp); __soundComp = NULL; } if (__oskComp) { __oskComp->Release(__oskComp); __oskComp = NULL; } if (__compComp) { __compComp->Release(__compComp); __compComp = NULL; } if (__coma) { __coma->Release(__coma); __coma = NULL; } if (__dale) { __dale->Release(__dale); __dale = NULL; } }
void EventManager::clear() { ILOG_TRACE_F(ILX_EVENTMANAGER); if (_focusedWidget) { _focusedWidget->_state = (WidgetState) (_focusedWidget->_state & ~FocusedState); _focusedWidget->focusOutEvent(); _focusedWidget->sigStateChanged(_focusedWidget, _focusedWidget->_state); _focusedWidget = NULL; } if (_exposedWidget) { _exposedWidget->_state = (WidgetState) (_exposedWidget->_state & ~ExposedState); _exposedWidget->_state = (WidgetState) (_exposedWidget->_state & ~PressedState); _exposedWidget->leaveEvent(PointerEvent()); _exposedWidget->sigStateChanged(_exposedWidget, _exposedWidget->_state); _exposedWidget = NULL; } if (_grabbedWidget) { _grabbedWidget->pointerReleaseEvent(PointerEvent()); _grabbedWidget = NULL; } }
void App::runBaresip() { ILOG_TRACE_F(ILX_SIPAPP); if (_pid) { _status->addMessage(PrintF("baresip quitting...")); DaleDFB::comaCallComponent(_sipComponent, BSM_QUIT, NULL); sleep(1); kill(_pid, SIGKILL); } pid_t pid = vfork(); switch (pid) { case -1: perror("vfork"); ILOG_FATAL(ILX_SIPAPP, "vfork error!\n"); break; case 0: setsid(); const char* args[2]; args[0] = "baresip"; args[1] = NULL; execvp(args[0], (char**) args); perror("execvp"); _exit(0); break; default: _pid = pid; _status->addMessage(PrintF("baresip [%d] is running.", _pid)); DaleDFB::comaGetComponent("baresip", &_sipComponent); _sipComponent->Listen(_sipComponent, BSN_DEBUG, sipLog, this); _sipComponent->Listen(_sipComponent, BSN_ERROR, sipError, this); _sipComponent->Listen(_sipComponent, BSN_VIDEO_SURFACE, sipVideo, this); _sipComponent->Listen(_sipComponent, BSN_CONTACT_STATUS, sipContactStatus, this); _sipComponent->Listen(_sipComponent, BSN_REGISTERING, sipRegistering, this); _sipComponent->Listen(_sipComponent, BSN_REGISTER_OK, sipRegisterOK, this); _sipComponent->Listen(_sipComponent, BSN_REGISTER_FAIL, sipRegisterFail, this); _sipComponent->Listen(_sipComponent, BSN_UNREGISTERING, sipRegistering, this); _sipComponent->Listen(_sipComponent, BSN_UNREGISTER_OK, sipRegisterOK, this); _sipComponent->Listen(_sipComponent, BSN_UNREGISTER_FAIL, sipRegisterFail, this); _sipComponent->Listen(_sipComponent, BSN_CALL_INCOMING, sipCallIncoming, this); _sipComponent->Listen(_sipComponent, BSN_CALL_RINGING, sipCallRinging, this); _sipComponent->Listen(_sipComponent, BSN_CALL_PROGRESS, sipCallProgress, this); _sipComponent->Listen(_sipComponent, BSN_CALL_ESTABLISHED, sipCallEstablished, this); _sipComponent->Listen(_sipComponent, BSN_CALL_CLOSED, sipCallClosed, this); break; } }
NotificationManager::~NotificationManager() { ILOG_TRACE_F(ILX_NOTIFICATIONMAN); pthread_mutex_destroy(&_activeMutex); pthread_mutex_destroy(&_pendingMutex); Notification::releaseBG(); }
bool NotificationManager::replaceActive(Notification* notification) { ILOG_TRACE_F(ILX_NOTIFICATIONMAN); if (notification->tag().empty()) return false; pthread_mutex_lock(&_activeMutex); NotificationList::iterator it = _active.begin(); while (it != _active.end()) { Notification* old = ((Notification*) *it); if (old->tag() == notification->tag()) { it = _active.erase(it); _active.insert(it, notification); notification->setGeometry(old->surfaceGeometry()); old->close(); _compositor->removeWidget(old); notification->show(); pthread_mutex_unlock(&_activeMutex); return true; } ++it; } pthread_mutex_unlock(&_activeMutex); return false; }
bool EventManager::setExposedWidget(Widget* widget, const PointerEvent& pointerEvent, bool dragging) { ILOG_TRACE_F(ILX_EVENTMANAGER); ILOG_DEBUG(ILX_EVENTMANAGER, " -> widget: %p\n", widget); if (widget == _exposedWidget) return false; if (_exposedWidget) { _exposedWidget->_state = (WidgetState) (_exposedWidget->_state & ~ExposedState); _exposedWidget->_state = (WidgetState) (_exposedWidget->_state & ~PressedState); _exposedWidget->sigStateChanged(_exposedWidget, _exposedWidget->_state); _exposedWidget->leaveEvent(pointerEvent); if (dragging) _exposedWidget->dragLeaveEvent(pointerEvent); } _exposedWidget = widget; if (_exposedWidget) { _exposedWidget->_state = (WidgetState) (_exposedWidget->_state | ExposedState); _exposedWidget->sigStateChanged(_exposedWidget, _exposedWidget->_state); _exposedWidget->enterEvent(pointerEvent); if (dragging) _exposedWidget->dragEnterEvent(pointerEvent); } return true; }
XMLReader::XMLReader() : _currentNode(NULL), _doc(NULL), _ctxt(NULL) { ILOG_TRACE_F(ILX_XMLREADER); }
int MGuiHawk::Create(ubus_context *ubus, HawkScreen* hawk) { int ret; ILOG_TRACE_F(MGUI_HAWK); if (_instance) { ILOG_ERROR(MGUI_HAWK, "Already created\n"); return -1; } _instance = new MGuiHawk(ubus, hawk); _instance->SetVersion(); ret = _instance->Register(); if (ret) { ILOG_ERROR(MGUI_HAWK, "Register failed (ret=%d)\n", ret); goto out_error; } ILOG_DEBUG(MGUI_HAWK, "%s exit\n", __FUNCTION__); return 0; out_error: delete _instance; _instance = NULL; }
bool EventManager::setGrabbedWidget(Widget* widget, const PointerEvent& pointerEvent) { ILOG_TRACE_F(ILX_EVENTMANAGER); ILOG_DEBUG(ILX_EVENTMANAGER, " -> widget: %p\n", widget); if (widget && !(widget->inputMethod() & PointerGrabbing)) return false; if (_grabbedWidget != widget) { if (_grabbedWidget) { _grabbedWidget->_state = (WidgetState) (_grabbedWidget->_state & ~(GrabbedState | PressedState)); _grabbedWidget->sigStateChanged(_grabbedWidget, _grabbedWidget->_state); _grabbedWidget->pointerReleaseEvent(pointerEvent); _grabbedWidget->update(); } _grabbedWidget = widget; if (_grabbedWidget) { _grabbedWidget->_state = (WidgetState) (_grabbedWidget->_state | GrabbedState | PressedState); _grabbedWidget->sigStateChanged(_grabbedWidget, _grabbedWidget->_state); _grabbedWidget->pointerGrabEvent(pointerEvent); _grabbedWidget->update(); } ILOG_DEBUG( ILX_EVENTMANAGER, "setGrabbedWidget ( widget %p, event.x %d, event.y %d )\n", widget, pointerEvent.x, pointerEvent.y); return true; } return false; }
bool EventManager::setFocusedWidget(Widget* widget) { ILOG_TRACE_F(ILX_EVENTMANAGER); ILOG_DEBUG(ILX_EVENTMANAGER, " -> widget: %p\n", widget); if (widget && !(widget->acceptsKeyInput())) return false; if (widget == _focusedWidget) return false; if (_focusedWidget) { _focusedWidget->_state = (WidgetState) (_focusedWidget->_state & ~FocusedState); _focusedWidget->sigStateChanged(_focusedWidget, _focusedWidget->_state); _focusedWidget->focusOutEvent(); } _focusedWidget = widget; if (widget != NULL) { if (widget->_parent) widget->_parent->_preSelectedWidget = _focusedWidget; _focusedWidget->_state = (WidgetState) (_focusedWidget->_state | FocusedState); _focusedWidget->sigStateChanged(_focusedWidget, _focusedWidget->_state); _focusedWidget->focusInEvent(); } setOSKWidget(widget); return true; }
XMLReader::XMLReader(const std::string& file) : _currentNode(NULL), _doc(NULL), _ctxt(NULL) { ILOG_TRACE_F(ILX_XMLREADER); loadFile(file); }
EventManager::EventManager(WindowWidget* creator) : _focusedWidget(0), _exposedWidget(0), _grabbedWidget(0), _oskWidget(0), _creator(creator) { ILOG_TRACE_F(ILX_EVENTMANAGER); }
void MGuiHawk::Destroy() { ILOG_TRACE_F(MGUI_HAWK); if (_instance) { _instance->UnRegister(); _instance = NULL; } }
bool EventManager::selectNext(Widget* target, Widget* startFrom, int iter) { ILOG_TRACE_F(ILX_EVENTMANAGER); ILOG_DEBUG(ILX_EVENTMANAGER, " -> target: %p\n", target); ILOG_DEBUG(ILX_EVENTMANAGER, " -> startFrom: %p\n", startFrom); ILOG_DEBUG(ILX_EVENTMANAGER, " -> iter: %d\n", iter); if (iter) return true; if (target == NULL && startFrom == _creator) ++iter; if (startFrom && target == _creator) { startFrom = NULL; iter++; } else if (!target) { if (_focusedWidget) target = _focusedWidget; else target = _creator; } if (setFocusedWidget(target)) return true; if (target->_children.size()) { Widget* targetChild; for (Widget::WidgetListIterator it = target->_children.begin(), end = target->_children.end(); it != end; ++it) { targetChild = (Widget*) *it; if (startFrom) { if (startFrom == targetChild) startFrom = NULL; } else { if (targetChild->_children.size()) { if (selectNext(targetChild, NULL, iter)) return true; } else if (setFocusedWidget(targetChild)) return true; } } return selectNext(target->_parent, target, iter); } else if (target != _creator) return selectNext(target->_parent, target, iter); return false; }
void GestureRecognizer::start(int x, int y) { ILOG_TRACE_F(ILX_GESTURE); _moves.clear(); _path.clear(); _lastMove = -1; _lastMoveTS = direct_clock_get_millis(); _preX = x; _preY = y; }
GestureRecognizer::GestureRecognizer() : _preX(-1), _preY(-1), _lastMove(-1), _lastMoveTS(0), _frequency(40), _minDistance(900), _sensitivity(2) { ILOG_TRACE_F(ILX_GESTURE); }
void GestureRecognizer::stop() { ILOG_TRACE_F(ILX_GESTURE); std::string match = matchGesture(); sigStopped(); if (match != "") { ILOG_DEBUG(ILX_GESTURE, " -> Matched \"%s\"\n", match.c_str()); sigGestureMatched(match); } }
void XMLReader::release() { ILOG_TRACE_F(ILX_XMLREADER); if (_doc) xmlFreeDoc(_doc); if (_ctxt) xmlFreeParserCtxt(_ctxt); _currentNode = NULL; _doc = NULL; _ctxt = NULL; }
DFBResult DaleDFB::comaGetComponent(const char* name, IComaComponent** component) { ILOG_TRACE_F(ILX_DALEDFB); if (!__coma) return DFB_FAILURE; if (__coma->GetComponent(__coma, name, 500, component) != DR_OK) { ILOG_ERROR( ILX_DALEDFB, "%s( %s ) failed!\n", __FUNCTION__, name); return DFB_FAILURE; } return DFB_OK; }
void EventManager::clear(Widget* widget) { ILOG_TRACE_F(ILX_EVENTMANAGER); ILOG_DEBUG(ILX_EVENTMANAGER, " -> widget: %p\n", widget); if (widget == NULL) return; if (_focusedWidget && _focusedWidget == widget) _focusedWidget = NULL; if (_grabbedWidget && _grabbedWidget == widget) _grabbedWidget = NULL; if (_exposedWidget && _exposedWidget == widget) _exposedWidget = NULL; }
DFBResult DaleDFB::comaGetLocal(unsigned int bytes, void** ret) { ILOG_TRACE_F(ILX_DALEDFB); if (!__coma) return DFB_FAILURE; if (__coma->GetLocal(__coma, bytes, ret) != DR_OK) { ILOG_ERROR( ILX_DALEDFB, "%s( %u ) failed!\n", __FUNCTION__, bytes); return DFB_FAILURE; } return DFB_OK; }
void GestureRecognizer::addMove(int dx, int dy) { ILOG_TRACE_F(ILX_GESTURE); int dir = round(atan2f(dy, dx) * RAD_2_DIRECTION); if (dir < 0) dir += 8; if (_lastMove != dir) { ILOG_DEBUG(ILX_GESTURE, " -> movement direction: %d\n", dir); _moves.push_back(dir); sigMovement(); } }
bool NotificationManager::checkPermission(const Compositor::NotificationData& data) { ILOG_TRACE_F(ILX_NOTIFICATIONMAN); // TODO check permission for notifications. if (data.client) return true; std::string query; std::string path; parseURI(data.origin, query, path); ILOG_DEBUG(ILX_NOTIFICATIONMAN, " -> path: %s\n", path.c_str()); ILOG_DEBUG(ILX_NOTIFICATIONMAN, " -> query: %s\n", query.c_str()); return true; }
void NotificationManager::tweenSlot() { ILOG_TRACE_F(ILX_NOTIFICATIONMAN); int deltaY = _tween->value() * _deltaY; ILOG_DEBUG(ILX_NOTIFICATIONMAN, "DeltaY: %d\n", deltaY); for (NotificationList::iterator it = _active.begin(); it != _active.end(); ++it) { if (*it == _active.back()) continue; ((Notification*) *it)->translate(0, deltaY); ((Notification*) *it)->update(); } _deltaY -= deltaY; }
DFBResult DaleDFB::hideOSK() { ILOG_TRACE_F(ILX_DALEDFB); if (getOSKComp() == DFB_FAILURE) return DFB_FAILURE; int ret_val; DirectResult ret = __oskComp->Call(__oskComp, 1, NULL, &ret_val); if (ret) { D_DERROR(ret, "WebKit/DFB: %s() failed!\n", __FUNCTION__); return (DFBResult) ret; } return DFB_OK; }
DFBResult DaleDFB::comaCallComponent(IComaComponent* component, ComaMethodID method, void* arg) { ILOG_TRACE_F(ILX_DALEDFB); if (!__coma) return DFB_FAILURE; if (component) { int ret_val; if (component->Call(component, method, arg, &ret_val) != DR_OK) { ILOG_ERROR( ILX_DALEDFB, "%s( %lu ) failed!\n", __FUNCTION__, method); return DFB_FAILURE; } return DFB_OK; } return DFB_FAILURE; }