mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-16 22:24:07 +00:00
add detach
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@183 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -369,3 +369,23 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||
free(dimage);
|
||||
free(dmask);
|
||||
}
|
||||
|
||||
void MwLLDetach(MwLL handle, MwPoint* point) {
|
||||
RECT rc, rc2;
|
||||
LONG_PTR style = GetWindowLongPtr(handle->hWnd, GWL_STYLE);
|
||||
|
||||
style |= WS_OVERLAPPEDWINDOW;
|
||||
|
||||
GetWindowRect(GetParent(handle->hWnd), &rc);
|
||||
|
||||
GetClientRect(handle->hWnd, &rc2);
|
||||
|
||||
SetParent(handle->hWnd, NULL);
|
||||
|
||||
rc.left += point->x;
|
||||
rc.top += point->y;
|
||||
|
||||
SetWindowPos(handle->hWnd, HWND_TOPMOST, rc.left, rc.top, rc2.right == 0 ? 1 : rc2.right, rc2.bottom == 0 ? 1 : rc2.bottom, SWP_NOREDRAW);
|
||||
|
||||
SetWindowLongPtr(handle->hWnd, GWL_STYLE, style);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user