Commit 810182ca authored by Cyril Deguet's avatar Cyril Deguet
Browse files

* implemented double click event for X11 skins. The delay is hard-coded

  (400ms) , maybe it could be stored in the vlc config file
parent 3f0d1dbf
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -105,7 +105,7 @@ int OSAPI_GetTime()
{
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 )
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -98,7 +98,6 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
(LPARAM)(LPTOOLINFO) &ToolTipInfo );
*/
if( DragDrop )
{
// register the listview as a drop target
......@@ -108,6 +107,14 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
// 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()
......@@ -119,10 +126,8 @@ X11Window::~X11Window()
{
DestroyWindow( hWnd );
}*/
if( ToolTipWindow != NULL )
{
XDestroyWindow( display, ToolTipWindow );
}/*
XDestroyWindow( display, ToolTipWindow );
/*
if( DragDrop )
{
// Remove the listview from the list of drop targets
......@@ -159,6 +164,8 @@ bool X11Window::ProcessOSEvent( Event *evt )
unsigned int msg = evt->GetMessage();
unsigned int p1 = evt->GetParam1();
int p2 = evt->GetParam2();
int time;
int posX, posY;
switch( msg )
{
......@@ -194,9 +201,25 @@ bool X11Window::ProcessOSEvent( Event *evt )
{
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:
......@@ -251,12 +274,7 @@ bool X11Window::ProcessOSEvent( Event *evt )
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;
*/
......
......@@ -2,7 +2,7 @@
* x11_window.h: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_window.h,v 1.2 2003/05/13 20:36:29 asmax Exp $
* $Id: x11_window.h,v 1.3 2003/06/07 00:36:28 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -54,8 +54,15 @@ class X11Window : public SkinWindow
Window ToolTipWindow;
// TOOLINFO ToolTipInfo;
// Double-click handling
int ClickedX;
int ClickedY;
int ClickedTime;
int DblClickDelay;
// Left button down
bool LButtonDown;
// Right button down
bool RButtonDown;
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment