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

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Feb 6 11:39:34 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
70535e54 by Steve Lhomme at 2024-02-06T11:22:12+00:00
doc/win_player: set WS_CLIPCHILDREN on our window

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

- - - - -
b29e2911 by Steve Lhomme at 2024-02-06T11:22:12+00: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.

- - - - -
1ce31601 by Steve Lhomme at 2024-02-06T11:22:12+00:00
doc/wx_player: set WS_CLIPCHILDREN on our window

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

- - - - -
102e4791 by Steve Lhomme at 2024-02-06T11:22:12+00: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.

- - - - -
dc3d6b67 by Steve Lhomme at 2024-02-06T11:22:12+00:00
vout/win32: don't force WS_CLIPCHILDREN internally

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

- - - - -


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
=====================================
@@ -149,6 +149,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
=====================================
@@ -137,7 +137,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
=====================================
@@ -985,6 +985,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
=====================================
@@ -228,11 +228,7 @@ static int Win32VoutCreateWindow( struct event_thread_t *p_event )
     msg_Dbg( p_event->obj, "created video window" );
 
     /* We don't want the window owner to overwrite our client area */
-    LONG  parent_style = GetWindowLong( p_event->hparent, GWL_STYLE );
-    if( !(parent_style & WS_CLIPCHILDREN) )
-        /* Hmmm, apparently this is a blocking call... */
-        SetWindowLong( p_event->hparent, GWL_STYLE,
-                       parent_style | WS_CLIPCHILDREN );
+    assert( GetWindowLong( p_event->hparent, GWL_STYLE ) & WS_CLIPCHILDREN );
 
 #ifdef HAVE_WIN32_SENSORS
     if (p_event->init_move != NULL)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a731f7e00b1caf1123014a03a235c1f69d2da6a7...dc3d6b67a75418051667b0f9e597604a4074826e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a731f7e00b1caf1123014a03a235c1f69d2da6a7...dc3d6b67a75418051667b0f9e597604a4074826e
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