Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1516 - Does not withdraw toplevels correctly
clutter_stage_x11_hide() needs to use XWithdrawWindow(), not
XUnmapWindow().
As it stands now, if the window is already unmapped (say the WM has
minimized it), then the WM will not know that Clutter has closed the
window and will keep the window managed, showing it in the task list
and so forth.
A lockup was reported by fargoilas on #clutter and removing the server grab in
clutter_x11_texture_pixmap_sync_window fixed the problem.
We were doing an x server grab to guarantee that if the XGetWindowAttributes
request reported that our redirected window was viewable then we would also
be able to get a valid pixmap name. (the composite protocol says it's an
error to request a name for a window if it's not viewable) Without the grab
there would be a race condition.
Instead we now handle error conditions gracefully.
If the stage is unrealized (such as will be the case if the stage was
created with clutter_stage_new) then it would set the size of the
stage display but it was not setting the fullscreen_on_map flag so it
never got the _NET_WM_STATE_FULLSCREEN property. Now it always sets
the flag regardless of whether the window is created yet.
There was also problems with dual-headed displays because in that case
DisplayWidth/Height will return the size of the combined display but
Metacity (and presumably other WMs) will sensibly try fit the window
to only one of the monitors. However we were setting the size hints so
that the minimum size is that of the combined display. Metacity tries
to honour this by setting the minimum size but then it no longer
positions the window at the top left of the screen.
The patch makes it avoid setting the minimum size when the stage is
fullscreen by checking the fullscreen_on_map flag. This also means we
can remove the static was_resizable flag which would presumably have
caused problems for multi-stage.
The call to "cmp" to compare a built file with its current version
should use the -s (silent) command line switch. This avoids a ugly
message on the console when building Clutter the first time.
The clutter_get_current_event_time() function will return the event
timestamp coming from a Clutter event. Clutter might synthesize or
throttle events, so the function cannot be used when dealing with
backend-specific use cases.
The X11 backend is the only backend supported by Clutter that makes
use of timestamps, so it's altogether fitting that it should come
with a specific function to deal with the timestamps of the X events.
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.
clutter-x11.h declares clutter_x11_set_display twice, which means code using
clutter doesn't compile cleanly with -Wredundant-decls.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
When processing a motion event, we need to spin the event loop two extra
times to ensure that any enter/leave events that might have been synthesized
are pumped through (otherwise they end up being pushed down the queue and
never processed).
While X11 Pixmap and Window types only have 32-bits of data, they
are actually 'unsigned long'. Change the "window" and "pixmap"
property of ClutterX11TexturePixmaps to be ulong.
This fixes 64-bit bugs where ClutterGLXTexturePixmap passed a
reference to Pixmap to g_object_get("pixmap", &pixmap, ...);
http://bugzilla.openedhand.com/show_bug.cgi?id=1405
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Since Clutter changed to using a layout scheme the handling_configure
flag no longer works because the allocate method is not invoked
immediately during the call to set_size from the ConfigureNotify
handler. However it is also no longer neccessary because the resizes
are effectively batched up until a relayout is run so it won't cause
an infinite loop of resize and notify events anyway.
Continuation of the fix in commit 00a3c69868.
Instead of using a separate flag for the resize process, just
delay the setting of the CLUTTER_ACTOR_SYNC_MATRICES flag on the
stage to the point when we receive a ConfigureNotify event from
X11.
This commit will break the stage embedding into other toolkits.
There is a race condition when we resize a stage before showing
it on X11.
The race goes like this:
- clutter_init() creates the default stage and realize it, which
will cause a 640x480 Window to be created
- call set_size(800, 600) on the stage will cause the Window to be
resized to 800x600
- call show() on the stage for the first time will cause COGL
to set up an 800 by 600 GL viewport
- the Window will be mapped, which will cause X to notify the
window manager that the Window should be resized to 800x600
- the window manager will approve the resize
- X resizes the drawable to 800x600
To fix the race, we need to defer COGL from setting up the viewport
until we receive a ConfigureNotify event and the X server has resized
the Drawable.
In order to defer the call to cogl_setup_viewport() we add a new
private flag, CLUTTER_STAGE_IN_RESIZE; the flag is checked whenever
we need to change the viewport size along with the SYNC_MATRICES
private flag. Thus, cogl_setup_viewport() will be called only if
SYNC_MATRICES is set and IN_RESIZE is not set.
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>
Instead of returning CLUTTER_X11_FILTER_CONTINUE always from
clutter_x11_handle_event() return CLUTTER_X11_FILTER_REMOVE if
the event was on a stage and translated to a ClutterEvent.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
* 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.
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/clutter-main.c:
* clutter/clutter-main.h:
* clutter/clutter-private.h:
* clutter/x11/clutter-backend-x11.c:
(clutter_get_option_group_without_init):
Function to obtain clutter option group without opening display
(for use with foreign display and gtk_clutter_init). Bug 1033.
Stripped trailing whitespace.
* clutter/x11/clutter-backend-x11.c: Properly document the
usage of clutter_x11_set_display().
* clutter/x11/clutter-x11.h: clutter_x11_set_display() is
public API and should be declared in the header we install.
* 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>).
* 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 1000 - clutter-x11 should define gtypes for its enumerations
* clutter/x11/Makefile.am:
* clutter/x11/clutter-event-x11.c:
* clutter/x11/clutter-x11-enum-types.c.in:
* clutter/x11/clutter-x11-enum-types.h.in:
* clutter/x11/clutter-x11.h: Add the GTypes for the X11-specific
enumerations, so that they can be used by the bindings. (Andy
Wingo)
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/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_get_display_size): Add a function for getting the
display size out of the backend.
* clutter/clutter-stage.c:
(clutter_stage_allocate): When allocating on a backend with a
static stage, we simply ignore the passed box and override it with
the size of the display.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_get_display_size),
(clutter_backend_egl_class_init): Implement get_display_size() by
returning the size of the EGL surface.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_egl_get_display_size),
(clutter_backend_egl_class_init): Ditto as above.
* clutter/x11/clutter-backend-x11.c:
(clutter_backend_x11_get_display_size),
(clutter_backend_x11_class_init): Implement get_display_size() by
returning the DisplayWidth and DisplayHeight of the current
screen.
* clutter/x11/clutter-event-x11.c (event_translate): Set the
event type explicitly in the union members as well for the
key events, like we do for all the other events.
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.