ref: 7acb58322a1af09f7e371a7d955c34fb408368b2
parent: e200e94c00504f556beefe1ae29306fdc0727900
author: aap <aap@papnet.eu>
date: Sun Sep 1 10:37:26 EDT 2024
add forced mouse movement 'M'. fixed win3 theme.
--- a/fs.c
+++ b/fs.c
@@ -793,7 +793,7 @@
return;
case Qmouse:
- if(data[0] != 'm'){
+ if(data[0] != 'm' && data[0] != 'M'){
respond(r, Ebadmouse);
return;
}
@@ -804,7 +804,7 @@
return;
}
pt.y = strtoul(p, nil, 0);
- wmovemouse(w->w, pt);
+ wmovemouse(w->w, pt, data[0] == 'M');
break;
case Qcursor:
--- a/inc.h
+++ b/inc.h
@@ -285,7 +285,7 @@
void wunfocus(Window *w);
int whide(Window *w);
int wunhide(Window *w);
-void wmovemouse(Window *w, Point pt);
+void wmovemouse(Window *w, Point pt, bool force);
WinTab *wcreate(Rectangle r, bool hidden, bool scrolling);
void wrelease(WinTab *w);
--- a/win3.c
+++ b/win3.c
@@ -143,12 +143,12 @@
// max/restore
br.max.x = r.max.x;
- br.min.x = br.max.x-titlesz-1;
+ br.min.x = br.max.x-titlesz+1;
winbtn(w->frame, br, icons[1+w->maximized], 0);
border(w->frame, insetrect(br,-1), 1, display->black, ZP);
// min
- br = rectaddpt(br, Pt(-titlesz-2,0));
+ br = rectaddpt(br, Pt(-titlesz,0));
winbtn(w->frame, br, icons[0], 0);
border(w->frame, insetrect(br,-1), 1, display->black, ZP);
@@ -194,8 +194,8 @@
r = insetrect(r, bordersz);
Rectangle br = Rect(0,0,titlesz-1,titlesz-1);
Rectangle br1 = rectaddpt(br, r.min);
- Rectangle br2 = rectaddpt(br1, Pt(Dx(r)-titlesz-1, 0));
- Rectangle br3 = rectaddpt(br2, Pt(-titlesz-2, 0));
+ Rectangle br2 = rectaddpt(br1, Pt(Dx(r)-titlesz+1, 0));
+ Rectangle br3 = rectaddpt(br2, Pt(-titlesz, 0));
if(ptinrect(mctl->xy, br1)){
if(winbtnctlflat(w->frame, br1, icons[3], icons[4]))
--- a/wind.c
+++ b/wind.c
@@ -750,11 +750,14 @@
}
}
+/* Normally the mouse will only be moved inside the window.
+ * The force argument can move the mouse anywhere. */
void
-wmovemouse(Window *w, Point pt)
+wmovemouse(Window *w, Point pt, bool force)
{
// TODO? rio also checks menuing and such
- if(w == focused && wpointto(mctl->xy) == w)
+ if(force ||
+ w == focused && wpointto(mctl->xy) == w && ptinrect(pt, w->rect))
moveto(mctl, pt);
}