Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if(enable-wayland)
connection/waylandinputmethodconnection.cpp
connection/waylandinputmethodconnection.h)

ecm_add_qtwayland_client_protocol(CONNECTION_SOURCES PROTOCOL ${WAYLANDPROTOCOLS_PATH}/unstable/input-method/input-method-unstable-v1.xml BASENAME input-method-unstable-v1)
ecm_add_qtwayland_client_protocol(CONNECTION_SOURCES PROTOCOL ${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml BASENAME input-method-unstable-v1)

add_definitions(-DHAVE_WAYLAND)
endif()
Expand Down Expand Up @@ -309,7 +309,7 @@ if(enable-wayland)
src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.cpp
src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.h src/qt/plugins/shellintegration/qwaylandinputpanelsurface.cpp src/qt/plugins/shellintegration/qwaylandinputpanelsurface.h)

ecm_add_qtwayland_client_protocol(INPUT_PANEL_SHELL_SOURCES PROTOCOL ${WAYLANDPROTOCOLS_PATH}/unstable/input-method/input-method-unstable-v1.xml BASENAME input-method-unstable-v1)
ecm_add_qtwayland_client_protocol(INPUT_PANEL_SHELL_SOURCES PROTOCOL ${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml BASENAME input-method-unstable-v1)

add_library(inputpanel-shell MODULE ${INPUT_PANEL_SHELL_SOURCES})
target_link_libraries(inputpanel-shell Qt5::WaylandClient PkgConfig::XKBCOMMON Wayland::Client)
Expand All @@ -320,7 +320,7 @@ if(enable-wayland)
src/gtk/plugins/im-module/gtkimcontextwayland.c
src/gtk/plugins/im-module/gtkimcontextwayland.h
src/gtk/plugins/im-module/imwayland.c)
ecm_add_wayland_client_protocol(IM_WAYLAND_SOURCES PROTOCOL ${WAYLANDPROTOCOLS_PATH}/unstable/text-input/text-input-unstable-v1.xml BASENAME text-input-unstable-v1)
ecm_add_wayland_client_protocol(IM_WAYLAND_SOURCES PROTOCOL ${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v1.xml BASENAME text-input-unstable-v1)
target_sources(im-wayland PRIVATE ${IM_WAYLAND_SOURCES})
target_link_libraries(im-wayland Gtk3::Gtk)
endif()
Expand Down
65 changes: 32 additions & 33 deletions cmake/FindWaylandProtocols.cmake
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
#.rst:
# FindWaylandProtocols
# -------
# SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <[email protected]>
#
# Find wayland protocol description files
#
# Try to find wayland protocol files. The following values are defined
#
# ::
#
# WAYLANDPROTOCOLS_FOUND - True if wayland protocol files are available
# WAYLANDPROTOCOLS_PATH - Path to wayland protocol files
#
#=============================================================================
# Copyright (c) 2015 Jari Vetoniemi
#
# Distributed under the OSI-approved BSD License (the "License");
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# SPDX-License-Identifier: BSD-3-Clause

include(FeatureSummary)
set_package_properties(WaylandProtocols PROPERTIES
URL "https://cgit.freedesktop.org/wayland/wayland-protocols"
DESCRIPTION "Wayland protocol development")
#[=======================================================================[.rst:
FindWaylandProtocols
--------------------

Try to find wayland-protocols on a Unix system.

This will define the following variables:

``WaylandProtocols_FOUND``
True if (the requested version of) wayland-protocols is available
``WaylandProtocols_VERSION``
The version of wayland-protocols
``WaylandProtocols_DATADIR``
The wayland protocols data directory
#]=======================================================================]

unset(WAYLANDPROTOCOLS_PATH)
find_package(PkgConfig QUIET)
pkg_check_modules(PKG_wayland_protocols QUIET wayland-protocols)

find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols
OUTPUT_VARIABLE WAYLANDPROTOCOLS_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
endif ()
set(WaylandProtocols_VERSION ${PKG_wayland_protocols_VERSION})
pkg_get_variable(WaylandProtocols_DATADIR wayland-protocols pkgdatadir)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WaylandProtocols DEFAULT_MSG WAYLANDPROTOCOLS_PATH)
mark_as_advanced(WAYLANDPROTOCOLS_PATH)
find_package_handle_standard_args(WaylandProtocols
FOUND_VAR WaylandProtocols_FOUND
REQUIRED_VARS WaylandProtocols_DATADIR
VERSION_VAR WaylandProtocols_VERSION
)

include(FeatureSummary)
set_package_properties(WaylandProtocols PROPERTIES
DESCRIPTION "Specifications of extended Wayland protocols"
URL "https://wayland.freedesktop.org/"
)
24 changes: 23 additions & 1 deletion src/qt/plugins/shellintegration/qwaylandinputpanelsurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ QWaylandInputPanelSurface::QWaylandInputPanelSurface(struct ::zwp_input_panel_su
, QtWayland::zwp_input_panel_surface_v1(object)
{
qCDebug(qLcQpaShellIntegration) << Q_FUNC_INFO;
window->applyConfigureWhenPossible();
}

QWaylandInputPanelSurface::~QWaylandInputPanelSurface()
Expand All @@ -37,6 +36,29 @@ QWaylandInputPanelSurface::~QWaylandInputPanelSurface()
void QWaylandInputPanelSurface::applyConfigure()
{
set_toplevel(window()->waylandScreen()->output(), position_center_bottom);
window()->resizeFromApplyConfigure(m_pendingSize);
}

bool QWaylandInputPanelSurface::isExposed() const
{
return m_configured;
}

void QWaylandInputPanelSurface::zwp_input_panel_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height)
{
ack_configure(serial);

m_pendingSize = QSize(width, height);

if (!m_configured) {
m_configured = true;
window()->resizeFromApplyConfigure(m_pendingSize);
window()->handleExpose(QRect(QPoint(), m_pendingSize));
} else {
// Later configures are resizes, so we have to queue them up for a time when we
// are not painting to the window.
window()->applyConfigureWhenPossible();
}
}

}
Expand Down
8 changes: 8 additions & 0 deletions src/qt/plugins/shellintegration/qwaylandinputpanelsurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ class QWaylandInputPanelSurface : public QWaylandShellSurface, public QtWayland:
~QWaylandInputPanelSurface() override;

void applyConfigure() override;

bool isExposed() const override;

private:
void zwp_input_panel_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;

QSize m_pendingSize;
bool m_configured = false;
};

}
Expand Down