X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2FCommon%2Ffreeglut_internal.h;h=815d13eb947ade033058552a71cbb4478eb73a1d;hb=28ba5e26f5546a236e93dc3e23ce4777b41f9ffc;hp=cb527ff0695cfbab86a9ce2691326f1265f962b4;hpb=b7ffd3e60d961de87355b3027e589eb150337e60;p=freeglut diff --git a/src/Common/freeglut_internal.h b/src/Common/freeglut_internal.h index cb527ff..815d13e 100644 --- a/src/Common/freeglut_internal.h +++ b/src/Common/freeglut_internal.h @@ -210,6 +210,59 @@ LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); #define INVALID_MODIFIERS 0xffffffff + + +/* Platform-specific includes */ +#if TARGET_HOST_POSIX_X11 + +typedef struct tagSFG_PlatformDisplay SFG_PlatformDisplay; +struct tagSFG_PlatformDisplay +{ + Display* Display; /* The display we are being run in. */ + int Screen; /* The screen we are about to use. */ + Window RootWindow; /* The screen's root window. */ + int Connection; /* The display's connection number */ + Atom DeleteWindow; /* The window deletion atom */ + Atom State; /* The state atom */ + Atom StateFullScreen; /* The full screen atom */ + +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H + int prev_xsz, prev_ysz; + int prev_refresh; + int prev_size_valid; +#endif /* HAVE_X11_EXTENSIONS_XRANDR_H */ + +#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H + /* + * XF86VidMode may be compilable even if it fails at runtime. Therefore, + * the validity of the VidMode has to be tracked + */ + int DisplayModeValid; /* Flag that indicates runtime status*/ + XF86VidModeModeLine DisplayMode; /* Current screen's display settings */ + int DisplayModeClock; /* The display mode's refresh rate */ + int DisplayViewPortX; /* saved X location of the viewport */ + int DisplayViewPortY; /* saved Y location of the viewport */ +#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */ + + int DisplayPointerX; /* saved X location of the pointer */ + int DisplayPointerY; /* saved Y location of the pointer */ +}; + + +/* + * Make "freeglut" window handle and context types so that we don't need so + * much conditionally-compiled code later in the library. + */ +typedef Window SFG_WindowHandleType ; +typedef GLXContext SFG_WindowContextType ; + + +#endif +#if TARGET_HOST_MS_WINDOWS +#include "../mswin/freeglut_internal_mswin.h" +#endif + + /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */ /* Freeglut callbacks type definitions */ @@ -356,42 +409,7 @@ struct tagSFG_State typedef struct tagSFG_Display SFG_Display; struct tagSFG_Display { -#if TARGET_HOST_POSIX_X11 - Display* Display; /* The display we are being run in. */ - int Screen; /* The screen we are about to use. */ - Window RootWindow; /* The screen's root window. */ - int Connection; /* The display's connection number */ - Atom DeleteWindow; /* The window deletion atom */ - Atom State; /* The state atom */ - Atom StateFullScreen; /* The full screen atom */ - -#ifdef HAVE_X11_EXTENSIONS_XRANDR_H - int prev_xsz, prev_ysz; - int prev_refresh; - int prev_size_valid; -#endif /* HAVE_X11_EXTENSIONS_XRANDR_H */ - -#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H - /* - * XF86VidMode may be compilable even if it fails at runtime. Therefore, - * the validity of the VidMode has to be tracked - */ - int DisplayModeValid; /* Flag that indicates runtime status*/ - XF86VidModeModeLine DisplayMode; /* Current screen's display settings */ - int DisplayModeClock; /* The display mode's refresh rate */ - int DisplayViewPortX; /* saved X location of the viewport */ - int DisplayViewPortY; /* saved Y location of the viewport */ -#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */ - - int DisplayPointerX; /* saved X location of the pointer */ - int DisplayPointerY; /* saved Y location of the pointer */ - -#elif TARGET_HOST_MS_WINDOWS - HINSTANCE Instance; /* The application's instance */ - DEVMODE DisplayMode; /* Desktop's display settings */ - char *DisplayName; /* Display name for multi display support*/ - -#endif + SFG_PlatformDisplay pDisplay; int ScreenWidth; /* The screen's width in pixels */ int ScreenHeight; /* The screen's height in pixels */ @@ -411,22 +429,6 @@ struct tagSFG_Timer }; /* - * Make "freeglut" window handle and context types so that we don't need so - * much conditionally-compiled code later in the library. - */ -#if TARGET_HOST_POSIX_X11 - -typedef Window SFG_WindowHandleType ; -typedef GLXContext SFG_WindowContextType ; - -#elif TARGET_HOST_MS_WINDOWS - -typedef HWND SFG_WindowHandleType ; -typedef HGLRC SFG_WindowContextType ; - -#endif - -/* * A window and its OpenGL context. The contents of this structure * are highly dependant on the target operating system we aim at... */ @@ -918,19 +920,6 @@ void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator ); void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback, SFG_Enumerator* enumerator ); -#if TARGET_HOST_MS_WINDOWS -/* - * Helper functions for getting client area from the window rect - * and the window rect from the client area given the style of the window - * (or a valid window pointer from which the style can be queried). - */ -void fghComputeWindowRectFromClientArea_UseStyle ( const DWORD windowStyle , RECT *clientRect, BOOL posIsOutside ); -void fghComputeWindowRectFromClientArea_QueryWindow( const SFG_Window *window, RECT *clientRect, BOOL posIsOutside ); -void fghComputeClientAreaFromWindowRect ( const SFG_Window *window, RECT *windowRect, BOOL wantPosOutside ); -RECT fghGetClientArea ( const SFG_Window *window, BOOL wantPosOutside ); -void fghGetBorderWidth(const DWORD windowStyle, int* xBorderWidth, int* yBorderWidth); -#endif - /* * fgWindowByHandle returns a (SFG_Window *) value pointing to the * first window in the queue matching the specified window handle.