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

Method random

plugins/single_plugins/place.cpp:89–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 void random(wayfire_toplevel_view & view, wf::geometry_t workarea)
90 {
91 wf::geometry_t window = view->get_pending_geometry();
92 wf::geometry_t area;
93 int pos_x, pos_y;
94
95 area.x = workarea.x;
96 area.y = workarea.y;
97 area.width = workarea.width - window.width;
98 area.height = workarea.height - window.height;
99
100 if ((area.width <= 0) || (area.height <= 0))
101 {
102 center(view, workarea);
103
104 return;
105 }
106
107 pos_x = rand() % area.width + area.x;
108 pos_y = rand() % area.height + area.y;
109
110 view->move(pos_x, pos_y);
111 }
112
113 void center(wayfire_toplevel_view & view, wf::geometry_t workarea)
114 {

Callers

nothing calls this directly

Calls 2

get_pending_geometryMethod · 0.80
moveMethod · 0.45

Tested by

no test coverage detected