]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/common.c
vout: remove no longer used display size event parameter
[vlc] / modules / video_output / msw / common.c
index 12724551891789efe8ca55218e4f90218ea9c27a..f8c1ceb61526235062677d37bd19f561e412c4cb 100644 (file)
@@ -1,63 +1,48 @@
 /*****************************************************************************
- * common.c:
+ * common.c: Windows video output common code
  *****************************************************************************
- * Copyright (C) 2001-2009 the VideoLAN team
+ * Copyright (C) 2001-2009 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Gildas Bazin <gbazin@videolan.org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * 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 General Public License for more details.
+ * 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 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.
+ * 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.
  *****************************************************************************/
 
-
 /*****************************************************************************
- * Preamble: This file contains the functions related to the creation of
- *             a window and the handling of its messages (events).
+ * Preamble: This file contains the functions related to the init of the vout
+ *           structure, the common display code, the screensaver, but not the
+ *           events and the Window Creation (events.c)
  *****************************************************************************/
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
-#include <assert.h>
 
 #include <vlc_common.h>
 #include <vlc_vout_display.h>
-#include <vlc_vout_window.h>
 
 #include <windows.h>
-#include <windowsx.h>
-#include <shellapi.h>
-
-#ifdef MODULE_NAME_IS_directdraw
-#include <ddraw.h>
-#endif
-#ifdef MODULE_NAME_IS_direct3d
-#include <d3d9.h>
-#endif
-#ifdef MODULE_NAME_IS_glwin32
-#include "../opengl.h"
-#endif
-#ifdef MODULE_NAME_IS_direct2d
-#include <d2d1.h>
-#endif
+#include <assert.h>
 
 #include "common.h"
 
 #include <vlc_windows_interfaces.h>
 
 static void CommonChangeThumbnailClip(vout_display_t *, bool show);
-static int CommonControlSetFullscreen(vout_display_t *, bool is_fullscreen);
+static int  CommonControlSetFullscreen(vout_display_t *, bool is_fullscreen);
 
 static void DisableScreensaver(vout_display_t *);
 static void RestoreScreensaver(vout_display_t *);
@@ -77,8 +62,8 @@ int CommonInit(vout_display_t *vd)
     sys->is_first_display = true;
     sys->is_on_top = false;
 
-    var_Create(vd, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
     var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
+    var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
 
     /* */
     sys->event = EventThreadCreate(vd);
@@ -93,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))
@@ -114,8 +98,6 @@ int CommonInit(vout_display_t *vd)
             vout_display_SendEventFullscreen(vd, false);
     }
 
-    /* Why not with glwin32 */
-    var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
     DisableScreensaver (vd);
 
     return VLC_SUCCESS;
@@ -230,7 +212,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
     /* fill in buffer info in first plane */
     picture->p->p_pixels = data;
     picture->p->i_pitch  = pitch;
-    picture->p->i_lines  = picture->format.i_height;
+    picture->p->i_lines  = picture->format.i_visible_height;
 
     /*  Fill chroma planes for planar YUV */
     if (picture->format.i_chroma == VLC_CODEC_I420 ||
@@ -243,7 +225,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
 
             p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch;
             p->i_pitch  = pitch / 2;
-            p->i_lines  = picture->format.i_height / 2;
+            p->i_lines  = picture->format.i_visible_height / 2;
         }
         /* The dx/d3d buffer is always allocated as YV12 */
         if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) {
@@ -346,8 +328,8 @@ void UpdateRects(vout_display_t *vd,
                                     point.x, point.y,
                                     rect.right, rect.bottom);
     if (is_resized)
-        vout_display_SendEventDisplaySize(vd, rect.right, rect.bottom, cfg->is_fullscreen);
-    if (!is_forced && !has_moved && !is_resized )
+        vout_display_SendEventDisplaySize(vd, rect.right, rect.bottom);
+    if (!is_forced && !has_moved && !is_resized)
         return;
 
     /* Update the window position and size */
@@ -420,8 +402,8 @@ void UpdateRects(vout_display_t *vd,
     /* src image dimensions */
     rect_src.left   = 0;
     rect_src.top    = 0;
-    rect_src.right  = source->i_width;
-    rect_src.bottom = source->i_height;
+    rect_src.right  = vd->fmt.i_visible_width;
+    rect_src.bottom = vd->fmt.i_visible_height;
 
     /* Clip the source image */
     rect_src_clipped.left = source->i_x_offset +
@@ -605,6 +587,7 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
                              rect_window.right - rect_window.left,
                              rect_window.bottom - rect_window.top, SWP_NOMOVE);
             }
+            return VLC_EGENERIC;
         }
         UpdateRects(vd, cfg, source, is_forced);
         return VLC_SUCCESS;