mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 21:27:20 +03:00
Merge branch 'hyprwm:main' into add-hyprctl-header
This commit is contained in:
commit
426d8e8bd5
@ -11,11 +11,11 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
|||||||
| (-q | --quiet) "Disable output"
|
| (-q | --quiet) "Disable output"
|
||||||
;
|
;
|
||||||
|
|
||||||
<WINDOWS> ::= {{{ hyprctl clients | grep class | awk '{print $2}' }}};
|
<WINDOWS> ::= {{{ hyprctl clients | awk '/class/{print $2}' }}};
|
||||||
|
|
||||||
<AVAILABLE_PLUGINS> ::= {{{ hyprpm list | grep "Plugin" | awk '{print $4}' }}};
|
<AVAILABLE_PLUGINS> ::= {{{ hyprpm list | awk '/Plugin/{print $4}' }}};
|
||||||
|
|
||||||
<MONITORS> ::= {{{ hyprctl monitors | grep Monitor | awk '{ print $2 }' }}};
|
<MONITORS> ::= {{{ hyprctl monitors | awk '/Monitor/{ print $2 }' }}};
|
||||||
|
|
||||||
<KEYBOARDS> ::= {{{ hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}' }}};
|
<KEYBOARDS> ::= {{{ hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}' }}};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
_hyprpm_cmd_0 () {
|
_hyprpm_cmd_0 () {
|
||||||
hyprpm list | grep Plugin | awk '{print $4}'
|
hyprpm list | awk '/Plugin/{print $4}'
|
||||||
}
|
}
|
||||||
|
|
||||||
_hyprpm () {
|
_hyprpm () {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
function _hyprpm_1
|
function _hyprpm_1
|
||||||
set 1 $argv[1]
|
set 1 $argv[1]
|
||||||
hyprpm list | grep Plugin | awk '{print $4}'
|
hyprpm list | awk '/Plugin/{print $4}'
|
||||||
end
|
end
|
||||||
|
|
||||||
function _hyprpm
|
function _hyprpm
|
||||||
|
@ -16,4 +16,4 @@ hyprpm [<FLAGS>]... <ARGUMENT>
|
|||||||
| (reload) "Reload all plugins"
|
| (reload) "Reload all plugins"
|
||||||
;
|
;
|
||||||
|
|
||||||
<PLUGINS> ::= {{{ hyprpm list | grep Plugin | awk '{print $4}' }}};
|
<PLUGINS> ::= {{{ hyprpm list | awk '/Plugin/{print $4}' }}};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#compdef hyprpm
|
#compdef hyprpm
|
||||||
|
|
||||||
_hyprpm_cmd_0 () {
|
_hyprpm_cmd_0 () {
|
||||||
hyprpm list | grep Plugin | awk '{print $4}'
|
hyprpm list | awk '/Plugin/{print $4}'
|
||||||
}
|
}
|
||||||
|
|
||||||
_hyprpm () {
|
_hyprpm () {
|
||||||
|
@ -413,7 +413,7 @@ void CCompositor::initManagers(eManagersInitStage stage) {
|
|||||||
switch (stage) {
|
switch (stage) {
|
||||||
case STAGE_PRIORITY: {
|
case STAGE_PRIORITY: {
|
||||||
Debug::log(LOG, "Creating the EventLoopManager!");
|
Debug::log(LOG, "Creating the EventLoopManager!");
|
||||||
g_pEventLoopManager = std::make_unique<CEventLoopManager>();
|
g_pEventLoopManager = std::make_unique<CEventLoopManager>(m_sWLDisplay, m_sWLEventLoop);
|
||||||
|
|
||||||
Debug::log(LOG, "Creating the HookSystem!");
|
Debug::log(LOG, "Creating the HookSystem!");
|
||||||
g_pHookSystem = std::make_unique<CHookSystemManager>();
|
g_pHookSystem = std::make_unique<CHookSystemManager>();
|
||||||
@ -604,7 +604,7 @@ void CCompositor::startCompositor() {
|
|||||||
|
|
||||||
// This blocks until we are done.
|
// This blocks until we are done.
|
||||||
Debug::log(LOG, "Hyprland is ready, running the event loop!");
|
Debug::log(LOG, "Hyprland is ready, running the event loop!");
|
||||||
g_pEventLoopManager->enterLoop(m_sWLDisplay, m_sWLEventLoop);
|
g_pEventLoopManager->enterLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMonitor* CCompositor::getMonitorFromID(const int& id) {
|
CMonitor* CCompositor::getMonitorFromID(const int& id) {
|
||||||
|
@ -1374,20 +1374,21 @@ void CKeybindManager::moveActiveTo(std::string args) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (PLASTWINDOW->m_bIsFloating) {
|
if (PLASTWINDOW->m_bIsFloating) {
|
||||||
Vector2D vPos;
|
std::optional<float> vPosx, vPosy;
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PLASTWINDOW->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(PLASTWINDOW->m_iMonitorID);
|
||||||
const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
|
const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
|
||||||
|
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case 'l': vPos.x = PMONITOR->vecReservedTopLeft.x + BORDERSIZE + PMONITOR->vecPosition.x; break;
|
case 'l': vPosx = PMONITOR->vecReservedTopLeft.x + BORDERSIZE + PMONITOR->vecPosition.x; break;
|
||||||
case 'r': vPos.x = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize.goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break;
|
case 'r': vPosx = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize.goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break;
|
||||||
case 't':
|
case 't':
|
||||||
case 'u': vPos.y = PMONITOR->vecReservedTopLeft.y + BORDERSIZE + PMONITOR->vecPosition.y; break;
|
case 'u': vPosy = PMONITOR->vecReservedTopLeft.y + BORDERSIZE + PMONITOR->vecPosition.y; break;
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'd': vPos.y = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize.goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break;
|
case 'd': vPosy = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize.goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLASTWINDOW->m_vRealPosition = Vector2D(vPos.x != 0 ? vPos.x : PLASTWINDOW->m_vRealPosition.goal().x, vPos.y != 0 ? vPos.y : PLASTWINDOW->m_vRealPosition.goal().y);
|
PLASTWINDOW->m_vRealPosition = Vector2D(vPosx.value_or(PLASTWINDOW->m_vRealPosition.goal().x), vPosy.value_or(PLASTWINDOW->m_vRealPosition.goal().y));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../protocols/PointerGestures.hpp"
|
#include "../protocols/PointerGestures.hpp"
|
||||||
#include "../protocols/FractionalScale.hpp"
|
#include "../protocols/FractionalScale.hpp"
|
||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../protocols/core/Compositor.hpp"
|
||||||
|
#include "eventLoop/EventLoopManager.hpp"
|
||||||
#include "SeatManager.hpp"
|
#include "SeatManager.hpp"
|
||||||
#include <wlr/interfaces/wlr_output.h>
|
#include <wlr/interfaces/wlr_output.h>
|
||||||
#include <wlr/render/interface.h>
|
#include <wlr/render/interface.h>
|
||||||
@ -139,8 +140,8 @@ CPointerManager::CPointerManager() {
|
|||||||
|
|
||||||
onMonitorLayoutChange();
|
onMonitorLayoutChange();
|
||||||
|
|
||||||
PMONITOR->events.modeChanged.registerStaticListener([this](void* owner, std::any data) { onMonitorLayoutChange(); }, nullptr);
|
PMONITOR->events.modeChanged.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr);
|
||||||
PMONITOR->events.disconnect.registerStaticListener([this](void* owner, std::any data) { onMonitorLayoutChange(); }, nullptr);
|
PMONITOR->events.disconnect.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr);
|
||||||
PMONITOR->events.destroy.registerStaticListener(
|
PMONITOR->events.destroy.registerStaticListener(
|
||||||
[this](void* owner, std::any data) {
|
[this](void* owner, std::any data) {
|
||||||
if (g_pCompositor && !g_pCompositor->m_bIsShuttingDown)
|
if (g_pCompositor && !g_pCompositor->m_bIsShuttingDown)
|
||||||
|
@ -9,8 +9,10 @@
|
|||||||
|
|
||||||
#define TIMESPEC_NSEC_PER_SEC 1000000000L
|
#define TIMESPEC_NSEC_PER_SEC 1000000000L
|
||||||
|
|
||||||
CEventLoopManager::CEventLoopManager() {
|
CEventLoopManager::CEventLoopManager(wl_display* display, wl_event_loop* wlEventLoop) {
|
||||||
m_sTimers.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
|
m_sTimers.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
|
||||||
|
m_sWayland.loop = wlEventLoop;
|
||||||
|
m_sWayland.display = display;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEventLoopManager::~CEventLoopManager() {
|
CEventLoopManager::~CEventLoopManager() {
|
||||||
@ -23,13 +25,10 @@ static int timerWrite(int fd, uint32_t mask, void* data) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEventLoopManager::enterLoop(wl_display* display, wl_event_loop* wlEventLoop) {
|
void CEventLoopManager::enterLoop() {
|
||||||
m_sWayland.loop = wlEventLoop;
|
m_sWayland.eventSource = wl_event_loop_add_fd(m_sWayland.loop, m_sTimers.timerfd, WL_EVENT_READABLE, timerWrite, nullptr);
|
||||||
m_sWayland.display = display;
|
|
||||||
|
|
||||||
m_sWayland.eventSource = wl_event_loop_add_fd(wlEventLoop, m_sTimers.timerfd, WL_EVENT_READABLE, timerWrite, nullptr);
|
wl_display_run(m_sWayland.display);
|
||||||
|
|
||||||
wl_display_run(display);
|
|
||||||
|
|
||||||
Debug::log(LOG, "Kicked off the event loop! :(");
|
Debug::log(LOG, "Kicked off the event loop! :(");
|
||||||
}
|
}
|
||||||
@ -87,3 +86,24 @@ void CEventLoopManager::nudgeTimers() {
|
|||||||
|
|
||||||
timerfd_settime(m_sTimers.timerfd, TFD_TIMER_ABSTIME, &ts, nullptr);
|
timerfd_settime(m_sTimers.timerfd, TFD_TIMER_ABSTIME, &ts, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEventLoopManager::doLater(const std::function<void()>& fn) {
|
||||||
|
m_sIdle.fns.emplace_back(fn);
|
||||||
|
|
||||||
|
if (m_sIdle.eventSource)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_sIdle.eventSource = wl_event_loop_add_idle(
|
||||||
|
m_sWayland.loop,
|
||||||
|
[](void* data) {
|
||||||
|
auto IDLE = (CEventLoopManager::SIdleData*)data;
|
||||||
|
auto cpy = IDLE->fns;
|
||||||
|
IDLE->fns.clear();
|
||||||
|
IDLE->eventSource = nullptr;
|
||||||
|
for (auto& c : cpy) {
|
||||||
|
if (c)
|
||||||
|
c();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
&m_sIdle);
|
||||||
|
}
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
class CEventLoopManager {
|
class CEventLoopManager {
|
||||||
public:
|
public:
|
||||||
CEventLoopManager();
|
CEventLoopManager(wl_display* display, wl_event_loop* wlEventLoop);
|
||||||
~CEventLoopManager();
|
~CEventLoopManager();
|
||||||
|
|
||||||
void enterLoop(wl_display* display, wl_event_loop* wlEventLoop);
|
void enterLoop();
|
||||||
|
|
||||||
// Note: will remove the timer if the ptr is lost.
|
// Note: will remove the timer if the ptr is lost.
|
||||||
void addTimer(SP<CEventLoopTimer> timer);
|
void addTimer(SP<CEventLoopTimer> timer);
|
||||||
@ -23,6 +23,14 @@ class CEventLoopManager {
|
|||||||
// recalculates timers
|
// recalculates timers
|
||||||
void nudgeTimers();
|
void nudgeTimers();
|
||||||
|
|
||||||
|
// schedules a function to run later, aka in a wayland idle event.
|
||||||
|
void doLater(const std::function<void()>& fn);
|
||||||
|
|
||||||
|
struct SIdleData {
|
||||||
|
wl_event_source* eventSource = nullptr;
|
||||||
|
std::vector<std::function<void()>> fns;
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct {
|
struct {
|
||||||
wl_event_loop* loop = nullptr;
|
wl_event_loop* loop = nullptr;
|
||||||
@ -34,6 +42,8 @@ class CEventLoopManager {
|
|||||||
std::vector<SP<CEventLoopTimer>> timers;
|
std::vector<SP<CEventLoopTimer>> timers;
|
||||||
int timerfd = -1;
|
int timerfd = -1;
|
||||||
} m_sTimers;
|
} m_sTimers;
|
||||||
|
|
||||||
|
SIdleData m_sIdle;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CEventLoopManager> g_pEventLoopManager;
|
inline std::unique_ptr<CEventLoopManager> g_pEventLoopManager;
|
@ -599,10 +599,10 @@ void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) {
|
|||||||
if (t->tool != tool || !t->current)
|
if (t->tool != tool || !t->current)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
t->current = false;
|
|
||||||
t->lastSurf.reset();
|
t->lastSurf.reset();
|
||||||
t->resource->sendProximityOut();
|
t->resource->sendProximityOut();
|
||||||
t->sendFrame();
|
t->sendFrame();
|
||||||
|
t->current = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user