Commit Graph

227 Commits

Author SHA1 Message Date
Benjamin Otte
bd6b6ed93c gdk: Remove VisibilityNotify events 2017-11-01 22:00:34 +01:00
Matthias Clasen
f0189aecbc Drop gdk_event_set/get_screen
These functions have been replaced by display variants.
2017-10-30 22:22:00 -04:00
Matthias Clasen
c74ee7a159 Add gdk_event_get/set_display
The GdkScreen apis are going away, this is a replacement.
2017-10-30 22:22:00 -04:00
Matthias Clasen
209f24f962 Remove gdk_setting_get
This is a minor convenience api, and it is unused.
2017-10-30 15:31:02 -04:00
Matthias Clasen
10ba84a6a9 gdk: Drop settings events
We are not emitting these events anymore, so lets remove them
from the api. The GdkSettingAction enum is moved to xsettings-client.c
where its only use remains.
2017-10-30 09:49:02 -04:00
Marc-Antoine Perennou
4808829352 gdk: add accessor for GdkEventOwnerChange::reason
https://bugzilla.gnome.org/show_bug.cgi?id=789198

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-10-19 14:37:28 +02:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Timm Bäder
29dd0a940e GdkEvent: OWNER_CHANGE events have a selection as well 2017-09-28 20:01:01 +02:00
Timm Bäder
74ce20451f GdkEvent: Unref user_data in free
gdk_event_set_user_data refs it and this was creating pretty bad leaks.
2017-09-28 20:01:01 +02:00
Rico Tzschichholz
9f259a7391 gdk: Add g-i annotations for new event getters 2017-09-22 14:18:00 +02:00
Carlos Garnacho
44cb3ccfa1 gdk: Remove motion hints
Motion hints are now literally a thing of the past. Everything should be
using the full motion event stream.
2017-09-19 18:40:51 +02:00
Carlos Garnacho
a9988e18b0 gtk: Remove 2BUTTON and 3BUTTON events and event types
Those should be interpreted by widget-local gestures, not guessed at a
high level with no notions of the specific context. Users will want
GtkGestureMultiPress to replace these events.
2017-09-19 18:40:50 +02:00
Matthias Clasen
7306f55912 Add some more GdkEvent getters 2017-09-19 18:39:03 +02:00
Matthias Clasen
66d8483fdf Add more GdkEvents API 2017-09-19 18:39:02 +02:00
Matthias Clasen
5488009150 Add more getters for event fields 2017-09-19 18:39:02 +02:00
Carlos Garnacho
c7431f46b5 gdk: Make GdkEvent structs/union opaque
All users are forced to deal with events as opaque pointers, only
using API to access the info.
2017-09-19 18:39:02 +02:00
Timm Bäder
b2c0afce34 Remove gdk_event_get_user_data from public headers
And add it back in gdk-private.h
2017-08-19 08:53:38 +02:00
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