MainInputManager::getInstance( p_intf );
#ifdef WIN32
- createTaskBarButtons();
+ taskbar_wmsg = RegisterWindowMessage("TaskbarButtonCreated");
#endif
/************************************************************
#ifdef WIN32
void MainInterface::createTaskBarButtons()
{
+ taskbar_wmsg = WM_NULL;
/*Here is the code for the taskbar thumb buttons
FIXME:We need pretty buttons in 16x16 px that are handled correctly by masks in Qt
FIXME:the play button's picture doesn't changed to pause when clicked
{
p_taskbl->vt->HrInit(p_taskbl);
- int msg_value = RegisterWindowMessage("TaskbarButtonCreated");
- //msg_Info( p_intf, "msg value: %04x", msg_value );
-
// Define an array of two buttons. These buttons provide images through an
// image list and also provide tooltips.
DWORD dwMask = THB_BITMAP | THB_FLAGS;
thbButtons[2].iBitmap = 3;
thbButtons[2].dwFlags = THBF_HIDDEN;
- HRESULT hr = p_taskbl->vt->ThumbBarSetImageList(p_taskbl, GetForegroundWindow(), himl );
+ HRESULT hr = p_taskbl->vt->ThumbBarSetImageList(p_taskbl, winId(), himl );
if(S_OK != hr)
msg_Err( p_intf, "ThumbBarSetImageList failed with error %08x", hr );
- if(S_OK != p_taskbl->vt->ThumbBarAddButtons(p_taskbl, GetForegroundWindow(), 3, thbButtons))
- msg_Err( p_intf, "ThumbBarAddButtons failed with error %08x", GetLastError() );
-
+ else
+ {
+ hr = p_taskbl->vt->ThumbBarAddButtons(p_taskbl, winId(), 3, thbButtons);
+ if(S_OK != hr)
+ msg_Err( p_intf, "ThumbBarAddButtons failed with error %08x", hr );
+ }
CONNECT( THEMIM->getIM(), statusChanged( int ), this, changeThumbbarButtons( int ) );
+ CONNECT( this, playPauseSignal(), THEMIM, togglePlayPause() );
+ CONNECT( this, prevSignal(), THEMIM, prev() );
+ CONNECT( this, nextSignal(), THEMIM, next() );
}
}
else
p_taskbl = NULL;
}
}
-#endif
-
-
+bool MainInterface::winEvent ( MSG * msg, long * result )
+{
+ if (msg->message == taskbar_wmsg)
+ {
+ //We received the taskbarbuttoncreated, now we can really create th buttons
+ createTaskBarButtons();
+ }
+ switch( msg->message )
+ {
+ case WM_COMMAND:
+ if (HIWORD(msg->wParam) == THBN_CLICKED)
+ {
+ switch(LOWORD(msg->wParam))
+ {
+ case 0:
+ emit prevSignal();
+ break;
+ case 1:
+ emit playPauseSignal();
+ break;
+ case 2:
+ emit nextSignal();
+ break;
+ }
+ }
+ break;
+ }
+ return false;
+}
+#endif
/**********************************************************************
* Handling of sizing of the components
void MainInterface::changeThumbbarButtons( int i_status)
{
#ifdef WIN32
- // Define an array of two buttons. These buttons provide images through an
+ // Define an array of three buttons. These buttons provide images through an
// image list and also provide tooltips.
DWORD dwMask = THB_BITMAP | THB_FLAGS;
switch( i_status )
{
- case 0:
- case END_S:
- {
- thbButtons[0].dwFlags = THBF_HIDDEN;
- thbButtons[1].dwFlags = THBF_HIDDEN;
- thbButtons[2].dwFlags = THBF_HIDDEN;
- break;
- }
case PLAYING_S:
{
thbButtons[0].dwFlags = THBF_ENABLED;
}
case PAUSE_S:
{
- //thbButtons[0].dwFlags = THBF_ENABLED;
- //thbButtons[1].dwFlags = THBF_ENABLED;
- //thbButtons[2].dwFlags = THBF_ENABLED;
+ thbButtons[0].dwFlags = THBF_ENABLED;
+ thbButtons[1].dwFlags = THBF_ENABLED;
+ thbButtons[2].dwFlags = THBF_ENABLED;
thbButtons[1].iBitmap = 2;
break;
}
+ default:
+ return;
}
-
- HRESULT hr = p_taskbl->vt->ThumbBarUpdateButtons(p_taskbl, GetForegroundWindow(), 3, thbButtons);
+ HRESULT hr = p_taskbl->vt->ThumbBarUpdateButtons(p_taskbl, this->winId(), 3, thbButtons);
if(S_OK != hr)
msg_Err( p_intf, "ThumbBarUpdateButtons failed with error %08x", hr );
#else
Q_OBJECT
public:
-#ifdef WIN32
- QVLCApp( intf_thread_t *p_intf, int & argc, char ** argv ) : QApplication( argc, argv, true )
- {
- connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );
- CONNECT( this, playPauseSignal(), THEMIM, togglePlayPause() );
- CONNECT( this, prevSignal(), THEMIM, prev() );
- CONNECT( this, nextSignal(), THEMIM, next() );
- }
-#else
QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, true )
{
connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );
}
-#endif
static void triggerQuit()
{
DefWindowProc( msg->hwnd, msg->message,
msg->wParam, msg->lParam );
break;
- case 0xC0C2: /* TaskbarButtonCreated */
- break;
- case WM_COMMAND:
- if (HIWORD(msg->wParam) == THBN_CLICKED)
- {
- switch(LOWORD(msg->wParam))
- {
- case 0:
- emit prevSignal();
- break;
- case 1:
- emit playPauseSignal();
- break;
- case 2:
- emit nextSignal();
- break;
- }
- }
- break;
}
return false;
}
signals:
void quitSignal();
- void playPauseSignal();
- void prevSignal();
- void nextSignal();
};