From d27f392c79ce53390f9de36778bb20f73f3e9324 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 10 Apr 2018 16:10:36 +0000 Subject: Break down CXFA_FFWidget::On{L|R}ButtonDown() into two steps. The first step, AcceptsFocusOnButtonDown(), returns whether the widget wants focus on a mouse click. The second step, On{L|R}ButtonDown(), handles the click after focus has been assigned. Bug: chromium:820256 Change-Id: I9da1f1a930f198fc17b24acb7f1e3e6ef7f12ae4 Reviewed-on: https://pdfium-review.googlesource.com/29951 Reviewed-by: Ryan Harrison Commit-Queue: Henrique Nakashima --- xfa/fxfa/cxfa_ffbarcode.cpp | 14 +++++--------- xfa/fxfa/cxfa_ffbarcode.h | 5 +++-- xfa/fxfa/cxfa_fffield.cpp | 19 ++++++++----------- xfa/fxfa/cxfa_fffield.h | 7 +++++-- xfa/fxfa/cxfa_ffimageedit.cpp | 14 +++++++++++--- xfa/fxfa/cxfa_ffimageedit.h | 5 ++++- xfa/fxfa/cxfa_ffsignature.cpp | 14 ++++++++------ xfa/fxfa/cxfa_ffsignature.h | 7 +++++-- xfa/fxfa/cxfa_fftext.cpp | 12 ++++++++++-- xfa/fxfa/cxfa_fftext.h | 5 ++++- xfa/fxfa/cxfa_fftextedit.cpp | 19 +++++++++++-------- xfa/fxfa/cxfa_fftextedit.h | 7 +++++-- xfa/fxfa/cxfa_ffwidget.cpp | 10 ++++++---- xfa/fxfa/cxfa_ffwidget.h | 9 +++++++-- xfa/fxfa/cxfa_ffwidgethandler.cpp | 25 +++++++++++++++++-------- 15 files changed, 109 insertions(+), 63 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp index c458696ce8..e35f6c8696 100644 --- a/xfa/fxfa/cxfa_ffbarcode.cpp +++ b/xfa/fxfa/cxfa_ffbarcode.cpp @@ -221,18 +221,14 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { } } -bool CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { +bool CXFA_FFBarcode::AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) { auto* pBarCodeWidget = static_cast(m_pNormalWidget.get()); if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) return false; - if (!m_pNode->IsOpenAccess()) + if (command == FWL_MouseCommand::LeftButtonDown && !m_pNode->IsOpenAccess()) return false; - return CXFA_FFTextEdit::OnLButtonDown(dwFlags, point); -} -bool CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { - auto* pBarCodeWidget = static_cast(m_pNormalWidget.get()); - if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) - return false; - return CXFA_FFTextEdit::OnRButtonDown(dwFlags, point); + return CXFA_FFTextEdit::AcceptsFocusOnButtonDown(dwFlags, point, command); } diff --git a/xfa/fxfa/cxfa_ffbarcode.h b/xfa/fxfa/cxfa_ffbarcode.h index 7804ce3830..672f89c316 100644 --- a/xfa/fxfa/cxfa_ffbarcode.h +++ b/xfa/fxfa/cxfa_ffbarcode.h @@ -99,8 +99,9 @@ class CXFA_FFBarcode : public CXFA_FFTextEdit { const CFX_Matrix& matrix, uint32_t dwStatus) override; void UpdateWidgetProperty() override; - bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; - bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) override; private: UnownedPtr barcode_; diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index 552a4e3f4b..e9a3c49c5c 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -382,7 +382,9 @@ CFX_PointF CXFA_FFField::FWLToClient(const CFX_PointF& point) { : point; } -bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { +bool CXFA_FFField::AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) { if (!m_pNormalWidget) return false; if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) @@ -390,13 +392,16 @@ bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { if (!PtInActiveRect(point)) return false; + return true; +} + +void CXFA_FFField::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { SetButtonDown(true); CFWL_MessageMouse ms(nullptr, m_pNormalWidget.get()); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); - return true; } bool CXFA_FFField::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { @@ -452,14 +457,7 @@ bool CXFA_FFField::OnMouseWheel(uint32_t dwFlags, return true; } -bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { - if (!m_pNormalWidget) - return false; - if (!m_pNode->IsOpenAccess() || !GetDoc()->GetXFADoc()->IsInteractive()) - return false; - if (!PtInActiveRect(point)) - return false; - +void CXFA_FFField::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { SetButtonDown(true); CFWL_MessageMouse ms(nullptr, m_pNormalWidget.get()); @@ -467,7 +465,6 @@ bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { ms.m_dwFlags = dwFlags; ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); - return true; } bool CXFA_FFField::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h index a27b3844b6..b51234a437 100644 --- a/xfa/fxfa/cxfa_fffield.h +++ b/xfa/fxfa/cxfa_fffield.h @@ -35,14 +35,17 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { bool PerformLayout() override; bool OnMouseEnter() override; bool OnMouseExit() override; - bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) override; + void OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseWheel(uint32_t dwFlags, int16_t zDelta, const CFX_PointF& point) override; - bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + void OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index df47493cca..40afdb1c4c 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -96,13 +96,22 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, iImageYDpi, iHorzAlign, iVertAlign); } -bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, - const CFX_PointF& point) { +bool CXFA_FFImageEdit::AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) { + if (command != FWL_MouseCommand::LeftButtonDown) + return CXFA_FFField::AcceptsFocusOnButtonDown(dwFlags, point, command); + if (!m_pNode->IsOpenAccess()) return false; if (!PtInActiveRect(point)) return false; + return true; +} + +void CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, + const CFX_PointF& point) { SetButtonDown(true); CFWL_MessageMouse ms(nullptr, m_pNormalWidget.get()); @@ -110,7 +119,6 @@ bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, ms.m_dwFlags = dwFlags; ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); - return true; } void CXFA_FFImageEdit::SetFWLRect() { diff --git a/xfa/fxfa/cxfa_ffimageedit.h b/xfa/fxfa/cxfa_ffimageedit.h index a7ef6a8c27..2b84c54360 100644 --- a/xfa/fxfa/cxfa_ffimageedit.h +++ b/xfa/fxfa/cxfa_ffimageedit.h @@ -20,7 +20,10 @@ class CXFA_FFImageEdit : public CXFA_FFField { uint32_t dwStatus) override; bool LoadWidget() override; void UnloadWidget() override; - bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) override; + void OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CXFA_Graphics* pGraphics, diff --git a/xfa/fxfa/cxfa_ffsignature.cpp b/xfa/fxfa/cxfa_ffsignature.cpp index 6911facce1..b2e5c6a0dc 100644 --- a/xfa/fxfa/cxfa_ffsignature.cpp +++ b/xfa/fxfa/cxfa_ffsignature.cpp @@ -44,11 +44,15 @@ bool CXFA_FFSignature::OnMouseExit() { return false; } -bool CXFA_FFSignature::OnLButtonDown(uint32_t dwFlags, - const CFX_PointF& point) { +bool CXFA_FFSignature::AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) { return false; } +void CXFA_FFSignature::OnLButtonDown(uint32_t dwFlags, + const CFX_PointF& point) {} + bool CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; } @@ -68,10 +72,8 @@ bool CXFA_FFSignature::OnMouseWheel(uint32_t dwFlags, return false; } -bool CXFA_FFSignature::OnRButtonDown(uint32_t dwFlags, - const CFX_PointF& point) { - return false; -} +void CXFA_FFSignature::OnRButtonDown(uint32_t dwFlags, + const CFX_PointF& point) {} bool CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; diff --git a/xfa/fxfa/cxfa_ffsignature.h b/xfa/fxfa/cxfa_ffsignature.h index bd09576af4..b8a21d3c9d 100644 --- a/xfa/fxfa/cxfa_ffsignature.h +++ b/xfa/fxfa/cxfa_ffsignature.h @@ -21,14 +21,17 @@ class CXFA_FFSignature final : public CXFA_FFField { bool LoadWidget() override; bool OnMouseEnter() override; bool OnMouseExit() override; - bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) override; + void OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseWheel(uint32_t dwFlags, int16_t zDelta, const CFX_PointF& pointy) override; - bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + void OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp index a446993520..5d6152e7a4 100644 --- a/xfa/fxfa/cxfa_fftext.cpp +++ b/xfa/fxfa/cxfa_fftext.cpp @@ -99,7 +99,12 @@ bool CXFA_FFText::PerformLayout() { return true; } -bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { +bool CXFA_FFText::AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) { + if (command != FWL_MouseCommand::LeftButtonDown) + return false; + if (!GetRectWithoutRotate().Contains(point)) return false; @@ -107,10 +112,13 @@ bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { if (!wsURLContent) return false; - SetButtonDown(true); return true; } +void CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { + SetButtonDown(true); +} + bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) { return GetRectWithoutRotate().Contains(point) && !!GetLinkURLAtPoint(point); } diff --git a/xfa/fxfa/cxfa_fftext.h b/xfa/fxfa/cxfa_fftext.h index 8eeb523772..9da39d4f73 100644 --- a/xfa/fxfa/cxfa_fftext.h +++ b/xfa/fxfa/cxfa_fftext.h @@ -15,7 +15,10 @@ class CXFA_FFText : public CXFA_FFWidget { ~CXFA_FFText() override; // CXFA_FFWidget - bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) override; + void OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override; FWL_WidgetHit OnHitTest(const CFX_PointF& point) override; diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index 9861b5253c..fd2cfb76cc 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -107,9 +107,18 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() { m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); } -bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { +bool CXFA_FFTextEdit::AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) { + if (command == FWL_MouseCommand::RightButtonDown && !m_pNode->IsOpenAccess()) + return false; if (!PtInActiveRect(point)) return false; + + return true; +} + +void CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; UpdateFWLData(); @@ -122,14 +131,9 @@ bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { ms.m_dwFlags = dwFlags; ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); - return true; } -bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { - if (!m_pNode->IsOpenAccess()) - return false; - if (!PtInActiveRect(point)) - return false; +void CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; UpdateFWLData(); @@ -142,7 +146,6 @@ bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { ms.m_dwFlags = dwFlags; ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); - return true; } bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h index 1388db5099..36251e152a 100644 --- a/xfa/fxfa/cxfa_fftextedit.h +++ b/xfa/fxfa/cxfa_fftextedit.h @@ -25,8 +25,11 @@ class CXFA_FFTextEdit : public CXFA_FFField { // CXFA_FFField bool LoadWidget() override; void UpdateWidgetProperty() override; - bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; - bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) override; + void OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + void OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnSetFocus(CXFA_FFWidget* pOldWidget) override; bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 629f3bd188..f9a4807099 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -360,10 +360,14 @@ bool CXFA_FFWidget::OnMouseExit() { return false; } -bool CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { +bool CXFA_FFWidget::AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command) { return false; } +void CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {} + bool CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; } @@ -382,9 +386,7 @@ bool CXFA_FFWidget::OnMouseWheel(uint32_t dwFlags, return false; } -bool CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { - return false; -} +void CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {} bool CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 5098230b62..a16b27a88f 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -13,6 +13,7 @@ #include "core/fxcodec/fx_codec_def.h" #include "core/fxge/cfx_graphstatedata.h" #include "xfa/fwl/cfwl_app.h" +#include "xfa/fwl/cfwl_messagemouse.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" @@ -101,14 +102,18 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { virtual void UpdateWidgetProperty(); virtual bool OnMouseEnter(); virtual bool OnMouseExit(); - virtual bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point); + // |command| must be LeftButtonDown or RightButtonDown. + virtual bool AcceptsFocusOnButtonDown(uint32_t dwFlags, + const CFX_PointF& point, + FWL_MouseCommand command); + virtual void OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point); virtual bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point); virtual bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point); virtual bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point); virtual bool OnMouseWheel(uint32_t dwFlags, int16_t zDelta, const CFX_PointF& point); - virtual bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point); + virtual void OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point); virtual bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point); virtual bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point); diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index 566923e590..f2bce57ea4 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -47,10 +47,14 @@ bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, const CFX_PointF& point) { m_pDocView->LockUpdate(); - bool bRet = hWidget->OnLButtonDown(dwFlags, hWidget->Rotate2Normal(point)); - if (bRet && m_pDocView->SetFocus(hWidget)) { - m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( - m_pDocView->GetDoc(), hWidget); + bool bRet = hWidget->AcceptsFocusOnButtonDown( + dwFlags, hWidget->Rotate2Normal(point), FWL_MouseCommand::LeftButtonDown); + if (bRet) { + if (m_pDocView->SetFocus(hWidget)) { + m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( + m_pDocView->GetDoc(), hWidget); + } + hWidget->OnLButtonDown(dwFlags, hWidget->Rotate2Normal(point)); } m_pDocView->UnlockUpdate(); m_pDocView->UpdateDocView(); @@ -94,10 +98,15 @@ bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, const CFX_PointF& point) { - bool bRet = hWidget->OnRButtonDown(dwFlags, hWidget->Rotate2Normal(point)); - if (bRet && m_pDocView->SetFocus(hWidget)) { - m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( - m_pDocView->GetDoc(), hWidget); + bool bRet = + hWidget->AcceptsFocusOnButtonDown(dwFlags, hWidget->Rotate2Normal(point), + FWL_MouseCommand::RightButtonDown); + if (bRet) { + if (m_pDocView->SetFocus(hWidget)) { + m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( + m_pDocView->GetDoc(), hWidget); + } + hWidget->OnRButtonDown(dwFlags, hWidget->Rotate2Normal(point)); } return bRet; } -- cgit v1.2.3