mirror of
https://github.com/glfw/glfw.git
synced 2024-11-29 13:32:01 +00:00
Merge branch 'master' into clipboard
Conflicts: src/CMakeLists.txt
This commit is contained in:
commit
92d4c02e07
@ -341,9 +341,9 @@ void mouse_position_callback(GLFWwindow window, int x, int y)
|
|||||||
// Callback function for scroll events
|
// Callback function for scroll events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void scroll_callback(GLFWwindow window, int x, int y)
|
void scroll_callback(GLFWwindow window, double x, double y)
|
||||||
{
|
{
|
||||||
zoom += y / 4.f;
|
zoom += (float) y / 4.f;
|
||||||
if (zoom < 0)
|
if (zoom < 0)
|
||||||
zoom = 0;
|
zoom = 0;
|
||||||
}
|
}
|
||||||
|
@ -488,7 +488,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow,int);
|
|||||||
typedef void (* GLFWmousebuttonfun)(GLFWwindow,int,int);
|
typedef void (* GLFWmousebuttonfun)(GLFWwindow,int,int);
|
||||||
typedef void (* GLFWmouseposfun)(GLFWwindow,int,int);
|
typedef void (* GLFWmouseposfun)(GLFWwindow,int,int);
|
||||||
typedef void (* GLFWcursorenterfun)(GLFWwindow,int);
|
typedef void (* GLFWcursorenterfun)(GLFWwindow,int);
|
||||||
typedef void (* GLFWscrollfun)(GLFWwindow,int,int);
|
typedef void (* GLFWscrollfun)(GLFWwindow,double,double);
|
||||||
typedef void (* GLFWkeyfun)(GLFWwindow,int,int);
|
typedef void (* GLFWkeyfun)(GLFWwindow,int,int);
|
||||||
typedef void (* GLFWcharfun)(GLFWwindow,int);
|
typedef void (* GLFWcharfun)(GLFWwindow,int);
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ GLFWAPI int glfwGetKey(GLFWwindow window, int key);
|
|||||||
GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button);
|
GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button);
|
||||||
GLFWAPI void glfwGetMousePos(GLFWwindow window, int* xpos, int* ypos);
|
GLFWAPI void glfwGetMousePos(GLFWwindow window, int* xpos, int* ypos);
|
||||||
GLFWAPI void glfwSetMousePos(GLFWwindow window, int xpos, int ypos);
|
GLFWAPI void glfwSetMousePos(GLFWwindow window, int xpos, int ypos);
|
||||||
GLFWAPI void glfwGetScrollOffset(GLFWwindow window, int* xoffset, int* yoffset);
|
GLFWAPI void glfwGetScrollOffset(GLFWwindow window, double* xoffset, double* yoffset);
|
||||||
GLFWAPI void glfwSetKeyCallback(GLFWkeyfun cbfun);
|
GLFWAPI void glfwSetKeyCallback(GLFWkeyfun cbfun);
|
||||||
GLFWAPI void glfwSetCharCallback(GLFWcharfun cbfun);
|
GLFWAPI void glfwSetCharCallback(GLFWcharfun cbfun);
|
||||||
GLFWAPI void glfwSetMouseButtonCallback(GLFWmousebuttonfun cbfun);
|
GLFWAPI void glfwSetMouseButtonCallback(GLFWmousebuttonfun cbfun);
|
||||||
|
@ -292,7 +292,7 @@ version of GLFW.</p>
|
|||||||
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
|
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
|
||||||
<li>Replaced ad hoc build system with CMake</li>
|
<li>Replaced ad hoc build system with CMake</li>
|
||||||
<li>Replaced layout-dependent key codes with single, platform-independent set based on US layout</li>
|
<li>Replaced layout-dependent key codes with single, platform-independent set based on US layout</li>
|
||||||
<li>Replaced mouse wheel interface with two-dimensional scrolling interface</li>
|
<li>Replaced mouse wheel interface with two-dimensional, floating point scrolling interface</li>
|
||||||
<li>Replaced <code>glfwEnable</code> and <code>glfwDisable</code> with <code>glfwGetInputMode</code> and <code>glfwSetInputMode</code></li>
|
<li>Replaced <code>glfwEnable</code> and <code>glfwDisable</code> with <code>glfwGetInputMode</code> and <code>glfwSetInputMode</code></li>
|
||||||
<li>Made Unicode character input unaffected by <code>GLFW_KEY_REPEAT</code></li>
|
<li>Made Unicode character input unaffected by <code>GLFW_KEY_REPEAT</code></li>
|
||||||
<li>Removed event auto-polling and the <code>GLFW_AUTO_POLL_EVENTS</code> window enable</li>
|
<li>Removed event auto-polling and the <code>GLFW_AUTO_POLL_EVENTS</code> window enable</li>
|
||||||
|
@ -3,10 +3,12 @@ include_directories(${GLFW_SOURCE_DIR}/src
|
|||||||
${GLFW_BINARY_DIR}/src
|
${GLFW_BINARY_DIR}/src
|
||||||
${glfw_INCLUDE_DIRS})
|
${glfw_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
set(common_HEADERS ${GLFW_SOURCE_DIR}/include/GL/glfw3.h internal.h)
|
||||||
set(common_SOURCES clipboard.c error.c fullscreen.c gamma.c init.c input.c
|
set(common_SOURCES clipboard.c error.c fullscreen.c gamma.c init.c input.c
|
||||||
joystick.c opengl.c time.c window.c)
|
joystick.c opengl.c time.c window.c)
|
||||||
|
|
||||||
if (_GLFW_COCOA_NSGL)
|
if (_GLFW_COCOA_NSGL)
|
||||||
|
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h)
|
||||||
set(glfw_SOURCES ${common_SOURCES} cocoa_clipboard.m cocoa_fullscreen.m
|
set(glfw_SOURCES ${common_SOURCES} cocoa_clipboard.m cocoa_fullscreen.m
|
||||||
cocoa_gamma.c cocoa_init.m cocoa_input.m cocoa_joystick.m
|
cocoa_gamma.c cocoa_init.m cocoa_input.m cocoa_joystick.m
|
||||||
cocoa_opengl.m cocoa_time.c cocoa_window.m)
|
cocoa_opengl.m cocoa_time.c cocoa_window.m)
|
||||||
@ -14,16 +16,18 @@ if (_GLFW_COCOA_NSGL)
|
|||||||
# For some reason, CMake doesn't know about .m
|
# For some reason, CMake doesn't know about .m
|
||||||
set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C)
|
set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C)
|
||||||
elseif (_GLFW_WIN32_WGL)
|
elseif (_GLFW_WIN32_WGL)
|
||||||
|
set(glfw_HEADERS ${common_HEADERS} win32_platform.h)
|
||||||
set(glfw_SOURCES ${common_SOURCES} win32_clipboard.c win32_fullscreen.c
|
set(glfw_SOURCES ${common_SOURCES} win32_clipboard.c win32_fullscreen.c
|
||||||
win32_gamma.c win32_init.c win32_input.c win32_joystick.c
|
win32_gamma.c win32_init.c win32_input.c win32_joystick.c
|
||||||
win32_opengl.c win32_time.c win32_window.c win32_dllmain.c)
|
win32_opengl.c win32_time.c win32_window.c win32_dllmain.c)
|
||||||
elseif (_GLFW_X11_GLX)
|
elseif (_GLFW_X11_GLX)
|
||||||
|
set(glfw_HEADERS ${common_HEADERS} x11_platform.h)
|
||||||
set(glfw_SOURCES ${common_SOURCES} x11_clipboard.c x11_fullscreen.c
|
set(glfw_SOURCES ${common_SOURCES} x11_clipboard.c x11_fullscreen.c
|
||||||
x11_gamma.c x11_init.c x11_input.c x11_joystick.c
|
x11_gamma.c x11_init.c x11_input.c x11_joystick.c
|
||||||
x11_keysym2unicode.c x11_opengl.c x11_time.c x11_window.c)
|
x11_keysym2unicode.c x11_opengl.c x11_time.c x11_window.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(glfw ${glfw_SOURCES})
|
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
|
|
||||||
|
@ -336,7 +336,12 @@ void _glfwInitJoysticks(void)
|
|||||||
result = IOMasterPort(bootstrap_port, &masterPort);
|
result = IOMasterPort(bootstrap_port, &masterPort);
|
||||||
hidMatchDictionary = IOServiceMatching(kIOHIDDeviceKey);
|
hidMatchDictionary = IOServiceMatching(kIOHIDDeviceKey);
|
||||||
if (kIOReturnSuccess != result || !hidMatchDictionary)
|
if (kIOReturnSuccess != result || !hidMatchDictionary)
|
||||||
|
{
|
||||||
|
if (hidMatchDictionary)
|
||||||
|
CFRelease(hidMatchDictionary);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
result = IOServiceGetMatchingServices(masterPort,
|
result = IOServiceGetMatchingServices(masterPort,
|
||||||
hidMatchDictionary,
|
hidMatchDictionary,
|
||||||
@ -370,20 +375,28 @@ void _glfwInitJoysticks(void)
|
|||||||
/* Check device type */
|
/* Check device type */
|
||||||
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsagePageKey));
|
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsagePageKey));
|
||||||
if (refCF)
|
if (refCF)
|
||||||
|
{
|
||||||
CFNumberGetValue(refCF, kCFNumberLongType, &usagePage);
|
CFNumberGetValue(refCF, kCFNumberLongType, &usagePage);
|
||||||
|
if (usagePage != kHIDPage_GenericDesktop)
|
||||||
|
{
|
||||||
|
/* We are not interested in this device */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsageKey));
|
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsageKey));
|
||||||
if (refCF)
|
if (refCF)
|
||||||
|
{
|
||||||
CFNumberGetValue(refCF, kCFNumberLongType, &usage);
|
CFNumberGetValue(refCF, kCFNumberLongType, &usage);
|
||||||
|
|
||||||
if ((usagePage != kHIDPage_GenericDesktop) ||
|
if ((usage != kHIDUsage_GD_Joystick &&
|
||||||
(usage != kHIDUsage_GD_Joystick &&
|
|
||||||
usage != kHIDUsage_GD_GamePad &&
|
usage != kHIDUsage_GD_GamePad &&
|
||||||
usage != kHIDUsage_GD_MultiAxisController))
|
usage != kHIDUsage_GD_MultiAxisController))
|
||||||
{
|
{
|
||||||
/* We don't interested in this device */
|
/* We are not interested in this device */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_glfwJoystick* joystick = &_glfwJoysticks[deviceCounter];
|
_glfwJoystick* joystick = &_glfwJoysticks[deviceCounter];
|
||||||
|
|
||||||
|
@ -72,11 +72,10 @@ typedef struct _GLFWcontextNSGL
|
|||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
typedef struct _GLFWwindowNS
|
typedef struct _GLFWwindowNS
|
||||||
{
|
{
|
||||||
id window;
|
id object;
|
||||||
id delegate;
|
id delegate;
|
||||||
|
id view;
|
||||||
unsigned int modifierFlags;
|
unsigned int modifierFlags;
|
||||||
double fracScrollX;
|
|
||||||
double fracScrollY;
|
|
||||||
} _GLFWwindowNS;
|
} _GLFWwindowNS;
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
[window->NSGL.context update];
|
[window->NSGL.context update];
|
||||||
|
|
||||||
NSRect contentRect =
|
NSRect contentRect =
|
||||||
[window->NS.window contentRectForFrameRect:[window->NS.window frame]];
|
[window->NS.object contentRectForFrameRect:[window->NS.object frame]];
|
||||||
|
|
||||||
_glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height);
|
_glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height);
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@
|
|||||||
[window->NSGL.context update];
|
[window->NSGL.context update];
|
||||||
|
|
||||||
NSRect contentRect =
|
NSRect contentRect =
|
||||||
[window->NS.window contentRectForFrameRect:[window->NS.window frame]];
|
[window->NS.object contentRectForFrameRect:[window->NS.object frame]];
|
||||||
|
|
||||||
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
|
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
|
||||||
double mainScreenHeight = CGDisplayBounds(CGMainDisplayID()).size.height;
|
double mainScreenHeight = CGDisplayBounds(CGMainDisplayID()).size.height;
|
||||||
@ -360,7 +360,7 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
|||||||
NSPoint p = [event locationInWindow];
|
NSPoint p = [event locationInWindow];
|
||||||
|
|
||||||
// Cocoa coordinate system has origin at lower left
|
// Cocoa coordinate system has origin at lower left
|
||||||
p.y = [[window->NS.window contentView] bounds].size.height - p.y;
|
p.y = [[window->NS.object contentView] bounds].size.height - p.y;
|
||||||
|
|
||||||
_glfwInputCursorMotion(window, p.x, p.y);
|
_glfwInputCursorMotion(window, p.x, p.y);
|
||||||
}
|
}
|
||||||
@ -479,14 +479,11 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
|||||||
|
|
||||||
- (void)scrollWheel:(NSEvent *)event
|
- (void)scrollWheel:(NSEvent *)event
|
||||||
{
|
{
|
||||||
double deltaX = window->NS.fracScrollX + [event deltaX];
|
double deltaX = [event deltaX];
|
||||||
double deltaY = window->NS.fracScrollY + [event deltaY];
|
double deltaY = [event deltaY];
|
||||||
|
|
||||||
if ((int) deltaX || (int) deltaY)
|
if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0)
|
||||||
_glfwInputScroll(window, (int) deltaX, (int) deltaY);
|
_glfwInputScroll(window, deltaX, deltaY);
|
||||||
|
|
||||||
window->NS.fracScrollX = (int) (deltaX - floor(deltaX));
|
|
||||||
window->NS.fracScrollY = (int) (deltaY - floor(deltaY));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -674,25 +671,26 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
else
|
else
|
||||||
styleMask = NSBorderlessWindowMask;
|
styleMask = NSBorderlessWindowMask;
|
||||||
|
|
||||||
window->NS.window = [[NSWindow alloc]
|
window->NS.object = [[NSWindow alloc]
|
||||||
initWithContentRect:NSMakeRect(0, 0, window->width, window->height)
|
initWithContentRect:NSMakeRect(0, 0, window->width, window->height)
|
||||||
styleMask:styleMask
|
styleMask:styleMask
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:NO];
|
defer:NO];
|
||||||
|
|
||||||
if (window->NS.window == nil)
|
if (window->NS.object == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwSetError(GLFW_PLATFORM_ERROR,
|
||||||
"Cocoa/NSOpenGL: Failed to create window");
|
"Cocoa/NSOpenGL: Failed to create window");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
[window->NS.window setTitle:[NSString stringWithUTF8String:wndconfig->title]];
|
window->NS.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
|
||||||
[window->NS.window setContentView:[[GLFWContentView alloc]
|
|
||||||
initWithGlfwWindow:window]];
|
[window->NS.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
|
||||||
[window->NS.window setDelegate:window->NS.delegate];
|
[window->NS.object setContentView:window->NS.view];
|
||||||
[window->NS.window setAcceptsMouseMovedEvents:YES];
|
[window->NS.object setDelegate:window->NS.delegate];
|
||||||
[window->NS.window center];
|
[window->NS.object setAcceptsMouseMovedEvents:YES];
|
||||||
|
[window->NS.object center];
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
@ -906,8 +904,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
if (!createContext(window, wndconfig, fbconfig))
|
if (!createContext(window, wndconfig, fbconfig))
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
[window->NS.window makeKeyAndOrderFront:nil];
|
[window->NS.object makeKeyAndOrderFront:nil];
|
||||||
[window->NSGL.context setView:[window->NS.window contentView]];
|
[window->NSGL.context setView:[window->NS.object contentView]];
|
||||||
|
|
||||||
if (wndconfig->mode == GLFW_FULLSCREEN)
|
if (wndconfig->mode == GLFW_FULLSCREEN)
|
||||||
{
|
{
|
||||||
@ -921,7 +919,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[window->NS.window contentView] enterFullScreenMode:[NSScreen mainScreen]
|
[[window->NS.object contentView] enterFullScreenMode:[NSScreen mainScreen]
|
||||||
withOptions:nil];
|
withOptions:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,11 +941,11 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
void _glfwPlatformCloseWindow(_GLFWwindow* window)
|
void _glfwPlatformCloseWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
[window->NS.window orderOut:nil];
|
[window->NS.object orderOut:nil];
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->mode == GLFW_FULLSCREEN)
|
||||||
{
|
{
|
||||||
[[window->NS.window contentView] exitFullScreenModeWithOptions:nil];
|
[[window->NS.object contentView] exitFullScreenModeWithOptions:nil];
|
||||||
|
|
||||||
_glfwRestoreVideoMode();
|
_glfwRestoreVideoMode();
|
||||||
}
|
}
|
||||||
@ -959,12 +957,15 @@ void _glfwPlatformCloseWindow(_GLFWwindow* window)
|
|||||||
[window->NSGL.context release];
|
[window->NSGL.context release];
|
||||||
window->NSGL.context = nil;
|
window->NSGL.context = nil;
|
||||||
|
|
||||||
[window->NS.window setDelegate:nil];
|
[window->NS.object setDelegate:nil];
|
||||||
[window->NS.delegate release];
|
[window->NS.delegate release];
|
||||||
window->NS.delegate = nil;
|
window->NS.delegate = nil;
|
||||||
|
|
||||||
[window->NS.window close];
|
[window->NS.view release];
|
||||||
window->NS.window = nil;
|
window->NS.view = nil;
|
||||||
|
|
||||||
|
[window->NS.object close];
|
||||||
|
window->NS.object = nil;
|
||||||
|
|
||||||
// TODO: Probably more cleanup
|
// TODO: Probably more cleanup
|
||||||
}
|
}
|
||||||
@ -976,7 +977,7 @@ void _glfwPlatformCloseWindow(_GLFWwindow* window)
|
|||||||
|
|
||||||
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title)
|
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title)
|
||||||
{
|
{
|
||||||
[window->NS.window setTitle:[NSString stringWithUTF8String:title]];
|
[window->NS.object setTitle:[NSString stringWithUTF8String:title]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -986,7 +987,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title)
|
|||||||
|
|
||||||
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
[window->NS.window setContentSize:NSMakeSize(width, height)];
|
[window->NS.object setContentSize:NSMakeSize(width, height)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -997,16 +998,16 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
|
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
NSRect contentRect =
|
NSRect contentRect =
|
||||||
[window->NS.window contentRectForFrameRect:[window->NS.window frame]];
|
[window->NS.object contentRectForFrameRect:[window->NS.object frame]];
|
||||||
|
|
||||||
// We assume here that the client code wants to position the window within the
|
// We assume here that the client code wants to position the window within the
|
||||||
// screen the window currently occupies
|
// screen the window currently occupies
|
||||||
NSRect screenRect = [[window->NS.window screen] visibleFrame];
|
NSRect screenRect = [[window->NS.object screen] visibleFrame];
|
||||||
contentRect.origin = NSMakePoint(screenRect.origin.x + x,
|
contentRect.origin = NSMakePoint(screenRect.origin.x + x,
|
||||||
screenRect.origin.y + screenRect.size.height -
|
screenRect.origin.y + screenRect.size.height -
|
||||||
y - contentRect.size.height);
|
y - contentRect.size.height);
|
||||||
|
|
||||||
[window->NS.window setFrame:[window->NS.window frameRectForContentRect:contentRect]
|
[window->NS.object setFrame:[window->NS.object frameRectForContentRect:contentRect]
|
||||||
display:YES];
|
display:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1017,7 +1018,7 @@ void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
|
|||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
[window->NS.window miniaturize:nil];
|
[window->NS.object miniaturize:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1027,7 +1028,7 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
|||||||
|
|
||||||
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
[window->NS.window deminiaturize:nil];
|
[window->NS.object deminiaturize:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1168,7 +1169,7 @@ void _glfwPlatformSetMouseCursorPos(_GLFWwindow* window, int x, int y)
|
|||||||
// "global coordinates" are upside down from CG's...
|
// "global coordinates" are upside down from CG's...
|
||||||
|
|
||||||
NSPoint localPoint = NSMakePoint(x, y);
|
NSPoint localPoint = NSMakePoint(x, y);
|
||||||
NSPoint globalPoint = [window->NS.window convertBaseToScreen:localPoint];
|
NSPoint globalPoint = [window->NS.object convertBaseToScreen:localPoint];
|
||||||
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
|
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
|
||||||
double mainScreenHeight = CGDisplayBounds(CGMainDisplayID()).size.height;
|
double mainScreenHeight = CGDisplayBounds(CGMainDisplayID()).size.height;
|
||||||
CGPoint targetPoint = CGPointMake(globalPoint.x - mainScreenOrigin.x,
|
CGPoint targetPoint = CGPointMake(globalPoint.x - mainScreenOrigin.x,
|
||||||
|
@ -200,7 +200,7 @@ void _glfwInputChar(_GLFWwindow* window, int character)
|
|||||||
// Register scroll events
|
// Register scroll events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void _glfwInputScroll(_GLFWwindow* window, int xoffset, int yoffset)
|
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
|
||||||
{
|
{
|
||||||
window->scrollX += xoffset;
|
window->scrollX += xoffset;
|
||||||
window->scrollY += yoffset;
|
window->scrollY += yoffset;
|
||||||
@ -476,7 +476,7 @@ GLFWAPI void glfwSetMousePos(GLFWwindow handle, int xpos, int ypos)
|
|||||||
// Returns the scroll offset for the specified window
|
// Returns the scroll offset for the specified window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwGetScrollOffset(GLFWwindow handle, int* xoffset, int* yoffset)
|
GLFWAPI void glfwGetScrollOffset(GLFWwindow handle, double* xoffset, double* yoffset)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ struct _GLFWwindow
|
|||||||
GLboolean systemKeys; // system keys enabled flag
|
GLboolean systemKeys; // system keys enabled flag
|
||||||
int cursorPosX, cursorPosY;
|
int cursorPosX, cursorPosY;
|
||||||
int cursorMode;
|
int cursorMode;
|
||||||
int scrollX, scrollY;
|
double scrollX, scrollY;
|
||||||
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
|
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
|
||||||
char key[GLFW_KEY_LAST + 1];
|
char key[GLFW_KEY_LAST + 1];
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ void _glfwInputWindowDamage(_GLFWwindow* window);
|
|||||||
// Input event notification (input.c)
|
// Input event notification (input.c)
|
||||||
void _glfwInputKey(_GLFWwindow* window, int key, int action);
|
void _glfwInputKey(_GLFWwindow* window, int key, int action);
|
||||||
void _glfwInputChar(_GLFWwindow* window, int character);
|
void _glfwInputChar(_GLFWwindow* window, int character);
|
||||||
void _glfwInputScroll(_GLFWwindow* window, int x, int y);
|
void _glfwInputScroll(_GLFWwindow* window, double x, double y);
|
||||||
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action);
|
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action);
|
||||||
void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y);
|
void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y);
|
||||||
void _glfwInputCursorEnter(_GLFWwindow* window, int entered);
|
void _glfwInputCursorEnter(_GLFWwindow* window, int entered);
|
||||||
|
@ -1022,7 +1022,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
_glfwInputScroll(window, 0, (((int) wParam) >> 16) / WHEEL_DELTA);
|
_glfwInputScroll(window, 0.0, (SHORT) HIWORD(wParam) / (double) WHEEL_DELTA);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1030,7 +1030,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
{
|
{
|
||||||
// This message is only sent on Windows Vista and later
|
// This message is only sent on Windows Vista and later
|
||||||
|
|
||||||
_glfwInputScroll(window, (((int) wParam) >> 16) / WHEEL_DELTA, 0);
|
_glfwInputScroll(window, (SHORT) HIWORD(wParam) / (double) WHEEL_DELTA, 0.0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1144,14 +1144,14 @@ static void processSingleEvent(void)
|
|||||||
// XFree86 3.3.2 and later translates mouse wheel up/down into
|
// XFree86 3.3.2 and later translates mouse wheel up/down into
|
||||||
// mouse button 4 & 5 presses
|
// mouse button 4 & 5 presses
|
||||||
else if (event.xbutton.button == Button4)
|
else if (event.xbutton.button == Button4)
|
||||||
_glfwInputScroll(window, 0, 1);
|
_glfwInputScroll(window, 0.0, 1.0);
|
||||||
else if (event.xbutton.button == Button5)
|
else if (event.xbutton.button == Button5)
|
||||||
_glfwInputScroll(window, 0, -1);
|
_glfwInputScroll(window, 0.0, -1.0);
|
||||||
|
|
||||||
else if (event.xbutton.button == Button6)
|
else if (event.xbutton.button == Button6)
|
||||||
_glfwInputScroll(window, -1, 0);
|
_glfwInputScroll(window, -1.0, 0.0);
|
||||||
else if (event.xbutton.button == Button7)
|
else if (event.xbutton.button == Button7)
|
||||||
_glfwInputScroll(window, 1, 0);
|
_glfwInputScroll(window, 1.0, 0.0);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -283,9 +283,9 @@ static void cursor_enter_callback(GLFWwindow window, int entered)
|
|||||||
entered ? "entered" : "left");
|
entered ? "entered" : "left");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scroll_callback(GLFWwindow window, int x, int y)
|
static void scroll_callback(GLFWwindow window, double x, double y)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Scroll: %i %i\n", counter++, glfwGetTime(), x, y);
|
printf("%08x at %0.3f: Scroll: %0.3f %0.3f\n", counter++, glfwGetTime(), x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow window, int key, int action)
|
||||||
|
Loading…
Reference in New Issue
Block a user