<p dir="ltr">Kristian,<br>
Use this one instead of the "fixed" one I included in my patchset.  It's better.<br>
--Jason Ekstrand<br>
</p>
<div class="gmail_quote">On Apr 3, 2014 1:50 AM, "Hardening" <<a href="mailto:rdp.effort@gmail.com">rdp.effort@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This patch adds an option to the RDP compositor to disable<br>
desktop resizes initiated by RDP peer. The current behaviour<br>
is that if an incoming RDP peer suggests a resolution that is<br>
not the current one, a mode_switch() is done and the desktop is<br>
resized to that new resolution. This new flag allows to disable<br>
that behaviour, and in that case the RDP peer will be instructed<br>
to resize to the size of the desktop.<br>
---<br>
 src/compositor-rdp.c | 44 ++++++++++++++++++++++++++++++++------------<br>
 src/compositor.c     |  1 +<br>
 2 files changed, 33 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c<br>
index 909e225..4c5ae36 100644<br>
--- a/src/compositor-rdp.c<br>
+++ b/src/compositor-rdp.c<br>
@@ -60,6 +60,7 @@ struct rdp_compositor_config {<br>
        char *server_cert;<br>
        char *server_key;<br>
        int env_socket;<br>
+       int no_clients_resize;<br>
 };<br>
<br>
 struct rdp_output;<br>
@@ -75,6 +76,7 @@ struct rdp_compositor {<br>
        char *server_key;<br>
        char *rdp_key;<br>
        int tls_enabled;<br>
+       int no_clients_resize;<br>
 };<br>
<br>
 enum peer_item_flags {<br>
@@ -122,6 +124,7 @@ rdp_compositor_config_init(struct rdp_compositor_config *config) {<br>
        config->server_cert = NULL;<br>
        config->server_key = NULL;<br>
        config->env_socket = 0;<br>
+       config->no_clients_resize = 0;<br>
 }<br>
<br>
 static void<br>
@@ -412,7 +415,8 @@ rdp_switch_mode(struct weston_output *output, struct weston_mode *target_mode) {<br>
<br>
        wl_list_for_each(rdpPeer, &rdpOutput->peers, link) {<br>
                settings = rdpPeer->peer->settings;<br>
-               if (settings->DesktopWidth == target_mode->width && settings->DesktopHeight == target_mode->height)<br>
+               if (settings->DesktopWidth == (UINT32)target_mode->width &&<br>
+                               settings->DesktopHeight == (UINT32)target_mode->height)<br>
                        continue;<br>
<br>
                if (!settings->DesktopResize) {<br>
@@ -672,18 +676,32 @@ xf_peer_post_connect(freerdp_peer* client)<br>
        if (output->base.width != (int)settings->DesktopWidth ||<br>
                        output->base.height != (int)settings->DesktopHeight)<br>
        {<br>
-               struct weston_mode new_mode;<br>
-               struct weston_mode *target_mode;<br>
-               new_mode.width = (int)settings->DesktopWidth;<br>
-               new_mode.height = (int)settings->DesktopHeight;<br>
-               target_mode = ensure_matching_mode(&output->base, &new_mode);<br>
-               if (!target_mode) {<br>
-                       weston_log("client mode not found\n");<br>
-                       return FALSE;<br>
+               if (c->no_clients_resize) {<br>
+                       /* RDP peers don't dictate their resolution to weston */<br>
+                       if (!settings->DesktopResize) {<br>
+                               /* peer does not support desktop resize */<br>
+                               weston_log("%s: client doesn't support resizing, closing connection\n", __FUNCTION__);<br>
+                               return FALSE;<br>
+                       } else {<br>
+                               settings->DesktopWidth = output->base.width;<br>
+                               settings->DesktopHeight = output->base.height;<br>
+                               client->update->DesktopResize(client->context);<br>
+                       }<br>
+               } else {<br>
+                       /* ask weston to adjust size */<br>
+                       struct weston_mode new_mode;<br>
+                       struct weston_mode *target_mode;<br>
+                       new_mode.width = (int)settings->DesktopWidth;<br>
+                       new_mode.height = (int)settings->DesktopHeight;<br>
+                       target_mode = ensure_matching_mode(&output->base, &new_mode);<br>
+                       if (!target_mode) {<br>
+                               weston_log("client mode not found\n");<br>
+                               return FALSE;<br>
+                       }<br>
+                       weston_output_switch_mode(&output->base, target_mode, 1, WESTON_MODE_SWITCH_SET_NATIVE);<br>
+                       output->base.width = new_mode.width;<br>
+                       output->base.height = new_mode.height;<br>
                }<br>
-               weston_output_switch_mode(&output->base, target_mode, 1, WESTON_MODE_SWITCH_SET_NATIVE);<br>
-               output->base.width = new_mode.width;<br>
-               output->base.height = new_mode.height;<br>
        }<br>
<br>
        weston_log("kbd_layout:%x kbd_type:%x kbd_subType:%x kbd_functionKeys:%x\n",<br>
@@ -988,6 +1006,7 @@ rdp_compositor_create(struct wl_display *display,<br>
        c->base.destroy = rdp_destroy;<br>
        c->base.restore = rdp_restore;<br>
        c->rdp_key = config->rdp_key ? strdup(config->rdp_key) : NULL;<br>
+       c->no_clients_resize = config->no_clients_resize;<br>
<br>
        /* activate TLS only if certificate/key are available */<br>
        if (config->server_cert && config->server_key) {<br>
@@ -1067,6 +1086,7 @@ backend_init(struct wl_display *display, int *argc, char *argv[],<br>
                { WESTON_OPTION_INTEGER, "height", 0, &config.height },<br>
                { WESTON_OPTION_STRING,  "address", 0, &config.bind_address },<br>
                { WESTON_OPTION_INTEGER, "port", 0, &config.port },<br>
+               { WESTON_OPTION_BOOLEAN, "no-clients-resize", 0, &config.no_clients_resize },<br>
                { WESTON_OPTION_STRING,  "rdp4-key", 0, &config.rdp_key },<br>
                { WESTON_OPTION_STRING,  "rdp-tls-cert", 0, &config.server_cert },<br>
                { WESTON_OPTION_STRING,  "rdp-tls-key", 0, &config.server_key }<br>
diff --git a/src/compositor.c b/src/compositor.c<br>
index 016f514..2ef07b2 100644<br>
--- a/src/compositor.c<br>
+++ b/src/compositor.c<br>
@@ -4059,6 +4059,7 @@ usage(int error_code)<br>
        "  --env-socket=SOCKET\tUse that socket as peer connection\n"<br>
        "  --address=ADDR\tThe address to bind\n"<br>
        "  --port=PORT\tThe port to listen on\n"<br>
+       "  --no-clients-resize\tThe RDP peers will be forced to the size of the desktop\n"<br>
        "  --rdp4-key=FILE\tThe file containing the key for RDP4 encryption\n"<br>
        "  --rdp-tls-cert=FILE\tThe file containing the certificate for TLS encryption\n"<br>
        "  --rdp-tls-key=FILE\tThe file containing the private key for TLS encryption\n"<br>
--<br>
1.8.1.2<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</blockquote></div>