[vlc-devel] [PATCH 1/2] RFC vout:win32: do not use a display module with a dummy vout_window_t

Steve Lhomme robux4 at ycbcr.xyz
Thu Apr 4 11:04:35 CEST 2019


On 4/2/2019 5:46 PM, Rémi Denis-Courmont wrote:
> Le tiistaina 2. huhtikuuta 2019, 17.37.55 EEST Steve Lhomme a écrit :
>> Now that we have a proper Win32 vout_window_t there's no reason to allow a
>> dummy one and handle a window in the display module.
>> ---
>>   modules/video_output/win32/events.c | 46 ++++++++++-------------------
>>   1 file changed, 15 insertions(+), 31 deletions(-)
>>
>> diff --git a/modules/video_output/win32/events.c
>> b/modules/video_output/win32/events.c index 6611951b4e..98920290e3 100644
>> --- a/modules/video_output/win32/events.c
>> +++ b/modules/video_output/win32/events.c
>> @@ -327,13 +327,6 @@ static void *EventThread( void *p_this )
>>
>>       } /* End Main loop */
>>
>> -    /* Check for WM_QUIT if we created the window */
>> -    if( !p_event->hparent && msg.message == WM_QUIT )
>> -    {
>> -        msg_Warn( p_event->obj, "WM_QUIT... should not happen!!" );
>> -        p_event->hwnd = NULL; /* Window already destroyed */
>> -    }
>> -
>>       msg_Dbg( p_event->obj, "Win32 Vout EventThread terminating" );
>>
>>       Win32VoutCloseWindow( p_event );
>> @@ -356,8 +349,7 @@ bool EventThreadGetAndResetSizeChanged( event_thread_t
>> *p_event )
>>
>>   event_thread_t *EventThreadCreate( vlc_object_t *obj, vout_window_t
>> *parent_window) {
>> -    if (parent_window->type != VOUT_WINDOW_TYPE_HWND &&
>> -        !(parent_window->type == VOUT_WINDOW_TYPE_DUMMY &&
>> parent_window->handle.hwnd == 0)) +    if (parent_window->type !=
>> VOUT_WINDOW_TYPE_HWND)
>>           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
>> @@ -636,10 +628,8 @@ static int Win32VoutCreateWindow( event_thread_t
>> *p_event ) hInstance = GetModuleHandle(NULL);
>>
>>       /* If an external window was specified, we'll draw in it. */
>> -    if ( p_event->parent_window->type == VOUT_WINDOW_TYPE_HWND )
>> -        p_event->hparent = p_event->parent_window->handle.hwnd;
>> -    else
>> -        p_event->hparent = NULL;
>> +    assert( p_event->parent_window->type == VOUT_WINDOW_TYPE_HWND );
>> +    p_event->hparent = p_event->parent_window->handle.hwnd;
>>       p_event->cursor_arrow = LoadCursor(NULL, IDC_ARROW);
>>       p_event->cursor_empty = EmptyCursor(hInstance);
>>
>> @@ -670,16 +660,13 @@ static int Win32VoutCreateWindow( event_thread_t
>> *p_event ) return VLC_EGENERIC;
>>       }
>>
>> -    if( p_event->hparent )
>> -    {
>> -        i_style = WS_VISIBLE|WS_CLIPCHILDREN|WS_CHILD;
>> +    i_style = WS_VISIBLE|WS_CLIPCHILDREN|WS_CHILD;
>>
>> -        /* allow user to regain control over input events if requested */
>> -        bool b_mouse_support = var_InheritBool( p_event->obj,
>> "mouse-events" ); -        bool b_key_support = var_InheritBool(
>> p_event->obj, "keyboard-events" ); -        if( !b_mouse_support &&
>> !b_key_support )
>> -            i_style |= WS_DISABLED;
>> -    }
>> +    /* allow user to regain control over input events if requested */
>> +    bool b_mouse_support = var_InheritBool( p_event->obj, "mouse-events" );
>> +    bool b_key_support = var_InheritBool( p_event->obj, "keyboard-events"
>> ); +    if( !b_mouse_support && !b_key_support )
>> +        i_style |= WS_DISABLED;
> AFAIU Win32 GUI, input events should be forwarded to the parent window in this
> case. Then there should be no needs to care about those settings here.

We could just use WS_DISABLED on both HWND and no care about 
mouse/keyboard events. But I think (I can't test) that gestures will 
also be disabled and right now we don't handle it in Qt nor in the 
vout_window_t. So I don't use the flag for now and will forward mouse 
events to the parent window (the keyboard seems to be handled properly 
without any special treatment).

>
> Though that would probably belong in a separate patch anyway.
>
> LGTM.
>
> -- 
> レミ・デニ-クールモン
> http://www.remlab.net/
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list