From 19bcc75d42ef83492190733b9da7ba79a28c493f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 28 May 2005 03:31:18 +0000 Subject: [PATCH] fix BadWindow warning due to calling XSelectInput before creating the window fix uninitialized windowIsOpen windowIsOpen -> m_bWindowIsOpen use PRODUCT_NAME one-line header comment goes on the very first line (eg. "head -1"); format it consistently, and be concise --- .../src/arch/LowLevelWindow/LowLevelWindow_X11.cpp | 13 ++++++++----- .../src/arch/LowLevelWindow/LowLevelWindow_X11.h | 5 +++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index 2e15e40baa..d3a8bf8854 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -2,6 +2,7 @@ #include "LowLevelWindow_X11.h" #include "RageLog.h" #include "RageException.h" +#include "ProductInfo.h" #include "archutils/Unix/X11Helper.h" #include @@ -17,6 +18,7 @@ extern Display *g_X11Display; LowLevelWindow_X11::LowLevelWindow_X11() { + m_bWindowIsOpen = false; g_X11Display = NULL; if( !X11Helper::Go() ) { @@ -61,10 +63,8 @@ CString LowLevelWindow_X11::TryVideoMode( RageDisplay::VideoModeParams p, bool & hints.min_width = hints.max_width = hints.base_width = p.width; hints.min_height = hints.max_height = hints.base_height = p.height; - if( !windowIsOpen || p.bpp != CurrentParams.bpp ) + if( !m_bWindowIsOpen || p.bpp != CurrentParams.bpp ) { - X11Helper::OpenMask( StructureNotifyMask ); - // Different depth, or we didn't make a window before. New context. bNewDeviceOut = true; @@ -101,9 +101,9 @@ CString LowLevelWindow_X11::TryVideoMode( RageDisplay::VideoModeParams p, bool & { return "Failed to create the window."; } - windowIsOpen = true; + m_bWindowIsOpen = true; - char WindowTitle[] = "StepMania"; + char WindowTitle[] = PRODUCT_NAME; XChangeProperty( g_X11Display, X11Helper::Win, XA_WM_NAME, XA_STRING, 8, PropModeReplace, reinterpret_cast(WindowTitle), strlen(WindowTitle) ); @@ -111,6 +111,9 @@ CString LowLevelWindow_X11::TryVideoMode( RageDisplay::VideoModeParams p, bool & glXMakeCurrent( X11Helper::Dpy, X11Helper::Win, ctxt ); + /* Enable StructureNotifyMask, so we receive a MapNotify for the following XMapWindow. */ + X11Helper::OpenMask( StructureNotifyMask ); + XMapWindow( X11Helper::Dpy, X11Helper::Win ); // HACK: Wait for the MapNotify event, without spinning and diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.h index adf3a77aae..0239ec7119 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.h @@ -1,13 +1,14 @@ +/* LowLevelWindow_X11 - OpenGL GLX window driver. */ + #ifndef LOW_LEVEL_WINDOW_X11_H #define LOW_LEVEL_WINDOW_X11_H -/* A nice, simple OpenGL window direct to X11 through Xlib. */ #include "LowLevelWindow.h" class LowLevelWindow_X11 : public LowLevelWindow { private: - bool windowIsOpen; + bool m_bWindowIsOpen; RageDisplay::VideoModeParams CurrentParams; public: