mouse events and fullscreen

hey,

oF seems to be ignoring the first mouse press events after going into or out of fullscreen mode. can anybody else verify this?

could there be any glut or window management functions that i could call in order to fix this problem?

thanks,

jeremy

of_preRelease_v0.05_xcode, osx 10.4.10

  
  
  
void testApp::mousePressed(int x, int y, int button){   
	  
	printf("mousepressed");  
	  
       if(x < 100 && y < 100){  
	  
		ofToggleFullscreen();  
	}  
}  
  
  

seems to work fine for me if I click twice, once to get the window in focus, second to get the mousePressed event to happen. are you not getting the second press event to happen?

take care!
zach

hey zach,

let me clarify.

1st mouse press - window focus
2nd (in invisible button area) - app goes to full screen
3rd (in invisible button area) - ignored
4th (in invisible button area) - app goes out of full screen
5th (in invisible button area) - ignored
6th (in invisible button area) - app goes back to full screen again

shouldn’t the window automatically be in focus after it jumps into fullscreen mode?

jeremy

ok so the issue is not loosing focus, it’s just that when you call toggle screen in middle of the mousePressed event, you seem to loose the mouseUp event. Then, the next time you press, (after the toggle) it seems to drop the down event and only give you the up event. Can you put in a boolean variable, as a flag and do the toggle in update()? I think then you will get both down and up events and not have the problem you are having now…

ps, to debug this, I added this line of code,

  
  
//------------------------------------------------------------  
void mouse_cb(int button, int state, int x, int y) {  
  
	cout << " here " << nFrameCount << " " << button << " " << state << " " << x << " " << y << endl;  
	  
  

which gives some info that (a) it is not loosing the event and (b) it’s just coming out only as a an “up” rather then a “down”.

hope that helps &
take care!
zach

you’re right, the mouse events are being recorded, glut just misses those mousereleased events and gets confused.

i tried creating a boolean variable which triggers fullscreen in update(), but that didn’t work (same behaviour) however, placing that function in mouseRelease() did the trick.

unfortunately, doesn’t look like there’s a way to send glut a reminder.

thanks for looking into it, zach. it’s much appreciated.

jeremy

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){

if(x < 100 && y < 100){

bToggleFullscreen = true;
}
}

//--------------------------------------------------------------
void testApp::mouseReleased(){

if(bToggleFullscreen) { ofToggleFullscreen(); bToggleFullscreen = false; }
}