SDL_SetVideoMode suffed "no input method could be opened"

When I trying to using SDL with opengl on
Linux(UBuntu 8.04) I got a error message.

“No input method could be opened”(SDL_SetVideoMode(m_iScreenWidth,
m_iScreenHeight, 0, flags))

The machine I used is
Mother board : AMD LX 800
Graphics card :Nvidia FX 5200
CPU:Intel:500 MHZ… lol

I am wandering to know what the problem is?
Is my machine old enough to say goodby?
Because it’s running fine on my new machine.(GF8500GT)

thanks for any advice :slight_smile:

below is my code segament

void GameApp::InitializeSDL(void)
{
/* Information about the current video settings. /
const SDL_VideoInfo
info = NULL;
/* Color depth in bits of our window. /
int bpp = 0;
/
Flags we will pass into SDL_SetVideoMode. /
int flags = 0;
SDL_Surface
drawContext;
/* First, initialize SDL’s video subsystem. /
if(SDL_WasInit(SDL_INIT_VIDEO)&SDL_INIT_VIDEO)
{
m_bWasInitSDL = true;
}
else
if( SDL_Init( SDL_INIT_VIDEO) < 0 )
{
/
Failed, exit. */
fprintf( stderr, “Video initialization failed: %s\n”,
SDL_GetError( ) );
quit_SDL( 1 );
}
// Create a double-buffered draw context
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
info = SDL_GetVideoInfo( );

flags = SDL_OPENGL|SDL_HWSURFACE;//|SDL_FULLSCREEN;
if( info->current_w<m_iScreenWidth || info->current_h< m_iScreenHeight )
{
ErrorMsg(CharToWchar(“wanted resolution is bigger than screen
resolution”),L"Error");
m_iScreenHeight = info->current_h;
m_iScreenWidth = info->current_w;
}
drawContext = SDL_SetVideoMode(m_iScreenWidth, m_iScreenHeight, 0,
flags);
/* Let’s get some video information. */
bpp = info->vfmt->BitsPerPixel;

if( !info )

{
/* This should probably never happen. /
fprintf( stderr, “Video query failed: %s\n”,
SDL_GetError( ) );
quit_SDL( 1 );
}
char
l_strForError = SDL_GetError();
if(strlen(l_strForError))
{
ErrorMsg(CharToWchar(l_strForError),L"Error");
}

}

Hmm. I’m really puzzled.

When I trying to using SDL with opengl on
Linux(UBuntu 8.04) I got a error message.

“No input method could be opened”(SDL_SetVideoMode(m_iScreenWidth,
m_iScreenHeight, 0, flags))

I’m not exactly sure what you did and what is your problem. Please
forgive me if I write something totally unrelated to your problem.

The above error_message gives and impress that the case is
SDL_SetVideoMode returned an error condition, and the message returned
from SDL_GetError() was “No input method could be opened”. A simple
guess is you want to know why the SDL_SetVideoMode returned an error.

However, in the program that you attached to the mail, return value
from SDL_SetVideoMode is never tested, so any error conditions from
the function is simply ignored in your program. I don’t think it is a
good practice, but anyway, it means the above guess is wrong.

Well, in SDL, there is only one location that generates a message “no
input method could be opened”. It is deep inside of
SDL_SetVideoMode(), and it indicates the case that the X11 xlib
function XOpenIM() returned an error. The fact that makes me puzzled
yet more is, that it is not an error condition of SDL. SDL checks the
return value from XOpenIM(), calls a function to set an error message
(SDL_SetError()) when errored, and keep going, falling back to no XIM
mode. So, even if you added a test for the return value from
SDL_SetVideoMode(), you should never see the message “no input method
could be opened” as an error_message. (Unless you compiled SDL in
DEBUG option turned on, and you are referring to the debug logging as
opposed to a message…)

If you saw “no input method could be opened” in your debug logging,
it’s not an error. SDL and OpenGL should work fine. Only downside is
that you can’t use your input method on your game. So, if you just
panicked seeing the text in your debug logging, just calm down and
ignore it.

If you are experiencing some problem in your game (e.g., your drawing
surface is entirely black), and you considered that your problem is
caused by “no input method could be opened”, it’s a wrong place. You
need to look in other debug loggings for the cause of your problem. I
or anybody else can even guess the cause, because you didn’t write
what was your problem in your mail.

Note that SDL on X11 currently supports the traditional XIM based
input method API only, and it doesn’t support modern GTK/KDE based
input method API (so-called immodules.) Unless something very strange
is happening in your game, seeing the “no input method could be
opened” debug log means you can’t use input methods with your game.
If you want to type, say, Chinese letters on your game, and found
that you can’t, (and that is your problem,) what you need to do is
set up XIM environment properly on your Desktop.

Is my machine old enough to say goodby?

I don’t think so. XIM was almost always configured properly on all
X11 systems in 1990s. Later, as GTK and KDE replaced the good old
Athena widgets, importance of XIM diminished, and many Linux installs
lack proper XIM configurations these days… In that sense, your
machine may be too new! :slight_smile:

Alissa Sabre--------------------------------------

Stop! Global Warming ~ Yahoo! JAPAN Earth Project
http://pr.mail.yahoo.co.jp/earthproject/