diff mbox

[i-g-t,1/6] overlay: Remove the miscalculation of window position

Message ID 20180514080251.11224-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson May 14, 2018, 8:02 a.m. UTC
We already call x11_position() to calculate the position of the
overlay, so do not need to manually recompute them inside
x11_overlay_create(). This has the advantage that x11_position()
understands the multi-monitor layout instructions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 overlay/x11/x11-overlay.c | 16 ----------------
 1 file changed, 16 deletions(-)

Comments

Tvrtko Ursulin May 14, 2018, 10:18 a.m. UTC | #1
On 14/05/2018 09:02, Chris Wilson wrote:
> We already call x11_position() to calculate the position of the
> overlay, so do not need to manually recompute them inside
> x11_overlay_create(). This has the advantage that x11_position()
> understands the multi-monitor layout instructions.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   overlay/x11/x11-overlay.c | 16 ----------------
>   1 file changed, 16 deletions(-)
> 
> diff --git a/overlay/x11/x11-overlay.c b/overlay/x11/x11-overlay.c
> index d08ebfc9c..ae6494295 100644
> --- a/overlay/x11/x11-overlay.c
> +++ b/overlay/x11/x11-overlay.c
> @@ -271,22 +271,6 @@ x11_overlay_create(struct config *config, int *width, int *height)
>   
>   	priv->x = x;
>   	priv->y = y;
> -	if (position != POS_UNSET) {
> -		switch (position & 7) {
> -		default:
> -		case 0: priv->x = 0; break;
> -		case 1: priv->x = (scr->width - image->width)/2; break;
> -		case 2: priv->x = scr->width - image->width; break;
> -		}
> -
> -		switch ((position >> 4) & 7) {
> -		default:
> -		case 0: priv->y = 0; break;
> -		case 1: priv->y = (scr->height - image->height)/2; break;
> -		case 2: priv->y = scr->height - image->height; break;
> -		}
> -	}
> -
>   
>   	priv->image = image;
>   	priv->image->data = (void *)&priv->name;
> 

Looks OK even without full understanding of the X11 programming.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
diff mbox

Patch

diff --git a/overlay/x11/x11-overlay.c b/overlay/x11/x11-overlay.c
index d08ebfc9c..ae6494295 100644
--- a/overlay/x11/x11-overlay.c
+++ b/overlay/x11/x11-overlay.c
@@ -271,22 +271,6 @@  x11_overlay_create(struct config *config, int *width, int *height)
 
 	priv->x = x;
 	priv->y = y;
-	if (position != POS_UNSET) {
-		switch (position & 7) {
-		default:
-		case 0: priv->x = 0; break;
-		case 1: priv->x = (scr->width - image->width)/2; break;
-		case 2: priv->x = scr->width - image->width; break;
-		}
-
-		switch ((position >> 4) & 7) {
-		default:
-		case 0: priv->y = 0; break;
-		case 1: priv->y = (scr->height - image->height)/2; break;
-		case 2: priv->y = scr->height - image->height; break;
-		}
-	}
-
 
 	priv->image = image;
 	priv->image->data = (void *)&priv->name;