1
0

obs-nix-wayland.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /******************************************************************************
  2. Copyright (C) 2019 by Jason Francis <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #include "obs-internal.h"
  15. #include "obs-nix-platform.h"
  16. #include "obs-nix-wayland.h"
  17. #include <wayland-client.h>
  18. void obs_nix_wayland_log_info(void)
  19. {
  20. struct wl_display *display = obs_get_nix_platform_display();
  21. if (display == NULL) {
  22. blog(LOG_INFO, "Unable to connect to Wayland server");
  23. return;
  24. }
  25. //TODO: query some information about the wayland server if possible
  26. blog(LOG_INFO, "Connected to Wayland server");
  27. }
  28. static bool
  29. obs_nix_wayland_hotkeys_platform_init(struct obs_core_hotkeys *hotkeys)
  30. {
  31. UNUSED_PARAMETER(hotkeys);
  32. return true;
  33. }
  34. static void
  35. obs_nix_wayland_hotkeys_platform_free(struct obs_core_hotkeys *hotkeys)
  36. {
  37. UNUSED_PARAMETER(hotkeys);
  38. }
  39. static bool
  40. obs_nix_wayland_hotkeys_platform_is_pressed(obs_hotkeys_platform_t *context,
  41. obs_key_t key)
  42. {
  43. UNUSED_PARAMETER(context);
  44. UNUSED_PARAMETER(key);
  45. return false;
  46. }
  47. static void obs_nix_wayland_key_to_str(obs_key_t key, struct dstr *dstr)
  48. {
  49. UNUSED_PARAMETER(key);
  50. UNUSED_PARAMETER(dstr);
  51. }
  52. static obs_key_t obs_nix_wayland_key_from_virtual_key(int sym)
  53. {
  54. UNUSED_PARAMETER(sym);
  55. return OBS_KEY_NONE;
  56. }
  57. static int obs_nix_wayland_key_to_virtual_key(obs_key_t key)
  58. {
  59. UNUSED_PARAMETER(key);
  60. return 0;
  61. }
  62. static const struct obs_nix_hotkeys_vtable wayland_hotkeys_vtable = {
  63. .init = obs_nix_wayland_hotkeys_platform_init,
  64. .free = obs_nix_wayland_hotkeys_platform_free,
  65. .is_pressed = obs_nix_wayland_hotkeys_platform_is_pressed,
  66. .key_to_str = obs_nix_wayland_key_to_str,
  67. .key_from_virtual_key = obs_nix_wayland_key_from_virtual_key,
  68. .key_to_virtual_key = obs_nix_wayland_key_to_virtual_key,
  69. };
  70. const struct obs_nix_hotkeys_vtable *obs_nix_wayland_get_hotkeys_vtable(void)
  71. {
  72. return &wayland_hotkeys_vtable;
  73. }