Commit Graph

8761 Commits

Author SHA1 Message Date
Matthias Clasen
987e7878a2 Drop gdk_surface_get_frame_extents
No longer used.
2019-05-29 18:04:08 +00:00
Matthias Clasen
0103c13632 x11: Set surface position correctly
The X backend was storing global coordinates
in surface->x/y, and keeping the parent-relative
positions in its own fields. Switch this around
to store the relative position in x/y, as is
expected by the frontend.
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
Benjamin Otte
89fb752a8f css: Use %f, not %.17f
The testusite failures explain why:
We don't want to print "1.00000000000000000", but "1".
2019-05-29 14:30:13 +02:00
Benjamin Otte
d71c196c5c css: Don't print numbers with exponent
CSS does not do exponents, so printing numbers close to 0 as 1.234e-15
does not work.

Also up the accuracy to 17 digits because that's what everyone else
uses.
2019-05-29 07:14:31 +02:00
Руслан Ижбулатов
84739dde99 GDK W32: Fix indentation and placate GCC 2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
d14e987c6c GDK W32: Correctly log popups 2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
b12d521bce GDK W32: Only use owner windows for popups
GTK4 doesn't have WS_CHILD windows anymore, so hWndParent argument
to CreateWindowEx() is always interpreted as the owner window,
not the parent window.

A window with an owner:
* is above the owner in Z-order
* is destroyed when the owner is destroyed
* is hidden when the owner is minimized
This is enforced by the OS.

GTK can only allow this for popup windows.

Desktop window must never[0] be an owner.

[0]: https://devblogs.microsoft.com/oldnewthing/20040224-00/?p=40493
2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
493b30c2a8 GDK W32: No more child windows
We don't have child windows (the window-inside-a-window kind of windows)
anymore. Remove all the code related to that.
2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
5ff7c3431b GDK W32: Don't handle WM_ACTIVATE for popup windows
Popups can't be active or inactive, so emitting GDK events
in response to WM_ACTIVATE makes no sense for these kinds
of GDK surfaces.

The jury is still out on whether we should block (return 0)
or ignore (don't return anything) this message.

Blocking WM_NCACTIVATE (which we currently ignore) is definitely
not an option - it completely breaks input somehow.
2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
6ab565b84a GDK W32: Adjust to new popup surfaces
1) Handle GDK_SURFACE_POPUP in RegisterGdkClass()
   (for now pretend it's the same as GDK_SURFACE_TOPLEVEL)

2) Remove useless code from GDK_SURFACE_TOPLEVEL case in _gdk_win32_display_create_surface()
   (now there's just GDK_SURFACE_TOPLEVEL there, no need for a type check)

3) Have a separate case for GDK_SURFACE_POPUP and ensure that
   it doesn't get WS_CHILDWINDOW (and neither should GDK_SURFACE_TEMP).
2019-05-28 20:25:17 +00:00
Matthias Clasen
11fdde0b8f surface: Cosmetics
Move things where they belong.
2019-05-28 20:25:17 +00:00
Matthias Clasen
2fa1a0a651 wayland: Disconnect the frame clock
The frame clock can survive the surface now,
so we need to disconnect.
2019-05-28 20:25:17 +00:00
Matthias Clasen
07b0da615b win32: Disconnect the frame clock
The frame clock can now survive the surface,
so we need to disconnect when the surface goes away.
2019-05-28 20:25:17 +00:00
Matthias Clasen
2aa0ceaeca x11: Disconnect from the frame clock
The frame clock can now survive its surface,
so we need to disconnect signal handlers.
2019-05-28 20:25:17 +00:00
Matthias Clasen
28addd3775 broadway: Disconnect from the frame clock
The frame clock can no survive its surface,
so we need to disconnect signal handlers.
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
78c94f9357 win32: Set surface type early enough
We need to set the surface type before
the frame clock.
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
2c43f87ef7 win32: Set the surface type
This is copying some code from the corresponding
create_surface implementations of the other backends.
2019-05-28 20:25:16 +00:00
Руслан Ижбулатов
138104de27 GDK W32: Fix the code to compile
Somewhat change the order of initialization (to be closer
to what Wayland backend does).

Also remove the wrapper field that is no longer needed -
it used to hold a pointer to the main GdkWindow instance,
which wrapped GdkWin32ImplWindow. Since impls are gone,
nothing is wrapping anything anymore.

Fix a substitution error, where wrong pointer was added
to the hash table. Added a comment to ensure that future readers
(including myself) won't be confused by the fact that we're
inserting a pointer instead of the handle itself.
2019-05-28 20:25:16 +00:00
Руслан Ижбулатов
d5e26cdb76 GDK W32: be able to handle NULL cursor 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
f728295e8c Cosmetics 2019-05-28 20:25:16 +00:00
Matthias Clasen
09ec88d0ce win32: Build fixes 2019-05-28 20:25:15 +00:00
Matthias Clasen
db855e092d Add a GdkSurface::parent property 2019-05-28 20:25:15 +00:00
Matthias Clasen
fa9cbf6c7d x11: Fix handling of frame clock freezes
Now that popups share the frame clock of their
parent, we have to be much more careful about
freezing the clock, since that may stop updates
for another surface.

This commit makes two changes that make the
X11 handling of the frame clock more similar
to the Wayland backend:
- Use gdk_surface_freeze_updates instead of
  gdk_surface_freeze_toplevel_updates to avoid
  affecting the frame clock
- Bail out early in before_paint/after_paint
  if the surface is frozen, to avoid affecting
  the frame clock

Together, these two make the X11 popup surface
type work without freezing updates for the toplevel.
2019-05-28 20:25:15 +00:00
Matthias Clasen
ef353f24c6 gdk: Inherit the frame clock for popups
With separate clocks, the phases are not coordinated,
which messes with GTKs size allocation machinery treating
the entire widget tree as a whole, and causes us to
run into assertion where popups get drawn before they
are allocated.
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
2dd15346a7 broadway: Track popups
This is more or less a 1:1 copy of the X11 code.
2019-05-28 20:25:14 +00:00
Matthias Clasen
6f1c32b3eb x11: Implement popup surfaces
Make them use o-r windows, and move
with their parent.

We do a sort-of ok job on stacking order
here - whenever the parent window gets a
ConfigureNotify, we just restack all popups
directly on top of their parent. This is good
enough to keep popups on top of their parent
while we drag it around, and it gets the popup
to disappear when raising another window on
top of the parent.
2019-05-28 20:25:14 +00:00
Matthias Clasen
99783c7fb7 wayland: Use popup parents
Make the Wayland move-to-rect implementation
use popup parents.
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
9af6d7f733 surface: Store popup parent
Store popup parents separately from transient-for
parents, since these are separate concepts with
different behaviors. And we need the parent in
the frontend, so we can use it in the fallback
move-to-rect implementation.
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
07b3a093bf x11: Remove useless checks
All surfaces are toplevels now, no need
to check for this all over the place.
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
93b8f2563d gdk: Add a private header
This is in preparation for getting rid of GdkSurfaceImpl.
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
0571fc265b surface: Cosmetics 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