Move the gtk_css_gadget_allocate call before the
gtk_label_update_layout_width call. This fixes the
statusbar label in widget-factory page 2 coming
up fully ellipsized.
Transient nodes should not propagate style-changed signals
that can cause widgets to get reallocated. This was causing
treeviews and iconviews with pixbuf cells to be constantly
resized and redrawn.
Clearing the icon doesn't appear to be necessary with
todays code, and it has the unfortunate side-effect of
temoorarily hiding the icon's window, which breaks grabs
and makes us miss the button release event when the icon
is changed from a button press handler.
We're going to add back the original struct definition removed by
a6e4de28, because using the typedef breaks all sorts of things like
gtkmm and WebKit, and having separate struct definitions allows us to
change the types in GdkBorder from gint16s to gints without breaking
ABI.
Empty boxes end up setting the clip to { 0, 0, 0, 0}, so warning
for a width or height of 0 triggers false positives. Instead,
initialize the clip to clearly invalid values.
As part of this conversion, remove the hardcoded padding around
the label.
Unfortunately, we cannot use the main gadget for drawing the frame
decoration, since we want to draw a custom border instead of the
stock css border that gadgets insist on drawing for us. Therefore,
add an extra gadget with name border and use it just for rendering
the frame.
Otherwise the gtk_grab_remove() calls on widget destruction will happen
on the default window group, which may leave the real window group
of the popover with a dangling pointer if it is not the default one.
This could be seen on the inspector, open a popover in the properties
list and close the window with alt-F4.
Invisible nodes don't change the first/last-child status of the nodes
after/before them. That means we don't have to just check the state of
the adjacent node when modifying this state, but all their siblings
until we hit a visible node.
The same way, a node is not the first child if it has no previous
sibling, it is the first child if it has no previous visible sibling.
This is important for caching in the global lookup cache.
CSS min-width and min-height on the slider node fit this
perfectly. We still fall back to the slider-width and
slider-height style properties if the CSS properties are
not set.
When doing a gtk_widget_show_all() on the shortcuts window,
accelerators for both RTL and LTR directions are being shown.
Make sure that no-show-all is set by default on hidden shortcuts, and
updated if the widget direction changes.
https://bugzilla.gnome.org/show_bug.cgi?id=759541
This was causing problems in the case when only one of the paned
children is visible - we would use uninitialized memory, leading
to invalide clip regions. Concretely, the signal tab in the inspector
would sometimes not render at all.
Make min-width/height have preference over the set default size. This
allows shrinking the widget. The default size is only used if min-width
is not set (or explicitly set to 0.
Drop the margin misuse and use the border allocation of the
handle gadget. We use negative margins to make the border allocation
larger without pushing the paned children out.
Size of the progress element now grows also when it's close to 0 size.
Previously the size was clamped to the minimum size, now it starts
growing from the minimum size.
So for a 100px trough with a 10px min size progress, the sizes of the
progress element change like this:
old new
0% 10 10
5% 10 14
10% 10 19
20% 20 28
50% 50 55
100% 100 100
We were not supporting plural form of the available space, which
is a problem in some languages.
However in this case is kind of a difficult matter, since we use a
formatted string from glib with g_format_size.
To fix it, use the same behavior as g_format_size to decide when
it should be used a plural form or not.
https://bugzilla.gnome.org/show_bug.cgi?id=759491
gtk_css_node_insert_before/after can easily create cycles
which later lead to stack overflows. Even if we're not
catching all cycles here, at least we can detect obviously
invalid arguments, such as inserting a node next to itself.
This was already mostly done by inheritance from GtkCheckButton.
To complete it, stop using the draw_indicator vfunc for radio
buttons, and instead make the indicator gadget draw either a
check or radio.
Use a gadget for the button, and for the indicator.
A complication here is that GtkCheckButton (and
GtkRadioButton) have a totally different appearance
depending on the ::draw-indicator property. If an
indicator is not required, we just reuse the
GtkButton gadget.
This mostly works; some minor sizing issues left, e.g. cranking
up the indicator-size causes the checkbutton grid in testgtk
to overlap.
This removes some hairy code handling with borders and padding,
which may or may not be correct. The examples in testheightforwidth
all continue to work, and min-width now works for labels.
This gives us min-width/height support. Currently, the spinner
still has a hardcoded minimum size of 16 and doesn't grow beyond
32. We may want to revisit that at some point.
When things change in the iconhelper, queue a resize on the owner widget
so that it automatically resizes.
Only do this for iconhelpers that are used as gadgets though, not for
temporary helpers - and to check this, check if the node is transient.
A gadget is halfway between a widget and a CSS node. It's supposed to
provide the minimum convenicence around CSS nodes until we've figured
out how to integrate them with widgets.
Constructing GtkCssStyleChange objects without styles is forbidden, so
don't do it. Instead untangle the callback from the actual update
function and call that untangled function directly.
When we reuse styles that didn't change across changes to the source
CSS, make sure we clear the caches. Otherwise child nodes will pick up
styles from the old source CSS.
Remove some now unused includes and dead code, and rename
gtk_drag_set_icon_window to gtk_drag_set_icon_widget_internal,
since it is no longer restricted to toplevel windows.
Under Wayland, the compositor does it, so there is no need
for us to move the window ourselves. For X11, we are now
doing the animation from the X11 backend. Trigger that by
calling gdk_drag_drop_done().
What changes here is that we have to keep the icon_window
alive for as long as the drag context exists. Use a weak
reference to do so.
In commit 2c61316677 we avoided emitting
the style-changed signal if no CSS property changed.
Unfortunately, this also caused CSS styles to not be updated when
animations started if those animations did not change any CSS value
immediately. In those cases the animation would just never start.
The obvious example was the spinner.
Catch the case where a CSS style did not change and don't emit the
style-changed signal in that case.
This saves not only the emission of the signal, but also doesn't cause
invalidation in child nodes, which would previously get a PARENT_STYLE
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.
This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
We were only storing the dialog size on unmap, but resetting to the
stored default value more often, e.g. on focus-out. This was causing
the dialog to 'jump back' to its remembered size after the user
manually resized it, leading to frustration and bug reports.
Instead, save the dialog size on every ::size-allocate of the toplevel.
To avoid needlessly spamming dconf, only write the new value if it
changed.
...in the process simplified the touch-selection styling, check
and radios not fixed there since I'm going to add proper osd assets
for those (istead of forcing the dark variant assets there as before).
The name gtk_text_*_begins_* was used only for begins_tag(). All other
similar functions use "starts": starts_line(), starts_word(), etc.
So for consistency, add gtk_text_iter_starts_tag() and deprecate
gtk_text_iter_begins_tag().
Also change (allow-none) to (nullable), to use the new annotation.
https://bugzilla.gnome.org/show_bug.cgi?id=759092
Otherwise rounding errors fool the "tab under coordinates" checks on
crossing events, which will be triggered close enough to the window
rectangle if the pointer moves slowly enough.
With this, the tab_prelight() function correctly figures out we've
moved the pointer outside the tab area when called in
gtk_notebook_leave_notify().
https://bugzilla.gnome.org/show_bug.cgi?id=759091
After removal of the selectable header and separator from the combo box,
the method to update the menu sensitivity must be changed as it assumes
at least two items within each sub menu and contains special handling
for the separator. Removing this fixes bug #759079.
Since we're no longer doing geometry widgets, don't send
base size and increments to the window manager anymore either.
This avoids an ugly 2 pixel gap to the right and bottom of half-tiled
terminals under gnome-shell.
We were getting the "New Accelerator" text mixed with the
content of the underlying cell, since plain labels don't
have a background. Go back to putting the label in selected
state, and fix the theme to render that white-on-blue. This
was lost when we switched to using a selection sub-node.
Showing two lists in a paned was a bit awkward, and space was
getting too limited. Go back to showing just the node list at
first, and make the CSS properties available via a stack. At
the same time, add a right-click context menu to the node list
to make the name and class editing more easily available.
The gesture functionality was taken over by GtkShortcutsShortcut,
so this widget is no longer needed, and it never was in a stable
release, so lets get rid of it.
GtkFontChooserWidget is using a GThemedIcon in its template,
so we need to ensure that the type is registered before
loading it. This was causing the defaultvalue test to fail.
The subscript was affecting the vertical alignment too much,
so tweak the rendering of the L/R markers to avoid that. Also,
mark these as translatable.
Instead of creating an icon source, making sure no state is set and
therefore the icon-effect will be applied and then rendering that icon
source, just call the icon-effect apply function.
Also, the new way isn't deprecated.
Applying the client-side decorations in the configure routine greatly
increases the chances of having the right size for the GtkHEaderBar and
border shadows.
Yet, it may be possible that these sizes change at a later point in
time, if for example the GtkHeaderBar grows in height while adding new
controls.
Mention this possible pitfall in the documentation for
gtk_window_resize().
https://bugzilla.gnome.org/show_bug.cgi?id=756618
The entry code passes GTK_DEST_DEFAULT_HIGHLIGHT when setting
up the drop target, but that is ineffective because of the
custom drag_motion implementation. Instead, call
gtk_drag_[un]hightlight ourselves.
This borrows heavily from the CSS4 fonts draft's font-palette, currently
found at https://drafts.csswg.org/css-fonts-4/#font-palette-control
The palette is mainly meant to trigger invalidations when colors used for
symbolic icons change, to potentially allow extending supported colors
in symbolic icons and to recolor all colors of a symbolic icon, not just
the main one.
The syntax for the property goes like this:
Name: -gtk-icon-palette
Value: default | name <color> [ , name <color> ]*
Initial: default
Applies to: all elements with icons
Inherited: yes
Animatable: yes, each color animated separately
The property defines a list of named colors to be used when looking up
icons. If a name is not defined, the value of the current "color"
property is used. Which names are relevant depends on the icons in use.
Currently symbolic icons make use of the names "success", "warning" and
"error".
"default" is the current behavior of the GTK when coloring symbolic
icons and is equal to the string
success @success_color, warning @warning_color, error @error_color
Animation is crudely implemented by animating colors that are in both
palettes that are animated and otherwise keeping the color from the
palette that defined it. Note that this can cause a sharp cut at the
beginning or end of the animation when the color goes away and will
therefore be replaced with the color property.
You can see an example of animations at
http://gfycat.com/CautiousPeacefulIaerismetalmark
When we start a drag cancel animation, we can just keep the existing
window. The reset was only necessary to convert from cursor icon to
window and we removed the cursor handling.
Just like we did for the default size, that reduces the chances of
having the headerbar missing or wrongly sized when computing the client
side decorations controls.
https://bugzilla.gnome.org/show_bug.cgi?id=756618
The Wayland dnd surface must remain in place until the drag
is over. Setting it directly as the hardcoded window of the
widget we construct carries the danger that it might get
destroyed prematurely, e.g. when the application calls
gtk_drag_set_icon_name more than once and we recreate the
widget.
Instead, create a dedicated toplevel, and reparent the widget
into it. To keep the code simple, we use the same approach
under X11 as well, and make it the responsibility of the
GDK dnd code to keep the window position updated. We already
pass the current pointer position to gdk_drag_motion, which
makes this very easy.
As a side-effect of these changes, it is now possible to use
non-toplevel widgets as drag icons.
https://bugzilla.gnome.org/show_bug.cgi?id=748763
If that sounds confusing, it's because GTK and CSS can sometimes not
agree on naming.
:active for CSS means that a button is currently pressed on an element.
And that is clearly not the case for spinning spinners.
This removes the dependency on state, which should be used for selection
CSS styles, not for actually applying them.
And image-effect does exactly what we want already, so we can start
using it.
The size of icons is a property that is relevant to who is rendering the
icon, not to the icon itself.
Example: Starting a DND operation from an entry icon should cause the
icon to resize (from the entr icon's size to the DND icon size).
Make gtk_icon_helper_ensure_surface() a private function that just
ensures the surface was loaded.
Add gtk_icon_helper_load_surface() that is called by the above function
and the dnd code to actually load the surface.
Just do the invalidation check once, there's no need to do it in every
branch of the switch.
Also remove useless checks: These functions will not be called if we
already have a rendered surface.
Just do the invalidation check once, there's no need to do it in every
branch of the switch.
Also remove useless checks: These functions will not be called if we
already have a rendered surface.
It seems this branch is not needed anymore. It was originally added in
1999 to support gtk_widget_realize(), but all those reasons seem
obsolete today.
Instead just call gtk_widget_realize().
If you end up at this commit when bisecting:
There is no bug that made me remove this code, it was purely meant to be
cleanup / dead code removal. I seem to have introduced a new bug or
bisecting wouldn't have let you here. So it seems we should just revert
this commit.
Under X11, popovers are always constrained to the toplevel
window. Under Wayland, they aren't. This commit adds a
property that allows to explicitly constrain popovers to
the toplevel, giving them the same behavior under Wayland
as under X11.
https://bugzilla.gnome.org/show_bug.cgi?id=757474
Widgets such as gtkfilechooser may be saving their size and position on
the unmap callback, if the client-side decoration header bar is removed
first, the reported size will be wrong.
https://bugzilla.gnome.org/show_bug.cgi?id=756618
'win.lines' contains the same content as the GtkTextBuffer, so to find
@match_start, forward_chars_with_skipping() is called with
skip_decomp=FALSE (the last parameter). So far so good.
On the other hand, the content 'lines' (the needle split in lines) is
casefolded and normalized for a case insensitive search. So,
forward_chars_with_skipping(..., skip_decomp=TRUE) must be called only
for the portion of text containing the needle.
Since 'start_tmp' contains the location at the start of the match, we
can simply begin at that location to find the end of the match.
Unit tests are added.
https://bugzilla.gnome.org/show_bug.cgi?id=758698
Doing things the other way around seems to cause problems in
some cases where children want to do different things depending
on the window position.
https://bugzilla.gnome.org/show_bug.cgi?id=758563
Instead of just listing the return type of get_plus_button() and
get_minus_button() in the documentation, we can use the (type)
annotation to ensure that the introspection data reflects the actual
type of the returned widget.
Fix a regression introduced by:
commit 6866d1c widget: Make gtk_widget_queue_allocate() not resize
Where the dropdown menu in Firefox would not be relocated after the
toplevel window is moved.
bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=758609
Just like it happens for window dragging, we're likely to not see the
matching button release for this event, so we must reset the controller
manually here.
https://bugzilla.gnome.org/show_bug.cgi?id=758661
Before calling gdk_window_move_resize(), store the full configure
request, not just width and height.
Fixes firefox randomly losing position of its dropdown windows.
https://bugzilla.gnome.org/show_bug.cgi?id=758609
tracker:uri-is-descendant/parent has the unfortunate side effect of
rendering the collation mechanisms in the database useless, so those
require full table scans to be validated.
Performing these as pure string comparisons will perform much better,
as those allow the underlying sqlite to rely on its own collation
to perform the search, which can be significantly faster with many
elements in the database.
https://bugzilla.gnome.org/show_bug.cgi?id=758407
It turns out that it is nicer in glade to have just a single
widget that can show either a shortcut or a gesture, so make
GtkShortcutsShortcut do it both.
GtkShortcutsGesture is now redundant and will be removed before
the next stable release.
The current code in gtkshortcutswindow.c is good enough to
construct a widget once from a .ui file, but fails to handle
changes at runtime, as happen e.g. in glade. Fix this by
listening for changes to section-name and title.
Empty underlines are hard to make out. Since we get somewhat
unreliable section information from the CSS parser, we just
make sure that we always underline at least one character.