mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-03-11 05:34:37 -04:00
Set Cage's window title to toplevel's title
When using the Wayland or X11 backend, Cage is drawn inside a window. This commit sets this window's title to that of the currently focused toplevel window inside Cage. Fixes #29.
This commit is contained in:
parent
443d955dfd
commit
c00ac5c462
7 changed files with 53 additions and 1 deletions
22
cage.c
22
cage.c
|
|
@ -17,6 +17,8 @@
|
|||
#include <unistd.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/wayland.h>
|
||||
#include <wlr/backend/x11.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
|
|
@ -36,11 +38,31 @@
|
|||
#include "output.h"
|
||||
#include "seat.h"
|
||||
#include "server.h"
|
||||
#include "view.h"
|
||||
#include "xdg_shell.h"
|
||||
#if CAGE_HAS_XWAYLAND
|
||||
#include "xwayland.h"
|
||||
#endif
|
||||
|
||||
void
|
||||
set_window_title(struct cg_server *server, struct cg_view *view)
|
||||
{
|
||||
struct wlr_output *output = server->output->wlr_output;
|
||||
bool is_wl = wlr_output_is_wl(output);
|
||||
bool is_x11 = wlr_output_is_x11(output);
|
||||
|
||||
if (!is_wl && !is_x11) {
|
||||
return;
|
||||
}
|
||||
|
||||
const char *title = view_get_title(view);
|
||||
if (is_wl) {
|
||||
wlr_wl_output_set_title(output, title);
|
||||
} else if (is_x11) {
|
||||
wlr_x11_output_set_title(output, title);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
spawn_primary_client(char *argv[], pid_t *pid_out)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue