[vlc-commits] [Git][videolan/vlc][3.0.x] 5 commits: doc/win_player: set WS_CLIPCHILDREN on our window

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Feb 9 12:08:29 UTC 2024



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
5c990a10 by Steve Lhomme at 2024-02-06T13:02:01+01:00
doc/win_player: set WS_CLIPCHILDREN on our window

So the display module doesn't have to do it in its own thread.

(cherry picked from commit 70535e54021563f851417a7aefc5d2e2e52afb6e)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
a5d5e6bc by Steve Lhomme at 2024-02-06T13:02:01+01:00
doc/QtPlayer: set WS_CLIPCHILDREN on our window

So the display module doesn't have to do it in its own thread.
It doesn't seem to be on by default in Qt and there's no direct API to set this.

(cherry picked from commit b29e2911fdbf4a1e53012794ed4a1b5a6cd8a5c0)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
60019609 by Steve Lhomme at 2024-02-06T13:02:01+01:00
doc/wx_player: set WS_CLIPCHILDREN on our window

So the display module doesn't have to do it in its own thread.

(cherry picked from commit 1ce31601a4234ae6bcd76e88ea93f814eb2356fd)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
cf7a7d34 by Steve Lhomme at 2024-02-06T13:02:01+01:00
doc: document that WS_CLIPCHILDREN must be set with set_hwnd()

So we don't have to do it internally in a potentially locking call.

(cherry picked from commit 102e4791528b3d11328fc701bda1dabd10aaf285)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
1eef18c4 by Steve Lhomme at 2024-02-06T13:12:54+01:00
vout/win32: don't force WS_CLIPCHILDREN internally

It's potentially locking. It should be set in the calling code.

(cherry picked from commit dc3d6b67a75418051667b0f9e597604a4074826e) (edited)
edited:
- the location of the call is different in 3.0 and didn't include assert.h
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


5 changed files:

- doc/libvlc/QtPlayer/player.cpp
- doc/libvlc/win_player.c
- doc/libvlc/wx_player.cpp
- include/vlc/libvlc_media_player.h
- modules/video_output/win32/events.c


Changes:

=====================================
doc/libvlc/QtPlayer/player.cpp
=====================================
@@ -148,6 +148,9 @@ void Mwindow::openFile() {
 #elif defined(Q_OS_UNIX)
     libvlc_media_player_set_xwindow(vlcPlayer, videoWidget->winId());
 #elif defined(Q_OS_WIN)
+    LONG style = GetWindowLong( videoWidget->winId(), GWL_STYLE );
+    if( !(style & WS_CLIPCHILDREN) )
+        SetWindowLong( videoWidget->winId(), GWL_STYLE, style | WS_CLIPCHILDREN );
     libvlc_media_player_set_hwnd(vlcPlayer, (HWND)videoWidget->winId());
 #endif
 


=====================================
doc/libvlc/win_player.c
=====================================
@@ -141,7 +141,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
     hWnd = CreateWindowEx(0,
                           "WindowClass",
                           "libvlc Demo app",
-                          WS_OVERLAPPEDWINDOW,
+                          WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
                           CW_USEDEFAULT, CW_USEDEFAULT,
                           wr.right - wr.left,
                           wr.bottom - wr.top,


=====================================
doc/libvlc/wx_player.cpp
=====================================
@@ -84,7 +84,7 @@ MainWindow::MainWindow(const wxString& title) : wxFrame(NULL, wxID_ANY, title, w
     this->SetSizer(vbox);
 
     //setup player widget
-    player_widget = new wxWindow(this, wxID_ANY);
+    player_widget = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
     player_widget->SetBackgroundColour(wxColour(wxT("black")));
     vbox->Add(player_widget, 1, wxEXPAND | wxALIGN_TOP);
 
@@ -140,6 +140,9 @@ void MainWindow::initVLC() {
     #ifdef __WXGTK__
         libvlc_media_player_set_xwindow(media_player, GET_XID(this->player_widget));
     #else
+        LONG style = GetWindowLong( player_widget->GetHandle(), GWL_STYLE );
+        if( !(style & WS_CLIPCHILDREN) )
+            SetWindowLong( player_widget->GetHandle(), GWL_STYLE, style | WS_CLIPCHILDREN );
         libvlc_media_player_set_hwnd(media_player, this->player_widget->GetHandle());
     #endif
 }


=====================================
include/vlc/libvlc_media_player.h
=====================================
@@ -559,6 +559,8 @@ LIBVLC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_m
  * render its video output. If LibVLC was built without Win32/Win64 API output
  * support, then this has no effects.
  *
+ * \warning the HWND must have the WS_CLIPCHILDREN set in its style.
+ *
  * \param p_mi the Media Player
  * \param drawable windows handle of the drawable
  */


=====================================
modules/video_output/win32/events.c
=====================================
@@ -40,6 +40,7 @@
 #include <windows.h>
 #include <windowsx.h>                                        /* GET_X_LPARAM */
 #include <shellapi.h>                                         /* ExtractIcon */
+#include <assert.h>
 
 #define vout_display_sys_win32_t vout_display_sys_t
 
@@ -819,15 +820,8 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
 
     if( p_event->hparent )
     {
-        LONG i_style;
-
         /* We don't want the window owner to overwrite our client area */
-        i_style = GetWindowLong( p_event->hparent, GWL_STYLE );
-
-        if( !(i_style & WS_CLIPCHILDREN) )
-            /* Hmmm, apparently this is a blocking call... */
-            SetWindowLong( p_event->hparent, GWL_STYLE,
-                           i_style | WS_CLIPCHILDREN );
+        assert( (GetWindowLong( p_event->hparent, GWL_STYLE ) & WS_CLIPCHILDREN) );
 
         /* Create our fullscreen window */
         p_event->hfswnd =



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/50acae2b5ba9ca47269f0fc228383a645d72242e...1eef18c45831810b25d36206f9ecfa68a4d4d66b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/50acae2b5ba9ca47269f0fc228383a645d72242e...1eef18c45831810b25d36206f9ecfa68a4d4d66b
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list