Project

General

Profile

Feature #7666 » 0001-Only-connect-jsScrollVisibilityChanged_-as-needed.patch

Bruce Toll, 07/27/2020 09:54 PM

View differences:

src/Wt/WWebWidget.C
WWebWidget::OtherImpl::OtherImpl(WWebWidget *const self)
: elementTagName_(nullptr),
tabIndex_(std::numeric_limits<int>::min()),
scrollVisibilityMargin_(0),
jsScrollVisibilityChanged_(self, "scrollVisibilityChanged")
{
jsScrollVisibilityChanged_.connect(self, &WWebWidget::jsScrollVisibilityChanged);
}
scrollVisibilityMargin_(0)
{ }
WWebWidget::OtherImpl::~OtherImpl()
{ }
......
void WWebWidget::setScrollVisibilityEnabled(bool enabled)
{
if (enabled && !otherImpl_)
if (enabled && !otherImpl_) {
otherImpl_.reset(new OtherImpl(this));
if (!otherImpl_->jsScrollVisibilityChanged_) {
otherImpl_->jsScrollVisibilityChanged_.reset(new JSignal<bool>(this, "scrollVisibilityChanged"));
otherImpl_->jsScrollVisibilityChanged_->connect(this, &WWebWidget::jsScrollVisibilityChanged);
}
}
if (scrollVisibilityEnabled() != enabled) {
flags_.set(BIT_SCROLL_VISIBILITY_ENABLED, enabled);
src/Wt/WWebWidget.h
int scrollVisibilityMargin_;
Signal<bool> scrollVisibilityChanged_;
JSignal<bool> jsScrollVisibilityChanged_;
std::unique_ptr<JSignal<bool> > jsScrollVisibilityChanged_;
OtherImpl(WWebWidget *const self);
~OtherImpl();
(1-1/2)