Commit Graph

1872 Commits

Author SHA1 Message Date
Timm Bäder
16689a1e81 widget: Fix a few typos in cursor documentation 2018-03-17 12:09:30 +01:00
Benjamin Otte
a8608618a9 dragsource: Replace gtk_drag_source_set_icon_surface()
... with gtk_drag_source_set_icon_paintable().
2018-03-16 06:04:45 +01:00
Timm Bäder
d4c9a35193 widget: Simplify setting a default direction
No reason for the second paramter to be a pointer.
2018-03-13 23:43:29 +01:00
Emmanuele Bassi
73ffb7f5e9 Initialise variables
The dx and dy variables may be left uninitialized by the coordinate
translation — or so the C compiler thinks. Let's avoid a warning when
building.
2018-03-13 16:00:55 +00:00
Matthias Clasen
d55da3fd44 Use GtkSnapshot getters
We can avoid direct struct access and gtksnapshotprivate.h
everywhere.
2018-03-11 00:31:44 -05:00
Matthias Clasen
694f1d8ecd Stop using stack-allocated snapshots
Use the new/free api instead of init/finish
for GtkSnapshot.
2018-03-11 00:31:44 -05:00
Timm Bäder
38fa5ab57b widget: Add a translate_coordinates version for doubles
So we can use that one when translating event coordinates. Also adapt
the widgetfocus demo to ensure this works.

We should probably at some point delete either the int or the double
version.
2018-03-07 20:17:39 +01:00
Timm Bäder
a9cd2d8181 widget: Simplify set_style_context
No need to use widget->priv later if we already define a priv pointer
before.
2018-02-26 08:42:38 +01:00
Timm Bäder
7d7045bc35 widget: Remove some unneeded prototypes 2018-02-25 16:47:20 +01:00
Timm Bäder
4e23daa998 widget: Don't export propagate_hierarchy_changed 2018-02-23 22:14:38 +01:00
Timm Bäder
eb66d6bcc6 widget: Simplify _set_name
No need for a new_name local variable here.
2018-02-23 22:08:45 +01:00
Timm Bäder
8720b2d8c5 widget: Correct translate_coordinate documentation
We write 0 to dest_x and dest_y nowadays if the two widgets do not have
a common ancestor.
2018-02-23 21:57:49 +01:00
Timm Bäder
94093fd18e widget: Improve warning for negative size_allocate dimensions
Print widget class, css node name and address.
2018-02-23 10:47:19 +01:00
Benjamin Otte
f08bc40fbb a11y: Don't include gtk.h
Also add missing includes and sort them for all the widgets that relied
on that before.
2018-02-08 15:25:53 +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
Matthias Clasen
3c45a56934 Drop gtk_widget_show_now
This function does bad things, and is not an
API that we want to take into GTK+ 4.
2018-02-04 23:23:15 +01:00
Timm Bäder
98e30f82b9 widget: Remove realized checks from _translate_coordinates
As discussed.
2018-02-03 12:22:56 +01:00
Timm Bäder
8f7a8ada18 widget: Don't call snapshot vfunc if width or height are 0
The result won't be visible anyway. This also prevents problems with
widgets that create some resource the size of the widget, like
GtkGLArea. It also keeps us from snapshotting revealers with
size 0.
2018-02-03 12:22:52 +01:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Daniel Boles
b91fc17a19 Widget: Don’t call reset() on NULL EventController
GtkGesture is a GtkEventController. gtk_event_controller_dispose() calls
_gtk_widget_remove_controller(). That NULLs the pointer-to-Controller in
our EventControllerData but does not delete said ECData from our GList.

Subsequently, if that same Widget gets unparent()ed, that method calls
unset_state_flags(), which leads to doing reset_controllers() if we are
insensitive. Now, unlike most most other loops over the GList of ECData,
reset_controllers() does not skip nodes whose pointer-to-Controller is
NULL. So, we call gtk_event_controller_reset(NULL) and get a CRITICAL.

This surfaced in a gtkmm program. The Gesture is destroyed before the
Widget. The Widget then gets dispose()d, which calls unparent()… boom.
I didn’t find an MCVE yet but would hope this logic is correct anyway:

The simplest fix is to make the loop in gtk_widget_reset_controllers()
skip GList nodes with a NULL Controller pointer, like most other such
loops, so we avoid passing the NULL to gtk_event_controller_reset().

In other, live cases, _gtk_widget_run_controllers() loops over the GList
and removes/frees nodes having NULL Controllers, so that should suffice.
But this clearly was not getting a chance to happen in the failing case.

https://bugzilla.gnome.org/show_bug.cgi?id=792624
2018-01-22 19:10:58 +00:00
Timm Bäder
fbd79d8fea widget: Only initialize bounds rect if necessary
We only use the graphene_rect_t version of the offset_clip for the
fallback cairo nodes.
2018-01-21 20:37:46 +01:00
Timm Bäder
8224e7ac72 inspector: Allow picking insensitive widgets
The default gtk_widget_contains/gtk_widget_pick don't consider
insensitive widgets.
2018-01-19 10:16:15 +01:00
Timm Bäder
aee4634ee5 widget: Always assign values to out parameter in translate_coordinates
safe guard against people using the returned coordinate values without
checking the return value of gtk_widget_translate_coordinates.
2018-01-18 14:45:13 +01:00
Timm Bäder
cc9a4c1720 widget: Initialize a local variable
We will later pass this variable on to some other functions, so be safe
against them using the value.
2018-01-18 14:45:13 +01:00
Timm Bäder
8ad1b09a3a widget: Clip redrawn area to widget clip
The clip can already be modified in size_allocate, so we never want a
widget to invalidate more than its actual clip region.
2018-01-17 21:57:19 +01:00
Timm Bäder
229ef9d776 widget: Remove reparent special case
Since gtk_widget_reparent doesn't exist anymore, we can also remove this
special case.
2018-01-17 21:57:19 +01:00
Matthias Clasen
e0990b2311 Drop ::button-press/release event
We are no longer using these, and there are several gestures
that can be used instead. If you need to catch raw button events,
use the ::event signal.
2018-01-16 14:14:11 -05:00
Matthias Clasen
64c3db931d Drop ::motion-notify-event
We no longer emit this signal. You can use various gestures
and event controllers instead. If you need to catch raw
motion events, use the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
9ba5f053d9 Drop ::focus-in/out-event
These signals are no longer used in GTK+.
If you need to catch focus events, use the ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
5759bc59c9 Drop gtk_widget_hide_on_delete
This function is misnamed - it is only ever relevant for
windows. And with the ::hide-on-delete property , it is
no longer necessary to use the signal for this simple case.
2018-01-16 14:14:10 -05:00
Matthias Clasen
2b59917a9d Drop ::event-after
This signal is not used in GTK+, and we are reducing the
amount of widget signals devoted to events in favor of
event controllers.
2018-01-16 14:14:10 -05:00
Matthias Clasen
1c2e09116a Drop ::grab-broken-event
This signal is no longer used in GTK+. Grab broken events
can be handled with the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
f594807c0a Drop ::enter/leave-notify-event
These signals are no longer used in GTK+ and have a (not quite
perfect yet) replacement with GtkEventControllerMotion.

If you need to catch the raw events, the generic ::event
signal still works.
2018-01-16 14:14:10 -05:00
Matthias Clasen
a9d468a4c8 Drop ::configure-event
This signal is unused in GTK+ and configure events are handled
internally by GtkWindow.

If you need to catch configure events, the generic ::event
signal still works.
2018-01-16 14:14:10 -05:00
Matthias Clasen
fa885f437c Drop ::touch-event
This signal is not used in GTK+, and has a suitable
replacement with GtkGesture and its subclasses.

If you need to catch the raw touch events, the generic ::event
signal still works, too.
2018-01-16 14:14:10 -05:00
Matthias Clasen
47712a826b Drop ::scroll-event
This signal is not used in GTK+, and has a suitable
replacement with GtkEventControllerScroll.

If you need to catch these events, the generic ::event
signal still works, too.
2018-01-16 14:14:10 -05:00
Matthias Clasen
e93c2517e6 Drop ::proximity-in-event and ::proximity-out-event
These are unused in GTK+, and are not very common.
If you need to catch these events, the generic ::event
signal still works.
2018-01-16 14:14:09 -05:00
Matthias Clasen
fd2a3b602f Drop ::map-event and ::unmap-event
These are unused in GTK+, and are not very common.
If you need to catch these events, the generic ::event
signal still works.
2018-01-16 14:14:09 -05:00
Matthias Clasen
1e0ae936fe widget: Stop using ::map-event
Use ::event here, since we want to drop the event-specific
signals.
2018-01-16 14:14:09 -05:00
Matthias Clasen
7b581ca096 Drop GtkWidget::destroy-event
This signal is unused in GTK+, and is documented as
'hard to ever get', so there's no good reason for
keeping it.
2018-01-16 14:14:09 -05:00
Matthias Clasen
2b52b4be5d Drop GtkWidget::delete-event
Nobody is using this signal anymore, and ::delete is there
for the few places where it is needed.
2018-01-16 14:14:09 -05:00
Matthias Clasen
c3215de005 gtk Use per-renderer flags for node names
We are moving to per-renderer flags, so lets check them here.
2018-01-14 17:05:04 -05:00
Matthias Clasen
af7f695068 Make geometry logging per-display
Use the new macro to do this.
2018-01-14 17:05:04 -05:00
Timm Bäder
1a8b9e9180 widget: Refine docs a bit 2018-01-10 08:46:22 +01:00
Timm Bäder
16cf4637e9 widget: Fix css padding debug drawing 2018-01-08 17:44:37 +01:00
Timm Bäder
85fa396176 widget: Avoid casting event coordinates to int in contains() 2018-01-04 21:41:35 +01:00
Timm Bäder
a89e88fc3e widget: Ignore non-gestures in _gtk_widget_consumes_motion
priv->event_controllers is a list of all event controllers, which aren't
all GtkGesture subclasses.
2018-01-04 13:15:15 +01:00
Matthias Clasen
fb51e438e9 Implement font-variation-settings
This is a CSS font level 4 property that lets us
use font variation settings from css.
2018-01-03 13:07:55 -05:00
Timm Bäder
614bcefa21 widget: Make all code snippets compile 2018-01-03 17:11:32 +01:00
Timm Bäder
cba24360b1 Move geometry management docs do GtkWidget
Both GtkWidget and GtkContainer had similar docs regarding hfw/wfh
geometry management. Move these just to GtkWidget. Also make sure the
examples compile, port everything from gtk_preferred_* to measure and
replace some occurrences of "container" with "widget" where container
was just used to refer to a widget with child widgets.
2018-01-03 17:11:32 +01:00