ibus_glfw.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //========================================================================
  2. // GLFW 3.4 XKB - www.glfw.org
  3. //------------------------------------------------------------------------
  4. // Copyright (c) 2018 Kovid Goyal <kovid@kovidgoyal.net>
  5. //
  6. // This software is provided 'as-is', without any express or implied
  7. // warranty. In no event will the authors be held liable for any damages
  8. // arising from the use of this software.
  9. //
  10. // Permission is granted to anyone to use this software for any purpose,
  11. // including commercial applications, and to alter it and redistribute it
  12. // freely, subject to the following restrictions:
  13. //
  14. // 1. The origin of this software must not be misrepresented; you must not
  15. // claim that you wrote the original software. If you use this software
  16. // in a product, an acknowledgment in the product documentation would
  17. // be appreciated but is not required.
  18. //
  19. // 2. Altered source versions must be plainly marked as such, and must not
  20. // be misrepresented as being the original software.
  21. //
  22. // 3. This notice may not be removed or altered from any source
  23. // distribution.
  24. //
  25. //========================================================================
  26. #pragma once
  27. #include "internal.h"
  28. #include "dbus_glfw.h"
  29. #include <xkbcommon/xkbcommon.h>
  30. typedef struct {
  31. bool ok, inited, name_owner_changed;
  32. time_t address_file_mtime;
  33. DBusConnection *conn;
  34. const char *input_ctx_path, *address_file_name, *address;
  35. } _GLFWIBUSData;
  36. typedef struct {
  37. xkb_keycode_t ibus_keycode;
  38. xkb_keysym_t ibus_keysym;
  39. GLFWid window_id;
  40. GLFWkeyevent glfw_ev;
  41. char __embedded_text[64];
  42. } _GLFWIBUSKeyEvent;
  43. void glfw_connect_to_ibus(_GLFWIBUSData *ibus);
  44. void glfw_ibus_terminate(_GLFWIBUSData *ibus);
  45. void glfw_ibus_set_focused(_GLFWIBUSData *ibus, bool focused);
  46. void glfw_ibus_dispatch(_GLFWIBUSData *ibus);
  47. bool ibus_process_key(const _GLFWIBUSKeyEvent *ev_, _GLFWIBUSData *ibus);
  48. void glfw_ibus_set_cursor_geometry(_GLFWIBUSData *ibus, int x, int y, int w, int h);