@ -253,7 +253,7 @@ void X11Window::internalOpenDisplay()
{
{
m_display = XOpenDisplay ( NULL ) ;
m_display = XOpenDisplay ( NULL ) ;
if ( ! m_display )
if ( ! m_display )
logF atal( " Unable to open X11 display " ) ;
g_logger. f atal( " Unable to open X11 display " ) ;
m_screen = DefaultScreen ( m_display ) ;
m_screen = DefaultScreen ( m_display ) ;
}
}
@ -295,7 +295,7 @@ void X11Window::internalCreateWindow()
m_visible = true ;
m_visible = true ;
if ( ! m_window )
if ( ! m_window )
logF atal( " Unable to create X11 window! " ) ;
g_logger. f atal( " Unable to create X11 window! " ) ;
// ensure window input focus
// ensure window input focus
XWMHints hints ;
XWMHints hints ;
@ -311,7 +311,7 @@ void X11Window::internalCreateWindow()
XSetWMProtocols ( m_display , m_window , & m_wmDelete , 1 ) ;
XSetWMProtocols ( m_display , m_window , & m_wmDelete , 1 ) ;
if ( ! internalSetupWindowInput ( ) )
if ( ! internalSetupWindowInput ( ) )
logW arning( " Input of special keys may be messed up, because window input initialization failed " ) ;
g_logger. w arning( " Input of special keys may be messed up, because window input initialization failed " ) ;
internalConnectGLContext ( ) ;
internalConnectGLContext ( ) ;
}
}
@ -327,20 +327,20 @@ bool X11Window::internalSetupWindowInput()
// create input context (to have better key input handling)
// create input context (to have better key input handling)
if ( ! XSupportsLocale ( ) ) {
if ( ! XSupportsLocale ( ) ) {
logE rror( " X11 doesn't support the current locale " ) ;
g_logger. e rror( " X11 doesn't support the current locale " ) ;
return false ;
return false ;
}
}
XSetLocaleModifiers ( " " ) ;
XSetLocaleModifiers ( " " ) ;
m_xim = XOpenIM ( m_display , NULL , NULL , NULL ) ;
m_xim = XOpenIM ( m_display , NULL , NULL , NULL ) ;
if ( ! m_xim ) {
if ( ! m_xim ) {
logE rror( " XOpenIM failed " ) ;
g_logger. e rror( " XOpenIM failed " ) ;
return false ;
return false ;
}
}
m_xic = XCreateIC ( m_xim , XNInputStyle , XIMPreeditNothing | XIMStatusNothing , XNClientWindow , m_window , NULL ) ;
m_xic = XCreateIC ( m_xim , XNInputStyle , XIMPreeditNothing | XIMStatusNothing , XNClientWindow , m_window , NULL ) ;
if ( ! m_xic ) {
if ( ! m_xic ) {
logE rror( " Unable to create the input context " ) ;
g_logger. e rror( " Unable to create the input context " ) ;
return false ;
return false ;
}
}
@ -352,13 +352,13 @@ void X11Window::internalCheckGL()
# ifdef OPENGL_ES
# ifdef OPENGL_ES
m_eglDisplay = eglGetDisplay ( ( EGLNativeDisplayType ) m_display ) ;
m_eglDisplay = eglGetDisplay ( ( EGLNativeDisplayType ) m_display ) ;
if ( m_eglDisplay = = EGL_NO_DISPLAY )
if ( m_eglDisplay = = EGL_NO_DISPLAY )
logF atal( " EGL not supported " ) ;
g_logger. f atal( " EGL not supported " ) ;
if ( ! eglInitialize ( m_eglDisplay , NULL , NULL ) )
if ( ! eglInitialize ( m_eglDisplay , NULL , NULL ) )
logF atal( " Unable to initialize EGL " ) ;
g_logger. f atal( " Unable to initialize EGL " ) ;
# else
# else
if ( ! glXQueryExtension ( m_display , NULL , NULL ) )
if ( ! glXQueryExtension ( m_display , NULL , NULL ) )
logF atal( " GLX not supported " ) ;
g_logger. f atal( " GLX not supported " ) ;
# endif
# endif
}
}
@ -377,10 +377,10 @@ void X11Window::internalChooseGLVisual()
EGLint numConfig ;
EGLint numConfig ;
if ( ! eglChooseConfig ( m_eglDisplay , attrList , & m_eglConfig , 1 , & numConfig ) )
if ( ! eglChooseConfig ( m_eglDisplay , attrList , & m_eglConfig , 1 , & numConfig ) )
logF atal( " Failed to choose EGL config " ) ;
g_logger. f atal( " Failed to choose EGL config " ) ;
if ( numConfig ! = 1 )
if ( numConfig ! = 1 )
logW arning( " Didn't got the exact EGL config " ) ;
g_logger. w arning( " Didn't got the exact EGL config " ) ;
m_rootWindow = DefaultRootWindow ( m_display ) ;
m_rootWindow = DefaultRootWindow ( m_display ) ;
# else
# else
@ -394,11 +394,11 @@ void X11Window::internalChooseGLVisual()
int nelements ;
int nelements ;
m_fbConfig = glXChooseFBConfig ( m_display , m_screen , attrList , & nelements ) ;
m_fbConfig = glXChooseFBConfig ( m_display , m_screen , attrList , & nelements ) ;
if ( ! m_fbConfig )
if ( ! m_fbConfig )
logF atal( " Couldn't choose RGBA, double buffered fbconfig " ) ;
g_logger. f atal( " Couldn't choose RGBA, double buffered fbconfig " ) ;
m_visual = glXGetVisualFromFBConfig ( m_display , * m_fbConfig ) ;
m_visual = glXGetVisualFromFBConfig ( m_display , * m_fbConfig ) ;
if ( ! m_visual )
if ( ! m_visual )
logF atal( " Couldn't choose RGBA, double buffered visual " ) ;
g_logger. f atal( " Couldn't choose RGBA, double buffered visual " ) ;
m_rootWindow = RootWindow ( m_display , m_visual - > screen ) ;
m_rootWindow = RootWindow ( m_display , m_visual - > screen ) ;
# endif
# endif
@ -418,15 +418,15 @@ void X11Window::internalCreateGLContext()
m_eglContext = eglCreateContext ( m_eglDisplay , m_eglConfig , EGL_NO_CONTEXT , attrList ) ;
m_eglContext = eglCreateContext ( m_eglDisplay , m_eglConfig , EGL_NO_CONTEXT , attrList ) ;
if ( m_eglContext = = EGL_NO_CONTEXT )
if ( m_eglContext = = EGL_NO_CONTEXT )
logF atal( " Unable to create EGL context: %s " , eglGetError ( ) ) ;
g_logger. f atal( " Unable to create EGL context: %s " , eglGetError ( ) ) ;
# else
# else
m_glxContext = glXCreateContext ( m_display , m_visual , NULL , True ) ;
m_glxContext = glXCreateContext ( m_display , m_visual , NULL , True ) ;
if ( ! m_glxContext )
if ( ! m_glxContext )
logF atal( " Unable to create GLX context " ) ;
g_logger. f atal( " Unable to create GLX context " ) ;
if ( ! glXIsDirect ( m_display , m_glxContext ) )
if ( ! glXIsDirect ( m_display , m_glxContext ) )
logW arning( " GL direct rendering is not possible " ) ;
g_logger. w arning( " GL direct rendering is not possible " ) ;
# endif
# endif
}
}
@ -459,12 +459,12 @@ void X11Window::internalConnectGLContext()
# ifdef OPENGL_ES
# ifdef OPENGL_ES
m_eglSurface = eglCreateWindowSurface ( m_eglDisplay , m_eglConfig , m_window , NULL ) ;
m_eglSurface = eglCreateWindowSurface ( m_eglDisplay , m_eglConfig , m_window , NULL ) ;
if ( m_eglSurface = = EGL_NO_SURFACE )
if ( m_eglSurface = = EGL_NO_SURFACE )
logF atal( " Unable to create EGL surface: %s " , eglGetError ( ) ) ;
g_logger. f atal( " Unable to create EGL surface: %s " , eglGetError ( ) ) ;
if ( ! eglMakeCurrent ( m_eglDisplay , m_eglSurface , m_eglSurface , m_eglContext ) )
if ( ! eglMakeCurrent ( m_eglDisplay , m_eglSurface , m_eglSurface , m_eglContext ) )
logF atal( " Unable to connect EGL context into X11 window " ) ;
g_logger. f atal( " Unable to connect EGL context into X11 window " ) ;
# else
# else
if ( ! glXMakeCurrent ( m_display , m_window , m_glxContext ) )
if ( ! glXMakeCurrent ( m_display , m_window , m_glxContext ) )
logF atal( " Unable to set GLX context on X11 window " ) ;
g_logger. f atal( " Unable to set GLX context on X11 window " ) ;
# endif
# endif
}
}
@ -712,7 +712,7 @@ void X11Window::poll()
break ;
break ;
std : : string text = buf ;
std : : string text = buf ;
// logD ebug("char: ", buf[0], " code: ", (int)((uchar)buf[0]));
// g_logger.d ebug("char: ", buf[0], " code: ", (int)((uchar)buf[0]));
if ( m_onInputEvent & & text . length ( ) > 0 ) {
if ( m_onInputEvent & & text . length ( ) > 0 ) {
m_inputEvent . reset ( Fw : : KeyTextInputEvent ) ;
m_inputEvent . reset ( Fw : : KeyTextInputEvent ) ;
@ -843,18 +843,18 @@ void X11Window::setMouseCursor(const std::string& file, const Point& hotSpot)
apng_data apng ;
apng_data apng ;
if ( load_apng ( fin , & apng ) ! = 0 ) {
if ( load_apng ( fin , & apng ) ! = 0 ) {
logTraceError ( " unable to load png file %s " , file ) ;
g_logger. traceError ( stdext : : format ( " unable to load png file %s " , file ) ) ;
return ;
return ;
}
}
if ( apng . bpp ! = 4 ) {
if ( apng . bpp ! = 4 ) {
logE rror( " the cursor png must have 4 channels " ) ;
g_logger. e rror( " the cursor png must have 4 channels " ) ;
free_apng ( & apng ) ;
free_apng ( & apng ) ;
return ;
return ;
}
}
if ( apng . width ! = 32 | | apng . height ! = 32 ) {
if ( apng . width ! = 32 | | apng . height ! = 32 ) {
logE rror( " the cursor png must have 32x32 dimension " ) ;
g_logger. e rror( " the cursor png must have 32x32 dimension " ) ;
free_apng ( & apng ) ;
free_apng ( & apng ) ;
return ;
return ;
}
}
@ -961,12 +961,12 @@ void X11Window::setIcon(const std::string& iconFile)
apng_data apng ;
apng_data apng ;
if ( load_apng ( fin , & apng ) ! = 0 ) {
if ( load_apng ( fin , & apng ) ! = 0 ) {
logE rror( " Unable to load window icon " ) ;
g_logger. e rror( " Unable to load window icon " ) ;
return ;
return ;
}
}
if ( apng . bpp ! = 4 ) {
if ( apng . bpp ! = 4 ) {
logE rror( " Could not set window icon, icon image must have 4 channels " ) ;
g_logger. e rror( " Could not set window icon, icon image must have 4 channels " ) ;
free_apng ( & apng ) ;
free_apng ( & apng ) ;
return ;
return ;
}
}
@ -985,7 +985,7 @@ void X11Window::setIcon(const std::string& iconFile)
Atom property = XInternAtom ( m_display , " _NET_WM_ICON " , 0 ) ;
Atom property = XInternAtom ( m_display , " _NET_WM_ICON " , 0 ) ;
if ( ! XChangeProperty ( m_display , m_window , property , XA_CARDINAL , 32 , PropModeReplace , ( const unsigned char * ) & iconData [ 0 ] , iconData . size ( ) ) )
if ( ! XChangeProperty ( m_display , m_window , property , XA_CARDINAL , 32 , PropModeReplace , ( const unsigned char * ) & iconData [ 0 ] , iconData . size ( ) ) )
logE rror( " Couldn't set app icon " ) ;
g_logger. e rror( " Couldn't set app icon " ) ;
free_apng ( & apng ) ;
free_apng ( & apng ) ;
}
}