From fd4b65c27f18256829ae521028dbb43b0db262ac Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sat, 1 Jul 2023 21:28:56 -0600 Subject: [PATCH] Minor fixes (#315) * Minor fixes * Fix #77 --- applications/system-service/buttonhandler.cpp | 1 + applications/system-service/digitizerhandler.h | 3 ++- applications/system-service/fifohandler.h | 5 +++-- applications/system-service/wifiapi.h | 7 +++++++ shared/liboxide/debug.h | 5 +++++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/applications/system-service/buttonhandler.cpp b/applications/system-service/buttonhandler.cpp index 517c4a2fe..cbb8693fa 100644 --- a/applications/system-service/buttonhandler.cpp +++ b/applications/system-service/buttonhandler.cpp @@ -86,6 +86,7 @@ void ButtonHandler::run(){ emit keyUp(map[ie.code].keyCode); } }else{ + qApp->processEvents(QEventLoop::AllEvents, 100); yieldCurrentThread(); } } diff --git a/applications/system-service/digitizerhandler.h b/applications/system-service/digitizerhandler.h index f9fe4222f..98bd5d3b8 100644 --- a/applications/system-service/digitizerhandler.h +++ b/applications/system-service/digitizerhandler.h @@ -146,7 +146,8 @@ class DigitizerHandler : public QThread { qDebug() << "Reading From : " << device.device.c_str() << " (" << name << ")"; qDebug() << "Listening for events..."; while(handle_events()){ - yieldCurrentThread(); + qApp->processEvents(QEventLoop::AllEvents, 100); + QThread::yieldCurrentThread(); } } bool handle_events(){ diff --git a/applications/system-service/fifohandler.h b/applications/system-service/fifohandler.h index 799856aed..205ba540b 100644 --- a/applications/system-service/fifohandler.h +++ b/applications/system-service/fifohandler.h @@ -77,12 +77,13 @@ class FifoHandler : public QObject { QString line(data.c_str()); line = line.trimmed(); emit dataRecieved(this, line); - thread()->yieldCurrentThread(); + qApp->processEvents(QEventLoop::AllEvents, 100); + QThread::yieldCurrentThread(); } if(in.eof()){ in.clear(); } - thread()->yieldCurrentThread(); + QThread::yieldCurrentThread(); } private: diff --git a/applications/system-service/wifiapi.h b/applications/system-service/wifiapi.h index f74d8cf43..05974c025 100644 --- a/applications/system-service/wifiapi.h +++ b/applications/system-service/wifiapi.h @@ -238,6 +238,10 @@ class WifiAPI : public APIBase { if(m_state == Off){ setState(Disconnected); } + if(system("rfkill unblock wifi")){ + qDebug() << "Failed to enable wifi devices"; + return false; + } for(auto wlan : wlans){ if(!wlan->isUp() && !wlan->up()){ qDebug() << "Failed to enable " + wlan->iface(); @@ -265,6 +269,9 @@ class WifiAPI : public APIBase { qDebug() << "Failed to disable " + wlan->iface(); } } + if(system("rfkill block wifi")){ + qDebug() << "Failed to disable wifi devices"; + } flushBSSCache(0); xochitlSettings.set_wifion(false); } diff --git a/shared/liboxide/debug.h b/shared/liboxide/debug.h index 84644e83c..7a12cec5f 100644 --- a/shared/liboxide/debug.h +++ b/shared/liboxide/debug.h @@ -13,6 +13,11 @@ * \brief Log a debug message if compiled with DEBUG mode, and debugging is enabled * \param msg Debug message to log */ +#ifndef DEBUG +#ifndef QT_NO_DEBUG +#define DEBUG +#endif +#endif #ifdef DEBUG #define O_DEBUG(msg) if(Oxide::debugEnabled()){ qDebug() << msg; } #else