0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-10-08 10:26:57 +00:00
Files
termux-packages/x11-packages/xfce4-docklike-plugin/src-Hotkeys.cpp.patch
Biswapriyo Nath 1592ec5833 bump(x11/xfce4-docklike-plugin): 0.4.3
Add required configure options explicitly for strict dependency checking.
2024-12-25 14:40:10 +05:30

49 lines
1.1 KiB
Diff

--- a/src/Hotkeys.cpp
+++ b/src/Hotkeys.cpp
@@ -9,6 +9,15 @@
#define ModifierChange 85 //? this event type isn't listed in libX11
+#ifdef __ANDROID__
+#include <signal.h>
+#include <string.h>
+static void threadSignalHandler(int signum)
+{
+ pthread_exit(0);
+}
+#endif
+
namespace Hotkeys
{
int mGrabbedKeys;
@@ -113,8 +122,17 @@
static void* threadedXIKeyListenner(void* data)
{
+#ifndef __ANDROID__
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, nullptr);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, nullptr);
+#else
+ struct sigaction actions;
+ memset(&actions, 0, sizeof(actions));
+ sigemptyset(&actions.sa_mask);
+ actions.sa_flags = 0;
+ actions.sa_handler = threadSignalHandler;
+ sigaction(SIGUSR2, &actions, nullptr);
+#endif
Display* display = XOpenDisplay(nullptr);
@@ -170,7 +170,11 @@
pthread_create(&mThread, nullptr, threadedXIKeyListenner, nullptr);
else if (mThread)
{
+#ifndef __ANDROID__
pthread_cancel(mThread); // also close the XDisplay in the thread
+#else
+ pthread_kill(mThread, SIGUSR2);
+#endif
void* ret = nullptr;
pthread_join(mThread, &ret);
mThread = 0;