Commit Graph

1255 Commits

Author SHA1 Message Date
Matthias Clasen
dc0570cc17 gsk: Drop the GskRenderer::scale-factor property
This is can always be obtained from the window that is already
associated with the renderer, no need to maintain a separate
property for it.
2017-10-28 11:49:39 -04:00
Drew DeVault
1b279e3d4a Wayland: Implement KDE's SSD protocol
If the compositor prefers server-side decorations and the client doesn't
customize the title bar, we disable client-side decorations and let the
compositor know. Otherwise, we continue to use client-side decorations.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

https://bugzilla.gnome.org/show_bug.cgi?id=781909
2017-10-26 15:51:56 -04:00
Timm Bäder
7ee2ab32b8 window: Use correct destroy notify for icon list
The list contains cairo_surface_t instances now, not GdkPixbuf anymore.
2017-10-23 14:43:47 +02:00
Alexander Larsson
d3fc937b4d GtkWindow/GdkWindow: Finish converting icons to surfaces
There were some parts left, for instance gdk_window_set_icon_list.
2017-10-23 13:45:25 +02:00
Matthias Clasen
8eea3e2ddd window: Correct the property definition for icon
cairo surfaces are boxed types, not objects.
2017-10-23 07:39:12 +02:00
Alexander Larsson
aa873e7709 GtkWindow: Use cairo_surface_t for icons 2017-10-22 22:57:21 +02:00
Timm Bäder
04c550bfb5 window: Make sure we query the window size before size-allocate'ing 2017-10-20 14:56:29 +02:00
Matthias Clasen
55df74a102 window: Remove dead code
GtkWindow never has a parent widget, so we never need to create
a child window for it.
2017-10-20 14:43:11 +02:00
Timm Bäder
c4c6a20998 popover: Explicitly call queue_allocate in tick callback
_gtk_window_set_popover_position is begin called in size-allocate.
2017-10-14 17:27:55 +02:00
Timm Bäder
d5fd2dca66 window: Remove widget parameter from popover_size_allocate
We already get that via the popover parameter.
2017-10-14 17:27:55 +02:00
Timm Bäder
f2ca2e1242 window: Make code snippets compile
Fix the wrong signature of a size_allocate signal handler
2017-10-12 15:42:03 +02:00
Matthias Clasen
ab22734159 Fix application window snapshot differently
As Timm Baedert pointed out, the previous fix made the
menubar go on top of popovers, which is just wrong. Instead,
make gtk_window_snapshot handle all direct children of the
window, taking care to stack popovers correctly.
2017-10-08 14:03:19 -04:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
177f3ef655 gtkwindow: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Daniel Boles
50106521d6 Window: Clarify documentation of set_application()
Clarify that ::destroy, not ::hide*, removes a window from its app, by
replacing the mention of open windows with the blurb on destruction from
:application, completing commit 7db4bee4b6

Also link to the equivalent gtk_application_(add|remove)_window() calls,
since Application.add_window() already links back to Window:application.

* unless you use gtkmm…

https://bugzilla.gnome.org/show_bug.cgi?id=639931
2017-09-19 00:20:17 +01:00
Georges Basile Stavracas Neto
0bdaebef1e window: Improve detection of edge constraint support
Instead of relying on special values of edge constraints, this
patch adds an internal-only gdk_window_supports_edge_constraints()
function that by default returns FALSE, and is implemented by
GdkWindowWayland and GdkWindowX11.

This way, we can properly detect server-side support for this
feature and adapt accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=783669
2017-09-17 23:16:48 -03:00
Georges Basile Stavracas Neto
b1c4e9afef window: Add individual CSS classes based on edge constraints
The last touch on this patch series is making GtkWindow able to
selectively adjust various UI details based on the different
tiled edges. The main driver here is that we don't want to show
shadows on edges that are constrained.

This patch adds the necessary code to do that, while still
maintaining compatibility with the old ways.

https://bugzilla.gnome.org/show_bug.cgi?id=783669
2017-09-17 23:16:48 -03:00
Georges Basile Stavracas Neto
45f4844880 window: handle tiled edges separately
GTK windows don't have their tiling states really
hooked into the client-side decoration code, and
the only effect it has is disabling the resizing
edges.

With the introduction of per-edge tiling information,
we are backed by much more precise data on how the
window manager wants the app to behave.

This patch, then, fixes GtkWindow to take into account
per-edge tiling information. For compatibility purposes,
the previous tiled field was kept, and thing will just
continue working if no edge information is supplied.

https://bugzilla.gnome.org/show_bug.cgi?id=783669
2017-09-17 23:16:48 -03:00
Daniel Boles
6984d0847b Window: Do not connect to NULL screen in init()
Do not connect to get_settings_for_screen() if we have no screen…

Use g_signal_connect(), not connect_object(), to match how set_screen()
makes this same connection, and how finalize() already disconnects it.

https://bugzilla.gnome.org/show_bug.cgi?id=705640
2017-08-31 20:26:44 +01:00
Timm Bäder
54c362bf48 gtkwindowprivate: Remove _gtk_window_keys_foreach
Unused outside of gtkwindow.c
2017-08-14 14:24:29 +02:00
Carlos Garnacho
4f31afcd9c window: Fix traversal of popovers during picking
These need to be traversed in the opposite direction. Given the order is
opposite to rendering, use a GQueue so it's cheap to traverse/add either
way.
2017-08-06 22:44:40 +02:00
Daniel Boles
01e587da22 Window: Also quote Window address in Popover error
This is symmetrical with how we already do that for the Popover, and it
could be useful for debugging.
2017-08-03 21:10:22 +01:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
3aeaeef070 window: Fix resizing with solid-csd
We can't use a 20px resize handle in that case so fall back to the
padding area of the window. Still ugly but it works.
2017-07-19 21:27:15 -04:00
Timm Bäder
5fb27e2bd7 window: Fix annotations in get_size and get_position 2017-07-19 21:27:15 -04:00
Timm Bäder
451a991488 window: Move updates debugging to GtkWidget
Which has the necessary information.
2017-07-19 21:27:15 -04:00
Timm Bäder
8dd29d755c window: Don't use allocated size in snapshot
Those are the wrong values.
2017-07-19 21:27:14 -04:00
Timm Bäder
2cbaa998db widget: Fix drawing invalidation with windowed widgets
E.g. popovers. Find the parent of the given widget with the window and
invalidate the given region in that window.
2017-07-19 21:27:14 -04:00
Timm Bäder
79797cd162 window: Stop wrapping popovers in another window
GtkPopover is already a windowed widget.
2017-07-19 21:27:14 -04:00
Timm Bäder
b8cc22a552 window: Remove dead code
This case can never happen since GtkWindow instances never have a
parent.
2017-07-19 21:27:13 -04:00
Timm Bäder
60e053f52a Remove calls to gtk_widget_set_allocation
gtk_widget_size_allocate_with_baselines does it automatically now.
2017-07-19 21:27:12 -04:00
Timm Bäder
2cd1a984cf set clip of more widgets 2017-07-19 21:27:11 -04:00
Carlos Garnacho
9de7c9f595 gtkwindow: Free pointer foci on dispose
That means the whole hierarchy is getting destroyed, leaving those
behind incurs not only in a leak, but also on weak refs (and unintended
repick) to happen in the wrong moment.
2017-07-19 18:16:18 +02:00
Carlos Garnacho
4772fc2d42 gtkwindow: Do not leak GtkPointerFocus
gtk_window_add_pointer_focus() increments the refcount, which means
the caller should be dropping its own.
2017-07-19 18:16:18 +02:00
Carlos Garnacho
b894c35008 gtk: Make GtkPointerFocus refcounted
In order to make it really sure the GtkPointerFocus is valid while being
removed from a GtkWindow.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
0d7fe2ec09 gtk: Check implicit grab status before sending crossing events
As we now refrain from sending the crossing events if there's an
implicit grab, those events must be sent on button release when
the implicit grab is broken.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
e892e20841 gtk: Rework pointer cursor selection
Check the grab widget (both explicit and implicit) and check for a cursor
from the target widget up to this grab widget. If the target widget is
outside the grab widget, only the grab wigdet's cursor will be checked.

This also means that we have to ensure the cursor is updated on button
releases, as an implicit grab being deactivated must trigger a cursor
lookup from the target widget.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
47e505781e gtkwindow: Implement ::pick to extend picking to popovers.
This makes interaction possible with popovers again.
2017-05-25 16:25:59 +02:00
Timm Bäder
f5e8d7a4e2 window: Hide titlebox when undecorated
We don't draw or size-allocate the titlebar when the window is
fullscreen or undecorated, so reflect this by setting it to
!child_visible. This can happen when changing the value of the decorated
property while the window is shown.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
599344d428 gtkwindow: Add private API to update pointer cursors 2017-05-25 16:25:59 +02:00
Carlos Garnacho
1858f310aa gtkwindow: Implement window resizing sans-GdkWindow
We can just replace window comparisons with coordinate matching, the
cursor corresponding to edges is now set in a capture-phase motion
handler, as cursors aren't set on GdkWindows anymore.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
95bf1379c0 gtkwindow: Ignore implicit grabs going away if there is no focus
There should be no circumstances where an implicit grab is requested but
no focus exists, there's however circumstances (like windowing grabs taking
input to a different window) where we might get implicit grabs being undone
when then new window didn't create a focus for the pointer itself.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
b7fee9f9d2 gtkwindow: Revoke implicit grabs when activating an explicit one
Only if they fall outside the grab widget, in that case the widget holding
the implicit grab won't be receiving events anymore, so we can just undo
it.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
3dfab962fa gtk: Implement per-focus implicit grabs
Unlike GTK+ grabs which are global to all/one device, the implicit grab
is per focus, which means each may have implicit grabs on different or
the same widget.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
8f24df1c19 gtk: Update GtkPointerFocus targets on mapping/sensitivity changes
Those are situations that must cause foci on these widgets to repick
themselves.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
17aa0ca76e gtkwindow: Add management functions for GtkPointerFocus instances
Each toplevel will keep its own tracking of the current ongoing foci,
add the plumbing that will allow to create/update/remove those as they
come and go.
2017-05-25 16:25:58 +02:00
Jonas Ådahl
477556aac2 GtkWindow: Don't double free export user data
The user data passed when exporting a Wayland window was supposed to be
freed using the destroy_func, as is commonly done. This was previously
broken, as the user data was just NULL:ed when exported, and only
actually destroyed when unexporting before having exported.

While e016d9a5db fixed this, it introduced
a regression, as GtkWindow was nice enough to free the memory anyway
after having received the exported handle, causing it now to double
free.

https://bugzilla.gnome.org/show_bug.cgi?id=782109
2017-05-09 23:23:11 +08:00
Timm Bäder
1a7a089e2c window: Stop using gtk_widget_get_preferred* 2017-05-05 11:18:24 +02:00
Emmanuele Bassi
c05fcdbba0 window: Remove property definition
Commit 92b0d2e8ea removed the
hide-titlebar-when-maximized property handlers, but it still installed
the GParamSpec into the GtkWindow class.
2017-05-03 15:58:49 +01:00