Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion deflect/qt/QmlStreamerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,33 @@ void QmlStreamer::Impl::_setupSizeHintsConnections()
[this](int size_) { _sizeHints.preferredHeight = size_; });
}

bool QmlStreamer::Impl::_isWithinSizeHintsRange(const QSize& size) const
{
return !size.isEmpty() &&
_isWithinSizeHintsRange(static_cast<uint>(size.width()),
static_cast<uint>(size.height()));
}

bool QmlStreamer::Impl::_isWithinSizeHintsRange(const uint width,
const uint height) const
{
const auto minWidth = _sizeHints.minWidth == SizeHints::UNSPECIFIED_SIZE
? std::numeric_limits<uint>::min()
: _sizeHints.minWidth;
const auto maxWidth = _sizeHints.maxWidth == SizeHints::UNSPECIFIED_SIZE
? std::numeric_limits<uint>::max()
: _sizeHints.maxWidth;
const auto minHeight = _sizeHints.minHeight == SizeHints::UNSPECIFIED_SIZE
? std::numeric_limits<uint>::min()
: _sizeHints.minHeight;
const auto maxHeight = _sizeHints.maxHeight == SizeHints::UNSPECIFIED_SIZE
? std::numeric_limits<uint>::max()
: _sizeHints.maxHeight;

return minWidth <= width && width <= maxWidth && minHeight <= height &&
height <= maxHeight;
}

std::string QmlStreamer::Impl::_getDeflectStreamIdentifier() const
{
if (!_streamId.empty())
Expand Down Expand Up @@ -281,7 +308,10 @@ void QmlStreamer::Impl::_setupDeflectStream()

// handle view resize
connect(_eventReceiver.get(), &EventReceiver::resized,
[this](const QSize size) { _quickView->resize(size); });
[this](const QSize size) {
if (_isWithinSizeHintsRange(size))
_quickView->resize(size);
});

// inject key events
connect(_eventReceiver.get(), &EventReceiver::keyPress, this,
Expand Down
8 changes: 5 additions & 3 deletions deflect/qt/QmlStreamerImpl.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*********************************************************************/
/* Copyright (c) 2015-2016, EPFL/Blue Brain Project */
/* Daniel.Nachbaur <[email protected]> */
/* Raphael Dumusc <[email protected]> */
/* Copyright (c) 2015-2018, EPFL/Blue Brain Project */
/* Daniel.Nachbaur <[email protected]>*/
/* Raphael Dumusc <[email protected]> */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
Expand Down Expand Up @@ -93,6 +93,8 @@ private slots:

private:
void _setupSizeHintsConnections();
bool _isWithinSizeHintsRange(const QSize& size) const;
bool _isWithinSizeHintsRange(uint width, uint height) const;
void _send(QKeyEvent& keyEvent);
bool _sendToWebengineviewItems(QKeyEvent& keyEvent);
std::string _getDeflectStreamIdentifier() const;
Expand Down
3 changes: 3 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog {#Changelog}
## Deflect 1.0

### 1.0.1 (master)
* [203](https://github.com/BlueBrain/Deflect/pull/203):
QmlStreamer resizes the window only if the received size event is within the
specified min/max size hints.
* [200](https://github.com/BlueBrain/Deflect/pull/200):
The Server now rejects Streams attempting to late-join after the first frame
was finished.
Expand Down