Commit Graph

228 Commits

Author SHA1 Message Date
Matthias Clasen
92e21c3f1c Drop the can-default property
It was added at a time when default buttons
had a very large external border that would disrupt
aligment. Not a problem nowadays.
2019-04-28 23:28:39 +00:00
Matthias Clasen
3ccdad76de popover: Add a default.activate action
This is a first example of a widget intercepting
the default.activate for its own handling.
2019-04-28 23:20:13 +00:00
Matthias Clasen
56e95ddfc8 popover: Add a default-widget property
This is part of redoing default widget handling.
2019-04-28 23:20:13 +00:00
Matthias Clasen
65052a5d6c Rename gtk_window_set_default
Call it gtk_window_set_default_widget, to match
the getter, and the property name. Update all
callers.
2019-04-28 23:20:13 +00:00
Matthias Clasen
52d4bcf1be popover: Stop using gtk_widget_get_parent_surface
We can just use the surface of the parent.
2019-04-24 20:57:09 -04:00
Matthias Clasen
5b78a3048f gizmo: Add a contains_func
Let GtkGizmo override the contains() implementation.
Update all callers to pass NULL for the contains_func.
2019-04-07 15:47:24 +00:00
Matthias Clasen
c2c4133eb0 Fix up the border/background-color removal
I overlooked one level of indirection here. Oops.
2019-03-31 20:43:19 -04:00
Matthias Clasen
6f5675ef3c Stop using deprecated style context api
Use the non-deprecated one it wraps, instead.
Yes, this is cheating...
2019-03-31 15:35:20 -04:00
Timm Bäder
e657d9d553 popover: Always measure contents gizmo
Otherwise we're getting warnings about allocating a widget we haven't
measured first, which is fair. The contents gizmo itself will later take
care about whether or not the real popover child is NULL.
2019-03-25 15:57:31 +01:00
Timm Bäder
36e00ae95e popover: Don't try to compute_bounds of a NULL child 2019-03-25 15:57:30 +01:00
Matthias Clasen
31d9ecb5c3 popover: Stop using ::set-focus
This will change completely when GtkPopover becomes a
root. For now, stop using ::set-focus and just use the
focus-widget property.
2019-03-16 21:24:44 -04:00
Matthias Clasen
9e231f6333 popover: Stop using ::hierarchy-changed
Use notify::root instead.
2019-02-23 09:43:57 -05:00
Benjamin Otte
01f7f255b5 gtk: Check return value of compute_bounds()
Half of these calls will completely break if anybody ever uses CSS
transforms with them, but hey...
2019-02-20 05:26:31 +01:00
Mohammed Sadiq
d11bc68b27 gtkpopover: Fix popover when parent widget is partially visible
fixes https://gitlab.gnome.org/GNOME/gtk/issues/750
2019-01-09 17:12:23 +05:30
Timm Bäder
f598836d6c popover: Don't recalculate position if unmapped 2018-11-29 08:50:18 +01:00
Timm Bäder
2bd02d9185 popover: Get rid of a gtk_widget_get_allocation call
Use _compute_bounds instead.
2018-11-29 08:50:18 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Daniel Boles
31b8e0f109 Popover: Minimally document the ::closed signal
This is better than nothing at all. The wording is taken from Carlos's
commit message when he added this shortly before 3.12 (but skip Since).
Skip the bit from his commit message explaining what this replaced; we
don't need to say all the less good things our convenience API replaces.
2018-11-07 20:33:15 +00:00
Matthias Clasen
443f8ddf6b popover: Drop some dead code
This will be done differently, using xdg-popup instead
of subsurfaces, so no point in keeping this.
2018-07-15 08:18:08 -04:00
Carlos Garnacho
a5414bc404 gtkpopover: Fix key navigation
This has been broken since we switched key event delivery to follow
the same semantics than pointer/touch. There, GTK+ grabs will influence
the topmost widget during event delivery, rendering the toplevel
unable to handle key navigation. The toplevel must handle those key
events in an explicit manner then.

We don't render the keyboard focus rectangle yet, but I assume that's
something else.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
1d97b5fd3c gtkpopover: Port to GtkEventController/GtkGesture
Use GtkEventControllerKey and GtkGestureMultiPress to replace key/button
event handling.
2018-06-21 12:50:57 +02:00
Timm Bäder
5c24bbf00c popover: Add missing close paren in docs 2018-06-04 21:58:44 +02:00
Carlos Garnacho
694d9aa9f9 gtkpopover: Fix thinko in key press event type check
That code branch is meant to check for key events, seems obvious we want
GDK_KEY_PRESS, not GDK_BUTTON_PRESS (which also broke the branch right
below).

Makes us all able to dismiss popovers again.
2018-05-29 14:05:14 +02:00
Carlos Garnacho
317abed78e Revert "popover: Fix setting priv->button_pressed in ::event handler"
This reverts commit d638ff3afa.

Doesn't look like the right fix. Another one coming that fixes dismissing
through both pointer and keyboard.
2018-05-29 14:03:27 +02:00
Timm Bäder
d638ff3afa popover: Fix setting priv->button_pressed in ::event handler
There were two cases in that if/else cascade handling the
event_type == GDK_BUTTON_PRESS case, so priv->button_pressed never got
set.
2018-05-27 17:51:51 +02:00
Matthias Clasen
824bbf3117 popover: Drop key_press_event handler
We can do the same in the generic ::event handler.
2018-05-19 23:20:53 -04:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +02:00
Benjamin Otte
5abc4749de gtk: Chain up in toplevels' realize
Don't call set_realized() manually.
2018-04-11 03:16:34 +02:00
Timm Bäder
d49d391fcd popover: Use gtk_widget_compute_bounds
Instead of the private get_own_allocation
2018-04-10 09:43:47 +02:00
Benjamin Otte
0afdd84a2a css: Clipping changes don't need a queue_allocate() anymore
Now that queue_draw() isn't restricted to clip anymore, we don't need to
care about clip in the CSS engine either.

We do keep GTK_CSS_AFFECTS_CLIP around though because GtkWindow does
care for the window's size.
2018-04-09 20:20:55 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Timm Bäder
b2f04be04c popover: Remove priv pointer 2018-03-30 23:15:04 +02:00
Alexander Larsson
39851fbdbf Continue renaming window to surface
This renames a lot of arguments, local variables and functions.
2018-03-21 11:49:14 +01:00
Benjamin Otte
0ce19eed08 gdk: Remove gdk_surface_shape_combine_region()
If you want transparent region, you can just render them transparent.
If you want input shaping, use gdk_surface_input_shape_combine_region().

Also remove gtk_widget_shape_combine_region().
2018-03-21 04:10:07 +01:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Timm Bäder
24e708a770 popover: Remove an unneeded local variable 2018-03-17 12:09:30 +01:00
Benjamin Otte
3bb95a09bb a11y: Remove gtk.h include from container accessible 2018-02-09 00:42:38 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
fcaa9aa22d Rename GtkActionMuxer's private header
Follow the naming policy for private headers.
2018-02-02 10:28:17 +01:00
Matthias Clasen
fb2df00f15 popover: Stop using ::button-press/release-event
Just use a generic ::event handler.
2018-01-16 14:14:10 -05:00
Matthias Clasen
e3e00a2673 popover: Stop using ::focus-in/out-event
We can use the is-active property of the window instead.
2018-01-16 14:14:10 -05:00
Timm Bäder
93df23d962 Remove some more gtk_widget_get_content_size uses 2017-12-04 12:42:52 +01:00
Timm Bäder
dbc4796d6a popover: Stop using gtk_widget_get_content_size 2017-12-03 22:05:15 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
ed1b6a9bed gdkwindow: Remove event_mask arguments from constructors 2017-11-13 23:41:38 +01: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
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
5785db64ce popover: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Matthias Clasen
af5d3e3299 popover: Fix a warning
We were unintentionally disconnecting an already-disconnected
signal handler in some cases. Don't do that, it causes warnings.
2017-09-06 08:04:33 -04:00