The bitmasks with the 31st, 32nd and 63rd bit set are added. The make up
the largest bitmasks on 32bit/64bit that can be represented without
allocating and the smallest bitmask on 32bit that must be allocated.
With the fix in 77912a65e2, another bug
got visible: booleans are 32 bits, so if the intersection between the 2
bitmasks happened in higher bits, the return value would be truncated to
FALSE.
This actually made slider handles disappear, so it was pretty visible.
If lookup->missing is empty we don't need to continue looking.
We short circuit in several places as this can happen
after iteratively makeign lookup->missing smaller.
We need to use the allocated codepath if *any* argument is
allocated, not if one arg is not allocated.
This bug caused unnecessary calls to _gtk_bitmask_is_allocated,
as well as return completely wrong result if both bitmask are
allocated.
What is this bin doing with all these crazy deltas? Company does:
<Company> that can safely be removed
<Company> in general, code that isn't obvious can either be understood
<Company> with a bit of thinking or it can be removed
<Company> if in doubt, go for the 2nd of those :)
Most GtkBin subclasses override this strange garbage anyway, so it's
not like this code is ever *run*, per se. Just make it proxy directly
to the child, and hope nothing goes wrong.
Implement get_preferred_width, get_preferred_height, and size_allocate.
This allows GtkBin subclasses to be quick and easy, without the
author doing the subclassing to have to do much work.
If the "wider" label is the smaller one, use the wider size for both
cases. This can happen when ellipsizing a single character, which is
often smaller than the ellipsizing glpyph(s).
Functions should not have a space before the opening parenthesis. So
change output like
alpha (@color, 0.5)
to
alpha(@color, 0.5)
and do the same for "shade" and "mix".
Tests have been updated accordingly.
With ellipsizing, the ellipsized text can have a smaller height than the
non-ellipsized text. So the wider text is also higher. Example:
.<big>TEXT</big>
will ellipsize to the small text.
Reported-By: Rico Tzschichholz <ricotz@t-online.de>
We must make sure to remove the weak pointer when disposing the widget
or when resetting the align widget otherwise glib will try to nullify
invalid memory.
This way we don't need a marker on GtkWidgetParivate that needs to be
unset later, so we have all our data in the same place and can avoid
problems with reentrancy and shenanigans like that.
But the main reason I wrote that is cleaner code.
With this function now available, we can do size computation in 2
ways:
(1) Compute size with size groups
(2) Compute size without size groups
And have (1) use (2) instead of setting flags on widgets. This patch
does exactly that.
With size groups now doing hfw, doing the optimization for CONSTANT_SIZE
was done too early. Size groups need to know that it's a hfw request, so
the other widgets in the size group get the correct behavior.
The label code assumed that Pango treats this as "wrap to as much space
as possible and then ellipsize all the lines", but for Pango, ellipsize
takes precedence over wrap. So do the same thing in GtkLabel.
Also updated is the reftest that checked this behavior.
We compute on-demand for size groups anyway, so we can (in theory, this
patch doesn't do that yet) get around costly cache blowing when
invalidating single widgets of a size group this way.
The current approach of using gtk_widget_get_mapped() is broken:
The usual steps taken when showing a window are:
(1) request the sizes
(2) allocate the sizes
(3) show the window in the allocated size
Showing the window with a random size between steps (1) and (2) would of
course
result in extra work and potential flickering when the widgets get
resized to
their proper sizes.
However, as GtkSizeGroup::ignore-hidden uses gtk_widget_get_mapped() to
determine visibility for a widget, the following will happen:
(1) the widget will request a 0 size
(2) the widget will be allocated a 0 size
(3) the widget will be too small when it is shown
gtk_widget_get_visible() however is set in advance. Note that toggling
visibility also causes a gtk-widget_queue_resize() call already so we
take care of changes in here automatically.
Instead of only checking the ignore_hidden flag when getting the
preferred sizes, respect it already when constructing the list of
widgets. This way, widgets don't queue resizes for groups they're
ignored in anyway.
For loops to loop over lists look nicer and actually do the right thing
with "break" and "continue" statements. So they are vastly preferred to
while loops.
This simplifies code and because sizes are cached by the widgets
themselves, it's not a large performance problem (unless people use huge
amounts of widgets in a single size group, but who does that?
The main problem is that we were emitting the row-deleted signal for the model in the middle
of the process that actually deletes the row from the model (remove the row from the array,
update the model->file_lookup hash table, etc.). In the model's caller, one of the row-deleted
callbacks was requesting an iter, which caused the model to revalidate itself - but it did
this while it was in an inconsistent state. This led to an assertion failure later when the
model resorted itself.
The fix in remove_file() is like this:
* The filteredness/visibility of the deleted node is not updated. The
node will simply be gone; we don't need to update those values at
all.
* We invalidate just the node that is being deleted.
* The model->file_lookup hash table is not completely nuked; instead,
we carefully adjust its indices.
* The row-deleted signal is only emitted at the very end, when
deletion is complete and the model is consistent.
Many thanks to William Hua for doing the detective work on this bug!
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
They were in the semi-public API of GtkFileSystemModel, but never actually used outside of it.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This is a function internal to the file system model; let's not pollute the gtk_tree_path namespace.
Also, make the 'i' variable into 'r' as it refers to a row index, not a file-array index (for
consistency with the docs and the rest of the code).
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Right now we support loading and recoloring symbolic GFileIcons, but
only if the underlying GFile has a local path. This breaks when the
GFileIcon is loaded from a GResource, which is a reasonable option for an
application that wants to ship a custom symbolic icon.
This patch changes GtkIconInfo to store a GFile together with the file
path, and changes the symbolic icon lookup code to use the GFile URI,
which transparently makes the code work also for GResources.
https://bugzilla.gnome.org/show_bug.cgi?id=687059
Move variable initialization outside the first code with side effects.
This allows adding some more early returns, including one for code that
used to trigger g_return_if_fail() in certain corner cases.
Old code tried to use the "background-image" proeprty for setting the
default image background. While this used to work in the early days of
GTK3, today it is grossly misleading as the backgronud image may be
resized, repositioned and semi-translucent which causes very weird
artifacts when rendering.
So we use the background-color only instead.
This way we create one provider per settings object instead of stuffing
it into a global unchanging never-deleting hash table.
Also, we now reload the theme when instructed instead of keeping the old
loaded (and possibly stale) data forever.
https://bugzilla.gnome.org/show_bug.cgi?id=683896
This makes sure the full theme loading logic resides in one function and
isn't scattered around.
As a side-effect, the hash table kept by gtk_css_provider_get_named()
will now be populated with fallback themes. This will not be a problem
after the next commit though.
Split maintaining the global themes hash table and the theme loading
code into two functions.
This also fixes leaking the provider when loading a theme from a builtin
resource.
Themes may want to render handles differently depending on whether
the widget is in selection mode (2 handles enclosing a selection) or
cursor mode (one handle pointing out the insertion cursor).
This improves both interaction and theming, as it allows
arbitrary handle shapes while just being draggable from
the visible areas.
This way themes can set up handles with the hotspot visually
displaced from the horizontal center, as long as the hotspot
lies centered in the image/svg asset.
The check on the handle to be drawn on the mask was based on the yet to
be set priv->windows pointers, pass explicitly the handle position to
have the shape correctly initialized on non-composited environments
The GtkNotebook drag-motion event handler may install a timeout when
hovering over a tab, in order to switch to it.
On the other hand it's desirable for applications to use the empty tab
area as a drop target, so the drag-motion handler returns FALSE
(also in case it installs the switch tab timeout), as explained in
https://bugzilla.gnome.org/show_bug.cgi?id=350665.
Unfortunately, applications can use the tab label widget (or a child
of it) as a different drop target area, and install their own
drag-motion handler there.
In this scenario, the timeout will still be installed by GtkNotebook's
handler, but since it returns FALSE, it will never get the matching
drag-leave event, causing it to trigger also when the mouse pointer
moved elsewhere before it expired.
Fix this by returning TRUE from drag-motion when the event is over a
tab. Note that this makes automatic tab switching not work anymore when
drag and drop is handled in the tab label widget; applications are
expected to also handle tab switching if desired in such a case.
https://bugzilla.gnome.org/show_bug.cgi?id=684415
GtkScrollbar used to rely on style-updated being emitted every time
after the widget was created in order to set the right values from its
style properties on GtkRange.
Nowadays we try to be smarter and avoid emitting style-updated at
creation time, so we need to manually initialize the GtkRange values.
This fixes a regression from 35e36b9fe5.
https://bugzilla.gnome.org/show_bug.cgi?id=686280
Currently we use gtk_style_context_set_background() when the state flags
change in order to propagate the background color to the overshoot
window, but this is actually only needed because the window doesn't get
expose events, since we always draw a full background in draw().
This also fixes some problems when the GdkWindow of the scrolled
window's child is composited, as seen in oxygen-gtk3.
https://bugzilla.gnome.org/show_bug.cgi?id=686265
The implementation of transition for GtkCssShadowValue can return NULL
at least when the two values have a different inset; all other parts of
the GTK/CSS machinery (e.g. GtkCssArrayValue) handle this by returning
NULL too. Instead, GtkCssShadowsValue was returning an invalid value,
where "len" was set, but some values in the array were NULL, which would
lead to a segfault when this value is later evaluated by the compute
function.
Fix this by making GtkCssShadowsValue return NULL if a shadow transition
fails, like GtkCssArrayValue does.
https://bugzilla.gnome.org/show_bug.cgi?id=686013
Parsing a shorthand background property was running into unexpected
errors when trying position values where there were none. To fix this,
introduce a try_parse variant of the position parse function that
silently returns NULL.
Move instance fields to a private struct, in preparation
for installing a11y headers.
This also required removing access to GtkWidgetAccessible innards
from several accessible implementations.
Move instance fields to a private struct, in preparation
for installing a11y headers.
This also required removing access to GtkToplevelAccessible innards
from the GtkWindowAccessible implementation.
Move instance fields to a private struct, in preparation
for installing a11y headers.
This also required removing access to GtkRendererCellAccessible innards
from various cell accessible implementations.
Move instance fields to a private struct, in preparation
for installing a11y headers.
This also required removing access to GtkContainerCellAccessible
innards from the GtkCellAccessible implementation.
Move instance fields to a private struct, in preparation
for installing a11y headers.
This also required removing access to GtkContainerAccessible innards
from the GtkMenuItemAccessible implementation.
... instead of from the intrinsic value. This way, we respect running
animations.
Note that the concept of "reversing" transitions is not implemented yet.
Otherwise, that value will never get reset and remain frozen in time.
This is problematic for example when the value is inherited and the
parent changes the value.
When positioning the scrollbar we were doing several miscalculations
when accounting for CSS paddings and borders. This also fixes a number
of problems with RTL and when scrollbars-within-bevel is FALSE.
https://bugzilla.gnome.org/show_bug.cgi?id=685449
I'm adding a bunch of fixes for gcc complaining about
-Wmissing-declarations after finding a bunch of cases today where I
had forgotten to make functions static in the CSS code.
This patch fixes the tests in gtk/tests.
After this last patch, the gtk/ subdir should now compile without
warnings when this flag is enabled.
This is part of a bunch of fixes for gcc complaining about
-Wmissing-declarations.
It puts functions into headers and includes those headers both where the
functions are defined and where they function are used.
Also remove the starting underscore from function names where
appropriate, as those functions are static now and not exported anymore.
This is part of a bunch of fixes for gcc complaining about
-Wmissing-declarations.
I'm adding a bunch of fixes for gcc complaining about
-Wmissing-declarations.
This set of patches makes private classes in gtk/*.c that use
G_DEFINE_TYPE() safe by adding definitions for the get_type() function
that can't be made static.
I'll add a bunch of fixes for gcc complaining about
-Wmissing-declarations after finding a bunch of cases today where I had
forgotten to make functions static in the CSS code.
A thorn in those patches is G_DEFINE_TYPE() which doesn't allow making
the get_type() function static, so I added definitions for that function
above the G_DEFINE_TYPE().
After those patches, GTK should compile without warnings when this flag
is enabled.