Commit Graph

632 Commits

Author SHA1 Message Date
Michael Catanzaro
09273d91f3 wayland: print correct coordinates during DnD
Convert wl_fixed values to floats for printing, rather than printing
them as non-meaningful integers.

https://bugzilla.gnome.org/show_bug.cgi?id=752025
2015-07-06 11:32:26 -05:00
Olivier Fourdan
c806f9b709 ignore size inc when maximized/fullscreen
Under Wayland, fullscreen/maximized windows may not cover the entire
area when a size increment is specified.

Ignore size increments for fullscreen/maximized windows just like most
window managers do under X11 so that windows with size increments can
still be fullscreen or fully maximized under Wayland as well.

https://bugzilla.gnome.org/show_bug.cgi?id=751368
2015-07-03 16:21:13 +02:00
Carlos Garnacho
de68968f89 wayland: Return the right type atom on gdk_selection_property_get()
We mistakenly forced the "STRING" type, which was able to confuse higher
layer helpers like gtk_selection_data_get_uris(). This fixes a crash
happening anytime a drop is attempted on a GtkPlacesSidebar.
2015-06-29 18:39:33 +02:00
Carlos Garnacho
50178ce014 wayland: Prepare against NULL selection owners on data_source requests
Currently, due to the lack of progress information in the Wayland DnD
protocol, we assume a DnD operation is finished after the first
data_source.send is finished (It's either that or leaving stuck grabs).

This however breaks previous assumptions that dest widgets can request
the data multiple times, even in response to GtkWidget::drag-motion.
This leaves us with a NULL owner for the DnD atom when we aren't
finished receiving wl_data_source events yet, causing a crash.

This commit fixes the crash, the behavior left is still far from
desirable though...
2015-06-29 18:39:05 +02:00
Carlos Garnacho
8509a07a08 wayland: Set the master device on the drop-side GdkDragContext
And force the ungrab on it, instead of the slave, in the case of
local DnD drop. This avoids confusions on the pointer events spawn
from DnD, as GDK doesn't think anymore those are from a slave device.
Most namely, it fixes the stuck grab when finishing DnD on the
same app it was started from.
2015-06-26 14:35:41 +02:00
Carlos Garnacho
1178a0ac8b wayland: Split handling of clipboard/DnD data offers
We currently only hold the last offer received, which is wrong, as both
are independent and have different life cycles.

This means we have to store per-selection wl_data_offer and targets, and
maintain these as appropriate from the clipboard/DnD specific entry points.
2015-06-26 14:29:42 +02:00
Carlos Garnacho
350d555893 wayland: Fix compile warning in DnD/selection code
Introduced in my recent commits
2015-06-25 18:44:49 +02:00
Carlos Garnacho
6cc9b17429 wayland: Plug some memleaks in DnD/clipboard code
gdk_atom_name() return value must be freed, this code was consistently
not doing so...
2015-06-25 15:09:56 +02:00
Carlos Garnacho
342db27278 wayland: protect against unknown mimetype requests
This oddly can be reproduced with weston+weston-dnd, when dragging
anything from GTK+ into weston-dnd, it will insist on picking its
custom application/x-wayland-dnd-flower mimetype, and this request
forwarded by the compositor, even if GTK+ didn't announce it on
its wl_data_source mimetype list. (What should probably happen here
is that the request is silenced, and/or weston-dnd picks (null))

This should be harmless, we are leaking though the fd in that case,
because the emission of GdkEventSelection on an unhandled mimetype
results in NOP. In order to avoid this, we should check whether the
mimetype is supported at all on the backend code and possibly close
the fd, this involves storing these in the first place.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho
fb266a8876 wayland: Ensure we close the fd on all error paths in data_source.send
https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho
3bd7b2a6fb wayland: close() the selection fd if we didn't start writing yet
If the other peer requests data too fast (too rare/unlikely though),
we might receive multiple gdk_wayland_selection_request_target() calls
with no ending gdk_wayland_selection_check_write(), in which case the
fd is leaked as no GOutputStream was created to take over it.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho
5e7159413d wayland: Ensure we cancel previous selection writes before starting one
We weren't catching all the places where the AsyncWriteData operation
should be cancelled, which could happen if we repeatedly request the
same target on different fds.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho
69b5955108 wayland: Do not close the descriptor on async_write_data_free()
At the moment we create the AsyncWriteData, the ownership of the
fd is granted to the GOutputStream, and the fd set to -1, so at
this moment we're just silently getting EBADFD.

This partially reverts 25885ca600, the initialization of .fd
to -1 is valid and stays though.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho
de2268000d wayland: Ensure device grabs generate crossing/focus events
On X11 this is something the windowing system does for us, which the
wayland backend should emulate, being grabs completely client-side.

So, if the grab and current focus windows differ, make sure we emit
focus/crossing events as it corresponds to the grab device.
2015-06-24 18:15:46 +02:00
Carlos Garnacho
de260ae2ea wayland: Update grab serial when ungrabbing keyboards
This was being done so only on pointers. Internally, a GdkDeviceGrabInfo
is kept for each of the master pointer/keyboard, failing to do this for
keyboards results in a stuck keyboard grab.

https://bugzilla.gnome.org/show_bug.cgi?id=748892
2015-06-24 16:42:07 +02:00
Carlos Garnacho
25885ca600 wayland: Properly initialize/finalize where we store the data_source.send fd
The fd must be closed on async_write_data_free(), but we should also
initialize it to -1 so gdk_wayland_selection_check_write() doesn't wrongly
pick the stdin fd.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 16:42:06 +02:00
Jonas Ådahl
0dab37c78f wayland: Always request transient commit when mapping subsurface
A subsurface positioning operation only takes effect when the parent
surfaces state is applied. If a subsurface is mapped and positioned, but
the parent surface state is not immediately committed, the relative
position of the subsurface is undefined and may be placed incorrectly.

To avoid this undefined state, always request that the parent surface
should be committed after mapping a subsurface so that the position
operation will take effect.

https://bugzilla.gnome.org/show_bug.cgi?id=751098
2015-06-17 17:41:31 +08:00
Matthias Clasen
5a446284b7 Ensure a variable is initialized
clang complained about transient_for being used uninitialized.
2015-06-13 21:10:25 -04:00
Jonas Ådahl
85635457bc wayland: Improve guessing of popup placement for detached popup menus
If a menu was not attached to any widget, we try to calculate its
position given where the grabbed pointer is and what window has its
focus. Previously we failed to do so if a "transfer window" was used
for the grab, and this patch adds a code path that, if the menu window
itself didn't have the grab, look for the transfer window and get the
grab device from there.

https://bugzilla.gnome.org/show_bug.cgi?id=748951
2015-06-10 11:28:32 +08:00
Jonas Ådahl
9e464252c0 wayland: Don't try to guess the popup menu placement when it was set
If a position was already explicitly set, don't try to guess the
position of popup menus by looking at the pointer position, just use
the set coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=748951
2015-06-10 11:28:32 +08:00
Jonas Ådahl
0f47d1bac4 wayland: Position popups relative to the parent surface
According to the xdg-shell protocol specification the (x, y) coordinates
passed when creating a popup surface is relative to top left corner of
the parent surface, but prior to this patch, if the parent surface
was an xdg_surface, we'd position it relative to top left corner of the
window geometry of that xdg_surface.

https://bugzilla.gnome.org/show_bug.cgi?id=749717
2015-06-10 10:50:12 +08:00
Carlos Garnacho
b84d9ea7ff wayland: Move DnD grab breaking function into gdkdevice-wayland.c
This has little to do with GdkDragContext, and a lot to do with
the GdkDevice that triggered it, seems to make more sense in
gdkdevice-wayland.c.
2015-06-02 18:09:49 +02:00
Carlos Garnacho
d34b1225eb wayland: Split keyboard/button modifiers internally
On wl_keyboard.key/modifiers, we're just forgetting about currently
pressed mouse buttons. Fix this by storing button and key modifiers
separately, and put these together when creating the GdkEvents.
2015-06-02 17:31:38 +02:00
Matthias Clasen
393df9f7e1 wayland: Avoid compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:14 -04:00
Jonas Ådahl
7fef713224 wayland: Use on globals closure for loading cursor themes
Instead of putting a 'load cursor themes' call when receiving an wl_shm
global, make it a closure that is prepared during initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=719819
2015-05-20 11:45:13 +08:00
Jonas Ådahl
4e9be39518 wayland: Add global object depedency tracking
Some features need certain globals to initialize. In order to deal with
these dependencies, add a way to postpone closures that depend on a
certain set of globals, that later will be invoked when required
globals are all received.

https://bugzilla.gnome.org/show_bug.cgi?id=719819
2015-05-20 11:45:13 +08:00
Jonas Ådahl
181e4399f6 wayland: Don't round trip recursively during initialization
Instead use asynchronous round trips that is synchronized in the end of
the initialization. This makes it easier to track state, as we won't
dispatch arbitrary Wayland messages while processing globals.

https://bugzilla.gnome.org/show_bug.cgi?id=719819
2015-05-20 10:59:47 +08:00
Matthias Clasen
62b858cf0f Avoid a critical under weston
The ordering of globals in connection setup under weston
is different from mutter, and we end up creating a the
dnd window before any outputs are present. Don't cause
a critical warning in that case.
2015-05-11 22:13:07 -04:00
Matthias Clasen
5434609b21 Wayland: Make css cursor names work
Map css cursor names to traditional X cursor names to increase
our chance of finding a good cursor in the cursor theme.
2015-05-08 13:34:25 -04:00
Matthias Clasen
b1e10f5312 Wayland: trivial reshuffle
Avoid a forward declaration by moving things around.
2015-05-08 13:34:25 -04:00
Alexander Larsson
eb2c9b433f wayland: Don't send bogus values for cursor surface buffer/scale
I was getting really weird values for scale for the blank cursor used
when hiding the cursor in a GtkEntry when typing, this was caused
by gdk_wayland_device_update_window_cursor sending random values
when the returned buffer was NULL.

We fix this by just not sending any buffer or scale updates in this
case.
2015-04-30 10:26:52 +02:00
Fabiano Fidêncio
fea2e7bf35 gdkkeys: Add support to _get_scroll_lock_state()
GdkKeymap already has support for _get_num_lock_state() and
_get_caps_lock_state(). Adding _get_scroll_lock_state() would be good
for completness and some backends (Windows?) could take advantage of
this.
2015-04-27 20:07:52 -03:00
Jonas Ådahl
3da7394b58 wayland: Add support for gtk_window_set_modal
Add two new requests to the gtk_surface interface: set_modal and
unset_modal. The server will currently not do anything special with
input focus, and its up to the client to ignore events on the parent
surface.

This commit bumps the gtk_shell interface version to 2. By connecting to
a Wayland server with another gtk_shell interface version any features
depending on the gtk_shell protocol will not be available.

https://bugzilla.gnome.org/show_bug.cgi?id=745721
2015-04-23 16:09:15 +08:00
Carlos Garnacho
3a3f2e505a wayland: Don't unset the selected mimetype on drop_reply
gdk_wayland_drop_context_set_status() can't do much else currently besides
picking a mimetype (the first one is currently chosen). This may incorrectly
unset the mimetype chosen on .receive(), so the transfer is cancelled before
it even starts.

At the time drop_reply happens, we should have already picked a mimetype
along the way, so only cover for accepted=FALSE in order to unset it.
2015-04-18 18:11:27 +02:00
Carlos Garnacho
42f096c846 wayland: Plug leak
We leak refs on the dest window if it gets set multiple times, expected to
happen as the DnD operation moves across the window.
2015-04-18 18:11:27 +02:00
Carlos Garnacho
0edc9deee5 wayland: Create internal GdkWindow to be set as the DnD source
During drag operations from another client, we currently set no window as
the DnD source. There's paths in upper layers though that rely on it being
set, just that we don't trigger these yet.
2015-04-18 18:11:26 +02:00
Matthias Clasen
b2e19866ea wayland: Wait for output and seat information
When we open the connection, we get the wl_output object,
but we return before all the information such as monitor
geometry has arrived, which causes us to misinform early
users of this information. Do a roundtrip here that causes
us to wait until the information is complete. Do the same
for seats, just in case.
https://bugzilla.gnome.org/show_bug.cgi?id=747471
2015-04-09 00:14:20 -04:00
Matthias Clasen
da16947e21 wayland: Add more debug output 2015-04-09 00:13:37 -04:00
Matthias Clasen
cb750f60f9 wayland: Don't mix free and g_strdup
While it works most of the time, this is technically
not correct.
2015-04-05 18:59:51 -04:00
Jonas Ådahl
71256a0f94 wayland: Set a more correct xdg_surface application id
The "app_id" of a xdg_surface should be the ID that can potentially be
used to get the DBUS name or the .desktop file.

For GtkApplication programs this is often the ID passed when creating the
GtkApplication object, so when available lets use that.

As fallbacks, first try g_get_prgname as it often corresponds to the
basename part of the .dektop file for non-GtkApplication programs.
Otherwise use gdk_get_program_class, even though that string usually
doesn't conform to the expectations of xdg_surface.set_application_id.

https://bugzilla.gnome.org/show_bug.cgi?id=746435
2015-03-31 12:37:50 +08:00
Carlos Garnacho
6c8c37abbb wayland: Silence warnings on clipboard data sending cancellation
During copy/paste, it may be common that we receive several property changes
around the selection atom, this results in warnings when cancelling the previous
write attempt. We already honor the last request properly, so we should just
cancel silently.
2015-03-19 16:05:04 +01:00
Carlos Garnacho
d5160bb950 wayland: Ensure we re-request the target if the fd changes
If we receive wl_data_source.target before .send, the target would already
be cached, but we'd take no action on the new fd.
2015-03-19 16:05:04 +01:00
Carlos Garnacho
a59fd4a9ad wayland: Don't accept the "TARGETS" target on the wl_data_offer
This is handled separately through the data already cached from the
wl_data_offer.offer handler, we can avoid this request entirely then.
2015-03-19 16:05:04 +01:00
Carlos Garnacho
dcfa55ac7e wayland: Fix thinko in wl_data_source.cancelled handler
The wl_data_source may be the clipboard's. Looking up the drag context in
order to get the display isn't going to fare well there. So, just use the
default display, and only look up the drag context when we know we need it.

https://bugzilla.gnome.org/show_bug.cgi?id=746386
2015-03-18 11:21:40 +01:00
Jonas Ådahl
4e930ada32 wayland: Move gtk-shell compatibility version define too
https://bugzilla.gnome.org/show_bug.cgi?id=745721
2015-03-16 13:58:14 -04:00
Jonas Ådahl
225c10bc5a wayland: Don't set the wl_surface user_data twice
wl_surface_add_listener already sets the user data pointer, so no need
to do it separately before.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
7372ddd2a1 wayland: Ignore setting the same cursor theme as was already set
If the name and size of the theme is identical to the current
configuration, do nothing.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
465647e964 wayland: Support scaling of theme based cursors
Support scaling of cursors created from themes. The default scale is
always 1, but if the pointer cursor surface enters an output with a
higher scale, load the larger version of the cursor theme and use the
image from that theme.

This assumes the theme size is set to one that fits with an output scale
= 1.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
7b2cdabc2e wayland: Put interface version defines in a common place
So far only one, but put it somewhere all files can see it.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
c7be8fd398 wayland: Don't set cursor surface scale when we don't have a surface
The setting of the the surface scale even when the surface is not
created from a surface was introduced due to a crash when getting the
buffers when dividing by the scale. The only reason I can see this is
that we get the buffer from a non-existing surface when the wl_cursor
has not yet been set.

Instead, use the name field to avoid trying to use the non-existing
surface, effectively avoiding the division-by-zero that way.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
b4344861a0 wayland: Only bind to supported gtk-shell versions
The gtk-shell Wayland protocol extension is not meant to be backward
compatible right now, so avoid binding to any version that is not the
one supported.

https://bugzilla.gnome.org/show_bug.cgi?id=745721
2015-03-11 11:37:37 +08:00
Carlos Garnacho
eaebc2cb4b wayland: Delay wl_subsurface interface creation until the window is shown
It isn't really necessary anytime before, so just make sure it's there only
when the window is visible.

https://bugzilla.gnome.org/show_bug.cgi?id=743427
2015-03-02 12:11:59 +01:00
Carlos Garnacho
c55fcd35fe wayland: Thaw the clock if we hide a GdkWindow mid-frame
When a window is hidden, its surface and all its roles are destroyed,
if this happens when we already issued a wl_surface_commit and are
awaiting for a frame callback, the clock will remain frozen for the
next time the window is shown.

To avoid this, keep track of the wl_surface_frame() calls issued,
and ensure the clock is thawed after hiding. If we happen to receive
the frame callback, it is just ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=743427
2015-03-02 12:11:59 +01:00
Matthias Clasen
af86bc58b9 wayland: Add debug spew 2015-02-28 00:58:05 -05:00
Matthias Clasen
94c5d691df wayland: Formatting fixes 2015-02-28 00:02:30 -05:00
Matthias Clasen
a0eb0e2346 wayland: Apply maximized and fullscreen state
We were just throwing the request away if the app asks to
fullscreen or maximize a window before it has been mapped.
This is something the GdkWindow API explicitly supports,
so make it work by saving the state until the surface exists.

This fixes things under weston. There are bugs in mutter
that keep this from working correctly with gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=745303
2015-02-27 19:09:03 -05:00
Matthias Clasen
3d205a2037 wayland: Drop some pointless lines
No need for these parameter checks, really.
2015-02-27 19:09:03 -05:00
Olivier Fourdan
53028ff3bb wayland: Don't use g_error() on connection lost
When the Wayland compositor vanishes, all applications connected will
receive a SIGPIPE as soon as they try to use wl_display_dispatch().

Do not use g_error() to terminate the applications when this occurs,
g_error() means an error in the application while here it's not truly
the case.

Use g_warning() and exit() instead.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=745289
2015-02-27 16:26:39 -05:00
Jonas Ådahl
f13157f4bb wayland: Don't allocate a full size SHM buffer when drawing using OpenGL
Before this patch, we'd always allocate a full size SHM buffer via
the wl_shm_pool, even though it would never be used. Instead allocate a
logical 1x1 cairo image surface.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:03 -05:00
Jonas Ådahl
aa81262f11 wayland: Scale up wl_egl_window according to window scale
In order to support window scales for EGL windows, resize the
wl_egl_window to the window dimension multiplied with the window scale,
just as with SHM window buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:03 -05:00
Jonas Ådahl
56c9eac16e wayland: Properly support changing of surface scale
When the preferred surface scale changes, for example when entering a
wl_output with a higher scale than any previous entered output, recreate
the shm surface and redraw the window content with the new window scale.

Before this patch, the internal scale would be changed, but the shm
surface would not be recreated given the new scale, i.e. we'd attach a
buffer for a different scale than wl_surface.set_scale specified.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:02 -05:00
Jonas Ådahl
a70b478a5c wayland: Don't ever try to set surface buffer scale when not supported
If the compositor is too old for handling surface buffer scales, never
tyr to set change it. This will effectively always leave it to its
initial state, i.e. 1.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:02 -05:00
Carlos Garnacho
e43ec48e83 wayland: Use display from GdkDragContext device
It will be useless to check the source window on the destination side,
it's at the moment always NULL. Fetch the display from the device instead,
which will be set for every GdkDragContext.
2015-02-17 19:50:05 +01:00
Jonas Ådahl
5889905d1d wayland: Update to xdg-shell unstable v5
Only trivial changes needed.

https://bugzilla.gnome.org/show_bug.cgi?id=744455
2015-02-14 20:54:47 -05:00
Pier Luigi Fiorini
6ae521bb32 wayland: Do not require latest wl_seat
Some compositors might not offer wl_seat 4 resulting in GTK+ clients not
working on that compositor.

wl_seat 4 introduces keyboard repeat information, but when that information
is missing it is retrieved from settings, hence there's no reason to
require wl_seat 4.

This patch was tested against QtCompositor (5.5, dev branch)
and Weston 1.6.1.

Reviewed-by: Daniel Stone <daniels@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744172
2015-02-13 19:05:32 -05:00
Emmanuele Bassi
d066e7541e Remove GdkGLProfile
The existence of OpenGL implementations that do not provide the full
core profile compatibility because of reasons beyond the technical, like
llvmpipe not implementing floating point buffers, makes the existence of
GdkGLProfile and documenting the fact that we use core profiles a bit
harder.

Since we do not have any existing profile except the default, we can
remove the GdkGLProfile and its related API from GDK and GTK+, and sweep
the whole thing under the carpet, while we wait for an extension that
lets us ask for the most compatible profile possible.

https://bugzilla.gnome.org/show_bug.cgi?id=744407
2015-02-12 17:51:31 +00:00
Emmanuele Bassi
022724aa69 gl: Drop profile for gdk_window_create_gl_context()
Now that we have a two-stages GL context creation sequence, we can move
the profile to a pre-realize option, like the debug and forward
compatibility bits, or the GL version to use.
2015-02-12 12:34:28 +00:00
Armin K
6886f479fe wayland: Implement minimize support
Use the existing xdg_surface API for minimization.

https://bugzilla.gnome.org/show_bug.cgi?id=695945
2015-02-11 22:01:38 -05:00
Emmanuele Bassi
2d9081d117 wayland/gl: Ensure we use the 3.2 core profile
Emit an error if the profile is different.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
f7497daee9 Switch GDK_GL_PROFILE_DEFAULT to mean 3_2_CORE
Instead of LEGACY.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
42a895e85e wayland/gl: Use the GdkGLContext options
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:05 +00:00
Emmanuele Bassi
22e6f37c9c GL: Split GL context creation in two phases
One of the major requests by OpenGL users has been the ability to
specify settings when creating a GL context, like the version to use
or whether the debug support should be enabled.

We have a couple of requirements in terms of API:

 • avoid, if at all possible, the "C arrays of integers with
   attribute, value pairs", which are hard to write and hard
   to bind in non-C languages.
 • allow failing in a recoverable way.
 • do not make the GL context creation API a mess of arguments.

Looking at prior art, it seems that a common pattern is to split the
construction phase in two:

 • a first phase that creates a GL context wrapper object and
   does preliminary checks on the environment.
 • a second phase that creates the backend-specific GL object.

We adopted a similar pattern:

 • gdk_window_create_gl_context() creates a GdkGLContext
 • gdk_gl_context_realize() creates the underlying resources

Calling gdk_gl_context_make_current() also realizes the context, so
simple GL users do not need to care. Advanced users will want to
call gdk_window_create_gl_context(), set up the optional requirements,
and then call gdk_gl_context_realize(). If either of these two steps
fails, it's possible to recover by changing the requirements, or simply
creating a new GdkGLContext instance.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:04 +00:00
Rui Matos
2dd07f346a gdkscreen-wayland: Don't leak wl_output objects
https://bugzilla.gnome.org/show_bug.cgi?id=743633
2015-01-28 17:17:09 +01:00
Matthias Clasen
95fad690d2 wayland: Don't claim to support selection notification
We don't support selection notification, so don't claim
we do, only to fail later.

https://bugzilla.gnome.org/show_bug.cgi?id=743229
2015-01-24 17:25:43 -05:00
Maks Naumov
6113504495 Fix event->button.y_root when using mouse buttons and dnd canceled
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>

https://bugzilla.gnome.org/show_bug.cgi?id=742785
2015-01-17 16:29:17 -05:00
Jasper St. Pierre
ecc64f63e4 gdkeventsource-wayland: Fix style 2014-12-28 18:13:34 -08:00
Carlos Garnacho
44c412ecc7 wayland: Pass shadow width to the compositor
Use xdg_surface_set_window_geometry() to tell the compositor about the
shadow widths, this makes some gnome-shell/mutter features (edge resistance,
frames around windows in the overview, side maximization, ...) work alright
with GTK+.

In order to add this, some other places in gdkwindow-wayland had to gain
some knowledge about margins:

- xdg_surface_configure() now syncs the shadow after applying the state,
  and gdk_wayland_window_set_shadow_width() possibly reconfigures the
  window in order to preserve window geometry. This is necessary to keep
  shadows in sync with state/geometry changes, as this does not happen
  all at once.
- xdg_popups relative to an xdg_surface are shown relative to buffer
  coordinates, so the left/top margins must be added there.

https://bugzilla.gnome.org/show_bug.cgi?id=736742
2014-11-23 13:11:08 +01:00
Jasper St. Pierre
8976e84ded gdkwindow: Don't pass the region to the impl when beginning a paint
It's unused. At the same time, rename "begin_paint_region" to
"begin_paint". This will help us clean up how GDK painting works
in the future to allow more creative use of double-buffering.
2014-11-22 08:08:34 -08:00
Alexander Larsson
cf94da2ca1 GdkGLContext: Remove unused update vfunc
The update virtual function for GdkGLContext is unused and is a
leftover from a previous GL approach. Just remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=739750
2014-11-20 12:38:04 +01:00
Javier Jardón
710f332082 configure.ac: Depend on cairo 1.14.0
This is needed for cairo_set_device_scale()
2014-11-10 15:12:17 +00:00
Carlos Garnacho
af6eab850e wayland: Schedule a clock tick instead of wl_surface_commit()ting directly
Instead of possibly calling wl_surface_commit() out of
GdkFrameClock::after-paint, tick the transient parent clock so ::after-paint
can be eventually run.

This ensures that the subsurface coordinates (considered part of the state
of the parent) aren't committed untimely, and guaranteed to be orderly with
the wl_subsurface-relative state.

This is a gtk-side fix for https://bugzilla.gnome.org/show_bug.cgi?id=738887
2014-11-07 17:24:10 +01:00
Carlos Garnacho
964abf7423 wayland: Don't translate a NULL region into an empty one
cairo_region_copy(NULL) will effectively return an empty region, as this
function is always meant to return valid memory. This however inverts the
meaning of the NULL region and results in entirely non-clickable windows.
2014-11-07 17:23:54 +01:00
Alexander Larsson
6fbc439fd7 GdkGLContext: Add display property
We need to use this in the code path where we make the context
non-current during destroy, because at that point the window
could be destroyed and gdk_window_get_display() would return
NULL.
2014-11-03 13:20:55 +01:00
Alexander Larsson
0eb2fb01fd Add GdkGLContext::profile 2014-10-30 12:43:03 +01:00
Alexander Larsson
f0ae8da993 Remove GdkGLContext::visual
This is not really needed. The gl context is totally tied to the
window it is created from by virtue of sharing the context with the
paint context of that window and that context always has the visual
of the window (which we already can get).

Also, all user visible contexts are essentially offscreen contexts, so
a visual doesn't make sense for them. They only use FBOs which have
whatever format that the users sets up.
2014-10-30 12:43:03 +01:00
Alexander Larsson
dbbab0791d GdkGLContext: Track shared context
This allows us to read it back, but primarily it ensures
the shared context wrapper stays alive as long as the context.
2014-10-30 12:43:03 +01:00
Alexander Larsson
fb50015519 GdkGLContext: Change the way we track the current context
To properly support multithreaded use we use a global GPrivate
to track the current context. Since we also don't need to track
the current context on the display we move gdk_display_destroy_gl_context
to GdkGLContext::discard.
2014-10-30 12:43:03 +01:00
Carlos Garnacho
b0313c7bcf wayland: Emit GDK_OWNER_CHANGE events around wl_data_offer changes
This way the upper GtkClipboard code emits correctly ::owner-change when
receiving these events.
2014-10-29 18:33:48 +01:00
Alexander Larsson
0814cd9f8b GdkGlContextWayland: Don't require specific bit depths
This just means we may fail to get a gl context, we just require
*some* color depth.
2014-10-28 18:30:09 +01:00
Jasper St. Pierre
c40ba85ace wayland: Don't use the default display
Pass a display in so that multi-display technology works.
2014-10-27 22:29:41 -07:00
Jasper St. Pierre
887b7356c3 gdkdisplay: Provide a default event_data_copy / event_data_free
Every single implementation but Quartz is a no-op for this, so just
provide it once rather than in every backend.
2014-10-27 22:13:23 -07:00
Alexander Larsson
3013997e23 Rename gdk_gl_context_flush_buffer to gdk_gl_context_end_frame
This makes a lot more sense.
2014-10-27 16:33:37 +01:00
Matthias Clasen
6440263ef3 GL: Follow naming conventions
All the GDK type defines are GDK_TYPE_..., so follow this
pattern for the GLContext subclasses as well.
2014-10-21 23:48:12 -04:00
Ryan Lortie
6d7f5d4431 wayland: don't init if XDG_RUNTIME_DIR missing
wayland doesn't strictly follow the XDG_RUNTIME_DIR spec by falling back
to another directory in case the runtime dir is not properly set.

When this variable is unset, wayland will log an error to us, which we
treat as fatal, aborting the entire program.

Skip ourselves all the trouble and don't try to bring up the wayland
backend when we know it will fail in this way.

https://bugzilla.gnome.org/show_bug.cgi?id=738873
2014-10-21 08:12:12 -04:00
Bastien Nocera
4af0379aae wayland: Don't try to create a subsurface again
We already did that inside gdk_wayland_window_create_surface() that's
called 2 lines above.

https://bugzilla.gnome.org/show_bug.cgi?id=738912
2014-10-21 12:18:01 +02:00
Matthias Clasen
417e0894e7 Correct another Since tag 2014-10-13 10:43:32 -04:00
Alexander Larsson
fdeb4f8c16 gl: Make gdk_gl_context_make_current() return void
Its not really reasonable to handle failures to make_current, it
basically only happens if you pass invalid arguments to it, and
thats not something we trap on similar things on the X drawing side.

If GL is not supported that should be handled by the context creation
failing, and anything going wrong after that is essentially a critical
(or an async X error).
2014-10-13 10:43:32 -04:00
Alexander Larsson
3d43a9b084 Fix warning 2014-10-13 10:43:32 -04:00
Alexander Larsson
236d08c3c5 gl: Make all user GdkGLContexts not attached to any window
We make user facing gl contexts not attached to a surface if possible,
or attached to dummy surfaces. This means nothing can accidentally
read/write to the toplevel back buffer.
2014-10-13 10:43:31 -04:00
Alexander Larsson
7eae4985e8 wayland: Add OpenGL support
This uses EGL to implement GdkGLContext for wayland.
2014-10-13 10:43:31 -04:00