We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 586

Summary: windows with icons in X are not focusable
Product: SDL Reporter: Vincent Povirk <madewokherd>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: bombasticbryan
Version: 1.2.12Keywords: target-1.2.14
Hardware: x86   
OS: Linux   
Attachments: patch for setting the input hint correctly

Description Vincent Povirk 2008-05-14 19:02:36 UTC
DOSBox does not set the InputHint in the WM_HINTS property of its window on Linux. That means it can't get keyboard input in an ICCCM-compliant window manager.

This can be tested using the xprop command. A window with InputHint set will have a line that reads
Client accepts input or input focus: True
or
Client accepts input or input focus: False

This appears to be because DOSBox sets an icon. The create_aux_windows function in SDL_x11video.c sets a value for WM_HINTS that includes InputHint, but X11_SetIcon in SDL_x11wm.c overwrites that value with one that has set only icon-related hints.

I can't be entirely sure if that's what's happening, but patching X11_SetIcon does seem to fix the problem.

I originally reported this in a thread at DOSBox's forum: http://vogons.zetafleet.com/viewtopic.php?t=18516
Comment 1 Ryan C. Gordon 2009-09-13 16:33:18 UTC
Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14.

Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla).

--ryan.
Comment 2 Vincent Povirk 2009-09-13 18:35:37 UTC
I'm actually not sure the bug is still present. I can't find the code that was broken in svn trunk.

I'll retest shortly.
Comment 3 Vincent Povirk 2009-09-13 20:33:02 UTC
This is still present in the 1.2 branch of sdl. I hadn't realized svn trunk was 1.3.

Given that this is an obvious deficiency with an easy fix, there's no good reason to leave it broken, even if it does not impact my own use of sdl and even if 1.2 will become obsolete.

Is there any further work I could do here? Is there somewhere I could send a patch?
Comment 4 Sam Lantinga 2009-09-21 01:12:40 UTC
You can attach a patch to this bug. That would be greatly appreciated, thanks!
Comment 5 Vincent Povirk 2009-09-26 16:58:32 UTC
Created attachment 377 [details]
patch for setting the input hint correctly
Comment 6 Sam Lantinga 2009-09-26 18:31:44 UTC
Thanks, your patch is in subversion!