Commit Graph

127 Commits

Author SHA1 Message Date
Matthias Clasen
fea42def61 surface: Always dd events to the profiler trace
We want to get this data for release builds as well.
2020-01-22 16:36:54 -05:00
Matthias Clasen
36cb812ad8 surface: Add enter/leave events to profiler traces
These are just as likely to trigger extra work than
other mouse events, so it is useful to show them.
2020-01-22 15:12:03 -05:00
Matthias Clasen
d116bbf0c8 docs: Expand the GDK dnd docs 2020-01-08 18:48:22 -05:00
Matthias Clasen
ad6fe9d6a0 surface: Only unpause events if we paused them
When a new popup surface is created, it may end up
getting a resume-events signal from its frame clock
without having seen a flush-events first.

Don't unpause events in that case, since it messes
up the displays pause counter.

This was causing criticals with tooltips.
2019-12-29 13:35:36 -05:00
Hubert Figuière
585397937d doc: Cleanup doc removing mentions of gdk_surface_shape_combine_region() 2019-12-05 11:33:09 -05:00
Emmanuele Bassi
b70e4f6de9 Rename "iconify" to "minimize"
The "iconified" state is mostly an X11-ism; every other platform calls
this state "minimized" because it may not involve turning a window into
an icon at all.
2019-11-16 20:07:37 +00:00
Jonas Ådahl
0885eb0a7b gdk: Remove gdk_surface_move_resize() API
Windows/surface's aren't supposed to be explicitly moved by any external
part, so don't provide API for doing so. Usage throughout Gdk is
replaced by the corresponding backend variants.
2019-07-25 10:35:43 +02:00
Jonas Ådahl
fc68d1b1e6 gdk: Make backends implement move_to_rect()
The generic layer still does the heavy lifting, leaving the backends
more or less just act as thin wrappers, dealing a bit with global
coordinate transformations. The end goal is to remove explicit surface
moving from the generic gdk layer.
2019-07-25 10:24:50 +02:00
Jonas Ådahl
b329090e69 gdk: Remove gdk_surface_move()
Generic gdk code now uses the internal helper; backends use their own
private implementations when necessary.
2019-07-25 10:24:50 +02:00
Jonas Ådahl
6314ebd435 gdk/surface: Add toplevel_resize vfunc
To separate how toplevels and popups are configured, a first step is to
introduce a resize-only vfunc for backends to implement. It's meant to
only configure toplevel windows, i.e. popups. Currently it's used for
both types, but introducing the resize-only API is a first step.
2019-07-25 10:24:50 +02:00
Jonas Ådahl
a7ee1b4e85 gdksurface: Make all surfaces listen to the frame clock signals
Instead of the toplevel driving popups, have the popups listen to the
frame clock themselves. Otherwise, if the toplevel for some reason isn't
drawn by the compositor and stops drawing new frames, popups wouldn't
get painted either.
2019-07-03 11:42:28 +02:00
Jonas Ådahl
5db079b052 gdk/frameclock: Make surfaces inhibit freeze
To make a frame clock tick as long as any of the associated surfaces
expect to receive ticks, make the surfaces inhibit freezing the clock,
instead of directly tell the frame clock to freeze itself.

This makes it so that as long as any surface using a certain frame clock
is not frozen (e.g. just received a frame event from the display
server), the frame clock will not be frozen.

With this, the frame clock is initiated as frozen, and won't be thawed
until any surface inhibits freeze. It will be frozen again, when every
surface has that previously inhibited freeze uninhibited freeze.
2019-07-03 11:42:28 +02:00
Christian Hergert
4d06ef5a39 profiler: add profiler marks for surface event delivery
This gives us marks to track the duration of processing certain types of
GdkEvent. It also provides some basic struct information in cases where
having that information would likely be useful for debugging.
2019-06-13 14:42:51 -07:00
Matthias Clasen
407ab93b59 gdk: Always deliver key events to toplevels
This is just a hack to see that this works.
Eventually, the backends should do the right
thing.
2019-06-09 17:38:54 +00:00
Matthias Clasen
c168116e64 Merge branch 'wip/matthiasc/shared-glyph-cache' into 'master'
Share the glyph cache

See merge request GNOME/gtk!912
2019-06-05 12:10:24 +00:00
Matthias Clasen
e08bab012c surface: Use surface->display directly
No need to go through a public getter
for internal uses.
2019-06-05 04:25:14 +00:00
Matthias Clasen
1f70bc4bf3 gdk: Create a global shared GL context
Create a global GL context that connects all
GL contexts on a display and lets us share textures
between them.
2019-06-04 23:00:02 +00:00
Matthias Clasen
792d578f4b Cosmetics
Remove a doc comment for no-longer-public api.
2019-05-29 18:04:15 +00:00
Matthias Clasen
8ed27d6e3b Drop gdk_surface_move
And its cousin, gdk_surface_move_resize.
These APIs are expecting global coordinates,
which are going away. GTK is not using them
anymore.
2019-05-29 18:04:08 +00:00
Matthias Clasen
d515c43dce Make gdk_surface_get_origin internal
We still use this function inside gdk in
a number of places, so keep it around.
2019-05-29 18:04:08 +00:00
Matthias Clasen
879f22fd27 Drop gdk_display_get_monitor_at_point
This api expects global coordinates, and
is unused.
2019-05-29 18:04:08 +00:00
Matthias Clasen
987e7878a2 Drop gdk_surface_get_frame_extents
No longer used.
2019-05-29 18:04:08 +00:00
Matthias Clasen
fd048005f5 Clarify gdk_surface_get_position
This function returns the position relative to
the surface parent, so will always return 0 for
non-popups. The out arguments don't need to
allow-none either - nobody passes NULL for these.
2019-05-29 18:04:08 +00:00
Matthias Clasen
902a49af9d surface: Add coordinate translation
We maintain offsets for popups, so we can translate
coordinates between surfaces that are attached directly
or indirectly to the same toplevel. Add an api for that.
2019-05-29 18:04:08 +00:00
Matthias Clasen
11fdde0b8f surface: Cosmetics
Move things where they belong.
2019-05-28 20:25:17 +00:00
Matthias Clasen
a3f127b0d0 surface: Give backends a chance to disconnect
Call the destroy vfunc before clearing
frame clock and gl context, so backends
have a chance to clean up.
2019-05-28 20:25:17 +00:00
Matthias Clasen
c7f9f8f63d surface: Fix the fallback move-to-rect implementation
On X11, the final and flipped rects were reporting
global coordinates. This was showing up as misplaced
popover beaks.
2019-05-28 20:25:17 +00:00
Matthias Clasen
895962d781 surface: Make only toplevels control events
There is no need for popups to connect to the frame
clock to pause and unpause events on the display -
the toplevel already does it.

And don't connect to paint either - handle paint
on popups recursively.
2019-05-28 20:25:17 +00:00
Matthias Clasen
3d283cc8f4 gdk: Maintain popup tree in the frontend
We will need this information here, and we can
share the child lists between various backends.
2019-05-28 20:25:17 +00:00
Matthias Clasen
44be64278b surface: Make surface-type a property
Make surface-type a construct-only property,
so we can set it before the frame clock.
2019-05-28 20:25:16 +00:00
Matthias Clasen
c2b9a12f6f surface: Don't dispose the frame clock prematurely
Since we are now sharing frame clocks with multiple
surfaces, we can no longer dispose them unconditionally
when a surface goes away. Only do it if we are a
toplevel (without parent).

This was showing up as criticals on exit when opening
and closing any popover in widget factory.
2019-05-28 20:25:16 +00:00
Matthias Clasen
db855e092d Add a GdkSurface::parent property 2019-05-28 20:25:15 +00:00
Matthias Clasen
18e396ef6c Add gdk_surface_get_parent back
The api is the same, the parent is different.
This now returns the parent of popup surfaces.
2019-05-28 20:25:15 +00:00
Alexander Larsson
ebb89bca0d surface: Remove gdk_surface_set/merge_child_input_shapes()
These are useless now that we don't have child surfaces
2019-05-28 20:25:15 +00:00
Alexander Larsson
1c7eb5ca33 surface: Remove old debug code 2019-05-28 20:25:15 +00:00
Matthias Clasen
b15ba64ec9 surface: Add an autohide property
This api is meant to mimic xdg-popover.grab - we
show the surface, and dismiss it when we get events
on other surfaces. For foreign surfaces, the compositor
handles that for us; for our own, we check outselves
before delivering events to GTK.
2019-05-28 20:25:14 +00:00
Matthias Clasen
1661615fef surface: Stop setting transient-for for popups
This was just a hack to reuse the existing
infrastructure. Now that we store parents separately,
stop doing it.
2019-05-28 20:25:14 +00:00
Matthias Clasen
1fa2a8217f surface: Make move-to-rect work for popups
Now that we store popup parents separately,
the client-side move-to-rect implementation
must use them.
2019-05-28 20:25:14 +00:00
Matthias Clasen
33c6dff881 gdk: Introduce a popup surface type
This surface type is meant to have semantics
similar to xdg-popup, with a mandatory parent,
and relative placement using gdk_surface_move_to_rect.
2019-05-28 20:25:14 +00:00
Matthias Clasen
712a5d4f25 Get rid of GdkSurfaceImpl
We don't need the complicated wrapper system anymore,
since client-side windows are gone. This commit moves
all the vfuncs to GtkSurfaceClass, and changes the
backends to just derive their surface implementation
from GdkSurface.
2019-05-28 20:25:14 +00:00
Matthias Clasen
d2951d3aac Rename surface constructors
We want to use a gdk_surface_new_popup for popups,
and align the constructor names with the surface
types, so rename

gdk_surface_new_popup -> gdk_surface_new_temp
gdk_surface_new_popup_full -> gdk_surface_new_popup

The temp surface type will disappear eventually.
2019-05-28 20:25:14 +00:00
Matthias Clasen
8536557007 gdk: Drop pass-through surfaces
With client-side windows gone, this property
is no longer used at all, and has been replaced
by a similar concept on the widget level.
Drop it.
2019-05-28 20:25:14 +00:00
Matthias Clasen
47fb092393 gdk: Drop GdkWindowAttr
All the information in it is already contained
in the surface object we pass along, and none
of the backend implementations were using the
attributes at all.
2019-05-28 20:25:14 +00:00
Matthias Clasen
2855729cb4 gdk: Drop input-only surfaces
We are not creating such surfaces anymore, and
they were only ever meaningfully implemented
on X11. Drop the concept, and the api for determining
if a surface is input-only.
2019-05-28 20:25:14 +00:00
Matthias Clasen
1a23ebf105 gdk: Remove an unused field
Spring cleaning. We are not using this field
at all, since we have the input_only boolean.
2019-05-28 20:25:14 +00:00
Matthias Clasen
82c8a05855 Drop gdk_surface_new_temp
This is no longer used, and the only difference
to gdk_surface_new_popup is input-only, which is
an X11-only concept.
2019-05-28 20:25:14 +00:00
Matthias Clasen
73a6aaebfd surface: Make gdk_surface_get_device_position void
None of the callers were using the return value,
and without child surfaces, it is not very useful.
2019-05-28 20:25:14 +00:00
Matthias Clasen
cb23d40d36 Drop gdk_surface_get_root_origin
It was not used.
2019-05-28 20:25:14 +00:00
Matthias Clasen
2ccd0dc8c6 Remove gdk_surface_coords_to/from_parent
This api was unused, and surfaces have no parents anymore.
2019-05-28 20:25:14 +00:00
Matthias Clasen
a3e0329a12 surface: Small simplification
No more special-casing of state setting.
2019-05-28 20:25:14 +00:00