[vlc-commits] vout:win32: keep the window when the event thread is created

Steve Lhomme git at videolan.org
Tue Nov 27 17:24:16 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Nov 13 08:59:13 2018 +0100| [210a5ddb4cad60255d2776d4789e2d332a49e47e] | committer: Thomas Guillem

vout:win32: keep the window when the event thread is created

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=210a5ddb4cad60255d2776d4789e2d332a49e47e
---

 modules/video_output/win32/events.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 9db4afdb06..0dfa779bae 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -313,7 +313,7 @@ static void *EventThread( void *p_this )
                     i_key |= KEY_MODIFIER_ALT;
                 }
 
-                vout_display_SendEventKey(vd, i_key);
+                vout_window_ReportKeyPress(p_event->parent_window, i_key);
             }
             break;
         }
@@ -343,7 +343,7 @@ static void *EventThread( void *p_this )
                 {
                     i_key |= KEY_MODIFIER_ALT;
                 }
-                vout_display_SendEventKey(vd, i_key);
+                vout_window_ReportKeyPress(p_event->parent_window, i_key);
             }
             break;
         }
@@ -458,6 +458,9 @@ bool EventThreadGetAndResetHasMoved( event_thread_t *p_event )
 
 event_thread_t *EventThreadCreate( vout_display_t *vd, const vout_display_cfg_t *vdcfg)
 {
+    if (vdcfg->window->type != VOUT_WINDOW_TYPE_HWND &&
+        !(vdcfg->window->type == VOUT_WINDOW_TYPE_DUMMY && vdcfg->window->handle.hwnd == 0))
+        return NULL;
      /* Create the Vout EventThread, this thread is created by us to isolate
      * the Win32 PeekMessage function calls. We want to do this because
      * Windows can stay blocked inside this call for a long time, and when
@@ -474,6 +477,8 @@ event_thread_t *EventThreadCreate( vout_display_t *vd, const vout_display_cfg_t
     vlc_mutex_init( &p_event->lock );
     vlc_cond_init( &p_event->wait );
 
+    p_event->parent_window = vdcfg->window;
+
     p_event->is_cursor_hidden = false;
     p_event->button_pressed = 0;
     p_event->psz_title = NULL;
@@ -690,11 +695,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
     #endif
     {
         /* If an external window was specified, we'll draw in it. */
-        p_event->parent_window = vout_display_NewWindow(vd, VOUT_WINDOW_TYPE_HWND);
-        if( p_event->parent_window )
-            p_event->hparent = p_event->parent_window->handle.hwnd;
-        else
-            p_event->hparent = NULL;
+        p_event->hparent = p_event->parent_window->handle.hwnd;
     }
     #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
     else
@@ -1012,7 +1013,7 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message,
 
     /* the user wants to close the window */
     case WM_CLOSE:
-        vout_display_SendEventClose(vd);
+        vout_window_ReportClose(p_event->parent_window);
         return 0;
 
     /* the window has been closed so shut down everything now */



More information about the vlc-commits mailing list