Commit Graph

1013 Commits

Author SHA1 Message Date
Matthias Clasen
f66a76d998 Document window-icon related api as 'may not work'
Some platforms simply don't have window icons (such as Wayland).
2016-08-24 14:43:58 -04:00
Carlos Garnacho
f1a9cd466e gdk: Address pad events similarly to keyboard events
We want the same treatment for those, the event will be emitted on the
toplevel, which will then decide what to do with the event.

It just doesn't make much sense to propagate those up/down the hierarchy,
when we want specifically one action being triggered from those.

https://bugzilla.gnome.org/show_bug.cgi?id=770026
2016-08-23 21:01:44 +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
Philip Withnall
7b40fdbc21 gdkwindow: Fix potential NULL pointer dereferences in event code
The event code could potentially dereference pointer_info if the
invariant that ENTER_NOTIFY and LEAVE_NOTIFY events are only emitted on
devices which have pointers is violated elsewhere.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2016-08-07 08:17:50 +01:00
William Hua
b3a530cb72 gdkwindow: add gdk_window_move_to_rect ()
https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
William Hua
48108c401e gdkwindow: store transient_for window
https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
William Hua
0a5bee2751 gdkwindow: store shadow sizes
https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
Emmanuele Bassi
b5a2bba840 docs: Improve gdk_window_create_similar_image_surface()
The sizes passed are in device pixels and do not take into account the
scaling factor of the window itself. We cannot change the semantics of
the function, so let's at least add a warning for this trap door.
2016-07-11 16:55:10 +01:00
Emmanuele Bassi
222bcf1a71 gdk: Try harder at tracking drawing contexts
If gdk_cairo_create() is called within a frame draw operation, we can
still associate the Cairo context with a GdkDrawingContext.
2016-06-12 17:27:44 +01:00
Emmanuele Bassi
ddfe3374e3 Avoid a deprecation warning
Some debugging code in GdkWindow still calls gdk_cairo_create().
2016-06-09 21:00:13 +01:00
Emmanuele Bassi
ad78daaf80 gdk: Deprecate gdk_cairo_create()
We have GdkDrawingContext, now, which is in charge of creating Cairo
contexts for drawing on a GdkWindow.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
2d38c40f78 gdk: Explicitly create a cairo context inside GdkDrawingContext
Instead of using gdk_cairo_create(), which we'll soon deprecate.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
c5d0522a23 Deprecate the gdk_window_begin/end_paint family of functions
They are replaced by the more appropriate gdk_window_begin_draw_frame()
and gdk_window_end_draw_frame() functions.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
dda6a0d385 Associate the drawing context to the Cairo context
Instead of associating the GdkWindow that created the GdkDrawingContext
we can directly bind the Cairo context to the GDK drawing context.

Cairo contexts created via gdk_cairo_create() go back to not having a
GdkWindow associated to them, like they did before we introduced the
gdk_window_begin_draw_frame() API.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
a7ef37da2a Add GdkDrawingContext
Instead of giving out Cairo contexts, GdkWindow should provide a
"drawing context", which can then create Cairo contexts on demand; this
allows us to future proof the API for when we're going to use a
different rendering pipeline, like OpenGL.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
fc569f1ac6 Add frame drawing API to GdkWindow
Existing code drawing on a GDK window has to handle the direct drawing
and the buffered drawing by itself, by checking the window type and
whether or not the window is backed by a native windowing surface. After
that, the calling code has to create a Cairo context from the window and
keep an association between the context and the window itself.

This is completely unnecessary: GDK can determine whether or not it
should use a backing store to draw on a GdkWindow as well as create a
Cairo context, and keep track of it.

This allows to simplify the calling code, and enforce some of the
drawing behavior we want to guarantee to users.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
9c3802fc4b gdk: Provide safe fallback for creating GL contexts
If the backend does not override GdkWindowClass.create_gl_context()
then we should provide a fallback that gives an error, instead of
crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=766782
2016-05-23 08:46:53 +01:00
Timm Bäder
f0f8d6d6b0 gdkwindow: Use GList less 2016-05-12 20:40:22 +02: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
Matthias Clasen
e502702dd4 Use a variable consistently 2016-04-30 23:15:20 -04:00
Matthias Clasen
98f16fdf7a Use the new getter
This avoids the use of generic api in the per-event code path.
2016-04-30 20:59:16 -04:00
Carlos Garnacho
358d15ae5e gdk: Make GDK_TOUCH_CANCEL be dealt with similarly to GDK_TOUCH_END
We must emit the cancel event with the same semantics, and towards the GdkWindow
that is currently under the touchpoint, so make proxy_button_event() deal with
GDK_TOUCH_CANCEL.

Fixes the GDK_TOUCH_CANCEL event being emitted only on the toplevel, which is
usually non-sufficient.
2016-04-18 14:14:33 +01:00
Carlos Garnacho
6286883e8d gdk: Forward tools in client-side windows event translation 2016-04-06 15:43:29 +02:00
Alexander Larsson
4c10800bcc gdkwindow: Remove O(n-children) code in gdk_window_invalidate
When we invalidate a window we need to also invalidate all child windows
that are native (non-native are automatically invalidated as we track
invalidation once per native window only). This was done in a pretty
inefficient way, recursing over the entire tree.

This makes the invalidation much faster by only looking at the native
children of the native window we're in, filtering out those that
are not a descendant of the client side window we're interested in.
Given that there are very few native subwindows this is much faster.
2016-03-31 18:56:18 +02:00
Matthias Clasen
4d84e7a8f7 Trivial formatting fix 2016-03-11 21:42:33 -05:00
Paolo Borelli
807c0c0a56 gdkwindow: get the pointer device from the default seat
https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-02-29 14:05:00 +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
Paolo Borelli
72b40266bd gdkwindow: cleanup, avoid direct access to display members 2016-02-28 18:22:42 +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
50859d9efe GdkWindow: 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
ce7bb7c739 GdkWindow: Iterate through seats' pointers/keyboards in older grab functions
Instead of using the GdkDeviceManager.
2015-12-16 19:47:05 +01:00
Carlos Garnacho
c70da9b7ae gdk: Set seat on events generated in common code 2015-12-16 19:47:05 +01:00
Carlos Garnacho
ee549c9ded GdkWindow: Listen to ::seat-removed in order to remove pointer info
Our actions on ::device-removed only actually applied to master
pointers, so listening to GdkDisplay::seat-removed and operating
on the seat pointer is equivalent.
2015-12-15 23:22:00 +01:00
Carlos Garnacho
b4aa498fe7 GdkWindow: Iterate through seats in gdk_window_set_cursor()
And set the pointer on all seat pointers, equivalent to the master
pointer lookup we were performing with GdkDeviceManager
2015-12-15 23:20:40 +01:00
Carlos Garnacho
ff686344c9 GdkWindow: Avoid gdk_device_manager_get_client_pointer()
It's now deprecated
2015-12-15 23:19:49 +01:00
Carlos Garnacho
fc19a999ec gdk: Manage GDK_TOUCH_CANCEL events on gdk_windowing_got_event()
These events must get active/implicit grabs undone, and can be done
on client-side code.

https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:40:21 +01:00
Matthias Clasen
268c7a3e44 gdk: Allow passing the start coordinates in drag_begin
Add a variant of gdk_drag_begin that takes the start position
in addition to the device. All backend implementation have been
updated to accept (and ignore) the new arguments.

Subsequent commits will make use of the data in some backends.
2015-12-13 10:39:43 -05:00
Alexander Larsson
09a181d205 gdk: Fix invalidation w/ pixel cache when changing child window geometry.
When moving/scrolling a child window we can't use the current clip
region to limit what is invalidated, because there may be a pixel
cache that listens for changes outside the clip region. Instead
invalidate the entire area and rely on the invalidation code to limit
the repaint to the actually visible area.
2015-11-09 17:06:00 +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
Matthias Clasen
65ec902df9 Remove overhead in gdk_window_get_user_data
This function is called very frequently during in GTK+'s drawing
paths, and thus should not carry unexpected costs.
2015-09-28 06:29:50 -04:00
Alexander Larsson
ee883a2ef5 gdkwindow: Fix list_insert_link_before
We forgot to set prev->next to the new link
2015-09-21 16:59:51 +02:00
Christian Hergert
1c8760c5fa gdkwindow: avoid multiple walking of children list
This counts the number of children and fetches the last GList
node at the same time.
2015-09-14 12:40:12 -07:00
Alexander Larsson
eafedfbaf8 gdkwindow: Avoid list allocation and object refs during repaint
There is no need to ref the windows we're ignoring, so collect and ref
only the affected child windows. Also, use a on-stack array rather
than allocating a linked list.

Also, we don't need to ref during the event emissions too, as we
already hold a ref.

https://bugzilla.gnome.org/show_bug.cgi?id=754687
2015-09-14 11:01:13 +02:00
Alexander Larsson
ea294fd92c gdkwindow: Store children list nodes in GdkWindow structure
This avoids a bunch of allocations, and additionally it has better
cache behaviour, as we don't follow pointers to the separate GList
node memory areas during traversal.

From Christian Hergert:

  This machine is a Retina mac book pro so I've been working on getting
  GtkTextView (GtkPixelCache) up to our performance level on
  X11/Wayland. I'm seeing a jump from about 43 FPS to about 50 FPS.

https://bugzilla.gnome.org/show_bug.cgi?id=754687
2015-09-13 21:48:55 +02:00
Matthias Clasen
2e52310d4b gdk window: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:13:14 -04:00
Matthias Clasen
60c1dbd358 gdk window: Remove an unneeded variable
The G_DEFINE_TYPE macros automate the parent_class handling.
2015-09-06 17:11:33 -04:00
Matthias Clasen
dc79d4f50d Trivial formatting fix 2015-08-28 16:15:26 -04:00
Carlos Garnacho
5092febaf8 gdk: Proxy touchpad events through the client-side window hierarchy
This includes poking the deepmost window, checking for the
GDK_TOUCHPAD_GESTURE_MASK bit set, and translating coordinates in events
accordingly.
2015-08-12 23:20:24 +02:00
Carlos Garnacho
8c2b3930da gdk: Add GDK_TOUCHPAD_GESTURE_MASK to GdkEventMask
Users will need to manually select on this in order to receive gesture
events.
2015-08-12 23:20:24 +02:00
Jeremy Whiting
f9d903995d Added api to set a window to fullscreen on a given monitor.
https://bugzilla.gnome.org/show_bug.cgi?id=752677
2015-07-25 07:08:59 -06:00