OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fwl/core/cfwl_notedriver.h" | 7 #include "xfa/fwl/core/cfwl_notedriver.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { | 77 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { |
78 int32_t pos = m_noteLoopQueue.GetSize(); | 78 int32_t pos = m_noteLoopQueue.GetSize(); |
79 if (pos <= 0) | 79 if (pos <= 0) |
80 return nullptr; | 80 return nullptr; |
81 | 81 |
82 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); | 82 CFWL_NoteLoop* p = m_noteLoopQueue.GetAt(pos - 1); |
83 m_noteLoopQueue.RemoveAt(pos - 1); | 83 m_noteLoopQueue.RemoveAt(pos - 1); |
84 return p; | 84 return p; |
85 } | 85 } |
86 | 86 |
87 bool CFWL_NoteDriver::SetFocus(CFWL_Widget* pFocus, bool bNotify) { | 87 bool CFWL_NoteDriver::SetFocus(CFWL_Widget* pFocus) { |
88 if (m_pFocus == pFocus) | 88 if (m_pFocus == pFocus) |
89 return true; | 89 return true; |
90 | 90 |
91 CFWL_Widget* pPrev = m_pFocus; | 91 CFWL_Widget* pPrev = m_pFocus; |
92 m_pFocus = pFocus; | 92 m_pFocus = pFocus; |
93 if (pPrev) { | 93 if (pPrev) { |
94 CFWL_MsgKillFocus ms; | 94 CFWL_MsgKillFocus ms; |
95 ms.m_pDstTarget = pPrev; | 95 ms.m_pDstTarget = pPrev; |
96 ms.m_pSrcTarget = pPrev; | 96 ms.m_pSrcTarget = pPrev; |
97 if (bNotify) | |
98 ms.m_dwExtend = 1; | |
99 | 97 |
100 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetDelegate()) | 98 if (IFWL_WidgetDelegate* pDelegate = pPrev->GetDelegate()) |
101 pDelegate->OnProcessMessage(&ms); | 99 pDelegate->OnProcessMessage(&ms); |
102 } | 100 } |
103 if (pFocus) { | 101 if (pFocus) { |
104 CFWL_Widget* pWidget = | 102 CFWL_Widget* pWidget = |
105 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus); | 103 pFocus->GetOwnerApp()->GetWidgetMgr()->GetSystemFormWidget(pFocus); |
106 CFWL_Form* pForm = static_cast<CFWL_Form*>(pWidget); | 104 CFWL_Form* pForm = static_cast<CFWL_Form*>(pWidget); |
107 if (pForm) | 105 if (pForm) |
108 pForm->SetSubFocus(pFocus); | 106 pForm->SetSubFocus(pFocus); |
109 | 107 |
110 CFWL_MsgSetFocus ms; | 108 CFWL_MsgSetFocus ms; |
111 ms.m_pDstTarget = pFocus; | 109 ms.m_pDstTarget = pFocus; |
112 if (bNotify) | |
113 ms.m_dwExtend = 1; | |
114 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) | 110 if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) |
115 pDelegate->OnProcessMessage(&ms); | 111 pDelegate->OnProcessMessage(&ms); |
116 } | 112 } |
117 return true; | 113 return true; |
118 } | 114 } |
119 | 115 |
120 void CFWL_NoteDriver::Run() { | 116 void CFWL_NoteDriver::Run() { |
121 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ | 117 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ |
122 _FX_OS_ == _FX_WIN64_) | 118 _FX_OS_ == _FX_WIN64_) |
123 for (;;) { | 119 for (;;) { |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { | 475 void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { |
480 auto it = m_eventTargets.begin(); | 476 auto it = m_eventTargets.begin(); |
481 while (it != m_eventTargets.end()) { | 477 while (it != m_eventTargets.end()) { |
482 auto old = it++; | 478 auto old = it++; |
483 if (old->second && (bRemoveAll || old->second->IsInvalid())) { | 479 if (old->second && (bRemoveAll || old->second->IsInvalid())) { |
484 delete old->second; | 480 delete old->second; |
485 m_eventTargets.erase(old); | 481 m_eventTargets.erase(old); |
486 } | 482 } |
487 } | 483 } |
488 } | 484 } |
OLD | NEW |