Commit Graph

1268 Commits

Author SHA1 Message Date
Benjamin Otte
cf2d549e92 widget: Implement gtk_widget_pick()
... and use it.
2017-11-05 05:13:17 +01:00
Benjamin Otte
70846c85b3 window: Make icons GdkTextures
Cairo surfaces are bad, mkay?
2017-11-05 00:07:17 +01:00
Benjamin Otte
9323d098a6 gdk: Cursors no longer have a display
Change constructors to reflect that.

While doing so, also add a fallback argument to the cursor constructors,
so it is now possible to create cursors with fallback.
2017-11-04 00:07:13 +01:00
Carlos Garnacho
b8d3f88ddb gtkwindow: Use event target widget for WM handling special paths
The check used to achieve discarding events not meant for the window
widget itself (because they are handled in the regular paths). Using
the target widget is the equivalent now.
2017-11-03 22:19:13 +01:00
Kjell Ahlstedt
23014438d6 GtkWindow: Tidy up after icon became a cairo surface
Use g_value_set/get_boxed() in gtk_window_get/set_property(), case PROP_ICON.
icon_from_list() shall always add a reference to the returned icon.
gtk_window_set_icon() must accept icon != NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=789870
2017-11-03 20:05:28 +01:00
Matthias Clasen
81cda3dcf7 Use x11-specific api to get at the screen
gdk_display_get_default_screen is going away.
2017-11-01 19:44:28 -04:00
Matthias Clasen
606345cbaa Change the fullscreen-on-monitor api
Use GdkMonitor here, since that is our primary monitor
object now, and GdkScreen is going away.
2017-11-01 14:17:20 -04:00
Benjamin Otte
b880296354 window: Unset transient parent in set_display()
If somebody changes a window's display, the transient parent cannot
stay if it's on a different display.
2017-11-01 18:17:11 +01:00
Benjamin Otte
8059f9bb3a window: Clear the renderer un unrealize
We disconnect from the GDK window, so the renderer can't keep any useful
state.

Plus, we might be using an entirely different window next time we
realize (after a call to gtk_window_set_display() for example) that should
use a completely different renderer anyway.
2017-11-01 15:48:00 +01:00
Matthias Clasen
a3cffa5072 Drop GdkScreen from GdkDevice apis
Returning the screen does not add anything here and
GdkScreen is going away.
2017-10-31 12:30:38 -04:00
Benjamin Otte
07164e098a window: Turn gtk_window_set_screen() into gtk_window_set_display()
And have a priv->display instead of a priv->screen.

Includes turning gtk_menu_set_screen() into gtk_menu_set_display(),
because that function just forwards to its window.
2017-10-31 08:25:37 +01:00
Benjamin Otte
c8986e66ce window: Remove gtk_window_get_screen()
It's identical to gtk_widget_get_screen(), just use that one.
2017-10-31 04:33:54 +01:00
Benjamin Otte
44614394e6 widget: Turn screen-changed signal into display-changed 2017-10-31 00:43:11 +01:00
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