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

Method activate

plugins/scale/scale.cpp:1297–1356  ·  view source on GitHub ↗

Activate and start scale animation */

Source from the content-addressed store, hash-verified

1295
1296 /* Activate and start scale animation */
1297 bool activate()
1298 {
1299 if (active)
1300 {
1301 return false;
1302 }
1303
1304 if (!output->activate_plugin(&grab_interface))
1305 {
1306 return false;
1307 }
1308
1309 auto views = get_views();
1310 if (views.empty())
1311 {
1312 output->deactivate_plugin(&grab_interface);
1313 return false;
1314 }
1315
1316 initial_workspace = output->wset()->get_current_workspace();
1317
1318 auto active_view = wf::get_active_view_for_output(output);
1319 if (active_view)
1320 {
1321 initial_focus_view = active_view->weak_from_this();
1322 current_focus_view = toplevel_cast(active_view);
1323 if (std::find(views.begin(), views.end(), current_focus_view) == views.end())
1324 {
1325 current_focus_view = nullptr;
1326 }
1327 } else
1328 {
1329 initial_focus_view.reset();
1330 current_focus_view = nullptr;
1331 }
1332
1333 // Make sure no leftover events from the activation binding
1334 // trigger an action in scale
1335 last_selected_view = nullptr;
1336
1337 grab->grab_input(wf::scene::layer::WORKSPACE);
1338 if (current_focus_view != wf::get_core().seat->get_active_view())
1339 {
1340 wf::get_core().default_wm->focus_raise_view(current_focus_view);
1341 }
1342
1343 active = true;
1344
1345 layout_slots(get_views());
1346
1347 output->connect(&on_view_mapped);
1348 output->connect(&workspace_changed);
1349 output->connect(&workarea_changed);
1350 output->connect(&view_minimized);
1351
1352 fade_out_all_except(current_focus_view);
1353 fade_in(current_focus_view);
1354

Callers

nothing calls this directly

Calls 15

toplevel_castFunction · 0.85
activate_pluginMethod · 0.80
emptyMethod · 0.80
deactivate_pluginMethod · 0.80
wsetMethod · 0.80
weak_from_thisMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
get_active_viewMethod · 0.80
focus_raise_viewMethod · 0.80
connectMethod · 0.80

Tested by

no test coverage detected