bugBos Wars - Bugs: bug #27982, Incorrect mouse handling by...


bug #27982: Incorrect mouse handling by boswars 2.5.1 while windowed

Submitter:  Rafał Mużyło <voidmage>
Submitted:  Mon 09 Nov 2009 10:44:58 PM UTC
Severity:  3 - Normal Item Group:  * Bug
Status:  Fixed Privacy:  Public
Assigned to:  feb Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Sun 17 Jan 2010 08:35:49 PM UTC, comment #9: 

A work-around has been submitted in svn. Thanks for the report and the analysis.

François Beerten <feb>
Group administrator
Sun 17 Jan 2010 06:34:00 PM UTC, comment #8: 

That still a bug in boswars
- "Focus follows mouse" is a valid option
for a window manager

And yes, editing engine/ui/mouse.cpp
does fix it.

Also, on unrelated note: there should be
a way to control the speed of scrolling
the map as mouse moves.

Rafał Mużyło <voidmage>
Sun 17 Jan 2010 05:59:33 PM UTC, comment #7: 

The events happen because some window managers passively grab the mouse.  Metacity in particular does that if you enable "Select windows when the mouse moves over them": it wants to see mouse clicks on such windows so that it can raise the windows.  Disabling that option avoids this bug.

Related metacity bug reports:

https://bugzilla.gnome.org/show_bug.cgi?id=102209 "clicking on window causes leave/enter events"
https://bugzilla.gnome.org/show_bug.cgi?id=115072 "need to grab mouse clicks in all focus modes"
https://bugzilla.gnome.org/show_bug.cgi?id=461577 "When raise-on-click is FALSE, passive grab is unnecessary"

Kalle Olavi Niemitalo <kon>
Group Member
Sun 17 Jan 2010 03:38:17 PM UTC, comment #6: 
Kalle Olavi Niemitalo <kon>
Group Member
Sun 17 Jan 2010 03:15:56 PM UTC, comment #5: 

This bug seems to be caused by SDL change r4872 <http://www.libsdl.org/cgi/viewvc.cgi?view=revision&revision=4872>.  Reverting that fixes the bug.  That change was made to fix SDL bug #716 <http://bugzilla.libsdl.org/show_bug.cgi?id=716>.

Kalle Olavi Niemitalo <kon>
Group Member
Sun 17 Jan 2010 01:35:40 PM UTC, comment #4: 

This bug happens because SDL 1.2.14 (but not 1.2.13) somehow reports two SDL_ACTIVEEVENT events before each SDL_MOUSEBUTTONDOWN event: first one event about losing SDL_APPMOUSEFOCUS, and then another event about getting it back.  The first SDL_ACTIVEEVENT makes Bos Wars think the mouse pointer of X has left the Bos Wars window and move its own mouse cursor to the center of the window.  Bos Wars then does not move its mouse cursor back to the original position on the next SDL_ACTIVEEVENT, and ignores the coordinates reported in SDL_MOUSEBUTTONDOWN and instead uses the previously set coordinates of its mouse cursor at the center of the window.

There seem to be two workarounds:

- Better: If you compile Bos Wars from the source, edit engine/ui/mouse.cpp (HandleMouseExit) and comment out the CursorX and CursorY assignments.  This has the side effect that moving the mouse pointer of X out of the Bos Wars window will leave the mouse cursor of Bos Wars in its last position, rather than at the center of the window.  However, Bos Wars will correctly abstain from scrolling the viewport even if that position is near an edge of the window (as it usually is).

- Worse: Edit boswars.lua and change SetLeaveStops(true) to SetLeaveStops(false) in boswars.lua.  This has the same side effect as above and Bos Wars will not stop scrolling either.

Kalle Olavi Niemitalo <kon>
Group Member
Fri 01 Jan 2010 07:57:53 PM UTC, comment #3: 

Well, that guichan part is just a guess, but I'm looking for
atypical things, as freeciv and widelands work.

The problem is that while not fullscreen, if I try to
click to select unit, I can't do it -
click seems to go elsewhere.
I can still select it by dragging, but once it's selected,
clicks seem to be happening at unit position,
regardless of mouse position.

Rafał Mużyło <voidmage>
Wed 30 Dec 2009 10:59:25 PM UTC, comment #2: 

Can you point to the decsription in guichan where they talk about this ? Thanks.

Do you mean this happens only in the menu screens and not while playing ?

François Beerten <feb>
Group administrator
Wed 30 Dec 2009 11:09:37 AM UTC, comment #1: 

In full-screen mode though, SDL does not properly pass through the pen coordinates from a graphics tablet:

I hope that whatever fix is eventually applied here will not make the tablet bug happen in windowed mode too.

Kalle Olavi Niemitalo <kon>
Group Member
Mon 09 Nov 2009 10:44:58 PM UTC, original submission:  

When fullscreen, mouse works correctly.
But if boswars is running windowed,
it seems that button press event is sent
at wrong coordinates.

I suspect the bug may be commimg from guichan,
(as it seems they had a bug, which description
fits this problem)
however it went through to many changes to
upgrade internal version without serious effort
(or at least a deeper understanding than only casual)
(it handles keyboard quite differently).

xf86-input-evdev 2.3.0

Rafał Mużyło <voidmage>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by feb (Posted a comment)
  • -email is unavailable- added by kon (Posted a comment)
  • -email is unavailable- added by voidmage (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-01-17 feb StatusNone Fixed
        Assigned toNone feb
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code