This commit is contained in:
Twaik Yont 2023-02-01 17:17:53 +02:00
parent 13718d94cf
commit 09a0fca185
3 changed files with 21 additions and 2 deletions

View File

@ -117,17 +117,34 @@ renderer(*this) {
shell->on_get_shell_surface = [=] (shell_surface_t* shell, surface_t* sfc) {
shell->on_set_toplevel = [=] () {
wl_array keys{};
wl_array_init(&keys);
renderer.set_toplevel(sfc);
if (data->pointer)
data->pointer->enter(next_serial(),sfc, 0, 0);
if(data->kbd)
data->kbd->enter(next_serial(), sfc, nullptr);
data->kbd->enter(next_serial(), sfc, &keys);
shell->configure(shell_surface_resize::none, renderer.width, renderer.height);
};
};
};
global_xdg_wm_base.on_bind = [=, this](client_t* client, xdg_wm_base_t* wm_base) {
wm_base->on_get_xdg_surface = [=, this](xdg_surface_t* xdg_surface, surface_t* sfc) {
xdg_surface->on_get_toplevel = [=, this](xdg_toplevel_t*) {
auto data = any_cast<client_data*>(toplevel->client()->user_data());
wl_array keys{};
wl_array_init(&keys);
renderer.set_toplevel(sfc);
if (data->pointer)
data->pointer->enter(next_serial(),sfc, 0, 0);
if (data->kbd)
data->kbd->enter(next_serial(), sfc, &keys);
};
};
wm_base->on__destroy = [=]() { wm_base->destroy(); };
};
}
int proc(int fd, uint32_t mask, void *data) {

View File

@ -1,6 +1,7 @@
#pragma once
#include <lorie_wayland_server.hpp>
#include <wayland-server-protocol.hpp>
#include <xdg-shell-server-protocol.hpp>
#include <lorie_renderer.hpp>
#include <lorie_message_queue.hpp>
#include "log.h"
@ -56,6 +57,7 @@ public:
wayland::global_seat_t global_seat{dpy};
wayland::global_output_t global_output{dpy};
wayland::global_shell_t global_shell{dpy};
wayland::global_xdg_wm_base_t global_xdg_wm_base{dpy};
struct wl_display *display = nullptr;
lorie_message_queue queue;

View File

@ -254,7 +254,7 @@ void lorie_renderer::redraw() {
if (cursor_visible)
draw_cursor();
} else {
glClearColor(0.f, 0.f, 1.f, 0.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT);
}