Old 11-16-2009, 01:23 AM   #1
howl
Member
 
Join Date: Nov 2009
Posts: 90
howl is a 2 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default [Patch] Prevent focus lost at Fullscreen on X11

Quote:
Originally Posted by AJ 187 View Post
On Windows, I click outside of the window and then back inside of it, that gets it working again (most of the time, anyways). I am not sure if it works on Linux, but I figure it's worth a shot. I usually find it happening after changing the resolution.
Well, find it, StepMania when in FullScreen takes the focus of the keyboard so there is not way to use alt+tab and similar. The problem is that the focus is be lost when there is a big screen resolution chage, so, I have make this patch not to grab only when enter in FullScreen and to grab the keyboard also when there is a resolution chage at fullscreen. Tested and solves the issue.

This is an important issue because people that doesn't know anything about ttys will be left with a locked interface.

Code:
Index: src/arch/arch/LowLevelWindow/LowLevelWindow_X11.cpp
===================================================================
--- src/arch/LowLevelWindow/LowLevelWindow_X11.cpp (revision 28234)
+++ src/arch/LowLevelWindow/LowLevelWindow_X11.cpp (working copy)
@@ -181,11 +181,16 @@
 		// context.
 		bNewDeviceOut = false;
 	}
-	
-	g_iOldSize = XRRConfigCurrentConfiguration( g_pScreenConfig, &g_OldRotation );
-	
+
 	if( !p.windowed )
 	{
+		if( m_bWasWindowed )
+		{
+			// If the user changed the resolution while StepMania was windowed we overwrite the resolution to restore with it at exit.
+			g_iOldSize = XRRConfigCurrentConfiguration( g_pScreenConfig, &g_OldRotation );
+			m_bWasWindowed = false;
+		}
+
 		// Find a matching mode.
 		int iSizesXct;
 		XRRScreenSize *pSizesX = XRRSizes( Dpy, DefaultScreen(Dpy), &iSizesXct );
@@ -210,13 +215,10 @@
 		XMoveWindow( Dpy, Win, 0, 0 );
 		
 		XRaiseWindow( Dpy, Win );
-		
-		if( m_bWasWindowed )
-		{
-			// We want to prevent the WM from catching anything that comes from the keyboard.
-			XGrabKeyboard( Dpy, Win, True, GrabModeAsync, GrabModeAsync, CurrentTime );
-			m_bWasWindowed = false;
-		}
+
+		// We want to prevent the WM from catching anything that comes from the keyboard.
+		// We should do this every time on fullscreen and not only we entering from windowed mode because we could lost focus at resolution change and that will leave the user input locked.
+		XGrabKeyboard( Dpy, Win, True, GrabModeAsync, GrabModeAsync, CurrentTime );
 	}
 	else
 	{

Last edited by howl; 11-16-2009 at 02:18 AM.. Reason: Updated one more time, now save also the resolution that was entering from window to fullscreen mode
howl is offline   Reply With Quote
Old 11-16-2009, 01:50 AM   #2
howl
Member
 
Join Date: Nov 2009
Posts: 90
howl is a 2 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

I have added to the patch the ability to solve StepMania leaving it's last used screen resolution at full-screen on exit or window mode change, now restores the resolution that user had when starting StepMania.
howl is offline   Reply With Quote
Old 11-16-2009, 02:11 AM   #3
howl
Member
 
Join Date: Nov 2009
Posts: 90
howl is a 2 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

Updated one more time, this is a uncommon situation but if the user changed his resolution while in window mode the resolution to restore should be updated, so now the patch makes StepMania to also save the resolution when entering from windowed mode to fullscreen mode.
howl is offline   Reply With Quote
Old 11-16-2009, 02:19 AM   #4
howl
Member
 
Join Date: Nov 2009
Posts: 90
howl is a 2 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

Another update, analyzing the last patch was possible to remove the save of resolution in the constructor by moving if( m_bWasWindowed ) before changing the screen resolution.
howl is offline   Reply With Quote
Old 11-16-2009, 05:45 PM   #5
DaVince
Member
 
DaVince's Avatar
 
Join Date: Oct 2008
Location: Amsterdam, Netherlands
Posts: 384
DaVince is a 3 bar user
Reputation: 10

Send a message via AIM to DaVince Send a message via MSN to DaVince
Post rating: Votes: 0 Score: 0rate    
Default

I know of another fullscreen issue where the mouse pointer stays visible. Not sure if this patch somehow fixes it too but a mouse pointer in the middle of the screen while playing can definitely be distracting.
__________________
My Stepfiles (1 new in August 2009. Latest stepfile)
DaVince is offline   Reply With Quote
Old 11-16-2009, 06:10 PM   #6
howl
Member
 
Join Date: Nov 2009
Posts: 90
howl is a 2 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

Quote:
Originally Posted by DaVince View Post
I know of another fullscreen issue where the mouse pointer stays visible. Not sure if this patch somehow fixes it too but a mouse pointer in the middle of the screen while playing can definitely be distracting.
That happens you always, or only sometimes? I saw that only one time but is an issue more related to X11 or the window manager itself.
howl is offline   Reply With Quote
Old 11-16-2009, 08:39 PM   #7
DaVince
Member
 
DaVince's Avatar
 
Join Date: Oct 2008
Location: Amsterdam, Netherlands
Posts: 384
DaVince is a 3 bar user
Reputation: 10

Send a message via AIM to DaVince Send a message via MSN to DaVince
Post rating: Votes: 0 Score: 0rate    
Default

Only sometimes, surprisingly. Could be a video driver bug, but I dunno (Intel video drivers have improved in Linux lately, especially for my 915GM). It happens in both Xfce and LXDE, with or without compositing enabled.

I do know that StepMania locks the mouse pointer in place in fullscreen mode since I can't move it away once it's on the screen. Some other apps that showed similar behaviour would make the cursor invisible once it even moved a pixel, so if mouse movement was actually possible in fullscreen I could probably "remove the annoyance".
__________________
My Stepfiles (1 new in August 2009. Latest stepfile)
DaVince is offline   Reply With Quote
Old 11-18-2009, 09:28 PM   #8
pcvii
Member
 
Join Date: Nov 2009
Location: Lafayette, IN, USA
Posts: 24
pcvii is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

Yea, I've had the same problem with the mouse pointer. I thought it was strange. Most of my issues are when changing settings. Sometimes step mania just crashes sometimes this bug you just fixed happens. I look forward to seeing your patches, keep up the good work.
pcvii is offline   Reply With Quote
Old 11-22-2009, 01:43 PM   #9
howl
Member
 
Join Date: Nov 2009
Posts: 90
howl is a 2 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

If I have time I will try to make StepMania window unable to be Maximized or Resized.
howl is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to prevent your feet from getting tangled? akstylish General questions 5 04-24-2008 04:16 PM
StepMania keeps getting focus Lebon14 General questions 5 02-08-2008 11:28 PM
20080130 00:00|csd: Out of Focus (Edit) CHA and Amnesty CHA csd Movies 7 01-30-2008 11:14 PM
:?: random course - prevent the same song more than once? hayesy Song and Course questions 0 06-25-2007 06:51 PM


All times are GMT. The time now is 04:00 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Thanks to

SourceForge.net Logo