wayland: Make sure we're initializing output scale sensibly
authorBryce Harrington <bryce@osg.samsung.com>
Sat, 28 Feb 2015 00:45:24 +0000 (19:45 -0500)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Sat, 28 Feb 2015 00:45:25 +0000 (19:45 -0500)
Summary:
By default the E_NEW() will create our output objects with a 0.0 scale,
which doesn't make any sense and if anything will lead to crashes.
Instead use a scale factor of 1.0.

When updating output details, if the scale setting is invalid then set
it to 1.0 as a sensible value.

Note this doesn't actually enable scaling, just helps make sure we're
not injecting invalid scale parameters from the start.

Reviewers: zmike, devilhorns, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2078

src/bin/e_comp_wl.c

index 43b0e30..6e72a53 100644 (file)
@@ -2793,6 +2793,7 @@ e_comp_wl_output_init(const char *id, const char *make, const char *model, int x
         output->global = wl_global_create(cdata->wl.disp, &wl_output_interface,
                                           2, output, _e_comp_wl_cb_output_bind);
         output->resources = NULL;
+        output->scale = 1.0;
      }
 
    /* update the output details */
@@ -2806,6 +2807,9 @@ e_comp_wl_output_init(const char *id, const char *make, const char *model, int x
    output->subpixel = subpixel;
    output->transform = transform;
 
+   if (output->scale <= 0)
+     output->scale = 1.0;
+
    /* if we have bound resources, send updates */
    EINA_LIST_FOREACH(output->resources, l2, resource)
      {