Share

GLFW

Tracker: Bugs

7 BadMatch error when calling XSetInputFocus - ID: 1170806
Last Update: Comment added ( elmindreda )

Debian GNU/Linux with XFree86 4.3.0 fails to run any
glfw programs in which a window is created. The program
exits before returning from a call to glfwOpenWindow(),
and prints the following error:

X Error of failed request: BadMatch (invalid parameter
attributes)
Major opcode of failed request: 42 (X_SetInputFocus)
Serial number of failed request: 35
Current serial number in output stream: 38


This bug occurs in both the latest stable and in the
CVS. GLFW was compiled using gcc 3.4, with the make
x11-gcc command.


Nobody/Anonymous ( nobody ) - 2005-03-25 23:39

7

Open

None

Camilla Berglund

X11/Unix

None

Public


Comments ( 5 )




Date: 2009-10-10 20:56
Sender: elmindredaProject Admin

Renaming.


Date: 2005-07-03 22:59
Sender: nobody

Logged In: NO

I've already send Marcus information how to remove this bug, but I'll post
it
here too.

Every application using GLFW exits with such a message when trying
create a window:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 42 (X_SetInputFocus)
Serial number of failed request: 27
Current serial number in output stream: 30

It is caused because window isn't viewable during call to
XSetInputFocus(). There are two workarounds that I know:
1. Remove any call to XSetInputFocus() (e.g. by commenting them out).
2. Make sure that window is viewable before calling XSetInputFocus().
It can be done for example by repeating calls to XGrabKeyboard() until
result will be different than BadWindow.

Simplifying things just remove lines containing XSetInputFocus in
lib/x11/
x11_window.c and everyting should be OK.


Date: 2005-03-26 11:40
Sender: nobody

Logged In: NO

After hacking at the glfw x11 source code, I found that the
error is caused when X window is still unviewable after the
call to XMapWindow on line 937 of x11_window.c.
From the X reference documentation: "The specified focus
window must be viewable at the time XSetInputFocus is
called, or a BadMatch error results. "

The error is no longer reported if the following changes are
made to x11_window.c:
In the function _glfwWaitForMapNotify, replace the MapNotify
event with an Expose event.

However, I'd like someone who is comfortable with the glfw
source code, and X to assert that this is indeed the correct
'fix'.



Date: 2005-03-26 00:05
Sender: nobody

Logged In: NO

After some more debugging, I've found that the error is
instantiated in the call to glXMakeCurrent() in
lib/x11/x11_window.c line 989. That is where the application
exits.


Date: 2005-03-25 23:48
Sender: nobody

Logged In: NO

If it is of any significance, here is the config.log from
building glfw:

---- config.log -----
This file contains any messages produced by compilers while
running ./compile.sh, to aid debugging if ./compile.sh makes
a mistake.

./compile.sh: checking whether we are using GNU C
./compile.sh: gcc -E conftest.c
./compile.sh: Checking for XFree86 VidMode support
./compile.sh: gcc -c -I/usr/X11R6/include conftest.c 1>&5
./compile.sh: Checking for pthread support
./compile.sh: gcc -o conftest -I/usr/X11R6/include
-D_GLFW_HAS_XF86VIDMODE -L/usr/X11R6/lib conftest.c -lGL
-lX11 -lXxf86vm -lXext -lpthread 1>&5
./compile.sh: Checking for glXGetProcAddress support
./compile.sh: gcc -o conftest -I/usr/X11R6/include
-D_GLFW_HAS_XF86VIDMODE -D_GLFW_HAS_PTHREAD
-L/usr/X11R6/lib conftest.c -lGL -lX11 -lXxf86vm -lXext
-lpthread 1>&5
./compile.sh: gcc -o conftest -I/usr/X11R6/include
-D_GLFW_HAS_XF86VIDMODE -D_GLFW_HAS_PTHREAD
-L/usr/X11R6/lib conftest.c -lGL -lX11 -lXxf86vm -lXext
-lpthread 1>&5
./compile.sh: gcc -o conftest -I/usr/X11R6/include
-D_GLFW_HAS_XF86VIDMODE -D_GLFW_HAS_PTHREAD
-L/usr/X11R6/lib conftest.c -lGL -lX11 -lXxf86vm -lXext
-lpthread 1>&5
/tmp/ccYY7K3Q.o(.text+0x25): In function `main':
: undefined reference to `glXGetProcAddressEXT'
collect2: ld returned 1 exit status
./compile.sh: failed program was:
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <GL/gl.h>
int main() {void *ptr=(void*)glXGetProcAddressEXT("glFun");
return 0;}
./compile.sh: Checking for dlopen support
./compile.sh: gcc -o conftest -I/usr/X11R6/include
-D_GLFW_HAS_XF86VIDMODE -D_GLFW_HAS_PTHREAD
-D_GLFW_HAS_GLXGETPROCADDRESS
-D_GLFW_HAS_GLXGETPROCADDRESSARB -L/usr/X11R6/lib
conftest.c -lGL -lX11 -lXxf86vm -lXext -lpthread 1>&5
./compile.sh: Checking for sysconf support
./compile.sh: gcc -o conftest -I/usr/X11R6/include
-D_GLFW_HAS_XF86VIDMODE -D_GLFW_HAS_PTHREAD
-D_GLFW_HAS_GLXGETPROCADDRESS
-D_GLFW_HAS_GLXGETPROCADDRESSARB -D_GLFW_HAS_DLOPEN
-L/usr/X11R6/lib conftest.c -lGL -lX11 -lXxf86vm -lXext
-lpthread 1>&5
./compile.sh: Checking for sysctl support
./compile.sh: gcc -E conftest.c
./compile.sh: Creating ./lib/x11/Makefile.x11.gcc...
./compile.sh: Creating ./examples/Makefile.x11.gcc...



Log in to comment.




Attached File

No Files Currently Attached

Changes ( 8 )

Field Old Value Date By
summary Runtime error in XFree86 4.3.0 2009-10-10 20:56 elmindreda
resolution_id Works For Me 2009-10-10 20:56 elmindreda
status_id Closed 2009-06-03 01:54 nobody
assigned_to nobody 2006-07-28 09:56 elmindreda
status_id Open 2006-07-28 09:48 elmindreda
close_date - 2006-07-28 09:48 elmindreda
priority 5 2006-07-28 09:48 elmindreda
resolution_id None 2006-07-28 09:48 elmindreda