Skip to content

Commit

Permalink
Terminal: use poll for PTY and window, Kernel: Fixed PTYDevice CanRea…
Browse files Browse the repository at this point in the history
…d() for master devices, LibLemon: More gfx fixes
  • Loading branch information
fido2020 committed Sep 9, 2020
1 parent d29461b commit 7b25efa
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Applications/Terminal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,14 @@ int main(char argc, char** argv){

ioctl(masterPTYFd, TIOCSWINSZ, &wSz);

std::vector<pollfd> fds;
fds.push_back({.fd = masterPTYFd, .events = POLLIN});

auto& wMHandler = window->GetHandler();
fds.insert(fds.begin(), wMHandler.GetFileDescriptors().begin(), wMHandler.GetFileDescriptors().end());
for(;;){
poll(fds.data(), fds.size(), -1);

Lemon::LemonEvent ev;
while(window->PollEvent(ev)){
if(ev.event == Lemon::EventKeyPressed){
Expand Down
2 changes: 1 addition & 1 deletion Kernel/include/fs/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class FsNode{
virtual void Sync(); // Sync node to device

virtual bool CanRead() { return true; }
virtual bool CanWrite() { return false; }
virtual bool CanWrite() { return true; }

FsNode* link;
FsNode* parent;
Expand Down
11 changes: 10 additions & 1 deletion Kernel/src/tty/pty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ int PTYDevice::Ioctl(uint64_t cmd, uint64_t arg){
return 0;
}

bool PTYDevice::CanRead() { return !(pty->IsCanonical() && !pty->slave.lines); };
bool PTYDevice::CanRead() {
if(device == PTYMasterDevice){
return !!pty->master.bufferPos;
} else if(device == PTYSlaveDevice){
if(pty->IsCanonical())
return !!pty->slave.lines;
else
return !!pty->slave.bufferPos;
}
}

PTY::PTY(){
slaveFile.flags = FS_NODE_CHARDEVICE;
Expand Down
4 changes: 2 additions & 2 deletions LibLemon/include/core/msghandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ namespace Lemon{
};

class MessageHandler {
public:
virtual std::vector<pollfd> GetFileDescriptors() = 0;
protected:
friend class MessageMultiplexer;

virtual std::vector<pollfd> GetFileDescriptors() = 0;

virtual ~MessageHandler() = default;
};

Expand Down
4 changes: 4 additions & 0 deletions LibLemon/src/gfx/sse2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ memcpy_sse2:
memcpy_sse2_unaligned:
xor rax, rax
mov rcx, rdx
test rcx, rcx
jz .ret
.loop:
movdqu xmm0, [rsi + rax]

Expand All @@ -32,6 +35,7 @@ memcpy_sse2_unaligned:
add rax, 0x10
loop .loop
.ret:
ret

memset32_sse2:
Expand Down
2 changes: 1 addition & 1 deletion System/LemonWM/lemonwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define CONTEXT_ITEM_WIDTH 128

//#define LEMONWM_USE_CLIPPING
#define LEMONWM_FRAMERATE_COUNTER
//#define LEMONWM_FRAMERATE_COUNTER

using WindowBuffer = Lemon::GUI::WindowBuffer;

Expand Down

0 comments on commit 7b25efa

Please sign in to comment.