1
0
Fork 0
Commit graph

328 commits

Author SHA1 Message Date
Owen W. Taylor
3f9c375f1c MetaRegionIterator: avoid reading off end of rectangles array
Fix an off-by-one error in the check for "can we peek ahead to the next
rectangle".

https://bugzilla.gnome.org/show_bug.cgi?id=636491
2010-12-06 12:00:30 -05:00
Dan Williams
5397335ae8 Fix builds with clutter < 1.5.2 2010-11-22 22:00:02 -06:00
Adel Gadllah
1394c566eb [MetaWindowActor] Fix crash in shadow shape creation
Protect against shape_region or bounding_region being NULL in check_needs_shadow.

This can happen for short lived windows and result into a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=635421
2010-11-21 19:57:42 +01:00
Owen W. Taylor
8817e68926 Use COGL_MATERIAL_WRAP_MODE_* defines not COGL_PIPELINE_*
Since we aren't depending on Clutter 1.5 or using the new
CoglPipeline name elsewhere, we need to stick to the old
COGL_MATERIAL_WRAP_MODE_* names, which are provided with
compatibility defines in Clutter 1.4.

Pointed out by Rico Tzschichholz
2010-11-19 14:41:44 -05:00
Owen W. Taylor
6260814285 Turn off background repeats for a full-size image
If we have repeats on for a full-sized image, then if the background
is displayed scaled (for example, in a desktop preview mode) then we
can get artifacts along the edge of the background where the repeat
of the opposite edge is blended in by bilinear scaling. So turn off
repeats when the screen and background image sizes match.

https://bugzilla.gnome.org/show_bug.cgi?id=634833
2010-11-18 13:58:37 -05:00
Owen W. Taylor
07e6c5aac2 Draw the root window background
Add code to track and draw the root window background. The advantage of doing
it here as compared to in a plugin is that we can use the visiblity smarts
of MetaWindowGroup to optimize out drawing the background when obscured.

If handling other than tracking the _XROOTPMAP_ID property is desired in the
future, more functionality like setting the background from a file or doing
cross-fades can be added.

The new background actor is exposed to plugins via meta_plugin_get_background_actor()
similar to other exposed actors to allow cloning the background for use in
other displays. The actual class is not installed for public consumption at
the moment since it has no useful methods.

https://bugzilla.gnome.org/show_bug.cgi?id=634833
2010-11-18 13:58:37 -05:00
Owen W. Taylor
0477a3066d Refactor "texture material" creation from MetaShadowFactory
Create new cogl-utils.[ch] and move a helper function from
MetaShadowFactory there as meta_create_texture_material(); this
allows us to create single-layer materials from different parts of
Mutter and have them share the same template material.

Also expose a function for creating a 1x1 texture of a given
color meta_create_color_texture_4ub().

https://bugzilla.gnome.org/show_bug.cgi?id=634833
2010-11-18 13:58:37 -05:00
Owen W. Taylor
59639909b1 MetaWindowGroup: further optimize paints by using current scissor
When in a partial stage paint, we can combine that with the visibility
information in MetaWindowGroup to further eliminate unneeded drawing.

Since there is no current Clutter API to access the current clip,
drop to using GL directly.

https://bugzilla.gnome.org/show_bug.cgi?id=634779
2010-11-18 13:58:36 -05:00
Adel Gadllah
64c37852b1 meta-actor-window: Use G_UNLIKELY for TFP check
This is just a microptimization, as we pretty much always use
TFP (and do the check every time we set a pixmap),
we can let gcc generate better code here.

https://bugzilla.gnome.org/show_bug.cgi?id=633002
2010-11-18 18:51:04 +01:00
Owen W. Taylor
bac668d287 Optimize out restacks that don't change actor order
For various reasons (mostly the stack tracker correctly predicting the
stacking order before getting events, but also because of the processing
that the compositor does to get the actor stacking order) the compositor
can be told to sync the stack when it has nothing to do. Detect this
at the last moment before actually telling Clutter to restack to avoid
triggering unnecessary redraws.

https://bugzilla.gnome.org/show_bug.cgi?id=634771
2010-11-18 10:07:38 -05:00
Owen W. Taylor
8b24711bba Omit shadows for fullscreen and maximized windows
Fullscreen and maximized windows never have visible shadows - the only
case where we would ever see them is if they bleed onto an adjacent
monitor and that looks bad.

It's small performance win to avoid computing them, and this also avoids
painting the top shadow for all maximized windows in GNOME Shell - since
the top panel isn't a X window, it doesn't factor into the computation
of what parts of windows are visible and maximized windows are computed
as having a top shadow.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:58 -05:00
Owen W. Taylor
ca5f2ac3ec Implement more accurate clipping of obscured shadows
Instead of making optimizing obscured shadows an all-or-none operation,
pass the clip region to meta_shadow_paint() and only paint the 9-slices
that are at least partially visible.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:58 -05:00
Owen W. Taylor
15f9590427 Report a correct paint volume for shadowed windows
Since we paint shadows directly now rather than using a child actor
in the ClutterGroup, we need to implement get_paint_volume() for
Clutter 1.5.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:58 -05:00
Owen W. Taylor
21a246eb42 Use a template material for shadows
To avoid unnecessary shader recompilation, use a root template material
for all shadows.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:58 -05:00
Owen W. Taylor
1bbaec81ce Make window shadows globally configurable
Instead of setting shadow parameters on individual windows, add the
idea of a "shadow class". Windows have default shadow classes based
on their frame and window type, which can be overriden by setting
the shadow-class property.

Each shadow class has separably configurable parameters for the
focused and unfocused state. New shadow classes can be defined with
arbitrary names.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:58 -05:00
Owen W. Taylor
3c4d52732e Make MetaShadowFactory public
The basic MetaShadowFactory type is moved to a public header, while
the functions to fetch and paint shadows are kept private.
The public object will be used for configuration of shadows by
plugins.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:57 -05:00
Owen W. Taylor
d56d267f7d MetaShadowFactory: convert to a GObject
https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:57 -05:00
Owen W. Taylor
8eb31944a5 MetaShadowFactory: Add the ability to top-fade a shadow
For attached modal dialogs, we want the shadow to fade out at the top
as if the window was glued to the parent at the top. Add a
shadow-top-fade property to MetaWindowActor and the corresponding
parameter to meta_shadow_factory_get_shadow().

The internal implementation of MetaShadow is adjusted to work
in terms of an "inner border" and "outer border" instead of doing
the calculations in terms of an aggregate border and the spread
of the shadow. The old way of doing things gets clumsy when the
top_fade distance is added in as well.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:57 -05:00
Owen W. Taylor
9f4942e9a7 Make shadows pretty and configurable
The current shadow code just uses a single fixed texture (the Gaussian
blur of a rectangle with a fixed blur radius) for drawing all window
shadows. This patch adds the ability

* Implement efficient blurring of arbitrary regions by approximating
  a Gaussian blur with multiple box blurs.

* Detect when multiple windows can use the same shadow texture by
  converting their shape into a size-invariant MetaWindowShape.

* Add properties shadow-radius, shadow-x-offset, shadow-y-offset,
  shadow-opacity to allow the shadow for a window to be configured.

* Add meta_window_actor_paint() and draw the shadow directly
  from there rather than using a child actor.

* Remove TidyTextureFrame, which is no longer used

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-18 09:47:56 -05:00
Florian Müllner
b445ee3763 Remove compatibility for GTK+-2.0
While the Meego developers agreed to switching mutter to GTK+-3.0
unconditionally a while ago, Canonical used a GTK+-2.0 build for their
Unity project. As Canonical now announced a switch to compiz as their
window manager, there is no longer a reason to maintain GTK+-2.0
compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=633133
2010-10-28 12:16:14 +02:00
Rico Tzschichholz
7227b636c6 Fix typo 2010-10-24 12:00:57 +02:00
Owen W. Taylor
1920f211b0 Remove Mutter namespace prefix
Move all objects and functions namespaced with Mutter into the Meta namespace
to get a single consistent namespace. Changes that aren't simply changing mutter
to meta:

 MutterWindow              => MetaWindowActor
 mutter_get_windows        => meta_get_window_actors
 mutter_plugin_get_windows => meta_plugin_get_window_actors

https://bugzilla.gnome.org/show_bug.cgi?id=628520
2010-10-23 15:48:29 -04:00
Owen W. Taylor
804117c456 Remove MetaRegion
In many places, MetaRegion was being used entirely internally, rather
than for gtk2/gtk3 compatibility. In these cases, it's simpler to just
depend on cairo-1.10 (for both gtk2 and gtk3) and use cairo_region_t.

The few places where we did need GDK compatibility (GdkEvent.region and
gdk_window_shape_combine_mask) are replaced with a combination of
converting GdkRegion to cairo_region_t and conditional code.

https://bugzilla.gnome.org/show_bug.cgi?id=632474
2010-10-23 15:48:29 -04:00
Florian Müllner
c382d8f7ea Remove unused variable 2010-09-30 18:49:21 +02:00
Adel Gadllah
f2ccf70f8d mutter-window: Don't track the window type twice
Currently mutter-window has its own type field, even though the same
information is already present in meta_window.

And while at it get rid of MetaCompWindowType, it is equally redundant.

https://bugzilla.gnome.org/show_bug.cgi?id=630363
2010-09-30 18:35:12 +02:00
Adel Gadllah
1123fca3f2 mutter-window: Add error traps check_needs_reshape
A window might change its shape and close immediately and thus causing
XShapeGetRectangles to produce a BadWindow, use an error trap
to avoid that.
2010-09-27 20:11:53 +02:00
Adel Gadllah
3fed2ab64d [mutter-shaped-texture] Use a base material for all instances
Use a base material for all textures rather than recreating it for every instance,
this should allow Cogl to optimize the program generation.

Idea 'stolen' from:

http://git.clutter-project.org/clutter/commit/?id=7e56a98413817479d0501ce8af9fad3e6411104d

https://bugzilla.gnome.org/show_bug.cgi?id=629350
2010-09-19 16:17:36 +02:00
Florian Müllner
7d8cc4f940 Fix build error introduced in the last commit 2010-09-15 03:15:46 +02:00
Florian Müllner
ee2f995fc7 introspection: Fix annotations
The scanner got stricter again - some annotations need fixing.
2010-09-15 02:31:47 +02:00
Colin Walters
4c0763792d introspection: Build with --warn-fatal, drop fix-meta-rectangle.py hack
Cleanly build with --warn-fatal.  Implementation:

* Liberally apply (skip) where the API is clearly C only, e.g. uses
  XLib.  The theming code and MutterPlugin are skipped too.
* Add missing (transfer) and (element-type) annotations

For a few functions that had a comment, I turned it into gtk-doc, but
I didn't (with a few exceptions) try to write new documentation in
this pass.
2010-09-07 10:48:07 -04:00
Adel Gadllah
2a54baf60e Trap xerrors in mutter_window_pre_paint
XDamageSubstract can create a BadDamage
(when the window goes away before XDamageSubstract is called)
and thus resulting into a crash.

Fix it by protecting the call with an error trap.

https://bugzilla.gnome.org/show_bug.cgi?id=623235
2010-08-23 22:31:51 +02:00
Owen W. Taylor
8b34b4bd0b MutterShapedWindow: drop all indirect references to textures
We don't get correct notifications for the ::cogl-texture property of
ClutterTexture in the case when we are unsetting the pixmap before calling
XFreePixmap. (This is because ClutterX11TexturePixmap is a hack on top
of ClutterTexture and we're a hack on top of that.) So we need to manually
clear everything out.

For consistency we also make sure that we drop all references to dead
textures:

 - When the shape changes
 - If the window pixmap texture changes without first being cleared
   (this is not expected to happen)

https://bugzilla.gnome.org/show_bug.cgi?id=627210
2010-08-19 16:12:11 -04:00
Owen W. Taylor
c9ebc0ea25 Always use mipmap emulation
Rather than trying to find out from Clutter whether mipmap generation
can be used together with texture_from_pixmap, just always assume
it can't and use the MutterTextureTower emulation code.

This fixes a problem with our previous hack for doing the query
no longer working. In the rare cases where mipmap generation
is supported, it is unlikely to produce significantly more efficient
or better looking results than the emulation. (In terms of efficiency,
we have better knowledge of when we need to update the lower mipmaps
and when we don't than CoglTexturePixmapX11.)

Some care is taken so mutter_shaped_texture_set_create_mipmaps() works
when changed on the fly and properly discards the old mipmap levels.
This isn't necesary currently, since it can only be controlled via
envvar, but is easier than future-proofing through documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=627087
2010-08-18 14:02:32 -04:00
Owen W. Taylor
15a214e435 Fix order of pixmap = None and XFreePixmap() in last commit
The last commit set MutterWindow->priv->back_pixmap to None before
calling XFreePixmap on it. Fix.
2010-08-17 19:07:49 -04:00
Owen W. Taylor
0b3327f04d Unset window pixmaps from MutterShapedWindow before freeing them
At least with the Mesa/DRI implementation of GLX, calling XFreePixmap()
on a pixmap before glxDestroyPixmap() on the corresponding GLX pixmap
causes an X error. To avoid triggering this with the new
ClutterTexturePixmapX11 code, we need to move our XFreePixmap after
unsetting the pixmap from the actor.

https://bugzilla.gnome.org/show_bug.cgi?id=627210
2010-08-17 18:42:02 -04:00
Adel Gadllah
a1bb3835cc [mutter-shaped-texture] Remove material_workaround
It is no longer needed as the workaround has been removed in
452025e984,
but the material is still around and unused.

https://bugzilla.gnome.org/show_bug.cgi?id=625712
2010-08-16 23:06:46 +02:00
Adel Gadllah
ce1ffa4624 Check for TFP usage after actually setting the pixmap
Starting with clutter 1.4 clutter / cogl only knows whether TFP is in use after
setting the pixmap, so doing the check before setting the pixmap will just
lead to a wrong message.

https://bugzilla.gnome.org/show_bug.cgi?id=624757
2010-07-30 16:16:55 +02:00
Florian Müllner
7feeb72721 Use cairo_region_t when building with gtk+-3.0
GdkRegion has been removed from Gtk+. The replacement is a
yet-unreleased cairo API, so use it only when building with
Gtk+-3.0.

https://bugzilla.gnome.org/show_bug.cgi?id=587991
2010-07-02 04:36:28 +02:00
Claudio Saavedra
c47d2da0cb Don't incĺude internal gdk headers directly
Bug 622800.
2010-06-30 01:35:35 +03:00
Maxim Ermilov
13ad103823 Clean up MutterPlugin effect interface
The current effect API passes an unnecessary list of windows to
switch_workspace() and forces a window to be passed in when killing
the switch_workspace() effect.

We can simplify the interface to correspond more closely to how
it is actually used and fix these problems:

Remove the actors parameter to plugin->switch_workspace
Remove the events parameter to plugin->kill_effect and rename it to kill_window_effects
Add plugin->kill_switch_workspace

Remove mutter_plugin_manager_kill_effect
Add mutter_plugin_manager_kill_window_effects
Add mutter_plugin_manager_kill_switch_workspace

Remove mutter_plugin_effect_completed
Add mutter_plugin_[minimize/map/destroy/maximize/unmaximize]_completed
https://bugzilla.gnome.org/show_bug.cgi?id=621082
2010-06-17 01:40:43 +04:00
Robert Bragg
91d82bf8c7 mutter-window: request DamageReportBoundingBox report level
In commit d34ae764769 I switched mutter-window to ask for Raw rectangles
from the X server. This avoided 2 non synchronous and 2 synchronous X
requests per window with damage, per frame; 2 (non-sync) to
create/destroy a temporary region to copy the damage region into, 1 to
request the server to copy the damage region into a our given region and
another to fetch that region back into the client. The problem with raw
events though is that it's possible to DOS the compositor with them.

Instead of receiving an event for every bit of damage this patch instead
asks the server to only report BoundingBox changes to the damage region.

https://bugzilla.gnome.org/show_bug.cgi?id=611838
2010-06-04 00:36:08 +01:00
Owen W. Taylor
092cc47afc Work around COGL bug causing flash for new windows
COGL bug http://bugzilla.openedhand.com/show_bug.cgi?id=2110 results
in pending drawing at the time of cogl_offscreen_new_to_texture() going
to the newly created framebuffer rather than the stage.

This would result in most windows being missing for the first frame
when a new window is mapped.

Work around this by calling cogl_flush() before
cogl_offscreen_new_to_texture().

https://bugzilla.gnome.org/show_bug.cgi?id=618138
2010-05-09 14:30:18 -04:00
Owen W. Taylor
d8b0f213b2 Fix accounting of frozen with maximize/unmaximize
The beginning maximization/unmaximization don't go through
start_effect_simple(), so we need to freeze the window
separately.

Change MutterWindow.freeze_count to a signed integer for
consistency with other counts, and so the logic for
checking for errors works properly.

https://bugzilla.gnome.org/show_bug.cgi?id=616546
2010-04-26 16:57:06 -04:00
Robert Bragg
0c14640352 mutter-window: stream raw updates to ClutterX11TexturePixmap
This changes the way we handle Damage events so instead of getting an
event when the damage region of a pixmap becomes non-empty we now get
sent all damage rectangles and stream those all though to
ClutterX11TexturePixmap using clutter_x11_texture_pixmap_update_area()

For Clutter 1.2, ClutterGLXTexturePixmap was updated so that calls to
clutter_x11_texture_pixmap_update_area are now cheap (glXBindTexImageEXT
calls are now deferred until just before painting) and since
ClutterGLXTexturePixmap is now capable of queueing clipped redraws that
can result in only updating a sub-region of the stage during a repaint
cycle (and using glXCopySubBufferMESA to present the sub-region redraw
to the front buffer) this should improve performance and reduced power
consumption for a range of use cases. (For example viewing a website
that has animated adverts doesn't force the whole screen to be redrawn
for each frame of the advert)

Besides being able to take advantage of glXCopySubBuffer to only update
a small region of the stage the fact that this patch makes Mutter now
request RawRectangles from the X server means we no longer do a
synchronous X request for a complete Damage Region for every window
damaged each frame. This should also improve performance.

CLUTTER_PAINT=redraws can be used to visualize what parts of the stage
are redrawn and with this patch applied I can open a terminal and as I
type I see that only the damaged areas of the terminal are being
redrawn.
2010-04-21 16:40:46 +01:00
Robert Bragg
cfa30f9876 make sure we create a pixmap for all new mutter windows
In the case where a mutter window is created for an X Window that is
already mapped then we weren't calling mutter_window_mark_for_repair and
so we weren't calling XCompositeNameWindowPixmap e.g. for menu windows.

This doesn't get noticed because as soon as some damage gets delivered
for such windows the pixmap will be named anyway, but if we were to
change how damage is handled this would result in broken menus.

We now call mutter_window_mark_for_repair in mutter_window_new when the
given Window is already mapped.
2010-04-21 16:40:34 +01:00
Owen W. Taylor
b77b0a3d81 Load one copy of plugins early
Although multi-screen support has not been tested and probably
doesn't fully work, the basic setup for multi-screen is that
we have the same list of plugins for all screens, but a different
instance of the plugins for each screen.

To allow plugins to do setup that is screen independent and needs
to occur early in the setup process, we identify a "default plugin
manager" and load (but not start) that plugin manager's plugins
immediately after we know our list of plugins.

That plugin manager is then reused for the first screen we open
and the plugins are started at that time. Separate plugin managers
are loaded and started for any other screens we open.

(A plugin could keep track of whether the screen-independent
setup has been done in a static variable, or it could do everything
in a way that is safe to do repeatedly.)

https://bugzilla.gnome.org/show_bug.cgi?id=615586
2010-04-13 13:53:55 -04:00
Owen W. Taylor
97a9726845 Add an explicit start() method for plugins
Rather than using the plugin objects constructed() method for doing
setup that requires the MetaScreen, add an explicit start() method
that is called after the screen is set.

The reason for this is that this allows plugin objects to be created
early before the bulk of Metacity setup, which then allows plugins
to affect how the setup happens. (For example, to change the way
that preferences are loaded.)

This is an incompatible change, since 'screen' is now not set in the
constructed method, so the plugin API version is bumped.

https://bugzilla.gnome.org/show_bug.cgi?id=615586
2010-04-13 13:40:16 -04:00
Dan Winship
debf08cac0 Fix handling of grabbed key events
https://bugzilla.gnome.org/show_bug.cgi?id=596659
2010-04-12 17:52:19 -04:00
Owen W. Taylor
ee35540b6e Remove compositor-internal window lookup code
Since all windows are now MetaWindows as well as compositor
windows, there's no reason to keep a compositor-specific hash table
mapping from XID to MutterWindow.

This reduces complexity and removes a call to XQueryTree that could
potentially produce a BadWindow error if not error-trapped.

https://bugzilla.gnome.org/show_bug.cgi?id=613398
2010-04-07 10:22:30 -04:00
Adel Gadllah
f77507e825 Don't trap XErrors in meta_compositor_process_event
meta_compositor_process_event uses meta_error_trap_push/pop for
every event processed by meta_compositor_process_event which isn't needed
and can cause performance problems.

https://bugzilla.gnome.org/show_bug.cgi?id=613398
2010-04-07 13:28:19 +02:00
Robert Bragg
452025e984 Remove the workaround for multi-texturing with old intel drivers
The 2009 Q2 release of the drivers includes the relevent bug fix.

https://bugzilla.gnome.org/show_bug.cgi?id=613121
2010-03-17 16:13:24 +00:00
Owen W. Taylor
ff4f096f1d Support and require Clutter 1.2
- Specify a minimum version of Clutter-1.2.0
- Remove conditionalizatin and always use Clutter-1.1 framebuffer
  API rather than raw GL fbos
- Replace deprecated cogl_material/texture_unref() with
  cogl_handle_unref()

https://bugzilla.gnome.org/show_bug.cgi?id=610862
2010-03-11 15:06:06 -05:00
Nguyễn Thái Ngọc Duy
2d409e5c09 Remove executable bit from mutter-shaped-texture.c 2010-02-21 21:23:17 +07:00
Tomas Frydrych
fb3d352d3a [MutterShapedTexture] Use cogl multitexture API
The older code relied on Clutter providing default texture coords for any
layers for which texture coords were not specified, which does not work as
of Clutter 1.1.6 (due to commit 8b950bdc87).

https://bugzilla.gnome.org/show_bug.cgi?id=609657
2010-02-12 11:37:30 +00:00
Emmanuele Bassi
2fbe4c2388 Do not use CGL_* symbols
The CGL_* defines in COGL were always meant to be private and should
have never been exposed in the first place. The API in COGL has been
updated to never require them starting from 1.1, but using the original
GL symbols has always been the intent of the API.

This commit removes the CGL_TEXTURE_RECTANGLE_ARB usage in favour of the
ARB-sanctioned GL_TEXTURE_RECTANGLE_ARB enumeration value.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=607398
2010-01-19 01:34:22 +00:00
Nickolas Lloyd
b20cb36f5d Migrate to new cogl framebuffer framework
The 1.2 API for draw-buffers/framebuffers has changed a bit
since the code in mutter-texture-tower.c was written; adapt to
the changes.

https://bugzilla.gnome.org/show_bug.cgi?id=604200
2009-12-14 11:59:08 -05:00
Owen W. Taylor
86f8c1863e Work around Mesa problem with PFNGLACTIVETEXTUREPROC
PFNGLACTIVETEXTUREPROC (a GL-1.2 addition) was inadvertently missing
from some recent versions of Mesa (like that in Fedora 11.) Use
the identical PFNGLACTIVETEXTUREARBPROC instead.
2009-11-30 10:51:45 -05:00
Owen W. Taylor
bdb3be7084 Fix compilation with older libGL
the mutlitexture and texture_rectangle extensions have recently
been incorporated into the GL core; fixes needed to work with
libGL that proceeds that:

GL_TEXTURE_RECTANGLE_ARB - use _ARB name
glActiveTextureARB() - use get_proc_address

https://bugzilla.gnome.org/show_bug.cgi?id=602870
2009-11-24 15:58:42 -05:00
Owen W. Taylor
47af6a0bbf Nice looking scaledown with mipmap emulation
Add MutterTextureTower, an abstraction for getting a image with
the right level of detail for rendering at a particular scale,
by manually scaling down by powers of two.

This results in much better looking scaled window images when
mipmaps can't be used with texture_from_pixmap (which is the
typical case for current GL drivers.)

When framebuffer objects are available, they are used to do
the scaledown using the GPU without having to pull the data
back from video memory. A software codepath is also available
for the case when FBO's are not present, though performance
will suffer

https://bugzilla.gnome.org/show_bug.cgi?id=601032
2009-11-24 15:40:35 -05:00
Tomas Frydrych
e811109566 [MutterWindow] Fixed potential NULL dereference
Avoid dereferencing NULL when the window is not yet placed on a workspace.
Added doc comment, noting this function is deprecated.

https://bugzilla.gnome.org/show_bug.cgi?id=592567
2009-10-09 16:50:38 +01:00
Colin Walters
d6143e4c73 mutter_plugin_get_windows returns *Mutter*Window, not MetaWindow 2009-09-28 19:30:24 -04:00
Colin Walters
d8ffc3c187 [mutter_plugin_get_windows] Document it 2009-09-28 16:55:37 -04:00
Owen W. Taylor
2af788956e mutter_begin_modal_for_plugin(): Check result of XGrabKeyboard()
The return value of XGrabKeyboard() wasn't actually being assigned
to the 'result' variable so we didn't notice when grabbing the
keyboard failed.

https://bugzilla.gnome.org/show_bug.cgi?id=596343
2009-09-25 12:59:13 -04:00
Owen W. Taylor
67682a2683 Add a modal mode for plugins
mutter_plugin_begin_modal() and mutter_plugin_begin_modal() allow putting
a plugin into a "modal" state. This means:

 - The plugin has the keyboard and mouse grabbed
 - All keyboard and mouse events go exclusively to the plugin

mutter-plugin.[ch]: Add public API
compositor.c compositor-private.h: Implement the API
mutter-plugin-manager.c: When reloading plugins, make sure none of them
  are modal at that moment, and if so force-unmodal them.
common.h: Add META_GRAB_OP_COMPOSITOR
display: When display->grab_op is META_GRAB_OP_COMPOSITOR forward relevant
  events exclusively to the compositor.

http://bugzilla.gnome.org/show_bug.cgi?id=590754
2009-08-26 12:26:58 -04:00
Colin Walters
41cf9134a6 Add meta_window_is_mapped, remove usage of window-private.h from mutter-window.c
mutter-window.c originally grew an #include "window-private.h" for
window->override_redirect, but that was just fixed.  However since
then it also ended up relying on a few other minor private bits.

To fix that, add meta_window_is_mapped, promote meta_window_toplevel_is_mapped
to public, and use the public MetaDisplay accessor.
2009-08-14 19:47:13 -04:00
Colin Walters
e960269653 Add meta_window_is_override_redirect
Trivial function, useful for plugins which are doing analysis
of windows.
2009-08-14 19:47:13 -04:00
Owen W. Taylor
f03d39eefb Check the opacity of the right actor
When determining if the window is opaque or not, look at it's opacity,
not the opacity of the window group.

Reported by Matthias Clasen
http://bugzilla.gnome.org/show_bug.cgi?id=591836
2009-08-14 15:58:07 -04:00
Tomas Frydrych
2c8df7d12e Do not run effects during WM startup
When we first start up, we do not want to run effects on any pre-exising
windows (this is either the case we are starting up and there are no windows,
or we are replacing an exisint window manager, or worse, we crashed, and we
just want to get to the desired desktop as quick as possible).

Dithered about where to place the check; putting into the plugin manager
reduces the number of places (and files) in which it needs to be done.
2009-08-12 07:45:03 +01:00
Tomas Frydrych
6b36e64e00 Take extra reference on the texture inside MutterWindow
We store a pointer to the texture independently of the ClutterContainer
internals, and rely on the pointer remaining valid until we run dispose.
Since we also provide public API to access this pointer, we should not
rely on the reference ClutterContainer holds to ensure that texture will
not be destroyed (e.g., some nasty developer could reparent the texture).
2009-08-07 17:38:11 +01:00
Tomas Frydrych
84059f1faa Free MutterWindow description string in finalize() not dispose()
We were freeing the description string in dispose and not setting it to NULL,
thus leaving around a dangling pointer for the duration of the disposal.
This commit moves the free into the finalize vfuction, where it belongs.
2009-08-07 16:47:43 +01:00
Tomas Frydrych
245908909b Fix check for zero-sized textures in MutterShaped texture
Patch by Jon Nettleton <jon.nettleton@gmail.com>

http://bugzilla.openedhand.com/show_bug.cgi?id=1538
http://bugzilla.gnome.org/show_bug.cgi?id=590646
2009-08-04 08:47:46 +01:00
Thomas Wood
1f90529365 Don't explicitly set the size of the MutterWindow texture
Setting the size of the texture causes the minimum and preferred width and
height values to be fixed at the set value. The normal requisition functions
of ClutterTexture will already report the size of the texture pixmap as the
natural size, but also allow scaling down as needed if less space is
available. We don't need that here, but we want to allow someone to make
a ClutterClone of the texture actor.
2009-07-31 13:36:59 +01:00
Owen W. Taylor
d91d503eb2 Pass event to clutter when the plugin doesn't have xevent_filter
With recent changes, Clutter no longer sets up the viewport correctly,
unless it receives ConfigureNotify events. If there is a plugin with
an xevent_filter function, then it's that plugins responsibility to pass
the event to Clutter if it doesn't want it. If there is no plugin,
or the plugin doesn't have an xevent_filter function, then we should
call clutter_x11_handle_event() ourselves.

http://bugzilla.gnome.org/show_bug.cgi?id=589419
2009-07-28 16:00:24 -04:00
Owen W. Taylor
e84bf7144c Queue redraws on MutterWindow's MutterShapedTexture
When a windows contents or shape changes, we schedule a redraw
with clutter_actor_queue_redraw(); we need to queue the redraw
on the shaped texture rather than on the window actor to support
cloning of just the shaped texture without the shadow: that
is, the shaped is what is really changing and it may be
visible via a clone even if the MutterWindow itself is not
visible.

http://bugzilla.gnome.org/show_bug.cgi?id=589429
2009-07-28 15:50:28 -04:00
Owen W. Taylor
83f8bfd2ca Reduce overpaint in the window group
When we are painting a stack of 5-10 maximized windows, the
standard bottom-to-top method of drawing every actor results
in a tremendous amount of overdraw and can easily max out
the available memory bandwidth on a low-end* graphics chipset.
It's even worse if window textures are being accessed over
the AGP bus.

When we have opaque windows, we can go ahead and compute visibility
ourselves (in classic X-server fashion) and use that information to
restrict drawing obscured actors.

* Add MutterWindowGroup - a ClutterGroup subclass with logic
  for figuring out obscured regions.

* Add mutter_window_get_obscured_region() to get the region
  obscured by that window.

* Add mutter_shaped_texture_set_clip_region() to hint
  a clip region to the painting code; this is set based on
  the computed visible region of MutterWindowGroup.

* Add tidy_texture_frame_set_needs_paint() to hint that the
  paint can be skipped entirely; this is used when we detect
  that the window shadow is entirely obscured.

http://bugzilla.gnome.org/show_bug.cgi?id=587344
2009-07-09 16:56:01 +01:00
Owen W. Taylor
4be8e155d1 Fix crash when starting not on first workspace
If we are starting on something other than the first workspace,
meta_compositor_switch_workspace() will be called before
meta_compositor_manage_screen(); guard against that.
2009-07-06 08:43:07 +01:00
Owen W. Taylor
6726fcd25d Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.

Simplify this so that visibility is controlled by:

 meta_compositor_show_window()
 meta_compositor_hide_window()

With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)

The map state of the window is signalled separately by:

 meta_compositor_map_window()
 meta_compositor_unmap_window()

And is used only to control resource handling.

Other changes:

 * The desired effect on show/hide is explicitly stored in
   MetaWindow, avoiding the need for the was_minimized flag.
   At idle, once we calculate the window state, we pass the
   effect to the compositor if it matches the new window
   state, and then clear the effect to start over for future
   map state changes.

 * meta_compositor_switch_workspace() is called before any windows
   are hidden or shown, allowing the compositor to avoid hiding
   or showing an effect for windows involved in the switch.
   http://bugzilla.gnome.org/show_bug.cgi?id=582341

 * Handling of post-effect cleanups for MutterWindow are
   simplified - instead of trying to do different things based
   on the individual needs of different effects, we just wait until
   all effects complete and sync the window state to what it
   should be.

 * On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
   that we've done so, so it can clean up and unbind. (The
   unbinding doesn't seem to be working properly because of
   ClutterGLXPixmap or video driver issues.)

http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-07-06 00:16:23 +01:00
Owen W. Taylor
cd048be932 Remove unused focus_window member of MetaCompScreen
Remove some old code; the compositor no longer tracks
the focus window.

http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-07-06 00:06:23 +01:00
Owen W. Taylor
5d477c4b4e Remove include_destroy parameter to mutter_window_effect_in_progress()
Clean up mutter_window_effect_in_progress() by removing the
include_destroy parameter which was used only in one place that
could be easily done otherwise. (There was another use in
mutter_window_sync_actor_position() that had no point and looked
unintended.)

http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-07-06 00:04:58 +01:00
Owen W. Taylor
9244f0f113 Move window repair and reshape to a paint function
Add a paint function that checks all windows for repair and
shape updates; this:

 - simplifies the logic for when a window needs to be repaired
 - avoids duplicate work when we get multiple damage effects
 - avoids the need to look ahead in the event queue

Instead of relying on repair to implicitly resize the
MutterWindow actor, set the size explicitly when the core
code updates the geometry. (This is needed because we haven't
repaired yet when we start an animation, and the animation
may depend on the size to, e.g., rescale from the center.)

Because the core geometry update happens before we start
maximize/unmaximize effects we need to work around this by
passing both the old and new geometry to the compositor.

http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-07-06 00:04:41 +01:00
Owen W. Taylor
309a07bf4c Remove unused dock_windows list from MetaCompScreen
MetaCompScreen.dock_windows was kept updated, but never used.

http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-07-05 23:56:58 +01:00
Owen W. Taylor
a0f06cab43 Fix function names in debug tracing statements
Refer to meta_compositor_* not the old clutter_cmp_* names.

http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-07-05 23:56:55 +01:00
Owen W. Taylor
c60d4c2bc4 Separate source and header files for MutterWindow
compositor.c: Move MutterWindow code to mutter-window.c;
 rename map_win() to mutter_window_map(), etc.

mutter-window-private.h: New private header file for
 MutterWindow functions used internally to the compositor.

compositor-mutter.h: Move MutterWindow declarations to
 mutter-window.h; move a couple of private functions to
 compositor-private.h

compositor-private.h: Move MetaCompScreen declaration to here:
 Conceptually it's private to compositor.c, but MutterWindow
 manipulates some of the lists directly for now.

mutter-plugin.c compositor.c: Don't call mutter_window_effect_completed()
 for MUTTER_PLUGIN_SWITCH_WORKSPACE, but use a new
 mutter_switch_workspace_completed(), since the window is
 just used to identify a screen.

http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-07-05 23:56:51 +01:00
Owen W. Taylor
f0d22e18c4 Split shadow code into a separate file
Separate code related to creating the gaussian-blurred shadow texture
into a separate file.

Move the definition of MetaCompositor into a compositor-private.h
so that the shadow code can cache the source in the compositor
structure.

http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-07-05 23:28:38 +01:00
Owen W. Taylor
d69546902b Remove unused MetaCompositor functions
Remove a number of functions that were either entirely unimplemented
or had empty implementations for the Clutter-compositor.

 meta_compositor_begin_move()
 meta_compositor_update_move()
 meta_compositor_end_move()
 meta_compositor_set_active_window()
 meta_compositor_free_window()

http://bugzilla.gnome.org/show_bug.cgi?id=581813
2009-06-30 09:35:12 -04:00
Owen W. Taylor
72149a054e Make MetaCompositor the clutter compositor
* Move compositor-mutter.c to compositor.c

* Remove the 'Mutter' typedef and define the structure for
  MetaCompositor directly.

http://bugzilla.gnome.org/show_bug.cgi?id=581813
2009-06-30 09:35:12 -04:00
Owen W. Taylor
3aff9726eb Remove MetaCompositor virtualization
Now that we only have one compositor, there's no reason to access the
compositor functions through a vtable. Remove the MetaCompositor virtualization
and make the clutter code implement the meta_compositor_* functions
directly.

Move the checks for the compositor being NULL from the vtable wrappers
to the calling code (most of them were already there, so just a few
needed to be added)

Note: the compositor is actually hard-coded on at the moment and the plan
  is to remove the non-composited code entirely, so the checks are
  added only to keep things neat: they have no practical effect.

http://bugzilla.gnome.org/show_bug.cgi?id=581813
2009-06-30 09:34:45 -04:00
Jon Nettleton
0b8a57bcba There can be only one compositor engine
Mutter is a Clutter-based compositing manager. So, remove the code for
the XRender-based compositor, and make it mandatory to have XComposite,
XRender and Clutter.

Run-time support for non-composited operation is left for now.

* src/compositor/mutter/: Move files from this subdirectory into
  the main compositor/ directory.

* compositor/compositor-xrender.ccompositor/compositor-xrender.h:
  Remove

* include/compositor-clutter.h: Remove this stray file, it had been
  replaced with compositor-mutter.h some time back.

http://bugzilla.gnome.org/show_bug.cgi?id=581813
2009-06-30 09:34:03 -04:00
Owen W. Taylor
455486db7c Avoid restacking animating hidden actors
Since the stack passed to the compositor now accurately reflects
the X stacking order, we need to treat hidden windows (which are
at the bottom of the X stacking order) specially - when the
compositor stacking order is synced, try to keep animating hidden
actors in their old positions in the stack.

http://bugzilla.gnome.org/show_bug.cgi?id=585984
2009-06-30 09:33:29 -04:00
Owen W. Taylor
072ec184d3 Revert "Unparent rather than destroy MutterWindows."
This reverts commit 16d49695ad.

If we want an actor to go away deterministically, we should call
clutter_actor_destroy(); using unparent instead a) may result
leaks through cyclic ref counts, and b) will delay the deallocation
of the window texture in a garbage collected environment until
the next garbage collection, causing much greater transient use
of memory.

http://bugzilla.gnome.org/show_bug.cgi?id=580520
2009-06-23 14:13:59 -04:00
Marina Zhurakhinskaya
0a863b8c2b Handle input area set to full screen or reset during start-up
info->pending_input_region needed to be destroyed in
mutter_set_stage_input_region() before it was set to something
else or before it was reset to be full screen (region == None).

Set the initial input area to an empty region by
setting info->pending_input_region to an empty region by default
and setting it to None or a new region if a new input region is
specified.

Remove show_overlay_window() function that was used to set an empty
input region on start-up, and uses a call to do_set_stage_input_region()
with info->pending_input_region as an argument instead.
2009-06-19 16:48:44 -04:00
Florian Muellner
ecde490967 Suppress strict aliasing warning
Fix a (harmless) warning about strict aliasing that some GCC versions
give when using g_module_symbol().

http://bugzilla.gnome.org/show_bug.cgi?id=582243
2009-06-16 15:47:59 -04:00
Jon Nettleton
51a6467968 Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.

The overall version was brought up to 2.27 to match current gnome.

Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system.  Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap.  These files will eventually end up in an external
gnome-wm-data module.

Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.

Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set.  This allows
gnome-control-center to continue using libmetacity.so for
configuration.  This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-16 14:17:10 -04:00
Owen W. Taylor
627b4484ec Fix _XOPEN_SOURCE compilation problems on Solaris
Change #define _XOPEN_SOURCE 500 to 600 in compositor-xrender.c to
avoid a bad interaction with -xc99 on Solaris.

Remove unneeded #define in compositor-mutter.c.

Based on a patch by Brian Cameron

http://bugzilla.gnome.org/show_bug.cgi?id=580662
2009-06-12 14:50:15 -04:00
Owen W. Taylor
442991a712 Adapt to premultiplied alpha usage in Cogl
Cogl's default blend function has been switched to expect premultiplied
alpha. Change the combine function and the colors we use to
modulate alpha to match.

http://bugzilla.gnome.org/show_bug.cgi?id=585480
2009-06-11 15:36:27 -04:00
Owen W. Taylor
7eae5d4eab Allow slicing the mask texture
It doesn't make sense to allow the window texture to be sliced,
but not allow the mask texture to be sliced. So, we should either
set 'disable-slicing' for the texture actor or not pass NO_SLICING when
creating the mask texture.

While slicing currently results in only the first layer being shown,
disabling slicing entirely would break windows larger than the texture
size limit.  It would be straightforward to support multitexturing of
sliced textures in Cogl when all the textures are identically sized
and sliced identically, if it became a priority.

http://bugzilla.gnome.org/show_bug.cgi?id=585151
2009-06-11 14:49:59 -04:00
Owen W. Taylor
fafb752827 Port to Mutter to Clutter 1.0 API
- Use float instead of ClutterUnit
- clutter_actor_get_size/position() return floats (remove some
  stray usage of these functions in the default plugin as well.)
- Adapt to cogl_texture_new_from_data() changes
- Use blend strings to set up multitexturing
- Remove CLUTTER_UNITS_TO_FLOAT() usage

http://bugzilla.gnome.org/show_bug.cgi?id=585016
2009-06-08 09:34:09 -04:00
Owen W. Taylor
9883f6e679 Select for crossing events on stage and overlay
If the input region has been shaped, then clutter needs to
receive EnterNotify/LeaveNotify events in order to properly
send enter and leave events to actors when the pointer crosses
the boundary of the stage.

http://bugzilla.gnome.org/show_bug.cgi?id=578250
2009-05-05 13:57:23 -04:00
Owen W. Taylor
6cf71a06c0 Remove debug printf about opacity
Don't print ""setting opacity to %d\n" every time a window's opacity
changes.

http://bugzilla.gnome.org/show_bug.cgi?id=580655
2009-04-29 11:44:15 -04:00
Owen W. Taylor
7a7632fa98 Allow setting input region before output window is created
If mutter_plugin_set_stage_input_region() and related methods are
called before the output window is available, save the set input
region and apply it to the output window later on.

compository-mutter.[ch]: Add mutter_set_stage_input_region() and
mutter_empty_stage_input_region(), move the input region handling
here and implement the delayed shape setting described
above.

mutter-plugin.c: Implement shape setting in terms of the new methods.

http://bugzilla.gnome.org/show_bug.cgi?id=580042
2009-04-24 09:54:19 -04:00