From 0f31a5d91f13bd6a574bed8db894a7ebb2813292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 26 Apr 2013 08:42:17 +0200 Subject: Introduce QXcbXSettings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows you to easily retrieve properties in the XSETTINGS specification. It is also possible to add listeners to get notified when a specific property changes. XSETTINGS is lazy initialized, so it will not be instansiated before someone uses it. For now the intended use is a fallback for finding cursor theme Change-Id: Id47f0613f5876424cd47d721b40da17d3f63429e Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbxsettings.h | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/plugins/platforms/xcb/qxcbxsettings.h (limited to 'src/plugins/platforms/xcb/qxcbxsettings.h') diff --git a/src/plugins/platforms/xcb/qxcbxsettings.h b/src/plugins/platforms/xcb/qxcbxsettings.h new file mode 100644 index 0000000000..16fed862bc --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbxsettings.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBXSETTINGS_H +#define QXCBXSETTINGS_H + +#include "qxcbscreen.h" + +QT_BEGIN_NAMESPACE + +class QXcbXSettingsPrivate; + +class QXcbXSettings : public QXcbWindowEventListener +{ + Q_DECLARE_PRIVATE(QXcbXSettings) +public: + QXcbXSettings(QXcbScreen *screen); + + QVariant setting(const QByteArray &property) const; + + typedef void (*PropertyChangeFunc)(QXcbScreen *screen, const QByteArray &name, const QVariant &property, void *handle); + void registerCallbackForProperty(const QByteArray &property, PropertyChangeFunc func, void *handle); + void removeCallbackForHandle(const QByteArray &property, void *handle); + void removeCallbackForHandle(void *handle); + + void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE; +private: + QXcbXSettingsPrivate *d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QXCBXSETTINGS_H -- cgit v1.2.3