Kaydet (Commit) c752aad4 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

merge vcl::DisplayConnectionDispatch with vcl::DisplayConnection

Change-Id: I0eb83905896e1d7549a5bd4adde45e9d69209401
Reviewed-on: https://gerrit.libreoffice.org/26888Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 3459ab4a
......@@ -390,7 +390,6 @@ merge tdoc_ucp::OfficeDocumentsEventListener with tdoc_ucp::ContentProvider
merge toolkit::ScrollableInterface with toolkit::ScrollableWrapper
merge unographic::GraphicTransformer with unographic::Graphic
merge vcl::DeletionNotifier with SalFrame
merge vcl::DisplayConnectionDispatch with vcl::DisplayConnection
merge vcl::ExtOutDevData with vcl::PDFExtOutDevData
merge vcl::SolarThreadExecutor with vcl::solarthread::detail::GenericSolarThreadExecutor
merge vclcanvas::DeviceHelper with vclcanvas::SpriteDeviceHelper
......
......@@ -320,11 +320,11 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/helper/canvasbitmap \
vcl/source/helper/canvastools \
vcl/source/helper/commandinfoprovider \
vcl/source/helper/displayconnectiondispatch \
vcl/source/helper/evntpost \
vcl/source/helper/lazydelete \
vcl/source/helper/strhelper \
vcl/source/helper/threadex \
vcl/source/helper/xconnection \
vcl/source/app/brand \
vcl/source/app/dbggui \
vcl/source/app/dndhelp \
......
......@@ -21,24 +21,46 @@
#define INCLUDED_VCL_INC_DISPLAYCONNECTIONDISPATCH_HXX
#include <sal/config.h>
#include <com/sun/star/awt/XDisplayConnection.hpp>
#include <cppuhelper/implbase.hxx>
#include <osl/mutex.hxx>
#include <rtl/ref.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <list>
namespace vcl {
class DisplayConnectionDispatch:
class DisplayConnectionDispatch :
public cppu::WeakImplHelper< css::awt::XDisplayConnection >
{
::osl::Mutex m_aMutex;
::std::list< css::uno::Reference< css::awt::XEventHandler > >
m_aHandlers;
::std::list< css::uno::Reference< css::awt::XEventHandler > >
m_aErrorHandlers;
css::uno::Any m_aAny;
public:
virtual bool dispatchEvent(void * pData, int nBytes) = 0;
DisplayConnectionDispatch();
~DisplayConnectionDispatch() override;
void start();
void terminate();
bool dispatchEvent( void* pData, int nBytes );
// XDisplayConnection
virtual void SAL_CALL addEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler, sal_Int32 eventMask ) throw(std::exception) override;
virtual void SAL_CALL removeEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override;
virtual void SAL_CALL addErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override;
virtual void SAL_CALL removeErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override;
virtual css::uno::Any SAL_CALL getIdentifier() throw(std::exception) override;
protected:
virtual ~DisplayConnectionDispatch() {}
};
}
#endif // INCLUDED_VCL_INC_DISPLAYCONNECTIONDISPATCH_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -153,8 +153,7 @@ public:
void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
{ m_pEventInst = pInstance; }
bool CallEventCallback( void* pEvent, int nBytes )
{ return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); }
bool CallEventCallback( void* pEvent, int nBytes );
enum ConnectionIdentifierType { AsciiCString, Blob };
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0;
......
......@@ -32,7 +32,7 @@
#include "vcleventlisteners.hxx"
#include "impfontcache.hxx"
#include "salwtype.hxx"
#include "xconnection.hxx"
#include "displayconnectiondispatch.hxx"
#include <unordered_map>
#include <boost/functional/hash.hpp>
......@@ -87,7 +87,7 @@ class VclEventListeners2;
class SalData;
class OpenGLContext;
namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; }
namespace vcl { class DisplayConnectionDispatch; class SettingsConfigItem; class DeleteOnDeinitBase; }
class LocaleConfigurationListener : public utl::ConfigurationListener
{
......@@ -334,7 +334,7 @@ struct ImplSVData
vcl::CommandInfoProvider* mpCommandInfoProvider;
oslThreadIdentifier mnMainThreadId;
rtl::Reference< vcl::DisplayConnection > mxDisplayConnection;
rtl::Reference< vcl::DisplayConnectionDispatch > mxDisplayConnection;
css::uno::Reference< css::lang::XComponent > mxAccessBridge;
vcl::SettingsConfigItem* mpSettingsConfigItem;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_INC_XCONNECTION_HXX
#define INCLUDED_VCL_INC_XCONNECTION_HXX
#include <osl/mutex.hxx>
#include <rtl/ref.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include "displayconnectiondispatch.hxx"
#include <list>
namespace vcl {
class DisplayConnection :
public DisplayConnectionDispatch
{
::osl::Mutex m_aMutex;
::std::list< css::uno::Reference< css::awt::XEventHandler > >
m_aHandlers;
::std::list< css::uno::Reference< css::awt::XEventHandler > >
m_aErrorHandlers;
css::uno::Any m_aAny;
public:
DisplayConnection();
virtual ~DisplayConnection();
void start();
void terminate();
virtual bool dispatchEvent( void* pData, int nBytes ) override;
// XDisplayConnection
virtual void SAL_CALL addEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler, sal_Int32 eventMask ) throw(std::exception) override;
virtual void SAL_CALL removeEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override;
virtual void SAL_CALL addErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override;
virtual void SAL_CALL removeErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override;
virtual css::uno::Any SAL_CALL getIdentifier() throw(std::exception) override;
};
}
#endif // INCLUDED_VCL_INC_XCONNECTION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -88,6 +88,11 @@ void SalInstance::DestroyMenuItem( SalMenuItem* pItem )
OSL_ENSURE( pItem == nullptr, "DestroyMenu called with non-native menus" );
}
bool SalInstance::CallEventCallback( void* pEvent, int nBytes )
{
return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes );
}
SalTimer::~SalTimer()
{
}
......
......@@ -60,7 +60,7 @@
#include "salsys.hxx"
#include "svdata.hxx"
#include "salimestatus.hxx"
#include "xconnection.hxx"
#include "displayconnectiondispatch.hxx"
#include "window.h"
#include "accmgr.hxx"
#include "idlemgr.hxx"
......@@ -1573,7 +1573,7 @@ css::uno::Reference< css::awt::XDisplayConnection > Application::GetDisplayConne
if( !pSVData->mxDisplayConnection.is() )
{
pSVData->mxDisplayConnection.set( new vcl::DisplayConnection );
pSVData->mxDisplayConnection.set( new vcl::DisplayConnectionDispatch );
pSVData->mxDisplayConnection->start();
}
......
......@@ -70,7 +70,7 @@
#include "salsys.hxx"
#include "saltimer.hxx"
#include "salimestatus.hxx"
#include "xconnection.hxx"
#include "displayconnectiondispatch.hxx"
#include <config_features.h>
#if HAVE_FEATURE_OPENGL
......
......@@ -19,7 +19,7 @@
#include <vcl/svapp.hxx>
#include "xconnection.hxx"
#include "displayconnectiondispatch.hxx"
#include "svdata.hxx"
#include "salinst.hxx"
......@@ -28,7 +28,7 @@ using namespace vcl;
using namespace com::sun::star::uno;
using namespace com::sun::star::awt;
DisplayConnection::DisplayConnection()
DisplayConnectionDispatch::DisplayConnectionDispatch()
{
SalInstance::ConnectionIdentifierType eType;
int nBytes;
......@@ -44,17 +44,17 @@ DisplayConnection::DisplayConnection()
}
}
DisplayConnection::~DisplayConnection()
DisplayConnectionDispatch::~DisplayConnectionDispatch()
{}
void DisplayConnection::start()
void DisplayConnectionDispatch::start()
{
DBG_TESTSOLARMUTEX();
ImplSVData* pSVData = ImplGetSVData();
pSVData->mpDefInst->SetEventCallback( this );
}
void DisplayConnection::terminate()
void DisplayConnectionDispatch::terminate()
{
DBG_TESTSOLARMUTEX();
ImplSVData* pSVData = ImplGetSVData();
......@@ -73,40 +73,40 @@ void DisplayConnection::terminate()
(*it)->handleEvent( aEvent );
}
void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw(std::exception)
void SAL_CALL DisplayConnectionDispatch::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw(std::exception)
{
MutexGuard aGuard( m_aMutex );
m_aHandlers.push_back( handler );
}
void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw(std::exception)
void SAL_CALL DisplayConnectionDispatch::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw(std::exception)
{
MutexGuard aGuard( m_aMutex );
m_aHandlers.remove( handler );
}
void SAL_CALL DisplayConnection::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw(std::exception)
void SAL_CALL DisplayConnectionDispatch::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw(std::exception)
{
MutexGuard aGuard( m_aMutex );
m_aErrorHandlers.push_back( handler );
}
void SAL_CALL DisplayConnection::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw(std::exception)
void SAL_CALL DisplayConnectionDispatch::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw(std::exception)
{
MutexGuard aGuard( m_aMutex );
m_aErrorHandlers.remove( handler );
}
Any SAL_CALL DisplayConnection::getIdentifier() throw(std::exception)
Any SAL_CALL DisplayConnectionDispatch::getIdentifier() throw(std::exception)
{
return m_aAny;
}
bool DisplayConnection::dispatchEvent( void* pData, int nBytes )
bool DisplayConnectionDispatch::dispatchEvent( void* pData, int nBytes )
{
SolarMutexReleaser aRel;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment