void *WinDockPlugin::processEvent(Event *e) { if (e->type() == EventCommandExec){ CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->id == CmdAutoHide){ dock->setAutoHide((cmd->flags & COMMAND_CHECKED) != 0); bAutoHideVisible = true; setBarState(); enableAutoHide(getAutoHide()); return cmd; } } if (e->type() == EventCheckState){ CommandDef *cmd = (CommandDef*)(e->param()); if ((cmd->id == CmdAutoHide) && (dock->getState() != ABE_FLOAT)){ cmd->flags &= ~COMMAND_CHECKED; if (dock->getAutoHide()) cmd->flags |= COMMAND_CHECKED; return cmd; } } if ((e->type() == EventInit) && !m_bInit) init(); if (e->type() == EventInTaskManager){ if ((dock->getState() != ABE_FLOAT) && e->param()){ Event eMy(EventInTaskManager, (void*)false); eMy.process(); return e->param(); } } return NULL; }
void WinDockPlugin::slotAutoHide() { if (pMain->isActiveWindow()) return; DWORD pos = GetMessagePos(); int x = GET_X_LPARAM(pos); int y = GET_Y_LPARAM(pos); RECT rc; GetWindowRect(pMain->winId(), &rc); rc.left -= GetSystemMetrics(SM_CXDOUBLECLK) * 2; rc.right += GetSystemMetrics(SM_CXDOUBLECLK) * 2; if ((x >= rc.left) && (x <= rc.right) && (y >= rc.top) && (y <= rc.bottom)) return; if ((getState() != ABE_FLOAT) && getAutoHide() && bAutoHideVisible){ bAutoHideVisible = false; setBarState(true); enableAutoHide(false); } }
void DockPlugin::timer() { if (!isMainShow()) // already hidden return; if (!getAutoHide() || (inactiveTime == 0)) // no autohide return; time_t now; time(&now); if (m_main != getMainWindow()) { m_main = getMainWindow(); m_main->installEventFilter(this); } if (now > inactiveTime + (time_t)getAutoHideInterval()){ if (m_main){ setShowMain(false); m_main->hide(); } } }
bool WinDockPlugin::eventFilter(QObject *o, QEvent *e) { if ((e->type() == QEvent::Hide) && getAutoHide()) return true; return QObject::eventFilter(o, e); }