Commit 268c70ea authored by Cyril Deguet's avatar Cyril Deguet

* now selection method in the playlist depends on the state of the

  CTRL button (as expected in a normal playlist !)
  TODO: - do the same under windows
        - replace all button constants 1/2 by MOUSE_LEFT/MOUSE_RIGHT
parent 66181839
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.cpp: Playlist control * playlist.cpp: Playlist control
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: playlist.cpp,v 1.13 2003/06/09 12:33:16 asmax Exp $ * $Id: playlist.cpp,v 1.14 2003/06/09 14:04:20 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -433,8 +433,19 @@ bool ControlPlayList::MouseDown( int x, int y, int button ) ...@@ -433,8 +433,19 @@ bool ControlPlayList::MouseDown( int x, int y, int button )
{ {
for( j = 0; j < NumOfItems; j++ ) for( j = 0; j < NumOfItems; j++ )
{ {
if( j == i + StartIndex ) if( button & KEY_CTRL )
Select[j] = !Select[j]; {
// CTRL is pressed
if( j == i + StartIndex )
{
Select[j] = !Select[j];
}
}
else
{
// CTRL is not pressed
Select[j] = ( j == i + StartIndex );
}
} }
RefreshAll(); RefreshAll();
return true; return true;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description * skin_common.h: Private Skin interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_common.h,v 1.16 2003/06/09 12:33:16 asmax Exp $ * $Id: skin_common.h,v 1.17 2003/06/09 14:04:20 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -39,6 +39,12 @@ class wxIcon; ...@@ -39,6 +39,12 @@ class wxIcon;
#include <X11/Xlib.h> #include <X11/Xlib.h>
#endif #endif
// For mouse events FIXME: should be elsewhere?
#define MOUSE_LEFT (1<<0)
#define MOUSE_RIGHT (1<<1)
#define KEY_CTRL (1<<2)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// intf_sys_t: description and status of skin interface // intf_sys_t: description and status of skin interface
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window.cpp: Window class * window.cpp: Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: window.cpp,v 1.27 2003/06/09 12:33:16 asmax Exp $ * $Id: window.cpp,v 1.28 2003/06/09 14:04:20 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -425,7 +425,7 @@ void SkinWindow::MouseUp( int x, int y, int button ) ...@@ -425,7 +425,7 @@ void SkinWindow::MouseUp( int x, int y, int button )
} }
#ifndef BASIC_SKINS #ifndef BASIC_SKINS
if( i < 0 && button == 2 ) if( i < 0 && button == MOUSE_RIGHT )
{ {
p_intf->p_sys->p_dialogs->ShowPopup(); p_intf->p_sys->p_dialogs->ShowPopup();
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_window.cpp: X11 implementation of the Window class * x11_window.cpp: X11 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_window.cpp,v 1.19 2003/06/09 12:33:17 asmax Exp $ * $Id: x11_window.cpp,v 1.20 2003/06/09 14:04:20 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -226,6 +226,8 @@ bool X11Window::ProcessOSEvent( Event *evt ) ...@@ -226,6 +226,8 @@ bool X11Window::ProcessOSEvent( Event *evt )
int p2 = evt->GetParam2(); int p2 = evt->GetParam2();
int time; int time;
int posX, posY; int posX, posY;
string type;
int button;
switch( msg ) switch( msg )
{ {
...@@ -256,11 +258,19 @@ bool X11Window::ProcessOSEvent( Event *evt ) ...@@ -256,11 +258,19 @@ bool X11Window::ProcessOSEvent( Event *evt )
XRaiseWindow( display, ( (X11Window *)(*win) )->GetHandle() ); XRaiseWindow( display, ( (X11Window *)(*win) )->GetHandle() );
XUNLOCK; XUNLOCK;
} }
button = 0;
if( ((XButtonEvent *)p2 )->state & ControlMask )
{
// Control key pressed
button |= KEY_CTRL;
}
switch( ( (XButtonEvent *)p2 )->button ) switch( ( (XButtonEvent *)p2 )->button )
{ {
case 1: case 1:
// Left button // Left button
button |= MOUSE_LEFT;
time = OSAPI_GetTime(); time = OSAPI_GetTime();
OSAPI_GetMousePos( posX, posY ); OSAPI_GetMousePos( posX, posY );
if( time - ClickedTime < DblClickDelay && if( time - ClickedTime < DblClickDelay &&
...@@ -269,7 +279,7 @@ bool X11Window::ProcessOSEvent( Event *evt ) ...@@ -269,7 +279,7 @@ bool X11Window::ProcessOSEvent( Event *evt )
// Double-click // Double-click
ClickedTime = 0; ClickedTime = 0;
MouseDblClick( (int)( (XButtonEvent *)p2 )->x, MouseDblClick( (int)( (XButtonEvent *)p2 )->x,
(int)( (XButtonEvent *)p2 )->y, 1 ); (int)( (XButtonEvent *)p2 )->y, button );
} }
else else
{ {
...@@ -278,15 +288,16 @@ bool X11Window::ProcessOSEvent( Event *evt ) ...@@ -278,15 +288,16 @@ bool X11Window::ProcessOSEvent( Event *evt )
ClickedY = posY; ClickedY = posY;
LButtonDown = true; LButtonDown = true;
MouseDown( (int)( (XButtonEvent *)p2 )->x, MouseDown( (int)( (XButtonEvent *)p2 )->x,
(int)( (XButtonEvent *)p2 )->y, 1 ); (int)( (XButtonEvent *)p2 )->y, button );
} }
break; break;
case 3: case 3:
// Right button // Right button
button |= MOUSE_RIGHT;
RButtonDown = true; RButtonDown = true;
MouseDown( (int)( (XButtonEvent *)p2 )->x, MouseDown( (int)( (XButtonEvent *)p2 )->x,
(int)( (XButtonEvent *)p2 )->y, 2 ); (int)( (XButtonEvent *)p2 )->y, button );
break; break;
default: default:
...@@ -295,20 +306,28 @@ bool X11Window::ProcessOSEvent( Event *evt ) ...@@ -295,20 +306,28 @@ bool X11Window::ProcessOSEvent( Event *evt )
return true; return true;
case ButtonRelease: case ButtonRelease:
button = 0;
if( ((XButtonEvent *)p2 )->state & ControlMask )
{
// Control key pressed
button |= KEY_CTRL;
}
switch( ( (XButtonEvent *)p2 )->button ) switch( ( (XButtonEvent *)p2 )->button )
{ {
case 1: case 1:
// Left button // Left button
button |= MOUSE_LEFT;
LButtonDown = false; LButtonDown = false;
MouseUp( (int)( (XButtonEvent *)p2 )->x, MouseUp( (int)( (XButtonEvent *)p2 )->x,
(int)( (XButtonEvent *)p2 )->y, 1 ); (int)( (XButtonEvent *)p2 )->y, button );
break; break;
case 3: case 3:
button |= MOUSE_RIGHT;
// Right button // Right button
RButtonDown = false; RButtonDown = false;
MouseUp( (int)( (XButtonEvent *)p2 )->x, MouseUp( (int)( (XButtonEvent *)p2 )->x,
(int)( (XButtonEvent *)p2 )->y, 2 ); (int)( (XButtonEvent *)p2 )->y, button );
break; break;
case 4: case 4:
...@@ -335,10 +354,9 @@ bool X11Window::ProcessOSEvent( Event *evt ) ...@@ -335,10 +354,9 @@ bool X11Window::ProcessOSEvent( Event *evt )
return true; return true;
case ClientMessage: case ClientMessage:
{
XLOCK; XLOCK;
string type = XGetAtomName( display, ( (XClientMessageEvent*) type = XGetAtomName( display, ( (XClientMessageEvent*)
p2 )->message_type ); p2 )->message_type );
XUNLOCK; XUNLOCK;
if( type == "XdndEnter" ) if( type == "XdndEnter" )
{ {
...@@ -360,7 +378,6 @@ bool X11Window::ProcessOSEvent( Event *evt ) ...@@ -360,7 +378,6 @@ bool X11Window::ProcessOSEvent( Event *evt )
DropObject->DndDrop( ((XClientMessageEvent*)p2)->data.l ); DropObject->DndDrop( ((XClientMessageEvent*)p2)->data.l );
return true; return true;
} }
}
return false; return false;
default: default:
......
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