Merge branch 'master' into EGL

Conflicts:
	CMakeLists.txt
	include/GL/glfw3.h
	readme.html
	src/CMakeLists.txt
	src/internal.h
	src/window.c
This commit is contained in:
Camilla Berglund
2012-09-23 15:35:45 +02:00
25 changed files with 356 additions and 300 deletions

View File

@@ -10,7 +10,11 @@ if (_GLFW_COCOA_NSGL)
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h)
set(glfw_SOURCES ${common_SOURCES} cocoa_clipboard.m cocoa_fullscreen.m
cocoa_gamma.c cocoa_init.m cocoa_input.m cocoa_joystick.m
cocoa_native.m cocoa_opengl.m cocoa_time.c cocoa_window.m)
cocoa_opengl.m cocoa_time.c cocoa_window.m)
if (GLFW_NATIVE_API)
list(APPEND glfw_SOURCES cocoa_native.m)
endif()
# For some reason, CMake doesn't know about .m
set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C)
@@ -18,14 +22,21 @@ elseif (_GLFW_WIN32_WGL)
set(glfw_HEADERS ${common_HEADERS} win32_platform.h)
set(glfw_SOURCES ${common_SOURCES} win32_clipboard.c win32_fullscreen.c
win32_gamma.c win32_init.c win32_input.c win32_joystick.c
win32_native.c win32_opengl.c win32_time.c win32_window.c
win32_dllmain.c)
win32_opengl.c win32_time.c win32_window.c)
if (GLFW_NATIVE_API)
list(APPEND glfw_SOURCES win32_native.c)
endif()
elseif (_GLFW_X11_GLX)
set(glfw_HEADERS ${common_HEADERS} x11_platform.h glx_platform.h)
set(glfw_SOURCES ${common_SOURCES} glx_opengl.c x11_clipboard.c
x11_fullscreen.c x11_gamma.c x11_init.c x11_input.c
x11_joystick.c x11_keysym2unicode.c x11_native.c x11_time.c
x11_joystick.c x11_keysym2unicode.c x11_time.c
x11_window.c)
if (GLFW_NATIVE_API)
list(APPEND glfw_SOURCES x11_native.c)
endif()
elseif (_GLFW_X11_EGL)
set(glfw_HEADERS ${common_HEADERS} x11_platform.h egl_platform.h)
set(glfw_SOURCES ${common_SOURCES} egl_opengl.c x11_clipboard.c

View File

@@ -131,6 +131,25 @@
return NSTerminateCancel;
}
- (void)applicationDidHide:(NSNotification *)notification
{
_GLFWwindow* window;
for (window = _glfwLibrary.windowListHead; window; window = window->next)
_glfwInputWindowVisibility(window, GL_FALSE);
}
- (void)applicationDidUnhide:(NSNotification *)notification
{
_GLFWwindow* window;
for (window = _glfwLibrary.windowListHead; window; window = window->next)
{
if ([window->NS.object isVisible])
_glfwInputWindowVisibility(window, GL_TRUE);
}
}
@end
@@ -905,7 +924,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!createContext(window, wndconfig, fbconfig))
return GL_FALSE;
[window->NS.object makeKeyAndOrderFront:nil];
[window->NSGL.context setView:[window->NS.object contentView]];
if (wndconfig->mode == GLFW_FULLSCREEN)
@@ -920,6 +938,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
return GL_FALSE;
}
_glfwPlatformShowWindow(window);
[[window->NS.object contentView] enterFullScreenMode:[NSScreen mainScreen]
withOptions:nil];
}
@@ -1029,6 +1048,27 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
}
//========================================================================
// Show window
//========================================================================
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
[window->NS.object makeKeyAndOrderFront:nil];
_glfwInputWindowVisibility(window, GL_TRUE);
}
//========================================================================
// Hide window
//========================================================================
void _glfwPlatformHideWindow(_GLFWwindow* window)
{
[window->NS.object orderOut:nil];
_glfwInputWindowVisibility(window, GL_FALSE);
}
//========================================================================
// Write back window parameters into GLFW window structure
//========================================================================

View File

@@ -69,7 +69,7 @@
#cmakedefine _GLFW_HAS_EGLGETPROCADDRESS 1
// Define this to 1 if the Linux joystick API is available
#cmakedefine _GLFW_USE_LINUX_JOYSTICKS
#cmakedefine _GLFW_HAS_LINUX_JOYSTICKS
// The GLFW version as used by glfwGetVersionString
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"

View File

@@ -32,7 +32,7 @@
#include "internal.h"
#include <stdlib.h>
#if _WIN32
#if defined(_MSC_VER)
#include <malloc.h>
#endif

View File

@@ -61,18 +61,15 @@ GLFWAPI void glfwSetGamma(float gamma)
for (i = 0; i < size; i++)
{
float value = (float) i / ((float) (size - 1));
float value;
// Apply gamma
// Calculate intensity
value = (float) i / (float) (size - 1);
// Apply gamma curve
value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f;
// Clamp to value range
value = (float) fmax(fmin(value, 65535.f), 0.f);
// Clamp values
if (value < 0.f)
value = 0.f;
else if (value > 65535.f)
value = 65535.f;
// Set the gamma ramp values
ramp.red[i] = (unsigned short) value;
ramp.green[i] = (unsigned short) value;
ramp.blue[i] = (unsigned short) value;

View File

@@ -98,6 +98,7 @@ struct _GLFWhints
int auxBuffers;
GLboolean stereo;
GLboolean resizable;
GLboolean visible;
int samples;
int clientAPI;
int glMajor;
@@ -121,6 +122,7 @@ struct _GLFWwndconfig
const char* title;
int refreshRate;
GLboolean resizable;
GLboolean visible;
int clientAPI;
int glMajor;
int glMinor;
@@ -172,6 +174,7 @@ struct _GLFWwindow
int positionX, positionY;
int mode; // GLFW_WINDOW or GLFW_FULLSCREEN
GLboolean resizable; // GL_TRUE if user may resize this window
GLboolean visible; // GL_TRUE if this window is visible
int refreshRate; // monitor refresh rate
void* userPointer;
@@ -290,6 +293,8 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y);
void _glfwPlatformIconifyWindow(_GLFWwindow* window);
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
void _glfwPlatformShowWindow(_GLFWwindow* window);
void _glfwPlatformHideWindow(_GLFWwindow* window);
// Event processing
void _glfwPlatformPollEvents(void);
@@ -318,6 +323,7 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated);
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y);
void _glfwInputWindowSize(_GLFWwindow* window, int width, int height);
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified);
void _glfwInputWindowVisibility(_GLFWwindow* window, int visible);
void _glfwInputWindowDamage(_GLFWwindow* window);
void _glfwInputWindowCloseRequest(_GLFWwindow* window);

View File

@@ -1,49 +0,0 @@
//========================================================================
// GLFW - An OpenGL library
// Platform: Win32
// API version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#include "internal.h"
#if defined(_GLFW_BUILD_DLL)
//========================================================================
// GLFW DLL entry point
//========================================================================
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
// NOTE: Some compilers complains about instance and x never being used -
// never mind that (we don't want to use them)!
return TRUE;
}
#endif // _GLFW_BUILD_DLL

View File

@@ -39,6 +39,18 @@
#endif // __BORLANDC__
//========================================================================
// GLFW DLL entry point
//========================================================================
#if defined(_GLFW_BUILD_DLL)
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
return TRUE;
}
#endif // _GLFW_BUILD_DLL
//========================================================================
// Load necessary libraries (DLLs)
//========================================================================

View File

@@ -33,95 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
//========================================================================
// Enable/disable minimize/restore animations
//========================================================================
static int setMinMaxAnimations(int enable)
{
ANIMATIONINFO AI;
int old_enable;
// Get old animation setting
AI.cbSize = sizeof(ANIMATIONINFO);
SystemParametersInfo(SPI_GETANIMATION, AI.cbSize, &AI, 0);
old_enable = AI.iMinAnimate;
// If requested, change setting
if (old_enable != enable)
{
AI.iMinAnimate = enable;
SystemParametersInfo(SPI_SETANIMATION, AI.cbSize, &AI,
SPIF_SENDCHANGE);
}
return old_enable;
}
//========================================================================
// Focus the window and bring it to the top of the stack
// Due to some nastiness with how XP handles SetForegroundWindow we have
// to go through some really bizarre measures to achieve this
//========================================================================
static void setForegroundWindow(HWND hWnd)
{
int try_count = 0;
int old_animate;
// Try the standard approach first...
BringWindowToTop(hWnd);
SetForegroundWindow(hWnd);
// If it worked, return now
if (hWnd == GetForegroundWindow())
{
// Try to modify the system settings (since this is the foreground
// process, we are allowed to do this)
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID) 0,
SPIF_SENDCHANGE);
return;
}
// For other Windows versions than 95 & NT4.0, the standard approach
// may not work, so if we failed we have to "trick" Windows into
// making our window the foureground window: Iconify and restore
// again. It is ugly, but it seems to work (we turn off those annoying
// zoom animations to make it look a bit better at least).
// Turn off minimize/restore animations
old_animate = setMinMaxAnimations(0);
// We try this a few times, just to be on the safe side of things...
do
{
// Iconify & restore
ShowWindow(hWnd, SW_HIDE);
ShowWindow(hWnd, SW_SHOWMINIMIZED);
ShowWindow(hWnd, SW_SHOWNORMAL);
// Try to get focus
BringWindowToTop(hWnd);
SetForegroundWindow(hWnd);
// We do not want to keep going on forever, so we keep track of
// how many times we tried
try_count++;
}
while (hWnd != GetForegroundWindow() && try_count <= 3);
// Restore the system minimize/restore animation setting
setMinMaxAnimations(old_animate);
// Try to modify the system settings (since this is now hopefully the
// foreground process, we are probably allowed to do this)
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID) 0,
SPIF_SENDCHANGE);
}
#include <windowsx.h>
//========================================================================
// Hide mouse cursor
@@ -393,37 +305,6 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
}
//========================================================================
// Translates a Windows key to Unicode
//========================================================================
static void translateChar(_GLFWwindow* window, DWORD wParam, DWORD lParam)
{
BYTE keyboard_state[256];
WCHAR unicode_buf[10];
UINT scan_code;
int i, num_chars;
GetKeyboardState(keyboard_state);
// Derive scan code from lParam and action
scan_code = (lParam & 0x01ff0000) >> 16;
num_chars = ToUnicode(
wParam, // virtual-key code
scan_code, // scan code
keyboard_state, // key-state array
unicode_buf, // buffer for translated key
10, // size of translated key buffer
0 // active-menu flag
);
// Report characters
for (i = 0; i < num_chars; i++)
_glfwInputChar(window, (int) unicode_buf[i]);
}
//========================================================================
// Window callback function (handles window events)
//========================================================================
@@ -507,6 +388,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
return 0;
}
case WM_SHOWWINDOW:
{
_glfwInputWindowVisibility(window, wParam ? GL_TRUE : GL_FALSE);
break;
}
case WM_SYSCOMMAND:
{
switch (wParam & 0xfff0)
@@ -541,13 +428,15 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_SYSKEYDOWN:
{
_glfwInputKey(window, translateKey(wParam, lParam), GLFW_PRESS);
if (_glfwLibrary.charCallback)
translateChar(window, (DWORD) wParam, (DWORD) lParam);
break;
}
case WM_CHAR:
{
_glfwInputChar(window, wParam);
return 0;
}
case WM_KEYUP:
case WM_SYSKEYUP:
{
@@ -642,8 +531,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
int newCursorX, newCursorY;
// Get signed (!) cursor position
newCursorX = (int)((short)LOWORD(lParam));
newCursorY = (int)((short)HIWORD(lParam));
newCursorX = GET_X_LPARAM(lParam);
newCursorY = GET_Y_LPARAM(lParam);
if (newCursorX != window->Win32.oldCursorX ||
newCursorY != window->Win32.oldCursorY)
@@ -836,7 +725,7 @@ static int createWindow(_GLFWwindow* window,
WCHAR* wideTitle;
// Set common window styles
dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE;
dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
dwExStyle = WS_EX_APPWINDOW;
// Set window style, depending on fullscreen mode
@@ -1067,13 +956,11 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (window->mode == GLFW_FULLSCREEN)
{
// Place the window above all topmost windows
_glfwPlatformShowWindow(window);
SetWindowPos(window->Win32.handle, HWND_TOPMOST, 0,0,0,0,
SWP_NOMOVE | SWP_NOSIZE);
}
setForegroundWindow(window->Win32.handle);
SetFocus(window->Win32.handle);
return GL_TRUE;
}
@@ -1193,6 +1080,29 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
}
//========================================================================
// Show or hide window
//========================================================================
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
ShowWindow(window->Win32.handle, SW_SHOWNORMAL);
BringWindowToTop(window->Win32.handle);
SetForegroundWindow(window->Win32.handle);
SetFocus(window->Win32.handle);
}
//========================================================================
// Show or hide window
//========================================================================
void _glfwPlatformHideWindow(_GLFWwindow* window)
{
ShowWindow(window->Win32.handle, SW_HIDE);
}
//========================================================================
// Write back window parameters into GLFW window structure
//========================================================================
@@ -1239,28 +1149,22 @@ void _glfwPlatformPollEvents(void)
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
switch (msg.message)
if (msg.message == WM_QUIT)
{
case WM_QUIT:
// Treat WM_QUIT as a close on all windows
window = _glfwLibrary.windowListHead;
while (window)
{
// Treat WM_QUIT as a close on all windows
window = _glfwLibrary.windowListHead;
while (window)
{
_glfwInputWindowCloseRequest(window);
window = window->next;
}
break;
}
default:
{
DispatchMessage(&msg);
break;
_glfwInputWindowCloseRequest(window);
window = window->next;
}
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// LSHIFT/RSHIFT fixup (keys tend to "stick" without this fix)

View File

@@ -33,7 +33,7 @@
#include <string.h>
#include <stdlib.h>
#if _WIN32
#if defined(_MSC_VER)
#include <malloc.h>
#endif
@@ -81,8 +81,9 @@ void _glfwSetDefaultWindowHints(void)
_glfwLibrary.hints.glMajor = 1;
_glfwLibrary.hints.glMinor = 0;
// The default is to allow window resizing
// The default is to show the window and allow window resizing
_glfwLibrary.hints.resizable = GL_TRUE;
_glfwLibrary.hints.visible = GL_TRUE;
// The default is 24 bits of depth, 8 bits of color
_glfwLibrary.hints.depthBits = 24;
@@ -181,6 +182,16 @@ void _glfwInputWindowIconify(_GLFWwindow* window, int iconified)
}
//========================================================================
// Register window visibility events
//========================================================================
void _glfwInputWindowVisibility(_GLFWwindow* window, int visible)
{
window->visible = visible;
}
//========================================================================
// Register window damage events
//========================================================================
@@ -251,6 +262,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
wndconfig.title = title;
wndconfig.refreshRate = Max(_glfwLibrary.hints.refreshRate, 0);
wndconfig.resizable = _glfwLibrary.hints.resizable ? GL_TRUE : GL_FALSE;
wndconfig.visible = _glfwLibrary.hints.visible ? GL_TRUE : GL_FALSE;
wndconfig.clientAPI = _glfwLibrary.hints.clientAPI;
wndconfig.glMajor = _glfwLibrary.hints.glMajor;
wndconfig.glMinor = _glfwLibrary.hints.glMinor;
@@ -326,8 +338,9 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
// Cache the actual (as opposed to requested) window parameters
_glfwPlatformRefreshWindowParams(window);
// Cache the actual (as opposed to requested) context parameters
glfwMakeContextCurrent(window);
// Cache the actual (as opposed to requested) context parameters
if (!_glfwRefreshContextParams())
{
glfwDestroyWindow(window);
@@ -343,6 +356,11 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
return GL_FALSE;
}
// Clearing the front buffer to black to avoid garbage pixels left over
// from previous uses of our bit of VRAM
glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(window);
// Restore the previously current context (or NULL)
glfwMakeContextCurrent(previous);
@@ -351,10 +369,8 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
if (mode == GLFW_FULLSCREEN)
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED);
// Clearing the front buffer to black to avoid garbage pixels left over
// from previous uses of our bit of VRAM
glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(window);
if (mode == GLFW_WINDOWED && wndconfig.visible)
glfwShowWindow(window);
return window;
}
@@ -413,9 +429,12 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_STEREO:
_glfwLibrary.hints.stereo = hint;
break;
case GLFW_WINDOW_RESIZABLE:
case GLFW_RESIZABLE:
_glfwLibrary.hints.resizable = hint;
break;
case GLFW_VISIBLE:
_glfwLibrary.hints.visible = hint;
break;
case GLFW_FSAA_SAMPLES:
_glfwLibrary.hints.samples = hint;
break;
@@ -656,6 +675,48 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
}
//========================================================================
// Window show
//========================================================================
GLFWAPI void glfwShowWindow(GLFWwindow handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
if (window->mode == GLFW_FULLSCREEN)
return;
_glfwPlatformShowWindow(window);
}
//========================================================================
// Window hide
//========================================================================
GLFWAPI void glfwHideWindow(GLFWwindow handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
if (window->mode == GLFW_FULLSCREEN)
return;
_glfwPlatformHideWindow(window);
}
//========================================================================
// Get window parameter
//========================================================================
@@ -680,8 +741,10 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
return window->closeRequested;
case GLFW_REFRESH_RATE:
return window->refreshRate;
case GLFW_WINDOW_RESIZABLE:
case GLFW_RESIZABLE:
return window->resizable;
case GLFW_VISIBLE:
return window->visible;
case GLFW_CLIENT_API:
return window->clientAPI;
case GLFW_OPENGL_VERSION_MAJOR:
@@ -822,7 +885,7 @@ GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindowiconifyfun cbfun)
//========================================================================
// Poll for new window and input events and close any flagged windows
// Poll for new window and input events
//========================================================================
GLFWAPI void glfwPollEvents(void)

View File

@@ -672,12 +672,12 @@ int _glfwPlatformTerminate(void)
_glfwTerminateGammaRamp();
terminateDisplay();
_glfwTerminateJoysticks();
_glfwTerminateOpenGL();
terminateDisplay();
// Free clipboard memory
if (_glfwLibrary.X11.selection.string)
free(_glfwLibrary.X11.selection.string);
@@ -728,7 +728,7 @@ const char* _glfwPlatformGetVersionString(void)
#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
" clock_gettime"
#endif
#if defined(_GLFW_USE_LINUX_JOYSTICKS)
#if defined(_GLFW_HAS_LINUX_JOYSTICKS)
" Linux-joystick-API"
#else
" no-joystick-support"

View File

@@ -30,7 +30,7 @@
#include "internal.h"
#ifdef _GLFW_USE_LINUX_JOYSTICKS
#ifdef _GLFW_HAS_LINUX_JOYSTICKS
#include <linux/joystick.h>
#include <sys/types.h>
@@ -41,7 +41,7 @@
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#endif // _GLFW_USE_LINUX_JOYSTICKS
#endif // _GLFW_HAS_LINUX_JOYSTICKS
//========================================================================
@@ -50,7 +50,7 @@
static int openJoystickDevice(int joy, const char* path)
{
#ifdef _GLFW_USE_LINUX_JOYSTICKS
#ifdef _GLFW_HAS_LINUX_JOYSTICKS
char numAxes, numButtons;
int fd, version;
@@ -97,7 +97,7 @@ static int openJoystickDevice(int joy, const char* path)
}
_glfwLibrary.X11.joystick[joy].present = GL_TRUE;
#endif // _GLFW_USE_LINUX_JOYSTICKS
#endif // _GLFW_HAS_LINUX_JOYSTICKS
return GL_TRUE;
}
@@ -109,7 +109,7 @@ static int openJoystickDevice(int joy, const char* path)
static void pollJoystickEvents(void)
{
#ifdef _GLFW_USE_LINUX_JOYSTICKS
#ifdef _GLFW_HAS_LINUX_JOYSTICKS
int i;
ssize_t result;
struct js_event e;
@@ -160,7 +160,7 @@ static void pollJoystickEvents(void)
}
}
}
#endif // _GLFW_USE_LINUX_JOYSTICKS
#endif // _GLFW_HAS_LINUX_JOYSTICKS
}
@@ -174,7 +174,7 @@ static void pollJoystickEvents(void)
int _glfwInitJoysticks(void)
{
#ifdef _GLFW_USE_LINUX_JOYSTICKS
#ifdef _GLFW_HAS_LINUX_JOYSTICKS
int i, joy = 0;
regex_t regex;
DIR* dir;
@@ -215,7 +215,7 @@ int _glfwInitJoysticks(void)
}
regfree(&regex);
#endif // _GLFW_USE_LINUX_JOYSTICKS
#endif // _GLFW_HAS_LINUX_JOYSTICKS
return GL_TRUE;
}
@@ -227,7 +227,7 @@ int _glfwInitJoysticks(void)
void _glfwTerminateJoysticks(void)
{
#ifdef _GLFW_USE_LINUX_JOYSTICKS
#ifdef _GLFW_HAS_LINUX_JOYSTICKS
int i;
for (i = 0; i <= GLFW_JOYSTICK_LAST; i++)
@@ -241,7 +241,7 @@ void _glfwTerminateJoysticks(void)
_glfwLibrary.X11.joystick[i].present = GL_FALSE;
}
}
#endif // _GLFW_USE_LINUX_JOYSTICKS
#endif // _GLFW_HAS_LINUX_JOYSTICKS
}

View File

@@ -228,10 +228,6 @@ static GLboolean createWindow(_GLFWwindow* window,
_glfwPlatformSetWindowTitle(window, wndconfig->title);
// Make sure the window is mapped before proceeding
XMapWindow(_glfwLibrary.X11.display, window->X11.handle);
XFlush(_glfwLibrary.X11.display);
return GL_TRUE;
}
@@ -699,6 +695,7 @@ static void processEvent(XEvent *event)
if (window == NULL)
return;
_glfwInputWindowVisibility(window, GL_TRUE);
_glfwInputWindowIconify(window, GL_FALSE);
break;
}
@@ -710,6 +707,7 @@ static void processEvent(XEvent *event)
if (window == NULL)
return;
_glfwInputWindowVisibility(window, GL_FALSE);
_glfwInputWindowIconify(window, GL_TRUE);
break;
}
@@ -854,6 +852,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
}
#endif /*_GLFW_HAS_XRANDR*/
_glfwPlatformShowWindow(window);
enterFullscreenMode(window);
}
@@ -1044,6 +1043,28 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
}
//========================================================================
// Show window
//========================================================================
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
XMapRaised(_glfwLibrary.X11.display, window->X11.handle);
XFlush(_glfwLibrary.X11.display);
}
//========================================================================
// Hide window
//========================================================================
void _glfwPlatformHideWindow(_GLFWwindow* window)
{
XUnmapWindow(_glfwLibrary.X11.display, window->X11.handle);
XFlush(_glfwLibrary.X11.display);
}
//========================================================================
// Read back framebuffer parameters from the context
//========================================================================