Commit Graph

6984 Commits

Author SHA1 Message Date
Stephen Chandler Paul
4f6bc82052 Wayland: Translate wl_tablet.down/up into button events
These are sent with button=GDK_BUTTON_PRIMARY, axes must be also
included in these events, in addition to motion ones.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
0f6be24e28 Wayland: Translate tool axes in motion events
On wayland, such axes are per-tool, we must update device capabilities
on the fly as new tools enter proximity, first the slave device so
it matches the current tool, and then the master device so it looks
the same than the current slave device.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
72884a274c Wayland: Implement proximity/crossing/motion event emission on tablets
Each tablet will update its own GdkWaylandPointerData separately. This
commit only adds plain motion event emission so far, no axes are managed
yet.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
7cc0850a5a Wayland: Add initial support for drawing tablets
Only the management of tablets and tools is added so far. No tablet events
are yet interpreted.

As it's been the tradition in GTK+, erasers are split into their own device,
whereas the rest of the tools are meant to be routed through the
GDK_SOURCE_PEN device. Both pen/eraser devices are slaves to a master
pointer device, separate to wl_pointer's. This is so each tablet can
maintain its own cursor/positioning accounting.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
2016-04-06 16:12:12 +02:00
Carlos Garnacho
45b4d765c0 wayland: Refactor master pointer data into a separate struct
This will enable multiple "pointers" to have separate data here.
Will come out useful when adding support for tablets, as they
will have a separate cursor for all purposes.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
af894af386 gdkcursor-wayland.c: Minor indentation fix
Changed the tabs to spaces

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
2016-04-06 16:12:12 +02: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
Carlos Garnacho
6286883e8d gdk: Forward tools in client-side windows event translation 2016-04-06 15:43:29 +02:00
Carlos Garnacho
6d73e75153 events: Add gdk_event_[gs]et_device_tool()
This getter/setter will manage the tool pointer in GdkEventPrivate. The
setter should be most notably used by backends.
2016-04-06 15:43:29 +02:00
Carlos Garnacho
5a25c5a9f2 GdkSeatDefault: Add functions to add/remove tools
This may be used by any backend using GdkSeatDefault as its seat
implementation.
2016-04-06 15:43:29 +02:00
Carlos Garnacho
6824dd7b8a gdk: Add GdkSeat::tool-added/removed signals
And a helper function to lookup a tool from the seat. Those are
tracker per-seat, and may be shared across devices.
2016-04-06 15:43:29 +02:00
Carlos Garnacho
d5f141a9b7 gdkdevice: Add GdkDevice::tool-changed signal
On the devices and backends that support it, this signal will be emitted
on slave/floating devices whenever the tool they are interacting with
changes. These notifications may also work as a sort of proximity events,
as the tool will be unset when the pen moves too far.

For backends, gdk_device_update_tool() has been included, all that should
be done on their side is just calling this whenever any tool might have
changed.
2016-04-06 15:43:29 +02:00
Carlos Garnacho
4ba95b09ba gdkdevice: Add GdkDeviceTool to identify device tools
GdkDeviceTool is an opaque object that can be used to identify a given
tool (eg. pens on tablets) during the app/device lifetime. Tools are only
set on non-master devices, and are owned by these.

The accounting functions are made private, the only public call on
GdkDeviceTool so far is gdk_device_tool_get_serial(), useful to identify
the tool across runs.
2016-04-06 15:43:29 +02:00
Carlos Garnacho
0f962f1075 device: Add gdk_device_get_axes(), and ::axes property
This returns a GdkAxisFlags, holding the axes currently available
through this device.
2016-04-06 15:43:29 +02:00
Carlos Garnacho
32d7ba76b3 device: Add distance/rotation/slider GdkAxisUse values
These are possible to handle in tablets, so add a value for these in the
axis enum.
2016-04-06 15:43:29 +02:00
Руслан Ижбулатов
adff59843b GDK W32: Don't move windows into top-left corner on style change
This fixes a bug that was introduced by db1b24233e.
The reason why 0:0 coordinates were passed was that SWP_NOREPOSITION was
misinterpreted as SWP_NOMOVE. That is not the case - SWP_NOREPOSITION
prevents owner Z-order change, not the window position change.
2016-04-06 10:22:15 +00:00
Olivier Fourdan
be6784c7ea wayland: Do not resize with the same size
gnome-control-center is calling gtk_window_resize() on configure-event
signals which leads to a busy loop.

Avoids such a busy loop by not re-configuring a window with the same
size, unless this is coming from and xdg-shell configure.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=764374
2016-04-05 18:22:40 +02:00
Matthias Clasen
2f0354fcf9 Move GdkDeviceManager to deprecated section
It has been superseded by GdkSeat.
2016-04-03 23:41:20 -04:00
Matthias Clasen
9bfc8371fe wayland: Remove an unused vfunc 2016-04-03 18:18:17 -04:00
Matthias Clasen
59e40f3d6f wayland: Remove unused field 2016-04-03 18:18:17 -04:00
Carlos Garnacho
2784eacf00 wayland: Avoid NULL slave devices in GdkSeat::get_slaves
Just because we're asked for a capability, it doesn't mean we have
it.
2016-04-01 19:10:36 +02:00
Matthias Clasen
4c698bc824 wayland: Print out more debug info
Print out the subpixel layout and frame rates that the compositor
sends us.
2016-03-31 20:31:00 -04:00
Alexander Larsson
4c10800bcc gdkwindow: Remove O(n-children) code in gdk_window_invalidate
When we invalidate a window we need to also invalidate all child windows
that are native (non-native are automatically invalidated as we track
invalidation once per native window only). This was done in a pretty
inefficient way, recursing over the entire tree.

This makes the invalidation much faster by only looking at the native
children of the native window we're in, filtering out those that
are not a descendant of the client side window we're interested in.
Given that there are very few native subwindows this is much faster.
2016-03-31 18:56:18 +02:00
Руслан Ижбулатов
bde5281ae8 GDK W32: Use a dumb window class for decorative windows
Currently only one kind of decorative window is in use - the shape
indicator that is shown when snapping windows to the edge of the screen.

When normal toplevel class is used, its window procedure expects certain
motions from GDK (passing user data to CreateWindowEx(), registering
handle in a hash map etc), and might crash if that is not done.

Dumb window doesn't require anything, it can just be.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:04:46 +00:00
Руслан Ижбулатов
cfbb8c5252 GDK W32: Add/subtract shadow when (un)snapping
Now halfleft/halfright/fullup snaps do hug screen edges as intended.

Documents AeroSnap behaviour when snapped windows are drag-resized
(currently this implementation handles this in a very simplistic way).

Don't believe GTK when it tells us that window shadow is 0, preserve
previous values (but do remember that GTK wants no shadow, in case
we need that).

Fixes a couple of bugs in unsnapping (check offset against the half
of the window; don't put pointer in the middle of the window vertically
if it still fits in the top half).

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:04:37 +00:00
Руслан Ижбулатов
f853283d7b GDK W32: Add/subtract shadow when drag-resizing
Implements gdk_win32_window_set_shadow_width().
Uses shadow width/height to adjust max tracking size, allowing
windows to be drag-resized to cover the whole desktop.

Also uses SM_C*VIRTUALSCREEN instead of SM_C*MAXTRACK.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:03:56 +00:00
Руслан Ижбулатов
b0131616b2 GDK W32: Draw snap indicators for AeroSnap
Indicator is a bare layered click-through native window,
painted completely by GDK, including animation.

This commit also isolates some of the more spam-ish debug logging
under ifdef.

This commit also changes the system metric used for maximal window
height for the snapping purposes. Turns out, SM_CYMAXTRACK is way
too large, use SM_CYVIRTUALSCREEN instead.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:03:41 +00:00
Руслан Ижбулатов
b420c53773 GDK W32: Add drag-to-snap feature to AeroSnap
This implements the part of AeroSnap that snaps windows when you
drag them (while moving or resizing) to the edge of the screen.

It also fixes drag behaviour for snapped and maximized windows
(if such windows are dragged, first they must be unmaximized/unsnapped).

Note that this code does not take into account the shadow width, and
because of that the under-pointer-position-preserving window moves
might not look as such for maximized windows, which lack the shadow
when maximized, but do have the shadow when unmaximized.

This commit also doesn't cover some corner-cases the same way AeroSnap does.

Also, the snapping indicator (which is supposed to be a window shape that
shows where the window will be if the drag op is stopped at its current
point) is not being drawn, all routines responsible for its creation,
moving and drawing are stubs.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:00:07 +00:00
Руслан Ижбулатов
2ea96cf946 GDK W32: Improve AeroSnap - don't resize windows that fit
This is what AeroSnap does. If a window is being unsnapped on
a new monitor, check if the work area is large enough for the
window to fit in its normal size. If the window fits, just
reposition it so that the ratio of
left-window-edge-to-screen-edge / right-window-edge-to-screen-edge
remains the same, without scaling the window.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:00:02 +00:00
Руслан Ижбулатов
0ce217cf94 GDK W32: Re-implement AeroSnap for CSD windows
It works exactly like AeroSnap.
Except for shift+win+left/right, which is left for AeroSnap
to handle (AeroSnap takes action before we get the message,
so there's no way for us to override it).
The only thing that doesn't work is shift+win+left/right on
a maximized window, for reasons unknown at the moment.

This only implements winkey+stuff behaviour of AeroSnap,
not the drag-to-the-edge-and-something-funny-happens one.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 08:59:56 +00:00
Руслан Ижбулатов
77eebbda5c GDK W32: Erase hidden layered windows before showing them
If a layered window was hidden and is made visible, erase its
contents before showing it. GDK will schedule a redraw, but until
then we generally don't want to show old contents.

https://bugzilla.gnome.org/show_bug.cgi?id=763783
2016-03-29 14:30:19 +00:00
Руслан Ижбулатов
cea8c29a26 GDK W32: Implement show_window_menu()
This is achieved by sending undocumented message WM_SYSMENU
to the window.
Before doing that, the window is given WS_SYSMENU style
(to enable window menu) and some combination of
WS_MAXIMIZEBOX (for "Mazimize" item)
WS_MINIMIZEBOX (for "Minimize" item)
WS_SIZEBOX (for "Size" item)
depending on which operations are currently permissible.

WM_SYSMENU is processed by DefWindowProc(), which results
in showing the window menu. We remove extra styles
at the first opportunity (WM_INITMENU message), as they
alter the way our window is rendered.

https://bugzilla.gnome.org/show_bug.cgi?id=763851
2016-03-29 13:47:49 +00:00
Matthias Clasen
59d8cba482 wayland: Get min/max keycode from xkb keymap
Instead of hardcoding 8/255 here.
2016-03-26 18:48:27 -04:00
Matthias Clasen
1057f249bd wayland: Add debug output for pixel formats
Use GDK_DEBUG=misc to see information about wl_shm pixel formats
supported by the compositor.
2016-03-26 16:08:01 -04:00
Matthias Clasen
f06fc8d378 Deprecate gdk_visual_get_colormap_size
Since we don't have API for colormaps anymore, this is not
a useful function.
2016-03-26 15:15:28 -04:00
Matthias Clasen
ce0074b034 Deprecate gdk_visual_get_byte_order
This function is only useful when working with XImages,
and is not meaningfully implemented in other backends.
2016-03-26 15:07:09 -04:00
Matthias Clasen
c6cdddd68d wayland: Fix up visual implementation
Don't return visuals that don't match the requested depth
and/or visual type.
2016-03-26 14:58:48 -04:00
Matthias Clasen
aa4c5459b7 Deprecate gdk_visual_get_bits_per_rgb
This function is pretty useless, since the Wayland backend returns
0 for this, and the Windows backend 42 (!).
2016-03-26 14:20:23 -04:00
Matthias Clasen
c448061d49 Add version macros for 3.22 2016-03-26 14:08:10 -04:00
Matthias Clasen
e48e29db3b wayland: Fully initialize the visual
The pixel details (mask, shift and precision) are supposed to
be filled in for TrueColor visuals.
2016-03-26 10:10:57 -04:00
Matthias Clasen
8206b824fa Make gdk_visual_get_*_pixel_details work again
These functions are supposed to return the numbers of consecutive
1 bits in each components mask as precision. However, due to a
copy-paste mistake when this code was moved around in
commit 70d689cddd, the precision
was always reported as zero. This affects only a few applications
that directly set window background on X11 windows, such as emacs.

https://bugzilla.gnome.org/show_bug.cgi?id=764210
2016-03-26 09:35:53 -04:00
Руслан Ижбулатов
b9b67e05e1 GDK W32: Optimize clipboard handling a bit
Delay as long as possible before calling OpenClipboard(),
call CloseClipboard() as quickly as possible after that.
Don't call OpenClipboard() when we don't need to (for example,
we don't need to open clipboard to call GetClipboardOwner()).

Also, print out actual W32 error code in some cases where it
was not printed before.

https://bugzilla.gnome.org/show_bug.cgi?id=763907
2016-03-26 00:03:50 +00:00
Руслан Ижбулатов
692c3b11ff GDK W32: Print error code along with the error message
Error codes can be easily looked up in an error code list
and/or googled up. Error messages, while descriptive, often
describe the wrong thing, and the messages themselves are not
part of the documentation of a function, unlike error codes.
It would be preferable to have the code, or both.

https://bugzilla.gnome.org/show_bug.cgi?id=763913
2016-03-25 22:04:58 +00:00
Руслан Ижбулатов
c4c00299b2 GDK W32: Print more debug info about events
1) Print timestamps for events
2) Print wParam and lParam (in hex form) for messages

https://bugzilla.gnome.org/show_bug.cgi?id=763913
2016-03-25 22:04:57 +00:00
Christoph Reiter
3f077ec36f quartz: fix pixelated image surfaces in retina/hidpi mode
gtk+ currently depends on the scaling factor and the cairo device scale
of both the backend surfaces and image surfaces to be equal.

Until now we didn't apply a cairo device scale at all and depended on the
automatic scaling of CGContexts. This works when drawing with cairo but
fails in case of image surfaces, which get requested at a too small size.

To make the quartz backend behave more like the X11 one, set the cairo device
scale on the surface in gdk_quartz_ref_cairo_surface(). As this conflicts
with the default scaling done by CGContext (we would get double scaling)
undo the CGContext scaling using CGContextScaleCTM().

This patch is based on the following patches by Brion Vibber:
    https://bugzilla.gnome.org/show_bug.cgi?id=740199#c4
    https://bugs.freedesktop.org/show_bug.cgi?id=69796#c4

https://bugzilla.gnome.org/show_bug.cgi?id=763779
2016-03-23 16:27:10 +01:00
Christian Hergert
c48bc48dda wayland: avoid dropping surfaces when possible
If the configure-event gives us the same size as we had before,
which is common for animation resizes, then try to keep the
existing buffer around. This saves us a memfd_create() syscall
on every frame.

https://bugzilla.gnome.org/show_bug.cgi?id=763350
2016-03-21 22:03:20 -04:00
Carlos Garnacho
219eedd7c8 wayland: Rename internal functions with misleading naming
Now that GdkWaylandDeviceData is gone, the functions prefixed
"gdk_wayland_device_" and taking a GdkWaylandSeat as first
parameter feel out of place. Renaming those makes it more obvious
that it's seat functions.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho
1597f31eba wayland: Remove GdkWaylandDataDevice typedef
It's no longer used.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho
81f0d23744 wayland: Replace all remaining uses of GdkWaylandDeviceData
And use GdkWaylandSeat in all of those. The variable names have also
been updated.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho
c9f9163544 wayland: Remove GdkWaylandDeviceData pointer in GdkWaylandDevice
It's the same than gdk_device_get_seat() nowadays. Also, rename the
usages of GdkWaylandDeviceData to GdkWaylandSeat in the functions
affected by the removal.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01: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
de4cb363c2 Document gdk_wayland_seat_get_wl_seat 2016-03-20 22:49:33 -04:00
Matthias Clasen
e4d3987b17 gdk: Add a missing Since tag
gdk_drag_context_manage_dnd was introduced this cycle.
2016-03-20 22:45:06 -04:00
Matthias Clasen
1c692c64fe gdk: Reword some docs 2016-03-20 22:29:37 -04:00
Benjamin Otte
9782a2b729 broadway: Use explicit sizes for payload length
The previous greater than comparisons would never trigger the 2nd case.

http://www.viva64.com/en/b/0383/
2016-03-20 05:51:42 +01: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
471cdee97f broadway: Remove duplicate initialization
http://www.viva64.com/en/b/0383/
2016-03-20 05:31:20 +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
Руслан Ижбулатов
7d2a7a5626 GDK W32: Don't move iconic windows
Using UpdateLayeredWindow() on iconic windows brings them *back* from
their iconic (minimized) state. That is bad.
As a precaution, also don't use SetWindowPos() on iconic windows.
This means that iconic windows can't be moved. That is fixable
by using SetWindowPlacement(), but there is no pressing need to do so,
as there are very few cases when windows need to be moved while minimized.

https://bugzilla.gnome.org/show_bug.cgi?id=763835
2016-03-18 07:49:39 +00:00
Christian Hergert
1bd5be6b7c quartz: fix quartz build
More fallout from recent refactoring.

See also b3860e407d.
2016-03-17 21:18:58 -07:00
Руслан Ижбулатов
5ac848d229 GDK W32: Fix shown window position calculation for dialogs and splashes
Two errors here:
1) A typo in splashscreen rectangle calculation - sets right twice
   instead of setting top
2) Centering for dialogs is off because it doesn't convert
   GDK virtual desktop coordinates to Windows WM virtual desktop
   coordinates by adding _gdk_offset_*

https://bugzilla.gnome.org/show_bug.cgi?id=763628
2016-03-14 16:31:14 +00:00
Carlos Garnacho
2923f69d3c gdkdnd: Add private means to commit the drag status
The way gdk_drag_status() may be called multiple times during the
processing of drag and drop events throughout the widget hierarchy
brings some superfluous messaging going in, esp. when it's the last
request the one we want to honor, yet we emit messaging requests on
all.

This is barely appreciable in the X11 backend, but due to the design
of the wayland protocol, quick series of changes like this it have
some self-amplificating consequences which may end up flooding the
connection.

We can delegate this to a late "commit" call, performed within GDK
event management. This way gdk_drag_status() calls may be cached
and only result in windowing messaging once per ::drag-motion or
::drag-data-received event. Emitting the final status will also
avoid spurious action changes on the compositor and the other peer.

https://bugzilla.gnome.org/show_bug.cgi?id=763298
2016-03-14 16:50:36 +01:00
Руслан Ижбулатов
ab16b19a0a GDK W32: Fix pointer-under-window code for custom resize
This code:
>  gdk_window_get_root_origin (window, &x, &y);
>  x -= root_x;
>  y -= root_y;
>  pointer_window = gdk_device_get_window_at_position (device, &x, &y);
was meant to find the child gdk window at coordinates root_x and root_y.

These 4 lines had 2 bugs:
1) x = x - root_x (same for y) is wrong, it should be x = root_x - x
2) gdk_device_get_window_at_position() does not give you the window
   at position x and y. It gives you the window under the device
   (mouse pointer) and the returns the device coordinates in x and y.

https://bugzilla.gnome.org/show_bug.cgi?id=763533
2016-03-14 15:06:51 +00:00
Руслан Ижбулатов
a97e8fd078 GDK W32: Fix a typo 2016-03-12 12:14:04 +00:00
Matthias Clasen
4d84e7a8f7 Trivial formatting fix 2016-03-11 21:42:33 -05:00
Friedrich Beckmann
8879052887 added NSEventTypeMagnify and NSEventTypeRotate for ZOOM and ROTATE gestures
MacOS provides the NSEventTypeMagnify which is very similar to the
Gtk ZOOM gesture and NSEventTypeRotate which is very similar to the
Gtk Rotate gesture. Those two event sequences are translated to a
sequence of GDK_TOUCHPAD_PINCH events. This sequence is then detected
in the upper gtk layers as Gtk Zoom/Rotate Gestures.

https://bugzilla.gnome.org/show_bug.cgi?id=760276
2016-03-11 09:59:01 -05:00
Jonas Ådahl
f8bbbbf684 gdk: Don't leak discarded window state event
When compressing window state events, we didn't free the discarded
event after removing it from the queue, causing us to leak it. This
commit makes sure to free the discarded event after unqueuing it.

https://bugzilla.gnome.org/show_bug.cgi?id=762468
2016-03-11 07:11:34 -05:00
Руслан Ижбулатов
65ea6f8736 GDK W32: Partially rollback the custom resize for GL windows
If a window is being drawn by OpenGL, we need to apply any
pending resizes to it *before* we paint.

https://bugzilla.gnome.org/show_bug.cgi?id=763287
2016-03-10 13:09:32 +00:00
Philip Chimento
b3860e407d quartz: Get core pointer from device manager
Some spots missed in the earlier refactor removing core_pointer from
the GdkDisplay struct.

https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-03-09 22:11:07 -08:00
Jonas Ådahl
8fb7f50028 wayland: Add request focus support via gtk_shell
A gtk_surface.present request was added to gtk_surface which takes
timestamp from some input event, and uses that timestamp to figure out
whether the window can be presented or not. If we don't have a
timestamp, we should just give up instead of making up our own,
otherwise we might steal someones focus.

https://bugzilla.gnome.org/show_bug.cgi?id=763037
2016-03-10 12:31:15 +08:00
Jonas Ådahl
ed430dc00a wayland: Add system bell support via gtk_shell
Invoke the system bell by calling the request added to the gtk_shell
protocol.

https://bugzilla.gnome.org/show_bug.cgi?id=763001
2016-03-10 12:31:15 +08:00
Jonas Ådahl
f68cf698fc wayland: Don't invent our own unstable protocol semantics
The gtk_shell protocol used some half baked unstable protocol semantics
that worked by only allowing binding the exact version of the
interface. This hack is a bit too confusing and it makes it impossible
to do any compatible changes without breaking things.

So, instead rename it to include a number in the interface names. This
way we can add requests and events without causing compatibility issues,
and we can later remove requests and events by bumping the number in
the interface names.

https://bugzilla.gnome.org/show_bug.cgi?id=763001
2016-03-10 12:31:15 +08:00
Carlos Garnacho
aaa467679d wayland: Make data_source_target() an empty stub
This request actually means nothing to the upper GDK layers,
we used to preempt a GDK_SELECTION_REQUEST event, but this is too
eager, and not like things work in X11.

Originally in wayland, this event may be used for feedback purposes.
We however don't perform any mimetype-based feedback, so we can
safely ignored.

This makes data_source_send() the only place where we actually
trigger GDK_SELECTION_REQUEST, this one is conceptually the same
than the X11 selection request event.
2016-03-09 18:39:16 +01:00
Carlos Garnacho
f61965233b wayland: Allow 0-size writes in selection/dnd
It's not something we should be forbidding explicitly, definitely
no-op is not the best option.
2016-03-09 18:39:15 +01:00
Carlos Garnacho
3da4b81427 wayland: Clear more thoroughly the source-side data on dnd_finished
The targets should also be unset.
2016-03-09 18:39:15 +01:00
Carlos Garnacho
ec2257e53c wayland: Unset the source-side DnD fd after passing it to the stream
The ownership is given to the stream, so unset it here.
2016-03-09 18:39:15 +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
Chun-wei Fan
15c9b3e692 GDK-Win32: Make update_stye_bits() available within the backend
Other portions of the GDK-Win32 backend make use of this function as
layered windows need to be disabled for GL windows and possibly other
parts, so make this function a private function that is available within
the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=763285
2016-03-08 13:26:59 +08:00
Chun-wei Fan
3f190e0fa6 Win32: Disable layered windows for GL
Layered windows and GL do not work well together, so disable layered
windows when initiating a GdkGLContext, so that GtkGLArea programs can run
properly.

Also based on patch by LRN to address the issue.

https://bugzilla.gnome.org/show_bug.cgi?id=763080
2016-03-08 12:16:37 +08:00
Matthias Clasen
13a94b66b6 Sync default double-click time with GNOME
The default value for the double-click key in the
org.gnome.settings-daemon.peripherals.mouse schema is 400.
Use the same value as the declared default for the
gtk-double-click-time GTK+ setting, to avoid pointless
differences in corner cases.

https://bugzilla.gnome.org/show_bug.cgi?id=720950
2016-03-07 07:50:29 -05:00
Matthias Clasen
1388b111a8 wayland: Implement gtk-keynav-use-caret setting
This is anticipating the gsetting that will be introduced in
https://bugzilla.gnome.org/show_bug.cgi?id=763123
2016-03-07 07:35:36 -05:00
Paolo Borelli
8f25481406 win32: use a struct for the event source
This removes the event_poll_fd global variable and the (ab)use of
get_default_display. It is also more consistent with other backends.

Also store display
2016-03-05 20:31:10 +01:00
Paolo Borelli
58a49c1a4b win32: fix "unused variable" warning 2016-03-05 20:31:10 +01: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
aadbabf998 wayland: Don't crash with offscreen windows
Use gdk_window_get_effective_toplevel when looking for
a suitable transient parent, to skip over offscreen windows
that we might encounter in the window tree. This fixes
a crash in glade.

https://bugzilla.gnome.org/show_bug.cgi?id=763110
2016-03-04 20:04:43 -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
Matthias Clasen
69479ceaef wayland: Clean up key repeat timeout
When returning G_SOURCE_REMOVE from a callback, we need
to reset the source id as well.
2016-03-04 13:56:26 -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
Руслан Ижбулатов
a55f1113f5 Remove unused variable 2016-03-03 18:00:44 +00:00
Руслан Ижбулатов
95fe3ec0c9 GDK W32: Fix redrawing during drag-move with no composition 2016-03-03 18:00:43 +00:00
Руслан Ижбулатов
ba89fbd72d GDK W32: Set default cursor from our own theme right away
Otherwise WM-dependent default cursor is used, which does not
match our theme. Worse, later GDK will realize that we have
our own left_ptr cursor and will apply it after all, making
the discrepancy even more noticeable.

https://bugzilla.gnome.org/show_bug.cgi?id=762902
2016-03-03 07:20:02 +00:00
Руслан Ижбулатов
84ddc6aab1 GDK W32: Force correct mouse cursor for custom resize/move
* Explicitly grab the device, setting appropriate cursor on it.
* Fix gdk_device_virtual_set_window_cursor() to just set the
  cursor, without trying to check that mouse is over the given
  window. Also prevent it from immediately resetting cursor.
* Alse take into account things that happen in other parts of
  GDK - don't look for replacement cursor, GDK already did that,
  and don't create a default arrow cursor instead of NULL,
  GDK-W32 already did that up the stack as well.
  Warn about inappropriate cursor == NULL argument instead.

https://bugzilla.gnome.org/show_bug.cgi?id=762711
2016-03-03 07:17:46 +00:00
Руслан Ижбулатов
f9ed3fdd7b GDK W32: Implement gdk_win32_screen_get_monitor_workarea()
https://bugzilla.gnome.org/show_bug.cgi?id=763012
2016-03-03 05:29:12 +00:00
Руслан Ижбулатов
c05f254a6e GDK W32: Use layered windows
Toplevels are now true layered windows that are moved,
resized and repainted via UpdateLayeredWindow() API call.
This achieves transparency without any extra effort,
and prevents window size and window contents desychronization
(bug 761629).

This also changes the way CSD windows are detected. We now
use window decorations to detect CSDiness of a window,
and to decide whether a window should be layered (CSD windows should
be) or not.

Decorations are now stored in the window implementation,
not as a quark-based property of the window-as-gobject.

https://bugzilla.gnome.org/show_bug.cgi?id=748872
2016-03-02 21:42:50 +00:00
Руслан Ижбулатов
e03946bd28 GDK W32: custom (non-WM) drag-move and drag-resize code
Normally works only on CSD windows, non-CSD windows continue
to use WM modal loop for drag-resizing and drag-moving. However,
if it is activated on non-CSD windows, it does work.

Has the advantage of being completely immune to AeroSnap.
AeroSnap only worked partially on CSD windows, with the only part
that worked being "don't let users drag window titlebar outside of
the desktop". Now AeroSnap doesn't work on windows moved by
this code at all, which is good, since they currently don't work
well with it due to the way shadows are drawn.

It's possible to also re-implement AeroSnap (or something similar),
but that is a story for another commit.

This code was originally intended to fix the problem of window
size and window contents desynchronization, but failed to achieve
that result in the end. Nevertheless, it serves as a foundation for
other changes to the way window resizing works.

https://bugzilla.gnome.org/show_bug.cgi?id=761629
2016-03-02 21:39:32 +00:00
Ray Strode
b5281837d6 wayland: synchronize key repeat with server
key repeat is handled client side, which means stalls in the compositor
dispatching key release events can lead to fictious repeat events.

This commit ties key repeat to a server roundtrip to ensure the client
and server are in sync.

https://bugzilla.gnome.org/show_bug.cgi?id=757942
2016-03-02 13:07:12 -05:00
Ray Strode
551f1742f5 wayland: handle key up events earlier in deliver_key_event
We don't need the key repeat rate or anything like that when
handling key up events, so do key up events first before querying
for that information.

https://bugzilla.gnome.org/show_bug.cgi?id=757942
2016-03-02 13:07:12 -05:00
Ray Strode
619799ba3b wayland: make deliver_key_event return void
deliver_key_event is sometimes called from a timeout handler and
sometimes called directly.  We currently erroneously return TRUE
(G_SOURCE_CONTINUE) in the case where it's called directly, but to
no ill effect, since we ignore that return value. In the future,
we're going to need to call it directly in other parts of the code
where the return value would be relevant and handling TRUE, would
require adding redundant code.

Instead, this commit just changes the code to always reset the timer
manually, and never rely on glib's ability to automatically reset
the timer by returning TRUE.  This makes the code smaller, too, since
there's less special casing required.

https://bugzilla.gnome.org/show_bug.cgi?id=757942
2016-03-02 13:07:12 -05:00
Rico Tzschichholz
1e27fe83ea mir: display->list_devices vfunc was dropped
See 4a6f8a065a

https://bugzilla.gnome.org/show_bug.cgi?id=762891
2016-03-02 10:24:44 +01:00
Olivier Fourdan
de383809f6 wayland: Check actual impl type in transient loop
If the parent of a transient is not a native Wayland window (e.g.
offscreen window), the transient loop check will crash.

Check for the actual type in the transient loop check and do not assume
the parent is necessarily Wayland native.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=761156

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-03-01 22:18:32 -05:00
Jonas Ådahl
9e2207b2b0 gdk: Compress window state events
If there are already a window state event for a given window queued
when the window state is changed, drop that event and queue a new event
with a changed_mask based on the state before last event that was queue
without compression.

https://bugzilla.gnome.org/show_bug.cgi?id=762468
2016-03-02 10:22:17 +08:00
Olivier Fourdan
3607b9aa2e wayland: Restore size when configure size is 0x0
According to xdg_shell, an xdg_surface.configure with size 0x0 should
be interpreted as that it is up to the client to set a size.

When transitioning from maximize or fullscreen state, this means the
client should configure its size back to what it was before being
maximize or fullscreen.

This problem currently only occurs on weston because weston sends a
configure with size 0x0 when transitioning back from maximize or
fullscreen.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=762713
2016-03-01 13:15:02 +01:00
Paolo Borelli
fa43edd244 gdk: implement gdk_display_list_devices using GdkSeat
Now that the function is factored out in a single place, we can
refactor it to not use deprecated API.
2016-02-29 21:54:01 +01: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
33ac51ea72 win32: init wintab when the device manager is constructed
No need to call a method explicitely after creating the object
2016-02-29 18:25:01 +01:00
Paolo Borelli
e9d2a622e2 win32: actually call _gdk_win32_screen_on_displaychange_event
41a371c435 factored out a method
but I forgot to actually amend the commit to call the new function
2016-02-29 18:25:01 +01:00
Ray Strode
316fe1dbbd wayland: deal with staging buffer getting allocated prematurely
The staging buffer gets allocated any time begin_paint is called
on the window. This can happen even with an empty paint region,
so we should cope with that situation. At the moment we crash
trying to post a runtime warning.

https://bugzilla.gnome.org/show_bug.cgi?id=762755
2016-02-29 10:52:00 -05: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
Paolo Borelli
502744be85 quartz: get the core pointer from the device manager
https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-02-29 14:15:04 +01:00
Paolo Borelli
539b1083de broadway: get the core pointer from the device manager
https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-02-29 14:15:04 +01:00
Paolo Borelli
363f9c9571 gdkdisplay: get the pointer device from the default seat
https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-02-29 14:05:00 +01:00
Paolo Borelli
807c0c0a56 gdkwindow: get the pointer device from the default seat
https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-02-29 14:05:00 +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
29c1263c4b wayland: 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:23 -05:00
Matthias Clasen
2a2d254a8b quartz: 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:23 -05:00
Matthias Clasen
2801f3c843 gdk: 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:23 -05:00
Paolo Borelli
187027942c gdk: remove _gdk_event_queue_prepend
It is never used
2016-02-28 19:05:53 +01:00
Matthias Clasen
e0caafbcdf display: Don't change default seat in flight
gdk_display_add_seat was prepending new seats to the list, which
was effectively making the added seat the new default. Since that
is probably not intended, append to the list.
2016-02-28 12:31:20 -05:00
Matthias Clasen
664b166838 wayland: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Matthias Clasen
4f422d1f5b quartz: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Matthias Clasen
1c887b2287 gdk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -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
Matthias Clasen
94342300a8 broadway: 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
72b40266bd gdkwindow: cleanup, avoid direct access to display members 2016-02-28 18:22:42 +01:00
Paolo Borelli
aaed73671c win32: close the screen when disposing the display 2016-02-28 15:53:52 +01:00
Emmanuele Bassi
d59c796a9d Fix builddir != srcdir
The gdkprivate-wayland.h header file is included from the top-level gdk
directory; this means that all included files referenced in the header
must be relative to the `gdk` directory, otherwise the build will fail
when the build directory is not equal to the source directory.

This commit fixes a build failure under continuous:

In file included from ../../gdk/gdkdisplaymanager.c:60:0:
../../gdk/wayland/gdkprivate-wayland.h:40:51: fatal error:
gtk-primary-selection-client-protocol.h: No such file or directory
 #include "gtk-primary-selection-client-protocol.h"
                                                   ^
compilation terminated.
Makefile:1155: recipe for target 'libgdk_3_la-gdkdisplaymanager.lo' failed
make[4]: *** [libgdk_3_la-gdkdisplaymanager.lo] Error 1
2016-02-28 12:21:26 +00:00
Paolo Borelli
41a371c435 win32: factor out on_displaychange_event method for the screen
This allows us to make more initialization methods private to the
screen object.
2016-02-28 12:19:08 +01:00
Paolo Borelli
48d693ea80 win32: make init_root_window private to the screen object
It can be called during the screen object initilization
2016-02-28 12:18:58 +01:00
Paolo Borelli
b20f80e65a win32: move function
Just reorder code in preparation to calling functions defined
before this one
2016-02-28 11:53:10 +01:00
Paolo Borelli
00f396dea9 win32: rename initialization function for clarity 2016-02-28 11:50:07 +01:00
Paolo Borelli
58e169c04c win32: do not confuse gtk-doc 2016-02-28 11:37:38 +01:00
Paolo Borelli
e48bd2e00b win32: move gdkvisual code in gdkscreen
Except for the init function, all the visual related code is made
of gdkscreen vfuncs, so let's move it to gdkscreen-win32. This way
we avoid keeping other static variables and instead store the info
inside the screen struct.
2016-02-28 11:37:38 +01: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
914f7bd6e4 wayland: Survive without primary selection
I am testing GTK+ master against mutter 3.19.90, so I'd
like GTK+ to survive even when the compositor does not
support the primary selection interface.
2016-02-26 19:48:05 -05:00
Matthias Clasen
9f37557ffc Fix an memory overrun
This was detected by gccs address sanitizer.
2016-02-26 15:52:19 -05:00
Carlos Garnacho
a2c575e34e wayland: Use the page size as the selection buffer size
And ensure we don't attempt to read EOF twice, once is enough.
2016-02-26 19:59:17 +01:00
Carlos Garnacho
ed3c87df7a wayland: Implement the (so far internal) primary selection protocol
Implement it using the internal copy of the protocol. Otherwise,
we just deal with it the same than clipboard selection, just mapping
it to the PRIMARY atom instead of the CLIPBOARD one.

https://bugzilla.gnome.org/show_bug.cgi?id=762561
2016-02-26 19:59:17 +01:00
Carlos Garnacho
f9f5586714 wayland: Make the function to get the last serial a seat one
This will be useful for primary selection.

https://bugzilla.gnome.org/show_bug.cgi?id=762561
2016-02-26 19:59:17 +01:00
Carlos Garnacho
787e1d7113 wayland: Add gtk-primary-selection protocol
This protocol is an internal mirror of the primary selection drafts
being proposed for wayland-protocols. No changes besides prefix/suffix
changes.

https://bugzilla.gnome.org/show_bug.cgi?id=762561
2016-02-26 19:59:17 +01:00
Fredy Paquet
0a6ee5e2cf W32: Fix for commit 1f74f12d9, re-enabling decimal separator key
1f74f12d9 rendered entry of keypad decimal mark unuseable for
several national keyboard layouts, this commit amends that, at
least for W32, and makes GTK+ behave more or less the same way
W32 behaves.

The patch works like this:
- When typing the first character at the keyboard or when switching
  keyboard layouts, the decimal mark character will be cached in the
  static variable "decimal_mark" within gdkkeys-win32.c

- in case of WIN32, gdk_keyval_to_unicode() asks gdkkeys-win32.c for the
  current decimal_mark when converting GDK_KEY_KP_Decimal.

https://bugzilla.gnome.org/show_bug.cgi?id=756751
2016-02-26 17:24:32 +00:00
Руслан Ижбулатов
c61764b0f9 GDK W32: Fix the filling of MINMAXINFO
1) MSDN says that the coordinates of the maximized window
   must be specified as if the window was on the primary display,
   even if nearest display where it ends up is not the primary display.
   So instead of using nearest display work area verbatim,
   use it only to account for taskbar size, while using
   primary display top-left corner (0:0) as the reference point.
2) MSDN says that max tracking size is a system property, we
   should just call GetSystemMetrics() and use that.

https://bugzilla.gnome.org/show_bug.cgi?id=762629
2016-02-26 08:02:03 +00: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
5b2e883161 Remove redundant words from docs
An either without an or doesn't add anything.
2016-02-25 20:16:21 -05:00
Matthias Clasen
f749152efe Fix a copy-paste error 2016-02-25 20:12:53 -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
f468f0fbb2 device: Add a num-touches property
Some backends can provide this information for touch devices,
and it can be useful to have, so add this property.
2016-02-25 08:27:08 -05:00
Matthias Clasen
e12663378c x11: Update seat capabilities
The default seat implementation was never returning capabilities,
which is broken. It is visible too, since the inspector shows seat
information now.
2016-02-25 06:18:41 -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
William Hua
acbb0c4bdd mir: fix warnings 2016-02-24 13:24:14 -05:00
William Hua
594ba3071b mir: fix GdkSeat-related deprecations 2016-02-24 13:23:18 -05:00
Carlos Garnacho
4ff3d5b7a6 gdk: Avoid 2/3BUTTON event generation if the source device changes
Remember the last source device we're generating multiple clicks for,
just so we can bail out if the device changed. That will just reset
the counting.

https://bugzilla.gnome.org/show_bug.cgi?id=723659
2016-02-23 20:35:01 -05:00
Paolo Borelli
c643d8b402 Win32: fix warning 2016-02-22 21:45:08 +01:00
Paolo Borelli
bc3c855e35 wip _gdk_display 2016-02-22 21:45:08 +01:00
Paolo Borelli
7047099fd8 Win32: fold the gdkinput.c file in gdkdisplay-win32.c
This is similar to what is done in the X11 and wayland backends.
It also gets rid of the _gdk_input_devices global variable
2016-02-22 21:45:08 +01:00
Paolo Borelli
b3a80180c7 Win32: remove leftover function
gdk_devices_list was removed from the API in 3.0 and it is not
in the headers. The win32 implementation lingered on by mistake.
2016-02-22 21:45:08 +01:00
Allin Cottrell
46d3611052 Fix Quartz Full Screen Crash. 2016-02-21 16:22:27 -08: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
ebb175021e wayland: Implement gtk_shell.set_startup_id
Fetch the DESKTOP_STARTUP_ID envvar at the same point it's done
for the X11 backend, and notify the startup ID gotten on
notify_startup_complete().
2016-02-19 17:45:42 +01:00
Carlos Garnacho
ce62f0513d wayland: Update gtk-shell protocol to v3
Add a gtk_shell.set_startup_id request, so the application can communicate
to the compositor the startup id that it received through the
DESKTOP_STARTUP_ID envvar, or other means.
2016-02-19 17:45:42 +01:00
Paolo Borelli
7505d49741 Win32: free the monitors array 2016-02-19 15:49:29 +01:00
Paolo Borelli
3aec838313 Win32: chain up screen finalize
Add the proper chain up (in preparation to actually freeing stuff) and
remove the empty dispose implementation
2016-02-19 15:49:29 +01:00
Paolo Borelli
577016126e Win32: remove the _gdk_monitors global variable
Make it a field of GdkWin32Screen since that is the object exposing
all the the getters.
2016-02-19 15:28:38 +01:00
Paolo Borelli
2e7f98a683 Win32: remove the _is_win8_or_above global variable 2016-02-19 15:28:38 +01:00
Matthias Clasen
9c2110122b gdk: Add a way to show included backends
Set GDK_BACKEND=help to see a list of all inluded GDK backends.
2016-02-18 22:03:12 -05:00
Olivier Fourdan
5a253c546a wayland: check for support of xdg_shell interface
When running with a Wayland compositor which doesn't support the
xdg_shell interface, gtk+ will segfault while trying to access the
corresponding wl proxy.

Check for xdg_shell support and do not use Wayland if not present, so
that it can fallback to X11, hoping that Xwayland is usable.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=762258
2016-02-18 15:29:01 +01:00
Jonas Ådahl
38b1f15f12 wayland: Only attach the buffer if there was damage
There is no point in attaching and then committing the same buffer if
there was no damage. This will also make us do less unnecessary backfill
read backs, for the cases where we paint with an empty paint region.

https://bugzilla.gnome.org/show_bug.cgi?id=762120
2016-02-16 16:22:51 -05:00
Jonas Ådahl
64c9ec14fe wayland: Handle after-paint invocations when nothing was painted
If a after-paint was scheduled but nothing was painted, for example when
the it was scheduled by a subsurface wanting to update its position,
we'd still try to read back from the backfill cairo surface and update
the committed cairo surface reference even though no buffer was
attached.

Fix this by adding a new state, 'pending_buffer_attached', which is only
true if a buffer was attached during frame. Only when this is true will
the backfill be read back and the committed cairo surface reference be
updated.

https://bugzilla.gnome.org/show_bug.cgi?id=762120
2016-02-16 16:22:51 -05:00
Carlos Garnacho
38d0d0a687 gdkdnd: Stick to the first gdk_drag_drop_done() result
That way we can let ::cancel callers to override the visual
result of the operation (eg. when detaching notebook tabs on
NO_TARGET).

Also, document gdk_drag_drop_done() so it is mentioned that
this is a one-shot call.

https://bugzilla.gnome.org/show_bug.cgi?id=761954
2016-02-15 19:04:22 +01:00
Carlos Garnacho
4636552a76 gdkdnd: Make GtkDragContext::cancel RUN_LAST
The default implementation code should act as a catch-all fallback,
we let the connected handlers to run first then.

https://bugzilla.gnome.org/show_bug.cgi?id=761954
2016-02-15 18:35:51 +01: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
Emmanuele Bassi
90d5c7f9e8 mir: Add C++ guards
Avoid missing symbols when compiling C++ including the GDK Mir backend
header.

https://bugzilla.gnome.org/show_bug.cgi?id=761829
2016-02-11 12:01:39 +00:00
Benjamin Otte
033fb5a879 win32: Always pass a window to the default event filters
This has to happen or the event filter cannot identify what type
of display the event is from (ie if it's an XEvent, a broadway
event or a win32 MSG.
2016-02-11 03:44:48 +01:00
Benjamin Otte
ec3ce21beb win32: Remove _gdk_display usge from dnd code 2016-02-11 03:44:47 +01:00
Benjamin Otte
7f266e1a03 win32: Make cursor code work without _gdk_display 2016-02-11 03:44:47 +01:00
Benjamin Otte
76e56c5038 win32: Stop using _gdk_display global in device code
Use gdk_device_get_display() instead.
2016-02-11 03:44:47 +01:00
Benjamin Otte
766b1b9886 win32: Remove deprecation warnings in dnd code 2016-02-11 03:44:46 +01:00
Benjamin Otte
4ce6d10601 win32: Remove deprecation warnings in devicemanager code 2016-02-11 03:44:46 +01:00
Benjamin Otte
584931e94d win32: Use g_set_object()
... instead of a hand-rolled version that does the same thing.
2016-02-11 03:44:46 +01:00
Benjamin Otte
788951c543 win32: Fix empty body warning 2016-02-11 03:44:46 +01:00
Ignacio Casal Quinteiro
eb555979db win32: properly handle show and focus
The first time a window is shown we should always call SW_SHOWNORMAL.
Understand whether to call SW_SHOW or SW_SHOWNORMAL and the specific
ones for the temporary windows depending on IsWindowVisible.
This also fixes the problem when calling gtk_window_present and
the window is snapped to the left or right of the screen.

This patch is based on the patches provided by Yevgen Muntyan
and Aleksander Morgado.

https://bugzilla.gnome.org/show_bug.cgi?id=698652
2016-02-08 13:25:01 +01:00
Yevgen Muntyan
07a994c89f win32: on focus restore the window if iconified
If the window is iconified we want to restore the window
to get the proper size instead of showing it normal which
would change the size of the window.

https://bugzilla.gnome.org/show_bug.cgi?id=698652
2016-02-08 12:58:58 +01:00
Ray Strode
c80dd54924 wayland: stage uncommitted changes to dedicated buffer
Right now we use one buffer for both staged changes (freshly painted
changes waiting for the frame clock to send to the compositor) and
committed changes (changes actively being read by the compositor
process). This creates a problem in the event we need to stage updates
at the same time the compositor is processing committed updates: we
can't change what the compositor is actively processing.

The current solution for handling this contention is to allocate a
temporary buffer on the spot at the time the updates are staged, and to
copy that buffer back to the shared buffer later.  The problem, though,
is that the copy to the shared buffer currently happens as soon as
the updates are finished being staged, not when the shared buffer is
done being processed by the compositor.

In order to address that problem, this commit changes the code to always
stage changes to a dedicated staging buffer.  The staging buffer is
used exclusively by the client until the client is done with it, and then
once that staging buffer is committed, the client never writes to that
buffer again.  If the client needs to stage new updates, it allocates a
brand new staging buffer, draws to it, and back fills the undrawn parts
of the buffer from a copy of the contents of the committed buffer.

As an optimization, the compositor has the option of releasing the
committed buffer back to the client.  If it does so before the client
needs to stage new updates, then the client will reuse the buffer
for staging future updates.  This optimization prevents having to allocate
a new staging buffer and the associated cost of back filling
that new buffer with a readback of the committed buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-06 08:02:57 -05:00
Ray Strode
40e91195ad wayland: don't handle buffer release centrally
Right now we handle buffer releases coming from the
compositor in a central place. We add a listener when
first creating the shared buffers.

This is problematic because a buffer can only have
one listener on it at once so users of the buffer
can't get notified when it's released.

This commit moves the buffer listener code from the
centrally managed display code to the cursor and window
code.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-06 08:02:57 -05:00
Ray Strode
2c300081c4 wayland: always return FALSE from begin_paint
The client and compositor share access to the window
pixel buffers. After the client hands off (commits)
the buffer to the compositor it's not supposed to write
to it again until it's released by the compositor.

The code tries to deal with this contention by allocating
a temporary buffer and using that in the mean time. This
temporary buffer is allocated by a higher layer of the code
when begin_paint returns TRUE. Unfortunately, that layer of
the code has no idea when the buffer is released, so it ends
up blitting the temporary buffer back to the shared buffer
prematurely.

This commit changes begin_paint to always return FALSE.

A future commit will address the contention problem in
a different way.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-06 08:02:57 -05:00
Ray Strode
1cfa2f4134 wayland: use g_clear_pointer when destroying cairo surfaces
There are a few places where we destroy a cairo surface and
then nullify it. This commit changes those to use
g_clear_pointer instead.

It also drops a cairo_surface_finish call that is unnecessary

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-06 08:00:35 -05:00
Ray Strode
e6f92df57e wayland: rename cairo surface user data key to be more specific
This commit renames the key name to be more specific for clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-06 07:59:25 -05:00
Ray Strode
3ac78ea0be wayland: move server proxy objects to substructure
This commit moves the server proxy objects to a substructure
for clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-06 07:59:09 -05:00
Ray Strode
f90db30b9e wayland: rename window->surface to window->wl_surface
The name surface is really overloaded when dealing
with wayland windows.

To alleviate ambiguity, this commit changes the name
of the "surface" and "subsurface" members to have
a wl_ prefix.

https://bugzilla.gnome.org/show_bug.cgi?id=761312
2016-02-06 07:58:56 -05: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
Benjamin Otte
a2ac9524bc broadway: Define variables where they are used
Avoids gcc warnings about unused variables.
2016-02-03 23:07:05 +01:00
William Hua
9b08853537 gdkborder: remove unneeded definition
This reverts 54fa65f544,
5190d010d9, and
a6e4de2884.

https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-02-03 11:20:52 -05:00