mirror of
https://github.com/cage-kiosk/cage.git
synced 2025-10-29 05:40:19 -04:00
Move set_window_title to output
This commit is contained in:
parent
2669c80803
commit
9d825d6dc7
5 changed files with 18 additions and 25 deletions
22
cage.c
22
cage.c
|
|
@ -18,8 +18,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
#include <wlr/backend/wayland.h>
|
|
||||||
#include <wlr/backend/x11.h>
|
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include <wlr/types/wlr_data_device.h>
|
#include <wlr/types/wlr_data_device.h>
|
||||||
|
|
@ -45,26 +43,6 @@
|
||||||
#include "xwayland.h"
|
#include "xwayland.h"
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
free(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
spawn_primary_client(char *argv[], pid_t *pid_out)
|
spawn_primary_client(char *argv[], pid_t *pid_out)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
14
output.c
14
output.c
|
|
@ -14,6 +14,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
|
#include <wlr/backend/wayland.h>
|
||||||
|
#include <wlr/backend/x11.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
#include <wlr/types/wlr_data_device.h>
|
#include <wlr/types/wlr_data_device.h>
|
||||||
#include <wlr/types/wlr_matrix.h>
|
#include <wlr/types/wlr_matrix.h>
|
||||||
|
|
@ -414,3 +416,15 @@ output_damage_drag_icon(struct cg_output *cg_output, struct cg_drag_icon *drag_i
|
||||||
damage_surface,
|
damage_surface,
|
||||||
&data);
|
&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
output_set_window_title(struct cg_output *output, const char *title)
|
||||||
|
{
|
||||||
|
struct wlr_output *wlr_output = output->wlr_output;
|
||||||
|
|
||||||
|
if (wlr_output_is_wl(wlr_output)) {
|
||||||
|
wlr_wl_output_set_title(wlr_output, title);
|
||||||
|
} else if (wlr_output_is_x11(wlr_output)) {
|
||||||
|
wlr_x11_output_set_title(wlr_output, title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
1
output.h
1
output.h
|
|
@ -25,5 +25,6 @@ void handle_new_output(struct wl_listener *listener, void *data);
|
||||||
void output_damage_view_surface(struct cg_output *output, struct cg_view *view);
|
void output_damage_view_surface(struct cg_output *output, struct cg_view *view);
|
||||||
void output_damage_view_whole(struct cg_output *cg_output, struct cg_view *view);
|
void output_damage_view_whole(struct cg_output *cg_output, struct cg_view *view);
|
||||||
void output_damage_drag_icon(struct cg_output *output, struct cg_drag_icon *icon);
|
void output_damage_drag_icon(struct cg_output *output, struct cg_drag_icon *icon);
|
||||||
|
void output_set_window_title(struct cg_output *output, const char *title);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
4
seat.c
4
seat.c
|
|
@ -745,7 +745,9 @@ seat_set_focus(struct cg_seat *seat, struct cg_view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
view_activate(view, true);
|
view_activate(view, true);
|
||||||
set_window_title(server, view);
|
char *title = view_get_title(view);
|
||||||
|
output_set_window_title(server->output, title);
|
||||||
|
free(title);
|
||||||
|
|
||||||
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(wlr_seat);
|
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(wlr_seat);
|
||||||
if (keyboard) {
|
if (keyboard) {
|
||||||
|
|
|
||||||
2
server.h
2
server.h
|
|
@ -42,6 +42,4 @@ struct cg_server {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_window_title(struct cg_server *server, struct cg_view *view);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue