Commit Graph

29 Commits

Author SHA1 Message Date
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
Matthias Clasen
73f4f518b8 gdk: Improve struct packing in places
Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.
2020-07-25 11:57:37 -04:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 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
59a8106373 gdk: Drop supports_multidevice API
Crossing events are now detached from widget state, all tricky consequences
from getting multiple crossing events are now somewhat moot. Resort to sending
all generated crossing events, and drop this barely (ever?) used API.
2020-06-23 23:42:53 +02: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
0c6266fd1a surface: Remove gdk_surface_is_viewable()
It returns the same value as gdk_surface_get_mapped(), so use that
instead.
2020-05-17 00:41:44 +02:00
Olivier Fourdan
3e1f59af61 gdk: Add gdk_toplevel_inhibit_system_shortcuts API
With the removal of grabs from the public API, we need a replacement API
to let applications bypass system keyboard shortcuts.

A typical use case for this API is remote desktop or virtual machine
viewers which need to inhibit the default system keyboard shortcuts so
that the remote session or virtual host gets those instead of the local
environment.

Close: https://gitlab.gnome.org/GNOME/gtk/issues/982
2020-03-30 18:25:36 +02:00
Matthias Clasen
1576cced0f Drop GdkToplevel:accept-focus/:focus-on-map
These properties were only ever implemented in the
X11 backend. If you want to use them, just use the
X properties directly.
2020-03-14 19:28:00 -04:00
Matthias Clasen
f020d77a23 Move fullscreen-mode to GdkToplevel 2020-03-12 15:30:11 -04:00
Matthias Clasen
81be6ff46b Move edge-constraints to GdkToplevel 2020-03-12 15:30:11 -04:00
Matthias Clasen
b7f51a362e surface: Drop unused vfuncs
These are now entirely unused.
2020-03-12 15:30:11 -04:00
Matthias Clasen
90dfca290c gdk: Drop surface-type
We have interfaces for surface subtypes now.
2020-03-12 15:30:10 -04:00
Matthias Clasen
b2ae6ce8ff surface: Rename gdk_surface_input_shape_combine_region
There is no shape combining going on anymore, so
call this just gdk_surface_set_input_region, and
remove the offset arguments too. All callers pass
0 anyway.

Update all callers and implementations.
2020-03-11 19:35:56 -04:00
Benjamin Otte
b0f6996892 gdk: Remove gdk_surface_register_dnd()
All surfaces are expected to be DND surfaces from creation.
2020-02-23 01:59:00 +01:00
Jonas Ådahl
ca71119a40 gdk/surface: Replace move_to_rect() with GdkPopupLayout based API
Replace the gdk_surface_move_to_rect() API with a new GdkSurface
method called gdk_surface_present_popup() taking a new GdkPopupLayout
object describing how they should be laid out on screen.

The layout properties provided are the same as the ones used with
gdk_surface_move_to_rect(), except they are now set up using
GdkPopupLayout.

Calling gdk_surface_present_popup() will either show the popup at the
position described using the popup layout object and a new unconstrained
size, or reposition it accordingly.

In some situations, such as when a popup is set to autohide, presenting
may immediately fail, in case the grab was not granted by the display
server.

After a successful present, the result of the layout can be queried
using the following methods:

 * gdk_surface_get_position() - to get the position relative to its
   parent
 * gdk_surface_get_width() - to get the current width
 * gdk_surface_get_height() - to get the current height
 * gdk_surface_get_rect_anchor() - to get the anchor point on the anchor
   rectangle the popup was effectively positioned against given
   constraints defined by the environment and the layout rules provided
   via GdkPopupLayout.
 * gdk_surface_get_surface_anchor() - the same as the one above but for
   the surface anchor.

A new signal replaces the old "moved-to-rect" one -
"popup-layout-changed". However, it is only intended to be emitted when
the layout changes implicitly by the windowing system, for example if
the monitor resolution changed, or the parent window moved.
2020-02-19 09:47:18 +01:00
Jonas Ådahl
4e78dd2ae0 gdk/surface: Use enum type for surface type 2020-02-19 09:47:18 +01: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
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
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
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
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
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
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