Skip to content

Commit

Permalink
Patches against vlc-3.0.21 release
Browse files Browse the repository at this point in the history
  • Loading branch information
komh committed Jun 17, 2024
1 parent 8614edf commit 3df39dc
Show file tree
Hide file tree
Showing 27 changed files with 2,598 additions and 0 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
From 62e5f0ebcc191a7fdbcdc1e7c784f4c29d1bfdba Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <[email protected]>
Date: Mon, 22 Oct 2012 18:13:06 +0900
Subject: [PATCH 02/26] kva: workaround stays-on-top of Qt 4.7.3GA for OS/2

Qt::WindowStaysOnTopHint does not work on Qt 4.7.3GA for OS/2.
---
modules/video_output/kva.c | 90 +++++++++++++++++++++++++++++++++++---
1 file changed, 85 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index a97821626f..16d7f18bdf 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -75,6 +75,15 @@ vlc_module_begin ()
set_callbacks( Open, Close )
vlc_module_end ()

+/* Qt::WindowStaysOnTopHint does not work on Qt 4.7.3GA for OS/2.
+ * Use workaround for this.
+ */
+#define USE_WORKAROUND_STAYS_ON_TOP_OF_QT 1
+
+#if USE_WORKAROUND_STAYS_ON_TOP_OF_QT
+# define QPOPUP_CLASS "QPopup"
+#endif
+
/*****************************************************************************
* vout_display_sys_t: video output method descriptor
*****************************************************************************
@@ -103,6 +112,9 @@ struct vout_display_sys_t
unsigned button_pressed;
bool is_mouse_hidden;
bool is_on_top;
+#if USE_WORKAROUND_STAYS_ON_TOP_OF_QT
+ PID pid;
+#endif
};

struct picture_sys_t
@@ -216,7 +228,7 @@ static void PMThread( void *arg )

WinSetWindowPtr( sys->client, 0, vd );

- if( !sys->parent_window )
+ if( !sys->parent_window || USE_WORKAROUND_STAYS_ON_TOP_OF_QT )
{
WinSetWindowPtr( sys->frame, 0, vd );
sys->p_old_frame = WinSubclassWindow( sys->frame, MyFrameWndProc );
@@ -277,13 +289,17 @@ static void PMThread( void *arg )
sys->i_result = VLC_SUCCESS;
DosPostEventSem( sys->ack_event );

- if( !sys->parent_window )
+ if( !sys->parent_window || USE_WORKAROUND_STAYS_ON_TOP_OF_QT )
WinSetVisibleRegionNotify( sys->frame, TRUE );

+#if USE_WORKAROUND_STAYS_ON_TOP_OF_QT
+ WinQueryWindowProcess( sys->frame, &sys->pid, NULL );
+#endif
+
while( WinGetMsg( sys->hab, &qm, NULLHANDLE, 0, 0 ))
WinDispatchMsg( sys->hab, &qm );

- if( !sys->parent_window )
+ if( !sys->parent_window || USE_WORKAROUND_STAYS_ON_TOP_OF_QT )
WinSetVisibleRegionNotify( sys->frame, FALSE );

kvaEnableScreenSaver();
@@ -296,7 +312,7 @@ exit_open_display :
kvaDone();

exit_kva_init :
- if( !sys->parent_window )
+ if( !sys->parent_window || USE_WORKAROUND_STAYS_ON_TOP_OF_QT )
WinSubclassWindow( sys->frame, sys->p_old_frame );

WinDestroyWindow( sys->frame );
@@ -919,7 +935,71 @@ static MRESULT EXPENTRY MyFrameWndProc( HWND hwnd, ULONG msg, MPARAM mp1,
//case WM_VRNDISABLED :
case WM_VRNENABLED :
if( !vd->cfg->is_fullscreen && sys->is_on_top )
- WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER );
+ {
+ HWND frame = hwnd;
+ HWND top = HWND_TOP;
+
+#if USE_WORKAROUND_STAYS_ON_TOP_OF_QT
+ if( sys->parent_window )
+ {
+ HWND parent;
+ HWND desktop = WinQueryDesktopWindow( sys->hab,
+ NULLHANDLE );
+
+ /* Find a main window */
+ for( frame = sys->parent;; frame = parent )
+ {
+ parent = WinQueryWindow( frame, QW_PARENT );
+ if( parent == desktop )
+ break;
+ }
+ }
+
+ HENUM henum;
+ HWND current;
+ char szClassName[ 80 ];
+ PID pidCurrent;
+
+ /* Find a QPopup window above a video window, but
+ * belowest one.
+ */
+ henum = WinBeginEnumWindows( HWND_DESKTOP );
+ while(( current = WinGetNextWindow( henum )) != NULLHANDLE )
+ {
+ /* Reached to me ? */
+ if( current == frame )
+ break;
+
+ /* Only check a physically showing window */
+ if( !WinIsWindowShowing( current ))
+ continue;
+
+ WinQueryWindowProcess( current, &pidCurrent, NULL );
+
+ if( pidCurrent == sys->pid )
+ {
+ /* Behind any VLC window in case of
+ * an embedded window.
+ */
+ if( sys->parent_window )
+ {
+ top = current;
+ continue;
+ }
+
+ WinQueryClassName( current, sizeof( szClassName ),
+ szClassName );
+
+ /* A QPopup window above me ? */
+ if( !strcmp( szClassName, QPOPUP_CLASS ))
+ top = current;
+ }
+ }
+ WinEndEnumWindows( henum );
+#endif
+
+ WinSetWindowPos( frame, top, 0, 0, 0, 0, SWP_ZORDER );
+ }
break;
}

--
2.42.0

Loading

0 comments on commit 3df39dc

Please sign in to comment.