Commit Graph

210 Commits

Author SHA1 Message Date
Timm Bäder
34fdc51392 Constify GdkEvent parameters in gtk_get_event_widget and _event_target 2017-05-25 16:25:59 +02:00
Carlos Garnacho
65de0ebea3 gdk: Make it possible to attach user data to GdkEvents
As event->any.window is the toplevel, this is not useful anymore to
determine the window/widget that is the target for this event. Add
helper functions to attach user data to GdkEvents so the target
widget can be stored on the gtk/ side.

These calls should be made private with the rest of GdkEvent related
API.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
799428aaea gdk: Add gdk_event_set_coords() method
A helper function basically for gtk+, so coordinates can be translated
in place depending on the widget it's being delivered to.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
0dcb9b316e gdk: Add pad event structs, enum values, and event mask bit
GDK_PAD_BUTTON*,RING and STRIP will be emitted respectively when
pad buttons, rings or strips are interacted with. Each of those
pad components belong to a group (a pad can contain several of
those), which may be in a given mode. All this information is
contained in the event.

GDK_PAD_GROUP_MODE is emitted when a group in the pad switches
mode, which will generally result in a different set of actions
being triggered from the same buttons/rings/strips in the group.

https://bugzilla.gnome.org/show_bug.cgi?id=770026
2016-08-23 21:01:44 +02:00
Matthias Clasen
49d5c9ed14 Forgotten rename 2016-05-10 15:32:25 -04:00
Matthias Clasen
4add8f3b63 Document new api 2016-05-10 15:22:35 -04:00
Matthias Clasen
0f476590fb Make gdk_event_get_pointer_emulated public
There is not strong reason to keep the getter private.
At the same time, strip _-prefixes from a few other GdkEvent
APIs. Update all callers.
2016-05-10 15:16:45 -04:00
Carlos Garnacho
cb6b5e4017 gdkevents: Free motion events discarded by motion compression
Those should be freed together with their list link.
2016-05-01 20:05:56 +02:00
Matthias Clasen
a7ee3a6d80 Small docs improvement
Cross reference from gdk_event_get_keycode to
gdk_event_get_scancode.
2016-05-01 13:26:35 -04:00
Matthias Clasen
8041c012fe Drop unused macros
These have been sitting here forever, unused. Time to drop them
2016-05-01 13:26:35 -04:00
Matthias Clasen
7a7e3fc0e3 Ad d new API to the docs 2016-04-21 22:55:57 -04:00
Frediano Ziglio
cf14fea5a8 Save scancode inside GdkEventPrivate
Windows save in hardware_keycode an information which is not so low
level and some application require the hardware scancode.
As Windows provides this information save it in GdkEventPrivate
and provide a function to get this information.
For no Windows system the function return the hardware_keycode instead.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=765259
2016-04-21 22:35:47 -04:00
Carlos Garnacho
6d73e75153 events: Add gdk_event_[gs]et_device_tool()
This getter/setter will manage the tool pointer in GdkEventPrivate. The
setter should be most notably used by backends.
2016-04-06 15:43:29 +02:00
Carlos Garnacho
2923f69d3c gdkdnd: Add private means to commit the drag status
The way gdk_drag_status() may be called multiple times during the
processing of drag and drop events throughout the widget hierarchy
brings some superfluous messaging going in, esp. when it's the last
request the one we want to honor, yet we emit messaging requests on
all.

This is barely appreciable in the X11 backend, but due to the design
of the wayland protocol, quick series of changes like this it have
some self-amplificating consequences which may end up flooding the
connection.

We can delegate this to a late "commit" call, performed within GDK
event management. This way gdk_drag_status() calls may be cached
and only result in windowing messaging once per ::drag-motion or
::drag-data-received event. Emitting the final status will also
avoid spurious action changes on the compositor and the other peer.

https://bugzilla.gnome.org/show_bug.cgi?id=763298
2016-03-14 16:50:36 +01:00
Jonas Ådahl
f8bbbbf684 gdk: Don't leak discarded window state event
When compressing window state events, we didn't free the discarded
event after removing it from the queue, causing us to leak it. This
commit makes sure to free the discarded event after unqueuing it.

https://bugzilla.gnome.org/show_bug.cgi?id=762468
2016-03-11 07:11:34 -05:00
Jonas Ådahl
9e2207b2b0 gdk: Compress window state events
If there are already a window state event for a given window queued
when the window state is changed, drop that event and queue a new event
with a changed_mask based on the state before last event that was queue
without compression.

https://bugzilla.gnome.org/show_bug.cgi?id=762468
2016-03-02 10:22:17 +08:00
Paolo Borelli
187027942c gdk: remove _gdk_event_queue_prepend
It is never used
2016-02-28 19:05:53 +01:00
Matthias Clasen
1c887b2287 gdk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Carlos Garnacho
4ff3d5b7a6 gdk: Avoid 2/3BUTTON event generation if the source device changes
Remember the last source device we're generating multiple clicks for,
just so we can bail out if the device changed. That will just reset
the counting.

https://bugzilla.gnome.org/show_bug.cgi?id=723659
2016-02-23 20:35:01 -05:00
Carlos Garnacho
f6b8fb5a6b gdk: Run DnD internal handlers before the main event handler
We'll be stealing those to GTK+, if the GdkDragContext manages
the DnD operation.
2016-01-19 14:17:35 +01:00
Peter Hutterer
48aa1bb08f wayland: add gdk_event_is_scroll_stop_event()
And use it to handle kinetic scrolling in the GtkScrolledWindow.

However, dropping the delta check causes the X11-based kinetic
scroll to break since we don't have the stop event here. Correct handling of
xf86-input-libinput-based scroll events is still being discussed.

https://bugzilla.gnome.org/show_bug.cgi?id=756729
2016-01-18 21:36:23 +01:00
Carlos Garnacho
7a926cc7e0 gdkevents: Fallback to the event device seat
There's places where we don't set a seat yet, plus the places
outside GTK+ where events are created, we should warn and fall
back to the master device seat with these.
2015-12-16 19:47:05 +01:00
Carlos Garnacho
b0d72a36d8 gdkevents: Ensure the seat data is copied in events 2015-12-16 19:47:05 +01:00
Cosimo Cecchi
990dc9961a gdkevents: fix a compiler warning 2015-12-16 10:35:46 -08:00
Carlos Garnacho
47632df9a5 gdkevents: Avoid gdk_device_manager_get_client_pointer()
It's now deprecated.
2015-12-15 23:24:59 +01:00
Carlos Garnacho
da6d52711a GdkEvent: Add GdkSeat getter and internal setter
https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:16:15 +01:00
Matthias Clasen
ffa98cbfa5 Don't use g_slist_next in gdk
We generally just use ->next directly.
2015-10-20 06:14:57 -04:00
Carlos Garnacho
25557c1c5d gdkevent: Hold refs to device/source_device
The extra reference will be held from GdkEventPrivate data, so there's
a common place to all events. Without this, events queued after devices/
capabilities disappear (eg. on TTY switch) might hold invalid pointers.
Windowing level operations on those devices (queries, grabs...) are
expected to fail at that time, but we should hold meaningful data for
the regular event handling paths.

https://bugzilla.gnome.org/show_bug.cgi?id=753185
2015-08-19 22:13:08 +02:00
Carlos Garnacho
a3b402a949 gdk: Add touchpad gesture events and event types.
Each gesture type has its separate GdkEvent struct, and begin/update/
end/cancel event types.

There is support for multi-finger swipe (3-4 fingers), and 2-finger
rotate/pinch gestures.
2015-08-12 23:20:24 +02:00
Carlos Garnacho
76c1337675 GdkEvent: Turn out parameters optional
As pointed out by lazka in IRC, /me clearly out of phase after allow-none.
2015-07-24 14:42:34 +02:00
Carlos Garnacho
dc9e54887a GdkEvent: Fix introspection annotations on gdk_event_get(_root)_coords
These functions respect NULLs being passed, so the return values are
(nullable).
2015-07-24 13:44:22 +02:00
Matthias Clasen
1a3bdefb00 Fix an ordering issue in event destruction
gdk_event_get_display accesses event->any.window, so don't
free that window first thing.
2014-11-01 14:44:03 -04:00
Jasper St. Pierre
bbe9ef20da gdkevents: Use the correct display to copy event data 2014-10-27 22:29:41 -07:00
Matthias Clasen
5334fb8921 Drop GDK_MULTIHEAD_SAFE
We don't support multiple screens anymore, so there is no need
for marking API as multihead safe any longer.
2014-06-11 21:55:15 -04:00
Carlos Garnacho
0d4e75f078 gdk: Make GdkEventSequence a boxed type
Not much to copy nor free, but this'll make bindings happy
2014-05-23 19:54:33 +02:00
Evan Nemerson
701adf81b6 gdk: assorted introspection and documentation fixes
https://bugzilla.gnome.org/show_bug.cgi?id=729983
2014-05-19 11:47:59 -07:00
Jasper St. Pierre
c1efc4ad7b gdk: Add new _gdk_set_window_state
Wayland's mechanism tells us all of our new states, rather than
telling us which ones were added and removed. Add a new private
interface so that we can simply specify the new states as a
bitfield directly rather than having to compute which ones were
added and removed.
2014-05-13 02:39:59 -04: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
c779b42476 Docs: use // for comments in examples
Without sgml mode, we can't escape /* as /&ast; anymore,
so just switch to // for comments in examples.
2014-02-14 23:34:22 -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
0ce016650b docs: Use markup for links 2014-02-07 09:42:12 -05:00
William Jon McCann
47469eb296 Use proper quotes in gdk 2014-02-05 15:08:42 -05:00
William Jon McCann
a22358c0c0 docs: use ` instead of <literal> 2014-02-04 18:24:29 -05:00
William Jon McCann
2dcbe27a06 docs: don't use <option> 2014-02-04 17:48:33 -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
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
William Jon McCann
10f25501f4 docs: fix link to even structures info 2014-01-21 18:57:41 -05: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