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

Method move

plugins/single_plugins/switcher.cpp:398–436  ·  view source on GitHub ↗

Move view animation target to the left * @param dir -1 for left, 1 for right */

Source from the content-addressed store, hash-verified

396 /* Move view animation target to the left
397 * @param dir -1 for left, 1 for right */
398 void move(SwitcherView& sv, int dir)
399 {
400 sv.attribs.off_x.restart_with_end(
401 sv.attribs.off_x.end + get_center_offset() * dir);
402 sv.attribs.off_y.restart_same_end();
403
404 float z_sign = 0;
405 if (sv.position == SWITCHER_POSITION_CENTER)
406 {
407 // Move from center to either left or right, so backwards
408 z_sign = 1;
409 } else if (view_expired(sv.position + dir))
410 {
411 // Expires, don't move
412 z_sign = 0;
413 } else
414 {
415 // Not from center, doesn't expire -> comes to the center
416 z_sign = -1;
417 }
418
419 sv.attribs.off_z.restart_with_end(
420 sv.attribs.off_z.end + get_z_offset() * z_sign);
421
422 /* scale views that aren't in the center */
423 sv.attribs.scale_x.restart_with_end(
424 sv.attribs.scale_x.end * std::pow(get_back_scale(), z_sign));
425
426 sv.attribs.scale_y.restart_with_end(
427 sv.attribs.scale_y.end * std::pow(get_back_scale(), z_sign));
428
429 float radians_rotation = -((float)view_thumbnail_rotation * (M_PI / 180.0));
430 sv.attribs.rotation.restart_with_end(
431 sv.attribs.rotation.end + radians_rotation * dir);
432
433 sv.position += dir;
434 sv.attribs.alpha.restart_with_end(
435 view_expired(sv.position) ? 0.3 : 1.0);
436 }
437
438 /* Calculate how much a view should be scaled to fit into the slots */
439 float calculate_scaling_factor(const wf::geometry_t& bbox) const

Callers 5

cascadeMethod · 0.45
randomMethod · 0.45
centerMethod · 0.45
initiateMethod · 0.45
adjust_view_on_outputFunction · 0.45

Calls 1

view_expiredFunction · 0.85

Tested by

no test coverage detected