Commit Graph

31451 Commits

Author SHA1 Message Date
Matthias Clasen
45fb1d06e3 entry: Delegate to GtkText
Use a GtkText child, and delegate the editable functionality
to it. Also forward all the properties that are provided by
GtkText.

Some of the more internal APIs, such as layout and im context
access and caps-lock warning, are removed here, but we preserve
most of the plain GtkEntry API by forwarding it to the GtkText
child.
2019-02-19 00:25:59 -05:00
Matthias Clasen
936181f354 Add a GtkTextAccessible
Add an accessible implementation for GtkText.
2019-02-18 14:24:21 -05:00
Matthias Clasen
fcb58887fa Make emoji completion work for GtkText
GtkEntry will stop using it directly in the following commits.
2019-02-18 14:24:21 -05:00
Matthias Clasen
1801bf6d83 Add a GtkText widget
This is a GtkEntry without any of the extras, such as
icons, completion, progress, caps-lock warning, emoji icon.
2019-02-18 14:24:21 -05:00
Matthias Clasen
b9c8dd64b3 spin button: Implement and use editable interface 2019-02-17 23:07:18 -05:00
Matthias Clasen
32795963c0 entry: Implement new editable iface 2019-02-17 23:07:18 -05:00
Matthias Clasen
7325f8e204 editable: Add more to interface
Add all the things to the GtkEditable interface that
make sense for most implementations.
2019-02-17 23:07:17 -05:00
Timm Bäder
c9d9f8b750 flowbox: Implement get_child_at_pos properly
With transforms in the mix, checking if the coordinate is inside the
widget "allocation" makes even less sense. Just use gtk_widget_pick()
and walk up until we find a GtkFlowBoxChild.
2019-02-16 15:45:06 +01:00
Timm Bäder
ca2c05cdb3 widget: Push a transform node if we need to
This is the same as the old code since the transformation only contains
teh offset right now, but it will be different later where arbitrary
transformations are possible per widget.
2019-02-16 15:44:46 +01:00
Timm Bäder
10e5856583 widget: Save transform as matrix
The transform matrix is a translation matrix from the parent's origin to
the widget origin. We will later allow more transformations than just
translations.
2019-02-16 15:44:37 +01:00
Timm Bäder
0739399766 paned: Implement increased handle area using pick()
Otherwise, we do report the widgets below the invisible handle area as
hovered or active.
2019-02-16 11:19:29 +01:00
Matthias Clasen
bea1a02edd Merge branch 'wip/otte/boxes' into 'master'
GtkCssBoxes

See merge request GNOME/gtk!584
2019-02-15 16:12:26 +00:00
Matthias Clasen
74d6d81db9 Merge branch 'assistant-cleanup' into 'master'
Assistant cleanup

See merge request GNOME/gtk!581
2019-02-15 15:54:53 +00:00
Matthias Clasen
e5e2bd3187 Drop GtkAssistantPage::has-padding
This is causing us some internal complications, and
it is very easy to just add padding to the pages
yourself.
2019-02-15 10:23:48 -05:00
Matthias Clasen
d327d3fab2 assistant: Use a stack
We don't use any non-stack features of the notebook here.
2019-02-15 10:23:48 -05:00
Matthias Clasen
fb4f5e0a78 assistant: Add docs
Without this, introspection complains about a missing
transfer annotation.
2019-02-15 10:23:48 -05:00
Benjamin Otte
c44c44ee25 css: Pass boxes to the render functions
Instead of style + rect_of_one_box, pass the new GtkCssBoxes object.
This has the nice side effect that when drawing background + border +
outline, we only compute all the boxes we need once.
2019-02-15 06:53:22 +01:00
Benjamin Otte
7ad0f7fc52 css: Mark some hot functions as G_GNUC_PURE
By doing that, gcc will generate code that avoids calling these
functions when not needed.
2019-02-15 06:53:22 +01:00
Benjamin Otte
285aba6ece widget: Make width, height and transform be widget-relative
Previously, those numbers stored the values relative to the margin box
of the widget. Now they store values relative to the content box,
thereby getting rid of the last remains of weird coordinate systems.
2019-02-15 06:53:22 +01:00
Benjamin Otte
19ffb40b27 cssboxes: Introduce
Split out the code for computing CSS boxes from given variables from the
background render code. This way, it can be shared between different
codebases.

Also, make that code completely be contained of static inline functions.
That ensures that it can be 100% inlined in cases where only parts of
the rectangle are needed (like in gtk_widget_get_width() in the future).

This will require some more patches to actually work, but those will
follow.
2019-02-15 06:53:22 +01:00
Benjamin Otte
86978d2654 widget: Store the render node in the widget's coordinate system
Also require gtk_widget_snapshot() to be in the widget's coordinate
system.
2019-02-15 06:53:17 +01:00
Benjamin Otte
694d7c378b root: Move the renderer to the root 2019-02-15 06:53:17 +01:00
Benjamin Otte
446713fb8b root: Add gtk_root_get_surface_transform()
The function isn't used yet, so this is just infrastructure.
2019-02-15 06:53:17 +01:00
Benjamin Otte
2fbdd8b849 root: Add GtkRoot:get_display vfunc
And use it.
2019-02-15 06:53:17 +01:00
Benjamin Otte
ddf2a3681d widget: Add a GtkWidget::root property and gtk_widget_get_root()
The property is just for API completeness, the getter is meant to
replace toplevel usage.
2019-02-15 06:53:17 +01:00
Benjamin Otte
4ca1f7e29f widget: Add GtkWidgetClass:root and :unroot functions
They get added whenever a widget gets added into a hierarchy with a root
widget.
2019-02-15 06:53:17 +01:00
Benjamin Otte
aeda099f47 widget: Remove toplevel flag
Instead, rely on GTK_IS_ROOT().

Also implement GtkRoot on GtkWindow and GtkInvisible, the two widgets
that used to set the toplevel flag before.
2019-02-15 06:53:17 +01:00
Benjamin Otte
2e5bc9fbc3 gtk: Add the GtkRoot interface
So far, this doesn't do anything.
2019-02-15 06:53:17 +01:00
Benjamin Otte
d65a60e0bd widget: Move compuatation of what changed further up
This way, we can compare with literally the previous allocation and the
size will not be influenced by an adjusted allocation.

But more importantly, we can now use the transform/width/height values
for other stuff.
2019-02-15 06:53:17 +01:00
Benjamin Otte
d3a2218ff4 widget: Split up priv->allocation
It's not priv->transform (to be turned into a graphene matrix),
priv->width and priv->height.

The numbers are still the same.
The only difference is that unallocated widgets will now have x/y set to
0, not to -1.
2019-02-15 06:53:17 +01:00
Benjamin Otte
e0ec5caaf8 container: Drop gtk_container_check_resize()
Instead, hardcode GtkWindow for now.
The code for non-windows was entirely broken.
2019-02-15 06:53:17 +01:00
Benjamin Otte
2ba928e142 window: Properly detect if size allocation is needed
Instead of looking at the allocation, just look at the alloc_needed
widget flag that tracks if an allocation is needed.
2019-02-15 06:46:04 +01:00
Benjamin Otte
07722582ef simpleselection: Improve items-changed
Make items-changed never emit 2 signals, instead, always emit only one,
potentially by extending the range reported in items-changed.

And be a lot more exhaustive about autoselect tests.
2019-02-15 06:46:04 +01:00
Benjamin Otte
1f56f5c2e9 selectionmodel: Change prototype of query_range()
1. Do not make position an inout variable
The function is meant to return a range for a given position, not modify
a position. So it makes no conceptual sense to use an inout variable.
2. Pass the selected state as an out variable
Using a boolean return value - in particular in an interface full of
boolean return values - makes the return value intuitively feel like a
success/failure return. Using an out variable clarifies the usage.
3. Allow passing every position value
Define what happens when position >= list.n_items
4. Clarify the docs about how this function should behave
In particular, mention the case from point (3)
5. Add more tests
Again, (3) needs testing.
2019-02-15 06:28:35 +01:00
Benjamin Otte
cd37b872ca overlay: Remove hack for scrolled windows
It's not needed now that we don't use scrollbars or overlays inside
scrolled windows anymore.
2019-02-15 06:28:11 +01:00
Matthias Clasen
89d8ae0431 stack: Fix a crash
We need to remove the weak pointer, as the stack switcher can
keep the list model alive beyond the stack. This was observed
to cause crashes:

==16870== Invalid write of size 8
==16870==    at 0x5168A4E: g_nullify_pointer (gutils.c:2284)
==16870==    by 0x522C500: weak_refs_notify (gobject.c:2791)
==16870==    by 0x50FE7BC: g_data_set_internal (gdataset.c:407)
==16870==    by 0x50FECA7: g_datalist_id_set_data_full (gdataset.c:670)
==16870==    by 0x5227EB4: g_object_real_dispose (gobject.c:1056)
==16870==    by 0x522D295: g_object_unref (gobject.c:3309)
==16870==    by 0x4AF849F: unset_stack (gtkstackswitcher.c:428)
==16870==    by 0x4AF892E: gtk_stack_switcher_dispose (gtkstackswitcher.c:527)
2019-02-14 12:24:22 -05:00
Matthias Clasen
fb44491926 assistant: Add a pages property
This is mainly useful to make the page objects
accessible in the inspector.
2019-02-13 18:27:25 -05:00
Matthias Clasen
2866a13f30 inspector: Support list model properties
This is just a very quick hack for a property editor
that allows to drill down into list models.
2019-02-13 15:08:17 -05:00
Matthias Clasen
6ef775dbcb stack: Add a pages property
This makes the list model available in the inspector.
2019-02-13 14:14:54 -05:00
Matthias Clasen
927e983ff8 inspector: Make object property inspection work again
This was lost when porting to GtkListView.
2019-02-13 13:41:15 -05:00
Matthias Clasen
fbe0db4007 inspector: Add an api to activate an object
This will be used to make object property inspection
work again.

This will be used to make object property inspection
work againn
2019-02-13 13:40:40 -05:00
Matthias Clasen
8de8b8eebc inspector: Fix selecting objects with a next tab
This was causing criticals.
2019-02-13 13:04:00 -05:00
Matthias Clasen
82fdd483d2 Add a missing icon
The view-refresh-symbolic icon is used in the data list
of the inspector. So ship it in gtk. No need to have
it in the demos, then.
2019-02-13 12:49:31 -05:00
Matthias Clasen
8c0b70691b stack: Don't emit bad ::selection-changed signals
We have to be careful to not pass bad numbers to
this signal, which was happening in cases where
we have on old or new selected item.
2019-02-13 09:01:07 -05:00
Matthias Clasen
1750922631 stack: Fix a corner-case
When the stack goes empty, we were failing to reset
the visible_child member to NULL, causing problems later
on, since we don't have a ref for it.
2019-02-13 09:00:00 -05:00
Matthias Clasen
2dd85b826f stack: Don't leak a reference
The page holds a reference to the widget, so can't just clear
this pointer.
2019-02-13 08:42:58 -05:00
Matthias Clasen
c0c6c87781 stack: Avoid some ugly unrefs
Instead of using the list model api that forces us
to drop the ref, just work with the list we have.
2019-02-13 08:40:13 -05:00
Matthias Clasen
f4b26af255 selection model: Add sanity checks
It is easy to emit wrong ::selection-changed signals,
and then bad things will usually happen later. Add
some sanity checks to gtk_selection_model_selection_changed
to make this easier to track down.
2019-02-13 08:38:30 -05:00
Matthias Clasen
2bd93303c4 Merge branch 'included-icons' into 'master'
Included icons

See merge request GNOME/gtk!580
2019-02-13 03:33:16 +00:00
Matthias Clasen
16026b6898 page setup dialog: Use theme icons
We have non-gtk-specific icons in the icon theme for this
now, so drop the gtk-orientation icons and use the theme
ones instead.
2019-02-12 21:37:02 -05:00