libvlcpp: how to exit program when window is closed

This forum is about all development around libVLC.
mediajoy
New Cone
New Cone
Posts: 4
Joined: 21 Jul 2021 11:49

libvlcpp: how to exit program when window is closed

Postby mediajoy » 09 Oct 2021 11:27

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. :)

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 09 Oct 2021 20:49

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mediajoy
New Cone
New Cone
Posts: 4
Joined: 21 Jul 2021 11:49

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

Postby mediajoy » 10 Oct 2021 00:27

What do you mean by the GUI framework?

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 26 Oct 2021 15:26

The GUI toolkit
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 34 guests