diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/include/IEventReceiver.h Irrlicht_starsonata/include/IEventReceiver.h --- irrlicht-svn-ss/trunk/include/IEventReceiver.h 2007-07-26 02:11:22.000000000 +0200 +++ Irrlicht_starsonata/include/IEventReceiver.h 2008-08-16 18:04:29.000000000 +0200 @@ -59,6 +59,12 @@ namespace irr //! in what direction and how fast. EMIE_MOUSE_WHEEL, + // Starsonata, Micha: Only implemented for windows so far + //! double click events (additional to and before the second EMIE_?MOUSE_UP events) + EMIE_LMOUSE_DOUBLE_CLICK, + EMIE_RMOUSE_DOUBLE_CLICK, + EMIE_MMOUSE_DOUBLE_CLICK, + //! No real event. Just for convenience to get number of events EMIE_COUNT }; @@ -168,6 +219,12 @@ struct SEvent /** Only valid if event was EMIE_MOUSE_WHEEL */ f32 Wheel; + //! true if shift was also pressed + bool Shift; + + //! true if ctrl was also pressed + bool Control; + //! type of mouse event EMOUSE_INPUT_EVENT Event; } MouseInput; diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceLinux.cpp Irrlicht_starsonata/source/Irrlicht/CIrrDeviceLinux.cpp --- irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceLinux.cpp 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CIrrDeviceLinux.cpp 2008-03-23 05:18:48.000000000 +0100 @@ -707,6 +721,8 @@ bool CIrrDeviceLinux::run() irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED; irrevent.MouseInput.X = event.xbutton.x; irrevent.MouseInput.Y = event.xbutton.y; + irrevent.MouseInput.Control = (event.xkey.state & ControlMask) != 0; + irrevent.MouseInput.Shift = (event.xkey.state & ShiftMask) != 0; postEventFromUser(irrevent); break; @@ -717,6 +733,8 @@ bool CIrrDeviceLinux::run() irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT; irrevent.MouseInput.X = event.xbutton.x; irrevent.MouseInput.Y = event.xbutton.y; + irrevent.MouseInput.Control = (event.xkey.state & ControlMask) != 0; + irrevent.MouseInput.Shift = (event.xkey.state & ShiftMask) != 0; irrevent.MouseInput.Event = irr::EMIE_COUNT; diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceWin32.cpp Irrlicht_starsonata/source/Irrlicht/CIrrDeviceWin32.cpp --- irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceWin32.cpp 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CIrrDeviceWin32.cpp 2008-06-24 21:30:22.000000000 +0200 @@ -125,6 +126,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT ClientToScreen(hWnd, &p); event.MouseInput.X = LOWORD(lParam) - p.x; event.MouseInput.Y = HIWORD(lParam) - p.y; + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; dev = getDeviceFromHWnd(hWnd); if (dev) @@ -138,6 +141,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT event.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN; event.MouseInput.X = (short)LOWORD(lParam); event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + dev = getDeviceFromHWnd(hWnd); if (dev) dev->postEventFromUser(event); @@ -154,9 +160,93 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT event.MouseInput.Event = irr::EMIE_LMOUSE_LEFT_UP; event.MouseInput.X = (short)LOWORD(lParam); event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_LBUTTONDBLCLK: + // send the usual click first + ClickCount++; + SetCapture(hWnd); + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + + // send additionally the double click + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_LMOUSE_DOUBLE_CLICK; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_RBUTTONDBLCLK: + // send the usual click first + ClickCount++; + SetCapture(hWnd); + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_RMOUSE_PRESSED_DOWN; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + + // send additionally the double click + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_RMOUSE_DOUBLE_CLICK; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_MBUTTONDBLCLK: + // send the usual click first + ClickCount++; + SetCapture(hWnd); + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_MMOUSE_PRESSED_DOWN; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + dev = getDeviceFromHWnd(hWnd); if (dev) dev->postEventFromUser(event); + + // send additionally the double click + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_MMOUSE_DOUBLE_CLICK; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + + if (dev) + dev->postEventFromUser(event); return 0; case WM_RBUTTONDOWN: @@ -166,6 +256,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT event.MouseInput.Event = irr::EMIE_RMOUSE_PRESSED_DOWN; event.MouseInput.X = (short)LOWORD(lParam); event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + dev = getDeviceFromHWnd(hWnd); if (dev) dev->postEventFromUser(event); @@ -182,6 +275,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT event.MouseInput.Event = irr::EMIE_RMOUSE_LEFT_UP; event.MouseInput.X = (short)LOWORD(lParam); event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + dev = getDeviceFromHWnd(hWnd); if (dev) dev->postEventFromUser(event); @@ -194,6 +290,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT event.MouseInput.Event = irr::EMIE_MMOUSE_PRESSED_DOWN; event.MouseInput.X = (short)LOWORD(lParam); event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + dev = getDeviceFromHWnd(hWnd); if (dev) dev->postEventFromUser(event); @@ -210,6 +309,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT event.MouseInput.Event = irr::EMIE_MMOUSE_LEFT_UP; event.MouseInput.X = (short)LOWORD(lParam); event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + dev = getDeviceFromHWnd(hWnd); if (dev) dev->postEventFromUser(event); @@ -220,6 +322,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT event.MouseInput.Event = irr::EMIE_MOUSE_MOVED; event.MouseInput.X = (short)LOWORD(lParam); event.MouseInput.Y = (short)HIWORD(lParam); + event.MouseInput.Shift = LOWORD(wParam) & MK_SHIFT; + event.MouseInput.Control = LOWORD(wParam) & MK_CONTROL; + dev = getDeviceFromHWnd(hWnd); if (dev) dev->postEventFromUser(event); @@ -328,7 +433,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(video:: // Register Class WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); - wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0;