Added API and X11 implementation of cursor enter and leave callbacks.

This commit is contained in:
Hanmac
2012-01-30 22:18:05 +01:00
committed by Camilla Berglund
parent cd1caded8d
commit 0b752b84c3
5 changed files with 92 additions and 1 deletions
+33 -1
View File
@@ -679,7 +679,8 @@ static GLboolean createWindow(_GLFWwindow* window,
wa.border_pixel = 0;
wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
ExposureMask | FocusChangeMask | VisibilityChangeMask;
ExposureMask | FocusChangeMask | VisibilityChangeMask |
EnterWindowMask | LeaveWindowMask;
if (wndconfig->mode == GLFW_WINDOWED)
{
@@ -1180,6 +1181,37 @@ static void processSingleEvent(void)
break;
}
case EnterNotify:
{
// The mouse cursor enters the Window
window = findWindow(event.xcrossing.window);
if (window == NULL)
{
fprintf(stderr, "Cannot find GLFW window structure for EnterNotify event\n");
return;
}
if(window->cursorMode == GLFW_CURSOR_HIDDEN)
{
hideMouseCursor(window);
}
_glfwInputCursorEnter(window);
break;
}
case LeaveNotify:
{
// The mouse cursor leave the Window
window = findWindow(event.xcrossing.window);
if (window == NULL)
{
fprintf(stderr, "Cannot find GLFW window structure for LeaveNotify event\n");
return;
}
showMouseCursor(window);
_glfwInputCursorLeave(window);
break;
}
case MotionNotify:
{
// The mouse cursor was moved