This fixes the build of GTK+ master on Visual Studio 2013 (and possibly
others) as snprintf() may not be supported even if the required C99
features are supported by the compiler.
https://bugzilla.gnome.org/show_bug.cgi?id=773299
This is not used by anything yet, but add it now, so people looking at
this new code can make sense of it.
Plus, the documentation mentions it, so better have the docs make sense.
It will be used once we add support for conversions to GDK and allow
doing cipboard/dnd by GValue.
Make sure the API reflects the idea that GdkContentFormats is a set
containing mime types. In particular, treat the object itself as a
plural - it's named content format`S' after all - and therefor use
the correct verb form.
Also make GdkContentFormats keep an array instead of a list, now that
it's immutable.
Whereever we handle long-press for touch, it makes sense to handle
right-click as a faster alternative for mouse-based interaction.
This commit makes right-click work to bring up the variation
selector for Emojis.
For a start, this makes gtk_main() work different from g_main_loop_run()
calls.
But most importantly, modern GDK does proper syncing itself and doesn't
need to rely on a catch-all to get it right.
Instead of allowing people to pass a uint user-data, insist on them
comparing mime types.
The user data was a uint instead of a pointer anyway, so uniqueness
could not be guaranteed and it caused more issues than it was worth.
And that's ignoring the fact that it basically wasn't used.
The HighContrast theme was not parsing anymore, due to
leftover widget style properties, and some missed cleanups,
like -gtk-icon-effect. Also update for the new focus handling,
and make checks and radios sharp again.
We no longer support registering custom icon sizes, so
we can make these properties just enums. This also lets
us specify them by nick in ui files. Nice!
Instead of looking at the icon size, look at the CSS value for
-gtk-icon-size. Set style classes depending on icon size instead.
Trivially change Adwaita and HighContrast to report the same values as
before.
Instead, add a function gtk_image_set_icon_size() for the cases where
overriding the icon size is necessary.
Treat icon sizes the same way as pixel sizes, too. So gtk_image_clear()
no longer unsets the icon size.
Instead of returning the icon size with them, make
gtk_image_get_icon_name() and gtk_image_get_gicon() only return the icon
itself.
As a benefit, we can turn them into regular getters that return values
instead of requiring out parameters.
Instead, provide gtk_image_get_icon_size() to query the icon size.
Instead, turn the functions into backend API:
gdk_broadway_display_add_selection_targets()
gdk_broadway_display_clear_selection_targets()
Remove the old per-backend functions, too.
It wasn't taking into account whether the sidebar had support for them
or not, resulting in a file chooser with open in new tab/window menu
items when it's not supported.
To fix it, do as with the other menus and check for the availability of
new tab/window flags.
https://bugzilla.gnome.org/show_bug.cgi?id=786123
g_resources_enumerate_children expects the path to end
in a '/' (even though thats not stated in the docs), and
will copy it if that isn't the case. Avoid the copy
by putting a '/' there to begin with.
g_resources_enumerate_children expects the path to end
in a '/' (even though thats not stated in the docs), and
will copy it if that isn't the case. Avoid the copy
by putting a '/' there to begin with.
When the duration is set to 0, clamp it to 1us. This way we're almost
correct: We should really instantly finish, but we don't. But we do
respect the delay.
Doing this properly would require some refactoring of how the progress
tracker actually maintains progress, and this is just a quick fix.
Also, sanitize the RTL correction code that made sure resizing the width
of a treeview would keep the contents glued to the right border instead
of the left border.
GtkSourceView is not using it, so it's unneeded. And it's certainly
diving deep into event internals of GtkTextView which hinders a proper
gesturization.
The selection bubble is not part of the text windows, so hiding it
during scroll should not be done in the text window code.
Also remove an unused variable that was only set in that code but never
read.
Insist that a first non-NULL property is passed to
gtk_style_context_get().
This is in particular relevant because of dropping the state argument
since GTK3, and code like
gtk_style_context_get (context, state, "font", &font);
would keep compiling without warnings without this change.
Use the same approach we take for recoloring in GtkIconHelper now.
As part of this change, GtkCsSImageRecolor is changed to not derive
from GtkCssImageUrl anymore.
commit 475d916eb9 added various paths that
use theme-name for this, but the existing path already used THEME, with
a subsequent description referring to the latter. So use that everywhere
With the shader approach to symbolic recoloring, we must
not recolor the svgs anymore as we're loading them. Instead,
load them the same way that gtk-encode-symbolic-svg does.
This fixes the rendering of large symbolic icons e.g. the
'no search results found' page in the file chooser.
This is necessary because picking is no longer automatically constrained
to a widget's box. So all clipping widgets need to constrain their
clipping, too.
This patch does that for GtkViewport only.
We cannot fast-track picking by using gtk_widget_contains(). Child
widgets may extend their parent using ie negative margins.
This is not just a theoretical concern, this is what's happening right
now with GtkScale's sliders relative to the trough.
The problem is that we now iterate through all widgets, even when they
aren't anywhere near the mouse pointer. So essentially every pick
operation is now guaranteed O(N_WIDGETS) which used to be the worst case
that pretty much never happened.
The trough widgets have the slider on top of the fill level and the
hilight widget. Make sure the widget stacking respects that.
This is particularly relevant because picking event targets should pick
the slider and not the hilight widget.
In particular, allow specifying a filename for a GDK_TYPE_TEXTURE
property. This makes it easy to transition properties from Pixbuf type
to Texture type without having to touch resource files.
A sideeffect is that we don't set the correct parent window on child
widgets anymore, but that is hopefully going to be fixed once we get rid
of child windows completely.
Widgets can now set their favorite cursor using public API.
This is very necessary because all cursor-setting APIs are still
setting it on their GdkWindow, which by now is the toplevel - oops.
Change constructors to reflect that.
While doing so, also add a fallback argument to the cursor constructors,
so it is now possible to create cursors with fallback.
The check used to achieve discarding events not meant for the window
widget itself (because they are handled in the regular paths). Using
the target widget is the equivalent now.
Use g_value_set/get_boxed() in gtk_window_get/set_property(), case PROP_ICON.
icon_from_list() shall always add a reference to the returned icon.
gtk_window_set_icon() must accept icon != NULL.
https://bugzilla.gnome.org/show_bug.cgi?id=789870
• Remove the box-shadow at the top when the entry is in the foreground
• Bump precedence so that :disabled entries do not have .flat overridden
• Also add :backdrop to stop HCInverse getting a lighter BG in :backdrop
https://bugzilla.gnome.org/show_bug.cgi?id=789733
Move the default pos of the Paned handle to 400px from the left, i.e.
50% of the default width of the window. The previous position at 300px
from left meant the node treeview was too narrow & could easily result
in the (useful) State column not being visible in the case of many
apps. The properties pane doesn't need to be as big as it was anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=788898
We disconnect from the GDK window, so the renderer can't keep any useful
state.
Plus, we might be using an entirely different window next time we
realize (after a call to gtk_window_set_display() for example) that should
use a completely different renderer anyway.
Drop the screen argument from gdk_dnd_find_window_for_screen
and rename the function to gdk_dnd_find_window. The screen
argument does not add anything here since the drag context
is already tied to the display. Update all backends, and
update all callers.
Consider the coordinates passed to gtk_widget_queue_draw_region to be
relative to @widget's origin, not its parent. That implies passing
priv->allocation or priv->clip to _queue_draw_region of a widget means
using its parent as @widget.
This fixes GtkScrolledWindow overshoot invalidation, which assumed the
coordinates to be widget-relative and not parent-relative.
And have a priv->display instead of a priv->screen.
Includes turning gtk_menu_set_screen() into gtk_menu_set_display(),
because that function just forwards to its window.
This is just lots of renaming.
The interface remains private, so the public API does not change, apart
from removing the definition of the Interface object to avoid
subclassing.
When a widget unparents its child widget manually in finalize, this can
lead to the parent-set signal being emitted for those child widgets. The
parent already has a ref_count of 0 though, so it can't be used in a
meaningful way. Specifically, emitting the signal will already try to
ref the parent which prints a critical.
Since GtkWidget already has a "parent" property, one can use its notify
signal instead to get notified when the parent widget changes.
... instead of returning either itself with uncomputed images or a
copy of itself with only one computed image and lots of other
uncomputed images that we're never gonna look at again.
This fixes expressions like -gtk-scaled(-gtk-recolor(...),-gtk-recolor(...))
which Adwaita uses for checkmarks and bullets.
The Vulkan renderer creates a fallback surface for each shadow
node, even if we end up not rendering anything to it. Avoiding
this is a nice optimization.
The GtkWidgetClass::measure vfunc is not required to assign a value to
any of the (out) parameters, so we need to initialize the locals we pass
to it, otherwise we can end up with a garbage size request.
The path bar would crash if we disposed it before all pending I/O
operations had finished. Now we remember all the outstanding
operations directly in the GtkPathBarPrivate, and deal with them
consistently.
The copy of the PangoGlyphString we do here was showing up
in some profiles. To avoid it, allocate the PangoGlyphInfo array
as part of the node itself. Update all callers to deal with
the slight api change required for this.
If the compositor prefers server-side decorations and the client doesn't
customize the title bar, we disable client-side decorations and let the
compositor know. Otherwise, we continue to use client-side decorations.
Signed-off-by: Drew DeVault <sir@cmpwn.com>
https://bugzilla.gnome.org/show_bug.cgi?id=781909
As documented, GtkAppChooser is "typically [used] for the purpose of
opening a file". However given that applications that support neither
opening files nor URLs are filtered out, the chooser is not actual
useful for any other (atypical) usage. Change that by only applying
the filtering if a content-type was set, and use the full unfiltered
list otherwise.
https://bugzilla.gnome.org/show_bug.cgi?id=789327
Since focus can now be represented by more than one state,
just looking at the focus_child is no longer sufficient - we
may fail to propagate :focus(visible) if we do so. For now,
just remove the shortcut and always do the work.
__builtin_popcount is a GCCism that is used to count the number of bits
involved, which means any non GCC/CLang compilers won't like the code,
meaning that on MSVC builds we must implement it ourselves.
We first use __cpuid() to check whether the CPU supports the popcount
instruction, if it does, we use the __popcnt intrinsic, otherwise
(untested, since I don't have a system that does not have the
instruction), we use the suggested hacks at
http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallelhttps://bugzilla.gnome.org/show_bug.cgi?id=773299
We still need to access the GdkEvent structure here directly, as using
the GdkEvent getters is likely not worth the trouble involved.
Please see Emmanuele's comment (#97) of the following bug URL.
https://bugzilla.gnome.org/show_bug.cgi?id=773299
These are no longer used, instead we always covert to surface as
early as possible and drop the pixbuf.
This means we never store both the pixbuf and the surface at
for any longer time, which is wasteful. Also, its one step further
to drop GdkPixbufs from generic use in our APIs.
Rather than store the pixbufs as themselves we immediately convert
them to surfaces. In the uncommon case that a pixbuf is read back
from the renderer we generate a new one from the surface data.
This drops the pixbuf property and the pixbuf getters. We keep
gtk_image_new/set_from_pixbuf, but these are small helpers that
immediately convert to a surface, and there is no way to later get
back the pixbuf you passed in.
The from file/resource codepaths are also changed to load a surface
instead of a pixbuf.
Rename the surface getter to peek, following other render
node getters, and make the surface-based constructor private,
since it is not something we want to encourage.
Update all callers.
The gtk_tools variable is an array of arrays; adding a new element
requires to maintain the same type, or we'll get a build failure when
we try to extract the newly added element.
Add the necessary machinery into the Meson definition files so that we
can build for Windows.
Since we don't have Wayland or X support for our use case here, disable
them once we know that we are building for Windows, as they are
(otherwise) enabled by default, and enable the items that need to be
built for Windows builds.
Exclude gtk4-launch from Windows builds as that is something that
is not supported on Windows.
As we won't have gio-unix on Windows, and PangoFT2 is optional, don't use
fallbacks for them when we are on Windows (but do use fallbacks for
gio-win32, as it will be used).
Also, clean up meson.build a bit as we can just force-include
msvc_recommended_pragmas.h from GLib since we depend on GLib, and so we
can handle these warnings from msvc_recommended_pragmas.h instead.
https://bugzilla.gnome.org/show_bug.cgi?id=785210