Commit Graph

2167 Commits

Author SHA1 Message Date
Matthias Clasen
660c8b8f9b x11: Mark trackpoints as GDK_SOURCE_TRACKPOINT
This uses the same heuristics that are currently used in
GtkScrolledWindow.

https://bugzilla.gnome.org/show_bug.cgi?id=767100
2016-06-01 09:31:18 -04:00
Rico Tzschichholz
694ba1298e x11: Replace RROutput with XID as used in GdkX11Monitor
This avoids an unconditional use of XRandr symbol.
2016-05-27 09:32:14 +02:00
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
Matthias Clasen
7e7d7991cc x11: Trap possible X error
XIGetClientPointer can generate X errors (e.g. when the X server
does not support XI2. Trap them and carry on.

https://bugzilla.gnome.org/show_bug.cgi?id=766233
2016-05-10 21:29:10 -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
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
Matthias Clasen
6baac526b9 x11: drop a useless list
We were keeping all the event sources in a list, only to remove
them at the end of their life. Not useful.
2016-05-01 13:26:35 -04:00
Matthias Clasen
5c1d0915af x11: Bring back fullscreen-on-all-monitors support
It is unfortunate the EWMH requires Xinerama here - lets do this
without the caching that was previously there, I don't think it is
needed.
2016-04-27 23:18:16 -04:00
Matthias Clasen
d92fda2103 x11: Port to new monitor api 2016-04-27 23:18:16 -04:00
Matthias Clasen
79a0286ab1 x11: Drop Xinerama
It may come back after the monitor conversion.
2016-04-27 23:18:16 -04: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
Emmanuele Bassi
f848450a70 gl: Use a uniform to flip R and B colors on GLES
This allows us to decide when the R and B color channels should be
flipped with a much better granularity.

For instance, when using GLX_EXT_texture_from_pixmap to create a GL
texture from a surface we don't need to swap the R and B channels, as
the internal representation of the texture data will already have the
appropriate colors.

We also don't need to flip color channels when blitting from a texture.
2016-04-25 14:33:36 +01:00
Emmanuele Bassi
88fed84d45 x11: Allow creating GLES contexts
We need to check for the GLX_EXT_create_context_es2_profile extension,
which allows us to create a GLES context while using the GLX API.
2016-04-25 12:29:37 +01: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
Matthias Clasen
9044f78751 Move GdkDeviceTool into its own files 2016-04-09 15:48:34 -04:00
Carlos Garnacho
6febc22918 x11: Use XInternAtom directly on poking device hardware IDs
This way we don't cache the property if it wasn't previously there,
added by the driver itself. Bailing out is due there.
2016-04-06 15:43:29 +02:00
Stephen Chandler Paul
9e72d24b23 GdkDeviceTool: Add GdkAxisFlags info to tablet tools
Different tools may have different sets of axes, we should store that
info somewhere.
2016-04-06 15:43:29 +02:00
Stephen Chandler Paul
8b2fd3ed1b GdkDeviceTool: Add GdkDeviceToolType to identify the physical tool type
Because there are multiple different types of styluses that can be used with
tablets, we have to have some sort of identifier for them attached to the
GdkDeviceTool, especially since knowing the actual tool type for a GdkDeviceTool
is necessary for matching up a GdkDeviceTool with it's appropriate
GdkInputSource in Wayland (eg. matching up a GdkDeviceTool eraser with the
GDK_SOURCE_ERASER GdkInputSource of a wayland tablet).

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
2016-04-06 15:43:29 +02:00
Carlos Garnacho
9a81b65959 x11: Set GdkDeviceTool on motion/button events
The last known tool from the device is used here. If no tool is known,
the event will just have a NULL pointer there.
2016-04-06 15:43:29 +02:00
Carlos Garnacho
0287ec7e89 x11: Update GdkDevices on "Wacom Serial IDs" property changes
This takes care of the emission of GdkDevice::tool-changed, plus the
updating of the internal device accounting.
2016-04-06 15:43:29 +02: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
Benjamin Otte
318a9c4634 x11: Use g_error_matches()
Fixes accidentally assigning values.

http://www.viva64.com/en/b/0383/
2016-03-20 05:43:02 +01:00
Benjamin Otte
5db1c987ee x11: Remove duplicate variable setting
http://www.viva64.com/en/b/0383/
2016-03-20 05:30:51 +01:00
Takao Fujiwara
7822f59a86 Set VirtualBox USB Tablet to GDK_SOURCE_MOUSE
The virtual host assigns the name of the mouse device to
"VirtualBox USB Tablet" in VirtualBox and we'd use that device as mouse.
If not, GtkTooltip is not enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=763017
2016-03-08 11:11:51 -05:00
Matthias Clasen
d8dee2952a gdk: Add an X setting for gtk-keynav-use-caret
This will let us toggle the use-caret setting session-wide.
2016-03-04 22:44:29 -05:00
Matthias Clasen
832742e1f3 x11: Trap errors around an XRandr call
Apparently, we can get X errors here. Ignore them.
https://bugzilla.gnome.org/show_bug.cgi?id=762907
2016-03-04 14:35:23 -05:00
fiddlerwoaroof
f3f998efd7 Check if XRRGetOutputInfo returned a null pointer.
Fixes bug 763023: in certain circumstances, XRRGetOutputInfo will return
a null pointer.  This commit adds a check to detect and handle this
return value.
2016-03-03 21:31:26 -05:00
Paolo Borelli
4a6f8a065a gdk: remove the display->list_devices vfunc
gdk_display_list_devices is deprecated and all the backends
implement the same fallback by delegating to the device manager
and caching the list (caching it is needed since the method does
not transfer ownership of the container).
The compat code can be shared among all backends and we can
initialize the list lazily only in the case someone calls the
deprecated method.

https://bugzilla.gnome.org/show_bug.cgi?id=762891
2016-02-29 21:53:58 +01:00
Paolo Borelli
38ad57948c gdk: remove the core_pointer field from GdkDisplay
It is not used anymore, so no need to set it

https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-02-29 14:15:04 +01: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
2ad19c70ce x11: Don't use g_print for debug output
The g_print documentation explicitly says not to do this, since
g_print is meant to be redirected by applications. Instead use
g_message for logging that can be triggered via GTK_DEBUG.
2016-02-28 21:40:24 -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
Paolo Borelli
70d689cddd gdk: calculate pixel color shift and precision lazily
This gets rid of the decompose_mask utility entirely and simplifies
backend code.
2016-02-27 12:27:54 +01:00
Paolo Borelli
f73e7680ed gdk: factor out utility shared among backends
Removes duplicated code and makes sure we use the version which
is safe against infinite loops
2016-02-27 10:46:59 +01:00
Matthias Clasen
5522ce9649 xi2: Add some more debug spew
Log the valuators we use or ignore.
2016-02-25 21:19:31 -05:00
Matthias Clasen
a4a7740b2f xi2: Set ::num-touches for touch devices
XI2 has this information, so pass it on.
2016-02-25 08:27:08 -05:00
Matthias Clasen
c75a833633 x11: More fake tablet blacklisting
Sigh.

Now that we've neutered the QEMU USB tablet, I'm finding that
spice is doing just the same nonsense. It has a fake "spice vdagent
tablet". Blacklist that as well.
2016-02-24 22:22:11 -05:00
Matthias Clasen
e837aa69b6 x11: Some cleanups to the multihead initialization
The significant change here is a memory leak fix in init_xrandr15.
The rest of the changes makes init_xrandr13 and init_xrandr15 more
parallel, and simplifies init_multihead.
2016-02-20 10:54:48 -05:00
Marco Trevisan (Treviño)
1dda932109 X11, GdkScreen: properly implement init_randr15 including output name
https://bugzilla.gnome.org/show_bug.cgi?id=762319
2016-02-20 10:45:44 -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
Carlos Garnacho
d55b8151f2 x11: Avoid setting has_pointer_focus if a EWMH compliant WM is present
This is mostly useful to have focus behave sanely on lack of WM, so avoid
any check there if we're positive there is a WM handling focus.

https://bugzilla.gnome.org/show_bug.cgi?id=677329
2016-02-12 22:05:30 +01:00
William Hua
7b88e304c7 x11: don't apply scaling factor twice
The fallback behaviour of get_work_area () divides the
screen width and height by the window scaling factor, but
those values are already scaled down.

https://bugzilla.gnome.org/show_bug.cgi?id=761474
2016-02-04 11:02:09 -05:00
Alberts Muktupāvels
8eb2619888 gdkwindow-x11: always set _GTK_THEME_VARIANT property
Set _GTK_THEME_VARIANT to empty string when default theme variant
is used. This will allow to understand whether _GTK_THEME_VARIANT
is not supported or default variant is requested.

https://bugzilla.gnome.org/show_bug.cgi?id=761476
2016-02-04 11:52:07 +02:00
Allison Ryan Lortie
0d109867d2 Tweak startup-notification after the first window
Presently, Gtk will only send a startup notification completion message
for the first window that is shown.  This is not good for the case of
GtkApplication, where we are expected to participate in
startup-notification for all windows.

We have avoided this problem by manually emitting the startup complete
message from after_emit in GtkApplication.

Unfortunately, this causes problems for windows that are shown with a
delay.  It is also a dirty hack.

The reason for the original behaviour is simple: there is a static
boolean in gtkwindow.c which controls it.  We remove this.

Instead, clear the startup notification ID stored in GDK when sending
the completion message.  GtkApplication will re-set this the next time
an event comes in which needs startup-notification handling.  In the
non-GtkApplication case, newly shown windows will still not send the
message, since the cookie will have been cleared.

Finally, we remove the hack from GtkApplication's after_emit.

This will probably cause some regressions in terms of lingering startup
notification messages.  The correct solution here is to always use
gtk_window_present(), including when merely opening a new document (with
a new tab, for example).

https://bugzilla.gnome.org/show_bug.cgi?id=690791
2016-01-27 18:14:40 +01:00
Olav Vitters
5cbc247c08 Add an XSetting for primary button warps slider
This will be used by xsettings-kde to ensure GTK+3.x programs behave
consistently.

https://bugzilla.gnome.org/show_bug.cgi?id=688524
2016-01-26 19:21:10 +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
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
Timm Bäder
af958b86cb gdkdisplay-x11: Plug memory leak 2016-01-18 17:34:29 +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
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
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
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
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
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
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
d236fd7aab x11: Use GdkSeatDefault to implement GdkSeat
https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:32:55 +01:00
Carlos Garnacho
6e8d5f70db x11: Use gdk_event_set_device() consistently
Move the variable definitions above the function, and use those
throughout all branches of the event handling switch.
2015-12-15 00:16:15 +01:00
Carlos Garnacho
3733e53c1a x11: Use client pointer as default core pointer for gtk+2 API
There is no need to fiddle with the master devices list.

https://bugzilla.gnome.org/show_bug.cgi?id=759323
2015-12-15 00:04:20 +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
c5b7cd97b6 x11: Add "pointer" to the is-not-a-touchscreen device name checks
Commit 1266d15c4 also broke Xwayland, as it does the same trick
than VMWare pointers. Let's extend the heuristic to check for "pointer"
in the device name, what can possibly go wrong...

https://bugzilla.gnome.org/show_bug.cgi?id=757358
2015-11-17 16:22:06 +01:00
Matthias Clasen
c659292940 x11: Try harder to find a core pointer
We currently just look for a master device with input source MOUSE.
After recent changes to the way input devices are classified, xwayland
on my system comes up with a virtual core pointer that has input
source TOUCHSCREEN. This was causing assertion failures. Be a little
more careful and accept a touchscreen as core pointer, if there is
no mouse.
2015-11-16 18:34:18 -05:00
Carlos Garnacho
b32c7c3282 x11: Do not misdetect mice with abs axes as touchscreens
VMWare seems to create mouse devices with abs axes which confuses
our detection of single-touch touchscreens. Those have though a
name we can match on ("VirtualPS/2 VMware VMMouse"), it should
be pretty safe to assume that no real touchscreens have "mouse"
in their name...

https://bugzilla.gnome.org/show_bug.cgi?id=757358
2015-11-14 23:45:46 -05:00
Carlos Garnacho
29dd395b7a x11: Detect single-touch touchscreens as GDK_SOURCE_TOUCHSCREEN
Those won't have ABS_MT_* axes, so won't be reported has having
XITouchClassInfo. Fallback on these to checking whether abs x/y axes are
available. After the Wacom checks, any remaining device with absolute axes
should be touchscreens, and GDK_SOURCE_MOUSE does indeed just make sense on
devices with relative axes.

https://bugzilla.gnome.org/show_bug.cgi?id=757358
2015-11-03 07:07:12 -05:00
Robert Ancell
aefa1ba611 gdk: Deprecate gdk_display_get_screen 2015-10-27 14:17:52 +13:00
Matthias Clasen
4d59233ba9 Don't use g_slist_next in the x11 backend
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Matthias Clasen
25483304cd Minor cleanup
Replace a unref-and-unset combination with g_clear_object.
2015-10-17 12:48:55 -04:00
Olivier Fourdan
4398e12469 GdkAppLaunchContext: Use the display name for X11
Using a NULL GAppInfo with g_app_launch_context_get_display() will
generate a critical warning in gio.

Use the display name instead as we don't have any valid GAppInfo to pass
to g_app_launch_context_get_display().

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=756439
2015-10-13 08:39:05 +02:00
Emmanuele Bassi
105f1c9fd3 Control legacy GL context via environment variable
For testing purposes, we may want to force the creation of legacy GL
contexts via an environment variable.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Emmanuele Bassi
18cae47e17 x11: Create legacy GLX contexts
If GLX has support for the GLX_ARB_create_context_profile extension,
then we use the GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; if it does
not, we fall back to the old glXCreateNewContext() API.

We use the shared GdkGLContext to decide whether the GLX context should
use the legacy bit or not.

https://bugzilla.gnome.org/show_bug.cgi?id=756142
2015-10-07 16:21:57 +01:00
Olivier Fourdan
ecb0e777fa GdkAppLaunchContext: Set DISPLAY variable for X11
The environment variable DISPLAY makes sense only for X11, so set its
value in the X11 backend.

https://bugzilla.gnome.org/show_bug.cgi?id=754983
2015-10-05 23:40:56 -04:00
Alexander Larsson
9bda0532f8 gdk: Finish conversion to in-struct GdkWindow list nodes 2015-09-21 16:59:51 +02:00
Carlos Garnacho
dbf85cc4db x11: Declare variable for the inner loop
Otherwise the outer loop control variable is messed up, and we end
up with uninitialized axes if there were any more valuators after
the XIKeyClass one.

This bug was sneakily introduced by fdb9a8e14, many thanks to
Carlos Soriano for helping spot the source of this bug.

https://bugzilla.gnome.org/show_bug.cgi?id=753431
2015-09-09 16:46:26 +02:00
Matthias Clasen
389ae3e022 settings: Avoid a redundant check
g_value_transform already returns whether it was successful
or not, so no need to call g_value_type_transformable beforehand.
2015-09-09 06:32:45 -04:00
Matthias Clasen
9f24b54786 Code cleanup
Use g_slist_free_full more consistently. This commit just converts
the obvious cases where g_slist_forall is directly followed by
g_slist_free.
2015-07-31 22:23:35 -04:00
Matthias Clasen
55edc81c10 x11: Make selection handling work across screens
When dealing with selection events, we might see windows from
other screens in the requestor field. The current x11 backend
code fails to wrap these in a foreign GdkWindow, since we
don't have the corresponding GdkScreen anymore. Work around
this by creating such 'foreign screens' on demand. We still
maintain the 1:1 relation between the display and the screen
returned by gdk_display_get_default_screen().

https://bugzilla.gnome.org/show_bug.cgi?id=721398
2015-07-27 23:20:53 -04:00
Ignacio Casal Quinteiro
186c8f5254 gdk: fix crash if visual is NULL
cairo_xlib_surface_get_visual might return NULL so we need to
check for NULL before trying to use it.

https://bugzilla.gnome.org/show_bug.cgi?id=752520
2015-07-17 14:26:11 +02:00
Carlos Garnacho
72bfb40ccf Revert "x11: Query pointer devices' scroll valuators on toplevel enter events"
This reverts commit 77b8495bc4.

The commit broke more scenarios than fixed, better to go back to square one.
2015-07-15 21:19:25 +02:00
Owen W. Taylor
6504b2e534 GdkDisplayX11: Properly translate server timestamps from _NET_WM_FRAME_* messages
When using frame times from _NET_WM_FRAME_DRAWN and _NET_WM_FRAME_TIMINGS, we
were treating them as local monotonic times, but they are actually extended-precision
versions of the server time, and need to be translated to monotonic times in the
case where the X server and client aren't running on the same system.

This fixes rendering stalls when using X over a remote ssh connection.
https://bugzilla.gnome.org/show_bug.cgi?id=741800
2015-07-15 12:46:06 -04:00
Ryan Lortie
a00a5ed210 GtkApplication: avoid using stale timestamps
Avoid using a stale timestamp (from the last user interaction with the
application) when a message arrives from D-Bus requesting that a new
window be created.

In this case the most-correct thing that we can do is to use no
timestamp at all.

We modify gdk_x11_display_set_startup_notification_id() to allow a NULL
value to mean "reset everything" and then call this function
unconditionally on receipt of D-Bus activation requests.  The result
will be that a missing desktop-startup-id in the platform-data struct
will reset the timestamp.

Under their default configuration metacity and mutter will both map
windows presented with no timestamp in the foreground.  This could
result in false-positive, but there is very little we can do about that
without the original timestamp from the user event.

https://bugzilla.gnome.org/show_bug.cgi?id=752000
2015-07-14 18:34:09 -07:00
Matthias Clasen
bdf0820c50 Simplify Xft setting fallback
If we don't find Xft values in the X resource db, simply fall
back to the values that are hardcoded in /etc/X11/Xresources
anyway. Extra trickery with likely-made-up screen dimensions
is not going to yield better results, and only makes for a
deeper rabbit hole when debugging.
2015-07-07 20:54:16 -04:00
Jasper St. Pierre
abc47d7faa gdkdisplay-x11: The leader window should be an input-only window
This prevents it from creating a _NET_WM_USER_TIME_WINDOW, which can
confuse mutter / other window managers, and also me, when debugging.
2015-07-05 17:00:52 -07:00
Carlos Garnacho
77b8495bc4 x11: Query pointer devices' scroll valuators on toplevel enter events
We used to "invalidate" scroll valuators, so the next scroll event could
be used as the base for the next scroll deltas. This has the inconvenience
that it invariably consumes the first event received after enter and,
due to interactions with WM overeager passive button grabs, there's a
possibility we don't scroll at all if we receive interleaved "smooth
scroll" XI_Motion events and XI_Enter events (Normally triggered by regular
scroll wheels in mice).

In order to fix this, and at the expense of some sync-call overhead on
XI_Enter events (one XIQueryDevice call per slave device), query the
current scroll valuator state for all the slaves of the entered pointer,
so we do know beforehand the right base values. If new devices are plugged
while the pointer is on top of the client, the initialized scroll values
will match the valuators'.

https://bugzilla.gnome.org/show_bug.cgi?id=750994
https://bugzilla.gnome.org/show_bug.cgi?id=750870
2015-07-01 19:40:09 +02:00
Carlos Garnacho
0f3995a446 x11: Avoid X error traps within server grabs
gdk_x11_device_xi2_window_at_position() may attempt to push/pop
a few error trap pairs while traversing the window tree. Move it
outside the server grab, and around the multiple XIQueryPointer
calls we may do here.

https://bugzilla.gnome.org/show_bug.cgi?id=751739
2015-07-01 07:42:41 -07:00
Matthias Clasen
7aec96b95f Remove unused variables 2015-06-13 21:10:26 -04:00
Matthias Clasen
fdb9a8e142 x11: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:14 -04:00
Krzesimir Nowak
39f91d7cdb gdk: Fix a typo 2015-05-22 14:39:53 +02:00
Matthias Clasen
9dad9378f2 Fix primary monitor determination with XRANDR 1.5
This was an oversight in the previous patch.
2015-05-22 06:56:23 -04:00
Dave Airlie
e670720d19 gtk3: add randr 1.5 monitor support
This patch introduces support for using the newly introduced
monitor objects in the XRandR protocol. These objects are meant
to be used to denote a set of rectangles representing a logical
monitor, and are used to hide details like monitor tiling and
virtual gpu outputs.

This uses the new objects instead of crtc/outputs objects when
they are available to create the monitor lists. X server 1.18
is required on the server side for randr 1.5.

https://bugzilla.gnome.org/show_bug.cgi?id=749561
2015-05-21 23:09:04 -04:00