Skip to content

Commit

Permalink
Merge pull request #3 from Riteo/wayland
Browse files Browse the repository at this point in the history
Wayland pull
  • Loading branch information
Rustmilian committed Sep 27, 2023
2 parents 0fff5e1 + 9a44ebe commit 0de296c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
9 changes: 0 additions & 9 deletions drivers/gles3/rasterizer_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@

#include "platform_gl.h"

#if EGL_ENABLED
#if GLAD_ENABLED
#include "thirdparty/glad/glad/egl.h"
#else
#include <EGL/egl.h>
#include <EGL/eglext.h>
#endif // GLAD_ENABLED
#endif // EGL_ENABLED

#if defined(MINGW_ENABLED) || defined(_MSC_VER)
#define strcpy strcpy_s
#endif
Expand Down
4 changes: 3 additions & 1 deletion platform/linuxbsd/key_mapping_xkb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,10 @@ xkb_keycode_t KeyMappingXKB::get_xkb_keycode(Key p_keysym) {
Key KeyMappingXKB::get_keycode(xkb_keysym_t p_keysym) {
// Kinda bruteforce.. could optimize.

if (p_keysym < 0x100) // Latin 1, maps 1-1
// Latin 1, maps 1-1
if (p_keysym < 0x100) {
return (Key)p_keysym;
}

// Look for special key.
for (int idx = 0; _xkb_keysym_to_keycode[idx].keysym != 0; idx++) {
Expand Down
14 changes: 7 additions & 7 deletions platform/linuxbsd/wayland/display_server_wayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,37 +159,37 @@ String DisplayServerWayland::get_name() const {
#ifdef SPEECHD_ENABLED

bool DisplayServerWayland::tts_is_speaking() const {
ERR_FAIL_COND_V(!tts, false);
ERR_FAIL_NULL_V(tts, false);
return tts->is_speaking();
}

bool DisplayServerWayland::tts_is_paused() const {
ERR_FAIL_COND_V(!tts, false);
ERR_FAIL_NULL_V(tts, false);
return tts->is_paused();
}

TypedArray<Dictionary> DisplayServerWayland::tts_get_voices() const {
ERR_FAIL_COND_V(!tts, TypedArray<Dictionary>());
ERR_FAIL_NULL_V(tts, TypedArray<Dictionary>());
return tts->get_voices();
}

void DisplayServerWayland::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {
ERR_FAIL_COND(!tts);
ERR_FAIL_NULL(tts);
tts->speak(p_text, p_voice, p_volume, p_pitch, p_rate, p_utterance_id, p_interrupt);
}

void DisplayServerWayland::tts_pause() {
ERR_FAIL_COND(!tts);
ERR_FAIL_NULL(tts);
tts->pause();
}

void DisplayServerWayland::tts_resume() {
ERR_FAIL_COND(!tts);
ERR_FAIL_NULL(tts);
tts->resume();
}

void DisplayServerWayland::tts_stop() {
ERR_FAIL_COND(!tts);
ERR_FAIL_NULL(tts);
tts->stop();
}

Expand Down
31 changes: 17 additions & 14 deletions platform/linuxbsd/wayland/wayland_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,17 +1114,17 @@ void WaylandThread::_xdg_toplevel_on_wm_capabilities(void *data, struct xdg_topl
switch (*capability) {
case XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE: {
ws->can_maximize = true;
}; break;
} break;
case XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN: {
ws->can_fullscreen = true;
}; break;
} break;

case XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE: {
ws->can_minimize = true;
}; break;
} break;

default: {
}; break;
} break;
}
}
}
Expand Down Expand Up @@ -2713,7 +2713,10 @@ void WaylandThread::seat_state_set_hint(SeatState *p_ss, int p_x, int p_y) {
}

zwp_locked_pointer_v1_set_cursor_position_hint(p_ss->wp_locked_pointer, wl_fixed_from_int(p_x), wl_fixed_from_int(p_y));
wl_surface_commit(p_ss->pointed_surface);

if (p_ss->pointed_surface) {
wl_surface_commit(p_ss->pointed_surface);
}
}

void WaylandThread::seat_state_confine_pointer(SeatState *p_ss) {
Expand Down Expand Up @@ -3215,7 +3218,7 @@ void WaylandThread::window_set_idle_inhibition(DisplayServer::WindowID p_window_

if (p_enable) {
if (ws.registry->wp_idle_inhibit_manager && !ws.wp_idle_inhibitor) {
ERR_FAIL_COND(!ws.wl_surface);
ERR_FAIL_NULL(ws.wl_surface);
ws.wp_idle_inhibitor = zwp_idle_inhibit_manager_v1_create_inhibitor(ws.registry->wp_idle_inhibit_manager, ws.wl_surface);
}
} else {
Expand Down Expand Up @@ -3337,15 +3340,15 @@ Error WaylandThread::init() {
KeyMappingXKB::initialize();

wl_display = wl_display_connect(nullptr);
ERR_FAIL_COND_V_MSG(!wl_display, ERR_CANT_CREATE, "Can't connect to a Wayland display.");
ERR_FAIL_NULL_V_MSG(wl_display, ERR_CANT_CREATE, "Can't connect to a Wayland display.");

thread_data.wl_display = wl_display;

events_thread.start(_poll_events_thread, &thread_data);

wl_registry = wl_display_get_registry(wl_display);

ERR_FAIL_COND_V_MSG(!wl_registry, ERR_UNAVAILABLE, "Can't obtain the Wayland registry global.");
ERR_FAIL_NULL_V_MSG(wl_registry, ERR_UNAVAILABLE, "Can't obtain the Wayland registry global.");

registry.wayland_thread = this;

Expand All @@ -3354,12 +3357,12 @@ Error WaylandThread::init() {
// Wait for registry to get notified from the compositor.
wl_display_roundtrip(wl_display);

ERR_FAIL_COND_V_MSG(!registry.wl_shm, ERR_UNAVAILABLE, "Can't obtain the Wayland shared memory global.");
ERR_FAIL_COND_V_MSG(!registry.wl_compositor, ERR_UNAVAILABLE, "Can't obtain the Wayland compositor global.");
ERR_FAIL_COND_V_MSG(!registry.wl_subcompositor, ERR_UNAVAILABLE, "Can't obtain the Wayland subcompositor global.");
ERR_FAIL_COND_V_MSG(!registry.wl_data_device_manager, ERR_UNAVAILABLE, "Can't obtain the Wayland data device manager global.");
ERR_FAIL_COND_V_MSG(!registry.wp_pointer_constraints, ERR_UNAVAILABLE, "Can't obtain the Wayland pointer constraints global.");
ERR_FAIL_COND_V_MSG(!registry.xdg_wm_base, ERR_UNAVAILABLE, "Can't obtain the Wayland XDG shell global.");
ERR_FAIL_NULL_V_MSG(registry.wl_shm, ERR_UNAVAILABLE, "Can't obtain the Wayland shared memory global.");
ERR_FAIL_NULL_V_MSG(registry.wl_compositor, ERR_UNAVAILABLE, "Can't obtain the Wayland compositor global.");
ERR_FAIL_NULL_V_MSG(registry.wl_subcompositor, ERR_UNAVAILABLE, "Can't obtain the Wayland subcompositor global.");
ERR_FAIL_NULL_V_MSG(registry.wl_data_device_manager, ERR_UNAVAILABLE, "Can't obtain the Wayland data device manager global.");
ERR_FAIL_NULL_V_MSG(registry.wp_pointer_constraints, ERR_UNAVAILABLE, "Can't obtain the Wayland pointer constraints global.");
ERR_FAIL_NULL_V_MSG(registry.xdg_wm_base, ERR_UNAVAILABLE, "Can't obtain the Wayland XDG shell global.");

if (!registry.xdg_decoration_manager) {
#ifdef LIBDECOR_ENABLED
Expand Down

0 comments on commit 0de296c

Please sign in to comment.