qbektrix / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Key press events dropped. #154

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

If my application takes long to process some window event, some of the
subsequent events will be dropped.  This happens at least for key press
events; I don't know if it's true for other event types.

I'll debug this further and refine this report.  I just sent this right
away just in case it is a known issue or even expected behaviour.  I can
see how you can drop old events in games, but I'm doing a text editor and
this is not acceptable for my application, so if this is intentional I may
need to override that in my end.

Either way, please confirm.

Paste in the traceback or error message:

n/a

Paste in the output of tools/gl_info.py:

Platform instance is <pyglet.window.xlib.XlibPlatform object at 0x832172c>
Display instance is <pyglet.window.xlib.XlibDisplayDevice object at 0xb7d839cc>
Screens:
  XlibScreen(screen=0, x=0, y=0, width=1400, height=1050, xinerama=1)
Creating default context...
GL attributes:
double_buffer=1 stereo=False buffer_size=32 aux_buffers=0
sample_buffers=0 samples=0 red_size=8 green_size=8 blue_size=8
alpha_size=8 depth_size=24 stencil_size=0 accum_red_size=0
accum_green_size=0 accum_blue_size=0 accum_alpha_size=0
GL version: 2.0.6474 (8.38.6)
GL vendor: ATI Technologies Inc.
GL renderer: ATI Mobility Radeon X1400
GL extensions:
  GL_ARB_texture_compression GL_EXT_blend_color GL_EXT_blend_subtract
  GL_EXT_stencil_wrap GL_EXT_vertex_array
  GL_EXT_texture_compression_s3tc GL_ATI_separate_stencil
  GL_ARB_depth_texture GL_ARB_vertex_blend
  GL_ATI_texture_compression_3dc GL_EXT_texture_object
  GL_EXT_vertex_shader GL_EXT_blend_func_separate
  GL_ATI_shader_texture_lod GL_EXT_texture_cube_map
  GL_ARB_occlusion_query GL_ARB_transpose_matrix
  GL_ARB_texture_border_clamp GL_EXT_fog_coord GL_ARB_texture_cube_map
  GL_ARB_point_parameters GL_EXT_texture_env_dot3
  GL_ATI_texture_env_combine3 GL_EXT_multi_draw_arrays
  GL_HP_occlusion_test GL_ATIX_texture_env_combine3
  GL_ATIX_vertex_shader_output_point_size GL_ARB_vertex_program
  GL_ARB_texture_env_dot3 GL_EXT_bgra GL_SGIS_texture_edge_clamp
  GL_ATI_fragment_shader GL_ARB_texture_env_combine
  GL_ARB_vertex_buffer_object GL_EXT_shadow_funcs
  GL_EXT_separate_specular_color GL_EXT_texture_env_add
  GL_EXT_texture_mirror_clamp GL_SGIS_texture_border_clamp
  GL_ATI_vertex_attrib_array_object GL_ARB_point_sprite
  GL_EXT_framebuffer_object GL_ARB_vertex_shader GL_ARB_draw_buffers
  GL_ARB_fragment_program_shadow GL_ATI_element_array
  GL_SGI_color_matrix GL_ATI_texture_mirror_once GL_NV_texgen_reflection
  GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array
  GL_EXT_point_parameters GL_ARB_texture_float GL_ARB_fragment_shader
  GL_ATI_texture_float GL_ARB_fragment_program GL_ARB_shader_objects
  GL_ARB_shading_language_100 GL_ATI_vertex_streams GL_NV_blend_square
  GL_ATI_envmap_bumpmap GL_EXT_texture_env_combine
  GL_EXT_texgen_reflection GL_EXT_texture_lod_bias GL_ARB_shadow_ambient
  GL_EXT_abgr GL_ARB_texture_rectangle GL_ARB_multisample
  GL_SGIS_generate_mipmap GL_ATI_map_object_buffer
  GL_EXT_texture_filter_anisotropic GL_EXT_blend_minmax
  GL_ARB_texture_env_crossbar GL_SGIS_texture_lod
  GL_ATIX_texture_env_route GL_EXT_texture_rectangle
  GL_EXT_texture_edge_clamp GL_ARB_window_pos GL_ARB_shadow
  GL_ARB_texture_mirrored_repeat GL_SUN_multi_draw_arrays GL_S3_s3tc
  GL_EXT_texture3D GL_ARB_multitexture GL_EXT_secondary_color
  GL_EXT_draw_range_elements GL_ATI_draw_buffers
  GL_ATI_vertex_array_object GL_NV_occlusion_query
  GL_ARB_texture_env_add GL_EXT_packed_pixels GL_EXT_rescale_normal
  GL_ARB_pixel_buffer_object
GLU version: 1.3
GLU extensions:
  GLU_EXT_nurbs_tessellator GLU_EXT_object_space_tess

Context is XlibGLContext()
GLX is direct
GLX server vendor: SGI
GLX server version: 1.2
GLX server extensions:
  GLX_ARB_multisample GLX_EXT_visual_info GLX_EXT_visual_rating
  GLX_EXT_import_context GLX_EXT_texture_from_pixmap GLX_OML_swap_method
  GLX_SGI_make_current_read GLX_SGIS_multisample GLX_SGIX_hyperpipe
  GLX_SGIX_swap_barrier GLX_SGIX_fbconfig GLX_MESA_copy_sub_buffer
  GLX_ARB_get_proc_address
GLX client vendor: ATI
GLX client version: 1.3
GLX client extensions:
  GLX_EXT_visual_info GLX_EXT_visual_rating GLX_EXT_import_context
  GLX_ARB_get_proc_address GLX_SGI_video_sync GLX_ARB_multisample
  GLX_ATI_pixel_format_float GLX_ATI_render_texture
GLX extensions:
  GLX_EXT_visual_info GLX_EXT_visual_rating GLX_EXT_import_context
  GLX_ARB_get_proc_address GLX_ARB_multisample

Any additional info (platform/language/hardware) that may be relevant?

I'm using Stackless Python.

Original issue reported on code.google.com by euccas...@gmail.com on 6 Oct 2007 at 3:44

GoogleCodeExporter commented 9 years ago
The following script is a quick way to reproduce the problem.  Just run it and 
type
some recognizable text, like the sequence "one two three four ..." and observe 
the
console output.  After some time (depending maybe on your machine and how fast 
you
type), you'll start missing presses.

import time

from pyglet.window import key, Window

w = Window()

keynames = dict((v, k) 
                for k, v in key.__dict__.iteritems()
                if isinstance(v, int)
                and not k.startswith("MOD"))

sleep_time = 0.0

def on_key_press(k, mods):
    print "Pressed", keynames.get(k, "??")
    global sleep_time
    sleep_time += 0.05
    time.sleep(sleep_time)

w.on_key_press = on_key_press

while not w.has_exit:
    w.dispatch_events()

Original comment by euccas...@gmail.com on 6 Oct 2007 at 5:14

GoogleCodeExporter commented 9 years ago
Fixed (as much as possible) in r1317.  

The error was in the key-repeat detection.  Because of the way this works (X11
doesn't tell us which key events are soft repeats and which are actual keyboard
presses), you will still find repeated key presses dropped (because they will be
assumed to be soft repeats).  For example, typing "three little bears" in your
program above may result in "thre litle bears".  

The only workarounds I can think of are to correlate the key events with the 
text
events (thus recovering soft repeats -- but I don't think you want this), or
overriding the low-level X11 key handler (_event_key in 
pyglet/window/xlib/__init__.py).

Original comment by Alex.Hol...@gmail.com on 7 Oct 2007 at 2:31