clients/fullscreen: Remove zwp_fullscreen client support

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2024-02-21 20:21:13 +02:00 committed by Marius Vlad
parent 6975cf4265
commit 50a6411bb6
2 changed files with 13 additions and 149 deletions

View File

@ -36,7 +36,6 @@
#include <linux/input.h>
#include <wayland-client.h>
#include "window.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include <libweston/zalloc.h>
struct fs_output {
@ -48,8 +47,6 @@ struct fullscreen {
struct display *display;
struct window *window;
struct widget *widget;
struct zwp_fullscreen_shell_v1 *fshell;
enum zwp_fullscreen_shell_v1_present_method present_method;
int width, height;
int fullscreen;
float pointer_x, pointer_y;
@ -122,7 +119,6 @@ redraw_handler(struct widget *widget, void *data)
cairo_t *cr;
int i;
double x, y, border;
const char *method_name[] = { "default", "center", "zoom", "zoom_crop", "stretch"};
surface = window_get_surface(fullscreen->window);
if (surface == NULL ||
@ -148,33 +144,17 @@ redraw_handler(struct widget *widget, void *data)
allocation.y + 25);
cairo_set_source_rgb(cr, 1, 1, 1);
if (fullscreen->fshell) {
draw_string(cr,
"Surface size: %d, %d\n"
"Scale: %d, transform: %d\n"
"Pointer: %f,%f\n"
"Output: %s, present method: %s\n"
"Keys: (s)cale, (t)ransform, si(z)e, (m)ethod,\n"
" (o)utput, modes(w)itch, (q)uit\n",
fullscreen->width, fullscreen->height,
window_get_buffer_scale (fullscreen->window),
window_get_buffer_transform (fullscreen->window),
fullscreen->pointer_x, fullscreen->pointer_y,
method_name[fullscreen->present_method],
fullscreen->current_output ? output_get_model(fullscreen->current_output->output): "null");
} else {
draw_string(cr,
"Surface size: %d, %d\n"
"Scale: %d, transform: %d\n"
"Pointer: %f,%f\n"
"Fullscreen: %d\n"
"Keys: (s)cale, (t)ransform, si(z)e, (f)ullscreen, (q)uit\n",
fullscreen->width, fullscreen->height,
window_get_buffer_scale (fullscreen->window),
window_get_buffer_transform (fullscreen->window),
fullscreen->pointer_x, fullscreen->pointer_y,
fullscreen->fullscreen);
}
draw_string(cr,
"Surface size: %d, %d\n"
"Scale: %d, transform: %d\n"
"Pointer: %f,%f\n"
"Fullscreen: %d\n"
"Keys: (s)cale, (t)ransform, si(z)e, (f)ullscreen, (q)uit\n",
fullscreen->width, fullscreen->height,
window_get_buffer_scale (fullscreen->window),
window_get_buffer_transform (fullscreen->window),
fullscreen->pointer_x, fullscreen->pointer_y,
fullscreen->fullscreen);
y = 100;
i = 0;
@ -253,8 +233,6 @@ key_handler(struct window *window, struct input *input, uint32_t time,
struct fullscreen *fullscreen = data;
int transform, scale;
static int current_size = 0;
struct fs_output *fsout;
struct wl_output *wl_output;
int widths[] = { 640, 320, 800, 400 };
int heights[] = { 480, 240, 600, 300 };
@ -290,69 +268,7 @@ key_handler(struct window *window, struct input *input, uint32_t time,
fullscreen->width, fullscreen->height);
break;
case XKB_KEY_m:
if (!fullscreen->fshell)
break;
wl_output = NULL;
if (fullscreen->current_output)
wl_output = output_get_wl_output(fullscreen->current_output->output);
fullscreen->present_method = (fullscreen->present_method + 1) % 5;
zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
fullscreen->present_method,
wl_output);
window_schedule_redraw(window);
break;
case XKB_KEY_o:
if (!fullscreen->fshell)
break;
fsout = fullscreen->current_output;
wl_output = fsout ? output_get_wl_output(fsout->output) : NULL;
/* Clear the current presentation */
zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell, NULL,
0, wl_output);
if (fullscreen->current_output) {
if (fullscreen->current_output->link.next == &fullscreen->output_list)
fsout = NULL;
else
fsout = wl_container_of(fullscreen->current_output->link.next,
fsout, link);
} else {
fsout = wl_container_of(fullscreen->output_list.next,
fsout, link);
}
fullscreen->current_output = fsout;
wl_output = fsout ? output_get_wl_output(fsout->output) : NULL;
zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
fullscreen->present_method,
wl_output);
window_schedule_redraw(window);
break;
case XKB_KEY_w:
if (!fullscreen->fshell || !fullscreen->current_output)
break;
wl_output = NULL;
if (fullscreen->current_output)
wl_output = output_get_wl_output(fullscreen->current_output->output);
zwp_fullscreen_shell_mode_feedback_v1_destroy(
zwp_fullscreen_shell_v1_present_surface_for_mode(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
wl_output, 0));
window_schedule_redraw(window);
break;
case XKB_KEY_f:
if (fullscreen->fshell)
break;
fullscreen->fullscreen ^= 1;
window_set_fullscreen(window, fullscreen->fullscreen);
break;
@ -424,25 +340,6 @@ touch_handler(struct widget *widget, struct input *input,
window_move(fullscreen->window, input, display_get_serial(fullscreen->display));
}
static void
fshell_capability_handler(void *data, struct zwp_fullscreen_shell_v1 *fshell,
uint32_t capability)
{
struct fullscreen *fullscreen = data;
switch (capability) {
case ZWP_FULLSCREEN_SHELL_V1_CAPABILITY_CURSOR_PLANE:
fullscreen->draw_cursor = 0;
break;
default:
break;
}
}
struct zwp_fullscreen_shell_v1_listener fullscreen_shell_listener = {
fshell_capability_handler
};
static void
usage(int error_code)
{
@ -474,22 +371,6 @@ output_handler(struct output *output, void *data)
wl_list_insert(&fullscreen->output_list, &fsout->link);
}
static void
global_handler(struct display *display, uint32_t id, const char *interface,
uint32_t version, void *data)
{
struct fullscreen *fullscreen = data;
if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
fullscreen->fshell = display_bind(display, id,
&zwp_fullscreen_shell_v1_interface,
1);
zwp_fullscreen_shell_v1_add_listener(fullscreen->fshell,
&fullscreen_shell_listener,
fullscreen);
}
}
int main(int argc, char *argv[])
{
struct fullscreen fullscreen;
@ -499,7 +380,6 @@ int main(int argc, char *argv[])
fullscreen.width = 640;
fullscreen.height = 480;
fullscreen.fullscreen = 0;
fullscreen.present_method = ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT;
wl_list_init(&fullscreen.output_list);
fullscreen.current_output = NULL;
@ -528,23 +408,11 @@ int main(int argc, char *argv[])
}
fullscreen.display = d;
fullscreen.fshell = NULL;
display_set_user_data(fullscreen.display, &fullscreen);
display_set_global_handler(fullscreen.display, global_handler);
display_set_output_configure_handler(fullscreen.display, output_handler);
if (fullscreen.fshell) {
fullscreen.window = window_create_custom(d);
zwp_fullscreen_shell_v1_present_surface(fullscreen.fshell,
window_get_wl_surface(fullscreen.window),
fullscreen.present_method,
NULL);
/* If we get the CURSOR_PLANE capability, we'll change this */
fullscreen.draw_cursor = 1;
} else {
fullscreen.window = window_create(d);
fullscreen.draw_cursor = 0;
}
fullscreen.window = window_create(d);
fullscreen.draw_cursor = 0;
fullscreen.widget =
window_add_widget(fullscreen.window, &fullscreen);

View File

@ -303,10 +303,6 @@ demo_clients = [
{ 'basename': 'flower' },
{
'basename': 'fullscreen',
'add_sources': [
fullscreen_shell_unstable_v1_client_protocol_h,
fullscreen_shell_unstable_v1_protocol_c,
]
},
{ 'basename': 'image' },
{