[metacity] surface: store position
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] surface: store position
- Date: Sun, 13 Oct 2019 20:44:44 +0000 (UTC)
commit 454aac8dd955d50d746282fd64af2aed6b962319
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Oct 13 23:39:39 2019 +0300
surface: store position
src/compositor/meta-surface.c | 34 ++++++++++++++++++++++++++++++----
src/compositor/meta-surface.h | 4 ++++
2 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/src/compositor/meta-surface.c b/src/compositor/meta-surface.c
index eab8afc3..3a6831ba 100644
--- a/src/compositor/meta-surface.c
+++ b/src/compositor/meta-surface.c
@@ -36,6 +36,8 @@ typedef struct
Damage damage;
Pixmap pixmap;
+ int x;
+ int y;
int width;
int height;
} MetaSurfacePrivate;
@@ -302,6 +304,26 @@ meta_surface_get_pixmap (MetaSurface *self)
return priv->pixmap;
}
+int
+meta_surface_get_x (MetaSurface *self)
+{
+ MetaSurfacePrivate *priv;
+
+ priv = meta_surface_get_instance_private (self);
+
+ return priv->x;
+}
+
+int
+meta_surface_get_y (MetaSurface *self)
+{
+ MetaSurfacePrivate *priv;
+
+ priv = meta_surface_get_instance_private (self);
+
+ return priv->y;
+}
+
int
meta_surface_get_width (MetaSurface *self)
{
@@ -386,6 +408,13 @@ meta_surface_sync_geometry (MetaSurface *self)
meta_window_get_input_rect (priv->window, &rect);
+ if (priv->x != rect.x ||
+ priv->y != rect.y)
+ {
+ priv->x = rect.x;
+ priv->y = rect.y;
+ }
+
if (priv->width != rect.width ||
priv->height != rect.height)
{
@@ -400,18 +429,15 @@ void
meta_surface_pre_paint (MetaSurface *self)
{
MetaSurfacePrivate *priv;
- MetaRectangle rect;
XserverRegion parts;
priv = meta_surface_get_instance_private (self);
- meta_window_get_input_rect (priv->window, &rect);
-
meta_error_trap_push (priv->display);
parts = XFixesCreateRegion (priv->xdisplay, 0, 0);
XDamageSubtract (priv->xdisplay, priv->damage, None, parts);
- XFixesTranslateRegion (priv->xdisplay, parts, rect.x, rect.y);
+ XFixesTranslateRegion (priv->xdisplay, parts, priv->x, priv->y);
meta_error_trap_pop (priv->display);
diff --git a/src/compositor/meta-surface.h b/src/compositor/meta-surface.h
index 8a2b1679..48bb6fec 100644
--- a/src/compositor/meta-surface.h
+++ b/src/compositor/meta-surface.h
@@ -33,6 +33,10 @@ MetaWindow *meta_surface_get_window (MetaSurface *self);
Pixmap meta_surface_get_pixmap (MetaSurface *self);
+int meta_surface_get_x (MetaSurface *self);
+
+int meta_surface_get_y (MetaSurface *self);
+
int meta_surface_get_width (MetaSurface *self);
int meta_surface_get_height (MetaSurface *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]