From 80f6707bf439db6ded52d4d28e9e6721a53b92c3 Mon Sep 17 00:00:00 2001 From: fayjf Date: Mon, 23 Jan 2012 02:46:16 +0000 Subject: [PATCH] Splitting a little Windows-specific menu code into its own file git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@996 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/Common/freeglut_menu.c | 40 ++++++++++--------- .../freeglut/src/mswin/freeglut_menu_mswin.c | 36 +++++++++++++++++ 2 files changed, 58 insertions(+), 18 deletions(-) diff --git a/freeglut/freeglut/src/Common/freeglut_menu.c b/freeglut/freeglut/src/Common/freeglut_menu.c index 2a963e2..91b2b83 100644 --- a/freeglut/freeglut/src/Common/freeglut_menu.c +++ b/freeglut/freeglut/src/Common/freeglut_menu.c @@ -84,6 +84,9 @@ static float menu_pen_hfore [4] = {0.0f, 0.0f, 0.0f, 1.0f}; static float menu_pen_hback [4] = {1.0f, 1.0f, 1.0f, 1.0f}; #endif + +extern GLvoid fghGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y ); + /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ /* @@ -139,27 +142,28 @@ static void fghDeactivateSubMenu( SFG_MenuEntry *menuEntry ) /* * Private function to get the virtual maximum screen extent */ +#if TARGET_HOST_POSIX_X11 +static GLvoid fghGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y ) +{ + int wx, wy; + Window w; + + XTranslateCoordinates( + fgDisplay.Display, + window->Window.Handle, + fgDisplay.RootWindow, + 0, 0, &wx, &wy, &w); + + *x = fgState.GameModeSize.X + wx; + *y = fgState.GameModeSize.Y + wy; +} +#endif + + static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y ) { if( fgStructure.GameModeWindow ) - { -#if TARGET_HOST_POSIX_X11 - int wx, wy; - Window w; - - XTranslateCoordinates( - fgDisplay.Display, - window->Window.Handle, - fgDisplay.RootWindow, - 0, 0, &wx, &wy, &w); - - *x = fgState.GameModeSize.X + wx; - *y = fgState.GameModeSize.Y + wy; -#else - *x = glutGet ( GLUT_SCREEN_WIDTH ); - *y = glutGet ( GLUT_SCREEN_HEIGHT ); -#endif - } + fghGetGameModeVMaxExtent ( window, x, y ); else { *x = fgDisplay.ScreenWidth; diff --git a/freeglut/freeglut/src/mswin/freeglut_menu_mswin.c b/freeglut/freeglut/src/mswin/freeglut_menu_mswin.c index e69de29..5d22b16 100644 --- a/freeglut/freeglut/src/mswin/freeglut_menu_mswin.c +++ b/freeglut/freeglut/src/mswin/freeglut_menu_mswin.c @@ -0,0 +1,36 @@ +/* + * freeglut_menu_mswin.c + * + * The Windows-specific mouse cursor related stuff. + * + * Copyright (c) 2012 Stephen J. Baker. All Rights Reserved. + * Written by John F. Fay, + * Creation date: Sun Jan 22, 2012 + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include "freeglut_internal_mswin.h" + + +GLvoid fghGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y ) +{ + *x = glutGet ( GLUT_SCREEN_WIDTH ); + *y = glutGet ( GLUT_SCREEN_HEIGHT ); +}