* x11_api.cpp: Various x11-specific functions
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_api.cpp,v 1.7 2003/06/04 18:47:57 asmax Exp $
+ * $Id: x11_api.cpp,v 1.8 2003/06/07 00:36:28 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
{
struct timeval time;
gettimeofday( &time, NULL );
- return( time.tv_sec * 1000 + time.tv_usec / 1000 );
+ return( (time.tv_sec&0xffffff) * 1000 + time.tv_usec / 1000 );
}
//---------------------------------------------------------------------------
void OSAPI_GetScreenSize( int &w, int &h )
* x11_window.cpp: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_window.cpp,v 1.10 2003/06/06 23:34:35 asmax Exp $
+ * $Id: x11_window.cpp,v 1.11 2003/06/07 00:36:28 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
(LPARAM)(LPTOOLINFO) &ToolTipInfo );
*/
-
if( DragDrop )
{
// register the listview as a drop target
// Create Tool Tip window
ToolTipWindow = XCreateSimpleWindow( display, wnd, 0, 0, 1, 1, 0, 0, 0 );
+
+ // Double-click handling
+ ClickedX = 0;
+ ClickedY = 0;
+ ClickedTime = 0;
+ // TODO: can be retrieved somewhere ?
+ DblClickDelay = 400;
+
}
//---------------------------------------------------------------------------
X11Window::~X11Window()
{
DestroyWindow( hWnd );
}*/
- if( ToolTipWindow != NULL )
- {
- XDestroyWindow( display, ToolTipWindow );
- }/*
+ XDestroyWindow( display, ToolTipWindow );
+ /*
if( DragDrop )
{
// Remove the listview from the list of drop targets
unsigned int msg = evt->GetMessage();
unsigned int p1 = evt->GetParam1();
int p2 = evt->GetParam2();
+ int time;
+ int posX, posY;
switch( msg )
{
{
case 1:
// Left button
- LButtonDown = true;
- MouseDown( (int)( (XButtonEvent *)p2 )->x,
- (int)( (XButtonEvent *)p2 )->y, 1 );
+ time = OSAPI_GetTime();
+ OSAPI_GetMousePos( posX, posY );
+ if( time - ClickedTime < DblClickDelay &&
+ posX == ClickedX && posY == ClickedY )
+ {
+ // Double-click
+ ClickedTime = 0;
+ MouseDblClick( (int)( (XButtonEvent *)p2 )->x,
+ (int)( (XButtonEvent *)p2 )->y, 1 );
+ }
+ else
+ {
+ ClickedTime = time;
+ ClickedX = posX;
+ ClickedY = posY;
+ LButtonDown = true;
+ MouseDown( (int)( (XButtonEvent *)p2 )->x,
+ (int)( (XButtonEvent *)p2 )->y, 1 );
+ }
break;
case 3:
OSAPI_PostMessage( this, WINDOW_LEAVE, 0, 0 );
return true;
-/* case GDK_2BUTTON_PRESS:
- MouseDblClick( (int)( (GdkEventButton *)p2 )->x,
- (int)( (GdkEventButton *)p2 )->y, 1 );
- return true;
-
- case GDK_DROP_START:
+/* case GDK_DROP_START:
DropObject->HandleDropStart( ( (GdkEventDND *)p2 )->context );
return true;
*/