Merge branch 'master' into msvc-support-master
This commit is contained in:
commit
bb9e452a36
2
.gitignore
vendored
2
.gitignore
vendored
@ -22,7 +22,7 @@ stamp-marshal
|
||||
/clutter/clutter-version.h
|
||||
/clutter/gcov-report.txt
|
||||
/clutter/clutter-json.h
|
||||
/clutter/cogl/clutter-cex100.h
|
||||
/clutter/egl/clutter-cex100.h
|
||||
/build/autotools/*.m4
|
||||
!/build/autotools/introspection.m4
|
||||
!/build/autotools/as-linguas.m4
|
||||
|
51
README.in
51
README.in
@ -25,12 +25,6 @@ On X11, Clutter depends on the following extensions
|
||||
• XInput (1.x or 2.x)
|
||||
• XKB
|
||||
|
||||
When running the OpenGL flavor, Clutter requires at least version 1.3
|
||||
or 1.2 with the multitexturing extension. However to build Clutter
|
||||
you will need the latest GL headers which can be obtained from:
|
||||
|
||||
http://www.khronos.org
|
||||
|
||||
If you are building the API reference you will also need:
|
||||
|
||||
• GTK-Doc ≥ @GTK_DOC_REQ_VERSION@
|
||||
@ -76,6 +70,7 @@ The Clutter Cookbook is available at:
|
||||
New releases of Clutter are available at:
|
||||
|
||||
http://source.clutter-project.org/sources/clutter/
|
||||
http://download.gnome.org/sources/clutter/
|
||||
|
||||
The Clutter blog is available at:
|
||||
|
||||
@ -114,7 +109,7 @@ See also the wiki page:
|
||||
|
||||
Clutter has additional command line options for the configure script:
|
||||
|
||||
--enable-debug=[no/minimum/yes]
|
||||
--enable-debug=[no/minimum/yes/error]
|
||||
Controls Clutter debugging level:
|
||||
|
||||
yes:
|
||||
@ -156,38 +151,38 @@ Clutter has additional command line options for the configure script:
|
||||
--enable-conform=[yes/no]
|
||||
Build the Clutter conformance test suite.
|
||||
|
||||
--enable-deprecated=[yes/no]
|
||||
Whether deprecated symbols should be available when compiling Clutter.
|
||||
|
||||
--disable-Bsymbolic
|
||||
Disable linking with -Bsymbolic.
|
||||
|
||||
--with-flavour
|
||||
Select the Clutter backend: (default=glx)
|
||||
--enable-x11-backend=[yes/no/check]
|
||||
Enable the X11 backend. (default=check)
|
||||
|
||||
glx:
|
||||
Fully featured GLX backend.
|
||||
--enable-win32-backend=[yes/no/check]
|
||||
Enable the native Microsoft Windows backend. (default=check)
|
||||
|
||||
opengl-egl-xlib:
|
||||
EGL/Open GL backend for X11.
|
||||
--enable-quartz-backend=[yes/no/check]
|
||||
Enable the native Quartz backend. (default=check)
|
||||
|
||||
wayland:
|
||||
EGL/Open GL backend for Wayland. (EXPERIMENTAL)
|
||||
--enable-gdk-backend=[yes/no/check]
|
||||
Enable the GDK backend. (default=check)
|
||||
|
||||
eglx:
|
||||
EGL/Open GL|ES backend for X11.
|
||||
--enable-wayland-backend=[yes/no]
|
||||
Enable the Wayland client backend. (default=no)
|
||||
|
||||
eglnative:
|
||||
EGL/Open GL|ES backend on 'native windowing system' - i.e
|
||||
raw framebuffer. Expects the EGL implementation to provide
|
||||
a createNativeWindow() call.
|
||||
--enable-egl-backend=[yes/no]
|
||||
Enable the EGL framebuffer backend. (default=no)
|
||||
|
||||
cex100:
|
||||
EGL/Open GL|ES backend on Intel CE3100 and CE4100 platforms.
|
||||
Requires libgdl.
|
||||
--with-tslib=[yes/no]
|
||||
Use TSLib for the input events. (default=yes)
|
||||
|
||||
osx:
|
||||
OS X backend. (EXPERIMENTAL)
|
||||
--with-evdev=[yes/no]
|
||||
Use evdev for the input events. (default=yes)
|
||||
|
||||
win32:
|
||||
Microsoft Windows(tm) WGL backend.
|
||||
--with-gdl=[yes/no]
|
||||
Use libgdl for CEx100 platforms. (default=no)
|
||||
|
||||
See also the INSTALL file generated by autotools for further information.
|
||||
|
||||
|
@ -14,8 +14,6 @@ lib_LTLIBRARIES =
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/clutter \
|
||||
-I$(top_srcdir)/clutter/$(CLUTTER_WINSYS) \
|
||||
-I$(top_srcdir)/clutter/$(CLUTTER_WINSYS_BASE) \
|
||||
-I$(top_srcdir)/clutter/deprecated \
|
||||
-I$(top_srcdir)/clutter/cally \
|
||||
-I$(top_builddir) \
|
||||
@ -92,7 +90,6 @@ source_h = \
|
||||
$(srcdir)/clutter-input-device.h \
|
||||
$(srcdir)/clutter-interval.h \
|
||||
$(srcdir)/clutter-keysyms.h \
|
||||
$(srcdir)/clutter-keysyms-compat.h \
|
||||
$(srcdir)/clutter-layout-manager.h \
|
||||
$(srcdir)/clutter-layout-meta.h \
|
||||
$(srcdir)/clutter-list-model.h \
|
||||
@ -233,6 +230,8 @@ source_c_priv = \
|
||||
|
||||
# deprecated installed headers
|
||||
deprecated_h = \
|
||||
$(srcdir)/deprecated/clutter-actor.h \
|
||||
$(srcdir)/deprecated/clutter-backend.h \
|
||||
$(srcdir)/deprecated/clutter-behaviour.h \
|
||||
$(srcdir)/deprecated/clutter-behaviour-depth.h \
|
||||
$(srcdir)/deprecated/clutter-behaviour-ellipse.h \
|
||||
@ -242,9 +241,13 @@ deprecated_h = \
|
||||
$(srcdir)/deprecated/clutter-behaviour-scale.h \
|
||||
$(srcdir)/deprecated/clutter-fixed.h \
|
||||
$(srcdir)/deprecated/clutter-frame-source.h \
|
||||
$(srcdir)/deprecated/clutter-group.h \
|
||||
$(srcdir)/deprecated/clutter-keysyms.h \
|
||||
$(srcdir)/deprecated/clutter-main.h \
|
||||
$(srcdir)/deprecated/clutter-timeout-pool.h \
|
||||
$(srcdir)/deprecated/clutter-score.h \
|
||||
$(srcdir)/deprecated/clutter-shader.h \
|
||||
$(srcdir)/deprecated/clutter-stage.h \
|
||||
$(NULL)
|
||||
|
||||
# deprecated source code
|
||||
@ -298,6 +301,13 @@ EXTRA_DIST += clutter-keysyms-update.pl
|
||||
|
||||
pc_files += clutter-$(CLUTTER_API_VERSION).pc
|
||||
|
||||
# in order to be compatible with Clutter < 1.10, when we shipped a single
|
||||
# shared library whose name was determined by the single backend it
|
||||
# supported, we need to install symbolic links so that existing applications
|
||||
# using Clutter won't break in the Brave New World of multi-backend support
|
||||
# in the same shared object.
|
||||
compat_libs =
|
||||
|
||||
# backends source listings
|
||||
#
|
||||
# backend_source_c := source code
|
||||
@ -365,14 +375,13 @@ backend_source_c_priv += $(x11_source_c_priv)
|
||||
# the list of files we want to introspect on X11
|
||||
x11_introspection = $(x11_source_c) $(x11_source_h)
|
||||
|
||||
# pkg-config file for the X11 meta-backend
|
||||
clutterx11_includedir = $(clutter_includedir)/x11
|
||||
clutterx11_include_HEADERS = $(x11_source_h)
|
||||
|
||||
clutter-x11-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-x11-$(CLUTTER_API_VERSION).pc
|
||||
|
||||
clutterx11_includedir = $(clutter_includedir)/x11
|
||||
clutterx11_include_HEADERS = $(x11_source_h)
|
||||
endif # SUPPORT_X11
|
||||
|
||||
# Shared cogl backend files
|
||||
@ -390,14 +399,31 @@ cogl_source_h_priv = \
|
||||
|
||||
cogl_source_c_priv =
|
||||
|
||||
if SUPPORT_X11
|
||||
# For compatability with the old GLX backend
|
||||
if USE_COGL
|
||||
backend_source_h += $(cogl_source_h)
|
||||
backend_source_c += $(cogl_source_c)
|
||||
backend_source_h_priv += $(cogl_source_h_priv)
|
||||
backend_source_c_priv += $(cogl_source_c_priv)
|
||||
|
||||
# pkg-config file for the cogl meta-backend
|
||||
clutter-cogl-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-cogl-$(CLUTTER_API_VERSION).pc
|
||||
endif
|
||||
|
||||
# For compatibility with the old GLX backend
|
||||
#
|
||||
# Note: there wasn't actually anything GLX specific so we can add
|
||||
# the compatability if clutter supports x11
|
||||
backend_source_c += $(srcdir)/cogl/clutter-glx-texture-pixmap.c
|
||||
glx_source_h = $(srcdir)/cogl/clutter-glx-texture-pixmap.h \
|
||||
$(srcdir)/cogl/clutter-glx.h
|
||||
# the compatibility if clutter supports x11
|
||||
glx_source_c = $(srcdir)/x11/clutter-glx-texture-pixmap.c
|
||||
glx_source_h = $(srcdir)/x11/clutter-glx-texture-pixmap.h \
|
||||
$(srcdir)/x11/clutter-glx.h
|
||||
|
||||
if SUPPORT_X11
|
||||
backend_source_h += $(glx_source_h)
|
||||
backend_source_c += $(glx_source_c)
|
||||
|
||||
clutterglx_includedir = $(clutter_includedir)/glx
|
||||
clutterglx_include_HEADERS = $(glx_source_h)
|
||||
|
||||
@ -405,13 +431,49 @@ clutter-glx-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-glx-$(CLUTTER_API_VERSION).pc
|
||||
|
||||
compat_libs += \
|
||||
libclutter-glx-$(CLUTTER_API_VERSION).so \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
if SUPPORT_GLX
|
||||
backend_source_h += $(cogl_source_h) $(glx_source_h)
|
||||
backend_source_c += $(cogl_source_c) $(glx_source_c)
|
||||
backend_source_h_priv += $(cogl_source_h_priv)
|
||||
endif # SUPPORT_GLX
|
||||
# GDK backend rules
|
||||
gdk_source_c = \
|
||||
$(srcdir)/gdk/clutter-backend-gdk.c \
|
||||
$(srcdir)/gdk/clutter-device-manager-gdk.c \
|
||||
$(srcdir)/gdk/clutter-input-device-gdk.c \
|
||||
$(srcdir)/gdk/clutter-event-gdk.c \
|
||||
$(srcdir)/gdk/clutter-stage-gdk.c \
|
||||
$(NULL)
|
||||
|
||||
gdk_source_h = \
|
||||
$(srcdir)/gdk/clutter-gdk.h \
|
||||
$(NULL)
|
||||
|
||||
gdk_source_h_priv = \
|
||||
$(srcdir)/gdk/clutter-settings-gdk.h \
|
||||
$(srcdir)/gdk/clutter-backend-gdk.h \
|
||||
$(srcdir)/gdk/clutter-device-manager-gdk.h \
|
||||
$(srcdir)/gdk/clutter-input-device-gdk.h \
|
||||
$(srcdir)/gdk/clutter-event-gdk.h \
|
||||
$(srcdir)/gdk/clutter-stage-gdk.h \
|
||||
$(NULL)
|
||||
|
||||
if SUPPORT_GDK
|
||||
backend_source_h += $(gdk_source_h)
|
||||
backend_source_c += $(gdk_source_c)
|
||||
backend_source_h_priv += $(gdk_source_h_priv)
|
||||
|
||||
cluttergdk_includedir = $(clutter_includedir)/gdk
|
||||
cluttergdk_include_HEADERS = $(gdk_source_h)
|
||||
|
||||
clutter-gdk-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-gdk-$(CLUTTER_API_VERSION).pc
|
||||
|
||||
gdk_introspection = $(gdk_source_c) $(gdk_source_h)
|
||||
endif # SUPPORT_GDK
|
||||
|
||||
# Windows backend rules
|
||||
win32_source_c = \
|
||||
@ -452,6 +514,11 @@ backend_source_h_priv += $(win32_source_h_priv)
|
||||
|
||||
clutterwin_includedir = $(clutter_includedir)/win32
|
||||
clutterwin_include_HEADERS = $(win32_source_h)
|
||||
|
||||
clutter-win32-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-win32-$(CLUTTER_API_VERSION).pc
|
||||
endif # SUPPORT_WIN32
|
||||
|
||||
EXTRA_DIST += \
|
||||
@ -461,11 +528,16 @@ EXTRA_DIST += \
|
||||
|
||||
# EGL backend rules
|
||||
egl_source_h = \
|
||||
$(srcdir)/cogl/clutter-egl-headers.h \
|
||||
$(srcdir)/cogl/clutter-egl.h \
|
||||
$(srcdir)/egl/clutter-egl-headers.h \
|
||||
$(srcdir)/egl/clutter-egl.h \
|
||||
$(NULL)
|
||||
|
||||
egl_tslib_c = $(srcdir)/cogl/clutter-event-tslib.c
|
||||
egl_source_h_priv = $(srcdir)/egl/clutter-backend-eglnative.h
|
||||
egl_source_c = $(srcdir)/egl/clutter-backend-eglnative.c
|
||||
egl_source_c_priv =
|
||||
|
||||
egl_tslib_h = $(srcdir)/tslib/clutter-event-tslib.h
|
||||
egl_tslib_c = $(srcdir)/tslib/clutter-event-tslib.c
|
||||
|
||||
evdev_c_priv = \
|
||||
$(srcdir)/evdev/clutter-xkb-utils.c \
|
||||
@ -478,31 +550,45 @@ evdev_h_priv = \
|
||||
$(srcdir)/evdev/clutter-input-device-evdev.h \
|
||||
$(NULL)
|
||||
|
||||
cex_h = cogl/clutter-cex100.h
|
||||
cex_h = egl/clutter-cex100.h
|
||||
BUILT_SOURCES += $(cex_h)
|
||||
EXTRA_DIST += $(srcdir)/$(cex_h).in
|
||||
|
||||
if USE_TSLIB
|
||||
backend_source_c_priv += $(egl_tslib_c)
|
||||
egl_source_c_priv += $(egl_tslib_c)
|
||||
egl_source_h_priv += $(egl_tslib_h)
|
||||
endif # SUPPORT_TSLIB
|
||||
|
||||
if SUPPORT_EVDEV
|
||||
backend_source_c_priv += $(evdev_c_priv)
|
||||
backend_source_h_priv += $(evdev_h_priv)
|
||||
if USE_EVDEV
|
||||
egl_source_c_priv += $(evdev_c_priv)
|
||||
egl_source_h_priv += $(evdev_h_priv)
|
||||
endif # SUPPORT_EVDEV
|
||||
|
||||
if SUPPORT_CEX100
|
||||
backend_source_h += $(cex_h)
|
||||
egl_source_h += $(cex_h)
|
||||
|
||||
clutter-cex100-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-cex100-$(CLUTTER_API_VERSION).pc
|
||||
|
||||
compat_libs += \
|
||||
libclutter-cex100-$(CLUTTER_API_VERSION).so \
|
||||
$(NULL)
|
||||
endif # SUPPORT_CEX100
|
||||
|
||||
if SUPPORT_EGL
|
||||
backend_source_h += $(cogl_source_h) $(egl_source_h)
|
||||
backend_source_c += $(cogl_source_c)
|
||||
backend_source_h_priv += $(cogl_source_h_priv)
|
||||
backend_source_c_priv += $(cogl_source_c_priv)
|
||||
backend_source_h += $(egl_source_h)
|
||||
backend_source_c += $(egl_source_c)
|
||||
backend_source_h_priv += $(egl_source_h_priv)
|
||||
|
||||
clutteregl_includedir = $(clutter_includedir)/egl
|
||||
clutteregl_include_HEADERS = $(egl_source_h)
|
||||
|
||||
clutter-egl-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-egl-$(CLUTTER_API_VERSION).pc
|
||||
endif # SUPPORT_EGL
|
||||
|
||||
# OSX backend rules
|
||||
@ -538,6 +624,11 @@ backend_source_c_priv += $(osx_source_c_priv)
|
||||
|
||||
clutterosx_includedir = $(clutter_includedir)/osx
|
||||
clutterosx_include_HEADERS = $(osx_source_h)
|
||||
|
||||
clutter-osx-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-osx-$(CLUTTER_API_VERSION).pc
|
||||
endif # SUPPORT_OSX
|
||||
|
||||
# Wayland backend rules
|
||||
@ -559,6 +650,15 @@ backend_source_c += \
|
||||
|
||||
clutterwayland_includedir = $(clutter_includedir)/wayland
|
||||
clutterwayland_include_HEADERS = $(wayland_source_h)
|
||||
|
||||
clutter-wayland-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-wayland-$(CLUTTER_API_VERSION).pc
|
||||
|
||||
compat_libs += \
|
||||
libclutter-wayland-$(CLUTTER_API_VERSION).so \
|
||||
$(NULL)
|
||||
endif # SUPPORT_WAYLAND
|
||||
|
||||
# cally
|
||||
@ -614,12 +714,6 @@ glib_enum_c = clutter-enum-types.c
|
||||
glib_enum_headers = $(source_h) $(backend_source_h)
|
||||
include $(top_srcdir)/build/autotools/Makefile.am.enums
|
||||
|
||||
# backend-specific pkg-config file
|
||||
clutter-$(CLUTTER_WINSYS)-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc
|
||||
$(QUIET_GEN)cp -f $< $(@F)
|
||||
|
||||
pc_files += clutter-$(CLUTTER_WINSYS)-$(CLUTTER_API_VERSION).pc
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = $(pc_files)
|
||||
DISTCLEANFILES += $(pc_files)
|
||||
@ -632,17 +726,17 @@ nodist_clutter_include_HEADERS = \
|
||||
|
||||
clutter_deprecated_HEADERS = $(deprecated_h)
|
||||
|
||||
lib_LTLIBRARIES += libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
lib_LTLIBRARIES += libclutter-@CLUTTER_API_VERSION@.la
|
||||
|
||||
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LIBADD = \
|
||||
libclutter_@CLUTTER_API_VERSION@_la_LIBADD = \
|
||||
-lm \
|
||||
$(CLUTTER_LIBS) \
|
||||
$(CLUTTER_PROFILE_LIBS)
|
||||
|
||||
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_DEPENDENCIES = \
|
||||
libclutter_@CLUTTER_API_VERSION@_la_DEPENDENCIES = \
|
||||
$(win32_resources)
|
||||
|
||||
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_SOURCES = \
|
||||
libclutter_@CLUTTER_API_VERSION@_la_SOURCES = \
|
||||
$(backend_source_c) \
|
||||
$(backend_source_h) \
|
||||
$(backend_source_c_priv) \
|
||||
@ -660,12 +754,12 @@ libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_SOURCES = \
|
||||
$(cally_sources_private) \
|
||||
$(NULL)
|
||||
|
||||
nodist_libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_SOURCES = \
|
||||
nodist_libclutter_@CLUTTER_API_VERSION@_la_SOURCES = \
|
||||
$(backend_source_built) \
|
||||
$(built_source_c) \
|
||||
$(built_source_h)
|
||||
|
||||
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LDFLAGS = \
|
||||
libclutter_@CLUTTER_API_VERSION@_la_LDFLAGS = \
|
||||
$(CLUTTER_LINK_FLAGS) \
|
||||
$(CLUTTER_LT_LDFLAGS) \
|
||||
$(GCOV_LDFLAGS) \
|
||||
@ -717,15 +811,33 @@ EXTRA_DIST += \
|
||||
# Let the VS9/VS10 Project files be cleared out before they are re-expanded...
|
||||
DISTCLEANFILES += ../build/win32/vs9/clutter.vcproj ../build/win32/vs10/clutter.vcxproj ../build/win32/vs10/clutter.vcxproj.filters
|
||||
|
||||
install-exec-local:
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
for lib in `echo $(compat_libs)`; do \
|
||||
(cd $(DESTDIR)$(libdir) && \
|
||||
rm -f $$lib.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION); \
|
||||
) ; \
|
||||
(cd $(DESTDIR)$(libdir) && \
|
||||
{ ln -s -f libclutter-$(CLUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib.0 || \
|
||||
{ rm -f $$lib.0 && ln -s libclutter-1.0.so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib.0; }; \
|
||||
} \
|
||||
) ; \
|
||||
(cd $(DESTDIR)$(libdir) && \
|
||||
{ ln -s -f libclutter-$(CLUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib || \
|
||||
{ rm -f $$lib && ln -s libclutter-1.0.so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib; }; \
|
||||
} \
|
||||
) ; \
|
||||
done
|
||||
|
||||
# gobject-introspection rules
|
||||
-include $(INTROSPECTION_MAKEFILE)
|
||||
|
||||
if HAVE_INTROSPECTION
|
||||
Clutter-@CLUTTER_API_VERSION@.gir: libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la Makefile
|
||||
Clutter-@CLUTTER_API_VERSION@.gir: libclutter-@CLUTTER_API_VERSION@.la Makefile
|
||||
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Clutter
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_API_VERSION@.la
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_FILES = \
|
||||
$(clutter_include_HEADERS) \
|
||||
$(clutter_deprecated_HEADERS) \
|
||||
@ -733,7 +845,7 @@ Clutter_@CLUTTER_API_VERSION_AM@_gir_FILES = \
|
||||
$(source_c) \
|
||||
$(deprecated_c) \
|
||||
$(built_source_c)
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS) -UCLUTTER_DISABLE_DEPRECATED
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS)
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 cairo-1.0 Cogl-1.0 CoglPango-1.0 Atk-1.0 Json-1.0
|
||||
Clutter_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
|
||||
--warn-all \
|
||||
@ -746,9 +858,9 @@ Cally-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir
|
||||
|
||||
Cally_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Cally
|
||||
Cally_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
|
||||
Cally_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
Cally_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_API_VERSION@.la
|
||||
Cally_@CLUTTER_API_VERSION_AM@_gir_FILES = $(cally_sources_h) $(cally_sources_c)
|
||||
Cally_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS) -UCLUTTER_DISABLE_DEPRECATED
|
||||
Cally_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS)
|
||||
Cally_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
|
||||
--identifier-prefix=Cally \
|
||||
--symbol-prefix=cally \
|
||||
@ -768,13 +880,30 @@ ClutterX11_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
|
||||
--pkg-export=clutter-x11-@CLUTTER_API_VERSION@ \
|
||||
--include-uninstalled=$(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir
|
||||
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = xlib-2.0
|
||||
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_API_VERSION@.la
|
||||
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_FILES = $(x11_introspection)
|
||||
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS) -UCLUTTER_DISABLE_DEPRECATED
|
||||
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS)
|
||||
|
||||
INTROSPECTION_GIRS += ClutterX11-@CLUTTER_API_VERSION@.gir
|
||||
endif # SUPPORT_X11
|
||||
|
||||
if SUPPORT_GDK
|
||||
ClutterGdk-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir
|
||||
|
||||
ClutterGdk_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
|
||||
--identifier-prefix=ClutterGdk \
|
||||
--symbol-prefix=clutter_gdk \
|
||||
--c-include='clutter/gdk/clutter-gdk.h' \
|
||||
--pkg-export=clutter-gdk-@CLUTTER_API_VERSION@ \
|
||||
--include-uninstalled=$(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir
|
||||
ClutterGdk_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = Gdk-3.0
|
||||
ClutterGdk_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_API_VERSION@.la
|
||||
ClutterGdk_@CLUTTER_API_VERSION_AM@_gir_FILES = $(gdk_introspection)
|
||||
ClutterGdk_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS)
|
||||
|
||||
INTROSPECTION_GIRS += ClutterGdk-@CLUTTER_API_VERSION@.gir
|
||||
endif # SUPPORT_GDK
|
||||
|
||||
# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
|
||||
# install anything - we need to install inside our prefix.
|
||||
girdir = $(datadir)/gir-1.0
|
||||
|
@ -397,11 +397,6 @@ void clutter_actor_set_name (ClutterActor
|
||||
const gchar *name);
|
||||
const gchar * clutter_actor_get_name (ClutterActor *self);
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
CLUTTER_DEPRECATED
|
||||
guint32 clutter_actor_get_gid (ClutterActor *self);
|
||||
#endif
|
||||
|
||||
void clutter_actor_set_clip (ClutterActor *self,
|
||||
gfloat xoff,
|
||||
gfloat yoff,
|
||||
@ -470,35 +465,6 @@ gboolean clutter_actor_event (ClutterActor
|
||||
ClutterEvent *event,
|
||||
gboolean capture);
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterActor * clutter_get_actor_by_gid (guint32 id_);
|
||||
#endif
|
||||
|
||||
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_effect)
|
||||
gboolean clutter_actor_set_shader (ClutterActor *self,
|
||||
ClutterShader *shader);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_get_effect)
|
||||
ClutterShader * clutter_actor_get_shader (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform_value)
|
||||
void clutter_actor_set_shader_param (ClutterActor *self,
|
||||
const gchar *param,
|
||||
const GValue *value);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform)
|
||||
void clutter_actor_set_shader_param_int (ClutterActor *self,
|
||||
const gchar *param,
|
||||
gint value);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform)
|
||||
void clutter_actor_set_shader_param_float (ClutterActor *self,
|
||||
const gchar *param,
|
||||
gfloat value);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
void clutter_actor_set_anchor_point (ClutterActor *self,
|
||||
gfloat anchor_x,
|
||||
gfloat anchor_y);
|
||||
|
@ -97,7 +97,6 @@ struct _ClutterAnimatableIface
|
||||
|
||||
GType clutter_animatable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
CLUTTER_DEPRECATED_FOR(clutter_animatable_interpolate_value)
|
||||
gboolean clutter_animatable_animate_property (ClutterAnimatable *animatable,
|
||||
ClutterAnimation *animation,
|
||||
@ -106,7 +105,6 @@ gboolean clutter_animatable_animate_property (ClutterAnimatable *animatable,
|
||||
const GValue *final_value,
|
||||
gdouble progress,
|
||||
GValue *value);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
GParamSpec *clutter_animatable_find_property (ClutterAnimatable *animatable,
|
||||
const gchar *property_name);
|
||||
|
@ -23,6 +23,9 @@
|
||||
#define __CLUTTER_BACKEND_PRIVATE_H__
|
||||
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-device-manager.h>
|
||||
#include <clutter/clutter-stage-window.h>
|
||||
|
||||
#include "clutter-event-translator.h"
|
||||
|
||||
#define CLUTTER_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
|
||||
@ -87,9 +90,6 @@ struct _ClutterBackendClass
|
||||
void (* settings_changed) (ClutterBackend *backend);
|
||||
};
|
||||
|
||||
/* vfuncs implemented by backend */
|
||||
GType _clutter_backend_impl_get_type (void);
|
||||
|
||||
void _clutter_backend_redraw (ClutterBackend *backend,
|
||||
ClutterStage *stage);
|
||||
ClutterStageWindow *_clutter_backend_create_stage (ClutterBackend *backend,
|
||||
|
@ -29,18 +29,14 @@
|
||||
#define __CLUTTER_BACKEND_H__
|
||||
|
||||
#include <cairo.h>
|
||||
#include <glib-object.h>
|
||||
#include <pango/pango.h>
|
||||
|
||||
#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
|
||||
#include <cogl/cogl.h>
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-actor.h>
|
||||
#include <clutter/clutter-device-manager.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
#include <clutter/clutter-feature.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
#include <clutter/clutter-stage-window.h>
|
||||
#include <clutter/clutter-config.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -63,33 +59,6 @@ GType clutter_backend_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterBackend *clutter_get_default_backend (void);
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_dpi)
|
||||
void clutter_backend_set_resolution (ClutterBackend *backend,
|
||||
gdouble dpi);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_time)
|
||||
void clutter_backend_set_double_click_time (ClutterBackend *backend,
|
||||
guint msec);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_time)
|
||||
guint clutter_backend_get_double_click_time (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_distance)
|
||||
void clutter_backend_set_double_click_distance (ClutterBackend *backend,
|
||||
guint distance);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_distance)
|
||||
guint clutter_backend_get_double_click_distance (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_name)
|
||||
void clutter_backend_set_font_name (ClutterBackend *backend,
|
||||
const gchar *font_name);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_name)
|
||||
const gchar * clutter_backend_get_font_name (ClutterBackend *backend);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
gdouble clutter_backend_get_resolution (ClutterBackend *backend);
|
||||
|
||||
void clutter_backend_set_font_options (ClutterBackend *backend,
|
||||
|
@ -464,8 +464,8 @@ clutter_cairo_texture_allocate (ClutterActor *self,
|
||||
|
||||
clutter_actor_box_get_size (allocation, &width, &height);
|
||||
|
||||
priv->surface_width = ceilf (width + 0.5);
|
||||
priv->surface_height = ceilf (height + 0.5);
|
||||
priv->surface_width = ceilf (width);
|
||||
priv->surface_height = ceilf (height);
|
||||
|
||||
clutter_cairo_texture_surface_resize_internal (texture);
|
||||
clutter_cairo_texture_invalidate (texture);
|
||||
@ -757,49 +757,19 @@ intersect_rectangles (cairo_rectangle_int_t *a,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_cairo_texture_create_region:
|
||||
* @self: a #ClutterCairoTexture
|
||||
* @x_offset: offset of the region on the X axis
|
||||
* @y_offset: offset of the region on the Y axis
|
||||
* @width: width of the region, or -1 for the full surface width
|
||||
* @height: height of the region, or -1 for the full surface height
|
||||
*
|
||||
* Creates a new Cairo context that will updat the region defined
|
||||
* by @x_offset, @y_offset, @width and @height.
|
||||
*
|
||||
* <warning><para>Do not call this function within the paint virtual
|
||||
* function or from a callback to the #ClutterActor::paint
|
||||
* signal.</para></warning>
|
||||
*
|
||||
* Return value: a newly created Cairo context. Use cairo_destroy()
|
||||
* to upload the contents of the context when done drawing
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.8: Use the #ClutterCairoTexture::draw signal and
|
||||
* clutter_cairo_texture_invalidate_rectangle() to obtain a
|
||||
* clipped Cairo context for 2D drawing.
|
||||
*/
|
||||
cairo_t *
|
||||
clutter_cairo_texture_create_region (ClutterCairoTexture *self,
|
||||
gint x_offset,
|
||||
gint y_offset,
|
||||
gint width,
|
||||
gint height)
|
||||
static cairo_t *
|
||||
clutter_cairo_texture_create_region_internal (ClutterCairoTexture *self,
|
||||
gint x_offset,
|
||||
gint y_offset,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
ClutterCairoTexturePrivate *priv;
|
||||
DrawContext *ctxt;
|
||||
ClutterCairoTexturePrivate *priv = self->priv;
|
||||
cairo_rectangle_int_t region, area, inter;
|
||||
cairo_surface_t *surface;
|
||||
DrawContext *ctxt;
|
||||
cairo_t *cr;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_CAIRO_TEXTURE (self), NULL);
|
||||
|
||||
clutter_warn_if_paint_fail (self);
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
if (width < 0)
|
||||
width = priv->surface_width;
|
||||
|
||||
@ -842,6 +812,46 @@ clutter_cairo_texture_create_region (ClutterCairoTexture *self,
|
||||
return cr;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_cairo_texture_create_region:
|
||||
* @self: a #ClutterCairoTexture
|
||||
* @x_offset: offset of the region on the X axis
|
||||
* @y_offset: offset of the region on the Y axis
|
||||
* @width: width of the region, or -1 for the full surface width
|
||||
* @height: height of the region, or -1 for the full surface height
|
||||
*
|
||||
* Creates a new Cairo context that will updat the region defined
|
||||
* by @x_offset, @y_offset, @width and @height.
|
||||
*
|
||||
* <warning><para>Do not call this function within the paint virtual
|
||||
* function or from a callback to the #ClutterActor::paint
|
||||
* signal.</para></warning>
|
||||
*
|
||||
* Return value: a newly created Cairo context. Use cairo_destroy()
|
||||
* to upload the contents of the context when done drawing
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.8: Use the #ClutterCairoTexture::draw signal and
|
||||
* clutter_cairo_texture_invalidate_rectangle() to obtain a
|
||||
* clipped Cairo context for 2D drawing.
|
||||
*/
|
||||
cairo_t *
|
||||
clutter_cairo_texture_create_region (ClutterCairoTexture *self,
|
||||
gint x_offset,
|
||||
gint y_offset,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_CAIRO_TEXTURE (self), NULL);
|
||||
|
||||
clutter_warn_if_paint_fail (self);
|
||||
|
||||
return clutter_cairo_texture_create_region_internal (self,
|
||||
x_offset, y_offset,
|
||||
width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_cairo_texture_invalidate_rectangle:
|
||||
* @self: a #ClutterCairoTexture
|
||||
@ -953,7 +963,7 @@ clutter_cairo_texture_create (ClutterCairoTexture *self)
|
||||
|
||||
clutter_warn_if_paint_fail (self);
|
||||
|
||||
return clutter_cairo_texture_create_region (self, 0, 0, -1, -1);
|
||||
return clutter_cairo_texture_create_region_internal (self, 0, 0, -1, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,6 @@ GType clutter_cairo_texture_get_type (void) G_GNUC_CONST;
|
||||
ClutterActor * clutter_cairo_texture_new (guint width,
|
||||
guint height);
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
CLUTTER_DEPRECATED_FOR(clutter_cairo_texture_invalidate_rectangle)
|
||||
cairo_t * clutter_cairo_texture_create_region (ClutterCairoTexture *self,
|
||||
gint x_offset,
|
||||
@ -126,7 +125,6 @@ cairo_t * clutter_cairo_texture_create_region (ClutterCairoTex
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_cairo_texture_invalidate)
|
||||
cairo_t * clutter_cairo_texture_create (ClutterCairoTexture *self);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
void clutter_cairo_texture_set_surface_size (ClutterCairoTexture *self,
|
||||
guint width,
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#define __CLUTTER_DEPRECATED_H_INSIDE__
|
||||
|
||||
#include "deprecated/clutter-actor.h"
|
||||
#include "deprecated/clutter-backend.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-behaviour-depth.h"
|
||||
#include "deprecated/clutter-behaviour-ellipse.h"
|
||||
@ -12,9 +14,13 @@
|
||||
#include "deprecated/clutter-behaviour-scale.h"
|
||||
#include "deprecated/clutter-fixed.h"
|
||||
#include "deprecated/clutter-frame-source.h"
|
||||
#include "deprecated/clutter-timeout-pool.h"
|
||||
#include "deprecated/clutter-group.h"
|
||||
#include "deprecated/clutter-keysyms.h"
|
||||
#include "deprecated/clutter-main.h"
|
||||
#include "deprecated/clutter-score.h"
|
||||
#include "deprecated/clutter-shader.h"
|
||||
#include "deprecated/clutter-stage.h"
|
||||
#include "deprecated/clutter-timeout-pool.h"
|
||||
|
||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
||||
|
||||
|
@ -353,7 +353,7 @@ clutter_group_dispose (GObject *object)
|
||||
/* Note: we are careful to consider that destroying children could
|
||||
* have the side-effect of destroying other children so
|
||||
* priv->children may be modified during clutter_actor_destroy. */
|
||||
while (priv->children)
|
||||
while (priv->children != NULL)
|
||||
{
|
||||
ClutterActor *child = priv->children->data;
|
||||
priv->children = g_list_delete_link (priv->children, priv->children);
|
||||
@ -463,24 +463,27 @@ clutter_group_new (void)
|
||||
|
||||
/**
|
||||
* clutter_group_remove_all:
|
||||
* @group: A #ClutterGroup
|
||||
* @self: A #ClutterGroup
|
||||
*
|
||||
* Removes all children actors from the #ClutterGroup.
|
||||
*/
|
||||
void
|
||||
clutter_group_remove_all (ClutterGroup *group)
|
||||
clutter_group_remove_all (ClutterGroup *self)
|
||||
{
|
||||
ClutterContainer *container;
|
||||
GList *children;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_GROUP (group));
|
||||
g_return_if_fail (CLUTTER_IS_GROUP (self));
|
||||
|
||||
children = group->priv->children;
|
||||
while (children)
|
||||
container = CLUTTER_CONTAINER (self);
|
||||
children = self->priv->children;
|
||||
|
||||
while (children != NULL)
|
||||
{
|
||||
ClutterActor *child = children->data;
|
||||
children = children->next;
|
||||
|
||||
clutter_container_remove_actor (CLUTTER_CONTAINER (group), child);
|
||||
clutter_container_remove_actor (container, child);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,31 +34,16 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_GROUP clutter_group_get_type()
|
||||
#define CLUTTER_TYPE_GROUP (clutter_group_get_type ())
|
||||
#define CLUTTER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GROUP, ClutterGroup))
|
||||
#define CLUTTER_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GROUP, ClutterGroupClass))
|
||||
#define CLUTTER_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GROUP))
|
||||
#define CLUTTER_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GROUP))
|
||||
#define CLUTTER_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GROUP, ClutterGroupClass))
|
||||
|
||||
#define CLUTTER_GROUP(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CLUTTER_TYPE_GROUP, ClutterGroup))
|
||||
|
||||
#define CLUTTER_GROUP_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CLUTTER_TYPE_GROUP, ClutterGroupClass))
|
||||
|
||||
#define CLUTTER_IS_GROUP(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CLUTTER_TYPE_GROUP))
|
||||
|
||||
#define CLUTTER_IS_GROUP_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CLUTTER_TYPE_GROUP))
|
||||
|
||||
#define CLUTTER_GROUP_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CLUTTER_TYPE_GROUP, ClutterGroupClass))
|
||||
|
||||
typedef struct _ClutterGroup ClutterGroup;
|
||||
typedef struct _ClutterGroupClass ClutterGroupClass;
|
||||
typedef struct _ClutterGroupPrivate ClutterGroupPrivate;
|
||||
typedef struct _ClutterGroup ClutterGroup;
|
||||
typedef struct _ClutterGroupClass ClutterGroupClass;
|
||||
typedef struct _ClutterGroupPrivate ClutterGroupPrivate;
|
||||
|
||||
/**
|
||||
* ClutterGroup:
|
||||
@ -97,25 +82,13 @@ struct _ClutterGroupClass
|
||||
void (*_clutter_reserved6) (void);
|
||||
};
|
||||
|
||||
GType clutter_group_get_type (void) G_GNUC_CONST;
|
||||
ClutterActor *clutter_group_new (void);
|
||||
ClutterActor *clutter_group_get_nth_child (ClutterGroup *self,
|
||||
gint index_);
|
||||
gint clutter_group_get_n_children (ClutterGroup *self);
|
||||
void clutter_group_remove_all (ClutterGroup *group);
|
||||
GType clutter_group_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
/* for Mr. Mallum only */
|
||||
#define clutter_group_add(group,actor) G_STMT_START { \
|
||||
ClutterActor *_actor = (ClutterActor *) (actor); \
|
||||
if (CLUTTER_IS_GROUP ((group)) && CLUTTER_IS_ACTOR ((_actor))) \
|
||||
{ \
|
||||
ClutterContainer *_container = (ClutterContainer *) (group); \
|
||||
clutter_container_add_actor (_container, _actor); \
|
||||
} } G_STMT_END
|
||||
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
ClutterActor * clutter_group_new (void);
|
||||
ClutterActor * clutter_group_get_nth_child (ClutterGroup *self,
|
||||
gint index_);
|
||||
gint clutter_group_get_n_children (ClutterGroup *self);
|
||||
void clutter_group_remove_all (ClutterGroup *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -58,9 +58,9 @@ die "Could not open file keysymdef.h: $!\n"
|
||||
die "Could not open file clutter-keysyms.h: $!\n"
|
||||
unless open(OUT_KEYSYMS, ">:utf8", "clutter-keysyms.h");
|
||||
|
||||
# Output: clutter/clutter/clutter-keysyms-compat.h
|
||||
# Output: clutter/clutter/deprecated/clutter-keysyms.h
|
||||
die "Could not open file clutter-keysyms-compat.h: $!\n"
|
||||
unless open(OUT_KEYSYMS_COMPAT, ">:utf8", "clutter-keysyms-compat.h");
|
||||
unless open(OUT_KEYSYMS_COMPAT, ">:utf8", "deprecated/clutter-keysyms.h");
|
||||
|
||||
my $LICENSE_HEADER= <<EOF;
|
||||
/* Clutter
|
||||
@ -114,8 +114,8 @@ print OUT_KEYSYMS_COMPAT<<EOF;
|
||||
* instead.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_KEYSYMS_COMPAT_H__
|
||||
#define __CLUTTER_KEYSYMS_COMPAT_H__
|
||||
#ifndef __CLUTTER_KEYSYMS_DEPRECATED_H__
|
||||
#define __CLUTTER_KEYSYMS_DEPRECATED_H__
|
||||
|
||||
EOF
|
||||
|
||||
@ -195,17 +195,12 @@ close IN_XF86KEYSYM;
|
||||
|
||||
print OUT_KEYSYMS<<EOF;
|
||||
|
||||
/* include the compatibility header */
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
#include "clutter-keysyms-compat.h"
|
||||
#endif
|
||||
|
||||
#endif /* __CLUTTER_KEYSYMS_H__ */
|
||||
EOF
|
||||
|
||||
print OUT_KEYSYMS_COMPAT<<EOF;
|
||||
|
||||
#endif /* __CLUTTER_KEYSYMS_COMPAT_H__ */
|
||||
#endif /* __CLUTTER_KEYSYMS_DEPRECATED_H__ */
|
||||
EOF
|
||||
|
||||
foreach my $f (qw/ keysymdef.h XF86keysym.h /) {
|
||||
@ -213,4 +208,4 @@ foreach my $f (qw/ keysymdef.h XF86keysym.h /) {
|
||||
}
|
||||
|
||||
printf "We just finished converting keysymdef.h to clutter-keysyms.h "
|
||||
. "and clutter-keysyms-compat.h\nThank you\n";
|
||||
. "and deprecated/clutter-keysyms.h\nThank you\n";
|
||||
|
@ -336,6 +336,12 @@
|
||||
#define CLUTTER_KEY_Pointer_Accelerate 0xfefa
|
||||
#define CLUTTER_KEY_Pointer_DfltBtnNext 0xfefb
|
||||
#define CLUTTER_KEY_Pointer_DfltBtnPrev 0xfefc
|
||||
#define CLUTTER_KEY_ch 0xfea0
|
||||
#define CLUTTER_KEY_Ch 0xfea1
|
||||
#define CLUTTER_KEY_CH 0xfea2
|
||||
#define CLUTTER_KEY_c_h 0xfea3
|
||||
#define CLUTTER_KEY_C_h 0xfea4
|
||||
#define CLUTTER_KEY_C_H 0xfea5
|
||||
#define CLUTTER_KEY_3270_Duplicate 0xfd01
|
||||
#define CLUTTER_KEY_3270_FieldMark 0xfd02
|
||||
#define CLUTTER_KEY_3270_Right2 0xfd03
|
||||
@ -2288,10 +2294,7 @@
|
||||
#define CLUTTER_KEY_ClearGrab 0x1008fe21
|
||||
#define CLUTTER_KEY_Next_VMode 0x1008fe22
|
||||
#define CLUTTER_KEY_Prev_VMode 0x1008fe23
|
||||
|
||||
/* include the compatibility header */
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
#include "clutter-keysyms-compat.h"
|
||||
#endif
|
||||
#define CLUTTER_KEY_LogWindowTree 0x1008fe24
|
||||
#define CLUTTER_KEY_LogGrabInfo 0x1008fe25
|
||||
|
||||
#endif /* __CLUTTER_KEYSYMS_H__ */
|
||||
|
@ -321,7 +321,6 @@
|
||||
* ]
|
||||
* }
|
||||
* </programlisting></informalexample>
|
||||
*
|
||||
* </refsect2>
|
||||
*
|
||||
* #ClutterLayoutManager is available since Clutter 1.2
|
||||
|
@ -100,6 +100,7 @@
|
||||
|
||||
#include "clutter-actor.h"
|
||||
#include "clutter-backend-private.h"
|
||||
#include "clutter-config.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-event.h"
|
||||
@ -114,6 +115,25 @@
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-version.h" /* For flavour define */
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_OSX
|
||||
#include "osx/clutter-backend-osx.h"
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_WIN32
|
||||
#include "win32/clutter-backend-win32.h"
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_GDK
|
||||
#include "gdk/clutter-backend-gdk.h"
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
#include "x11/clutter-backend-x11.h"
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_EGL
|
||||
#include "egl/clutter-backend-eglnative.h"
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_WAYLAND
|
||||
#include "wayland/clutter-backend-wayland.h"
|
||||
#endif
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
#include <cogl-pango/cogl-pango.h>
|
||||
|
||||
@ -1293,7 +1313,54 @@ _clutter_context_is_initialized (void)
|
||||
return ClutterCntx->is_initialized;
|
||||
}
|
||||
|
||||
static inline ClutterMainContext *
|
||||
static ClutterBackend *
|
||||
clutter_create_backend (void)
|
||||
{
|
||||
const char *backend = g_getenv ("CLUTTER_BACKEND");
|
||||
ClutterBackend *retval = NULL;
|
||||
|
||||
if (backend != NULL)
|
||||
backend = g_intern_string (backend);
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_OSX
|
||||
if (backend == NULL || backend == I_(CLUTTER_WINDOWING_OSX))
|
||||
retval = g_object_new (CLUTTER_TYPE_BACKEND_OSX, NULL);
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_WIN32
|
||||
if (backend == NULL || backend == I_(CLUTTER_WINDOWING_WIN32))
|
||||
retval = g_object_new (CLUTTER_TYPE_BACKEND_WIN32, NULL);
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_WAYLAND
|
||||
if (backend == NULL || backend == I_(CLUTTER_WINDOWING_WAYLAND))
|
||||
retval = g_object_new (CLUTTER_TYPE_BACKEND_WAYLAND, NULL);
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_EGL
|
||||
if (backend == NULL || backend == I_(CLUTTER_WINDOWING_EGL))
|
||||
retval = g_object_new (CLUTTER_TYPE_BACKEND_EGL_NATIVE, NULL);
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
if (backend == NULL || backend == I_(CLUTTER_WINDOWING_X11))
|
||||
retval = g_object_new (CLUTTER_TYPE_BACKEND_X11, NULL);
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_GDK
|
||||
if (backend == NULL || backend == I_(CLUTTER_WINDOWING_GDK))
|
||||
retval = g_object_new (CLUTTER_TYPE_BACKEND_GDK, NULL);
|
||||
else
|
||||
#endif
|
||||
if (backend == NULL)
|
||||
g_error ("No default Clutter backend found.");
|
||||
else
|
||||
g_error ("Unsupported Clutter backend: '%s'", backend);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static ClutterMainContext *
|
||||
clutter_context_get_default_unlocked (void)
|
||||
{
|
||||
if (G_UNLIKELY (ClutterCntx == NULL))
|
||||
@ -1302,11 +1369,10 @@ clutter_context_get_default_unlocked (void)
|
||||
|
||||
ClutterCntx = ctx = g_new0 (ClutterMainContext, 1);
|
||||
|
||||
/* create the default backend */
|
||||
ctx->backend = g_object_new (_clutter_backend_impl_get_type (), NULL);
|
||||
|
||||
ctx->is_initialized = FALSE;
|
||||
ctx->motion_events_per_actor = TRUE;
|
||||
|
||||
/* create the windowing system backend */
|
||||
ctx->backend = clutter_create_backend ();
|
||||
|
||||
/* create the default settings object, and store a back pointer to
|
||||
* the backend singleton
|
||||
@ -1319,6 +1385,7 @@ clutter_context_get_default_unlocked (void)
|
||||
g_timer_start (ctx->timer);
|
||||
#endif
|
||||
|
||||
ctx->motion_events_per_actor = TRUE;
|
||||
ctx->last_repaint_id = 1;
|
||||
}
|
||||
|
||||
@ -3551,3 +3618,87 @@ _clutter_context_get_motion_events_enabled (void)
|
||||
|
||||
return context->motion_events_per_actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_check_windowing_backend:
|
||||
* @backend_type: the name of the backend to check
|
||||
*
|
||||
* Checks the run-time name of the Clutter windowing system backend, using
|
||||
* the symbolic macros like %CLUTTER_WINDOWING_WIN32 or
|
||||
* %CLUTTER_WINDOWING_X11.
|
||||
*
|
||||
* This function should be used in conjuction with the compile-time macros
|
||||
* inside applications and libraries that are using the platform-specific
|
||||
* windowing system API, to ensure that they are running on the correct
|
||||
* windowing system; for instance:
|
||||
*
|
||||
* |[
|
||||
* #ifdef CLUTTER_WINDOWING_X11
|
||||
* if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
|
||||
* {
|
||||
* /* it is safe to use the clutter_x11_* API */
|
||||
* }
|
||||
* else
|
||||
* #endif
|
||||
* #ifdef CLUTTER_WINDOWING_WIN32
|
||||
* if (clutter_check_windowing_backend (CLUTTER_WINDOWING_WIN32))
|
||||
* {
|
||||
* /* it is safe to use the clutter_win32_* API */
|
||||
* }
|
||||
* else
|
||||
* #endif
|
||||
* g_error ("Unknown Clutter backend.");
|
||||
* ]|
|
||||
*
|
||||
* Return value: %TRUE if the current Clutter windowing system backend is
|
||||
* the one checked, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
gboolean
|
||||
clutter_check_windowing_backend (const char *backend_type)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
|
||||
g_return_val_if_fail (backend_type != NULL, FALSE);
|
||||
|
||||
backend_type = g_intern_string (backend_type);
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_OSX
|
||||
if (backend_type == I_(CLUTTER_WINDOWING_OSX) &&
|
||||
CLUTTER_IS_BACKEND_OSX (context->backend))
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_WIN32
|
||||
if (backend_type == I_(CLUTTER_WINDOWING_WIN32) &&
|
||||
CLUTTER_IS_BACKEND_WIN32 (context->backend))
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_WAYLAND
|
||||
if (backend_type == I_(CLUTTER_WINDOWING_WAYLAND) &&
|
||||
CLUTTER_IS_BACKEND_WAYLAND (context->backend))
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_EGL
|
||||
if (backend_type == I_(CLUTTER_WINDOWING_EGL) &&
|
||||
CLUTTER_IS_BACKEND_EGL_NATIVE (context->backend))
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_GDK
|
||||
if (backend_type == I_(CLUTTER_WINDOWING_GDK) &&
|
||||
CLUTTER_IS_BACKEND_GDK (context->backend))
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
if (backend_type == I_(CLUTTER_WINDOWING_X11) &&
|
||||
CLUTTER_IS_BACKEND_X11 (context->backend))
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -77,126 +77,69 @@ GQuark clutter_init_error_quark (void);
|
||||
#define CLUTTER_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 50)
|
||||
|
||||
/* Initialisation */
|
||||
void clutter_base_init (void);
|
||||
ClutterInitError clutter_init (int *argc,
|
||||
char ***argv)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
ClutterInitError clutter_init_with_args (int *argc,
|
||||
char ***argv,
|
||||
const char *parameter_string,
|
||||
GOptionEntry *entries,
|
||||
const char *translation_domain,
|
||||
GError **error)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
GOptionGroup * clutter_get_option_group (void);
|
||||
GOptionGroup * clutter_get_option_group_without_init (void);
|
||||
void clutter_base_init (void);
|
||||
ClutterInitError clutter_init (int *argc,
|
||||
char ***argv) G_GNUC_WARN_UNUSED_RESULT;
|
||||
ClutterInitError clutter_init_with_args (int *argc,
|
||||
char ***argv,
|
||||
const char *parameter_string,
|
||||
GOptionEntry *entries,
|
||||
const char *translation_domain,
|
||||
GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
GOptionGroup * clutter_get_option_group (void);
|
||||
GOptionGroup * clutter_get_option_group_without_init (void);
|
||||
|
||||
/* Mainloop */
|
||||
void clutter_main (void);
|
||||
void clutter_main_quit (void);
|
||||
gint clutter_main_level (void);
|
||||
void clutter_main (void);
|
||||
void clutter_main_quit (void);
|
||||
gint clutter_main_level (void);
|
||||
|
||||
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_ensure_redraw)
|
||||
void clutter_redraw (ClutterStage *stage);
|
||||
#endif
|
||||
|
||||
void clutter_do_event (ClutterEvent *event);
|
||||
void clutter_do_event (ClutterEvent *event);
|
||||
|
||||
/* Debug utility functions */
|
||||
gboolean clutter_get_debug_enabled (void);
|
||||
gboolean clutter_get_show_fps (void);
|
||||
gulong clutter_get_timestamp (void);
|
||||
gboolean clutter_get_accessibility_enabled (void);
|
||||
gboolean clutter_get_debug_enabled (void);
|
||||
gboolean clutter_get_show_fps (void);
|
||||
gulong clutter_get_timestamp (void);
|
||||
gboolean clutter_get_accessibility_enabled (void);
|
||||
|
||||
/* Threading functions */
|
||||
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_threads_init (void);
|
||||
#endif
|
||||
void clutter_threads_enter (void);
|
||||
void clutter_threads_leave (void);
|
||||
void clutter_threads_set_lock_functions (GCallback enter_fn,
|
||||
GCallback leave_fn);
|
||||
guint clutter_threads_add_idle (GSourceFunc func,
|
||||
gpointer data);
|
||||
guint clutter_threads_add_idle_full (gint priority,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
guint clutter_threads_add_timeout (guint interval,
|
||||
GSourceFunc func,
|
||||
gpointer data);
|
||||
guint clutter_threads_add_timeout_full (gint priority,
|
||||
guint interval,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
guint clutter_threads_add_repaint_func (GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
void clutter_threads_remove_repaint_func (guint handle_id);
|
||||
|
||||
void clutter_threads_enter (void);
|
||||
void clutter_threads_leave (void);
|
||||
void clutter_threads_set_lock_functions (GCallback enter_fn,
|
||||
GCallback leave_fn);
|
||||
guint clutter_threads_add_idle (GSourceFunc func,
|
||||
gpointer data);
|
||||
guint clutter_threads_add_idle_full (gint priority,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
guint clutter_threads_add_timeout (guint interval,
|
||||
GSourceFunc func,
|
||||
gpointer data);
|
||||
guint clutter_threads_add_timeout_full (gint priority,
|
||||
guint interval,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
void clutter_set_default_frame_rate (guint frames_per_sec);
|
||||
guint clutter_get_default_frame_rate (void);
|
||||
|
||||
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_threads_add_frame_source (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data);
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_threads_add_frame_source_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
void clutter_grab_pointer (ClutterActor *actor);
|
||||
void clutter_ungrab_pointer (void);
|
||||
ClutterActor * clutter_get_pointer_grab (void);
|
||||
void clutter_grab_keyboard (ClutterActor *actor);
|
||||
void clutter_ungrab_keyboard (void);
|
||||
ClutterActor * clutter_get_keyboard_grab (void);
|
||||
|
||||
guint clutter_threads_add_repaint_func (GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
void clutter_threads_remove_repaint_func (guint handle_id);
|
||||
PangoFontMap * clutter_get_font_map (void);
|
||||
|
||||
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_set_motion_events_enabled)
|
||||
void clutter_set_motion_events_enabled (gboolean enable);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_get_motion_events_enabled)
|
||||
gboolean clutter_get_motion_events_enabled (void);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
void clutter_set_default_frame_rate (guint frames_per_sec);
|
||||
guint clutter_get_default_frame_rate (void);
|
||||
|
||||
void clutter_grab_pointer (ClutterActor *actor);
|
||||
void clutter_ungrab_pointer (void);
|
||||
ClutterActor * clutter_get_pointer_grab (void);
|
||||
|
||||
void clutter_grab_keyboard (ClutterActor *actor);
|
||||
void clutter_ungrab_keyboard (void);
|
||||
ClutterActor * clutter_get_keyboard_grab (void);
|
||||
|
||||
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
|
||||
CLUTTER_DEPRECATED_FOR(cogl_pango_font_map_clear_glyph_cache)
|
||||
void clutter_clear_glyph_cache (void);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_backend_set_font_options)
|
||||
void clutter_set_font_flags (ClutterFontFlags flags);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_backend_get_font_options)
|
||||
ClutterFontFlags clutter_get_font_flags (void);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
|
||||
CLUTTER_DEPRECATED_FOR(clutter_device_manager_get_device)
|
||||
ClutterInputDevice *clutter_get_input_device_for_id (gint id_);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_input_device_grab)
|
||||
void clutter_grab_pointer_for_device (ClutterActor *actor,
|
||||
gint id_);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_input_device_ungrab)
|
||||
void clutter_ungrab_pointer_for_device (gint id_);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
PangoFontMap * clutter_get_font_map (void);
|
||||
|
||||
ClutterTextDirection clutter_get_default_text_direction (void);
|
||||
ClutterTextDirection clutter_get_default_text_direction (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
#ifdef CLUTTER_ENABLE_PROFILE
|
||||
|
||||
/* XXX - we need this for g_atexit() */
|
||||
#define G_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "clutter-profile.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -77,10 +77,9 @@ ClutterStage * clutter_stage_manager_get_default_stage (ClutterStageManage
|
||||
GSList * clutter_stage_manager_list_stages (ClutterStageManager *stage_manager);
|
||||
const GSList * clutter_stage_manager_peek_stages (ClutterStageManager *stage_manager);
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
|
||||
ClutterStage *stage);
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -234,3 +234,17 @@ _clutter_stage_window_get_active_framebuffer (ClutterStageWindow *window)
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
if (iface->can_clip_redraws != NULL)
|
||||
return iface->can_clip_redraws (window);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ struct _ClutterStageWindowIface
|
||||
void (* redraw) (ClutterStageWindow *stage_window);
|
||||
|
||||
CoglFramebuffer *(* get_active_framebuffer) (ClutterStageWindow *stage_window);
|
||||
|
||||
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
|
||||
};
|
||||
|
||||
GType clutter_stage_window_get_type (void) G_GNUC_CONST;
|
||||
@ -118,6 +120,8 @@ void _clutter_stage_window_redraw (ClutterStageWin
|
||||
|
||||
CoglFramebuffer *_clutter_stage_window_get_active_framebuffer (ClutterStageWindow *window);
|
||||
|
||||
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_WINDOW_H__ */
|
||||
|
@ -46,32 +46,6 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_IS_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE))
|
||||
#define CLUTTER_STAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE, ClutterStageClass))
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
/**
|
||||
* CLUTTER_STAGE_WIDTH:
|
||||
*
|
||||
* Macro that evaluates to the width of the default stage
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.2: Use clutter_actor_get_width() instead
|
||||
*/
|
||||
#define CLUTTER_STAGE_WIDTH() (clutter_actor_get_width (clutter_stage_get_default ()))
|
||||
|
||||
/**
|
||||
* CLUTTER_STAGE_HEIGHT:
|
||||
*
|
||||
* Macro that evaluates to the height of the default stage
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.2: use clutter_actor_get_height() instead
|
||||
*/
|
||||
#define CLUTTER_STAGE_HEIGHT() (clutter_actor_get_height (clutter_stage_get_default ()))
|
||||
|
||||
#endif /* !CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
typedef struct _ClutterPerspective ClutterPerspective;
|
||||
typedef struct _ClutterFog ClutterFog;
|
||||
|
||||
@ -255,19 +229,6 @@ void clutter_stage_set_motion_events_enabled (ClutterStage *sta
|
||||
gboolean enabled);
|
||||
gboolean clutter_stage_get_motion_events_enabled (ClutterStage *stage);
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
/* Commodity macro, for mallum only */
|
||||
#define clutter_stage_add(stage,actor) G_STMT_START { \
|
||||
if (CLUTTER_IS_STAGE ((stage)) && CLUTTER_IS_ACTOR ((actor))) \
|
||||
{ \
|
||||
ClutterContainer *_container = (ClutterContainer *) (stage); \
|
||||
ClutterActor *_actor = (ClutterActor *) (actor); \
|
||||
clutter_container_add_actor (_container, _actor); \
|
||||
} } G_STMT_END
|
||||
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_H__ */
|
||||
|
@ -127,10 +127,8 @@ ClutterActor * clutter_texture_new (void);
|
||||
ClutterActor * clutter_texture_new_from_file (const gchar *filename,
|
||||
GError **error);
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
CLUTTER_DEPRECATED_FOR(ClutterOffscreenEffect)
|
||||
ClutterActor * clutter_texture_new_from_actor (ClutterActor *actor);
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
gboolean clutter_texture_set_from_file (ClutterTexture *texture,
|
||||
const gchar *filename,
|
||||
|
@ -72,18 +72,15 @@ typedef struct _ClutterEffect ClutterEffect;
|
||||
|
||||
typedef struct _ClutterPath ClutterPath;
|
||||
|
||||
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
|
||||
typedef struct _ClutterBehaviour ClutterBehaviour;
|
||||
|
||||
typedef struct _ClutterShader ClutterShader;
|
||||
#endif /* DISABLE_DEPRECATED */
|
||||
|
||||
typedef struct _ClutterActorBox ClutterActorBox;
|
||||
typedef struct _ClutterColor ClutterColor;
|
||||
typedef struct _ClutterGeometry ClutterGeometry;
|
||||
typedef struct _ClutterKnot ClutterKnot;
|
||||
typedef struct _ClutterVertex ClutterVertex;
|
||||
|
||||
typedef struct _ClutterBehaviour ClutterBehaviour;
|
||||
typedef struct _ClutterShader ClutterShader;
|
||||
|
||||
typedef union _ClutterEvent ClutterEvent;
|
||||
|
||||
/**
|
||||
|
@ -32,13 +32,9 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gint clutter_util_next_p2 (gint a);
|
||||
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_UTIL_H__ */
|
||||
|
@ -103,6 +103,12 @@ G_BEGIN_DECLS
|
||||
* GL Windowing system used
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: The macro evaluates to "deprecated" as Clutter can be
|
||||
* compiled with multiple windowing system backends. Use the various
|
||||
* CLUTTER_WINDOWING_* macros to detect the windowing system that Clutter
|
||||
* is being compiled against, and the type check macros for the
|
||||
* #ClutterBackend for a run-time check.
|
||||
*/
|
||||
#define CLUTTER_FLAVOUR "@CLUTTER_FLAVOUR@"
|
||||
|
||||
@ -113,6 +119,9 @@ G_BEGIN_DECLS
|
||||
* "gles" currently
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: The macro evaluates to "deprecated" as Cogl can be
|
||||
* compiled against multiple GL implementations.
|
||||
*/
|
||||
#define CLUTTER_COGL "@CLUTTER_COGL@"
|
||||
|
||||
@ -122,6 +131,11 @@ G_BEGIN_DECLS
|
||||
* The default GObject type for the Clutter stage.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.10: The macro evaluates to "deprecated" as Clutter can
|
||||
* be compiled against multiple windowing systems. You can use the
|
||||
* CLUTTER_WINDOWING_* macros for compile-time checks, and the type
|
||||
* check macros for run-time checks.
|
||||
*/
|
||||
#define CLUTTER_STAGE_TYPE @CLUTTER_STAGE_TYPE@
|
||||
|
||||
@ -181,6 +195,8 @@ gboolean clutter_check_version (guint major,
|
||||
guint minor,
|
||||
guint micro);
|
||||
|
||||
gboolean clutter_check_windowing_backend (const char *backend_type);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_VERSION_H__ */
|
||||
|
@ -103,9 +103,7 @@
|
||||
|
||||
#include "clutter-enum-types.h"
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
#include "clutter-deprecated.h"
|
||||
#endif
|
||||
|
||||
#undef __CLUTTER_H_INSIDE__
|
||||
|
||||
|
@ -4,18 +4,19 @@ libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
apiversion=@CLUTTER_API_VERSION@
|
||||
winsys=@CLUTTER_WINSYS@
|
||||
soname_infix=@CLUTTER_SONAME_INFIX@
|
||||
cogl_driver=@COGL_DRIVER@
|
||||
requires=@CLUTTER_REQUIRES@
|
||||
backends=@CLUTTER_BACKENDS@
|
||||
|
||||
# only kept for backward compatibility
|
||||
soname_infix=@CLUTTER_SONAME_INFIX@
|
||||
winsys=@CLUTTER_WINSYS@
|
||||
cogl=@COGL_DRIVER@
|
||||
cogl_driver=@COGL_DRIVER@
|
||||
backend=@CLUTTER_WINSYS@
|
||||
|
||||
Name: Clutter
|
||||
Description: Clutter Core Library (${winsys}/${cogl_driver} backend)
|
||||
Description: Clutter Core Library
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lclutter-${soname_infix}-${apiversion}
|
||||
Libs: -L${libdir} -lclutter-${apiversion}
|
||||
Cflags: -I${includedir}/clutter-${apiversion}
|
||||
Requires: ${requires}
|
||||
|
@ -39,44 +39,16 @@
|
||||
#include "clutter-backend-cogl.h"
|
||||
#include "clutter-stage-cogl.h"
|
||||
|
||||
#ifdef HAVE_EVDEV
|
||||
#include "clutter-device-manager-evdev.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-stage-private.h"
|
||||
|
||||
#ifdef COGL_HAS_EGL_SUPPORT
|
||||
#include "clutter-egl.h"
|
||||
#endif
|
||||
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
|
||||
#include "clutter-cex100.h"
|
||||
#endif
|
||||
|
||||
static ClutterBackendCogl *backend_singleton = NULL;
|
||||
|
||||
static gchar *clutter_vblank = NULL;
|
||||
|
||||
/* FIXME: We should have CLUTTER_ define for this... */
|
||||
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
|
||||
static gdl_plane_id_t gdl_plane = GDL_PLANE_ID_UPP_C;
|
||||
static guint gdl_n_buffers = CLUTTER_CEX100_TRIPLE_BUFFERING;
|
||||
#endif
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
G_DEFINE_TYPE (ClutterBackendCogl, _clutter_backend_cogl, CLUTTER_TYPE_BACKEND_X11);
|
||||
#else
|
||||
G_DEFINE_TYPE (ClutterBackendCogl, _clutter_backend_cogl, CLUTTER_TYPE_BACKEND);
|
||||
#endif
|
||||
|
||||
static void
|
||||
clutter_backend_at_exit (void)
|
||||
{
|
||||
if (backend_singleton)
|
||||
g_object_run_dispose (G_OBJECT (backend_singleton));
|
||||
}
|
||||
|
||||
const gchar*
|
||||
_clutter_backend_cogl_get_vblank (void)
|
||||
@ -92,13 +64,6 @@ clutter_backend_cogl_pre_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
const gchar *env_string;
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
ClutterBackendClass *parent_class =
|
||||
CLUTTER_BACKEND_CLASS (_clutter_backend_cogl_parent_class);
|
||||
|
||||
if (!parent_class->pre_parse (backend, error))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
env_string = g_getenv ("CLUTTER_VBLANK");
|
||||
if (env_string)
|
||||
@ -114,56 +79,7 @@ static gboolean
|
||||
clutter_backend_cogl_post_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
ClutterBackendClass *parent_class =
|
||||
CLUTTER_BACKEND_CLASS (_clutter_backend_cogl_parent_class);
|
||||
|
||||
if (!parent_class->post_parse (backend, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
g_atexit (clutter_backend_at_exit);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifndef COGL_HAS_XLIB_SUPPORT
|
||||
static ClutterDeviceManager *
|
||||
clutter_backend_cogl_get_device_manager (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendCogl *backend_cogl = CLUTTER_BACKEND_COGL (backend);
|
||||
|
||||
if (G_UNLIKELY (backend_cogl->device_manager == NULL))
|
||||
{
|
||||
#ifdef HAVE_EVDEV
|
||||
backend_cogl->device_manager =
|
||||
g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_EVDEV,
|
||||
"backend", backend_cogl,
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
return backend_cogl->device_manager;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
clutter_backend_cogl_init_events (ClutterBackend *backend)
|
||||
{
|
||||
#ifdef HAVE_TSLIB
|
||||
/* XXX: This should be renamed to _clutter_events_tslib_init */
|
||||
_clutter_events_tslib_init (CLUTTER_BACKEND_COGL (backend));
|
||||
#endif
|
||||
#ifdef HAVE_EVDEV
|
||||
_clutter_events_evdev_init (CLUTTER_BACKEND (backend));
|
||||
#endif
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
/* Chain up to the X11 backend */
|
||||
CLUTTER_BACKEND_CLASS (_clutter_backend_cogl_parent_class)->
|
||||
init_events (backend);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -179,14 +95,6 @@ static void
|
||||
clutter_backend_cogl_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (gobject);
|
||||
#ifdef HAVE_TSLIB
|
||||
ClutterBackendCogl *backend_cogl = CLUTTER_BACKEND_COGL (gobject);
|
||||
#endif
|
||||
|
||||
/* We chain up before disposing our CoglContext so that we will
|
||||
* destroy all of the stages first. Otherwise the actors may try to
|
||||
* make Cogl calls during destruction which would cause a crash */
|
||||
G_OBJECT_CLASS (_clutter_backend_cogl_parent_class)->dispose (gobject);
|
||||
|
||||
if (backend->cogl_context)
|
||||
{
|
||||
@ -194,16 +102,7 @@ clutter_backend_cogl_dispose (GObject *gobject)
|
||||
backend->cogl_context = NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
/* XXX: This should be renamed to _clutter_events_tslib_uninit */
|
||||
_clutter_events_egl_uninit (backend_cogl);
|
||||
|
||||
if (backend_cogl->event_timer != NULL)
|
||||
{
|
||||
g_timer_destroy (backend_cogl->event_timer);
|
||||
backend_cogl->event_timer = NULL;
|
||||
}
|
||||
#endif
|
||||
G_OBJECT_CLASS (_clutter_backend_cogl_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
@ -214,7 +113,7 @@ clutter_backend_cogl_constructor (GType gtype,
|
||||
GObjectClass *parent_class;
|
||||
GObject *retval;
|
||||
|
||||
if (!backend_singleton)
|
||||
if (backend_singleton == NULL)
|
||||
{
|
||||
parent_class = G_OBJECT_CLASS (_clutter_backend_cogl_parent_class);
|
||||
retval = parent_class->constructor (gtype, n_params, params);
|
||||
@ -234,17 +133,8 @@ static ClutterFeatureFlags
|
||||
clutter_backend_cogl_get_features (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendCogl *backend_cogl = CLUTTER_BACKEND_COGL (backend);
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
ClutterBackendClass *parent_class;
|
||||
#endif
|
||||
ClutterFeatureFlags flags = 0;
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
parent_class = CLUTTER_BACKEND_CLASS (_clutter_backend_cogl_parent_class);
|
||||
|
||||
flags = parent_class->get_features (backend);
|
||||
#endif
|
||||
|
||||
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Cogl supports multiple onscreen framebuffers");
|
||||
@ -279,150 +169,6 @@ clutter_backend_cogl_get_features (ClutterBackend *backend)
|
||||
return flags;
|
||||
}
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
static XVisualInfo *
|
||||
clutter_backend_cogl_get_visual_info (ClutterBackendX11 *backend_x11)
|
||||
{
|
||||
return cogl_clutter_winsys_xlib_get_visual_info ();
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
clutter_backend_cogl_create_context (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
#endif
|
||||
CoglSwapChain *swap_chain = NULL;
|
||||
CoglOnscreenTemplate *onscreen_template = NULL;
|
||||
|
||||
if (backend->cogl_context)
|
||||
return TRUE;
|
||||
|
||||
backend->cogl_renderer = cogl_renderer_new ();
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
cogl_xlib_renderer_set_foreign_display (backend->cogl_renderer,
|
||||
backend_x11->xdpy);
|
||||
#endif
|
||||
if (!cogl_renderer_connect (backend->cogl_renderer, error))
|
||||
goto error;
|
||||
|
||||
swap_chain = cogl_swap_chain_new ();
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
cogl_swap_chain_set_has_alpha (swap_chain,
|
||||
clutter_x11_get_use_argb_visual ());
|
||||
#endif
|
||||
|
||||
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
|
||||
cogl_swap_chain_set_length (swap_chain, gdl_n_buffers);
|
||||
#endif
|
||||
|
||||
onscreen_template = cogl_onscreen_template_new (swap_chain);
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
/* XXX: I have some doubts that this is a good design.
|
||||
* Conceptually should we be able to check an onscreen_template
|
||||
* without more details about the CoglDisplay configuration?
|
||||
*/
|
||||
if (!cogl_renderer_check_onscreen_template (backend->cogl_renderer,
|
||||
onscreen_template,
|
||||
error))
|
||||
goto error;
|
||||
|
||||
backend->cogl_display = cogl_display_new (backend->cogl_renderer,
|
||||
onscreen_template);
|
||||
|
||||
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
|
||||
cogl_gdl_display_set_plane (backend->cogl_display, gdl_plane);
|
||||
#endif
|
||||
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
cogl_object_unref (onscreen_template);
|
||||
|
||||
if (!cogl_display_setup (backend->cogl_display, error))
|
||||
goto error;
|
||||
|
||||
backend->cogl_context = cogl_context_new (backend->cogl_display, error);
|
||||
if (!backend->cogl_context)
|
||||
goto error;
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
if (backend->cogl_display)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_display);
|
||||
backend->cogl_display = NULL;
|
||||
}
|
||||
|
||||
if (onscreen_template)
|
||||
cogl_object_unref (onscreen_template);
|
||||
if (swap_chain)
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
if (backend->cogl_renderer)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
backend->cogl_renderer = NULL;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static ClutterStageWindow *
|
||||
clutter_backend_cogl_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
ClutterEventTranslator *translator;
|
||||
ClutterStageWindow *stage;
|
||||
ClutterStageX11 *stage_x11;
|
||||
|
||||
stage = g_object_new (CLUTTER_TYPE_STAGE_COGL, NULL);
|
||||
|
||||
/* copy backend data into the stage */
|
||||
stage_x11 = CLUTTER_STAGE_X11 (stage);
|
||||
stage_x11->wrapper = wrapper;
|
||||
stage_x11->backend = backend_x11;
|
||||
|
||||
translator = CLUTTER_EVENT_TRANSLATOR (stage_x11);
|
||||
_clutter_backend_add_event_translator (backend, translator);
|
||||
|
||||
CLUTTER_NOTE (MISC, "Cogl stage created (display:%p, screen:%d, root:%u)",
|
||||
backend_x11->xdpy,
|
||||
backend_x11->xscreen_num,
|
||||
(unsigned int) backend_x11->xwin_root);
|
||||
|
||||
#else /* COGL_HAS_XLIB_SUPPORT */
|
||||
|
||||
ClutterBackendCogl *backend_cogl = CLUTTER_BACKEND_COGL (backend);
|
||||
ClutterStageWindow *stage;
|
||||
ClutterStageCogl *stage_cogl;
|
||||
|
||||
if (G_UNLIKELY (backend_cogl->stage != NULL))
|
||||
{
|
||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"The Cogl backend does not support multiple "
|
||||
"onscreen windows");
|
||||
return backend_cogl->stage;
|
||||
}
|
||||
|
||||
stage = g_object_new (CLUTTER_TYPE_STAGE_COGL, NULL);
|
||||
|
||||
stage_cogl = CLUTTER_STAGE_COGL (stage);
|
||||
stage_cogl->backend = backend_cogl;
|
||||
stage_cogl->wrapper = wrapper;
|
||||
|
||||
backend_cogl->stage = stage;
|
||||
|
||||
#endif /* COGL_HAS_XLIB_SUPPORT */
|
||||
|
||||
return stage;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_cogl_ensure_context (ClutterBackend *backend,
|
||||
ClutterStage *stage)
|
||||
@ -444,86 +190,18 @@ _clutter_backend_cogl_class_init (ClutterBackendCoglClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass);
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
ClutterBackendX11Class *backendx11_class = CLUTTER_BACKEND_X11_CLASS (klass);
|
||||
#endif
|
||||
|
||||
gobject_class->constructor = clutter_backend_cogl_constructor;
|
||||
gobject_class->dispose = clutter_backend_cogl_dispose;
|
||||
gobject_class->finalize = clutter_backend_cogl_finalize;
|
||||
gobject_class->dispose = clutter_backend_cogl_dispose;
|
||||
gobject_class->finalize = clutter_backend_cogl_finalize;
|
||||
|
||||
backend_class->pre_parse = clutter_backend_cogl_pre_parse;
|
||||
backend_class->post_parse = clutter_backend_cogl_post_parse;
|
||||
backend_class->get_features = clutter_backend_cogl_get_features;
|
||||
#ifndef COGL_HAS_XLIB_SUPPORT
|
||||
backend_class->get_device_manager = clutter_backend_cogl_get_device_manager;
|
||||
#endif
|
||||
backend_class->init_events = clutter_backend_cogl_init_events;
|
||||
backend_class->create_stage = clutter_backend_cogl_create_stage;
|
||||
backend_class->create_context = clutter_backend_cogl_create_context;
|
||||
backend_class->ensure_context = clutter_backend_cogl_ensure_context;
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
backendx11_class->get_visual_info = clutter_backend_cogl_get_visual_info;
|
||||
#endif
|
||||
backend_class->pre_parse = clutter_backend_cogl_pre_parse;
|
||||
backend_class->post_parse = clutter_backend_cogl_post_parse;
|
||||
backend_class->get_features = clutter_backend_cogl_get_features;
|
||||
backend_class->ensure_context = clutter_backend_cogl_ensure_context;
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_backend_cogl_init (ClutterBackendCogl *backend_cogl)
|
||||
{
|
||||
#ifdef HAVE_TSLIB
|
||||
backend_cogl->event_timer = g_timer_new ();
|
||||
#endif
|
||||
}
|
||||
|
||||
GType
|
||||
_clutter_backend_impl_get_type (void)
|
||||
{
|
||||
return _clutter_backend_cogl_get_type ();
|
||||
}
|
||||
|
||||
#ifdef COGL_HAS_EGL_SUPPORT
|
||||
EGLDisplay
|
||||
clutter_eglx_display (void)
|
||||
{
|
||||
return clutter_egl_get_egl_display ();
|
||||
}
|
||||
|
||||
EGLDisplay
|
||||
clutter_egl_display (void)
|
||||
{
|
||||
return clutter_egl_get_egl_display ();
|
||||
}
|
||||
|
||||
EGLDisplay
|
||||
clutter_egl_get_egl_display (void)
|
||||
{
|
||||
if (backend_singleton == NULL)
|
||||
{
|
||||
g_critical ("%s has been called before clutter_init()", G_STRFUNC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cogl_egl_context_get_egl_display (backend_singleton->cogl_context);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* FIXME we should have a CLUTTER_ define for this */
|
||||
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
|
||||
void
|
||||
clutter_cex100_set_plane (gdl_plane_id_t plane)
|
||||
{
|
||||
g_return_if_fail (plane >= GDL_PLANE_ID_UPP_A && plane <= GDL_PLANE_ID_UPP_E);
|
||||
|
||||
gdl_plane = plane;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_cex100_set_buffering_mode (ClutterCex100BufferingMode mode)
|
||||
{
|
||||
g_return_if_fail (mode == CLUTTER_CEX100_DOUBLE_BUFFERING ||
|
||||
mode == CLUTTER_CEX100_TRIPLE_BUFFERING);
|
||||
|
||||
gdl_n_buffers = mode;
|
||||
}
|
||||
#endif
|
||||
|
@ -37,10 +37,6 @@
|
||||
|
||||
#include "clutter-backend-private.h"
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
#include "../x11/clutter-backend-x11.h"
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BACKEND_COGL (_clutter_backend_cogl_get_type ())
|
||||
@ -55,47 +51,18 @@ typedef struct _ClutterBackendCoglClass ClutterBackendCoglClass;
|
||||
|
||||
struct _ClutterBackendCogl
|
||||
{
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
ClutterBackendX11 parent_instance;
|
||||
|
||||
#else /* COGL_HAS_X11_SUPPORT */
|
||||
ClutterBackend parent_instance;
|
||||
|
||||
/* main stage singleton */
|
||||
ClutterStageWindow *stage;
|
||||
|
||||
/* device manager (ie evdev) */
|
||||
ClutterDeviceManager *device_manager;
|
||||
|
||||
/* event source */
|
||||
GSource *event_source;
|
||||
|
||||
/* event timer */
|
||||
GTimer *event_timer;
|
||||
|
||||
#endif /* COGL_HAS_X11_SUPPORT */
|
||||
|
||||
CoglContext *cogl_context;
|
||||
|
||||
gboolean can_blit_sub_buffer;
|
||||
};
|
||||
|
||||
struct _ClutterBackendCoglClass
|
||||
{
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
ClutterBackendX11Class parent_class;
|
||||
#else
|
||||
ClutterBackendClass parent_class;
|
||||
#endif
|
||||
};
|
||||
|
||||
GType _clutter_backend_cogl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
void _clutter_events_tslib_init (ClutterBackendCogl *backend);
|
||||
void _clutter_events_tslib_uninit (ClutterBackendCogl *backend);
|
||||
#endif
|
||||
|
||||
const gchar *_clutter_backend_cogl_get_vblank (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-config.h"
|
||||
|
||||
#include "clutter-stage-cogl.h"
|
||||
#include "clutter-backend-cogl.h"
|
||||
|
||||
@ -43,22 +45,21 @@
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-util.h"
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
static ClutterStageWindowIface *clutter_stage_window_parent_iface = NULL;
|
||||
#endif
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageCogl,
|
||||
_clutter_stage_cogl,
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
CLUTTER_TYPE_STAGE_X11,
|
||||
#else
|
||||
G_TYPE_OBJECT,
|
||||
#endif
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||
clutter_stage_window_iface_init));
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_WRAPPER,
|
||||
PROP_BACKEND,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static void
|
||||
clutter_stage_cogl_unrealize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
@ -66,11 +67,6 @@ clutter_stage_cogl_unrealize (ClutterStageWindow *stage_window)
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Unrealizing Cogl stage [%p]", stage_cogl);
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
/* chain up to the StageX11 implementation */
|
||||
clutter_stage_window_parent_iface->unrealize (stage_window);
|
||||
#endif
|
||||
|
||||
if (stage_cogl->onscreen != NULL)
|
||||
{
|
||||
cogl_object_unref (stage_cogl->onscreen);
|
||||
@ -101,9 +97,6 @@ static gboolean
|
||||
clutter_stage_cogl_realize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
#endif
|
||||
ClutterBackend *backend;
|
||||
CoglFramebuffer *framebuffer;
|
||||
GError *error = NULL;
|
||||
@ -117,23 +110,11 @@ clutter_stage_cogl_realize (ClutterStageWindow *stage_window)
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
clutter_actor_get_size (CLUTTER_ACTOR (stage_x11->wrapper), &width, &height);
|
||||
#endif
|
||||
|
||||
stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context,
|
||||
width, height);
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
if (stage_x11->xwin != None)
|
||||
if (stage_cogl->onscreen == NULL)
|
||||
{
|
||||
cogl_x11_onscreen_set_foreign_window_xid (stage_cogl->onscreen,
|
||||
stage_x11->xwin,
|
||||
_clutter_stage_x11_update_foreign_event_mask,
|
||||
stage_x11);
|
||||
|
||||
stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context,
|
||||
width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
clutter_vblank = _clutter_backend_cogl_get_vblank ();
|
||||
if (clutter_vblank && strcmp (clutter_vblank, "none") == 0)
|
||||
@ -149,7 +130,7 @@ clutter_stage_cogl_realize (ClutterStageWindow *stage_window)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* FIXME: for fullscreen Cogl platforms then the size we gave above
|
||||
/* FIXME: for fullscreen Cogl platforms then the size we gave
|
||||
* will be ignored, so we need to make sure the stage size is
|
||||
* updated to this size. */
|
||||
|
||||
@ -161,14 +142,7 @@ clutter_stage_cogl_realize (ClutterStageWindow *stage_window)
|
||||
stage_cogl);
|
||||
}
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
if (stage_x11->xwin == None)
|
||||
stage_x11->xwin = cogl_x11_onscreen_get_window_xid (stage_cogl->onscreen);
|
||||
|
||||
return clutter_stage_window_parent_iface->realize (stage_window);
|
||||
#else
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
@ -179,8 +153,6 @@ clutter_stage_cogl_get_pending_swaps (ClutterStageWindow *stage_window)
|
||||
return stage_cogl->pending_swaps;
|
||||
}
|
||||
|
||||
#ifndef COGL_HAS_XLIB_SUPPORT
|
||||
|
||||
static ClutterActor *
|
||||
clutter_stage_cogl_get_wrapper (ClutterStageWindow *stage_window)
|
||||
{
|
||||
@ -189,7 +161,7 @@ clutter_stage_cogl_get_wrapper (ClutterStageWindow *stage_window)
|
||||
|
||||
static void
|
||||
clutter_stage_cogl_show (ClutterStageWindow *stage_window,
|
||||
gboolean do_raise)
|
||||
gboolean do_raise)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
|
||||
@ -238,8 +210,6 @@ clutter_stage_cogl_resize (ClutterStageWindow *stage_window,
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* COGL_HAS_XLIB_SUPPORT */
|
||||
|
||||
static gboolean
|
||||
clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *stage_window)
|
||||
{
|
||||
@ -368,13 +338,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
"The time spent in blit_sub_buffer",
|
||||
0 /* no application private data */);
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_cogl);
|
||||
|
||||
wrapper = CLUTTER_ACTOR (stage_x11->wrapper);
|
||||
#else
|
||||
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
|
||||
#endif
|
||||
|
||||
if (!stage_cogl->onscreen)
|
||||
return;
|
||||
@ -384,24 +348,17 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
|
||||
CLUTTER_TIMER_START (_clutter_uprof_context, painting_timer);
|
||||
|
||||
if (G_LIKELY (backend_cogl->can_blit_sub_buffer) &&
|
||||
may_use_clipped_redraw = FALSE;
|
||||
if (_clutter_stage_window_can_clip_redraws (stage_window) &&
|
||||
G_LIKELY (backend_cogl->can_blit_sub_buffer) &&
|
||||
/* NB: a zero width redraw clip == full stage redraw */
|
||||
stage_cogl->bounding_redraw_clip.width != 0 &&
|
||||
/* some drivers struggle to get going and produce some junk
|
||||
* frames when starting up... */
|
||||
G_LIKELY (stage_cogl->frame_count > 3)
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
/* While resizing a window clipped redraws are disabled to avoid
|
||||
* artefacts. See clutter-event-x11.c:event_translate for a
|
||||
* detailed explanation */
|
||||
&& G_LIKELY (stage_x11->clipped_redraws_cool_off == 0)
|
||||
#endif
|
||||
)
|
||||
G_LIKELY (stage_cogl->frame_count > 3))
|
||||
{
|
||||
may_use_clipped_redraw = TRUE;
|
||||
}
|
||||
else
|
||||
may_use_clipped_redraw = FALSE;
|
||||
|
||||
if (may_use_clipped_redraw &&
|
||||
G_LIKELY (!(clutter_paint_debug_flags &
|
||||
@ -564,16 +521,6 @@ clutter_stage_cogl_get_active_framebuffer (ClutterStageWindow *stage_window)
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
{
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->realize = clutter_stage_cogl_realize;
|
||||
iface->unrealize = clutter_stage_cogl_unrealize;
|
||||
|
||||
/* the rest is inherited from ClutterStageX11 */
|
||||
|
||||
#else /* COGL_HAS_X11_SUPPORT */
|
||||
|
||||
iface->realize = clutter_stage_cogl_realize;
|
||||
iface->unrealize = clutter_stage_cogl_unrealize;
|
||||
iface->get_wrapper = clutter_stage_cogl_get_wrapper;
|
||||
@ -581,9 +528,6 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
iface->resize = clutter_stage_cogl_resize;
|
||||
iface->show = clutter_stage_cogl_show;
|
||||
iface->hide = clutter_stage_cogl_hide;
|
||||
|
||||
#endif /* COGL_HAS_X11_SUPPORT */
|
||||
|
||||
iface->get_pending_swaps = clutter_stage_cogl_get_pending_swaps;
|
||||
iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
|
||||
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
|
||||
@ -593,11 +537,28 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
iface->get_active_framebuffer = clutter_stage_cogl_get_active_framebuffer;
|
||||
}
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
static void
|
||||
clutter_stage_cogl_dispose (GObject *gobject)
|
||||
clutter_stage_cogl_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
G_OBJECT_CLASS (_clutter_stage_cogl_parent_class)->dispose (gobject);
|
||||
ClutterStageCogl *self = CLUTTER_STAGE_COGL (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WRAPPER:
|
||||
self->wrapper = CLUTTER_STAGE (g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_BACKEND:
|
||||
self->backend = CLUTTER_BACKEND_COGL (g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -605,14 +566,22 @@ _clutter_stage_cogl_class_init (ClutterStageCoglClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = clutter_stage_cogl_dispose;
|
||||
gobject_class->set_property = clutter_stage_cogl_set_property;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_WRAPPER,
|
||||
g_param_spec_object ("wrapper",
|
||||
"Wrapper",
|
||||
"ClutterStage wrapping this native stage",
|
||||
CLUTTER_TYPE_STAGE,
|
||||
CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_BACKEND,
|
||||
g_param_spec_object ("backend",
|
||||
"ClutterBackend",
|
||||
"The Clutter backend singleton",
|
||||
CLUTTER_TYPE_BACKEND_COGL,
|
||||
CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
#else
|
||||
static void
|
||||
_clutter_stage_cogl_class_init (ClutterStageCoglClass *klass)
|
||||
{
|
||||
}
|
||||
#endif /* COGL_HAS_X11_SUPPORT */
|
||||
|
||||
static void
|
||||
_clutter_stage_cogl_init (ClutterStageCogl *stage)
|
||||
|
@ -1,10 +1,6 @@
|
||||
#ifndef __CLUTTER_STAGE_COGL_H__
|
||||
#define __CLUTTER_STAGE_COGL_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <cairo.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
@ -13,7 +9,6 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include "../x11/clutter-stage-x11.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-backend-cogl.h"
|
||||
@ -32,12 +27,6 @@ typedef struct _ClutterStageCoglClass ClutterStageCoglClass;
|
||||
|
||||
struct _ClutterStageCogl
|
||||
{
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
|
||||
ClutterStageX11 parent_instance;
|
||||
|
||||
#else
|
||||
|
||||
GObject parent_instance;
|
||||
|
||||
/* the stage wrapper */
|
||||
@ -46,8 +35,6 @@ struct _ClutterStageCogl
|
||||
/* back pointer to the backend */
|
||||
ClutterBackendCogl *backend;
|
||||
|
||||
#endif
|
||||
|
||||
CoglOnscreen *onscreen;
|
||||
|
||||
gint pending_swaps;
|
||||
@ -69,11 +56,7 @@ struct _ClutterStageCogl
|
||||
|
||||
struct _ClutterStageCoglClass
|
||||
{
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
ClutterStageX11Class parent_class;
|
||||
#else
|
||||
GObjectClass parent_class;
|
||||
#endif
|
||||
};
|
||||
|
||||
GType _clutter_stage_cogl_get_type (void) G_GNUC_CONST;
|
||||
|
16
clutter/deprecated/clutter-actor.h
Normal file
16
clutter/deprecated/clutter-actor.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef __CLUTTER_ACTOR_DEPRECATED_H__
|
||||
#define __CLUTTER_ACTOR_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint32 clutter_actor_get_gid (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterActor * clutter_get_actor_by_gid (guint32 id_);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_DEPRECATED_H__ */
|
36
clutter/deprecated/clutter-backend.h
Normal file
36
clutter/deprecated/clutter-backend.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef __CLUTTER_BACKEND_DEPRECATED_H__
|
||||
#define __CLUTTER_BACKEND_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_dpi)
|
||||
void clutter_backend_set_resolution (ClutterBackend *backend,
|
||||
gdouble dpi);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_time)
|
||||
void clutter_backend_set_double_click_time (ClutterBackend *backend,
|
||||
guint msec);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_time)
|
||||
guint clutter_backend_get_double_click_time (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_distance)
|
||||
void clutter_backend_set_double_click_distance (ClutterBackend *backend,
|
||||
guint distance);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_distance)
|
||||
guint clutter_backend_get_double_click_distance (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_name)
|
||||
void clutter_backend_set_font_name (ClutterBackend *backend,
|
||||
const gchar *font_name);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_name)
|
||||
const gchar * clutter_backend_get_font_name (ClutterBackend *backend);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_DEPRECATED_H__ */
|
23
clutter/deprecated/clutter-group.h
Normal file
23
clutter/deprecated/clutter-group.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef __CLUTTER_GROUP_DEPRECATED_H__
|
||||
#define __CLUTTER_GROUP_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
/* for Mr. Mallum only */
|
||||
#define clutter_group_add(group,actor) G_STMT_START { \
|
||||
ClutterActor *_actor = (ClutterActor *) (actor); \
|
||||
if (CLUTTER_IS_GROUP ((group)) && CLUTTER_IS_ACTOR ((_actor))) \
|
||||
{ \
|
||||
ClutterContainer *_container = (ClutterContainer *) (group); \
|
||||
clutter_container_add_actor (_container, _actor); \
|
||||
} } G_STMT_END
|
||||
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_GROUP_DEPRECATED_H__ */
|
@ -26,8 +26,10 @@
|
||||
* instead.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_KEYSYMS_COMPAT_H__
|
||||
#define __CLUTTER_KEYSYMS_COMPAT_H__
|
||||
#ifndef __CLUTTER_KEYSYMS_DEPRECATED_H__
|
||||
#define __CLUTTER_KEYSYMS_DEPRECATED_H__
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
#define CLUTTER_VoidSymbol 0xffffff
|
||||
#define CLUTTER_BackSpace 0xff08
|
||||
@ -334,6 +336,12 @@
|
||||
#define CLUTTER_Pointer_Accelerate 0xfefa
|
||||
#define CLUTTER_Pointer_DfltBtnNext 0xfefb
|
||||
#define CLUTTER_Pointer_DfltBtnPrev 0xfefc
|
||||
#define CLUTTER_ch 0xfea0
|
||||
#define CLUTTER_Ch 0xfea1
|
||||
#define CLUTTER_CH 0xfea2
|
||||
#define CLUTTER_c_h 0xfea3
|
||||
#define CLUTTER_C_h 0xfea4
|
||||
#define CLUTTER_C_H 0xfea5
|
||||
#define CLUTTER_3270_Duplicate 0xfd01
|
||||
#define CLUTTER_3270_FieldMark 0xfd02
|
||||
#define CLUTTER_3270_Right2 0xfd03
|
||||
@ -2286,5 +2294,9 @@
|
||||
#define CLUTTER_ClearGrab 0x1008fe21
|
||||
#define CLUTTER_Next_VMode 0x1008fe22
|
||||
#define CLUTTER_Prev_VMode 0x1008fe23
|
||||
#define CLUTTER_LogWindowTree 0x1008fe24
|
||||
#define CLUTTER_LogGrabInfo 0x1008fe25
|
||||
|
||||
#endif /* __CLUTTER_KEYSYMS_COMPAT_H__ */
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
#endif /* __CLUTTER_KEYSYMS_DEPRECATED_H__ */
|
53
clutter/deprecated/clutter-main.h
Normal file
53
clutter/deprecated/clutter-main.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef __CLUTTER_MAIN_DEPRECATED_H__
|
||||
#define __CLUTTER_MAIN_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-input-device.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_threads_init (void);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_threads_add_frame_source (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data);
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_threads_add_frame_source_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_set_motion_events_enabled)
|
||||
void clutter_set_motion_events_enabled (gboolean enable);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_get_motion_events_enabled)
|
||||
gboolean clutter_get_motion_events_enabled (void);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_ensure_redraw)
|
||||
void clutter_redraw (ClutterStage *stage);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(cogl_pango_font_map_clear_glyph_cache)
|
||||
void clutter_clear_glyph_cache (void);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_backend_set_font_options)
|
||||
void clutter_set_font_flags (ClutterFontFlags flags);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_backend_get_font_options)
|
||||
ClutterFontFlags clutter_get_font_flags (void);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_device_manager_get_device)
|
||||
ClutterInputDevice * clutter_get_input_device_for_id (gint id_);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_input_device_grab)
|
||||
void clutter_grab_pointer_for_device (ClutterActor *actor,
|
||||
gint id_);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_input_device_ungrab)
|
||||
void clutter_ungrab_pointer_for_device (gint id_);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_MAIN_DEPRECATED_H__ */
|
@ -150,6 +150,30 @@ CoglHandle clutter_shader_get_cogl_fragment_shader (ClutterShader
|
||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
|
||||
CoglHandle clutter_shader_get_cogl_vertex_shader (ClutterShader *shader);
|
||||
|
||||
/* ClutterActor methods */
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_effect)
|
||||
gboolean clutter_actor_set_shader (ClutterActor *self,
|
||||
ClutterShader *shader);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_get_effect)
|
||||
ClutterShader * clutter_actor_get_shader (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform_value)
|
||||
void clutter_actor_set_shader_param (ClutterActor *self,
|
||||
const gchar *param,
|
||||
const GValue *value);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform)
|
||||
void clutter_actor_set_shader_param_int (ClutterActor *self,
|
||||
const gchar *param,
|
||||
gint value);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform)
|
||||
void clutter_actor_set_shader_param_float (ClutterActor *self,
|
||||
const gchar *param,
|
||||
gfloat value);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_SHADER_H__ */
|
||||
|
45
clutter/deprecated/clutter-stage.h
Normal file
45
clutter/deprecated/clutter-stage.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef __CLUTTER_STAGE_DEPRECATED_H__
|
||||
#define __CLUTTER_STAGE_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
/**
|
||||
* CLUTTER_STAGE_WIDTH:
|
||||
*
|
||||
* Macro that evaluates to the width of the default stage
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.2: Use clutter_actor_get_width() instead
|
||||
*/
|
||||
#define CLUTTER_STAGE_WIDTH() (clutter_actor_get_width (clutter_stage_get_default ()))
|
||||
|
||||
/**
|
||||
* CLUTTER_STAGE_HEIGHT:
|
||||
*
|
||||
* Macro that evaluates to the height of the default stage
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.2: use clutter_actor_get_height() instead
|
||||
*/
|
||||
#define CLUTTER_STAGE_HEIGHT() (clutter_actor_get_height (clutter_stage_get_default ()))
|
||||
|
||||
/* Commodity macro, for mallum only */
|
||||
#define clutter_stage_add(stage,actor) G_STMT_START { \
|
||||
if (CLUTTER_IS_STAGE ((stage)) && CLUTTER_IS_ACTOR ((actor))) \
|
||||
{ \
|
||||
ClutterContainer *_container = (ClutterContainer *) (stage); \
|
||||
ClutterActor *_actor = (ClutterActor *) (actor); \
|
||||
clutter_container_add_actor (_container, _actor); \
|
||||
} } G_STMT_END
|
||||
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_DEPRECATED_H__ */
|
368
clutter/egl/clutter-backend-eglnative.c
Normal file
368
clutter/egl/clutter-backend-eglnative.c
Normal file
@ -0,0 +1,368 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2010,2011 Intel Corporation.
|
||||
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
* Authors:
|
||||
* Matthew Allum
|
||||
* Emmanuele Bassi
|
||||
* Robert Bragg
|
||||
* Neil Roberts
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "clutter-backend-eglnative.h"
|
||||
|
||||
/* This is a Cogl based backend */
|
||||
#include "cogl/clutter-stage-cogl.h"
|
||||
|
||||
#ifdef HAVE_EVDEV
|
||||
#include "clutter-device-manager-evdev.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
#include "clutter-event-tslib.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-stage-private.h"
|
||||
|
||||
#ifdef COGL_HAS_EGL_SUPPORT
|
||||
#include "clutter-egl.h"
|
||||
#endif
|
||||
|
||||
#ifdef CLUTTER_EGL_BACKEND_CEX100
|
||||
#include "clutter-cex100.h"
|
||||
#endif
|
||||
|
||||
#ifdef CLUTTER_EGL_BACKEND_CEX100
|
||||
static gdl_plane_id_t gdl_plane = GDL_PLANE_ID_UPP_C;
|
||||
static guint gdl_n_buffers = CLUTTER_CEX100_TRIPLE_BUFFERING;
|
||||
#endif
|
||||
|
||||
#define clutter_backend_egl_native_get_type _clutter_backend_egl_native_get_type
|
||||
|
||||
G_DEFINE_TYPE (ClutterBackendEglNative, clutter_backend_egl_native, CLUTTER_TYPE_BACKEND_COGL);
|
||||
|
||||
static ClutterDeviceManager *
|
||||
clutter_backend_egl_native_get_device_manager (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendEglNative *backend_egl_native = CLUTTER_BACKEND_EGL_NATIVE (backend);
|
||||
|
||||
if (G_UNLIKELY (backend_egl_native->device_manager == NULL))
|
||||
{
|
||||
#ifdef HAVE_EVDEV
|
||||
backend_egl_native->device_manager =
|
||||
g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_EVDEV,
|
||||
"backend", backend_egl_native,
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
return backend_egl_native->device_manager;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_native_init_events (ClutterBackend *backend)
|
||||
{
|
||||
const char *input_backend = NULL;
|
||||
|
||||
input_backend = g_getenv ("CLUTTER_INPUT_BACKEND");
|
||||
|
||||
#ifdef HAVE_EVDEV
|
||||
if (input_backend != NULL &&
|
||||
strcmp (input_backend, CLUTTER_EVDEV_INPUT_BACKEND) == 0)
|
||||
_clutter_events_evdev_init (CLUTTER_BACKEND (backend));
|
||||
else
|
||||
#endif
|
||||
#ifdef HAVE_TSLIB
|
||||
if (input_backend != NULL &&
|
||||
strcmp (input_backend, CLUTTER_TSLIB_INPUT_BACKEND) == 0)
|
||||
_clutter_events_tslib_init (CLUTTER_BACKEND (backend));
|
||||
else
|
||||
#endif
|
||||
if (input_backend != NULL)
|
||||
g_error ("Unrecognized input backend '%s'", input_backend);
|
||||
else
|
||||
g_error ("Unknown input backend");
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_native_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterBackendEglNative *backend_egl_native = CLUTTER_BACKEND_EGL_NATIVE (gobject);
|
||||
|
||||
if (backend_egl_native->event_timer != NULL)
|
||||
{
|
||||
g_timer_destroy (backend_egl_native->event_timer);
|
||||
backend_egl_native->event_timer = NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
_clutter_events_tslib_uninit (CLUTTER_BACKEND (gobject));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EVDEV
|
||||
_clutter_events_evdev_uninit (CLUTTER_BACKEND (gobject));
|
||||
|
||||
if (backend_egl_native->device_manager != NULL)
|
||||
{
|
||||
g_object_unref (backend_egl_native->device_manager);
|
||||
backend_egl_native->device_manager = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
G_OBJECT_CLASS (clutter_backend_egl_native_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static ClutterStageWindow *
|
||||
clutter_backend_egl_native_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendEglNative *backend_egl_native = CLUTTER_BACKEND_EGL_NATIVE (backend);
|
||||
ClutterStageWindow *stage;
|
||||
|
||||
if (G_UNLIKELY (backend_egl_native->stage != NULL))
|
||||
{
|
||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"The EglNative backend does not support multiple "
|
||||
"onscreen windows");
|
||||
return backend_egl_native->stage;
|
||||
}
|
||||
|
||||
stage = g_object_new (CLUTTER_TYPE_STAGE_COGL,
|
||||
"backend", backend,
|
||||
"wrapper", wrapper,
|
||||
NULL);
|
||||
backend_egl_native->stage = stage;
|
||||
|
||||
return stage;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_backend_egl_native_create_context (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
CoglSwapChain *swap_chain = NULL;
|
||||
CoglOnscreenTemplate *onscreen_template = NULL;
|
||||
|
||||
if (backend->cogl_context != NULL)
|
||||
return TRUE;
|
||||
|
||||
backend->cogl_renderer = cogl_renderer_new ();
|
||||
if (!cogl_renderer_connect (backend->cogl_renderer, error))
|
||||
goto error;
|
||||
|
||||
swap_chain = cogl_swap_chain_new ();
|
||||
|
||||
#if defined(CLUTTER_EGL_BACKEND_CEX100) && defined(COGL_HAS_GDL_SUPPORT)
|
||||
cogl_swap_chain_set_length (swap_chain, gdl_n_buffers);
|
||||
#endif
|
||||
|
||||
onscreen_template = cogl_onscreen_template_new (swap_chain);
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
/* XXX: I have some doubts that this is a good design.
|
||||
* Conceptually should we be able to check an onscreen_template
|
||||
* without more details about the CoglDisplay configuration?
|
||||
*/
|
||||
if (!cogl_renderer_check_onscreen_template (backend->cogl_renderer,
|
||||
onscreen_template,
|
||||
error))
|
||||
goto error;
|
||||
|
||||
backend->cogl_display = cogl_display_new (backend->cogl_renderer,
|
||||
onscreen_template);
|
||||
|
||||
#if defined(CLUTTER_EGL_BACKEND_CEX100) && defined(COGL_HAS_GDL_SUPPORT)
|
||||
cogl_gdl_display_set_plane (backend->cogl_display, gdl_plane);
|
||||
#endif /* CLUTTER_EGL_BACKEND_CEX100 */
|
||||
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
cogl_object_unref (onscreen_template);
|
||||
|
||||
if (!cogl_display_setup (backend->cogl_display, error))
|
||||
goto error;
|
||||
|
||||
backend->cogl_context = cogl_context_new (backend->cogl_display, error);
|
||||
if (backend->cogl_context == NULL)
|
||||
goto error;
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
if (backend->cogl_display != NULL)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_display);
|
||||
backend->cogl_display = NULL;
|
||||
}
|
||||
|
||||
if (onscreen_template != NULL)
|
||||
cogl_object_unref (onscreen_template);
|
||||
|
||||
if (swap_chain != NULL)
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
if (backend->cogl_renderer != NULL)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
backend->cogl_renderer = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = clutter_backend_egl_native_dispose;
|
||||
|
||||
backend_class->get_device_manager = clutter_backend_egl_native_get_device_manager;
|
||||
backend_class->init_events = clutter_backend_egl_native_init_events;
|
||||
backend_class->create_stage = clutter_backend_egl_native_create_stage;
|
||||
backend_class->create_context = clutter_backend_egl_native_create_context;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native)
|
||||
{
|
||||
backend_egl_native->event_timer = g_timer_new ();
|
||||
}
|
||||
|
||||
#ifdef CLUTTER_EGL_BACKEND_CEX100
|
||||
/**
|
||||
* clutter_cex100_set_plane:
|
||||
* @plane: FIXME
|
||||
*
|
||||
* FIXME
|
||||
*
|
||||
* Since:
|
||||
*/
|
||||
void
|
||||
clutter_cex100_set_plane (gdl_plane_id_t plane)
|
||||
{
|
||||
g_return_if_fail (plane >= GDL_PLANE_ID_UPP_A && plane <= GDL_PLANE_ID_UPP_E);
|
||||
|
||||
gdl_plane = plane;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLUTTER_EGL_BACKEND_CEX100
|
||||
/**
|
||||
* clutter_cex100_set_plane:
|
||||
* @mode: FIXME
|
||||
*
|
||||
* FIXME
|
||||
*
|
||||
* Since:
|
||||
*/
|
||||
void
|
||||
clutter_cex100_set_buffering_mode (ClutterCex100BufferingMode mode)
|
||||
{
|
||||
g_return_if_fail (mode == CLUTTER_CEX100_DOUBLE_BUFFERING ||
|
||||
mode == CLUTTER_CEX100_TRIPLE_BUFFERING);
|
||||
|
||||
gdl_n_buffers = mode;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* clutter_eglx_display:
|
||||
*
|
||||
* Retrieves the EGL display used by Clutter.
|
||||
*
|
||||
* Return value: the EGL display, or 0
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_egl_get_egl_display() instead.
|
||||
*/
|
||||
EGLDisplay
|
||||
clutter_eglx_display (void)
|
||||
{
|
||||
return clutter_egl_get_egl_display ();
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_egl_display:
|
||||
*
|
||||
* Retrieves the EGL display used by Clutter.
|
||||
*
|
||||
* Return value: the EGL display used by Clutter, or 0
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_egl_get_egl_display() instead.
|
||||
*/
|
||||
EGLDisplay
|
||||
clutter_egl_display (void)
|
||||
{
|
||||
return clutter_egl_get_egl_display ();
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_egl_get_egl_display:
|
||||
*
|
||||
* Retrieves the EGL display used by Clutter, if it supports the
|
||||
* EGL windowing system and if it is running using an EGL backend.
|
||||
*
|
||||
* Return value: the EGL display used by Clutter, or 0
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
EGLDisplay
|
||||
clutter_egl_get_egl_display (void)
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
|
||||
if (!_clutter_context_is_initialized ())
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialized yet");
|
||||
return 0;
|
||||
}
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
|
||||
if (!CLUTTER_IS_BACKEND_EGL_NATIVE (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not an EGL backend");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if COGL_HAS_EGL_SUPPORT
|
||||
return cogl_egl_context_get_egl_display (backend->cogl_context);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
75
clutter/egl/clutter-backend-eglnative.h
Normal file
75
clutter/egl/clutter-backend-eglnative.h
Normal file
@ -0,0 +1,75 @@
|
||||
/* Clutter.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenedHand
|
||||
* Copyright (C) 2010 Intel Corp
|
||||
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Matthew Allum
|
||||
* Robert Bragg
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_BACKEND_EGL_NATIVE_H__
|
||||
#define __CLUTTER_BACKEND_EGL_NATIVE_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-device-manager.h>
|
||||
|
||||
#include "clutter-backend-private.h"
|
||||
#include "cogl/clutter-backend-cogl.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BACKEND_EGL_NATIVE (_clutter_backend_egl_native_get_type ())
|
||||
#define CLUTTER_BACKEND_EGL_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_EGL_NATIVE, ClutterBackendEglNative))
|
||||
#define CLUTTER_IS_BACKEND_EGL_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_EGL_NATIVE))
|
||||
#define CLUTTER_BACKEND_EGL_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_EGL_NATIVE, ClutterBackendEglNativeClass))
|
||||
#define CLUTTER_IS_BACKEND_EGL_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_EGL_NATIVE))
|
||||
#define CLUTTER_BACKEND_EGL_NATIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_EGL_NATIVE, ClutterBackendEglNativeClass))
|
||||
|
||||
typedef struct _ClutterBackendEglNative ClutterBackendEglNative;
|
||||
typedef struct _ClutterBackendEglNativeClass ClutterBackendEglNativeClass;
|
||||
|
||||
struct _ClutterBackendEglNative
|
||||
{
|
||||
ClutterBackendCogl parent_instance;
|
||||
|
||||
/* main stage singleton */
|
||||
ClutterStageWindow *stage;
|
||||
|
||||
/* device manager (ie evdev) */
|
||||
ClutterDeviceManager *device_manager;
|
||||
|
||||
/* event source */
|
||||
GSource *event_source;
|
||||
|
||||
/* event timer */
|
||||
GTimer *event_timer;
|
||||
};
|
||||
|
||||
struct _ClutterBackendEglNativeClass
|
||||
{
|
||||
ClutterBackendCoglClass parent_class;
|
||||
};
|
||||
|
||||
GType _clutter_backend_egl_native_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_EGL_NATIVE_H__ */
|
@ -49,6 +49,9 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TSLIB_INPUT_BACKEND "tslib"
|
||||
#define CLUTTER_EVDEV_INPUT_BACKEND "evdev"
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
/**
|
||||
* clutter_eglx_display:
|
@ -855,17 +855,16 @@ clutter_device_manager_evdev_init (ClutterDeviceManagerEvdev *self)
|
||||
void
|
||||
_clutter_events_evdev_init (ClutterBackend *backend)
|
||||
{
|
||||
ClutterDeviceManager *dummy G_GNUC_UNUSED;
|
||||
|
||||
CLUTTER_NOTE (EVENT, "Initializing evdev backend");
|
||||
|
||||
/* We just have to create the singleon here */
|
||||
clutter_device_manager_get_default ();
|
||||
/* we need to create the device manager here */
|
||||
dummy = clutter_device_manager_get_default ();
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_events_evdev_uninit (ClutterBackend *backend)
|
||||
{
|
||||
ClutterDeviceManager *manager;
|
||||
|
||||
manager = clutter_device_manager_get_default ();
|
||||
g_object_unref (manager);
|
||||
CLUTTER_NOTE (EVENT, "Uninitializing evdev backend");
|
||||
}
|
||||
|
32
clutter/gdk/clutter-backend-gdk-private.h
Normal file
32
clutter/gdk/clutter-backend-gdk-private.h
Normal file
@ -0,0 +1,32 @@
|
||||
/* An OpenGL based 'interactive canvas' library.
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Copyright (C) 2006-2007 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_BACKEND_PRIVATE_X11_H__
|
||||
#define __CLUTTER_BACKEND_PRIVATE_X11_H__
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _clutter_backend_x11_events_init (ClutterBackend *backend);
|
||||
void _clutter_backend_x11_events_uninit (ClutterBackend *backend);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
470
clutter/gdk/clutter-backend-gdk.c
Normal file
470
clutter/gdk/clutter-backend-gdk.c
Normal file
@ -0,0 +1,470 @@
|
||||
/* Clutter.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Copyright (C) 2006-2007 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#include <cogl/cogl-xlib.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
#include <gdk/gdkwin32.h>
|
||||
#endif
|
||||
|
||||
#include "clutter-backend-gdk.h"
|
||||
#include "clutter-device-manager-gdk.h"
|
||||
#include "clutter-settings-gdk.h"
|
||||
#include "clutter-stage-gdk.h"
|
||||
#include "clutter-gdk.h"
|
||||
|
||||
#include "clutter-backend.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#define clutter_backend_gdk_get_type _clutter_backend_gdk_get_type
|
||||
G_DEFINE_TYPE (ClutterBackendGdk, clutter_backend_gdk, CLUTTER_TYPE_BACKEND_COGL);
|
||||
|
||||
/* global for pre init setup calls */
|
||||
static GdkDisplay *_foreign_dpy = NULL;
|
||||
|
||||
static gboolean disable_event_retrieval = FALSE;
|
||||
|
||||
static void
|
||||
clutter_backend_gdk_init_settings (ClutterBackendGdk *backend_gdk)
|
||||
{
|
||||
ClutterSettings *settings = clutter_settings_get_default ();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (_clutter_settings_map); i++)
|
||||
{
|
||||
GValue val = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&val, CLUTTER_SETTING_TYPE(i));
|
||||
gdk_screen_get_setting (backend_gdk->screen,
|
||||
CLUTTER_SETTING_GDK_NAME(i),
|
||||
&val);
|
||||
g_object_set_property (G_OBJECT (settings),
|
||||
CLUTTER_SETTING_PROPERTY(i),
|
||||
&val);
|
||||
g_value_unset (&val);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_gdk_update_setting (ClutterBackendGdk *backend_gdk,
|
||||
const gchar *setting_name)
|
||||
{
|
||||
ClutterSettings *settings = clutter_settings_get_default ();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (_clutter_settings_map); i++)
|
||||
{
|
||||
if (g_strcmp0 (CLUTTER_SETTING_GDK_NAME (i), setting_name) == 0)
|
||||
{
|
||||
GValue val = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&val, CLUTTER_SETTING_TYPE (i));
|
||||
gdk_screen_get_setting (backend_gdk->screen,
|
||||
CLUTTER_SETTING_GDK_NAME (i),
|
||||
&val);
|
||||
g_object_set_property (G_OBJECT (settings),
|
||||
CLUTTER_SETTING_PROPERTY (i),
|
||||
&val);
|
||||
g_value_unset (&val);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static GdkFilterReturn
|
||||
cogl_gdk_filter (GdkXEvent *xevent,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
CoglFilterReturn ret;
|
||||
|
||||
ret = cogl_xlib_handle_event ((XEvent*)xevent);
|
||||
switch (ret)
|
||||
{
|
||||
case COGL_FILTER_REMOVE:
|
||||
return GDK_FILTER_REMOVE;
|
||||
|
||||
case COGL_FILTER_CONTINUE:
|
||||
default:
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_clutter_backend_gdk_post_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend);
|
||||
|
||||
if (_foreign_dpy != NULL)
|
||||
backend_gdk->display = _foreign_dpy;
|
||||
|
||||
/* Init Gdk, if outside code did not already */
|
||||
if (!gdk_init_check (NULL, NULL))
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* Only open connection if not already set by prior call to
|
||||
* clutter_gdk_set_display()
|
||||
*/
|
||||
if (backend_gdk->display == NULL)
|
||||
backend_gdk->display = g_object_ref (gdk_display_get_default ());
|
||||
|
||||
g_assert (backend_gdk->display != NULL);
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
if (GDK_IS_X11_DISPLAY (backend_gdk->display))
|
||||
{
|
||||
/* Cogl needs to know the Xlib display connection for
|
||||
CoglTexturePixmapX11 */
|
||||
cogl_xlib_set_display (gdk_x11_display_get_xdisplay (backend_gdk->display));
|
||||
}
|
||||
#endif
|
||||
|
||||
backend_gdk->screen = gdk_display_get_default_screen (backend_gdk->display);
|
||||
|
||||
/* add event filter for Cogl events */
|
||||
gdk_window_add_filter (NULL, cogl_gdk_filter, NULL);
|
||||
|
||||
clutter_backend_gdk_init_settings (backend_gdk);
|
||||
|
||||
CLUTTER_NOTE (BACKEND,
|
||||
"Gdk Display '%s' opened",
|
||||
gdk_display_get_name (backend_gdk->display));
|
||||
|
||||
return CLUTTER_BACKEND_CLASS (clutter_backend_gdk_parent_class)->post_parse (backend,
|
||||
error);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
clutter_backend_gdk_init_events (ClutterBackend *backend)
|
||||
{
|
||||
CLUTTER_NOTE (EVENT, "initialising the event loop");
|
||||
|
||||
if (!disable_event_retrieval)
|
||||
_clutter_backend_gdk_events_init (backend);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_gdk_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (gobject);
|
||||
|
||||
gdk_window_remove_filter (NULL, cogl_gdk_filter, NULL);
|
||||
g_object_unref (backend_gdk->display);
|
||||
|
||||
G_OBJECT_CLASS (clutter_backend_gdk_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_gdk_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (gobject);
|
||||
ClutterStageManager *stage_manager;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Disposing the of stages");
|
||||
stage_manager = clutter_stage_manager_get_default ();
|
||||
|
||||
g_object_unref (stage_manager);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Removing the event source");
|
||||
_clutter_backend_gdk_events_uninit (CLUTTER_BACKEND (backend_gdk));
|
||||
|
||||
G_OBJECT_CLASS (clutter_backend_gdk_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static ClutterFeatureFlags
|
||||
clutter_backend_gdk_get_features (ClutterBackend *backend)
|
||||
{
|
||||
ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_USER_RESIZE | CLUTTER_FEATURE_STAGE_CURSOR;
|
||||
|
||||
flags |= CLUTTER_BACKEND_CLASS (clutter_backend_gdk_parent_class)->get_features (backend);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_gdk_copy_event_data (ClutterBackend *backend,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
GdkEvent *gdk_event;
|
||||
|
||||
gdk_event = _clutter_event_get_platform_data (src);
|
||||
if (gdk_event != NULL)
|
||||
_clutter_event_set_platform_data (dest, gdk_event_copy (gdk_event));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_gdk_free_event_data (ClutterBackend *backend,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
GdkEvent *gdk_event;
|
||||
|
||||
gdk_event = _clutter_event_get_platform_data (event);
|
||||
if (gdk_event != NULL)
|
||||
gdk_event_free (gdk_event);
|
||||
}
|
||||
|
||||
static ClutterDeviceManager *
|
||||
clutter_backend_gdk_get_device_manager (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend);
|
||||
|
||||
if (G_UNLIKELY (backend_gdk->device_manager == NULL))
|
||||
{
|
||||
backend_gdk->device_manager = g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_GDK,
|
||||
"backend", backend_gdk,
|
||||
"gdk-display", backend_gdk->display,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return backend_gdk->device_manager;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_backend_gdk_create_context (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend);
|
||||
CoglSwapChain *swap_chain = NULL;
|
||||
CoglOnscreenTemplate *onscreen_template = NULL;
|
||||
GdkVisual *rgba_visual = NULL;
|
||||
|
||||
if (backend->cogl_context != NULL)
|
||||
return TRUE;
|
||||
|
||||
backend->cogl_renderer = cogl_renderer_new ();
|
||||
|
||||
#if defined(GDK_WINDOWING_X11) && defined(COGL_HAS_XLIB_SUPPORT)
|
||||
if (GDK_IS_X11_DISPLAY (backend_gdk->display))
|
||||
{
|
||||
cogl_xlib_renderer_set_foreign_display (backend->cogl_renderer,
|
||||
gdk_x11_display_get_xdisplay (backend_gdk->display));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if defined(GDK_WINDOWING_WIN32)
|
||||
if (GDK_IS_WIN32_DISPLAY (backend_gdk->display))
|
||||
{
|
||||
/* Force a WGL winsys on windows */
|
||||
cogl_renderer_set_winsys_id (backend_cogl->cogl_renderer, COGL_WINSYS_ID_WGL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"Could not find a suitable CoglWinsys for"
|
||||
"a GdkDisplay of type %s", G_OBJECT_TYPE_NAME (backend_gdk->display));
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if (!cogl_renderer_connect (backend->cogl_renderer, error))
|
||||
goto error;
|
||||
|
||||
swap_chain = cogl_swap_chain_new ();
|
||||
|
||||
rgba_visual = gdk_screen_get_rgba_visual (backend_gdk->screen);
|
||||
cogl_swap_chain_set_has_alpha (swap_chain, rgba_visual != NULL);
|
||||
|
||||
onscreen_template = cogl_onscreen_template_new (swap_chain);
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
/* XXX: I have some doubts that this is a good design.
|
||||
* Conceptually should we be able to check an onscreen_template
|
||||
* without more details about the CoglDisplay configuration?
|
||||
*/
|
||||
if (!cogl_renderer_check_onscreen_template (backend->cogl_renderer,
|
||||
onscreen_template,
|
||||
error))
|
||||
goto error;
|
||||
|
||||
backend->cogl_display = cogl_display_new (backend->cogl_renderer,
|
||||
onscreen_template);
|
||||
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
cogl_object_unref (onscreen_template);
|
||||
|
||||
if (!cogl_display_setup (backend->cogl_display, error))
|
||||
goto error;
|
||||
|
||||
backend->cogl_context = cogl_context_new (backend->cogl_display, error);
|
||||
if (backend->cogl_context == NULL)
|
||||
goto error;
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
if (backend->cogl_display != NULL)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_display);
|
||||
backend->cogl_display = NULL;
|
||||
}
|
||||
|
||||
if (onscreen_template != NULL)
|
||||
cogl_object_unref (onscreen_template);
|
||||
if (swap_chain != NULL)
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
if (backend->cogl_renderer != NULL)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
backend->cogl_renderer = NULL;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static ClutterStageWindow *
|
||||
clutter_backend_gdk_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_STAGE_GDK,
|
||||
"backend", backend,
|
||||
"wrapper", wrapper,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_gdk_class_init (ClutterBackendGdkClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = clutter_backend_gdk_dispose;
|
||||
gobject_class->finalize = clutter_backend_gdk_finalize;
|
||||
|
||||
backend_class->post_parse = _clutter_backend_gdk_post_parse;
|
||||
backend_class->init_events = clutter_backend_gdk_init_events;
|
||||
backend_class->get_features = clutter_backend_gdk_get_features;
|
||||
backend_class->get_device_manager = clutter_backend_gdk_get_device_manager;
|
||||
backend_class->copy_event_data = clutter_backend_gdk_copy_event_data;
|
||||
backend_class->free_event_data = clutter_backend_gdk_free_event_data;
|
||||
backend_class->create_context = clutter_backend_gdk_create_context;
|
||||
backend_class->create_stage = clutter_backend_gdk_create_stage;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_gdk_init (ClutterBackendGdk *backend_gdk)
|
||||
{
|
||||
/* nothing to do here */
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_gdk_get_default_display:
|
||||
*
|
||||
* Retrieves the pointer to the default display.
|
||||
*
|
||||
* Return value: (transfer none): the default display
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
GdkDisplay *
|
||||
clutter_gdk_get_default_display (void)
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!CLUTTER_IS_BACKEND_GDK (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a GDK backend");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return CLUTTER_BACKEND_GDK (backend)->display;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_gdk_set_display:
|
||||
* @display: pointer to a GDK display connection.
|
||||
*
|
||||
* Sets the display connection Clutter should use; must be called
|
||||
* before clutter_init(), clutter_init_with_args() or other functions
|
||||
* pertaining Clutter's initialization process.
|
||||
*
|
||||
* If you are parsing the command line arguments by retrieving Clutter's
|
||||
* #GOptionGroup with clutter_get_option_group() and calling
|
||||
* g_option_context_parse() yourself, you should also call
|
||||
* clutter_gdk_set_display() before g_option_context_parse().
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
void
|
||||
clutter_gdk_set_display (GdkDisplay *display)
|
||||
{
|
||||
if (_clutter_context_is_initialized ())
|
||||
{
|
||||
g_warning ("%s() can only be used before calling clutter_init()",
|
||||
G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
_foreign_dpy = g_object_ref (display);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_gdk_disable_event_retrieval (void)
|
||||
{
|
||||
if (_clutter_context_is_initialized ())
|
||||
{
|
||||
g_warning ("%s() can only be used before calling clutter_init()",
|
||||
G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
disable_event_retrieval = TRUE;
|
||||
}
|
73
clutter/gdk/clutter-backend-gdk.h
Normal file
73
clutter/gdk/clutter-backend-gdk.h
Normal file
@ -0,0 +1,73 @@
|
||||
/* Clutter.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Copyright (C) 2006-2007 OpenedHand
|
||||
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_BACKEND_GDK_H__
|
||||
#define __CLUTTER_BACKEND_GDK_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "clutter-gdk.h"
|
||||
|
||||
#include "clutter-backend-private.h"
|
||||
#include "cogl/clutter-backend-cogl.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BACKEND_GDK (_clutter_backend_gdk_get_type ())
|
||||
#define CLUTTER_BACKEND_GDK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_GDK, ClutterBackendGdk))
|
||||
#define CLUTTER_IS_BACKEND_GDK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_GDK))
|
||||
#define CLUTTER_BACKEND_GDK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_GDK, ClutterBackendGdkClass))
|
||||
#define CLUTTER_IS_BACKEND_GDK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_GDK))
|
||||
#define CLUTTER_BACKEND_GDK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_GDK, ClutterBackendGdkClass))
|
||||
|
||||
typedef struct _ClutterBackendGdk ClutterBackendGdk;
|
||||
typedef struct _ClutterBackendGdkClass ClutterBackendGdkClass;
|
||||
|
||||
struct _ClutterBackendGdk
|
||||
{
|
||||
ClutterBackendCogl parent_instance;
|
||||
|
||||
GdkDisplay *display;
|
||||
GdkScreen *screen;
|
||||
|
||||
ClutterDeviceManager *device_manager;
|
||||
};
|
||||
|
||||
struct _ClutterBackendGdkClass
|
||||
{
|
||||
ClutterBackendCoglClass parent_class;
|
||||
|
||||
/* nothing here, for now */
|
||||
};
|
||||
|
||||
GType _clutter_backend_gdk_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void _clutter_backend_gdk_events_init (ClutterBackend *backend);
|
||||
void _clutter_backend_gdk_events_uninit (ClutterBackend *backend);
|
||||
|
||||
void _clutter_backend_gdk_update_setting (ClutterBackendGdk *backend, const gchar *name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_GDK_H__ */
|
249
clutter/gdk/clutter-device-manager-gdk.c
Normal file
249
clutter/gdk/clutter-device-manager-gdk.c
Normal file
@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 2011 Intel Corp.
|
||||
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "clutter-device-manager-gdk.h"
|
||||
|
||||
#include "clutter-backend-gdk.h"
|
||||
#include "clutter-input-device-gdk.h"
|
||||
#include "clutter-stage-gdk.h"
|
||||
|
||||
#include "clutter-backend.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-event-translator.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#define clutter_device_manager_gdk_get_type _clutter_device_manager_gdk_get_type
|
||||
|
||||
G_DEFINE_TYPE (ClutterDeviceManagerGdk, clutter_device_manager_gdk, CLUTTER_TYPE_DEVICE_MANAGER)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_GDK_DISPLAY,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
ClutterInputDevice *
|
||||
_clutter_device_manager_gdk_lookup_device (ClutterDeviceManager *manager,
|
||||
GdkDevice *device)
|
||||
{
|
||||
ClutterDeviceManagerGdk *manager_gdk = CLUTTER_DEVICE_MANAGER_GDK (manager);
|
||||
ClutterInputDevice *clutter_device;
|
||||
|
||||
clutter_device = g_object_get_data (G_OBJECT (device), "clutter-device");
|
||||
if (clutter_device != NULL)
|
||||
return clutter_device;
|
||||
|
||||
clutter_device = _clutter_input_device_gdk_new (manager, device);
|
||||
g_object_set_data_full (G_OBJECT (device), "clutter-device", clutter_device, g_object_unref);
|
||||
|
||||
manager_gdk->device_cache = g_slist_prepend (manager_gdk->device_cache, g_object_ref (clutter_device));
|
||||
g_hash_table_replace (manager_gdk->device_by_id,
|
||||
GINT_TO_POINTER (clutter_input_device_get_device_id (clutter_device)),
|
||||
g_object_ref (clutter_device));
|
||||
|
||||
return clutter_device;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_gdk_add_device (ClutterDeviceManager *manager,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
/* XXX implement */
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_gdk_remove_device (ClutterDeviceManager *manager,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
/* XXX implement */
|
||||
}
|
||||
|
||||
static const GSList *
|
||||
clutter_device_manager_gdk_get_devices (ClutterDeviceManager *manager)
|
||||
{
|
||||
ClutterDeviceManagerGdk *manager_gdk = CLUTTER_DEVICE_MANAGER_GDK (manager);
|
||||
|
||||
return manager_gdk->device_cache;
|
||||
}
|
||||
|
||||
static ClutterInputDevice *
|
||||
clutter_device_manager_gdk_get_device (ClutterDeviceManager *manager,
|
||||
gint id)
|
||||
{
|
||||
ClutterDeviceManagerGdk *manager_gdk = CLUTTER_DEVICE_MANAGER_GDK (manager);
|
||||
|
||||
return g_hash_table_lookup (manager_gdk->device_by_id, GINT_TO_POINTER (id));
|
||||
}
|
||||
|
||||
static ClutterInputDevice *
|
||||
clutter_device_manager_gdk_get_core_device (ClutterDeviceManager *manager,
|
||||
ClutterInputDeviceType device_type)
|
||||
{
|
||||
ClutterDeviceManagerGdk *manager_gdk = CLUTTER_DEVICE_MANAGER_GDK (manager);
|
||||
GdkDevice *gdk_device;
|
||||
|
||||
gdk_device = gdk_device_manager_get_client_pointer (manager_gdk->device_manager);
|
||||
|
||||
g_assert (gdk_device != NULL);
|
||||
|
||||
if (device_type == CLUTTER_KEYBOARD_DEVICE)
|
||||
gdk_device = gdk_device_get_associated_device (gdk_device);
|
||||
else if (device_type != CLUTTER_POINTER_DEVICE)
|
||||
return NULL;
|
||||
|
||||
return _clutter_device_manager_gdk_lookup_device (manager, gdk_device);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_added (GdkDeviceManager *gdk_manager,
|
||||
GdkDevice *device,
|
||||
ClutterDeviceManager *self)
|
||||
{
|
||||
/* this will do the right thing if the device is not there */
|
||||
ClutterInputDevice *clutter_device = _clutter_device_manager_gdk_lookup_device (self, device);
|
||||
|
||||
_clutter_device_manager_add_device (self, clutter_device);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_removed (GdkDeviceManager *gdk_manager,
|
||||
GdkDevice *device,
|
||||
ClutterDeviceManagerGdk *self)
|
||||
{
|
||||
ClutterInputDevice *clutter_device = g_object_get_data (G_OBJECT (device), "clutter-device");
|
||||
|
||||
if (clutter_device == NULL)
|
||||
return;
|
||||
|
||||
self->device_cache = g_slist_remove (self->device_cache, clutter_device);
|
||||
g_object_unref (clutter_device);
|
||||
|
||||
g_hash_table_remove (self->device_by_id,
|
||||
GINT_TO_POINTER (clutter_input_device_get_device_id (clutter_device)));
|
||||
|
||||
_clutter_device_manager_remove_device (CLUTTER_DEVICE_MANAGER (self), clutter_device);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_foreach_cb (gpointer data,
|
||||
gpointer user_data)
|
||||
{
|
||||
_clutter_device_manager_gdk_lookup_device (user_data, data);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_gdk_constructed (GObject *gobject)
|
||||
{
|
||||
ClutterDeviceManagerGdk *manager_gdk = CLUTTER_DEVICE_MANAGER_GDK (gobject);
|
||||
GList *all_devices;
|
||||
|
||||
g_assert (manager_gdk->device_manager != NULL);
|
||||
|
||||
all_devices = gdk_device_manager_list_devices (manager_gdk->device_manager,
|
||||
GDK_DEVICE_TYPE_MASTER);
|
||||
g_list_foreach (all_devices, gdk_device_foreach_cb, manager_gdk);
|
||||
g_list_free (all_devices);
|
||||
|
||||
all_devices = gdk_device_manager_list_devices (manager_gdk->device_manager,
|
||||
GDK_DEVICE_TYPE_SLAVE);
|
||||
g_list_foreach (all_devices, gdk_device_foreach_cb, manager_gdk);
|
||||
g_list_free (all_devices);
|
||||
|
||||
all_devices = gdk_device_manager_list_devices (manager_gdk->device_manager,
|
||||
GDK_DEVICE_TYPE_FLOATING);
|
||||
g_list_foreach (all_devices, gdk_device_foreach_cb, manager_gdk);
|
||||
g_list_free (all_devices);
|
||||
|
||||
g_object_connect (manager_gdk->device_manager,
|
||||
"object-signal::device-added", gdk_device_added, gobject,
|
||||
"object-signal::device-removed", gdk_device_removed, gobject,
|
||||
NULL);
|
||||
|
||||
if (G_OBJECT_CLASS (clutter_device_manager_gdk_parent_class)->constructed)
|
||||
G_OBJECT_CLASS (clutter_device_manager_gdk_parent_class)->constructed (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_gdk_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterDeviceManagerGdk *manager_gdk = CLUTTER_DEVICE_MANAGER_GDK (gobject);
|
||||
GdkDisplay *gdk_display;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_GDK_DISPLAY:
|
||||
gdk_display = GDK_DISPLAY (g_value_get_object (value));
|
||||
manager_gdk->device_manager = gdk_display_get_device_manager (gdk_display);
|
||||
g_object_ref (manager_gdk->device_manager);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_gdk_class_init (ClutterDeviceManagerGdkClass *klass)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
GObjectClass *gobject_class;
|
||||
GParamSpec *pspec;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->constructed = clutter_device_manager_gdk_constructed;
|
||||
gobject_class->set_property = clutter_device_manager_gdk_set_property;
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_CLASS (klass);
|
||||
manager_class->add_device = clutter_device_manager_gdk_add_device;
|
||||
manager_class->remove_device = clutter_device_manager_gdk_remove_device;
|
||||
manager_class->get_devices = clutter_device_manager_gdk_get_devices;
|
||||
manager_class->get_core_device = clutter_device_manager_gdk_get_core_device;
|
||||
manager_class->get_device = clutter_device_manager_gdk_get_device;
|
||||
|
||||
pspec = g_param_spec_object ("gdk-display",
|
||||
"GdkDisplay",
|
||||
"The GDK display",
|
||||
GDK_TYPE_DISPLAY,
|
||||
CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
|
||||
g_object_class_install_property (gobject_class, PROP_GDK_DISPLAY, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_gdk_init (ClutterDeviceManagerGdk *self)
|
||||
{
|
||||
self->device_by_id = g_hash_table_new_full (NULL, NULL,
|
||||
NULL, (GDestroyNotify) g_object_unref);
|
||||
}
|
63
clutter/gdk/clutter-device-manager-gdk.h
Normal file
63
clutter/gdk/clutter-device-manager-gdk.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 2011 Intel Corp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_DEVICE_MANAGER_GDK_H__
|
||||
#define __CLUTTER_DEVICE_MANAGER_GDK_H__
|
||||
|
||||
#include <clutter/clutter-device-manager.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_DEVICE_MANAGER_GDK (_clutter_device_manager_gdk_get_type ())
|
||||
#define CLUTTER_DEVICE_MANAGER_GDK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER_GDK, ClutterDeviceManagerGdk))
|
||||
#define CLUTTER_IS_DEVICE_MANAGER_GDK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER_GDK))
|
||||
#define CLUTTER_DEVICE_MANAGER_GDK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER_GDK, ClutterDeviceManagerGdkClass))
|
||||
#define CLUTTER_IS_DEVICE_MANAGER_GDK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER_GDK))
|
||||
#define CLUTTER_DEVICE_MANAGER_GDK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER_GDK, ClutterDeviceManagerGdkClass))
|
||||
|
||||
typedef struct _ClutterDeviceManagerGdk ClutterDeviceManagerGdk;
|
||||
typedef struct _ClutterDeviceManagerGdkClass ClutterDeviceManagerGdkClass;
|
||||
|
||||
struct _ClutterDeviceManagerGdk
|
||||
{
|
||||
ClutterDeviceManager parent_instance;
|
||||
|
||||
GdkDeviceManager *device_manager;
|
||||
GSList *device_cache;
|
||||
GHashTable *device_by_id;
|
||||
};
|
||||
|
||||
struct _ClutterDeviceManagerGdkClass
|
||||
{
|
||||
ClutterDeviceManagerClass parent_class;
|
||||
};
|
||||
|
||||
GType _clutter_device_manager_gdk_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterInputDevice * _clutter_device_manager_gdk_lookup_device (ClutterDeviceManager *manager,
|
||||
GdkDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DEVICE_MANAGER_GDK_H__ */
|
346
clutter/gdk/clutter-event-gdk.c
Normal file
346
clutter/gdk/clutter-event-gdk.c
Normal file
@ -0,0 +1,346 @@
|
||||
/* Clutter.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
|
||||
* Copyright (C) 2009, 2010 Intel Corp.
|
||||
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authored by:
|
||||
* Matthew Allum <mallum@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "clutter-gdk.h"
|
||||
#include "clutter-backend-gdk.h"
|
||||
#include "clutter-device-manager-gdk.h"
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-backend-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
static void
|
||||
gdk_event_handler (GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
clutter_gdk_handle_event (event);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_gdk_events_init (ClutterBackend *backend)
|
||||
{
|
||||
gdk_event_handler_set (gdk_event_handler, NULL, NULL);
|
||||
|
||||
CLUTTER_NOTE (EVENT, "GDK event handler set");
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_gdk_events_uninit (ClutterBackend *backend)
|
||||
{
|
||||
gdk_event_handler_set (NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_gdk_handle_event:
|
||||
* @event: a #GdkEvent
|
||||
*
|
||||
* This function processes a single GDK event; it can be used to hook
|
||||
* into external event processing
|
||||
*
|
||||
* Return value: #GdkFilterReturn. %GDK_FILTER_REMOVE indicates that
|
||||
* Clutter has internally handled the event and the caller should do
|
||||
* no further processing. %GDK_FILTER_CONTINUE indicates that Clutter
|
||||
* is either not interested in the event, or has used the event to
|
||||
* update internal state without taking any exclusive action.
|
||||
* %GDK_FILTER_TRANSLATE will not occur.
|
||||
*
|
||||
*/
|
||||
GdkFilterReturn
|
||||
clutter_gdk_handle_event (GdkEvent *gdk_event)
|
||||
{
|
||||
ClutterDeviceManager *device_manager;
|
||||
ClutterBackendGdk *backend_gdk;
|
||||
ClutterBackend *backend;
|
||||
ClutterStage *stage = NULL;
|
||||
ClutterEvent *event = NULL;
|
||||
gint spin = 0;
|
||||
GdkFilterReturn result = GDK_FILTER_CONTINUE;
|
||||
ClutterInputDevice *device, *source_device;
|
||||
GdkDevice *gdk_device;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
if (!CLUTTER_IS_BACKEND_GDK (backend))
|
||||
return GDK_FILTER_CONTINUE;
|
||||
|
||||
if (gdk_event->any.window == NULL)
|
||||
return GDK_FILTER_CONTINUE;
|
||||
|
||||
backend_gdk = CLUTTER_BACKEND_GDK (backend);
|
||||
stage = clutter_gdk_get_stage_from_window (gdk_event->any.window);
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
|
||||
gdk_device = gdk_event_get_device (gdk_event);
|
||||
if (gdk_device != NULL)
|
||||
device = _clutter_device_manager_gdk_lookup_device (device_manager,
|
||||
gdk_device);
|
||||
else
|
||||
device = NULL;
|
||||
|
||||
gdk_device = gdk_event_get_source_device (gdk_event);
|
||||
if (gdk_device != NULL)
|
||||
source_device = _clutter_device_manager_gdk_lookup_device (device_manager,
|
||||
gdk_device);
|
||||
else
|
||||
source_device = NULL;
|
||||
|
||||
if (stage == NULL)
|
||||
return GDK_FILTER_CONTINUE;
|
||||
|
||||
clutter_threads_enter ();
|
||||
|
||||
switch (gdk_event->type)
|
||||
{
|
||||
case GDK_DELETE:
|
||||
event = clutter_event_new (CLUTTER_DELETE);
|
||||
break;
|
||||
|
||||
case GDK_DESTROY:
|
||||
event = clutter_event_new (CLUTTER_DESTROY_NOTIFY);
|
||||
break;
|
||||
|
||||
case GDK_EXPOSE:
|
||||
{
|
||||
ClutterPaintVolume clip;
|
||||
ClutterVertex origin;
|
||||
|
||||
CLUTTER_NOTE (EVENT, "Expose for stage '%s' [%p] { %d, %d - %d x %d }",
|
||||
_clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)),
|
||||
stage,
|
||||
gdk_event->expose.area.x,
|
||||
gdk_event->expose.area.y,
|
||||
gdk_event->expose.area.width,
|
||||
gdk_event->expose.area.height);
|
||||
|
||||
origin.x = gdk_event->expose.area.x;
|
||||
origin.y = gdk_event->expose.area.y;
|
||||
origin.z = 0;
|
||||
|
||||
_clutter_paint_volume_init_static (&clip, CLUTTER_ACTOR (stage));
|
||||
|
||||
clutter_paint_volume_set_origin (&clip, &origin);
|
||||
clutter_paint_volume_set_width (&clip, gdk_event->expose.area.width);
|
||||
clutter_paint_volume_set_height (&clip, gdk_event->expose.area.height);
|
||||
|
||||
_clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), 0, &clip);
|
||||
|
||||
clutter_paint_volume_free (&clip);
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_DAMAGE:
|
||||
/* This is handled by cogl */
|
||||
break;
|
||||
|
||||
case GDK_MOTION_NOTIFY:
|
||||
event = clutter_event_new (CLUTTER_MOTION);
|
||||
event->motion.time = gdk_event->motion.time;
|
||||
event->motion.x = gdk_event->motion.x;
|
||||
event->motion.y = gdk_event->motion.y;
|
||||
event->motion.axes = NULL;
|
||||
/* It's all X in the end, right? */
|
||||
event->motion.modifier_state = gdk_event->motion.state;
|
||||
clutter_event_set_device (event, device);
|
||||
clutter_event_set_source_device (event, source_device);
|
||||
CLUTTER_NOTE (EVENT, "Motion notifiy [%.2f, %.2f]",
|
||||
event->motion.x,
|
||||
event->motion.y);
|
||||
break;
|
||||
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
event = clutter_event_new (gdk_event->type == GDK_BUTTON_PRESS ?
|
||||
CLUTTER_BUTTON_PRESS :
|
||||
CLUTTER_BUTTON_RELEASE);
|
||||
event->button.time = gdk_event->button.time;
|
||||
event->button.x = gdk_event->button.x;
|
||||
event->button.y = gdk_event->button.y;
|
||||
event->button.axes = NULL;
|
||||
event->button.modifier_state = gdk_event->button.state;
|
||||
event->button.button = gdk_event->button.button;
|
||||
event->button.click_count = 1;
|
||||
clutter_event_set_device (event, device);
|
||||
clutter_event_set_source_device (event, source_device);
|
||||
CLUTTER_NOTE (EVENT, "Button %d %s [%.2f, %.2f]",
|
||||
event->button.button,
|
||||
event->type == CLUTTER_BUTTON_PRESS ? "press" : "release",
|
||||
event->button.x,
|
||||
event->button.y);
|
||||
break;
|
||||
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
/* these are handled by clutter-main.c updating click_count */
|
||||
break;
|
||||
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
event = clutter_event_new (gdk_event->type == GDK_KEY_PRESS ?
|
||||
CLUTTER_KEY_PRESS :
|
||||
CLUTTER_KEY_RELEASE);
|
||||
event->key.time = gdk_event->key.time;
|
||||
event->key.modifier_state = gdk_event->key.state;
|
||||
event->key.keyval = gdk_event->key.keyval;
|
||||
event->key.hardware_keycode = gdk_event->key.hardware_keycode;
|
||||
event->key.unicode_value = g_utf8_get_char (gdk_event->key.string);
|
||||
clutter_event_set_device (event, device);
|
||||
clutter_event_set_source_device (event, source_device);
|
||||
CLUTTER_NOTE (EVENT, "Key %d %s",
|
||||
event->key.keyval,
|
||||
event->type == CLUTTER_KEY_PRESS ? "press" : "release");
|
||||
break;
|
||||
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
event = clutter_event_new (gdk_event->type == GDK_ENTER_NOTIFY ?
|
||||
CLUTTER_ENTER :
|
||||
CLUTTER_LEAVE);
|
||||
event->crossing.source = CLUTTER_ACTOR (stage);
|
||||
event->crossing.time = gdk_event_get_time (gdk_event);
|
||||
event->crossing.x = gdk_event->crossing.x;
|
||||
event->crossing.y = gdk_event->crossing.y;
|
||||
|
||||
/* XXX: no better fallback here? */
|
||||
clutter_event_set_device (event, device);
|
||||
clutter_event_set_source_device (event, source_device);
|
||||
if (gdk_event->type == GDK_ENTER_NOTIFY)
|
||||
_clutter_stage_add_device (stage, clutter_event_get_device (event));
|
||||
else
|
||||
_clutter_stage_remove_device (stage, clutter_event_get_device (event));
|
||||
CLUTTER_NOTE (EVENT, "Crossing %s [%.2f, %.2f]",
|
||||
event->type == CLUTTER_ENTER ? "enter" : "leave",
|
||||
event->crossing.x,
|
||||
event->crossing.y);
|
||||
break;
|
||||
|
||||
case GDK_FOCUS_CHANGE:
|
||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
||||
event->stage_state.time = 0; /* XXX: there is no timestamp in this GdkEvent */
|
||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
event->stage_state.new_state = gdk_event->focus_change.in
|
||||
? CLUTTER_STAGE_STATE_ACTIVATED
|
||||
: 0;
|
||||
break;
|
||||
|
||||
case GDK_CONFIGURE:
|
||||
{
|
||||
gfloat w, h;
|
||||
|
||||
clutter_actor_get_size (CLUTTER_ACTOR (stage), &w, &h);
|
||||
|
||||
if (w != gdk_event->configure.width ||
|
||||
h != gdk_event->configure.height)
|
||||
{
|
||||
clutter_actor_set_size (CLUTTER_ACTOR (stage),
|
||||
gdk_event->configure.width,
|
||||
gdk_event->configure.height);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_SCROLL:
|
||||
event = clutter_event_new (CLUTTER_SCROLL);
|
||||
event->scroll.time = gdk_event->scroll.time;
|
||||
event->scroll.x = gdk_event->scroll.x;
|
||||
event->scroll.y = gdk_event->scroll.y;
|
||||
event->scroll.modifier_state = gdk_event->scroll.state;
|
||||
event->scroll.axes = NULL;
|
||||
event->scroll.direction = gdk_event->scroll.direction;
|
||||
clutter_event_set_device (event, device);
|
||||
clutter_event_set_source_device (event, source_device);
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_STATE:
|
||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
||||
event->stage_state.changed_mask = 0;
|
||||
event->stage_state.new_state = 0;
|
||||
if (gdk_event->window_state.changed_mask & GDK_WINDOW_STATE_WITHDRAWN)
|
||||
{
|
||||
event->stage_state.changed_mask |= CLUTTER_STAGE_STATE_OFFSCREEN;
|
||||
event->stage_state.new_state |= (gdk_event->window_state.new_window_state & GDK_WINDOW_STATE_WITHDRAWN)
|
||||
? CLUTTER_STAGE_STATE_OFFSCREEN
|
||||
: 0;
|
||||
}
|
||||
|
||||
if (gdk_event->window_state.changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
|
||||
{
|
||||
event->stage_state.changed_mask |= CLUTTER_STAGE_STATE_FULLSCREEN;
|
||||
event->stage_state.new_state |= (gdk_event->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
|
||||
? CLUTTER_STAGE_STATE_FULLSCREEN
|
||||
: 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_SETTING:
|
||||
_clutter_backend_gdk_update_setting (backend_gdk, gdk_event->setting.name);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (event != NULL)
|
||||
{
|
||||
event->any.stage = stage;
|
||||
|
||||
if (gdk_event->any.send_event)
|
||||
event->any.flags = CLUTTER_EVENT_FLAG_SYNTHETIC;
|
||||
|
||||
_clutter_event_push (event, FALSE);
|
||||
|
||||
spin = 1;
|
||||
|
||||
CLUTTER_NOTE (EVENT, "Translated one event from Gdk");
|
||||
|
||||
/* handle also synthetic enter/leave events */
|
||||
if (event->type == CLUTTER_MOTION)
|
||||
spin += 2;
|
||||
|
||||
while (spin > 0 && (event = clutter_event_get ()))
|
||||
{
|
||||
/* forward the event into clutter for emission etc. */
|
||||
clutter_do_event (event);
|
||||
clutter_event_free (event);
|
||||
--spin;
|
||||
}
|
||||
|
||||
result = GDK_FILTER_REMOVE;
|
||||
}
|
||||
|
||||
clutter_threads_leave ();
|
||||
|
||||
return result;
|
||||
}
|
58
clutter/gdk/clutter-gdk.h
Normal file
58
clutter/gdk/clutter-gdk.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-gdk
|
||||
* @short_description: GDK specific API
|
||||
*
|
||||
* The GDK backend for Clutter provides some specific API, allowing
|
||||
* integration with the GDK API for manipulating the stage window and
|
||||
* handling events outside of Clutter.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_GDK_H__
|
||||
#define __CLUTTER_GDK_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void clutter_gdk_set_display (GdkDisplay *display);
|
||||
|
||||
GdkWindow * clutter_gdk_get_stage_window (ClutterStage *stage);
|
||||
gboolean clutter_gdk_set_stage_foreign (ClutterStage *stage,
|
||||
GdkWindow *window);
|
||||
|
||||
GdkFilterReturn clutter_gdk_handle_event (GdkEvent *event);
|
||||
|
||||
ClutterStage * clutter_gdk_get_stage_from_window (GdkWindow *window);
|
||||
|
||||
void clutter_gdk_disable_event_retrieval (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_GDK_H__ */
|
160
clutter/gdk/clutter-input-device-gdk.c
Normal file
160
clutter/gdk/clutter-input-device-gdk.c
Normal file
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 2011 Intel Corp.
|
||||
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "clutter-input-device-gdk.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
|
||||
#include "clutter-backend-gdk.h"
|
||||
#include "clutter-stage-gdk.h"
|
||||
|
||||
typedef struct _ClutterInputDeviceClass ClutterInputDeviceGdkClass;
|
||||
|
||||
#define clutter_input_device_gdk_get_type _clutter_input_device_gdk_get_type
|
||||
|
||||
G_DEFINE_TYPE (ClutterInputDeviceGdk,
|
||||
clutter_input_device_gdk,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
|
||||
static int device_int_counter;
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_GDK_DEVICE,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static void
|
||||
clutter_input_device_gdk_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterInputDeviceGdk *self = CLUTTER_INPUT_DEVICE_GDK (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_GDK_DEVICE:
|
||||
self->gdk_device = GDK_DEVICE (g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_input_device_gdk_class_init (ClutterInputDeviceGdkClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = clutter_input_device_gdk_set_property;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_GDK_DEVICE,
|
||||
g_param_spec_object ("gdk-device",
|
||||
"GdkDevice",
|
||||
"The GDK device",
|
||||
GDK_TYPE_DEVICE,
|
||||
CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_input_device_gdk_init (ClutterInputDeviceGdk *self)
|
||||
{
|
||||
}
|
||||
|
||||
ClutterInputDevice*
|
||||
_clutter_input_device_gdk_new (ClutterDeviceManager *manager,
|
||||
GdkDevice *device)
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
ClutterInputDevice *clutter_device;
|
||||
ClutterInputMode input_mode = CLUTTER_INPUT_MODE_FLOATING;
|
||||
ClutterInputDeviceType device_type = CLUTTER_EXTENSION_DEVICE;
|
||||
gboolean has_cursor = FALSE;
|
||||
const gchar *name;
|
||||
gboolean is_enabled = FALSE;
|
||||
|
||||
g_object_get (manager, "backend", &backend, NULL);
|
||||
|
||||
/* yay for name consistency */
|
||||
switch (gdk_device_get_device_type (device))
|
||||
{
|
||||
case GDK_DEVICE_TYPE_MASTER:
|
||||
input_mode = CLUTTER_INPUT_MODE_MASTER;
|
||||
is_enabled = TRUE;
|
||||
break;
|
||||
case GDK_DEVICE_TYPE_SLAVE:
|
||||
input_mode = CLUTTER_INPUT_MODE_SLAVE;
|
||||
is_enabled = FALSE;
|
||||
break;
|
||||
case GDK_DEVICE_TYPE_FLOATING:
|
||||
input_mode = CLUTTER_INPUT_MODE_FLOATING;
|
||||
is_enabled = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (gdk_device_get_source (device))
|
||||
{
|
||||
case GDK_SOURCE_MOUSE:
|
||||
device_type = CLUTTER_POINTER_DEVICE;
|
||||
break;
|
||||
case GDK_SOURCE_PEN:
|
||||
device_type = CLUTTER_PEN_DEVICE;
|
||||
break;
|
||||
case GDK_SOURCE_ERASER:
|
||||
device_type = CLUTTER_ERASER_DEVICE;
|
||||
break;
|
||||
case GDK_SOURCE_CURSOR:
|
||||
device_type = CLUTTER_CURSOR_DEVICE;
|
||||
break;
|
||||
case GDK_SOURCE_KEYBOARD:
|
||||
device_type = CLUTTER_KEYBOARD_DEVICE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (device_type != CLUTTER_KEYBOARD_DEVICE)
|
||||
has_cursor = gdk_device_get_has_cursor (device);
|
||||
|
||||
name = gdk_device_get_name (device);
|
||||
|
||||
clutter_device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_GDK,
|
||||
"backend", backend,
|
||||
"device-manager", manager,
|
||||
"device-mode", input_mode,
|
||||
"device-type", device_type,
|
||||
"has-cursor", has_cursor,
|
||||
"gdk-device", device,
|
||||
"id", device_int_counter++,
|
||||
"name", name,
|
||||
"enabled", is_enabled,
|
||||
NULL);
|
||||
return clutter_device;
|
||||
}
|
55
clutter/gdk/clutter-input-device-gdk.h
Normal file
55
clutter/gdk/clutter-input-device-gdk.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 2011 Intel Corp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_INPUT_DEVICE_GDK_H__
|
||||
#define __CLUTTER_INPUT_DEVICE_GDK_H__
|
||||
|
||||
#include <clutter/clutter-input-device.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "clutter-backend.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_INPUT_DEVICE_GDK (_clutter_input_device_gdk_get_type ())
|
||||
#define CLUTTER_INPUT_DEVICE_GDK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE_GDK, ClutterInputDeviceGdk))
|
||||
#define CLUTTER_IS_INPUT_DEVICE_GDK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE_GDK))
|
||||
|
||||
typedef struct _ClutterInputDeviceGdk ClutterInputDeviceGdk;
|
||||
|
||||
struct _ClutterInputDeviceGdk
|
||||
{
|
||||
ClutterInputDevice parent;
|
||||
|
||||
GdkDevice *gdk_device;
|
||||
};
|
||||
|
||||
GType _clutter_input_device_gdk_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterInputDevice * _clutter_input_device_gdk_new (ClutterDeviceManager *manager,
|
||||
GdkDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_INPUT_DEVICE_GDK_H__ */
|
28
clutter/gdk/clutter-settings-gdk.h
Normal file
28
clutter/gdk/clutter-settings-gdk.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef __CLUTTER_SETTINGS_GDK_H__
|
||||
#define __CLUTTER_SETTINGS_GDK_H__
|
||||
|
||||
/* XSETTINGS key names to ClutterSettings properties */
|
||||
static const struct {
|
||||
const char *gdk_setting_name;
|
||||
const char *settings_property;
|
||||
GType type;
|
||||
} _clutter_settings_map[] = {
|
||||
{ "gtk-double-click-time", "double-click-time", G_TYPE_INT },
|
||||
{ "gtk-double-click-distance", "double-click-distance", G_TYPE_INT },
|
||||
{ "gtk-dnd-drag-threshold", "dnd-drag-threshold", G_TYPE_INT },
|
||||
{ "gtk-font-name", "font-name", G_TYPE_STRING },
|
||||
{ "gtk-xft-antialias", "font-antialias", G_TYPE_INT },
|
||||
{ "gtk-xft-dpi", "font-dpi", G_TYPE_INT },
|
||||
{ "gtk-xft-hinting", "font-hinting", G_TYPE_INT },
|
||||
{ "gtk-xft-hintstyle", "font-hint-style", G_TYPE_STRING },
|
||||
{ "gtk-xft-rgba", "font-subpixel-order", G_TYPE_STRING },
|
||||
{ "gtk-fontconfig-timestamp", "fontconfig-timestamp", G_TYPE_UINT },
|
||||
};
|
||||
|
||||
static const gint _n_clutter_settings_map = G_N_ELEMENTS (_clutter_settings_map);
|
||||
|
||||
#define CLUTTER_SETTING_TYPE(id) (_clutter_settings_map[(id)].type)
|
||||
#define CLUTTER_SETTING_GDK_NAME(id) (_clutter_settings_map[(id)].gdk_setting_name)
|
||||
#define CLUTTER_SETTING_PROPERTY(id) (_clutter_settings_map[(id)].settings_property)
|
||||
|
||||
#endif /* __CLUTTER_SETTINGS_GDK_H__ */
|
605
clutter/gdk/clutter-stage-gdk.c
Normal file
605
clutter/gdk/clutter-stage-gdk.c
Normal file
@ -0,0 +1,605 @@
|
||||
/* Clutter.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Copyright (C) 2006-2007 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
#include <gdk/gdk.h>
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
#include <gdk/gdkwin32.h>
|
||||
#endif
|
||||
|
||||
#include "clutter-backend-gdk.h"
|
||||
#include "clutter-stage-gdk.h"
|
||||
#include "clutter-gdk.h"
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-event-translator.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-feature.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
|
||||
static ClutterStageWindowIface *clutter_stage_window_parent_iface = NULL;
|
||||
|
||||
#define clutter_stage_gdk_get_type _clutter_stage_gdk_get_type
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageGdk,
|
||||
clutter_stage_gdk,
|
||||
CLUTTER_TYPE_STAGE_COGL,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||
clutter_stage_window_iface_init));
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_update_foreign_event_mask (CoglOnscreen *onscreen,
|
||||
guint32 event_mask,
|
||||
void *user_data)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = user_data;
|
||||
|
||||
/* we assume that a GDK event mask is bitwise compatible with X11
|
||||
event masks */
|
||||
gdk_window_set_events (stage_gdk->window, event_mask | CLUTTER_STAGE_GDK_EVENT_MASK);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_set_gdk_geometry (ClutterStageGdk *stage)
|
||||
{
|
||||
GdkGeometry geometry;
|
||||
ClutterStage *wrapper = CLUTTER_STAGE_COGL (stage)->wrapper;
|
||||
gboolean resize = clutter_stage_get_user_resizable (wrapper);
|
||||
|
||||
if (!resize)
|
||||
{
|
||||
geometry.min_width = geometry.max_width = gdk_window_get_width (stage->window);
|
||||
geometry.min_height = geometry.max_height = gdk_window_get_height (stage->window);
|
||||
|
||||
gdk_window_set_geometry_hints (stage->window,
|
||||
&geometry,
|
||||
GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
clutter_stage_get_minimum_size (wrapper,
|
||||
(guint *)&geometry.min_width,
|
||||
(guint *)&geometry.min_height);
|
||||
|
||||
gdk_window_set_geometry_hints (stage->window,
|
||||
&geometry,
|
||||
GDK_HINT_MIN_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_get_geometry (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *geometry)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
|
||||
if (stage_gdk->window != NULL)
|
||||
{
|
||||
geometry->width = gdk_window_get_width (stage_gdk->window);
|
||||
geometry->height = gdk_window_get_height (stage_gdk->window);
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry->width = 640;
|
||||
geometry->height = 480;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_resize (ClutterStageWindow *stage_window,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
{
|
||||
/* Should not happen, if this turns up we need to debug it and
|
||||
* determine the cleanest way to fix.
|
||||
*/
|
||||
g_warning ("GDK stage not allowed to have 0 width or height");
|
||||
width = 1;
|
||||
height = 1;
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "New size received: (%d, %d)", width, height);
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (CLUTTER_STAGE_COGL (stage_gdk)->wrapper,
|
||||
CLUTTER_IN_RESIZE);
|
||||
|
||||
gdk_window_resize (stage_gdk->window, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_unrealize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
|
||||
if (stage_gdk->window != NULL)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (stage_gdk->window),
|
||||
"clutter-stage-window", NULL);
|
||||
|
||||
if (stage_gdk->foreign_window)
|
||||
g_object_unref (stage_gdk->window);
|
||||
else
|
||||
gdk_window_destroy (stage_gdk->window);
|
||||
|
||||
stage_gdk->window = NULL;
|
||||
}
|
||||
|
||||
return clutter_stage_window_parent_iface->unrealize (stage_window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_gdk_realize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
|
||||
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend);
|
||||
GdkWindowAttr attributes;
|
||||
gboolean cursor_visible;
|
||||
gboolean use_alpha;
|
||||
gfloat width, height;
|
||||
|
||||
if (!stage_gdk->foreign_window)
|
||||
{
|
||||
if (stage_gdk->window != NULL)
|
||||
{
|
||||
/* complete realizing the stage */
|
||||
cairo_rectangle_int_t geometry;
|
||||
|
||||
clutter_stage_gdk_get_geometry (stage_window, &geometry);
|
||||
clutter_actor_set_size (CLUTTER_ACTOR (stage_cogl->wrapper),
|
||||
geometry.width,
|
||||
geometry.height);
|
||||
|
||||
gdk_window_ensure_native (stage_gdk->window);
|
||||
gdk_window_set_events (stage_gdk->window, CLUTTER_STAGE_GDK_EVENT_MASK);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes.title = NULL;
|
||||
g_object_get (stage_cogl->wrapper,
|
||||
"cursor-visible", &cursor_visible,
|
||||
"title", &attributes.title,
|
||||
"width", &width,
|
||||
"height", &height,
|
||||
"use-alpha", &use_alpha,
|
||||
NULL);
|
||||
|
||||
attributes.width = width;
|
||||
attributes.height = height;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.window_type = GDK_WINDOW_TOPLEVEL;
|
||||
attributes.event_mask = CLUTTER_STAGE_GDK_EVENT_MASK;
|
||||
|
||||
attributes.cursor = NULL;
|
||||
if (!cursor_visible)
|
||||
{
|
||||
if (stage_gdk->blank_cursor == NULL)
|
||||
stage_gdk->blank_cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
|
||||
|
||||
attributes.cursor = stage_gdk->blank_cursor;
|
||||
}
|
||||
|
||||
attributes.visual = NULL;
|
||||
if (use_alpha)
|
||||
{
|
||||
attributes.visual = gdk_screen_get_rgba_visual (backend_gdk->screen);
|
||||
|
||||
if (attributes.visual == NULL)
|
||||
clutter_stage_set_use_alpha (stage_cogl->wrapper, FALSE);
|
||||
}
|
||||
|
||||
if (attributes.visual == NULL)
|
||||
{
|
||||
/* This could still be an RGBA visual, although normally it's not */
|
||||
attributes.visual = gdk_screen_get_system_visual (backend_gdk->screen);
|
||||
}
|
||||
|
||||
stage_gdk->foreign_window = FALSE;
|
||||
stage_gdk->window = gdk_window_new (NULL, &attributes,
|
||||
GDK_WA_TITLE | GDK_WA_CURSOR | GDK_WA_VISUAL);
|
||||
|
||||
g_free (attributes.title);
|
||||
}
|
||||
|
||||
clutter_stage_gdk_set_gdk_geometry (stage_gdk);
|
||||
}
|
||||
|
||||
gdk_window_ensure_native (stage_gdk->window);
|
||||
|
||||
g_object_set_data (G_OBJECT (stage_gdk->window),
|
||||
"clutter-stage-window", stage_gdk);
|
||||
|
||||
stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context,
|
||||
width, height);
|
||||
|
||||
#if defined(GDK_WINDOWING_X11) && defined(COGL_HAS_XLIB_SUPPORT)
|
||||
if (GDK_IS_X11_WINDOW (stage_gdk->window))
|
||||
{
|
||||
cogl_x11_onscreen_set_foreign_window_xid (stage_cogl->onscreen,
|
||||
GDK_WINDOW_XID (stage_gdk->window),
|
||||
clutter_stage_gdk_update_foreign_event_mask,
|
||||
stage_gdk);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if defined(GDK_WINDOWING_WIN32) && defined(COGL_HAS_WIN32_SUPPORT)
|
||||
if (GDK_IS_WIN32_WINDOW (stage_gdk->window))
|
||||
{
|
||||
cogl_win32_onscreen_set_foreign_window (stage_cogl->onscreen,
|
||||
gdk_win32_window_get_handle (stage_gdk->window));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
g_warning ("Cannot find an appropriate CoglWinsys for a "
|
||||
"GdkWindow of type %s", G_OBJECT_TYPE_NAME (stage_gdk->window));
|
||||
|
||||
cogl_object_unref (stage_cogl->onscreen);
|
||||
stage_cogl->onscreen = NULL;
|
||||
|
||||
if (!stage_gdk->foreign_window)
|
||||
gdk_window_destroy (stage_gdk->window);
|
||||
|
||||
stage_gdk->window = NULL;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return clutter_stage_window_parent_iface->realize (stage_window);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_set_fullscreen (ClutterStageWindow *stage_window,
|
||||
gboolean is_fullscreen)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
ClutterStage *stage = CLUTTER_STAGE_COGL (stage_window)->wrapper;
|
||||
|
||||
if (stage == NULL || CLUTTER_ACTOR_IN_DESTRUCTION (stage))
|
||||
return;
|
||||
|
||||
if (stage_gdk->window == NULL)
|
||||
return;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "%ssetting fullscreen", is_fullscreen ? "" : "un");
|
||||
|
||||
if (is_fullscreen)
|
||||
gdk_window_fullscreen (stage_gdk->window);
|
||||
else
|
||||
gdk_window_unfullscreen (stage_gdk->window);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_set_cursor_visible (ClutterStageWindow *stage_window,
|
||||
gboolean cursor_visible)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
|
||||
if (stage_gdk->window == NULL)
|
||||
return;
|
||||
|
||||
if (cursor_visible)
|
||||
{
|
||||
gdk_window_set_cursor (stage_gdk->window, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stage_gdk->blank_cursor == NULL)
|
||||
stage_gdk->blank_cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
|
||||
|
||||
gdk_window_set_cursor (stage_gdk->window, stage_gdk->blank_cursor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_set_title (ClutterStageWindow *stage_window,
|
||||
const gchar *title)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
|
||||
if (stage_gdk->window == NULL)
|
||||
return;
|
||||
|
||||
gdk_window_set_title (stage_gdk->window, title);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_set_user_resizable (ClutterStageWindow *stage_window,
|
||||
gboolean is_resizable)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
GdkWMFunction function;
|
||||
|
||||
if (stage_gdk->window == NULL)
|
||||
return;
|
||||
|
||||
function = GDK_FUNC_MOVE | GDK_FUNC_MINIMIZE | GDK_FUNC_CLOSE;
|
||||
if (is_resizable)
|
||||
function |= GDK_FUNC_RESIZE | GDK_FUNC_MAXIMIZE;
|
||||
|
||||
gdk_window_set_functions (stage_gdk->window, function);
|
||||
|
||||
clutter_stage_gdk_set_gdk_geometry (stage_gdk);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_set_accept_focus (ClutterStageWindow *stage_window,
|
||||
gboolean accept_focus)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
|
||||
if (stage_gdk->window == NULL)
|
||||
return;
|
||||
|
||||
gdk_window_set_accept_focus (stage_gdk->window, accept_focus);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_show (ClutterStageWindow *stage_window,
|
||||
gboolean do_raise)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
|
||||
g_return_if_fail (stage_gdk->window != NULL);
|
||||
|
||||
clutter_actor_map (CLUTTER_ACTOR (CLUTTER_STAGE_COGL (stage_gdk)->wrapper));
|
||||
|
||||
if (do_raise)
|
||||
gdk_window_show (stage_gdk->window);
|
||||
else
|
||||
gdk_window_show_unraised (stage_gdk->window);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_hide (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
|
||||
|
||||
g_return_if_fail (stage_gdk->window != NULL);
|
||||
|
||||
clutter_actor_unmap (CLUTTER_ACTOR (CLUTTER_STAGE_COGL (stage_gdk)->wrapper));
|
||||
gdk_window_hide (stage_gdk->window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_gdk_can_clip_redraws (ClutterStageWindow *stage_window)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (gobject);
|
||||
|
||||
if (stage_gdk->window != NULL)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (stage_gdk->window),
|
||||
"clutter-stage-window", NULL);
|
||||
if (stage_gdk->foreign_window)
|
||||
g_object_unref (stage_gdk->window);
|
||||
else
|
||||
gdk_window_destroy (stage_gdk->window);
|
||||
stage_gdk->window = NULL;
|
||||
}
|
||||
|
||||
if (stage_gdk->blank_cursor != NULL)
|
||||
{
|
||||
g_object_unref (stage_gdk->blank_cursor);
|
||||
stage_gdk->blank_cursor = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (clutter_stage_gdk_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_class_init (ClutterStageGdkClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = clutter_stage_gdk_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_init (ClutterStageGdk *stage)
|
||||
{
|
||||
/* nothing to do here */
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
{
|
||||
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->set_title = clutter_stage_gdk_set_title;
|
||||
iface->set_fullscreen = clutter_stage_gdk_set_fullscreen;
|
||||
iface->set_cursor_visible = clutter_stage_gdk_set_cursor_visible;
|
||||
iface->set_user_resizable = clutter_stage_gdk_set_user_resizable;
|
||||
iface->set_accept_focus = clutter_stage_gdk_set_accept_focus;
|
||||
iface->show = clutter_stage_gdk_show;
|
||||
iface->hide = clutter_stage_gdk_hide;
|
||||
iface->resize = clutter_stage_gdk_resize;
|
||||
iface->get_geometry = clutter_stage_gdk_get_geometry;
|
||||
iface->realize = clutter_stage_gdk_realize;
|
||||
iface->unrealize = clutter_stage_gdk_unrealize;
|
||||
iface->can_clip_redraws = clutter_stage_gdk_can_clip_redraws;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_gdk_get_stage_window:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Gets the stages GdkWindow.
|
||||
*
|
||||
* Return value: (transfer none): A GdkWindow* for the stage window.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
GdkWindow *
|
||||
clutter_gdk_get_stage_window (ClutterStage *stage)
|
||||
{
|
||||
ClutterStageWindow *impl;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), None);
|
||||
|
||||
impl = _clutter_stage_get_window (stage);
|
||||
if (!CLUTTER_IS_STAGE_GDK (impl))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a GDK backend");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return CLUTTER_STAGE_GDK (impl)->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_gdk_get_stage_from_window:
|
||||
* @window: a #GtkWindow
|
||||
*
|
||||
* Gets the stage for a particular X window.
|
||||
*
|
||||
* Return value: (transfer none): A #ClutterStage, or% NULL if a stage
|
||||
* does not exist for the window
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterStage *
|
||||
clutter_gdk_get_stage_from_window (GdkWindow *window)
|
||||
{
|
||||
ClutterStageGdk *stage_gdk = g_object_get_data (G_OBJECT (window), "clutter-stage-window");
|
||||
|
||||
if (stage_gdk != NULL && CLUTTER_IS_STAGE_GDK (stage_gdk))
|
||||
return CLUTTER_STAGE_COGL (stage_gdk)->wrapper;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ClutterStageGdk *stage_gdk;
|
||||
GdkWindow *window;
|
||||
} ForeignWindowClosure;
|
||||
|
||||
static void
|
||||
set_foreign_window_callback (ClutterActor *actor,
|
||||
void *data)
|
||||
{
|
||||
ForeignWindowClosure *closure = data;
|
||||
ClutterStageGdk *stage_gdk = closure->stage_gdk;
|
||||
|
||||
stage_gdk->window = closure->window;
|
||||
stage_gdk->foreign_window = TRUE;
|
||||
|
||||
/* calling this with the stage unrealized will unset the stage
|
||||
* from the GL context; once the stage is realized the GL context
|
||||
* will be set again
|
||||
*/
|
||||
clutter_stage_ensure_current (CLUTTER_STAGE (actor));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_gdk_set_stage_foreign:
|
||||
* @stage: a #ClutterStage
|
||||
* @window: an existing #GdkWindow
|
||||
*
|
||||
* Target the #ClutterStage to use an existing external #GdkWindow
|
||||
*
|
||||
* Return value: %TRUE if foreign window is valid
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
gboolean
|
||||
clutter_gdk_set_stage_foreign (ClutterStage *stage,
|
||||
GdkWindow *window)
|
||||
{
|
||||
ForeignWindowClosure closure;
|
||||
ClutterStageGdk *stage_gdk;
|
||||
ClutterStageWindow *impl;
|
||||
ClutterActor *actor;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
g_return_val_if_fail (!CLUTTER_ACTOR_IN_DESTRUCTION (stage), FALSE);
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
||||
|
||||
impl = _clutter_stage_get_window (stage);
|
||||
if (!CLUTTER_IS_STAGE_GDK (impl))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a GDK backend");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stage_gdk = CLUTTER_STAGE_GDK (impl);
|
||||
|
||||
if (g_object_get_data (G_OBJECT (window), "clutter-stage-window") != NULL)
|
||||
{
|
||||
g_critical ("The provided GdkWindow is already in use by another ClutterStage");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
closure.stage_gdk = stage_gdk;
|
||||
closure.window = g_object_ref (window);
|
||||
|
||||
actor = CLUTTER_ACTOR (stage);
|
||||
|
||||
_clutter_actor_rerealize (actor,
|
||||
set_foreign_window_callback,
|
||||
&closure);
|
||||
|
||||
/* Queue a relayout - so the stage will be allocated the new
|
||||
* window size.
|
||||
*
|
||||
* Note also that when the stage gets allocated the new
|
||||
* window size that will result in the stage's
|
||||
* priv->viewport being changed, which will in turn result
|
||||
* in the Cogl viewport changing when _clutter_do_redraw
|
||||
* calls _clutter_stage_maybe_setup_viewport().
|
||||
*/
|
||||
clutter_actor_queue_relayout (actor);
|
||||
|
||||
return TRUE;
|
||||
}
|
81
clutter/gdk/clutter-stage-gdk.h
Normal file
81
clutter/gdk/clutter-stage-gdk.h
Normal file
@ -0,0 +1,81 @@
|
||||
/* Clutter.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Copyright (C) 2006-2007 OpenedHand
|
||||
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_STAGE_GDK_H__
|
||||
#define __CLUTTER_STAGE_GDK_H__
|
||||
|
||||
#include <clutter/clutter-group.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "clutter-backend-gdk.h"
|
||||
#include "cogl/clutter-stage-cogl.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_STAGE_GDK (_clutter_stage_gdk_get_type ())
|
||||
#define CLUTTER_STAGE_GDK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_GDK, ClutterStageGdk))
|
||||
#define CLUTTER_IS_STAGE_GDK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_GDK))
|
||||
#define CLUTTER_STAGE_GDK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE_GDK, ClutterStageGdkClass))
|
||||
#define CLUTTER_IS_STAGE_GDK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE_GDK))
|
||||
#define CLUTTER_STAGE_GDK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE_GDK, ClutterStageGdkClass))
|
||||
|
||||
typedef struct _ClutterStageGdk ClutterStageGdk;
|
||||
typedef struct _ClutterStageGdkClass ClutterStageGdkClass;
|
||||
|
||||
struct _ClutterStageGdk
|
||||
{
|
||||
ClutterStageCogl parent_instance;
|
||||
|
||||
GdkWindow *window;
|
||||
GdkCursor *blank_cursor;
|
||||
|
||||
gboolean foreign_window;
|
||||
};
|
||||
|
||||
struct _ClutterStageGdkClass
|
||||
{
|
||||
ClutterStageCoglClass parent_class;
|
||||
};
|
||||
|
||||
#define CLUTTER_STAGE_GDK_EVENT_MASK \
|
||||
(GDK_STRUCTURE_MASK | \
|
||||
GDK_FOCUS_CHANGE_MASK | \
|
||||
GDK_EXPOSURE_MASK | \
|
||||
GDK_PROPERTY_CHANGE_MASK | \
|
||||
GDK_ENTER_NOTIFY_MASK | \
|
||||
GDK_LEAVE_NOTIFY_MASK | \
|
||||
GDK_KEY_PRESS_MASK | \
|
||||
GDK_KEY_RELEASE_MASK | \
|
||||
GDK_BUTTON_PRESS_MASK | \
|
||||
GDK_BUTTON_RELEASE_MASK | \
|
||||
GDK_POINTER_MOTION_MASK)
|
||||
|
||||
GType _clutter_stage_gdk_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void _clutter_stage_gdk_update_foreign_event_mask (CoglOnscreen *onscreen,
|
||||
guint32 event_mask,
|
||||
void *user_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_H__ */
|
@ -253,9 +253,3 @@ clutter_backend_osx_class_init (ClutterBackendOSXClass *klass)
|
||||
backend_class->init_events = clutter_backend_osx_init_events;
|
||||
backend_class->get_device_manager = clutter_backend_osx_get_device_manager;
|
||||
}
|
||||
|
||||
GType
|
||||
_clutter_backend_impl_get_type (void)
|
||||
{
|
||||
return clutter_backend_osx_get_type ();
|
||||
}
|
||||
|
@ -22,8 +22,9 @@
|
||||
#ifndef __CLUTTER_STAGE_OSX_H__
|
||||
#define __CLUTTER_STAGE_OSX_H__
|
||||
|
||||
#include <clutter/clutter-stage.h>
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
#include <clutter/clutter-stage-window.h>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
@ -19,11 +19,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-egl.h"
|
||||
#include "clutter-backend-egl.h"
|
||||
#include "clutter-egl.h"
|
||||
|
||||
@ -37,9 +34,7 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
#include <tslib.h>
|
||||
#endif
|
||||
|
||||
typedef struct _ClutterEventSource ClutterEventSource;
|
||||
|
||||
@ -50,13 +45,9 @@ struct _ClutterEventSource
|
||||
ClutterBackendEGL *backend;
|
||||
GPollFD event_poll_fd;
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
struct tsdev *ts_device;
|
||||
#endif
|
||||
struct tsdev *ts_device;
|
||||
};
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
|
||||
static gboolean clutter_event_prepare (GSource *source,
|
||||
gint *timeout);
|
||||
static gboolean clutter_event_check (GSource *source);
|
||||
@ -93,16 +84,17 @@ get_backend_time (void)
|
||||
|
||||
return g_timer_elapsed (backend_egl->event_timer, NULL) * 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
_clutter_events_tslib_init (ClutterBackendEGL *backend_egl)
|
||||
_clutter_events_tslib_init (ClutterBackend *backend)
|
||||
{
|
||||
#ifdef HAVE_TSLIB
|
||||
ClutterBackendEglNative *backend_egl;
|
||||
ClutterEventSource *event_source;
|
||||
const char *device_name;
|
||||
GSource *source;
|
||||
|
||||
backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
|
||||
CLUTTER_NOTE (EVENT, "Starting timer");
|
||||
g_assert (backend_egl->event_timer != NULL);
|
||||
g_timer_start (backend_egl->event_timer);
|
||||
@ -148,13 +140,11 @@ _clutter_events_tslib_init (ClutterBackendEGL *backend_egl)
|
||||
g_warning ("Unable to open '%s'", device_name);
|
||||
g_source_unref (source);
|
||||
}
|
||||
#endif /* HAVE_TSLIB */
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_events_egl_uninit (ClutterBackendEGL *backend_egl)
|
||||
_clutter_events_egl_uninit (ClutterBackendEglNative *backend_egl)
|
||||
{
|
||||
#ifdef HAVE_TSLIB
|
||||
if (backend_egl->event_timer != NULL)
|
||||
{
|
||||
CLUTTER_NOTE (EVENT, "Stopping the timer");
|
||||
@ -175,11 +165,8 @@ _clutter_events_egl_uninit (ClutterBackendEGL *backend_egl)
|
||||
g_source_unref (backend_egl->event_source);
|
||||
backend_egl->event_source = NULL;
|
||||
}
|
||||
#endif /* HAVE_TSLIB */
|
||||
}
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
|
||||
static gboolean
|
||||
clutter_event_prepare (GSource *source,
|
||||
gint *timeout)
|
||||
@ -227,7 +214,7 @@ clutter_event_dispatch (GSource *source,
|
||||
if ((!clutter_events_pending()) &&
|
||||
(ts_read(event_source->ts_device, &tsevent, 1) == 1))
|
||||
{
|
||||
static gint last_x = 0, last_y = 0;
|
||||
static gint last_x = 0, last_y = 0;
|
||||
static gboolean clicked = FALSE;
|
||||
|
||||
/* Avoid sending too many events which are just pressure changes.
|
||||
@ -290,5 +277,3 @@ out:
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
35
clutter/tslib/clutter-event-tslib.h
Normal file
35
clutter/tslib/clutter-event-tslib.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* Clutter.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenedHand
|
||||
* Copyright (C) 2008, 2009, 2010, 2011 Intel Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_EVENT_TSLIB_H__
|
||||
#define __CLUTTER_EVENT_TSLIB_H__
|
||||
|
||||
#include <clutter/clutter-backend.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _clutter_events_tslib_init (ClutterBackend *backend);
|
||||
void _clutter_events_tslib_uninit (ClutterBackend *backend);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_EVENT_TSLIB_H__ */
|
@ -52,13 +52,6 @@ static ClutterBackendWayland *backend_singleton = NULL;
|
||||
|
||||
G_DEFINE_TYPE (ClutterBackendWayland, _clutter_backend_wayland, CLUTTER_TYPE_BACKEND);
|
||||
|
||||
static void
|
||||
clutter_backend_at_exit (void)
|
||||
{
|
||||
if (backend_singleton)
|
||||
g_object_run_dispose (G_OBJECT (backend_singleton));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_backend_wayland_pre_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
@ -281,8 +274,6 @@ clutter_backend_wayland_post_parse (ClutterBackend *backend,
|
||||
ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
|
||||
EGLBoolean status;
|
||||
|
||||
g_atexit (clutter_backend_at_exit);
|
||||
|
||||
/* TODO: expose environment variable/commandline option for this... */
|
||||
backend_wayland->wayland_display = wl_display_connect (NULL);
|
||||
if (!backend_wayland->wayland_display)
|
||||
@ -659,12 +650,6 @@ _clutter_backend_wayland_init (ClutterBackendWayland *backend_wayland)
|
||||
backend_wayland->drm_fd = -1;
|
||||
}
|
||||
|
||||
GType
|
||||
_clutter_backend_impl_get_type (void)
|
||||
{
|
||||
return _clutter_backend_wayland_get_type ();
|
||||
}
|
||||
|
||||
EGLDisplay
|
||||
clutter_wayland_get_egl_display (void)
|
||||
{
|
||||
|
@ -378,12 +378,6 @@ clutter_backend_win32_init (ClutterBackendWin32 *backend_win32)
|
||||
timeBeginPeriod (1);
|
||||
}
|
||||
|
||||
GType
|
||||
_clutter_backend_impl_get_type (void)
|
||||
{
|
||||
return clutter_backend_win32_get_type ();
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
|
@ -733,9 +733,13 @@ clutter_win32_set_stage_foreign (ClutterStage *stage,
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
g_return_val_if_fail (hwnd != NULL, FALSE);
|
||||
|
||||
actor = CLUTTER_ACTOR (stage);
|
||||
|
||||
impl = _clutter_stage_get_window (stage);
|
||||
if (!CLUTTER_IS_STAGE_WIN32 (impl))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a Windows backend");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stage_win32 = CLUTTER_STAGE_WIN32 (impl);
|
||||
|
||||
if (!GetClientRect (hwnd, &client_rect))
|
||||
@ -758,6 +762,8 @@ clutter_win32_set_stage_foreign (ClutterStage *stage,
|
||||
fwd.geom.width = client_rect.right - client_rect.left;
|
||||
fwd.geom.height = client_rect.bottom - client_rect.top;
|
||||
|
||||
actor = CLUTTER_ACTOR (stage);
|
||||
|
||||
_clutter_actor_rerealize (actor,
|
||||
set_foreign_window_callback,
|
||||
&fwd);
|
||||
|
@ -59,6 +59,7 @@
|
||||
#endif
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
#include <cogl/cogl-xlib.h>
|
||||
|
||||
#include "clutter-backend.h"
|
||||
#include "clutter-debug.h"
|
||||
@ -69,7 +70,7 @@
|
||||
|
||||
#define clutter_backend_x11_get_type _clutter_backend_x11_get_type
|
||||
|
||||
G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND);
|
||||
G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND_COGL);
|
||||
|
||||
/* atoms; remember to add the code that assigns the atom value to
|
||||
* the member of the ClutterBackendX11 structure if you add an
|
||||
@ -91,9 +92,6 @@ static const gchar *atom_names[] = {
|
||||
|
||||
#define N_ATOM_NAMES G_N_ELEMENTS (atom_names)
|
||||
|
||||
/* singleton object */
|
||||
static ClutterBackendX11 *backend_singleton = NULL;
|
||||
|
||||
/* various flags corresponding to pre init setup calls */
|
||||
static gboolean _no_xevent_retrieval = FALSE;
|
||||
static gboolean clutter_enable_xinput = FALSE;
|
||||
@ -333,7 +331,8 @@ _clutter_backend_x11_pre_parse (ClutterBackend *backend,
|
||||
env_string = NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return CLUTTER_BACKEND_CLASS (clutter_backend_x11_parent_class)->pre_parse (backend,
|
||||
error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -341,11 +340,14 @@ _clutter_backend_x11_post_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
ClutterSettings *settings;
|
||||
Atom atoms[N_ATOM_NAMES];
|
||||
double dpi;
|
||||
|
||||
if (_foreign_dpy)
|
||||
backend_x11->xdpy = _foreign_dpy;
|
||||
/*
|
||||
* Only open connection if not already set by prior call to
|
||||
|
||||
/* Only open connection if not already set by prior call to
|
||||
* clutter_x11_set_display()
|
||||
*/
|
||||
if (backend_x11->xdpy == NULL)
|
||||
@ -378,78 +380,72 @@ _clutter_backend_x11_post_parse (ClutterBackend *backend,
|
||||
|
||||
g_assert (backend_x11->xdpy != NULL);
|
||||
|
||||
{
|
||||
ClutterSettings *settings;
|
||||
Atom atoms[N_ATOM_NAMES];
|
||||
double dpi;
|
||||
CLUTTER_NOTE (BACKEND, "Getting the X screen");
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Getting the X screen");
|
||||
settings = clutter_settings_get_default ();
|
||||
|
||||
settings = clutter_settings_get_default ();
|
||||
/* Cogl needs to know the Xlib display connection for
|
||||
CoglTexturePixmapX11 */
|
||||
cogl_xlib_set_display (backend_x11->xdpy);
|
||||
|
||||
/* Cogl needs to know the Xlib display connection for
|
||||
CoglTexturePixmapX11 */
|
||||
cogl_xlib_set_display (backend_x11->xdpy);
|
||||
/* add event filter for Cogl events */
|
||||
clutter_x11_add_filter (cogl_xlib_filter, NULL);
|
||||
|
||||
/* add event filter for Cogl events */
|
||||
clutter_x11_add_filter (cogl_xlib_filter, NULL);
|
||||
if (clutter_screen == -1)
|
||||
backend_x11->xscreen = DefaultScreenOfDisplay (backend_x11->xdpy);
|
||||
else
|
||||
backend_x11->xscreen = ScreenOfDisplay (backend_x11->xdpy,
|
||||
clutter_screen);
|
||||
|
||||
if (clutter_screen == -1)
|
||||
backend_x11->xscreen = DefaultScreenOfDisplay (backend_x11->xdpy);
|
||||
else
|
||||
backend_x11->xscreen = ScreenOfDisplay (backend_x11->xdpy,
|
||||
clutter_screen);
|
||||
backend_x11->xscreen_num = XScreenNumberOfScreen (backend_x11->xscreen);
|
||||
backend_x11->xscreen_width = WidthOfScreen (backend_x11->xscreen);
|
||||
backend_x11->xscreen_height = HeightOfScreen (backend_x11->xscreen);
|
||||
|
||||
backend_x11->xscreen_num = XScreenNumberOfScreen (backend_x11->xscreen);
|
||||
backend_x11->xscreen_width = WidthOfScreen (backend_x11->xscreen);
|
||||
backend_x11->xscreen_height = HeightOfScreen (backend_x11->xscreen);
|
||||
backend_x11->xwin_root = RootWindow (backend_x11->xdpy,
|
||||
backend_x11->xscreen_num);
|
||||
|
||||
backend_x11->xwin_root = RootWindow (backend_x11->xdpy,
|
||||
backend_x11->xscreen_num);
|
||||
backend_x11->display_name = g_strdup (clutter_display_name);
|
||||
|
||||
backend_x11->display_name = g_strdup (clutter_display_name);
|
||||
dpi = (((double) DisplayHeight (backend_x11->xdpy, backend_x11->xscreen_num) * 25.4)
|
||||
/ (double) DisplayHeightMM (backend_x11->xdpy, backend_x11->xscreen_num));
|
||||
|
||||
dpi = (((double) DisplayHeight (backend_x11->xdpy, backend_x11->xscreen_num) * 25.4)
|
||||
/ (double) DisplayHeightMM (backend_x11->xdpy, backend_x11->xscreen_num));
|
||||
g_object_set (settings, "font-dpi", (int) dpi * 1024, NULL);
|
||||
|
||||
g_object_set (settings, "font-dpi", (int) dpi * 1024, NULL);
|
||||
/* create the device manager */
|
||||
clutter_backend_x11_create_device_manager (backend_x11);
|
||||
|
||||
/* create the device manager */
|
||||
clutter_backend_x11_create_device_manager (backend_x11);
|
||||
/* register keymap */
|
||||
clutter_backend_x11_create_keymap (backend_x11);
|
||||
|
||||
/* register keymap */
|
||||
clutter_backend_x11_create_keymap (backend_x11);
|
||||
/* create XSETTINGS client */
|
||||
backend_x11->xsettings =
|
||||
_clutter_xsettings_client_new (backend_x11->xdpy,
|
||||
backend_x11->xscreen_num,
|
||||
clutter_backend_x11_xsettings_notify,
|
||||
NULL,
|
||||
backend_x11);
|
||||
|
||||
/* create XSETTINGS client */
|
||||
backend_x11->xsettings =
|
||||
_clutter_xsettings_client_new (backend_x11->xdpy,
|
||||
backend_x11->xscreen_num,
|
||||
clutter_backend_x11_xsettings_notify,
|
||||
NULL,
|
||||
backend_x11);
|
||||
/* add event filter for XSETTINGS events */
|
||||
clutter_x11_add_filter (xsettings_filter, backend_x11);
|
||||
|
||||
/* add event filter for XSETTINGS events */
|
||||
clutter_x11_add_filter (xsettings_filter, backend_x11);
|
||||
if (clutter_synchronise)
|
||||
XSynchronize (backend_x11->xdpy, True);
|
||||
|
||||
if (clutter_synchronise)
|
||||
XSynchronize (backend_x11->xdpy, True);
|
||||
XInternAtoms (backend_x11->xdpy,
|
||||
(char **) atom_names, N_ATOM_NAMES,
|
||||
False, atoms);
|
||||
|
||||
XInternAtoms (backend_x11->xdpy,
|
||||
(char **) atom_names, N_ATOM_NAMES,
|
||||
False, atoms);
|
||||
|
||||
backend_x11->atom_NET_WM_PID = atoms[0];
|
||||
backend_x11->atom_NET_WM_PING = atoms[1];
|
||||
backend_x11->atom_NET_WM_STATE = atoms[2];
|
||||
backend_x11->atom_NET_WM_STATE_FULLSCREEN = atoms[3];
|
||||
backend_x11->atom_NET_WM_USER_TIME = atoms[4];
|
||||
backend_x11->atom_WM_PROTOCOLS = atoms[5];
|
||||
backend_x11->atom_WM_DELETE_WINDOW = atoms[6];
|
||||
backend_x11->atom_XEMBED = atoms[7];
|
||||
backend_x11->atom_XEMBED_INFO = atoms[8];
|
||||
backend_x11->atom_NET_WM_NAME = atoms[9];
|
||||
backend_x11->atom_UTF8_STRING = atoms[10];
|
||||
}
|
||||
backend_x11->atom_NET_WM_PID = atoms[0];
|
||||
backend_x11->atom_NET_WM_PING = atoms[1];
|
||||
backend_x11->atom_NET_WM_STATE = atoms[2];
|
||||
backend_x11->atom_NET_WM_STATE_FULLSCREEN = atoms[3];
|
||||
backend_x11->atom_NET_WM_USER_TIME = atoms[4];
|
||||
backend_x11->atom_WM_PROTOCOLS = atoms[5];
|
||||
backend_x11->atom_WM_DELETE_WINDOW = atoms[6];
|
||||
backend_x11->atom_XEMBED = atoms[7];
|
||||
backend_x11->atom_XEMBED_INFO = atoms[8];
|
||||
backend_x11->atom_NET_WM_NAME = atoms[9];
|
||||
backend_x11->atom_UTF8_STRING = atoms[10];
|
||||
|
||||
g_free (clutter_display_name);
|
||||
|
||||
@ -461,7 +457,8 @@ _clutter_backend_x11_post_parse (ClutterBackend *backend,
|
||||
(unsigned int) backend_x11->xwin_root,
|
||||
clutter_backend_get_resolution (backend));
|
||||
|
||||
return TRUE;
|
||||
return CLUTTER_BACKEND_CLASS (clutter_backend_x11_parent_class)->post_parse (backend,
|
||||
error);
|
||||
}
|
||||
|
||||
|
||||
@ -525,9 +522,6 @@ clutter_backend_x11_finalize (GObject *gobject)
|
||||
|
||||
XCloseDisplay (backend_x11->xdpy);
|
||||
|
||||
if (backend_singleton)
|
||||
backend_singleton = NULL;
|
||||
|
||||
G_OBJECT_CLASS (clutter_backend_x11_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
@ -548,34 +542,15 @@ clutter_backend_x11_dispose (GObject *gobject)
|
||||
G_OBJECT_CLASS (clutter_backend_x11_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
clutter_backend_x11_constructor (GType gtype,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GObjectClass *parent_class;
|
||||
GObject *retval;
|
||||
|
||||
if (backend_singleton == NULL)
|
||||
{
|
||||
parent_class = G_OBJECT_CLASS (clutter_backend_x11_parent_class);
|
||||
retval = parent_class->constructor (gtype, n_params, params);
|
||||
|
||||
backend_singleton = CLUTTER_BACKEND_X11 (retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
g_warning ("Attempting to create a new backend object. This should "
|
||||
"never happen, so we return the singleton instance.");
|
||||
|
||||
return g_object_ref (backend_singleton);
|
||||
}
|
||||
|
||||
static ClutterFeatureFlags
|
||||
clutter_backend_x11_get_features (ClutterBackend *backend)
|
||||
{
|
||||
return CLUTTER_FEATURE_STAGE_USER_RESIZE | CLUTTER_FEATURE_STAGE_CURSOR;
|
||||
ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_USER_RESIZE
|
||||
| CLUTTER_FEATURE_STAGE_CURSOR;
|
||||
|
||||
flags |= CLUTTER_BACKEND_CLASS (clutter_backend_x11_parent_class)->get_features (backend);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -705,13 +680,146 @@ clutter_backend_x11_translate_event (ClutterBackend *backend,
|
||||
return parent_class->translate_event (backend, native, event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_backend_x11_create_context (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
CoglOnscreenTemplate *onscreen_template = NULL;
|
||||
CoglSwapChain *swap_chain = NULL;
|
||||
GError *internal_error = NULL;
|
||||
gboolean status;
|
||||
|
||||
if (backend->cogl_context != NULL)
|
||||
return TRUE;
|
||||
|
||||
backend->cogl_renderer = cogl_renderer_new ();
|
||||
cogl_xlib_renderer_set_foreign_display (backend->cogl_renderer,
|
||||
backend_x11->xdpy);
|
||||
if (!cogl_renderer_connect (backend->cogl_renderer, &internal_error))
|
||||
goto error;
|
||||
|
||||
swap_chain = cogl_swap_chain_new ();
|
||||
cogl_swap_chain_set_has_alpha (swap_chain, clutter_enable_argb);
|
||||
|
||||
onscreen_template = cogl_onscreen_template_new (swap_chain);
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
/* XXX: I have some doubts that this is a good design.
|
||||
*
|
||||
* Conceptually should we be able to check an onscreen_template
|
||||
* without more details about the CoglDisplay configuration?
|
||||
*/
|
||||
status = cogl_renderer_check_onscreen_template (backend->cogl_renderer,
|
||||
onscreen_template,
|
||||
&internal_error);
|
||||
if (!status && clutter_enable_argb)
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND,
|
||||
"Creation of a context with a ARGB visual failed: %s",
|
||||
internal_error != NULL ? internal_error->message
|
||||
: "Unknown reason");
|
||||
|
||||
g_clear_error (&internal_error);
|
||||
|
||||
/* It's possible that the current renderer doesn't support transparency
|
||||
* in a swap_chain so lets see if we can fallback to not having any
|
||||
* transparency...
|
||||
*
|
||||
* XXX: It might be nice to have a CoglRenderer feature we could
|
||||
* explicitly check for ahead of time.
|
||||
*/
|
||||
clutter_enable_argb = FALSE;
|
||||
cogl_swap_chain_set_has_alpha (swap_chain, FALSE);
|
||||
status = cogl_renderer_check_onscreen_template (backend->cogl_renderer,
|
||||
onscreen_template,
|
||||
&internal_error);
|
||||
}
|
||||
|
||||
if (!status)
|
||||
goto error;
|
||||
|
||||
backend->cogl_display = cogl_display_new (backend->cogl_renderer,
|
||||
onscreen_template);
|
||||
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
cogl_object_unref (onscreen_template);
|
||||
|
||||
if (!cogl_display_setup (backend->cogl_display, &internal_error))
|
||||
goto error;
|
||||
|
||||
backend->cogl_context = cogl_context_new (backend->cogl_display,
|
||||
&internal_error);
|
||||
if (backend->cogl_context == NULL)
|
||||
goto error;
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
if (internal_error != NULL)
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Backend creation failed: %s",
|
||||
internal_error->message);
|
||||
|
||||
g_set_error_literal (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
internal_error->message);
|
||||
g_error_free (internal_error);
|
||||
}
|
||||
|
||||
if (backend->cogl_display != NULL)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_display);
|
||||
backend->cogl_display = NULL;
|
||||
}
|
||||
|
||||
if (onscreen_template != NULL)
|
||||
cogl_object_unref (onscreen_template);
|
||||
|
||||
if (swap_chain != NULL)
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
if (backend->cogl_renderer != NULL)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
backend->cogl_renderer = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static ClutterStageWindow *
|
||||
clutter_backend_x11_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
ClutterEventTranslator *translator;
|
||||
ClutterStageWindow *stage;
|
||||
|
||||
stage = g_object_new (CLUTTER_TYPE_STAGE_X11,
|
||||
"backend", backend,
|
||||
"wrapper", wrapper,
|
||||
NULL);
|
||||
|
||||
/* the X11 stage does event translation */
|
||||
translator = CLUTTER_EVENT_TRANSLATOR (stage);
|
||||
_clutter_backend_add_event_translator (backend, translator);
|
||||
|
||||
CLUTTER_NOTE (MISC, "X11 stage created (display:%p, screen:%d, root:%u)",
|
||||
backend_x11->xdpy,
|
||||
backend_x11->xscreen_num,
|
||||
(unsigned int) backend_x11->xwin_root);
|
||||
|
||||
return stage;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass);
|
||||
|
||||
gobject_class->constructor = clutter_backend_x11_constructor;
|
||||
gobject_class->dispose = clutter_backend_x11_dispose;
|
||||
gobject_class->finalize = clutter_backend_x11_finalize;
|
||||
|
||||
@ -724,6 +832,8 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
|
||||
backend_class->copy_event_data = clutter_backend_x11_copy_event_data;
|
||||
backend_class->free_event_data = clutter_backend_x11_free_event_data;
|
||||
backend_class->translate_event = clutter_backend_x11_translate_event;
|
||||
backend_class->create_context = clutter_backend_x11_create_context;
|
||||
backend_class->create_stage = clutter_backend_x11_create_stage;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -783,13 +893,21 @@ clutter_x11_untrap_x_errors (void)
|
||||
Display *
|
||||
clutter_x11_get_default_display (void)
|
||||
{
|
||||
if (!backend_singleton)
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("X11 backend has not been initialised");
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return backend_singleton->xdpy;
|
||||
if (!CLUTTER_IS_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return CLUTTER_BACKEND_X11 (backend)->xdpy;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -912,13 +1030,21 @@ clutter_x11_has_event_retrieval (void)
|
||||
int
|
||||
clutter_x11_get_default_screen (void)
|
||||
{
|
||||
if (!backend_singleton)
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("X11 backend has not been initialised");
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return backend_singleton->xscreen_num;
|
||||
if (!CLUTTER_IS_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return CLUTTER_BACKEND_X11 (backend)->xscreen_num;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -933,13 +1059,21 @@ clutter_x11_get_default_screen (void)
|
||||
Window
|
||||
clutter_x11_get_root_window (void)
|
||||
{
|
||||
if (!backend_singleton)
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("X11 backend has not been initialised");
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return None;
|
||||
}
|
||||
|
||||
return backend_singleton->xwin_root;
|
||||
if (!CLUTTER_IS_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return None;
|
||||
}
|
||||
|
||||
return CLUTTER_BACKEND_X11 (backend)->xwin_root;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -956,21 +1090,31 @@ clutter_x11_add_filter (ClutterX11FilterFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterX11EventFilter *filter;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
ClutterBackendX11 *backend_x11;
|
||||
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (!backend_singleton)
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("X11 backend has not been initialised");
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CLUTTER_IS_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return;
|
||||
}
|
||||
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
filter = g_new0 (ClutterX11EventFilter, 1);
|
||||
filter->func = func;
|
||||
filter->data = data;
|
||||
|
||||
backend_singleton->event_filters =
|
||||
g_slist_append (backend_singleton->event_filters, filter);
|
||||
backend_x11->event_filters =
|
||||
g_slist_append (backend_x11->event_filters, filter);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -990,10 +1134,26 @@ clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
||||
{
|
||||
GSList *tmp_list, *this;
|
||||
ClutterX11EventFilter *filter;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
ClutterBackendX11 *backend_x11;
|
||||
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
tmp_list = backend_singleton->event_filters;
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CLUTTER_IS_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return;
|
||||
}
|
||||
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
tmp_list = backend_x11->event_filters;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
@ -1003,8 +1163,8 @@ clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
||||
|
||||
if (filter->func == func && filter->data == data)
|
||||
{
|
||||
backend_singleton->event_filters =
|
||||
g_slist_remove_link (backend_singleton->event_filters, this);
|
||||
backend_x11->event_filters =
|
||||
g_slist_remove_link (backend_x11->event_filters, this);
|
||||
|
||||
g_slist_free_1 (this);
|
||||
g_free (filter);
|
||||
@ -1051,10 +1211,21 @@ gboolean
|
||||
clutter_x11_has_xinput (void)
|
||||
{
|
||||
#if defined(HAVE_XINPUT) || defined(HAVE_XINPUT_2)
|
||||
if (backend_singleton != NULL)
|
||||
return backend_singleton->has_xinput;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
return FALSE;
|
||||
if (backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!CLUTTER_IS_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return CLUTTER_BACKEND_X11 (backend)->has_xinput;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
@ -1086,6 +1257,8 @@ clutter_x11_has_composite_extension (void)
|
||||
}
|
||||
|
||||
dpy = clutter_x11_get_default_display();
|
||||
if (dpy == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (XCompositeQueryExtension (dpy, &event, &error))
|
||||
{
|
||||
@ -1158,15 +1331,7 @@ clutter_x11_get_use_argb_visual (void)
|
||||
XVisualInfo *
|
||||
_clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11)
|
||||
{
|
||||
ClutterBackendX11Class *klass;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_BACKEND_X11 (backend_x11), NULL);
|
||||
|
||||
klass = CLUTTER_BACKEND_X11_GET_CLASS (backend_x11);
|
||||
if (klass->get_visual_info)
|
||||
return klass->get_visual_info (backend_x11);
|
||||
|
||||
return NULL;
|
||||
return cogl_clutter_winsys_xlib_get_visual_info ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1185,8 +1350,16 @@ XVisualInfo *
|
||||
clutter_x11_get_visual_info (void)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11;
|
||||
ClutterBackend *backend;
|
||||
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
|
||||
backend = clutter_get_default_backend ();
|
||||
if (!CLUTTER_IS_BACKEND_X11 (backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
return _clutter_backend_x11_get_visual_info (backend_x11);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "clutter-backend-private.h"
|
||||
#include "clutter-keymap-x11.h"
|
||||
#include "cogl/clutter-backend-cogl.h"
|
||||
|
||||
#include "xsettings/xsettings-client.h"
|
||||
|
||||
@ -67,7 +68,7 @@ struct _ClutterEventX11
|
||||
|
||||
struct _ClutterBackendX11
|
||||
{
|
||||
ClutterBackend parent_instance;
|
||||
ClutterBackendCogl parent_instance;
|
||||
|
||||
Display *xdpy;
|
||||
gchar *display_name;
|
||||
@ -112,14 +113,7 @@ struct _ClutterBackendX11
|
||||
|
||||
struct _ClutterBackendX11Class
|
||||
{
|
||||
ClutterBackendClass parent_class;
|
||||
|
||||
/*
|
||||
* To support foreign stage windows the we need a way to ask for an
|
||||
* XVisualInfo that may be used by toolkits to create an XWindow, and this
|
||||
* may need to be handled differently for different backends.
|
||||
*/
|
||||
XVisualInfo *(* get_visual_info) (ClutterBackendX11 *backend);
|
||||
ClutterBackendCoglClass parent_class;
|
||||
};
|
||||
|
||||
void _clutter_backend_x11_events_init (ClutterBackend *backend);
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#include "clutter-backend-x11.h"
|
||||
#include "clutter-stage-x11.h"
|
||||
#include "clutter-x11.h"
|
||||
@ -43,14 +45,14 @@
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
#ifdef HAVE_XFIXES
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#endif
|
||||
|
||||
#define STAGE_X11_IS_MAPPED(s) ((((ClutterStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
|
||||
|
||||
static ClutterStageWindowIface *clutter_stage_window_parent_iface = NULL;
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
static void clutter_event_translator_iface_init (ClutterEventTranslatorIface *iface);
|
||||
|
||||
@ -60,7 +62,7 @@ static GHashTable *clutter_stages_by_xid = NULL;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageX11,
|
||||
clutter_stage_x11,
|
||||
G_TYPE_OBJECT,
|
||||
CLUTTER_TYPE_STAGE_COGL,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||
clutter_stage_window_iface_init)
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_TRANSLATOR,
|
||||
@ -129,7 +131,8 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
||||
gint new_width,
|
||||
gint new_height)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
if (stage_x11->xwin != None && !stage_x11->is_foreign_xwin)
|
||||
{
|
||||
@ -137,11 +140,11 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
||||
XSizeHints *size_hints;
|
||||
gboolean resize;
|
||||
|
||||
resize = clutter_stage_get_user_resizable (stage_x11->wrapper);
|
||||
resize = clutter_stage_get_user_resizable (stage_cogl->wrapper);
|
||||
|
||||
size_hints = XAllocSizeHints();
|
||||
|
||||
clutter_stage_get_minimum_size (stage_x11->wrapper,
|
||||
clutter_stage_get_minimum_size (stage_cogl->wrapper,
|
||||
&min_width,
|
||||
&min_height);
|
||||
|
||||
@ -182,7 +185,8 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
||||
static void
|
||||
clutter_stage_x11_set_wm_protocols (ClutterStageX11 *stage_x11)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
Atom protocols[2];
|
||||
int n = 0;
|
||||
|
||||
@ -197,7 +201,8 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *geometry)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
/* If we're fullscreen, return the size of the display. */
|
||||
if ((stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN) &&
|
||||
@ -219,7 +224,8 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||
gint height)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
if (stage_x11->is_foreign_xwin)
|
||||
{
|
||||
@ -229,7 +235,7 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||
*/
|
||||
stage_x11->xwin_width = width;
|
||||
stage_x11->xwin_height = height;
|
||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_x11->wrapper));
|
||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_cogl->wrapper));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -262,7 +268,7 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||
width,
|
||||
height);
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (stage_x11->wrapper,
|
||||
CLUTTER_SET_PRIVATE_FLAGS (stage_cogl->wrapper,
|
||||
CLUTTER_IN_RESIZE);
|
||||
|
||||
/* XXX: in this case we can rely on a subsequent
|
||||
@ -280,7 +286,8 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||
static inline void
|
||||
set_wm_pid (ClutterStageX11 *stage_x11)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
long pid;
|
||||
|
||||
if (stage_x11->xwin == None || stage_x11->is_foreign_xwin)
|
||||
@ -304,7 +311,8 @@ set_wm_pid (ClutterStageX11 *stage_x11)
|
||||
static inline void
|
||||
set_wm_title (ClutterStageX11 *stage_x11)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
if (stage_x11->xwin == None || stage_x11->is_foreign_xwin)
|
||||
return;
|
||||
@ -331,7 +339,8 @@ set_wm_title (ClutterStageX11 *stage_x11)
|
||||
static inline void
|
||||
set_cursor_visible (ClutterStageX11 *stage_x11)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
if (stage_x11->xwin == None)
|
||||
return;
|
||||
@ -385,6 +394,8 @@ clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
|
||||
g_hash_table_remove (clutter_stages_by_xid,
|
||||
GINT_TO_POINTER (stage_x11->xwin));
|
||||
}
|
||||
|
||||
clutter_stage_window_parent_iface->unrealize (stage_window);
|
||||
}
|
||||
|
||||
void
|
||||
@ -393,7 +404,8 @@ _clutter_stage_x11_update_foreign_event_mask (CoglOnscreen *onscreen,
|
||||
void *user_data)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = user_data;
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = user_data;
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
XSetWindowAttributes attrs;
|
||||
|
||||
attrs.event_mask = event_mask | CLUTTER_STAGE_X11_EVENT_MASK;
|
||||
@ -408,9 +420,36 @@ static gboolean
|
||||
clutter_stage_x11_realize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
ClutterDeviceManager *device_manager;
|
||||
int event_flags;
|
||||
gfloat width, height;
|
||||
|
||||
clutter_actor_get_size (CLUTTER_ACTOR (stage_cogl->wrapper),
|
||||
&width, &height);
|
||||
|
||||
stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context,
|
||||
width, height);
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
cogl_x11_onscreen_set_foreign_window_xid (stage_cogl->onscreen,
|
||||
stage_x11->xwin,
|
||||
_clutter_stage_x11_update_foreign_event_mask,
|
||||
stage_x11);
|
||||
|
||||
}
|
||||
|
||||
/* Chain to the parent class now. ClutterStageCogl will call cogl_framebuffer_allocate,
|
||||
which will create the X Window we need */
|
||||
|
||||
if (!(clutter_stage_window_parent_iface->realize (stage_window)))
|
||||
return FALSE;
|
||||
|
||||
if (stage_x11->xwin == None)
|
||||
stage_x11->xwin = cogl_x11_onscreen_get_window_xid (stage_cogl->onscreen);
|
||||
|
||||
if (clutter_stages_by_xid == NULL)
|
||||
clutter_stages_by_xid = g_hash_table_new (NULL, NULL);
|
||||
@ -456,7 +495,7 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
|
||||
*/
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
_clutter_device_manager_select_stage_events (device_manager,
|
||||
stage_x11->wrapper,
|
||||
stage_cogl->wrapper,
|
||||
event_flags);
|
||||
|
||||
/* no user resize.. */
|
||||
@ -475,8 +514,9 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
|
||||
gboolean is_fullscreen)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStage *stage = stage_x11->wrapper;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
ClutterStage *stage = stage_cogl->wrapper;
|
||||
gboolean was_fullscreen;
|
||||
|
||||
if (stage == NULL || CLUTTER_ACTOR_IN_DESTRUCTION (stage))
|
||||
@ -611,7 +651,8 @@ clutter_stage_x11_set_user_resizable (ClutterStageWindow *stage_window,
|
||||
static inline void
|
||||
update_wm_hints (ClutterStageX11 *stage_x11)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
XWMHints wm_hints;
|
||||
|
||||
if (stage_x11->wm_state & STAGE_X11_WITHDRAWN)
|
||||
@ -661,7 +702,8 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window,
|
||||
gboolean do_raise)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
@ -689,7 +731,7 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window,
|
||||
|
||||
g_assert (STAGE_X11_IS_MAPPED (stage_x11));
|
||||
|
||||
clutter_actor_map (CLUTTER_ACTOR (stage_x11->wrapper));
|
||||
clutter_actor_map (CLUTTER_ACTOR (stage_cogl->wrapper));
|
||||
|
||||
if (!stage_x11->is_foreign_xwin)
|
||||
XMapWindow (backend_x11->xdpy, stage_x11->xwin);
|
||||
@ -700,7 +742,8 @@ static void
|
||||
clutter_stage_x11_hide (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
@ -709,17 +752,23 @@ clutter_stage_x11_hide (ClutterStageWindow *stage_window)
|
||||
|
||||
g_assert (!STAGE_X11_IS_MAPPED (stage_x11));
|
||||
|
||||
clutter_actor_unmap (CLUTTER_ACTOR (stage_x11->wrapper));
|
||||
clutter_actor_unmap (CLUTTER_ACTOR (stage_cogl->wrapper));
|
||||
|
||||
if (!stage_x11->is_foreign_xwin)
|
||||
XWithdrawWindow (backend_x11->xdpy, stage_x11->xwin, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
clutter_stage_x11_get_wrapper (ClutterStageWindow *stage_window)
|
||||
static gboolean
|
||||
clutter_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
|
||||
{
|
||||
return CLUTTER_ACTOR (CLUTTER_STAGE_X11 (stage_window)->wrapper);
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
|
||||
/* while resizing a window, clipped redraws are disabled in order to
|
||||
* avoid artefacts. see clutter-event-x11.c:event_translate for a more
|
||||
* detailed explanation
|
||||
*/
|
||||
return stage_x11->clipped_redraws_cool_off == 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -736,7 +785,7 @@ static void
|
||||
clutter_stage_x11_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterEventTranslator *translator = CLUTTER_EVENT_TRANSLATOR (gobject);
|
||||
ClutterBackendX11 *backend = CLUTTER_STAGE_X11 (gobject)->backend;
|
||||
ClutterBackendCogl *backend = CLUTTER_STAGE_COGL (gobject)->backend;
|
||||
|
||||
_clutter_backend_remove_event_translator (CLUTTER_BACKEND (backend),
|
||||
translator);
|
||||
@ -768,14 +817,13 @@ clutter_stage_x11_init (ClutterStageX11 *stage)
|
||||
stage->accept_focus = TRUE;
|
||||
|
||||
stage->title = NULL;
|
||||
|
||||
stage->wrapper = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
{
|
||||
iface->get_wrapper = clutter_stage_x11_get_wrapper;
|
||||
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->set_title = clutter_stage_x11_set_title;
|
||||
iface->set_fullscreen = clutter_stage_x11_set_fullscreen;
|
||||
iface->set_cursor_visible = clutter_stage_x11_set_cursor_visible;
|
||||
@ -787,6 +835,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
iface->get_geometry = clutter_stage_x11_get_geometry;
|
||||
iface->realize = clutter_stage_x11_realize;
|
||||
iface->unrealize = clutter_stage_x11_unrealize;
|
||||
iface->can_clip_redraws = clutter_stage_x11_can_clip_redraws;
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -810,6 +859,7 @@ handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
|
||||
ClutterStageX11 *stage_x11,
|
||||
XEvent *xevent)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
Atom atom = (Atom) xevent->xclient.data.l[0];
|
||||
|
||||
if (atom == backend_x11->atom_WM_DELETE_WINDOW &&
|
||||
@ -821,8 +871,8 @@ handle_wm_protocols_event (ClutterBackendX11 *backend_x11,
|
||||
* handle the request
|
||||
*/
|
||||
CLUTTER_NOTE (EVENT, "Delete stage %s[%p], win:0x%x",
|
||||
_clutter_actor_get_debug_name (CLUTTER_ACTOR (stage_x11->wrapper)),
|
||||
stage_x11->wrapper,
|
||||
_clutter_actor_get_debug_name (CLUTTER_ACTOR (stage_cogl->wrapper)),
|
||||
stage_cogl->wrapper,
|
||||
(unsigned int) stage_x11->xwin);
|
||||
|
||||
set_user_time (backend_x11, stage_x11, xevent->xclient.data.l[1]);
|
||||
@ -862,8 +912,9 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (translator);
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (translator);
|
||||
ClutterTranslateReturn res = CLUTTER_TRANSLATE_CONTINUE;
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
Window stage_xwindow = stage_x11->xwin;
|
||||
XEvent *xevent = native;
|
||||
ClutterStage *stage;
|
||||
@ -901,7 +952,7 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
||||
xevent->xconfigure.width,
|
||||
xevent->xconfigure.height);
|
||||
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (stage_x11->wrapper, CLUTTER_IN_RESIZE);
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (stage_cogl->wrapper, CLUTTER_IN_RESIZE);
|
||||
|
||||
if (size_changed)
|
||||
{
|
||||
@ -1171,16 +1222,16 @@ clutter_x11_get_stage_window (ClutterStage *stage)
|
||||
ClutterStage *
|
||||
clutter_x11_get_stage_from_window (Window win)
|
||||
{
|
||||
ClutterStageX11 *stage_x11;
|
||||
ClutterStageCogl *stage_cogl;
|
||||
|
||||
if (clutter_stages_by_xid == NULL)
|
||||
return NULL;
|
||||
|
||||
stage_x11 = g_hash_table_lookup (clutter_stages_by_xid,
|
||||
GINT_TO_POINTER (win));
|
||||
stage_cogl = g_hash_table_lookup (clutter_stages_by_xid,
|
||||
GINT_TO_POINTER (win));
|
||||
|
||||
if (stage_x11 != NULL)
|
||||
return stage_x11->wrapper;
|
||||
if (stage_cogl != NULL)
|
||||
return stage_cogl->wrapper;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -1228,7 +1279,8 @@ set_foreign_window_callback (ClutterActor *actor,
|
||||
void *data)
|
||||
{
|
||||
ForeignWindowData *fwd = data;
|
||||
ClutterBackendX11 *backend_x11 = fwd->stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (fwd->stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Setting foreign window (0x%x)",
|
||||
(unsigned int) fwd->xwindow);
|
||||
@ -1279,6 +1331,7 @@ clutter_x11_set_stage_foreign (ClutterStage *stage,
|
||||
{
|
||||
ClutterBackendX11 *backend_x11;
|
||||
ClutterStageX11 *stage_x11;
|
||||
ClutterStageCogl *stage_cogl;
|
||||
ClutterStageWindow *impl;
|
||||
ClutterActor *actor;
|
||||
gint x, y;
|
||||
@ -1294,7 +1347,8 @@ clutter_x11_set_stage_foreign (ClutterStage *stage,
|
||||
|
||||
impl = _clutter_stage_get_window (stage);
|
||||
stage_x11 = CLUTTER_STAGE_X11 (impl);
|
||||
backend_x11 = stage_x11->backend;
|
||||
stage_cogl = CLUTTER_STAGE_COGL (impl);
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
xvisinfo = _clutter_backend_x11_get_visual_info (backend_x11);
|
||||
g_return_val_if_fail (xvisinfo != NULL, FALSE);
|
||||
@ -1369,7 +1423,10 @@ void
|
||||
_clutter_stage_x11_set_user_time (ClutterStageX11 *stage_x11,
|
||||
guint32 user_time)
|
||||
{
|
||||
set_user_time (stage_x11->backend, stage_x11, user_time);
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
set_user_time (backend_x11, stage_x11, user_time);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -1377,7 +1434,8 @@ _clutter_stage_x11_get_root_coords (ClutterStageX11 *stage_x11,
|
||||
gint *root_x,
|
||||
gint *root_y)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
gint return_val;
|
||||
Window child;
|
||||
gint tx, ty;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include "clutter-backend-x11.h"
|
||||
#include "cogl/clutter-stage-cogl.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -48,7 +49,7 @@ typedef enum
|
||||
|
||||
struct _ClutterStageX11
|
||||
{
|
||||
GObject parent_instance;
|
||||
ClutterStageCogl parent_instance;
|
||||
|
||||
Window xwin;
|
||||
gint xwin_width;
|
||||
@ -62,10 +63,6 @@ struct _ClutterStageX11
|
||||
|
||||
ClutterStageX11State wm_state;
|
||||
|
||||
/* backpointers */
|
||||
ClutterStage *wrapper;
|
||||
ClutterBackendX11 *backend;
|
||||
|
||||
guint is_foreign_xwin : 1;
|
||||
guint fullscreening : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
@ -75,7 +72,7 @@ struct _ClutterStageX11
|
||||
|
||||
struct _ClutterStageX11Class
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
ClutterStageCoglClass parent_class;
|
||||
};
|
||||
|
||||
#define CLUTTER_STAGE_X11_EVENT_MASK \
|
||||
|
@ -529,7 +529,6 @@ clutter_x11_texture_pixmap_class_init (ClutterX11TexturePixmapClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
ClutterBackend *default_backend;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ClutterX11TexturePixmapPrivate));
|
||||
|
||||
@ -714,15 +713,6 @@ clutter_x11_texture_pixmap_class_init (ClutterX11TexturePixmapClass *klass)
|
||||
g_signal_override_class_handler ("queue-damage-redraw",
|
||||
CLUTTER_X11_TYPE_TEXTURE_PIXMAP,
|
||||
G_CALLBACK (clutter_x11_texture_pixmap_real_queue_damage_redraw));
|
||||
|
||||
default_backend = clutter_get_default_backend ();
|
||||
|
||||
if (!CLUTTER_IS_BACKEND_X11 (default_backend))
|
||||
{
|
||||
g_critical ("ClutterX11TexturePixmap instantiated with a "
|
||||
"non-X11 backend");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -954,13 +944,17 @@ clutter_x11_texture_pixmap_set_window (ClutterX11TexturePixmap *texture,
|
||||
{
|
||||
ClutterX11TexturePixmapPrivate *priv;
|
||||
XWindowAttributes attr;
|
||||
Display *dpy = clutter_x11_get_default_display ();
|
||||
Display *dpy;
|
||||
|
||||
g_return_if_fail (CLUTTER_X11_IS_TEXTURE_PIXMAP (texture));
|
||||
|
||||
if (!clutter_x11_has_composite_extension ())
|
||||
return;
|
||||
|
||||
dpy = clutter_x11_get_default_display ();
|
||||
if (dpy == NULL)
|
||||
return;
|
||||
|
||||
#if HAVE_XCOMPOSITE
|
||||
priv = texture->priv;
|
||||
|
||||
@ -1058,7 +1052,7 @@ clutter_x11_texture_pixmap_sync_window_internal (ClutterX11TexturePixmap *textur
|
||||
priv->window_height = height;
|
||||
priv->override_redirect = override_redirect;
|
||||
|
||||
if (!clutter_x11_has_composite_extension())
|
||||
if (!clutter_x11_has_composite_extension ())
|
||||
{
|
||||
/* FIXME: this should just be an error, this is unlikely to work worth anything */
|
||||
clutter_x11_texture_pixmap_set_pixmap (texture, priv->window);
|
||||
@ -1148,12 +1142,15 @@ clutter_x11_texture_pixmap_sync_window (ClutterX11TexturePixmap *texture)
|
||||
if (priv->destroyed)
|
||||
return;
|
||||
|
||||
if (priv->window)
|
||||
if (priv->window != None)
|
||||
{
|
||||
XWindowAttributes attr;
|
||||
Display *dpy = clutter_x11_get_default_display ();
|
||||
XWindowAttributes attr;
|
||||
Status status;
|
||||
|
||||
if (dpy == NULL)
|
||||
return;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
|
||||
status = XGetWindowAttributes (dpy, priv->window, &attr);
|
||||
|
587
configure.ac
587
configure.ac
@ -77,10 +77,20 @@ CLUTTER_LT_REV=lt_revision
|
||||
CLUTTER_LT_AGE=lt_age
|
||||
CLUTTER_LT_VERSION="$CLUTTER_LT_CURRENT:$CLUTTER_LT_REV:$CLUTTER_LT_AGE"
|
||||
CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"
|
||||
AC_SUBST([CLUTTER_LT_CURRENT], [lt_current])
|
||||
AC_SUBST([CLUTTER_LT_REVISION], [lt_revision])
|
||||
AC_SUBST([CLUTTER_LT_VERSION], [$CLUTTER_LT_VERSION])
|
||||
|
||||
AC_PROG_SED
|
||||
|
||||
dnl = Preliminary platform checks =============================================
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
platform_win32=no
|
||||
platform_quartz=no
|
||||
platform_linux=no
|
||||
|
||||
AC_MSG_CHECKING([if building for some Win32 platform])
|
||||
AS_CASE([$host],
|
||||
[*-*-mingw*|*-*-cygwin*],
|
||||
@ -89,18 +99,24 @@ AS_CASE([$host],
|
||||
platform_win32=yes
|
||||
],
|
||||
|
||||
[platform_win32=no]
|
||||
[]
|
||||
)
|
||||
AC_MSG_RESULT([$platform_win32])
|
||||
|
||||
AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"])
|
||||
|
||||
AC_CHECK_HEADER([OpenGL/gl.h], [platform_quartz=yes], [platform_quartz=no])
|
||||
AM_CONDITIONAL(OS_QUARTZ, [test "$platform_quartz" = "yes"])
|
||||
|
||||
AC_SUBST(CLUTTER_LT_VERSION)
|
||||
AC_CHECK_HEADER([GL/glx.h], [platform_glx=yes], [platform_glx=no])
|
||||
AC_CHECK_LIB([GL], [glXCreateContext], [platform_glx=yes], [platform_glx=no])
|
||||
AM_CONDITIONAL(OS_GLX, [test "$platform_glx" = "yes"])
|
||||
|
||||
AC_SUBST(CLUTTER_LT_LDFLAGS)
|
||||
|
||||
dnl ========================================================================
|
||||
AC_CACHE_SAVE
|
||||
|
||||
dnl = Dependencies =========================================================
|
||||
|
||||
# Checks for programs.
|
||||
AM_PROG_CC_C_O
|
||||
@ -114,7 +130,7 @@ AC_HEADER_STDC
|
||||
|
||||
# required versions for dependencies
|
||||
m4_define([glib_req_version], [2.31.0])
|
||||
m4_define([cogl_req_version], [1.8.0])
|
||||
m4_define([cogl_req_version], [1.9.1])
|
||||
m4_define([json_glib_req_version], [0.12.0])
|
||||
m4_define([atk_req_version], [2.1.5])
|
||||
m4_define([cairo_req_version], [1.10])
|
||||
@ -124,6 +140,7 @@ m4_define([uprof_req_version], [0.3])
|
||||
m4_define([gtk_doc_req_version], [1.15])
|
||||
m4_define([xfixes_req_version], [3])
|
||||
m4_define([xcomposite_req_version], [0.4])
|
||||
m4_define([gdk_req_version], [3.0.0])
|
||||
|
||||
AC_SUBST([GLIB_REQ_VERSION], [glib_req_version])
|
||||
AC_SUBST([COGL_REQ_VERSION], [cogl_req_version])
|
||||
@ -136,6 +153,7 @@ AC_SUBST([UPROF_REQ_VERSION], [uprof_req_version])
|
||||
AC_SUBST([GTK_DOC_REQ_VERSION], [gtk_doc_req_version])
|
||||
AC_SUBST([XFIXES_REQ_VERSION], [xfixes_req_version])
|
||||
AC_SUBST([XCOMPOSITE_REQ_VERSION], [xcomposite_req_version])
|
||||
AC_SUBST([GDK_REQ_VERSION], [gdk_req_version])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AM_PATH_GLIB_2_0([glib_req_version],
|
||||
@ -167,26 +185,16 @@ AC_ARG_ENABLE([Bsymbolic],
|
||||
AS_IF([test "x$enable_Bsymbolic" = "xyes"], [CLUTTER_LINK_FLAGS=-Wl[,]-Bsymbolic-functions])
|
||||
AC_SUBST(CLUTTER_LINK_FLAGS)
|
||||
|
||||
dnl ========================================================================
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# defaults
|
||||
AS_IF([test "x$platform_win32" = "xyes"], [CLUTTER_FLAVOUR=win32],
|
||||
[test "x$platform_quartz" = "xyes"], [CLUTTER_FLAVOUR=osx],
|
||||
[CLUTTER_FLAVOUR=glx])
|
||||
dnl ========================================================================
|
||||
|
||||
FLAVOUR_LIBS=""
|
||||
FLAVOUR_CFLAGS=""
|
||||
CLUTTER_WINSYS_BASE=
|
||||
CLUTTER_WINSYS_BASE_LIB=
|
||||
CLUTTER_WINSYS=
|
||||
CLUTTER_BACKENDS=""
|
||||
|
||||
experimental_backend=no
|
||||
|
||||
AC_ARG_WITH([flavour],
|
||||
[AS_HELP_STRING([--with-flavour=@<:@glx/opengl-egl-xlib/wayland/eglx/eglnative/osx/win32/cex100@:>@],
|
||||
[Select the Clutter window system backend])],
|
||||
[CLUTTER_FLAVOUR=$with_flavour])
|
||||
|
||||
# base dependencies for core
|
||||
CLUTTER_BASE_PC_FILES="cogl-1.0 >= $COGL_REQ_VERSION cairo-gobject >= $CAIRO_REQ_VERSION atk >= $ATK_REQ_VERSION pangocairo >= $PANGO_REQ_VERSION cogl-pango-1.0 json-glib-1.0 >= $JSON_GLIB_REQ_VERSION"
|
||||
|
||||
@ -195,195 +203,75 @@ BACKEND_PC_FILES=""
|
||||
|
||||
dnl === Clutter windowing system backend ======================================
|
||||
|
||||
AS_CASE([$CLUTTER_FLAVOUR],
|
||||
AC_ARG_ENABLE([x11-backend],
|
||||
[AS_HELP_STRING([--enable-x11-backend=@<:@yes/no@:>@], [Enable the X11 backend (default=check)])],
|
||||
[enable_x11=$enableval],
|
||||
[enable_x11=check])
|
||||
AC_ARG_ENABLE([win32-backend],
|
||||
[AS_HELP_STRING([--enable-win32-backend=@<:@yes/no@:>@], [Enable the Windows backend (default=check)])],
|
||||
[enable_win32=$enableval],
|
||||
[enable_win32=check])
|
||||
AC_ARG_ENABLE([quartz-backend],
|
||||
[AS_HELP_STRING([--enable-quartz-backend=@<:@yes/no@:>@], [Enable the OS X backend (default=check)])],
|
||||
[enable_osx=$enableval],
|
||||
[enable_osx=check])
|
||||
AC_ARG_ENABLE([gdk-backend],
|
||||
[AS_HELP_STRING([--enable-gdk-backend=@<:@yes/no@:>@], [Enable the GDK backend (default=check)])],
|
||||
[enable_gdk=$enableval],
|
||||
[enable_gdk=check])
|
||||
AC_ARG_ENABLE([wayland-backend],
|
||||
[AS_HELP_STRING([--enable-wayland-backend=@<:@yes/no@:>@], [Enable the Wayland client backend (default=no)])],
|
||||
[enable_wayland=$enableval],
|
||||
[enable_wayland=no])
|
||||
AC_ARG_ENABLE([egl-backend],
|
||||
[AS_HELP_STRING([--enable-egl-backend=@<:@yes/no@:>@], [Enable the EGL framebuffer backend (default=no)])],
|
||||
[enable_egl=$enableval],
|
||||
[enable_egl=no])
|
||||
|
||||
[glx],
|
||||
[
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_GLX"
|
||||
|
||||
SUPPORT_X11=1
|
||||
SUPPORT_XLIB=1
|
||||
SUPPORT_GLX=1
|
||||
|
||||
CLUTTER_WINSYS=cogl
|
||||
CLUTTER_WINSYS_BASE=x11
|
||||
CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
|
||||
CLUTTER_SONAME_INFIX=glx
|
||||
|
||||
# Mesa 7.3 added a GL pkg-config file, finally
|
||||
PKG_CHECK_EXISTS([gl],
|
||||
[BACKEND_PC_FILES="$BACKEND_PC_FILES gl"],
|
||||
# if a pkg-config file isn't found just add -lGL
|
||||
# and hope for the best.
|
||||
[FLAVOUR_LIBS="$FLAVOUR_LIBS -lGL"])
|
||||
|
||||
# We might fall back to DRM for sync-to-vblank on GLX
|
||||
PKG_CHECK_EXISTS([libdrm],
|
||||
[
|
||||
AC_DEFINE([HAVE_DRM], [1], [Have libdrm support])
|
||||
BACKEND_PC_FILES="$BACKEND_PC_FILES libdrm"
|
||||
],
|
||||
[])
|
||||
],
|
||||
|
||||
[opengl-egl-xlib],
|
||||
[
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
|
||||
CLUTTER_EGL_BACKEND="generic"
|
||||
|
||||
SUPPORT_X11=1
|
||||
SUPPORT_XLIB=1
|
||||
SUPPORT_EGL=1
|
||||
SUPPORT_EGL_PLATFORM_POWERVR_X11=1
|
||||
|
||||
CLUTTER_WINSYS=cogl
|
||||
CLUTTER_WINSYS_BASE=x11
|
||||
CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
|
||||
# I think this winsys can be API and ABI compatible with the
|
||||
# glx flavour so we can also be cheeky and use the same soname
|
||||
CLUTTER_SONAME_INFIX=glx
|
||||
|
||||
PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
|
||||
PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], [])
|
||||
],
|
||||
|
||||
[wayland],
|
||||
[
|
||||
experimental_backend="yes"
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WAYLAND"
|
||||
|
||||
SUPPORT_WAYLAND=1
|
||||
|
||||
CLUTTER_WINSYS=wayland
|
||||
CLUTTER_SONAME_INFIX=wayland
|
||||
|
||||
PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
|
||||
PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], [])
|
||||
PKG_CHECK_EXISTS([wayland-client xkbcommon],
|
||||
[BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-client xkbcommon"], [])
|
||||
],
|
||||
|
||||
[eglx],
|
||||
[
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
|
||||
CLUTTER_EGL_BACKEND="generic"
|
||||
|
||||
SUPPORT_X11=1
|
||||
SUPPORT_XLIB=1
|
||||
SUPPORT_EGL=1
|
||||
SUPPORT_EGL_PLATFORM_POWERVR_X11=1
|
||||
|
||||
CLUTTER_WINSYS=cogl
|
||||
CLUTTER_WINSYS_BASE=x11
|
||||
CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
|
||||
CLUTTER_SONAME_INFIX=eglx
|
||||
],
|
||||
|
||||
[eglnative],
|
||||
[
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
|
||||
CLUTTER_EGL_BACKEND="generic"
|
||||
|
||||
SUPPORT_EGL=1
|
||||
SUPPORT_EGL_PLATFORM_POWERVR_NULL=1
|
||||
|
||||
PKG_CHECK_MODULES(TSLIB, [tslib-1.0], [have_tslib=yes], [have_tslib=no])
|
||||
AS_IF([test "x$have_tslib" = "xyes"],
|
||||
[AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])]
|
||||
)
|
||||
|
||||
# evdev
|
||||
PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon],
|
||||
[have_evdev=yes], [have_evdev=no])
|
||||
AS_IF([test "x$have_evdev" = "xyes"],
|
||||
[AC_DEFINE([HAVE_EVDEV], 1,
|
||||
[Have evdev support for input handling])]
|
||||
)
|
||||
|
||||
# Make sure we don't enable tslib and evdev at the same time, we
|
||||
# don't support multiple event backends yet.
|
||||
AS_IF([test "x$have_tslib" = "xyes" -a "x$have_evdev" = "xyes"],
|
||||
[AC_MSG_ERROR([Cannot enable both tslib and evdev events])])
|
||||
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS"
|
||||
FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS"
|
||||
|
||||
CLUTTER_WINSYS=cogl
|
||||
CLUTTER_SONAME_INFIX=eglnative
|
||||
],
|
||||
|
||||
[cex100],
|
||||
[
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
|
||||
CLUTTER_EGL_BACKEND="cex100"
|
||||
|
||||
SUPPORT_EGL=1
|
||||
SUPPORT_EGL_PLATFORM_GDL=1
|
||||
|
||||
# The cex100 is a small specialization of the EGL backend
|
||||
CLUTTER_WINSYS=cogl
|
||||
CLUTTER_SONAME_INFIX=cex100
|
||||
|
||||
found_gdl=no
|
||||
AC_CHECK_HEADERS([libgdl.h], [found_gdl=yes])
|
||||
AS_IF([test "x$found_gdl" = "xno"],
|
||||
[AC_CHECK_HEADERS([CE4100/libgdl.h],
|
||||
[
|
||||
FLAVOUR_CFLAGS="-I/usr/include/CE4100"
|
||||
found_gdl=yes
|
||||
CLUTTER_CEX100_LIBGDL_PREFIX=CE4100/
|
||||
])
|
||||
])
|
||||
AC_SUBST(CLUTTER_CEX100_LIBGDL_PREFIX)
|
||||
|
||||
AS_IF([test x"$found_gdl" = "xno"], [AC_MSG_ERROR([libgdl.h not found])])
|
||||
|
||||
# evdev
|
||||
PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon],
|
||||
[have_evdev=yes], [have_evdev=no])
|
||||
AS_IF([test "x$have_evdev" = "xyes"],
|
||||
[AC_DEFINE([HAVE_EVDEV], 1,
|
||||
[Have evdev support for input handling])]
|
||||
)
|
||||
|
||||
FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $EVDEV_CFLAGS"
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS -lgdl $EVDEV_LIBS"
|
||||
],
|
||||
|
||||
[osx],
|
||||
[
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_OSX"
|
||||
|
||||
AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend])
|
||||
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS -framework Cocoa -framework OpenGL"
|
||||
|
||||
CLUTTER_WINSYS=osx
|
||||
CLUTTER_SONAME_INFIX=osx
|
||||
],
|
||||
|
||||
[win32],
|
||||
[
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WIN32"
|
||||
AC_DEFINE([HAVE_CLUTTER_WIN32], [1], [Have the Win32 backend])
|
||||
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS -lopengl32 -lgdi32 -lwinmm"
|
||||
FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS -D_WIN32_WINNT=0x0500"
|
||||
|
||||
AC_CHECK_TOOL(WINDRES, windres, no)
|
||||
if test "$WINDRES" = no; then
|
||||
AC_MSG_ERROR([*** windres is required])
|
||||
fi
|
||||
|
||||
CLUTTER_WINSYS=win32
|
||||
CLUTTER_SONAME_INFIX=win32
|
||||
],
|
||||
|
||||
[AC_MSG_ERROR([Invalid backend for Clutter])]
|
||||
)
|
||||
|
||||
AS_IF([test "x$SUPPORT_X11" = "x1"],
|
||||
dnl Define default values
|
||||
AS_IF([test "x$enable_x11" = "xcheck"],
|
||||
[
|
||||
AS_IF([test "x$platform_glx" = "xyes"], [enable_x11=yes], [enable_x11=no])
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_win32" = "xcheck"],
|
||||
[
|
||||
AS_IF([test "x$platform_win32" = "xyes"], [enable_win32=yes], [enable_win32=no])
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_osx" = "xcheck"],
|
||||
[
|
||||
AS_IF([test "x$platform_quartz" = "xyes"], [enable_osx=yes], [enable_osx=no])
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_gdk" = "xcheck"],
|
||||
[
|
||||
PKG_CHECK_EXISTS([gdk-3.0 >= gdk_req_version], [enable_gdk=yes], [enable_gdk=no])
|
||||
])
|
||||
|
||||
dnl Per-backend rules
|
||||
AS_IF([test "x$enable_x11" = "xyes"],
|
||||
[
|
||||
CLUTTER_BACKENDS="$CLUTTER_BACKENDS x11"
|
||||
|
||||
SUPPORT_X11=1
|
||||
SUPPORT_GLX=1
|
||||
SUPPORT_COGL=1
|
||||
|
||||
# Mesa 7.3 added a GL pkg-config file, finally, but if a pkg-config
|
||||
# file isn't found just add -lGL and hope for the best.
|
||||
PKG_CHECK_EXISTS([gl],
|
||||
[BACKEND_PC_FILES="$BACKEND_PC_FILES gl"],
|
||||
[FLAVOUR_LIBS="$FLAVOUR_LIBS -lGL"])
|
||||
|
||||
# We might fall back to DRM for sync-to-vblank on GLX
|
||||
PKG_CHECK_EXISTS([libdrm],
|
||||
[
|
||||
AC_DEFINE([HAVE_DRM], [1], [Have libdrm support])
|
||||
BACKEND_PC_FILES="$BACKEND_PC_FILES libdrm"
|
||||
],
|
||||
[])
|
||||
|
||||
# we use fontconfig API and pango-fc when the fontconfig
|
||||
# configuration changes
|
||||
PKG_CHECK_EXISTS([pangoft2],
|
||||
@ -392,44 +280,173 @@ AS_IF([test "x$SUPPORT_X11" = "x1"],
|
||||
BACKEND_PC_FILES="$BACKEND_PC_FILES pangoft2"
|
||||
],
|
||||
[])
|
||||
])
|
||||
|
||||
AS_IF([test "x$SUPPORT_GLX" = "x1"],
|
||||
[
|
||||
AC_DEFINE([HAVE_CLUTTER_GLX], [1], [Have the GLX backend])
|
||||
])
|
||||
|
||||
AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
|
||||
AS_IF([test "x$enable_gdk" = "xyes"],
|
||||
[
|
||||
CLUTTER_BACKENDS="$CLUTTER_BACKENDS gdk"
|
||||
|
||||
SUPPORT_GDK=1
|
||||
SUPPORT_COGL=1
|
||||
|
||||
BACKEND_PC_FILES="$BACKEND_PC_FILES gdk-3.0"
|
||||
PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_wayland" = "xyes"],
|
||||
[
|
||||
CLUTTER_BACKENDS="$CLUTTER_BACKENDS wayland"
|
||||
|
||||
experimental_backend="yes"
|
||||
|
||||
SUPPORT_WAYLAND=1
|
||||
SUPPORT_EVDEV=1
|
||||
|
||||
PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
|
||||
PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], [])
|
||||
PKG_CHECK_EXISTS([wayland-client xkbcommon],
|
||||
[BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-client xkbcommon"],
|
||||
[])
|
||||
|
||||
AC_DEFINE([HAVE_CLUTTER_WAYLAND], [1], [Have the Wayland backend])
|
||||
])
|
||||
|
||||
AS_IF([test "x$SUPPORT_EGL" = "x1"],
|
||||
AS_IF([test "x$enable_egl" = "xyes"],
|
||||
[
|
||||
CLUTTER_BACKENDS="$CLUTTER_BACKENDS egl"
|
||||
|
||||
SUPPORT_EGL=1
|
||||
SUPPORT_COGL=1
|
||||
|
||||
# if Mesa has support for egl, we can use it as well
|
||||
PKG_CHECK_EXISTS([egl],
|
||||
[
|
||||
BACKEND_PC_FILES="$BACKEND_PC_FILES egl"
|
||||
],
|
||||
[])
|
||||
|
||||
AC_ARG_WITH([tslib],
|
||||
[AS_HELP_STRING([--with-tslib=@<:@yes/no@:>@], [Use TSLib for events (default=no)])],
|
||||
[],
|
||||
[with_tslib=no])
|
||||
|
||||
AC_ARG_WITH([evdev],
|
||||
[AS_HELP_STRING([--with-evdev=@<:@yes/no@:>@], [Use evdev for events (default=yes)])],
|
||||
[],
|
||||
[with_evdev=yes])
|
||||
|
||||
AC_ARG_WITH([gdl],
|
||||
[AS_HELP_STRING([--with-gdl=@<:@yes/no@:>@], [Use libgdl for CE3100/CE4100 support (default=no)])],
|
||||
[],
|
||||
[with_gdl=no])
|
||||
|
||||
AS_IF([test "x$with_tslib" = "xyes"],
|
||||
[
|
||||
PKG_CHECK_MODULES(TSLIB, [tslib-1.0], [have_tslib=yes], [have_tslib=no])
|
||||
AS_IF([test "x$have_tslib" = "xyes"],
|
||||
[
|
||||
AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])
|
||||
SUPPORT_TSLIB=1
|
||||
])
|
||||
],
|
||||
[have_tslib=no])
|
||||
|
||||
AS_IF([test "x$with_evdev" = "xyes"],
|
||||
[
|
||||
PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon], [have_evdev=yes], [have_evdev=no])
|
||||
AS_IF([test "x$have_evdev" = "xyes"],
|
||||
[
|
||||
AC_DEFINE([HAVE_EVDEV], [1], [Have evdev support for input handling])
|
||||
SUPPORT_EVDEV=1
|
||||
])
|
||||
],
|
||||
[have_evdev=no])
|
||||
|
||||
AS_IF([test "x$with_gdl" = "xyes"],
|
||||
[
|
||||
have_gdl=no
|
||||
|
||||
AC_CHECK_HEADERS([libgdl.h], [have_gdl=yes])
|
||||
|
||||
AS_IF([test "x$have_gdl" = "xno"],
|
||||
[
|
||||
AC_CHECK_HEADERS([CE4100/libgdl.h],
|
||||
[
|
||||
FLAVOUR_CFLAGS="-I/usr/include/CE4100"
|
||||
have_gdl=yes
|
||||
CLUTTER_CEX100_LIBGDL_PREFIX=CE4100/
|
||||
])
|
||||
])
|
||||
|
||||
AC_SUBST(CLUTTER_CEX100_LIBGDL_PREFIX)
|
||||
|
||||
AS_IF([test "x$have_gdl" = "xno"], [AC_MSG_ERROR([libgdl.h not found])])
|
||||
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS -lgdl"
|
||||
|
||||
SUPPORT_EGL_PLATFORM_GDL=1
|
||||
|
||||
AC_DEFINE([CLUTTER_EGL_BACKEND_CEX100], [1], [Use CEX100 EGL backend])
|
||||
],
|
||||
[have_gdl=no])
|
||||
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS"
|
||||
FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS"
|
||||
|
||||
AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend])
|
||||
|
||||
AC_DEFINE([HAVE_CLUTTER_EGL], [1], [Have the EGL backend])
|
||||
])
|
||||
|
||||
AS_IF([test "x$CLUTTER_EGL_BACKEND" = "xgeneric"],
|
||||
AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend]))
|
||||
AS_IF([test "x$enable_osx" = "xyes"],
|
||||
[
|
||||
CLUTTER_BACKENDS="$CLUTTER_BACKENDS osx"
|
||||
|
||||
AS_IF([test "x$CLUTTER_EGL_BACKEND" = "xcex100"],
|
||||
AC_DEFINE([CLUTTER_EGL_BACKEND_CEX100], [1], [Use CEX100 EGL backend]))
|
||||
AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend])
|
||||
|
||||
# winsys conditionals for use in automake files...
|
||||
AM_CONDITIONAL(SUPPORT_GLX, [test "x$SUPPORT_GLX" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_X11, [test "x$SUPPORT_X11" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_XLIB, [test "x$SUPPORT_XLIB" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_EGL, [test "x$SUPPORT_EGL" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_OSX, [test "x$CLUTTER_WINSYS" = "xosx"])
|
||||
AM_CONDITIONAL(SUPPORT_WIN32, [test "x$CLUTTER_WINSYS" = "xwin32"])
|
||||
AM_CONDITIONAL(SUPPORT_CEX100, [test "x$SUPPORT_EGL_PLATFORM_GDL" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$CLUTTER_WINSYS" = "xwayland"])
|
||||
AM_CONDITIONAL(SUPPORT_STUB, [test "x$CLUTTER_WINSYS" = "xwin32" -o \
|
||||
"x$CLUTTER_WINSYS" = "xosx" -o \
|
||||
"x$CLUTTER_WINSYS" = "xwayland"])
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS -framework Cocoa -framework OpenGL"
|
||||
|
||||
SUPPORT_OSX=1
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_win32" = "xyes"],
|
||||
[
|
||||
CLUTTER_BACKENDS="$CLUTTER_BACKENDS win32"
|
||||
|
||||
AC_DEFINE([HAVE_CLUTTER_WIN32], [1], [Have the Win32 backend])
|
||||
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS -lopengl32 -lgdi32 -lwinmm"
|
||||
FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS -D_WIN32_WINNT=0x0500"
|
||||
|
||||
AC_CHECK_TOOL(WINDRES, [windres], [AC_MSG_ERROR([*** windres is required])])
|
||||
|
||||
SUPPORT_WIN32=1
|
||||
])
|
||||
|
||||
AS_IF([test "x$CLUTTER_BACKENDS" = "x"],
|
||||
[
|
||||
AC_MSG_ERROR([No backend enabled. You need to enable at least one backend.])
|
||||
])
|
||||
|
||||
# conditionals for use in automake files...
|
||||
AM_CONDITIONAL(SUPPORT_GLX, [test "x$SUPPORT_GLX" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_X11, [test "x$SUPPORT_X11" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_GDK, [test "x$SUPPORT_GDK" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_EGL, [test "x$SUPPORT_EGL" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_OSX, [test "x$SUPPORT_OSX" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_WIN32, [test "x$SUPPORT_WIN32" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_CEX100, [test "x$SUPPORT_EGL_PLATFORM_GDL" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$SUPPORT_WAYLAND" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_STUB, [test "x$SUPPORT_WIN32" = "x1" -o \
|
||||
"x$SUPPORT_OSX" = "x1" -o \
|
||||
"x$SUPPORT_WAYLAND" = "x1"])
|
||||
|
||||
AM_CONDITIONAL(USE_COGL, [test "x$SUPPORT_COGL" = "x1"])
|
||||
AM_CONDITIONAL(USE_TSLIB, [test "x$have_tslib" = "xyes"])
|
||||
AM_CONDITIONAL(SUPPORT_EVDEV, [test "x$have_evdev" = "xyes"])
|
||||
AM_CONDITIONAL(USE_EVDEV, [test "x$have_evdev" = "xyes"])
|
||||
AM_CONDITIONAL(USE_GLD, [test "x$have_gdl" = "xyes"])
|
||||
|
||||
dnl Instead of using AM_CFLAGS to ensure
|
||||
dnl COGL_ENABLE_EXPERIMENTAL_2_0_API is defined while compiling clutter
|
||||
@ -438,61 +455,68 @@ dnl other tools such as glib-mkenums and gir-scanner don't end up
|
||||
dnl using the define also.
|
||||
AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_2_0_API], [1], [Can use Cogl 2.0 API internally])
|
||||
|
||||
dnl strip leading spaces
|
||||
CLUTTER_BACKENDS=${CLUTTER_BACKENDS#* }
|
||||
AC_SUBST(CLUTTER_BACKENDS)
|
||||
|
||||
AC_CACHE_SAVE
|
||||
|
||||
dnl === Clutter configuration =================================================
|
||||
|
||||
CLUTTER_CONFIG_DEFINES=
|
||||
|
||||
# windowing systems
|
||||
AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
AS_IF([test "x$SUPPORT_X11" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_WINDOWING_X11 1"])
|
||||
#define CLUTTER_WINDOWING_X11 \"x11\""])
|
||||
AS_IF([test "x$SUPPORT_GDK" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_WINDOWING_GDK \"gdk\""])
|
||||
AS_IF([test "x$SUPPORT_GLX" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_WINDOWING_GLX 1"])
|
||||
#define CLUTTER_WINDOWING_GLX \"glx\""])
|
||||
AS_IF([test "x$SUPPORT_EGL" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_WINDOWING_EGL 1"])
|
||||
AS_IF([test "x$CLUTTER_WINSYS" = "xwayland"],
|
||||
#define CLUTTER_WINDOWING_EGL \"eglnative\""])
|
||||
AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_WINDOWING_WAYLAND 1"])
|
||||
AS_IF([test "x$CLUTTER_WINSYS" = "xosx"],
|
||||
#define CLUTTER_WINDOWING_WAYLAND \"wayland\""])
|
||||
AS_IF([test "x$SUPPORT_OSX" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_WINDOWING_OSX 1"])
|
||||
AS_IF([test "x$CLUTTER_WINSYS" = "xwin32"],
|
||||
#define CLUTTER_WINDOWING_OSX \"osx\""])
|
||||
AS_IF([test "x$SUPPORT_WIN32" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_WINDOWING_WIN32 1"])
|
||||
#define CLUTTER_WINDOWING_WIN32 \"win32\""])
|
||||
AS_IF([test "x$SUPPORT_EGL_PLATFORM_GDL" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_WINDOWING_CEX100 1"])
|
||||
#define CLUTTER_WINDOWING_CEX100 \"cex100\""])
|
||||
AS_IF([test "x$SUPPORT_EVDEV" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_INPUT_EVDEV \"evdev\""])
|
||||
AS_IF([test "x$SUPPORT_TSLIB" = "x1"],
|
||||
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
|
||||
#define CLUTTER_INPUT_TSLIB \"tslib\""])
|
||||
|
||||
AC_SUBST([CLUTTER_CONFIG_DEFINES])
|
||||
|
||||
dnl === Clutter substitutions =================================================
|
||||
# Eventually the idea of a winsys should be hidden from Clutter and moved
|
||||
# into Cogl, but for now we have CLUTTER_WINSYS...
|
||||
AC_SUBST([CLUTTER_WINSYS])
|
||||
# The same goes for the winsys-base...
|
||||
AC_SUBST([CLUTTER_WINSYS_BASE])
|
||||
AC_SUBST([CLUTTER_WINSYS_BASE_LIB])
|
||||
AC_SUBST(CLUTTER_STAGE_TYPE)
|
||||
AC_SUBST(CLUTTER_SONAME_INFIX)
|
||||
|
||||
CLUTTER_WINSYS_LIB=libclutter-$CLUTTER_SONAME_INFIX-$CLUTTER_API_VERSION.la
|
||||
AC_SUBST([CLUTTER_WINSYS_LIB])
|
||||
|
||||
dnl === Clutter substitutions kept for backwards compatibility ================
|
||||
AC_SUBST([CLUTTER_FLAVOUR])
|
||||
CLUTTER_COGL=undefined
|
||||
AC_SUBST([CLUTTER_COGL])
|
||||
AC_SUBST([CLUTTER_WINSYS], [deprecated])
|
||||
AC_SUBST([CLUTTER_WINSYS_BASE], [deprecated])
|
||||
AC_SUBST([CLUTTER_STAGE_TYPE], [deprecated])
|
||||
AC_SUBST([CLUTTER_SONAME_INFIX], [deprecated])
|
||||
AC_SUBST([CLUTTER_FLAVOUR], [deprecated])
|
||||
AC_SUBST([CLUTTER_COGL], [deprecated])
|
||||
AC_SUBST([COGL_DRIVER], [deprecated])
|
||||
|
||||
dnl === Image loading backend =================================================
|
||||
IMAGE_PC_FILES=""
|
||||
|
||||
dnl === X11 checks, only for X11-based backends ===============================
|
||||
X11_PC_FILES=""
|
||||
X11_EXTS=""
|
||||
x11_tests=no
|
||||
|
||||
AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
AS_IF([test "x$SUPPORT_X11" = "x1"],
|
||||
[
|
||||
# base X11 includes and libraries
|
||||
AC_MSG_CHECKING([for X11])
|
||||
@ -537,6 +561,7 @@ AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
|
||||
X11_LIBS="$X11_LIBS -lXext"
|
||||
X11_PC_FILES="$X11_PC_FILES xext"
|
||||
X11_EXTS="$X11_EXTS xext"
|
||||
|
||||
AC_MSG_RESULT([found])
|
||||
],
|
||||
@ -552,6 +577,7 @@ AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
|
||||
X11_LIBS="$X11_LIBS -lXfixes"
|
||||
X11_PC_FILES="$X11_PC_FILES xfixes >= $XFIXES_REQ_VERSION"
|
||||
X11_EXTS="$X11_EXTS xfixes"
|
||||
|
||||
AC_MSG_RESULT([found])
|
||||
],
|
||||
@ -567,6 +593,7 @@ AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
|
||||
X11_LIBS="$X11_LIBS -lXdamage"
|
||||
X11_PC_FILES="$X11_PC_FILES xdamage"
|
||||
X11_EXTS="$X11_EXTS xdamage"
|
||||
|
||||
AC_MSG_RESULT([found])
|
||||
],
|
||||
@ -582,6 +609,7 @@ AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
|
||||
X11_LIBS="$X11_LIBS -lXcomposite"
|
||||
X11_PC_FILES="$X11_PC_FILES xcomposite >= $XCOMPOSITE_REQ_VERSION"
|
||||
X11_EXTS="$X11_EXTS xcomposite"
|
||||
|
||||
AC_MSG_RESULT([found])
|
||||
],
|
||||
@ -600,6 +628,7 @@ AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
[
|
||||
AC_DEFINE([HAVE_XGE], [1], [Define to 1 if X Generic Extensions is available])
|
||||
have_xge=yes
|
||||
X11_EXTS="$X11_EXTS xge"
|
||||
])
|
||||
|
||||
CPPFLAGS="$clutter_save_CPPFLAGS"
|
||||
@ -639,6 +668,7 @@ AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
|
||||
X11_LIBS="$X11_LIBS $XINPUT_LIBS"
|
||||
X11_PC_FILES="$X11_PC_FILES xi"
|
||||
X11_EXTS="$X11_EXTS xi"
|
||||
],
|
||||
|
||||
[no],
|
||||
@ -660,6 +690,8 @@ AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
[
|
||||
AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension])
|
||||
have_xkb=yes
|
||||
|
||||
X11_EXTS="$X11_EXTS xkb"
|
||||
])
|
||||
|
||||
CPPFLAGS="$clutter_save_CPPFLAGS"
|
||||
@ -673,7 +705,11 @@ AS_IF([test "x$SUPPORT_XLIB" = "x1"],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL([BUILD_XI2], [test "x$have_xinput2" = "xyes"])
|
||||
AM_CONDITIONAL(X11_TESTS, [test "x$x11_tests" = "xyes"])
|
||||
AM_CONDITIONAL([X11_TESTS], [test "x$x11_tests" = "xyes"])
|
||||
|
||||
X11_EXTS=${X11_EXTS#* }
|
||||
|
||||
AC_CACHE_SAVE
|
||||
|
||||
dnl === Enable debug level ====================================================
|
||||
|
||||
@ -721,7 +757,7 @@ AS_CASE([$enable_deprecated],
|
||||
|
||||
[no],
|
||||
[
|
||||
CLUTTER_DEPRECATED_CFLAGS="-DG_DISABLE_SINGLE_INCLUDES -DCOGL_DISABLE_DEPRECATED -DCLUTTER_DISABLE_DEPRECATED"
|
||||
CLUTTER_DEPRECATED_CFLAGS="-DG_DISABLE_SINGLE_INCLUDES -DCOGL_DISABLE_DEPRECATED"
|
||||
],
|
||||
|
||||
[yes],
|
||||
@ -961,7 +997,7 @@ AC_CONFIG_FILES([
|
||||
|
||||
clutter/cally/cally-$CLUTTER_API_VERSION.pc:clutter/cally/cally.pc.in
|
||||
|
||||
clutter/cogl/clutter-cex100.h
|
||||
clutter/egl/clutter-cex100.h
|
||||
|
||||
tests/Makefile
|
||||
tests/accessibility/Makefile
|
||||
@ -1000,8 +1036,6 @@ echo " • Global:"
|
||||
echo " Prefix: ${prefix}"
|
||||
echo " Libdir: ${libdir}"
|
||||
echo " Sysconfdir: ${sysconfdir}"
|
||||
echo " Flavour: ${CLUTTER_WINSYS}"
|
||||
echo " Target library: ${CLUTTER_WINSYS_LIB}"
|
||||
|
||||
# Compiler/Debug related flags
|
||||
echo ""
|
||||
@ -1023,24 +1057,31 @@ echo ""
|
||||
echo " • Extra:"
|
||||
echo " Build introspection data: ${enable_introspection}"
|
||||
echo " Build conformance test suite: ${enable_conformance}"
|
||||
echo " Build X11-specific tests: ${x11_tests}"
|
||||
|
||||
# Clutter backend related flags
|
||||
echo ""
|
||||
echo " • Clutter Backend:"
|
||||
echo " • Clutter Backends:"
|
||||
|
||||
if test "x$experimental_backend" = "xno"; then
|
||||
echo " Windowing system: ${CLUTTER_WINSYS}"
|
||||
echo " Windowing systems: ${CLUTTER_BACKENDS}"
|
||||
else
|
||||
echo " Windowing system: ${CLUTTER_WINSYS} (WARNING: Experimental)"
|
||||
echo " Windowing systems: ${CLUTTER_BACKENDS} (WARNING: Experimental backends enabled)"
|
||||
fi
|
||||
|
||||
if test "x$SUPPORT_XLIB" = "x1"; then
|
||||
echo " Enable XComposite: ${have_xcomposite}"
|
||||
echo " Enable XInput: ${have_xinput}"
|
||||
echo " Enable Xge: ${have_xge}"
|
||||
echo " Enable XI2: ${have_xinput2}"
|
||||
echo " Enable XKB: ${have_xkb}"
|
||||
echo " Enable X11 tests: ${x11_tests}"
|
||||
if test "x$SUPPORT_X11" = "x1"; then
|
||||
echo ""
|
||||
echo " - X11 backend options:"
|
||||
echo " Enabled extensions: ${X11_EXTS}"
|
||||
echo " Build X11-specific tests: ${x11_tests}"
|
||||
fi
|
||||
|
||||
if test "x$SUPPORT_EGL" = "x1"; then
|
||||
echo ""
|
||||
echo " - EGL backend options:"
|
||||
echo " Enable TSLib: ${have_tslib}"
|
||||
echo " Enable evdev: ${have_evdev}"
|
||||
echo " Enable GDL: ${have_gdl}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
@ -1048,11 +1089,13 @@ echo ""
|
||||
# General warning about experimental features
|
||||
if test "x$experimental_backend" = "xyes"; then
|
||||
echo ""
|
||||
echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
|
||||
echo " *WARNING*"
|
||||
echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
|
||||
echo "*WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*"
|
||||
echo ""
|
||||
echo " The stability of your build might be affected by one or more"
|
||||
echo " experimental backends or experimental and unsupported features"
|
||||
echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
|
||||
echo ""
|
||||
echo "*WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*"
|
||||
echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
|
||||
echo ""
|
||||
fi
|
||||
|
@ -57,14 +57,14 @@ INCLUDES = \
|
||||
-I$(top_builddir)/clutter \
|
||||
$(NULL)
|
||||
|
||||
LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la
|
||||
|
||||
AM_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_DISABLE_SINGLE_INCLUDES \
|
||||
-DCOGL_DISABLE_DEPRECATED \
|
||||
-DCLUTTER_DISABLE_DEPRECATED \
|
||||
-DCLUTTER_DISABLE_DEPRECATION_WARNINGS \
|
||||
-DTESTS_DATA_DIR=\""$(top_srcdir)/tests/data/"\"
|
||||
|
||||
AM_LDFLAGS = $(CLUTTER_LIBS) -export-dynamic
|
||||
|
@ -79,7 +79,7 @@ expand_content_files= \
|
||||
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
|
||||
|
||||
INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/clutter -I$(top_srcdir)/clutter/cogl -I$(top_builddir) -I$(top_builddir)/clutter -I$(top_builddir)/clutter/cogl $(CLUTTER_CFLAGS)
|
||||
GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
|
||||
GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
|
||||
|
||||
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
|
@ -52,16 +52,19 @@ HFILE_GLOB=\
|
||||
$(top_builddir)/clutter/*.h \
|
||||
$(top_srcdir)/clutter/x11/clutter-x11.h \
|
||||
$(top_srcdir)/clutter/x11/clutter-x11-texture-pixmap.h \
|
||||
$(top_srcdir)/clutter/cogl/clutter-glx-texture-pixmap.h \
|
||||
$(top_srcdir)/clutter/cogl/clutter-egl.h \
|
||||
$(top_srcdir)/clutter/cogl/clutter-cex100.h \
|
||||
$(top_srcdir)/clutter/win32/clutter-win32.h
|
||||
$(top_srcdir)/clutter/x11/clutter-glx-texture-pixmap.h \
|
||||
$(top_srcdir)/clutter/egl/clutter-egl.h \
|
||||
$(top_srcdir)/clutter/egl/clutter-cex100.h \
|
||||
$(top_srcdir)/clutter/win32/clutter-win32.h \
|
||||
$(top_srcdir)/clutter/gdk/clutter-gdk.h
|
||||
|
||||
CFILE_GLOB=\
|
||||
$(top_srcdir)/clutter/*.c \
|
||||
$(top_srcdir)/clutter/cogl/*.c \
|
||||
$(top_srcdir)/clutter/x11/*.c \
|
||||
$(top_srcdir)/clutter/win32/*.c
|
||||
$(top_srcdir)/clutter/win32/*.c \
|
||||
$(top_srcdir)/clutter/gdk/*.c \
|
||||
$(top_srcdir)/clutter/egl/*.c
|
||||
|
||||
# Header files to ignore when scanning.
|
||||
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
|
||||
@ -96,8 +99,11 @@ IGNORE_HFILES=\
|
||||
clutter-timeout-interval.h \
|
||||
cally \
|
||||
cogl \
|
||||
egl \
|
||||
evdev \
|
||||
gdk \
|
||||
osx \
|
||||
tslib \
|
||||
x11 \
|
||||
wayland \
|
||||
win32
|
||||
@ -105,11 +111,12 @@ IGNORE_HFILES=\
|
||||
EXTRA_HFILES=\
|
||||
$(top_srcdir)/clutter/x11/clutter-x11.h \
|
||||
$(top_srcdir)/clutter/x11/clutter-x11-texture-pixmap.h \
|
||||
$(top_srcdir)/clutter/cogl/clutter-glx-texture-pixmap.h \
|
||||
$(top_srcdir)/clutter/cogl/clutter-egl.h \
|
||||
$(top_srcdir)/clutter/cogl/clutter-cex100.h \
|
||||
$(top_srcdir)/clutter/x11/clutter-glx-texture-pixmap.h \
|
||||
$(top_srcdir)/clutter/egl/clutter-egl.h \
|
||||
$(top_srcdir)/clutter/egl/clutter-cex100.h \
|
||||
$(top_srcdir)/clutter/wayland/clutter-wayland.h \
|
||||
$(top_srcdir)/clutter/win32/clutter-win32.h
|
||||
$(top_srcdir)/clutter/win32/clutter-win32.h \
|
||||
$(top_srcdir)/clutter/gdk/clutter-gdk.h
|
||||
|
||||
# Images to copy into HTML directory.
|
||||
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
|
||||
@ -162,7 +169,7 @@ expand_content_files= \
|
||||
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
|
||||
|
||||
INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/clutter -I$(top_srcdir)/clutter/cogl -I$(top_builddir) -I$(top_builddir)/clutter -I$(top_builddir)/clutter/cogl $(CLUTTER_CFLAGS)
|
||||
GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
|
||||
GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
|
||||
|
||||
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
|
@ -203,6 +203,7 @@
|
||||
<listitem><para>Backend-related notes, including initialization of
|
||||
the backend features and GL context creation</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>event</term>
|
||||
<listitem><para>Event handling notes</para></listitem>
|
||||
</varlistentry>
|
||||
|
@ -1,7 +1,7 @@
|
||||
include $(top_srcdir)/build/autotools/Makefile.am.silent
|
||||
|
||||
common_ldadd = \
|
||||
$(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
$(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la
|
||||
|
||||
common_sources = \
|
||||
cally-examples-util.c \
|
||||
|
@ -170,7 +170,7 @@ test_conformance_CPPFLAGS = \
|
||||
|
||||
test_conformance_CFLAGS = -g $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
|
||||
|
||||
test_conformance_LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
|
||||
test_conformance_LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
|
||||
|
||||
test_conformance_LDFLAGS = -export-dynamic
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include <glib.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
static const ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
|
||||
|
||||
#ifdef COGL_HAS_XLIB
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
#include <cogl/cogl-texture-pixmap-x11.h>
|
||||
@ -195,13 +195,13 @@ queue_redraw (gpointer stage)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* COGL_HAS_XLIB */
|
||||
#endif /* CLUTTER_WINDOWING_X11 */
|
||||
|
||||
void
|
||||
test_cogl_texture_pixmap_x11 (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
#ifdef COGL_HAS_XLIB
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
|
||||
TestState state;
|
||||
guint idle_handler;
|
||||
@ -235,11 +235,11 @@ test_cogl_texture_pixmap_x11 (TestConformSimpleFixture *fixture,
|
||||
if (g_test_verbose ())
|
||||
g_print ("OK\n");
|
||||
|
||||
#else /* COGL_HAS_XLIB */
|
||||
#else /* CLUTTER_WINDOWING_X11 */
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Skipping\n");
|
||||
|
||||
#endif /* COGL_HAS_XLIB */
|
||||
#endif /* CLUTTER_WINDOWING_X11 */
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <clutter/clutter.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef COGL_HAS_XLIB
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
#endif
|
||||
@ -48,7 +48,7 @@ test_conform_simple_fixture_setup (TestConformSimpleFixture *fixture,
|
||||
g_assert (clutter_init (shared_state->argc_addr, shared_state->argv_addr)
|
||||
== CLUTTER_INIT_SUCCESS);
|
||||
|
||||
#ifdef COGL_HAS_XLIB
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
/* A lot of the tests depend on a specific stage / framebuffer size
|
||||
* when they read pixels back to verify the results of the test.
|
||||
*
|
||||
|
@ -1,5 +1,3 @@
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
@ -59,10 +59,11 @@ UNIT_TESTS = \
|
||||
test-path-constraint.c \
|
||||
test-snap-constraint.c \
|
||||
test-state-script.c \
|
||||
test-drop.c
|
||||
test-drop.c \
|
||||
test-devices.c
|
||||
|
||||
if X11_TESTS
|
||||
UNIT_TESTS += test-pixmap.c test-devices.c
|
||||
UNIT_TESTS += test-pixmap.c
|
||||
endif
|
||||
|
||||
if OS_WIN32
|
||||
@ -147,7 +148,7 @@ INCLUDES = \
|
||||
-I$(top_builddir)/clutter \
|
||||
-I$(top_builddir)/clutter/cogl
|
||||
|
||||
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la
|
||||
|
||||
noinst_PROGRAMS = test-interactive
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include <math.h>
|
||||
|
@ -1,4 +1,3 @@
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include <math.h>
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <glib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static gboolean
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
/* each time the timeline animating the label completes, swap the direction */
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
ClutterActor *stage;
|
||||
@ -218,8 +221,10 @@ test_devices_main (int argc, char **argv)
|
||||
ClutterDeviceManager *manager;
|
||||
const GSList *stage_devices, *l;
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
/* force enabling X11 support */
|
||||
clutter_x11_enable_xinput ();
|
||||
#endif
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static GList *stages = NULL;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#if defined (_MSC_VER) && !defined (_USE_MATH_DEFINES)
|
||||
|
@ -1,24 +1,22 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <cairo.h>
|
||||
|
||||
#ifdef CAIRO_HAS_XLIB_SURFACE
|
||||
#include <cairo-xlib.h>
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xcomposite.h>
|
||||
|
||||
# include <clutter/x11/clutter-x11.h>
|
||||
# include <clutter/x11/clutter-x11-texture-pixmap.h>
|
||||
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/extensions/Xcomposite.h>
|
||||
|
||||
# include <cairo.h>
|
||||
# include <cairo-xlib.h>
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
#include <clutter/x11/clutter-x11-texture-pixmap.h>
|
||||
#endif
|
||||
|
||||
#define IMAGE TESTS_DATADIR G_DIR_SEPARATOR_S "redhand.png"
|
||||
|
||||
@ -127,6 +125,7 @@ stage_button_press_cb (ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
draw_arc ((Pixmap)data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -172,9 +171,12 @@ create_pixmap (guint *width, guint *height, guint *depth)
|
||||
cairo_paint (cr);
|
||||
cairo_surface_destroy (image);
|
||||
|
||||
if (width) *width = w;
|
||||
if (height) *height = h;
|
||||
if (depth) *depth = 32;
|
||||
if (width)
|
||||
*width = w;
|
||||
if (height)
|
||||
*height = h;
|
||||
if (depth)
|
||||
*depth = 32;
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
@ -210,6 +212,11 @@ test_pixmap_main (int argc, char **argv)
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
|
||||
g_error ("test-pixmap requires the X11 Clutter backend.");
|
||||
#endif
|
||||
|
||||
xdpy = clutter_x11_get_default_display ();
|
||||
XSynchronize (xdpy, True);
|
||||
|
||||
@ -308,13 +315,3 @@ test_pixmap_main (int argc, char **argv)
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
test_pixmap_main (int argc, char **argv)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
};
|
||||
|
||||
#endif /* CLUTTER_WINDOWING_X11 */
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static const ClutterGravity gravities[] = {
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static ClutterScript *script = NULL;
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
/* each time the timeline animating the label completes, swap the direction */
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#undef CLUTTER_DISABLE_DEPRECATED
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
/* our thread-specific data */
|
||||
|
@ -1,6 +1,6 @@
|
||||
include $(top_srcdir)/build/autotools/Makefile.am.silent
|
||||
|
||||
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
test-text \
|
||||
|
@ -14,7 +14,7 @@ INCLUDES = \
|
||||
-I$(top_srcdir)/clutter \
|
||||
-I$(top_builddir)/clutter
|
||||
|
||||
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
|
||||
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la
|
||||
|
||||
LDADD = $(common_ldadd) $(CLUTTER_LIBS) -lm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user