зеркало из https://github.com/mozilla/gecko-dev.git
Camino only - Bug 366996: Select word on right click only when there is no selection. r=murph sr=pink
This commit is contained in:
Родитель
3d68d54537
Коммит
f487272dea
|
@ -4044,12 +4044,23 @@ enum BWCOpenDest {
|
||||||
(contextMenuFlags & nsIContextMenuListener::CONTEXT_TEXT) != 0 ||
|
(contextMenuFlags & nsIContextMenuListener::CONTEXT_TEXT) != 0 ||
|
||||||
isMidas)
|
isMidas)
|
||||||
{
|
{
|
||||||
// simulate a double click to select the word as native text fields do for context clicks,
|
// The following is a hack to work around bug 365183: If there is a no selection in the
|
||||||
// which allows spell check to operate on the word under the mouse.
|
// editor, we simulate a double click to select the word as native text fields do
|
||||||
// ideally we'd tell the editor directly to move the anchor to the mouse location and select
|
// for context clicks, which allows spell check to operate on the word under the mouse.
|
||||||
// the word it ends up in, but there doesn't appear to be a way to do that.
|
// The behavior is not quite right since a right click outside of an existing selection should
|
||||||
NSEvent* realClick = [NSApp currentEvent];
|
// change the selection, but this gets us most of the way there until bug 365183 is fixed.
|
||||||
NSEvent* fakeDoubleClickDown = [NSEvent mouseEventWithType:NSLeftMouseDown
|
if (!hasSelection) {
|
||||||
|
NSEvent* realClick = [NSApp currentEvent];
|
||||||
|
NSEvent* fakeDoubleClickDown = [NSEvent mouseEventWithType:NSLeftMouseDown
|
||||||
|
location:[realClick locationInWindow]
|
||||||
|
modifierFlags:0
|
||||||
|
timestamp:[realClick timestamp]
|
||||||
|
windowNumber:[realClick windowNumber]
|
||||||
|
context:[realClick context]
|
||||||
|
eventNumber:[realClick eventNumber]
|
||||||
|
clickCount:2
|
||||||
|
pressure:[realClick pressure]];
|
||||||
|
NSEvent* fakeDoubleClickUp = [NSEvent mouseEventWithType:NSLeftMouseUp
|
||||||
location:[realClick locationInWindow]
|
location:[realClick locationInWindow]
|
||||||
modifierFlags:0
|
modifierFlags:0
|
||||||
timestamp:[realClick timestamp]
|
timestamp:[realClick timestamp]
|
||||||
|
@ -4058,18 +4069,11 @@ enum BWCOpenDest {
|
||||||
eventNumber:[realClick eventNumber]
|
eventNumber:[realClick eventNumber]
|
||||||
clickCount:2
|
clickCount:2
|
||||||
pressure:[realClick pressure]];
|
pressure:[realClick pressure]];
|
||||||
NSEvent* fakeDoubleClickUp = [NSEvent mouseEventWithType:NSLeftMouseUp
|
NSView* textFieldView = [mContentView hitTest:[[mContentView superview] convertPoint:[realClick locationInWindow] fromView:nil]];
|
||||||
location:[realClick locationInWindow]
|
[textFieldView mouseDown:fakeDoubleClickDown];
|
||||||
modifierFlags:0
|
[textFieldView mouseUp:fakeDoubleClickUp];
|
||||||
timestamp:[realClick timestamp]
|
}
|
||||||
windowNumber:[realClick windowNumber]
|
|
||||||
context:[realClick context]
|
|
||||||
eventNumber:[realClick eventNumber]
|
|
||||||
clickCount:2
|
|
||||||
pressure:[realClick pressure]];
|
|
||||||
NSView* textFieldView = [mContentView hitTest:[[mContentView superview] convertPoint:[realClick locationInWindow] fromView:nil]];
|
|
||||||
[textFieldView mouseDown:fakeDoubleClickDown];
|
|
||||||
[textFieldView mouseUp:fakeDoubleClickUp];
|
|
||||||
menuPrototype = mInputMenu;
|
menuPrototype = mInputMenu;
|
||||||
showSpellingItems = YES;
|
showSpellingItems = YES;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче