Commit Graph

64 Commits

Author SHA1 Message Date
Lionel Landwerlin
0e4d11bcd8 gdk: master clock: fix incorrect symbol use
https://bugzilla.gnome.org/show_bug.cgi?id=754134
2015-08-26 21:40:47 +01:00
Lionel Landwerlin
5b9c31a0ce gdk: fix memory corruption
g_hash_table_replace will free the list pointer we're modifying.
Let's just do memory management ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=754134
2015-08-26 21:40:41 +01:00
Emmanuele Bassi
fe422ab61c gdk: Use non-deprecated/non-Clutter specific X11 API
We are currently using deprecated/Clutter-specific API in Cogl to
retrieve the XVisualInfo associated with the (E)GLX context. Cogl 1.21.2
added new CoglRenderer API to achieve the same result.
2015-08-21 11:58:52 +01:00
Emmanuele Bassi
4040f2d556 gdk: Do not use deprecated macros
Use the replacement functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
365bd482fb gdk: Use X11 API only when running under X11
Avoid using GdkX11Screen API when the GDK backend being used is not the
X11 one.

https://bugzilla.gnome.org/show_bug.cgi?id=752143
2015-07-09 14:34:11 +01:00
Carlos Garnacho
2105055a34 gdk: Enable GDK_TOUCH_MASK on the stage window
This allows touch events to be received and translated.

https://bugzilla.gnome.org/show_bug.cgi?id=750496
2015-06-11 15:06:55 +01:00
Carlos Garnacho
7ed3714a94 gdk: Ignore synthesized leave events out of touch events
Certain crossing modes notify about synthesized events, where
the pointer didn't really leave the window. Unsetting the stage
from the device at that time is incorrect, and will leave all
remaining touches unable to pick coordinates, so silently eaten
away.

https://bugzilla.gnome.org/show_bug.cgi?id=750496
2015-06-11 15:06:55 +01:00
Emmanuele Bassi
2d5b5aa82a gdk: Add function to retrieve the GdkVisual
Straight from Cogl.

This allows us to propagate the GdkVisual Cogl and Clutter use to
embedding toolkits, like GTK+.

The function is annotated as being added to the 1.22 development
cycle because it will be backported to the stable branch, so that
downstream developers can package up a version of Clutter that does
not crash on nVidia.

https://bugzilla.gnome.org/show_bug.cgi?id=747489
2015-06-10 19:09:21 +01:00
Emmanuele Bassi
c91621e8c2 gdk: Use the Cogl visual on Xlib winsys
GDK 3.16 started selecting different visuals, to best comply with the
requirements for OpenGL, and this has broken Clutter on GLX drivers that
are fairly picky in how they select visuals and GLXFBConfig.

GDK selects GLXFBConfig that do not include depth or stencil buffers;
Cogl, on the other hand, needs both depth and stencil buffers, and keeps
selecting the first available visual, assuming that the GLX driver will
give us the best compliant one, as per specification. Sadly, some
drivers will return incompatible configurations, and then bomb out when
you try to embed Clutter inside GTK+, because of mismatched visuals.

Cogl has an old, deprecated, Clutter-only API that allows us to retrieve
the XVisualInfo mapping to the GLXFBConfig it uses; this means we should
look up the GdkVisual for it when creating our own GdkWindows, instead
of relying on the RGBA and system GdkVisuals exposed by GDK — at least
on X11.

https://bugzilla.gnome.org/show_bug.cgi?id=747489
2015-06-10 19:06:25 +01:00
Emmanuele Bassi
896e43cbd5 gdk/device: Propagate more device details from GDK
In order to do device matching we need to propagate more information,
like the device_id (only on X11 with the XInput2 extension enabled),
the vendor id, and the product id.

https://bugzilla.gnome.org/show_bug.cgi?id=747951
2015-06-03 13:08:01 +01:00
Dima Ryazanov
71743ef660 Fix a compile error when the X11 backend is disabled
When defining clutter_stage_gdk_update_foreign_event_mask, check for the
same macros as when actually using it.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
2015-05-29 10:13:03 +01:00
Matthieu Bouron
8aea8bc463 clutter-backend-gdk: Only set setting on successful gdk_screen_get_setting call
It could happen that gdk_screen_get_setting fails to retreive
Gdk/WindowScalingFactor which leads to the following warnings when
clutter_init is called:

GLib-GObject-WARNING **: value "0" of type 'gint' is invalid or out of range for property 'window-scaling-factor' of type 'gint'
GLib-GObject-WARNING **: value "0" of type 'gint' is invalid or out of range for property 'dnd-drag-threshold' of type 'gint'

https://bugzilla.gnome.org/show_bug.cgi?id=749256

Slightly edited to fix up whitespace issues.

Edited-by: Emmanuele Bassi <ebassi@gnome.org>
2015-05-12 11:14:14 +01:00
Emmanuele Bassi
8fc8a73580 gdk: Use RGBA visual if there is one
The condition check for the has_rgba_visual flag is reversed, and thus
we relied on drivers returning an ARGB visual first by default.

Referenced by: https://bugzilla.redhat.com/show_bug.cgi?id=1206960
2015-05-07 13:28:33 +01:00
Emmanuele Bassi
505801cd09 gdk: Fix stage removal from the master clock
Prevents a double-free in the conformance test suite.
2015-03-23 13:24:44 +00:00
Emmanuele Bassi
4f8643cea3 gdk: Fix mapping between frame clock and stages
While each stage has at most a GdkFrameClock, the same GdkFrameClock
instance may drive multiple stages per frame. This means that the
mapping between a GdkFrameClock and a ClutterStage is a 1:M one, not a
1:1.

We should store a list of stages associated to each frame clock
instance, so that we can iterate over it when we need to update the
stages.

This commit fixes redraws of applications using multiple stages,
especially when using clutter-gtk.
2015-03-23 11:00:00 +00:00
Emmanuele Bassi
253292802c Drop the UProf dependency
Nobody has been compiling Clutter with profiling enabled in a long time.

UProf itself hasn't been updated in 5 years, and it still depends on
deprecated components like dbus-glib, with no port to GDBus in sight.

The profiling code was moderately useful in the past, but these days
it's probably better to profile Cogl than Clutter itself; timing
information can be extracted by the timestamp on each diagnostic message
that is now available by default in the CLUTTER_NOTE macro, and we can
add ad hoc counters where needed.
2015-03-03 17:44:15 +00:00
Emmanuele Bassi
3b98103b72 gdk/stage: Warn if CoglContext is not available
Instead of crashing inside Cogl later on.

https://bugzilla.gnome.org/show_bug.cgi?id=745229
2015-03-02 16:08:18 +00:00
Lionel Landwerlin
a4d0b157b6 gdk: master-clock: force scheduling new frames for timelines alive
As long as we have timelines alive, we need to keep asking the
GdkFrameClock for new frames. Otherwise animations might stall.

https://bugzilla.gnome.org/show_bug.cgi?id=744684
2015-02-18 11:37:53 +00:00
Lionel Landwerlin
018cd7bb5c gdk: implement a MasterClock based on GdkFrameClock
https://bugzilla.gnome.org/show_bug.cgi?id=744668
2015-02-17 19:12:40 +00:00
Rui Matos
b192ad1300 gdk: Disable cogl wayland event dispatching if requested
If gdk event retrieval has been disabled and gdk's backend is wayland
we must also disable cogl's wayland event dispatching otherwise cogl
will try to dispatch wayland events itself which blocks the main
loop.

https://bugzilla.gnome.org/show_bug.cgi?id=744058
2015-02-05 18:31:44 +01:00
Lionel Landwerlin
c185d2187b gdk: report an error when initialization fails
https://bugzilla.gnome.org/show_bug.cgi?id=743355
2015-01-22 17:35:14 +00:00
Emmanuele Bassi
8859ed44e1 gdk: Support GdkWayland
We need to set up the Wayland display when using GDK and Wayland's
client-side API.
2015-01-12 17:48:04 +00:00
Emmanuele Bassi
00efa5371d gdk: Compare integer values
Stage sizes are always pixel aligned, so we can do a proper
integer comparison.
2015-01-12 15:05:02 +00:00
Emmanuele Bassi
2aac32694c gdk: Implement get_scale_factor()
Otherwise scaling will not work correctly.
2015-01-12 15:04:27 +00:00
Emmanuele Bassi
54efcf0e90 gdk: Use non-deprecated GdkCursor API
The non-display safe variant has been deprecated in GTK+ 3.15.
2014-12-03 12:11:55 +00:00
Emmanuele Bassi
7d7eb8aabd gdk: Disable deprecation warnings
We don't want to break the build because GDK deprecated some symbol.
2014-12-03 12:07:06 +00:00
Bastien Nocera
908aedbacc gdk: Add window-scaling-factor support
So that we follow GDK's idea of a scaling factor for Clutter.

https://bugzilla.gnome.org/show_bug.cgi?id=734480
2014-09-03 14:21:08 +01:00
Adel Gadllah
cfcba18684 clutter-settings: Mark window-scaling-factor as fixed when set by the app
When an application sets the scaling factor manually we should mark it as fixed
and not override it when the xsettings change. This matches GDKs behaviour.

In order for this to work we cannot use the same path when setting the value
internally so introduce a _clutter_settings_set_property_internal and use it
for that.

https://bugzilla.gnome.org/show_bug.cgi?id=735244
2014-08-23 14:02:56 +02:00
Lionel Landwerlin
ad18f2a996 backend: gdk: add support for foreign windows on wayland
https://bugzilla.gnome.org/show_bug.cgi?id=734935
2014-08-17 16:55:10 +01:00
Lionel Landwerlin
ccd2054fda backend: gdk: add translation code for touch events
https://bugzilla.gnome.org/show_bug.cgi?id=734934
2014-08-17 16:55:10 +01:00
Emmanuele Bassi
f12c174d72 Remove unused internal 'in-resize' flag
A remnant of days gone by.
2014-08-15 12:07:48 +01:00
Emmanuele Bassi
53a86e91d9 Annotate symbols in backend-specific headers
Like we did for the rest of the API.
2014-03-17 19:26:49 +00:00
Rui Matos
e70a0109f2 Avoid needless event copies when queueing from a backend to a stage
All backends follow the same pattern of queueing events first in
ClutterMainContext, then copying them to a ClutterStage queue and
immediately free them. Instead, we can just pass ownership of events
directly to ClutterStage thus avoiding the allocation and copy in
between.

https://bugzilla.gnome.org/show_bug.cgi?id=711857
2014-03-15 19:44:57 +00:00
Neil Roberts
0cef63b837 win32: Disable event retrieval in Cogl
Since commit 4543ed6ac3 in Cogl, Cogl will now try to consume
Windows message itself. This doesn't really cause any problems because
both message loops just call DispatchMessage which will cause the
message to be routed through Clutter's window procedure either way.
However, it's not great to have two sources listening for messages so
this patch disables Cogl's message retrieval.

https://bugzilla.gnome.org/show_bug.cgi?id=701356
2013-07-12 17:59:54 +01:00
Emmanuele Bassi
5a061ed4a3 gdk: Replace deprecated Cogl API 2013-07-03 18:35:44 +01:00
Damien Lespiau
3e479a3326 cogl: Don't use cogl_xlib_set_diplay()
This function is deprecated and has been replaced by set_display() on
the renderer. This is done in the get_renderer() vfunc of both the x11
and gdk backends already.

Actually cogl_xlib_set_diplay() is now a no-op and can be safely removed.

https://bugzilla.gnome.org/show_bug.cgi?id=687652
2013-02-20 23:06:28 +00:00
Jasper St. Pierre
2034f1677d gdk: Fix realization in the foreign-window case
Found by Coverity.

https://bugzilla.gnome.org/show_bug.cgi?id=689496
2012-12-02 14:50:54 -05:00
Emmanuele Bassi
d6b8dfb694 gdk: Fix include 2012-09-03 22:34:52 +01:00
Tomeu Vizoso
d5332d1e4c stage: Remove tracking input devices, it's not used
https://bugzilla.gnome.org/show_bug.cgi?id=683126
2012-09-03 21:50:19 +01:00
Emmanuele Bassi
fc04f015a6 gdk: Fix compilation on non-X11 platforms
The GDK backend may not work on non-X11 platforms, yet, but it's not a
good reason to let it introduce random build breakage.
2012-07-29 13:39:13 +01:00
Emmanuele Bassi
0e4c6d0a87 Deprecate clutter_threads_enter()/leave()
Acquiring the Clutter lock to mark critical sections is not portable,
and not recommended to implement threaded applications with Clutter.

The recommended pattern is to use worker threads, and schedule UI
updates inside idle or timeout handlers within the main loop. We should
enforce this pattern by deprecating the threads_enter()/leave()
functions. For compatibility concerns, we need internal API to acquire
the main lock during frame processing dispatch.

https://bugzilla.gnome.org/show_bug.cgi?id=679450
2012-07-11 13:22:19 +01:00
Chun-wei Fan
ef1860d71d Bug 676150 GDK: Fix build on Windows
-Don't include unistd.h and stdint.h unconditionally as not all Windows
 compilers have them around.
-Only include cogl/cogl-xlib.h when it is really supported by Cogl and GDK.
-sys/ioctl.h is not available on Windows (MinGW/MSVC).
-Correct the call to cogl_renderer_set_winsys_id:
 (backend_cogl->cogl_renderer, COGL_WINSYS_ID_WGL) ->
 (renderer, COGL_WINSYS_ID_WGL)
2012-05-21 23:01:23 +08:00
Emmanuele Bassi
26d8ad7479 Be resilient in case there is no device manager
It's possible to run Clutter with the 'null' input backend, which means
that clutter_device_manager_get_default() may return NULL. In the future
we may add a default dummy device manager, but right now it's safer to
just add a simple NULL check in the places where we ask for the device
manager.
2012-04-26 13:56:00 +01:00
Emmanuele Bassi
ab3582be1c gdk: Relay scroll delta from GDK 2012-03-19 14:29:23 +00:00
Stefano Facchini
ac6ce79aa3 gdk: add new device types (GDK_SOURCE_TOUCHSCREEN, GDK_SOURCE_TOUCHPAD)
https://bugzilla.gnome.org/show_bug.cgi?id=671779
2012-03-12 13:19:34 +01:00
Emmanuele Bassi
9bc8c05db8 gdk: Add missing declaration of clutter_gdk_get_default_display() 2012-03-07 12:36:42 +00:00
Emmanuele Bassi
39a75436bf docs: Documentation fixes 2012-02-23 12:01:11 +00:00
Emmanuele Bassi
8c184f53cb gdk: Use the Stage state tracking 2012-01-26 08:31:11 +00:00
Emmanuele Bassi
17c89bd0a0 backend: Clean up the device manager creation
Create the device manager during the event initialization, where it
makes sense.

This allows us to get rid of the per-backend get_device_manager()
virtual function, and just store the DeviceManager pointer into the
ClutterBackend structure.
2011-11-10 14:55:03 +00:00
Emmanuele Bassi
cd1e8da07f */backend: Clean up the stage creation
Use the default implementation of create_stage() wherever possible.
2011-11-10 14:55:03 +00:00