Commit Graph

8792 Commits

Author SHA1 Message Date
Benjamin Otte
96b782c026 x11: Make sure stream stays alive long enough
When unreffing the stream from a different thread, the close function
will schedule its cleanup asynchornously in the main thread.
We need to make sure the stream object stays alive for as long as
that hasn't happened, so ref() it.

Fixes #2003
2019-07-05 21:17:00 +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
Emmanuele Bassi
f524a9315b Set the monitor's connector under X11
Like we do on Wayland.

In this case, we copy it from the same source as the output name,
because it's going to match.
2019-06-24 15:38:36 +01:00
Emmanuele Bassi
a5f22897f9 Relay the xdg_output.name to GdkMonitor
The xdg_output v2 interface has a `name` property that reflects the
output name coming from the compositor.

This is the closest thing we can get to a connector name.
2019-06-24 15:38:36 +01:00
Emmanuele Bassi
03840fb687 Add getter for a monitor connector
The migration from GdkScreen's monitor API to GdkMonitor left out a way
to get the connector's name of a monitor.

While there's no real guarantee coming from the underlying graphics
system that the connector's name is stable, some system components may
use it to uniquely identify a monitor until the next plug in/out event.
2019-06-24 15:38:36 +01:00
Benjamin Otte
c0bbfd950d x11: Actually call the finished func when finishing
Copy/paste madness was calling the status func...
2019-06-18 15:53:18 -04:00
Benjamin Otte
c2ac141031 contentformats: Fix doc typo 2019-06-18 15:50:53 -04:00
Matthias Clasen
bbea1cc841 wayland: Explicitly require RGBA8888
Its the format we expect to have. If we want to
support 10-bit visuals at some point, that should
be an explicit decision.
2019-06-17 12:41:01 -04: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
ed9b874d2e wayland: Fix the popover race workaround
The Wayland backend has a hack to work around
a race with popover mapping: If the surface size
changes before the initial configure, we hide and
show the surface. Unfortunately, the code was doing
this in a way that is externally observable (by
listening for surface state changes), and popovers
were observing it and hiding themselves in response.

Avoid this by not going through the GDK frontend
code for this.
2019-06-12 21:50:16 -04: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
Руслан Ижбулатов
2ace3113d6 GDK W32: Ensure correct stacking of popup windows
1) In the SetWindowPos() function (and the WINDOWPOS struct) the
   "hWndInsertAfter" argument/field means the window that will be
   directly above after the change, not the window that will be
   directly below. MSDN says "precedes" for SetWindowPos(), but
   WINDOWPOS documentation is more precise: this is the window
   behind which the affected window will be placed. Apparently,
   Z-axis goes back-to-front.
   Therefore, logging should be reworded correctly.

2) When we switch away from the application and then switch back
   to a transient window, we need to bring up its transient-owner
   (and its transient-owner's owner and so forth) as well,
   otherwise our transient (modal) window might be transient for
   something that might not be visible.

3) When we bring up a window, we should bring all of its children
   (popup windows) on top of it.
   Because Windows doesn't provide a function to bring one window
   on top of the other, we have to work around this by calling
   SetWindowPos() twice, swapping the windows between the calls.
2019-06-01 19:23:30 +00:00
Matthias Clasen
57175dd5b1 Drop gdk_event_get_root_coords 2019-05-31 23:36:35 +00:00
Matthias Clasen
c7f06dd35e win32: Stop using gdk_event_get_root_coords
It seems we want local coords here anyway.
2019-05-31 23:36:35 +00:00
Matthias Clasen
2ae6f1a741 Add a gtk-overlay-scrolling setting
This is in preparation for letting user opt out of
overlay scrolling in the control-center.
2019-05-31 14:07:15 +00:00
Christian Hergert
bd26cce812 gtk: rely on default marshallers
Similar to previous removals of g_cclosure_marshal_VOID__VOID we can remove
other marshallers for which are a simple G_TYPE_NONE with single parameter.
In those cases, GLib will setup both a c_marshaller and va_marshaller for
us. Before this commit, we would not get a va_marshaller because the
c_marshaller is set.

Related to GNOME/Initiatives#10
2019-05-30 20:56:50 -07:00
Niels De Graef
df9aed6c61 Fix some GObject introspection annotations
Fixes several warnings by the GIR compiler.
2019-05-30 20:34:43 +02:00
Christian Hergert
3a0beeadc5 profiler: port GdkProfiler to sysprof-3
This uses the new sysprof-3 ABI to implement the capture writer. It also
uses the statically linked libsysprof-capture-3.a that is provided with
Sysprof for the capture writing to ensure that we do not leak any symbols
nor depend on any additional libraries.

The GTK_TRACE_FD can be used to pass a FD for tracing into Gtk. Sysprof
uses this when the Gtk instrument is selected for recording.
2019-05-29 19:02:30 -07:00
Christian Hergert
82afe850e8 marshallers: add missing g_cclosure_marshal_VOID__VOID fixes 2019-05-29 13:48:33 -07:00
Christian Hergert
f507a79056 marshallers: ensure g_cclosure_marshal_VOID__VOIDv is used
If we set c_marshaller manually, then g_signal_newv() will not setup a
va_marshaller for us. However, if we provide c_marshaller as NULL, it will
setup both the c_marshaller (to g_cclosure_marshal_VOID__VOID) and
va_marshaller (to g_cclosure_marshal_VOID__VOIDv) for us.
2019-05-29 13:22:31 -07:00
Matthias Clasen
792d578f4b Cosmetics
Remove a doc comment for no-longer-public api.
2019-05-29 18:04:15 +00:00
Matthias Clasen
9ecd906b7f Cosmetics
Drop a leftover declaration.
2019-05-29 18:04:13 +00:00
Matthias Clasen
51396533a1 Fix the win32 build
gdk_display_get_monitor_at_point was used
in this backend.
2019-05-29 18:04:13 +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
12da0a6db1 Drop gdk_device_get_position
Root coordinates are going away, so this
api does not make sense anymore. Use
gdk_surface_get_device_position instead.
We still keep this as internal api for
root-coordinate using backends.
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
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