[PATCH 1/2] toytoolkit: allow clients to specify preferred output for fullscreen

U. Artie Eoff ullysses.a.eoff at intel.com
Fri Nov 22 09:13:15 PST 2013


From: "U. Artie Eoff" <ullysses.a.eoff at intel.com>

Add window_set_fullscreen_with_preferred_output method to allow
toytoolkit clients to specify a preferred output, by output id,
when going into fullscreen mode.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
 clients/window.c | 29 ++++++++++++++++++++++++-----
 clients/window.h |  9 +++++++--
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index d9f061d..7b9129f 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1518,7 +1518,7 @@ window_destroy(struct window *window)
 
 	wl_list_remove(&window->redraw_task.link);
 
-	wl_list_for_each(input, &display->input_list, link) {	  
+	wl_list_for_each(input, &display->input_list, link) {
 		if (input->touch_focus == window)
 			input->touch_focus = NULL;
 		if (input->pointer_focus == window)
@@ -2976,7 +2976,7 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
 			wl_list_insert(&input->touch_point_list, &tp->link);
 
 			if (widget->touch_down_handler)
-				(*widget->touch_down_handler)(widget, input, 
+				(*widget->touch_down_handler)(widget, input,
 							      serial, time, id,
 							      sx, sy,
 							      widget->user_data);
@@ -3055,7 +3055,7 @@ touch_handle_frame(void *data, struct wl_touch *wl_touch)
 
 	wl_list_for_each_safe(tp, tmp, &input->touch_point_list, link) {
 		if (tp->widget->touch_frame_handler)
-			(*tp->widget->touch_frame_handler)(tp->widget, input, 
+			(*tp->widget->touch_frame_handler)(tp->widget, input,
 							   tp->widget->user_data);
 
 		wl_list_remove(&tp->link);
@@ -3966,9 +3966,15 @@ window_defer_redraw_until_configure(struct window* window)
 	window->configure_requests++;
 }
 
+
 void
-window_set_fullscreen(struct window *window, int fullscreen)
+window_set_fullscreen_with_preferred_output(struct window *window,
+					    int fullscreen,
+					    uint32_t preferred_output_id)
 {
+	struct output *output;
+	struct wl_output *wl_output = NULL;
+
 	if (!window->display->shell)
 		return;
 
@@ -3976,6 +3982,13 @@ window_set_fullscreen(struct window *window, int fullscreen)
 		return;
 
 	if (fullscreen) {
+		wl_list_for_each(output, &window->display->output_list, link) {
+			if (preferred_output_id == output->server_output_id) {
+				wl_output = output->output;
+				break;
+			}
+		}
+
 		window->saved_type = window->type;
 		if (window->type == TYPE_TOPLEVEL) {
 			window->saved_allocation = window->main_surface->allocation;
@@ -3983,7 +3996,7 @@ window_set_fullscreen(struct window *window, int fullscreen)
 		window->type = TYPE_FULLSCREEN;
 		wl_shell_surface_set_fullscreen(window->shell_surface,
 						window->fullscreen_method,
-						0, NULL);
+						0, wl_output);
 		window_defer_redraw_until_configure (window);
 	} else {
 		if (window->saved_type == TYPE_MAXIMIZED) {
@@ -4000,6 +4013,12 @@ window_set_fullscreen(struct window *window, int fullscreen)
 }
 
 void
+window_set_fullscreen(struct window *window, int fullscreen)
+{
+	window_set_fullscreen_with_preferred_output(window, fullscreen, 0);
+}
+
+void
 window_set_fullscreen_method(struct window *window,
 			     enum wl_shell_surface_fullscreen_method method)
 {
diff --git a/clients/window.h b/clients/window.h
index 66cf985..93605d3 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -255,9 +255,9 @@ typedef void (*widget_touch_motion_handler_t)(struct widget *widget,
 					      float x,
 					      float y,
 					      void *data);
-typedef void (*widget_touch_frame_handler_t)(struct widget *widget, 
+typedef void (*widget_touch_frame_handler_t)(struct widget *widget,
 					     struct input *input, void *data);
-typedef void (*widget_touch_cancel_handler_t)(struct widget *widget, 
+typedef void (*widget_touch_cancel_handler_t)(struct widget *widget,
 					      struct input *input, void *data);
 typedef void (*widget_axis_handler_t)(struct widget *widget,
 				      struct input *input, uint32_t time,
@@ -361,6 +361,11 @@ int
 window_is_fullscreen(struct window *window);
 
 void
+window_set_fullscreen_with_preferred_output(struct window *window,
+					    int fullscreen,
+					    uint32_t preferred_output_id);
+
+void
 window_set_fullscreen(struct window *window, int fullscreen);
 
 void
-- 
1.8.3.1



More information about the wayland-devel mailing list