X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_main.c;h=e31ee1a027e5ba23f0e031ffd2b2aec5181a6ff5;hb=ded8742fba5a4622b49778679cc7e26d197d75c5;hp=3926b3856139e9a4695a7f975e9df90f3feca67b;hpb=43db91d700145ae03ae7b83308a869aef5bd6eb0;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 3926b38..e31ee1a 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -122,7 +122,8 @@ static void fghReshapeWindow ( SFG_Window *window, int width, int height ) if ( window->Parent == NULL ) { - if ( ! window->IsMenu && (window != fgStructure.GameModeWindow) ) + if ( ! window->IsMenu && (window != fgStructure.GameModeWindow) && + !( fgState.DisplayMode & GLUT_BORDERLESS )) { w += GetSystemMetrics( SM_CXSIZEFRAME ) * 2; h += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 + @@ -512,7 +513,7 @@ static void fghSleepForEvents( void ) /* * Returns GLUT modifier mask for the state field of an X11 event. */ -static int fghGetXModifiers( int state ) +int fghGetXModifiers( int state ) { int ret = 0; @@ -1445,7 +1446,10 @@ void FGAPIENTRY glutMainLoopEvent( void ) break; default: - fgWarning ("Unknown X event type: %d\n", event.type); + /* enter handling of Extension Events here */ + #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H + fgHandleExtensionEvents( &event ); + #endif break; } } @@ -1918,6 +1922,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, fgUpdateMenuHighlight( window->ActiveMenu ); break; } + SetFocus(window->Window.Handle); fgState.Modifiers = fghGetWin32Modifiers( ); @@ -2444,6 +2449,41 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); break; +#ifdef WM_TOUCH + /* handle multi-touch messages */ + case WM_TOUCH: + { + unsigned int numInputs = (unsigned int)wParam; + unsigned int i = 0; + TOUCHINPUT* ti = (TOUCHINPUT*)malloc( sizeof(TOUCHINPUT)*numInputs); + if (GetTouchInputInfo( (HTOUCHINPUT)lParam, numInputs, ti, sizeof(TOUCHINPUT) )) { + /* Handle each contact point */ + for (i = 0; i < numInputs; ++i ) { + + POINT tp; + tp.x = TOUCH_COORD_TO_PIXEL(ti[i].x); + tp.y = TOUCH_COORD_TO_PIXEL(ti[i].y); + ScreenToClient( hWnd, &tp ); + + ti[i].dwID = ti[i].dwID * 2; + + if (ti[i].dwFlags & TOUCHEVENTF_DOWN) { + INVOKE_WCB( *window, MultiEntry, ( ti[i].dwID, GLUT_ENTERED ) ); + INVOKE_WCB( *window, MultiButton, ( ti[i].dwID, tp.x, tp.y, 0, GLUT_DOWN ) ); + } else if (ti[i].dwFlags & TOUCHEVENTF_MOVE) { + INVOKE_WCB( *window, MultiMotion, ( ti[i].dwID, tp.x, tp.y ) ); + } else if (ti[i].dwFlags & TOUCHEVENTF_UP) { + INVOKE_WCB( *window, MultiButton, ( ti[i].dwID, tp.x, tp.y, 0, GLUT_UP ) ); + INVOKE_WCB( *window, MultiEntry, ( ti[i].dwID, GLUT_LEFT ) ); + } + } + } + CloseTouchInputHandle((HTOUCHINPUT)lParam); + free( (void*)ti ); + lRet = 0; /*DefWindowProc( hWnd, uMsg, wParam, lParam );*/ + break; + } +#endif default: /* Handle unhandled messages */ lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );