Spit out a warning when trying to set/unset fullscreen without server supporting it

Previously we only checked when connecting to the server whether it had
the minimum required version but didn't act accordingly in the various
functions that use the functionality of later versions. If there were a
server in the wild, that actually would not have this functionality,
there would have been a crash. Fix this by checking the version before
using the functionality and gracefully abort it.
This commit is contained in:
Till Smejkal 2020-12-04 08:04:02 +01:00
parent bb60e68b9d
commit 18f129a712
1 changed files with 5 additions and 0 deletions

View File

@ -546,6 +546,11 @@ void Task::activate()
void Task::fullscreen(bool set)
{
if (zwlr_foreign_toplevel_handle_v1_get_version(handle_) < ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_SET_FULLSCREEN_SINCE_VERSION) {
spdlog::warn("Foreign toplevel manager server does not support for set/unset fullscreen.");
return;
}
if (set)
zwlr_foreign_toplevel_handle_v1_set_fullscreen(handle_, nullptr);
else