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
c85294e0
Commit
c85294e0
authored
10 years ago
by
Camilla Löwy
Browse files
Options
Downloads
Patches
Plain Diff
Window class cleanup.
parent
82dc6c8b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/win32_init.c
+4
-5
4 additions, 5 deletions
src/win32_init.c
src/win32_platform.h
+4
-5
4 additions, 5 deletions
src/win32_platform.h
src/win32_window.c
+48
-44
48 additions, 44 deletions
src/win32_window.c
with
56 additions
and
54 deletions
src/win32_init.c
+
4
−
5
View file @
c85294e0
...
...
@@ -211,6 +211,9 @@ int _glfwPlatformInit(void)
_control87
(
MCW_EM
,
MCW_EM
);
#endif
if
(
!
_glfwRegisterWindowClass
())
return
GL_FALSE
;
if
(
!
_glfwInitContextAPI
())
return
GL_FALSE
;
...
...
@@ -222,11 +225,7 @@ int _glfwPlatformInit(void)
void
_glfwPlatformTerminate
(
void
)
{
if
(
_glfw
.
win32
.
classAtom
)
{
UnregisterClassW
(
_GLFW_WNDCLASSNAME
,
GetModuleHandleW
(
NULL
));
_glfw
.
win32
.
classAtom
=
0
;
}
_glfwUnregisterWindowClass
();
// Restore previous foreground lock timeout system setting
SystemParametersInfoW
(
SPI_SETFOREGROUNDLOCKTIMEOUT
,
0
,
...
...
This diff is collapsed.
Click to expand it.
src/win32_platform.h
+
4
−
5
View file @
c85294e0
...
...
@@ -130,10 +130,6 @@ typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*);
#define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled
// We use versioned window class names in order not to cause conflicts
// between applications using different versions of GLFW
#define _GLFW_WNDCLASSNAME L"GLFW30"
#define _GLFW_RECREATION_NOT_NEEDED 0
#define _GLFW_RECREATION_REQUIRED 1
#define _GLFW_RECREATION_IMPOSSIBLE 2
...
...
@@ -188,7 +184,6 @@ typedef struct _GLFWwindowWin32
//------------------------------------------------------------------------
typedef
struct
_GLFWlibraryWin32
{
ATOM
classAtom
;
DWORD
foregroundLockTimeout
;
char
*
clipboardString
;
...
...
@@ -255,6 +250,10 @@ typedef struct _GLFWtimeWin32
// Prototypes for platform specific internal functions
//========================================================================
// Window class
GLboolean
_glfwRegisterWindowClass
(
void
);
void
_glfwUnregisterWindowClass
(
void
);
// Desktop compositing
BOOL
_glfwIsCompositionEnabled
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/win32_window.c
+
48
−
44
View file @
c85294e0
...
...
@@ -34,6 +34,8 @@
#define _GLFW_KEY_INVALID -2
#define _GLFW_WNDCLASSNAME L"GLFW30"
// Updates the cursor clip rect
//
...
...
@@ -838,43 +840,6 @@ static void getFullWindowSize(_GLFWwindow* window,
*
fullHeight
=
rect
.
bottom
-
rect
.
top
;
}
// Registers the GLFW window class
//
static
ATOM
registerWindowClass
(
void
)
{
WNDCLASSW
wc
;
ATOM
classAtom
;
// Set window class parameters
wc
.
style
=
CS_HREDRAW
|
CS_VREDRAW
|
CS_OWNDC
;
wc
.
lpfnWndProc
=
(
WNDPROC
)
windowProc
;
wc
.
cbClsExtra
=
0
;
// No extra class data
wc
.
cbWndExtra
=
sizeof
(
void
*
)
+
sizeof
(
int
);
// Make room for one pointer
wc
.
hInstance
=
GetModuleHandleW
(
NULL
);
wc
.
hCursor
=
LoadCursorW
(
NULL
,
IDC_ARROW
);
wc
.
hbrBackground
=
NULL
;
// No background
wc
.
lpszMenuName
=
NULL
;
// No menu
wc
.
lpszClassName
=
_GLFW_WNDCLASSNAME
;
// Load user-provided icon if available
wc
.
hIcon
=
LoadIconW
(
GetModuleHandleW
(
NULL
),
L"GLFW_ICON"
);
if
(
!
wc
.
hIcon
)
{
// No user-provided icon found, load default icon
wc
.
hIcon
=
LoadIconW
(
NULL
,
IDI_WINLOGO
);
}
classAtom
=
RegisterClassW
(
&
wc
);
if
(
!
classAtom
)
{
_glfwInputError
(
GLFW_PLATFORM_ERROR
,
"Win32: Failed to register window class"
);
return
0
;
}
return
classAtom
;
}
// Creates the GLFW window and rendering context
//
static
int
createWindow
(
_GLFWwindow
*
window
,
...
...
@@ -986,6 +951,52 @@ static void destroyWindow(_GLFWwindow* window)
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
// Registers the GLFW window class
//
GLboolean
_glfwRegisterWindowClass
(
void
)
{
WNDCLASSW
wc
;
wc
.
style
=
CS_HREDRAW
|
CS_VREDRAW
|
CS_OWNDC
;
wc
.
lpfnWndProc
=
(
WNDPROC
)
windowProc
;
wc
.
cbClsExtra
=
0
;
// No extra class data
wc
.
cbWndExtra
=
sizeof
(
void
*
)
+
sizeof
(
int
);
// Make room for one pointer
wc
.
hInstance
=
GetModuleHandleW
(
NULL
);
wc
.
hCursor
=
LoadCursorW
(
NULL
,
IDC_ARROW
);
wc
.
hbrBackground
=
NULL
;
// No background
wc
.
lpszMenuName
=
NULL
;
// No menu
wc
.
lpszClassName
=
_GLFW_WNDCLASSNAME
;
// Load user-provided icon if available
wc
.
hIcon
=
LoadIconW
(
GetModuleHandleW
(
NULL
),
L"GLFW_ICON"
);
if
(
!
wc
.
hIcon
)
{
// No user-provided icon found, load default icon
wc
.
hIcon
=
LoadIconW
(
NULL
,
IDI_WINLOGO
);
}
if
(
!
RegisterClassW
(
&
wc
))
{
_glfwInputError
(
GLFW_PLATFORM_ERROR
,
"Win32: Failed to register window class"
);
return
GL_FALSE
;
}
return
GL_TRUE
;
}
// Unregisters the GLFW window class
//
void
_glfwUnregisterWindowClass
(
void
)
{
UnregisterClassW
(
_GLFW_WNDCLASSNAME
,
GetModuleHandleW
(
NULL
));
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
...
...
@@ -997,13 +1008,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
{
int
status
;
if
(
!
_glfw
.
win32
.
classAtom
)
{
_glfw
.
win32
.
classAtom
=
registerWindowClass
();
if
(
!
_glfw
.
win32
.
classAtom
)
return
GL_FALSE
;
}
if
(
!
createWindow
(
window
,
wndconfig
,
ctxconfig
,
fbconfig
))
return
GL_FALSE
;
...
...
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
register
or
sign in
to comment