Commit Graph

6583 Commits

Author SHA1 Message Date
Rico Tzschichholz
2dc8d1f611 GdkSeat: Fix annotation of gdk_seat_grab() 2016-01-10 16:49:42 +01:00
Matthias Clasen
771149e19a wayland: Ensure we have a dnd-ask cursor
We use this for DND, so make sure that we fall back to some other
cursor if this one isn't present.
2016-01-08 18:11:07 -05:00
Matthias Clasen
04a9b5b5f8 x11: Ensure we have a dnd-ask cursor
We use this for DND, so make sure that we fall back to some other
cursor if this one isn't present.
2016-01-08 18:11:07 -05:00
Carlos Garnacho
ad0fc8ae7e wayland: Force the grab cursor while a grab is active
When a cursor is specified in gdk_seat_grab(), the cursor is reverted as
soon as the pointer enters or leaves another window.

To avoid this issue, store the grab cursor separately, so we force-apply
it in ::set_window_cursor(). Also, unset early the seat info from the
window on gdk_seat_ungrab(), so the next time switch_to_pointer_grab()
happens we end up picking the cursor set for the window underneath the
pointer window.

Based on a patch by Olivier Fourdan <ofourdan@redhat.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=760213
2016-01-08 22:01:25 +01:00
Carlos Garnacho
23b629e27c x11: Initialize GdkWindowAttr struct memory
Valgrind complains about jumps based on uninitialized values
otherwise.
2016-01-08 21:58:33 +01:00
Matthias Clasen
b94f30bb64 Avoid an X error
We are getting the mime data destroy notify called when we
destroy the surface in finalize. Trying to set the XSync counters
at this time is a) pointless and b) yielding an X error because
the counters have already been destroyed.
To avoid this, unhook the damage tracking before destroying
the surface.

https://bugzilla.gnome.org/show_bug.cgi?id=760188
2016-01-08 13:50:46 -05:00
Matthias Clasen
4d60b5b10c x11: Fix damage tracking hack
We are setting mime data with a destroy notify on the cairo
surface to get notified when cairo registers damage for the
surface (in that case, it clears the mime data, calling the
destroy notify). Unfortunately, the destroy notify is also
called when we remove the mime data ourselves, which was
not intentional.

Use a flag in the window impl struct to ignore the callback
when we are clearing the hook.
2016-01-08 13:44:36 -05:00
Matthias Clasen
709cc08603 x11: Simplify drag cancel animation setup
Instead of creating an intermediate pixbuf, just render
the window surface onto the new surface. Doing things this
way lets us avoid the cairo_surface_mark_dirty() call in
gdk_pixbuf_get_from_window(), which is not generally safe
to call on 'random' surfaces - it asserts that the surface
has no mime data attached, and the X11 backend uses mime
data for damage tracking purposes...
2016-01-08 11:33:24 -05:00
Matthias Clasen
ea0084cd99 x11: Keep the drag window alive longer
We destroy the widget that is wrapped around the drag window
when the object data on the drag context gets cleared. Destroying
the window before that happens leads to unpleasantries. E.g. we may
try to access the frame clock, which doesn't exist anymore, and
things go downhill from there. So, keep the window alive for
a little longer.
2016-01-08 11:33:24 -05:00
Matthias Clasen
f9e504d70e wayland: Keep the drag window alive longer
We destroy the widget that is wrapped around the drag window
when the object data on the drag context gets cleared. Destroying
the window before that happens leads to unpleasantries. E.g. we may
try to access the frame clock, which doesn't exist anymore, and
things go downhill from there. So, keep the window alive for
a little longer.
2016-01-08 11:22:47 -05:00
Matthias Clasen
4eb333801b Revert "Translate GDK_KEY_KP_Decimal according to locale"
This reverts commit 7c7fde136e.

Too much controversy for this minor improvement.
See https://bugzilla.gnome.org/show_bug.cgi?id=756751
2016-01-08 08:59:02 -05:00
Olivier Fourdan
120088b15f wayland: Update parent of dialogs without transient
X11 has the notions of "transient for group", and while it's an ICCCM
violation, it's commonly used and documented that a window manager
would treat a window with transient_for set to None to transient for all
windows of its group.

gtk uses this when an application sets a dialog type window but does not
specify an explicit transient.

While this works on X11, there is no such thing as groups in Wayland and
the closest equivalent which is set_parent() in xdg-shell takes only one
parent. This is what is used for modal dialogs.

To get something similar in behavior to what is available on X11, a
solution is to update the parent() of the dialogs without transient when
the active surface changes.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=759161
2016-01-08 11:55:41 +01:00
Olivier Fourdan
28f011eb05 wayland: prefer subsurface when possible
Quite a few applications use GTK_WINDOW_POPUP to create various
temporary windows and place then on screen. That works fine on X11 but
on Wayland there is no global coordinate system for regular surfaces.

If the application is using a gdk temp window and set a parent with
gtk_window_transient_for(), the gdk wayland backend has all it needs to
create a subsurface that can be placed at will by the application.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=759738
2016-01-08 10:33:26 +01:00
Ben Gamari
fa66b271f8 gdkwindow-x11: Ensure that extended update counter is freed
I believe this lead to rampant leakage of SyncCounters by
gnome-terminal.

https://bugzilla.gnome.org/show_bug.cgi?id=760188
2016-01-07 21:13:42 -05:00
Matthias Clasen
10cc35405e wayland: Only do cursor name fallback for standard names
Always returning a left_ptr if we can't find anything better
broke firefox application-specific fallback for missing cursors.
Keep that working by only doing the fallback for the CSS cursor
names, not for things like hashes.

https://bugzilla.gnome.org/show_bug.cgi?id=760141
2016-01-06 14:57:42 -05:00
Matthias Clasen
d9befb9086 x11: Only do cursor name fallback for standard names
Always returning a left_ptr if we can't find anything better
broke firefox application-specific fallback for missing cursors.
Keep that working by only doing the fallback for the CSS cursor
names, not for things like hashes.

https://bugzilla.gnome.org/show_bug.cgi?id=760141
2016-01-06 14:57:42 -05:00
Matthias Clasen
b6e11d087c Add context-menu to the list of standard cursor names
Adwaita doesn't have this one, but we are falling to the
default cursor anyway.
2016-01-06 14:57:42 -05:00
Carlos Garnacho
9290aa7c46 GdkSeat: Use g_intern_static_string() for signal names
https://bugzilla.gnome.org/show_bug.cgi?id=759857
2015-12-25 14:26:58 +01:00
Kjell Ahlstedt
939be8a24b GdkSeat: Add G_BEGIN_DECLS and G_END_DECLS
https://bugzilla.gnome.org/show_bug.cgi?id=759771
2015-12-22 10:33:41 +01:00
Paolo Borelli
7f17468afc W32: avoid code duplication in gdkdevice-win32|virtual
The same get_position function is cut and pasted in the two
classes.
2015-12-22 09:31:56 +01:00
Alberts Muktupāvels
54c32fae1e x11: create GdkSeat also in GdkX11DeviceManagerCore
There are at least few cases when GdkX11DeviceManagerXI2 will not
be used. Make sure that we have GdkSeat in such cases.

https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-21 20:58:28 +01:00
Carlos Garnacho
fc2879108d wayland: Don't trigger grab on missing capabilities
Those might not be currently there in the first place.
2015-12-21 19:14:21 +01:00
William Hua
54fa65f544 gdkborder: change types from gint16 to gint 2015-12-17 12:56:35 -05:00
Paolo Borelli
8c355d8fe6 Win32: call dnd exit when finalizing the display
Since we init dnd when opening the display, call the corresponding
exit function (which is unused at the moment) when finalizing the
display.
2015-12-17 17:18:02 +01:00
Paolo Borelli
2e5616b27e Win32: move CoInitialize to dnd init
Functions requiring CoInitialize are called just in two places:
 - the filechooser thread which calls its own CoInitializeEx
 - the dnd code

Moving CoInitialize in the dnd specific init is cleaner and
we can pair it with the corresponding CoUninitialize since
CoUninitialize should be called as many times as CoInitialize.
Note that it is ok to call this function multiple times, so it
will not break if another codepath will need it in the future.

The patch also replaces the deprecated CoInitialize with the
equivalent call to CoInitializeEx (already used in the filechooser).
2015-12-17 17:18:01 +01:00
Carlos Garnacho
24afce5650 x11: Make fallback window dragging use seat grabs
Also, gdk_seat_ungrab() will undo the implicit grab when EWMH dragging
is used.
2015-12-16 19:47:06 +01:00
Carlos Garnacho
7ead57be8c x11: Add some ignore deprecation statements
In those places we still need access to floating devices, or we need to
use the GdkDeviceManager as its GdkEventTranslator interface.
2015-12-16 19:47:06 +01:00
Carlos Garnacho
c3f1565c18 x11: Avoid gdk_device_manager_get_client_pointer()
We can use the pointer of the default seat instead.
2015-12-16 19:47:06 +01:00
Carlos Garnacho
1fbf2fe4d7 wayland: Avoid GdkDeviceManager APIs
In most places, we can do with the pointer/keyboard of the default seat
instead of the client pointer. We can also remove some code from
gdk_input_init() because we know for sure there's no floating devices to
care about here.
2015-12-16 19:47:06 +01:00
Carlos Garnacho
598dedfe36 broadway: 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
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
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
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
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
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
Carlos Garnacho
c70da9b7ae gdk: Set seat on events generated in common code 2015-12-16 19:47:05 +01:00
Cosimo Cecchi
990dc9961a gdkevents: fix a compiler warning 2015-12-16 10:35:46 -08:00
Olivier Fourdan
b456db8cf4 wayland: Check transient loop
Gdk Wayland backend walks up the transient windows tree, but does not
check for cycles when doing so.

As a result, if two or more windows are transient to each other, the
Wayland gdk backend will enter an infinite loop.

While this is clearly a bug in the application, gtk+/gdk should be more
robust and handle such errors more gracefully.

To avoid looping infinitely at various point in the code, check for a
possible loop when setting the transient relationship and deny the
request to set a window transient for another if that would create a
loop.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=759299
2015-12-16 14:11:11 +01:00
Emmanuele Bassi
0b19197493 Fix the fix to the last commit
I should not push while compilation is still going on
2015-12-16 12:42:27 +00:00
Emmanuele Bassi
00102e35ea Fix previous commit
The scale parameter was missing.
2015-12-16 12:41:16 +00:00
Lars Uebernickel
1f07625705 gdk_pixbuf_get_from_window: honor device scale
gdk_pixbuf_get_from_window() paints the given window onto a new cairo
surface. Create that new surface with the same device scale as the
window so that the result is not scaled down on hidpi screens.

This is similar to 657a43e (which was reverted), but doesn't modify the
behavior of gdk_pixbuf_get_from_surface().

https://bugzilla.gnome.org/show_bug.cgi?id=757147
2015-12-16 13:07:58 +01: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
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
William Hua
a6e4de2884 gdkborder: add GdkBorder to gdktypes.h 2015-12-15 10:13:03 -05:00
William Hua
c6bd3ddb8a gdkwindow: move GdkWindowTypeHint to gdktypes.h 2015-12-15 10:13:03 -05:00
Carlos Garnacho
5d6a2ae54f win32: Use GdkSeatDefault to implement GdkSeat 2015-12-15 00:40:22 +01:00
Carlos Garnacho
af54b82c0a quartz: Use GdkSeatDefault to implement GdkSeat 2015-12-15 00:40:21 +01:00