Notify clients on mode_switch()
This patch implements the notification of clients during mode_switch.
As discussed on IRC, clients are notified of mode_switch only when the
"native" mode is changed and activated. That means that if the native
mode is changed and the compositor had activated a temporary mode for
a fullscreen surface, the clients will be notified only when the native
mode is restored.
The scaling factor is treated the same way as modes.
diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index 642a6b7..69f1d04 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -372,9 +372,10 @@
if(local_mode == output->current_mode)
return 0;
- output->current_mode->flags = 0;
+ output->current_mode->flags &= ~WL_OUTPUT_MODE_CURRENT;
+
output->current_mode = local_mode;
- output->current_mode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
+ output->current_mode->flags |= WL_OUTPUT_MODE_CURRENT;
pixman_renderer_output_destroy(output);
pixman_renderer_output_create(output);
@@ -466,7 +467,7 @@
goto out_free_output_and_modes;
}
- output->base.current_mode = currentMode;
+ output->base.current_mode = output->base.native_mode = currentMode;
weston_output_init(&output->base, &c->base, 0, 0, width, height,
WL_OUTPUT_TRANSFORM_NORMAL, 1);
@@ -489,7 +490,6 @@
loop = wl_display_get_event_loop(c->base.wl_display);
output->finish_frame_timer = wl_event_loop_add_timer(loop, finish_frame_handler, output);
- output->base.original_mode = output->base.current_mode;
output->base.start_repaint_loop = rdp_output_start_repaint_loop;
output->base.repaint = rdp_output_repaint;
output->base.destroy = rdp_output_destroy;
@@ -679,23 +679,26 @@
output = c->output;
settings = client->settings;
- if(!settings->SurfaceCommandsEnabled) {
+ if (!settings->SurfaceCommandsEnabled) {
weston_log("client doesn't support required SurfaceCommands\n");
return FALSE;
}
- if(output->base.width != (int)settings->DesktopWidth ||
+ if (output->base.width != (int)settings->DesktopWidth ||
output->base.height != (int)settings->DesktopHeight)
{
- if(!settings->DesktopResize) {
- weston_log("client don't support desktopResize()\n");
+ struct weston_mode new_mode;
+ struct weston_mode *target_mode;
+ new_mode.width = (int)settings->DesktopWidth;
+ new_mode.height = (int)settings->DesktopHeight;
+ target_mode = find_matching_mode(&output->base, &new_mode);
+ if (!target_mode) {
+ weston_log("client mode not found\n");
return FALSE;
}
-
- /* force the client size */
- settings->DesktopWidth = output->base.width;
- settings->DesktopHeight = output->base.height;
- client->update->DesktopResize(client->context);
+ weston_output_switch_mode(&output->base, target_mode, 1, WESTON_MODE_SWITCH_SET_NATIVE);
+ output->base.width = new_mode.width;
+ output->base.height = new_mode.height;
}
weston_log("kbd_layout:%x kbd_type:%x kbd_subType:%x kbd_functionKeys:%x\n",