Commit Graph

75408 Commits

Author SHA1 Message Date
Matthias Clasen
b23ac5c8da Deprecate gtk_widget_translate_coordinates
Update all (non-deprecated) callers to use
gtk_widget_compute_point instead.

Fixes: #5697
2023-03-25 10:14:35 -04:00
Matthias Clasen
81e61b9abf Merge branch 'popover-bounds-trouble' into 'main'
textview: Give the magnifier correct coordinates

Closes #5695

See merge request GNOME/gtk!5716
2023-03-24 22:59:05 +00:00
Matthias Clasen
d2693ba66e magnifier: Correct position of area
The widget paintable uses the widgets bounds
as intrinsic size, so we need to offset from
that to the allocation, which is what the
coordinates are relative to.
2023-03-24 16:05:32 -04:00
Matthias Clasen
9db08c7a86 texthandle: Correct placement of handles
Text handles had the same problem as popovers.
They were interpreting their pointing-to rectangle
relative to the widgets bounds, when it is meant
to be relative to the widgtets allocation.

While we touch this code, rewrite it to use
gtk_widget_compute_point.
2023-03-24 16:05:05 -04:00
Matthias Clasen
fb3fe7a353 popover: Correct placement of popovers
When we don't have a pointing-to rectangle, we want to place
the popover wrt to the parents bounds. But if we have a
pointing-to rectangle, it is relative to the widgets allocation,
which is different from the bounds.

We were not handling the second case correctly, leading to context
menus in the text view being mispositioned by the widgets CSS padding.

While we are touching this code, rewrite it to handle transforms.

Fixes: #5695
2023-03-24 15:57:17 -04:00
Matthias Clasen
c51387d62b Merge branch 'matthiasc/for-main' into 'main'
Fix up criticals from GdkGLTexture

See merge request GNOME/gtk!5712
2023-03-24 15:53:55 +00:00
Chun-wei Fan
d209f55677 Merge branch 'alternative-fix-5685' into 'main'
GDK/Win32: Use wgl* functions directly as needed (fix #5685)

Closes #5685

See merge request GNOME/gtk!5702
2023-03-24 15:30:01 +00:00
Matthias Clasen
5c558c0091 Fix up criticals from GdkGLTexture
I broke this in 4291f27b56.
I overlooked that there may not be a current context.
2023-03-24 11:29:38 -04:00
Matthias Clasen
a83f36f4f6 Merge branch 'matthiasc/for-main' into 'main'
docs: Some updates

See merge request GNOME/gtk!5711
2023-03-24 14:45:35 +00:00
Matthias Clasen
f0a2d77e0f docs: Improve markup for keys
Consistently use <kbd>x</kbd> to render keys in the docs
and use + for key combinations.
2023-03-24 10:30:07 -04:00
Matthias Clasen
ce983c9495 docs: Some updates
Fix some links ot point to docs.gtk.org.
2023-03-24 08:56:06 -04:00
Matthias Clasen
91b19854c4 inspector: Cosmetics 2023-03-24 08:17:51 -04:00
Chun-wei Fan
b5ebe270c3 gtkgstsink.c: Drop workarounds needed for Windows
Since we are making GdkGLContext call the core wgl*() functions directly
instead of via libepoxy, drop the workarounds that we needed for notifying
libepoxy that wglMakeCurrent() outside of GDK/GTK was called.

This way, we clean up the code, and as a result, we can use the GstGL
APIs like the other platforms to query what GL api that is to be used.

For ensuring that things work between different threads, we now call
gdk_gl_context_clear_current() in place of calling wglMakeCurrent(xxx,
NULL), so that we make sure that there is no current GL context on a
thread outside of GstGL's thread, which Windows does not like.
2023-03-24 18:50:49 +08:00
Chun-wei Fan
627ee674e5 GDK-Win32: Add wrapper functions for calling core wgl* functions
We might be dealing with GL contexts from different threads, which have more
gotchas when we are using libepoxy, so in case the function pointers for
these are invalidated by wglMakeCurrent() calls outside of GTK/GDK, such as
in GstGL, we want to use these functions that are directly linked to
opengl32.dll provided by the system/ICD, by linking to opengl32.lib.

This will ensure that we will indeed call the "correct" wgl* functions that
we need.

This should help fix issue #5685.
2023-03-24 18:43:23 +08:00
Benjamin Otte
a8b211ff15 Merge branch 'wip/otte/for-main' into 'main'
listview: Activatable means activate

See merge request GNOME/gtk!5709
2023-03-24 05:18:08 +00:00
Benjamin Otte
8c0152a1af columnview: Don't infloop when a cell is grab_focus()ed
Whoopsie.

Broken since 30d4629043.
2023-03-24 05:43:13 +01:00
Benjamin Otte
bbfaebd1cd listview: Activatable means activate
Fix a typo that prevented activatable widgets from activating since the
refactoring in 608be08b0d.
2023-03-24 05:43:13 +01:00
Matthias Clasen
65acf8500f Merge branch 'mipmap-tracking' into 'main'
gsk: Avoid copying GL texture in more cases

See merge request GNOME/gtk!5704
2023-03-24 03:43:21 +00:00
Matthias Clasen
22ea1af569 gsk: Avoid copying GL texture in more cases
When the GL texture already has a mipmap, we don't
have to download and reupload it to generate one.

We differentiate the handling for texture scale nodes,
where we do want to force the mipmap creation even if
it requires us to reupload the GL texture, and plain
texture nodes, where we just take advantage of a
preexisting mipmap to allow trilinear filtering for
downscaling, or create one if we have to upload the
texture anyway.
2023-03-23 23:17:54 -04:00
Matthias Clasen
7cb7e0ab35 gl: Add a private way to query mipmap status
Make GdkGLTexture determine if the texture has
a mipmap, and provide private API to query this
information.

This check is done in gdkgltexture.c instead of
gskgldriver.c, since we're already binding the
texture here for other reasons, so it is easy
to query a few more things.
2023-03-23 23:16:54 -04:00
Matthias Clasen
48491c6a04 Merge branch 'check-widget-on-destruction' into 'main'
gtkwidget: Do a type-check in gtk_widget_in_destruction()

See merge request GNOME/gtk!5708
2023-03-24 03:03:31 +00:00
Matthias Clasen
4291f27b56 gltexture: Try harder to determine the format
We can query these things as long as the texture ID
is valid in the current context.
2023-03-23 22:56:06 -04:00
Marco Trevisan (Treviño)
07197a299f gtkwidget: Do a type-check in gtk_widget_in_destruction()
Given it can be called during a widget destruction, it's safer to do a
type-check before crashing.

See: https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1727
2023-03-24 03:31:07 +01:00
Boyuan Yang
3dc0ee7483 Update Chinese (China) translation 2023-03-23 18:46:30 +00:00
Emmanuele Bassi
9f4013c5b4 Merge branch 'fix-a11y-leak2' into 'main'
Don't leak all AT contexts

Closes #5690

See merge request GNOME/gtk!5700
2023-03-23 11:07:18 +00:00
Benjamin Otte
4e9369585d Merge branch 'wip/otte/listview-cleanups' into 'main'
listview refactoring and new stuff

See merge request GNOME/gtk!5701
2023-03-23 05:38:29 +00:00
Benjamin Otte
30d4629043 columnview: Handle focus movement properly
- grab_focus() on a row (happens with scroll_to()) keeps the focus
  column intact if possible.
- <Tab> and <Shift-Tab> move through the cells in order, and move
  to the next row when at the end.
- <Up> an <Down> move to the next/prev row, keeping the same column
  focused.
- <Left> and <Right> move to the prev/next cell, if one is available.
  If not, they stay where they are.
2023-03-23 04:51:50 +01:00
Benjamin Otte
78e72ad1de columnview: add a (private) focus-column
Make setting the focus column scroll to it, too.
2023-03-23 04:51:20 +01:00
Benjamin Otte
8e17abb8fe columnviewrowwidget: Handle left/right arrow keys
Make it move focus just like GtkWindow would.

Otherwise the listview will (try to) handle it and move focus between
cells - which doesn't do anything for lists and only works with grids.
2023-03-23 04:45:03 +01:00
Benjamin Otte
fa7a5773d4 listbase: Only grab_focus() if the cursor moved
If there is no movement, grab_focus() on the already focused widget
just causes weird inconsistencies and we don't want those.
2023-03-23 04:45:03 +01:00
Benjamin Otte
7285830dfb columnviewrow: Handle focus movement properly
Handle backwards tab properly and deal with left right arrows.
2023-03-23 04:45:03 +01:00
Benjamin Otte
817732ded9 listitemwidget: Only take a single child 2023-03-23 04:45:03 +01:00
Benjamin Otte
3a6bfe9e9d columnviewrowwidget: Drop unneeded stuff
Also remove the GtkColumnListItemFactory and GtkColumnViewLayout
objects by folding them into GtkColumnViewRowWidget.
2023-03-23 04:45:03 +01:00
Benjamin Otte
bea7d5d318 columnview: Add GtkColumnViewRowWidget
This is a copy/paste of GtkListItemWidget for now.

Modifications will happen in future commits.
2023-03-23 04:45:03 +01:00
Benjamin Otte
608be08b0d listview: Add private GtkListFactoryWidget
This is a split of GtkListItemWidget into the generic parts of factory
using widgets.

On top of it there's GtkListItemWidget, which takes care of GtkListItem.
2023-03-23 04:45:03 +01:00
Benjamin Otte
107133ec6d listview: Move ::factory out of the item manager
It's a listitemwidget property, and the item manager manages the items,
not the widgets.
2023-03-23 04:45:03 +01:00
Benjamin Otte
4ecda13fbd listview: Move ::single-click-activate out of the item manager
It's a listitemwidget property, and the item manager manages the items,
not the widgets.
2023-03-23 04:45:03 +01:00
Benjamin Otte
ccacf80f47 listitemmanager: Create widgets via vfunc
We now have listitemmanager just create GtkListItemBase objects via
vfunc and use them.
2023-03-23 04:45:03 +01:00
Benjamin Otte
1f3a2734eb listitemwidget: split out GtkListItemBase
There's 2 reasons for this:

1. Adding a custom widget for columnview rows
2. Using this as base class for sections
2023-03-23 04:45:03 +01:00
Benjamin Otte
a18760a094 itemmananger: Remove the user data
Use the widget instead. They're the same anyway.
2023-03-23 04:45:03 +01:00
Benjamin Otte
e85270b051 listbase: Privatize 2 functions
They're not used outside of GtkListBase, so no use to have them in the
header.

Requires moving one function up in the source now that the forward
declaration is missing.
2023-03-23 04:45:03 +01:00
Benjamin Otte
27c01cfa49 listitemmanager: Clean up header
Remove all unused functions and an unused macro.
2023-03-23 04:45:03 +01:00
Matthias Clasen
7b22983be5 Don't leak all AT contexts
create_at_context was confused - it stored a reference
to the newly created context in priv->context, but then
also returned a reference, and the caller stored that
in priv->context again.

Change it to only return a reference.

Fixes: #5690
2023-03-22 23:41:40 -04:00
Matthias Clasen
57ec758d81 Merge branch 'texture-scale-test' into 'main'
gsk: Add a test for scaled textures

See merge request GNOME/gtk!5686
2023-03-23 02:42:28 +00:00
Bruce Cowan
2ab3610df8 Update British English translation
(cherry picked from commit d80cecec06)
2023-03-22 15:46:23 +00:00
Matthias Clasen
724ecf3b51 Merge branch 'ebassi/ensure-file-chooser-types' into 'main'
Ensure GtkFileChooserCell's type

See merge request GNOME/gtk!5696
2023-03-22 10:48:55 +00:00
Emmanuele Bassi
b2e8158c7a Ensure GtkFileChooserCell's type
Otherwise anything that dlopen()'s GTK will have a bad day.

See: https://discourse.gnome.org/t/strange-filechooserdialog-behaviour-in-gtk-4-10/14435
2023-03-22 10:29:57 +00:00
Matthias Clasen
9dcc1943b3 gsk: Improve slice handling
Upload slices in chunks, instead of copying
enormous amounts of memory.
2023-03-22 00:15:32 -04:00
Matthias Clasen
c3ee8d2699 gsk: Add more flexible texture upload
Add a command queue function to create a
GL texture by uploading several GdkTextures
at given positions.
This lets us 'piece together' textures.
2023-03-22 00:15:04 -04:00
Matthias Clasen
24720307bb gsk: Tweak one test to pass
Clip away the problematic corners in this
artificial texture scaling test. The GL renderer
has problems getting them perfect.
2023-03-22 00:15:04 -04:00