From a49601ba875245fa6789d699d51031d1dec80b93 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 1 Oct 2016 20:05:29 +0100 Subject: [PATCH] Wayland: Rename snake_case identifiers to camelCase for consistency --- src/wl_init.c | 34 +++++++++++++++++----------------- src/wl_monitor.c | 12 ++++++------ src/wl_platform.h | 12 ++++++------ src/wl_window.c | 46 +++++++++++++++++++++++----------------------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 2a7a4fbb..4627c599 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -128,7 +128,7 @@ static void pointerHandleAxis(void* data, wl_fixed_t value) { _GLFWwindow* window = _glfw.wl.pointerFocus; - double scroll_factor; + double scrollFactor; 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_factor = 1.0/10.0; + scrollFactor = 1.0/10.0; switch (axis) { case WL_POINTER_AXIS_HORIZONTAL_SCROLL: - x = wl_fixed_to_double(value) * scroll_factor; + x = wl_fixed_to_double(value) * scrollFactor; y = 0.0; break; case WL_POINTER_AXIS_VERTICAL_SCROLL: x = 0.0; - y = wl_fixed_to_double(value) * scroll_factor; + y = wl_fixed_to_double(value) * scrollFactor; 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_mask = + _glfw.wl.xkb.controlMask = 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"); - _glfw.wl.xkb.shift_mask = + _glfw.wl.xkb.shiftMask = 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"); } @@ -260,14 +260,14 @@ static int toGLFWKeyCode(uint32_t key) static void inputChar(_GLFWwindow* window, uint32_t key) { - uint32_t code, num_syms; + uint32_t code, numSyms; long cp; const xkb_keysym_t *syms; 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]); 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_mask) + if (mask & _glfw.wl.xkb.controlMask) modifiers |= GLFW_MOD_CONTROL; - if (mask & _glfw.wl.xkb.alt_mask) + if (mask & _glfw.wl.xkb.altMask) modifiers |= GLFW_MOD_ALT; - if (mask & _glfw.wl.xkb.shift_mask) + if (mask & _glfw.wl.xkb.shiftMask) modifiers |= GLFW_MOD_SHIFT; - if (mask & _glfw.wl.xkb.super_mask) + if (mask & _glfw.wl.xkb.superMask) 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_version = min(3, version); + _glfw.wl.compositorVersion = min(3, version); _glfw.wl.compositor = wl_registry_bind(registry, name, &wl_compositor_interface, - _glfw.wl.wl_compositor_version); + _glfw.wl.compositorVersion); } else if (strcmp(interface, "wl_shm") == 0) { diff --git a/src/wl_monitor.c b/src/wl_monitor.c index d6a5a3f4..7a830513 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -102,7 +102,7 @@ static void scale(void* data, monitor->wl.scale = factor; } -static const struct wl_output_listener output_listener = { +static const struct wl_output_listener outputListener = { geometry, mode, done, @@ -118,10 +118,10 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) { _GLFWmonitor *monitor; struct wl_output *output; - char name_str[80]; + char nameStr[80]; - memset(name_str, 0, sizeof(name_str)); - snprintf(name_str, 79, "wl_output@%u", name); + memset(nameStr, 0, sizeof(nameStr)); + snprintf(nameStr, 79, "wl_output@%u", name); if (version < 2) { @@ -130,7 +130,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) return; } - monitor = _glfwAllocMonitor(name_str, 0, 0); + monitor = _glfwAllocMonitor(nameStr, 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_listener, monitor); + wl_output_add_listener(output, &outputListener, monitor); if (_glfw.wl.monitorsCount + 1 >= _glfw.wl.monitorsSize) { diff --git a/src/wl_platform.h b/src/wl_platform.h index cec52b90..f60626e2 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -83,7 +83,7 @@ typedef struct _GLFWwindowWayland GLFWbool maximized; struct wl_surface* surface; struct wl_egl_window* native; - struct wl_shell_surface* shell_surface; + struct wl_shell_surface* shellSurface; 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_version; + int compositorVersion; 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_mask; - xkb_mod_mask_t alt_mask; - xkb_mod_mask_t shift_mask; - xkb_mod_mask_t super_mask; + xkb_mod_mask_t controlMask; + xkb_mod_mask_t altMask; + xkb_mod_mask_t shiftMask; + xkb_mod_mask_t superMask; unsigned int modifiers; } xkb; diff --git a/src/wl_window.c b/src/wl_window.c index 0761de64..a2bae373 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -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_version < 3) + if (_glfw.wl.compositorVersion < 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_surface = wl_shell_get_shell_surface(_glfw.wl.shell, - window->wl.surface); - if (!window->wl.shell_surface) + window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell, + window->wl.surface); + if (!window->wl.shellSurface) return GLFW_FALSE; - wl_shell_surface_add_listener(window->wl.shell_surface, + wl_shell_surface_add_listener(window->wl.shellSurface, &shellSurfaceListener, window); 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) { wl_shell_surface_set_fullscreen( - window->wl.shell_surface, + window->wl.shellSurface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, window->monitor->wl.output); } 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 { - wl_shell_surface_set_toplevel(window->wl.shell_surface); + wl_shell_surface_set_toplevel(window->wl.shellSurface); } return GLFW_TRUE; @@ -411,7 +411,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, } else { - window->wl.shell_surface = NULL; + window->wl.shellSurface = 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_surface) - wl_shell_surface_destroy(window->wl.shell_surface); + if (window->wl.shellSurface) + wl_shell_surface_destroy(window->wl.shellSurface); 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_surface) - wl_shell_surface_set_title(window->wl.shell_surface, title); + if (window->wl.shellSurface) + wl_shell_surface_set_title(window->wl.shellSurface, 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_surface) - wl_shell_surface_set_toplevel(window->wl.shell_surface); + if (window->wl.shellSurface) + wl_shell_surface_set_toplevel(window->wl.shellSurface); window->wl.maximized = GLFW_FALSE; } @@ -557,10 +557,10 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { if (!window->monitor && !window->wl.maximized) { - if (window->wl.shell_surface) + if (window->wl.shellSurface) { // 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; } @@ -570,7 +570,7 @@ void _glfwPlatformShowWindow(_GLFWwindow* window) { if (!window->monitor) { - if (!window->wl.shell_surface) + if (!window->wl.shellSurface) createShellSurface(window); window->wl.visible = GLFW_TRUE; } @@ -580,8 +580,8 @@ void _glfwPlatformHideWindow(_GLFWwindow* window) { if (!window->monitor) { - if (window->wl.shell_surface) - wl_shell_surface_destroy(window->wl.shell_surface); + if (window->wl.shellSurface) + wl_shell_surface_destroy(window->wl.shellSurface); window->wl.visible = GLFW_FALSE; } } @@ -601,14 +601,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, if (monitor) { wl_shell_surface_set_fullscreen( - window->wl.shell_surface, + window->wl.shellSurface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, refreshRate * 1000, // Convert Hz to mHz. monitor->wl.output); } else { - wl_shell_surface_set_toplevel(window->wl.shell_surface); + wl_shell_surface_set_toplevel(window->wl.shellSurface); } _glfwInputWindowMonitorChange(window, monitor); }