Enable scaling to fit various screen resolutions
[apps/agl-service-windowmanager.git] / src / wayland.cpp
index 53668d2..7db6920 100644 (file)
@@ -148,6 +148,8 @@ void output::geometry(int32_t x, int32_t y, int32_t pw, int32_t ph,
    HMI_DEBUG("wm",
       "wl::output %s @ %p x %i y %i w %i h %i spel %x make %s model %s tx %i",
       __func__, this->proxy.get(), x, y, pw, ph, subpel, make, model, tx);
+   this->physical_width = pw;
+   this->physical_height = ph;
    this->transform = tx;
 }
 
@@ -169,6 +171,7 @@ void output::done() {
        this->transform == WL_OUTPUT_TRANSFORM_FLIPPED_90 ||
        this->transform == WL_OUTPUT_TRANSFORM_FLIPPED_270) {
       std::swap(this->width, this->height);
+      std::swap(this->physical_width, this->physical_height);
    }
 }
 
@@ -226,6 +229,9 @@ void controller::layer_create(uint32_t id, int32_t w, int32_t h) {
 
 void controller::surface_create(uint32_t id) {
    this->surfaces[id] = std::make_unique<struct surface>(id, this);
+
+   // configure surface to wxh dimensions
+   this->surfaces[id]->set_configuration(this->output_size.w, this->output_size.h);
 }
 
 void controller::controller_screen(uint32_t id,
@@ -251,6 +257,9 @@ void controller::controller_surface(uint32_t id) {
    if (this->surfaces.find(id) == this->surfaces.end()) {
       this->surfaces[id] = std::make_unique<struct surface>(id, this);
       this->chooks->surface_created(id);
+
+      // configure surface to wxh dimensions
+      this->surfaces[id]->set_configuration(this->output_size.w, this->output_size.h);
    }
 }
 
@@ -628,7 +637,6 @@ void controller::surface_configuration(struct surface *s, int32_t width,
    HMI_DEBUG("wm", "compositor::surface %s @ %d w %i h %i", __func__, s->id,
             width, height);
    this->sprops[s->id].size = size{uint32_t(width), uint32_t(height)};
-   is_configured = true;
 }
 
 void controller::surface_orientation(struct surface *s, int32_t orientation) {