summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2015-01-22 16:29:53 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2015-01-22 16:29:53 +0200
commitb0c0accbf21cae3d42eefc5ea52509b70a7f7d56 (patch)
tree9591be10584797a70f40d54394f6c07928ab38cc
parent43250740ab2a56991744a1525bad2930d7541595 (diff)
downloadmetacity-b0c0accbf21cae3d42eefc5ea52509b70a7f7d56.tar.gz
bump xcomposite required version to 0.3 and simplify code
Version 0.3 is available more then 8 years.
-rw-r--r--configure.ac2
-rw-r--r--src/compositor/compositor-xrender.c199
-rw-r--r--src/core/display-private.h2
-rw-r--r--src/core/display.c28
-rw-r--r--src/include/display.h3
5 files changed, 59 insertions, 175 deletions
diff --git a/configure.ac b/configure.ac
index a5c9315d..bacf0711 100644
--- a/configure.ac
+++ b/configure.ac
@@ -218,7 +218,7 @@ fi
## or the render-specific check later
have_xrender=no
-XCOMPOSITE_VERSION=0.2
+XCOMPOSITE_VERSION=0.3
if test x$enable_compositor = xyes; then
have_xcomposite=yes
elif test x$enable_compositor = xauto; then
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index a86e4e84..213e4f84 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -48,39 +48,8 @@
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xrender.h>
-#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2
-#define HAVE_NAME_WINDOW_PIXMAP 1
-#endif
-
-#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 3
-#define HAVE_COW 1
-#else
-/* Don't have a cow man...HAAHAAHAA */
-#endif
-
#define USE_IDLE_REPAINT 1
-#ifdef HAVE_COMPOSITE_EXTENSIONS
-static inline gboolean
-composite_at_least_version (MetaDisplay *display,
- int maj, int min)
-{
- static int major = -1;
- static int minor = -1;
-
- if (major == -1)
- meta_display_get_compositor_version (display, &major, &minor);
-
- return (major > maj || (major == maj && minor >= min));
-}
-
-#define have_name_window_pixmap(display) \
- composite_at_least_version (display, 0, 2)
-#define have_cow(display) \
- composite_at_least_version (display, 0, 3)
-
-#endif
-
typedef enum _MetaCompWindowType
{
META_COMP_WINDOW_NORMAL,
@@ -178,7 +147,6 @@ typedef struct _MetaCompWindow
Window id;
XWindowAttributes attrs;
-#ifdef HAVE_NAME_WINDOW_PIXMAP
Pixmap back_pixmap;
/* When the window is shaded back_pixmap will be replaced with the pixmap
@@ -186,7 +154,6 @@ typedef struct _MetaCompWindow
so that we can still see what the window looked like when it is needed
for the _get_window_pixmap function */
Pixmap shaded_back_pixmap;
-#endif
int mode;
@@ -1179,16 +1146,11 @@ 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 (xdisplay, cw->id);
+ if (cw->back_pixmap == None)
+ cw->back_pixmap = XCompositeNameWindowPixmap (xdisplay, cw->id);
- if (cw->back_pixmap != None)
- draw = cw->back_pixmap;
- }
-#endif
+ if (cw->back_pixmap != None)
+ draw = cw->back_pixmap;
format = get_window_format (cw);
if (format)
@@ -1343,22 +1305,10 @@ 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
-#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;
- }
+ 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;
XFixesSetPictureClipRegion (xdisplay, root_buffer,
0, 0, paint_region);
@@ -1434,22 +1384,11 @@ paint_windows (MetaScreen *screen,
if (cw->mode == WINDOW_ARGB)
{
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
-#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;
- }
+
+ 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;
XRenderComposite (xdisplay, PictOpOver, cw->picture,
cw->alpha_pict, root_buffer, 0, 0, 0, 0,
@@ -1661,23 +1600,18 @@ free_win (MetaCompWindow *cw,
Display *xdisplay = meta_display_get_xdisplay (display);
MetaCompScreen *info = meta_screen_get_compositor_data (cw->screen);
-#ifdef HAVE_NAME_WINDOW_PIXMAP
- if (have_name_window_pixmap (display))
+ /* See comment in map_win */
+ if (cw->back_pixmap && destroy)
{
- /* See comment in map_win */
- if (cw->back_pixmap && destroy)
- {
- XFreePixmap (xdisplay, cw->back_pixmap);
- cw->back_pixmap = None;
- }
+ XFreePixmap (xdisplay, cw->back_pixmap);
+ cw->back_pixmap = None;
+ }
- if (cw->shaded_back_pixmap && destroy)
- {
- XFreePixmap (xdisplay, cw->shaded_back_pixmap);
- cw->shaded_back_pixmap = None;
- }
+ if (cw->shaded_back_pixmap && destroy)
+ {
+ XFreePixmap (xdisplay, cw->shaded_back_pixmap);
+ cw->shaded_back_pixmap = None;
}
-#endif
if (cw->picture)
{
@@ -1751,7 +1685,6 @@ map_win (MetaDisplay *display,
if (cw == NULL)
return;
-#ifdef HAVE_NAME_WINDOW_PIXMAP
/* The reason we deallocate this here and not in unmap
is so that we will still have a valid pixmap for
whenever the window is unmapped */
@@ -1766,7 +1699,6 @@ map_win (MetaDisplay *display,
XFreePixmap (xdisplay, cw->shaded_back_pixmap);
cw->shaded_back_pixmap = None;
}
-#endif
cw->attrs.map_state = IsViewable;
cw->damaged = FALSE;
@@ -1960,11 +1892,8 @@ add_win (MetaScreen *screen,
XSelectInput (xdisplay, xwindow, event_mask);
-
-#ifdef HAVE_NAME_WINDOW_PIXMAP
cw->back_pixmap = None;
cw->shaded_back_pixmap = None;
-#endif
cw->damaged = FALSE;
cw->shaped = is_shaped (display, xwindow);
@@ -2146,32 +2075,28 @@ 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);
+ cw->shaded_back_pixmap = None;
+ }
+
+ if (cw->back_pixmap)
{
- if (cw->shaded_back_pixmap)
+ /* If the window is shaded, we store the old backing pixmap
+ so we can return a proper image of the window */
+ if (cw->window && meta_window_is_shaded (cw->window))
{
- XFreePixmap (xdisplay, cw->shaded_back_pixmap);
- cw->shaded_back_pixmap = None;
+ cw->shaded_back_pixmap = cw->back_pixmap;
+ cw->back_pixmap = None;
}
-
- if (cw->back_pixmap)
+ else
{
- /* If the window is shaded, we store the old backing pixmap
- so we can return a proper image of the window */
- if (cw->window && meta_window_is_shaded (cw->window))
- {
- cw->shaded_back_pixmap = cw->back_pixmap;
- cw->back_pixmap = None;
- }
- else
- {
- XFreePixmap (xdisplay, cw->back_pixmap);
- cw->back_pixmap = None;
- }
+ XFreePixmap (xdisplay, cw->back_pixmap);
+ cw->back_pixmap = None;
}
}
-#endif
+
if (cw->picture)
{
XRenderFreePicture (xdisplay, cw->picture);
@@ -2608,29 +2533,22 @@ show_overlay_window (MetaScreen *screen,
{
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
+ XserverRegion region;
-#ifdef HAVE_COW
- if (have_cow (display))
- {
- XserverRegion region;
-
- region = XFixesCreateRegion (xdisplay, NULL, 0);
+ region = XFixesCreateRegion (xdisplay, NULL, 0);
- XFixesSetWindowShapeRegion (xdisplay, cow, ShapeBounding, 0, 0, 0);
- XFixesSetWindowShapeRegion (xdisplay, cow, ShapeInput, 0, 0, region);
+ XFixesSetWindowShapeRegion (xdisplay, cow, ShapeBounding, 0, 0, 0);
+ XFixesSetWindowShapeRegion (xdisplay, cow, ShapeInput, 0, 0, region);
- XFixesDestroyRegion (xdisplay, region);
+ XFixesDestroyRegion (xdisplay, region);
- damage_screen (screen);
- }
-#endif
+ damage_screen (screen);
}
static void
hide_overlay_window (MetaScreen *screen,
Window cow)
{
-#ifdef HAVE_COW
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
XserverRegion region;
@@ -2638,7 +2556,6 @@ hide_overlay_window (MetaScreen *screen,
region = XFixesCreateRegion (xdisplay, NULL, 0);
XFixesSetWindowShapeRegion (xdisplay, cow, ShapeBounding, 0, 0, region);
XFixesDestroyRegion (xdisplay, region);
-#endif
}
static Window
@@ -2650,17 +2567,8 @@ get_output_window (MetaScreen *screen)
xroot = meta_screen_get_xroot (screen);
-#ifdef HAVE_COW
- if (have_cow (display))
- {
- output = XCompositeGetOverlayWindow (xdisplay, xroot);
- XSelectInput (xdisplay, output, ExposureMask);
- }
- else
-#endif
- {
- output = xroot;
- }
+ output = XCompositeGetOverlayWindow (xdisplay, xroot);
+ XSelectInput (xdisplay, output, ExposureMask);
return output;
}
@@ -2797,9 +2705,7 @@ xrender_unmanage_screen (MetaCompositor *compositor,
CompositeRedirectManual);
meta_screen_unset_cm_selection (screen);
-#ifdef HAVE_COW
XCompositeReleaseOverlayWindow (xdisplay, info->output);
-#endif
g_free (info);
@@ -2965,17 +2871,10 @@ xrender_get_window_pixmap (MetaCompositor *compositor,
if (cw == NULL)
return None;
-#ifdef HAVE_NAME_WINDOW_PIXMAP
- if (have_name_window_pixmap (meta_window_get_display (window)))
- {
- if (meta_window_is_shaded (window))
- return cw->shaded_back_pixmap;
- else
- return cw->back_pixmap;
- }
+ if (meta_window_is_shaded (window))
+ return cw->shaded_back_pixmap;
else
-#endif
- return None;
+ return cw->back_pixmap;
#endif
}
diff --git a/src/core/display-private.h b/src/core/display-private.h
index a723be77..2c7e7039 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -271,8 +271,6 @@ 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;
diff --git a/src/core/display.c b/src/core/display.c
index 368a1650..6db6674f 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -549,6 +549,9 @@ meta_display_open (void)
#ifdef HAVE_COMPOSITE_EXTENSIONS
{
+ int composite_major_version = 0;
+ int composite_minor_version = 0;
+
the_display->have_composite = FALSE;
the_display->composite_error_base = 0;
@@ -563,18 +566,16 @@ meta_display_open (void)
}
else
{
- the_display->composite_major_version = 0;
- the_display->composite_minor_version = 0;
if (XCompositeQueryVersion (the_display->xdisplay,
- &the_display->composite_major_version,
- &the_display->composite_minor_version))
+ &composite_major_version,
+ &composite_minor_version))
{
the_display->have_composite = TRUE;
}
else
{
- the_display->composite_major_version = 0;
- the_display->composite_minor_version = 0;
+ composite_major_version = 0;
+ composite_minor_version = 0;
}
}
@@ -582,8 +583,8 @@ meta_display_open (void)
"extn ver %d %d\n",
the_display->composite_error_base,
the_display->composite_event_base,
- the_display->composite_major_version,
- the_display->composite_minor_version);
+ composite_major_version,
+ composite_minor_version);
the_display->have_damage = FALSE;
@@ -5140,17 +5141,6 @@ meta_display_remove_autoraise_callback (MetaDisplay *display)
}
}
-#ifdef HAVE_COMPOSITE_EXTENSIONS
-void
-meta_display_get_compositor_version (MetaDisplay *display,
- int *major,
- int *minor)
-{
- *major = display->composite_major_version;
- *minor = display->composite_minor_version;
-}
-#endif
-
Display *
meta_display_get_xdisplay (MetaDisplay *display)
{
diff --git a/src/include/display.h b/src/include/display.h
index 4b1270bb..9a0ee0a3 100644
--- a/src/include/display.h
+++ b/src/include/display.h
@@ -27,9 +27,6 @@
#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
-void meta_display_get_compositor_version (MetaDisplay *display,
- int *major,
- int *minor);
Display *meta_display_get_xdisplay (MetaDisplay *display);
MetaCompositor *meta_display_get_compositor (MetaDisplay *display);
GSList *meta_display_get_screens (MetaDisplay *display);