mirror of https://github.com/procxx/kepka.git
				
				
				
			Apply sway fixes to the PiP and export windows too
This commit is contained in:
		
							parent
							
								
									7b106761be
								
							
						
					
					
						commit
						586744c112
					
				| 
						 | 
					@ -354,7 +354,8 @@ QImage RotateFrameImage(QImage image, int rotation) {
 | 
				
			||||||
PipPanel::PipPanel(
 | 
					PipPanel::PipPanel(
 | 
				
			||||||
	QWidget *parent,
 | 
						QWidget *parent,
 | 
				
			||||||
	Fn<void(QPainter&, FrameRequest)> paint)
 | 
						Fn<void(QPainter&, FrameRequest)> paint)
 | 
				
			||||||
: _parent(parent)
 | 
					: PipParent(Core::App().getModalParent())
 | 
				
			||||||
 | 
					, _parent(parent)
 | 
				
			||||||
, _paint(std::move(paint)) {
 | 
					, _paint(std::move(paint)) {
 | 
				
			||||||
	setWindowFlags(Qt::Tool
 | 
						setWindowFlags(Qt::Tool
 | 
				
			||||||
		| Qt::WindowStaysOnTopHint
 | 
							| Qt::WindowStaysOnTopHint
 | 
				
			||||||
| 
						 | 
					@ -543,7 +544,11 @@ void PipPanel::setPositionOnScreen(Position position, QRect available) {
 | 
				
			||||||
		geometry.moveTop(inner.y() + inner.height() - geometry.height());
 | 
							geometry.moveTop(inner.y() + inner.height() - geometry.height());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setGeometry(geometry.marginsAdded(_padding));
 | 
						geometry += _padding;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						setGeometry(geometry);
 | 
				
			||||||
 | 
						setMinimumSize(geometry.size());
 | 
				
			||||||
 | 
						setMaximumSize(geometry.size());
 | 
				
			||||||
	updateDecorations();
 | 
						updateDecorations();
 | 
				
			||||||
	update();
 | 
						update();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -714,8 +719,11 @@ void PipPanel::processDrag(QPoint point) {
 | 
				
			||||||
	if (clamped != valid.topLeft()) {
 | 
						if (clamped != valid.topLeft()) {
 | 
				
			||||||
		moveAnimated(clamped);
 | 
							moveAnimated(clamped);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							const auto newGeometry = valid.marginsAdded(_padding);
 | 
				
			||||||
		_positionAnimation.stop();
 | 
							_positionAnimation.stop();
 | 
				
			||||||
		setGeometry(valid.marginsAdded(_padding));
 | 
							setGeometry(newGeometry);
 | 
				
			||||||
 | 
							setMinimumSize(newGeometry.size());
 | 
				
			||||||
 | 
							setMaximumSize(newGeometry.size());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -802,6 +810,8 @@ void PipPanel::updateDecorations() {
 | 
				
			||||||
	_useTransparency = use;
 | 
						_useTransparency = use;
 | 
				
			||||||
	setAttribute(Qt::WA_OpaquePaintEvent, !_useTransparency);
 | 
						setAttribute(Qt::WA_OpaquePaintEvent, !_useTransparency);
 | 
				
			||||||
	setGeometry(newGeometry);
 | 
						setGeometry(newGeometry);
 | 
				
			||||||
 | 
						setMinimumSize(newGeometry.size());
 | 
				
			||||||
 | 
						setMaximumSize(newGeometry.size());
 | 
				
			||||||
	update();
 | 
						update();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
				
			||||||
namespace Ui {
 | 
					namespace Ui {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SeparatePanel::SeparatePanel()
 | 
					SeparatePanel::SeparatePanel()
 | 
				
			||||||
: _close(this, st::separatePanelClose)
 | 
					: RpWidget(Core::App().getModalParent())
 | 
				
			||||||
 | 
					, _close(this, st::separatePanelClose)
 | 
				
			||||||
, _back(this, object_ptr<Ui::IconButton>(this, st::separatePanelBack))
 | 
					, _back(this, object_ptr<Ui::IconButton>(this, st::separatePanelBack))
 | 
				
			||||||
, _body(this) {
 | 
					, _body(this) {
 | 
				
			||||||
	setMouseTracking(true);
 | 
						setMouseTracking(true);
 | 
				
			||||||
| 
						 | 
					@ -359,18 +360,25 @@ void SeparatePanel::initGeometry(QSize size) {
 | 
				
			||||||
			st::lineWidth);
 | 
								st::lineWidth);
 | 
				
			||||||
	setAttribute(Qt::WA_OpaquePaintEvent, !_useTransparency);
 | 
						setAttribute(Qt::WA_OpaquePaintEvent, !_useTransparency);
 | 
				
			||||||
	const auto screen = QApplication::desktop()->screenGeometry(center);
 | 
						const auto screen = QApplication::desktop()->screenGeometry(center);
 | 
				
			||||||
	const auto rect = QRect(QPoint(), size);
 | 
						const auto rect = [&] {
 | 
				
			||||||
	setGeometry(
 | 
							const QRect initRect(QPoint(), size);
 | 
				
			||||||
		rect.translated(center - rect.center()).marginsAdded(_padding));
 | 
							return initRect.translated(center - initRect.center()).marginsAdded(_padding);
 | 
				
			||||||
 | 
						}();
 | 
				
			||||||
 | 
						setGeometry(rect);
 | 
				
			||||||
 | 
						setMinimumSize(rect.size());
 | 
				
			||||||
 | 
						setMaximumSize(rect.size());
 | 
				
			||||||
	updateControlsGeometry();
 | 
						updateControlsGeometry();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SeparatePanel::updateGeometry(QSize size) {
 | 
					void SeparatePanel::updateGeometry(QSize size) {
 | 
				
			||||||
	setGeometry(
 | 
						const auto rect = QRect(
 | 
				
			||||||
		x(),
 | 
							x(),
 | 
				
			||||||
		y(),
 | 
							y(),
 | 
				
			||||||
		_padding.left() + size.width() + _padding.right(),
 | 
							_padding.left() + size.width() + _padding.right(),
 | 
				
			||||||
		_padding.top() + size.height() + _padding.bottom());
 | 
							_padding.top() + size.height() + _padding.bottom());
 | 
				
			||||||
 | 
						setGeometry(rect);
 | 
				
			||||||
 | 
						setMinimumSize(rect.size());
 | 
				
			||||||
 | 
						setMaximumSize(rect.size());
 | 
				
			||||||
	updateControlsGeometry();
 | 
						updateControlsGeometry();
 | 
				
			||||||
	update();
 | 
						update();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue