MCPcopy Create free account
hub / github.com/WayfireWM/wayfire / adjust_geometry

Method adjust_geometry

plugins/tile/tree-controller.cpp:271–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271void resize_view_controller_t::adjust_geometry(int32_t& x1, int32_t& len1,
272 int32_t& x2, int32_t& len2, int32_t delta)
273{
274 /*
275 * On the line:
276 *
277 * x1 (x1+len1)=x2 x2+len2-1
278 * ._______________.___________________.
279 */
280 constexpr int MIN_SIZE = 50;
281
282 int maxPositive = std::max(0, len2 - MIN_SIZE);
283 int maxNegative = std::max(0, len1 - MIN_SIZE);
284
285 /* Make sure we don't shrink one dimension too much */
286 delta = clamp(delta, -maxNegative, maxPositive);
287
288 /* Adjust sizes */
289 len1 += delta;
290 x2 += delta;
291 len2 -= delta;
292}
293
294void resize_view_controller_t::input_motion()
295{

Callers

nothing calls this directly

Calls 1

clampFunction · 0.85

Tested by

no test coverage detected