WildCAD - a simple 2D drawing application

Adam D Ruppe destructionator at gmail.com
Thu Jan 26 14:31:55 UTC 2023


I briefly played around with it, not bad at all. I did see the 
menus popped up in the wrong place though, something to note is 
that ConfigureNotify is a bit complicated in how it works. Let me 
copy/paste a comment from my simpledisplay.d:

/+
         The ICCCM says window managers must send a synthetic 
event when the window
         is moved but NOT when it is resized. In the resize case, 
an event is sent
         with position (0, 0) which can be wrong and break the dpi 
calculations.

         So we only consider the synthetic events from the WM and 
otherwise
         need to wait for some other event to get the position 
which... sucks.
+/
if(event.send_event) {
         win.screenPositionKnown = true;
         win.screenPositionX = event.x;
         win.screenPositionY = event.y;
}



You can also request the window position with 
XTranslateCoordinates:

int x, y;
Window dummyw;
XTranslateCoordinates(dpy, window.nativeHandle, RootWindow(dpy, 
DefaultScreen(dpy)), x, y, &x, &y, &dummyw);



Which is what I do when it is time to pop up a menu.


Your thing works ok when maximized tho, it is kinda nice how you 
got the rest working.

But as a fellow DIY widgetset author it is always fun to compare 
and contrast :)

And since some of these X things are a bit obscure it helps to 
steal tips from each other lol


More information about the Digitalmars-d-announce mailing list