[vlc-devel] [PATCH 1/2] Make video-x and video-y default to -1 instead of 0
Felix Abecassis
felix.abecassis at gmail.com
Fri Jan 31 14:22:51 CET 2014
Similarly to width/height parameters, -1 means the value was not
specified by the user. The position of the video will be
implementation-defined.
---
modules/gui/qt4/qt4.cpp | 4 ++--
modules/video_output/msw/events.c | 4 ++--
modules/video_output/xcb/window.c | 3 ++-
src/libvlc-module.c | 4 ++--
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index a6e414f..a5cb1b2 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -650,8 +650,8 @@ static int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
MainInterface *p_mi = p_intf->p_sys->p_mi;
msg_Dbg( p_wnd, "requesting video window..." );
- int i_x = cfg->x;
- int i_y = cfg->y;
+ int i_x = cfg->x > 0 ? cfg->x : 0;
+ int i_y = cfg->y > 0 ? cfg->y : 0;
unsigned i_width = cfg->width;
unsigned i_height = cfg->height;
diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index 90939dc..ca2ec38 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -780,9 +780,9 @@ 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 :
+ (p_event->wnd_cfg.x < 0) ? (UINT)CW_USEDEFAULT :
(UINT)p_event->wnd_cfg.x, /* default X coordinate */
- (!p_event->wnd_cfg.y) ? (UINT)CW_USEDEFAULT :
+ (p_event->wnd_cfg.y < 0) ? (UINT)CW_USEDEFAULT :
(UINT)p_event->wnd_cfg.y, /* default Y coordinate */
rect_window.right - rect_window.left, /* window width */
rect_window.bottom - rect_window.top, /* window height */
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 5717dab..3514617 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -248,7 +248,8 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
xcb_window_t window = xcb_generate_id (conn);
ck = xcb_create_window_checked (conn, scr->root_depth, window, scr->root,
- cfg->x, cfg->y, cfg->width, cfg->height, 0,
+ cfg->x > 0 ? cfg->x : 0, cfg->y > 0 ? cfg->y : 0,
+ cfg->width, cfg->height, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
scr->root_visual, mask, values);
err = xcb_request_check (conn, ck);
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 5b5b7d1..d1d1a90 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1582,9 +1582,9 @@ vlc_module_begin ()
change_safe ()
add_integer( "height", -1, HEIGHT_TEXT, HEIGHT_LONGTEXT, true )
change_safe ()
- add_integer( "video-x", 0, VIDEOX_TEXT, VIDEOX_LONGTEXT, true )
+ add_integer( "video-x", -1, VIDEOX_TEXT, VIDEOX_LONGTEXT, true )
change_safe ()
- add_integer( "video-y", 0, VIDEOY_TEXT, VIDEOY_LONGTEXT, true )
+ add_integer( "video-y", -1, VIDEOY_TEXT, VIDEOY_LONGTEXT, true )
change_safe ()
add_string( "crop", NULL, CROP_TEXT, CROP_LONGTEXT, false )
change_safe ()
--
1.8.3.2
More information about the vlc-devel
mailing list