Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a wayland input panel shell integration
Move all the wayland input panel code there. Allows to start QT_WAYLAND_SHELL_INTEGRATION=inputpanel-shell maliit-keyboard to get it started as input panel instead of previous hacks.
- Loading branch information
Showing
8 changed files
with
246 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"Keys":[ "inputpanel-shell" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2017 Jan Arne Petersen | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it 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. | ||
*/ | ||
|
||
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h> | ||
|
||
#include "qwaylandinputpanelshellintegration.h" | ||
|
||
QT_BEGIN_NAMESPACE | ||
|
||
namespace QtWaylandClient | ||
{ | ||
|
||
class QWaylandInputPanelShellIntegrationPlugin: public QWaylandShellIntegrationPlugin | ||
{ | ||
Q_OBJECT | ||
Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "inputpanelshell.json") | ||
|
||
public: | ||
virtual QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; | ||
}; | ||
|
||
QWaylandShellIntegration *QWaylandInputPanelShellIntegrationPlugin::create(const QString &key, const QStringList ¶mList) | ||
{ | ||
Q_UNUSED(key); | ||
Q_UNUSED(paramList); | ||
return new QWaylandInputPanelShellIntegration(); | ||
} | ||
|
||
} | ||
|
||
QT_END_NAMESPACE | ||
|
||
#include "inputpanelshellplugin.moc" |
54 changes: 54 additions & 0 deletions
54
src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2017 Jan Arne Petersen | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it 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. | ||
*/ | ||
|
||
#include "qwaylandinputpanelshellintegration.h" | ||
|
||
#include <QtWaylandClient/private/qwaylandwindow_p.h> | ||
|
||
#include "qwaylandinputpanelsurface.h" | ||
|
||
QT_BEGIN_NAMESPACE | ||
|
||
namespace QtWaylandClient | ||
{ | ||
|
||
QWaylandInputPanelShellIntegration::QWaylandInputPanelShellIntegration() | ||
: QWaylandShellIntegration() | ||
{ | ||
} | ||
|
||
QWaylandInputPanelShellIntegration::~QWaylandInputPanelShellIntegration() | ||
{ | ||
} | ||
|
||
bool QWaylandInputPanelShellIntegration::initialize(QWaylandDisplay *display) | ||
{ | ||
auto result = QWaylandShellIntegration::initialize(display); | ||
const auto globals = display->globals(); | ||
for (auto global: globals) { | ||
if (global.interface == QLatin1String("zwp_input_panel_v1")) { | ||
m_panel.reset(new QtWayland::zwp_input_panel_v1(display->wl_registry(), global.id, 1)); | ||
break; | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
QWaylandShellSurface * | ||
QWaylandInputPanelShellIntegration::createShellSurface(QWaylandWindow *window) | ||
{ | ||
struct zwp_input_panel_surface_v1 *ip_surface = m_panel->get_input_panel_surface(window->object()); | ||
|
||
return new QWaylandInputPanelSurface(ip_surface, window); | ||
} | ||
|
||
} | ||
|
||
QT_END_NAMESPACE |
40 changes: 40 additions & 0 deletions
40
src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2017 Jan Arne Petersen | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it 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. | ||
*/ | ||
|
||
#ifndef QWAYLANDINPUTPANELSHELLINTEGRATION_H | ||
#define QWAYLANDINPUTPANELSHELLINTEGRATION_H | ||
|
||
#include <QtWaylandClient/private/qwaylandshellintegration_p.h> | ||
|
||
#include "qwayland-input-method-unstable-v1.h" | ||
|
||
QT_BEGIN_NAMESPACE | ||
|
||
namespace QtWaylandClient | ||
{ | ||
|
||
class QWaylandInputPanelShellIntegration: public QWaylandShellIntegration | ||
{ | ||
public: | ||
QWaylandInputPanelShellIntegration(); | ||
~QWaylandInputPanelShellIntegration() override; | ||
|
||
bool initialize(QWaylandDisplay *display) override; | ||
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; | ||
|
||
private: | ||
QScopedPointer<QtWayland::zwp_input_panel_v1> m_panel; | ||
}; | ||
|
||
} | ||
|
||
QT_END_NAMESPACE | ||
|
||
#endif //QWAYLANDINPUTPANELSHELLINTEGRATION_H |
46 changes: 46 additions & 0 deletions
46
src/qt/plugins/shellintegration/qwaylandinputpanelsurface.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2017 Jan Arne Petersen | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it 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. | ||
*/ | ||
|
||
#include "qwaylandinputpanelsurface.h" | ||
|
||
#include <QtWaylandClient/private/qwaylandwindow_p.h> | ||
#include <QtWaylandClient/private/qwaylandscreen_p.h> | ||
|
||
QT_BEGIN_NAMESPACE | ||
|
||
Q_LOGGING_CATEGORY(qLcQpaShellIntegration, "qt.qpa.wayland.shell") | ||
|
||
namespace QtWaylandClient | ||
{ | ||
|
||
QWaylandInputPanelSurface::QWaylandInputPanelSurface(struct ::zwp_input_panel_surface_v1 *object, | ||
QWaylandWindow *window) | ||
: QWaylandShellSurface(window) | ||
, QtWayland::zwp_input_panel_surface_v1(object) | ||
{ | ||
qCDebug(qLcQpaShellIntegration) << Q_FUNC_INFO; | ||
} | ||
|
||
QWaylandInputPanelSurface::~QWaylandInputPanelSurface() | ||
{ | ||
qCDebug(qLcQpaShellIntegration) << Q_FUNC_INFO; | ||
} | ||
|
||
void QWaylandInputPanelSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) | ||
{ | ||
Q_UNUSED(type) | ||
Q_UNUSED(transientParent) | ||
|
||
set_toplevel(window()->screen()->output(), position_center_bottom); | ||
} | ||
|
||
} | ||
|
||
QT_END_NAMESPACE |
39 changes: 39 additions & 0 deletions
39
src/qt/plugins/shellintegration/qwaylandinputpanelsurface.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2017 Jan Arne Petersen | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it 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. | ||
*/ | ||
|
||
#ifndef QWAYLANDINPUTPANELSURFACE_H | ||
#define QWAYLANDINPUTPANELSURFACE_H | ||
|
||
#include "qwayland-input-method-unstable-v1.h" | ||
|
||
#include <QtCore/QLoggingCategory> | ||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h> | ||
|
||
QT_BEGIN_NAMESPACE | ||
|
||
Q_DECLARE_LOGGING_CATEGORY(qLcQpaShellIntegration) | ||
|
||
namespace QtWaylandClient | ||
{ | ||
|
||
class QWaylandInputPanelSurface : public QWaylandShellSurface, public QtWayland::zwp_input_panel_surface_v1 | ||
{ | ||
public: | ||
QWaylandInputPanelSurface(struct ::zwp_input_panel_surface_v1 *object, QWaylandWindow *window); | ||
~QWaylandInputPanelSurface() override; | ||
|
||
void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; | ||
}; | ||
|
||
} | ||
|
||
QT_END_NAMESPACE | ||
|
||
#endif //QWAYLANDINPUTPANELSURFACE_H |
Oops, something went wrong.