Commit Graph

2120 Commits

Author SHA1 Message Date
Carlos Garnacho
942d144d3b gdk: Pass hardware ID on gdk_device_tool_new()
And implement this on wayland, where this information is already obtained.

https://bugzilla.gnome.org/show_bug.cgi?id=770026
2016-08-23 21:01:44 +02:00
Matthias Clasen
f44baf51d9 Avoid a division by zero
It appears that xvfb returns nonsense in its xrandr resources.
Avoid a crash when that happens.

https://bugzilla.gnome.org/show_bug.cgi?id=768999
2016-07-25 08:32:24 -04:00
Matthias Clasen
82fd72a477 Opt in to structured logging
Define G_LOG_USE_STRUCTURED, so that all our g_debug, g_warning,
etc calls directly use structured logging and provide source information.
2016-07-22 23:13:20 -04:00
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