Commit Graph

177 Commits

Author SHA1 Message Date
Carlos Garnacho
1d04bdf845 x11/dnd: Ignore grab broken events from other devices than our DnD device.
The GdkDragContext should only listen to GDK_GRAB_BROKEN events sent to
its own pointer device. It turns out that the passive key grabs mistake
GDK into sending a GdkEventGrabBroken on the master keyboard, which the
DnD machinery mistakes as a signal to cancel the operation.

https://bugzilla.gnome.org/show_bug.cgi?id=766442
2016-05-18 12:54:40 +02:00
Carlos Garnacho
c14572fdae x11: Rely on passive keyboard grabs with XI2 for DnD
The active keyboard grab can be spared then. This way the passive
key grabs allow other key combinations (eg. alt-tab) that are not
mandatory to grab here.
2016-05-05 19:16:25 +02:00
Jonas Ådahl
1a4f000f3b gdk/dnd: Don't use default display when getting cursor
Always associate a drag context with a GdkDisplay and use that when
getting a cursor for a given action.

If we don't do this, dragging on a window that doesn't use the default
display will make us use cursors from the wrong display.

https://bugzilla.gnome.org/show_bug.cgi?id=765565
2016-04-26 23:03:24 +08:00
Matthias Clasen
068d382689 dnd: Hide the drag window when we're done
We were just relying on the drag context finalize() to destroy
the window. But with garbage-collected bindings, that might
not happen as soon as we like, so explicitly hide the window
when the drag ends successfully.

https://bugzilla.gnome.org/show_bug.cgi?id=763659
2016-03-21 11:26:24 -04:00
Matthias Clasen
ee217dc823 Add and use GDK_CHECK_DEBUG macro
This is following what we've already done in GTK+. It avoids
direct access to _gdk_debug_flags all over the place.
2016-02-28 21:40:30 -05:00
Matthias Clasen
697efcd4bc x11: 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
aad3135e4c gdk: Add GdkDragCancelReason enum as argument to GdkDragContext::cancel
We should conform to a minimal set of reasons for the gtk side to emit
a better GtkDragResult than GTK_DRAG_RESULT_ERROR. This fixes the notebook
tab DnD feature, where we rely on GTK_DRAG_RESULT_NO_TARGET.

In the wayland side, unfortunately we can't honor either NO_TARGET nor
USER_CANCELLED, we don't know of the latter, so we could return false
positives on the former.

https://bugzilla.gnome.org/show_bug.cgi?id=761954
2016-02-15 18:35:51 +01:00
Matthias Clasen
cccaf1d16b Use actual drop status
We have this information in the XDND protocol, so we don't have
to blindly assume that the drop succeeded.
2016-01-19 14:17:36 +01:00
Carlos Garnacho
bfee45e6f9 x11: Implement gdk_drag_context_manage_dnd()
This includes managing input events and source-side DND events,
as well as setting the appropriate cursor and emitting the signals
that are expected in this mode of operation.
2016-01-19 14:17:35 +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
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
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
Matthias Clasen
23b2b49321 x11: Implement drag cancel animation
Showing the drag cancel animation can be done in the X11
drag context implementation now that we hold the drag
window there, and have the start coordinates.

Since we can't control if and when the application destroys
the drag widget, we take a snapshot of the window contents
and display that during the animation. This should be good
enough for all practical purposes.
2015-12-13 15:49:25 -05:00
Matthias Clasen
ed89e5f62a x11: Store drag start coordinates
These will be used in later commits.
2015-12-13 10:39:43 -05: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
Matthias Clasen
7d1a0b075d Trivial code restructuring 2015-12-07 21:57:45 -05:00
Matthias Clasen
475f6e09b1 x11: Implement gdk_drag_context_set_hotspot
This makes the drag behavior under X11 match what we had previously.
2015-12-07 21:52:51 -05:00
Matthias Clasen
fff8297a50 Add gdk_drag_context_get_drag_window
This makes gdk_wayland_drag_context_get_dnd_window
backend-independent API and adds an implementation
for X11.
2015-12-01 23:47:56 -05:00
Carlos Garnacho
88bf4a7a2d x11: Fix possible leak of GdkEvents
If the filter didn't return GDK_EVENT_TRANSLATE, the event struct would be
left unused and leaked.
2014-08-22 13:24:48 +02:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
Volker Sobek
a4d69e7f14 docs/comments: Fix spelling of 'explicitly'
This replaces all occurrences of 'explicitely' with 'explicitly'. Only
code comments and gtk-doc statements are affected.

https://bugzilla.gnome.org/show_bug.cgi?id=722429
2014-01-18 03:47:46 +01:00
Alexander Larsson
525e5cff04 x11: Initial cut at supporting window scaling for X11
If you set GDK_SCALE=2 in the environment then all windows will be
scaled by 2. Its not an ideal solution as it doesn't handle
multi-monitors at different scales, and only affects gtk apps.
But it is a good starting points and will help a lot on HiDPI
laptops.
2013-07-03 14:34:14 +02:00
Matthias Clasen
0cc688aa92 Drop the Motif DND protocol
The implementation is not working and unused, since XDND is the
de-facto standard under X nowadays.

https://bugzilla.gnome.org/show_bug.cgi?id=695476
2013-03-12 20:03:19 -04:00
Edward Sheldrake
f77b690e26 GDK X11 DND: Fix infinite loop
Related: https://bugzilla.gnome.org/show_bug.cgi?id=664646
2012-05-14 23:02:23 -04:00
Benjamin Otte
826360a214 x11: Add suggested braces around empty body in 'if' statements 2012-04-07 13:01:24 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
266866e82c Fix problems with DND on some X servers
When the X server does not support the shape extension (as some
vnc implementations seem to), our DND code was always seeing
an empty input shape, so drops always missed their target.

http://bugzilla.gnome.org/show_bug.cgi?id=620240
2012-01-03 10:57:53 -05:00
Matthias Clasen
879202b9c2 GdkX11DragContext: Struct packing improvements 2011-04-12 12:13:55 -04:00
Benjamin Otte
7b5ad65e71 x11: Use Window isntead of GdkNativeWindow 2011-02-01 18:51:57 +01:00
Benjamin Otte
c2a5d715d5 x11: Use gdk_x11_window_foreign_new_for_display() unconditionally
gdk_x11_window_lookup_window() calls are done by this function alreayd,
so no need to do them manually.
2011-02-01 18:51:57 +01:00
Benjamin Otte
8ecd420ede x11: Do dnd event handling via gdk_window_add_filter() 2011-02-01 06:33:02 +01:00
Benjamin Otte
180cd853fc x11: Use macros for byte order to set byte order
No need to run sophisticated functions to guess it.
2011-02-01 06:33:02 +01:00
Benjamin Otte
d217f4d09e x11: Handle motif client message filter just like xdnd filters 2011-02-01 06:33:01 +01:00
Matthias Clasen
c97652aeb4 Decouple GdkWindowCache life-cycle from GdkX11DragContext
By making window caches refcounted. This fixes problems with leaking
drag contexts, as experienced in
https://bugzilla.gnome.org/show_bug.cgi?id=637691
and
https://bugzilla.gnome.org/show_bug.cgi?id=144324

Based on a patch by drago01@gmail.com
2011-01-04 19:30:04 -05:00
Nguyễn Thái Ngọc Duy
cf752786f3 gdkdnd-x11.c: fix building without HAVE_XCOMPOSITE
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
2011-01-02 23:40:00 -05:00
Matthias Clasen
3fb8c3415b Rename GdkDragContextX11 to GdkX11DragContext 2010-12-21 12:07:09 -05:00
Benjamin Otte
a8b69df376 x11: Rename GdkScreenX11 to GdkX11Screen 2010-12-21 12:07:08 -05:00
Benjamin Otte
4db086da4b x11: Rename GdkDisplayX11 to GdkX11Display
Also rename all the macros etc.
2010-12-21 12:07:07 -05:00
Benjamin Otte
8e2240f699 x11: Rename GdkDisplayX11 to GdkX11Display 2010-12-21 12:07:07 -05:00
Matthias Clasen
00e2b949eb Reinstate the correct field value 2010-12-21 12:07:03 -05:00
Matthias Clasen
fdabc9585d Drop g[dt]k_set_locale
These functions were essentially just calling setlocale anyway.
The X11 version was also setting a gdk_use_mb variable that
is not used anywhere.
2010-12-21 12:07:02 -05:00
Matthias Clasen
214342eac5 Clean up gdkx.h a bit
Moving the direct-access redefinitions of various macros
to gdkprivate-x11.h and use that header throughout in x11/.

Also remove a workaround for a long-fixed X server bug.
2010-12-21 12:07:01 -05:00
Matthias Clasen
566abbad25 Rename _gdk_send_xevent to _gdk_x11_display_send_xevent 2010-12-21 12:07:00 -05:00
Matthias Clasen
985eb14469 Multiple changes to reduce the amount of unprefixed symbols
The X11 backend exports a number of symbols which are _-prefixed
(so don't become part of the gdk api), but are not named in a
way to prevent accidental clashes between backends.

The one API change here is that the gdk_xid_table functions
have been removed - they did not server an purpose, since the
xid table only stores windows anyway, and we already have a
lookup-by-xid function for windows.
2010-12-21 12:07:00 -05:00
Matthias Clasen
fa33839d72 Consistently use per-display error traps in the X11 backend 2010-12-21 12:06:59 -05:00
Matthias Clasen
2d7583c0e3 Make gdk_window_{lookup,foreign_new}_for_display backend specific
At the same time, make GDK_IS_DISPLAY_X11 available in gdkx.h, and
add some exemplaric ifdefs to GTK+ code.
2010-12-21 12:06:59 -05:00
Matthias Clasen
ea96e5e16f Explode gdkinternals.h into per-class private headers
At the same time, move some more class and instance structs
out of public headers.
2010-12-21 12:06:58 -05:00
Matthias Clasen
23a2b42216 Fully initialize the ClientMessage struct
Otherwise we run into warnings from xdnd_status_filter
2010-12-21 12:06:56 -05:00
Matthias Clasen
8e1d320ce9 Rename _gdk_dnd_init
Nonstatic backend-specific functions need an x11 in their name.
2010-12-21 12:06:56 -05:00