[PATCH 2/2] Notify clients on mode_switch()
Hardening
rdp.effort at gmail.com
Fri Sep 13 15:40:13 PDT 2013
Le 13/09/2013 11:00, Pekka Paalanen a écrit :
> On Wed, 11 Sep 2013 00:28:50 +0200
> Hardening <rdp.effort at gmail.com> wrote:
>
>> 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.
>> ---
>> src/compositor-rdp.c | 28 +++++++------
>> src/compositor.c | 109
>> +++++++++++++++++++++++++++++++++++++++++++++++----
>> src/compositor.h | 13 +++++- src/shell.c | 12 +++---
>> 4 files changed, 135 insertions(+), 27 deletions(-)
[...]
>> @@ -152,6 +220,31 @@ weston_output_switch_mode(struct weston_output
>> *output, struct weston_mode *mode
>> pixman_region32_fini(&old_output_region);
>>
>> + /* notify clients of the changes */
>> + if (notify_mode_changed || notify_scale_changed) {
>> + wl_resource_for_each(resource,
>> &output->resource_list) {
>> + if(notify_mode_changed) {
>> + wl_output_send_mode(resource,
>> + old_mode.flags &
>> ~WL_OUTPUT_MODE_CURRENT,
>> + old_mode.width,
>> + old_mode.height,
>> + old_mode.refresh);
>
> Hi,
>
> is it really necessary to send the old mode again without the "current"
> flag? Are clients not supposed to handle it with just the new mode,
> since having more than one mode current does not make sense?
>
> The protocol is slightly awkward here to begin with, because for each
> mode event a client needs to iterate over all old modes, check if there
> is a matching one: if yes, update flags; if not, add mode.
>
Hi,
You're right the protocol documentation says:
"The event is sent again if an output changes mode, for the mode that is
now current. In other words, the current mode is always the last mode
that was received with the current flag set."
I will send back a patch to drop the notification for the old_mode (will
simplify the code too).
The done event can help when treating new current mode. With the RDP
compositor, we'll also be able to have some new modes that are
advertised after initial notification.
Regards, Hardening.
More information about the wayland-devel
mailing list