LWJGL
September 19, 2014, 22:54:52 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.9.1 released!
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: [FIXED] Keyboard does not respond on Linux  (Read 13678 times)
Wibowit
Newbie
*
Posts: 1


« on: January 12, 2011, 07:09:46 »

Hello,

My system is Ubuntu 10.10 64-bit with 8 GiB RAM and Radeon HD 5770 1 GiB.

Recently I've started playing with LWJGL. My favourite IDE is NetBeans, so I've followed instructions from: http://lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_NetBeans

The problem is that window is displaying, but it doesn't respond to keyboard. It does respond to mouse however.

When I run the example from NetBeans (with "-Djava.library.path=/java/lwjgl/2.6/bin/native/linux" as VM Options in Project Properties) then I see a window with decorations and with green square following mouse pointer. Keyboard doesn't work but no exception logs are shown in Output window. Sometimes JRE throws a runtime exception on exit, for example:
Code:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fd912e84d28, pid=7761, tid=140572797961984
#
# JRE version: 6.0_20-b20
# Java VM: OpenJDK 64-Bit Server VM (19.0-b09 mixed mode linux-amd64 )
# Derivative: IcedTea6 1.9.2
# Distribution: Ubuntu 10.10, package 6b20-1.9.2-0ubuntu2
# Problematic frame:
# C  [libX11.so.6+0x37d28]  XQueryExtension+0x28
#
# An error report file with more information is saved as:
# /home/piotrek/NetBeansProjects/LWJGL-Test/hs_err_pid7761.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
#   https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
#
Java Result: 134
References file is uploaded here: http://lwjgl.pastebin.com/pTYSnvPj

When I run example form terminal then following things happens: http://lwjgl.pastebin.com/yVU7h8N4
Instead of window with decorations I see flashing (!) undecorated window (ie. only canvas).

This is even more strange because those runtime errors are thrown by OpenJDK only when I hit other keys than arrow keys. With Sun JDK errors are always thrown from terminal.

There are ldd reports about LWJGL natives: http://lwjgl.pastebin.com/b43UAMgX
Logged
jediTofu
Prolific Timewaster
****
Posts: 280



« Reply #1 on: January 12, 2011, 16:05:22 »

Based on looking at your error report, it seems that libX11.so with Java is to blame and not LWJGL, but I'm not 100% sure on that, maybe it is the Linux natives as well.  I'm using the latest version of Linux Mint 64-bit (which was built on top of Ubuntu 10.10), and it works fine.  Try asking in the Ubuntu forums or IRC chat if there is a problem here, or just searching.

While searching for your related problem, I found someone that had the exact same problem but in Eclipse:  http://stackoverflow.com/questions/3499459/icedtea-and-lwgjl.  I believe that you have already tried everything that they have suggested, except for "sudo update-alternatives --config java", but that didn't work either for the person there.

Things to try:
[1] Download and try using the latest nightly build instead from here
[2] In NetBeans, go to Tools->Java Platforms.  Add a new platform that points to sun-java-6 instead of openjdk-6.  Then in your project, change the Java Platform that it uses in the project's properties.  You could also just compile on the command line if you don't mind setting the long classpath, so that it's compiling with Sun's Java.
Logged

cool story, bro
horace
Newbie
*
Posts: 5


« Reply #2 on: January 17, 2011, 01:21:35 »

Hi,

I am currently experiencing the same issue :
display is correct, mouse input is OK, but keyboard input is ignored.
This applies to my applications, but also all of the org.lwjgl.test package.

I followed jediTofu's advice and tried the nightly but have noticed no improvement.

My setup is pretty different from Wibowit, and the only common factor seems to be linux 64 :

OS: Fedora14 64bit
GPU : nVidia Corporation G96 [Quadro FX 580]
Driver : OpenGL version string: 3.3.0 NVIDIA 260.19.29
X11 : Screen 0: minimum 3600 x 1200, current 3600 x 1200, maximum 3600 x 1200
JVM : java version "1.6.0_23" Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
Environment : bash, no IDE
ldd :
Code:
lwjgl/native/linux $ ldd *64.so
libjinput-linux64.so:
        linux-vdso.so.1 =>  (0x00007fffedf67000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f07b1df5000)
        /lib64/ld-linux-x86-64.so.2 (0x000000322d200000)
liblwjgl64.so:
        linux-vdso.so.1 =>  (0x00007fff319ac000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fa3046ae000)
        libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007fa30436f000)
        libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007fa30415c000)
        libXcursor.so.1 => /usr/lib64/libXcursor.so.1 (0x00007fa303f52000)
        libXrandr.so.2 => /usr/lib64/libXrandr.so.2 (0x00007fa303d4a000)
        libXxf86vm.so.1 => /usr/lib64/libXxf86vm.so.1 (0x00007fa303b44000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa303927000)
        libjawt.so => not found
        libc.so.6 => /lib64/libc.so.6 (0x00007fa303582000)
        libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007fa303367000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fa303163000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fa302f4d000)
        libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x00007fa302d43000)
        libXfixes.so.3 => /usr/lib64/libXfixes.so.3 (0x00007fa302b3e000)
        /lib64/ld-linux-x86-64.so.2 (0x000000322d200000)
        libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007fa30293a000)
libopenal64.so:
        linux-vdso.so.1 =>  (0x00007fffe697c000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fccb2ac2000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fccb28a5000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fccb26a0000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fccb241b000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fccb2077000)
        /lib64/ld-linux-x86-64.so.2 (0x000000322d200000)

Note that the VM does not crash like for OP, but I do not leave the examples running for very long since without keyboard input interaction is very limited.

I can provide additional info if needed.
Logged
kappa
Administrator
Nerdus Imperius
*****
Posts: 1167



« Reply #3 on: January 17, 2011, 02:17:43 »

As for the above issue, i also run linux 64 bit and can confirm keyboard input does work, so its not a linux 64 bit issue.

While searching for your related problem, I found someone that had the exact same problem but in Eclipse:  http://stackoverflow.com/questions/3499459/icedtea-and-lwgjl.
Just some clarification on the IcedTea situation.

The main issue with LWJGL and IcedTea/OpenJDK was that LWJGL Applets were broken on their plugin. This is an issue as OpenJDK/IcedTea is installed by default on distro's like Ubuntu and Fedora.

A bug was raised here http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=568
and the folks there seemed to have now fixed it (see attached patch there). It will be part of the next IcedTea release.

Getting LWJGL Applets to work on IcedTea is also now part of their Release Plan, see the Release Plan page http://icedtea.classpath.org/wiki/IcedTea-Web (at the bottom) and is targeted to be done by 31st January 2011.

So good news on that front.
Logged
horace
Newbie
*
Posts: 5


« Reply #4 on: January 17, 2011, 04:53:04 »

As for the above issue, i also run linux 64 bit and can confirm keyboard input does work, so its not a linux 64 bit issue.

Sure, I did not mean it fails on every linux64 machine.

I actually have this problem at work, where I used to have a Fedora10 64b and everything went smoothly.
I was recently upgraded to another machine with Fedora14 and now I get this.
I did a couple of ssh -X on some of my coworker's machines:
the bug is 100% reproducible on every Fedora 12 and 14 I can reach (all x64 / Nvidia Quadro),
but everything works with Fedora 10.

I can do tests on those Fedora 10/12/14 if anyone has a hint as to which module/driver/library in the stack causes the problem.
Logged
kappa
Administrator
Nerdus Imperius
*****
Posts: 1167



« Reply #5 on: January 17, 2011, 11:16:06 »

hmm, in that case we might have something breaking with these new versions of 64bit linux, can you confirm that it also happen on Oracle Java and not just an OpenJDK issue?

Internally the native code in LWJGL just uses X11/XLib, so unless there has been some changes to that not sure what else could cause just the keyboard to break.
Logged
horace
Newbie
*
Posts: 5


« Reply #6 on: January 17, 2011, 11:32:18 »

can you confirm that it also happen on Oracle Java and not just an OpenJDK issue?

Actually I've never used OpenJDK, this happens with the latest Sun Hotspot 6 x64.
Logged
jediTofu
Prolific Timewaster
****
Posts: 280



« Reply #7 on: January 17, 2011, 14:46:38 »

Hmmm, if you haven't already, try replacing lwjgl.jar with lwjgl-debug.jar to see if it shows any additional information.

Here's my current setup, and it works for me using the latest stable LWJGL 2.6 in both NB and the terminal:

$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

$ Xorg -version
X.Org X Server 1.9.0
Release Date: 2010-08-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24-27-server x86_64 Ubuntu
Current Operating System: Linux Mint 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.35-22-generic root=UUID=(DELETED THIS) ro vga=792 splash quiet splash
Build Date: 16 September 2010  06:18:41PM
xorg-server 2:1.9.0-0ubuntu7 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.18.4
   Before reporting problems, check http://wiki.x.org
   to make sure that you have the latest version.
Logged

cool story, bro
horace
Newbie
*
Posts: 5


« Reply #8 on: January 18, 2011, 01:31:44 »

No luck with lwjgl-debug.jar and -Dorg.lwjgl.util.Debug=true
it prints stuff about display creation, but nothing of real interest:
Quote
$ /usr/bin/java -cp .:res:jar/lwjgl-debug.jar:jar/lwjgl_test.jar:jar/lwjgl_util.jar:jar/jinput.jar: -Djava.library.path=native/linux  -Dorg.lwjgl.util.Debug=true org.lwjgl.test.input.KeyboardTest
Xrandr extension version 1.3
Using Xrandr for display mode switching
XF86VidMode extension version 2.2
Initial mode: 3600 x 1200 x 24 @51Hz
Removed 0 duplicate displaymodes
Available screen modes:
3600 x 1200 x 24 @51Hz
3600 x 1200 x 24 @50Hz
Sorted display modes:
Pixel format info: r = 8, g = 8, b = 8, a = 0, depth = 24, stencil = 0, sample buffers = 0, samples = 0
Could not locate symbol glVertexWeighthNV
^CXF86VidMode extension version 2.2

I tried with OpenJDK 6, exact same result.

Some version numbers :
Quote
$ /usr/bin/java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.3) (fedora-49.1.9.3.fc14-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

$ java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)

$ Xorg -version
X.Org X Server 1.9.3
Release Date: 2010-12-13
X Protocol Version 11, Revision 0
Build Operating System: x86-02 2.6.32-71.el6.x86_64
Current Operating System: Linux 2.6.35.10-74.fc14.x86_64 #1 SMP Thu Dec 23 16:04:50 UTC 2010 x86_64
Kernel command line: ro root=UUID=b97b00ca-8d6b-4da7-94cd-d5f7591b3e15 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us quiet nouveau.modeset=0 rdblacklist=nouveau
Build Date: 20 December 2010  03:37:11PM
Build ID: xorg-x11-server 1.9.3-3.fc14
Current version of pixman: 0.18.4
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Logged
horace
Newbie
*
Posts: 5


« Reply #9 on: January 20, 2011, 09:56:31 »

Since you can't reproduce it I went ahead and opened the sources.

The issue is in org.lwjgl.opengl.LinuxDisplay#processEvents()
line 755:
Code:
if (event_window != getWindow() || event_buffer.filterEvent(event_window) ||

filterEvent() calls XFilterEvent in libX11. It should return false to allow the keyboard event handler to do its job,
but for some reason it returns true.
The man says this can happen if the keyboard is grabbed, trying to force ungrabbing does not help.
I still don't really understand what this keyboard grabbing thing is about.

I opened the Xlib source for some more info, (http://pastebin.com/u4HaKesh) but this is pretty cryptic to me...
I guess i'll keep looking later.


edit
Ok I got it, now I feel stupid.
I have this applet on Xfce called 'imsettings' (http://code.google.com/p/imsettings/) that lets me change the keyboard layout with a shortcut.
Apparently it does not mix well with lwjgl and puts the lwjgl keyboard in permanent grab mode.
Strange since other applications I run are not affected... well that stuff is useless anyway.

Does the latest gnome/ubuntu also have this thing, or is this only xfce/fedora ?
Logged
jediTofu
Prolific Timewaster
****
Posts: 280



« Reply #10 on: January 20, 2011, 15:34:24 »

Nice, good job.

I couldn't find it in my software manager, so I assume that I'd have to manually install it on Ubuntu/GNOME systems, and it should work according to the website (Gtk+ and GNOME supported).  This is good to know though for Linux systems, possible problems with desktop applets and LWJGL.

Anyway, mouse grabbing should still work on Linux; it works on mine.  Perhaps there is something wrong with the Mouse grabbing code in LWJGL.  I wonder if this is specific to desktop environments, or if people have had this problem also on GNOME.
Logged

cool story, bro
kappa
Administrator
Nerdus Imperius
*****
Posts: 1167



« Reply #11 on: January 20, 2011, 15:52:37 »

thanks for looking into this, is this post related to the same issue?
Logged
_ralts
Newbie
*
Posts: 6


« Reply #12 on: September 09, 2011, 23:16:50 »

My LWJGL application creates the window and detects the mouse, but it never receives any keyboard events. Sad

Keyboard.isCreated() returns true, so I know the keyboard is initialized.

Funnily enough, Minecraft detects the keyboard just fine, although it's supposed to be using LWJGL too.

I'm using Scala and LWJGL 2.6 on Ubuntu 11.04 with ATI's proprietary driver. I've read this topic but I don't think that would have affected the keyboard.

I've posted the rest of the code at https://gist.github.com/1208003 -- any help would be appreciated  Cheesy

Code:
 def loop() {
    while(!Display.isCloseRequested) {

      while(Keyboard.next()) {
        println("Key pressed!") // ** Never reaches this part!
      }

      // Blank the screen
      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT)

      Display.update()
      Display.sync(60)
    }
  }

EDIT: The Space Invaders demo doesn't work with the keyboard either.
Logged
CodeBunny
Nerdus Imperius
*****
Posts: 562



WWW
« Reply #13 on: September 10, 2011, 16:20:47 »

I think that Minecraft is placed into a JFrame (Display.setParent()), can you try doing that and see if the keyboard works?
Logged
_ralts
Newbie
*
Posts: 6


« Reply #14 on: September 14, 2011, 23:25:54 »

Thanks for the quick reply! I've tried that, and now it crashes in a different way...

Code:
Exception in thread "main" org.lwjgl.LWJGLException: X Error - disp: 0x7fb92c2adec0 serial: 51 error: BadValue (integer parameter out of range for operation) request_code: 1 minor_code: 0
at org.lwjgl.opengl.LinuxDisplay.globalErrorHandler(LinuxDisplay.java:276)
at org.lwjgl.opengl.LinuxDisplay.nCreateWindow(Native Method)
at org.lwjgl.opengl.LinuxDisplay.createWindow(LinuxDisplay.java:429)
at org.lwjgl.opengl.Display.createWindow(Display.java:317)
at org.lwjgl.opengl.Display.create(Display.java:857)
at org.lwjgl.opengl.Display.create(Display.java:785)
at org.lwjgl.opengl.Display.create(Display.java:766)
at tk.allele.frame.LWJGLFrame.<init>(LWJGLFrame.scala:32)
at tk.allele.frangipani.FrangipaniFrame.<init>(FrangipaniFrame.scala:7)
at tk.allele.frangipani.Frangipani$.main(Frangipani.scala:9)
at tk.allele.frangipani.Frangipani.main(Frangipani.scala)

My code pretty much goes like this now:
  • Create a java.awt.Frame
  • Create a Canvas
  • Add the Canvas to the Frame
  • pack()
  • Display.setParent(canvas)
  • Display.create()

From the stack trace, it looks like it can't create the display.
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!