core: begin using CFileDescriptor from hyprutils (#9122)
* config: make fd use CFileDescriptor make use of the new hyprutils CFileDescriptor instead of manual FD handling. * hyprctl: make fd use CFileDescriptor make use of the new hyprutils CFileDescriptor instead of manual FD handling. * ikeyboard: make fd use CFileDescriptor make use of the new CFileDescriptor instead of manual FD handling, also in sendKeymap remove dead code, it already early returns if keyboard isnt valid, and dont try to close the FD that ikeyboard owns. * core: make SHMFile functions use CFileDescriptor make SHMFile misc functions use CFileDescriptor and its associated usage in dmabuf and keyboard. * core: make explicit sync use CFileDescriptor begin using CFileDescriptor in explicit sync and its timelines and eglsync usage in opengl, there is still a bit left with manual handling that requires future aquamarine change aswell. * eventmgr: make fd and sockets use CFileDescriptor make use of the hyprutils CFileDescriptor instead of manual FD and socket handling and closing. * eventloopmgr: make timerfd use CFileDescriptor make the timerfd use CFileDescriptor instead of manual fd handling * opengl: make gbm fd use CFileDescriptor make the gbm rendernode fd use CFileDescriptor instead of manual fd handling * core: make selection source/offer use CFileDescriptor make data selection source and offers use CFileDescriptor and its associated use in xwm and protocols * protocols: convert protocols fd to CFileDescriptor make most fd handling use CFileDescriptor in protocols * shm: make SHMPool use CfileDescriptor make SHMPool use CFileDescriptor instead of manual fd handling. * opengl: duplicate fd with CFileDescriptor duplicate fenceFD with CFileDescriptor duplicate instead. * xwayland: make sockets and fds use CFileDescriptor instead of manual opening/closing make sockets and fds use CFileDescriptor * keybindmgr: make sockets and fds use CFileDescriptor make sockets and fds use CFileDescriptor instead of manual handling.
This commit is contained in:
parent
7d1c78f4a3
commit
32c0fa2f2f
50 changed files with 422 additions and 526 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include "XDataSource.hpp"
|
||||
|
||||
#include <fcntl.h>
|
||||
using namespace Hyprutils::OS;
|
||||
|
||||
CXDataSource::CXDataSource(SXSelection& sel_) : selection(sel_) {
|
||||
xcb_get_property_cookie_t cookie = xcb_get_property(g_pXWayland->pWM->connection,
|
||||
|
|
@ -47,7 +48,7 @@ std::vector<std::string> CXDataSource::mimes() {
|
|||
return mimeTypes;
|
||||
}
|
||||
|
||||
void CXDataSource::send(const std::string& mime, uint32_t fd) {
|
||||
void CXDataSource::send(const std::string& mime, CFileDescriptor fd) {
|
||||
xcb_atom_t mimeAtom = 0;
|
||||
|
||||
if (mime == "text/plain")
|
||||
|
|
@ -65,11 +66,10 @@ void CXDataSource::send(const std::string& mime, uint32_t fd) {
|
|||
|
||||
if (!mimeAtom) {
|
||||
Debug::log(ERR, "[XDataSource] mime atom not found");
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug::log(LOG, "[XDataSource] send with mime {} to fd {}", mime, fd);
|
||||
Debug::log(LOG, "[XDataSource] send with mime {} to fd {}", mime, fd.get());
|
||||
|
||||
selection.transfer = makeUnique<SXTransfer>(selection);
|
||||
selection.transfer->incomingWindow = xcb_generate_id(g_pXWayland->pWM->connection);
|
||||
|
|
@ -81,8 +81,9 @@ void CXDataSource::send(const std::string& mime, uint32_t fd) {
|
|||
|
||||
xcb_flush(g_pXWayland->pWM->connection);
|
||||
|
||||
fcntl(fd, F_SETFL, O_WRONLY | O_NONBLOCK);
|
||||
selection.transfer->wlFD = fd;
|
||||
//TODO: make CFileDescriptor setflags take SETFL aswell
|
||||
fcntl(fd.get(), F_SETFL, O_WRONLY | O_NONBLOCK);
|
||||
selection.transfer->wlFD = std::move(fd);
|
||||
}
|
||||
|
||||
void CXDataSource::accepted(const std::string& mime) {
|
||||
|
|
@ -101,4 +102,4 @@ eDataSourceType CXDataSource::type() {
|
|||
return DATA_SOURCE_TYPE_X11;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue