|
| 1 | +From 5de92e04dd7d6cc5e200b7b1481e41b543b54a17 Mon Sep 17 00:00:00 2001 |
| 2 | +From: KO Myung-Hun <komh@chollian.net> |
| 3 | +Date: Mon, 22 Oct 2012 18:13:06 +0900 |
| 4 | +Subject: [PATCH 02/26] kva: workaround stays-on-top of Qt 4.7.3GA for OS/2 |
| 5 | + |
| 6 | +Qt::WindowStaysOnTopHint does not work on Qt 4.7.3GA for OS/2. |
| 7 | +--- |
| 8 | + modules/video_output/kva.c | 90 +++++++++++++++++++++++++++++++++++++++++++--- |
| 9 | + 1 file changed, 85 insertions(+), 5 deletions(-) |
| 10 | + |
| 11 | +diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c |
| 12 | +index 15acb1a5fb..659272f2c7 100644 |
| 13 | +--- a/modules/video_output/kva.c |
| 14 | ++++ b/modules/video_output/kva.c |
| 15 | +@@ -75,6 +75,15 @@ vlc_module_begin () |
| 16 | + set_callbacks( Open, Close ) |
| 17 | + vlc_module_end () |
| 18 | + |
| 19 | ++/* Qt::WindowStaysOnTopHint does not work on Qt 4.7.3GA for OS/2. |
| 20 | ++ * Use workaround for this. |
| 21 | ++ */ |
| 22 | ++#define USE_WORKAROUND_STAYS_ON_TOP_OF_QT 1 |
| 23 | ++ |
| 24 | ++#if USE_WORKAROUND_STAYS_ON_TOP_OF_QT |
| 25 | ++# define QPOPUP_CLASS "QPopup" |
| 26 | ++#endif |
| 27 | ++ |
| 28 | + /***************************************************************************** |
| 29 | + * vout_display_sys_t: video output method descriptor |
| 30 | + ***************************************************************************** |
| 31 | +@@ -103,6 +112,9 @@ struct vout_display_sys_t |
| 32 | + unsigned button_pressed; |
| 33 | + bool is_mouse_hidden; |
| 34 | + bool is_on_top; |
| 35 | ++#if USE_WORKAROUND_STAYS_ON_TOP_OF_QT |
| 36 | ++ PID pid; |
| 37 | ++#endif |
| 38 | + }; |
| 39 | + |
| 40 | + struct picture_sys_t |
| 41 | +@@ -216,7 +228,7 @@ static void PMThread( void *arg ) |
| 42 | + |
| 43 | + WinSetWindowPtr( sys->client, 0, vd ); |
| 44 | + |
| 45 | +- if( !sys->parent_window ) |
| 46 | ++ if( !sys->parent_window || USE_WORKAROUND_STAYS_ON_TOP_OF_QT ) |
| 47 | + { |
| 48 | + WinSetWindowPtr( sys->frame, 0, vd ); |
| 49 | + sys->p_old_frame = WinSubclassWindow( sys->frame, MyFrameWndProc ); |
| 50 | +@@ -277,13 +289,17 @@ static void PMThread( void *arg ) |
| 51 | + sys->i_result = VLC_SUCCESS; |
| 52 | + DosPostEventSem( sys->ack_event ); |
| 53 | + |
| 54 | +- if( !sys->parent_window ) |
| 55 | ++ if( !sys->parent_window || USE_WORKAROUND_STAYS_ON_TOP_OF_QT ) |
| 56 | + WinSetVisibleRegionNotify( sys->frame, TRUE ); |
| 57 | + |
| 58 | ++#if USE_WORKAROUND_STAYS_ON_TOP_OF_QT |
| 59 | ++ WinQueryWindowProcess( sys->frame, &sys->pid, NULL ); |
| 60 | ++#endif |
| 61 | ++ |
| 62 | + while( WinGetMsg( sys->hab, &qm, NULLHANDLE, 0, 0 )) |
| 63 | + WinDispatchMsg( sys->hab, &qm ); |
| 64 | + |
| 65 | +- if( !sys->parent_window ) |
| 66 | ++ if( !sys->parent_window || USE_WORKAROUND_STAYS_ON_TOP_OF_QT ) |
| 67 | + WinSetVisibleRegionNotify( sys->frame, FALSE ); |
| 68 | + |
| 69 | + kvaEnableScreenSaver(); |
| 70 | +@@ -296,7 +312,7 @@ exit_open_display : |
| 71 | + kvaDone(); |
| 72 | + |
| 73 | + exit_kva_init : |
| 74 | +- if( !sys->parent_window ) |
| 75 | ++ if( !sys->parent_window || USE_WORKAROUND_STAYS_ON_TOP_OF_QT ) |
| 76 | + WinSubclassWindow( sys->frame, sys->p_old_frame ); |
| 77 | + |
| 78 | + WinDestroyWindow( sys->frame ); |
| 79 | +@@ -919,7 +935,71 @@ static MRESULT EXPENTRY MyFrameWndProc( HWND hwnd, ULONG msg, MPARAM mp1, |
| 80 | + //case WM_VRNDISABLED : |
| 81 | + case WM_VRNENABLED : |
| 82 | + if( !vd->cfg->is_fullscreen && sys->is_on_top ) |
| 83 | +- WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); |
| 84 | ++ { |
| 85 | ++ HWND frame = hwnd; |
| 86 | ++ HWND top = HWND_TOP; |
| 87 | ++ |
| 88 | ++#if USE_WORKAROUND_STAYS_ON_TOP_OF_QT |
| 89 | ++ if( sys->parent_window ) |
| 90 | ++ { |
| 91 | ++ HWND parent; |
| 92 | ++ HWND desktop = WinQueryDesktopWindow( sys->hab, |
| 93 | ++ NULLHANDLE ); |
| 94 | ++ |
| 95 | ++ /* Find a main window */ |
| 96 | ++ for( frame = sys->parent;; frame = parent ) |
| 97 | ++ { |
| 98 | ++ parent = WinQueryWindow( frame, QW_PARENT ); |
| 99 | ++ if( parent == desktop ) |
| 100 | ++ break; |
| 101 | ++ } |
| 102 | ++ } |
| 103 | ++ |
| 104 | ++ HENUM henum; |
| 105 | ++ HWND current; |
| 106 | ++ char szClassName[ 80 ]; |
| 107 | ++ PID pidCurrent; |
| 108 | ++ |
| 109 | ++ /* Find a QPopup window above a video window, but |
| 110 | ++ * belowest one. |
| 111 | ++ */ |
| 112 | ++ henum = WinBeginEnumWindows( HWND_DESKTOP ); |
| 113 | ++ while(( current = WinGetNextWindow( henum )) != NULLHANDLE ) |
| 114 | ++ { |
| 115 | ++ /* Reached to me ? */ |
| 116 | ++ if( current == frame ) |
| 117 | ++ break; |
| 118 | ++ |
| 119 | ++ /* Only check a physically showing window */ |
| 120 | ++ if( !WinIsWindowShowing( current )) |
| 121 | ++ continue; |
| 122 | ++ |
| 123 | ++ WinQueryWindowProcess( current, &pidCurrent, NULL ); |
| 124 | ++ |
| 125 | ++ if( pidCurrent == sys->pid ) |
| 126 | ++ { |
| 127 | ++ /* Behind any VLC window in case of |
| 128 | ++ * an embedded window. |
| 129 | ++ */ |
| 130 | ++ if( sys->parent_window ) |
| 131 | ++ { |
| 132 | ++ top = current; |
| 133 | ++ continue; |
| 134 | ++ } |
| 135 | ++ |
| 136 | ++ WinQueryClassName( current, sizeof( szClassName ), |
| 137 | ++ szClassName ); |
| 138 | ++ |
| 139 | ++ /* A QPopup window above me ? */ |
| 140 | ++ if( !strcmp( szClassName, QPOPUP_CLASS )) |
| 141 | ++ top = current; |
| 142 | ++ } |
| 143 | ++ } |
| 144 | ++ WinEndEnumWindows( henum ); |
| 145 | ++#endif |
| 146 | ++ |
| 147 | ++ WinSetWindowPos( frame, top, 0, 0, 0, 0, SWP_ZORDER ); |
| 148 | ++ } |
| 149 | + break; |
| 150 | + } |
| 151 | + |
| 152 | +-- |
| 153 | +2.13.3 |
| 154 | + |
0 commit comments