MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / MouseMove

Method MouseMove

System/LemonWM/wm.cpp:422–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422void WMInstance::MouseMove(){
423 if(resize && active){
424 Lemon::LemonEvent ev;
425 ev.event = Lemon::EventWindowResize;
426
427 if(resizePoint == ResizePoint::BottomRight) {
428 ev.resizeBounds = (input.mouse.pos - active->pos);
429 if(!(active->flags & WINDOW_FLAGS_NODECORATION)) ev.resizeBounds.y -= WINDOW_TITLEBAR_HEIGHT - WINDOW_BORDER_THICKNESS;
430 } else if (resizePoint == ResizePoint::Bottom) {
431 ev.resizeBounds = {active->size.x, input.mouse.pos.y - active->pos.y};
432 if(!(active->flags & WINDOW_FLAGS_NODECORATION)) ev.resizeBounds.y -= WINDOW_TITLEBAR_HEIGHT - WINDOW_BORDER_THICKNESS;
433 } else if (resizePoint == ResizePoint::Right) {
434 ev.resizeBounds = {input.mouse.pos.x - active->pos.x, active->size.y};
435 } else {
436 return;
437 }
438
439 if(ev.resizeBounds.x < 128) ev.resizeBounds.x = 128;
440 if(ev.resizeBounds.y < 64) ev.resizeBounds.y = 64;
441
442 PostEvent(ev, active);
443
444 resizeStartPos = input.mouse.pos;
445
446 redrawBackground = true;
447 } else if (active && PointInWindowProper(active, input.mouse.pos)){
448 Lemon::LemonEvent ev;
449 ev.event = Lemon::EventMouseMoved;
450 ev.mousePos = input.mouse.pos - active->pos;
451
452 if(!(active->flags & WINDOW_FLAGS_NODECORATION)) ev.mousePos = ev.mousePos - (vector2i_t){1, 25};
453
454 PostEvent(ev, active);
455 }
456}
457
458void WMInstance::KeyUpdate(int key, bool pressed){
459 if(shellConnected && key == KEY_GUI && pressed){

Callers 1

PollMethod · 0.80

Calls 1

PointInWindowProperFunction · 0.85

Tested by

no test coverage detected