Page 1 of 1

libvlcpp: how to exit program when window is closed

Posted: 09 Oct 2021 11:27
by mediajoy
Hello everyone, :)
I use the C++ libvlcpp bindings and can not find any way to check if the window was closed. Maybe there is a method I am missing out?

When I close the window, the vlc library outputs:

Code: Select all

xcb_window window error: X server failure
But the program continues working in the background without any window. To restart the program, I have to kill it manually. This is not the expected behaviour for the user!

I have tried to create my own X window with XCB, but this is quite complicated, and seems overkill only for an additional check if a window was closed. :( Also, libvlc already manages a window pretty well and even handles X events such as double-click to toggle fullscreen and it hides the cursor if it enters the window. (libvlc even handles handles the double-click event if I create my own X window, which is odd.)

Finally, if there would be just another function, which returns the state of the window (open, closed or killed), that would be all I need. If it returns a value which indicates window destruction I would exit my program.

I would appreciate a lot, if you add such a function. :)

Re: libvlcpp: how to exit program when window is closed

Posted: 09 Oct 2021 20:49
by Rémi Denis-Courmont
It is up to your program to request LibVLC to stop when you think it should do so. Normally, the GUI framework does most of the work for you.

Re: libvlcpp: how to exit program when window is closed

Posted: 10 Oct 2021 00:27
by mediajoy
What do you mean by the GUI framework?

Re: libvlcpp: how to exit program when window is closed

Posted: 26 Oct 2021 15:26
by Rémi Denis-Courmont
The GUI toolkit