There's no need to enable the texture target unless it is going to be
used for rendering. Enabling it directly with glEnable calls confuses
Cogl's state caching.
This is a replacement for the patch in bug 1483 which was reverted.
This reverts commit f9d996a460.
The change from calling glBindTexture to using the material API with
cogl_material_flush_gl_state does not always work because it doesn't
necessarily leave the active texture unit as GL_TEXTURE0. For example,
if the previously rendered texture was multi-layered then the last
thing cogl_material_flush_gl_state will do is select GL_TEXTURE1 just
to disable it.
This is useful because sometimes we need to get the current matrix, which
is too expensive when indirect rendering.
In addition, this virtualization makes it easier to clean up the API in
the future.
Using glEnable() directly confuses COGL and can result in problems
like subsequent pick operations not working correctly. Get the
material for the ClutterTexture and call cogl_material_flush_gl_state()
instead.
http://bugzilla.openedhand.com/show_bug.cgi?id=1483
Bug 1178 - No enter / leave events on actors when pointer leaves the
stage window
The patch is mostly thanks to Johan Bilien with small modifications
based on suggestions by Owen Taylor.
The X11 backend now listens for enter and leave notifications. Leave
notifications get translated directly to a CLUTTER_LEAVE
event. Clutter can detect these special events because the source
actor is NULL in which case it sets the source actor to the last known
actor and then sets the last known actor to NULL.
Enter notifications just get translated to CLUTTER_MOTION events which
will cause Clutter to generate an enter event through the usual code
path.
By creating an ARGB texture for 24bpp pixmaps we were exposing an undefined
alpha channel to the blending and texture combine stages which resulted in
nasty artefacts. (This issue was seen on i945 + DRI2)
Clutter has a set of command line options that are added to every
application by means of clutter_init() or by obtaining the Clutter
GOptionGroup and using g_option_context_parse(). Thus, every Clutter
application will automatically have an --help command line switch
showing the list of options and their description.
At the moment, Clutter does not enable localization of the help,
thus making it less than useful on non-English locales.
This patch enables the machinery to create a localization file and
load it when initializing Clutter, by means of the GLib macros and
locale.h API we already use.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Some drivers (e.g. Nvidia) get upset if you try to create multiple glx pixmaps
for the same server side pixmap object, even though you might have unique
client side names, we now avoid hitting this problem by destroying the current
glx pixmap early within clutter_glx_texture_pixmap_create_glx_pixmap.
* clutter/cogl/gl/cogl-texture.c (cogl_texture_new_from_foreign,
(_cogl_texture_quad_hw, cogl_texture_polygon),
(_cogl_texture_quad_sw): Support GL_ARB_texture_rectangle textures
* clutter/glx/clutter-glx-texture-pixmap.c: Use rectangle textures
when NPOTs are not available or it is forced by the
CLUTTER_PIXMAP_TEXTURE_RECTANGLE environment variable.
* clutter/cogl/gl/cogl.c (cogl_enable): Allow enabling
GL_TEXTURE_RECTANGLE_ARB.
fallbacks are being used
* glx/clutter-glx-texture-pixmap.c:
clutter_glx_texture_pixmap_using_extension now checks to see if
priv->use_fallback is TRUE not just that the tfp extension is
available.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
* clutter/clutter-clone-texture.c:
* clutter/clutter-private.h:
* clutter/clutter-texture.c:
* clutter/x11/clutter-x11-texture-pixmap.c:
Attempt to lower overhead of updating TFP's (particularly mipmaped).
Compresses mipmap updates only for visible TFPs.
Avoiding updates for non visible TFP's whilst keeping visible
clones working ok.
* clutter/clutter-texture.c: (clutter_texture_set_filter_quality),
(clutter_texture_get_filter_quality):
Fix up some logic, typos.
* clutter/glx/clutter-glx-texture-pixmap.c:
Improve support for mipmaped TFP textures.
Bug 1200 - Crash with invalid DISPLAY
* clutter/clutter-main.c: Use the ClutterBackend wrapper API
instead of directly checking the class structure.
* clutter/glx/clutter-backend-glx.c: Return the correct value
in case of failure.
* clutter/x11/clutter-backend-x11.c: Bail out if XOpenDisplay()
failed.
* clutter/glx/clutter-stage-glx.c (clutter_stage_glx_realize):
Don't set a backing pixel on the X window. Otherwise when the
window resizes it will flicker when X paints the background
immediatly before Clutter repaints the whole stage.
* clutter/glx/clutter-glx-texture-pixmap.c:
* clutter/x11/clutter-x11-texture-pixmap.c:
TFP resyncing on MapNotify/ConfigureNotify (bug 1020; patch by
Andy Wingo <wingo@pobox.com>).
Bug 1011 - Fix TFP fallback mechanism (take 2)
* clutter/glx/clutter-glx-texture-pixmap.c:
* tests/test-pixmap.c:
Slightly modified patch from Gwenole Beauchesne applied
to better handle both falling back to non accelerated tfp
and improvements to the test case.
* clutter/glx/clutter-stage-glx.c:
* clutter/x11/clutter-backend-x11.c:
* clutter/x11/clutter-backend-x11.h:
* clutter/x11/clutter-event-x11.c:
* clutter/x11/clutter-x11.h:
* tests/test-devices.c:
Disable use of XInput and add an explicit clutter_x11_enable_xinput
to enable it.
Also fix up the x11 pre-init calls to not need g_type_init.
Bug 1007 - Fix TFP fallback mechanism
* clutter/glx/clutter-glx-texture-pixmap.c:
* clutter/x11/clutter-x11-texture-pixmap.c:
Add some extra safety to glx pixmap creations and tidy up some notes.
Patch from Gwenole Beauchesne.
Bug 997 - automatic updates not working for named TFP pixmaps,
at least in x11
* clutter/glx/clutter-glx-texture-pixmap.c:
* clutter/glx/clutter-glx-texture-pixmap.h:
* clutter/x11/clutter-backend-x11.c:
* clutter/x11/clutter-x11-texture-pixmap.c:
* clutter/x11/clutter-x11-texture-pixmap.h:
* clutter/x11/clutter-x11.h:
* configure.ac:
* tests/test-pixmap.c:
Rework Andy Wingos patch a little adding more safety for now also
handling redirect Windows (as well as pixmaps)
release events when pointer is outside window as well as re-enabling
keyrepeat.
* clutter/glx/clutter-stage-glx.c: (clutter_stage_glx_realize): select
for KeyPressMask and KeyReleaseMask even with XInput enabled.
* clutter/x11/clutter-backend-x11.c: (_clutter_x11_register_xinput):
Disabled the XInput keyboard code paths (comments and #if 0's)
* clutter/x11/clutter-event-x11.c: (event_translate): always handle
keyboard events without regard to XInput.
* clutter/cogl/gl/cogl.c:
Temp workaround for 10.4 ATI card OSX folks, see #929
(Tommi Komulainen)
Bug 998 - clutter always captures X input events
* clutter/eglx/clutter-stage-egl.c:
* clutter/glx/clutter-stage-glx.c:
When we disable X event retrival, dont still select for window
events.
* clutter/glx/clutter-glx-texture-pixmap.c:
Move the gl extension probe into the regular object init() rather than
class_init. Should be a little safer.
* clutter/clutter-texture.c:
Minor reformatting cleanups. Emit filter-quality prop on change.
* clutter/glx/clutter-glx-texture-pixmap.c:
Support mipmaps via filter quality prop.
Bug #948 - Remove texture rectangle support
* clutter/clutter-feature.c:
* clutter/clutter-feature.h:
* clutter/clutter-texture.c:
* clutter/cogl/gl/cogl.c:
* clutter/glx/clutter-glx-texture-pixmap.c:
Remove support for GL_TEXTURE_RECTANGLE_ARB (now using just regular
2D textures, with optional npots extension). Simplifys code, + makes
mipmap & shader support much more sane.
* clutter/glx/clutter-glx-texture-pixmap.c:
Dont always fallback to x11 (slow) updates for a single
failed pixmap.
Minor cleanups.
* clutter/x11/clutter-x11-texture-pixmap.c:
Move shm allocation to only area updates.
* clutter/eglx/Makefile.am: Fix the INCLUDE directives to
properly include the X11 backend headers.
* clutter/glx/Makefile.am: Add the libclutter-x11.la static
library to the LDADD directives.
* clutter/glx/Makefile.am:
* clutter/x11/Makefile.am:
Install glx and x11 specific includes into clutter/glx and
clutter/x11 so that header files that include glx/*.h or x11/*.h
when installed.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_unrealize): Move the shaders release from here...
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_dispose): ... to here. Shaders should be
released when the GL context is being destroyed, and that only
happens when the backend is being disposed, now that we support
multiple stages.
* clutter/clutter-backend.c:
(_clutter_backend_create_stage): Call _clutter_stage_set_window()
ourselves, thus removing yet another action that backends must
implement and might get wrong; also cuts a backend-agnostic piece
of code duplication.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_create_stage): Update the EGL native backend.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_create_stage): Update the EGLX backend.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_egl_create_stage): Update the fruity backend
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Update the GLX backend.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_create_stage): Update the SDL backend.
* HACKING.backends: Update the ::create_stage() description.
Rework the stage wrapper/implementation relation: remove
duplicated code and all the bookkeeping from the backends into
ClutterStage whenever possible, to reduce the amount of work a
backend must do (and possibly get wrong). Thanks to Tommi
Komulainen.
* clutter/clutter-main.c:
(clutter_init_with_args), (clutter_init): Realize the default
stage after creation. The default stage is special, because we
use it in the initialization sequence. This removes the burden
from the backends and reduces the things a backend can get
wrong.
* clutter/clutter-stage.c:
(clutter_stage_show): Make sure to realize the implementation if
it hasn't been realized yet.
(clutter_stage_realize): Set the REALIZED flag and call
clutter_stage_ensure_current() if the implementation was
successfully realized.
(clutter_stage_unrealized): Call clutter_stage_ensure_current()
on unrealize.
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Do not realize the stage anymore
when creating it, and let the normal realization sequence take
place.
(clutter_backend_glx_ensure_context): Trap for X11 errors.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_realize): Chain up to the X11 implementation
so that we can set up the window state (title, cursor visibility)
when we actually have a X window. Also, do not call
clutter_stage_ensure_current(), and rely on the wrapper to do
it for us. This means we can drop setting the REALIZED flag on
the wrapper.
(clutter_stage_glx_unrealize): Do not call
clutter_stage_ensure_current() ourselves, and rely on the wrapper
to do it for us.
* clutter/x11/clutter-stage-x11.c:
(set_wm_title), (set_cursor_visible): Move the WM title and
cursor visibility code inside their own functions.
(clutter_stage_x11_realize): Set the window title and whether the
cursor is visible or not after realizing the stage.
(clutter_stage_x11_set_cursor_visible),
(clutter_stage_x11_set_title): Call set_wm_title() and
set_cursor_visible().
(clutter_stage_x11_finalize): Free the title string.
* clutter/x11/clutter-stage-x11.h: Save more of the stage state,
so that we can set it even when the stage hasn't been realized
yet.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_create_stage):
* clutter/eglnative/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglnative backend.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_ensure_context),
(clutter_backend_egl_create_stage):
* clutter/eglx/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglx backend.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_create_stage):
* clutter/sdl/clutter-stage-sdl.c:
(clutter_stage_sdl_realize): Update the sdl backend.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_fruity_create_stage):
* clutter/sdl/clutter-stage-fruity.c:
(clutter_stage_fruity_realize): Update the fruity backend.
* tests/test-multistage.c (on_button_press): Bail out if
clutter_stage_new() returns NULL.
* HACKING.backends: Update backend writing documentation.
* clutter/cogl/gl(es)/cogl-texture.h:
* clutter/cogl/gl(es)/cogl-texture.c:
cogl_texture_new_* functions take a gboolean auto_mipmap argument.
If TRUE automatic mipmap generation is enabled during the process
of slice texture object creation.
(cogl_texture_new_from_foreign:) now allows mipmap min filter
flags.
* clutter/clutter-texture.c:
* clutter/glx/clutter-glx-texture-pixmap.c:
* tests/test-cogl-offscreen.c:
* tests/test-cogl-tex-tile.c:
* tests/test-cogl-tex-convert.c:
* tests/test-cogl-tex-polygon.c:
* tests/test-cogl-tex-getset.c:
Pass FALSE for auto_mipmap to cogl_texture_new_*.
* clutter/pango/pangoclutter-render.c:
(tc_get:) Pass TRUE to cogl_texture_new_with_size and use mipmap
min filter for nicer glyphs at small scales. As a result test-text
has gone all beautiful now.
* clutter/glx/clutter-glx-texture-pixmap.c:
* tests/test-pixmap.c:
Fix up texture-pixmap, now works.
Thanks to Neil for spotting we were actually using
wrong texture type in fbconfig (COGL change).
Work related to #873;
* clutter/glx/clutter-backend-glx.c:
* clutter/glx/clutter-backend-glx.h:
* clutter/x11/clutter-x11-texture-pixmap.c:
* clutter/x11/clutter-x11-texture-pixmap.h:
General cleanup of texture pixmap code, adding;
- Pixmap dimentions and depth now auto probed, read only props.
- More X safety traps
- Add support for optionally tracking damage and automatically
updating texture.
* clutter/glx/clutter-glx-texture-pixmap.c:
* clutter/glx/clutter-glx-texture-pixmap.h:
General cleanup and some safety additions. Needs more work so
'proper' subclass - dependent on new COGL.
* clutter/x11/clutter-backend-x11.c: (clutter_x11_remove_filter):
Invert g_return_if check.
* configure.ac:
Pull in XComposite and XDamage (at least for now)
* tests/Makefile.am:
* tests/test-pixmap.c:
Add a modified test from Johan for above.
* README: Add a note about the Shader API changes.
* clutter/clutter-deprecated.h: Add deprecation symbols.
* clutter/clutter-shader.[ch]: Rename the :bound read-only
property to :compiled. Also rename clutter_shader_bind()
and clutter_shader_is_bound() to clutter_shader_compil() and
clutter_shader_is_compiled(), respectively.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_unrealize): Update after
clutter_shader_release_all() rename.
* tests/test-shader.c (button_release_cb), (main): Update.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_ensure_context): Sync up with the GLX
backend.
(clutter_backend_egl_create_stage): Dumb compilation fix.
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Unref the stage if we are
erroring out.
* clutter/clutter-backend.c: Add more debug messages
* clutter/clutter-stage.h:
* clutter/clutter-stage.c:
(clutter_stage_is_default): Add a function to check if the
stage is the default one.
* clutter/glx/clutter-backend-glx.c:
* clutter/glx/clutter-stage-glx.c:
* clutter/x11/clutter-stage-x11.c: Keep the stage wrapper
and implementation flags in sync, to ensure that the GL
context is always set.
Bug #864 - Allow instantiating and subclassing of ClutterStage
* clutter/Makefile.am: Add clutter-stage-window.[ch]
* clutter/clutter-stage-manager.c:
(_clutter_stage_manager_remove_stage): Do not warn if removing
a stage we don't manage, as we might be invoked multiple times
during a ClutterState dispose sequence.
* clutter/clutter-actor.c:
* clutter/clutter-backend.[ch]:
* clutter/clutter-main.c:
* clutter/clutter-private.h:
* clutter/clutter-stage.[ch]: Make ClutterStage a proxy actor,
with a private actor implementing the ClutterStageWindow
interface for handling the per-backend realization, painting
and unrealization, plus all the windowing system abstraction.
* clutter/x11/clutter-event-x11.c:
* clutter/x11/clutter-stage-x11.[ch]: Port the X11 backend
to the new backend and stage API and semantics.
* clutter/glx/clutter-backend-glx.c:
* clutter/glx/clutter-stage-glx.c: Port the GLX backend to
the new backend and stage API and semantics.
* clutter/eglx/clutter-backend-egl.[ch]:
* clutter/eglx/clutter-stage-egl.[ch]: Port the EGLX backend
to the new backend and stage API and semantics (untested).
* tests/test-multistage.c (on_button_press): Rename
clutter_stage_create_new() to clutter_stage_new().