On Mon, 7 Jan 2019 08:59:30 +0100 Stephen Kitt <sk...@debian.org> wrote:
> On Sat, Jan 05, 2019 at 03:32:02AM -0500, Full Name wrote:
> > A similar problem occurs in DOSBox.  I'm not sure if this is a bug in xorg 
> > or SDL.
> > 
> > What is happening is that when you unpause, lbreakout2 tries to fence the 
> > mouse in its window,
> > but instead the window immediately loses focus causing lbreakout2 to pause 
> > again.  I'm not sure
> > why the mouse lock works the first time, but once it releases it cannot be 
> > regained.
> 
> Yup, this does seem to be the case. This issue was fixed in DOSBox
> with the patch available at
> https://www.dosbox.com/downloads/74-2-events.diff (also included in
> the current DOSBox package in unstable and testing).
> 
> Regards,
> 
> Stephen

Hi,

I've implemented the mentioned fix for DOSBox and it worked. (see added 
diff-file) But I couldn't add the macro from the DOSBox diff, because it 
doesn't work (don't know why). I'm also not very familiar with debian 
packaging, so I expect the diff file wasn't created/applied correctly. But here 
it is.

Kind regards,
bitfreak25
--- lbreakout2-2.6.5.orig/client/game.c	2013-05-03 19:06:20.000000000 +0200
+++ lbreakout2-2.6.5/client/game.c	2019-01-13 00:21:06.339765000 +0100
@@ -1150,6 +1150,17 @@
 		/* check wether an event occured */
 		button_clicked = key_pressed = 0;
 		if ( SDL_PollEvent( &event ) ) {
+			// Special code for broken SDL with Xorg 1.20.1, where pairs of inputfocus gain and loss events are generated
+			// when locking the mouse in windowed mode.
+			if (event.type == SDL_ACTIVEEVENT && event.active.state == SDL_APPINPUTFOCUS && event.active.gain == 0) {
+				SDL_Event test; //Check if the next event would undo this one.
+				if (SDL_PeepEvents(&test,1,SDL_PEEKEVENT,SDL_ACTIVEEVENTMASK) == 1 && test.active.state == SDL_APPINPUTFOCUS && test.active.gain == 1) {
+					// Skip both events.
+					SDL_PeepEvents(&test,1,SDL_GETEVENT,SDL_ACTIVEEVENTMASK);
+					continue;
+				}
+			}
+			
 			if ( client_state == CS_PAUSE && game->game_type == GT_NETWORK )
 				gui_dispatch_event( &event, ms );
 			else

Reply via email to