officecfg/registry/data/org/openoffice/VCL.xcu | 5 officecfg/registry/schema/org/openoffice/VCL.xcs | 10 + vcl/Library_vclplug_gen.mk | 1 vcl/unx/generic/dtrans/X11_selection.cxx | 10 + vcl/unx/generic/dtrans/X11_selection.hxx | 1 vcl/unx/generic/dtrans/config.cxx | 122 ----------------------- 6 files changed, 16 insertions(+), 133 deletions(-)
New commits: commit aecf1253fdc7b58ee4da7109799a0751897edc7e Author: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> AuthorDate: Sat May 10 11:33:40 2025 +0200 Commit: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> CommitDate: Tue Jun 17 19:49:23 2025 +0200 [API CHANGE] tdf#46037 Replace VCL Settings (SelectionTimeout) in order to simplify code. The flexibility provided by the ConfigurableSettings template is not really necessary for the simple settings VCL has Change-Id: I95827072b5c78b8b66d3101b0176d8ed5f85b626 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185172 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index 4ed4bdb528ba..6db713d69ca9 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -24,11 +24,6 @@ <value>false</value> </prop> </node> - <node oor:name="Transfer" oor:op="replace"> - <prop oor:name="SelectionTimeout" oor:type="xs:string" oor:op="replace"> - <value>3</value> - </prop> - </node> <node oor:name="Menu" oor:op="replace"> <prop oor:name="SuppressAccelerators" oor:type="xs:string" oor:op="replace"> <value>false</value> diff --git a/officecfg/registry/schema/org/openoffice/VCL.xcs b/officecfg/registry/schema/org/openoffice/VCL.xcs index fe878f851497..ac9652bc5d5e 100644 --- a/officecfg/registry/schema/org/openoffice/VCL.xcs +++ b/officecfg/registry/schema/org/openoffice/VCL.xcs @@ -104,5 +104,15 @@ <desc>Contains the localized font substitution tables for VCL (see template description).</desc> </info> </set> + <group oor:name="VCLSettings"> + <info> + <desc>Contains VCL-related configurations (print dialog, menus, etc.).</desc> + </info> + <group oor:name="Transfer"> + <prop oor:name="SelectionTimeout" oor:type="xs:int" oor:nillable="false"> + <value>3</value> + </prop> + </group> + </group> </component> </oor:component-schema> diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk index 2d314017bb8b..43b825c5eae2 100644 --- a/vcl/Library_vclplug_gen.mk +++ b/vcl/Library_vclplug_gen.mk @@ -89,7 +89,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\ vcl/unx/generic/app/sm \ vcl/unx/generic/app/wmadaptor \ vcl/unx/generic/dtrans/bmp \ - vcl/unx/generic/dtrans/config \ vcl/unx/generic/dtrans/X11_clipboard \ vcl/unx/generic/dtrans/X11_dndcontext \ vcl/unx/generic/dtrans/X11_droptarget \ diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 826e8fb96489..982adba77b78 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -68,6 +68,8 @@ #include <comphelper/solarmutex.hxx> #include <cppuhelper/supportsservice.hxx> +#include <officecfg/VCL.hxx> + #include <algorithm> constexpr auto DRAG_EVENT_MASK = ButtonPressMask | @@ -217,7 +219,6 @@ SelectionManager::SelectionManager() : m_aThread( nullptr ), m_aDragExecuteThread( nullptr ), m_aWindow( None ), - m_nSelectionTimeout( 0 ), m_nSelectionTimestamp( CurrentTime ), m_bDropEnterSent( true ), m_aCurrentDropWindow( None ), @@ -900,6 +901,7 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In tv_current = tv_last; XEvent aEvent; + auto nSelectionTimeout = officecfg::VCL::VCLSettings::Transfer::SelectionTimeout::get(); do { bool bAdjustTime = false; @@ -958,10 +960,10 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In gettimeofday( &tv_current, nullptr ); if( bAdjustTime ) tv_last = tv_current; - } while( ! it->second->m_aDataArrived.check() && (tv_current.tv_sec - tv_last.tv_sec) < getSelectionTimeout() ); + } while( ! it->second->m_aDataArrived.check() && (tv_current.tv_sec - tv_last.tv_sec) < nSelectionTimeout ); #if OSL_DEBUG_LEVEL > 1 - SAL_WARN_IF((tv_current.tv_sec - tv_last.tv_sec) > getSelectionTimeout(), + SAL_WARN_IF((tv_current.tv_sec - tv_last.tv_sec) > nSelectionTimeout, "vcl.unx.dtrans", "timed out."); #endif @@ -1952,7 +1954,7 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify std::vector< Atom > aTimeouts; for (auto const& incrementalTransfer : it->second) { - if( (nCurrentTime - incrementalTransfer.second.m_nTransferStartTime) > (getSelectionTimeout()+2) ) + if( (nCurrentTime - incrementalTransfer.second.m_nTransferStartTime) > (officecfg::VCL::VCLSettings::Transfer::SelectionTimeout::get()+2) ) { aTimeouts.push_back( incrementalTransfer.first ); #if OSL_DEBUG_LEVEL > 1 diff --git a/vcl/unx/generic/dtrans/X11_selection.hxx b/vcl/unx/generic/dtrans/X11_selection.hxx index ea7ac20c9479..5ec683990a0d 100644 --- a/vcl/unx/generic/dtrans/X11_selection.hxx +++ b/vcl/unx/generic/dtrans/X11_selection.hxx @@ -247,7 +247,6 @@ namespace x11 { css::uno::Reference< css::frame::XDesktop2 > m_xDesktop; css::uno::Reference< css::awt::XDisplayConnection > m_xDisplayConnection; - sal_Int32 m_nSelectionTimeout; Time m_nSelectionTimestamp; // members used for Xdnd diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx deleted file mode 100644 index c9ece3c8d988..000000000000 --- a/vcl/unx/generic/dtrans/config.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- 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 . - */ - -#include <o3tl/any.hxx> -#include <sal/log.hxx> -#include <unotools/configitem.hxx> - -#include "X11_selection.hxx" - -constexpr OUStringLiteral SETTINGS_CONFIGNODE = u"VCL/Settings/Transfer"; -constexpr OUString SELECTION_PROPERTY = u"SelectionTimeout"_ustr; - -namespace x11 -{ - -namespace { - -class DtransX11ConfigItem : public ::utl::ConfigItem -{ - sal_Int32 m_nSelectionTimeout; - - virtual void Notify( const css::uno::Sequence< OUString >& rPropertyNames ) override; - virtual void ImplCommit() override; - -public: - DtransX11ConfigItem(); - - sal_Int32 getSelectionTimeout() const { return m_nSelectionTimeout; } -}; - -} - -} - -using namespace com::sun::star::uno; -using namespace x11; - -sal_Int32 SelectionManager::getSelectionTimeout() -{ - if( m_nSelectionTimeout < 1 ) - { - DtransX11ConfigItem aCfg; - m_nSelectionTimeout = aCfg.getSelectionTimeout(); -#if OSL_DEBUG_LEVEL > 1 - SAL_INFO("vcl.unx.dtrans", "initialized selection timeout to " - << m_nSelectionTimeout - << " seconds."); -#endif - } - return m_nSelectionTimeout; -} - -/* - * DtransX11ConfigItem constructor - */ - -DtransX11ConfigItem::DtransX11ConfigItem() : - ConfigItem( SETTINGS_CONFIGNODE, - ConfigItemMode::NONE ), - m_nSelectionTimeout( 3 ) -{ - Sequence<OUString> aKeys { SELECTION_PROPERTY }; - const Sequence< Any > aValues = GetProperties( aKeys ); -#if OSL_DEBUG_LEVEL > 1 - SAL_INFO("vcl.unx.dtrans", "found " - << aValues.getLength() - << " properties for " - << SELECTION_PROPERTY); -#endif - for( Any const & value : aValues ) - { - if( auto pLine = o3tl::tryAccess<OUString>(value) ) - { - if( !pLine->isEmpty() ) - { - m_nSelectionTimeout = pLine->toInt32(); - if( m_nSelectionTimeout < 1 ) - m_nSelectionTimeout = 1; - } -#if OSL_DEBUG_LEVEL > 1 - SAL_INFO("vcl.unx.dtrans", "found SelectionTimeout \"" << *pLine << "\"."); -#endif - } -#if OSL_DEBUG_LEVEL > 1 - else - SAL_INFO("vcl.unx.dtrans", "found SelectionTimeout of type \"" - << value.getValueTypeName() << "\"."); -#endif - } -} - -void DtransX11ConfigItem::ImplCommit() -{ - // for the clipboard service this is readonly, so - // there is nothing to commit -} - -/* - * DtransX11ConfigItem::Notify - */ - -void DtransX11ConfigItem::Notify( const Sequence< OUString >& /*rPropertyNames*/ ) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */