mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-28 02:55:05 +00:00
Fixes greetd and hyprland ipc sockets reads being incomplete and breaking said integrations on slow machines.
27 lines
482 B
C++
27 lines
482 B
C++
#pragma once
|
|
|
|
#include <qbytearray.h>
|
|
#include <qiodevice.h>
|
|
#include <qtypes.h>
|
|
|
|
class StreamReader {
|
|
public:
|
|
void setDevice(QIODevice* device);
|
|
|
|
void startTransaction();
|
|
QByteArray readBytes(qsizetype count);
|
|
QByteArray readUntil(char terminator);
|
|
void readInto(char* ptr, qsizetype count);
|
|
qint32 readI32();
|
|
bool commitTransaction();
|
|
void reset();
|
|
|
|
private:
|
|
bool fill();
|
|
|
|
QIODevice* device = nullptr;
|
|
QByteArray buffer;
|
|
qsizetype cursor = 0;
|
|
bool failed = false;
|
|
};
|