Commit Graph

639 Commits

Author SHA1 Message Date
Alexander Larsson
890b759091 broadway: Send actual float32, not some hack 2019-03-26 17:07:47 +01:00
Alexander Larsson
d997903d29 broadway: Use DataView instead of hand-rolled int parsers
This is nicer in general, but also will let us do floats more sanely.
2019-03-26 17:07:47 +01:00
Alexander Larsson
b097f0a7d8 Broadway: Add node for debug nodes
This can be helpful when debugging broadway.
2019-03-26 17:07:47 +01:00
Alexander Larsson
1b5b1bfd0e broadway: Don't fall back for translation transform nodes
These are trivial anyway
2019-03-26 17:07:47 +01:00
Matthias Clasen
3d37f08f38 Remove gdk_device_warp
This was only ever implemented on X11, and is
not something we want to encourage apps to do, ever.
2019-03-24 20:49:08 -04:00
Emmanuele Bassi
45361e19c3 Rename more GSources to use gtk 2019-02-06 10:37:24 +01:00
Mickael Istria
14010899b5 Issue #1633 - Ensure focus on click
This is necessary to give back focus to the Broadway elements when
content is embedded in an IFrame.

Signed-off-by: Mickael Istria <mistria@redhat.com>
2019-02-04 17:46:09 +01:00
Benjamin Otte
375fbd4e47 gdk: Remove key_event->string and key_event->length
They're unused.
2018-07-30 19:32:38 +02:00
Benjamin Otte
259be23ff2 broadway: Remove unused variable 2018-07-24 20:55:45 +02:00
Nirbheek Chauhan
5df4d27752 meson: libgdk-broadway.a depends on broadwayjs.h
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1218

Also fix another dependency error I found.
2018-07-23 20:15:44 +05:30
Matthias Clasen
e2fd33f78a Revert "broadway: Stop using configure events"
This reverts commit 9c827cbff4.
2018-07-15 20:23:45 -04:00
Matthias Clasen
228f813c43 dnd: Drop gdk_drag_drop
This is an inconsistently used private api, and just adds
a vfunc indirection for no other benefit.
2018-07-15 15:58:05 -04:00
Matthias Clasen
7ca6440f4d gdk: Drop map events
We are really inconsistent about generating these,
and they are not actually used in GTK+. Instead,
add a boolean GdkSurface::mapped property.
2018-07-15 15:10:56 -04:00
Matthias Clasen
9c827cbff4 broadway: Stop using configure events
These no longer exist.
2018-07-15 14:01:59 -04:00
Matthias Clasen
f432c937cc dnd: Drop gdk_drag_abort
This function is never called, so drop it, its vfunc,
and all the backend implementations.
2018-07-12 13:57:45 +02:00
Matthias Clasen
64f5afe608 dnd: Rename headers
Rename gdkdnd.h to gdkdrag.h, to go along with gdkdrop.h

This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 15:00:50 +02:00
Matthias Clasen
7733f646d6 gdk: Rename GdkDragContext to GdkDrag
This is to go along with the newly introduced GdkDrop.

This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 14:59:26 +02:00
Benjamin Otte
a1cee7fa65 surface: Kill event masks
In particular, this patch removes:
  gdk_surface_get_events()
  gdk_surface_set_events()
  gdk_surface_get_device_events()
  gdk_surface_set_device_events()

Event masks so far still exist for grabs.
2018-06-18 23:49:52 +02:00
Benjamin Otte
905765eed6 broadway: Remove unused variable 2018-06-18 23:49:52 +02:00
Benjamin Otte
316bd6a333 dnd: Add gdk_drop_finish()
and move the vfunc into GdkDrop.
2018-06-18 23:49:20 +02:00
Benjamin Otte
a05af1f0f3 dnd: Move the gdk_drag_status() function
It's now gdk_drop_status().

Also clarify the intended semantics.
2018-06-18 23:49:19 +02:00
Benjamin Otte
7e574fa98c gdk: Get rid of gdk_event_free()
Events are objects, so use g_object_unref().
2018-05-29 21:53:44 +02:00
Benjamin Otte
8366ef71c0 dnd: Remove gdk_drop_reply()
It was only necessary for Motif DND, and we don't support that anymore.
2018-05-03 01:31:40 +02:00
Benjamin Otte
fb53568c04 gdk: Remove gdk_drag_grop_succeeded()
It's unused and most backends don't implement it.
2018-05-03 01:31:39 +02:00
Benjamin Otte
4aaeb7de19 dnd: Make GdkDragContext::device a (construct-only) property
Also remove gdk_drag_context_set_device() and insist on backends using
the property.
2018-04-27 14:32:28 +02:00
Benjamin Otte
ae7a677346 cairocontext: Remove fallback implementations
Now that all Cairo contexts are ported to managing cairo surfaces
themselves, the old fallback code that didi the managing is no longer
needed.

Also clarify the behavior of gdk_cairo_context_cairo_create() wrt the
vfunc by doing the early exit and the clipping outside of it.
2018-04-24 23:24:55 +02:00
Alexander Larsson
a329de63ea broadway: Add and use GdkBroadwayDrawContext 2018-04-24 23:24:55 +02:00
Alexander Larsson
99c46f263e broadway: Add basic GdkCairoContext implementation 2018-04-24 23:17:14 +02:00
Alexander Larsson
9421cb8b3a broadway: Call _gdk_surface_update_size when resizing surface 2018-04-24 23:17:14 +02:00
Benjamin Otte
813e9c95fb gdk: Add Cairo context implementations for all backends
And make the GdkCairoContext as abstract.

The idea of this and thje following commits is to get rid of all
Cairo code in gdksurface.c (and $backend/gdksurface-$backend.c)
by moving that code into the Cairo context files.
In particular, the GdkSurfaceClass.begin_frame/end_frame()
functions (which are currently exclusively used by the Cairo code
should end up being moved to GdkDrawContextClass.begin/end_frame().

This has multiple benefits:

1. It unifies code between the different drawing contexts.
   GL lives in GLContext, Vulkan in VulkanContext and Cairo in
   CairoContext. In turn, this makes it way easier to reason about
   what's going on in surface-specific code. Currently pretty much
   all backends do things wrong when they want to sync to drawing
   or to the frame clock.

2. It makes the API of GdkSurface smaller. No drawing code (apart
   from creating the contexts) needs to remain.

3. It confines Cairo to the Drawcontext, thereby making it way
   more obvious when backends are still using it in situations
   where it may now conflict with OpenGL (like when doing the dnd
   failed animation or in the APIs that I'm removing in this
   branch).

4. We have 2 very different types of Cairo contexts: The X/win32
   model, where we have a natively supported Cairo backend but do
   double buffering ourselves and use similar surfaces and the
   Wayland/Broadway model where we use image surfaces without any
   Cairo backend support and have to submit the buffers manually.
   By not sharing code between those 2 versions, we can make the
   actual code way smaller. We also get around the need to create
   1x1 image surfaces in the Wayland backend where we pretend
   there's a native Cairo surface.
2018-04-24 23:16:12 +02:00
Benjamin Otte
f1f27ce0c2 broadway: Improve error message
This error message is printed into the journal if a GTK app can't
connect to eithre Wayland or X11. Make it at least mention who is not
capable of connecting to a server.

Unrelated, we might want to improve our error reporting when a GTK app
can't start, so that debugging issues with system startup / login get
easier to resolve.
2018-04-05 14:56:38 +02:00
Benjamin Otte
cb4ec6f384 gdk: Remove GdkSurfaceImpl::shape_combine_region vfunc
... and all the implementations.

Input shapes still exist.
2018-03-21 23:28:26 +01:00
Benjamin Otte
4fff16860f gdk: Remove a bunch of unused variables 2018-03-21 23:28:26 +01:00
Alexander Larsson
3f2894fec1 broadway: Fix up window -> surface renames 2018-03-21 09:17:50 +01:00
Alexander Larsson
4ac450b324 Convert all references to GdkEvent->surface 2018-03-20 16:25:50 +01:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
890080ebf7 GdkWindow -> GdkSurface: File renames
Rename all *window.[ch] source files.

This is an automatic operation, done by the following commands:

for i in $(git ls-files gdk | grep window); do
    git mv $i $(echo $i | sed s/window/surface/);
    git sed -f g $(basename $i) $(basename $i | sed s/window/surface/) ;
done

git checkout NEWS* po-properties po
2018-03-20 11:46:11 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Emmanuele Bassi
7f25cc9d4e Rewrite toarray Perl script to Python
We don't need to shell out to Perl to generate a C array out of a text
file.
2018-02-14 15:51:45 +00:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
888dfe499d Drop the Big GDK Lock
GDK has a lock to mark critical sections inside the backends.
Additionally, code that would re-enter into the GTK main loop was
supposed to hold the lock.

Back in the Good Old Days™ this was guaranteed to kind of work only on
the X11 backend, and would cause a neat explosion on any other GDK
backend.

During GTK+ 3.x we deprecated the API to enter and leave the critical
sections, and now we can remove all the internal uses of the lock, since
external API that uses GTK+ 4.x won't be able to hold the GDK lock.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:07:10 +01:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Benjamin Otte
3e0fab6b93 dnd: Remove 2 vfuncs that aren't needed
They're only used inside the X11 backend, and the backend can just call
its own function.
2018-01-31 13:21:26 +01:00
Matthias Clasen
77bab4e027 gdk: Drop some unused cursor apis
The query function for cursor sizes and capabilities
are not very interesting. At least, they are not used
in GTK+, and all backends but X11 just hardcode
made-up values anyway. So, lets drop them.
2018-01-16 23:32:01 -05:00
Ting-Wei Lan
5f8e2fcf93 gdk/broadway/toarray.pl: Don't hard-code the path of perl
https://bugzilla.gnome.org/show_bug.cgi?id=791927
2017-12-25 12:25:54 +08:00
Emmanuele Bassi
f1ef422871 broadway: Use correct type in assignment
The new type propagation for g_object_ref() is raising a compiler
warning for an assignment with a different type.
2017-12-21 18:42:26 +00:00
Benjamin Otte
5d70bbf4c4 display: Remove leftover old clipboard APIs 2017-12-14 13:35:32 +01:00
Matthias Clasen
54a6273191 Drop gdk_atom_intern
Atoms are just interned strings now, so we can just
use g_intern_string.
2017-12-13 23:39:03 -05:00
Benjamin Otte
b49a9b9933 dnd: Remove gdk_drag_get_selection()
Without selections, drags can't have them either.

Also included is removing the selection from GtkSelectionData.

Includes a bunch of crude cleanups to Wayland code that no longer has to
care about selection atoms.
2017-12-14 04:39:22 +01:00
Benjamin Otte
65fcff87b2 gdk: Remove ability to request selection notifications
Without selections, that's kinda pointless.
2017-12-14 04:20:48 +01:00
Benjamin Otte
f2bb2024c8 gdk: Remove properties
They are not used anymore.

Gone with them are PropertyNotify events.
2017-12-14 03:05:34 +01:00
Benjamin Otte
82aa0eacb2 broadway: Make compile after GdkEvent objectification 2017-12-14 03:05:34 +01:00
Benjamin Otte
a4b42f0b73 gdk: Remove selection defines
And with it, remove the selections section from the docs.

So selections are gone for good now.
2017-12-14 03:05:34 +01:00
Benjamin Otte
54f9aef0d4 gdk: Remove gdk_selection_convert()
It's not used anymore.
2017-12-14 00:44:26 +01:00
Benjamin Otte
4042d5f242 gdk: Remove ability to own a selection
With this, the GDK_EVENT_SELECTION_REQUEST and GDK_EVENT_SELECTION_CLEAR
and the associated GtkWidget signals are gone, too.
2017-12-13 23:39:02 +01:00
Benjamin Otte
b66052f3ce gdk: Remove gdk_selection_add_targets()
It's not needed anymore, now that we can look at the content provider's
formats.

Alose remove all the API in GTK that was used to set it.
2017-12-13 19:27:51 +01:00
Benjamin Otte
8648d5409e dnd: Pass content to gdk_drag_begin()
Instead of just passing the GdkContentFormats, we are now passing the
GdkContentProvider to gdk_drag_begin().
This means that GDK itself can now query the data from the provider
directly instead of having to send selection events.

Use this to provide the private API gdk_drag_context_write() that allows
backends to pass an output stream that this data will be written to.
Implement this as the mechanism for providing drag data on Wayland.

And to make this all work, implement a content provider named
GtkDragContent that is implemented by reverting to the old DND
drag-data-get machinery inside GTK, so for widgets everything works just
like before.
2017-12-13 15:05:27 +01:00
Benjamin Otte
643a6c2311 gdk: Remove gdk_drag_manage_dnd()
Instead, pass the actions as part of gdk_drag_begin() and insist DND is
always managed.

A new side effect is that gdk_drag_begin() can now return %NULL.
2017-12-11 01:46:33 +01:00
Benjamin Otte
218efa62ef dnd: Pass dx/dy instead of x_root/y_root
This way, we don't need root coordinates when computing the dnd start
position.
2017-12-11 01:02:31 +01:00
Benjamin Otte
0d31eb8670 dnd: Add gdk_drag_context_get_display()
Also turn it into a readable, construct-only property.

Every GDK object should have this. (Apart from GdkDisplay, obviously.)
2017-12-10 01:09:14 +01:00
Alexander Larsson
df2716a109 broadway: Add broadway_server_lookup_surface helper 2017-12-05 16:10:06 +01:00
Alexander Larsson
2cad2c21e6 broadway: Make the use of next_texture_id clearer
It used to actually be pre-incremented, so meant like "one before
next id".
2017-12-05 15:54:36 +01:00
Alexander Larsson
d141bd4121 broadway: Use "surface" instead of window/toplevel for browser object
Als fixes indentation/tabs and removes some unused code.
2017-12-05 15:50:34 +01:00
Alexander Larsson
e80ad0e0f9 broadway: Remove references to unused BROADWAY_EVENT_DELETE_NOTIFY 2017-12-05 15:50:34 +01:00
Alexander Larsson
4694885015 broadway: Remove now unused toplevel surface 2017-12-05 15:50:34 +01:00
Matthias Clasen
6ab72b2653 Remove GdkDragProtocol from the api
...together with apis that return it. We were not using this
information in GTK+ at all, so no need to provide it.
2017-12-03 06:41:08 +01:00
Alexander Larsson
61ea8e8676 broadway: Add some (disabled) debugging tools 2017-11-30 21:57:42 +01:00
Alexander Larsson
af890e6677 broadway: Don't send node updates to browser if nothing changed 2017-11-30 21:57:42 +01:00
Alexander Larsson
d43008b2a5 broadway: Fix texture hash function 2017-11-30 21:57:42 +01:00
Alexander Larsson
c30073793e broadway: Improve logging
We now log backwards, so that the latest is always visible.
Also, we use <pre> with a smaller size.
2017-11-30 21:57:42 +01:00
Alexander Larsson
521b09cc96 broadway: Send diffs of node trees
Reusing pre-created nodes is a lot faster both in terms of
dom modifications and of transfer sizes.
2017-11-30 21:57:42 +01:00
Alexander Larsson
3d4a9324e6 broadway: Add broadway_node_equal 2017-11-30 21:57:42 +01:00
Alexander Larsson
46c4869945 broadway: Prepare for implementing diff 2017-11-30 21:57:42 +01:00
Alexander Larsson
e43f031769 broadway: Add div for container nodes
We need this so that all nodes have divs, otherwise diffing is going
to be very hard.
2017-11-30 21:57:42 +01:00
Alexander Larsson
1820362b2b broadway: Deserialize node tree in server
This doesn't really change anything, but it is in preparation for diffing
the trees.
2017-11-30 21:57:42 +01:00
Alexander Larsson
907e071c90 broadway: Add a texture cache
This ensures we never upload a texture we already have locally available.
2017-11-30 21:57:42 +01:00
Alexander Larsson
d284c3fa85 broadway: Re-add seat and core device creation 2017-11-30 21:57:42 +01:00
Matthias Clasen
6489bc1929 broadway: Remove devicemanager implementation
It is not used and not needed anymore.
2017-11-25 11:04:14 -05:00
Matthias Clasen
1023249e31 broadway: Stop using GdkDeviceManager
We can use the GdkSeat apis for this.
2017-11-25 11:04:14 -05:00
Alexander Larsson
cfb76fedb6 broadway: Roundtrip each update to rate limit redraw 2017-11-23 10:48:29 +01:00
Alexander Larsson
b74959a605 broadway: Add clip node 2017-11-23 10:48:29 +01:00
Alexander Larsson
9e5a22bbe5 broadway: Add opacity node 2017-11-23 10:48:29 +01:00
Alexander Larsson
9b1f6acc2b broadway: Add shadow node 2017-11-23 10:48:29 +01:00
Alexander Larsson
cbbbf49043 broadway: Add node cache for text 2017-11-23 10:48:29 +01:00
Alexander Larsson
6cc96318c8 broadway: Remove inflate code
This is not used anymore
2017-11-23 10:48:29 +01:00
Alexander Larsson
278370c8e5 broadway: Add linear gradient node 2017-11-23 10:48:29 +01:00
Alexander Larsson
f7ff6dbb66 broadway: Add RoundedClip node 2017-11-23 10:48:29 +01:00
Alexander Larsson
0083c084e4 broadway: Add inset shadow 2017-11-23 10:48:29 +01:00
Alexander Larsson
35ceb8e626 broadway: Add outset shadow node 2017-11-23 10:48:29 +01:00
Alexander Larsson
0ad523038c broadway: Fix border node positioning 2017-11-23 10:48:29 +01:00
Alexander Larsson
cf03229a99 broadway: Add border node 2017-11-23 10:48:29 +01:00
Alexander Larsson
5a8d204c83 broadway: Clean up node parser 2017-11-23 10:48:29 +01:00
Alexander Larsson
0b38ab339e broadway: Add color nodes 2017-11-23 10:48:29 +01:00
Alexander Larsson
cfdb3952c6 broadway: Fix input events 2017-11-23 10:48:29 +01:00
Alexander Larsson
97c0d112af broadway: Don't swap node trees until all images are loaded 2017-11-23 10:48:29 +01:00
Alexander Larsson
fd0285de09 broadway: Rewrite textures in nodes to global 2017-11-23 10:48:29 +01:00
Alexander Larsson
54e7a8f0c0 broadway: Remove remaining unused window_update code 2017-11-23 10:48:29 +01:00
Alexander Larsson
f7d8ee041b broadway: Initial version of using actual render nodes 2017-11-23 10:48:29 +01:00
Alexander Larsson
cc7423855b broadway: Use textures to configure window contents
Instead of using the old buffer code, just use textures to define the
window contents.
2017-11-23 10:46:47 +01:00
Alexander Larsson
a4636a06a7 broadway: Actually upload textures to client 2017-11-23 10:46:47 +01:00