mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-31 06:13:55 +00:00
Close window X11 display fixed #438
This commit is contained in:
parent
83ebdf3efd
commit
ce0972d699
@ -135,6 +135,7 @@ typedef struct _Bounds Bounds;
|
||||
|
||||
// Reinstate old handler
|
||||
XSetErrorHandler(mOld);
|
||||
XCloseDisplay(rDisplay);
|
||||
}
|
||||
|
||||
// Definitions
|
||||
@ -182,6 +183,7 @@ typedef struct _Bounds Bounds;
|
||||
WM_ACTIVE = XInternAtom(rDisplay, "_NET_ACTIVE_WINDOW", True);
|
||||
WM_HINTS = XInternAtom(rDisplay, "_MOTIF_WM_HINTS", True);
|
||||
WM_EXTENTS = XInternAtom(rDisplay, "_NET_FRAME_EXTENTS", True);
|
||||
XCloseDisplay(rDisplay);
|
||||
}
|
||||
|
||||
|
||||
@ -219,6 +221,7 @@ typedef struct _Bounds Bounds;
|
||||
XFree (result);
|
||||
}
|
||||
|
||||
XCloseDisplay(rDisplay);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -262,6 +265,7 @@ typedef struct _Bounds Bounds;
|
||||
XFree(desktop);
|
||||
}
|
||||
}
|
||||
XCloseDisplay(rDisplay);
|
||||
}
|
||||
|
||||
static Bounds GetFrame(MData win){
|
||||
|
@ -224,6 +224,8 @@ Bounds get_client(uintptr pid, uintptr isHwnd){
|
||||
bounds.Y = y;
|
||||
bounds.W = attr.width;
|
||||
bounds.H = attr.height;
|
||||
XCloseDisplay(rDisplay);
|
||||
|
||||
return bounds;
|
||||
|
||||
#elif defined(IS_WINDOWS)
|
||||
|
@ -41,7 +41,7 @@ void initWindow(uintptr handle){
|
||||
}
|
||||
|
||||
mData.XWin = 0;
|
||||
|
||||
XCloseDisplay(rDisplay);
|
||||
#elif defined(IS_WINDOWS)
|
||||
mData.HWnd = 0;
|
||||
#endif
|
||||
@ -125,6 +125,7 @@ bool IsValid(){
|
||||
|
||||
// Free result and return true
|
||||
XFree(result);
|
||||
XCloseDisplay(rDisplay);
|
||||
return true;
|
||||
|
||||
#elif defined(IS_WINDOWS)
|
||||
@ -412,7 +413,7 @@ void SetActive(const MData win){
|
||||
XSetInputFocus(rDisplay, win.XWin,
|
||||
RevertToParent, CurrentTime);
|
||||
}
|
||||
|
||||
XCloseDisplay(rDisplay);
|
||||
#elif defined(IS_WINDOWS)
|
||||
|
||||
if (IsMinimized()) {
|
||||
@ -502,6 +503,7 @@ MData GetActive(void){
|
||||
Window window = None;
|
||||
int revert = RevertToNone;
|
||||
XGetInputFocus(rDisplay, &window, &revert);
|
||||
XCloseDisplay(rDisplay);
|
||||
|
||||
// Return foreground window
|
||||
result.XWin = window;
|
||||
@ -590,7 +592,7 @@ void close_window_by_Id(MData m_data){
|
||||
|
||||
// Close the window
|
||||
XDestroyWindow(rDisplay, m_data.XWin);
|
||||
|
||||
XCloseDisplay(rDisplay);
|
||||
#elif defined(IS_WINDOWS)
|
||||
|
||||
PostMessage(m_data.HWnd, WM_CLOSE, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user