[vlc-commits] [Git][videolan/vlc][master] Deleted 2 commits: display: remove unnecessary #include

Thomas Guillem (@tguillem) gitlab at videolan.org
Wed Dec 1 13:05:19 UTC 2021



Thomas Guillem pushed to branch master at VideoLAN / VLC


WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below.


Deleted commits:
de2518b1 by Rémi Denis-Courmont at 2021-11-30T22:00:37+02:00
display: remove unnecessary #include

- - - - -
2ddcadde by Rémi Denis-Courmont at 2021-11-30T22:00:37+02:00
window: split generic and vout-specific code

- - - - -


6 changed files:

- src/Makefile.am
- src/video_output/display.c
- src/video_output/video_output.c
- + src/video_output/video_window.c
- src/video_output/window.h → src/video_output/video_window.h
- src/video_output/window.c


Changes:

=====================================
src/Makefile.am
=====================================
@@ -329,8 +329,9 @@ libvlccore_la_SOURCES = \
 	video_output/vout_subpictures.c \
 	video_output/vout_spuregion_helper.h \
 	video_output/vout_wrapper.h \
+	video_output/video_window.c \
+	video_output/video_window.h \
 	video_output/window.c \
-	video_output/window.h \
 	video_output/opengl.c \
 	video_output/vout_intf.c \
 	video_output/vout_internal.h \


=====================================
src/video_output/display.c
=====================================
@@ -41,7 +41,6 @@
 #include <libvlc.h>
 
 #include "display.h"
-#include "window.h"
 #include "vout_internal.h"
 
 /*****************************************************************************


=====================================
src/video_output/video_output.c
=====================================
@@ -55,7 +55,7 @@
 #include "vout_internal.h"
 #include "display.h"
 #include "snapshot.h"
-#include "window.h"
+#include "video_window.h"
 #include "../misc/variables.h"
 #include "../clock/clock.h"
 #include "statistic.h"


=====================================
src/video_output/video_window.c
=====================================
@@ -0,0 +1,242 @@
+/*****************************************************************************
+ * video_window.c: vout-specific window management
+ *****************************************************************************
+ * Copyright © 2014-2021 Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <assert.h>
+#include <stdlib.h>
+
+#include <vlc_common.h>
+#include <vlc_vout_window.h>
+#include <vlc_vout.h>
+#include <vlc_vout_display.h>
+#include "video_window.h"
+#include "vout_internal.h"
+
+#define DOUBLE_CLICK_TIME VLC_TICK_FROM_MS(300)
+
+struct vout_window_ack_data {
+    vout_window_t *window;
+    vout_window_ack_cb callback;
+    unsigned width;
+    unsigned height;
+    void *opaque;
+};
+
+static void vout_window_Ack(void *data)
+{
+    struct vout_window_ack_data *cb_data = data;
+
+    if (cb_data->callback != NULL)
+        cb_data->callback(cb_data->window, cb_data->width, cb_data->height,
+                          cb_data->opaque);
+}
+
+typedef struct vout_display_window
+{
+    vout_thread_t *vout;
+    vlc_mouse_t mouse;
+    vlc_tick_t last_left_press;
+} vout_display_window_t;
+
+static void vout_display_window_ResizeNotify(vout_window_t *window,
+                                             unsigned width, unsigned height,
+                                             vout_window_ack_cb cb,
+                                             void *opaque)
+{
+    vout_display_window_t *state = window->owner.sys;
+    vout_thread_t *vout = state->vout;
+    struct vout_window_ack_data data = { window, cb, width, height, opaque };
+
+    msg_Dbg(window, "resized to %ux%u", width, height);
+    vout_ChangeDisplaySize(vout, width, height, vout_window_Ack, &data);
+}
+
+static void vout_display_window_CloseNotify(vout_window_t *window)
+{
+    /* TODO: Nowhere to dispatch to currently.
+     * Needs callback to ES output to deselect ES? */
+    msg_Err(window, "window closed");
+}
+
+static void vout_display_window_StateNotify(vout_window_t *window,
+                                            unsigned window_state)
+{
+    vout_display_window_t *state = window->owner.sys;
+    vout_thread_t *vout = state->vout;
+
+    static const char states[][8] = {
+        [VOUT_WINDOW_STATE_NORMAL] = "normal",
+        [VOUT_WINDOW_STATE_ABOVE] = "above",
+        [VOUT_WINDOW_STATE_BELOW] = "below",
+    };
+
+    assert(window_state < ARRAY_SIZE(states));
+    msg_Dbg(window, "window state changed: %s", states[window_state]);
+    var_SetInteger(vout, "window-state", window_state);
+}
+
+static void vout_display_window_FullscreenNotify(vout_window_t *window,
+                                                 const char *id)
+{
+    vout_display_window_t *state = window->owner.sys;
+    vout_thread_t *vout = state->vout;
+
+    msg_Dbg(window, (id != NULL) ? "window set to fullscreen on %s"
+                                 : "window set to fullscreen", id);
+    var_SetString(vout, "window-fullscreen-output",
+                  (id != NULL) ? id : "");
+    var_SetBool(vout, "window-fullscreen", true);
+}
+
+static void vout_display_window_WindowingNotify(vout_window_t *window)
+{
+    vout_display_window_t *state = window->owner.sys;
+    vout_thread_t *vout = state->vout;
+
+    msg_Dbg(window, "window set windowed");
+    var_SetBool(vout, "window-fullscreen", false);
+}
+
+static void vout_display_window_MouseEvent(vout_window_t *window,
+                                           const vout_window_mouse_event_t *ev)
+{
+    vout_display_window_t *state = window->owner.sys;
+    vout_thread_t *vout = state->vout;
+    vlc_mouse_t *m = &state->mouse;
+
+    m->b_double_click = false;
+
+    switch (ev->type)
+    {
+        case VOUT_WINDOW_MOUSE_MOVED:
+            vlc_mouse_SetPosition(m, ev->x, ev->y);
+            state->last_left_press = INT64_MIN;
+            break;
+
+        case VOUT_WINDOW_MOUSE_PRESSED:
+            if (!window->info.has_double_click
+             && ev->button_mask == MOUSE_BUTTON_LEFT
+             && !vlc_mouse_IsLeftPressed(m))
+            {
+                const vlc_tick_t now = vlc_tick_now();
+
+                if (state->last_left_press != INT64_MIN
+                 && now - state->last_left_press < DOUBLE_CLICK_TIME)
+                {
+                    m->b_double_click = true;
+                    state->last_left_press = INT64_MIN;
+                }
+                else
+                    state->last_left_press = now;
+            }
+
+            vlc_mouse_SetPressed(m, ev->button_mask);
+            break;
+
+        case VOUT_WINDOW_MOUSE_RELEASED:
+            vlc_mouse_SetReleased(m, ev->button_mask);
+            break;
+
+        case VOUT_WINDOW_MOUSE_DOUBLE_CLICK:
+            assert(window->info.has_double_click);
+            m->b_double_click = true;
+            break;
+
+        default:
+            vlc_assert_unreachable();
+    }
+
+    vout_MouseState(vout, m);
+}
+
+static void vout_display_window_KeyboardEvent(vout_window_t *window,
+                                              unsigned key)
+{
+    var_SetInteger(vlc_object_instance(window), "key-pressed", key);
+}
+
+static void vout_display_window_OutputEvent(vout_window_t *window,
+                                            const char *name, const char *desc)
+{
+    if (desc != NULL)
+        msg_Dbg(window, "fullscreen output %s (%s) added", name, desc);
+    else
+        msg_Dbg(window, "fullscreen output %s removed", name);
+}
+
+static const struct vout_window_callbacks vout_display_window_cbs = {
+    .resized = vout_display_window_ResizeNotify,
+    .closed = vout_display_window_CloseNotify,
+    .state_changed = vout_display_window_StateNotify,
+    .fullscreened = vout_display_window_FullscreenNotify,
+    .windowed = vout_display_window_WindowingNotify,
+    .mouse_event = vout_display_window_MouseEvent,
+    .keyboard_event = vout_display_window_KeyboardEvent,
+    .output_event = vout_display_window_OutputEvent,
+};
+
+/**
+ * Creates a video window, initially without any attached display.
+ */
+vout_window_t *vout_display_window_New(vout_thread_t *vout)
+{
+    vout_display_window_t *state = malloc(sizeof (*state));
+    if (state == NULL)
+        return NULL;
+
+    vlc_mouse_Init(&state->mouse);
+    state->last_left_press = INT64_MIN;
+    state->vout = vout;
+
+    char *modlist = var_InheritString(vout, "window");
+    vout_window_owner_t owner = {
+        .cbs = &vout_display_window_cbs,
+        .sys = state,
+    };
+    vout_window_t *window;
+
+    var_Create(vout, "window-state", VLC_VAR_INTEGER);
+    var_Create(vout, "window-fullscreen", VLC_VAR_BOOL);
+    var_Create(vout, "window-fullscreen-output", VLC_VAR_STRING);
+
+    window = vout_window_New((vlc_object_t *)vout, modlist, &owner);
+    free(modlist);
+    if (window == NULL)
+        free(state);
+    return window;
+}
+
+/**
+ * Destroys a video window.
+ * \note The window must be detached.
+ */
+void vout_display_window_Delete(vout_window_t *window)
+{
+    vout_display_window_t *state = window->owner.sys;
+    vout_thread_t *vout = state->vout;
+
+    vout_window_Delete(window);
+    var_Destroy(vout, "window-fullscreen-output");
+    var_Destroy(vout, "window-fullscreen");
+    var_Destroy(vout, "window-state");
+    free(state);
+}


=====================================
src/video_output/window.h → src/video_output/video_window.h
=====================================
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * window.h: window management for VLC video output
+ * video_window.h: window management for VLC video output
  *****************************************************************************
  * Copyright © 2014 Rémi Denis-Courmont
  *


=====================================
src/video_output/window.c
=====================================
@@ -1,7 +1,8 @@
 /*****************************************************************************
- * window.c: "vout window" management
+ * window.c: generic window management
  *****************************************************************************
  * Copyright (C) 2009 Laurent Aimar
+ * Copyright © 2009-2021 Rémi Denis-Courmont
  *
  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
  *
@@ -197,219 +198,3 @@ void vout_window_ReportFullscreen(vout_window_t *window, const char *id)
     if (window->owner.cbs->fullscreened != NULL)
         window->owner.cbs->fullscreened(window, id);
 }
-
-struct vout_window_ack_data {
-    vout_window_t *window;
-    vout_window_ack_cb callback;
-    unsigned width;
-    unsigned height;
-    void *opaque;
-};
-
-static void vout_window_Ack(void *data)
-{
-    struct vout_window_ack_data *cb_data = data;
-
-    if (cb_data->callback != NULL)
-        cb_data->callback(cb_data->window, cb_data->width, cb_data->height,
-                          cb_data->opaque);
-}
-
-/* Video output display integration */
-#include <vlc_vout.h>
-#include <vlc_vout_display.h>
-#include "window.h"
-#include "vout_internal.h"
-
-#define DOUBLE_CLICK_TIME VLC_TICK_FROM_MS(300)
-
-typedef struct vout_display_window
-{
-    vout_thread_t *vout;
-    vlc_mouse_t mouse;
-    vlc_tick_t last_left_press;
-} vout_display_window_t;
-
-static void vout_display_window_ResizeNotify(vout_window_t *window,
-                                             unsigned width, unsigned height,
-                                             vout_window_ack_cb cb,
-                                             void *opaque)
-{
-    vout_display_window_t *state = window->owner.sys;
-    vout_thread_t *vout = state->vout;
-    struct vout_window_ack_data data = { window, cb, width, height, opaque };
-
-    msg_Dbg(window, "resized to %ux%u", width, height);
-    vout_ChangeDisplaySize(vout, width, height, vout_window_Ack, &data);
-}
-
-static void vout_display_window_CloseNotify(vout_window_t *window)
-{
-    /* TODO: Nowhere to dispatch to currently.
-     * Needs callback to ES output to deselect ES? */
-    msg_Err(window, "window closed");
-}
-
-static void vout_display_window_StateNotify(vout_window_t *window,
-                                            unsigned window_state)
-{
-    vout_display_window_t *state = window->owner.sys;
-    vout_thread_t *vout = state->vout;
-
-    static const char states[][8] = {
-        [VOUT_WINDOW_STATE_NORMAL] = "normal",
-        [VOUT_WINDOW_STATE_ABOVE] = "above",
-        [VOUT_WINDOW_STATE_BELOW] = "below",
-    };
-
-    assert(window_state < ARRAY_SIZE(states));
-    msg_Dbg(window, "window state changed: %s", states[window_state]);
-    var_SetInteger(vout, "window-state", window_state);
-}
-
-static void vout_display_window_FullscreenNotify(vout_window_t *window,
-                                                 const char *id)
-{
-    vout_display_window_t *state = window->owner.sys;
-    vout_thread_t *vout = state->vout;
-
-    msg_Dbg(window, (id != NULL) ? "window set to fullscreen on %s"
-                                 : "window set to fullscreen", id);
-    var_SetString(vout, "window-fullscreen-output",
-                  (id != NULL) ? id : "");
-    var_SetBool(vout, "window-fullscreen", true);
-}
-
-static void vout_display_window_WindowingNotify(vout_window_t *window)
-{
-    vout_display_window_t *state = window->owner.sys;
-    vout_thread_t *vout = state->vout;
-
-    msg_Dbg(window, "window set windowed");
-    var_SetBool(vout, "window-fullscreen", false);
-}
-
-static void vout_display_window_MouseEvent(vout_window_t *window,
-                                           const vout_window_mouse_event_t *ev)
-{
-    vout_display_window_t *state = window->owner.sys;
-    vout_thread_t *vout = state->vout;
-    vlc_mouse_t *m = &state->mouse;
-
-    m->b_double_click = false;
-
-    switch (ev->type)
-    {
-        case VOUT_WINDOW_MOUSE_MOVED:
-            vlc_mouse_SetPosition(m, ev->x, ev->y);
-            state->last_left_press = INT64_MIN;
-            break;
-
-        case VOUT_WINDOW_MOUSE_PRESSED:
-            if (!window->info.has_double_click
-             && ev->button_mask == MOUSE_BUTTON_LEFT
-             && !vlc_mouse_IsLeftPressed(m))
-            {
-                const vlc_tick_t now = vlc_tick_now();
-
-                if (state->last_left_press != INT64_MIN
-                 && now - state->last_left_press < DOUBLE_CLICK_TIME)
-                {
-                    m->b_double_click = true;
-                    state->last_left_press = INT64_MIN;
-                }
-                else
-                    state->last_left_press = now;
-            }
-
-            vlc_mouse_SetPressed(m, ev->button_mask);
-            break;
-
-        case VOUT_WINDOW_MOUSE_RELEASED:
-            vlc_mouse_SetReleased(m, ev->button_mask);
-            break;
-
-        case VOUT_WINDOW_MOUSE_DOUBLE_CLICK:
-            assert(window->info.has_double_click);
-            m->b_double_click = true;
-            break;
-
-        default:
-            vlc_assert_unreachable();
-    }
-
-    vout_MouseState(vout, m);
-}
-
-static void vout_display_window_KeyboardEvent(vout_window_t *window,
-                                              unsigned key)
-{
-    var_SetInteger(vlc_object_instance(window), "key-pressed", key);
-}
-
-static void vout_display_window_OutputEvent(vout_window_t *window,
-                                            const char *name, const char *desc)
-{
-    if (desc != NULL)
-        msg_Dbg(window, "fullscreen output %s (%s) added", name, desc);
-    else
-        msg_Dbg(window, "fullscreen output %s removed", name);
-}
-
-static const struct vout_window_callbacks vout_display_window_cbs = {
-    .resized = vout_display_window_ResizeNotify,
-    .closed = vout_display_window_CloseNotify,
-    .state_changed = vout_display_window_StateNotify,
-    .fullscreened = vout_display_window_FullscreenNotify,
-    .windowed = vout_display_window_WindowingNotify,
-    .mouse_event = vout_display_window_MouseEvent,
-    .keyboard_event = vout_display_window_KeyboardEvent,
-    .output_event = vout_display_window_OutputEvent,
-};
-
-/**
- * Creates a video window, initially without any attached display.
- */
-vout_window_t *vout_display_window_New(vout_thread_t *vout)
-{
-    vout_display_window_t *state = malloc(sizeof (*state));
-    if (state == NULL)
-        return NULL;
-
-    vlc_mouse_Init(&state->mouse);
-    state->last_left_press = INT64_MIN;
-    state->vout = vout;
-
-    char *modlist = var_InheritString(vout, "window");
-    vout_window_owner_t owner = {
-        .cbs = &vout_display_window_cbs,
-        .sys = state,
-    };
-    vout_window_t *window;
-
-    var_Create(vout, "window-state", VLC_VAR_INTEGER);
-    var_Create(vout, "window-fullscreen", VLC_VAR_BOOL);
-    var_Create(vout, "window-fullscreen-output", VLC_VAR_STRING);
-
-    window = vout_window_New((vlc_object_t *)vout, modlist, &owner);
-    free(modlist);
-    if (window == NULL)
-        free(state);
-    return window;
-}
-
-/**
- * Destroys a video window.
- * \note The window must be detached.
- */
-void vout_display_window_Delete(vout_window_t *window)
-{
-    vout_display_window_t *state = window->owner.sys;
-    vout_thread_t *vout = state->vout;
-
-    vout_window_Delete(window);
-    var_Destroy(vout, "window-fullscreen-output");
-    var_Destroy(vout, "window-fullscreen");
-    var_Destroy(vout, "window-state");
-    free(state);
-}



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/76b3ad36d3e6d9a6f38b2d17b6054b50760e6aed...2ddcadde698efaab7986912cba514d81c2ecb6b6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/76b3ad36d3e6d9a6f38b2d17b6054b50760e6aed...2ddcadde698efaab7986912cba514d81c2ecb6b6
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list