* text.cpp: Text control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: text.cpp,v 1.10 2003/06/05 22:16:15 asmax Exp $
+ * $Id: text.cpp,v 1.11 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
//-----------------------------------------------------------------------
// X11 methods
//-----------------------------------------------------------------------
- void ScrollingTextTimer( void *data )
+ bool ScrollingTextTimer( void *data )
{
if( (ControlText *)data != NULL
&& !( (ControlText *)data )->GetSelected() )
{
( (ControlText *)data )->DoScroll();
}
+ return True;
}
//-----------------------------------------------------------------------
* x11_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_run.cpp,v 1.16 2003/06/06 19:40:37 asmax Exp $
+ * $Id: x11_run.cpp,v 1.17 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
}
-void RefreshCallback( void *data )
+bool RefreshCallback( void *data )
{
SkinManage( (intf_thread_t*)data );
+ return True;
}
* x11_timer.cpp: helper class to implement timers
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_timer.cpp,v 1.1 2003/06/05 22:16:15 asmax Exp $
+ * $Id: x11_timer.cpp,v 1.2 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
}
-void X11Timer::Execute()
+bool X11Timer::Execute()
{
- (*_callback)( _data );
+ return (*_callback)( _data );
}
//---------------------------------------------------------------------------
void *X11TimerManager::Thread( void *p_timer )
{
vlc_thread_ready( (vlc_object_t*) p_timer );
+
while( !((timer_thread_t*)p_timer)->die )
{
list<X11Timer*>::iterator timer;
for( timer = _instance->_timers.begin();
timer != _instance->_timers.end(); timer++ )
{
- (*timer)->Execute();
+ bool ret = (*timer)->Execute();
+ if( !ret )
+ { _instance->_timers.remove( *timer );
+ break;
+ }
}
msleep( 100000 );
}
-
}
#endif
* x11_timer.h: helper class to implement timers
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_timer.h,v 1.1 2003/06/05 22:16:15 asmax Exp $
+ * $Id: x11_timer.h,v 1.2 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
class X11Timer; // forward declaration
-typedef void(*callback_t)( void* );
+typedef bool(*callback_t)( void* );
//---------------------------------------------------------------------------
class X11Timer
~X11Timer();
mtime_t getNextDate( mtime_t current );
- void Execute();
+ bool Execute();
};
//---------------------------------------------------------------------------
class X11TimerManager
void Destroy();
void addTimer( X11Timer *timer ) { _timers.push_back( timer ); }
+ void removeTimer( X11Timer *timer ) { _timers.remove( timer ); }
};
//---------------------------------------------------------------------------
* x11_window.cpp: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_window.cpp,v 1.11 2003/06/07 00:36:28 asmax Exp $
+ * $Id: x11_window.cpp,v 1.12 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
#include "../src/skin_common.h"
#include "../src/theme.h"
#include "../os_theme.h"
+#include "x11_timer.h"
+
+
+bool ToolTipCallback( void *data );
//---------------------------------------------------------------------------
CursorPos = new POINT;
WindowPos = new POINT;
- // Create Tool Tip Window
- ToolTipWindow = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hWnd, 0, GetModuleHandle( NULL ), 0);
-
- // Create Tool Tip infos
- ToolTipInfo.cbSize = sizeof(TOOLINFO);
- ToolTipInfo.uFlags = TTF_SUBCLASS|TTF_IDISHWND;
- ToolTipInfo.hwnd = hWnd;
- ToolTipInfo.hinst = GetModuleHandle( NULL );
- ToolTipInfo.uId = (unsigned int)hWnd;
- ToolTipInfo.lpszText = NULL;
- ToolTipInfo.rect.left = ToolTipInfo.rect.top = 0;
- ToolTipInfo.rect.right = ToolTipInfo.rect.bottom = 0;
-
- SendMessage( ToolTipWindow, TTM_ADDTOOL, 0,
- (LPARAM)(LPTOOLINFO) &ToolTipInfo );
*/
if( DragDrop )
// Create Tool Tip window
ToolTipWindow = XCreateSimpleWindow( display, wnd, 0, 0, 1, 1, 0, 0, 0 );
+ X11Timer *timer = new X11Timer( p_intf, 100, ToolTipCallback, &ToolTipInfo );
+ ToolTipInfo.p_intf = p_intf;
+ ToolTipInfo.timer = timer;
// Double-click handling
ClickedX = 0;
XResizeWindow( display, Wnd, width, height );
}
//---------------------------------------------------------------------------
+
+
+bool ToolTipCallback( void *data )
+{
+ fprintf(stderr," TOOLTIP: %s\n", ((tooltip_t*)data)->text.c_str());
+ return False;
+}
+
+
void X11Window::ChangeToolTipText( string text )
{
if( text == "none" )
if( text != ToolTipText )
{
ToolTipText = text;
+ ToolTipInfo.text = text;
+ X11TimerManager *timerManager = X11TimerManager::Instance( p_intf );
+ timerManager->addTimer( ToolTipInfo.timer );
// ToolTipInfo.lpszText = (char *)ToolTipText.c_str();
- /* SendMessage( ToolTipWindow, TTM_ACTIVATE, 1 , 0 );
- SendMessage( ToolTipWindow, TTM_UPDATETIPTEXT, 0,
- (LPARAM)(LPTOOLINFO)&ToolTipInfo );*/
}
}
}
* x11_window.h: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_window.h,v 1.3 2003/06/07 00:36:28 asmax Exp $
+ * $Id: x11_window.h,v 1.4 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
//--- X11 -------------------------------------------------------------------
#include <X11/Xlib.h>
+#include "x11_timer.h"
+
//---------------------------------------------------------------------------
class Graphics;
class Event;
+
+typedef struct
+{
+ intf_thread_t *p_intf;
+ X11Timer *timer;
+ string text;
+} tooltip_t;
+
+
//---------------------------------------------------------------------------
class X11Window : public SkinWindow
{
// Tooltip texts
Window ToolTipWindow;
-// TOOLINFO ToolTipInfo;
+ tooltip_t ToolTipInfo;
// Double-click handling
int ClickedX;