[metacity] compositor-xrender: move Expose event handling to MetaCompositor
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] compositor-xrender: move Expose event handling to MetaCompositor
- Date: Mon, 21 Oct 2019 05:21:38 +0000 (UTC)
commit 3eb4d02b01cc70be31248cc3b013a5e6eb259a87
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Oct 20 20:42:14 2019 +0300
compositor-xrender: move Expose event handling to MetaCompositor
src/compositor/meta-compositor-xrender.c | 68 --------------------------------
src/compositor/meta-compositor.c | 34 +++++++++++++++-
2 files changed, 33 insertions(+), 69 deletions(-)
---
diff --git a/src/compositor/meta-compositor-xrender.c b/src/compositor/meta-compositor-xrender.c
index f76f86ab..841541ba 100644
--- a/src/compositor/meta-compositor-xrender.c
+++ b/src/compositor/meta-compositor-xrender.c
@@ -578,35 +578,6 @@ shadow_picture (MetaCompositorXRender *xrender,
return shadow_picture;
}
-static MetaCompWindow *
-find_comp_window_by_xwindow (MetaCompositorXRender *xrender,
- Window xwindow)
-{
- GHashTableIter iter;
- MetaCompWindow *cw;
-
- g_hash_table_iter_init (&iter, xrender->windows_by_xid);
- while (g_hash_table_iter_next (&iter, NULL, (gpointer) &cw))
- {
- MetaFrame *frame;
-
- frame = meta_window_get_frame (cw->window);
-
- if (frame)
- {
- if (meta_frame_get_xwindow (frame) == xwindow)
- return cw;
- }
- else
- {
- if (meta_window_get_xwindow (cw->window) == xwindow)
- return cw;
- }
- }
-
- return NULL;
-}
-
static Picture
solid_picture (Display *xdisplay,
gboolean argb,
@@ -1177,41 +1148,6 @@ process_property_notify (MetaCompositorXRender *xrender,
}
}
-static void
-expose_area (MetaCompositorXRender *xrender,
- XRectangle *rects,
- int nrects)
-{
- XserverRegion region;
-
- region = XFixesCreateRegion (xrender->xdisplay, rects, nrects);
-
- meta_compositor_add_damage (META_COMPOSITOR (xrender), "expose_area", region);
- XFixesDestroyRegion (xrender->xdisplay, region);
-}
-
-static void
-process_expose (MetaCompositorXRender *xrender,
- XExposeEvent *event)
-{
- MetaCompWindow *cw = find_comp_window_by_xwindow (xrender, event->window);
- XRectangle rect[1];
- int origin_x = 0, origin_y = 0;
-
- if (cw != NULL)
- {
- origin_x = cw->rect.x;
- origin_y = cw->rect.y;
- }
-
- rect[0].x = event->x + origin_x;
- rect[0].y = event->y + origin_y;
- rect[0].width = event->width;
- rect[0].height = event->height;
-
- expose_area (xrender, rect, 1);
-}
-
static int
timeout_debug (MetaCompositorXRender *compositor)
{
@@ -1488,10 +1424,6 @@ meta_compositor_xrender_process_event (MetaCompositor *compositor,
process_property_notify (xrender, (XPropertyEvent *) event);
break;
- case Expose:
- process_expose (xrender, (XExposeEvent *) event);
- break;
-
default:
break;
}
diff --git a/src/compositor/meta-compositor.c b/src/compositor/meta-compositor.c
index 9dc466fe..41324961 100644
--- a/src/compositor/meta-compositor.c
+++ b/src/compositor/meta-compositor.c
@@ -542,13 +542,45 @@ meta_compositor_process_event (MetaCompositor *compositor,
{
MetaCompositorPrivate *priv;
MetaCompositorClass *compositor_class;
+ int damage_event_base;
priv = meta_compositor_get_instance_private (compositor);
compositor_class = META_COMPOSITOR_GET_CLASS (compositor);
compositor_class->process_event (compositor, event, window);
- if (event->type == meta_display_get_damage_event_base (priv->display) + XDamageNotify)
+ damage_event_base = meta_display_get_damage_event_base (priv->display);
+
+ if (event->type == Expose)
+ {
+ XExposeEvent *expose_event;
+ MetaSurface *surface;
+ XRectangle rect;
+ XserverRegion region;
+
+ expose_event = (XExposeEvent *) event;
+
+ if (window != NULL)
+ surface = g_hash_table_lookup (priv->surfaces, window);
+ else
+ surface = find_surface_by_xwindow (compositor, expose_event->window);
+
+ rect.x = expose_event->x;
+ rect.y = expose_event->y;
+ rect.width = expose_event->width;
+ rect.height = expose_event->height;
+
+ if (surface != NULL)
+ {
+ rect.x += meta_surface_get_x (surface);
+ rect.y += meta_surface_get_y (surface);
+ }
+
+ region = XFixesCreateRegion (priv->display->xdisplay, &rect, 1);
+ meta_compositor_add_damage (compositor, "XExposeEvent", region);
+ XFixesDestroyRegion (priv->display->xdisplay, region);
+ }
+ else if (event->type == damage_event_base + XDamageNotify)
{
XDamageNotifyEvent *damage_event;
MetaSurface *surface;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]