aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3-adas/recipes-graphics/wayland/weston-1.11.0/0003-add-window-set-fullscreen-at-output.patch
blob: d519a49dca7e9b7059ecbf4750b7de965b35e9df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
diff --git a/clients/toytoolkit.h b/clients/toytoolkit.h
index fdf9b57..402836d 100644
--- a/clients/toytoolkit.h
+++ b/clients/toytoolkit.h
@@ -84,6 +84,12 @@ display_get_compositor(struct display *display);
 struct output *
 display_get_output(struct display *display);
 
+unsigned int
+display_get_outputs_number(struct display *display);
+
+struct output *
+display_get_output_by_index(struct display *display, unsigned int index); 
+
 uint32_t
 display_get_serial(struct display *display);
 
@@ -372,6 +378,9 @@ window_is_fullscreen(struct window *window);
 void
 window_set_fullscreen(struct window *window, int fullscreen);
 
+void
+window_set_fullscreen_at_output(struct window *window, int fullscreen, struct output *output);
+
 int
 window_is_maximized(struct window *window);
 
diff --git a/clients/window.c b/clients/window.c
index 0e73f5b..2d38796 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -4364,6 +4364,21 @@ window_set_fullscreen(struct window *window, int fullscreen)
 		xdg_surface_unset_fullscreen(window->xdg_surface);
 }
 
+void
+window_set_fullscreen_at_output(struct window *window, int fullscreen, struct output *output)
+{
+	if (!window->xdg_surface)
+		return;
+
+	if (window->fullscreen == fullscreen)
+		return;
+
+	if (fullscreen)
+		xdg_surface_set_fullscreen(window->xdg_surface, output ? output_get_wl_output(output) : NULL);
+	else
+		xdg_surface_unset_fullscreen(window->xdg_surface);
+}
+
 int
 window_is_maximized(struct window *window)
 {
@@ -5743,6 +5758,29 @@ display_get_output(struct display *display)
 	return container_of(display->output_list.next, struct output, link);
 }
 
+unsigned int
+display_get_outputs_number(struct display *display)
+{
+    return wl_list_length(&display->output_list);
+}
+
+struct output *
+display_get_output_by_index(struct display *display, unsigned int index)
+{
+    int i;
+    int n = wl_list_length(&display->output_list);
+    struct wl_list *item;
+
+    if (index >= n)
+        return NULL;
+
+    item = display->output_list.next;
+    for (i = 0; i < index; i++)
+        item = item->next;
+
+	return container_of(item, struct output, link);
+}
+
 struct wl_compositor *
 display_get_compositor(struct display *display)
 {