Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pirvi-public
glfw
Commits
a49601ba
Commit
a49601ba
authored
Oct 01, 2016
by
Emmanuel Gil Peyrot
Committed by
linkmauve
Oct 12, 2016
Browse files
Wayland: Rename snake_case identifiers to camelCase for consistency
parent
aa10ec6e
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/wl_init.c
View file @
a49601ba
...
...
@@ -128,7 +128,7 @@ static void pointerHandleAxis(void* data,
wl_fixed_t
value
)
{
_GLFWwindow
*
window
=
_glfw
.
wl
.
pointerFocus
;
double
scroll
_f
actor
;
double
scroll
F
actor
;
double
x
,
y
;
if
(
!
window
)
...
...
@@ -137,17 +137,17 @@ static void pointerHandleAxis(void* data,
/* Wayland scroll events are in pointer motion coordinate space (think
* two finger scroll). The factor 10 is commonly used to convert to
* "scroll step means 1.0. */
scroll
_f
actor
=
1
.
0
/
10
.
0
;
scroll
F
actor
=
1
.
0
/
10
.
0
;
switch
(
axis
)
{
case
WL_POINTER_AXIS_HORIZONTAL_SCROLL
:
x
=
wl_fixed_to_double
(
value
)
*
scroll
_f
actor
;
x
=
wl_fixed_to_double
(
value
)
*
scroll
F
actor
;
y
=
0
.
0
;
break
;
case
WL_POINTER_AXIS_VERTICAL_SCROLL
:
x
=
0
.
0
;
y
=
wl_fixed_to_double
(
value
)
*
scroll
_f
actor
;
y
=
wl_fixed_to_double
(
value
)
*
scroll
F
actor
;
break
;
default:
break
;
...
...
@@ -214,13 +214,13 @@ static void keyboardHandleKeymap(void* data,
_glfw
.
wl
.
xkb
.
keymap
=
keymap
;
_glfw
.
wl
.
xkb
.
state
=
state
;
_glfw
.
wl
.
xkb
.
control
_m
ask
=
_glfw
.
wl
.
xkb
.
control
M
ask
=
1
<<
xkb_keymap_mod_get_index
(
_glfw
.
wl
.
xkb
.
keymap
,
"Control"
);
_glfw
.
wl
.
xkb
.
alt
_m
ask
=
_glfw
.
wl
.
xkb
.
alt
M
ask
=
1
<<
xkb_keymap_mod_get_index
(
_glfw
.
wl
.
xkb
.
keymap
,
"Mod1"
);
_glfw
.
wl
.
xkb
.
shift
_m
ask
=
_glfw
.
wl
.
xkb
.
shift
M
ask
=
1
<<
xkb_keymap_mod_get_index
(
_glfw
.
wl
.
xkb
.
keymap
,
"Shift"
);
_glfw
.
wl
.
xkb
.
super
_m
ask
=
_glfw
.
wl
.
xkb
.
super
M
ask
=
1
<<
xkb_keymap_mod_get_index
(
_glfw
.
wl
.
xkb
.
keymap
,
"Mod4"
);
}
...
...
@@ -260,14 +260,14 @@ static int toGLFWKeyCode(uint32_t key)
static
void
inputChar
(
_GLFWwindow
*
window
,
uint32_t
key
)
{
uint32_t
code
,
num
_s
yms
;
uint32_t
code
,
num
S
yms
;
long
cp
;
const
xkb_keysym_t
*
syms
;
code
=
key
+
8
;
num
_s
yms
=
xkb_state_key_get_syms
(
_glfw
.
wl
.
xkb
.
state
,
code
,
&
syms
);
num
S
yms
=
xkb_state_key_get_syms
(
_glfw
.
wl
.
xkb
.
state
,
code
,
&
syms
);
if
(
num
_s
yms
==
1
)
if
(
num
S
yms
==
1
)
{
cp
=
_glfwKeySym2Unicode
(
syms
[
0
]);
if
(
cp
!=
-
1
)
...
...
@@ -331,13 +331,13 @@ static void keyboardHandleModifiers(void* data,
XKB_STATE_LAYOUT_DEPRESSED
|
XKB_STATE_MODS_LATCHED
|
XKB_STATE_LAYOUT_LATCHED
);
if
(
mask
&
_glfw
.
wl
.
xkb
.
control
_m
ask
)
if
(
mask
&
_glfw
.
wl
.
xkb
.
control
M
ask
)
modifiers
|=
GLFW_MOD_CONTROL
;
if
(
mask
&
_glfw
.
wl
.
xkb
.
alt
_m
ask
)
if
(
mask
&
_glfw
.
wl
.
xkb
.
alt
M
ask
)
modifiers
|=
GLFW_MOD_ALT
;
if
(
mask
&
_glfw
.
wl
.
xkb
.
shift
_m
ask
)
if
(
mask
&
_glfw
.
wl
.
xkb
.
shift
M
ask
)
modifiers
|=
GLFW_MOD_SHIFT
;
if
(
mask
&
_glfw
.
wl
.
xkb
.
super
_m
ask
)
if
(
mask
&
_glfw
.
wl
.
xkb
.
super
M
ask
)
modifiers
|=
GLFW_MOD_SUPER
;
_glfw
.
wl
.
xkb
.
modifiers
=
modifiers
;
}
...
...
@@ -389,10 +389,10 @@ static void registryHandleGlobal(void* data,
{
if
(
strcmp
(
interface
,
"wl_compositor"
)
==
0
)
{
_glfw
.
wl
.
wl_
compositor
_v
ersion
=
min
(
3
,
version
);
_glfw
.
wl
.
compositor
V
ersion
=
min
(
3
,
version
);
_glfw
.
wl
.
compositor
=
wl_registry_bind
(
registry
,
name
,
&
wl_compositor_interface
,
_glfw
.
wl
.
wl_
compositor
_v
ersion
);
_glfw
.
wl
.
compositor
V
ersion
);
}
else
if
(
strcmp
(
interface
,
"wl_shm"
)
==
0
)
{
...
...
src/wl_monitor.c
View file @
a49601ba
...
...
@@ -102,7 +102,7 @@ static void scale(void* data,
monitor
->
wl
.
scale
=
factor
;
}
static
const
struct
wl_output_listener
output
_l
istener
=
{
static
const
struct
wl_output_listener
output
L
istener
=
{
geometry
,
mode
,
done
,
...
...
@@ -118,10 +118,10 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
{
_GLFWmonitor
*
monitor
;
struct
wl_output
*
output
;
char
name
_s
tr
[
80
];
char
name
S
tr
[
80
];
memset
(
name
_s
tr
,
0
,
sizeof
(
name
_s
tr
));
snprintf
(
name
_s
tr
,
79
,
"wl_output@%u"
,
name
);
memset
(
name
S
tr
,
0
,
sizeof
(
name
S
tr
));
snprintf
(
name
S
tr
,
79
,
"wl_output@%u"
,
name
);
if
(
version
<
2
)
{
...
...
@@ -130,7 +130,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
return
;
}
monitor
=
_glfwAllocMonitor
(
name
_s
tr
,
0
,
0
);
monitor
=
_glfwAllocMonitor
(
name
S
tr
,
0
,
0
);
output
=
wl_registry_bind
(
_glfw
.
wl
.
registry
,
name
,
...
...
@@ -148,7 +148,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
monitor
->
wl
.
scale
=
1
;
monitor
->
wl
.
output
=
output
;
wl_output_add_listener
(
output
,
&
output
_l
istener
,
monitor
);
wl_output_add_listener
(
output
,
&
output
L
istener
,
monitor
);
if
(
_glfw
.
wl
.
monitorsCount
+
1
>=
_glfw
.
wl
.
monitorsSize
)
{
...
...
src/wl_platform.h
View file @
a49601ba
...
...
@@ -83,7 +83,7 @@ typedef struct _GLFWwindowWayland
GLFWbool
maximized
;
struct
wl_surface
*
surface
;
struct
wl_egl_window
*
native
;
struct
wl_shell_surface
*
shell
_s
urface
;
struct
wl_shell_surface
*
shell
S
urface
;
struct
wl_callback
*
callback
;
_GLFWcursor
*
currentCursor
;
...
...
@@ -119,7 +119,7 @@ typedef struct _GLFWlibraryWayland
struct
zwp_relative_pointer_manager_v1
*
relativePointerManager
;
struct
zwp_pointer_constraints_v1
*
pointerConstraints
;
int
wl_
compositor
_v
ersion
;
int
compositor
V
ersion
;
struct
wl_cursor_theme
*
cursorTheme
;
struct
wl_surface
*
cursorSurface
;
...
...
@@ -136,10 +136,10 @@ typedef struct _GLFWlibraryWayland
struct
xkb_context
*
context
;
struct
xkb_keymap
*
keymap
;
struct
xkb_state
*
state
;
xkb_mod_mask_t
control
_m
ask
;
xkb_mod_mask_t
alt
_m
ask
;
xkb_mod_mask_t
shift
_m
ask
;
xkb_mod_mask_t
super
_m
ask
;
xkb_mod_mask_t
control
M
ask
;
xkb_mod_mask_t
alt
M
ask
;
xkb_mod_mask_t
shift
M
ask
;
xkb_mod_mask_t
super
M
ask
;
unsigned
int
modifiers
;
}
xkb
;
...
...
src/wl_window.c
View file @
a49601ba
...
...
@@ -105,7 +105,7 @@ static void checkScaleChange(_GLFWwindow* window)
int
monitorScale
;
// Check if we will be able to set the buffer scale or not.
if
(
_glfw
.
wl
.
wl_
compositor
_v
ersion
<
3
)
if
(
_glfw
.
wl
.
compositor
V
ersion
<
3
)
return
;
// Get the scale factor from the highest scale monitor.
...
...
@@ -220,33 +220,33 @@ static GLFWbool createSurface(_GLFWwindow* window,
static
GLFWbool
createShellSurface
(
_GLFWwindow
*
window
)
{
window
->
wl
.
shell
_s
urface
=
wl_shell_get_shell_surface
(
_glfw
.
wl
.
shell
,
window
->
wl
.
surface
);
if
(
!
window
->
wl
.
shell
_s
urface
)
window
->
wl
.
shell
S
urface
=
wl_shell_get_shell_surface
(
_glfw
.
wl
.
shell
,
window
->
wl
.
surface
);
if
(
!
window
->
wl
.
shell
S
urface
)
return
GLFW_FALSE
;
wl_shell_surface_add_listener
(
window
->
wl
.
shell
_s
urface
,
wl_shell_surface_add_listener
(
window
->
wl
.
shell
S
urface
,
&
shellSurfaceListener
,
window
);
if
(
window
->
wl
.
title
)
wl_shell_surface_set_title
(
window
->
wl
.
shell
_s
urface
,
window
->
wl
.
title
);
wl_shell_surface_set_title
(
window
->
wl
.
shell
S
urface
,
window
->
wl
.
title
);
if
(
window
->
monitor
)
{
wl_shell_surface_set_fullscreen
(
window
->
wl
.
shell
_s
urface
,
window
->
wl
.
shell
S
urface
,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT
,
0
,
window
->
monitor
->
wl
.
output
);
}
else
if
(
window
->
wl
.
maximized
)
{
wl_shell_surface_set_maximized
(
window
->
wl
.
shell
_s
urface
,
NULL
);
wl_shell_surface_set_maximized
(
window
->
wl
.
shell
S
urface
,
NULL
);
}
else
{
wl_shell_surface_set_toplevel
(
window
->
wl
.
shell
_s
urface
);
wl_shell_surface_set_toplevel
(
window
->
wl
.
shell
S
urface
);
}
return
GLFW_TRUE
;
...
...
@@ -411,7 +411,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
}
else
{
window
->
wl
.
shell
_s
urface
=
NULL
;
window
->
wl
.
shell
S
urface
=
NULL
;
window
->
wl
.
visible
=
GLFW_FALSE
;
}
...
...
@@ -443,8 +443,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
if
(
window
->
wl
.
native
)
wl_egl_window_destroy
(
window
->
wl
.
native
);
if
(
window
->
wl
.
shell
_s
urface
)
wl_shell_surface_destroy
(
window
->
wl
.
shell
_s
urface
);
if
(
window
->
wl
.
shell
S
urface
)
wl_shell_surface_destroy
(
window
->
wl
.
shell
S
urface
);
if
(
window
->
wl
.
surface
)
wl_surface_destroy
(
window
->
wl
.
surface
);
...
...
@@ -458,8 +458,8 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
if
(
window
->
wl
.
title
)
free
(
window
->
wl
.
title
);
window
->
wl
.
title
=
strdup
(
title
);
if
(
window
->
wl
.
shell
_s
urface
)
wl_shell_surface_set_title
(
window
->
wl
.
shell
_s
urface
,
title
);
if
(
window
->
wl
.
shell
S
urface
)
wl_shell_surface_set_title
(
window
->
wl
.
shell
S
urface
,
title
);
}
void
_glfwPlatformSetWindowIcon
(
_GLFWwindow
*
window
,
...
...
@@ -546,8 +546,8 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
// TODO: also do the same for iconified.
if
(
window
->
monitor
||
window
->
wl
.
maximized
)
{
if
(
window
->
wl
.
shell
_s
urface
)
wl_shell_surface_set_toplevel
(
window
->
wl
.
shell
_s
urface
);
if
(
window
->
wl
.
shell
S
urface
)
wl_shell_surface_set_toplevel
(
window
->
wl
.
shell
S
urface
);
window
->
wl
.
maximized
=
GLFW_FALSE
;
}
...
...
@@ -557,10 +557,10 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
{
if
(
!
window
->
monitor
&&
!
window
->
wl
.
maximized
)
{
if
(
window
->
wl
.
shell
_s
urface
)
if
(
window
->
wl
.
shell
S
urface
)
{
// Let the compositor select the best output.
wl_shell_surface_set_maximized
(
window
->
wl
.
shell
_s
urface
,
NULL
);
wl_shell_surface_set_maximized
(
window
->
wl
.
shell
S
urface
,
NULL
);
}
window
->
wl
.
maximized
=
GLFW_TRUE
;
}
...
...
@@ -570,7 +570,7 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
{
if
(
!
window
->
monitor
)
{
if
(
!
window
->
wl
.
shell
_s
urface
)
if
(
!
window
->
wl
.
shell
S
urface
)
createShellSurface
(
window
);
window
->
wl
.
visible
=
GLFW_TRUE
;
}
...
...
@@ -580,8 +580,8 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
{
if
(
!
window
->
monitor
)
{
if
(
window
->
wl
.
shell
_s
urface
)
wl_shell_surface_destroy
(
window
->
wl
.
shell
_s
urface
);
if
(
window
->
wl
.
shell
S
urface
)
wl_shell_surface_destroy
(
window
->
wl
.
shell
S
urface
);
window
->
wl
.
visible
=
GLFW_FALSE
;
}
}
...
...
@@ -601,14 +601,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
if
(
monitor
)
{
wl_shell_surface_set_fullscreen
(
window
->
wl
.
shell
_s
urface
,
window
->
wl
.
shell
S
urface
,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT
,
refreshRate
*
1000
,
// Convert Hz to mHz.
monitor
->
wl
.
output
);
}
else
{
wl_shell_surface_set_toplevel
(
window
->
wl
.
shell
_s
urface
);
wl_shell_surface_set_toplevel
(
window
->
wl
.
shell
S
urface
);
}
_glfwInputWindowMonitorChange
(
window
,
monitor
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment