winrt: Use ComPtrs in input context

By doing so we no longer leak the input pane inside the destructor.
Additionally the coding style is closer to the rest of the WinRT port.

Change-Id: I0d56086719c98585cec8bc3c4bcb2d86c3ea2e79
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
bb10
Oliver Wolff 2016-09-06 13:35:28 +02:00 committed by Maurice Kalinowski
parent 25d30ddb3e
commit a5915f260f
1 changed files with 3 additions and 4 deletions

View File

@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods")
inline QRectF getInputPaneRect(IInputPane *pane, qreal scaleFactor)
inline QRectF getInputPaneRect(ComPtr<IInputPane> pane, qreal scaleFactor)
{
Rect rect;
pane->get_OccludedRect(&rect);
@ -85,16 +85,15 @@ QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen)
{
qCDebug(lcQpaInputMethods) << __FUNCTION__ << screen;
IInputPaneStatics *statics;
ComPtr<IInputPaneStatics> statics;
if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(),
&statics))) {
qWarning("failed to retrieve input pane statics.");
return;
}
IInputPane *inputPane;
ComPtr<IInputPane> inputPane;
statics->GetForCurrentView(&inputPane);
statics->Release();
if (inputPane) {
EventRegistrationToken showToken, hideToken;
inputPane->add_Showing(Callback<InputPaneVisibilityHandler>(