mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
Misc cleanups, removal of stray printf's etc. Add basic win opacity handling
This commit is contained in:
parent
8fd2f1d22a
commit
c29232fd0d
@ -284,6 +284,8 @@ if test x$have_xcursor = xyes; then
|
|||||||
AC_DEFINE(HAVE_XCURSOR, , [Building with Xcursor support])
|
AC_DEFINE(HAVE_XCURSOR, , [Building with Xcursor support])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
METACITY_PC_MODULES="$METACITY_PC_MODULES clutter-0.7"
|
||||||
|
|
||||||
PKG_CHECK_MODULES(METACITY, $METACITY_PC_MODULES)
|
PKG_CHECK_MODULES(METACITY, $METACITY_PC_MODULES)
|
||||||
|
|
||||||
AC_PATH_XTRA
|
AC_PATH_XTRA
|
||||||
|
@ -16,6 +16,8 @@ metacity_SOURCES= \
|
|||||||
compositor/compositor-private.h \
|
compositor/compositor-private.h \
|
||||||
compositor/compositor-xrender.c \
|
compositor/compositor-xrender.c \
|
||||||
compositor/compositor-xrender.h \
|
compositor/compositor-xrender.h \
|
||||||
|
compositor/compositor-clutter.c \
|
||||||
|
compositor/compositor-clutter.h \
|
||||||
include/compositor.h \
|
include/compositor.h \
|
||||||
core/constraints.c \
|
core/constraints.c \
|
||||||
core/constraints.h \
|
core/constraints.h \
|
||||||
|
@ -91,31 +91,20 @@ typedef struct _MetaCompositorClutter
|
|||||||
Atom atom_net_wm_window_type_splash;
|
Atom atom_net_wm_window_type_splash;
|
||||||
Atom atom_net_wm_window_type_toolbar;
|
Atom atom_net_wm_window_type_toolbar;
|
||||||
|
|
||||||
#ifdef USE_IDLE_REPAINT
|
|
||||||
guint repaint_id;
|
|
||||||
#endif
|
|
||||||
guint enabled : 1;
|
|
||||||
guint show_redraw : 1;
|
guint show_redraw : 1;
|
||||||
guint debug : 1;
|
guint debug : 1;
|
||||||
} MetaCompositorClutter;
|
} MetaCompositorClutter;
|
||||||
|
|
||||||
typedef struct _MetaCompScreen
|
typedef struct _MetaCompScreen
|
||||||
{
|
{
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
|
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
GList *windows;
|
GList *windows;
|
||||||
GHashTable *windows_by_xid;
|
GHashTable *windows_by_xid;
|
||||||
MetaWindow *focus_window;
|
MetaWindow *focus_window;
|
||||||
|
|
||||||
Window output;
|
Window output;
|
||||||
|
|
||||||
XserverRegion all_damage;
|
XserverRegion all_damage;
|
||||||
|
|
||||||
guint overlays;
|
|
||||||
gboolean compositor_active;
|
|
||||||
gboolean clip_changed;
|
|
||||||
|
|
||||||
GSList *dock_windows;
|
GSList *dock_windows;
|
||||||
|
|
||||||
ClutterEffectTemplate *destroy_effect;
|
ClutterEffectTemplate *destroy_effect;
|
||||||
@ -124,33 +113,25 @@ typedef struct _MetaCompScreen
|
|||||||
|
|
||||||
typedef struct _MetaCompWindow
|
typedef struct _MetaCompWindow
|
||||||
{
|
{
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
MetaWindow *window; /* NULL if this window isn't managed by Metacity */
|
MetaWindow *window;
|
||||||
Window id;
|
Window id;
|
||||||
XWindowAttributes attrs;
|
XWindowAttributes attrs;
|
||||||
|
ClutterActor *actor;
|
||||||
|
Pixmap back_pixmap;
|
||||||
|
int mode;
|
||||||
|
|
||||||
ClutterActor *actor;
|
gboolean damaged;
|
||||||
|
gboolean shaped;
|
||||||
Pixmap back_pixmap;
|
|
||||||
|
|
||||||
int mode;
|
|
||||||
|
|
||||||
gboolean damaged;
|
|
||||||
gboolean shaped;
|
|
||||||
|
|
||||||
MetaCompWindowType type;
|
MetaCompWindowType type;
|
||||||
|
|
||||||
Damage damage;
|
Damage damage;
|
||||||
|
|
||||||
gboolean needs_shadow;
|
gboolean needs_shadow;
|
||||||
|
|
||||||
XserverRegion border_size;
|
XserverRegion extents;
|
||||||
XserverRegion extents;
|
|
||||||
|
|
||||||
XserverRegion border_clip;
|
|
||||||
|
|
||||||
gboolean updates_frozen;
|
|
||||||
gboolean update_pending;
|
|
||||||
} MetaCompWindow;
|
} MetaCompWindow;
|
||||||
|
|
||||||
|
|
||||||
@ -172,7 +153,9 @@ find_window_in_display (MetaDisplay *display,
|
|||||||
{
|
{
|
||||||
GSList *index;
|
GSList *index;
|
||||||
|
|
||||||
for (index = meta_display_get_screens (display); index; index = index->next)
|
for (index = meta_display_get_screens (display);
|
||||||
|
index;
|
||||||
|
index = index->next)
|
||||||
{
|
{
|
||||||
MetaCompWindow *cw = find_window_for_screen (index->data, xwindow);
|
MetaCompWindow *cw = find_window_for_screen (index->data, xwindow);
|
||||||
|
|
||||||
@ -244,8 +227,6 @@ get_window_type (MetaDisplay *display,
|
|||||||
cw->type = META_COMP_WINDOW_DOCK;
|
cw->type = META_COMP_WINDOW_DOCK;
|
||||||
else
|
else
|
||||||
cw->type = META_COMP_WINDOW_NORMAL;
|
cw->type = META_COMP_WINDOW_NORMAL;
|
||||||
|
|
||||||
/* meta_verbose ("Window is %d\n", cw->type); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -301,11 +282,10 @@ add_damage (MetaScreen *screen,
|
|||||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
/* dump_xserver_region ("add_damage", display, damage); */
|
|
||||||
|
|
||||||
if (info->all_damage)
|
if (info->all_damage)
|
||||||
{
|
{
|
||||||
XFixesUnionRegion (xdisplay, info->all_damage, info->all_damage, damage);
|
XFixesUnionRegion (xdisplay, info->all_damage,
|
||||||
|
info->all_damage, damage);
|
||||||
XFixesDestroyRegion (xdisplay, damage);
|
XFixesDestroyRegion (xdisplay, damage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -327,18 +307,6 @@ free_win (MetaCompWindow *cw,
|
|||||||
cw->back_pixmap = None;
|
cw->back_pixmap = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cw->border_size)
|
|
||||||
{
|
|
||||||
XFixesDestroyRegion (xdisplay, cw->border_size);
|
|
||||||
cw->border_size = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cw->border_clip)
|
|
||||||
{
|
|
||||||
XFixesDestroyRegion (xdisplay, cw->border_clip);
|
|
||||||
cw->border_clip = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cw->extents)
|
if (cw->extents)
|
||||||
{
|
{
|
||||||
XFixesDestroyRegion (xdisplay, cw->extents);
|
XFixesDestroyRegion (xdisplay, cw->extents);
|
||||||
@ -347,13 +315,14 @@ free_win (MetaCompWindow *cw,
|
|||||||
|
|
||||||
if (destroy)
|
if (destroy)
|
||||||
{
|
{
|
||||||
if (cw->damage != None) {
|
if (cw->damage != None)
|
||||||
meta_error_trap_push (display);
|
{
|
||||||
XDamageDestroy (xdisplay, cw->damage);
|
meta_error_trap_push (display);
|
||||||
meta_error_trap_pop (display, FALSE);
|
XDamageDestroy (xdisplay, cw->damage);
|
||||||
|
meta_error_trap_pop (display, FALSE);
|
||||||
cw->damage = None;
|
|
||||||
}
|
cw->damage = None;
|
||||||
|
}
|
||||||
|
|
||||||
/* The window may not have been added to the list in this case,
|
/* The window may not have been added to the list in this case,
|
||||||
but we can check anyway */
|
but we can check anyway */
|
||||||
@ -366,16 +335,16 @@ free_win (MetaCompWindow *cw,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static void
|
static void
|
||||||
on_destroy_effect_complete (ClutterActor *actor,
|
on_destroy_effect_complete (ClutterActor *actor,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaCompWindow *cw = (MetaCompWindow *)user_data;
|
MetaCompWindow *cw = (MetaCompWindow *)user_data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
free_win (cw, TRUE);
|
free_win (cw, TRUE);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroy_win (MetaDisplay *display,
|
destroy_win (MetaDisplay *display,
|
||||||
@ -391,8 +360,6 @@ destroy_win (MetaDisplay *display,
|
|||||||
if (cw == NULL)
|
if (cw == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("destroy %p\n", cw);
|
|
||||||
|
|
||||||
screen = cw->screen;
|
screen = cw->screen;
|
||||||
|
|
||||||
if (cw->extents != None)
|
if (cw->extents != None)
|
||||||
@ -405,6 +372,8 @@ destroy_win (MetaDisplay *display,
|
|||||||
info->windows = g_list_remove (info->windows, (gconstpointer) cw);
|
info->windows = g_list_remove (info->windows, (gconstpointer) cw);
|
||||||
g_hash_table_remove (info->windows_by_xid, (gpointer) xwindow);
|
g_hash_table_remove (info->windows_by_xid, (gpointer) xwindow);
|
||||||
|
|
||||||
|
free_win (cw, TRUE);
|
||||||
|
#if 0
|
||||||
clutter_actor_show (cw->actor);
|
clutter_actor_show (cw->actor);
|
||||||
clutter_actor_raise_top (cw->actor);
|
clutter_actor_raise_top (cw->actor);
|
||||||
clutter_actor_set_opacity (cw->actor, 0xff);
|
clutter_actor_set_opacity (cw->actor, 0xff);
|
||||||
@ -413,6 +382,7 @@ destroy_win (MetaDisplay *display,
|
|||||||
0,
|
0,
|
||||||
on_destroy_effect_complete,
|
on_destroy_effect_complete,
|
||||||
(gpointer)cw);
|
(gpointer)cw);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -483,9 +453,7 @@ resize_win (MetaCompWindow *cw,
|
|||||||
MetaScreen *screen = cw->screen;
|
MetaScreen *screen = cw->screen;
|
||||||
MetaDisplay *display = meta_screen_get_display (screen);
|
MetaDisplay *display = meta_screen_get_display (screen);
|
||||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
|
||||||
XserverRegion damage;
|
XserverRegion damage;
|
||||||
gboolean debug;
|
|
||||||
|
|
||||||
if (cw->extents)
|
if (cw->extents)
|
||||||
{
|
{
|
||||||
@ -502,8 +470,7 @@ resize_win (MetaCompWindow *cw,
|
|||||||
|
|
||||||
clutter_actor_set_position (cw->actor, x, y);
|
clutter_actor_set_position (cw->actor, x, y);
|
||||||
|
|
||||||
/* Let named pixmap resync sort this */
|
/* Note, let named named pixmap resync actually resize actor */
|
||||||
/* clutter_actor_set_size (cw->actor, width, height); */
|
|
||||||
|
|
||||||
if (cw->attrs.width != width || cw->attrs.height != height)
|
if (cw->attrs.width != width || cw->attrs.height != height)
|
||||||
{
|
{
|
||||||
@ -535,8 +502,6 @@ resize_win (MetaCompWindow *cw,
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_damage (screen, damage);
|
add_damage (screen, damage);
|
||||||
|
|
||||||
info->clip_changed = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -559,8 +524,6 @@ map_win (MetaDisplay *display,
|
|||||||
cw->back_pixmap = None;
|
cw->back_pixmap = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("map %p\n", cw);
|
|
||||||
|
|
||||||
clutter_actor_show (cw->actor);
|
clutter_actor_show (cw->actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,15 +535,12 @@ unmap_win (MetaDisplay *display,
|
|||||||
{
|
{
|
||||||
MetaCompWindow *cw = find_window_for_screen (screen, id);
|
MetaCompWindow *cw = find_window_for_screen (screen, id);
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
||||||
|
|
||||||
if (cw == NULL)
|
if (cw == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("unmap %p\n", cw);
|
|
||||||
|
|
||||||
if (cw->window && cw->window == info->focus_window)
|
if (cw->window && cw->window == info->focus_window)
|
||||||
info->focus_window = NULL;
|
info->focus_window = NULL;
|
||||||
|
|
||||||
@ -594,7 +554,6 @@ unmap_win (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
free_win (cw, FALSE);
|
free_win (cw, FALSE);
|
||||||
info->clip_changed = TRUE;
|
|
||||||
|
|
||||||
clutter_actor_hide (cw->actor);
|
clutter_actor_hide (cw->actor);
|
||||||
}
|
}
|
||||||
@ -644,27 +603,7 @@ add_win (MetaScreen *screen,
|
|||||||
else
|
else
|
||||||
cw->damage = XDamageCreate (xdisplay, xwindow, XDamageReportNonEmpty);
|
cw->damage = XDamageCreate (xdisplay, xwindow, XDamageReportNonEmpty);
|
||||||
|
|
||||||
#if 0
|
|
||||||
cw->alpha_pict = None;
|
|
||||||
cw->shadow_pict = None;
|
|
||||||
cw->border_size = None;
|
|
||||||
cw->extents = None;
|
cw->extents = None;
|
||||||
cw->shadow = None;
|
|
||||||
cw->shadow_dx = 0;
|
|
||||||
cw->shadow_dy = 0;
|
|
||||||
cw->shadow_width = 0;
|
|
||||||
cw->shadow_height = 0;
|
|
||||||
|
|
||||||
if (window && meta_window_has_focus (window))
|
|
||||||
cw->shadow_type = META_SHADOW_LARGE;
|
|
||||||
else
|
|
||||||
cw->shadow_type = META_SHADOW_MEDIUM;
|
|
||||||
|
|
||||||
cw->opacity = OPAQUE;
|
|
||||||
|
|
||||||
cw->border_clip = None;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Only add the window to the list of docks if it needs a shadow */
|
/* Only add the window to the list of docks if it needs a shadow */
|
||||||
if (cw->type == META_COMP_WINDOW_DOCK)
|
if (cw->type == META_COMP_WINDOW_DOCK)
|
||||||
@ -678,30 +617,43 @@ add_win (MetaScreen *screen,
|
|||||||
info->windows = g_list_prepend (info->windows, cw);
|
info->windows = g_list_prepend (info->windows, cw);
|
||||||
g_hash_table_insert (info->windows_by_xid, (gpointer) xwindow, cw);
|
g_hash_table_insert (info->windows_by_xid, (gpointer) xwindow, cw);
|
||||||
|
|
||||||
#if 0
|
|
||||||
cw->back_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
|
|
||||||
cw->actor = clutter_glx_texture_pixmap_new_with_pixmap (cw->back_pixmap);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cw->actor = clutter_glx_texture_pixmap_new ();
|
cw->actor = clutter_glx_texture_pixmap_new ();
|
||||||
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (info->stage), cw->actor);
|
clutter_container_add_actor (CLUTTER_CONTAINER (info->stage), cw->actor);
|
||||||
|
|
||||||
clutter_actor_set_position (cw->actor, cw->attrs.x, cw->attrs.y);
|
clutter_actor_set_position (cw->actor, cw->attrs.x, cw->attrs.y);
|
||||||
|
|
||||||
clutter_actor_hide (cw->actor);
|
clutter_actor_hide (cw->actor);
|
||||||
|
|
||||||
if (cw->attrs.map_state == IsViewable)
|
if (cw->attrs.map_state == IsViewable)
|
||||||
map_win (display, screen, xwindow);
|
map_win (display, screen, xwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
damage_screen (MetaScreen *screen)
|
||||||
|
{
|
||||||
|
MetaDisplay *display = meta_screen_get_display (screen);
|
||||||
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||||
|
XserverRegion region;
|
||||||
|
int width, height;
|
||||||
|
XRectangle r;
|
||||||
|
|
||||||
|
r.x = 0;
|
||||||
|
r.y = 0;
|
||||||
|
meta_screen_get_size (screen, &width, &height);
|
||||||
|
r.width = width;
|
||||||
|
r.height = height;
|
||||||
|
|
||||||
|
region = XFixesCreateRegion (xdisplay, &r, 1);
|
||||||
|
|
||||||
|
add_damage (screen, region);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
repair_win (MetaCompWindow *cw)
|
repair_win (MetaCompWindow *cw)
|
||||||
{
|
{
|
||||||
MetaScreen *screen = cw->screen;
|
MetaScreen *screen = cw->screen;
|
||||||
MetaDisplay *display = meta_screen_get_display (screen);
|
MetaDisplay *display = meta_screen_get_display (screen);
|
||||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||||
// XserverRegion parts;
|
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
if (cw->id == meta_screen_get_xroot (screen)
|
if (cw->id == meta_screen_get_xroot (screen)
|
||||||
@ -718,12 +670,13 @@ repair_win (MetaCompWindow *cw)
|
|||||||
|
|
||||||
if (cw->back_pixmap == None)
|
if (cw->back_pixmap == None)
|
||||||
{
|
{
|
||||||
printf("dammit no valid pixmap\n");
|
meta_verbose ("Unable to get named pixmap for %p\n", cw);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_x11_texture_pixmap_set_pixmap (CLUTTER_X11_TEXTURE_PIXMAP (cw->actor),
|
clutter_x11_texture_pixmap_set_pixmap
|
||||||
cw->back_pixmap);
|
(CLUTTER_X11_TEXTURE_PIXMAP (cw->actor),
|
||||||
|
cw->back_pixmap);
|
||||||
|
|
||||||
g_object_get (cw->actor,
|
g_object_get (cw->actor,
|
||||||
"pixmap-width", &pxm_width,
|
"pixmap-width", &pxm_width,
|
||||||
@ -731,7 +684,6 @@ repair_win (MetaCompWindow *cw)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
clutter_actor_set_size (cw->actor, pxm_width, pxm_height);
|
clutter_actor_set_size (cw->actor, pxm_width, pxm_height);
|
||||||
|
|
||||||
clutter_actor_show (cw->actor);
|
clutter_actor_show (cw->actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,45 +701,38 @@ repair_win (MetaCompWindow *cw)
|
|||||||
parts = XFixesCreateRegion (xdisplay, 0, 0);
|
parts = XFixesCreateRegion (xdisplay, 0, 0);
|
||||||
XDamageSubtract (xdisplay, cw->damage, None, parts);
|
XDamageSubtract (xdisplay, cw->damage, None, parts);
|
||||||
|
|
||||||
#if 0
|
if (1) /*clutter_glx_texture_pixmap_using_extension
|
||||||
r_damage = XFixesFetchRegionAndBounds (xdisplay,
|
(CLUTTER_GLX_TEXTURE_PIXMAP (cw->actor)))*/
|
||||||
parts,
|
|
||||||
&r_count,
|
|
||||||
&r_bounds);
|
|
||||||
|
|
||||||
if (r_damage)
|
|
||||||
{
|
{
|
||||||
for (i = 0; i < r_count; ++i)
|
clutter_x11_texture_pixmap_update_area
|
||||||
|
(CLUTTER_X11_TEXTURE_PIXMAP (cw->actor),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
clutter_actor_get_width (cw->actor),
|
||||||
|
clutter_actor_get_height (cw->actor));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r_damage = XFixesFetchRegionAndBounds (xdisplay,
|
||||||
|
parts,
|
||||||
|
&r_count,
|
||||||
|
&r_bounds);
|
||||||
|
|
||||||
|
if (r_damage)
|
||||||
{
|
{
|
||||||
// ClutterGeometry geom;
|
for (i = 0; i < r_count; ++i)
|
||||||
|
{
|
||||||
clutter_x11_texture_pixmap_update_area
|
clutter_x11_texture_pixmap_update_area
|
||||||
(CLUTTER_X11_TEXTURE_PIXMAP (cw->actor),
|
(CLUTTER_X11_TEXTURE_PIXMAP (cw->actor),
|
||||||
r_damage[i].x,
|
r_damage[i].x,
|
||||||
r_damage[i].y,
|
r_damage[i].y,
|
||||||
r_damage[i].width,
|
r_damage[i].width,
|
||||||
r_damage[i].height);
|
r_damage[i].height);
|
||||||
|
}
|
||||||
/*
|
|
||||||
geom.x = clutter_actor_get_x (cw->actor) + r_damage[i].x;
|
|
||||||
geom.y = clutter_actor_get_y (cw->actor) + r_damage[i].y;
|
|
||||||
geom.width = r_damage[i].width;
|
|
||||||
geom.height = r_damage[i].height;
|
|
||||||
|
|
||||||
clutter_stage_queue_redraw_area (info->stage, &geom);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
XFree (r_damage);
|
||||||
XFree (r_damage);
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
clutter_x11_texture_pixmap_update_area
|
|
||||||
(CLUTTER_GLX_TEXTURE_PIXMAP (cw->actor),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
clutter_actor_get_width (cw->actor),
|
|
||||||
clutter_actor_get_height (cw->actor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_error_trap_pop (display, FALSE);
|
meta_error_trap_pop (display, FALSE);
|
||||||
@ -851,7 +796,6 @@ process_configure_notify (MetaCompositorClutter *compositor,
|
|||||||
XConfigureEvent *event)
|
XConfigureEvent *event)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = compositor->display;
|
MetaDisplay *display = compositor->display;
|
||||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
||||||
MetaCompWindow *cw = find_window_in_display (display, event->window);
|
MetaCompWindow *cw = find_window_in_display (display, event->window);
|
||||||
|
|
||||||
if (cw)
|
if (cw)
|
||||||
@ -872,15 +816,8 @@ process_configure_notify (MetaCompositorClutter *compositor,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
info = meta_screen_get_compositor_data (screen);
|
info = meta_screen_get_compositor_data (screen);
|
||||||
/*
|
|
||||||
if (info->root_buffer)
|
|
||||||
{
|
|
||||||
XRenderFreePicture (xdisplay, info->root_buffer);
|
|
||||||
info->root_buffer = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
damage_screen (screen);
|
damage_screen (screen);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -910,7 +847,6 @@ process_circulate_notify (MetaCompositorClutter *compositor,
|
|||||||
above = None;
|
above = None;
|
||||||
restack_win (cw, above);
|
restack_win (cw, above);
|
||||||
|
|
||||||
info->clip_changed = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -971,7 +907,6 @@ process_unmap (MetaCompositorClutter *compositor,
|
|||||||
/* Ignore unmap caused by parent's resize */
|
/* Ignore unmap caused by parent's resize */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cw = find_window_in_display (compositor->display, event->window);
|
cw = find_window_in_display (compositor->display, event->window);
|
||||||
if (cw)
|
if (cw)
|
||||||
@ -989,7 +924,79 @@ process_map (MetaCompositorClutter *compositor,
|
|||||||
map_win (compositor->display, cw->screen, event->window);
|
map_win (compositor->display, cw->screen, event->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
process_property_notify (MetaCompositorClutter *compositor,
|
||||||
|
XPropertyEvent *event)
|
||||||
|
{
|
||||||
|
MetaDisplay *display = compositor->display;
|
||||||
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||||
|
MetaScreen *screen;
|
||||||
|
int p;
|
||||||
|
Atom background_atoms[2];
|
||||||
|
|
||||||
|
/* Check for the background property changing */
|
||||||
|
background_atoms[0] = compositor->atom_x_root_pixmap;
|
||||||
|
background_atoms[1] = compositor->atom_x_set_root;
|
||||||
|
|
||||||
|
for (p = 0; p < 2; p++)
|
||||||
|
{
|
||||||
|
if (event->atom == background_atoms[p])
|
||||||
|
{
|
||||||
|
screen = meta_display_screen_for_root (display, event->window);
|
||||||
|
|
||||||
|
if (screen)
|
||||||
|
{
|
||||||
|
damage_screen (screen);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for the opacity changing */
|
||||||
|
if (event->atom == compositor->atom_net_wm_window_opacity)
|
||||||
|
{
|
||||||
|
MetaCompWindow *cw = find_window_in_display (display, event->window);
|
||||||
|
gulong value;
|
||||||
|
|
||||||
|
if (!cw)
|
||||||
|
{
|
||||||
|
/* Applications can set this for their toplevel windows, so
|
||||||
|
* this must be propagated to the window managed by the compositor
|
||||||
|
*/
|
||||||
|
cw = find_window_for_child_window_in_display (display,
|
||||||
|
event->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cw)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (meta_prop_get_cardinal (display, event->window,
|
||||||
|
compositor->atom_net_wm_window_opacity,
|
||||||
|
&value) == FALSE)
|
||||||
|
value = 0xffffffff;
|
||||||
|
|
||||||
|
clutter_actor_set_opacity (cw->actor, 200); /* FIXME */
|
||||||
|
|
||||||
|
if (cw->extents)
|
||||||
|
XFixesDestroyRegion (xdisplay, cw->extents);
|
||||||
|
cw->extents = win_extents (cw);
|
||||||
|
|
||||||
|
cw->damaged = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event->atom == compositor->atom_net_wm_window_type)
|
||||||
|
{
|
||||||
|
MetaCompWindow *cw = find_window_in_display (display, event->window);
|
||||||
|
|
||||||
|
if (!cw)
|
||||||
|
return;
|
||||||
|
|
||||||
|
get_window_type (display, cw);
|
||||||
|
//cw->needs_shadow = window_has_shadow (cw);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_overlay_window (MetaScreen *screen,
|
show_overlay_window (MetaScreen *screen,
|
||||||
@ -997,22 +1004,16 @@ show_overlay_window (MetaScreen *screen,
|
|||||||
{
|
{
|
||||||
MetaDisplay *display = meta_screen_get_display (screen);
|
MetaDisplay *display = meta_screen_get_display (screen);
|
||||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||||
|
XserverRegion region;
|
||||||
|
|
||||||
#ifdef HAVE_COW
|
region = XFixesCreateRegion (xdisplay, NULL, 0);
|
||||||
if (have_cow (display))
|
|
||||||
{
|
|
||||||
XserverRegion region;
|
|
||||||
|
|
||||||
region = XFixesCreateRegion (xdisplay, NULL, 0);
|
|
||||||
|
|
||||||
XFixesSetWindowShapeRegion (xdisplay, cow, ShapeBounding, 0, 0, 0);
|
XFixesSetWindowShapeRegion (xdisplay, cow, ShapeBounding, 0, 0, 0);
|
||||||
XFixesSetWindowShapeRegion (xdisplay, cow, ShapeInput, 0, 0, region);
|
XFixesSetWindowShapeRegion (xdisplay, cow, ShapeInput, 0, 0, region);
|
||||||
|
|
||||||
XFixesDestroyRegion (xdisplay, region);
|
XFixesDestroyRegion (xdisplay, region);
|
||||||
|
|
||||||
//damage_screen (screen);
|
damage_screen (screen);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Window
|
static Window
|
||||||
@ -1024,17 +1025,8 @@ get_output_window (MetaScreen *screen)
|
|||||||
|
|
||||||
xroot = meta_screen_get_xroot (screen);
|
xroot = meta_screen_get_xroot (screen);
|
||||||
|
|
||||||
#ifdef HAVE_COW
|
output = XCompositeGetOverlayWindow (xdisplay, xroot);
|
||||||
if (have_cow (display))
|
XSelectInput (xdisplay, output, ExposureMask);
|
||||||
{
|
|
||||||
output = XCompositeGetOverlayWindow (xdisplay, xroot);
|
|
||||||
XSelectInput (xdisplay, output, ExposureMask);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
output = xroot;
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
@ -1075,16 +1067,11 @@ clutter_cmp_manage_screen (MetaCompositor *compositor,
|
|||||||
info->output = get_output_window (screen);
|
info->output = get_output_window (screen);
|
||||||
|
|
||||||
info->all_damage = None;
|
info->all_damage = None;
|
||||||
|
|
||||||
info->windows = NULL;
|
info->windows = NULL;
|
||||||
info->windows_by_xid = g_hash_table_new (g_direct_hash, g_direct_equal);
|
info->windows_by_xid = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||||
|
|
||||||
info->focus_window = meta_display_get_focus_window (display);
|
info->focus_window = meta_display_get_focus_window (display);
|
||||||
|
|
||||||
info->compositor_active = TRUE;
|
|
||||||
info->overlays = 0;
|
|
||||||
info->clip_changed = TRUE;
|
|
||||||
|
|
||||||
XClearArea (xdisplay, info->output, 0, 0, 0, 0, TRUE);
|
XClearArea (xdisplay, info->output, 0, 0, 0, 0, TRUE);
|
||||||
|
|
||||||
meta_screen_set_cm_selection (screen);
|
meta_screen_set_cm_selection (screen);
|
||||||
@ -1106,8 +1093,6 @@ clutter_cmp_manage_screen (MetaCompositor *compositor,
|
|||||||
info->destroy_effect
|
info->destroy_effect
|
||||||
= clutter_effect_template_new (clutter_timeline_new_for_duration (2000),
|
= clutter_effect_template_new (clutter_timeline_new_for_duration (2000),
|
||||||
CLUTTER_ALPHA_SINE_INC);
|
CLUTTER_ALPHA_SINE_INC);
|
||||||
|
|
||||||
printf("managing screen\n");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,7 +1164,7 @@ clutter_cmp_process_event (MetaCompositor *compositor,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
// process_property_notify (xrc, (XPropertyEvent *) event);
|
process_property_notify (xrc, (XPropertyEvent *) event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Expose:
|
case Expose:
|
||||||
@ -1213,10 +1198,7 @@ clutter_cmp_process_event (MetaCompositor *compositor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* else if (event->type == meta_display_get_shape_event_base (xrc->display) + ShapeNotify)
|
||||||
if (event->type == meta_display_get_damage_event_base (xrc->display) + XDamageNotify)
|
|
||||||
process_damage (xrc, (XDamageNotifyEvent *) event);
|
|
||||||
else if (event->type == meta_display_get_shape_event_base (xrc->display) + ShapeNotify)
|
|
||||||
process_shape (xrc, (XShapeEvent *) event);
|
process_shape (xrc, (XShapeEvent *) event);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1290,6 +1272,9 @@ meta_compositor_clutter_new (MetaDisplay *display)
|
|||||||
MetaCompositor *compositor;
|
MetaCompositor *compositor;
|
||||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||||
|
|
||||||
|
if (!composite_at_least_version (display, 0, 3))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
clc = g_new (MetaCompositorClutter, 1);
|
clc = g_new (MetaCompositorClutter, 1);
|
||||||
clc->compositor = comp_info;
|
clc->compositor = comp_info;
|
||||||
|
|
||||||
@ -1297,8 +1282,6 @@ meta_compositor_clutter_new (MetaDisplay *display)
|
|||||||
clutter_x11_disable_event_retrieval ();
|
clutter_x11_disable_event_retrieval ();
|
||||||
clutter_init (NULL, NULL);
|
clutter_init (NULL, NULL);
|
||||||
|
|
||||||
printf("clutter initiated\n");
|
|
||||||
|
|
||||||
compositor = (MetaCompositor *) clc;
|
compositor = (MetaCompositor *) clc;
|
||||||
|
|
||||||
clc->display = display;
|
clc->display = display;
|
||||||
@ -1321,13 +1304,6 @@ meta_compositor_clutter_new (MetaDisplay *display)
|
|||||||
clc->atom_net_wm_window_type_splash = atoms[11];
|
clc->atom_net_wm_window_type_splash = atoms[11];
|
||||||
clc->atom_net_wm_window_type_toolbar = atoms[12];
|
clc->atom_net_wm_window_type_toolbar = atoms[12];
|
||||||
|
|
||||||
#ifdef USE_IDLE_REPAINT
|
|
||||||
meta_verbose ("Using idle repaint\n");
|
|
||||||
clc->repaint_id = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
clc->enabled = TRUE;
|
|
||||||
|
|
||||||
return compositor;
|
return compositor;
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -22,13 +22,15 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "compositor-private.h"
|
#include "compositor-private.h"
|
||||||
#include "compositor-xrender.h"
|
#include "compositor-xrender.h"
|
||||||
|
#include "compositor-clutter.h"
|
||||||
|
|
||||||
MetaCompositor *
|
MetaCompositor *
|
||||||
meta_compositor_new (MetaDisplay *display)
|
meta_compositor_new (MetaDisplay *display)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
/* At some point we would have a way to select between backends */
|
/* At some point we would have a way to select between backends */
|
||||||
return meta_compositor_xrender_new (display);
|
/* return meta_compositor_xrender_new (display); */
|
||||||
|
return meta_compositor_clutter_new (display);
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -719,7 +719,7 @@ meta_display_open (void)
|
|||||||
/* We don't composite the windows here because they will be composited
|
/* We don't composite the windows here because they will be composited
|
||||||
faster with the call to meta_screen_manage_all_windows further down
|
faster with the call to meta_screen_manage_all_windows further down
|
||||||
the code */
|
the code */
|
||||||
if (meta_prefs_get_compositing_manager ())
|
if (1) /* meta_prefs_get_compositing_manager ()) FIXME */
|
||||||
enable_compositor (the_display, FALSE);
|
enable_compositor (the_display, FALSE);
|
||||||
|
|
||||||
meta_display_grab (the_display);
|
meta_display_grab (the_display);
|
||||||
|
Loading…
Reference in New Issue
Block a user