bug 505391 - Implement support for touch sensitive click wheel on HTC phones r=dougt

This commit is contained in:
Alexandru Cristei 2009-08-26 12:07:15 -04:00
parent 067a9a9574
commit f6e6ec1737
2 changed files with 46 additions and 10 deletions

View File

@ -375,6 +375,18 @@ PRLogModuleInfo* gWindowsLog = nsnull;
static KeyboardLayout gKbdLayout;
#endif
#ifdef WINCE_WINDOWS_MOBILE
// HTC Navigation Wheel Event
// This is the defined value for Gesture Mode
const int WM_HTCNAV = 0x0400 + 200;
typedef int (__stdcall * HTCApiNavOpen)(HANDLE, int);
typedef int (__stdcall * HTCApiNavSetMode)(HANDLE, unsigned int);
HTCApiNavOpen gHTCApiNavOpen = nsnull;
HTCApiNavSetMode gHTCApiNavSetMode = nsnull;
#endif
// The last user input event time in microseconds. If
// there are any pending native toolkit input events
// it returns the current time. The value is compatible
@ -3556,9 +3568,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
PRBool result = PR_FALSE; // call the default nsWindow proc
*aRetValue = 0;
#if !defined (WINCE_WINDOWS_MOBILE)
static PRBool getWheelInfo = PR_TRUE;
#endif
#if defined(EVENT_DEBUG_OUTPUT)
// First param shows all events, second param indicates whether
@ -4048,8 +4058,25 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
MakeFullScreen(TRUE);
}
}
#ifdef WINCE_WINDOWS_MOBILE
if (gHTCApiNavOpen == nsnull) {
HINSTANCE library;
library = LoadLibrary(L"HTCAPI.dll");
gHTCApiNavOpen = (HTCApiNavOpen) GetProcAddress(library, "HTCNavOpen");
gHTCApiNavSetMode = (HTCApiNavSetMode) GetProcAddress(library ,"HTCNavSetMode");
}
if (gHTCApiNavOpen != NULL)
gHTCApiNavOpen(mWnd, 1 /* undocumented value */);
if (gHTCApiNavSetMode != NULL)
gHTCApiNavSetMode ( mWnd, 4);
// 4 is Gesture Mode. This will generate WM_HTCNAV events to the window
#endif
break;
#ifndef WINCE
case WM_MOUSEACTIVATE:
if (mWindowType == eWindowType_popup) {
@ -4180,7 +4207,6 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
break;
#endif
#if !defined (WINCE_WINDOWS_MOBILE)
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
{
@ -4194,7 +4220,6 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
return result;
}
break;
#endif
#ifndef WINCE
case WM_DWMCOMPOSITIONCHANGED:
@ -4333,6 +4358,22 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
break;
#endif
#ifdef WINCE_WINDOWS_MOBILE
//HTC NAVIGATION WHEEL EVENT
case WM_HTCNAV:
{
int distance = wParam & 0x000000FF;
if ( (wParam & 0x000000100) != 0) // Counter Clockwise
distance *= -1;
if (OnMouseWheel(WM_MOUSEWHEEL, MAKEWPARAM(0, distance),
MAKELPARAM(GetSystemMetrics(SM_CXSCREEN) / 2,
GetSystemMetrics(SM_CYSCREEN) / 2),
getWheelInfo, result, aRetValue))
return result;
}
break;
#endif
default:
{
#ifdef NS_ENABLE_TSF
@ -4875,7 +4916,6 @@ PRBool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam)
* within the message case block. If returning true result should be returned
* immediately (no more processing).
*/
#if !defined (WINCE_WINDOWS_MOBILE)
PRBool nsWindow::OnMouseWheel(UINT msg, WPARAM wParam, LPARAM lParam, PRBool& getWheelInfo, PRBool& result, LRESULT *aRetValue)
{
// Handle both flavors of mouse wheel events.
@ -5130,8 +5170,6 @@ int nsWindow::ComputeMouseWheelDelta(int currentVDelta,
(double) scrollAccelerationFactor / 10);
}
#endif // !defined(WINCE_WINDOWS_MOBILE)
static PRBool
StringCaseInsensitiveEquals(const PRUnichar* aChars1, const PRUint32 aNumChars1,
const PRUnichar* aChars2, const PRUint32 aNumChars2)

View File

@ -315,7 +315,6 @@ protected:
#if defined(CAIRO_HAS_DDRAW_SURFACE)
PRBool OnPaintImageDDraw16();
#endif // defined(CAIRO_HAS_DDRAW_SURFACE)
#if !defined(WINCE_WINDOWS_MOBILE)
PRBool OnMouseWheel(UINT msg, WPARAM wParam, LPARAM lParam,
PRBool& result, PRBool& getWheelInfo,
LRESULT *aRetValue);
@ -324,7 +323,6 @@ protected:
int ComputeMouseWheelDelta(int currentVDelta,
int iDeltaPerLine,
ULONG ulScrollLines);
#endif // !defined(WINCE_WINDOWS_MOBILE)
#if !defined(WINCE)
void OnWindowPosChanging(LPWINDOWPOS& info);
#endif // !defined(WINCE)