Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
660cc33f
Commit
660cc33f
authored
May 13, 2006
by
Olivier Teulière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* skins2: new skins2-systray option on Windows to activate an icon in the system tray
parent
0603924b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
7 deletions
+53
-7
modules/gui/skins2/src/skin_main.cpp
modules/gui/skins2/src/skin_main.cpp
+6
-4
modules/gui/skins2/win32/win32_factory.cpp
modules/gui/skins2/win32/win32_factory.cpp
+44
-3
modules/gui/skins2/win32/win32_factory.hpp
modules/gui/skins2/win32/win32_factory.hpp
+3
-0
No files found.
modules/gui/skins2/src/skin_main.cpp
View file @
660cc33f
...
...
@@ -343,10 +343,10 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
#define SKINS2_LAST N_("Skin to use")
#define SKINS2_LAST_LONG N_("Path to the skin to use.")
#define SKINS2_CONFIG N_("Config of last used skin")
/// \bug [String] missing "skin". Remove "by the skins module". Add "do not touch"
#define SKINS2_CONFIG_LONG N_("Windows configuration of the last used. " \
"This option is updated automatically by the skins module."
)
#define SKINS2_CONFIG_LONG N_("Windows configuration of the last skin used. " \
"This option is updated automatically, do not touch it." )
#define SKINS2_SYSTRAY N_("Systray icon"
)
#define SKINS2_SYSTRAY_LONG N_("Show a systray icon for VLC")
#define SKINS2_TRANSPARENCY N_("Enable transparency effects")
#define SKINS2_TRANSPARENCY_LONG N_("You can disable all transparency effects"\
" if you want. This is mainly useful when moving windows does not behave" \
...
...
@@ -362,6 +362,8 @@ vlc_module_begin();
VLC_TRUE
);
change_autosave
();
#ifdef WIN32
add_bool
(
"skins2-systray"
,
VLC_FALSE
,
NULL
,
SKINS2_SYSTRAY
,
SKINS2_SYSTRAY_LONG
,
VLC_FALSE
);
add_bool
(
"skins2-transparency"
,
VLC_FALSE
,
NULL
,
SKINS2_TRANSPARENCY
,
SKINS2_TRANSPARENCY_LONG
,
VLC_FALSE
);
#endif
...
...
modules/gui/skins2/win32/win32_factory.cpp
View file @
660cc33f
...
...
@@ -32,6 +32,11 @@
#include "win32_popup.hpp"
#include "win32_loop.hpp"
#include "../src/theme.hpp"
#include "../src/window_manager.hpp"
#include "commands/cmd_dialogs.hpp"
// Custom message for the notifications of the system tray
#define MY_WSTRAYACTION (WM_APP + 1)
LRESULT
CALLBACK
Win32Proc
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
...
...
@@ -73,6 +78,23 @@ LRESULT CALLBACK Win32Proc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
// ( (Event *)wParam )->SendEvent();
// return 0;
}
// Handle systray notifications
else
if
(
uMsg
==
MY_WSTRAYACTION
)
{
if
(
(
UINT
)
lParam
==
WM_LBUTTONDOWN
)
{
p_intf
->
p_sys
->
p_theme
->
getWindowManager
().
raiseAll
();
}
else
if
(
(
UINT
)
lParam
==
WM_RBUTTONDOWN
)
{
CmdDlgShowPopupMenu
aCmdPopup
(
p_intf
);
aCmdPopup
.
execute
();
}
else
if
(
(
UINT
)
lParam
==
WM_LBUTTONDBLCLK
)
{
ShowWindow
(
hwnd
,
SW_RESTORE
);
}
}
}
// If hwnd does not match any window or message not processed
...
...
@@ -135,14 +157,30 @@ bool Win32Factory::init()
return
false
;
}
// Store with it a pointer to the interface thread
SetWindowLongPtr
(
m_hParentWindow
,
GWLP_USERDATA
,
(
LONG_PTR
)
getIntf
()
);
// Initialize the systray icon
m_trayIcon
.
cbSize
=
sizeof
(
NOTIFYICONDATA
);
m_trayIcon
.
hWnd
=
m_hParentWindow
;
m_trayIcon
.
uID
=
42
;
m_trayIcon
.
uFlags
=
NIF_ICON
|
NIF_TIP
|
NIF_MESSAGE
;
m_trayIcon
.
uCallbackMessage
=
MY_WSTRAYACTION
;
m_trayIcon
.
hIcon
=
LoadIcon
(
m_hInst
,
_T
(
"VLC_ICON"
)
);
strcpy
(
m_trayIcon
.
szTip
,
"VLC media player"
);
// Show the systray icon if needed
if
(
config_GetInt
(
getIntf
(),
"skins2-systray"
)
)
{
Shell_NotifyIcon
(
NIM_ADD
,
&
m_trayIcon
);
}
// We do it this way otherwise CreateWindowEx will fail
// if WS_EX_LAYERED is not supported
SetWindowLongPtr
(
m_hParentWindow
,
GWL_EXSTYLE
,
GetWindowLong
(
m_hParentWindow
,
GWL_EXSTYLE
)
|
WS_EX_LAYERED
);
// Store with it a pointer to the interface thread
SetWindowLongPtr
(
m_hParentWindow
,
GWLP_USERDATA
,
(
LONG_PTR
)
getIntf
()
);
ShowWindow
(
m_hParentWindow
,
SW_SHOW
);
// Initialize the OLE library (for drag & drop)
...
...
@@ -203,6 +241,9 @@ Win32Factory::~Win32Factory()
// Uninitialize the OLE library
OleUninitialize
();
// Remove the systray icon
Shell_NotifyIcon
(
NIM_DELETE
,
&
m_trayIcon
);
if
(
m_hParentWindow
)
DestroyWindow
(
m_hParentWindow
);
// Unload msimg32.dll and user32.dll
...
...
@@ -264,7 +305,7 @@ OSPopup *Win32Factory::createOSPopup()
// In fact, the clean way would be to have in Builder::addPopup() a call
// to pPopup->associateToWindow() (to be written)... but the problem is
// that there is no way to access the OS-dependent window handle from a
// GenericWindow (we cannot e
ev
n access the OSWindow).
// GenericWindow (we cannot e
ve
n access the OSWindow).
if
(
m_windowMap
.
begin
()
==
m_windowMap
.
end
()
)
{
msg_Err
(
getIntf
(),
"no window has been created before the popup!"
);
...
...
modules/gui/skins2/win32/win32_factory.hpp
View file @
660cc33f
...
...
@@ -30,6 +30,7 @@
#endif
#include <windows.h>
#include <shellapi.h>
#include "../src/os_factory.hpp"
#include <map>
...
...
@@ -113,6 +114,8 @@ class Win32Factory: public OSFactory
HINSTANCE
m_hInst
;
/// Handle of the parent window
HWND
m_hParentWindow
;
/// Structure for the system tray
NOTIFYICONDATA
m_trayIcon
;
/// Handle on msimg32.dll (for TransparentBlt)
HINSTANCE
m_hMsimg32
;
/// Handle on user32.dll (for SetLayeredWindowAttributes)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment