Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
glfw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pirvi-public
glfw
Commits
b97039f3
Commit
b97039f3
authored
Sep 10, 2017
by
Camilla Löwy
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup
parent
a368d89c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/input.c
+48
-55
48 additions, 55 deletions
src/input.c
src/window.c
+62
-67
62 additions, 67 deletions
src/window.c
with
110 additions
and
122 deletions
src/input.c
+
48
−
55
View file @
b97039f3
...
@@ -354,11 +354,11 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
...
@@ -354,11 +354,11 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
return
window
->
stickyKeys
;
return
window
->
stickyKeys
;
case
GLFW_STICKY_MOUSE_BUTTONS
:
case
GLFW_STICKY_MOUSE_BUTTONS
:
return
window
->
stickyMouseButtons
;
return
window
->
stickyMouseButtons
;
default:
}
_glfwInputError
(
GLFW_INVALID_ENUM
,
"Invalid input mode 0x%08X"
,
mode
);
_glfwInputError
(
GLFW_INVALID_ENUM
,
"Invalid input mode 0x%08X"
,
mode
);
return
0
;
return
0
;
}
}
}
GLFWAPI
void
glfwSetInputMode
(
GLFWwindow
*
handle
,
int
mode
,
int
value
)
GLFWAPI
void
glfwSetInputMode
(
GLFWwindow
*
handle
,
int
mode
,
int
value
)
{
{
...
@@ -367,9 +367,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
...
@@ -367,9 +367,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
_GLFW_REQUIRE_INIT
();
_GLFW_REQUIRE_INIT
();
switch
(
mode
)
if
(
mode
==
GLFW_CURSOR
)
{
case
GLFW_CURSOR
:
{
{
if
(
value
!=
GLFW_CURSOR_NORMAL
&&
if
(
value
!=
GLFW_CURSOR_NORMAL
&&
value
!=
GLFW_CURSOR_HIDDEN
&&
value
!=
GLFW_CURSOR_HIDDEN
&&
...
@@ -392,12 +390,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
...
@@ -392,12 +390,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
if
(
_glfwPlatformWindowFocused
(
window
))
if
(
_glfwPlatformWindowFocused
(
window
))
_glfwPlatformSetCursorMode
(
window
,
value
);
_glfwPlatformSetCursorMode
(
window
,
value
);
return
;
}
}
else
if
(
mode
==
GLFW_STICKY_KEYS
)
case
GLFW_STICKY_KEYS
:
{
{
value
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
if
(
window
->
stickyKeys
==
value
)
if
(
window
->
stickyKeys
==
value
)
return
;
return
;
...
@@ -414,11 +410,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
...
@@ -414,11 +410,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
}
}
window
->
stickyKeys
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
window
->
stickyKeys
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
return
;
}
}
else
if
(
mode
==
GLFW_STICKY_MOUSE_BUTTONS
)
case
GLFW_STICKY_MOUSE_BUTTONS
:
{
{
value
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
if
(
window
->
stickyMouseButtons
==
value
)
if
(
window
->
stickyMouseButtons
==
value
)
return
;
return
;
...
@@ -435,10 +430,8 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
...
@@ -435,10 +430,8 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
}
}
window
->
stickyMouseButtons
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
window
->
stickyMouseButtons
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
return
;
}
}
}
else
_glfwInputError
(
GLFW_INVALID_ENUM
,
"Invalid input mode 0x%08X"
,
mode
);
_glfwInputError
(
GLFW_INVALID_ENUM
,
"Invalid input mode 0x%08X"
,
mode
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/window.c
+
62
−
67
View file @
b97039f3
...
@@ -278,119 +278,118 @@ GLFWAPI void glfwWindowHint(int hint, int value)
...
@@ -278,119 +278,118 @@ GLFWAPI void glfwWindowHint(int hint, int value)
{
{
case
GLFW_RED_BITS
:
case
GLFW_RED_BITS
:
_glfw
.
hints
.
framebuffer
.
redBits
=
value
;
_glfw
.
hints
.
framebuffer
.
redBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_GREEN_BITS
:
case
GLFW_GREEN_BITS
:
_glfw
.
hints
.
framebuffer
.
greenBits
=
value
;
_glfw
.
hints
.
framebuffer
.
greenBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_BLUE_BITS
:
case
GLFW_BLUE_BITS
:
_glfw
.
hints
.
framebuffer
.
blueBits
=
value
;
_glfw
.
hints
.
framebuffer
.
blueBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_ALPHA_BITS
:
case
GLFW_ALPHA_BITS
:
_glfw
.
hints
.
framebuffer
.
alphaBits
=
value
;
_glfw
.
hints
.
framebuffer
.
alphaBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_DEPTH_BITS
:
case
GLFW_DEPTH_BITS
:
_glfw
.
hints
.
framebuffer
.
depthBits
=
value
;
_glfw
.
hints
.
framebuffer
.
depthBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_STENCIL_BITS
:
case
GLFW_STENCIL_BITS
:
_glfw
.
hints
.
framebuffer
.
stencilBits
=
value
;
_glfw
.
hints
.
framebuffer
.
stencilBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_ACCUM_RED_BITS
:
case
GLFW_ACCUM_RED_BITS
:
_glfw
.
hints
.
framebuffer
.
accumRedBits
=
value
;
_glfw
.
hints
.
framebuffer
.
accumRedBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_ACCUM_GREEN_BITS
:
case
GLFW_ACCUM_GREEN_BITS
:
_glfw
.
hints
.
framebuffer
.
accumGreenBits
=
value
;
_glfw
.
hints
.
framebuffer
.
accumGreenBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_ACCUM_BLUE_BITS
:
case
GLFW_ACCUM_BLUE_BITS
:
_glfw
.
hints
.
framebuffer
.
accumBlueBits
=
value
;
_glfw
.
hints
.
framebuffer
.
accumBlueBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_ACCUM_ALPHA_BITS
:
case
GLFW_ACCUM_ALPHA_BITS
:
_glfw
.
hints
.
framebuffer
.
accumAlphaBits
=
value
;
_glfw
.
hints
.
framebuffer
.
accumAlphaBits
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_AUX_BUFFERS
:
case
GLFW_AUX_BUFFERS
:
_glfw
.
hints
.
framebuffer
.
auxBuffers
=
value
;
_glfw
.
hints
.
framebuffer
.
auxBuffers
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_STEREO
:
case
GLFW_STEREO
:
_glfw
.
hints
.
framebuffer
.
stereo
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
framebuffer
.
stereo
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_DOUBLEBUFFER
:
case
GLFW_DOUBLEBUFFER
:
_glfw
.
hints
.
framebuffer
.
doublebuffer
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
framebuffer
.
doublebuffer
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_SAMPLES
:
case
GLFW_SAMPLES
:
_glfw
.
hints
.
framebuffer
.
samples
=
value
;
_glfw
.
hints
.
framebuffer
.
samples
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_SRGB_CAPABLE
:
case
GLFW_SRGB_CAPABLE
:
_glfw
.
hints
.
framebuffer
.
sRGB
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
framebuffer
.
sRGB
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_RESIZABLE
:
case
GLFW_RESIZABLE
:
_glfw
.
hints
.
window
.
resizable
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
resizable
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_DECORATED
:
case
GLFW_DECORATED
:
_glfw
.
hints
.
window
.
decorated
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
decorated
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_FOCUSED
:
case
GLFW_FOCUSED
:
_glfw
.
hints
.
window
.
focused
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
focused
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_AUTO_ICONIFY
:
case
GLFW_AUTO_ICONIFY
:
_glfw
.
hints
.
window
.
autoIconify
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
autoIconify
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_FLOATING
:
case
GLFW_FLOATING
:
_glfw
.
hints
.
window
.
floating
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
floating
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_MAXIMIZED
:
case
GLFW_MAXIMIZED
:
_glfw
.
hints
.
window
.
maximized
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
maximized
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_VISIBLE
:
case
GLFW_VISIBLE
:
_glfw
.
hints
.
window
.
visible
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
visible
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_COCOA_RETINA_FRAMEBUFFER
:
case
GLFW_COCOA_RETINA_FRAMEBUFFER
:
_glfw
.
hints
.
window
.
ns
.
retina
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
ns
.
retina
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_COCOA_FRAME_AUTOSAVE
:
case
GLFW_COCOA_FRAME_AUTOSAVE
:
_glfw
.
hints
.
window
.
ns
.
frame
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
ns
.
frame
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_COCOA_GRAPHICS_SWITCHING
:
case
GLFW_COCOA_GRAPHICS_SWITCHING
:
_glfw
.
hints
.
context
.
nsgl
.
offline
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
context
.
nsgl
.
offline
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_CENTER_CURSOR
:
case
GLFW_CENTER_CURSOR
:
_glfw
.
hints
.
window
.
centerCursor
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
window
.
centerCursor
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_CLIENT_API
:
case
GLFW_CLIENT_API
:
_glfw
.
hints
.
context
.
client
=
value
;
_glfw
.
hints
.
context
.
client
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_CONTEXT_CREATION_API
:
case
GLFW_CONTEXT_CREATION_API
:
_glfw
.
hints
.
context
.
source
=
value
;
_glfw
.
hints
.
context
.
source
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_CONTEXT_VERSION_MAJOR
:
case
GLFW_CONTEXT_VERSION_MAJOR
:
_glfw
.
hints
.
context
.
major
=
value
;
_glfw
.
hints
.
context
.
major
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_CONTEXT_VERSION_MINOR
:
case
GLFW_CONTEXT_VERSION_MINOR
:
_glfw
.
hints
.
context
.
minor
=
value
;
_glfw
.
hints
.
context
.
minor
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_CONTEXT_ROBUSTNESS
:
case
GLFW_CONTEXT_ROBUSTNESS
:
_glfw
.
hints
.
context
.
robustness
=
value
;
_glfw
.
hints
.
context
.
robustness
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_OPENGL_FORWARD_COMPAT
:
case
GLFW_OPENGL_FORWARD_COMPAT
:
_glfw
.
hints
.
context
.
forward
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
context
.
forward
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_OPENGL_DEBUG_CONTEXT
:
case
GLFW_OPENGL_DEBUG_CONTEXT
:
_glfw
.
hints
.
context
.
debug
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
context
.
debug
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_CONTEXT_NO_ERROR
:
case
GLFW_CONTEXT_NO_ERROR
:
_glfw
.
hints
.
context
.
noerror
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
_glfw
.
hints
.
context
.
noerror
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
b
re
ak
;
re
turn
;
case
GLFW_OPENGL_PROFILE
:
case
GLFW_OPENGL_PROFILE
:
_glfw
.
hints
.
context
.
profile
=
value
;
_glfw
.
hints
.
context
.
profile
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_CONTEXT_RELEASE_BEHAVIOR
:
case
GLFW_CONTEXT_RELEASE_BEHAVIOR
:
_glfw
.
hints
.
context
.
release
=
value
;
_glfw
.
hints
.
context
.
release
=
value
;
b
re
ak
;
re
turn
;
case
GLFW_REFRESH_RATE
:
case
GLFW_REFRESH_RATE
:
_glfw
.
hints
.
refreshRate
=
value
;
_glfw
.
hints
.
refreshRate
=
value
;
break
;
return
;
default:
_glfwInputError
(
GLFW_INVALID_ENUM
,
"Invalid window hint 0x%08X"
,
hint
);
break
;
}
}
_glfwInputError
(
GLFW_INVALID_ENUM
,
"Invalid window hint 0x%08X"
,
hint
);
}
}
GLFWAPI
void
glfwDestroyWindow
(
GLFWwindow
*
handle
)
GLFWAPI
void
glfwDestroyWindow
(
GLFWwindow
*
handle
)
...
@@ -770,40 +769,36 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
...
@@ -770,40 +769,36 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
value
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
value
=
value
?
GLFW_TRUE
:
GLFW_FALSE
;
switch
(
attrib
)
if
(
attrib
==
GLFW_AUTO_ICONIFY
)
{
window
->
autoIconify
=
value
;
case
GLFW_RESIZABLE
:
else
if
(
attrib
==
GLFW_RESIZABLE
)
if
(
window
->
resizable
!=
value
)
{
{
if
(
window
->
resizable
==
value
)
return
;
window
->
resizable
=
value
;
window
->
resizable
=
value
;
if
(
!
window
->
monitor
)
if
(
!
window
->
monitor
)
_glfwPlatformSetWindowResizable
(
window
,
value
);
_glfwPlatformSetWindowResizable
(
window
,
value
);
}
}
else
if
(
attrib
==
GLFW_DECORATED
)
{
if
(
window
->
decorated
==
value
)
return
;
return
;
case
GLFW_DECORATED
:
if
(
window
->
decorated
!=
value
)
{
window
->
decorated
=
value
;
window
->
decorated
=
value
;
if
(
!
window
->
monitor
)
if
(
!
window
->
monitor
)
_glfwPlatformSetWindowDecorated
(
window
,
value
);
_glfwPlatformSetWindowDecorated
(
window
,
value
);
}
}
else
if
(
attrib
==
GLFW_FLOATING
)
{
if
(
window
->
floating
==
value
)
return
;
return
;
case
GLFW_FLOATING
:
if
(
window
->
floating
!=
value
)
{
window
->
floating
=
value
;
window
->
floating
=
value
;
if
(
!
window
->
monitor
)
if
(
!
window
->
monitor
)
_glfwPlatformSetWindowFloating
(
window
,
value
);
_glfwPlatformSetWindowFloating
(
window
,
value
);
}
}
return
;
else
case
GLFW_AUTO_ICONIFY
:
window
->
autoIconify
=
value
;
return
;
}
_glfwInputError
(
GLFW_INVALID_ENUM
,
"Invalid window attribute 0x%08X"
,
attrib
);
_glfwInputError
(
GLFW_INVALID_ENUM
,
"Invalid window attribute 0x%08X"
,
attrib
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment