2003-11-15 23:35:16 -05:00
|
|
|
/* Metacity compositing manager */
|
|
|
|
|
|
|
|
/*
|
2004-08-26 22:17:49 -04:00
|
|
|
* Copyright (C) 2003, 2004 Red Hat, Inc.
|
2003-11-23 13:16:01 -05:00
|
|
|
* Copyright (C) 2003 Keith Packard
|
2003-11-15 23:35:16 -05:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include "compositor.h"
|
2003-11-23 13:16:01 -05:00
|
|
|
#include "screen.h"
|
|
|
|
#include "errors.h"
|
2003-11-29 22:30:27 -05:00
|
|
|
#include "window.h"
|
|
|
|
#include "frame.h"
|
2003-11-15 23:35:16 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
#include <X11/extensions/Xcomposite.h>
|
|
|
|
#include <X11/extensions/Xdamage.h>
|
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
|
2004-08-26 23:27:43 -04:00
|
|
|
#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2
|
|
|
|
#define HAVE_NAME_WINDOW_PIXMAP 1
|
|
|
|
#endif
|
|
|
|
|
2003-11-15 23:35:16 -05:00
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
#define SHADOW_OFFSET 3
|
|
|
|
#define FRAME_INTERVAL_MILLISECONDS ((int)(1000.0/40.0))
|
|
|
|
|
2003-11-15 23:35:16 -05:00
|
|
|
/* Unlike MetaWindow, there's one of these for _all_ toplevel windows,
|
|
|
|
* override redirect or not. We also track unmapped windows as
|
|
|
|
* otherwise on window map we'd have to determine where the
|
|
|
|
* newly-mapped window was in the stack. A MetaCompositorWindow may
|
|
|
|
* correspond to a metacity window frame rather than an application
|
|
|
|
* window.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Window xwindow;
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
MetaCompositor *compositor;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int border_width;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
Damage damage;
|
|
|
|
XserverRegion last_painted_extents;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
Picture picture;
|
|
|
|
XserverRegion border_size;
|
2004-08-26 23:27:43 -04:00
|
|
|
|
|
|
|
#if HAVE_NAME_WINDOW_PIXMAP
|
|
|
|
Pixmap pixmap;
|
|
|
|
#endif
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
unsigned int managed : 1;
|
|
|
|
unsigned int damaged : 1;
|
2003-12-25 19:05:26 -05:00
|
|
|
unsigned int viewable : 1;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
unsigned int screen_index : 8;
|
2004-08-26 23:27:43 -04:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
#endif
|
|
|
|
} MetaCompositorWindow;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
|
|
|
struct MetaCompositor
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
|
|
|
|
int composite_error_base;
|
|
|
|
int composite_event_base;
|
|
|
|
int damage_error_base;
|
|
|
|
int damage_event_base;
|
|
|
|
int fixes_error_base;
|
|
|
|
int fixes_event_base;
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
GHashTable *window_hash;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
guint repair_idle;
|
2003-11-29 22:30:27 -05:00
|
|
|
guint repair_timeout;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
|
|
|
guint enabled : 1;
|
2003-11-24 18:00:52 -05:00
|
|
|
guint have_composite : 1;
|
|
|
|
guint have_damage : 1;
|
|
|
|
guint have_fixes : 1;
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
#ifdef HAVE_NAME_WINDOW_PIXMAP
|
2004-08-26 23:27:43 -04:00
|
|
|
guint have_name_window_pixmap : 1;
|
|
|
|
#endif
|
2003-11-15 23:35:16 -05:00
|
|
|
};
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
meta_compositor_window_free (MetaCompositorWindow *cwindow)
|
|
|
|
{
|
2003-11-29 22:30:27 -05:00
|
|
|
g_assert (cwindow->damage != None);
|
2004-08-26 23:27:43 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (cwindow->compositor->display);
|
2003-11-29 22:30:27 -05:00
|
|
|
/* This seems to cause an error if the window
|
|
|
|
* is destroyed?
|
|
|
|
*/
|
2003-11-23 13:16:01 -05:00
|
|
|
XDamageDestroy (cwindow->compositor->display->xdisplay,
|
|
|
|
cwindow->damage);
|
2004-08-26 23:27:43 -04:00
|
|
|
|
|
|
|
#if HAVE_NAME_WINDOW_PIXMAP
|
|
|
|
/* Free our window pixmap name */
|
|
|
|
if (cwindow->pixmap != None)
|
|
|
|
XFreePixmap (cwindow->compositor->display->xdisplay,
|
|
|
|
cwindow->pixmap);
|
|
|
|
#endif
|
2003-11-29 22:30:27 -05:00
|
|
|
meta_error_trap_pop (cwindow->compositor->display, FALSE);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
g_free (cwindow);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
free_window_hash_value (void *v)
|
|
|
|
{
|
|
|
|
MetaCompositorWindow *cwindow = v;
|
|
|
|
|
|
|
|
meta_compositor_window_free (cwindow);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
2003-11-15 23:35:16 -05:00
|
|
|
MetaCompositor*
|
|
|
|
meta_compositor_new (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
MetaCompositor *compositor;
|
|
|
|
|
|
|
|
compositor = g_new0 (MetaCompositor, 1);
|
|
|
|
|
|
|
|
compositor->display = display;
|
|
|
|
|
|
|
|
if (!XCompositeQueryExtension (display->xdisplay,
|
|
|
|
&compositor->composite_event_base,
|
|
|
|
&compositor->composite_error_base))
|
|
|
|
{
|
|
|
|
compositor->composite_event_base = 0;
|
|
|
|
compositor->composite_error_base = 0;
|
|
|
|
}
|
2003-11-24 18:00:52 -05:00
|
|
|
else
|
2004-08-26 23:27:43 -04:00
|
|
|
{
|
|
|
|
int composite_major, composite_minor;
|
|
|
|
|
|
|
|
compositor->have_composite = TRUE;
|
|
|
|
|
|
|
|
#if HAVE_NAME_WINDOW_PIXMAP
|
|
|
|
XCompositeQueryVersion (display->xdisplay,
|
|
|
|
&composite_major, &composite_minor);
|
2004-08-27 18:09:13 -04:00
|
|
|
|
|
|
|
#if 0
|
2004-08-26 23:27:43 -04:00
|
|
|
if (composite_major > 0 || composite_minor >= 2)
|
|
|
|
compositor->have_name_window_pixmap = TRUE;
|
2004-08-27 18:09:13 -04:00
|
|
|
#endif
|
2004-08-26 23:27:43 -04:00
|
|
|
#endif
|
|
|
|
}
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Composite extension event base %d error base %d\n",
|
|
|
|
compositor->composite_event_base,
|
|
|
|
compositor->composite_error_base);
|
2003-11-15 23:35:16 -05:00
|
|
|
|
|
|
|
if (!XDamageQueryExtension (display->xdisplay,
|
|
|
|
&compositor->damage_event_base,
|
|
|
|
&compositor->damage_error_base))
|
|
|
|
{
|
|
|
|
compositor->damage_event_base = 0;
|
|
|
|
compositor->damage_error_base = 0;
|
|
|
|
}
|
2003-11-24 18:00:52 -05:00
|
|
|
else
|
|
|
|
compositor->have_damage = TRUE;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Damage extension event base %d error base %d\n",
|
|
|
|
compositor->damage_event_base,
|
|
|
|
compositor->damage_error_base);
|
2003-11-15 23:35:16 -05:00
|
|
|
|
|
|
|
if (!XFixesQueryExtension (display->xdisplay,
|
|
|
|
&compositor->fixes_event_base,
|
|
|
|
&compositor->fixes_error_base))
|
|
|
|
{
|
|
|
|
compositor->fixes_event_base = 0;
|
|
|
|
compositor->fixes_error_base = 0;
|
|
|
|
}
|
2003-11-24 18:00:52 -05:00
|
|
|
else
|
|
|
|
compositor->have_fixes = TRUE;
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Fixes extension event base %d error base %d\n",
|
|
|
|
compositor->fixes_event_base,
|
|
|
|
compositor->fixes_error_base);
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-24 18:00:52 -05:00
|
|
|
if (!(compositor->have_composite &&
|
|
|
|
compositor->have_fixes &&
|
2004-08-26 22:17:49 -04:00
|
|
|
compositor->have_damage &&
|
|
|
|
META_DISPLAY_HAS_RENDER (compositor->display)))
|
2003-11-15 23:35:16 -05:00
|
|
|
{
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Failed to find all extensions needed for compositing manager, disabling compositing manager\n");
|
2003-11-15 23:35:16 -05:00
|
|
|
g_assert (!compositor->enabled);
|
|
|
|
return compositor;
|
|
|
|
}
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
compositor->window_hash = g_hash_table_new_full (meta_unsigned_long_hash,
|
|
|
|
meta_unsigned_long_equal,
|
|
|
|
NULL,
|
|
|
|
free_window_hash_value);
|
|
|
|
|
2003-11-15 23:35:16 -05:00
|
|
|
compositor->enabled = TRUE;
|
|
|
|
|
|
|
|
return compositor;
|
|
|
|
#else /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
return (void*) 0xdeadbeef; /* non-NULL value */
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
}
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
remove_repair_idle (MetaCompositor *compositor)
|
|
|
|
{
|
2003-12-25 21:42:38 -05:00
|
|
|
if (compositor->repair_idle || compositor->repair_timeout)
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Damage idle removed\n");
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
if (compositor->repair_idle != 0)
|
|
|
|
{
|
|
|
|
g_source_remove (compositor->repair_idle);
|
|
|
|
compositor->repair_idle = 0;
|
|
|
|
}
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
if (compositor->repair_timeout != 0)
|
|
|
|
{
|
|
|
|
g_source_remove (compositor->repair_timeout);
|
|
|
|
compositor->repair_timeout = 0;
|
|
|
|
}
|
2003-11-23 13:16:01 -05:00
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
2003-11-15 23:35:16 -05:00
|
|
|
void
|
|
|
|
meta_compositor_unref (MetaCompositor *compositor)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
/* There isn't really a refcount at the moment since
|
|
|
|
* there's no ref()
|
|
|
|
*/
|
2003-11-23 13:16:01 -05:00
|
|
|
remove_repair_idle (compositor);
|
2003-11-24 12:47:48 -05:00
|
|
|
|
|
|
|
if (compositor->window_hash)
|
|
|
|
g_hash_table_destroy (compositor->window_hash);
|
2003-11-15 23:35:16 -05:00
|
|
|
|
|
|
|
g_free (compositor);
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
}
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static XserverRegion
|
|
|
|
window_extents (MetaCompositorWindow *cwindow)
|
|
|
|
{
|
|
|
|
XRectangle r;
|
|
|
|
|
|
|
|
r.x = cwindow->x;
|
|
|
|
r.y = cwindow->y;
|
|
|
|
r.width = cwindow->width;
|
|
|
|
r.height = cwindow->height;
|
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
r.width += SHADOW_OFFSET;
|
|
|
|
r.height += SHADOW_OFFSET;
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
return XFixesCreateRegion (cwindow->compositor->display->xdisplay, &r, 1);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
2004-08-26 23:27:43 -04:00
|
|
|
static void
|
|
|
|
window_get_paint_bounds (MetaCompositorWindow *cwindow,
|
|
|
|
int *x,
|
|
|
|
int *y,
|
|
|
|
int *w,
|
|
|
|
int *h)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_NAME_WINDOW_PIXMAP
|
|
|
|
if (cwindow->pixmap != None)
|
|
|
|
{
|
|
|
|
*x = cwindow->x;
|
|
|
|
*y = cwindow->y;
|
|
|
|
*w = cwindow->width + cwindow->border_width * 2;
|
|
|
|
*h = cwindow->height + cwindow->border_width * 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
*x = cwindow->x + cwindow->border_width;
|
|
|
|
*y = cwindow->y + cwindow->border_width;
|
|
|
|
*w = cwindow->width;
|
|
|
|
*h = cwindow->height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
static void
|
|
|
|
paint_screen (MetaCompositor *compositor,
|
|
|
|
MetaScreen *screen,
|
|
|
|
XserverRegion damage_region)
|
|
|
|
{
|
|
|
|
XserverRegion region;
|
|
|
|
Picture buffer_picture;
|
|
|
|
Pixmap buffer_pixmap;
|
|
|
|
Display *xdisplay;
|
|
|
|
XRenderPictFormat *format;
|
|
|
|
GList *tmp;
|
2003-11-29 22:30:27 -05:00
|
|
|
GC gc;
|
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Repainting screen %d root 0x%lx\n",
|
|
|
|
screen->number, screen->xroot);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
2004-08-27 18:09:13 -04:00
|
|
|
/* meta_display_grab (screen->display); */
|
2003-11-29 22:30:27 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
xdisplay = screen->display->xdisplay;
|
|
|
|
|
|
|
|
if (damage_region == None)
|
|
|
|
{
|
|
|
|
XRectangle r;
|
|
|
|
|
|
|
|
r.x = 0;
|
|
|
|
r.y = 0;
|
2005-12-14 07:47:35 -05:00
|
|
|
r.width = screen->rect.width;
|
|
|
|
r.height = screen->rect.height;
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
region = XFixesCreateRegion (xdisplay, &r, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
region = XFixesCreateRegion (xdisplay, NULL, 0);
|
2003-11-29 22:30:27 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
XFixesCopyRegion (compositor->display->xdisplay,
|
|
|
|
region,
|
|
|
|
damage_region);
|
|
|
|
}
|
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
buffer_pixmap = XCreatePixmap (xdisplay, screen->xroot,
|
2005-12-14 07:47:35 -05:00
|
|
|
screen->rect.width,
|
|
|
|
screen->rect.height,
|
2003-11-23 13:16:01 -05:00
|
|
|
DefaultDepth (xdisplay,
|
|
|
|
screen->number));
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
gc = XCreateGC (xdisplay, buffer_pixmap, 0, NULL);
|
|
|
|
XSetForeground (xdisplay, gc, WhitePixel (xdisplay, screen->number));
|
|
|
|
XFixesSetGCClipRegion (xdisplay, gc, 0, 0, region);
|
|
|
|
XFillRectangle (xdisplay, buffer_pixmap, gc, 0, 0,
|
2005-12-14 07:47:35 -05:00
|
|
|
screen->rect.width, screen->rect.height);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
format = XRenderFindVisualFormat (xdisplay,
|
|
|
|
DefaultVisual (xdisplay,
|
|
|
|
screen->number));
|
|
|
|
|
|
|
|
buffer_picture = XRenderCreatePicture (xdisplay,
|
|
|
|
buffer_pixmap,
|
|
|
|
format,
|
|
|
|
0, 0);
|
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
/* set clip */
|
2003-11-23 13:16:01 -05:00
|
|
|
XFixesSetPictureClipRegion (xdisplay,
|
2003-11-29 22:30:27 -05:00
|
|
|
buffer_picture, 0, 0,
|
|
|
|
region);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
/* draw windows from bottom to top */
|
2003-11-29 22:30:27 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
meta_error_trap_push (compositor->display);
|
|
|
|
tmp = g_list_last (screen->compositor_windows);
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaCompositorWindow *cwindow = tmp->data;
|
2003-11-29 22:30:27 -05:00
|
|
|
XRenderColor shadow_color;
|
|
|
|
MetaWindow *window;
|
|
|
|
|
|
|
|
shadow_color.red = 0;
|
|
|
|
shadow_color.green = 0;
|
|
|
|
shadow_color.blue = 0;
|
|
|
|
shadow_color.alpha = 0x90c0;
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
if (cwindow->picture == None) /* InputOnly */
|
|
|
|
goto next;
|
2003-12-25 19:05:26 -05:00
|
|
|
|
|
|
|
if (!cwindow->viewable)
|
|
|
|
goto next; /* not viewable */
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
if (cwindow->last_painted_extents)
|
|
|
|
XFixesDestroyRegion (xdisplay,
|
|
|
|
cwindow->last_painted_extents);
|
|
|
|
|
|
|
|
cwindow->last_painted_extents = window_extents (cwindow);
|
|
|
|
|
|
|
|
/* XFixesSubtractRegion (dpy, region, region, 0, 0, w->borderSize, 0, 0); */
|
2003-11-29 22:30:27 -05:00
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, " Compositing window 0x%lx %d,%d %dx%d\n",
|
|
|
|
cwindow->xwindow,
|
|
|
|
cwindow->x, cwindow->y,
|
|
|
|
cwindow->width, cwindow->height);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
window = meta_display_lookup_x_window (compositor->display,
|
|
|
|
cwindow->xwindow);
|
|
|
|
if (window != NULL &&
|
|
|
|
window == compositor->display->grab_window &&
|
|
|
|
(meta_grab_op_is_resizing (compositor->display->grab_op) ||
|
|
|
|
meta_grab_op_is_moving (compositor->display->grab_op)))
|
|
|
|
{
|
|
|
|
/* Draw window transparent while resizing */
|
2004-08-26 23:27:43 -04:00
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
window_get_paint_bounds (cwindow, &x, &y, &w, &h);
|
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
XRenderComposite (xdisplay,
|
|
|
|
PictOpOver, /* PictOpOver for alpha, PictOpSrc without */
|
|
|
|
cwindow->picture,
|
|
|
|
screen->trans_picture,
|
|
|
|
buffer_picture,
|
|
|
|
0, 0, 0, 0,
|
2004-08-26 23:27:43 -04:00
|
|
|
x, y, w, h);
|
2003-11-29 22:30:27 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Draw window normally */
|
2004-08-26 23:27:43 -04:00
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
window_get_paint_bounds (cwindow, &x, &y, &w, &h);
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
/* superlame drop shadow */
|
|
|
|
XRenderFillRectangle (xdisplay, PictOpOver,
|
|
|
|
buffer_picture,
|
|
|
|
&shadow_color,
|
|
|
|
cwindow->x + SHADOW_OFFSET,
|
|
|
|
cwindow->y + SHADOW_OFFSET,
|
|
|
|
cwindow->width, cwindow->height);
|
|
|
|
|
|
|
|
XRenderComposite (xdisplay,
|
|
|
|
PictOpSrc, /* PictOpOver for alpha, PictOpSrc without */
|
|
|
|
cwindow->picture,
|
|
|
|
None,
|
|
|
|
buffer_picture,
|
|
|
|
0, 0, 0, 0,
|
2004-08-26 23:27:43 -04:00
|
|
|
x, y, w, h);
|
2003-11-29 22:30:27 -05:00
|
|
|
}
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
next:
|
|
|
|
tmp = tmp->prev;
|
|
|
|
}
|
|
|
|
meta_error_trap_pop (compositor->display, FALSE);
|
|
|
|
|
|
|
|
/* Copy buffer to root window */
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Copying buffer to root window 0x%lx picture 0x%lx\n",
|
|
|
|
screen->xroot, screen->root_picture);
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
#if 1
|
|
|
|
XFixesSetPictureClipRegion (xdisplay,
|
|
|
|
screen->root_picture,
|
|
|
|
0, 0, region);
|
|
|
|
#endif
|
2003-11-23 13:16:01 -05:00
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
/* XFixesSetPictureClipRegion (xdisplay, buffer_picture, 0, 0, None); */
|
2003-11-23 13:16:01 -05:00
|
|
|
XRenderComposite (xdisplay, PictOpSrc, buffer_picture, None,
|
|
|
|
screen->root_picture,
|
|
|
|
0, 0, 0, 0, 0, 0,
|
2005-12-14 07:47:35 -05:00
|
|
|
screen->rect.width, screen->rect.height);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
XFixesDestroyRegion (xdisplay, region);
|
|
|
|
XFreePixmap (xdisplay, buffer_pixmap);
|
|
|
|
XRenderFreePicture (xdisplay, buffer_picture);
|
2003-11-29 22:30:27 -05:00
|
|
|
XFreeGC (xdisplay, gc);
|
|
|
|
|
2004-08-27 18:09:13 -04:00
|
|
|
/* meta_display_ungrab (screen->display); */
|
2003-12-25 21:42:38 -05:00
|
|
|
|
|
|
|
XSync (screen->display->xdisplay, False);
|
2003-11-23 13:16:01 -05:00
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
2003-11-29 22:30:27 -05:00
|
|
|
static void
|
|
|
|
do_repair (MetaCompositor *compositor)
|
2003-11-23 13:16:01 -05:00
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
tmp = compositor->display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *s = tmp->data;
|
|
|
|
|
|
|
|
if (s->damage_region != None)
|
|
|
|
{
|
|
|
|
paint_screen (compositor, s,
|
|
|
|
s->damage_region);
|
|
|
|
XFixesDestroyRegion (s->display->xdisplay,
|
|
|
|
s->damage_region);
|
|
|
|
s->damage_region = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
remove_repair_idle (compositor);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static gboolean
|
|
|
|
repair_idle_func (void *data)
|
|
|
|
{
|
|
|
|
MetaCompositor *compositor = data;
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
compositor->repair_idle = 0;
|
2003-11-29 22:30:27 -05:00
|
|
|
do_repair (compositor);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static gboolean
|
|
|
|
repair_timeout_func (void *data)
|
|
|
|
{
|
|
|
|
MetaCompositor *compositor = data;
|
|
|
|
|
|
|
|
compositor->repair_timeout = 0;
|
|
|
|
do_repair (compositor);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static MetaScreen*
|
|
|
|
meta_compositor_window_get_screen (MetaCompositorWindow *cwindow)
|
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
screen = NULL;
|
|
|
|
tmp = cwindow->compositor->display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *s = tmp->data;
|
|
|
|
|
|
|
|
if (s->number == cwindow->screen_index)
|
|
|
|
{
|
|
|
|
screen = s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
g_assert (screen != NULL);
|
|
|
|
|
|
|
|
return screen;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
ensure_repair_idle (MetaCompositor *compositor)
|
|
|
|
{
|
|
|
|
if (compositor->repair_idle != 0)
|
|
|
|
return;
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
compositor->repair_idle = g_idle_add_full (META_PRIORITY_COMPOSITE,
|
|
|
|
repair_idle_func, compositor, NULL);
|
|
|
|
compositor->repair_timeout = g_timeout_add (FRAME_INTERVAL_MILLISECONDS,
|
|
|
|
repair_timeout_func, compositor);
|
2003-12-25 21:42:38 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Damage idle queued\n");
|
2003-11-23 13:16:01 -05:00
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
merge_and_destroy_damage_region (MetaCompositor *compositor,
|
|
|
|
MetaScreen *screen,
|
|
|
|
XserverRegion region)
|
|
|
|
{
|
|
|
|
if (screen->damage_region != None)
|
|
|
|
{
|
2003-11-29 22:30:27 -05:00
|
|
|
XFixesUnionRegion (compositor->display->xdisplay,
|
|
|
|
screen->damage_region,
|
|
|
|
region, screen->damage_region);
|
2003-11-23 13:16:01 -05:00
|
|
|
XFixesDestroyRegion (compositor->display->xdisplay,
|
|
|
|
region);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
screen->damage_region = region;
|
|
|
|
}
|
|
|
|
|
|
|
|
ensure_repair_idle (compositor);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
merge_damage_region (MetaCompositor *compositor,
|
|
|
|
MetaScreen *screen,
|
|
|
|
XserverRegion region)
|
|
|
|
{
|
|
|
|
if (screen->damage_region == None)
|
|
|
|
screen->damage_region =
|
|
|
|
XFixesCreateRegion (compositor->display->xdisplay, NULL, 0);
|
2003-12-25 21:42:38 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"(Merging damage region)\n");
|
2003-11-23 13:16:01 -05:00
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
XFixesUnionRegion (compositor->display->xdisplay,
|
|
|
|
screen->damage_region,
|
|
|
|
region, screen->damage_region);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
ensure_repair_idle (compositor);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
process_damage_notify (MetaCompositor *compositor,
|
|
|
|
XDamageNotifyEvent *event)
|
|
|
|
{
|
|
|
|
MetaCompositorWindow *cwindow;
|
|
|
|
XserverRegion region;
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
cwindow = g_hash_table_lookup (compositor->window_hash,
|
|
|
|
&event->drawable);
|
|
|
|
if (cwindow == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
region = XFixesCreateRegion (compositor->display->xdisplay, NULL, 0);
|
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
/* translate region to screen; can error if window of damage is
|
|
|
|
* destroyed
|
|
|
|
*/
|
|
|
|
meta_error_trap_push (compositor->display);
|
2003-11-23 13:16:01 -05:00
|
|
|
XDamageSubtract (compositor->display->xdisplay,
|
|
|
|
cwindow->damage, None, region);
|
2003-11-29 22:30:27 -05:00
|
|
|
meta_error_trap_pop (compositor->display, FALSE);
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
XFixesTranslateRegion (compositor->display->xdisplay,
|
|
|
|
region,
|
|
|
|
cwindow->x,
|
|
|
|
cwindow->y);
|
|
|
|
|
|
|
|
screen = meta_compositor_window_get_screen (cwindow);
|
|
|
|
|
|
|
|
merge_and_destroy_damage_region (compositor, screen, region);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
process_configure_notify (MetaCompositor *compositor,
|
|
|
|
XConfigureEvent *event)
|
|
|
|
{
|
|
|
|
MetaCompositorWindow *cwindow;
|
|
|
|
MetaScreen *screen;
|
|
|
|
GList *link;
|
|
|
|
Window above;
|
|
|
|
XserverRegion region;
|
|
|
|
|
|
|
|
cwindow = g_hash_table_lookup (compositor->window_hash,
|
|
|
|
&event->window);
|
|
|
|
if (cwindow == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
screen = meta_compositor_window_get_screen (cwindow);
|
|
|
|
|
2003-12-25 21:42:38 -05:00
|
|
|
g_assert (screen != NULL);
|
|
|
|
|
|
|
|
if (screen->xroot != event->event)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"ConfigureNotify for 0x%lx received by 0x%lx not using\n",
|
|
|
|
event->window, event->event);
|
|
|
|
return; /* ignore ConfigureNotify not received on root window */
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"ConfigureNotify for 0x%lx received by 0x%lx %d,%d %dx%d\n",
|
|
|
|
event->window, event->event,
|
|
|
|
event->x, event->y, event->width, event->height);
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
if (cwindow->last_painted_extents)
|
|
|
|
{
|
2003-11-29 22:30:27 -05:00
|
|
|
merge_and_destroy_damage_region (compositor,
|
|
|
|
screen,
|
|
|
|
cwindow->last_painted_extents);
|
|
|
|
cwindow->last_painted_extents = None;
|
2003-11-23 13:16:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
cwindow->x = event->x;
|
|
|
|
cwindow->y = event->y;
|
|
|
|
cwindow->width = event->width;
|
|
|
|
cwindow->height = event->height;
|
|
|
|
cwindow->border_width = event->border_width;
|
|
|
|
|
|
|
|
link = g_list_find (screen->compositor_windows,
|
|
|
|
cwindow);
|
|
|
|
|
|
|
|
g_assert (link != NULL);
|
|
|
|
|
|
|
|
if (link->next)
|
|
|
|
above = ((MetaCompositorWindow*) link->next)->xwindow;
|
|
|
|
else
|
|
|
|
above = None;
|
|
|
|
|
|
|
|
if (above != event->above)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
screen->compositor_windows =
|
|
|
|
g_list_delete_link (screen->compositor_windows,
|
|
|
|
link);
|
|
|
|
link = NULL;
|
|
|
|
|
|
|
|
/* Note that event->above is None if our window is on the bottom */
|
|
|
|
tmp = screen->compositor_windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaCompositorWindow *t = tmp->data;
|
|
|
|
|
|
|
|
if (t->xwindow == event->above)
|
|
|
|
{
|
|
|
|
/* We are above this window, i.e. earlier in list */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tmp != NULL)
|
|
|
|
{
|
|
|
|
screen->compositor_windows =
|
|
|
|
g_list_insert_before (screen->compositor_windows,
|
|
|
|
tmp,
|
|
|
|
cwindow);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
screen->compositor_windows =
|
|
|
|
g_list_prepend (screen->compositor_windows,
|
|
|
|
cwindow);
|
|
|
|
}
|
|
|
|
|
|
|
|
region = window_extents (cwindow);
|
|
|
|
merge_damage_region (compositor,
|
|
|
|
screen,
|
|
|
|
region);
|
|
|
|
XFixesDestroyRegion (compositor->display->xdisplay, region);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
process_expose (MetaCompositor *compositor,
|
|
|
|
XExposeEvent *event)
|
|
|
|
{
|
|
|
|
XserverRegion region;
|
|
|
|
MetaScreen *screen;
|
|
|
|
XRectangle r;
|
|
|
|
|
|
|
|
screen = meta_display_screen_for_root (compositor->display,
|
|
|
|
event->window);
|
|
|
|
|
|
|
|
if (screen == NULL || screen->root_picture == None)
|
|
|
|
return;
|
|
|
|
|
|
|
|
r.x = 0;
|
|
|
|
r.y = 0;
|
2005-12-14 07:47:35 -05:00
|
|
|
r.width = screen->rect.width;
|
|
|
|
r.height = screen->rect.height;
|
2003-11-29 22:30:27 -05:00
|
|
|
region = XFixesCreateRegion (compositor->display->xdisplay, &r, 1);
|
|
|
|
|
|
|
|
merge_and_destroy_damage_region (compositor, screen, region);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
process_map (MetaCompositor *compositor,
|
|
|
|
XMapEvent *event)
|
|
|
|
{
|
|
|
|
MetaCompositorWindow *cwindow;
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
/* See if window was mapped as child of root */
|
|
|
|
screen = meta_display_screen_for_root (compositor->display,
|
|
|
|
event->event);
|
|
|
|
|
|
|
|
if (screen == NULL || screen->root_picture == None)
|
2003-12-25 21:42:38 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"MapNotify received on non-root 0x%lx for 0x%lx\n",
|
|
|
|
event->event, event->window);
|
|
|
|
return; /* MapNotify wasn't for a child of the root */
|
|
|
|
}
|
2003-12-25 19:05:26 -05:00
|
|
|
|
|
|
|
cwindow = g_hash_table_lookup (compositor->window_hash,
|
|
|
|
&event->window);
|
|
|
|
if (cwindow == NULL)
|
|
|
|
{
|
|
|
|
XWindowAttributes attrs;
|
|
|
|
|
|
|
|
meta_error_trap_push_with_return (compositor->display);
|
|
|
|
|
|
|
|
XGetWindowAttributes (compositor->display->xdisplay,
|
|
|
|
event->window, &attrs);
|
|
|
|
|
|
|
|
if (meta_error_trap_pop_with_return (compositor->display, TRUE) != Success)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Failed to get attributes for window 0x%lx\n",
|
|
|
|
event->window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-25 21:42:38 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Map window 0x%lx\n", event->window);
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_compositor_add_window (compositor,
|
|
|
|
event->window, &attrs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cwindow->viewable = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
process_unmap (MetaCompositor *compositor,
|
|
|
|
XUnmapEvent *event)
|
|
|
|
{
|
|
|
|
MetaCompositorWindow *cwindow;
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
/* See if window was unmapped as child of root */
|
|
|
|
screen = meta_display_screen_for_root (compositor->display,
|
|
|
|
event->event);
|
|
|
|
|
|
|
|
if (screen == NULL || screen->root_picture == None)
|
2003-12-25 21:42:38 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"UnmapNotify received on non-root 0x%lx for 0x%lx\n",
|
|
|
|
event->event, event->window);
|
|
|
|
return; /* UnmapNotify wasn't for a child of the root */
|
|
|
|
}
|
2003-12-25 19:05:26 -05:00
|
|
|
|
|
|
|
cwindow = g_hash_table_lookup (compositor->window_hash,
|
|
|
|
&event->window);
|
|
|
|
if (cwindow != NULL)
|
|
|
|
{
|
|
|
|
cwindow->viewable = FALSE;
|
|
|
|
|
|
|
|
if (cwindow->last_painted_extents)
|
|
|
|
{
|
|
|
|
merge_and_destroy_damage_region (compositor,
|
|
|
|
screen,
|
|
|
|
cwindow->last_painted_extents);
|
|
|
|
cwindow->last_painted_extents = None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
process_create (MetaCompositor *compositor,
|
|
|
|
XCreateWindowEvent *event)
|
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
|
|
|
XWindowAttributes attrs;
|
|
|
|
|
|
|
|
screen = meta_display_screen_for_root (compositor->display,
|
|
|
|
event->parent);
|
|
|
|
|
|
|
|
if (screen == NULL || screen->root_picture == None)
|
2003-12-25 21:42:38 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"CreateNotify received on non-root 0x%lx for 0x%lx\n",
|
|
|
|
event->parent, event->window);
|
|
|
|
return;
|
|
|
|
}
|
2003-12-25 19:05:26 -05:00
|
|
|
|
|
|
|
meta_error_trap_push_with_return (compositor->display);
|
|
|
|
|
|
|
|
XGetWindowAttributes (compositor->display->xdisplay,
|
|
|
|
event->window, &attrs);
|
|
|
|
|
|
|
|
if (meta_error_trap_pop_with_return (compositor->display, TRUE) != Success)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Failed to get attributes for window 0x%lx\n",
|
|
|
|
event->window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-25 21:42:38 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Create window 0x%lx, adding\n", event->window);
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_compositor_add_window (compositor,
|
|
|
|
event->window, &attrs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
process_destroy (MetaCompositor *compositor,
|
|
|
|
XDestroyWindowEvent *event)
|
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
screen = meta_display_screen_for_root (compositor->display,
|
|
|
|
event->event);
|
|
|
|
|
|
|
|
if (screen == NULL || screen->root_picture == None)
|
2003-12-25 21:42:38 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"DestroyNotify received on non-root 0x%lx for 0x%lx\n",
|
|
|
|
event->event, event->window);
|
|
|
|
return;
|
|
|
|
}
|
2003-12-25 19:05:26 -05:00
|
|
|
|
2003-12-25 21:42:38 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Destroy window 0x%lx\n", event->window);
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_compositor_remove_window (compositor, event->window);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
2003-12-25 21:42:38 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
static void
|
|
|
|
process_reparent (MetaCompositor *compositor,
|
|
|
|
XReparentEvent *event)
|
|
|
|
{
|
|
|
|
/* Reparent from one screen to another doesn't happen now, but
|
|
|
|
* it's been suggested as a future extension
|
|
|
|
*/
|
|
|
|
MetaScreen *event_screen;
|
|
|
|
MetaScreen *parent_screen;
|
|
|
|
MetaCompositorWindow *cwindow;
|
|
|
|
XWindowAttributes attrs;
|
|
|
|
|
|
|
|
event_screen = meta_display_screen_for_root (compositor->display,
|
|
|
|
event->event);
|
|
|
|
|
|
|
|
if (event_screen == NULL || event_screen->root_picture == None)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"ReparentNotify received on non-root 0x%lx for 0x%lx\n",
|
|
|
|
event->event, event->window);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Reparent window 0x%lx new parent 0x%lx received on 0x%lx\n",
|
|
|
|
event->window, event->parent, event->event);
|
|
|
|
|
|
|
|
parent_screen = meta_display_screen_for_root (compositor->display,
|
|
|
|
event->parent);
|
|
|
|
|
|
|
|
if (parent_screen == NULL)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"ReparentNotify 0x%lx to a non-screen or unmanaged screen 0x%lx\n",
|
|
|
|
event->window, event->parent);
|
|
|
|
meta_compositor_remove_window (compositor, event->window);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cwindow = g_hash_table_lookup (compositor->window_hash,
|
|
|
|
&event->window);
|
|
|
|
if (cwindow != NULL)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Window reparented to new screen at %d,%d\n",
|
|
|
|
event->x, event->y);
|
|
|
|
cwindow->x = event->x;
|
|
|
|
cwindow->y = event->y;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_error_trap_push_with_return (compositor->display);
|
|
|
|
|
|
|
|
XGetWindowAttributes (compositor->display->xdisplay,
|
|
|
|
event->window, &attrs);
|
|
|
|
|
|
|
|
if (meta_error_trap_pop_with_return (compositor->display, TRUE) != Success)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Failed to get attributes for window 0x%lx\n",
|
|
|
|
event->window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Reparent window 0x%lx into screen 0x%lx, adding\n",
|
|
|
|
event->window, event->parent);
|
|
|
|
meta_compositor_add_window (compositor,
|
|
|
|
event->window, &attrs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
|
2003-11-15 23:35:16 -05:00
|
|
|
void
|
|
|
|
meta_compositor_process_event (MetaCompositor *compositor,
|
2003-11-23 13:16:01 -05:00
|
|
|
XEvent *event,
|
2003-11-15 23:35:16 -05:00
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
if (!compositor->enabled)
|
|
|
|
return; /* no extension */
|
|
|
|
|
2003-12-25 21:42:38 -05:00
|
|
|
/* FIXME support CirculateNotify */
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
if (event->type == (compositor->damage_event_base + XDamageNotify))
|
|
|
|
{
|
|
|
|
process_damage_notify (compositor,
|
|
|
|
(XDamageNotifyEvent*) event);
|
|
|
|
}
|
|
|
|
else if (event->type == ConfigureNotify)
|
|
|
|
{
|
|
|
|
process_configure_notify (compositor,
|
|
|
|
(XConfigureEvent*) event);
|
|
|
|
}
|
2003-11-29 22:30:27 -05:00
|
|
|
else if (event->type == Expose)
|
|
|
|
{
|
|
|
|
process_expose (compositor,
|
|
|
|
(XExposeEvent*) event);
|
|
|
|
}
|
2003-12-25 19:05:26 -05:00
|
|
|
else if (event->type == UnmapNotify)
|
|
|
|
{
|
|
|
|
process_unmap (compositor,
|
|
|
|
(XUnmapEvent*) event);
|
|
|
|
}
|
|
|
|
else if (event->type == MapNotify)
|
|
|
|
{
|
|
|
|
process_map (compositor,
|
|
|
|
(XMapEvent*) event);
|
|
|
|
}
|
2003-12-25 21:42:38 -05:00
|
|
|
else if (event->type == ReparentNotify)
|
|
|
|
{
|
|
|
|
process_reparent (compositor,
|
|
|
|
(XReparentEvent*) event);
|
|
|
|
}
|
2003-12-25 19:05:26 -05:00
|
|
|
else if (event->type == CreateNotify)
|
|
|
|
{
|
|
|
|
process_create (compositor,
|
|
|
|
(XCreateWindowEvent*) event);
|
|
|
|
}
|
|
|
|
else if (event->type == DestroyNotify)
|
|
|
|
{
|
|
|
|
process_destroy (compositor,
|
|
|
|
(XDestroyWindowEvent*) event);
|
|
|
|
}
|
|
|
|
|
2003-11-15 23:35:16 -05:00
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called when metacity does its XQueryTree() on startup
|
2003-11-23 13:16:01 -05:00
|
|
|
* and when a new window is mapped.
|
2003-11-15 23:35:16 -05:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_compositor_add_window (MetaCompositor *compositor,
|
|
|
|
Window xwindow,
|
|
|
|
XWindowAttributes *attrs)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
2003-11-23 13:16:01 -05:00
|
|
|
MetaCompositorWindow *cwindow;
|
|
|
|
MetaScreen *screen;
|
|
|
|
Damage damage;
|
|
|
|
XRenderPictFormat *format;
|
|
|
|
XRenderPictureAttributes pa;
|
2003-11-29 22:30:27 -05:00
|
|
|
XserverRegion region;
|
2003-11-23 13:16:01 -05:00
|
|
|
|
2003-11-15 23:35:16 -05:00
|
|
|
if (!compositor->enabled)
|
|
|
|
return; /* no extension */
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
screen = meta_screen_for_x_screen (attrs->screen);
|
|
|
|
g_assert (screen != NULL);
|
|
|
|
|
|
|
|
cwindow = g_hash_table_lookup (compositor->window_hash,
|
|
|
|
&xwindow);
|
|
|
|
|
|
|
|
if (cwindow != NULL)
|
2003-12-25 21:42:38 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Window 0x%lx already added\n", xwindow);
|
|
|
|
return;
|
|
|
|
}
|
2003-11-23 13:16:01 -05:00
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
2003-12-25 21:42:38 -05:00
|
|
|
"Adding window 0x%lx (%s) to compositor\n",
|
|
|
|
xwindow,
|
|
|
|
attrs->map_state == IsViewable ?
|
|
|
|
"mapped" : "unmapped");
|
2003-12-25 19:05:26 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
/* Create Damage object to monitor window damage */
|
|
|
|
meta_error_trap_push (compositor->display);
|
|
|
|
damage = XDamageCreate (compositor->display->xdisplay,
|
|
|
|
xwindow, XDamageReportNonEmpty);
|
|
|
|
meta_error_trap_pop (compositor->display, FALSE);
|
|
|
|
|
|
|
|
if (damage == None)
|
|
|
|
return;
|
|
|
|
|
|
|
|
cwindow = g_new0 (MetaCompositorWindow, 1);
|
|
|
|
|
|
|
|
cwindow->compositor = compositor;
|
|
|
|
cwindow->xwindow = xwindow;
|
|
|
|
cwindow->screen_index = screen->number;
|
|
|
|
cwindow->damage = damage;
|
|
|
|
cwindow->x = attrs->x;
|
|
|
|
cwindow->y = attrs->y;
|
|
|
|
cwindow->width = attrs->width;
|
|
|
|
cwindow->height = attrs->height;
|
|
|
|
cwindow->border_width = attrs->border_width;
|
|
|
|
|
2004-08-26 23:27:43 -04:00
|
|
|
#if HAVE_NAME_WINDOW_PIXMAP
|
|
|
|
if (compositor->have_name_window_pixmap)
|
|
|
|
{
|
|
|
|
meta_error_trap_push (compositor->display);
|
|
|
|
cwindow->pixmap = XCompositeNameWindowPixmap (compositor->display->xdisplay,
|
|
|
|
cwindow->xwindow);
|
|
|
|
meta_error_trap_pop (compositor->display, FALSE);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
/* viewable == mapped for the root window, since root can't be unmapped */
|
|
|
|
cwindow->viewable = (attrs->map_state == IsViewable);
|
2004-08-27 18:19:43 -04:00
|
|
|
/* FIXME this assertion can fail somehow... */
|
2003-12-25 19:05:26 -05:00
|
|
|
g_assert (attrs->map_state != IsUnviewable);
|
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
pa.subwindow_mode = IncludeInferiors;
|
|
|
|
|
|
|
|
if (attrs->class != InputOnly)
|
2004-08-26 23:27:43 -04:00
|
|
|
{
|
2003-11-23 13:16:01 -05:00
|
|
|
format = XRenderFindVisualFormat (compositor->display->xdisplay,
|
|
|
|
attrs->visual);
|
|
|
|
cwindow->picture = XRenderCreatePicture (compositor->display->xdisplay,
|
2004-08-26 23:27:43 -04:00
|
|
|
#if HAVE_NAME_WINDOW_PIXMAP
|
|
|
|
cwindow->pixmap != None ?
|
|
|
|
cwindow->pixmap :
|
|
|
|
cwindow->xwindow,
|
|
|
|
#else
|
|
|
|
cwindow->xwindow,
|
|
|
|
#endif
|
2003-11-23 13:16:01 -05:00
|
|
|
format,
|
|
|
|
CPSubwindowMode,
|
|
|
|
&pa);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cwindow->picture = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_insert (compositor->window_hash,
|
|
|
|
&cwindow->xwindow, cwindow);
|
|
|
|
|
2003-12-25 19:05:26 -05:00
|
|
|
/* assume cwindow is at the top of the stack as it was either just
|
|
|
|
* created or just reparented to the root window
|
2003-11-29 22:30:27 -05:00
|
|
|
*/
|
2003-11-23 13:16:01 -05:00
|
|
|
screen->compositor_windows = g_list_prepend (screen->compositor_windows,
|
|
|
|
cwindow);
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
/* schedule paint of the new window */
|
|
|
|
region = window_extents (cwindow);
|
|
|
|
merge_and_destroy_damage_region (compositor, screen, region);
|
2003-11-15 23:35:16 -05:00
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
}
|
|
|
|
|
2003-11-20 21:32:05 -05:00
|
|
|
void
|
|
|
|
meta_compositor_remove_window (MetaCompositor *compositor,
|
|
|
|
Window xwindow)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
2003-11-23 13:16:01 -05:00
|
|
|
MetaCompositorWindow *cwindow;
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
2003-11-20 21:32:05 -05:00
|
|
|
if (!compositor->enabled)
|
|
|
|
return; /* no extension */
|
2003-12-25 19:05:26 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
cwindow = g_hash_table_lookup (compositor->window_hash,
|
|
|
|
&xwindow);
|
|
|
|
|
|
|
|
if (cwindow == NULL)
|
2003-12-25 21:42:38 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Window 0x%lx already removed\n", xwindow);
|
|
|
|
return;
|
|
|
|
}
|
2003-12-25 19:05:26 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
2003-12-25 21:42:38 -05:00
|
|
|
"Removing window 0x%lx (%s) from compositor\n",
|
|
|
|
xwindow,
|
|
|
|
cwindow->viewable ? "mapped" : "unmapped");
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
screen = meta_compositor_window_get_screen (cwindow);
|
|
|
|
|
|
|
|
if (cwindow->last_painted_extents)
|
|
|
|
{
|
|
|
|
merge_and_destroy_damage_region (compositor,
|
|
|
|
screen,
|
|
|
|
cwindow->last_painted_extents);
|
|
|
|
cwindow->last_painted_extents = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
screen->compositor_windows = g_list_remove (screen->compositor_windows,
|
|
|
|
cwindow);
|
|
|
|
|
|
|
|
/* Frees cwindow as side effect */
|
|
|
|
g_hash_table_remove (compositor->window_hash,
|
|
|
|
&xwindow);
|
|
|
|
|
2003-11-20 21:32:05 -05:00
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
}
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-20 21:32:05 -05:00
|
|
|
void
|
|
|
|
meta_compositor_manage_screen (MetaCompositor *compositor,
|
|
|
|
MetaScreen *screen)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
2003-11-23 13:16:01 -05:00
|
|
|
XRenderPictureAttributes pa;
|
2003-11-29 22:30:27 -05:00
|
|
|
XRectangle r;
|
|
|
|
XRenderColor c;
|
2003-11-23 13:16:01 -05:00
|
|
|
|
2003-11-20 21:32:05 -05:00
|
|
|
if (!compositor->enabled)
|
|
|
|
return; /* no extension */
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
/* FIXME we need to handle root window resize by recreating the
|
|
|
|
* root_picture
|
|
|
|
*/
|
|
|
|
|
|
|
|
g_assert (screen->root_picture == None);
|
|
|
|
|
2003-11-24 12:47:48 -05:00
|
|
|
/* FIXME add flag for whether we're composite-managing each
|
|
|
|
* screen and detect failure here
|
|
|
|
*/
|
|
|
|
XCompositeRedirectSubwindows (screen->display->xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
CompositeRedirectManual);
|
2003-12-25 19:05:26 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR, "Subwindows redirected, we are now the compositing manager\n");
|
2003-11-24 12:47:48 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
pa.subwindow_mode = IncludeInferiors;
|
|
|
|
|
|
|
|
screen->root_picture =
|
|
|
|
XRenderCreatePicture (compositor->display->xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
XRenderFindVisualFormat (compositor->display->xdisplay,
|
|
|
|
DefaultVisual (compositor->display->xdisplay,
|
|
|
|
screen->number)),
|
|
|
|
CPSubwindowMode,
|
|
|
|
&pa);
|
|
|
|
|
|
|
|
g_assert (screen->root_picture != None);
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
screen->trans_pixmap = XCreatePixmap (compositor->display->xdisplay,
|
|
|
|
screen->xroot, 1, 1, 8);
|
|
|
|
|
|
|
|
pa.repeat = True;
|
|
|
|
screen->trans_picture =
|
|
|
|
XRenderCreatePicture (compositor->display->xdisplay,
|
|
|
|
screen->trans_pixmap,
|
|
|
|
XRenderFindStandardFormat (compositor->display->xdisplay,
|
|
|
|
PictStandardA8),
|
|
|
|
CPRepeat,
|
|
|
|
&pa);
|
|
|
|
|
|
|
|
c.red = c.green = c.blue = 0;
|
|
|
|
c.alpha = 0xc0c0;
|
|
|
|
XRenderFillRectangle (compositor->display->xdisplay,
|
|
|
|
PictOpSrc,
|
|
|
|
screen->trans_picture, &c, 0, 0, 1, 1);
|
|
|
|
|
|
|
|
/* Damage the whole screen */
|
|
|
|
r.x = 0;
|
|
|
|
r.y = 0;
|
2005-12-14 07:47:35 -05:00
|
|
|
r.width = screen->rect.width;
|
|
|
|
r.height = screen->rect.height;
|
2003-11-29 22:30:27 -05:00
|
|
|
|
|
|
|
merge_and_destroy_damage_region (compositor,
|
|
|
|
screen,
|
|
|
|
XFixesCreateRegion (compositor->display->xdisplay,
|
|
|
|
&r, 1));
|
2003-11-23 13:16:01 -05:00
|
|
|
|
2003-11-20 21:32:05 -05:00
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
}
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-20 21:32:05 -05:00
|
|
|
void
|
|
|
|
meta_compositor_unmanage_screen (MetaCompositor *compositor,
|
|
|
|
MetaScreen *screen)
|
|
|
|
{
|
2003-11-23 13:16:01 -05:00
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
2003-11-20 21:32:05 -05:00
|
|
|
if (!compositor->enabled)
|
|
|
|
return; /* no extension */
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-23 13:16:01 -05:00
|
|
|
XRenderFreePicture (screen->display->xdisplay,
|
|
|
|
screen->root_picture);
|
|
|
|
screen->root_picture = None;
|
2003-11-29 22:30:27 -05:00
|
|
|
XRenderFreePicture (screen->display->xdisplay,
|
|
|
|
screen->trans_picture);
|
|
|
|
screen->trans_picture = None;
|
|
|
|
XFreePixmap (screen->display->xdisplay,
|
|
|
|
screen->trans_pixmap);
|
|
|
|
screen->trans_pixmap = None;
|
2003-11-23 13:16:01 -05:00
|
|
|
|
|
|
|
while (screen->compositor_windows != NULL)
|
|
|
|
{
|
|
|
|
MetaCompositorWindow *cwindow = screen->compositor_windows->data;
|
|
|
|
|
2003-12-25 21:42:38 -05:00
|
|
|
meta_topic (META_DEBUG_COMPOSITOR,
|
|
|
|
"Unmanage screen for 0x%lx\n", cwindow->xwindow);
|
2003-11-23 13:16:01 -05:00
|
|
|
meta_compositor_remove_window (compositor, cwindow->xwindow);
|
|
|
|
}
|
2003-11-20 21:32:05 -05:00
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
}
|
2003-11-15 23:35:16 -05:00
|
|
|
|
2003-11-29 22:30:27 -05:00
|
|
|
void
|
|
|
|
meta_compositor_damage_window (MetaCompositor *compositor,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
|
|
|
Window xwindow;
|
|
|
|
MetaCompositorWindow *cwindow;
|
|
|
|
|
|
|
|
if (!compositor->enabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (window->screen->root_picture == None)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (window->frame)
|
|
|
|
xwindow = window->frame->xwindow;
|
|
|
|
else
|
|
|
|
xwindow = window->xwindow;
|
|
|
|
|
|
|
|
cwindow = g_hash_table_lookup (compositor->window_hash,
|
|
|
|
&xwindow);
|
|
|
|
if (cwindow == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
merge_and_destroy_damage_region (compositor,
|
|
|
|
window->screen,
|
|
|
|
window_extents (cwindow));
|
|
|
|
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
|
|
|
}
|