Commit a49601ba authored by Emmanuel Gil Peyrot's avatar Emmanuel Gil Peyrot Committed by linkmauve
Browse files

Wayland: Rename snake_case identifiers to camelCase for consistency

parent aa10ec6e
...@@ -128,7 +128,7 @@ static void pointerHandleAxis(void* data, ...@@ -128,7 +128,7 @@ static void pointerHandleAxis(void* data,
wl_fixed_t value) wl_fixed_t value)
{ {
_GLFWwindow* window = _glfw.wl.pointerFocus; _GLFWwindow* window = _glfw.wl.pointerFocus;
double scroll_factor; double scrollFactor;
double x, y; double x, y;
if (!window) if (!window)
...@@ -137,17 +137,17 @@ static void pointerHandleAxis(void* data, ...@@ -137,17 +137,17 @@ static void pointerHandleAxis(void* data,
/* Wayland scroll events are in pointer motion coordinate space (think /* Wayland scroll events are in pointer motion coordinate space (think
* two finger scroll). The factor 10 is commonly used to convert to * two finger scroll). The factor 10 is commonly used to convert to
* "scroll step means 1.0. */ * "scroll step means 1.0. */
scroll_factor = 1.0/10.0; scrollFactor = 1.0/10.0;
switch (axis) switch (axis)
{ {
case WL_POINTER_AXIS_HORIZONTAL_SCROLL: case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
x = wl_fixed_to_double(value) * scroll_factor; x = wl_fixed_to_double(value) * scrollFactor;
y = 0.0; y = 0.0;
break; break;
case WL_POINTER_AXIS_VERTICAL_SCROLL: case WL_POINTER_AXIS_VERTICAL_SCROLL:
x = 0.0; x = 0.0;
y = wl_fixed_to_double(value) * scroll_factor; y = wl_fixed_to_double(value) * scrollFactor;
break; break;
default: default:
break; break;
...@@ -214,13 +214,13 @@ static void keyboardHandleKeymap(void* data, ...@@ -214,13 +214,13 @@ static void keyboardHandleKeymap(void* data,
_glfw.wl.xkb.keymap = keymap; _glfw.wl.xkb.keymap = keymap;
_glfw.wl.xkb.state = state; _glfw.wl.xkb.state = state;
_glfw.wl.xkb.control_mask = _glfw.wl.xkb.controlMask =
1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control"); 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control");
_glfw.wl.xkb.alt_mask = _glfw.wl.xkb.altMask =
1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1"); 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1");
_glfw.wl.xkb.shift_mask = _glfw.wl.xkb.shiftMask =
1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift"); 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift");
_glfw.wl.xkb.super_mask = _glfw.wl.xkb.superMask =
1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4"); 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4");
} }
...@@ -260,14 +260,14 @@ static int toGLFWKeyCode(uint32_t key) ...@@ -260,14 +260,14 @@ static int toGLFWKeyCode(uint32_t key)
static void inputChar(_GLFWwindow* window, uint32_t key) static void inputChar(_GLFWwindow* window, uint32_t key)
{ {
uint32_t code, num_syms; uint32_t code, numSyms;
long cp; long cp;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
code = key + 8; code = key + 8;
num_syms = xkb_state_key_get_syms(_glfw.wl.xkb.state, code, &syms); numSyms = xkb_state_key_get_syms(_glfw.wl.xkb.state, code, &syms);
if (num_syms == 1) if (numSyms == 1)
{ {
cp = _glfwKeySym2Unicode(syms[0]); cp = _glfwKeySym2Unicode(syms[0]);
if (cp != -1) if (cp != -1)
...@@ -331,13 +331,13 @@ static void keyboardHandleModifiers(void* data, ...@@ -331,13 +331,13 @@ static void keyboardHandleModifiers(void* data,
XKB_STATE_LAYOUT_DEPRESSED | XKB_STATE_LAYOUT_DEPRESSED |
XKB_STATE_MODS_LATCHED | XKB_STATE_MODS_LATCHED |
XKB_STATE_LAYOUT_LATCHED); XKB_STATE_LAYOUT_LATCHED);
if (mask & _glfw.wl.xkb.control_mask) if (mask & _glfw.wl.xkb.controlMask)
modifiers |= GLFW_MOD_CONTROL; modifiers |= GLFW_MOD_CONTROL;
if (mask & _glfw.wl.xkb.alt_mask) if (mask & _glfw.wl.xkb.altMask)
modifiers |= GLFW_MOD_ALT; modifiers |= GLFW_MOD_ALT;
if (mask & _glfw.wl.xkb.shift_mask) if (mask & _glfw.wl.xkb.shiftMask)
modifiers |= GLFW_MOD_SHIFT; modifiers |= GLFW_MOD_SHIFT;
if (mask & _glfw.wl.xkb.super_mask) if (mask & _glfw.wl.xkb.superMask)
modifiers |= GLFW_MOD_SUPER; modifiers |= GLFW_MOD_SUPER;
_glfw.wl.xkb.modifiers = modifiers; _glfw.wl.xkb.modifiers = modifiers;
} }
...@@ -389,10 +389,10 @@ static void registryHandleGlobal(void* data, ...@@ -389,10 +389,10 @@ static void registryHandleGlobal(void* data,
{ {
if (strcmp(interface, "wl_compositor") == 0) if (strcmp(interface, "wl_compositor") == 0)
{ {
_glfw.wl.wl_compositor_version = min(3, version); _glfw.wl.compositorVersion = min(3, version);
_glfw.wl.compositor = _glfw.wl.compositor =
wl_registry_bind(registry, name, &wl_compositor_interface, wl_registry_bind(registry, name, &wl_compositor_interface,
_glfw.wl.wl_compositor_version); _glfw.wl.compositorVersion);
} }
else if (strcmp(interface, "wl_shm") == 0) else if (strcmp(interface, "wl_shm") == 0)
{ {
......
...@@ -102,7 +102,7 @@ static void scale(void* data, ...@@ -102,7 +102,7 @@ static void scale(void* data,
monitor->wl.scale = factor; monitor->wl.scale = factor;
} }
static const struct wl_output_listener output_listener = { static const struct wl_output_listener outputListener = {
geometry, geometry,
mode, mode,
done, done,
...@@ -118,10 +118,10 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) ...@@ -118,10 +118,10 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
{ {
_GLFWmonitor *monitor; _GLFWmonitor *monitor;
struct wl_output *output; struct wl_output *output;
char name_str[80]; char nameStr[80];
memset(name_str, 0, sizeof(name_str)); memset(nameStr, 0, sizeof(nameStr));
snprintf(name_str, 79, "wl_output@%u", name); snprintf(nameStr, 79, "wl_output@%u", name);
if (version < 2) if (version < 2)
{ {
...@@ -130,7 +130,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) ...@@ -130,7 +130,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
return; return;
} }
monitor = _glfwAllocMonitor(name_str, 0, 0); monitor = _glfwAllocMonitor(nameStr, 0, 0);
output = wl_registry_bind(_glfw.wl.registry, output = wl_registry_bind(_glfw.wl.registry,
name, name,
...@@ -148,7 +148,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) ...@@ -148,7 +148,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
monitor->wl.scale = 1; monitor->wl.scale = 1;
monitor->wl.output = output; monitor->wl.output = output;
wl_output_add_listener(output, &output_listener, monitor); wl_output_add_listener(output, &outputListener, monitor);
if (_glfw.wl.monitorsCount + 1 >= _glfw.wl.monitorsSize) if (_glfw.wl.monitorsCount + 1 >= _glfw.wl.monitorsSize)
{ {
......
...@@ -83,7 +83,7 @@ typedef struct _GLFWwindowWayland ...@@ -83,7 +83,7 @@ typedef struct _GLFWwindowWayland
GLFWbool maximized; GLFWbool maximized;
struct wl_surface* surface; struct wl_surface* surface;
struct wl_egl_window* native; struct wl_egl_window* native;
struct wl_shell_surface* shell_surface; struct wl_shell_surface* shellSurface;
struct wl_callback* callback; struct wl_callback* callback;
_GLFWcursor* currentCursor; _GLFWcursor* currentCursor;
...@@ -119,7 +119,7 @@ typedef struct _GLFWlibraryWayland ...@@ -119,7 +119,7 @@ typedef struct _GLFWlibraryWayland
struct zwp_relative_pointer_manager_v1* relativePointerManager; struct zwp_relative_pointer_manager_v1* relativePointerManager;
struct zwp_pointer_constraints_v1* pointerConstraints; struct zwp_pointer_constraints_v1* pointerConstraints;
int wl_compositor_version; int compositorVersion;
struct wl_cursor_theme* cursorTheme; struct wl_cursor_theme* cursorTheme;
struct wl_surface* cursorSurface; struct wl_surface* cursorSurface;
...@@ -136,10 +136,10 @@ typedef struct _GLFWlibraryWayland ...@@ -136,10 +136,10 @@ typedef struct _GLFWlibraryWayland
struct xkb_context* context; struct xkb_context* context;
struct xkb_keymap* keymap; struct xkb_keymap* keymap;
struct xkb_state* state; struct xkb_state* state;
xkb_mod_mask_t control_mask; xkb_mod_mask_t controlMask;
xkb_mod_mask_t alt_mask; xkb_mod_mask_t altMask;
xkb_mod_mask_t shift_mask; xkb_mod_mask_t shiftMask;
xkb_mod_mask_t super_mask; xkb_mod_mask_t superMask;
unsigned int modifiers; unsigned int modifiers;
} xkb; } xkb;
......
...@@ -105,7 +105,7 @@ static void checkScaleChange(_GLFWwindow* window) ...@@ -105,7 +105,7 @@ static void checkScaleChange(_GLFWwindow* window)
int monitorScale; int monitorScale;
// Check if we will be able to set the buffer scale or not. // Check if we will be able to set the buffer scale or not.
if (_glfw.wl.wl_compositor_version < 3) if (_glfw.wl.compositorVersion < 3)
return; return;
// Get the scale factor from the highest scale monitor. // Get the scale factor from the highest scale monitor.
...@@ -220,33 +220,33 @@ static GLFWbool createSurface(_GLFWwindow* window, ...@@ -220,33 +220,33 @@ static GLFWbool createSurface(_GLFWwindow* window,
static GLFWbool createShellSurface(_GLFWwindow* window) static GLFWbool createShellSurface(_GLFWwindow* window)
{ {
window->wl.shell_surface = wl_shell_get_shell_surface(_glfw.wl.shell, window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell,
window->wl.surface); window->wl.surface);
if (!window->wl.shell_surface) if (!window->wl.shellSurface)
return GLFW_FALSE; return GLFW_FALSE;
wl_shell_surface_add_listener(window->wl.shell_surface, wl_shell_surface_add_listener(window->wl.shellSurface,
&shellSurfaceListener, &shellSurfaceListener,
window); window);
if (window->wl.title) if (window->wl.title)
wl_shell_surface_set_title(window->wl.shell_surface, window->wl.title); wl_shell_surface_set_title(window->wl.shellSurface, window->wl.title);
if (window->monitor) if (window->monitor)
{ {
wl_shell_surface_set_fullscreen( wl_shell_surface_set_fullscreen(
window->wl.shell_surface, window->wl.shellSurface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
0, 0,
window->monitor->wl.output); window->monitor->wl.output);
} }
else if (window->wl.maximized) else if (window->wl.maximized)
{ {
wl_shell_surface_set_maximized(window->wl.shell_surface, NULL); wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
} }
else else
{ {
wl_shell_surface_set_toplevel(window->wl.shell_surface); wl_shell_surface_set_toplevel(window->wl.shellSurface);
} }
return GLFW_TRUE; return GLFW_TRUE;
...@@ -411,7 +411,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, ...@@ -411,7 +411,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
} }
else else
{ {
window->wl.shell_surface = NULL; window->wl.shellSurface = NULL;
window->wl.visible = GLFW_FALSE; window->wl.visible = GLFW_FALSE;
} }
...@@ -443,8 +443,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) ...@@ -443,8 +443,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
if (window->wl.native) if (window->wl.native)
wl_egl_window_destroy(window->wl.native); wl_egl_window_destroy(window->wl.native);
if (window->wl.shell_surface) if (window->wl.shellSurface)
wl_shell_surface_destroy(window->wl.shell_surface); wl_shell_surface_destroy(window->wl.shellSurface);
if (window->wl.surface) if (window->wl.surface)
wl_surface_destroy(window->wl.surface); wl_surface_destroy(window->wl.surface);
...@@ -458,8 +458,8 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) ...@@ -458,8 +458,8 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
if (window->wl.title) if (window->wl.title)
free(window->wl.title); free(window->wl.title);
window->wl.title = strdup(title); window->wl.title = strdup(title);
if (window->wl.shell_surface) if (window->wl.shellSurface)
wl_shell_surface_set_title(window->wl.shell_surface, title); wl_shell_surface_set_title(window->wl.shellSurface, title);
} }
void _glfwPlatformSetWindowIcon(_GLFWwindow* window, void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
...@@ -546,8 +546,8 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) ...@@ -546,8 +546,8 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
// TODO: also do the same for iconified. // TODO: also do the same for iconified.
if (window->monitor || window->wl.maximized) if (window->monitor || window->wl.maximized)
{ {
if (window->wl.shell_surface) if (window->wl.shellSurface)
wl_shell_surface_set_toplevel(window->wl.shell_surface); wl_shell_surface_set_toplevel(window->wl.shellSurface);
window->wl.maximized = GLFW_FALSE; window->wl.maximized = GLFW_FALSE;
} }
...@@ -557,10 +557,10 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window) ...@@ -557,10 +557,10 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
{ {
if (!window->monitor && !window->wl.maximized) if (!window->monitor && !window->wl.maximized)
{ {
if (window->wl.shell_surface) if (window->wl.shellSurface)
{ {
// Let the compositor select the best output. // Let the compositor select the best output.
wl_shell_surface_set_maximized(window->wl.shell_surface, NULL); wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
} }
window->wl.maximized = GLFW_TRUE; window->wl.maximized = GLFW_TRUE;
} }
...@@ -570,7 +570,7 @@ void _glfwPlatformShowWindow(_GLFWwindow* window) ...@@ -570,7 +570,7 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
{ {
if (!window->monitor) if (!window->monitor)
{ {
if (!window->wl.shell_surface) if (!window->wl.shellSurface)
createShellSurface(window); createShellSurface(window);
window->wl.visible = GLFW_TRUE; window->wl.visible = GLFW_TRUE;
} }
...@@ -580,8 +580,8 @@ void _glfwPlatformHideWindow(_GLFWwindow* window) ...@@ -580,8 +580,8 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
{ {
if (!window->monitor) if (!window->monitor)
{ {
if (window->wl.shell_surface) if (window->wl.shellSurface)
wl_shell_surface_destroy(window->wl.shell_surface); wl_shell_surface_destroy(window->wl.shellSurface);
window->wl.visible = GLFW_FALSE; window->wl.visible = GLFW_FALSE;
} }
} }
...@@ -601,14 +601,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, ...@@ -601,14 +601,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
if (monitor) if (monitor)
{ {
wl_shell_surface_set_fullscreen( wl_shell_surface_set_fullscreen(
window->wl.shell_surface, window->wl.shellSurface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
refreshRate * 1000, // Convert Hz to mHz. refreshRate * 1000, // Convert Hz to mHz.
monitor->wl.output); monitor->wl.output);
} }
else else
{ {
wl_shell_surface_set_toplevel(window->wl.shell_surface); wl_shell_surface_set_toplevel(window->wl.shellSurface);
} }
_glfwInputWindowMonitorChange(window, monitor); _glfwInputWindowMonitorChange(window, monitor);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment