[vlc-commits] skins2(Windows): fix mouse input no longer working for skins2

2020-09-01 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Sep  1 14:53:12 
2020 +0200| [7babcb233e5b6f05614df5b69d7f9078b8457594] | committer: Erwan Tulou

skins2(Windows): fix mouse input no longer working for skins2

Following latest change at core level, skins2 stopped reacting to mouse
events.

Actually, the Windows Proc was not fully configured in the case of Vout
windows and returned right away as a no-op.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7babcb233e5b6f05614df5b69d7f9078b8457594
---

 modules/gui/skins2/win32/win32_window.cpp | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/modules/gui/skins2/win32/win32_window.cpp 
b/modules/gui/skins2/win32/win32_window.cpp
index 1ff49414ac..1a48609818 100644
--- a/modules/gui/skins2/win32/win32_window.cpp
+++ b/modules/gui/skins2/win32/win32_window.cpp
@@ -73,9 +73,6 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow 
&rWindow,
 m_hWnd = CreateWindowEx( WS_EX_APPWINDOW, vlc_class,
  vlc_name, WS_POPUP | WS_CLIPCHILDREN,
  0, 0, 0, 0, NULL, 0, hInst, NULL );
-
-// Store with it a pointer to the interface thread
-SetWindowLongPtr( m_hWnd, GWLP_USERDATA, (LONG_PTR)getIntf() );
 }
 else if( type == GenericWindow::FscWindow )
 {
@@ -90,9 +87,6 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow 
&rWindow,
 m_hWnd = CreateWindowEx( WS_EX_APPWINDOW, vlc_class, vlc_name,
  WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
  0, 0, 0, 0, m_hWnd_parent, 0, hInst, NULL );
-
-// Store with it a pointer to the interface thread
-SetWindowLongPtr( m_hWnd, GWLP_USERDATA, (LONG_PTR)getIntf() );
 }
 else
 {
@@ -101,9 +95,6 @@ Win32Window::Win32Window( intf_thread_t *pIntf, 
GenericWindow &rWindow,
 m_hWnd = CreateWindowEx( 0, vlc_class, vlc_name,
  WS_POPUP | WS_CLIPCHILDREN,
  0, 0, 0, 0, hWnd_owner, 0, hInst, NULL );
-
-// Store with it a pointer to the interface thread
-SetWindowLongPtr( m_hWnd, GWLP_USERDATA, (LONG_PTR)getIntf() );
 }
 
 if( !m_hWnd )
@@ -112,6 +103,9 @@ Win32Window::Win32Window( intf_thread_t *pIntf, 
GenericWindow &rWindow,
 return;
 }
 
+// Store with it a pointer to the interface thread
+SetWindowLongPtr( m_hWnd, GWLP_USERDATA, (LONG_PTR)getIntf() );
+
 // Store a pointer to the GenericWindow in a map
 pFactory->m_windowMap[m_hWnd] = &rWindow;
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: ensure playlist gets stopped before terminating vlc.

2019-11-29 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Nov 29 19:32:25 
2019 +0100| [0594abc06cb1a57548a7c3bf977e3071e64ef022] | committer: Erwan Tulou

skins2: ensure playlist gets stopped before terminating vlc.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0594abc06cb1a57548a7c3bf977e3071e64ef022
---

 modules/gui/skins2/src/skin_main.cpp | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/modules/gui/skins2/src/skin_main.cpp 
b/modules/gui/skins2/src/skin_main.cpp
index 087dd82cc0..d52e904d8d 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -143,6 +143,12 @@ static void Close( vlc_object_t *p_this )
 
 msg_Dbg( p_intf, "closing skins2 module" );
 
+// ensure the playlist is stopped
+vlc_playlist_t *playlist = vlc_intf_GetMainPlaylist( p_intf );
+vlc_playlist_Lock( playlist );
+vlc_playlist_Stop ( playlist );
+vlc_playlist_Unlock( playlist );
+
 vlc_mutex_lock( &skin_load.mutex );
 skin_load.intf = NULL;
 vlc_mutex_unlock( &skin_load.mutex);

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Qt(menu): fix CheckablelistMenu

2019-11-29 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Nov 29 11:52:32 
2019 +0100| [d613d7d670db24ce01102cc14b864d2a74373b58] | committer: Erwan Tulou

Qt(menu): fix CheckablelistMenu

Using an actionGroup is wrong, because the checkableListMenu just needs to
comply with the model. For some models (Crop, Zoom, Aspect, ..), it is 
exclusive (one and only one check), for others (audio, video, subtitle), it may 
not be exclusive(zero check or multiple checks allowed). But, anyway, the 
models manage that accordingly and there is not need to also want to manage it 
locally. Furthermore, for audio, video, subtitle, this breaks everything

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d613d7d670db24ce01102cc14b864d2a74373b58
---

 modules/gui/qt/components/custom_menus.cpp | 2 --
 modules/gui/qt/components/custom_menus.hpp | 2 --
 2 files changed, 4 deletions(-)

diff --git a/modules/gui/qt/components/custom_menus.cpp 
b/modules/gui/qt/components/custom_menus.cpp
index 099ff06572..80dba7db89 100644
--- a/modules/gui/qt/components/custom_menus.cpp
+++ b/modules/gui/qt/components/custom_menus.cpp
@@ -207,7 +207,6 @@ CheckableListMenu::CheckableListMenu(QString title, 
QAbstractListModel* model ,
 , m_model(model)
 {
 this->setTitle(title);
-m_actionGroup = new QActionGroup( this );
 
 connect(m_model, &QAbstractListModel::rowsAboutToBeRemoved, this, 
&CheckableListMenu::onRowsAboutToBeRemoved);
 connect(m_model, &QAbstractListModel::rowsInserted, this, 
&CheckableListMenu::onRowInserted);
@@ -237,7 +236,6 @@ void CheckableListMenu::onRowInserted(const QModelIndex &, 
int first, int last)
 bool checked = m_model->data(index, Qt::CheckStateRole).toBool();
 
 QAction *choiceAction = new QAction(title, this);
-m_actionGroup->addAction(choiceAction);
 addAction(choiceAction);
 connect(choiceAction, &QAction::triggered, [this, i](bool checked){
 QModelIndex dataIndex = m_model->index(i);
diff --git a/modules/gui/qt/components/custom_menus.hpp 
b/modules/gui/qt/components/custom_menus.hpp
index 80316fdc6a..63185177c0 100644
--- a/modules/gui/qt/components/custom_menus.hpp
+++ b/modules/gui/qt/components/custom_menus.hpp
@@ -90,8 +90,6 @@ private slots:
 private:
 QAbstractListModel* m_model;
 QMenu * m_submenu;
-
-QActionGroup* m_actionGroup;
 };
 
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Qt: initialise m_fullscreen in the Qt player controller

2019-11-29 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Nov 29 00:46:35 
2019 +0100| [ed30b0c34578cfcbff68faddf49f3981d6df6be2] | committer: Erwan Tulou

Qt: initialise m_fullscreen in the Qt player controller

maintaining the Qt player controller fully in synch with the vlc player
is key to providing a correct popupmenu.

For instance, this fixes 'vlc -I skins --fullscreen' where the popupmenu
was out of synch with the current mode.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ed30b0c34578cfcbff68faddf49f3981d6df6be2
---

 modules/gui/qt/components/player_controller.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/gui/qt/components/player_controller.cpp 
b/modules/gui/qt/components/player_controller.cpp
index 1b3b0d820a..164fd5f3d1 100644
--- a/modules/gui/qt/components/player_controller.cpp
+++ b/modules/gui/qt/components/player_controller.cpp
@@ -1001,6 +1001,9 @@ 
PlayerControllerPrivate::PlayerControllerPrivate(PlayerController *playercontrol
 
 m_time_timer.setSingleShot( true );
 m_time_timer.setTimerType( Qt::PreciseTimer );
+
+// Initialise fullscreen to match the player state
+m_fullscreen = vlc_player_vout_IsFullscreen( m_player );
 }
 
 PlayerController::PlayerController( intf_thread_t *_p_intf )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Qt(menu): fix skins2 issues with checkbox menus

2019-11-29 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Nov 28 21:01:19 
2019 +0100| [1a2932b4b0c9ce100d0dffdf895f4f245a57ff49] | committer: Erwan Tulou

Qt(menu): fix skins2 issues with checkbox menus

The bug:
- launch a video with vlc(skins2).
- Press 'o' to toggle autoscale.
- click outside vlc to lose the focus.
- click again on vlc and press again on 'o'.
At this point, the Qt thread no longer responds because of a deadlock

The cause is an undue connect (on toggled signal) that sets again the variable
while it was already being set in a callback (via hotkey).

The patch does the following:
- removes the undue connect (on toggled signal)
- ensure the essential connect (on triggered signal) is always called
- add a proper initialisation that was missing
- assert instead of if (the degraded mode is never used)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a2932b4b0c9ce100d0dffdf895f4f245a57ff49
---

 modules/gui/qt/components/custom_menus.cpp | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/modules/gui/qt/components/custom_menus.cpp 
b/modules/gui/qt/components/custom_menus.cpp
index e11ba4f231..099ff06572 100644
--- a/modules/gui/qt/components/custom_menus.cpp
+++ b/modules/gui/qt/components/custom_menus.cpp
@@ -297,18 +297,14 @@ BooleanPropertyAction::BooleanPropertyAction(QString 
title, QObject *model, QStr
 QMetaProperty property = meta->property(propertyId);
 assert(property.type() ==  QVariant::Bool);
 const QMetaObject* selfMeta = this->metaObject();
-if (property.hasNotifySignal())
-{
-QMetaMethod checkedSlot = selfMeta->method(selfMeta->indexOfSlot( 
"setChecked(bool)" ));
-connect( model, property.notifySignal(), this, checkedSlot );
-connect( this, &BooleanPropertyAction::toggled, this, 
&BooleanPropertyAction::setModelChecked );
-setCheckable(true);
-}
-else
-{
-connect( this, &BooleanPropertyAction::triggered, this, 
&BooleanPropertyAction::setModelChecked );
-setCheckable(true);
-}
+
+assert(property.hasNotifySignal());
+QMetaMethod checkedSlot = selfMeta->method(selfMeta->indexOfSlot( 
"setChecked(bool)" ));
+connect( model, property.notifySignal(), this, checkedSlot );
+connect( this, &BooleanPropertyAction::triggered, this, 
&BooleanPropertyAction::setModelChecked );
+
+setCheckable(true);
+setChecked(property.read(model).toBool());
 }
 
 void BooleanPropertyAction::setModelChecked(bool checked)

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Qt: fix improper dataChanged() signal emission

2019-09-23 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Sep 22 22:05:07 
2019 +0200| [a1c19dde82e31344a109ccb59b727d4649f78cd0] | committer: Thomas 
Guillem

Qt: fix improper dataChanged() signal emission

At https://doc.qt.io/qt-5/qabstractitemmodel.html#dataChanged, it reads:
"This signal is emitted whenever the data in an existing item changes."

My understanding is that emitting dataChanged() is limited to the update of
an existing item. Neither insertion nor deletion of an item have to emit
this signal.

Furthermore, in the case of deletion, this may lead to the following error:

ASSERT failure in QList::operator[]: "index out of range", file 
/usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h, line 549

Signed-off-by: Thomas Guillem 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1c19dde82e31344a109ccb59b727d4649f78cd0
---

 modules/gui/qt/util/input_models.cpp | 4 
 1 file changed, 4 deletions(-)

diff --git a/modules/gui/qt/util/input_models.cpp 
b/modules/gui/qt/util/input_models.cpp
index 8c795df1ef..f344e8b7f1 100644
--- a/modules/gui/qt/util/input_models.cpp
+++ b/modules/gui/qt/util/input_models.cpp
@@ -83,8 +83,6 @@ void TrackListModel::updateTracks(vlc_player_list_action 
action, const vlc_playe
 beginInsertRows({}, m_data.size(), m_data.size());
 m_data.append(Data{ track_info });
 endInsertRows();
-QModelIndex dataIndex = index(m_data.size() - 1);
-emit dataChanged(dataIndex, dataIndex);
 break;
 }
 case VLC_PLAYER_LIST_REMOVED:
@@ -99,8 +97,6 @@ void TrackListModel::updateTracks(vlc_player_list_action 
action, const vlc_playe
 beginRemoveRows({}, pos, pos);
 m_data.erase(it);
 endRemoveRows();
-QModelIndex dataIndex = index(pos);
-emit dataChanged(dataIndex, dataIndex);
 break;
 }
 case VLC_PLAYER_LIST_UPDATED:

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: kill compilation warning

2019-09-22 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Sep 22 12:21:00 
2019 +0200| [bdefc284c09d651ff3007d10da9f4e6e3a30903f] | committer: Erwan Tulou

skins2: kill compilation warning

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bdefc284c09d651ff3007d10da9f4e6e3a30903f
---

 modules/gui/skins2/utils/ustring.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/utils/ustring.cpp 
b/modules/gui/skins2/utils/ustring.cpp
index bffa583ca4..43efe5ce51 100644
--- a/modules/gui/skins2/utils/ustring.cpp
+++ b/modules/gui/skins2/utils/ustring.cpp
@@ -70,7 +70,7 @@ UString::UString( intf_thread_t *pIntf, const char *pString ):
 }
 if( !pCur || *pCur )
 {
-msg_Err( pIntf, "invalid UTF8 string: %s", pString );
+msg_Err( pIntf, "invalid UTF8 string: %s", pString ? pString : "nil" );
 m_length = 0;
 m_pString = NULL;
 return;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(x11): fix maximizing a window on Linux

2019-09-22 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Sep 22 10:27:25 
2019 +0200| [530f104f52943f5979bf8c9d5fa1e6030761ae21] | committer: Erwan Tulou

skins2(x11): fix maximizing a window on Linux

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=530f104f52943f5979bf8c9d5fa1e6030761ae21
---

 modules/gui/skins2/x11/x11_factory.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/x11/x11_factory.cpp 
b/modules/gui/skins2/x11/x11_factory.cpp
index 1d1c2a812a..837db02bed 100644
--- a/modules/gui/skins2/x11/x11_factory.cpp
+++ b/modules/gui/skins2/x11/x11_factory.cpp
@@ -354,7 +354,7 @@ SkinsRect X11Factory::getWorkArea() const
 }
 }
 msg_Dbg( getIntf(),"WorkArea: %ix%i at +%i+%i", w, h, x, y );
-return SkinsRect( x, y, w, h );
+return SkinsRect( x, y, x + w, y + h );
 }
 
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: kill warning

2019-07-06 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jul  4 16:11:26 
2019 +0200| [f614097ed2017e3c188021e90a73b8492b33dd5c] | committer: Erwan Tulou

skins2: kill warning

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f614097ed2017e3c188021e90a73b8492b33dd5c
---

 modules/gui/skins2/src/ft2_font.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/ft2_font.cpp 
b/modules/gui/skins2/src/ft2_font.cpp
index acbc43e3c6..c606899cb0 100644
--- a/modules/gui/skins2/src/ft2_font.cpp
+++ b/modules/gui/skins2/src/ft2_font.cpp
@@ -161,8 +161,10 @@ GenericBitmap *FT2Font::drawString( const UString 
&rString, uint32_t color,
 {
 pFribidiString = new uint32_t[len+1];
 FriBidiCharType baseDir = FRIBIDI_TYPE_ON;
-fribidi_log2vis( (FriBidiChar*)pString, len, &baseDir,
- (FriBidiChar*)pFribidiString, 0, 0, 0 );
+FriBidiLevel level = fribidi_log2vis(
+(FriBidiChar*)pString, len, &baseDir,
+(FriBidiChar*)pFribidiString, 0, 0, 0 );
+(void)level;
 pString = pFribidiString;
 }
 #endif

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: temporary fix for a design issue

2019-07-06 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jul  4 01:16:52 
2019 +0200| [04409ebd456c67bfe4f5827c2116359f955b596e] | committer: Erwan Tulou

skins2: temporary fix for a design issue

Interface modules also often acting as vout window submodules should
outlive any vout instances in order to ensure proper termination of the
latter.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=04409ebd456c67bfe4f5827c2116359f955b596e
---

 modules/gui/skins2/src/skin_main.cpp | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/skin_main.cpp 
b/modules/gui/skins2/src/skin_main.cpp
index 49793f86e6..40f5bf6ee7 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -366,8 +366,21 @@ static int WindowEnable( vout_window_t *pWnd, const 
vout_window_cfg_t *cfg )
 
 static void WindowDisable( vout_window_t *pWnd )
 {
-vout_window_skins_t* sys = (vout_window_skins_t *)pWnd->sys;
-intf_thread_t *pIntf = sys->pIntf;
+// vout_window_skins_t* sys = (vout_window_skins_t *)pWnd->sys;
+
+// Design issue
+// In the process of quitting vlc, the interfaces are destroyed first,
+// then comes the playlist along with the player and possible vouts.
+// problem: the interface is no longer active to properly deallocate
+// ressources allocated as a vout window submodule.
+vlc_mutex_lock( &skin_load.mutex );
+intf_thread_t *pIntf = skin_load.intf;
+vlc_mutex_unlock( &skin_load.mutex );
+if( pIntf == NULL )
+{
+msg_Err( pWnd, "Design issue: the interface no longer exists " );
+return;
+}
 
 // force execution in the skins2 thread context
 CmdExecuteBlock* cmd = new CmdExecuteBlock( pIntf, VLC_OBJECT( pWnd ),

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: support new playlist/player implementations

2019-07-06 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jul  4 16:11:51 
2019 +0200| [1f667918441ede3c7728ff8dd414050c60e31989] | committer: Erwan Tulou

skins2: support new playlist/player implementations

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1f667918441ede3c7728ff8dd414050c60e31989
---

 modules/gui/skins2/commands/cmd_add_item.cpp   |  19 +-
 modules/gui/skins2/commands/cmd_audio.cpp  |   7 +-
 modules/gui/skins2/commands/cmd_callbacks.hpp  |  87 +--
 modules/gui/skins2/commands/cmd_dialogs.hpp|  18 -
 modules/gui/skins2/commands/cmd_dvd.cpp|  59 +-
 modules/gui/skins2/commands/cmd_fullscreen.cpp |  24 +-
 modules/gui/skins2/commands/cmd_input.cpp  |  71 +-
 modules/gui/skins2/commands/cmd_playlist.cpp   |  45 +-
 modules/gui/skins2/commands/cmd_playtree.cpp   |  16 +-
 modules/gui/skins2/commands/cmd_playtree.hpp   |   3 +
 modules/gui/skins2/commands/cmd_quit.cpp   |  13 +-
 modules/gui/skins2/commands/cmd_snapshot.cpp   |  25 +-
 modules/gui/skins2/commands/cmd_vars.cpp   |  32 +-
 modules/gui/skins2/commands/cmd_vars.hpp   |  47 +-
 modules/gui/skins2/src/dialogs.cpp |   5 +-
 modules/gui/skins2/src/skin_common.hpp |   8 +-
 modules/gui/skins2/src/skin_main.cpp   |   8 +-
 modules/gui/skins2/src/top_window.cpp  |  15 +-
 modules/gui/skins2/src/vlcproc.cpp | 991 +
 modules/gui/skins2/src/vlcproc.hpp |  98 +--
 modules/gui/skins2/utils/var_tree.cpp  |  31 +-
 modules/gui/skins2/utils/var_tree.hpp  |  16 +-
 modules/gui/skins2/vars/equalizer.cpp  |  14 +-
 modules/gui/skins2/vars/playtree.cpp   | 273 +++
 modules/gui/skins2/vars/playtree.hpp   |  26 +-
 modules/gui/skins2/vars/time.cpp   |  43 +-
 modules/gui/skins2/vars/volume.cpp |   8 +-
 27 files changed, 970 insertions(+), 1032 deletions(-)

Diff:   
http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=1f667918441ede3c7728ff8dd414050c60e31989
___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Revert "configure: disable skins2"

2019-07-06 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sat Jun 29 15:29:36 
2019 +0200| [656fb0768857d906813df4f5347c005cb931e9b4] | committer: Erwan Tulou

Revert "configure: disable skins2"

This reverts commit 376d2b561115aea7fbf233be2170db7f46687948.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=656fb0768857d906813df4f5347c005cb931e9b4
---

 configure.ac | 6 --
 1 file changed, 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4fbacaa41c..d2459d230a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3976,12 +3976,6 @@ AS_IF([test "${enable_skins2}" != "no"], [
 enable_skins2="yes"
   ])
 ])
-
-AS_IF([test "${enable_skins2}" = "yes"], [
-  AC_MSG_WARN([Skins2 interface disabled, it need to ported to the new player 
and playlist.])
-  enable_skins2="0"
-], [])
-
 AM_CONDITIONAL([BUILD_SKINS], [test "${enable_skins2}" = "yes"])
 
 AC_ARG_ENABLE([libtar],

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] png: fix wrong pointer passed as callback data

2019-02-20 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Wed Feb 20 19:16:54 
2019 +0100| [494a8a039cbe7d189a53885d393bd50cab3c0d61] | committer: Erwan Tulou

png: fix wrong pointer passed as callback data

user_warning() and user_error() expect p_sys as user data.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=494a8a039cbe7d189a53885d393bd50cab3c0d61
---

 modules/codec/png.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/png.c b/modules/codec/png.c
index 8a95588df2..402459d8e1 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -238,8 +238,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
 if( setjmp( png_jmpbuf( p_png ) ) )
 goto error;
 
-png_set_read_fn( p_png, (void *)p_block, user_read );
-png_set_error_fn( p_png, (void *)p_dec, user_error, user_warning );
+png_set_read_fn( p_png, p_block, user_read );
+png_set_error_fn( p_png, p_sys, user_error, user_warning );
 
 png_read_info( p_png, p_info );
 if( p_sys->b_error ) goto error;
@@ -399,7 +399,7 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t 
*p_pic)
 goto error;
 
 png_set_write_fn( p_png, p_block, user_write, user_flush );
-png_set_error_fn( p_png, p_enc, user_error, user_warning );
+png_set_error_fn( p_png, p_sys, user_error, user_warning );
 
 p_info = png_create_info_struct( p_png );
 if( p_info == NULL )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix fullscreen wrong size on Windows10 (high DPI)

2018-12-16 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Thu Oct  4 
22:04:34 2018 +0200| [4cba4c02857701479fdc9eb7874aee50847b15e0] | committer: 
Jean-Baptiste Kempf

skins2: fix fullscreen wrong size on Windows10 (high DPI)

When setting the scaling factor of Windows10 to something different
from the default 100%, a wrong fullscreen width/height was used.

At init, the skins2 engine is a non DPI-aware process. Since Windows10
expects to rescale in the background, reported sizes are altered.
Then, the skins2 engine launches the qt dialog provider, which makes the
process go from non DPI to DPI aware. As a result, Windows10 stops plans
to rescale, and provides the application with the real sizes.

The patch uses the latest valid sizes whatsoever.

This fixes trac #15349

TODO: As of today, the skins2 engine is seen as DPI aware,
(because of Qt) but nothing is implemented to behave accordingly.

(cherry picked from commit 028c89ad19d522976a1523e88f84102e667a7340)
Signed-off-by: Jean-Baptiste Kempf 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4cba4c02857701479fdc9eb7874aee50847b15e0
---

 modules/gui/skins2/src/vout_manager.cpp | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/modules/gui/skins2/src/vout_manager.cpp 
b/modules/gui/skins2/src/vout_manager.cpp
index 442c9b265e..e555e5e6f9 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -325,8 +325,6 @@ void VoutManager::onUpdate( Subject &rVariable, 
void *arg )
 void VoutManager::configureFullscreen( VoutWindow& rWindow )
 {
 int numScr = var_InheritInteger( getIntf(), "qt-fullscreen-screennumber" );
-int x0 = m_pVoutMainWindow->getTop();
-int y0 = m_pVoutMainWindow->getLeft();
 
 int x, y, w, h;
 if( numScr >= 0 )
@@ -341,16 +339,13 @@ void VoutManager::configureFullscreen( VoutWindow& 
rWindow )
 rWindow.getMonitorInfo( &x, &y, &w, &h );
 }
 
-if( x != x0 || y != y0 )
-{
-// move and resize fullscreen
-m_pVoutMainWindow->move( x, y );
-m_pVoutMainWindow->resize( w, h );
+// move and resize fullscreen
+m_pVoutMainWindow->move( x, y );
+m_pVoutMainWindow->resize( w, h );
 
-// ensure the fs controller is also moved
-if( m_pFscWindow )
-{
-m_pFscWindow->moveTo( x, y, w, h );
-}
+// ensure the fs controller is also moved
+if( m_pFscWindow )
+{
+m_pFscWindow->moveTo( x, y, w, h );
 }
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Qt(menu): fix RendererMenu for skins2

2018-11-27 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Mon Nov 26 14:19:33 
2018 +0100| [1177a500f55fd5220e3b2524556e5e901ed6e06b] | committer: Erwan Tulou

Qt(menu): fix RendererMenu for skins2

If a menu is given a parent, the menu will transparently be deleted once
the parent is deleted. If the menu is also kept in a static variable,
there is no easy means to reset said variable to NULL when the deletion
does occur. That leaves the likelihood to dereference an invalid pointer.

For the Qt interface, luckily the first parent object is the menu bar
whose lifetime is expected to span the entire vlc session, so the risk
is limited.

For the skins2 interface, on the contrary, the first parent object is a
popupmenu with a very short lifetime. So, it is bound to crash as soon
as a first popupmenu is displayed and closed.

This patch sets a NULL parent.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1177a500f55fd5220e3b2524556e5e901ed6e06b
---

 modules/gui/qt/menus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index eab268b6db..25f14673c2 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -732,7 +732,7 @@ QMenu *VLCMenuBar::NavigMenu( intf_thread_t *p_intf, QMenu 
*menu )
 menu->addSeparator();
 
 if ( !VLCMenuBar::rendererMenu )
-VLCMenuBar::rendererMenu = new RendererMenu( menu, p_intf );
+VLCMenuBar::rendererMenu = new RendererMenu( NULL, p_intf );
 
 menu->addMenu( VLCMenuBar::rendererMenu );
 menu->addSeparator();

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Qt(menu): fix memory leak regarding static variables.

2018-11-27 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Nov 27 09:17:44 
2018 +0100| [46dd65277fa57b05a015f7eb6fbd0b17f15c943b] | committer: Erwan Tulou

Qt(menu): fix memory leak regarding static variables.

This patch ensures the parentless menus (recentsMenu and RendererMenu)
are freed at the end of the vlc session.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=46dd65277fa57b05a015f7eb6fbd0b17f15c943b
---

 modules/gui/qt/dialogs_provider.cpp | 4 
 modules/gui/qt/menus.hpp| 8 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/dialogs_provider.cpp 
b/modules/gui/qt/dialogs_provider.cpp
index 32ee5b0d22..13634934ae 100644
--- a/modules/gui/qt/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs_provider.cpp
@@ -112,6 +112,10 @@ DialogsProvider::~DialogsProvider()
 delete videoPopupMenu;
 delete audioPopupMenu;
 delete miscPopupMenu;
+
+/* free parentless menus  */
+VLCMenuBar::freeRecentsMenu();
+VLCMenuBar::freeRendererMenu();
 }
 
 QString DialogsProvider::getSaveFileName( QWidget *parent,
diff --git a/modules/gui/qt/menus.hpp b/modules/gui/qt/menus.hpp
index bfa0c818cc..ffa7fa704f 100644
--- a/modules/gui/qt/menus.hpp
+++ b/modules/gui/qt/menus.hpp
@@ -84,6 +84,10 @@ public:
 static void updateSystrayMenu( MainInterface *, intf_thread_t  *,
bool b_force_visible = false);
 
+/* destructor for parentless Menus (kept in static variables) */
+static void freeRendererMenu(){ delete rendererMenu; rendererMenu = NULL; }
+static void freeRecentsMenu(){ delete recentsMenu; recentsMenu = NULL; }
+
 /* Actions */
 static void DoAction( QObject * );
 enum actionflag {
@@ -96,8 +100,6 @@ public:
 };
 Q_DECLARE_FLAGS(actionflags, actionflag)
 
-static RendererMenu *rendererMenu;
-
 private:
 /* All main Menus */
 static QMenu *FileMenu( intf_thread_t *, QWidget *, MainInterface * mi = 
NULL );
@@ -154,6 +156,8 @@ private:
 /* recentMRL menu */
 static QMenu *recentsMenu;
 
+static RendererMenu *rendererMenu;
+
 static void updateAudioDevice( intf_thread_t *, audio_output_t *, QMenu* );
 
 public slots:

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] image: fix a copy/paste error while refactoring

2018-11-25 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Mon Nov 26 00:08:22 
2018 +0100| [00b337537f53e6cfce363ad4a8947aeb3a86bbbd] | committer: Erwan Tulou

image: fix a copy/paste error while refactoring

this regression, found in 629aa1c03d9e82eff0444f3498738bfcdc629d16,
resulted in skins2 no longer able to decode any bitmaps.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=00b337537f53e6cfce363ad4a8947aeb3a86bbbd
---

 src/misc/image.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/misc/image.c b/src/misc/image.c
index 8467dc93e7..3622232d1e 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -315,11 +315,11 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, 
const char *psz_url,
 {
 fmtin.i_chroma = image_Mime2Fourcc( psz_mime );
 free( psz_mime );
-if( !fmtin.i_chroma )
-{
-/* Try to guess format from file name */
-fmtin.i_chroma = image_Ext2Fourcc( psz_url );
-}
+}
+if( !fmtin.i_chroma )
+{
+   /* Try to guess format from file name */
+   fmtin.i_chroma = image_Ext2Fourcc( psz_url );
 }
 }
 vlc_stream_Delete( p_stream );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix fullscreen wrong size on Windows10 (high DPI)

2018-10-04 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Oct  4 22:04:34 
2018 +0200| [028c89ad19d522976a1523e88f84102e667a7340] | committer: Erwan Tulou

skins2: fix fullscreen wrong size on Windows10 (high DPI)

When setting the scaling factor of Windows10 to something different
from the default 100%, a wrong fullscreen width/height was used.

At init, the skins2 engine is a non DPI-aware process. Since Windows10
expects to rescale in the background, reported sizes are altered.
Then, the skins2 engine launches the qt dialog provider, which makes the
process go from non DPI to DPI aware. As a result, Windows10 stops plans
to rescale, and provides the application with the real sizes.

The patch uses the latest valid sizes whatsoever.

This fixes trac #15349

TODO: As of today, the skins2 engine is seen as DPI aware,
(because of Qt) but nothing is implemented to behave accordingly.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=028c89ad19d522976a1523e88f84102e667a7340
---

 modules/gui/skins2/src/vout_manager.cpp | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/modules/gui/skins2/src/vout_manager.cpp 
b/modules/gui/skins2/src/vout_manager.cpp
index 44d1dcdd7f..63940f4a31 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -325,8 +325,6 @@ void VoutManager::onUpdate( Subject &rVariable, 
void *arg )
 void VoutManager::configureFullscreen( VoutWindow& rWindow )
 {
 int numScr = var_InheritInteger( getIntf(), "qt-fullscreen-screennumber" );
-int x0 = m_pVoutMainWindow->getTop();
-int y0 = m_pVoutMainWindow->getLeft();
 
 int x, y, w, h;
 if( numScr >= 0 )
@@ -341,17 +339,14 @@ void VoutManager::configureFullscreen( VoutWindow& 
rWindow )
 rWindow.getMonitorInfo( &x, &y, &w, &h );
 }
 
-if( x != x0 || y != y0 )
-{
-// move and resize fullscreen
-m_pVoutMainWindow->move( x, y );
-m_pVoutMainWindow->resize( w, h );
+// move and resize fullscreen
+m_pVoutMainWindow->move( x, y );
+m_pVoutMainWindow->resize( w, h );
 
-// ensure the fs controller is also moved
-if( m_pFscWindow )
-{
-m_pFscWindow->moveTo( x, y, w, h );
-}
+// ensure the fs controller is also moved
+if( m_pFscWindow )
+{
+m_pFscWindow->moveTo( x, y, w, h );
 }
 
 // place voutWindow within fullscreen

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] xdg-shell: provide a fully configured window

2018-06-19 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Jun 19 21:42:37 
2018 +0300| [6ef463a42a0273a5653543c557259d5d1fd8831e] | committer: Rémi 
Denis-Courmont

xdg-shell: provide a fully configured window

On Weston, this fixes the following test case:
cmd: vlc -I qt -V wl --no-embedded-video --no-video-deco
error: xdg_surface@9: error 3: xdg_surface has never been configured

Modified-and-...
Signed-off-by: Rémi Denis-Courmont 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6ef463a42a0273a5653543c557259d5d1fd8831e
---

 modules/video_output/wayland/xdg-shell.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/modules/video_output/wayland/xdg-shell.c 
b/modules/video_output/wayland/xdg-shell.c
index 4d639f05ad..9698b5e281 100644
--- a/modules/video_output/wayland/xdg-shell.c
+++ b/modules/video_output/wayland/xdg-shell.c
@@ -96,6 +96,7 @@ struct vout_window_sys_t
 unsigned height;
 bool fullscreen;
 } latch;
+bool configured;
 } wm;
 # ifdef XDG_SHELL_UNSTABLE
 bool unstable;
@@ -302,6 +303,7 @@ static void xdg_surface_configure_cb(void *data, struct 
xdg_surface *surface,
 vout_window_ReportWindowed(wnd);
 
 xdg_surface_ack_configure(surface, serial);
+sys->wm.configured = true;
 }
 
 static const struct xdg_surface_listener xdg_surface_cbs =
@@ -480,6 +482,7 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t 
*cfg)
 sys->wm.latch.width = 0;
 sys->wm.latch.height = 0;
 sys->wm.latch.fullscreen = false;
+sys->wm.configured = false;
 sys->set.width = cfg->width;
 sys->set.height = cfg->height;
 wl_list_init(&sys->outputs);
@@ -581,8 +584,14 @@ static int Open(vout_window_t *wnd, const 
vout_window_cfg_t *cfg)
 goto error;
 }
 
+wl_surface_commit(surface);
 wl_display_flush(display);
 
+#ifdef XDG_SHELL
+while (!sys->wm.configured)
+wl_display_dispatch(display);
+#endif
+
 wnd->type = VOUT_WINDOW_TYPE_WAYLAND;
 wnd->handle.wl = surface;
 wnd->display.wl = display;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(x11): fix vlc crashing on Kwin

2018-06-17 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Jun 17 19:51:36 
2018 +0200| [31315a5af37181b7be9b083bee77c8df85c67909] | committer: Erwan Tulou

skins2(x11): fix vlc crashing on Kwin

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=31315a5af37181b7be9b083bee77c8df85c67909
---

 modules/gui/skins2/x11/x11_factory.cpp | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/gui/skins2/x11/x11_factory.cpp 
b/modules/gui/skins2/x11/x11_factory.cpp
index 8857a72d7b..5bd68ec90e 100644
--- a/modules/gui/skins2/x11/x11_factory.cpp
+++ b/modules/gui/skins2/x11/x11_factory.cpp
@@ -344,11 +344,14 @@ SkinsRect X11Factory::getWorkArea() const
 &ret, &i_format, &i_items, &i_bytesafter,
 (unsigned char **)&values ) == Success )
 {
-x = values[0];
-y = values[1];
-w = values[2];
-h = values[3];
-XFree( values );
+if( values )
+{
+x = values[0];
+y = values[1];
+w = values[2];
+h = values[3];
+XFree( values );
+}
 }
 }
 msg_Dbg( getIntf(),"WorkArea: %ix%i at +%i+%i", w, h, x, y );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] qt: protect against invalid Qsize

2018-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Jun 12 10:48:52 
2018 +0200| [d8d3d1efd3362b5ca88d47a46e7e2508e206d336] | committer: Erwan Tulou

qt: protect against invalid Qsize

This partially reverts commit 5ea9b98e29b518dadfc10e710eaa18f2c42468e9.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d8d3d1efd3362b5ca88d47a46e7e2508e206d336
---

 modules/gui/qt/main_interface.cpp | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/modules/gui/qt/main_interface.cpp 
b/modules/gui/qt/main_interface.cpp
index d14ae32b74..8b87e29e8f 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -678,6 +678,12 @@ inline void MainInterface::showTab( QWidget *widget, bool 
video_closing )
 }
 
 stackCentralW->setCurrentWidget( widget );
+if( b_autoresize )
+{
+QSize size = stackWidgetsSizes[widget];
+if( size.isValid() )
+resizeStack( size.width(), size.height() );
+}
 
 #ifdef DEBUG_INTF
 msg_Dbg( p_intf, "Stack state changed to %s, index %i",

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] hotkeys: fix crash when zooming

2018-06-11 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Mon Jun 11 13:24:32 
2018 +0200| [d1a441526653c477ef186fc1d97509c6b46f62df] | committer: Erwan Tulou

hotkeys: fix crash when zooming

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d1a441526653c477ef186fc1d97509c6b46f62df
---

 modules/control/hotkeys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 5428373eb4..54d904b6c8 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -1263,7 +1263,7 @@ static int PutAction( intf_thread_t *p_intf, 
input_thread_t *p_input,
 var_SetFloat( p_vout, "zoom", val_list[i].f_float );
 DisplayMessage( p_vout, _("Zoom mode: %s"), text_list[i] );
 
-var_FreeStringList( count, val_list, text_list );
+var_FreeList( count, val_list, text_list );
 }
 }
 break;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] qt: remove dubious and non functional call

2018-06-11 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri May 25 12:37:21 
2018 +0200| [5ea9b98e29b518dadfc10e710eaa18f2c42468e9] | committer: Erwan Tulou

qt: remove dubious and non functional call

As no videoWidget is ever inserted into the stackWidgetsSizes QMap, a
default QSize is provided with width and height = -1. These uninitialized
values are then propagated and end up as a no op at some point.

Yet, on Wayland, this -1 default values can end up being transmitted to
the Wayland server, that treats them as invalid values (protocol error).
At least the Gnome server(mutter) does.

This fix simply removes the call.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5ea9b98e29b518dadfc10e710eaa18f2c42468e9
---

 modules/gui/qt/main_interface.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/modules/gui/qt/main_interface.cpp 
b/modules/gui/qt/main_interface.cpp
index 4b07c33bf9..d14ae32b74 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -678,8 +678,6 @@ inline void MainInterface::showTab( QWidget *widget, bool 
video_closing )
 }
 
 stackCentralW->setCurrentWidget( widget );
-if( b_autoresize )
-resizeStack( stackWidgetsSizes[widget].width(), 
stackWidgetsSizes[widget].height() );
 
 #ifdef DEBUG_INTF
 msg_Dbg( p_intf, "Stack state changed to %s, index %i",

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: cosmetics

2018-06-04 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Mon Jun  4 17:28:42 
2018 +0200| [5bf929ae00e1b01b0711573fddb0841ceef6a394] | committer: Erwan Tulou

skins2: cosmetics

- move the vout_window_t management into each OS implementation
(x11, win32 or os2) so that set up is done accordingly.
- keep all window handles within each OS implementation.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5bf929ae00e1b01b0711573fddb0841ceef6a394
---

 modules/gui/skins2/os2/os2_factory.cpp |  2 +-
 modules/gui/skins2/os2/os2_factory.hpp |  2 +-
 modules/gui/skins2/os2/os2_window.cpp  |  9 ++---
 modules/gui/skins2/os2/os2_window.hpp  |  8 ++--
 modules/gui/skins2/src/generic_window.cpp  | 11 ++-
 modules/gui/skins2/src/generic_window.hpp  |  8 +---
 modules/gui/skins2/src/os_factory.hpp  |  2 +-
 modules/gui/skins2/src/os_window.hpp   |  4 ++--
 modules/gui/skins2/src/skin_common.hpp |  6 --
 modules/gui/skins2/src/skin_main.cpp   | 17 -
 modules/gui/skins2/src/vout_window.cpp |  7 +--
 modules/gui/skins2/src/vout_window.hpp |  2 +-
 modules/gui/skins2/win32/win32_factory.cpp |  5 +++--
 modules/gui/skins2/win32/win32_factory.hpp |  2 +-
 modules/gui/skins2/win32/win32_window.cpp  |  8 +---
 modules/gui/skins2/win32/win32_window.hpp  | 12 
 modules/gui/skins2/x11/x11_factory.cpp |  5 +++--
 modules/gui/skins2/x11/x11_factory.hpp |  2 +-
 modules/gui/skins2/x11/x11_window.cpp  | 10 ++
 modules/gui/skins2/x11/x11_window.hpp  | 14 --
 20 files changed, 69 insertions(+), 67 deletions(-)

diff --git a/modules/gui/skins2/os2/os2_factory.cpp 
b/modules/gui/skins2/os2/os2_factory.cpp
index bdd1fb515b..5d0e17101b 100644
--- a/modules/gui/skins2/os2/os2_factory.cpp
+++ b/modules/gui/skins2/os2/os2_factory.cpp
@@ -363,7 +363,7 @@ int OS2Factory::getScreenHeight() const
 }
 
 
-void OS2Factory::getMonitorInfo( const GenericWindow &rWindow,
+void OS2Factory::getMonitorInfo( OSWindow* pWindow,
  int* p_x, int* p_y,
  int* p_width, int* p_height ) const
 {
diff --git a/modules/gui/skins2/os2/os2_factory.hpp 
b/modules/gui/skins2/os2/os2_factory.hpp
index 531cf607b8..3f1923bca8 100644
--- a/modules/gui/skins2/os2/os2_factory.hpp
+++ b/modules/gui/skins2/os2/os2_factory.hpp
@@ -99,7 +99,7 @@ public:
 virtual int getScreenHeight() const;
 
 /// Get Monitor Information
-virtual void getMonitorInfo( const GenericWindow &rWindow,
+virtual void getMonitorInfo( OSWindow* pWindow,
  int* x, int* y,
  int* width, int* height ) const;
 virtual void getMonitorInfo( int numScreen,
diff --git a/modules/gui/skins2/os2/os2_window.cpp 
b/modules/gui/skins2/os2/os2_window.cpp
index 8bc44ef785..7fcfd2cb6b 100644
--- a/modules/gui/skins2/os2/os2_window.cpp
+++ b/modules/gui/skins2/os2/os2_window.cpp
@@ -83,7 +83,9 @@ OS2Window::OS2Window( intf_thread_t *pIntf, GenericWindow 
&rWindow,
 GenericWindow* pParent =
(GenericWindow*)pVoutManager->getVoutMainWindow();
 
-m_hWnd_parent = (HWND)pParent->getOSHandle();
+OS2Window* pWin = (OS2Window*)pParent->getOSWindow();
+m_hWnd_parent = pWin->getHandle();
+
 
 // top-level window
 m_hWnd = WinCreateStdWindow( HWND_DESKTOP,
@@ -152,9 +154,10 @@ OS2Window::~OS2Window()
 }
 
 
-void OS2Window::reparent( void* OSHandle, int x, int y, int w, int h )
+void OS2Window::reparent( OSWindow* parent, int x, int y, int w, int h )
 {
-HWND hwndParent = ( HWND )OSHandle;
+OS2Window *pParentWin = (OS2Window*)parent;
+HWND hwndParent = pParentWin->getHandle();
 
 // Reparent the window
 if( !WinSetParent( m_hWnd, hwndParent, TRUE ) )
diff --git a/modules/gui/skins2/os2/os2_window.hpp 
b/modules/gui/skins2/os2/os2_window.hpp
index e0aed774d2..9c21243507 100644
--- a/modules/gui/skins2/os2/os2_window.hpp
+++ b/modules/gui/skins2/os2/os2_window.hpp
@@ -60,8 +60,12 @@ public:
 /// Getter for the window handle
 HWND getHandle() const { return m_hWndClient; }
 
-/// Getter for the window handle
-void* getOSHandle() const { return (void*) m_hWndClient; }
+/// Set the window handler
+void setOSHandle( vout_window_t *pWnd ) const {
+pWnd->type = VOUT_WINDOW_TYPE_HWND;
+pWnd->info.has_double_click = true;
+pWnd->handle.hwnd = getHandle();
+}
 
 /// reparent the window
 void reparent( void* OSHandle, int x, int y, int w, int h );
diff --git a/modules/gui/skins2/src/generic_window.cpp 
b/modules/gui/skins2/src/generic_window.cpp
index 49d9beef1f..55d1bdcc29 100644
--- a/modules/gui/skins2/src/generic_window.cpp
+++ b/modules/gui/skins2/src/generic_window.cpp
@@ -167,9 +167,10 @@ void GenericWindow::innerHide()
 }
 }
 
-vlc_wnd_type GenericWindow::getOSHandle() const
+
+void G

[vlc-commits] egl(Wayland): fix wrong use of vlc_gl_Resize

2018-05-25 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Mon May 21 23:14:54 
2018 +0200| [cf965e2673c9abbc0f3ee00b6ed45cb2947ba5f0] | committer: Rémi 
Denis-Courmont

egl(Wayland): fix wrong use of vlc_gl_Resize

vlc_gl_Resize is meant to report the change in size of the display to
the underlying egl library, not the inner video size within the display.

this fix makes embedded video within qt fully functional on Wayland with
the default -V gl option.

Signed-off-by: Rémi Denis-Courmont 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cf965e2673c9abbc0f3ee00b6ed45cb2947ba5f0
---

 modules/video_output/opengl/display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/video_output/opengl/display.c 
b/modules/video_output/opengl/display.c
index c391a6fc48..1c22540c36 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -246,7 +246,7 @@ static int Control (vout_display_t *vd, int query, va_list 
ap)
 c.align.vertical = VOUT_DISPLAY_ALIGN_TOP;
 
 vout_display_PlacePicture (&place, src, &c, false);
-vlc_gl_Resize (sys->gl, place.width, place.height);
+vlc_gl_Resize (sys->gl, c.display.width, c.display.height);
 if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
 return VLC_EGENERIC;
 vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width 
/ place.height);

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: double_click is managed by the interface

2018-05-22 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue May 22 21:20:11 
2018 +0200| [4885b50b2e1edc6dbbf7de81888d46a18fe9187c] | committer: Erwan Tulou

skins2: double_click is managed by the interface

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4885b50b2e1edc6dbbf7de81888d46a18fe9187c
---

 modules/gui/skins2/src/skin_main.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/gui/skins2/src/skin_main.cpp 
b/modules/gui/skins2/src/skin_main.cpp
index 9a015006e4..36f66e344d 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -380,6 +380,7 @@ static int WindowOpen( vout_window_t *pWnd, const 
vout_window_cfg_t *cfg )
 #else
 pWnd->type = VOUT_WINDOW_TYPE_HWND;
 #endif
+pWnd->info.has_double_click = true;
 pWnd->control = WindowControl;
 
 // force execution in the skins2 thread context

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix resize cursor not resetting properly

2018-02-07 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Feb  8 01:56:53 
2018 +0100| [8c407d84f5cf3e7879f2297b3e78958017dc99e0] | committer: Erwan Tulou

skins2: fix resize cursor not resetting properly

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8c407d84f5cf3e7879f2297b3e78958017dc99e0
---

 modules/gui/skins2/controls/ctrl_resize.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/controls/ctrl_resize.cpp 
b/modules/gui/skins2/controls/ctrl_resize.cpp
index 7992d4b0fe..bb6e17f060 100644
--- a/modules/gui/skins2/controls/ctrl_resize.cpp
+++ b/modules/gui/skins2/controls/ctrl_resize.cpp
@@ -174,7 +174,7 @@ void CtrlResize::CmdStillResize::execute()
 void CtrlResize::CmdResizeStill::execute()
 {
 // Set the cursor
-m_pParent->changeCursor( m_pParent->m_direction );
+m_pParent->changeCursor( WindowManager::kNone );
 
 m_pParent->releaseMouse();
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: transmit scroll events to the vout display

2018-02-07 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Wed Feb  7 20:13:30 
2018 +0100| [d362b2df71a0aad0f77a7fce4c812aceb0f645db] | committer: Erwan Tulou

skins2: transmit scroll events to the vout display

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d362b2df71a0aad0f77a7fce4c812aceb0f645db
---

 modules/gui/skins2/src/vout_window.cpp | 9 +
 modules/gui/skins2/src/vout_window.hpp | 1 +
 2 files changed, 10 insertions(+)

diff --git a/modules/gui/skins2/src/vout_window.cpp 
b/modules/gui/skins2/src/vout_window.cpp
index d683e6a974..d8c2e2f2e4 100644
--- a/modules/gui/skins2/src/vout_window.cpp
+++ b/modules/gui/skins2/src/vout_window.cpp
@@ -118,6 +118,15 @@ void VoutWindow::processEvent( EvtKey &rEvtKey )
 }
 
 
+void VoutWindow::processEvent( EvtScroll &rEvtScroll )
+{
+int i = (rEvtScroll.getDirection() == EvtScroll::kUp ?
+KEY_MOUSEWHEELUP : KEY_MOUSEWHEELDOWN) | rEvtScroll.getMod();
+
+getIntf()->p_sys->p_dialogs->sendKey( i );
+}
+
+
 void VoutWindow::processEvent( EvtMotion &rEvtMotion )
 {
 int x = rEvtMotion.getXPos() - m_pParentWindow->getLeft() - getLeft();
diff --git a/modules/gui/skins2/src/vout_window.hpp 
b/modules/gui/skins2/src/vout_window.hpp
index ef971ae7d5..0a927c80cd 100644
--- a/modules/gui/skins2/src/vout_window.hpp
+++ b/modules/gui/skins2/src/vout_window.hpp
@@ -56,6 +56,7 @@ public:
 
 /// hotkeys processing
 virtual void processEvent( EvtKey &rEvtKey );
+virtual void processEvent( EvtScroll &rEvtScroll );
 virtual void processEvent( EvtMotion &rEvtMotion );
 virtual void processEvent( EvtMouse &rEvtMouse );
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: remove dead code

2018-02-07 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Wed Feb  7 20:12:10 
2018 +0100| [1bd9a6206f8dc2bd3ca97d854b9a6707aea4466a] | committer: Erwan Tulou

skins2: remove dead code

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1bd9a6206f8dc2bd3ca97d854b9a6707aea4466a
---

 modules/gui/skins2/src/top_window.cpp | 7 ++-
 modules/gui/skins2/src/top_window.hpp | 2 --
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/src/top_window.cpp 
b/modules/gui/skins2/src/top_window.cpp
index 77842a32e2..56eb998ac9 100644
--- a/modules/gui/skins2/src/top_window.cpp
+++ b/modules/gui/skins2/src/top_window.cpp
@@ -62,7 +62,7 @@ TopWindow::TopWindow( intf_thread_t *pIntf, int left, int top,
 m_rWindowManager( rWindowManager ),
 m_pActiveLayout( NULL ), m_pLastHitControl( NULL ),
 m_pCapturingControl( NULL ), m_pFocusControl( NULL ),
-m_pDragControl( NULL ), m_currModifier( 0 )
+m_pDragControl( NULL )
 {
 // Register as a moving window
 m_rWindowManager.registerWindow( *this );
@@ -209,9 +209,6 @@ void TopWindow::processEvent( EvtKey &rEvtKey )
 {
 getIntf()->p_sys->p_dialogs->sendKey( rEvtKey.getModKey() );
 }
-
-// Always store the modifier, which can be needed for scroll events.
-m_currModifier = rEvtKey.getMod();
 }
 
 void TopWindow::processEvent( EvtScroll &rEvtScroll )
@@ -237,7 +234,7 @@ void TopWindow::processEvent( EvtScroll &rEvtScroll )
 {
 // Treat the scroll event as a hotkey plus current modifiers
 int i = (rEvtScroll.getDirection() == EvtScroll::kUp ?
- KEY_MOUSEWHEELUP : KEY_MOUSEWHEELDOWN) | m_currModifier;
+ KEY_MOUSEWHEELUP : KEY_MOUSEWHEELDOWN) | rEvtScroll.getMod();
 
 getIntf()->p_sys->p_dialogs->sendKey( i );
 }
diff --git a/modules/gui/skins2/src/top_window.hpp 
b/modules/gui/skins2/src/top_window.hpp
index a64dd49d59..8979ba326b 100644
--- a/modules/gui/skins2/src/top_window.hpp
+++ b/modules/gui/skins2/src/top_window.hpp
@@ -119,8 +119,6 @@ private:
 CtrlGeneric *m_pFocusControl;
 /// Control over which drag&drop is hovering
 CtrlGeneric *m_pDragControl;
-/// Current key modifier (also used for mouse)
-int m_currModifier;
 
 /// Variable for the visibility of the window
 VarBoolImpl *m_pVarMaximized;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: optimize vout resizing

2018-02-07 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Wed Feb  7 14:27:04 
2018 +0100| [e2b30c764da0f6f08da843cf5717cb691ff5d095] | committer: Erwan Tulou

skins2: optimize vout resizing

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e2b30c764da0f6f08da843cf5717cb691ff5d095
---

 modules/gui/skins2/src/vout_manager.cpp | 4 
 modules/gui/skins2/src/vout_window.cpp  | 8 +---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/src/vout_manager.cpp 
b/modules/gui/skins2/src/vout_manager.cpp
index 442c9b265e..44d1dcdd7f 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -353,4 +353,8 @@ void VoutManager::configureFullscreen( VoutWindow& rWindow )
 m_pFscWindow->moveTo( x, y, w, h );
 }
 }
+
+// place voutWindow within fullscreen
+rWindow.move( x, y );
+rWindow.resize( w, h );
 }
diff --git a/modules/gui/skins2/src/vout_window.cpp 
b/modules/gui/skins2/src/vout_window.cpp
index d8c2e2f2e4..105468bdea 100644
--- a/modules/gui/skins2/src/vout_window.cpp
+++ b/modules/gui/skins2/src/vout_window.cpp
@@ -85,15 +85,9 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
 else
 {
 hide();
-int w = VoutManager::instance( getIntf() 
)->getVoutMainWindow()->getWidth();
-int h = VoutManager::instance( getIntf() 
)->getVoutMainWindow()->getHeight();
-
-setParent( VoutManager::instance( getIntf() )->getVoutMainWindow(),
-   0, 0, w, h );
+setParent( VoutManager::instance( getIntf() )->getVoutMainWindow() );
 m_pParentWindow =
   VoutManager::instance( getIntf() )->getVoutMainWindow();
-
-resize( w, h );
 show();
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: set opacity before showing the window

2018-02-07 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Feb  6 11:30:55 
2018 +0100| [6dcee51e0f33a8ea339ec6bc28071d3a91b72e87] | committer: Erwan Tulou

skins2: set opacity before showing the window

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6dcee51e0f33a8ea339ec6bc28071d3a91b72e87
---

 modules/gui/skins2/src/window_manager.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/window_manager.cpp 
b/modules/gui/skins2/src/window_manager.cpp
index c5d2f5d90c..628aa51399 100644
--- a/modules/gui/skins2/src/window_manager.cpp
+++ b/modules/gui/skins2/src/window_manager.cpp
@@ -438,10 +438,10 @@ void WindowManager::showAll( bool firstTime ) const
 
 void WindowManager::show( TopWindow &rWindow ) const
 {
-rWindow.show();
-
 if( isOpacityNeeded() )
 rWindow.setOpacity( m_alpha );
+
+rWindow.show();
 }
 
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix WorkArea different from Screen

2018-01-29 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Mon Jan 29 21:14:17 
2018 +0100| [ba2b7b8a1b84b25765a2c7b6f40f28f5b2d1fa19] | committer: Erwan Tulou

skins2: fix WorkArea different from Screen

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ba2b7b8a1b84b25765a2c7b6f40f28f5b2d1fa19
---

 modules/gui/skins2/src/window_manager.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/window_manager.cpp 
b/modules/gui/skins2/src/window_manager.cpp
index 7941cd5c6e..c5d2f5d90c 100644
--- a/modules/gui/skins2/src/window_manager.cpp
+++ b/modules/gui/skins2/src/window_manager.cpp
@@ -326,9 +326,7 @@ void WindowManager::maximize( TopWindow &rWindow )
rWindow.getTop() + rWindow.getHeight() );
 
 // maximise the window within the current screen (multiple screens allowed)
-int x, y, width, height;
-rWindow.getMonitorInfo( &x, &y, &width, &height );
-SkinsRect workArea(x, y, x + width, y + height);
+SkinsRect workArea = OSFactory::instance( getIntf() )->getWorkArea();
 
 // Move the window
 startMove( rWindow );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins(x11): query WorkArea when available

2018-01-29 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Mon Jan 29 21:15:18 
2018 +0100| [cc07586876ef6a3d13e77d1b4e261b34b1f483da] | committer: Erwan Tulou

skins(x11): query WorkArea when available

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cc07586876ef6a3d13e77d1b4e261b34b1f483da
---

 modules/gui/skins2/x11/x11_display.cpp |  1 +
 modules/gui/skins2/x11/x11_display.hpp |  2 ++
 modules/gui/skins2/x11/x11_factory.cpp | 40 +++---
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/modules/gui/skins2/x11/x11_display.cpp 
b/modules/gui/skins2/x11/x11_display.cpp
index 4dc86cb861..1399ba5951 100644
--- a/modules/gui/skins2/x11/x11_display.cpp
+++ b/modules/gui/skins2/x11/x11_display.cpp
@@ -341,6 +341,7 @@ void X11Display::testEWMH()
 TEST_EWMH( m_net_wm_window_opacity, "_NET_WM_WINDOW_OPACITY" )
 
 TEST_EWMH( m_net_wm_pid, "_NET_WM_PID" )
+TEST_EWMH( m_net_workarea, "_NET_WORKAREA" )
 
 #undef TEST_EWMH
 
diff --git a/modules/gui/skins2/x11/x11_display.hpp 
b/modules/gui/skins2/x11/x11_display.hpp
index dea86e2a89..64f1409534 100644
--- a/modules/gui/skins2/x11/x11_display.hpp
+++ b/modules/gui/skins2/x11/x11_display.hpp
@@ -46,6 +46,7 @@
 #define NET_WM_WINDOW_OPACITY m_rDisplay.m_net_wm_window_opacity
 
 #define NET_WM_PIDm_rDisplay.m_net_wm_pid
+#define NET_WORKAREA  m_rDisplay.m_net_workarea
 
 /// Class for encapsulation of a X11 Display
 class X11Display: public SkinObject
@@ -99,6 +100,7 @@ public:
 Atom m_net_wm_window_opacity;
 
 Atom m_net_wm_pid;
+Atom m_net_workarea;
 
 /// test EWMH capabilities
 void testEWMH();
diff --git a/modules/gui/skins2/x11/x11_factory.cpp 
b/modules/gui/skins2/x11/x11_factory.cpp
index 008c64bddb..ed52ff1ae2 100644
--- a/modules/gui/skins2/x11/x11_factory.cpp
+++ b/modules/gui/skins2/x11/x11_factory.cpp
@@ -326,8 +326,32 @@ void X11Factory::getDefaultGeometry( int* p_width, int* 
p_height ) const
 
 SkinsRect X11Factory::getWorkArea() const
 {
-// XXX
-return SkinsRect( 0, 0, getScreenWidth(), getScreenHeight() );
+// query Work Area if available from Window Manager
+// otherwise, default to the whole screen
+int x = 0, y = 0;
+int w = getScreenWidth(), h = getScreenHeight();
+if( m_pDisplay->m_net_workarea != None )
+{
+Atom ret;
+int i_format;
+unsigned long i_items, i_bytesafter;
+long *values;
+if( XGetWindowProperty( m_pDisplay->getDisplay(),
+DefaultRootWindow( m_pDisplay->getDisplay() ),
+m_pDisplay->m_net_workarea,
+0, 16384, False, XA_CARDINAL,
+&ret, &i_format, &i_items, &i_bytesafter,
+(unsigned char **)&values ) == Success )
+{
+x = values[0];
+y = values[1];
+w = values[2];
+h = values[3];
+XFree( values );
+}
+}
+msg_Dbg( getIntf(),"WorkArea: %ix%i at +%i+%i", w, h, x, y );
+return SkinsRect( x, y, w, h );
 }
 
 
@@ -391,17 +415,17 @@ void X11Factory::initCursors( )
 Display *display = m_pDisplay->getDisplay();
 static const struct {
 CursorType_t type;
-   const char *name;
+const char *name;
 } cursors[] = {
 { kDefaultArrow, "left_ptr" },
-   { kResizeNWSE, "bottom_right_corner" },
-   { kResizeNS, "bottom_side" },
-   { kResizeWE, "right_side" },
-   { kResizeNESW, "bottom_left_corner" },
+{ kResizeNWSE, "bottom_right_corner" },
+{ kResizeNS, "bottom_side" },
+{ kResizeWE, "right_side" },
+{ kResizeNESW, "bottom_left_corner" },
 };
 // retrieve cursors from default theme
 for( unsigned i = 0; i < sizeof(cursors) / sizeof(cursors[0]); i++ )
-   mCursors[cursors[i].type] =
+mCursors[cursors[i].type] =
 XcursorLibraryLoadCursor( display, cursors[i].name );
 
 // build an additional empty cursor

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] qt: fix recentsMenu that causes skins2 to crash

2018-01-23 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Tue Jan 23 
12:15:58 2018 +0100| [e9dd62ed8c55e30b942c5adf3b95c5431073acd1] | committer: 
Erwan Tulou

qt: fix recentsMenu that causes skins2 to crash

Skins2 uses FileMenu in the PopupMenu (short lifetime). This causes the
static variable recentsMenu to be freed and then be dereferenced.

The patch creates a one-off recentsMenu, that is used by the different
instances of FileMenu via the addMenu function (no transfer of ownership).

It follows the same pattern as the other two static audioDeviceMenu
and rendererMenu. Note that these static variables are never freed.

(cherry picked from commit 2f562a59f9fec7fffb2070d4ab597f933ca1a5f3)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e9dd62ed8c55e30b942c5adf3b95c5431073acd1
---

 modules/gui/qt/menus.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index 77392d611f..0ccf1412eb 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -370,9 +370,11 @@ QMenu *VLCMenuBar::FileMenu( intf_thread_t *p_intf, 
QWidget *parent, MainInterfa
 addDPStaticEntry( menu, qtr( "Open &Location from clipboard" ),
   NULL, SLOT( openUrlDialog() ), "Ctrl+V" );
 
-if( var_InheritBool( p_intf, "qt-recentplay" ) )
+if( !recentsMenu && var_InheritBool( p_intf, "qt-recentplay" ) )
+recentsMenu = new QMenu( qtr( "Open &Recent Media" ) );
+
+if( recentsMenu )
 {
-recentsMenu = new QMenu( qtr( "Open &Recent Media" ), menu );
 updateRecents( p_intf );
 menu->addMenu( recentsMenu );
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] qt: fix recentsMenu that causes skins2 to crash

2018-01-23 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Jan 23 12:15:58 
2018 +0100| [2f562a59f9fec7fffb2070d4ab597f933ca1a5f3] | committer: Erwan Tulou

qt: fix recentsMenu that causes skins2 to crash

Skins2 uses FileMenu in the PopupMenu (short lifetime). This causes the
static variable recentsMenu to be freed and then be dereferenced.

The patch creates a one-off recentsMenu, that is used by the different
instances of FileMenu via the addMenu function (no transfer of ownership).

It follows the same pattern as the other two static audioDeviceMenu
and rendererMenu. Note that these static variables are never freed.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2f562a59f9fec7fffb2070d4ab597f933ca1a5f3
---

 modules/gui/qt/menus.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index 77392d611f..0ccf1412eb 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -370,9 +370,11 @@ QMenu *VLCMenuBar::FileMenu( intf_thread_t *p_intf, 
QWidget *parent, MainInterfa
 addDPStaticEntry( menu, qtr( "Open &Location from clipboard" ),
   NULL, SLOT( openUrlDialog() ), "Ctrl+V" );
 
-if( var_InheritBool( p_intf, "qt-recentplay" ) )
+if( !recentsMenu && var_InheritBool( p_intf, "qt-recentplay" ) )
+recentsMenu = new QMenu( qtr( "Open &Recent Media" ) );
+
+if( recentsMenu )
 {
-recentsMenu = new QMenu( qtr( "Open &Recent Media" ), menu );
 updateRecents( p_intf );
 menu->addMenu( recentsMenu );
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): fix sporadic crash

2018-01-22 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Tue Jan 23 
01:46:30 2018 +0100| [4b48ad5dc66e00a118395c6db9e88ff11ed724e7] | committer: 
Erwan Tulou

skins2(Win): fix sporadic crash

Timer messages may be pending and must be explicitely discarded
when calling the destructor of a timer. Otherwise, the callback
function is called after the object is destroyed leading to crash.

(cherry picked from commit 90cb142cb5d58ab0d0917bf54499b585e15675b6)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4b48ad5dc66e00a118395c6db9e88ff11ed724e7
---

 modules/gui/skins2/win32/win32_timer.cpp | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/gui/skins2/win32/win32_timer.cpp 
b/modules/gui/skins2/win32/win32_timer.cpp
index afe1550955..c499348716 100644
--- a/modules/gui/skins2/win32/win32_timer.cpp
+++ b/modules/gui/skins2/win32/win32_timer.cpp
@@ -33,10 +33,7 @@ void CALLBACK CallbackTimer( HWND hwnd, UINT uMsg,
 {
 (void)hwnd; (void)uMsg; (void)dwTime;
 Win32Timer *pTimer = (Win32Timer*)idEvent;
-if( pTimer != NULL )
-{
-pTimer->execute();
-}
+pTimer->execute();
 }
 
 
@@ -49,6 +46,15 @@ Win32Timer::Win32Timer( intf_thread_t *pIntf, CmdGeneric 
&rCmd, HWND hWnd ):
 Win32Timer::~Win32Timer()
 {
 stop();
+
+// discard possible WM_TIMER messages for this timer
+// already in the message queue and not yet dispatched
+MSG msg;
+while( !PeekMessage( &msg, m_hWnd, WM_TIMER, WM_TIMER, PM_REMOVE ) )
+{
+if( (Win32Timer*)msg.wParam != this )
+PostMessage( m_hWnd, WM_TIMER, msg.wParam, msg.lParam );
+}
 }
 
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): fix sporadic crash

2018-01-22 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Jan 23 01:46:30 
2018 +0100| [90cb142cb5d58ab0d0917bf54499b585e15675b6] | committer: Erwan Tulou

skins2(Win): fix sporadic crash

Timer messages may be pending and must be explicitely discarded
when calling the destructor of a timer. Otherwise, the callback
function is called after the object is destroyed leading to crash.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=90cb142cb5d58ab0d0917bf54499b585e15675b6
---

 modules/gui/skins2/win32/win32_timer.cpp | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/gui/skins2/win32/win32_timer.cpp 
b/modules/gui/skins2/win32/win32_timer.cpp
index afe1550955..c499348716 100644
--- a/modules/gui/skins2/win32/win32_timer.cpp
+++ b/modules/gui/skins2/win32/win32_timer.cpp
@@ -33,10 +33,7 @@ void CALLBACK CallbackTimer( HWND hwnd, UINT uMsg,
 {
 (void)hwnd; (void)uMsg; (void)dwTime;
 Win32Timer *pTimer = (Win32Timer*)idEvent;
-if( pTimer != NULL )
-{
-pTimer->execute();
-}
+pTimer->execute();
 }
 
 
@@ -49,6 +46,15 @@ Win32Timer::Win32Timer( intf_thread_t *pIntf, CmdGeneric 
&rCmd, HWND hWnd ):
 Win32Timer::~Win32Timer()
 {
 stop();
+
+// discard possible WM_TIMER messages for this timer
+// already in the message queue and not yet dispatched
+MSG msg;
+while( !PeekMessage( &msg, m_hWnd, WM_TIMER, WM_TIMER, PM_REMOVE ) )
+{
+if( (Win32Timer*)msg.wParam != this )
+PostMessage( m_hWnd, WM_TIMER, msg.wParam, msg.lParam );
+}
 }
 
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] mft: fix probe issue with GUI threads

2018-01-21 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Sat Jan 20 
20:49:56 2018 +0100| [8719301547ff6312271458dde1d7b1cc2549ee76] | committer: 
Erwan Tulou

mft: fix probe issue with GUI threads

The skins2 thread as a Gui interface uses OLE/COM set up as 'appartment 
threaded' for DragNDrop. This thread also uses the vlc decoding facilities to 
decode still images and therefore is likely to probe decoder modules.

Calling CoInitializeEx() in multithreaded mode is not compatible with the 
already 'appartment threaded' setting, and therefore fails. In debug mode, this 
causes an unreachable assert. In non debug mode, the Open() is executed, fails 
and calls an undue CoUninitialize() which silently breaks the whole OLE setting 
of the thread.

The patch just gracefully returns on failure.

(cherry picked from commit 545124d374e5a00c74ce58c40dbc254abc1178cd)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8719301547ff6312271458dde1d7b1cc2549ee76
---

 modules/codec/mft.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/codec/mft.c b/modules/codec/mft.c
index f91fc7c00f..0305300d9c 100644
--- a/modules/codec/mft.c
+++ b/modules/codec/mft.c
@@ -1121,7 +1121,10 @@ static int Open(vlc_object_t *p_this)
 return VLC_ENOMEM;
 
 if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)) )
-vlc_assert_unreachable();
+{
+free(p_sys);
+return VLC_EGENERIC;
+}
 
 if (LoadMFTLibrary(&p_sys->mf_handle))
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): support no cursor

2018-01-21 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Jan 21 12:00:35 
2018 +0100| [e9492429f7e116266836e561d29f5699043dc12c] | committer: Erwan Tulou

skins2(Win): support no cursor

Added to support VOUT_WINDOW_HIDE_MOUSE

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e9492429f7e116266836e561d29f5699043dc12c
---

 modules/gui/skins2/win32/win32_factory.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/win32/win32_factory.cpp 
b/modules/gui/skins2/win32/win32_factory.cpp
index a357276f29..74a802aff2 100644
--- a/modules/gui/skins2/win32/win32_factory.cpp
+++ b/modules/gui/skins2/win32/win32_factory.cpp
@@ -464,15 +464,16 @@ void Win32Factory::changeCursor( CursorType_t type ) const
 LPCTSTR id;
 switch( type )
 {
-default:
 case kDefaultArrow: id = IDC_ARROW;break;
 case kResizeNWSE:   id = IDC_SIZENWSE; break;
 case kResizeNS: id = IDC_SIZENS;   break;
 case kResizeWE: id = IDC_SIZEWE;   break;
 case kResizeNESW:   id = IDC_SIZENESW; break;
+case kNoCursor:
+default: id = 0;
 }
 
-HCURSOR hCurs = LoadCursor( NULL, id );
+HCURSOR hCurs = (type == kNoCursor) ? NULL : LoadCursor( NULL, id );
 SetCursor( hCurs );
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


vlc-commits@videolan.org

2018-01-21 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Jan 21 13:12:20 
2018 +0100| [b4e31d4bc28d99b101838f954fc8378e5cecb2ee] | committer: Erwan Tulou

skins2(x11): improve Drag&Drop

Rely on the XSelectionNotify event to ascertain DragNDrop data are available
instead of blindly querying the property.

This does fix Drag and Drop sometimes non functioning.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b4e31d4bc28d99b101838f954fc8378e5cecb2ee
---

 modules/gui/skins2/x11/x11_dragdrop.cpp | 106 +---
 modules/gui/skins2/x11/x11_dragdrop.hpp |   1 +
 modules/gui/skins2/x11/x11_loop.cpp |  20 ++
 3 files changed, 77 insertions(+), 50 deletions(-)

diff --git a/modules/gui/skins2/x11/x11_dragdrop.cpp 
b/modules/gui/skins2/x11/x11_dragdrop.cpp
index 9244a2532e..9cfd4e7bbb 100644
--- a/modules/gui/skins2/x11/x11_dragdrop.cpp
+++ b/modules/gui/skins2/x11/x11_dragdrop.cpp
@@ -61,9 +61,10 @@ void X11DragDrop::dndEnter( ldata_t data )
 unsigned long nitems, nbytes;
 Atom *dataList;
 Atom typeListAtom = XInternAtom( XDISPLAY, "XdndTypeList", 0 );
-XGetWindowProperty( XDISPLAY, src, typeListAtom, 0, 65536, False,
-XA_ATOM, &type, &format, &nitems, &nbytes,
-(unsigned char**)&dataList );
+if( XGetWindowProperty( XDISPLAY, src, typeListAtom, 0, 65536,
+  False, XA_ATOM, &type, &format, &nitems, &nbytes,
+  (unsigned char**)&dataList ) != Success )
+return;
 for( unsigned long i=0; i files;
 
 // Read the selection
 Atom type;
 int format;
 unsigned long nitems, nbytes_after_return;
 char *buffer;
-long length_max = 1024;
-XGetWindowProperty( XDISPLAY, src, propAtom, 0, length_max, False,
-AnyPropertyType, &type, &format, &nitems,
-&nbytes_after_return, (unsigned char**)&buffer );
-if( buffer && nbytes_after_return > 0 )
-{
-XFree( buffer );
-length_max += nbytes_after_return;
-XGetWindowProperty( XDISPLAY, src, propAtom, 0, length_max, False,
-AnyPropertyType, &type, &format, &nitems,
-&nbytes_after_return, (unsigned char**)&buffer );
-}
-if( buffer != NULL )
+Atom propAtom = XInternAtom( XDISPLAY, "VLC_SELECTION", 0 );
+int ret = XGetWindowProperty( XDISPLAY, m_wnd, propAtom, 0, 65536, True,
+  AnyPropertyType, &type, &format, &nitems,
+  &nbytes_after_return,
+  (unsigned char**)&buffer );
+if( ret == Success && buffer != NULL )
 {
 msg_Dbg( getIntf(), "buffer received: %s", buffer );
 char* psz_dup = strdup( buffer );
@@ -214,26 +235,11 @@ void X11DragDrop::dndDrop( ldata_t data )
 }
 free( psz_dup );
 XFree( buffer );
-}
-
-Atom actionAtom = XInternAtom( XDISPLAY, "XdndActionCopy", 0 );
-Atom typeAtom = XInternAtom( XDISPLAY, "XdndFinished", 0 );
 
-// Tell the source we accepted the drop
-XEvent event;
-event.type = ClientMessage;
-event.xclient.window = src;
-event.xclient.display = XDISPLAY;
-event.xclient.message_type = typeAtom;
-event.xclient.format = 32;
-event.xclient.data.l[0] = m_wnd;
-event.xclient.data.l[1] = 1;// drop accepted
-event.xclient.data.l[2] = actionAtom;
-XSendEvent( XDISPLAY, src, False, 0, &event );
-
-// transmit DragDrop event
-EvtDragDrop evt( getIntf(), m_xPos, m_yPos, files );
-m_pWin->processEvent( evt );
+// transmit DragDrop event
+EvtDragDrop evt( getIntf(), m_xPos, m_yPos, files );
+m_pWin->processEvent( evt );
+}
 }
 
 #endif
diff --git a/modules/gui/skins2/x11/x11_dragdrop.hpp 
b/modules/gui/skins2/x11/x11_dragdrop.hpp
index a4fbbd67a0..968c2c1a04 100644
--- a/modules/gui/skins2/x11/x11_dragdrop.hpp
+++ b/modules/gui/skins2/x11/x11_dragdrop.hpp
@@ -45,6 +45,7 @@ public:
 void dndPosition( ldata_t data );
 void dndLeave( ldata_t data );
 void dndDrop( ldata_t data );
+void dndSelectionNotify( );
 
 private:
 /// X11 display
diff --git a/modules/gui/skins2/x11/x11_loop.cpp 
b/modules/gui/skins2/x11/x11_loop.cpp
index 4355c9f232..54e4102aa2 100644
--- a/modules/gui/skins2/x11/x11_loop.cpp
+++ b/modules/gui/skins2/x11/x11_loop.cpp
@@ -360,6 +360,26 @@ void X11Loop::handleX11Event()
 pDnd->dndDrop( event.xclient.data.l );
 break;
 }
+
+case SelectionNotify:
+{
+// Check XConvertSelection completion
+if( event.xselection.property == None )
+{
+msg_Err( getI

[vlc-commits] skins2: add debugging info

2018-01-21 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sat Jan 20 20:59:23 
2018 +0100| [20e3e35de211d135e895c08d6dc9b455d6c1f752] | committer: Erwan Tulou

skins2: add debugging info

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=20e3e35de211d135e895c08d6dc9b455d6c1f752
---

 modules/gui/skins2/src/top_window.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/gui/skins2/src/top_window.cpp 
b/modules/gui/skins2/src/top_window.cpp
index 260872e420..77842a32e2 100644
--- a/modules/gui/skins2/src/top_window.cpp
+++ b/modules/gui/skins2/src/top_window.cpp
@@ -272,6 +272,7 @@ void TopWindow::processEvent( EvtDragDrop &rEvtDragDrop )
 std::list::const_iterator it = files.begin();
 for( bool first = true; it != files.end(); ++it, first = false )
 {
+msg_Dbg( getIntf(),"Dropped item: %s", it->c_str() );
 bool playOnDrop = m_playOnDrop && first;
 CmdAddItem( getIntf(), it->c_str(), playOnDrop ).execute();
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] mft: fix probe issue with GUI threads

2018-01-21 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sat Jan 20 20:49:56 
2018 +0100| [545124d374e5a00c74ce58c40dbc254abc1178cd] | committer: Erwan Tulou

mft: fix probe issue with GUI threads

The skins2 thread as a Gui interface uses OLE/COM set up as 'appartment 
threaded' for DragNDrop. This thread also uses the vlc decoding facilities to 
decode still images and therefore is likely to probe decoder modules.

Calling CoInitializeEx() in multithreaded mode is not compatible with the 
already 'appartment threaded' setting, and therefore fails. In debug mode, this 
causes an unreachable assert. In non debug mode, the Open() is executed, fails 
and calls an undue CoUninitialize() which silently breaks the whole OLE setting 
of the thread.

The patch just gracefully returns on failure.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=545124d374e5a00c74ce58c40dbc254abc1178cd
---

 modules/codec/mft.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/codec/mft.c b/modules/codec/mft.c
index f7d9a257b6..24eaaa55cb 100644
--- a/modules/codec/mft.c
+++ b/modules/codec/mft.c
@@ -1121,7 +1121,10 @@ static int Open(vlc_object_t *p_this)
 return VLC_ENOMEM;
 
 if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)) )
-vlc_assert_unreachable();
+{
+free(p_sys);
+return VLC_EGENERIC;
+}
 
 if (LoadMFTLibrary(&p_sys->mf_handle))
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): support more DragNdrop formats on Windows

2018-01-21 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Jan 21 12:01:12 
2018 +0100| [bb1fddd2003f61a943702a120c3421669d4503a2] | committer: Erwan Tulou

skins2(Win): support more DragNdrop formats on Windows

Add support for urls with the following formats :
- CFSTR_INETURLW (e.g. youtube on Firefox et Google Chrome)
- CF_TEXT (e.g. youtube on Internet Edge)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bb1fddd2003f61a943702a120c3421669d4503a2
---

 modules/gui/skins2/win32/win32_dragdrop.cpp | 148 ++--
 modules/gui/skins2/win32/win32_dragdrop.hpp |  13 ++-
 2 files changed, 103 insertions(+), 58 deletions(-)

diff --git a/modules/gui/skins2/win32/win32_dragdrop.cpp 
b/modules/gui/skins2/win32/win32_dragdrop.cpp
index bb936ac6f9..b36b543195 100644
--- a/modules/gui/skins2/win32/win32_dragdrop.cpp
+++ b/modules/gui/skins2/win32/win32_dragdrop.cpp
@@ -28,12 +28,13 @@
 #include "../commands/cmd_add_item.hpp"
 #include "../events/evt_dragndrop.hpp"
 #include 
+#include 
 
 
 Win32DragDrop::Win32DragDrop( intf_thread_t *pIntf,
   bool playOnDrop, GenericWindow* pWin )
 : SkinObject( pIntf ), IDropTarget(), m_references( 1 ),
-  m_playOnDrop( playOnDrop ), m_pWin( pWin)
+  m_playOnDrop( playOnDrop ), m_pWin( pWin), m_format( { 0, NULL} )
 {
 }
 
@@ -48,24 +49,25 @@ STDMETHODIMP Win32DragDrop::QueryInterface( REFIID iid, 
void FAR* FAR* ppv )
 return S_OK;
 }
 *ppv = NULL;
-return ResultFromScode( E_NOINTERFACE );
+return E_NOINTERFACE;
 }
 
 
 STDMETHODIMP_(ULONG) Win32DragDrop::AddRef()
 {
-return ++m_references;
+return InterlockedIncrement( &m_references );
 }
 
 
 STDMETHODIMP_(ULONG) Win32DragDrop::Release()
 {
-if( --m_references == 0 )
+LONG count = InterlockedDecrement( &m_references );
+if( count == 0 )
 {
 delete this;
 return 0;
 }
-return m_references;
+return count;
 }
 
 
@@ -73,24 +75,63 @@ STDMETHODIMP Win32DragDrop::DragEnter( LPDATAOBJECT 
pDataObj,
 DWORD grfKeyState, POINTL pt, DWORD *pdwEffect )
 {
 (void)grfKeyState; (void)pt;
-FORMATETC fmtetc;
 
-fmtetc.cfFormat = CF_HDROP;
+// enumerate all data formats of HGLOBAL medium type
+// that the source is offering
+std::list formats;
+IEnumFORMATETC *pEnum;
+if( pDataObj->EnumFormatEtc( DATADIR_GET, &pEnum ) == S_OK )
+{
+FORMATETC fe;
+while( pEnum->Next( 1, &fe, NULL ) == S_OK )
+{
+if( fe.tymed == TYMED_HGLOBAL )
+formats.push_back( fe.cfFormat );
+}
+}
+
+// List of all data formats that we are interested in
+// sorted by order of preference
+static UINT ft_url = RegisterClipboardFormat( CFSTR_INETURLW );
+static const struct {
+UINT format;
+const char* name;
+} preferred[] = {
+{ ft_url, "CFSTR_INETURLW" },
+{ CF_HDROP, "CF_HDROP" },
+{ CF_TEXT, "CF_TEXT" },
+};
+
+// select the preferred format among those offered by the source
+m_format = { 0, NULL };
+for( unsigned i = 0; i < sizeof(preferred)/sizeof(preferred[0]); i++ )
+{
+for( std::list::iterator it = formats.begin();
+ it != formats.end(); ++it )
+{
+if( *it == preferred[i].format )
+{
+m_format = { preferred[i].format, preferred[i].name };
+msg_Dbg( getIntf(), "drag&drop selected format: %s",
+ m_format.name );
+break;
+}
+}
+if( m_format.format )
+break;
+}
+
+// Check that the drag source provides the selected format
+FORMATETC fmtetc;
+fmtetc.cfFormat = m_format.format;
 fmtetc.ptd  = NULL;
 fmtetc.dwAspect = DVASPECT_CONTENT;
 fmtetc.lindex   = -1;
 fmtetc.tymed= TYMED_HGLOBAL;
-
-// Check that the drag source provides CF_HDROP,
-// which is the only format we accept
-if( pDataObj->QueryGetData( &fmtetc ) == S_OK )
-{
+if( m_format.format && pDataObj->QueryGetData( &fmtetc ) == S_OK )
 *pdwEffect = DROPEFFECT_COPY;
-}
 else
-{
 *pdwEffect = DROPEFFECT_NONE;
-}
 
 // transmit DragEnter event
 EvtDragEnter evt( getIntf() );
@@ -108,6 +149,7 @@ STDMETHODIMP Win32DragDrop::DragOver( DWORD grfKeyState, 
POINTL pt,
 EvtDragOver evt( getIntf(), pt.x, pt.y );
 m_pWin->processEvent( evt );
 
+*pdwEffect = DROPEFFECT_COPY;
 return S_OK;
 }
 
@@ -127,62 +169,62 @@ STDMETHODIMP Win32DragDrop::Drop( LPDATAOBJECT pDataObj, 
DWORD grfKeyState,
 POINTL pt, DWORD *pdwEffect )
 {
 (void)grfKeyState;
-// User has dropped on us -- get the CF_HDROP data from drag source
+
+// On Drop, retrieve and process the data
 FORMATETC fmtetc;
-fmtetc.cfFormat = C

[vlc-commits] skins2(x11): fix Drag&Drop issues on X11.

2018-01-16 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Tue Jan 16 
19:02:13 2018 +0100| [715833ba19414b26128098c802a2e2183d4fa673] | committer: 
Erwan Tulou

skins2(x11): fix Drag&Drop issues on X11.

this patch fixes issues that limited the scope of Drag&Drop.
- set the version number to the latest one (version 5 in 2003!)
- ensure the data type is not hardcoded but selected at runtime.
- add a XSync to ascertain full completion of Drag and Drop.
- protect against possible overflow
- add some debugging info

(cherry picked from commit c5213920b8fb6d5a5ed5c430356831f14c170a6a)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=715833ba19414b26128098c802a2e2183d4fa673
---

 modules/gui/skins2/x11/x11_dragdrop.cpp | 64 +++--
 modules/gui/skins2/x11/x11_window.cpp   |  2 +-
 2 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/modules/gui/skins2/x11/x11_dragdrop.cpp 
b/modules/gui/skins2/x11/x11_dragdrop.cpp
index 47587fbfa3..9244a2532e 100644
--- a/modules/gui/skins2/x11/x11_dragdrop.cpp
+++ b/modules/gui/skins2/x11/x11_dragdrop.cpp
@@ -48,7 +48,9 @@ X11DragDrop::X11DragDrop( intf_thread_t *pIntf, X11Display 
&rDisplay,
 void X11DragDrop::dndEnter( ldata_t data )
 {
 Window src = data[0];
+int version = data[1]>>24;
 m_xPos = m_yPos = -1;
+(void)version;
 
 // Retrieve available data types
 std::list dataTypes;
@@ -81,16 +83,23 @@ void X11DragDrop::dndEnter( ldata_t data )
 }
 }
 
+// list all data types available
+std::list::iterator it;
+for( it = dataTypes.begin(); it != dataTypes.end(); ++it )
+msg_Dbg( getIntf(), "D&D data type: %s", (*it).c_str() );
+
 // Find the right target
 m_target = None;
-std::list::iterator it;
 for( it = dataTypes.begin(); it != dataTypes.end(); ++it )
 {
 if( *it == "text/uri-list" ||
 *it == "text/plain" ||
-*it == "STRING" )
+*it == "text/plain;charset=utf-8" ||
+*it == "STRING" ||
+*it == "UTF8_STRING" )
 {
 m_target = XInternAtom( XDISPLAY, (*it).c_str(), 0 );
+msg_Dbg( getIntf(), "D&D data type chosen: %s", (*it).c_str() );
 break;
 }
 }
@@ -107,22 +116,11 @@ void X11DragDrop::dndPosition( ldata_t data )
 m_xPos = data[2] >> 16;
 m_yPos = data[2] & 0x;
 Time time = data[3];
-
-Atom selectionAtom = XInternAtom( XDISPLAY, "XdndSelection", 0 );
-//Atom targetAtom = XInternAtom( XDISPLAY, "text/plain", 0 );
-Atom targetAtom = XInternAtom( XDISPLAY, "text/uri-list", 0 );
-Atom propAtom = XInternAtom( XDISPLAY, "VLC_SELECTION", 0 );
+Atom action = data[4];
+(void)time; (void)action;
 
 Atom actionAtom = XInternAtom( XDISPLAY, "XdndActionCopy", 0 );
-Atom typeAtom = XInternAtom( XDISPLAY, "XdndFinished", 0 );
-
-// Convert the selection into the given target
-// NEEDED or it doesn't work!
-XConvertSelection( XDISPLAY, selectionAtom, targetAtom, propAtom, src,
-   time );
-
-actionAtom = XInternAtom( XDISPLAY, "XdndActionCopy", 0 );
-typeAtom = XInternAtom( XDISPLAY, "XdndStatus", 0 );
+Atom typeAtom = XInternAtom( XDISPLAY, "XdndStatus", 0 );
 
 XEvent event;
 event.type = ClientMessage;
@@ -149,6 +147,8 @@ void X11DragDrop::dndPosition( ldata_t data )
 void X11DragDrop::dndLeave( ldata_t data )
 {
 (void)data;
+m_target = None;
+
 // transmit DragLeave event
 EvtDragLeave evt( getIntf() );
 m_pWin->processEvent( evt );
@@ -163,26 +163,33 @@ void X11DragDrop::dndDrop( ldata_t data )
 Time time = data[2];
 
 Atom selectionAtom = XInternAtom( XDISPLAY, "XdndSelection", 0 );
-Atom targetAtom = XInternAtom( XDISPLAY, "text/uri-list", 0 );
 Atom propAtom = XInternAtom( XDISPLAY, "VLC_SELECTION", 0 );
-
-Atom actionAtom = XInternAtom( XDISPLAY, "XdndActionCopy", 0 );
-Atom typeAtom = XInternAtom( XDISPLAY, "XdndFinished", 0 );
-
 // Convert the selection into the given target
-XConvertSelection( XDISPLAY, selectionAtom, targetAtom, propAtom, src,
+XConvertSelection( XDISPLAY, selectionAtom, m_target, propAtom, src,
time );
+// Needed to ensure XGetWindowProperty returns something
+XSync( XDISPLAY, False );
 
 // Read the selection
 Atom type;
 int format;
-unsigned long nitems, nbytes;
+unsigned long nitems, nbytes_after_return;
 char *buffer;
-XGetWindowProperty( XDISPLAY, src, propAtom, 0, 1024, False,
-AnyPropertyType, &type, &format, &nitems, &nbytes,
-(un

[vlc-commits] skins2(x11): fix Drag&Drop issues on X11.

2018-01-16 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Jan 16 19:02:13 
2018 +0100| [c5213920b8fb6d5a5ed5c430356831f14c170a6a] | committer: Erwan Tulou

skins2(x11): fix Drag&Drop issues on X11.

this patch fixes issues that limited the scope of Drag&Drop.
- set the version number to the latest one (version 5 in 2003!)
- ensure the data type is not hardcoded but selected at runtime.
- add a XSync to ascertain full completion of Drag and Drop.
- protect against possible overflow
- add some debugging info

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c5213920b8fb6d5a5ed5c430356831f14c170a6a
---

 modules/gui/skins2/x11/x11_dragdrop.cpp | 64 +++--
 modules/gui/skins2/x11/x11_window.cpp   |  2 +-
 2 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/modules/gui/skins2/x11/x11_dragdrop.cpp 
b/modules/gui/skins2/x11/x11_dragdrop.cpp
index 47587fbfa3..9244a2532e 100644
--- a/modules/gui/skins2/x11/x11_dragdrop.cpp
+++ b/modules/gui/skins2/x11/x11_dragdrop.cpp
@@ -48,7 +48,9 @@ X11DragDrop::X11DragDrop( intf_thread_t *pIntf, X11Display 
&rDisplay,
 void X11DragDrop::dndEnter( ldata_t data )
 {
 Window src = data[0];
+int version = data[1]>>24;
 m_xPos = m_yPos = -1;
+(void)version;
 
 // Retrieve available data types
 std::list dataTypes;
@@ -81,16 +83,23 @@ void X11DragDrop::dndEnter( ldata_t data )
 }
 }
 
+// list all data types available
+std::list::iterator it;
+for( it = dataTypes.begin(); it != dataTypes.end(); ++it )
+msg_Dbg( getIntf(), "D&D data type: %s", (*it).c_str() );
+
 // Find the right target
 m_target = None;
-std::list::iterator it;
 for( it = dataTypes.begin(); it != dataTypes.end(); ++it )
 {
 if( *it == "text/uri-list" ||
 *it == "text/plain" ||
-*it == "STRING" )
+*it == "text/plain;charset=utf-8" ||
+*it == "STRING" ||
+*it == "UTF8_STRING" )
 {
 m_target = XInternAtom( XDISPLAY, (*it).c_str(), 0 );
+msg_Dbg( getIntf(), "D&D data type chosen: %s", (*it).c_str() );
 break;
 }
 }
@@ -107,22 +116,11 @@ void X11DragDrop::dndPosition( ldata_t data )
 m_xPos = data[2] >> 16;
 m_yPos = data[2] & 0x;
 Time time = data[3];
-
-Atom selectionAtom = XInternAtom( XDISPLAY, "XdndSelection", 0 );
-//Atom targetAtom = XInternAtom( XDISPLAY, "text/plain", 0 );
-Atom targetAtom = XInternAtom( XDISPLAY, "text/uri-list", 0 );
-Atom propAtom = XInternAtom( XDISPLAY, "VLC_SELECTION", 0 );
+Atom action = data[4];
+(void)time; (void)action;
 
 Atom actionAtom = XInternAtom( XDISPLAY, "XdndActionCopy", 0 );
-Atom typeAtom = XInternAtom( XDISPLAY, "XdndFinished", 0 );
-
-// Convert the selection into the given target
-// NEEDED or it doesn't work!
-XConvertSelection( XDISPLAY, selectionAtom, targetAtom, propAtom, src,
-   time );
-
-actionAtom = XInternAtom( XDISPLAY, "XdndActionCopy", 0 );
-typeAtom = XInternAtom( XDISPLAY, "XdndStatus", 0 );
+Atom typeAtom = XInternAtom( XDISPLAY, "XdndStatus", 0 );
 
 XEvent event;
 event.type = ClientMessage;
@@ -149,6 +147,8 @@ void X11DragDrop::dndPosition( ldata_t data )
 void X11DragDrop::dndLeave( ldata_t data )
 {
 (void)data;
+m_target = None;
+
 // transmit DragLeave event
 EvtDragLeave evt( getIntf() );
 m_pWin->processEvent( evt );
@@ -163,26 +163,33 @@ void X11DragDrop::dndDrop( ldata_t data )
 Time time = data[2];
 
 Atom selectionAtom = XInternAtom( XDISPLAY, "XdndSelection", 0 );
-Atom targetAtom = XInternAtom( XDISPLAY, "text/uri-list", 0 );
 Atom propAtom = XInternAtom( XDISPLAY, "VLC_SELECTION", 0 );
-
-Atom actionAtom = XInternAtom( XDISPLAY, "XdndActionCopy", 0 );
-Atom typeAtom = XInternAtom( XDISPLAY, "XdndFinished", 0 );
-
 // Convert the selection into the given target
-XConvertSelection( XDISPLAY, selectionAtom, targetAtom, propAtom, src,
+XConvertSelection( XDISPLAY, selectionAtom, m_target, propAtom, src,
time );
+// Needed to ensure XGetWindowProperty returns something
+XSync( XDISPLAY, False );
 
 // Read the selection
 Atom type;
 int format;
-unsigned long nitems, nbytes;
+unsigned long nitems, nbytes_after_return;
 char *buffer;
-XGetWindowProperty( XDISPLAY, src, propAtom, 0, 1024, False,
-AnyPropertyType, &type, &format, &nitems, &nbytes,
-(unsigned char**)&buffer );
+long length_max = 1024;
+XGetWindowProperty( XDISPLAY, src, propAto

[vlc-commits] skins2: implement VOUT_WINDOW_HIDE_MOUSE control

2018-01-13 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Fri Jan 12 
11:35:45 2018 +0100| [5bccf0fd964ece48f60949020b7cefd0d6442cf7] | committer: 
Jean-Baptiste Kempf

skins2: implement VOUT_WINDOW_HIDE_MOUSE control

(cherry picked from commit 93b9f3a346e4eb954d2029053686cb44f4a36efd)
Signed-off-by: Jean-Baptiste Kempf 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=5bccf0fd964ece48f60949020b7cefd0d6442cf7
---

 modules/gui/skins2/commands/cmd_resize.cpp |  9 +
 modules/gui/skins2/commands/cmd_resize.hpp | 15 +++
 modules/gui/skins2/src/os_factory.hpp  |  3 ++-
 modules/gui/skins2/src/skin_main.cpp   | 10 ++
 modules/gui/skins2/src/vout_manager.cpp| 11 +++
 modules/gui/skins2/src/vout_manager.hpp|  3 +++
 6 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/modules/gui/skins2/commands/cmd_resize.cpp 
b/modules/gui/skins2/commands/cmd_resize.cpp
index 5903b46241..6b8b378f06 100644
--- a/modules/gui/skins2/commands/cmd_resize.cpp
+++ b/modules/gui/skins2/commands/cmd_resize.cpp
@@ -66,3 +66,12 @@ void CmdSetFullscreen::execute()
 }
 
 
+CmdHideMouse::CmdHideMouse( intf_thread_t *pIntf,
+   vout_window_t * pWnd, bool hide )
+: CmdGeneric( pIntf ), m_pWnd( pWnd ), m_bHide( hide ) { }
+
+
+void CmdHideMouse::execute()
+{
+getIntf()->p_sys->p_voutManager->hideMouseWnd( m_pWnd, m_bHide );
+}
diff --git a/modules/gui/skins2/commands/cmd_resize.hpp 
b/modules/gui/skins2/commands/cmd_resize.hpp
index c0b988b8cc..9a9d76b731 100644
--- a/modules/gui/skins2/commands/cmd_resize.hpp
+++ b/modules/gui/skins2/commands/cmd_resize.hpp
@@ -84,4 +84,19 @@ private:
 bool m_bFullscreen;
 };
 
+
+/// Command to hide mouse
+class CmdHideMouse: public CmdGeneric
+{
+public:
+/// hide the mouse
+CmdHideMouse( intf_thread_t *pIntf, vout_window_t* pWnd, bool hide );
+virtual ~CmdHideMouse() { }
+virtual void execute();
+virtual std::string getType() const { return "hide mouse"; }
+
+private:
+vout_window_t* m_pWnd;
+bool m_bHide;
+};
 #endif
diff --git a/modules/gui/skins2/src/os_factory.hpp 
b/modules/gui/skins2/src/os_factory.hpp
index 5095a4e515..3aff7ba2c3 100644
--- a/modules/gui/skins2/src/os_factory.hpp
+++ b/modules/gui/skins2/src/os_factory.hpp
@@ -51,7 +51,8 @@ public:
 kResizeNS,
 kResizeWE,
 kResizeNWSE,
-kResizeNESW
+kResizeNESW,
+kNoCursor,
 };
 
 /**
diff --git a/modules/gui/skins2/src/skin_main.cpp 
b/modules/gui/skins2/src/skin_main.cpp
index cc93d603ce..69bbf0fd44 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -472,6 +472,16 @@ static int WindowControl( vout_window_t *pWnd, int query, 
va_list args )
 return VLC_SUCCESS;
 }
 
+case VOUT_WINDOW_HIDE_MOUSE:
+{
+bool hide = va_arg( args, int );
+// Post a HideMouse command
+CmdHideMouse* pCmd =
+new CmdHideMouse( pIntf, pWnd, hide );
+pQueue->push( CmdGenericPtr( pCmd ) );
+return VLC_SUCCESS;
+}
+
 default:
 msg_Dbg( pIntf, "control query not supported" );
 return VLC_EGENERIC;
diff --git a/modules/gui/skins2/src/vout_manager.cpp 
b/modules/gui/skins2/src/vout_manager.cpp
index 5b3c6af780..442c9b265e 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -297,6 +297,17 @@ void VoutManager::setFullscreenWnd( vout_window_t *pWnd, 
bool b_fullscreen )
 }
 
 
+void VoutManager::hideMouseWnd( vout_window_t *pWnd, bool hide )
+{
+msg_Dbg( pWnd, "hide mouse (%i) received from vout thread", hide );
+OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+if( hide )
+pOsFactory->changeCursor( OSFactory::kNoCursor );
+else
+pOsFactory->changeCursor( OSFactory::kDefaultArrow );
+}
+
+
 void VoutManager::onUpdate( Subject &rVariable, void *arg )
 {
 (void)arg;
diff --git a/modules/gui/skins2/src/vout_manager.hpp 
b/modules/gui/skins2/src/vout_manager.hpp
index 60c2713aef..4cf3522b40 100644
--- a/modules/gui/skins2/src/vout_manager.hpp
+++ b/modules/gui/skins2/src/vout_manager.hpp
@@ -118,6 +118,9 @@ public:
 /// set fullscreen mode (vout window provider)
 void setFullscreenWnd( vout_window_t* pWnd, bool b_fullscreen );
 
+/// hide mouse (vout window provider)
+void hideMouseWnd( vout_window_t* pWnd, bool hide );
+
 // Register Video Controls (when building theme)
 void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: implement VOUT_WINDOW_HIDE_MOUSE control

2018-01-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jan 12 11:35:45 
2018 +0100| [93b9f3a346e4eb954d2029053686cb44f4a36efd] | committer: Erwan Tulou

skins2: implement VOUT_WINDOW_HIDE_MOUSE control

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=93b9f3a346e4eb954d2029053686cb44f4a36efd
---

 modules/gui/skins2/commands/cmd_resize.cpp |  9 +
 modules/gui/skins2/commands/cmd_resize.hpp | 15 +++
 modules/gui/skins2/src/os_factory.hpp  |  3 ++-
 modules/gui/skins2/src/skin_main.cpp   | 10 ++
 modules/gui/skins2/src/vout_manager.cpp| 11 +++
 modules/gui/skins2/src/vout_manager.hpp|  3 +++
 6 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/modules/gui/skins2/commands/cmd_resize.cpp 
b/modules/gui/skins2/commands/cmd_resize.cpp
index 5903b46241..6b8b378f06 100644
--- a/modules/gui/skins2/commands/cmd_resize.cpp
+++ b/modules/gui/skins2/commands/cmd_resize.cpp
@@ -66,3 +66,12 @@ void CmdSetFullscreen::execute()
 }
 
 
+CmdHideMouse::CmdHideMouse( intf_thread_t *pIntf,
+   vout_window_t * pWnd, bool hide )
+: CmdGeneric( pIntf ), m_pWnd( pWnd ), m_bHide( hide ) { }
+
+
+void CmdHideMouse::execute()
+{
+getIntf()->p_sys->p_voutManager->hideMouseWnd( m_pWnd, m_bHide );
+}
diff --git a/modules/gui/skins2/commands/cmd_resize.hpp 
b/modules/gui/skins2/commands/cmd_resize.hpp
index c0b988b8cc..9a9d76b731 100644
--- a/modules/gui/skins2/commands/cmd_resize.hpp
+++ b/modules/gui/skins2/commands/cmd_resize.hpp
@@ -84,4 +84,19 @@ private:
 bool m_bFullscreen;
 };
 
+
+/// Command to hide mouse
+class CmdHideMouse: public CmdGeneric
+{
+public:
+/// hide the mouse
+CmdHideMouse( intf_thread_t *pIntf, vout_window_t* pWnd, bool hide );
+virtual ~CmdHideMouse() { }
+virtual void execute();
+virtual std::string getType() const { return "hide mouse"; }
+
+private:
+vout_window_t* m_pWnd;
+bool m_bHide;
+};
 #endif
diff --git a/modules/gui/skins2/src/os_factory.hpp 
b/modules/gui/skins2/src/os_factory.hpp
index 5095a4e515..3aff7ba2c3 100644
--- a/modules/gui/skins2/src/os_factory.hpp
+++ b/modules/gui/skins2/src/os_factory.hpp
@@ -51,7 +51,8 @@ public:
 kResizeNS,
 kResizeWE,
 kResizeNWSE,
-kResizeNESW
+kResizeNESW,
+kNoCursor,
 };
 
 /**
diff --git a/modules/gui/skins2/src/skin_main.cpp 
b/modules/gui/skins2/src/skin_main.cpp
index cc93d603ce..69bbf0fd44 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -472,6 +472,16 @@ static int WindowControl( vout_window_t *pWnd, int query, 
va_list args )
 return VLC_SUCCESS;
 }
 
+case VOUT_WINDOW_HIDE_MOUSE:
+{
+bool hide = va_arg( args, int );
+// Post a HideMouse command
+CmdHideMouse* pCmd =
+new CmdHideMouse( pIntf, pWnd, hide );
+pQueue->push( CmdGenericPtr( pCmd ) );
+return VLC_SUCCESS;
+}
+
 default:
 msg_Dbg( pIntf, "control query not supported" );
 return VLC_EGENERIC;
diff --git a/modules/gui/skins2/src/vout_manager.cpp 
b/modules/gui/skins2/src/vout_manager.cpp
index 5b3c6af780..442c9b265e 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -297,6 +297,17 @@ void VoutManager::setFullscreenWnd( vout_window_t *pWnd, 
bool b_fullscreen )
 }
 
 
+void VoutManager::hideMouseWnd( vout_window_t *pWnd, bool hide )
+{
+msg_Dbg( pWnd, "hide mouse (%i) received from vout thread", hide );
+OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+if( hide )
+pOsFactory->changeCursor( OSFactory::kNoCursor );
+else
+pOsFactory->changeCursor( OSFactory::kDefaultArrow );
+}
+
+
 void VoutManager::onUpdate( Subject &rVariable, void *arg )
 {
 (void)arg;
diff --git a/modules/gui/skins2/src/vout_manager.hpp 
b/modules/gui/skins2/src/vout_manager.hpp
index 60c2713aef..4cf3522b40 100644
--- a/modules/gui/skins2/src/vout_manager.hpp
+++ b/modules/gui/skins2/src/vout_manager.hpp
@@ -118,6 +118,9 @@ public:
 /// set fullscreen mode (vout window provider)
 void setFullscreenWnd( vout_window_t* pWnd, bool b_fullscreen );
 
+/// hide mouse (vout window provider)
+void hideMouseWnd( vout_window_t* pWnd, bool hide );
+
 // Register Video Controls (when building theme)
 void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(x11): implement cursor management

2018-01-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jan 12 18:12:34 
2018 +0100| [9f475faac675e1baadb022134d1936ef868926f1] | committer: Erwan Tulou

skins2(x11): implement cursor management

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9f475faac675e1baadb022134d1936ef868926f1
---

 configure.ac  |  3 +-
 modules/gui/skins2/src/generic_window.cpp |  4 +--
 modules/gui/skins2/src/generic_window.hpp |  4 +++
 modules/gui/skins2/x11/x11_factory.cpp| 54 ++-
 modules/gui/skins2/x11/x11_factory.hpp| 13 ++--
 modules/gui/skins2/x11/x11_loop.cpp   | 13 
 6 files changed, 78 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 030832e3e3..efe861b613 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3750,9 +3750,10 @@ AS_IF([test "${enable_skins2}" != "no"], [
   ], [
 PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
 PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
+PKG_CHECK_MODULES([XCURSOR], [xcursor],, [have_skins_x11_deps="no"])
 PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
 VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} 
-DX11_SKINS])
-VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} 
${XINERAMA_LIBS} -lX11])
+VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} 
${XINERAMA_LIBS} ${XCURSOR_LIBS} -lX11])
   ])
 
   dnl we need freetype
diff --git a/modules/gui/skins2/src/generic_window.cpp 
b/modules/gui/skins2/src/generic_window.cpp
index 445a3a2824..49d9beef1f 100644
--- a/modules/gui/skins2/src/generic_window.cpp
+++ b/modules/gui/skins2/src/generic_window.cpp
@@ -32,8 +32,8 @@
 GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
   bool dragDrop, bool playOnDrop,
   GenericWindow *pParent, WindowType_t type ):
-SkinObject( pIntf ), m_left( left ), m_top( top ), m_width( 0 ),
-m_height( 0 ), m_pVarVisible( NULL )
+SkinObject( pIntf ), m_type( type ), m_left( left ), m_top( top ),
+m_width( 0 ), m_height( 0 ), m_pVarVisible( NULL )
 {
 // Get the OSFactory
 OSFactory *pOsFactory = OSFactory::instance( getIntf() );
diff --git a/modules/gui/skins2/src/generic_window.hpp 
b/modules/gui/skins2/src/generic_window.hpp
index b8f4b70660..86343e234e 100644
--- a/modules/gui/skins2/src/generic_window.hpp
+++ b/modules/gui/skins2/src/generic_window.hpp
@@ -114,6 +114,9 @@ public:
 /// windows handle
 vlc_wnd_type getOSHandle() const;
 
+/// window type
+WindowType_t getType() { return m_type; }
+
 /// reparent
 void setParent( GenericWindow* pParent,
 int x = 0, int y = 0, int w = -1, int h = -1 );
@@ -157,6 +160,7 @@ protected:
 virtual void onUpdate( Subject &rVariable , void*);
 
 private:
+WindowType_t m_type;
 /// Window position and size
 int m_left, m_top, m_width, m_height;
 /// OS specific implementation
diff --git a/modules/gui/skins2/x11/x11_factory.cpp 
b/modules/gui/skins2/x11/x11_factory.cpp
index 6e7c671884..008c64bddb 100644
--- a/modules/gui/skins2/x11/x11_factory.cpp
+++ b/modules/gui/skins2/x11/x11_factory.cpp
@@ -45,7 +45,8 @@
 #include 
 
 X11Factory::X11Factory( intf_thread_t *pIntf ): OSFactory( pIntf ),
-m_pDisplay( NULL ), m_pTimerLoop( NULL ), m_dirSep( "/" )
+m_pDisplay( NULL ), m_pTimerLoop( NULL ), m_dirSep( "/" ),
+mPointerWindow( None ), mVoutWindow( None ), mEmptyCursor( None )
 {
 // see init()
 }
@@ -53,6 +54,8 @@ X11Factory::X11Factory( intf_thread_t *pIntf ): OSFactory( 
pIntf ),
 
 X11Factory::~X11Factory()
 {
+if( mEmptyCursor != None )
+XFreeCursor( m_pDisplay->getDisplay(), mEmptyCursor );
 delete m_pTimerLoop;
 delete m_pDisplay;
 }
@@ -107,6 +110,9 @@ bool X11Factory::init()
 XFree( info );
 }
 
+// init cursors
+initCursors();
+
 return true;
 }
 
@@ -370,4 +376,50 @@ void X11Factory::rmDir( const std::string &rPath )
 rmdir( rPath.c_str() );
 }
 
+
+void X11Factory::changeCursor( CursorType_t type ) const
+{
+Cursor cursor = mCursors[type];
+Window win = (type == OSFactory::kNoCursor) ? mVoutWindow : mPointerWindow;
+
+if( win != None )
+XDefineCursor( m_pDisplay->getDisplay(), win, cursor );
+}
+
+void X11Factory::initCursors( )
+{
+Display *display = m_pDisplay->getDisplay();
+static const struct {
+CursorType_t type;
+   const char *name;
+} cursors[] = {
+{ kDefaultArrow, "left_ptr" },
+   { kResizeNWSE, "bottom_right_corner" },
+   { kResizeNS, "bottom_side" },
+   { kResizeWE, "right_side" },
+   { kResizeNESW, "bottom_left_corner" },
+};
+// retrieve cursors from default theme
+f

[vlc-commits] skins2(x11): fix skin being truncated on Gnome

2018-01-11 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Thu Jan 11 
17:33:00 2018 +0100| [f50118b046c38feeffd5a6a54c8b25bf1877a35b] | committer: 
Erwan Tulou

skins2(x11): fix skin being truncated on Gnome

Ensure the window size is updated before applying a mask.

(cherry picked from commit 4bc6943b8d53317bf18c32ae2a98955277f7a818)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=f50118b046c38feeffd5a6a54c8b25bf1877a35b
---

 modules/gui/skins2/x11/x11_graphics.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/gui/skins2/x11/x11_graphics.cpp 
b/modules/gui/skins2/x11/x11_graphics.cpp
index b6e5cbe23c..b6a34f2bdb 100644
--- a/modules/gui/skins2/x11/x11_graphics.cpp
+++ b/modules/gui/skins2/x11/x11_graphics.cpp
@@ -321,6 +321,9 @@ void X11Graphics::applyMaskToWindow( OSWindow &rWindow )
 // Get the target window
 Window win = ((X11Window&)rWindow).getDrawable();
 
+// ensure the window size is right
+XResizeWindow( XDISPLAY, win, m_width, m_height );
+
 // Change the shape of the window
 XShapeCombineRegion( XDISPLAY, win, ShapeBounding, 0, 0, m_mask,
  ShapeSet );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(x11): report mouse events to vlc core

2018-01-11 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Thu Jan 11 
04:14:45 2018 +0100| [23db4ef530efdd5c605e41f7ab02b72fbef90191] | committer: 
Erwan Tulou

skins2(x11): report mouse events to vlc core

This fixes mouse on video widget not functioning with skins on Linux.

(cherry picked from commit 0dd0534c363d7ba07cb77c705ac9147d37c92bfb)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=23db4ef530efdd5c605e41f7ab02b72fbef90191
---

 modules/gui/skins2/src/vout_window.cpp | 28 
 modules/gui/skins2/src/vout_window.hpp |  2 ++
 modules/gui/skins2/x11/x11_window.cpp  | 11 +--
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/modules/gui/skins2/src/vout_window.cpp 
b/modules/gui/skins2/src/vout_window.cpp
index e50683f410..d683e6a974 100644
--- a/modules/gui/skins2/src/vout_window.cpp
+++ b/modules/gui/skins2/src/vout_window.cpp
@@ -29,6 +29,8 @@
 #include "os_graphics.hpp"
 #include "os_window.hpp"
 #include "../events/evt_key.hpp"
+#include "../events/evt_motion.hpp"
+#include "../events/evt_mouse.hpp"
 
 #include 
 
@@ -115,3 +117,29 @@ void VoutWindow::processEvent( EvtKey &rEvtKey )
 getIntf()->p_sys->p_dialogs->sendKey( rEvtKey.getModKey() );
 }
 
+
+void VoutWindow::processEvent( EvtMotion &rEvtMotion )
+{
+int x = rEvtMotion.getXPos() - m_pParentWindow->getLeft() - getLeft();
+int y = rEvtMotion.getYPos() - m_pParentWindow->getTop() - getTop();
+vout_window_ReportMouseMoved( m_pWnd, x, y );
+}
+
+
+void VoutWindow::processEvent( EvtMouse &rEvtMouse )
+{
+int button = -1;
+if( rEvtMouse.getButton() == EvtMouse::kLeft )
+button = 0;
+else if( rEvtMouse.getButton() == EvtMouse::kMiddle )
+button = 1;
+else if( rEvtMouse.getButton() == EvtMouse::kRight )
+button = 2;
+
+if( rEvtMouse.getAction() == EvtMouse::kDown )
+vout_window_ReportMousePressed( m_pWnd, button );
+else if( rEvtMouse.getAction() == EvtMouse::kUp )
+vout_window_ReportMouseReleased( m_pWnd, button );
+else if( rEvtMouse.getAction() == EvtMouse::kDblClick )
+vout_window_ReportMouseDoubleClick( m_pWnd, button );
+}
diff --git a/modules/gui/skins2/src/vout_window.hpp 
b/modules/gui/skins2/src/vout_window.hpp
index ada0447338..ef971ae7d5 100644
--- a/modules/gui/skins2/src/vout_window.hpp
+++ b/modules/gui/skins2/src/vout_window.hpp
@@ -56,6 +56,8 @@ public:
 
 /// hotkeys processing
 virtual void processEvent( EvtKey &rEvtKey );
+virtual void processEvent( EvtMotion &rEvtMotion );
+virtual void processEvent( EvtMouse &rEvtMouse );
 
 /// set and get Video Control for VoutWindow
 virtual void setCtrlVideo( CtrlVideo* pCtrlVideo );
diff --git a/modules/gui/skins2/x11/x11_window.cpp 
b/modules/gui/skins2/x11/x11_window.cpp
index c38202fde1..57850299c4 100644
--- a/modules/gui/skins2/x11/x11_window.cpp
+++ b/modules/gui/skins2/x11/x11_window.cpp
@@ -115,18 +115,9 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow 
&rWindow,
 }
 
 // Select events received by the window
-long event_mask;
-if( type == GenericWindow::VoutWindow )
-{
-event_mask =  ExposureMask|KeyPressMask|
-  LeaveWindowMask|FocusChangeMask;
-}
-else
-{
-event_mask =  ExposureMask|KeyPressMask|
+long event_mask = ExposureMask|KeyPressMask|
   PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
   LeaveWindowMask|FocusChangeMask;
-}
 XSelectInput( XDISPLAY, m_wnd, event_mask );
 
 // Store a pointer on the generic window in a map

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix uri to path conversion

2018-01-11 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Mon Jan  8 
23:12:11 2018 +0100| [5a5a621cedff9fd38ba3d2c68058f2287a3d8e98] | committer: 
Erwan Tulou

skins2: fix uri to path conversion

(cherry picked from commit 7348862286282761da1b92cb53ff4f24a0900b4b)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=5a5a621cedff9fd38ba3d2c68058f2287a3d8e98
---

 modules/gui/skins2/src/dialogs.cpp | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/src/dialogs.cpp 
b/modules/gui/skins2/src/dialogs.cpp
index f59ea71065..465e3102dc 100644
--- a/modules/gui/skins2/src/dialogs.cpp
+++ b/modules/gui/skins2/src/dialogs.cpp
@@ -31,6 +31,7 @@
 #include "../commands/cmd_playtree.hpp"
 #include 
 #include 
+#include 
 
 /// Callback called when a new skin is chosen
 void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
@@ -41,13 +42,18 @@ void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
 {
 if( pArg->psz_results[0] )
 {
-// Create a change skin command
-CmdChangeSkin *pCmd =
-new CmdChangeSkin( pIntf, pArg->psz_results[0] );
-
-// Push the command in the asynchronous command queue
-AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
-pQueue->push( CmdGenericPtr( pCmd ) );
+char* psz_path = vlc_uri2path( pArg->psz_results[0] );
+if( psz_path )
+{
+// Create a change skin command
+CmdChangeSkin *pCmd =
+new CmdChangeSkin( pIntf, psz_path );
+free( psz_path );
+
+// Push the command in the asynchronous command queue
+AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
+pQueue->push( CmdGenericPtr( pCmd ) );
+   }
 }
 }
 else if( !pIntf->p_sys->p_theme )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix uri to path conversion

2018-01-11 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Mon Jan  8 23:12:11 
2018 +0100| [7348862286282761da1b92cb53ff4f24a0900b4b] | committer: Erwan Tulou

skins2: fix uri to path conversion

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7348862286282761da1b92cb53ff4f24a0900b4b
---

 modules/gui/skins2/src/dialogs.cpp | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/src/dialogs.cpp 
b/modules/gui/skins2/src/dialogs.cpp
index f59ea71065..465e3102dc 100644
--- a/modules/gui/skins2/src/dialogs.cpp
+++ b/modules/gui/skins2/src/dialogs.cpp
@@ -31,6 +31,7 @@
 #include "../commands/cmd_playtree.hpp"
 #include 
 #include 
+#include 
 
 /// Callback called when a new skin is chosen
 void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
@@ -41,13 +42,18 @@ void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
 {
 if( pArg->psz_results[0] )
 {
-// Create a change skin command
-CmdChangeSkin *pCmd =
-new CmdChangeSkin( pIntf, pArg->psz_results[0] );
-
-// Push the command in the asynchronous command queue
-AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
-pQueue->push( CmdGenericPtr( pCmd ) );
+char* psz_path = vlc_uri2path( pArg->psz_results[0] );
+if( psz_path )
+{
+// Create a change skin command
+CmdChangeSkin *pCmd =
+new CmdChangeSkin( pIntf, psz_path );
+free( psz_path );
+
+// Push the command in the asynchronous command queue
+AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
+pQueue->push( CmdGenericPtr( pCmd ) );
+   }
 }
 }
 else if( !pIntf->p_sys->p_theme )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(x11): report mouse events to vlc core

2018-01-11 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jan 11 04:14:45 
2018 +0100| [0dd0534c363d7ba07cb77c705ac9147d37c92bfb] | committer: Erwan Tulou

skins2(x11): report mouse events to vlc core

This fixes mouse on video widget not functioning with skins on Linux.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0dd0534c363d7ba07cb77c705ac9147d37c92bfb
---

 modules/gui/skins2/src/vout_window.cpp | 28 
 modules/gui/skins2/src/vout_window.hpp |  2 ++
 modules/gui/skins2/x11/x11_window.cpp  | 11 +--
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/modules/gui/skins2/src/vout_window.cpp 
b/modules/gui/skins2/src/vout_window.cpp
index e50683f410..d683e6a974 100644
--- a/modules/gui/skins2/src/vout_window.cpp
+++ b/modules/gui/skins2/src/vout_window.cpp
@@ -29,6 +29,8 @@
 #include "os_graphics.hpp"
 #include "os_window.hpp"
 #include "../events/evt_key.hpp"
+#include "../events/evt_motion.hpp"
+#include "../events/evt_mouse.hpp"
 
 #include 
 
@@ -115,3 +117,29 @@ void VoutWindow::processEvent( EvtKey &rEvtKey )
 getIntf()->p_sys->p_dialogs->sendKey( rEvtKey.getModKey() );
 }
 
+
+void VoutWindow::processEvent( EvtMotion &rEvtMotion )
+{
+int x = rEvtMotion.getXPos() - m_pParentWindow->getLeft() - getLeft();
+int y = rEvtMotion.getYPos() - m_pParentWindow->getTop() - getTop();
+vout_window_ReportMouseMoved( m_pWnd, x, y );
+}
+
+
+void VoutWindow::processEvent( EvtMouse &rEvtMouse )
+{
+int button = -1;
+if( rEvtMouse.getButton() == EvtMouse::kLeft )
+button = 0;
+else if( rEvtMouse.getButton() == EvtMouse::kMiddle )
+button = 1;
+else if( rEvtMouse.getButton() == EvtMouse::kRight )
+button = 2;
+
+if( rEvtMouse.getAction() == EvtMouse::kDown )
+vout_window_ReportMousePressed( m_pWnd, button );
+else if( rEvtMouse.getAction() == EvtMouse::kUp )
+vout_window_ReportMouseReleased( m_pWnd, button );
+else if( rEvtMouse.getAction() == EvtMouse::kDblClick )
+vout_window_ReportMouseDoubleClick( m_pWnd, button );
+}
diff --git a/modules/gui/skins2/src/vout_window.hpp 
b/modules/gui/skins2/src/vout_window.hpp
index ada0447338..ef971ae7d5 100644
--- a/modules/gui/skins2/src/vout_window.hpp
+++ b/modules/gui/skins2/src/vout_window.hpp
@@ -56,6 +56,8 @@ public:
 
 /// hotkeys processing
 virtual void processEvent( EvtKey &rEvtKey );
+virtual void processEvent( EvtMotion &rEvtMotion );
+virtual void processEvent( EvtMouse &rEvtMouse );
 
 /// set and get Video Control for VoutWindow
 virtual void setCtrlVideo( CtrlVideo* pCtrlVideo );
diff --git a/modules/gui/skins2/x11/x11_window.cpp 
b/modules/gui/skins2/x11/x11_window.cpp
index c38202fde1..57850299c4 100644
--- a/modules/gui/skins2/x11/x11_window.cpp
+++ b/modules/gui/skins2/x11/x11_window.cpp
@@ -115,18 +115,9 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow 
&rWindow,
 }
 
 // Select events received by the window
-long event_mask;
-if( type == GenericWindow::VoutWindow )
-{
-event_mask =  ExposureMask|KeyPressMask|
-  LeaveWindowMask|FocusChangeMask;
-}
-else
-{
-event_mask =  ExposureMask|KeyPressMask|
+long event_mask = ExposureMask|KeyPressMask|
   PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
   LeaveWindowMask|FocusChangeMask;
-}
 XSelectInput( XDISPLAY, m_wnd, event_mask );
 
 // Store a pointer on the generic window in a map

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(x11): fix skin being truncated on Gnome

2018-01-11 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jan 11 17:33:00 
2018 +0100| [4bc6943b8d53317bf18c32ae2a98955277f7a818] | committer: Erwan Tulou

skins2(x11): fix skin being truncated on Gnome

Ensure the window size is updated before applying a mask.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4bc6943b8d53317bf18c32ae2a98955277f7a818
---

 modules/gui/skins2/x11/x11_graphics.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/gui/skins2/x11/x11_graphics.cpp 
b/modules/gui/skins2/x11/x11_graphics.cpp
index b6e5cbe23c..b6a34f2bdb 100644
--- a/modules/gui/skins2/x11/x11_graphics.cpp
+++ b/modules/gui/skins2/x11/x11_graphics.cpp
@@ -321,6 +321,9 @@ void X11Graphics::applyMaskToWindow( OSWindow &rWindow )
 // Get the target window
 Window win = ((X11Window&)rWindow).getDrawable();
 
+// ensure the window size is right
+XResizeWindow( XDISPLAY, win, m_width, m_height );
+
 // Change the shape of the window
 XShapeCombineRegion( XDISPLAY, win, ShapeBounding, 0, 0, m_mask,
  ShapeSet );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] qt: fix crash when undocking playlist on Wayland + optimization elsewhere

2017-12-17 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Tue Dec 12 
14:06:10 2017 +0100| [dbded10b41460b09fad134e8d37e7a07425110c9] | committer: 
Jean-Baptiste Kempf

qt: fix crash when undocking playlist on Wayland + optimization elsewhere

Since the video widget is always kept in the main interface, just making
sure it is relocated __before__ moving the playlistwidget to the playlist
dialog saves the two calls to the display server needed to reparent the
native window back and forth at the qt level.

For Wayland, this fixes a crash, since qt is unable to reparent due to
Wayland limitations, anyway.

For other platforms, this is an optimization, since we avoid two useless
often inter-process communications (reparenting back and forth)

Signed-off-by: Jean-Baptiste Kempf 
(cherry picked from commit a420de32234b1517069c717d9cc7885854f7d289)
Signed-off-by: Jean-Baptiste Kempf 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=dbded10b41460b09fad134e8d37e7a07425110c9
---

 modules/gui/qt/main_interface.cpp | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/main_interface.cpp 
b/modules/gui/qt/main_interface.cpp
index 8763d21fc2..3889dedc0e 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1069,12 +1069,21 @@ void MainInterface::dockPlaylist( bool p_docked )
 if( !p_docked ) /* Previously docked */
 {
 playlistVisible = playlistWidget->isVisible();
-stackCentralW->removeWidget( playlistWidget );
-dialog->importPlaylistWidget( playlistWidget );
+
+/* repositioning the videowidget __before__ exporting the
+   playlistwidget into the playlist dialog avoids two unneeded
+   calls to the server in the qt library to reparent the underlying
+   native window back and forth.
+   For Wayland, this is mandatory since reparenting is not implemented.
+   For X11 or Windows, this is just an optimization. */
 if ( videoWidget && THEMIM->getIM()->hasVideo() )
 showTab(videoWidget);
 else
 showTab(bgWidget);
+
+/* playlistwidget exported into the playlist dialog */
+stackCentralW->removeWidget( playlistWidget );
+dialog->importPlaylistWidget( playlistWidget );
 if ( playlistVisible ) dialog->show();
 }
 else /* Previously undocked */

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] qt: fix crash when undocking playlist on Wayland + optimization elsewhere

2017-12-17 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Dec 12 14:06:10 
2017 +0100| [a420de32234b1517069c717d9cc7885854f7d289] | committer: 
Jean-Baptiste Kempf

qt: fix crash when undocking playlist on Wayland + optimization elsewhere

Since the video widget is always kept in the main interface, just making
sure it is relocated __before__ moving the playlistwidget to the playlist
dialog saves the two calls to the display server needed to reparent the
native window back and forth at the qt level.

For Wayland, this fixes a crash, since qt is unable to reparent due to
Wayland limitations, anyway.

For other platforms, this is an optimization, since we avoid two useless
often inter-process communications (reparenting back and forth)

Signed-off-by: Jean-Baptiste Kempf 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a420de32234b1517069c717d9cc7885854f7d289
---

 modules/gui/qt/main_interface.cpp | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/main_interface.cpp 
b/modules/gui/qt/main_interface.cpp
index 8763d21fc2..3889dedc0e 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1069,12 +1069,21 @@ void MainInterface::dockPlaylist( bool p_docked )
 if( !p_docked ) /* Previously docked */
 {
 playlistVisible = playlistWidget->isVisible();
-stackCentralW->removeWidget( playlistWidget );
-dialog->importPlaylistWidget( playlistWidget );
+
+/* repositioning the videowidget __before__ exporting the
+   playlistwidget into the playlist dialog avoids two unneeded
+   calls to the server in the qt library to reparent the underlying
+   native window back and forth.
+   For Wayland, this is mandatory since reparenting is not implemented.
+   For X11 or Windows, this is just an optimization. */
 if ( videoWidget && THEMIM->getIM()->hasVideo() )
 showTab(videoWidget);
 else
 showTab(bgWidget);
+
+/* playlistwidget exported into the playlist dialog */
+stackCentralW->removeWidget( playlistWidget );
+dialog->importPlaylistWidget( playlistWidget );
 if ( playlistVisible ) dialog->show();
 }
 else /* Previously undocked */

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] qt(wayland): fix video widget failing to display video.

2017-12-17 Thread Erwan Tulou
vlc/vlc-3.0 | branch: master | Erwan Tulou  | Sun Dec 10 
19:00:15 2017 +0100| [844119079d1e2266f8a041d7b0caf1ac1f248f89] | committer: 
Jean-Baptiste Kempf

qt(wayland): fix video widget failing to display video.

Setting Qt:WA_DontCreateNativeAncestors in addition to Qt::WA_NativeWindow
tells qt to create a native window for the widget and only for the widget.

For Wayland, this resulted in one single wayland subsurface instead of a
tree of nested subsurfaces. Wayland is a bit convoluted when it comes to
mapping/unmapping nested subsurfaces, which accounted for the video failing
to be displayed.

For X11, on the contrary, setting Qt:WA_DontCreateNativeAncestors proved
wrong with some misplacement in the video. So, this parameter is set
*** ONLY *** in a Wayland context.

Signed-off-by: Jean-Baptiste Kempf 
(cherry picked from commit eb375bf9583eed0a1a588ee9d436a2219e2809f8)
Signed-off-by: Jean-Baptiste Kempf 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=844119079d1e2266f8a041d7b0caf1ac1f248f89
---

 modules/gui/qt/components/interface_widgets.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/gui/qt/components/interface_widgets.cpp 
b/modules/gui/qt/components/interface_widgets.cpp
index a5fef977d3..98dfdebfbe 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -164,6 +164,9 @@ bool VideoWidget::request( struct vout_window_t *p_wnd )
 #ifdef QT5_HAS_WAYLAND
 case VOUT_WINDOW_TYPE_WAYLAND:
 {
+/* Ensure only the video widget is native (needed for Wayland) */
+stable->setAttribute( Qt::WA_DontCreateNativeAncestors, true);
+
 QWindow *window = stable->windowHandle();
 assert(window != NULL);
 window->create();

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] qt(wayland): fix video widget failing to display video.

2017-12-13 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Dec 10 19:00:15 
2017 +0100| [eb375bf9583eed0a1a588ee9d436a2219e2809f8] | committer: 
Jean-Baptiste Kempf

qt(wayland): fix video widget failing to display video.

Setting Qt:WA_DontCreateNativeAncestors in addition to Qt::WA_NativeWindow
tells qt to create a native window for the widget and only for the widget.

For Wayland, this resulted in one single wayland subsurface instead of a
tree of nested subsurfaces. Wayland is a bit convoluted when it comes to
mapping/unmapping nested subsurfaces, which accounted for the video failing
to be displayed.

For X11, on the contrary, setting Qt:WA_DontCreateNativeAncestors proved
wrong with some misplacement in the video. So, this parameter is set
*** ONLY *** in a Wayland context.

Signed-off-by: Jean-Baptiste Kempf 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eb375bf9583eed0a1a588ee9d436a2219e2809f8
---

 modules/gui/qt/components/interface_widgets.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/gui/qt/components/interface_widgets.cpp 
b/modules/gui/qt/components/interface_widgets.cpp
index a5fef977d3..98dfdebfbe 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -164,6 +164,9 @@ bool VideoWidget::request( struct vout_window_t *p_wnd )
 #ifdef QT5_HAS_WAYLAND
 case VOUT_WINDOW_TYPE_WAYLAND:
 {
+/* Ensure only the video widget is native (needed for Wayland) */
+stable->setAttribute( Qt::WA_DontCreateNativeAncestors, true);
+
 QWindow *window = stable->windowHandle();
 assert(window != NULL);
 window->create();

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix object pointer inadvertedly modified recently

2016-12-09 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Dec  9 21:36:54 
2016 +0100| [56a969a8fbdfcf58b46e5cf40acc6ca3c8ad1942] | committer: Erwan Tulou

skins2: fix object pointer inadvertedly modified recently

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=56a969a8fbdfcf58b46e5cf40acc6ca3c8ad1942
---

 modules/gui/skins2/src/vlcproc.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/src/vlcproc.cpp 
b/modules/gui/skins2/src/vlcproc.cpp
index b8d8c85..b827637 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -204,7 +204,7 @@ VlcProc::~VlcProc()
 var_DelCallback( getPL(), "playlist-item-deleted", onItemDelete, this );
 var_DelCallback( getPL(), "input-current", onInputNew, this );
 var_DelCallback( getPL(), "item-change", onItemChange, this );
-var_DelCallback( getPL(), "interaction", onInteraction, this );
+var_DelCallback( getIntf(), "interaction", onInteraction, this );
 }
 
 int VlcProc::onInputNew( vlc_object_t *pObj, const char *pVariable,

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix typo following a recent change in playlist.

2016-12-09 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Dec  9 21:12:32 
2016 +0100| [a3ab7ff0d9330cb9047a4cf0b4ac75432af12408] | committer: Erwan Tulou

skins2: fix typo following a recent change in playlist.

This caused the skin engine to fail to refresh on the spot when new items
were added to the playlist.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3ab7ff0d9330cb9047a4cf0b4ac75432af12408
---

 modules/gui/skins2/vars/playtree.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/vars/playtree.cpp 
b/modules/gui/skins2/vars/playtree.cpp
index 5dc8c1a..90012db 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -210,7 +210,7 @@ void Playtree::onAppend( int i_id )
 }
 
 Iterator it_node = findById( pItem->p_parent->i_id );
-if( it_node != m_children.end() )
+if( it_node == m_children.end() )
 {
 playlist_Unlock( m_pPlaylist );
 return;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: kill some warnings

2016-02-01 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Tue Dec  1 
15:34:17 2015 +0100| [3bc3f2bcde73240e059dfe78bad225589d1b49a4] | committer: 
Erwan Tulou

skins2: kill some warnings

(cherry picked from commit 60aae68d2779ec644946bcd1cab1cc11971f4086)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=3bc3f2bcde73240e059dfe78bad225589d1b49a4
---

 modules/gui/skins2/src/ft2_bitmap.cpp |4 ++--
 modules/gui/skins2/src/ft2_bitmap.hpp |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/ft2_bitmap.cpp 
b/modules/gui/skins2/src/ft2_bitmap.cpp
index fed481b..10a3e11 100644
--- a/modules/gui/skins2/src/ft2_bitmap.cpp
+++ b/modules/gui/skins2/src/ft2_bitmap.cpp
@@ -50,10 +50,10 @@ void FT2Bitmap::draw( const FT_Bitmap &rBitmap, int left, 
int top,
 uint8_t green = (color >> 8) & 0xff;
 uint8_t red = (color >> 16) & 0xff;
 
-for( int y = top; y < top + rBitmap.rows && y < m_height; y++ )
+for( unsigned y = top; y < top + rBitmap.rows && y < m_height; y++ )
 {
 uint8_t *pData = m_pData + 4 * (m_width * y + left);
-for( int x = left; x < left + rBitmap.width && x < m_width; x++ )
+for( unsigned x = left; x < left + rBitmap.width && x < m_width; x++ )
 {
 // The buffer in FT_Bitmap contains alpha values
 uint8_t val = *(pBuf++);
diff --git a/modules/gui/skins2/src/ft2_bitmap.hpp 
b/modules/gui/skins2/src/ft2_bitmap.hpp
index daaab72..c60845d 100644
--- a/modules/gui/skins2/src/ft2_bitmap.hpp
+++ b/modules/gui/skins2/src/ft2_bitmap.hpp
@@ -56,7 +56,7 @@ public:
 
 private:
 /// Bitmap size
-int m_width, m_height;
+unsigned int m_width, m_height;
 /// Image data buffer
 uint8_t *m_pData;
 };

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix maximizing a window in a multi-screen context.

2016-02-01 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Thu Jan 28 
20:08:00 2016 +0100| [b442adbeec75aaf03b69eac60234a21d3f1ddd5d] | committer: 
Erwan Tulou

skins2: fix maximizing a window in a multi-screen context.

  The current screen in a multi-screen config is chosen to
  maximize the window instead of the default main screen.

  This fixes trac #16500

(cherry picked from commit b6603b4c8cdcd93e8d64f686c708e5fe3beb724c)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=b442adbeec75aaf03b69eac60234a21d3f1ddd5d
---

 modules/gui/skins2/src/window_manager.cpp |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/gui/skins2/src/window_manager.cpp 
b/modules/gui/skins2/src/window_manager.cpp
index 093e6d3..7941cd5 100644
--- a/modules/gui/skins2/src/window_manager.cpp
+++ b/modules/gui/skins2/src/window_manager.cpp
@@ -325,7 +325,11 @@ void WindowManager::maximize( TopWindow &rWindow )
rWindow.getLeft() + rWindow.getWidth(),
rWindow.getTop() + rWindow.getHeight() );
 
-SkinsRect workArea = OSFactory::instance( getIntf() )->getWorkArea();
+// maximise the window within the current screen (multiple screens allowed)
+int x, y, width, height;
+rWindow.getMonitorInfo( &x, &y, &width, &height );
+SkinsRect workArea(x, y, x + width, y + height);
+
 // Move the window
 startMove( rWindow );
 move( rWindow, workArea.getLeft(), workArea.getTop() );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix maximizing a window in a multi-screen context.

2016-01-28 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jan 28 20:08:00 
2016 +0100| [b6603b4c8cdcd93e8d64f686c708e5fe3beb724c] | committer: Erwan Tulou

skins2: fix maximizing a window in a multi-screen context.

  The current screen in a multi-screen config is chosen to
  maximize the window instead of the default main screen.

  This fixes trac #16500

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b6603b4c8cdcd93e8d64f686c708e5fe3beb724c
---

 modules/gui/skins2/src/window_manager.cpp |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/gui/skins2/src/window_manager.cpp 
b/modules/gui/skins2/src/window_manager.cpp
index 093e6d3..7941cd5 100644
--- a/modules/gui/skins2/src/window_manager.cpp
+++ b/modules/gui/skins2/src/window_manager.cpp
@@ -325,7 +325,11 @@ void WindowManager::maximize( TopWindow &rWindow )
rWindow.getLeft() + rWindow.getWidth(),
rWindow.getTop() + rWindow.getHeight() );
 
-SkinsRect workArea = OSFactory::instance( getIntf() )->getWorkArea();
+// maximise the window within the current screen (multiple screens allowed)
+int x, y, width, height;
+rWindow.getMonitorInfo( &x, &y, &width, &height );
+SkinsRect workArea(x, y, x + width, y + height);
+
 // Move the window
 startMove( rWindow );
 move( rWindow, workArea.getLeft(), workArea.getTop() );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: kill some warnings

2016-01-28 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Dec  1 15:34:17 
2015 +0100| [60aae68d2779ec644946bcd1cab1cc11971f4086] | committer: Erwan Tulou

skins2: kill some warnings

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=60aae68d2779ec644946bcd1cab1cc11971f4086
---

 modules/gui/skins2/src/ft2_bitmap.cpp |4 ++--
 modules/gui/skins2/src/ft2_bitmap.hpp |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/ft2_bitmap.cpp 
b/modules/gui/skins2/src/ft2_bitmap.cpp
index fed481b..10a3e11 100644
--- a/modules/gui/skins2/src/ft2_bitmap.cpp
+++ b/modules/gui/skins2/src/ft2_bitmap.cpp
@@ -50,10 +50,10 @@ void FT2Bitmap::draw( const FT_Bitmap &rBitmap, int left, 
int top,
 uint8_t green = (color >> 8) & 0xff;
 uint8_t red = (color >> 16) & 0xff;
 
-for( int y = top; y < top + rBitmap.rows && y < m_height; y++ )
+for( unsigned y = top; y < top + rBitmap.rows && y < m_height; y++ )
 {
 uint8_t *pData = m_pData + 4 * (m_width * y + left);
-for( int x = left; x < left + rBitmap.width && x < m_width; x++ )
+for( unsigned x = left; x < left + rBitmap.width && x < m_width; x++ )
 {
 // The buffer in FT_Bitmap contains alpha values
 uint8_t val = *(pBuf++);
diff --git a/modules/gui/skins2/src/ft2_bitmap.hpp 
b/modules/gui/skins2/src/ft2_bitmap.hpp
index daaab72..c60845d 100644
--- a/modules/gui/skins2/src/ft2_bitmap.hpp
+++ b/modules/gui/skins2/src/ft2_bitmap.hpp
@@ -56,7 +56,7 @@ public:
 
 private:
 /// Bitmap size
-int m_width, m_height;
+unsigned int m_width, m_height;
 /// Image data buffer
 uint8_t *m_pData;
 };

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Linux): fix fullscreen for some Window Managers like Gnome3

2015-09-08 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Tue Sep  8 13:46:54 
2015 +0200| [51e41b79f4849934b32d19cba21e7185d35f9f9d] | committer: 
Jean-Baptiste Kempf

skins2(Linux): fix fullscreen for some Window Managers like Gnome3

   Some Window Managers (Gnome3, Unity) will keep the task bar displayed
   and limit the fullscreen display to the subarea outside the task bar
   if the window type is not set.
   Setting the Window type to normal ensures a clean 100% fullscreen.

   This fixes an issue reported on the forum at
   https://forum.videolan.org/viewtopic.php?f=13&t=127840

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=51e41b79f4849934b32d19cba21e7185d35f9f9d
---

 modules/gui/skins2/x11/x11_display.cpp |3 +++
 modules/gui/skins2/x11/x11_display.hpp |6 ++
 modules/gui/skins2/x11/x11_window.cpp  |   13 +
 3 files changed, 22 insertions(+)

diff --git a/modules/gui/skins2/x11/x11_display.cpp 
b/modules/gui/skins2/x11/x11_display.cpp
index ac02312..eac50c9 100644
--- a/modules/gui/skins2/x11/x11_display.cpp
+++ b/modules/gui/skins2/x11/x11_display.cpp
@@ -330,6 +330,9 @@ void X11Display::testEWMH()
 msg_Dbg( getIntf(), "%s support: yes", value );\
 }
 
+TEST_EWMH( m_net_wm_window_type, "_NET_WM_WINDOW_TYPE" )
+TEST_EWMH( m_net_wm_window_type_normal, "_NET_WM_WINDOW_TYPE_NORMAL" )
+
 TEST_EWMH( m_net_wm_state, "_NET_WM_STATE" )
 TEST_EWMH( m_net_wm_state_fullscreen, "_NET_WM_STATE_FULLSCREEN" )
 TEST_EWMH( m_net_wm_stays_on_top, "_NET_WM_STATE_STAYS_ON_TOP" )
diff --git a/modules/gui/skins2/x11/x11_display.hpp 
b/modules/gui/skins2/x11/x11_display.hpp
index 9647263..dea86e2 100644
--- a/modules/gui/skins2/x11/x11_display.hpp
+++ b/modules/gui/skins2/x11/x11_display.hpp
@@ -36,6 +36,8 @@
 #define XGC m_rDisplay.getGC()
 
 #define NET_WM_SUPPORTED  m_rDisplay.m_net_wm_supported
+#define NET_WM_WINDOW_TYPEm_rDisplay.m_net_wm_window_type
+#define NET_WM_WINDOW_TYPE_NORMAL m_rDisplay.m_net_wm_window_type_normal
 #define NET_WM_STATE  m_rDisplay.m_net_wm_state
 #define NET_WM_STATE_FULLSCREEN   m_rDisplay.m_net_wm_state_fullscreen
 #define NET_WM_STATE_ABOVEm_rDisplay.m_net_wm_state_above
@@ -85,6 +87,10 @@ public:
 
 /// EWMH spec
 Atom m_net_wm_supported;
+
+Atom m_net_wm_window_type;
+Atom m_net_wm_window_type_normal;
+
 Atom m_net_wm_state;
 Atom m_net_wm_state_above;
 Atom m_net_wm_state_fullscreen;
diff --git a/modules/gui/skins2/x11/x11_window.cpp 
b/modules/gui/skins2/x11/x11_window.cpp
index 24dba3a..7e83648 100644
--- a/modules/gui/skins2/x11/x11_window.cpp
+++ b/modules/gui/skins2/x11/x11_window.cpp
@@ -221,6 +221,19 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow 
&rWindow,
 XChangeProperty( XDISPLAY, m_wnd, NET_WM_PID, XA_CARDINAL, 32,
  PropModeReplace, (unsigned char *)&pid, 1 );
 
+if( NET_WM_WINDOW_TYPE != None )
+{
+if( type == GenericWindow::FullscreenWindow )
+{
+// Some Window Managers like Gnome3 limit fullscreen to the
+// subarea outside the task bar if no window type is provided.
+// For those WMs, setting type window to normal ensures a clean
+// 100% fullscreen
+XChangeProperty( XDISPLAY, m_wnd, NET_WM_WINDOW_TYPE,
+ XA_ATOM, 32, PropModeReplace,
+ (unsigned char *)&NET_WM_WINDOW_TYPE_NORMAL, 1 );
+}
+}
 }
 
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Linux): fix fullscreen for some Window Managers like Gnome3

2015-09-08 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Tue Sep  8 
13:46:54 2015 +0200| [479bc999e204f03299df69a5a04977ce1e0a6267] | committer: 
Jean-Baptiste Kempf

skins2(Linux): fix fullscreen for some Window Managers like Gnome3

   Some Window Managers (Gnome3, Unity) will keep the task bar displayed
   and limit the fullscreen display to the subarea outside the task bar
   if the window type is not set.
   Setting the Window type to normal ensures a clean 100% fullscreen.

   This fixes an issue reported on the forum at
   https://forum.videolan.org/viewtopic.php?f=13&t=127840

(cherry picked from commit 51e41b79f4849934b32d19cba21e7185d35f9f9d)
Signed-off-by: Jean-Baptiste Kempf 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=479bc999e204f03299df69a5a04977ce1e0a6267
---

 modules/gui/skins2/x11/x11_display.cpp |3 +++
 modules/gui/skins2/x11/x11_display.hpp |6 ++
 modules/gui/skins2/x11/x11_window.cpp  |   13 +
 3 files changed, 22 insertions(+)

diff --git a/modules/gui/skins2/x11/x11_display.cpp 
b/modules/gui/skins2/x11/x11_display.cpp
index ac02312..eac50c9 100644
--- a/modules/gui/skins2/x11/x11_display.cpp
+++ b/modules/gui/skins2/x11/x11_display.cpp
@@ -330,6 +330,9 @@ void X11Display::testEWMH()
 msg_Dbg( getIntf(), "%s support: yes", value );\
 }
 
+TEST_EWMH( m_net_wm_window_type, "_NET_WM_WINDOW_TYPE" )
+TEST_EWMH( m_net_wm_window_type_normal, "_NET_WM_WINDOW_TYPE_NORMAL" )
+
 TEST_EWMH( m_net_wm_state, "_NET_WM_STATE" )
 TEST_EWMH( m_net_wm_state_fullscreen, "_NET_WM_STATE_FULLSCREEN" )
 TEST_EWMH( m_net_wm_stays_on_top, "_NET_WM_STATE_STAYS_ON_TOP" )
diff --git a/modules/gui/skins2/x11/x11_display.hpp 
b/modules/gui/skins2/x11/x11_display.hpp
index 9647263..dea86e2 100644
--- a/modules/gui/skins2/x11/x11_display.hpp
+++ b/modules/gui/skins2/x11/x11_display.hpp
@@ -36,6 +36,8 @@
 #define XGC m_rDisplay.getGC()
 
 #define NET_WM_SUPPORTED  m_rDisplay.m_net_wm_supported
+#define NET_WM_WINDOW_TYPEm_rDisplay.m_net_wm_window_type
+#define NET_WM_WINDOW_TYPE_NORMAL m_rDisplay.m_net_wm_window_type_normal
 #define NET_WM_STATE  m_rDisplay.m_net_wm_state
 #define NET_WM_STATE_FULLSCREEN   m_rDisplay.m_net_wm_state_fullscreen
 #define NET_WM_STATE_ABOVEm_rDisplay.m_net_wm_state_above
@@ -85,6 +87,10 @@ public:
 
 /// EWMH spec
 Atom m_net_wm_supported;
+
+Atom m_net_wm_window_type;
+Atom m_net_wm_window_type_normal;
+
 Atom m_net_wm_state;
 Atom m_net_wm_state_above;
 Atom m_net_wm_state_fullscreen;
diff --git a/modules/gui/skins2/x11/x11_window.cpp 
b/modules/gui/skins2/x11/x11_window.cpp
index 6473c21..ca4e6b0 100644
--- a/modules/gui/skins2/x11/x11_window.cpp
+++ b/modules/gui/skins2/x11/x11_window.cpp
@@ -221,6 +221,19 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow 
&rWindow,
 XChangeProperty( XDISPLAY, m_wnd, NET_WM_PID, XA_CARDINAL, 32,
  PropModeReplace, (unsigned char *)&pid, 1 );
 
+if( NET_WM_WINDOW_TYPE != None )
+{
+if( type == GenericWindow::FullscreenWindow )
+{
+// Some Window Managers like Gnome3 limit fullscreen to the
+// subarea outside the task bar if no window type is provided.
+// For those WMs, setting type window to normal ensures a clean
+// 100% fullscreen
+XChangeProperty( XDISPLAY, m_wnd, NET_WM_WINDOW_TYPE,
+ XA_ATOM, 32, PropModeReplace,
+ (unsigned char *)&NET_WM_WINDOW_TYPE_NORMAL, 1 );
+}
+}
 }
 
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: also enable key accelerators when focus on playlist

2015-09-08 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sat Jul 18 22:53:07 
2015 +0200| [a3a09ff07b226116c32a0ff12fb20a6c1ee2bf86] | committer: Erwan Tulou

skins2: also enable key accelerators when focus on playlist

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3a09ff07b226116c32a0ff12fb20a6c1ee2bf86
---

 modules/gui/skins2/controls/ctrl_tree.cpp |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp 
b/modules/gui/skins2/controls/ctrl_tree.cpp
index 55945cc..63fe050 100644
--- a/modules/gui/skins2/controls/ctrl_tree.cpp
+++ b/modules/gui/skins2/controls/ctrl_tree.cpp
@@ -31,6 +31,7 @@
 #include "../src/generic_bitmap.hpp"
 #include "../src/generic_font.hpp"
 #include "../src/scaled_bitmap.hpp"
+#include "../src/dialogs.hpp"
 #include "../utils/position.hpp"
 #include "../utils/ustring.hpp"
 #include "../events/evt_key.hpp"
@@ -382,8 +383,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
 {
 // other keys to be forwarded to vlc core
 EvtKey& rEvtKey = (EvtKey&)rEvent;
-var_SetInteger( getIntf()->p_libvlc, "key-pressed",
-rEvtKey.getModKey() );
+getIntf()->p_sys->p_dialogs->sendKey( rEvtKey.getModKey() );
 }
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix uninitialized variable

2015-09-08 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sat Jul 18 23:01:35 
2015 +0200| [b973146c7178f962709e8c5b6b7a70532871c8e9] | committer: Erwan Tulou

skins2: fix uninitialized variable

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b973146c7178f962709e8c5b6b7a70532871c8e9
---

 modules/gui/skins2/vars/equalizer.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/vars/equalizer.cpp 
b/modules/gui/skins2/vars/equalizer.cpp
index 8b0548e..a61b1fc 100644
--- a/modules/gui/skins2/vars/equalizer.cpp
+++ b/modules/gui/skins2/vars/equalizer.cpp
@@ -60,7 +60,7 @@ EqualizerBands::~EqualizerBands()
 
 void EqualizerBands::set( std::string bands )
 {
-float val;
+float val = 0.0f;
 std::stringstream ss( bands );
 
 m_isUpdating = true;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Skins2: add check on bitmaps to avoid crash

2015-06-17 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Wed Jun 17 
12:46:48 2015 +0200| [f59e289efdef3086571e20d3cd281fed3bda0bca] | committer: 
Erwan Tulou

Skins2: add check on bitmaps to avoid crash

(cherry picked from commit d7b946844c7aeb97c878779f8ea0cba548626504)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=f59e289efdef3086571e20d3cd281fed3bda0bca
---

 modules/gui/skins2/parser/builder.cpp |   49 ++---
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/modules/gui/skins2/parser/builder.cpp 
b/modules/gui/skins2/parser/builder.cpp
index 5b7d1a7..bf470b5 100644
--- a/modules/gui/skins2/parser/builder.cpp
+++ b/modules/gui/skins2/parser/builder.cpp
@@ -132,7 +132,7 @@ Theme *Builder::build()
 
 
 // Macro to get a bitmap by its ID in the builder
-#define GET_BMP( pBmp, id ) \
+#define GET_BMP( pBmp, id, abort ) \
 if( id != "none" ) \
 { \
 pBmp = m_pTheme->getBitmapById(id); \
@@ -141,6 +141,11 @@ Theme *Builder::build()
 msg_Err( getIntf(), "unknown bitmap id: %s", id.c_str() ); \
 return; \
 } \
+} \
+else if( abort )\
+{ \
+msg_Err( getIntf(), "bitmap required for id: %s", rData.m_id.c_str() 
); \
+return; \
 }
 
 // macro to check bitmap size consistency for button and checkbox
@@ -244,7 +249,7 @@ void Builder::addSubBitmap( const BuilderData::SubBitmap 
&rData )
 
 // Get the parent bitmap
 GenericBitmap *pParentBmp = NULL;
-GET_BMP( pParentBmp, rData.m_parent );
+GET_BMP( pParentBmp, rData.m_parent, true );
 
 // Copy a region of the parent bitmap to the new one
 BitmapImpl *pBmp =
@@ -457,13 +462,13 @@ void Builder::addButton( const BuilderData::Button &rData 
)
 {
 // Get the bitmaps of the button
 GenericBitmap *pBmpUp = NULL;
-GET_BMP( pBmpUp, rData.m_upId );
+GET_BMP( pBmpUp, rData.m_upId, true );
 
 GenericBitmap *pBmpDown = pBmpUp;
-GET_BMP( pBmpDown, rData.m_downId );
+GET_BMP( pBmpDown, rData.m_downId, false );
 
 GenericBitmap *pBmpOver = pBmpUp;
-GET_BMP( pBmpOver, rData.m_overId );
+GET_BMP( pBmpOver, rData.m_overId, false );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -519,22 +524,22 @@ void Builder::addCheckbox( const BuilderData::Checkbox 
&rData )
 {
 // Get the bitmaps of the checkbox
 GenericBitmap *pBmpUp1 = NULL;
-GET_BMP( pBmpUp1, rData.m_up1Id );
+GET_BMP( pBmpUp1, rData.m_up1Id, true );
 
 GenericBitmap *pBmpDown1 = pBmpUp1;
-GET_BMP( pBmpDown1, rData.m_down1Id );
+GET_BMP( pBmpDown1, rData.m_down1Id, false );
 
 GenericBitmap *pBmpOver1 = pBmpUp1;
-GET_BMP( pBmpOver1, rData.m_over1Id );
+GET_BMP( pBmpOver1, rData.m_over1Id, false );
 
 GenericBitmap *pBmpUp2 = NULL;
-GET_BMP( pBmpUp2, rData.m_up2Id );
+GET_BMP( pBmpUp2, rData.m_up2Id, true );
 
 GenericBitmap *pBmpDown2 = pBmpUp2;
-GET_BMP( pBmpDown2, rData.m_down2Id );
+GET_BMP( pBmpDown2, rData.m_down2Id, false );
 
 GenericBitmap *pBmpOver2 = pBmpUp2;
-GET_BMP( pBmpOver2, rData.m_over2Id );
+GET_BMP( pBmpOver2, rData.m_over2Id, false );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -611,7 +616,7 @@ void Builder::addCheckbox( const BuilderData::Checkbox 
&rData )
 void Builder::addImage( const BuilderData::Image &rData )
 {
 GenericBitmap *pBmp = NULL;
-GET_BMP( pBmp, rData.m_bmpId );
+GET_BMP( pBmp, rData.m_bmpId, true );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -810,7 +815,7 @@ void Builder::addRadialSlider( const 
BuilderData::RadialSlider &rData )
 {
 // Get the bitmaps of the slider
 GenericBitmap *pSeq = NULL;
-GET_BMP( pSeq, rData.m_sequence );
+GET_BMP( pSeq, rData.m_sequence, true );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -864,7 +869,7 @@ void Builder::addSlider( const BuilderData::Slider &rData )
 
 // Get the bitmaps of the background
 GenericBitmap *pBgImage = NULL;
-GET_BMP( pBgImage, rData.m_imageId );
+GET_BMP( pBgImage, rData.m_imageId, false );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -916,13 +921,13 @@ void Builder::addSlider( const BuilderData::Slider &rData 
)
 
 // Get the bitmaps of the cursor
 GenericBitmap *pBmpUp = NULL;
-GET_BMP( pBmpUp, rData.m_upId );
+GET_BMP( pBmpUp, rData.m_upId, true );
 
 GenericBitmap *pBmpDown = pBmpUp;
-GET_BMP( pBmpDown, rData.m_downId );
+GET_BMP( pBmpDown, rData.m_downId, false );
 
 GenericBitmap *pBmpOver = pBmpUp;
-GET_BMP( pBmpOver, rData.m_overId );
+GET_BMP( pBmpOver, rData.m_

[vlc-commits] Skins2: add check on bitmaps to avoid crash

2015-06-17 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Wed Jun 17 12:46:48 
2015 +0200| [d7b946844c7aeb97c878779f8ea0cba548626504] | committer: Erwan Tulou

Skins2: add check on bitmaps to avoid crash

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d7b946844c7aeb97c878779f8ea0cba548626504
---

 modules/gui/skins2/parser/builder.cpp |   49 ++---
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/modules/gui/skins2/parser/builder.cpp 
b/modules/gui/skins2/parser/builder.cpp
index 5b7d1a7..bf470b5 100644
--- a/modules/gui/skins2/parser/builder.cpp
+++ b/modules/gui/skins2/parser/builder.cpp
@@ -132,7 +132,7 @@ Theme *Builder::build()
 
 
 // Macro to get a bitmap by its ID in the builder
-#define GET_BMP( pBmp, id ) \
+#define GET_BMP( pBmp, id, abort ) \
 if( id != "none" ) \
 { \
 pBmp = m_pTheme->getBitmapById(id); \
@@ -141,6 +141,11 @@ Theme *Builder::build()
 msg_Err( getIntf(), "unknown bitmap id: %s", id.c_str() ); \
 return; \
 } \
+} \
+else if( abort )\
+{ \
+msg_Err( getIntf(), "bitmap required for id: %s", rData.m_id.c_str() 
); \
+return; \
 }
 
 // macro to check bitmap size consistency for button and checkbox
@@ -244,7 +249,7 @@ void Builder::addSubBitmap( const BuilderData::SubBitmap 
&rData )
 
 // Get the parent bitmap
 GenericBitmap *pParentBmp = NULL;
-GET_BMP( pParentBmp, rData.m_parent );
+GET_BMP( pParentBmp, rData.m_parent, true );
 
 // Copy a region of the parent bitmap to the new one
 BitmapImpl *pBmp =
@@ -457,13 +462,13 @@ void Builder::addButton( const BuilderData::Button &rData 
)
 {
 // Get the bitmaps of the button
 GenericBitmap *pBmpUp = NULL;
-GET_BMP( pBmpUp, rData.m_upId );
+GET_BMP( pBmpUp, rData.m_upId, true );
 
 GenericBitmap *pBmpDown = pBmpUp;
-GET_BMP( pBmpDown, rData.m_downId );
+GET_BMP( pBmpDown, rData.m_downId, false );
 
 GenericBitmap *pBmpOver = pBmpUp;
-GET_BMP( pBmpOver, rData.m_overId );
+GET_BMP( pBmpOver, rData.m_overId, false );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -519,22 +524,22 @@ void Builder::addCheckbox( const BuilderData::Checkbox 
&rData )
 {
 // Get the bitmaps of the checkbox
 GenericBitmap *pBmpUp1 = NULL;
-GET_BMP( pBmpUp1, rData.m_up1Id );
+GET_BMP( pBmpUp1, rData.m_up1Id, true );
 
 GenericBitmap *pBmpDown1 = pBmpUp1;
-GET_BMP( pBmpDown1, rData.m_down1Id );
+GET_BMP( pBmpDown1, rData.m_down1Id, false );
 
 GenericBitmap *pBmpOver1 = pBmpUp1;
-GET_BMP( pBmpOver1, rData.m_over1Id );
+GET_BMP( pBmpOver1, rData.m_over1Id, false );
 
 GenericBitmap *pBmpUp2 = NULL;
-GET_BMP( pBmpUp2, rData.m_up2Id );
+GET_BMP( pBmpUp2, rData.m_up2Id, true );
 
 GenericBitmap *pBmpDown2 = pBmpUp2;
-GET_BMP( pBmpDown2, rData.m_down2Id );
+GET_BMP( pBmpDown2, rData.m_down2Id, false );
 
 GenericBitmap *pBmpOver2 = pBmpUp2;
-GET_BMP( pBmpOver2, rData.m_over2Id );
+GET_BMP( pBmpOver2, rData.m_over2Id, false );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -611,7 +616,7 @@ void Builder::addCheckbox( const BuilderData::Checkbox 
&rData )
 void Builder::addImage( const BuilderData::Image &rData )
 {
 GenericBitmap *pBmp = NULL;
-GET_BMP( pBmp, rData.m_bmpId );
+GET_BMP( pBmp, rData.m_bmpId, true );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -810,7 +815,7 @@ void Builder::addRadialSlider( const 
BuilderData::RadialSlider &rData )
 {
 // Get the bitmaps of the slider
 GenericBitmap *pSeq = NULL;
-GET_BMP( pSeq, rData.m_sequence );
+GET_BMP( pSeq, rData.m_sequence, true );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -864,7 +869,7 @@ void Builder::addSlider( const BuilderData::Slider &rData )
 
 // Get the bitmaps of the background
 GenericBitmap *pBgImage = NULL;
-GET_BMP( pBgImage, rData.m_imageId );
+GET_BMP( pBgImage, rData.m_imageId, false );
 
 GenericLayout *pLayout = m_pTheme->getLayoutById( rData.m_layoutId );
 if( pLayout == NULL )
@@ -916,13 +921,13 @@ void Builder::addSlider( const BuilderData::Slider &rData 
)
 
 // Get the bitmaps of the cursor
 GenericBitmap *pBmpUp = NULL;
-GET_BMP( pBmpUp, rData.m_upId );
+GET_BMP( pBmpUp, rData.m_upId, true );
 
 GenericBitmap *pBmpDown = pBmpUp;
-GET_BMP( pBmpDown, rData.m_downId );
+GET_BMP( pBmpDown, rData.m_downId, false );
 
 GenericBitmap *pBmpOver = pBmpUp;
-GET_BMP( pBmpOver, rData.m_overId );
+GET_BMP( pBmpOver, rData.m_overId, false );
 
 // Create the cursor control
 CtrlSliderCursor *pCursor = new CtrlSliderCursor( get

[vlc-commits] skins2: fix compilation on Linux (if no libtar)

2015-06-13 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Sun Jun 14 
00:38:28 2015 +0200| [b9b974d7a924f59ccca3decbd1a4e5d38345ffe9] | committer: 
Erwan Tulou

skins2: fix compilation on Linux (if no libtar)

problem reported by Timothy B. Terriberry" 

(cherry picked from commit 7a8a62f6f7987d01232800924b75ab4d05fc163e)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=b9b974d7a924f59ccca3decbd1a4e5d38345ffe9
---

 modules/gui/skins2/src/theme_loader.cpp |3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index e54f999..6766be5 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -64,6 +64,9 @@ int makedir( const char *newdir );
 #define WINAMP2_XML_FILE "winamp2.xml"
 #define ZIP_BUFFER_SIZE 4096
 
+#ifndef O_BINARY
+#   define O_BINARY 0
+#endif
 
 bool ThemeLoader::load( const string &fileName )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix compilation on Linux (if no libtar)

2015-06-13 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sun Jun 14 00:38:28 
2015 +0200| [7a8a62f6f7987d01232800924b75ab4d05fc163e] | committer: Erwan Tulou

skins2: fix compilation on Linux (if no libtar)

problem reported by Timothy B. Terriberry" 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a8a62f6f7987d01232800924b75ab4d05fc163e
---

 modules/gui/skins2/src/theme_loader.cpp |3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index e54f999..6766be5 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -64,6 +64,9 @@ int makedir( const char *newdir );
 #define WINAMP2_XML_FILE "winamp2.xml"
 #define ZIP_BUFFER_SIZE 4096
 
+#ifndef O_BINARY
+#   define O_BINARY 0
+#endif
 
 bool ThemeLoader::load( const string &fileName )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: replace unlink with vlc_unlink

2015-06-13 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Sat Jun 13 
14:13:01 2015 +0200| [0f4bb9c024c6ce759b53a778b46157e8dcd6b7d0] | committer: 
Erwan Tulou

skins2: replace unlink with vlc_unlink

(cherry picked from commit 5e3c93f14aa5084101b1a0adf527016b3a86904c)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=0f4bb9c024c6ce759b53a778b46157e8dcd6b7d0
---

 modules/gui/skins2/src/theme_loader.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index ae983a3..a8d2725 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -640,7 +640,7 @@ int tar_extract_all( TAR *t, char *prefix )
 fprintf( stderr, "error writing %s skipping...\n", fname );
 fclose( outfile );
 outfile = NULL;
-unlink( fname );
+vlc_unlink( fname );
 }
 }
 remaining -= bytes;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Linux): replace tempnam() with mkdtemp()

2015-06-13 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Sat Jun 13 
15:29:25 2015 +0200| [150ac49cf2a2904f4bf5783e4dac84a38e53626d] | committer: 
Erwan Tulou

skins2(Linux): replace tempnam() with mkdtemp()

Linux manual strongly advises against using tempnam().

(cherry picked from commit 27cb7a2eddae5bd4e730ca7fff5b05cffd1b691c)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=150ac49cf2a2904f4bf5783e4dac84a38e53626d
---

 modules/gui/skins2/src/theme_loader.cpp |   28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index a8d2725..e54f999 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -817,29 +817,27 @@ string ThemeLoader::getTmpDir( )
 {
 #if defined( _WIN32 )
 wchar_t *tmpdir = _wtempnam( NULL, L"vlt" );
-#else
-char *tmpdir = tempnam( NULL, "vlt" );
-#endif
 if( tmpdir == NULL )
 return "";
-
-#if defined( _WIN32 )
 char* utf8 = FromWide( tmpdir );
-if( utf8 == NULL )
-{
-free( tmpdir );
-return "";
-}
-string tempPath( utf8 );
+free( tmpdir );
+string tempPath( utf8 ? utf8 : "" );
 free( utf8 );
+return tempPath;
+
 #elif defined( __OS2__ )
+char *tmpdir = tempnam( NULL, "vlt" );
+if( tmpdir == NULL )
+return "";
 string tempPath( sFromLocale( tmpdir ));
-#else
-string tempPath( tmpdir );
-#endif
-
 free( tmpdir );
 return tempPath;
+
+#else
+char templ[] = "/tmp/vltXX";
+char *tmpdir = mkdtemp( templ );
+return string( tmpdir ? tmpdir : "");
+#endif
 }
 
 #endif

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: replace unlink with vlc_unlink

2015-06-13 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sat Jun 13 14:13:01 
2015 +0200| [5e3c93f14aa5084101b1a0adf527016b3a86904c] | committer: Erwan Tulou

skins2: replace unlink with vlc_unlink

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e3c93f14aa5084101b1a0adf527016b3a86904c
---

 modules/gui/skins2/src/theme_loader.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index ae983a3..a8d2725 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -640,7 +640,7 @@ int tar_extract_all( TAR *t, char *prefix )
 fprintf( stderr, "error writing %s skipping...\n", fname );
 fclose( outfile );
 outfile = NULL;
-unlink( fname );
+vlc_unlink( fname );
 }
 }
 remaining -= bytes;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Linux): replace tempnam() with mkdtemp()

2015-06-13 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Sat Jun 13 15:29:25 
2015 +0200| [27cb7a2eddae5bd4e730ca7fff5b05cffd1b691c] | committer: Erwan Tulou

skins2(Linux): replace tempnam() with mkdtemp()

Linux manual strongly advises against using tempnam().

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=27cb7a2eddae5bd4e730ca7fff5b05cffd1b691c
---

 modules/gui/skins2/src/theme_loader.cpp |   28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index a8d2725..e54f999 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -817,29 +817,27 @@ string ThemeLoader::getTmpDir( )
 {
 #if defined( _WIN32 )
 wchar_t *tmpdir = _wtempnam( NULL, L"vlt" );
-#else
-char *tmpdir = tempnam( NULL, "vlt" );
-#endif
 if( tmpdir == NULL )
 return "";
-
-#if defined( _WIN32 )
 char* utf8 = FromWide( tmpdir );
-if( utf8 == NULL )
-{
-free( tmpdir );
-return "";
-}
-string tempPath( utf8 );
+free( tmpdir );
+string tempPath( utf8 ? utf8 : "" );
 free( utf8 );
+return tempPath;
+
 #elif defined( __OS2__ )
+char *tmpdir = tempnam( NULL, "vlt" );
+if( tmpdir == NULL )
+return "";
 string tempPath( sFromLocale( tmpdir ));
-#else
-string tempPath( tmpdir );
-#endif
-
 free( tmpdir );
 return tempPath;
+
+#else
+char templ[] = "/tmp/vltXX";
+char *tmpdir = mkdtemp( templ );
+return string( tmpdir ? tmpdir : "");
+#endif
 }
 
 #endif

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: replace all stat() with vlc_stat()

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Fri Jun 12 
11:04:18 2015 +0200| [6dc293939bc8ca6dd82f42a3910d53ea6f61e9a8] | committer: 
Erwan Tulou

skins2: replace all stat() with vlc_stat()

(cherry picked from commit 49c72956b06beceda573b3f6eb5d57a3b5ddb414)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=6dc293939bc8ca6dd82f42a3910d53ea6f61e9a8
---

 modules/gui/skins2/parser/xmlparser.cpp |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/parser/xmlparser.cpp 
b/modules/gui/skins2/parser/xmlparser.cpp
index 4c19bed..c99a03b 100644
--- a/modules/gui/skins2/parser/xmlparser.cpp
+++ b/modules/gui/skins2/parser/xmlparser.cpp
@@ -26,6 +26,7 @@
 #include 
 
 #include 
+#include 
 
 XMLParser::XMLParser( intf_thread_t *pIntf, const string &rFileName )
 : SkinObject( pIntf ), m_pXML( NULL ), m_pReader( NULL ), m_pStream( NULL )
@@ -84,7 +85,7 @@ void XMLParser::LoadCatalog()
 for( it = resPath.begin(); it != resPath.end(); ++it )
 {
 string catalog_path = (*it) + sep + "skin.catalog";
-if( !stat( catalog_path.c_str(), &statBuf ) )
+if( !vlc_stat( catalog_path.c_str(), &statBuf ) )
 {
 msg_Dbg( getIntf(), "Using catalog %s", catalog_path.c_str() );
 xml_CatalogLoad( m_pXML, catalog_path.c_str() );
@@ -100,7 +101,7 @@ void XMLParser::LoadCatalog()
 for( it = resPath.begin(); it != resPath.end(); ++it )
 {
 string path = (*it) + sep + "skin.dtd";
-if( !stat( path.c_str(), &statBuf ) )
+if( !vlc_stat( path.c_str(), &statBuf ) )
 {
 // DTD found
 msg_Dbg( getIntf(), "using DTD %s", path.c_str() );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): fix multibyte issue for vlt filename (zip format)

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Thu Jun 11 
20:53:06 2015 +0200| [e76b5fad18d4abc906a338b93e7c9c2ab919bba4] | committer: 
Erwan Tulou

skins2(Win): fix multibyte issue for vlt filename (zip format)

On Windows, unzOpen() doesn't fully support Microsoft wide char.
So, use unzOpen2() with a callback to use vlc_fopen() instead of
the default fopen().

This fixes situations where a skin filename or path contains
e.g Japanese characters whatever the Windows locale.

For OS2 and Linux, no functional change.

(cherry picked from commit 1ac910a5f378a77d88469facf830055877701d3c)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=e76b5fad18d4abc906a338b93e7c9c2ab919bba4
---

 modules/gui/skins2/src/theme_loader.cpp |   19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index 1fba110..083fa79 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -78,7 +78,7 @@ bool ThemeLoader::load( const string &fileName )
 // file...
 
 #if defined( HAVE_ZLIB_H )
-if( ! extract( sToLocale( fileName ) ) && ! parse( path, fileName ) )
+if( ! extract( fileName ) && ! parse( path, fileName ) )
 return false;
 #else
 if( ! parse( path, fileName ) )
@@ -134,13 +134,28 @@ bool ThemeLoader::extractTarGz( const string &tarFile, 
const string &rootDir )
 return true;
 }
 
+static voidpf ZCALLBACK open_vlc( voidpf opaque, const char *filename, int 
mode)
+{
+(void)mode;
+intf_thread_t *pIntf = (intf_thread_t *)opaque;
+
+FILE *stream = vlc_fopen( filename, "rb" );
+if( stream == NULL )
+msg_Dbg( pIntf, "vlc_fopen failed for %s", filename );
+return stream;
+}
 
 bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
 {
 bool b_isWsz = strstr( zipFile.c_str(), ".wsz" );
 
 // Try to open the ZIP file
-unzFile file = unzOpen( zipFile.c_str() );
+zlib_filefunc_def descr;
+fill_fopen_filefunc( &descr );
+descr.zopen_file = open_vlc;
+descr.opaque = getIntf();
+
+unzFile file = unzOpen2( zipFile.c_str(), &descr );
 if( file == 0 )
 {
 msg_Dbg( getIntf(), "failed to open %s as a zip file",

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix multibyte issue for temporary directory

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Fri Jun 12 
13:10:01 2015 +0200| [49276e70f115d382e65b9d4c9bd31fd280eba0a4] | committer: 
Erwan Tulou

skins2: fix multibyte issue for temporary directory

(cherry picked from commit 6de8060b719fad54d86eb9d097dc73d7a6d7f479)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=49276e70f115d382e65b9d4c9bd31fd280eba0a4
---

 modules/gui/skins2/src/theme_loader.cpp |   36 ---
 modules/gui/skins2/src/theme_loader.hpp |3 +++
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index eee6219..ae983a3 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -288,9 +288,9 @@ bool ThemeLoader::extractFileInZip( unzFile file, const 
string &rootDir,
 bool ThemeLoader::extract( const string &fileName )
 {
 bool result = true;
-char *tmpdir = tempnam( NULL, "vlt" );
-string tempPath = sFromLocale( tmpdir );
-free( tmpdir );
+string tempPath = getTmpDir();
+if( tempPath.empty() )
+return false;
 
 // Extract the file in a temporary directory
 if( ! extractTarGz( fileName, tempPath ) &&
@@ -812,4 +812,34 @@ int gzwrite_frontend( int fd, const void * p_buffer, 
size_t i_length )
 return -1;
 }
 
+// FIXME: could become a skins2 OS factory function or a vlc core function
+string ThemeLoader::getTmpDir( )
+{
+#if defined( _WIN32 )
+wchar_t *tmpdir = _wtempnam( NULL, L"vlt" );
+#else
+char *tmpdir = tempnam( NULL, "vlt" );
+#endif
+if( tmpdir == NULL )
+return "";
+
+#if defined( _WIN32 )
+char* utf8 = FromWide( tmpdir );
+if( utf8 == NULL )
+{
+free( tmpdir );
+return "";
+}
+string tempPath( utf8 );
+free( utf8 );
+#elif defined( __OS2__ )
+string tempPath( sFromLocale( tmpdir ));
+#else
+string tempPath( tmpdir );
+#endif
+
+free( tmpdir );
+return tempPath;
+}
+
 #endif
diff --git a/modules/gui/skins2/src/theme_loader.hpp 
b/modules/gui/skins2/src/theme_loader.hpp
index 99d43ac..9025904 100644
--- a/modules/gui/skins2/src/theme_loader.hpp
+++ b/modules/gui/skins2/src/theme_loader.hpp
@@ -71,6 +71,9 @@ private:
  * Expects a string from the current locale.
  */
 void deleteTempFiles( const string &path );
+
+/// Get a unique temporary directory
+string getTmpDir( );
 #endif
 
 /// Parse the XML file given as a parameter and build the skin

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix wrong FromLocale()

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Fri Jun 12 
12:19:36 2015 +0200| [2367cfe8a98324d84a1967b32de6f34e5652148f] | committer: 
Erwan Tulou

skins2: fix wrong FromLocale()

file is already utf8 encoded, since it is a string that comes from
the theme.xml description file, and therefore it is expected to be utf8.

(cherry picked from commit ab806efc95b8378fab3b8b7aed78da07957269a1)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=2367cfe8a98324d84a1967b32de6f34e5652148f
---

 modules/gui/skins2/parser/builder.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/parser/builder.cpp 
b/modules/gui/skins2/parser/builder.cpp
index 7d8ae77..5b7d1a7 100644
--- a/modules/gui/skins2/parser/builder.cpp
+++ b/modules/gui/skins2/parser/builder.cpp
@@ -1259,7 +1259,7 @@ string Builder::getFilePath( const string &rFileName ) 
const
file.replace( pos, 1, sep );
 #endif
 
-string full_path = m_path + sep + sFromLocale( file );
+string full_path = m_path + sep + file;
 
 // check that the file exists
 struct stat stat;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: remove a leftover call to FromLocale()

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Fri Jun 12 
11:32:06 2015 +0200| [40710288890bf92d107fb2f6924e25c308737549] | committer: 
Erwan Tulou

skins2: remove a leftover call to FromLocale()

- on Windows, the ressource paths are already UTF8 encoded. bug fixed
- on Linux, the function is a noop
- on OS2, config_GetDataDir() may need a fix (two paths, the former returns
locale, the latter UTF8)

(cherry picked from commit 58eb9328ed1daa2701c040dc9f076f08dca9b396)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=40710288890bf92d107fb2f6924e25c308737549
---

 modules/gui/skins2/src/theme_repository.cpp |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/modules/gui/skins2/src/theme_repository.cpp 
b/modules/gui/skins2/src/theme_repository.cpp
index 7e14ddb..ab1ef17 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -135,17 +135,14 @@ ThemeRepository::~ThemeRepository()
 }
 
 
-void ThemeRepository::parseDirectory( const string &rDir_locale )
+void ThemeRepository::parseDirectory( const string &rDir )
 {
 const char *pszDirContent;
 // Path separator
 const string &sep = OSFactory::instance( getIntf() )->getDirSeparator();
 
 // Open the dir
-// FIXME: parseDirectory should be invoked with UTF-8 input instead!!
-string rDir = sFromLocale( rDir_locale );
 DIR *pDir = vlc_opendir( rDir.c_str() );
-
 if( pDir == NULL )
 {
 // An error occurred

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: replace ifstream() with vlc_stat()

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Fri Jun 12 
21:12:44 2015 +0200| [ff1783a00518b42cebe0405a20d337628ff537d8] | committer: 
Erwan Tulou

skins2: replace ifstream() with vlc_stat()

(cherry picked from commit 51299c84451404d9f564f24d429bbc21ff4a091a)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=ff1783a00518b42cebe0405a20d337628ff537d8
---

 modules/gui/skins2/parser/builder.cpp |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/parser/builder.cpp 
b/modules/gui/skins2/parser/builder.cpp
index ece673f..7d8ae77 100644
--- a/modules/gui/skins2/parser/builder.cpp
+++ b/modules/gui/skins2/parser/builder.cpp
@@ -57,8 +57,9 @@
 #include "../utils/var_bool.hpp"
 #include "../utils/var_text.hpp"
 
+#include 
+#include 
 #include 
-#include 
 
 
 Builder::Builder( intf_thread_t *pIntf, const BuilderData &rData,
@@ -1260,8 +1261,9 @@ string Builder::getFilePath( const string &rFileName ) 
const
 
 string full_path = m_path + sep + sFromLocale( file );
 
-// check that the file exists and can be read
-if( ifstream( full_path.c_str() ).fail() )
+// check that the file exists
+struct stat stat;
+if( vlc_stat( full_path.c_str(), &stat ) )
 {
 msg_Err( getIntf(), "missing file: %s", file.c_str() );
 full_path = "";

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): fix another multibyte issue

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Fri Jun 12 
10:38:06 2015 +0200| [5788a5738a02bd334dc22328e3ca221049dc7b4f] | committer: 
Erwan Tulou

skins2(Win): fix another multibyte issue

(cherry picked from commit 9e9fd90d0ccf75eb51ae5a2624f7efc8b317581c)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=5788a5738a02bd334dc22328e3ca221049dc7b4f
---

 modules/gui/skins2/src/theme_repository.cpp |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/src/theme_repository.cpp 
b/modules/gui/skins2/src/theme_repository.cpp
index bf19dcf..7e14ddb 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -26,8 +26,9 @@
 #include "../commands/async_queue.hpp"
 #include "../commands/cmd_dialogs.hpp"
 #include 
+#include 
 
-#include 
+#include 
 
 
 ThemeRepository *ThemeRepository::instance( intf_thread_t *pIntf )
@@ -88,17 +89,17 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): 
SkinObject( pIntf )
 
 // retrieve last skins stored or skins requested by user
 char* psz_current = var_InheritString( getIntf(), "skins2-last" );
-string current = string( psz_current ? psz_current : "" );
+string current( psz_current ? psz_current : "" );
 free( psz_current );
 
-// check if skins exists and is readable
-bool b_readable = !ifstream( sToLocale(current).c_str() ).fail();
-
+// check if skin exists
+struct stat stat;
+bool b_exists = !vlc_stat( current.c_str(), &stat );
 msg_Dbg( getIntf(), "requested skins %s is %s accessible",
- current.c_str(), b_readable ? "" : "NOT" );
+ current.c_str(), b_exists ? "" : "NOT" );
 
 // set the default skins if given skins not accessible
-if( !b_readable && b_default_found )
+if( !b_exists && b_default_found )
 current = itdefault->second;
 
 // save this valid skins for reuse

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix file descriptor leak and missing error check

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Thu Jun 11 
20:09:10 2015 +0200| [23188e2036b47526e63d6b9346af150957825b10] | committer: 
Erwan Tulou

skins2: fix file descriptor leak and missing error check

(cherry picked from commit 01bf3662b1af1673cc5f6efbb355a698983a7651)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=23188e2036b47526e63d6b9346af150957825b10
---

 modules/gui/skins2/src/theme_loader.cpp |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index 5783cda..1fba110 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -115,6 +115,8 @@ bool ThemeLoader::extractTarGz( const string &tarFile, 
const string &rootDir )
 if( tar_open( &t, (char *)tarFile.c_str(), O_RDONLY ) == -1 )
 #endif
 {
+msg_Dbg( getIntf(), "failed to open %s as a gzip tar file",
+tarFile.c_str() );
 return false;
 }
 
@@ -139,10 +141,18 @@ bool ThemeLoader::extractZip( const string &zipFile, 
const string &rootDir )
 
 // Try to open the ZIP file
 unzFile file = unzOpen( zipFile.c_str() );
+if( file == 0 )
+{
+msg_Dbg( getIntf(), "failed to open %s as a zip file",
+ zipFile.c_str() );
+return false;
+}
 unz_global_info info;
-
 if( unzGetGlobalInfo( file, &info ) != UNZ_OK )
 {
+msg_Dbg( getIntf(), "failed to read zip info from %s",
+ zipFile.c_str() );
+unzClose( file );
 return false;
 }
 // Extract all the files in the archive
@@ -159,7 +169,7 @@ bool ThemeLoader::extractZip( const string &zipFile, const 
string &rootDir )
 if( i < info.number_entry - 1 )
 {
 // Go the next file in the archive
-if( unzGoToNextFile( file ) !=UNZ_OK )
+if( unzGoToNextFile( file ) != UNZ_OK )
 {
 msg_Warn( getIntf(), "error while unzipping %s",
   zipFile.c_str() );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: replace all fopen() with vlc_fopen()

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Fri Jun 12 
14:37:05 2015 +0200| [80f1016779f86db6878920a5a60c7ba35e41df86] | committer: 
Erwan Tulou

skins2: replace all fopen() with vlc_fopen()

(cherry picked from commit 369d697c91052d07aacdd11d233084cf4df4745c)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=80f1016779f86db6878920a5a60c7ba35e41df86
---

 modules/gui/skins2/src/ft2_font.cpp |2 +-
 modules/gui/skins2/src/theme_loader.cpp |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/skins2/src/ft2_font.cpp 
b/modules/gui/skins2/src/ft2_font.cpp
index 51a9ade..855640b 100644
--- a/modules/gui/skins2/src/ft2_font.cpp
+++ b/modules/gui/skins2/src/ft2_font.cpp
@@ -62,7 +62,7 @@ bool FT2Font::init()
 return false;
 }
 
-FILE *file = fopen( m_name.c_str(), "rb" );
+FILE *file = vlc_fopen( m_name.c_str(), "rb" );
 if( !file )
 {
 msg_Dbg( getIntf(), "failed to open font %s (%s)",
diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index de99320..eee6219 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -238,7 +238,7 @@ bool ThemeLoader::extractFileInZip( unzFile file, const 
string &rootDir,
 return false;
 }
 makedir( basePath.c_str() );
-FILE *fout = fopen( fullPath.c_str(), "wb" );
+FILE *fout = vlc_fopen( fullPath.c_str(), "wb" );
 if( fout == NULL )
 {
 msg_Err( getIntf(), "error opening %s", fullPath.c_str() );
@@ -600,7 +600,7 @@ int tar_extract_all( TAR *t, char *prefix )
 remaining = getoct( buffer.header.size, 12 );
 if( !remaining ) outfile = NULL; else
 {
-outfile = fopen( fname, "wb" );
+outfile = vlc_fopen( fname, "wb" );
 if( outfile == NULL )
 {
 /* try creating directory */
@@ -610,7 +610,7 @@ int tar_extract_all( TAR *t, char *prefix )
 *p = '\0';
 makedir( fname );
 *p = '/';
-outfile = fopen( fname, "wb" );
+outfile = vlc_fopen( fname, "wb" );
 if( !outfile )
 {
 fprintf( stderr, "tar couldn't create %s\n",

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): fix multibyte issue for vlt filename (tar format)

2015-06-12 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Thu Jun 11 
21:43:25 2015 +0200| [2f2d5b5a7736e1610b8c1fe82f981eb141fd1435] | committer: 
Erwan Tulou

skins2(Win): fix multibyte issue for vlt filename (tar format)

On Windows, gzopen() doesn't fully support Microsoft wide char either.
So, use vlc_open() + gzdopen().

For OS2 and Linux, no functional change.

(cherry picked from commit 743ca935aa278f33ecb0488bd61f12ab00e3d951)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=2f2d5b5a7736e1610b8c1fe82f981eb141fd1435
---

 modules/gui/skins2/src/theme_loader.cpp |   24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index 083fa79..de99320 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -516,14 +516,26 @@ int tar_open( TAR **t, char *pathname, int oflags )
 {
 (void)oflags;
 
-gzFile f = gzopen( pathname, "rb" );
+int fd = vlc_open( pathname, O_BINARY | O_RDONLY );
+if( !fd )
+{
+fprintf( stderr, "Couldn't open %s\n", pathname );
+return -1;
+}
+gzFile f = gzdopen( fd, "rb" );
 if( f == NULL )
 {
 fprintf( stderr, "Couldn't gzopen %s\n", pathname );
+close( fd );
 return -1;
 }
 
 *t = (gzFile *)malloc( sizeof(gzFile) );
+if( *t == NULL )
+{
+gzclose( f );
+return -1;
+}
 **t = f;
 return 0;
 }
@@ -750,11 +762,17 @@ int gzopen_frontend( const char *pathname, int oflags, 
int mode )
 errno = EINVAL;
 return -1;
 }
-
-gzf = gzopen( pathname, gzflags );
+int fd = vlc_open( pathname, oflags );
+if( !fd )
+{
+fprintf( stderr, "Couldn't open %s\n", pathname );
+return -1;
+}
+gzf = gzdopen( fd, gzflags );
 if( !gzf )
 {
 errno = ENOMEM;
+close( fd );
 return -1;
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: replace all fopen() with vlc_fopen()

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jun 12 14:37:05 
2015 +0200| [369d697c91052d07aacdd11d233084cf4df4745c] | committer: Erwan Tulou

skins2: replace all fopen() with vlc_fopen()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=369d697c91052d07aacdd11d233084cf4df4745c
---

 modules/gui/skins2/src/ft2_font.cpp |2 +-
 modules/gui/skins2/src/theme_loader.cpp |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/skins2/src/ft2_font.cpp 
b/modules/gui/skins2/src/ft2_font.cpp
index 51a9ade..855640b 100644
--- a/modules/gui/skins2/src/ft2_font.cpp
+++ b/modules/gui/skins2/src/ft2_font.cpp
@@ -62,7 +62,7 @@ bool FT2Font::init()
 return false;
 }
 
-FILE *file = fopen( m_name.c_str(), "rb" );
+FILE *file = vlc_fopen( m_name.c_str(), "rb" );
 if( !file )
 {
 msg_Dbg( getIntf(), "failed to open font %s (%s)",
diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index de99320..eee6219 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -238,7 +238,7 @@ bool ThemeLoader::extractFileInZip( unzFile file, const 
string &rootDir,
 return false;
 }
 makedir( basePath.c_str() );
-FILE *fout = fopen( fullPath.c_str(), "wb" );
+FILE *fout = vlc_fopen( fullPath.c_str(), "wb" );
 if( fout == NULL )
 {
 msg_Err( getIntf(), "error opening %s", fullPath.c_str() );
@@ -600,7 +600,7 @@ int tar_extract_all( TAR *t, char *prefix )
 remaining = getoct( buffer.header.size, 12 );
 if( !remaining ) outfile = NULL; else
 {
-outfile = fopen( fname, "wb" );
+outfile = vlc_fopen( fname, "wb" );
 if( outfile == NULL )
 {
 /* try creating directory */
@@ -610,7 +610,7 @@ int tar_extract_all( TAR *t, char *prefix )
 *p = '\0';
 makedir( fname );
 *p = '/';
-outfile = fopen( fname, "wb" );
+outfile = vlc_fopen( fname, "wb" );
 if( !outfile )
 {
 fprintf( stderr, "tar couldn't create %s\n",

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): fix multibyte issue for vlt filename (zip format)

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jun 11 20:53:06 
2015 +0200| [1ac910a5f378a77d88469facf830055877701d3c] | committer: Erwan Tulou

skins2(Win): fix multibyte issue for vlt filename (zip format)

On Windows, unzOpen() doesn't fully support Microsoft wide char.
So, use unzOpen2() with a callback to use vlc_fopen() instead of
the default fopen().

This fixes situations where a skin filename or path contains
e.g Japanese characters whatever the Windows locale.

For OS2 and Linux, no functional change.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1ac910a5f378a77d88469facf830055877701d3c
---

 modules/gui/skins2/src/theme_loader.cpp |   19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index 1fba110..083fa79 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -78,7 +78,7 @@ bool ThemeLoader::load( const string &fileName )
 // file...
 
 #if defined( HAVE_ZLIB_H )
-if( ! extract( sToLocale( fileName ) ) && ! parse( path, fileName ) )
+if( ! extract( fileName ) && ! parse( path, fileName ) )
 return false;
 #else
 if( ! parse( path, fileName ) )
@@ -134,13 +134,28 @@ bool ThemeLoader::extractTarGz( const string &tarFile, 
const string &rootDir )
 return true;
 }
 
+static voidpf ZCALLBACK open_vlc( voidpf opaque, const char *filename, int 
mode)
+{
+(void)mode;
+intf_thread_t *pIntf = (intf_thread_t *)opaque;
+
+FILE *stream = vlc_fopen( filename, "rb" );
+if( stream == NULL )
+msg_Dbg( pIntf, "vlc_fopen failed for %s", filename );
+return stream;
+}
 
 bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
 {
 bool b_isWsz = strstr( zipFile.c_str(), ".wsz" );
 
 // Try to open the ZIP file
-unzFile file = unzOpen( zipFile.c_str() );
+zlib_filefunc_def descr;
+fill_fopen_filefunc( &descr );
+descr.zopen_file = open_vlc;
+descr.opaque = getIntf();
+
+unzFile file = unzOpen2( zipFile.c_str(), &descr );
 if( file == 0 )
 {
 msg_Dbg( getIntf(), "failed to open %s as a zip file",

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: remove a leftover call to FromLocale()

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jun 12 11:32:06 
2015 +0200| [58eb9328ed1daa2701c040dc9f076f08dca9b396] | committer: Erwan Tulou

skins2: remove a leftover call to FromLocale()

- on Windows, the ressource paths are already UTF8 encoded. bug fixed
- on Linux, the function is a noop
- on OS2, config_GetDataDir() may need a fix (two paths, the former returns
locale, the latter UTF8)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=58eb9328ed1daa2701c040dc9f076f08dca9b396
---

 modules/gui/skins2/src/theme_repository.cpp |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/modules/gui/skins2/src/theme_repository.cpp 
b/modules/gui/skins2/src/theme_repository.cpp
index 0efb378..1f29f6e 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -135,17 +135,14 @@ ThemeRepository::~ThemeRepository()
 }
 
 
-void ThemeRepository::parseDirectory( const string &rDir_locale )
+void ThemeRepository::parseDirectory( const string &rDir )
 {
 const char *pszDirContent;
 // Path separator
 const string &sep = OSFactory::instance( getIntf() )->getDirSeparator();
 
 // Open the dir
-// FIXME: parseDirectory should be invoked with UTF-8 input instead!!
-string rDir = sFromLocale( rDir_locale );
 DIR *pDir = vlc_opendir( rDir.c_str() );
-
 if( pDir == NULL )
 {
 // An error occurred

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: replace ifstream() with vlc_stat()

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jun 12 21:12:44 
2015 +0200| [51299c84451404d9f564f24d429bbc21ff4a091a] | committer: Erwan Tulou

skins2: replace ifstream() with vlc_stat()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=51299c84451404d9f564f24d429bbc21ff4a091a
---

 modules/gui/skins2/parser/builder.cpp |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/parser/builder.cpp 
b/modules/gui/skins2/parser/builder.cpp
index ece673f..7d8ae77 100644
--- a/modules/gui/skins2/parser/builder.cpp
+++ b/modules/gui/skins2/parser/builder.cpp
@@ -57,8 +57,9 @@
 #include "../utils/var_bool.hpp"
 #include "../utils/var_text.hpp"
 
+#include 
+#include 
 #include 
-#include 
 
 
 Builder::Builder( intf_thread_t *pIntf, const BuilderData &rData,
@@ -1260,8 +1261,9 @@ string Builder::getFilePath( const string &rFileName ) 
const
 
 string full_path = m_path + sep + sFromLocale( file );
 
-// check that the file exists and can be read
-if( ifstream( full_path.c_str() ).fail() )
+// check that the file exists
+struct stat stat;
+if( vlc_stat( full_path.c_str(), &stat ) )
 {
 msg_Err( getIntf(), "missing file: %s", file.c_str() );
 full_path = "";

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix multibyte issue for temporary directory

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jun 12 13:10:01 
2015 +0200| [6de8060b719fad54d86eb9d097dc73d7a6d7f479] | committer: Erwan Tulou

skins2: fix multibyte issue for temporary directory

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6de8060b719fad54d86eb9d097dc73d7a6d7f479
---

 modules/gui/skins2/src/theme_loader.cpp |   36 ---
 modules/gui/skins2/src/theme_loader.hpp |3 +++
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index eee6219..ae983a3 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -288,9 +288,9 @@ bool ThemeLoader::extractFileInZip( unzFile file, const 
string &rootDir,
 bool ThemeLoader::extract( const string &fileName )
 {
 bool result = true;
-char *tmpdir = tempnam( NULL, "vlt" );
-string tempPath = sFromLocale( tmpdir );
-free( tmpdir );
+string tempPath = getTmpDir();
+if( tempPath.empty() )
+return false;
 
 // Extract the file in a temporary directory
 if( ! extractTarGz( fileName, tempPath ) &&
@@ -812,4 +812,34 @@ int gzwrite_frontend( int fd, const void * p_buffer, 
size_t i_length )
 return -1;
 }
 
+// FIXME: could become a skins2 OS factory function or a vlc core function
+string ThemeLoader::getTmpDir( )
+{
+#if defined( _WIN32 )
+wchar_t *tmpdir = _wtempnam( NULL, L"vlt" );
+#else
+char *tmpdir = tempnam( NULL, "vlt" );
+#endif
+if( tmpdir == NULL )
+return "";
+
+#if defined( _WIN32 )
+char* utf8 = FromWide( tmpdir );
+if( utf8 == NULL )
+{
+free( tmpdir );
+return "";
+}
+string tempPath( utf8 );
+free( utf8 );
+#elif defined( __OS2__ )
+string tempPath( sFromLocale( tmpdir ));
+#else
+string tempPath( tmpdir );
+#endif
+
+free( tmpdir );
+return tempPath;
+}
+
 #endif
diff --git a/modules/gui/skins2/src/theme_loader.hpp 
b/modules/gui/skins2/src/theme_loader.hpp
index 99d43ac..9025904 100644
--- a/modules/gui/skins2/src/theme_loader.hpp
+++ b/modules/gui/skins2/src/theme_loader.hpp
@@ -71,6 +71,9 @@ private:
  * Expects a string from the current locale.
  */
 void deleteTempFiles( const string &path );
+
+/// Get a unique temporary directory
+string getTmpDir( );
 #endif
 
 /// Parse the XML file given as a parameter and build the skin

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: replace all stat() with vlc_stat()

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jun 12 11:04:18 
2015 +0200| [49c72956b06beceda573b3f6eb5d57a3b5ddb414] | committer: Erwan Tulou

skins2: replace all stat() with vlc_stat()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=49c72956b06beceda573b3f6eb5d57a3b5ddb414
---

 modules/gui/skins2/parser/xmlparser.cpp |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/parser/xmlparser.cpp 
b/modules/gui/skins2/parser/xmlparser.cpp
index 4c19bed..c99a03b 100644
--- a/modules/gui/skins2/parser/xmlparser.cpp
+++ b/modules/gui/skins2/parser/xmlparser.cpp
@@ -26,6 +26,7 @@
 #include 
 
 #include 
+#include 
 
 XMLParser::XMLParser( intf_thread_t *pIntf, const string &rFileName )
 : SkinObject( pIntf ), m_pXML( NULL ), m_pReader( NULL ), m_pStream( NULL )
@@ -84,7 +85,7 @@ void XMLParser::LoadCatalog()
 for( it = resPath.begin(); it != resPath.end(); ++it )
 {
 string catalog_path = (*it) + sep + "skin.catalog";
-if( !stat( catalog_path.c_str(), &statBuf ) )
+if( !vlc_stat( catalog_path.c_str(), &statBuf ) )
 {
 msg_Dbg( getIntf(), "Using catalog %s", catalog_path.c_str() );
 xml_CatalogLoad( m_pXML, catalog_path.c_str() );
@@ -100,7 +101,7 @@ void XMLParser::LoadCatalog()
 for( it = resPath.begin(); it != resPath.end(); ++it )
 {
 string path = (*it) + sep + "skin.dtd";
-if( !stat( path.c_str(), &statBuf ) )
+if( !vlc_stat( path.c_str(), &statBuf ) )
 {
 // DTD found
 msg_Dbg( getIntf(), "using DTD %s", path.c_str() );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix wrong FromLocale()

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jun 12 12:19:36 
2015 +0200| [ab806efc95b8378fab3b8b7aed78da07957269a1] | committer: Erwan Tulou

skins2: fix wrong FromLocale()

file is already utf8 encoded, since it is a string that comes from
the theme.xml description file, and therefore it is expected to be utf8.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ab806efc95b8378fab3b8b7aed78da07957269a1
---

 modules/gui/skins2/parser/builder.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/skins2/parser/builder.cpp 
b/modules/gui/skins2/parser/builder.cpp
index 7d8ae77..5b7d1a7 100644
--- a/modules/gui/skins2/parser/builder.cpp
+++ b/modules/gui/skins2/parser/builder.cpp
@@ -1259,7 +1259,7 @@ string Builder::getFilePath( const string &rFileName ) 
const
file.replace( pos, 1, sep );
 #endif
 
-string full_path = m_path + sep + sFromLocale( file );
+string full_path = m_path + sep + file;
 
 // check that the file exists
 struct stat stat;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): fix multibyte issue for vlt filename (tar format)

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jun 11 21:43:25 
2015 +0200| [743ca935aa278f33ecb0488bd61f12ab00e3d951] | committer: Erwan Tulou

skins2(Win): fix multibyte issue for vlt filename (tar format)

On Windows, gzopen() doesn't fully support Microsoft wide char either.
So, use vlc_open() + gzdopen().

For OS2 and Linux, no functional change.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=743ca935aa278f33ecb0488bd61f12ab00e3d951
---

 modules/gui/skins2/src/theme_loader.cpp |   24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index 083fa79..de99320 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -516,14 +516,26 @@ int tar_open( TAR **t, char *pathname, int oflags )
 {
 (void)oflags;
 
-gzFile f = gzopen( pathname, "rb" );
+int fd = vlc_open( pathname, O_BINARY | O_RDONLY );
+if( !fd )
+{
+fprintf( stderr, "Couldn't open %s\n", pathname );
+return -1;
+}
+gzFile f = gzdopen( fd, "rb" );
 if( f == NULL )
 {
 fprintf( stderr, "Couldn't gzopen %s\n", pathname );
+close( fd );
 return -1;
 }
 
 *t = (gzFile *)malloc( sizeof(gzFile) );
+if( *t == NULL )
+{
+gzclose( f );
+return -1;
+}
 **t = f;
 return 0;
 }
@@ -750,11 +762,17 @@ int gzopen_frontend( const char *pathname, int oflags, 
int mode )
 errno = EINVAL;
 return -1;
 }
-
-gzf = gzopen( pathname, gzflags );
+int fd = vlc_open( pathname, oflags );
+if( !fd )
+{
+fprintf( stderr, "Couldn't open %s\n", pathname );
+return -1;
+}
+gzf = gzdopen( fd, gzflags );
 if( !gzf )
 {
 errno = ENOMEM;
+close( fd );
 return -1;
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix file descriptor leak and missing error check

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Thu Jun 11 20:09:10 
2015 +0200| [01bf3662b1af1673cc5f6efbb355a698983a7651] | committer: Erwan Tulou

skins2: fix file descriptor leak and missing error check

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=01bf3662b1af1673cc5f6efbb355a698983a7651
---

 modules/gui/skins2/src/theme_loader.cpp |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp 
b/modules/gui/skins2/src/theme_loader.cpp
index 5783cda..1fba110 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -115,6 +115,8 @@ bool ThemeLoader::extractTarGz( const string &tarFile, 
const string &rootDir )
 if( tar_open( &t, (char *)tarFile.c_str(), O_RDONLY ) == -1 )
 #endif
 {
+msg_Dbg( getIntf(), "failed to open %s as a gzip tar file",
+tarFile.c_str() );
 return false;
 }
 
@@ -139,10 +141,18 @@ bool ThemeLoader::extractZip( const string &zipFile, 
const string &rootDir )
 
 // Try to open the ZIP file
 unzFile file = unzOpen( zipFile.c_str() );
+if( file == 0 )
+{
+msg_Dbg( getIntf(), "failed to open %s as a zip file",
+ zipFile.c_str() );
+return false;
+}
 unz_global_info info;
-
 if( unzGetGlobalInfo( file, &info ) != UNZ_OK )
 {
+msg_Dbg( getIntf(), "failed to read zip info from %s",
+ zipFile.c_str() );
+unzClose( file );
 return false;
 }
 // Extract all the files in the archive
@@ -159,7 +169,7 @@ bool ThemeLoader::extractZip( const string &zipFile, const 
string &rootDir )
 if( i < info.number_entry - 1 )
 {
 // Go the next file in the archive
-if( unzGoToNextFile( file ) !=UNZ_OK )
+if( unzGoToNextFile( file ) != UNZ_OK )
 {
 msg_Warn( getIntf(), "error while unzipping %s",
   zipFile.c_str() );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2(Win): fix another multibyte issue

2015-06-12 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Fri Jun 12 10:38:06 
2015 +0200| [9e9fd90d0ccf75eb51ae5a2624f7efc8b317581c] | committer: Erwan Tulou

skins2(Win): fix another multibyte issue

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9e9fd90d0ccf75eb51ae5a2624f7efc8b317581c
---

 modules/gui/skins2/src/theme_repository.cpp |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/src/theme_repository.cpp 
b/modules/gui/skins2/src/theme_repository.cpp
index 094ebcd..0efb378 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -26,8 +26,9 @@
 #include "../commands/async_queue.hpp"
 #include "../commands/cmd_dialogs.hpp"
 #include 
+#include 
 
-#include 
+#include 
 
 
 ThemeRepository *ThemeRepository::instance( intf_thread_t *pIntf )
@@ -88,17 +89,17 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): 
SkinObject( pIntf )
 
 // retrieve last skins stored or skins requested by user
 char* psz_current = var_InheritString( getIntf(), "skins2-last" );
-string current = string( psz_current ? psz_current : "" );
+string current( psz_current ? psz_current : "" );
 free( psz_current );
 
-// check if skins exists and is readable
-bool b_readable = !ifstream( sToLocale(current).c_str() ).fail();
-
+// check if skin exists
+struct stat stat;
+bool b_exists = !vlc_stat( current.c_str(), &stat );
 msg_Dbg( getIntf(), "requested skins %s is %s accessible",
- current.c_str(), b_readable ? "" : "NOT" );
+ current.c_str(), b_exists ? "" : "NOT" );
 
 // set the default skins if given skins not accessible
-if( !b_readable && b_default_found )
+if( !b_exists && b_default_found )
 current = itdefault->second;
 
 // save this valid skins for reuse

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix UTF8 conversion issues

2015-06-10 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Wed Jun 10 
18:18:35 2015 +0200| [53dc47fab75cefd3a936cc9323f06b7b23b8c37c] | committer: 
Erwan Tulou

skins2: fix UTF8 conversion issues

The issue is twofold:
- converting filenames that are already UTF8 encoded from the Qt dialog box
- missing UTF8-to-locale conversion for filename passed as parameter to vlc

These bugs accounted for skins with name or path containing multibyte
characters not being able to load successfully on Windows.

This fixes trac #14843

(cherry picked from commit 3b6b39ac889e7a3242f7ef586c01d6821bd49d24)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=53dc47fab75cefd3a936cc9323f06b7b23b8c37c
---

 modules/gui/skins2/src/dialogs.cpp  |4 ++--
 modules/gui/skins2/src/theme_repository.cpp |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/dialogs.cpp 
b/modules/gui/skins2/src/dialogs.cpp
index 3bda3b9..9a7a55b 100644
--- a/modules/gui/skins2/src/dialogs.cpp
+++ b/modules/gui/skins2/src/dialogs.cpp
@@ -42,7 +42,7 @@ void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
 {
 // Create a change skin command
 CmdChangeSkin *pCmd =
-new CmdChangeSkin( pIntf, sFromLocale( pArg->psz_results[0] ) 
);
+new CmdChangeSkin( pIntf, pArg->psz_results[0] );
 
 // Push the command in the asynchronous command queue
 AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
@@ -66,7 +66,7 @@ void Dialogs::showPlaylistLoadCB( intf_dialog_args_t *pArg )
 {
 // Create a Playlist Load command
 CmdPlaylistLoad *pCmd =
-new CmdPlaylistLoad( pIntf, sFromLocale( pArg->psz_results[0] ) );
+new CmdPlaylistLoad( pIntf, pArg->psz_results[0] );
 
 // Push the command in the asynchronous command queue
 AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
diff --git a/modules/gui/skins2/src/theme_repository.cpp 
b/modules/gui/skins2/src/theme_repository.cpp
index 7df2283..bf19dcf 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -92,7 +92,7 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): 
SkinObject( pIntf )
 free( psz_current );
 
 // check if skins exists and is readable
-bool b_readable = !ifstream( current.c_str() ).fail();
+bool b_readable = !ifstream( sToLocale(current).c_str() ).fail();
 
 msg_Dbg( getIntf(), "requested skins %s is %s accessible",
  current.c_str(), b_readable ? "" : "NOT" );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix UTF8 conversion issues

2015-06-10 Thread Erwan Tulou
vlc | branch: master | Erwan Tulou  | Wed Jun 10 18:18:35 
2015 +0200| [3b6b39ac889e7a3242f7ef586c01d6821bd49d24] | committer: Erwan Tulou

skins2: fix UTF8 conversion issues

The issue is twofold:
- converting filenames that are already UTF8 encoded from the Qt dialog box
- missing UTF8-to-locale conversion for filename passed as parameter to vlc

These bugs accounted for skins with name or path containing multibyte
characters not being able to load successfully on Windows.

This fixes trac #14843

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b6b39ac889e7a3242f7ef586c01d6821bd49d24
---

 modules/gui/skins2/src/dialogs.cpp  |4 ++--
 modules/gui/skins2/src/theme_repository.cpp |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/gui/skins2/src/dialogs.cpp 
b/modules/gui/skins2/src/dialogs.cpp
index 0067b57..8a5c2a0 100644
--- a/modules/gui/skins2/src/dialogs.cpp
+++ b/modules/gui/skins2/src/dialogs.cpp
@@ -42,7 +42,7 @@ void Dialogs::showChangeSkinCB( intf_dialog_args_t *pArg )
 {
 // Create a change skin command
 CmdChangeSkin *pCmd =
-new CmdChangeSkin( pIntf, sFromLocale( pArg->psz_results[0] ) 
);
+new CmdChangeSkin( pIntf, pArg->psz_results[0] );
 
 // Push the command in the asynchronous command queue
 AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
@@ -66,7 +66,7 @@ void Dialogs::showPlaylistLoadCB( intf_dialog_args_t *pArg )
 {
 // Create a Playlist Load command
 CmdPlaylistLoad *pCmd =
-new CmdPlaylistLoad( pIntf, sFromLocale( pArg->psz_results[0] ) );
+new CmdPlaylistLoad( pIntf, pArg->psz_results[0] );
 
 // Push the command in the asynchronous command queue
 AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
diff --git a/modules/gui/skins2/src/theme_repository.cpp 
b/modules/gui/skins2/src/theme_repository.cpp
index dedfd11..094ebcd 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -92,7 +92,7 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): 
SkinObject( pIntf )
 free( psz_current );
 
 // check if skins exists and is readable
-bool b_readable = !ifstream( current.c_str() ).fail();
+bool b_readable = !ifstream( sToLocale(current).c_str() ).fail();
 
 msg_Dbg( getIntf(), "requested skins %s is %s accessible",
  current.c_str(), b_readable ? "" : "NOT" );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: fix a video control that fails to show up

2015-04-28 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Tue Apr 28 
15:32:12 2015 +0200| [88fa0c4b9d5196c53241fa27f2315ae6553d3808] | committer: 
Erwan Tulou

skins2: fix a video control that fails to show up

This fixes a regression in vlc2.2. It is described on the forum at :
https://forum.videolan.org/viewtopic.php?f=15&t=125790&sid=05f4d8a32853034ce6d497ca15bab1e8

(cherry picked from commit 7a00bd9b966fe6eb615d7df1b5ff6afdd92b2d36)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=88fa0c4b9d5196c53241fa27f2315ae6553d3808
---

 modules/gui/skins2/controls/ctrl_video.cpp |   36 +++-
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/modules/gui/skins2/controls/ctrl_video.cpp 
b/modules/gui/skins2/controls/ctrl_video.cpp
index 7c9dcae..c722755 100644
--- a/modules/gui/skins2/controls/ctrl_video.cpp
+++ b/modules/gui/skins2/controls/ctrl_video.cpp
@@ -113,6 +113,7 @@ void CtrlVideo::setLayout( GenericLayout *pLayout,
 {
 CtrlGeneric::setLayout( pLayout, rPosition );
 m_pLayout->getActiveVar().addObserver( this );
+getWindow()->getVisibleVar().addObserver( this );
 
 // register Video Control
 VoutManager::instance( getIntf() )->registerCtrlVideo( this );
@@ -125,6 +126,7 @@ void CtrlVideo::setLayout( GenericLayout *pLayout,
 void CtrlVideo::unsetLayout()
 {
 m_pLayout->getActiveVar().delObserver( this );
+getWindow()->getVisibleVar().delObserver( this );
 CtrlGeneric::unsetLayout();
 }
 
@@ -162,27 +164,28 @@ void CtrlVideo::resizeControl( int width, int height )
 void CtrlVideo::onUpdate( Subject &rVariable, void *arg  )
 {
 (void)arg;
+VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
 
-// Visibility changed
 if( &rVariable == m_pVisible )
 {
-msg_Dbg( getIntf(), "VideoCtrl : Visibility changed (visible=%d)",
-  isVisible() );
+msg_Dbg( getIntf(), "VideoCtrl(%p) : control visibility changed (%i)",
+  this, isVisible() );
 notifyLayout();
 }
-
-// Active Layout changed
-if( &rVariable == &m_pLayout->getActiveVar() )
+else if( &rVariable == &m_pLayout->getActiveVar() )
 {
-msg_Dbg( getIntf(), "VideoCtrl : Active Layout changed (isActive=%d)",
-  m_pLayout->getActiveVar().get() );
+msg_Dbg( getIntf(), "VideoCtrl(%p) : Active Layout changed (%i)",
+  this, m_pLayout->getActiveVar().get() );
 }
-
-VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
-if( &rVariable == &rFullscreen )
+else if( &rVariable == &getWindow()->getVisibleVar() )
+{
+msg_Dbg( getIntf(), "VideoCtrl(%p) : Window visibility changed (%i)",
+  this, getWindow()->getVisibleVar().get() );
+}
+else if( &rVariable == &rFullscreen )
 {
-msg_Dbg( getIntf(), "VideoCtrl : fullscreen toggled (fullscreen = %d)",
-  rFullscreen.get() );
+msg_Dbg( getIntf(), "VideoCtrl(%p) : fullscreen toggled (%i)",
+  this, rFullscreen.get() );
 }
 
 if( isUseable() && !isUsed() )
@@ -232,9 +235,10 @@ bool CtrlVideo::isUseable( ) const
 {
 VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
 
-return isVisible() && // video control is visible
-   m_pLayout->isVisible() &&  // layout is visible
-   !rFullscreen.get();// fullscreen is off
+return isVisible()   // video control is visible
+   && m_pLayout->getActiveVar().get()// layout is active
+   && getWindow()->getVisibleVar().get() // window is visible
+   && !rFullscreen.get();// fullscreen is off
 }
 
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] skins2: remove a fallback when choosing a video control

2015-04-28 Thread Erwan Tulou
vlc/vlc-2.2 | branch: master | Erwan Tulou  | Tue Apr 28 
15:21:24 2015 +0200| [e2c4691e3d75fca23ca8255ad530bf5d26e6371b] | committer: 
Erwan Tulou

skins2: remove a fallback when choosing a video control

This fallback was an attempt to recover when a skin is poorly designed,
but it causes problems under some circumstances. So let's remove it !

(cherry picked from commit 1d2608d4aa0aa9fe30b9fde5a825f14a9941347c)
Signed-off-by: Erwan Tulou 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=e2c4691e3d75fca23ca8255ad530bf5d26e6371b
---

 modules/gui/skins2/src/vout_manager.cpp |9 -
 1 file changed, 9 deletions(-)

diff --git a/modules/gui/skins2/src/vout_manager.cpp 
b/modules/gui/skins2/src/vout_manager.cpp
index f6ea8eb..5c9e67c 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -182,15 +182,6 @@ CtrlVideo* VoutManager::getBestCtrlVideo( )
 }
 }
 
-// as a fallback, look up any video control that is unused
-for( it = m_pCtrlVideoVec.begin(); it != m_pCtrlVideoVec.end(); ++it )
-{
-if( !(*it)->isUsed() )
-{
-return (*it);
-}
-}
-
 return NULL;
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


  1   2   3   >