add detach

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@183 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-06 12:41:27 +00:00
parent 15af9d917d
commit 8dac5bd0f0
4 changed files with 48 additions and 31 deletions

View File

@@ -374,3 +374,20 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
XcursorImageDestroy(img);
}
void MwLLDetach(MwLL handle, MwPoint* point) {
int x = 0, y = 0;
Window child, root, parent;
Window* children;
unsigned int nchild;
XQueryTree(handle->display, handle->window, &root, &parent, &children, &nchild);
if(children != NULL) XFree(children);
XTranslateCoordinates(handle->display, parent, RootWindow(handle->display, DefaultScreen(handle->display)), 0, 0, &x, &y, &child);
XReparentWindow(handle->display, handle->window, RootWindow(handle->display, DefaultScreen(handle->display)), x + point->x, y + point->y);
XMapWindow(handle->display, handle->window);
XSetInputFocus(handle->display, handle->window, RevertToNone, CurrentTime);
}