Commit Graph

25 Commits

Author SHA1 Message Date
Emmanuele Bassi
eae4561929 Clean up the private flags for ClutterActor
Provide macros to quickly query a flag, and remove all namespacing
except the initial 'CLUTTER'.
2010-07-21 16:10:46 +01:00
Emmanuele Bassi
e95a0c194f Remove default settings from backends
The defaults are set in the Settings instance.
2010-06-21 17:57:57 +01:00
Emmanuele Bassi
79acb088e7 Remove mentions of the FSF address
Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.

Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.

As a side note: this commit closes the oldes bug in Clutter's bug
report tool.

http://bugzilla.openedhand.com/show_bug.cgi?id=521
2010-03-01 12:56:10 +00:00
Neil Roberts
a2afc9d7ba win32: Fixup compilation errors from b398292089
That commit added some Win32 code which breaks compilation.

Thanks to Samuel Degrande for help with this.
2010-02-18 11:36:15 +00:00
Emmanuele Bassi
b398292089 device: Impose per-backend DeviceManager
The DeviceManager class should be abstract in Clutter, and implemented
by each backend, as different backends will have different ways to
detect, initialize and list devices; the X11 backend alone has *two*
ways of dealing with devices.

This commit makes DeviceManager an abstract class and delegates the
device initialization and enumeration to per-backend sub-classes.

The responsible for creating the device manager is, obviously, the
backend singleton.

The X11 and Win32 backends have been updated to the new layout; the
Win32 backend has been updated blindly, so it might require additional
testing.
2010-02-17 17:46:48 +00:00
Neil Roberts
ae188d203c win32: Use a dummy window to support delayed stage creation
The Win32 backend now implements the create_context method which
creates a context and binds it to a 1x1 invisible window. That way
there will always be a context bound and the features can be retrieved
without creating the default stage. This reflects the changes in
1c6ffc8..b245d55 to the GLX backend.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
74dbcede25 win32: Experimental implementation of device support
Mostly lifted from the core pointer and keyboard X11 backend support.

The win32 backend registers two devices (a core pointer and a core
keyboard) and assigns them to the event structure when doing the
translation from native events to Clutter events.

Thanks to: Samuel Degrande <Samuel.Degrande@lifl.fr> for testing this
patch.
2010-01-20 00:38:09 +00:00
Neil Roberts
14a28620ae win32: Use an invisible cursor when cursor-visible is FALSE
The win32 backend now handles the WM_SETCURSOR message and sets a
fully transparent cursor if the cursor-visible property has been
cleared on the stage. The icon is stored in the library via a resource
file. The instance handle for the DLL is needed to load the resource
so there is now a DllMain function to grab the handle.
2010-01-19 16:10:23 +00:00
Samuel Degrande
26ce94eda0 Adapt win32 backend to the semantic change of StageWindow
http://bugzilla.openedhand.com/show_bug.cgi?id=1847

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-11-13 15:50:00 +00:00
Robert Bragg
6d9498da7c Adds a cogl_flush() to give developers breaking into raw GL a fighting chance
This function should only need to be called in exceptional circumstances
since Cogl can normally determine internally when a flush is necessary.

As an optimization Cogl drawing functions may batch up primitives
internally, so if you are trying to use raw GL outside of Cogl you stand a
better chance of being successful if you ask Cogl to flush any batched
geometry before making your state changes.

cogl_flush() ensures that the underlying driver is issued all the commands
necessary to draw the batched primitives.  It provides no guarantees about
when the driver will complete the rendering.

This provides no guarantees about the GL state upon returning and to avoid
confusing Cogl you should aim to restore any changes you make before
resuming use of Cogl.

If you are making state changes with the intention of affecting Cogl drawing
primitives you are 100% on your own since you stand a good chance of
conflicting with Cogl internals.  For example clutter-gst which currently
uses direct GL calls to bind ARBfp programs will very likely break when Cogl
starts to use ARBfb programs internally for the material API, but for now it
can use cogl_flush() to at least ensure that the ARBfp program isn't applied
to additional primitives.

This does not provide a robust generalized solution supporting safe use of
raw GL, its use is very much discouraged.
2009-06-30 17:13:38 +01:00
Robert Bragg
845ff67301 [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes
Previously the journal was always flushed at the end of
_cogl_rectangles_with_multitexture_coords, (i.e.  the end of any
cogl_rectangle* calls) but now we have broadened the potential for batching
geometry.  In ideal circumstances we will only flush once per scene.

In summary the journal works like this:

When you use any of the cogl_rectangle* APIs then nothing is emitted to the
GPU at this point, we just log one or more quads into the journal.  A
journal entry consists of the quad coordinates, an associated material
reference, and a modelview matrix.  Ideally the journal only gets flushed
once at the end of a scene, but in fact there are things to consider that
may cause unwanted flushing, including:

- modifying materials mid-scene
    This is because each quad in the journal has an associated material
    reference (i.e. not copy), so if you try and modify a material that is
    already referenced in the journal we force a flush first)

    NOTE: For now this means you should avoid using cogl_set_source_color()
	      since that currently uses a single shared material. Later we
	  should change it to use a pool of materials that is recycled
	  when the journal is flushed.

- modifying any state that isn't currently logged, such as depth, fog and
  backface culling enables.

The first thing that happens when flushing, is to upload all the vertex data
associated with the journal into a single VBO.

We then go through a process of splitting up the journal into batches that
have compatible state so they can be emitted to the GPU together.  This is
currently broken up into 3 levels so we can stagger the state changes:

1) we break the journal up according to changes in the number of material layers
   associated with logged quads. The number of layers in a material determines
   the stride of the associated vertices, so we have to update our vertex
   array offsets at this level. (i.e. calling gl{Vertex,Color},Pointer etc)
2) we further split batches up according to material compatability. (e.g.
   materials with different textures) We flush material state at this level.
3) Finally we split batches up according to modelview changes. At this level
   we update the modelview matrix and actually emit the actual draw command.

This commit is largely about putting the initial design in-place; this will be
followed by other changes that take advantage of the extended batching.
2009-06-30 17:13:34 +01:00
Emmanuele Bassi
c6fba47a52 Hide clutter_context_get_default()
The clutter_context_get_default() function is private, but shared
across Clutter. For this reason, it should be prefixed by '_' so
that the symbol is hidden from the shared object.
2009-06-18 14:20:28 +01:00
Emmanuele Bassi
ccca24ab76 Remove usage of the grave accent as quotation mark
See:

  http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

This should make Thomas happy.
2009-03-17 14:13:31 +00:00
Neil Roberts
abbcf0ee4b * clutter/win32/clutter-backend-win32.c (check_vblank_env): Use
g_ascii_strcasecmp instead of strcasecmp because strcasecmp isn't
	available in MSVC.
2008-06-30 16:08:45 +00:00
Emmanuele Bassi
a07d57572c 2008-06-26 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c:
	(clutter_actor_set_min_width),
	(clutter_actor_set_min_height),
	(clutter_actor_set_natural_width),
	(clutter_actor_set_natural_height): Ignore any override of the
	minimum and natural size of the stage on backends that only
	support static stages.

	* clutter/clutter-stage.c (clutter_stage_allocate): Use the
	preferred size of the ClutterStage implementation instead of
	the display size.

	* clutter/clutter-backend.[ch]: Remove get_display_size() and
	clutter_backend_get_display_size().

	* clutter/eglnative/clutter-backend-egl.c:
	* clutter/fruity/clutter-backend-fruity.c:
	* clutter/osx/clutter-backend-osx.c:
	* clutter/sdl/clutter-backend-sdl.c:
	* clutter/win32/clutter-backend-win32.c:
	* clutter/x11/clutter-backend-x11.c: Remove get_display_size()
	implementations.
2008-06-26 21:42:44 +00:00
Neil Roberts
5f3db8e0a0 * clutter/win32/clutter-backend-win32.c
(clutter_backend_win32_get_display_size): Implement
	get_display_size on the Win32 backend.
2008-06-25 16:51:43 +00:00
Neil Roberts
feb16bcf95 Bug 979 - Wrong call convension for SwapIntervalProc in win32 backend
* clutter/win32/clutter-backend-win32.c: Use the correct calling
	convention for SwapInterval. Thanks to Haakon Sporsheim.
2008-06-24 22:07:15 +00:00
Neil Roberts
bfaacb10bf * clutter/win32/clutter-event-win32.c (message_translate): Fix
signedness of old_xpos and old_ypos to get rid of compiler
	warnings.

	* clutter/win32/clutter-backend-win32.c
	(clutter_backend_win32_get_features): Cast the result of
	glGetString to a signed char pointer to avoid compiler warnings.
2008-05-16 09:47:37 +00:00
Neil Roberts
8ef653a9e8 * clutter/win32/clutter-stage-win32.c:
* clutter/win32/clutter-backend-win32.c: Reflect changes to the
	GLX/X11 backend in revisions 2708-2709 and 2713-2715 which
	simplify the backend a little.
2008-05-15 22:03:22 +00:00
Neil Roberts
6409b1adeb Merged clutter-ivan branch into trunk.
svn merge \
 https://svn.o-hand.com/repos/clutter/trunk/clutter@2509 \
 https://svn.o-hand.com/repos/clutter/branches/clutter-ivan@HEAD
2008-04-25 13:37:36 +00:00
Neil Roberts
3d1f2a0859 Added support for foreign windows to the Win32 backend.
* clutter/win32/clutter-stage-win32.c
	(clutter_stage_win32_request_coords): Don't resize foreign
	windows.
	(clutter_stage_win32_unrealize): Don't destroy foreign windows.
	(clutter_stage_win32_init): Added initialiser for is_foreign_win.
	(clutter_win32_get_stage_from_window): Resort to looking in the
	stage list if the window isn't the right window class so that it
	can still find stages with foreign windows.
	(clutter_win32_set_stage_foreign): New public function to set a
	foreign window for a stage.

	* clutter/win32/clutter-event-win32.c
	(clutter_win32_disable_event_retrieval): New public function to
	disable event retrieval.
	(message_translate): Don't handle WM_SIZE or WM_MOVE for foreign
	windows.

	* clutter/win32/clutter-backend-win32.h (struct
	_ClutterBackendWin32): Added a flag to disable event retrieval

	* clutter/win32/clutter-backend-win32.c
	(clutter_backend_win32_ensure_context): Update debug note to
	include whether the stage is foreign or not.
2008-04-15 16:12:37 +00:00
Neil Roberts
0b8a500fca Upgraded the Win32 backend to work with the multi-stage
subclassing code.

	* clutter/win32/clutter-stage-win32.h: 
	* clutter/win32/clutter-stage-win32.c: Now inherits from
	ClutterGroup and implements ClutterStageWindow instead of
	inheriting directly from ClutterStage.

	* clutter/win32/clutter-event-win32.c (message_translate): Now
	takes an extra parameter to return whether DefWindowProc should be
	called. This is needed to prevent the default WM_CLOSE handler
	from destroying the window.

	* clutter/win32/clutter-backend-win32.c
	(clutter_backend_win32_dispose): Destroy all of the stages using
	g_slist_foreach as per bug #871. Now also destroys the GL context.
	(clutter_backend_win32_get_features): Added assertions to ensure
	there is a valid GL context.
	(clutter_backend_win32_ensure_context): Accepts NULL stage. Gets
	implementation pointer from the stage.
2008-04-13 08:43:32 +00:00
Neil Roberts
e88c8b4ce1 2008-03-30 Neil Roberts <neil@o-hand.com>
* clutter/win32/clutter-backend-win32.c
	(clutter_backend_win32_init): Added a call to
	timeBeginPeriod. Without this the frame rates are terrible because
	the glib timeouts are not accurate enough. However this requires
	Glib >= 2.16.0 to take any effect because of a change in the way
	g_poll is implemented. See revision 6597 of glib.
	(clutter_backend_win32_finalize): Added a call to timeEndPeriod.

	* configure.ac: Added -lwinmm to the library dependencies for the
	Win32 backend.
2008-03-30 22:27:27 +00:00
Neil Roberts
1a263dca5c 2008-03-30 Neil Roberts <neil@o-hand.com>
* clutter/win32/clutter-win32.h: 
	* clutter/win32/clutter-stage-win32.h: 
	* clutter/win32/clutter-stage-win32.c: 
	* clutter/win32/clutter-event-win32.c: 
	* clutter/win32/clutter-backend-win32.h: 
	* clutter/win32/clutter-backend-win32.c:
	Upgraded for multi-stage support.

	* clutter/win32/clutter-stage-win32.c
	(clutter_stage_win32_request_coords): Fixed so that it doesn't set
	the position or size if it hasn't changed. This was causing
	problems when the window was resized using the top left corner. In
	that case the window receives resize and move messages separately
	which caused the window to flash at a different size or position
	while one message was handled before the other.
	(clutter_stage_win32_realize): Added PFD_GENERIC_ACCELERATED to
	the list of pixel format flags to force it to use hardware
	acceleration.

2008-03-30  Neil Roberts  <neil@o-hand.com>

	* clutter-sections.txt: Added clutter_win32_get_stage_from_window
2008-03-30 16:51:01 +00:00
Neil Roberts
051ed6b43b 2008-03-25 Neil Roberts <neil@o-hand.com>
Added a native Win32 WGL backend.

	* configure.ac: Added the 'win32' flavour.

	* clutter/cogl/gl/cogl.c (cogl_get_proc_address): Added an ifdef
	to use wglGetProcAddress with the Win32 backend.

	* clutter/Makefile.am (DIST_SUBDIRS): Added the win32 directory.

	* clutter/win32/clutter-win32.pc.in:
	* clutter/win32/clutter-win32.h: 
	* clutter/win32/clutter-stage-win32.h: 
	* clutter/win32/clutter-stage-win32.c: 
	* clutter/win32/clutter-event-win32.c: 
	* clutter/win32/clutter-backend-win32.h: 
	* clutter/win32/Makefile.am:
	* clutter/win32/clutter-backend-win32.c: New files.
2008-03-25 15:42:50 +00:00