My program create a window using GLUT,
when this program running on WINDOWS XP, the "glutEntryFunc" works well, which means when I leave the window I created by "glutCreateWindow" and click other windows by mouse_L button, the window will loss focus,when I enter the window I created and click by hit mouse_L button, the Window will retrieve the Focus.
but on MAC OS, when my mouse leave the Window without mouse click, it will lose Focus, why?
how can I make it works well as in WINDOWS XP on MAC OS?
below is the sample code, it will works both on MAC OS and WINDOWS XP.
#include <stdio.h>
#include "GLUT.h"
#include <stdlib.h>
void Update(int para)
{
glutPostRedisplay();
glutTimerFunc(17,Update,0);
}
void exitfunc(int para)
{
exit(0);
}
void key_process(unsigned char key,int x,int y)
{
if(key == '\033')//ESC
{
exit(0);
}
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}
void focus_lost(int bAct)
{
if(bAct == GLUT_ENTERED)
{
printf("get focus \n");
}
else
{
printf("lose focus\n");
}
}
int main(int argc, char ** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
{
glutInitWindowSize(1024,768);
}
glutCreateWindow("Xcode Glut Demo");
glutTimerFunc(17, Update,0);
glutDisplayFunc(display);
glutKeyboardFunc(key_process);
glutEntryFunc(focus_lost);
glutMainLoop();
}
when this program running on WINDOWS XP, the "glutEntryFunc" works well, which means when I leave the window I created by "glutCreateWindow" and click other windows by mouse_L button, the window will loss focus,when I enter the window I created and click by hit mouse_L button, the Window will retrieve the Focus.
but on MAC OS, when my mouse leave the Window without mouse click, it will lose Focus, why?
how can I make it works well as in WINDOWS XP on MAC OS?
below is the sample code, it will works both on MAC OS and WINDOWS XP.
#include <stdio.h>
#include "GLUT.h"
#include <stdlib.h>
void Update(int para)
{
glutPostRedisplay();
glutTimerFunc(17,Update,0);
}
void exitfunc(int para)
{
exit(0);
}
void key_process(unsigned char key,int x,int y)
{
if(key == '\033')//ESC
{
exit(0);
}
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}
void focus_lost(int bAct)
{
if(bAct == GLUT_ENTERED)
{
printf("get focus \n");
}
else
{
printf("lose focus\n");
}
}
int main(int argc, char ** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
{
glutInitWindowSize(1024,768);
}
glutCreateWindow("Xcode Glut Demo");
glutTimerFunc(17, Update,0);
glutDisplayFunc(display);
glutKeyboardFunc(key_process);
glutEntryFunc(focus_lost);
glutMainLoop();
}