Close window X11 display fixed #438

This commit is contained in:
vcaesar 2022-01-19 12:43:26 -04:00
parent 83ebdf3efd
commit ce0972d699
3 changed files with 11 additions and 3 deletions

View File

@ -135,6 +135,7 @@ typedef struct _Bounds Bounds;
// Reinstate old handler // Reinstate old handler
XSetErrorHandler(mOld); XSetErrorHandler(mOld);
XCloseDisplay(rDisplay);
} }
// Definitions // Definitions
@ -182,6 +183,7 @@ typedef struct _Bounds Bounds;
WM_ACTIVE = XInternAtom(rDisplay, "_NET_ACTIVE_WINDOW", True); WM_ACTIVE = XInternAtom(rDisplay, "_NET_ACTIVE_WINDOW", True);
WM_HINTS = XInternAtom(rDisplay, "_MOTIF_WM_HINTS", True); WM_HINTS = XInternAtom(rDisplay, "_MOTIF_WM_HINTS", True);
WM_EXTENTS = XInternAtom(rDisplay, "_NET_FRAME_EXTENTS", True); WM_EXTENTS = XInternAtom(rDisplay, "_NET_FRAME_EXTENTS", True);
XCloseDisplay(rDisplay);
} }
@ -219,6 +221,7 @@ typedef struct _Bounds Bounds;
XFree (result); XFree (result);
} }
XCloseDisplay(rDisplay);
return NULL; return NULL;
} }
@ -262,6 +265,7 @@ typedef struct _Bounds Bounds;
XFree(desktop); XFree(desktop);
} }
} }
XCloseDisplay(rDisplay);
} }
static Bounds GetFrame(MData win){ static Bounds GetFrame(MData win){

View File

@ -224,6 +224,8 @@ Bounds get_client(uintptr pid, uintptr isHwnd){
bounds.Y = y; bounds.Y = y;
bounds.W = attr.width; bounds.W = attr.width;
bounds.H = attr.height; bounds.H = attr.height;
XCloseDisplay(rDisplay);
return bounds; return bounds;
#elif defined(IS_WINDOWS) #elif defined(IS_WINDOWS)

View File

@ -41,7 +41,7 @@ void initWindow(uintptr handle){
} }
mData.XWin = 0; mData.XWin = 0;
XCloseDisplay(rDisplay);
#elif defined(IS_WINDOWS) #elif defined(IS_WINDOWS)
mData.HWnd = 0; mData.HWnd = 0;
#endif #endif
@ -125,6 +125,7 @@ bool IsValid(){
// Free result and return true // Free result and return true
XFree(result); XFree(result);
XCloseDisplay(rDisplay);
return true; return true;
#elif defined(IS_WINDOWS) #elif defined(IS_WINDOWS)
@ -412,7 +413,7 @@ void SetActive(const MData win){
XSetInputFocus(rDisplay, win.XWin, XSetInputFocus(rDisplay, win.XWin,
RevertToParent, CurrentTime); RevertToParent, CurrentTime);
} }
XCloseDisplay(rDisplay);
#elif defined(IS_WINDOWS) #elif defined(IS_WINDOWS)
if (IsMinimized()) { if (IsMinimized()) {
@ -502,6 +503,7 @@ MData GetActive(void){
Window window = None; Window window = None;
int revert = RevertToNone; int revert = RevertToNone;
XGetInputFocus(rDisplay, &window, &revert); XGetInputFocus(rDisplay, &window, &revert);
XCloseDisplay(rDisplay);
// Return foreground window // Return foreground window
result.XWin = window; result.XWin = window;
@ -590,7 +592,7 @@ void close_window_by_Id(MData m_data){
// Close the window // Close the window
XDestroyWindow(rDisplay, m_data.XWin); XDestroyWindow(rDisplay, m_data.XWin);
XCloseDisplay(rDisplay);
#elif defined(IS_WINDOWS) #elif defined(IS_WINDOWS)
PostMessage(m_data.HWnd, WM_CLOSE, 0, 0); PostMessage(m_data.HWnd, WM_CLOSE, 0, 0);