MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / AdjustToScale

Function AdjustToScale

Telegram/SourceFiles/core/core_settings.cpp:128–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126} // namespace
127
128[[nodiscard]] WindowPosition AdjustToScale(
129 WindowPosition position,
130 const QString &name) {
131 DEBUG_LOG(("%1 Pos: Initializing first %2, %3, %4, %5 "
132 "(scale %6%, maximized %7)")
133 .arg(name)
134 .arg(position.x)
135 .arg(position.y)
136 .arg(position.w)
137 .arg(position.h)
138 .arg(position.scale)
139 .arg(position.maximized));
140
141 if (!position.scale) {
142 return position;
143 }
144 const auto scaleFactor = cScale() / float64(position.scale);
145 if (scaleFactor != 1.) {
146 // Change scale while keeping the position center in place.
147 position.x += position.w / 2;
148 position.y += position.h / 2;
149 position.w *= scaleFactor;
150 position.h *= scaleFactor;
151 position.x -= position.w / 2;
152 position.y -= position.h / 2;
153 }
154 return position;
155}
156
157Settings::Settings()
158: _sendSubmitWay(Ui::InputSubmitSettings::Enter)

Callers 4

initNormalGeometryMethod · 0.85
initialPositionMethod · 0.85
panelGeometryMethod · 0.85
ivGeometryMethod · 0.85

Calls 1

cScaleFunction · 0.85

Tested by

no test coverage detected