Commit Graph

747 Commits

Author SHA1 Message Date
Christian Hergert
352898ae9e inspector: fix compilation with broadway 2021-06-17 11:54:00 -07:00
Matthias Clasen
7745f67583 broadway: Add a setter for display scale
This is useful when using Broadway as a headless
display server.

Fixes: #3934
2021-05-10 07:19:26 -04:00
Matthias Clasen
374225ae6a Cosmetics 2021-05-09 19:32:48 -04:00
Rafał Dzięgiel
d586410416
broadway: Restore guint32 type for memory size
guint32 is used as part of the protocol in broadway backend.
Memory size declared with it was mistakenly replaced with size_t type
which does not guarantee being 32bit on all platforms, leading to a crash.
2021-02-27 23:43:12 +01:00
Emmanuele Bassi
504b5bbd1b broadway: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions
of GLib.
2021-02-11 14:22:22 +00:00
Jonas Ådahl
142f7862ed gdk/toplevellayout: Change API to be about intent, not full state
When being fullscreen, and wanting to unfullscreen but not caring about
whether to go unmaximized or maximized (as this information is lost), if
the GdkToplevelLayout represents the full intended state, we won't be
able to do the right thing.

To avoid this issue, make the GdkToplevelLayout API intend based, where
if one e.g. doesn't call gdk_toplevel_set_maximized() with anything, the
backend will not attempt to change the maximized state.

This means we can also remove the old 'initially_maximized' and
'initially_fullscreen' fields from the private GtkWindow struct, as we
only deal with intents now.
2020-12-16 14:16:08 +01:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Emmanuele Bassi
7975bbfcaa build: Remove linker flags from static libraries
We only need hardening linker flags on the libgtk shared library;
internal static libraries don't really need them.
2020-12-15 11:36:20 +00:00
Jonas Ådahl
d2c95a1b13 gdk: Replace 'WITHDRAWN' state with async 'is-mapped' boolean
It was used by all surfaces to track 'is-mapped', but still part of the
GdkToplevelState, and is now replaced with a separate boolean in the
GdkSurface structure.

It also caused issues when a widget was unmapped, and due to that
unmapped a popover which hid its corresponding surface. When this
surface was hidden, it emitted a state change event, which would then go
back into GTK and queue a resize on popover widget, which would travel
back down to the widget that was originally unmapped, causing confusino
when doing future allocations.

To summarize, one should not hide widgets during allocation, and to
avoid this, make this new is-mapped boolean asynchronous when hiding a
surface, meaning the notification event for the changed mapped state
will be emitted in an idle callback. This avoids the above described
reentry issue.
2020-12-07 20:37:30 +01:00
Jonas Ådahl
6ee7535af0 gdk/toplevelsize: Rename 'margin' to 'shadow' and 'shadow_width'
This makes it more consistent with everywhere else.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
42679f2903 gdk: Replace all GDK_CONFIGURE usage with GdkSurface::layout
This removes the GDK_CONFIGURE event and all related functions and data
types; it includes untested changes to the MacOSX, Win32 and Broadway
backends.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
3f96d4b6da gdk: Always get shadow width via GdkToplevelSize
This removes the gdk_surface_set_shadow_width() function and related
vfuncs. The point here is that the shadow width and surface size can now
be communicated to GDK atomically, meaning it's possible to avoid
intermediate stages where the surface size includes the shadow, but
without the shadow width set, or the other way around.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
641915974b gdk/toplevel: Make gdk_toplevel_present() async
The plan is to concencrate size computations as part of the frame clock
dispatch, meaning we shouldn't do it synchronously in the present()
function.

Still, in Wayland, and maybe elsewhere, it is done in the present()
function, e.g. when no state change was made, but this will eventually
be changed.
2020-12-07 09:46:39 +01:00
Benjamin Beichler
8efde9c48c broadway: make header name parsing case-insensitve
since http RFC state that the header names should be processed case in-sensitive, broadway should not rely on the actual case. E.g. the go-language libraries tend to rewrite the header, which cause problems with e.g. Caddy

Fixes #3406
2020-11-27 12:05:51 +01:00
kai-berlin
499e4b4c50 broadway: Set modifier state of scroll events
Set modifier state of scroll events, so Ctrl-scroll
works.

Fixes: #2733
2020-11-03 19:21:00 -05:00
Matthias Clasen
27ef9d9e5e broadway: Stop using gdk_surface_new_temp
No need to roundtrip through the frontend to create
one of our own surfaces.
2020-10-07 21:04:05 -04:00
Matthias Clasen
93078e52c0 gdk: Rename GdkSurfaceState to GdkToplevelState
That is what it is.

Fixes: #2790
2020-09-10 00:39:03 -04:00
Matthias Clasen
75915bc782 broadway: Fix up surface_at_position 2020-08-26 17:56:41 -04:00
Matthias Clasen
338d6adb10 broadway: Drop unused argument from query_state
Now that this is backend-only api, we can just
drop unused arguments.
2020-08-26 17:56:41 -04:00
Matthias Clasen
c4c155d698 broadway: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-26 17:56:41 -04:00
Matthias Clasen
73d81d7178 broadway: Stop using the query_state vfunc
Just call the backend implementation directly.
2020-08-26 17:56:41 -04:00
Alexander Larsson
d57e6b754f broadway: Prune fully clipped render nodes
If some node is fully outside the clip region we don't send it to the daemon.
This helps a lot in how much data we send for scrolling viewports.

However, sending partial trees makes node reuse a bit more tricky. We
can't save for reuse any node that could possibly clip different depending on
the clip region, as that could be different next frame. So, unless the
node is fully contained in the current clip (and we thus know it is not
parial) we don't allow reusing that next frame.

This fixes #3086
2020-08-26 18:08:00 +02:00
Timm Bäder
45046a53eb Merge branch 'broadway-debug-nodes' into 'master'
Broadway: Fix handling of debug nodes

See merge request GNOME/gtk!2486
2020-08-26 12:38:09 +00:00
Alexander Larsson
918996b047 Broadway: Fix handling of debug nodes
The debug nodes have id BROADWAY_NODE_DEBUG, which happens to be "12".
So, don't hardcode the wrong number "14".
2020-08-26 14:01:00 +02:00
Alexander Larsson
fcaa6e98d0 broadway: Correct handling of opaque colors
If alpha is 255, we use rgb() instead of rgba(), not if alpha is 0.
This makes the title bar gradient go from fully transparent to blue
rather than black to blue..
2020-08-26 12:18:28 +02:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Jonas Ådahl
2ff74eb667 gdk/toplevel: Negotiate surface size via a compute-size signal
GTK will not up front know how to correctly calculate a size, since it
will not be able to reliably predict the constraints that may exist
where it will be mapped.

Thus, to handle this, calculate the size of the toplevel by having GDK
emitting a signal called 'compute-size' that will contain information
needed for computing a toplevel window size.

This signal may be emitted at any time, e.g. during
gdk_toplevel_present(), or spontaneously if constraints change.

This also drops the max size from the toplevel layout, while moving the
min size from the toplevel layout struct to the struct passed via the
signal,

This needs changes to a test case where we make sure we process
GDK_CONFIGURE etc, which means we also needs to show the window and
process all pending events in the test-focus-chain test case.
2020-08-05 15:49:00 +02:00
Carlos Garnacho
96452a2e46 gdk: Rename gdk_seat_get_physical_devices() to gdk_seat_get_devices()
We don't want to tell what they are, and the distinction is now less
clear. Remove the adjective from the function name.
2020-07-30 18:44:40 +02:00
Carlos Garnacho
46eb054337 gdk: Drop gdk_device_get_device_type()
There is no longer a hierarchy of devices, or none that is seen
on the outside.
2020-07-30 18:44:40 +02:00
Benjamin Otte
4dc2ab61c9 Merge branch 'wip/otte/geometry' into 'master'
Some GdkGeometry cleanups

See merge request GNOME/gtk!2322
2020-07-30 15:31:27 +00:00
Benjamin Otte
3dd0e6d0b1 Remove gravity from GdkGeometry
It's always northwest
2020-07-30 17:06:15 +02:00
Matthias Clasen
7df070d681 gdk: Move default group api to the X11 backend
This is the only place where it is implemented.
2020-07-29 22:58:37 -04:00
Jonas Ådahl
c7c71137b2 gdk/monitor: Remove gdk_monitor_work_area and GdkMonitor::work-area
It's not a portable API, so remove it. The corresponding backend
specific functions are still available, if they were implemented, e.g.
gdk_macos_monitor_get_workarea() and gdk_x11_monitor_get_workarea().
2020-07-29 17:57:30 +02:00
Carlos Garnacho
cab1dcb696 gdk: Conflate GDK devices
Make GdkEvents hold a single GdkDevice. This device is closer to
the logical device conceptually, although it must be sufficient for
device checks (i.e. GdkInputSource), which makes it similar to the
physical devices.

Make the logical devices have a more accurate GdkInputSource where
needed, and conflate the event devices altogether.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
25ea17a6fc gdk: Drop source_device argument from _gdk_display_device_grab_update()
It's just passed around and used nowhere.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
a2876b5cb4 gdkdevice: Remove gdk_device_get_state()
This is not needed nor recommended anymore, all reasons to maybe
need this were all kept within gdk.
2020-07-28 17:36:18 +02:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Carlos Garnacho
5f29b8fcec gdk: Drop GdkGrabOwnership
We no longer expose such low level tweaks, this is essentially
unused.
2020-06-23 23:42:53 +02:00
Emmanuele Bassi
1c856a208f Rename master and slave device
We already use the "logical/virtual" and "physical" names in the
documentation, there's no reason to use loaded terms just because X11
uses them.
2020-06-18 19:22:20 +01:00
Matthias Clasen
2c82151d65 gdk: Drop axis labels
This was only ever implemented on X11, and the labels
here were atom names, so unlikely to be useful for
anything interesting.
2020-06-10 07:36:30 -04:00
Matthias Clasen
ca1c89c5bd broadway: Drop a pointless vfunc
A vfunc that just returns FALSE is not useful.
2020-06-08 18:24:20 -04:00
Christian Hergert
fa08d848ca device: remove get_toplevel from surface_at_position vfunc
This is not used anymore now that surfaces are always toplevel in the
semantics of GdkWindow where child windows were available. We can drop
that and simplify the vfunc just a bit more.

Fixes #2765
2020-05-19 13:07:38 -07:00
Matthias Clasen
d6818475d7 gdk: Simplify gdk_display_supports_input_shapes
Make this a display property, and do away with
the vfunc in favor of a private setter, to match
how we handle other display characteristics.
2020-05-17 22:05:24 -04:00
Matthias Clasen
287c40276a gdk: Drop gdk_display_supports_shapes
The apis to set shapes on surfaces are gone,
so there is no point in providing this information
on GdkDisplay.
2020-05-17 21:52:15 -04:00
Matthias Clasen
71bad81aff gdk: Make gdk_drag_begin take doubles
This is a better fit to the way we treat coordinates
everywhere else.
2020-05-17 17:51:03 -04:00
Matthias Clasen
c0faf0c6b6 Merge branch 'toplevel-move-resize' into 'master'
Toplevel move resize

See merge request GNOME/gtk!1923
2020-05-17 19:15:46 +00:00
Matthias Clasen
1e8a58e367 gdk: Move the begin_move/resize_drag vfuncs around
Move these from GdkSurface to GdkToplevel, where they
belong. Update all backends.
2020-05-17 14:15:06 -04:00
Benjamin Otte
b353221185 Merge branch 'wip/otte/monitors' into 'master'
various GDK cleanups

See merge request GNOME/gtk!1920
2020-05-17 16:57:52 +00:00