mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 20:11:58 +00:00
x11: Move KeySym to unicode converter out of x11 backend
To be used by the Wayland backend.
This commit is contained in:
parent
819e148510
commit
2f71bfc152
@ -27,8 +27,8 @@ elseif (_GLFW_X11)
|
|||||||
set(glfw_HEADERS ${common_HEADERS} x11_platform.h linux_joystick.h
|
set(glfw_HEADERS ${common_HEADERS} x11_platform.h linux_joystick.h
|
||||||
posix_time.h posix_tls.h)
|
posix_time.h posix_tls.h)
|
||||||
set(glfw_SOURCES ${common_SOURCES} x11_clipboard.c x11_gamma.c x11_init.c
|
set(glfw_SOURCES ${common_SOURCES} x11_clipboard.c x11_gamma.c x11_init.c
|
||||||
x11_monitor.c x11_window.c x11_unicode.c linux_joystick.c
|
x11_monitor.c x11_window.c xkb_unicode.c xkb_unicode.h
|
||||||
posix_time.c posix_tls.c)
|
linux_joystick.c posix_time.c posix_tls.c)
|
||||||
elseif (_GLFW_WAYLAND)
|
elseif (_GLFW_WAYLAND)
|
||||||
set(glfw_HEADERS ${common_HEADERS} wl_platform.h linux_joystick.h
|
set(glfw_HEADERS ${common_HEADERS} wl_platform.h linux_joystick.h
|
||||||
posix_time.h posix_tls.h)
|
posix_time.h posix_tls.h)
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
|
|
||||||
#include "posix_time.h"
|
#include "posix_time.h"
|
||||||
#include "linux_joystick.h"
|
#include "linux_joystick.h"
|
||||||
|
#include "xkb_unicode.h"
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowX11 x11
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowX11 x11
|
||||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11
|
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11
|
||||||
@ -248,9 +249,6 @@ void _glfwInitGammaRamp(void);
|
|||||||
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
||||||
|
|
||||||
// Unicode support
|
|
||||||
long _glfwKeySym2Unicode(KeySym keysym);
|
|
||||||
|
|
||||||
// Clipboard handling
|
// Clipboard handling
|
||||||
void _glfwHandleSelectionClear(XEvent* event);
|
void _glfwHandleSelectionClear(XEvent* event);
|
||||||
void _glfwHandleSelectionRequest(XEvent* event);
|
void _glfwHandleSelectionRequest(XEvent* event);
|
||||||
|
@ -852,9 +852,9 @@ static const struct codepair {
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Convert X11 KeySym to Unicode
|
// Convert XKB KeySym to Unicode
|
||||||
//
|
//
|
||||||
long _glfwKeySym2Unicode(KeySym keysym)
|
long _glfwKeySym2Unicode(unsigned int keysym)
|
||||||
{
|
{
|
||||||
int min = 0;
|
int min = 0;
|
||||||
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
|
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
|
33
src/xkb_unicode.h
Normal file
33
src/xkb_unicode.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.1 Linux - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#ifndef _xkb_unicode_h_
|
||||||
|
#define _xkb_unicode_h_
|
||||||
|
|
||||||
|
// Unicode support
|
||||||
|
long _glfwKeySym2Unicode(unsigned int keysym);
|
||||||
|
|
||||||
|
#endif // _xkb_unicode_h_
|
Loading…
Reference in New Issue
Block a user