Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
droidmonkey committed Nov 26, 2024
1 parent 11a95b3 commit 2f03e4f
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ if(NOT WITH_XC_NETWORKING AND WITH_XC_UPDATECHECK)
set(WITH_XC_UPDATECHECK OFF)
endif()

if(UNIX AND NOT APPLE AND NOT WITH_XC_X11)
message(STATUS "Disabling WITH_XC_AUTOTYPE because WITH_XC_X11 is disabled")
set(WITH_XC_AUTOTYPE OFF)
endif()

set(KEEPASSXC_VERSION_MAJOR "2")
set(KEEPASSXC_VERSION_MINOR "8")
set(KEEPASSXC_VERSION_PATCH "0")
Expand Down
32 changes: 30 additions & 2 deletions cmake/FindXkbcommon.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
# Copyright (C) 2021 KeePassXC Team <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 or (at your option)
# version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

find_package(PkgConfig)
pkg_check_modules(Xkbcommon xkbcommon)
# This only works with CMake 3.18 and newer
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18")
find_package(PkgConfig QUIET)
pkg_check_modules(Xkbcommon xkbcommon)
endif()

if(NOT Xkbcommon_FOUND)
find_path(Xkbcommon_INCLUDE_DIRS xkbcommon/xkbcommon.h)
find_library(Xkbcommon_LIBRARIES xkbcommon)

if(Xkbcommon_INCLUDE_DIRS AND Xkbcommon_LIBRARIES)
set(Xkbcommon_FOUND TRUE)
endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Xkbcommon DEFAULT_MSG Xkbcommon_LIBRARIES Xkbcommon_INCLUDE_DIRS)

mark_as_advanced(Xkbcommon_LIBRARIES Xkbcommon_INCLUDE_DIRS)
2 changes: 1 addition & 1 deletion src/autotype/AutoType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
return;
}

if (m_windowTitleForGlobal.isEmpty() && QApplication::platformName().compare("wayland", Qt::CaseInsensitive) == 0) {
if (m_windowTitleForGlobal.isEmpty() && QApplication::platformName().compare("wayland", Qt::CaseInsensitive) != 0) {
m_inGlobalAutoTypeDialog.unlock();
return;
}
Expand Down
32 changes: 24 additions & 8 deletions src/autotype/wayland/AutoTypeWayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ void AutoTypePlatformWayland::handleCreateSession(uint response, QVariantMap res

QVariantMap selectDevicesOptions{
{"handle_token", selectDevicesRequestHandle},
{"types", uint(1)},
{"persist_mode", uint(2)},
{"types", QVariant::fromValue(1)},
{"persist_mode", QVariant::fromValue(2)},
};

// TODO: Store restore token in database/some other persistent data so the dialog doesn't appear every launch
if (!m_restore_token.isEmpty()) {
selectDevicesOptions.insert("restore_token", m_restore_token);
}

m_remote_desktop.call("SelectDevices", m_session_handle, selectDevicesOptions);
m_remote_desktop.call("SelectDevices", QVariant::fromValue(m_session_handle), selectDevicesOptions);

QString startRequestHandle = generateToken();
m_handlers.insert(startRequestHandle,
Expand All @@ -93,7 +93,7 @@ void AutoTypePlatformWayland::handleCreateSession(uint response, QVariantMap res

// TODO: Pass window identifier here instead of empty string if we want the dialog to appear on top of the
// application window, need to be able to get active window and handle from Wayland
m_remote_desktop.call("Start", m_session_handle, "", startOptions);
m_remote_desktop.call("Start", QVariant::fromValue(m_session_handle), "", startOptions);
}
}

Expand Down Expand Up @@ -127,15 +127,31 @@ void AutoTypePlatformWayland::portalResponse(uint response, QVariantMap results,
AutoTypeAction::Result AutoTypePlatformWayland::sendKey(xkb_keysym_t keysym, QVector<xkb_keysym_t> modifiers)
{
for (auto modifier : modifiers) {
m_remote_desktop.call("NotifyKeyboardKeysym", m_session_handle, QVariantMap(), int(modifier), uint(1));
m_remote_desktop.call("NotifyKeyboardKeysym",
QVariant::fromValue(m_session_handle),
QVariantMap(),
QVariant::fromValue(modifier),
QVariant::fromValue(1));
}

m_remote_desktop.call("NotifyKeyboardKeysym", m_session_handle, QVariantMap(), int(keysym), uint(1));
m_remote_desktop.call("NotifyKeyboardKeysym",
QVariant::fromValue(m_session_handle),
QVariantMap(),
QVariant::fromValue(keysym),
QVariant::fromValue(1));

m_remote_desktop.call("NotifyKeyboardKeysym", m_session_handle, QVariantMap(), int(keysym), uint(0));
m_remote_desktop.call("NotifyKeyboardKeysym",
QVariant::fromValue(m_session_handle),
QVariantMap(),
QVariant::fromValue(keysym),
QVariant::fromValue(0));

for (auto modifier : modifiers) {
m_remote_desktop.call("NotifyKeyboardKeysym", m_session_handle, QVariantMap(), int(modifier), uint(0));
m_remote_desktop.call("NotifyKeyboardKeysym",
QVariant::fromValue(m_session_handle),
QVariantMap(),
QVariant::fromValue(modifier),
QVariant::fromValue(0));
}
return AutoTypeAction::Result::Ok();
}
Expand Down

0 comments on commit 2f03e4f

Please sign in to comment.