src/core/display.c (meta_display_open), fetch & use composite version, for

2008-01-28  Michael Meeks  <michael.meeks@novell.com>

        * src/core/display.c (meta_display_open),
        * src/core/compositor.c: fetch & use composite
        version, for remote screens that don't match the
        compile system's version.
        (meta_compositor_manage_screen): bin erroneous FIXME.
        (add_win): remove common warning churn for (very)
        transient windows


svn path=/trunk/; revision=3550
This commit is contained in:
Michael Meeks 2008-02-04 15:57:07 +00:00 committed by Michael Meeks
parent a9a69ac807
commit 2f43d436c8
4 changed files with 154 additions and 82 deletions

View File

@ -1,3 +1,13 @@
2008-01-28 Michael Meeks <michael.meeks@novell.com>
* src/core/display.c (meta_display_open),
* src/core/compositor.c: fetch & use composite
version, for remote screens that don't match the
compile system's version.
(meta_compositor_manage_screen): bin erroneous FIXME.
(add_win): remove common warning churn for (very)
transient windows
2008-02-03 Thomas Thurman <tthurman@gnome.org>
* tools/patch-wrangler.py: another program I use for maintenance

View File

@ -55,6 +55,20 @@
#define USE_IDLE_REPAINT 1
static inline gboolean
composite_at_least_version (MetaDisplay *display,
int maj, int minor)
{
return (display->composite_major_version > maj
|| (display->composite_major_version == maj
&& display->composite_minor_version >= minor));
}
#define have_name_window_pixmap(display) \
composite_at_least_version (display, 0, 2)
#define have_cow(display) \
composite_at_least_version (display, 0, 3)
typedef enum _MetaCompWindowType
{
META_COMP_WINDOW_NORMAL,
@ -893,11 +907,14 @@ get_window_picture (MetaCompWindow *cw)
meta_error_trap_push (display);
#ifdef HAVE_NAME_WINDOW_PIXMAP
if (have_name_window_pixmap (display))
{
if (cw->back_pixmap == None)
cw->back_pixmap = XCompositeNameWindowPixmap (display->xdisplay, cw->id);
if (cw->back_pixmap != None)
draw = cw->back_pixmap;
}
#endif
format = get_window_format (cw);
@ -1049,16 +1066,21 @@ paint_windows (MetaScreen *screen,
int x, y, wid, hei;
#ifdef HAVE_NAME_WINDOW_PIXMAP
if (have_name_window_pixmap (display))
{
x = cw->attrs.x;
y = cw->attrs.y;
wid = cw->attrs.width + cw->attrs.border_width * 2;
hei = cw->attrs.height + cw->attrs.border_width * 2;
#else
}
else
#endif
{
x = cw->attrs.x + cw->attrs.border_width;
y = cw->attrs.y + cw->attrs.border_width;
wid = cw->attrs.width;
hei = cw->attrs.height;
#endif
}
XFixesSetPictureClipRegion (xdisplay, root_buffer,
0, 0, paint_region);
@ -1135,16 +1157,21 @@ paint_windows (MetaScreen *screen,
{
int x, y, wid, hei;
#ifdef HAVE_NAME_WINDOW_PIXMAP
if (have_name_window_pixmap (display))
{
x = cw->attrs.x;
y = cw->attrs.y;
wid = cw->attrs.width + cw->attrs.border_width * 2;
hei = cw->attrs.height + cw->attrs.border_width * 2;
#else
}
else
#endif
{
x = cw->attrs.x + cw->attrs.border_width;
y = cw->attrs.y + cw->attrs.border_width;
wid = cw->attrs.width;
hei = cw->attrs.height;
#endif
}
XRenderComposite (xdisplay, PictOpOver, cw->picture,
cw->alpha_pict, root_buffer, 0, 0, 0, 0,
@ -1350,6 +1377,8 @@ free_win (MetaCompWindow *cw,
MetaCompScreen *info = cw->screen->compositor_data;
#ifdef HAVE_NAME_WINDOW_PIXMAP
if (have_name_window_pixmap (display))
{
/* See comment in map_win */
if (cw->back_pixmap && destroy)
{
@ -1362,6 +1391,7 @@ free_win (MetaCompWindow *cw,
XFreePixmap (display->xdisplay, cw->shaded_back_pixmap);
cw->shaded_back_pixmap = None;
}
}
#endif
if (cw->picture)
@ -1615,7 +1645,6 @@ add_win (MetaScreen *screen,
if (!XGetWindowAttributes (display->xdisplay, xwindow, &cw->attrs))
{
g_warning ("Could not get attrs");
g_free (cw);
return;
}
@ -1807,6 +1836,8 @@ resize_win (MetaCompWindow *cw,
if (cw->attrs.width != width || cw->attrs.height != height)
{
#ifdef HAVE_NAME_WINDOW_PIXMAP
if (have_name_window_pixmap (display))
{
if (cw->shaded_back_pixmap)
{
XFreePixmap (xdisplay, cw->shaded_back_pixmap);
@ -1828,6 +1859,7 @@ resize_win (MetaCompWindow *cw,
cw->back_pixmap = None;
}
}
}
#endif
if (cw->picture)
{
@ -2271,12 +2303,16 @@ meta_compositor_remove_window (MetaCompositor *compositor,
#ifdef HAVE_COMPOSITE_EXTENSIONS
#endif
}
#ifdef HAVE_COW
static void
show_overlay_window (MetaScreen *screen,
Window cow)
{
MetaDisplay *display = screen->display;
#ifdef HAVE_COW
if (have_cow (display))
{
XserverRegion region;
region = XFixesCreateRegion (display->xdisplay, NULL, 0);
@ -2288,7 +2324,10 @@ show_overlay_window (MetaScreen *screen,
damage_screen (screen);
}
#endif
}
#if 0
static void
hide_overlay_window (MetaScreen *screen,
Window cow)
@ -2302,19 +2341,28 @@ hide_overlay_window (MetaScreen *screen,
0, 0, region);
XFixesDestroyRegion (display->xdisplay, region);
}
#endif
static Window
get_overlay_window (MetaScreen *screen)
get_output_window (MetaScreen *screen)
{
MetaDisplay *display = screen->display;
Window cow;
Window output;
cow = XCompositeGetOverlayWindow (display->xdisplay, screen->xroot);
XSelectInput (display->xdisplay, cow, ExposureMask);
return cow;
#ifdef HAVE_COW
if (have_cow (display))
{
output = XCompositeGetOverlayWindow (display->xdisplay, screen->xroot);
XSelectInput (display->xdisplay, output, ExposureMask);
}
else
#endif
{
output = screen->xroot;
}
return output;
}
void
meta_compositor_manage_screen (MetaCompositor *compositor,
@ -2331,7 +2379,6 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
return;
gdk_error_trap_push ();
/* FIXME: Use correct composite mode */
XCompositeRedirectSubwindows (display->xdisplay, screen->xroot,
CompositeRedirectManual);
XSync (display->xdisplay, FALSE);
@ -2357,11 +2404,7 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
return;
}
#ifdef HAVE_COW
info->output = get_overlay_window (screen);
#else
info->output = screen->xroot;
#endif
info->output = get_output_window (screen);
pa.subwindow_mode = IncludeInferiors;
info->root_picture = XRenderCreatePicture (display->xdisplay, info->output,
@ -2394,12 +2437,9 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
meta_screen_set_cm_selection (screen);
#ifdef HAVE_COW
/* Now we're up and running we can show the output if needed */
show_overlay_window (screen, info->output);
#endif
#endif
}
void
@ -2596,12 +2636,15 @@ meta_compositor_get_window_pixmap (MetaCompositor *compositor,
return None;
#ifdef HAVE_NAME_WINDOW_PIXMAP
if (have_name_window_pixmap (window->display))
{
if (window->shaded)
return cw->shaded_back_pixmap;
else
return cw->back_pixmap;
#else
}
else
#endif
return None;
#endif
#endif
}

View File

@ -752,11 +752,28 @@ meta_display_open (void)
display->composite_event_base = 0;
}
else
{
display->composite_major_version = 0;
display->composite_minor_version = 0;
if (XCompositeQueryVersion (display->xdisplay,
&display->composite_major_version,
&display->composite_minor_version))
{
display->have_composite = TRUE;
}
else
{
display->composite_major_version = 0;
display->composite_minor_version = 0;
}
}
meta_verbose ("Attempted to init Composite, found error base %d event base %d\n",
meta_verbose ("Attempted to init Composite, found error base %d event base %d "
"extn ver %d %d\n",
display->composite_error_base,
display->composite_event_base);
display->composite_event_base,
display->composite_major_version,
display->composite_minor_version);
display->have_damage = FALSE;

View File

@ -357,6 +357,8 @@ struct _MetaDisplay
#ifdef HAVE_COMPOSITE_EXTENSIONS
int composite_event_base;
int composite_error_base;
int composite_major_version;
int composite_minor_version;
int damage_event_base;
int damage_error_base;
int xfixes_event_base;