Commit Graph

6606 Commits

Author SHA1 Message Date
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
Carlos Garnacho
edc4374a63 gdk: Allow internal management of source-side DnD
We've traditionally left GTK+ to handle the input side of things,
letting GDK only manage the windowing-specific messaging. This
way of splitting responsibilities is not compatible however with
some backends, we must fold then input management at the DnD stage
into GDK (and backends) domain.

The gdk_drag_context_manage_dnd() call is meant to be the entry
point for this mode of operation, if the drag and drop operation
becomes managed, the caller (i.e. gtkdnd.c) doesn't need to perform
grabs, nor manage input events itself.

As a consequence of this, different aspects now belong to the
backend GdkDragContext implementation:
- Because the caller doesn't see keyboard events anymore,
  keyboard navigation must be managed in GDK, so is the decision
  of the current action based on modifiers/button pressed.
- Because the caller won't see input events in general, the lifetime
  of the drag and drop operation is now communicated through the
  ::drop-performed, ::dnd-finished and ::cancel events
- Because the caller doesn't participate anymore on the action
  being chosen, the pointer cursor must be set by the backend.
  The caller is rather notified of the final action through the
  ::action signal.

The caller is still responsible of dealing with the corresponding
GdkSelection, ensuring its ownership and communicating the supported
mimetypes.
2016-01-19 14:17:35 +01:00
Carlos Garnacho
f8b8e4eaf8 x11: Set event->scroll.is_stop
We still figure this out from 0/0 scroll events. This method is
not intended to last forever, but it's something we can cling to
so far.

https://bugzilla.gnome.org/show_bug.cgi?id=756729
2016-01-18 21:36:23 +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
Peter Hutterer
3fca36169a wayland: add support for wl_pointer frame/axis_source/axis_discrete/axis_stop
This adds support for the new wl_pointer events available in v5.

The wl_pointer.axis_source events can be ignored for the purposes here, the
main reason they exist is so that the combination of axis_source=finger and
axis_stop triggers kinetic scrolling. We don't need to care about the source,
axis_stop is enough for us to tell us when we're scrolling.

The wl_pointer.frame events group events together and is intended as a
mechanism to coalesce events together. This for example allows us to now
send a single GTK scroll event for a diagonal scroll. Previously, the two
wl_pointer.axis events had to be handled separately.

The wl_pointer.axis_discrete event sends mouse wheel clicks where
appropriate, and is translated into up/down/left/right scroll events.

https://bugzilla.gnome.org/show_bug.cgi?id=756729
2016-01-18 21:36:23 +01:00
Timm Bäder
af958b86cb gdkdisplay-x11: Plug memory leak 2016-01-18 17:34:29 +01:00
Matthias Clasen
6f3cff16af gdk: Clarify docs about scale
Explicitly state where we return application pixels as opposed
to device pixels.
2016-01-18 08:54:35 -05:00
Matthias Clasen
bbc08d08a9 Trivial typo fix 2016-01-18 08:36:53 -05:00
Руслан Ижбулатов
f74f81f06b W32: Detect ticks wraparound
https://bugzilla.gnome.org/show_bug.cgi?id=748327
2016-01-18 09:23:44 +00:00
William Hua
2b95e4db55 mir: add default GdkSeat for the default GdkDisplay 2016-01-15 14:10:53 -05:00
Rui Matos
303556ac2a wayland: Fix an endless loop 2016-01-15 18:40:43 +01:00
Ignacio Casal Quinteiro
f6cc3be118 win32: get rid of _gdk_screen global variable
The screen is part of the display so it should be belong to it.
2016-01-15 12:35:31 +01:00
Ignacio Casal Quinteiro
ea7c509afd win32: fix warning 2016-01-15 11:56:01 +01:00
Tom Schoonjans
967ecc80d3 Windows library manager fix
The Makefile.am's had a dependency on incorrectly named libtool
archives for the generation of the .lib files.

https://bugzilla.gnome.org/show_bug.cgi?id=760388
2016-01-15 11:16:32 +01:00
Руслан Ижбулатов
37bd22c3d9 GDK W32: Don't use WM-drawn shadow for tooltips
This prevents WM from drawing shadows around tooltip windows,
which, in Adwaita, should have no shadow and are CSD-ish (which means
that tooltip window is larger than it looks, and WM draws the shadow
only on the outside, leaving a gap between the visible tooltip edge and
the shadow).

https://bugzilla.gnome.org/show_bug.cgi?id=759898
2016-01-14 14:53:15 +00:00
Paolo Borelli
3cd79c11fc win32: remove _gdk_root global variable 2016-01-14 14:30:37 +01:00
Dominique Leuenberger
d7e5fd2e2f QEMU USB Tablet is not really a tablet - it's a trick
Unfortunately, Qemu gives us this confusing device to work with,
and the best we can do is filter it out based on its name.

https://bugzilla.gnome.org/show_bug.cgi?id=760445
2016-01-12 23:03:14 -05:00
Ting-Wei Lan
f4d2d66b1e broadway: Call setlocale in main function of broadwayd
It is required to correctly show translated messages on some locales.

https://bugzilla.gnome.org/show_bug.cgi?id=760416
2016-01-12 23:00:03 -05:00
Alberts Muktupāvels
0ba5e38c91 gdkseat: remove return from gdk_seat_ungrab 2016-01-12 18:49:40 +02:00
Timm Bäder
8cb515e2f3 Remove stray semicolon
Gets rid of a mixed code/declaration warning.
2016-01-12 09:35:04 +01:00
Matthias Clasen
2c0b251dac Improve deprecation note for gdk_device_manager_get_client_pointer
List gdk_seat_get_pointer as replacement. Suggested in
https://bugzilla.gnome.org/show_bug.cgi?id=759785
2016-01-11 15:09:47 -05:00
Matthias Clasen
5c50250273 Fix the deprecation note for gdk_device_manager_list_devices
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=759785
2016-01-11 15:06:15 -05:00
Matthias Clasen
63365d5044 Fix the annotation for gdk_seat_get_slaves
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=759785
2016-01-11 15:05:21 -05:00
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