mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-09-15 07:48:23 +00:00
cleanup: Revert use doLater instead of adding idle event handlers (#8624)
This reverts commit 6d7544458d
.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include <algorithm>
|
||||
#include "../Compositor.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
#include "../managers/eventLoop/EventLoopManager.hpp"
|
||||
#include "core/Seat.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
#include <cstring>
|
||||
@@ -470,6 +469,8 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
|
||||
|
||||
CXDGSurfaceResource::~CXDGSurfaceResource() {
|
||||
events.destroy.emit();
|
||||
if (configureSource)
|
||||
wl_event_source_remove(configureSource);
|
||||
if (surface)
|
||||
surface->resetRole();
|
||||
}
|
||||
@@ -483,23 +484,22 @@ SP<CXDGSurfaceResource> CXDGSurfaceResource::fromResource(wl_resource* res) {
|
||||
return data ? data->self.lock() : nullptr;
|
||||
}
|
||||
|
||||
static void onConfigure(void* data) {
|
||||
((CXDGSurfaceResource*)data)->configure();
|
||||
}
|
||||
|
||||
uint32_t CXDGSurfaceResource::scheduleConfigure() {
|
||||
if (configureScheduled)
|
||||
if (configureSource)
|
||||
return scheduledSerial;
|
||||
|
||||
configureSource = wl_event_loop_add_idle(g_pCompositor->m_sWLEventLoop, onConfigure, this);
|
||||
scheduledSerial = wl_display_next_serial(g_pCompositor->m_sWLDisplay);
|
||||
|
||||
configureScheduled = true;
|
||||
g_pEventLoopManager->doLater([this]() { configure(); });
|
||||
|
||||
return scheduledSerial;
|
||||
}
|
||||
|
||||
void CXDGSurfaceResource::configure() {
|
||||
if (!resource)
|
||||
return;
|
||||
|
||||
configureScheduled = false;
|
||||
configureSource = nullptr;
|
||||
resource->sendConfigure(scheduledSerial);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user