зеркало из https://github.com/mozilla/pjs.git
Bug 50597 - mousewheel nonfunctional if set to full-page scroll. r=mjudge,jkobal,ben. a=ben.
This commit is contained in:
Родитель
9158e10fc8
Коммит
c69f97571b
|
@ -19,7 +19,6 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#define FORCE_PR_LOG
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
|
@ -67,7 +66,6 @@
|
|||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "prlog.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
#include "nsITreeFrame.h"
|
||||
|
@ -81,8 +79,6 @@ nsIContent * gLastFocusedContent = 0; // Strong reference
|
|||
nsIDocument * gLastFocusedDocument = 0; // Strong reference
|
||||
nsIPresContext* gLastFocusedPresContext = 0; // Weak reference
|
||||
|
||||
PRLogModuleInfo *MOUSEWHEEL;
|
||||
|
||||
PRUint32 nsEventStateManager::mInstanceCount = 0;
|
||||
|
||||
enum {
|
||||
|
@ -130,8 +126,6 @@ nsEventStateManager::nsEventStateManager()
|
|||
NS_INIT_REFCNT();
|
||||
|
||||
++mInstanceCount;
|
||||
if (!MOUSEWHEEL)
|
||||
MOUSEWHEEL = PR_NewLogModule("MOUSEWHEEL");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -960,40 +954,56 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
nsMouseScrollEvent *msEvent = (nsMouseScrollEvent*) aEvent;
|
||||
PRInt32 action = 0;
|
||||
PRInt32 numLines = 0;
|
||||
PRBool aBool;
|
||||
|
||||
PRBool aBool;
|
||||
|
||||
if (msEvent->isShift) {
|
||||
mPrefService->GetIntPref("mousewheel.withshiftkey.action", &action);
|
||||
mPrefService->GetBoolPref("mousewheel.withshiftkey.sysnumlines", &aBool);
|
||||
if (aBool)
|
||||
numLines = msEvent->deltaLines;
|
||||
mPrefService->GetBoolPref("mousewheel.withshiftkey.sysnumlines",
|
||||
&aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
mPrefService->GetIntPref("mousewheel.withshiftkey.numlines", &numLines);
|
||||
mPrefService->GetIntPref("mousewheel.withshiftkey.numlines",
|
||||
&numLines);
|
||||
} else if (msEvent->isControl) {
|
||||
mPrefService->GetIntPref("mousewheel.withcontrolkey.action", &action);
|
||||
mPrefService->GetBoolPref("mousewheel.withcontrolkey.sysnumlines", &aBool);
|
||||
if (aBool)
|
||||
numLines = msEvent->deltaLines;
|
||||
mPrefService->GetBoolPref("mousewheel.withcontrolkey.sysnumlines",
|
||||
&aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
mPrefService->GetIntPref("mousewheel.withcontrolkey.numlines", &numLines);
|
||||
mPrefService->GetIntPref("mousewheel.withcontrolkey.numlines",
|
||||
&numLines);
|
||||
} else if (msEvent->isAlt) {
|
||||
mPrefService->GetIntPref("mousewheel.withaltkey.action", &action);
|
||||
mPrefService->GetBoolPref("mousewheel.withaltkey.sysnumlines", &aBool);
|
||||
if (aBool)
|
||||
numLines = msEvent->deltaLines;
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
mPrefService->GetIntPref("mousewheel.withaltkey.numlines", &numLines);
|
||||
mPrefService->GetIntPref("mousewheel.withaltkey.numlines",
|
||||
&numLines);
|
||||
} else {
|
||||
mPrefService->GetIntPref("mousewheel.withnokey.action", &action);
|
||||
mPrefService->GetBoolPref("mousewheel.withnokey.sysnumlines", &aBool);
|
||||
if (aBool)
|
||||
numLines = msEvent->deltaLines;
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
mPrefService->GetIntPref("mousewheel.withnokey.numlines", &numLines);
|
||||
}
|
||||
|
||||
if ((msEvent->deltaLines < 0) && (numLines > 0))
|
||||
if ((msEvent->delta < 0) && (numLines > 0))
|
||||
numLines = -numLines;
|
||||
|
||||
switch (action) {
|
||||
|
@ -1088,7 +1098,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
if (pcContainer) {
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(pcContainer));
|
||||
if (webNav) {
|
||||
if (msEvent->deltaLines > 0)
|
||||
if (msEvent->delta > 0)
|
||||
webNav->GoBack();
|
||||
else
|
||||
webNav->GoForward();
|
||||
|
@ -1098,7 +1108,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
break;
|
||||
|
||||
case MOUSE_SCROLL_TEXTSIZE:
|
||||
ChangeTextSize((msEvent->deltaLines > 0) ? 1 : -1);
|
||||
ChangeTextSize((msEvent->delta > 0) ? 1 : -1);
|
||||
break;
|
||||
}
|
||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#define FORCE_PR_LOG
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
|
@ -67,7 +66,6 @@
|
|||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "prlog.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
#include "nsITreeFrame.h"
|
||||
|
@ -81,8 +79,6 @@ nsIContent * gLastFocusedContent = 0; // Strong reference
|
|||
nsIDocument * gLastFocusedDocument = 0; // Strong reference
|
||||
nsIPresContext* gLastFocusedPresContext = 0; // Weak reference
|
||||
|
||||
PRLogModuleInfo *MOUSEWHEEL;
|
||||
|
||||
PRUint32 nsEventStateManager::mInstanceCount = 0;
|
||||
|
||||
enum {
|
||||
|
@ -130,8 +126,6 @@ nsEventStateManager::nsEventStateManager()
|
|||
NS_INIT_REFCNT();
|
||||
|
||||
++mInstanceCount;
|
||||
if (!MOUSEWHEEL)
|
||||
MOUSEWHEEL = PR_NewLogModule("MOUSEWHEEL");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -960,40 +954,56 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
nsMouseScrollEvent *msEvent = (nsMouseScrollEvent*) aEvent;
|
||||
PRInt32 action = 0;
|
||||
PRInt32 numLines = 0;
|
||||
PRBool aBool;
|
||||
|
||||
PRBool aBool;
|
||||
|
||||
if (msEvent->isShift) {
|
||||
mPrefService->GetIntPref("mousewheel.withshiftkey.action", &action);
|
||||
mPrefService->GetBoolPref("mousewheel.withshiftkey.sysnumlines", &aBool);
|
||||
if (aBool)
|
||||
numLines = msEvent->deltaLines;
|
||||
mPrefService->GetBoolPref("mousewheel.withshiftkey.sysnumlines",
|
||||
&aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
mPrefService->GetIntPref("mousewheel.withshiftkey.numlines", &numLines);
|
||||
mPrefService->GetIntPref("mousewheel.withshiftkey.numlines",
|
||||
&numLines);
|
||||
} else if (msEvent->isControl) {
|
||||
mPrefService->GetIntPref("mousewheel.withcontrolkey.action", &action);
|
||||
mPrefService->GetBoolPref("mousewheel.withcontrolkey.sysnumlines", &aBool);
|
||||
if (aBool)
|
||||
numLines = msEvent->deltaLines;
|
||||
mPrefService->GetBoolPref("mousewheel.withcontrolkey.sysnumlines",
|
||||
&aBool);
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
mPrefService->GetIntPref("mousewheel.withcontrolkey.numlines", &numLines);
|
||||
mPrefService->GetIntPref("mousewheel.withcontrolkey.numlines",
|
||||
&numLines);
|
||||
} else if (msEvent->isAlt) {
|
||||
mPrefService->GetIntPref("mousewheel.withaltkey.action", &action);
|
||||
mPrefService->GetBoolPref("mousewheel.withaltkey.sysnumlines", &aBool);
|
||||
if (aBool)
|
||||
numLines = msEvent->deltaLines;
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
mPrefService->GetIntPref("mousewheel.withaltkey.numlines", &numLines);
|
||||
mPrefService->GetIntPref("mousewheel.withaltkey.numlines",
|
||||
&numLines);
|
||||
} else {
|
||||
mPrefService->GetIntPref("mousewheel.withnokey.action", &action);
|
||||
mPrefService->GetBoolPref("mousewheel.withnokey.sysnumlines", &aBool);
|
||||
if (aBool)
|
||||
numLines = msEvent->deltaLines;
|
||||
if (aBool) {
|
||||
numLines = msEvent->delta;
|
||||
if (msEvent->isPageScroll)
|
||||
action = MOUSE_SCROLL_PAGE;
|
||||
}
|
||||
else
|
||||
mPrefService->GetIntPref("mousewheel.withnokey.numlines", &numLines);
|
||||
}
|
||||
|
||||
if ((msEvent->deltaLines < 0) && (numLines > 0))
|
||||
if ((msEvent->delta < 0) && (numLines > 0))
|
||||
numLines = -numLines;
|
||||
|
||||
switch (action) {
|
||||
|
@ -1088,7 +1098,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
if (pcContainer) {
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(pcContainer));
|
||||
if (webNav) {
|
||||
if (msEvent->deltaLines > 0)
|
||||
if (msEvent->delta > 0)
|
||||
webNav->GoBack();
|
||||
else
|
||||
webNav->GoForward();
|
||||
|
@ -1098,7 +1108,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||
break;
|
||||
|
||||
case MOUSE_SCROLL_TEXTSIZE:
|
||||
ChangeTextSize((msEvent->deltaLines > 0) ? 1 : -1);
|
||||
ChangeTextSize((msEvent->delta > 0) ? 1 : -1);
|
||||
break;
|
||||
}
|
||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
|
|
|
@ -239,7 +239,8 @@ struct nsCompositionEvent : public nsInputEvent {
|
|||
};
|
||||
|
||||
struct nsMouseScrollEvent : public nsInputEvent {
|
||||
PRInt32 deltaLines;
|
||||
PRBool isPageScroll;
|
||||
PRInt32 delta;
|
||||
};
|
||||
|
||||
struct nsReconversionEventReply {
|
||||
|
|
|
@ -1935,10 +1935,11 @@ nsWidget::OnButtonPressSignal(GdkEventButton * aGdkButtonEvent)
|
|||
|
||||
case 4:
|
||||
case 5:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
if (aGdkButtonEvent->button == 4)
|
||||
scrollEvent.deltaLines = -3;
|
||||
scrollEvent.delta = -3;
|
||||
else
|
||||
scrollEvent.deltaLines = 3;
|
||||
scrollEvent.delta = 3;
|
||||
|
||||
scrollEvent.message = NS_MOUSE_SCROLL;
|
||||
scrollEvent.widget = this;
|
||||
|
|
|
@ -2421,19 +2421,24 @@ PRBool nsWindow::OnVScroll( MPARAM mp1, MPARAM mp2)
|
|||
scrollEvent.isMeta = PR_FALSE;
|
||||
switch (SHORT2FROMMP(mp2)) {
|
||||
case SB_LINEUP:
|
||||
scrollEvent.deltaLines = -1;
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = -1;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
scrollEvent.deltaLines = 1;
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = 1;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
scrollEvent.deltaLines = -10; /* OS2TODO ??? */
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.delta = -1;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
scrollEvent.deltaLines = 10; /* OS2TODO ??? */
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.delta = 1;
|
||||
break;
|
||||
default:
|
||||
scrollEvent.deltaLines = 0;
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = 0;
|
||||
break;
|
||||
}
|
||||
DispatchWindowEvent(&scrollEvent);
|
||||
|
@ -2455,18 +2460,23 @@ PRBool nsWindow::OnHScroll( MPARAM mp1, MPARAM mp2)
|
|||
scrollEvent.isMeta = PR_FALSE;
|
||||
switch (SHORT2FROMMP(mp2)) {
|
||||
case SB_LINELEFT:
|
||||
scrollEvent.deltaColumns = -1;
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = -1;
|
||||
break;
|
||||
case SB_LINERIGHT:
|
||||
scrollEvent.deltaColumns = 1;
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.delta = 1;
|
||||
break;
|
||||
case SB_PAGELEFT:
|
||||
scrollEvent.deltaColumns = -10; /* OS2TODO ??? */
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.delta = -1;
|
||||
break;
|
||||
case SB_PAGERIGHT:
|
||||
scrollEvent.deltaColumns = 10; /* OS2TODO ??? */
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
scrollEvent.deltaColumns = 1;
|
||||
break;
|
||||
default:
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.deltaColumns = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,10 @@
|
|||
|
||||
#define kWindowPositionSlop 10
|
||||
|
||||
#ifndef SPI_GETWHEELSCROLLLINES
|
||||
#define SPI_GETWHEELSCROLLLINES 104
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
|
||||
static NS_DEFINE_CID(kTimerManagerCID, NS_TIMERMANAGER_CID);
|
||||
|
@ -2701,12 +2705,9 @@ void PrintEvent(UINT msg, PRBool aShowAllEvents, PRBool aShowMouseMoves)
|
|||
|
||||
PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *aRetValue)
|
||||
{
|
||||
static UINT vkKeyCached = 0; // caches VK code fon WM_KEYDOWN
|
||||
static BOOL firstTime = TRUE; // for mouse wheel logic
|
||||
static int iDeltaPerLine, iAccumDelta ; // for mouse wheel logic
|
||||
ULONG ulScrollLines ; // for mouse wheel logic
|
||||
|
||||
static UINT vkKeyCached = 0; // caches VK code fon WM_KEYDOWN
|
||||
PRBool result = PR_FALSE; // call the default nsWindow proc
|
||||
PRBool getWheelInfo = PR_TRUE;
|
||||
nsPaletteInfo palInfo;
|
||||
*aRetValue = 0;
|
||||
|
||||
|
@ -3184,7 +3185,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
|||
}
|
||||
|
||||
case WM_SETTINGCHANGE:
|
||||
firstTime = TRUE;
|
||||
getWheelInfo = PR_TRUE;
|
||||
break;
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
|
@ -3291,111 +3292,137 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
|||
|
||||
default: {
|
||||
// Handle both flavors of mouse wheel events.
|
||||
if ( msg == WM_MOUSEWHEEL || msg == uMSH_MOUSEWHEEL ) {
|
||||
// Get mouse wheel metrics (but only once).
|
||||
if (firstTime) {
|
||||
firstTime = FALSE;
|
||||
|
||||
// This needs to be done differently for Win95 than Win98/NT
|
||||
// Taken from sample code in MS Intellimouse SDK
|
||||
// (http://www.microsoft.com/Mouse/intellimouse/sdk/sdkmessaging.htm)
|
||||
|
||||
OSVERSIONINFO osversion;
|
||||
memset(&osversion, 0, sizeof(OSVERSIONINFO));
|
||||
osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&osversion);
|
||||
|
||||
if ((osversion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) &&
|
||||
(osversion.dwMajorVersion == 4) &&
|
||||
(osversion.dwMinorVersion == 0))
|
||||
{
|
||||
// This is the Windows 95 case
|
||||
HWND hdlMsWheel = FindWindow(MSH_WHEELMODULE_CLASS,
|
||||
MSH_WHEELMODULE_TITLE);
|
||||
if (hdlMsWheel) {
|
||||
UINT uiMsh_MsgScrollLines = RegisterWindowMessage(MSH_SCROLL_LINES);
|
||||
if (uiMsh_MsgScrollLines) {
|
||||
ulScrollLines = (int) SendMessage(hdlMsWheel,
|
||||
uiMsh_MsgScrollLines, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (osversion.dwMajorVersion >= 4) {
|
||||
// This is the Win98/NT4/Win2K case
|
||||
SystemParametersInfo (104, 0, &ulScrollLines, 0);
|
||||
}
|
||||
|
||||
// ulScrollLines usually equals 3 or 0 (for no scrolling)
|
||||
// WHEEL_DELTA equals 120, so iDeltaPerLine will be 40
|
||||
|
||||
if (ulScrollLines)
|
||||
iDeltaPerLine = WHEEL_DELTA / ulScrollLines ;
|
||||
else
|
||||
iDeltaPerLine = 0 ;
|
||||
}
|
||||
|
||||
if (iDeltaPerLine == 0)
|
||||
return 0;
|
||||
|
||||
// The mousewheel event will be dispatched to the toplevel
|
||||
// window. We need to give it to the child window
|
||||
|
||||
POINT point;
|
||||
point.x = (short) LOWORD(lParam);
|
||||
point.y = (short) HIWORD(lParam);
|
||||
HWND destWnd = ::WindowFromPoint(point);
|
||||
if ((msg == WM_MOUSEWHEEL) || (msg == uMSH_MOUSEWHEEL)) {
|
||||
static int iDeltaPerLine;
|
||||
static ULONG ulScrollLines;
|
||||
|
||||
// Get mouse wheel metrics (but only once).
|
||||
if (getWheelInfo) {
|
||||
getWheelInfo = PR_FALSE;
|
||||
|
||||
// Since we receive mousewheel events for as long as
|
||||
// we are focused, it's entirely possible that there
|
||||
// is another app's window or no window under the
|
||||
// pointer.
|
||||
|
||||
if (!destWnd) {
|
||||
// No window is under the pointer
|
||||
break;
|
||||
}
|
||||
|
||||
LONG proc = ::GetWindowLong(destWnd, GWL_WNDPROC);
|
||||
if (proc != (LONG)&nsWindow::WindowProc) {
|
||||
// Some other app
|
||||
break;
|
||||
}
|
||||
|
||||
else if (destWnd != mWnd) {
|
||||
nsWindow* destWindow = GetNSWindowPtr(destWnd);
|
||||
if (destWindow) {
|
||||
return destWindow->ProcessMessage(msg, wParam, lParam, aRetValue);
|
||||
// This needs to be done differently for Win95 than Win98/NT
|
||||
// Taken from sample code in MS Intellimouse SDK
|
||||
// http://www.microsoft.com/Mouse/intellimouse/sdk/sdkmessaging.htm
|
||||
|
||||
OSVERSIONINFO osversion;
|
||||
memset(&osversion, 0, sizeof(OSVERSIONINFO));
|
||||
osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&osversion);
|
||||
|
||||
if ((osversion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) &&
|
||||
(osversion.dwMajorVersion == 4) &&
|
||||
(osversion.dwMinorVersion == 0))
|
||||
{
|
||||
// This is the Windows 95 case
|
||||
HWND hdlMsWheel = FindWindow(MSH_WHEELMODULE_CLASS,
|
||||
MSH_WHEELMODULE_TITLE);
|
||||
if (hdlMsWheel) {
|
||||
UINT uiMsh_MsgScrollLines = RegisterWindowMessage(MSH_SCROLL_LINES);
|
||||
if (uiMsh_MsgScrollLines) {
|
||||
ulScrollLines = (int) SendMessage(hdlMsWheel,
|
||||
uiMsh_MsgScrollLines, 0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
printf("WARNING: couldn't get child window for MW event\n");
|
||||
#endif
|
||||
}
|
||||
else if (osversion.dwMajorVersion >= 4) {
|
||||
// This is the Win98/NT4/Win2K case
|
||||
SystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0,
|
||||
&ulScrollLines, 0);
|
||||
}
|
||||
|
||||
nsMouseScrollEvent scrollEvent;
|
||||
if (msg == WM_MOUSEWHEEL)
|
||||
scrollEvent.deltaLines = -((short) HIWORD (wParam) / iDeltaPerLine);
|
||||
// ulScrollLines usually equals 3 or 0 (for no scrolling)
|
||||
// WHEEL_DELTA equals 120, so iDeltaPerLine will be 40.
|
||||
|
||||
// However, if ulScrollLines > WHEEL_DELTA, we assume that
|
||||
// the mouse driver wants a page scroll. The docs state that
|
||||
// ulScrollLines should explicitly equal WHEEL_PAGESCROLL, but
|
||||
// since some mouse drivers use an arbitrary large number instead,
|
||||
// we have to handle that as well.
|
||||
|
||||
iDeltaPerLine = 0;
|
||||
if (ulScrollLines) {
|
||||
if (ulScrollLines <= WHEEL_DELTA) {
|
||||
iDeltaPerLine = WHEEL_DELTA / ulScrollLines;
|
||||
} else {
|
||||
ulScrollLines = WHEEL_PAGESCROLL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((ulScrollLines != WHEEL_PAGESCROLL) && (!iDeltaPerLine))
|
||||
return 0;
|
||||
|
||||
// The mousewheel event will be dispatched to the toplevel
|
||||
// window. We need to give it to the child window
|
||||
|
||||
POINT point;
|
||||
point.x = (short) LOWORD(lParam);
|
||||
point.y = (short) HIWORD(lParam);
|
||||
HWND destWnd = ::WindowFromPoint(point);
|
||||
|
||||
// Since we receive mousewheel events for as long as
|
||||
// we are focused, it's entirely possible that there
|
||||
// is another app's window or no window under the
|
||||
// pointer.
|
||||
|
||||
if (!destWnd) {
|
||||
// No window is under the pointer
|
||||
break;
|
||||
}
|
||||
|
||||
LONG proc = ::GetWindowLong(destWnd, GWL_WNDPROC);
|
||||
if (proc != (LONG)&nsWindow::WindowProc) {
|
||||
// Some other app
|
||||
break;
|
||||
}
|
||||
|
||||
else if (destWnd != mWnd) {
|
||||
nsWindow* destWindow = GetNSWindowPtr(destWnd);
|
||||
if (destWindow) {
|
||||
return destWindow->ProcessMessage(msg, wParam, lParam,
|
||||
aRetValue);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
scrollEvent.deltaLines = -((int) wParam / iDeltaPerLine);
|
||||
scrollEvent.eventStructType = NS_MOUSE_SCROLL_EVENT;
|
||||
scrollEvent.isShift = IS_VK_DOWN(NS_VK_SHIFT);
|
||||
scrollEvent.isControl = IS_VK_DOWN(NS_VK_CONTROL);
|
||||
scrollEvent.isMeta = PR_FALSE;
|
||||
scrollEvent.isAlt = IS_VK_DOWN(NS_VK_ALT);
|
||||
InitEvent(scrollEvent, NS_MOUSE_SCROLL);
|
||||
if (nsnull != mEventCallback) {
|
||||
result = DispatchWindowEvent(&scrollEvent);
|
||||
}
|
||||
NS_RELEASE(scrollEvent.widget);
|
||||
printf("WARNING: couldn't get child window for MW event\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsMouseScrollEvent scrollEvent;
|
||||
if (ulScrollLines == WHEEL_PAGESCROLL) {
|
||||
scrollEvent.isPageScroll = PR_TRUE;
|
||||
if (msg == WM_MOUSEWHEEL)
|
||||
scrollEvent.delta = (((short) HIWORD (wParam)) > 0) ? -1 : 1;
|
||||
else
|
||||
scrollEvent.delta = ((int) wParam > 0) ? -1 : 1;
|
||||
} else {
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
if (msg == WM_MOUSEWHEEL)
|
||||
scrollEvent.delta = -((short) HIWORD (wParam) / iDeltaPerLine);
|
||||
else
|
||||
scrollEvent.delta = -((int) wParam / iDeltaPerLine);
|
||||
}
|
||||
|
||||
scrollEvent.eventStructType = NS_MOUSE_SCROLL_EVENT;
|
||||
scrollEvent.isShift = IS_VK_DOWN(NS_VK_SHIFT);
|
||||
scrollEvent.isControl = IS_VK_DOWN(NS_VK_CONTROL);
|
||||
scrollEvent.isMeta = PR_FALSE;
|
||||
scrollEvent.isAlt = IS_VK_DOWN(NS_VK_ALT);
|
||||
InitEvent(scrollEvent, NS_MOUSE_SCROLL);
|
||||
if (nsnull != mEventCallback) {
|
||||
result = DispatchWindowEvent(&scrollEvent);
|
||||
}
|
||||
NS_RELEASE(scrollEvent.widget);
|
||||
} // WM_MOUSEWHEEL || uMSH_MOUSEWHEEL
|
||||
|
||||
|
||||
//
|
||||
// reconvertion meesage for Windows 95 / NT 4.0
|
||||
//
|
||||
// See the following URL
|
||||
// http://msdn.microsoft.com/library/specs/msimeif_perimeinterfaces.htm#WM_MSIME_RECONVERT
|
||||
// http://www.justsystem.co.jp/tech/atok/api12_04.html#4_11
|
||||
|
||||
|
||||
else if ((msg == nsWindow::uWM_ATOK_RECONVERT) || (msg == nsWindow::uWM_MSIME_RECONVERT)) {
|
||||
result = OnIMERequest(wParam, lParam, aRetValue, PR_TRUE);
|
||||
}
|
||||
|
|
|
@ -710,7 +710,8 @@ nsAppShell::HandleButtonEvent(XEvent *event, nsWidget *aWidget)
|
|||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
scrollEvent.deltaLines = (event->xbutton.button == 4) ? -3 : 3;
|
||||
scrollEvent.delta = (event->xbutton.button == 4) ? -3 : 3;
|
||||
scrollEvent.isPageScroll = PR_FALSE;
|
||||
scrollEvent.message = NS_MOUSE_SCROLL;
|
||||
scrollEvent.widget = aWidget;
|
||||
scrollEvent.eventStructType = NS_MOUSE_SCROLL_EVENT;
|
||||
|
|
Загрузка…
Ссылка в новой задаче