dashdan / freerct

Automatically exported from code.google.com/p/freerct
0 stars 0 forks source link

Make window movement more robuust against fast movements of the mouse pointer #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Move the window across the screen very quickly
2. Boom

gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff76ac4b3 in std::_Rb_tree_increment(std::_Rb_tree_node_base const*) 
() from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0  0x00007ffff76ac4b3 in std::_Rb_tree_increment(std::_Rb_tree_node_base 
const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00000000004277c1 in std::_Rb_tree_const_iterator<DrawData>::operator++ 
(this=0x7fffffffdfb0) at /usr/include/c++/4.7/bits/stl_tree.h:277
#2  0x0000000000425a8f in Viewport::OnDraw (this=0x7c9d30) at viewport.cpp:1220
#3  0x000000000042eb4d in UpdateWindows () at window.cpp:885
#4  0x000000000042ec0d in WindowManager::Tick (this=0x69ca80) at window.cpp:906
#5  0x0000000000405c1a in main () at main.cpp:125

Original issue reported on code.google.com by CharlesP...@googlemail.com on 16 Dec 2012 at 5:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It only happens when you move the window up and it is not required to move it 
very fast. Actually, it doesn't segfault only when you move it extremely slow.

Original comment by mkr...@gmail.com on 18 Dec 2012 at 11:37

GoogleCodeExporter commented 9 years ago

Original comment by CharlesP...@googlemail.com on 28 Dec 2012 at 2:17

GoogleCodeExporter commented 9 years ago

Original comment by CharlesP...@googlemail.com on 28 Dec 2012 at 2:18

GoogleCodeExporter commented 9 years ago
Should be fixed in r642

Original comment by Alberth2...@gmail.com on 30 Dec 2012 at 1:51

GoogleCodeExporter commented 9 years ago
Sorry to inform you, but now when you try moving the window upwards, the cursor 
just loses it as if the mouse button was released: the window moves a few 
pixels and then stops, and the cursor continues going.

Original comment by mkr...@gmail.com on 31 Dec 2012 at 2:56

GoogleCodeExporter commented 9 years ago
Yeah it does, but it does not seg-fault any more, which is what the issue was 
about.

What happened is that during the move, the mouse cursor left the window you are 
moving, so the game switched to another window, namely the main display under 
it, and started moving that window. Together with not clipping the window to 
the screen, the draw code caused data corruption in other memory parts, giving 
segmentation faults etc.
This is what I wanted to fix; crashes are very annoying.

I don't understand how it manages to switch windows, it should not be possible. 
Finding out how that happens will be done another day. As a work-around, move 
your mouse to the bottom of the title bar before the drag, and/or don't move 
too fast.

Original comment by Alberth2...@gmail.com on 31 Dec 2012 at 10:47

GoogleCodeExporter commented 9 years ago
Issue 19 has been merged into this issue.

Original comment by CharlesP...@googlemail.com on 4 Jul 2013 at 11:30

GoogleCodeExporter commented 9 years ago
I fixed the window moving.
The UpdateCurrentWindow method will change the current window if you move to 
fast. In my opinion it should only be called in WMMM_PASS_THROUGH mode, because 
when you click on a window, it should follow your mouse untill you unclick it.
So you don't have to call UpdateCurrentWindow when dragging a window.

Original comment by tnt.free...@gmail.com on 19 Jul 2013 at 11:27

Attachments:

GoogleCodeExporter commented 9 years ago
The patch does not apply. You seem to have a different TAB width, and replace 
TAB characters by spaces.

Since the project uses TAB characters as leading white space, that makes 
applying the patch impossible.

Could you please make a patch that uses TABs as leading white space?

Original comment by Alberth2...@gmail.com on 20 Jul 2013 at 2:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
My bad, vim seems to replace tabs with spaces in the file.
Here is the patch with tabs.

Original comment by tnt.free...@gmail.com on 20 Jul 2013 at 4:02

Attachments:

GoogleCodeExporter commented 9 years ago
Applied your patch in r789, thanks for the fix.

Please watch out for trailing white space (causing spurious "this->mouse_pos = 
pos;" replacement), and empty lines at the end that got added.

I use

set list
set listchars=tab:>-,trail:<

In .vimrc to see whitespace problems, and always check the produced patch for 
weird additions (It amazing how much you find that way :) ).

Original comment by Alberth2...@gmail.com on 22 Jul 2013 at 9:43

GoogleCodeExporter commented 9 years ago
Will do in the future, thanks.

Original comment by tnt.free...@gmail.com on 22 Jul 2013 at 11:43