Commit Graph

208 Commits

Author SHA1 Message Date
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
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
Benjamin Otte
5e4672092a gdk: Deprecate static gravities
... and remove all implementations. The API allows to not work "if the
server doesn't support it. So from now on, no server does!
2014-10-06 02:38:40 +02:00
Matthias Clasen
52578945bd Wayland: Fix various compiler warnings
Mostly missing declarations, missing statics and unused functions.
2014-09-05 20:41:06 -04:00
Carlos Garnacho
7fbac57712 wayland: Unset window_impl->commit_pending when hiding the surface
A surface may be hidden when a frame is already scheduled, which may cause
crashes on on_frame_clock_after_paint() when calling commit() on a NULL
surface. To fix this, ensure commit_pending is also set to FALSE when the
surface is gone.

https://bugzilla.gnome.org/show_bug.cgi?id=735226
2014-09-01 22:44:08 +02:00
Carlos Garnacho
6ba7d347c7 wayland: Return properly type hints from GdkWindows
This was hardcoded to GDK_WINDOW_TYPE_HINT_NORMAL, even though wayland
windows store the type hint themselves.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:54 +02:00
Carlos Garnacho
867302e2c7 wayland: Don't set an xdg surface to DnD windows
https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
7744799072 wayland: Implement drag/source side of selections
This has been made to work similarly to X11, requests for the data device
contents are notified through GDK_SELECTION_REQUEST events, the data stored
in the GDK_SELECTION property as a reaction to that event is then stored
into the wayland selection implementation, and written to the fd when
requested/available.

https://bugzilla.gnome.org/show_bug.cgi?id=697855
2014-09-01 19:17:53 +02:00
Carlos Garnacho
d34f2526c4 wayland: Ensure the parent is committed after repositioning subsurfaces
Subsurface position is deemed part of the state of the parent surface, so
ensure wl_surface_commit() happens on the parent surface if none is
scheduled, so the repositioning takes place.
2014-08-27 17:45:16 +02:00
Carlos Garnacho
29d9b2f7cf wayland: unset sequence if the xdg surface is moved/resized through touch
The latest implicit grab serial is used in order to start the compositor
grab, If it belongs to a touch event, remove that touch sequence, as the
rest of the sequence will be gone for good.

This avoids stale sequences (and implicit grab info) after a window is
moved/resized.

https://bugzilla.gnome.org/show_bug.cgi?id=731380
2014-08-26 13:41:05 +02:00
Carlos Garnacho
537ff9fcad wayland: Improve implicit grab serial retrieval
_gdk_wayland_device_get_button_press_serial() has been replaced by
_gdk_wayland_device_get_implicit_grab_serial(), which takes a touch/pointer
event and figures out the relevant serial, and
_gdk_wayland_device_get_last_implicit_grab_serial() which returns
the most recent serial.

The button press serial was currently used when operating popping up
xdg_shell/surface popups and window menus, so this is now touch aware, of
some sort.

https://bugzilla.gnome.org/show_bug.cgi?id=734374
2014-08-26 13:32:46 +02:00
Carlos Garnacho
ab6f771413 wayland: create a wl_subsurface interface for GDK_WINDOW_SUBSURFACE windows
This subsurface is currently dependent on the transient_for parent, so the
subsurface is repositioned relative to it.

https://bugzilla.gnome.org/show_bug.cgi?id=729215
2014-08-26 12:58:13 +02:00
Carlos Garnacho
e206b72635 wayland: Make toplevels' X/Y coordinates be 0
To all effects each window has its own "root" coordinates system, so set
toplevels at 0,0 in that coordinate system, so root coordinate calculations
are locally right.

https://bugzilla.gnome.org/show_bug.cgi?id=729215
2014-08-26 12:58:13 +02:00
Matthias Clasen
c9da8bf2b3 Revert "docs: Fix broken gtk-doc formatting"
This reverts commit a7562dd38f.

I prefer to not confuse gtk-doc with doc comments for private
functions.
2014-08-18 08:18:02 -04:00
Rico Tzschichholz
a7562dd38f docs: Fix broken gtk-doc formatting
Fixes broken introspection of GtkTranslateFunc
2014-08-18 13:27:05 +02:00
Jasper St. Pierre
966b191e13 gdkwayland-window: Don't map the grab transfer menu for GtkMenu
This is a bad idea in general, but it also means that the focus for a
window drops when we pop up a menu, since the grab transfer menu exists.
2014-08-13 19:03:39 -04:00
Jasper St. Pierre
46bcfa0098 gdkwindow-wayland: Take out the margins for now
xdg-shell has moved on and replaced set_margin with set_window_geometry.
To properly support set_window_geometry requires a full rewrite of how
we've been dealing with toplevel windows for now, so just don't set any
margin until we can have a proper toplevel window abstraction in GTK+.
2014-07-17 16:59:29 -04:00
Jasper St. Pierre
b0bd9d82a3 Revert "wayland: Prevent stale paints and weird artifacts when using Weston"
This reverts commit 76922c169f.

This is too local a fix, and is broken if the user paints to a small
region, as the entire buffer will be wiped.
2014-07-14 19:12:19 -04:00
Jasper St. Pierre
58715796d2 gdkwindow: Provide a default implementation of process_updates_recurse
As a quick code cleanup.
2014-06-22 10:20:50 -04:00
Jasper St. Pierre
0dfd506b3c gdkwidow: Make queue_antiexpose optional 2014-06-21 18:45:41 -04:00
Jasper St. Pierre
c767d504c5 gdkwindow: Don't bother with a return parameter for queue_antiexpose
Standard refcounting works perfectly well. Don't give us the opportunity
for more memory leaks.
2014-06-21 18:45:39 -04:00
Jasper St. Pierre
0bad7d8f5c gdkwindow-wayland: Attach new buffers and submit damage in end_paint
process_updates_recurse is simply the wrong place for it to be.
2014-06-21 18:45:38 -04:00
Jasper St. Pierre
afbadd6639 gdkwindow-wayland: Rename listener -> frame_listener
Don't pollute the static namespace here.
2014-06-21 18:45:38 -04:00
Jasper St. Pierre
d48adf9cee gdkwindow: Remove the internal cairo_surface used for out-of-band painting
Traditionally, the way painting was done in GTK+ was with the
"expose-event" handler, where you'd use GDK methods to do drawing on
your surface. In GTK+ 2.24, we added cairo support with gdk_cairo_create,
so you could paint your graphics with cairo.

Since then, we've added client-side windows, double buffering, the paint
clock, and various other enhancements, and the modern way to do drawing
is to connect to the "draw" signal on GtkWidget, which hands you a
cairo_t. To do double-buffering, the cairo_t we hand you is actually on
a secret surface, not the actual backing store of the window, and when
the draw handler completes we blit it into the main backing store
atomically.

The code to do this is with the APIs gdk_window_begin_paint_region,
which creates the temporary surface, and gdk_window_end_paint which
blits it back into the backing store. GTK+'s implementation of the
"draw" signal uses these APIs.

We've always sort-of supported people calling gdk_cairo_create
"outside" of a begin_paint / end_paint like old times, but then you're
not getting the benefit of double-buffering, and it's harder for GDK to
optimize.

Additionally, newer backends like Mir and Wayland can't actually support
this model, since they're based on double-buffering and swapping buffers
at various points in time. If we hand you a random cairo_t, we have no
idea when is a good time to swap.

Remove support for this.

This is technically a GDK API break: a warning is added in cases where
gdk_cairo_create is called outside of a paint cycle, and the returned
surface is a dummy that won't ever be composited back onto the main
surface. Testing with complex applications like Ardour didn't produce
any warnings.
2014-06-20 20:41:54 -04:00
Jasper St. Pierre
76922c169f wayland: Prevent stale paints and weird artifacts when using Weston
Weston releases buffers almost immediately after they're done, which
means that GTK+ doesn't use a temporary surface and instead paints
directly onto the SHM backing store that Weston will use.

Normally, after painting to the temporary surface, GTK+ *replaces*
the existing backing surface with CAIRO_OPERATOR_SOURCE. However,
if we immediately paint to the backing surface, it might have junk
from the last paint in it. So clear out the backing surface whenever
somebody calls begin_paint_region().

Maybe we should just always use the temporary surface like the X11
codepath, since that prevents us from having to do weird things like
this, but oh well.
2014-06-20 09:02:02 -04:00
Jasper St. Pierre
87e2a7d4b2 gdkwindow-wayland: Destroy the wl_surface too when hiding a window
wl_surfaces can't switch roles, so destroying the xdg_surface but not
the wl_surface means that we could get an error when trying to re-map
the surface.

We could fix this by not destroying the xdg resource and only do it at
finalization time, but it's just as easy to just create a new wl_surface.
2014-06-19 15:10:54 -04:00
Jasper St. Pierre
6926c6d9f8 gdkwindow-wayland: Destroy the xdg roles before the wl_surface
Since the xdg roles are a special case of the surface, some compositors
like Weston destroy them automatically when the wl_surface is destroyed.
Thus, we need to destroy these first.
2014-06-19 15:10:54 -04:00
Jasper St. Pierre
b35820fa3c gdkwindow-wayland: Add a forgotten ref 2014-06-19 14:56:17 -04:00
Jasper St. Pierre
0bbe2589f6 gdkwindow-wayland: Another slight rearrange 2014-06-19 14:56:17 -04:00
Jasper St. Pierre
ec7504fd57 gdkwindow-wayland: Pair a ref with its owner 2014-06-19 14:56:17 -04:00
Jasper St. Pierre
12fc77ad98 gdkwindow-wayland: Don't post CONFIGURE events for the same size
The Wayland compositor is completely allowed to send us configure
events for the same size, and this validly happens if we're changing
states. Fizzle these out.
2014-06-19 14:56:16 -04:00
Kristian Høgsberg
544e1ac1d1 wayland: Remove unused XSERVER_TIME_IS_LATER macro 2014-05-27 10:24:34 -07:00
Jasper St. Pierre
0d402601b2 wayland: Add support for show_window_menu 2014-05-24 15:55:55 -04:00
Jasper St. Pierre
72e9937e00 wayland: Remove unused stuff 2014-05-16 15:24:37 -04:00
Jasper St. Pierre
75ecdf50a3 wayland: Fix GtkMenuButton popups in a terrible, hacky way
Since you can't take grabs on unmapped windows, GtkMenu takes a grab on
the menu in a convoluted way: it first grabs another window, shows the
menu window, and then transfers the grab over to the GtkMenu widget.

For normal menubars, this is perfectly fine, as the first window it grabs
is our toplevel, and that gets picked up in our transient path.  For
GtkMenuButton or other spurious uses of gtk_menu_popup, it creates a new
temporary input-only window which it takes the grab on, known as the "grab
transfer window". Since this window isn't a transient-for of our new menu
widget window, the grab isn't noticed when we go to show it, and thus the
menu ends up as a new toplevel.

Add a special hack to GtkMenu and the Wayland backend which lets us notice
this "grab transfer window", and include it in our grab finding path.

It's sort of terrible to have to hack up the widgets instead of just the
backend, but the alternative would be an entirely new window type which is
managed correctly by GDK. I don't want to write that.
2014-05-15 18:02:45 -04:00
Jasper St. Pierre
f6b3f0bfc7 wayland: Clean up function to find the input seat 2014-05-15 18:02:45 -04:00
Jasper St. Pierre
7052795a80 wayland: Clean up code to find the correct seat for a window 2014-05-15 18:02:45 -04:00
Jasper St. Pierre
38445e6326 wayland: Ack the configure immediately 2014-05-13 16:21:57 -04:00
Jasper St. Pierre
9b4668c82c wayland: Update to latest xdg-shell protocol 2014-05-13 02:39:59 -04:00
Jasper St. Pierre
ee3d00c391 wayland: Map the window immediately on show 2014-04-22 19:19:14 -04:00
Jasper St. Pierre
4e72674bf3 wayland: Remove useless hint set 2014-04-22 19:19:14 -04:00
Jasper St. Pierre
938725fff0 wayland: Remove VISIBILITY_NOTIFY event
VISIBILITY_NOTIFY is already known to be unreliable.
2014-04-22 19:19:14 -04:00
Jasper St. Pierre
e4e75a94f5 wayland: The xdg_surface.delete event was renamed to close 2014-04-17 13:14:44 -04:00
Jasper St. Pierre
eb5cc3da9b wayland: set_transient_for was renamed to set_parent 2014-04-12 08:20:33 -07:00
Jasper St. Pierre
e91e447db7 wayland: Don't pass dx/dy when we're resizing
They're ignored by the server.
2014-04-12 08:20:33 -07:00
Jasper St. Pierre
8201e2bfab wayland: Merge buffer implementations 2014-04-12 08:20:33 -07:00
Matthias Clasen
a8036a5143 wayland: Fix northeast resizing
Surprisingly, the same corner that was broken for resizing under
X is also broken under Wayland, for an entirely different reason.
2014-03-21 18:24:38 -04:00
Jasper St. Pierre
3472235232 wayland: Add support for input regions 2014-03-20 14:28:24 -04:00