Commit Graph

189 Commits

Author SHA1 Message Date
Carlos Garnacho
3e1e02c2bc GdkDisplay: Add a few ignore deprecations statements around GdkDeviceManager
There's places where we still need to deal with floating devices, which are
unseen by seats. Ignore deprecations and keep using GdkDeviceManager until
we can forget about floating devices.
2015-12-16 19:47:06 +01:00
Carlos Garnacho
644fa138c3 GdkDisplay: Iterate through seats' pointers/keyboards in older grab functions
Instead of using the GdkDeviceManager.
2015-12-16 19:47:06 +01:00
Carlos Garnacho
4065bd1e96 gdk: Deprecate GdkDeviceManager and gdk_device_grab/ungrab()
GdkSeat is now the preferred way to deal with input devices and grabs.

https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:40:21 +01:00
Carlos Garnacho
8ec3fb39a2 GdkDisplay: Add ::seat-added/removed signals
These will be emitted as seats come and go.

https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:40:21 +01:00
Carlos Garnacho
6f4edc091b GdkDisplay: Add GdkSeat getters
https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:16:15 +01:00
Robert Ancell
aefa1ba611 gdk: Deprecate gdk_display_get_screen 2015-10-27 14:17:52 +13:00
Matthias Clasen
9f24b54786 Code cleanup
Use g_slist_free_full more consistently. This commit just converts
the obvious cases where g_slist_forall is directly followed by
g_slist_free.
2015-07-31 22:23:35 -04:00
Matthias Clasen
d9b02ea4a3 gdk: Make debug-updates a per-display setting
Add private API to set this per-display, and make the existing
gdk_window_set_debug_update function set a global default.
2014-11-10 15:23:14 -05:00
Matthias Clasen
5536d9bcde gdk: Add private API for rendering mode
This will be used to expose rendering mode in the inspector.
2014-11-10 14:39:57 -05:00
Matthias Clasen
8338b7e4cd Move rendering mode into GdkDisplay
This is in preparation for making it runtime-settable in the
inspector.
2014-11-10 14:28:43 -05:00
Emmanuele Bassi
eedbec2066 Make global GDK libgtk_only functions more private
The current way of exposing GDK API that should be considered internal
to GTK+ is to append a 'libgtk_only' suffix to the function name; this
is not really safe.

GLib has been using a slightly different approach: a private table of
function pointers, and a macro that allows accessing the desired symbol
inside that vtable.

We can copy the approach, and deprecate the 'libgtk_only' symbols in
lieu of outright removal.

https://bugzilla.gnome.org/show_bug.cgi?id=739781
2014-11-08 00:20:15 -05:00
Alexander Larsson
fb50015519 GdkGLContext: Change the way we track the current context
To properly support multithreaded use we use a global GPrivate
to track the current context. Since we also don't need to track
the current context on the display we move gdk_display_destroy_gl_context
to GdkGLContext::discard.
2014-10-30 12:43:03 +01:00
Jasper St. Pierre
887b7356c3 gdkdisplay: Provide a default event_data_copy / event_data_free
Every single implementation but Quartz is a no-op for this, so just
provide it once rather than in every backend.
2014-10-27 22:13:23 -07:00
Alexander Larsson
fdeb4f8c16 gl: Make gdk_gl_context_make_current() return void
Its not really reasonable to handle failures to make_current, it
basically only happens if you pass invalid arguments to it, and
thats not something we trap on similar things on the X drawing side.

If GL is not supported that should be handled by the context creation
failing, and anything going wrong after that is essentially a critical
(or an async X error).
2014-10-13 10:43:32 -04:00
Alexander Larsson
038aac6275 gdk: Add support for OpenGL
This adds the new type GdkGLContext that wraps an OpenGL context for a
particular native window. It also adds support for the gdk paint
machinery to use OpenGL to draw everything. As soon as anyone creates
a GL context for a native window we create a "paint context" for that
GdkWindow and switch to using GL for painting it.

This commit contains only an implementation for X11 (using GLX).

The way painting works is that all client gl contexts draw into
offscreen buffers rather than directly to the back buffer, and the
way something gets onto the window is by using gdk_cairo_draw_from_gl()
to draw part of that buffer onto the draw cairo context.

As a fallback (if we're doing redirected drawing or some effect like a
cairo_push_group()) we read back the gl buffer into memory and composite
using cairo. This means that GL rendering works in all cases, including
rendering to a PDF. However, this is not particularly fast.

In the *typical* case, where we're drawing directly to the window in
the regular paint loop we hit the fast path. The fast path uses opengl
to draw the buffer to the window back buffer, either by blitting or
texturing. Then we track the region that was drawn, and when the draw
ends we paint the normal cairo surface to the window (using
texture-from-pixmap in the X11 case, or texture from cairo image
otherwise) in the regions where there is no gl painted.

There are some complexities wrt layering of gl and cairo areas though:
* We track via gdk_window_mark_paint_from_clip() whenever gtk is
  painting over a region we previously rendered with opengl
  (flushed_region). This area (needs_blend_region) is blended
  rather than copied at the end of the frame.
* If we're drawing a gl texture with alpha we first copy the current
  cairo_surface inside the target region to the back buffer before
  we blend over it.

These two operations allow us full stacking of transparent gl and cairo
regions.
2014-10-13 10:43:31 -04:00
Benjamin Otte
508d31fe70 gdk: Deprecate compositing support
We might want to remove support for it completely and always return
FALSE.
2014-10-12 04:54:35 +02:00
Evan Nemerson
38d2458f53 gdk: add many missing (nullable) return value annotations
https://bugzilla.gnome.org/show_bug.cgi?id=729834
2014-05-11 11:48:32 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
63e887e165 docs: replace all <examples> with markdown headings 2014-02-04 16:58:54 -05:00
William Jon McCann
9f99f567c8 docs: use markdown instead of inlinegraphic tags 2014-02-04 16:58:53 -05:00
William Jon McCann
8d6717097c docs: Use markdown for ulinks 2014-02-04 16:58:53 -05:00
Matthias Clasen
30cc1512e6 Docs: Use markdown for lists
This greatly reduces the amount of xml in the docs.
2014-02-02 01:07:39 -05:00
William Jon McCann
4c8bd8e7cf docs: Identify examples that are C code
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
768bc44081 docs: use |[ ]| instead of <programlisting></programlisting>
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
2d003553e8 docs: don't use <emphasis>
It is a little heavy handed. The text can speak for itself.
2014-01-28 02:02:05 -05:00
Volker Sobek
a4d69e7f14 docs/comments: Fix spelling of 'explicitly'
This replaces all occurrences of 'explicitely' with 'explicitly'. Only
code comments and gtk-doc statements are affected.

https://bugzilla.gnome.org/show_bug.cgi?id=722429
2014-01-18 03:47:46 +01:00
Owen W. Taylor
f50a3af1b7 Handle recursion from motion event handlers
If a motion event handler (or other handler running from the flush-events
phase of the frame clock) recursed the main loop then flushing wouldn't
complete until after the recursed main loop returned, and various aspects
of the state would get out of sync.

To fix this, change flushing of the event queue to simply mark events as
ready to flush, and let normal event delivery handle the rest.

https://bugzilla.gnome.org/show_bug.cgi?id=705176
2013-11-11 23:17:14 -05:00
Alexander Larsson
e8b38fedbd gdk: Convert mouse position to doubles, add new getters
We've long had double precision mouse coordinates on wayland (e.g.
when rotating a window) but with the new scaling we even have it on
X (and, its also in Xinput2), so convert all the internal mouse/device
position getters to use doubles and add new accessors for the
public APIs that take doubles instead of ints.
2013-07-03 14:39:25 +02:00
Benjamin Otte
01c6ecfb78 display: Add display to displaymanager later
Instead of GdkDisplay::init, only add the display to the display manager
in GdkDisplay::opened. This avoids spurious changes of the default
display in gtk_init() when we're trying to find the one that works and
try to open lots of different ones.
2013-04-19 16:18:25 -04:00
Benjamin Otte
c86ac95ebf display: Make opened signal have a vfunc
... instead of g_signal_connect()ing in every init function.
2013-04-19 16:18:25 -04:00
Benjamin Otte
7ef508ff4a displaymanager: Handle list of displays in base class
This moves the add/remove_display() functions from the subclasses to
GdkDisplay and GdkDisplayManager. It also gets rid of the list_displays
vfunc.
2013-04-15 15:43:26 +02:00
Benjamin Otte
f7c0b025b9 displaymanager: Move set_default_display vfunc
... to GdkDisplayClass.make_default. It's only implemented by X11
anyway.
2013-04-15 15:43:26 +02:00
Benjamin Otte
ae2208cd5d gdk: Deprecate gdk_display_get_n_screens() 2013-04-06 10:47:55 +02:00
Rob Bradford
000ed99f3d gdkdisplay: Warn if asked for a non-zero screen not a zero screen
Following on from a6b29d73 this commit correctly warn if you try and use
deprecated multiple screen behaviour.
2013-04-02 12:04:22 +01:00
Benjamin Otte
a6b29d73d7 gdkdisplay: Remove get_screen() and get_n_screens() vfuncs 2013-04-02 11:45:44 +02:00
Benjamin Otte
cb2c47597e gdk: Shuffle code around
Make implementation, header and documentation be at the correct place.
2013-04-01 14:20:46 +02:00
Owen W. Taylor
e4aa9f05ae GdkDisplay: handle multiple calls to _gdk_display_pause_events()
Since events can be paused independently for each window during processing,
make _gdk_display_pause_events() count how many times it is called
and only unpause when unpause_events() is called the same number of
times.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:50 -05:00
Owen W. Taylor
d446dda920 gdk_display_get_event: don't unqueue events from the windowing system when paused
Unqueuing events from the windowing system when paused could result
in weird reordering if event filters resulted in application-visible
behavior. Since we now resume events when the frame clock is frozen,
we now no longer count on low-level event handling running while
event handling is paused.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:50 -05:00
Owen W. Taylor
a69285da08 Compress motion synchronized with the paint cycle
When we have pending motion events, instead of delivering them
directly, request the new FLUSH_EVENTS phase of the frame clock.
This allows us to compress repeated motion events sent to the
same window.

In the FLUSH_EVENTS phase, which occur at priority GDK_PRIORITY_EVENTS + 1,
we deliver any pending motion events then turn off event delivery
until the end of the next frame. Turning off event delivery means
that we'll reliably paint the compressed motion events even if more
have arrived.

Add a motion-compression test case which demonstrates behavior when
an application takes too long handle motion events. It is unusable
without this patch but behaves fine with the patch.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:49 -05:00
Carlos Garnacho
3210cd6511 gdk: strengthen touch crossing event synthesizing on programmatical crossings
There are cases where crossing events aren't generated by input devices themselves
but rather through programmatical means (windows being moved/hidden/destroyed while
the pointer is on top).

Those events come from X as sourceid=deviceid, and GDK does its deal at lessening
this by setting a meaningful source device on such events, although this caused
some confusion on the mechanism to block/synthesize touch crossing events that
could possibly cause bogus enter events on the new window below the pointer.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691572
2013-01-15 17:48:56 +01:00
Marc-André Lureau
4884a7c1af gdk: do not send leave event on touchpad button release
This is along the changes introduced in
bd55519f7e,
A TOUCHPAD device behaves like a mouse"

https://bugzilla.gnome.org/show_bug.cgi?id=674549
2012-05-05 14:39:37 -04:00
Matthias Clasen
050cba6a31 Fix malformed doc comments
Most of these are forgotten :'s and similar details
which gtk-doc now warns about.
2012-04-12 21:12:16 -04:00
Carlos Garnacho
b897ba0cd8 gdk: Don't fully destroy the implicit touch grab on ::grab-broken
the backing GdkTouchGrabInfo will be needed if the overriding device
grab finishes before the touch does in order to send events back to
the implicit grab window. Instead, wait until the touch is physically
finished before removing the matching GdkTouchGrabInfo
2012-03-01 16:25:26 -05:00
Carlos Garnacho
c72a77b04c gdk: handle implicit touch grabs
If the touch sequence happens on a window with GDK_TOUCH_MASK set,
a GdkTouchGrabInfo is created to back it up. Else a device grab is
only created if the sequence emulates the pointer.

If both a device and a touch grab are present on a window, the later
of them both is obeyed, Any grab on the device happening after a
touch grab generates grab-broken on all the windows an implicit
touch grab was going on.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
b5cfdf2db4 gdk: Add internal API to deal with touch implicit grabs
The necessary information about a touch implicit grab is stored in
GdkTouchGrabInfo structs, these are meant to be transient to the
touch sequence.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
8689921b90 gdk: Generate crossing events around touch devices' press/release
Anytime a touch device interacts, the crossing events generation
will change to a touch mode where only events with mode
GDK_CROSSING_TOUCH_BEGIN/END are handled, and those are sent
around touch begin/end. Those are virtual as the master
device may still stay on the window.

Whenever there is a switch of slave device (the user starts
using another non-touch device), a crossing event with mode
GDK_CROSSING_DEVICE_SWITCH may generated if needed, and the normal
crossing event handling is resumed.
2012-03-01 16:25:21 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00