displays: changed api for mainloop

- removed `needs_mainloop` attribute and deduce if mainloop is needed
  from the presence of _run callback (the information is now redundant
  only displays needing/running mainloop should announce _run callback)

- run the custom mainloop (currently only Syphon!) only when display
  doesn't run its mainloop. This allows running Syphon and GL/SDL
  display because it connects to the display mainloop.
This commit is contained in:
Martin Pulec
2023-03-27 13:47:36 +02:00
parent dd0c38b01d
commit a3daa89ef6
31 changed files with 20 additions and 82 deletions

View File

@@ -1658,17 +1658,7 @@ int main(int argc, char *argv[])
control_start(control);
kc.start();
if(mainloop) {
if (display_needs_mainloop(uv.display_device)) {
throw string("Cannot run display when "
"another mainloop registered!\n");
}
display_run_new_thread(uv.display_device);
mainloop(mainloop_udata);
display_join(uv.display_device);
} else {
display_run_this_thread(uv.display_device);
}
display_run_mainloop(uv.display_device);
} catch (ug_no_error const &e) {
exit_uv(0);