D23102: Reduce duplicate code calculating popup position

Vlad Zagorodniy noreply at phabricator.kde.org
Mon Aug 12 22:38:44 BST 2019


zzag added inline comments.

INLINE COMMENTS

> useractions.cpp:154-162
> +    if (y != pos.top()) {
> +        QRect area = Workspace::self()->clientArea(ScreenArea, QPoint(x, y),
> +                                                   VirtualDesktopManager::self()->current());
>          menuAboutToShow(); // needed for sizeHint() to be correct :-/
>          int popupHeight = m_menu->sizeHint().height();
> -        if (y + popupHeight < area.height()) {
> -            if (needsPopup) {
> -                m_menu->popup(QPoint(x, y));
> -            } else {
> -                m_menu->exec(QPoint(x, y));
> -            }
> -        } else {
> -            if (needsPopup) {
> -                m_menu->popup(QPoint(x, pos.top() - popupHeight));
> -            } else {
> -                m_menu->exec(QPoint(x, pos.top() - popupHeight));
> -            }
> +        if (y + popupHeight >= area.height()) {
> +            y = pos.top() - popupHeight;

Remove this code as well.

REPOSITORY
  R108 KWin

BRANCH
  arcpatch-D23102

REVISION DETAIL
  https://phabricator.kde.org/D23102

To: gladhorn, #kwin, romangg
Cc: zzag, romangg, kwin, LeGast00n, sbergeron, jraleigh, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, Pitel, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwin/attachments/20190812/2b73a0f9/attachment-0001.html>


More information about the kwin mailing list