Skip to content

Commit

Permalink
Minor WM and MessageEndpoint tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
fido2020 committed Mar 1, 2021
1 parent 909b03c commit 65ea239
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions Kernel/src/arch/x86_64/syscalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2519,6 +2519,7 @@ long SysEndpointQueue(RegisterContext* r){
Handle* endpHandle;
if(Scheduler::FindHandle(currentProcess, SC_ARG0(r), &endpHandle)){
Log::Warning("(%s): SysEndpointQueue: Invalid handle ID %d", currentProcess->name, SC_ARG0(r));
Log::Info("%x", r->rip);
UserPrintStackTrace(r->rbp, Scheduler::GetCurrentProcess()->addressSpace);

return -EINVAL;
Expand Down
6 changes: 5 additions & 1 deletion Kernel/src/objects/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ int64_t MessageEndpoint::Read(uint64_t* id, uint16_t* size, uint8_t* data){
if(*size){
size_t read = queue.Dequeue(data, *size);
if(read < *size){
Log::Warning("[MessageEndpoint] Draining message queue (expected %u bytes, only got %u)!", *size, read);
Log::Warning("[MessageEndpoint] Draining message queue (expected %u bytes, only got %u) (id: %u size:, %hu)!", *size, read, *id, *size);
queue.Drain(); // Not all data has been written, drain the buffer

releaseLock(&queueLock);

if(!peer.get()){
return -ENOTCONN;
}
return 0;
}
}
Expand Down
19 changes: 18 additions & 1 deletion System/LemonWM/wm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ void WMInstance::MinimizeWindow(WMWindow* win, bool state){
SetActive(nullptr);
}

if(lastMousedOver == win){
Lemon::LemonEvent ev;
ev.event = Lemon::EventMouseExit;

PostEvent(ev, win);

lastMousedOver = nullptr;
}

if(shellConnected && !(win->flags & WINDOW_FLAGS_NOSHELL))
Lemon::Shell::SetWindowState(win->clientID, Lemon::Shell::ShellWindowStateMinimized, shellClient);
}
Expand Down Expand Up @@ -82,7 +91,7 @@ void WMInstance::SetActive(WMWindow* win){

ev.event = Lemon::EventMouseExit;

PostEvent(ev, win);
PostEvent(ev, active);
}
}

Expand Down Expand Up @@ -136,6 +145,10 @@ void WMInstance::Poll(){
SetActive(nullptr);
}

if(lastMousedOver == win){
lastMousedOver = nullptr;
}

if(shellConnected && !(win->flags & WINDOW_FLAGS_NOSHELL)){
Lemon::Shell::RemoveWindow(client, shellClient);
}
Expand Down Expand Up @@ -211,6 +224,10 @@ void WMInstance::Poll(){
if(active == win){
SetActive(nullptr);
}

if(lastMousedOver == win){
lastMousedOver = nullptr;
}

if(shellConnected && !(win->flags & WINDOW_FLAGS_NOSHELL)){
Lemon::Shell::RemoveWindow(client, shellClient);
Expand Down

0 comments on commit 65ea239

Please sign in to comment.