]> git.sesse.net Git - vlc/commitdiff
msw: shrink events data structure
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 9 Oct 2014 19:33:34 +0000 (22:33 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 16 Oct 2014 17:23:38 +0000 (20:23 +0300)
modules/video_output/msw/common.c
modules/video_output/msw/direct3d.c
modules/video_output/msw/events.c
modules/video_output/msw/events.h

index fbf790c8a9241884ba0379c1388159e492276f5a..d1728b08481d3f498df59a702429daf41e6885ff 100644 (file)
@@ -78,11 +78,10 @@ int CommonInit(vout_display_t *vd)
 #ifdef MODULE_NAME_IS_directdraw
     cfg.use_overlay = sys->use_overlay;
 #endif
-    cfg.win.type   = VOUT_WINDOW_TYPE_HWND;
-    cfg.win.x      = var_InheritInteger(vd, "video-x");
-    cfg.win.y      = var_InheritInteger(vd, "video-y");
-    cfg.win.width  = vd->cfg->display.width;
-    cfg.win.height = vd->cfg->display.height;
+    cfg.x      = var_InheritInteger(vd, "video-x");
+    cfg.y      = var_InheritInteger(vd, "video-y");
+    cfg.width  = vd->cfg->display.width;
+    cfg.height = vd->cfg->display.height;
 
     event_hwnd_t hwnd;
     if (EventThreadStart(sys->event, &hwnd, &cfg))
index 7fa45859530b908e89c4eb38246c7a873c6028c1..2f6a9c6cf3517211475b1fc66c8656785d48f328 100644 (file)
@@ -399,11 +399,10 @@ static int ControlReopenDevice(vout_display_t *vd)
     memset(&cfg, 0, sizeof(cfg));
     cfg.use_desktop = sys->use_desktop;
     if (!sys->use_desktop) {
-        cfg.win.type   = VOUT_WINDOW_TYPE_HWND;
-        cfg.win.x      = sys->desktop_save.win.left;
-        cfg.win.y      = sys->desktop_save.win.top;
-        cfg.win.width  = sys->desktop_save.win.right  - sys->desktop_save.win.left;
-        cfg.win.height = sys->desktop_save.win.bottom - sys->desktop_save.win.top;
+        cfg.x      = sys->desktop_save.win.left;
+        cfg.y      = sys->desktop_save.win.top;
+        cfg.width  = sys->desktop_save.win.right  - sys->desktop_save.win.left;
+        cfg.height = sys->desktop_save.win.bottom - sys->desktop_save.win.top;
     }
 
     event_hwnd_t hwnd;
index a1fe0185a6dd612f9423c23c0b2414f1aea91ad5..934f0fede662a8ff300b9906136e8831f5dd744a 100644 (file)
@@ -75,8 +75,9 @@ struct event_thread_t
     /* Title */
     char *psz_title;
 
-    int               i_window_style;
-    vout_window_cfg_t wnd_cfg;
+    int i_window_style;
+    int x, y;
+    unsigned width, height;
 
     /* */
     vout_window_t *parent_window;
@@ -414,15 +415,13 @@ void EventThreadUpdateWindowPosition( event_thread_t *p_event,
                                       int x, int y, unsigned w, unsigned h )
 {
     vlc_mutex_lock( &p_event->lock );
-    *pb_moved   = x != p_event->wnd_cfg.x ||
-                  y != p_event->wnd_cfg.y;
-    *pb_resized = w != p_event->wnd_cfg.width ||
-                  h != p_event->wnd_cfg.height;
-
-    p_event->wnd_cfg.x      = x;
-    p_event->wnd_cfg.y      = y;
-    p_event->wnd_cfg.width  = w;
-    p_event->wnd_cfg.height = h;
+    *pb_moved   = x != p_event->x || y != p_event->y;
+    *pb_resized = w != p_event->width || h != p_event->height;
+
+    p_event->x      = x;
+    p_event->y      = y;
+    p_event->width  = w;
+    p_event->height = h;
     vlc_mutex_unlock( &p_event->lock );
 }
 
@@ -495,7 +494,10 @@ int EventThreadStart( event_thread_t *p_event, event_hwnd_t *p_hwnd, const event
 {
     p_event->use_desktop = p_cfg->use_desktop;
     p_event->use_overlay = p_cfg->use_overlay;
-    p_event->wnd_cfg     = p_cfg->win;
+    p_event->x           = p_cfg->x;
+    p_event->y           = p_cfg->y;
+    p_event->width       = p_cfg->width;
+    p_event->height      = p_cfg->height;
 
     p_event->has_moved = false;
 
@@ -683,8 +685,16 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
     if( !p_event->use_desktop )
     {
     #endif
+        vout_window_cfg_t wnd_cfg = {
+            .type = VOUT_WINDOW_TYPE_HWND,
+            .x = p_event->x,
+            .y = p_event->y,
+            .width = p_event->width,
+            .height = p_event->height,
+        };
+
         /* If an external window was specified, we'll draw in it. */
-        p_event->parent_window = vout_display_NewWindow(vd, &p_event->wnd_cfg );
+        p_event->parent_window = vout_display_NewWindow(vd, &wnd_cfg );
         if( p_event->parent_window )
             p_event->hparent = p_event->parent_window->handle.hwnd;
         else
@@ -746,8 +756,8 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
      * the window corresponding to the useable surface we want */
     rect_window.left   = 10;
     rect_window.top    = 10;
-    rect_window.right  = rect_window.left + p_event->wnd_cfg.width;
-    rect_window.bottom = rect_window.top  + p_event->wnd_cfg.height;
+    rect_window.right  = rect_window.left + p_event->width;
+    rect_window.bottom = rect_window.top  + p_event->height;
 
     if( var_GetBool( vd, "video-deco" ) )
     {
@@ -785,10 +795,10 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
                     p_event->class_main,             /* name of window class */
                     _T(VOUT_TITLE) _T(" (VLC Video Output)"),  /* window title */
                     i_style,                                 /* window style */
-                    (!p_event->wnd_cfg.x) ? (UINT)CW_USEDEFAULT :
-                        (UINT)p_event->wnd_cfg.x,   /* default X coordinate */
-                    (!p_event->wnd_cfg.y) ? (UINT)CW_USEDEFAULT :
-                        (UINT)p_event->wnd_cfg.y,   /* default Y coordinate */
+                    (!p_event->x) ? (UINT)CW_USEDEFAULT :
+                        (UINT)p_event->x,            /* default X coordinate */
+                    (!p_event->y) ? (UINT)CW_USEDEFAULT :
+                        (UINT)p_event->y,            /* default Y coordinate */
                     rect_window.right - rect_window.left,    /* window width */
                     rect_window.bottom - rect_window.top,   /* window height */
                     p_event->hparent,                       /* parent window */
index 92d2e52c29b7a2edcb0cc07459ff45a5c30ebb5f..25372c66915ad98be4c2c2cef994376829a8b821 100644 (file)
@@ -32,8 +32,10 @@ typedef struct event_thread_t event_thread_t;
 typedef struct {
     bool use_desktop; /* direct3d */
     bool use_overlay; /* directx */
-
-    vout_window_cfg_t win;
+    int x;
+    int y;
+    unsigned width;
+    unsigned height;
 } event_cfg_t;
 
 typedef struct {