Compare commits

...

134 Commits

Author SHA1 Message Date
Chun-wei Fan 4ad550f341 gdkdrag-win32.c: Fix drag surface positioning
Determine the root_x and root_y coordinates of the drag surface by
relying on the coordinates of the surface where the drag is being
carried out, plus the coordinates that we receive from the drag event,
which is in-line with what the X11 backend does.

This will prevent the drag surface from being initially drawn at the
correct position, but jumping towards the top-left corner of the screen
shortly afterwards.

The DnD support will still need some more updates to function correctly
on Windows, but at least this is a small improvement.

Fixes issue #3798.


(cherry picked from commit e35490ba5b)
2021-06-19 03:18:01 +00:00
Matthias Clasen c1816408c0 Merge branch 'backports-for-4-2' into 'gtk-4-2'
Assorted bugfix backports

See merge request GNOME/gtk!3687
2021-06-19 01:38:51 +00:00
Matthias Clasen 5699e5ba71 gsk: Respect max element vertices limitation
We are pretty good at batching commands now, and we can easily
produce batches that exceed the maximum number of elements per
draw call that the hw can handle. Query that number, and respect
it when merging batches.

This fixes the rendering of the overview map in GtkSourceView.
2021-06-18 10:22:50 -07:00
Matthias Clasen 5356202ba3 listitemwidget: Claim gesture when activating
Claim the gesture when we are activating a list item.

Otherwise we end up with double activations in
columnviews: first GtkColumnViewCell handles
the event, and then GtkListItemWidget handles
it again.

Fixes: #4015
2021-06-18 10:19:54 -07:00
Matthias Clasen 15a574976e listitemwidget: Match activation conditions
Make the conditions used for activation in the single-
and double-click case properly match, so that it is
obvious that we won't trigger both of them.
2021-06-18 10:19:47 -07:00
Zhi f9c7b68853 fix: make the new nsview as the first responder.
Make the new view as the first responder(focused) so the new view can
accept events from input method.

Fixes #3968.
2021-06-18 10:19:29 -07:00
Matthias Clasen 741603c838 label: Fix mnemonic handling
We were not handling the case right in which we
want to use underlines, but not use markup. Since
we are now using pango_parse_markup for this case,
we need to escape the xml markup.

Fixes: #4041
2021-06-18 10:19:07 -07:00
Benjamin Otte 5ab6eca84d cellarea: Don't shrink area too much
Do not compute rectangles with negative width/height. This avoids
assertion failures further down when those rectangles were actually
checked.

https://bugzilla.redhat.com/show_bug.cgi?id=1962215


(cherry picked from commit 4ba89f25b8)
2021-06-18 10:18:27 -07:00
Matthias Clasen 024151fe2c treeviewcolumn: Clip header buttons
We don't want to overdraw when dragging a narrow column
around, and we also need the clipping to avoid picking
the wrong column, when a later column button overlaps
an earlier one.

Fixes: #4045
2021-06-18 10:17:49 -07:00
Matthias Clasen d5bfcdc218 Merge branch 'fix-3793-4-2' into 'gtk-4-2'
gdksurface-win32.c: Fix up popup placement (fix issue #3793 for gtk-4-2)

See merge request GNOME/gtk!3675
2021-06-18 17:17:01 +00:00
Chun-wei Fan 90bd5a04fd gdksurface-win32.c: Fix up popup placement
If we are undergoing a surface move, just apply the next_layout anyways,
even if we are not moving a toplevel surface.

Update the way how we obtain the x and y coordinates of a surface, if it
is a toplevel, apply the x and y coordinates from the results from we
obtained the underlying Win32 HWND, as we did before.  But if it is a
popup, use gdk_win32_surface_get_geometry() to obtain the correct x and
y coordinates to place our popup surface.

Also correct how we compute the shadow dimensions, and the final popup
rectangle as we attempt to layout the popup surface, since GDK-Win32
keeps track of the shadow dimensions in system (unscaled) units, not GDK
units.

Fixes issue #3793.
2021-06-18 10:18:56 +08:00
Chun-wei Fan 16da71f1ce gdksurface-win32.c: Fix formatting for popup functions 2021-06-18 10:18:56 +08:00
Hugo Carvalho 807537dd5d Update Portuguese translation 2021-06-17 14:44:36 +00:00
Daniel Mustieles b3fa74d1ac Updated Spanish translation 2021-06-15 13:04:34 +02:00
Daniel Mustieles dcb620e103 Updated Spanish translation 2021-06-15 13:04:26 +02:00
Matthias Clasen c573732ef1 Merge branch 'alatiera-gtk-4-2-patch-27279' into 'gtk-4-2'
NEWS: use the correct version for the header

See merge request GNOME/gtk!3657
2021-06-11 00:17:40 +00:00
Jordan Petridis 69e72341a2 NEWS: use the correct version for the header 2021-06-10 20:54:06 +00:00
Matthias Clasen 2a0a55ae97 Merge branch 'wip/carlosg/spin-button-swipe-gesture-4-2' into 'gtk-4-2'
spinbutton: Connect swipe gesture to the text entry

See merge request GNOME/gtk!3651
2021-06-08 17:07:53 +00:00
Carlos Garnacho 6df3296211 spinbutton: Mind the step in the swipe gesture
The swipe gesture forces values in the spin button that are
"impossible" according to the adjustment. This can break things
in creative ways.

Ensure the steps provided are always multiples of the adjustment
step value, and keep the remainder for further interaction.
2021-06-08 18:35:39 +02:00
Carlos Garnacho a00d3b107e spinbutton: Connect swipe gesture to the text entry
In the GTK3 days, the spin button was an entry, with buttons on
top, and the swipe gesture affected the input on the entry bits.
Now the spin button is a container, so this gesture in the capture
phase applies to all contained children (incl. buttons).

Attach this gesture to the entry itself, so the buttons are left
outside this business. The gesture is still in the capture phase
in order to prevent text selection/edition/etc to happen.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4008
2021-06-08 18:35:38 +02:00
Matthias Clasen 4ffcc9aa26 Merge branch 'wip/carlosg/no-early-popup-ungrabs-4-2' into 'gtk-4-2'
gdk/wayland: Break only implicit grabs on wl_pointer.leave w/ pressed buttons (4.2)

See merge request GNOME/gtk!3640
2021-06-06 12:31:59 +00:00
Carlos Garnacho e7fdb43499 gdk/wayland: Break only implicit grabs on wl_pointer.leave w/ pressed buttons
The releasing of grabs while a button is pressed (e.g. after starting dnd, or
dragging the window, or going to overview with a pressed button, etc...) was
generalized here in https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1879.

However we shouldn't break all grabs here. In the case of grabbing popups,
compositors will still emit crossing events between client surfaces (e.g.
popping up and selecting a menu item via press-drag-release), breaking all
grabs here means inconsistent client state, that was
https://gitlab.gnome.org/GNOME/gtk/-/issues/2746.

That was fixed in mutter, by essentially making implicit grabs
owner_events=FALSE, however that breaks the mentioned use pattern entirely.
Mutter is changing this behavior back, so GTK should handle these crossing
events.

The grab that we are interested in breaking here is the implicit pointer
one. Popups will be dismissed via other means if the compositor says their
active grab needs breaking. This still leaves dnd/move/resize drags in
one place, while not allowing #2746 to happen with popups.
2021-06-05 18:29:39 +02:00
Matthias Clasen 03be0994ad Merge branch 'imcontext-ignore-more-4-2' into 'gtk-4-2'
imcontext: Ignore more keysyms

See merge request GNOME/gtk!3635
2021-06-05 02:39:51 +00:00
Matthias Clasen 073c40c738 imcontext: Ignore more keysyms
It finally dawned on my that #3673 is just another
case of unexpected keysyms getting sent our way via
fringe XKB features.

Ignore them all!
2021-06-04 21:29:17 -04:00
Anders Jonsson b3d6202833 Update Swedish translation 2021-06-04 21:16:04 +00:00
Matthias Clasen bf09dc47fd docs: Assorted fixes
Fix all the link syntax errors, now that gi-docgen
reports them.
2021-06-01 18:01:14 -04:00
Matthias Clasen 4e031a9542 Merge branch 'notebook-critical-4-2' into 'gtk-4-2'
Fix a critical in notebook code

See merge request GNOME/gtk!3616
2021-06-01 18:08:59 +00:00
Caolán McNamara 8d263eed02 invalid cast from 'GtkButton' to 'GtkBox'
on adding a page to a GtkNotebook

(soffice): Gtk-CRITICAL **: gtk_box_remove: assertion 'GTK_IS_BOX (box)' failed
2021-06-01 12:39:17 -04:00
Matthias Clasen 5047f79218 Merge branch 'fix.vs2013.link.4-2' into 'gtk-4-2'
gtk/meson.build: Fix linking on Visual Studio 2013 (gtk-4-2 branch)

See merge request GNOME/gtk!3576
2021-05-26 14:43:40 +00:00
Matthias Clasen 54885d14bf Merge branch 'ignore-nosymbol-press-4-2' into 'gtk-4-2'
imcontext: Ignore NoSymbol key events

See merge request GNOME/gtk!3592
2021-05-25 18:14:52 +00:00
Matthias Clasen c231ce6a9f Merge branch 'fix-im-reset-4-2' into 'gtk-4-2'
imcontextsimple: Fix a possible problem

See merge request GNOME/gtk!3585
2021-05-25 17:29:30 +00:00
Matthias Clasen c12f1ebebb imcontext: Ignore NoSymbol key events
These can happen with some XKB options.

Fixes: #3973
2021-05-25 13:24:41 -04:00
Matthias Clasen 6c1f404e5a imcontextsimple: Fix a possible problem
We were forgetting to handle the compose sequence
case in reset().
2021-05-25 08:05:50 -04:00
Chun-wei Fan caa5fd0584 gtk/meson.build: Fix linking on Visual Studio 2013
Visual Studio 2013's linker does not suport `/WHOLEARCHIVE:`, just
explicitly extract the objects from the static libraries that will
form the final GTK DLL.
2021-05-24 10:32:48 +08:00
Matthias Clasen d883b0a383 Merge branch 'cherry-pick-7db87a88' into 'gtk-4-2'
Merge !3565 into gtk-4-2

See merge request GNOME/gtk!3566
2021-05-21 16:19:12 +00:00
Matthias Clasen ffcbc44c7f Merge branch 'ci-image-4-2' into 'gtk-4-2'
ci: Stop using a separate docs image

See merge request GNOME/gtk!3573
2021-05-21 03:08:19 +00:00
Matthias Clasen 633d59fff9 build: Fix default options for gdk-pixbuf
The gdk-pixbuf subproject api changed (options changed
from boolean to feature). Adapt to that.
2021-05-20 22:05:20 -04:00
Matthias Clasen 939a254e28 ci: Stop using a separate docs image
No longer needed with gi-docgen.
2021-05-20 21:49:26 -04:00
Benjamin Otte 06a0265efa Merge branch 'fix-gst-media-file' into 'master'
gtkgstmediafile: Remove media-info-updated callback

Closes #3913

See merge request GNOME/gtk!3565

(cherry picked from commit 7db87a8889)

12a9a0fa gtkgstmediafile: Remove media-info-updated callback
2021-05-19 16:51:53 +00:00
Matthias Clasen f639fda994 Merge branch 'pixbuf-fix-for-4-2' into 'gtk-4-2'
Meson: gdk-pixbuf jpeg/png options changed to feature

See merge request GNOME/gtk!3532
2021-05-07 21:14:51 +00:00
Xavier Claessens 26805edcff Meson: gdk-pixbuf jpeg/png options changed to feature 2021-05-07 15:34:52 -04:00
Matthias Clasen d5db409c44 Merge branch 'wip/carlosg/map-emulated-moveresize-window-4.2' into 'gtk-4-2'
gdk/x11: Ensure to map the non-ewmh moveresize emulation window before use

See merge request GNOME/gtk!3530
2021-05-07 19:32:46 +00:00
Carlos Garnacho b6a4ffef36 gdk/x11: Ensure to map the non-ewmh moveresize emulation window before use
Otherwise, we don't deem it as able to be grabbed, which we intend to do
immediately after.
2021-05-07 16:28:07 +02:00
Matthias Clasen ba44668478 4.2.1 2021-05-03 21:37:09 -04:00
Matthias Clasen 2f921ab667 dragsource: Keep the source alive long enough
When a drop causes the event controller to be finalized
(directly or indirectly), we end up segfaulting while
trying to wrap up the drag operation. So, keep a reference
on the GtkDragSource from when the drag begins to when
it is done.

This fixes a crash in gnome-todo when dragging tasks.
2021-05-03 21:20:54 -04:00
Matthias Clasen d9784df92e inspector: Improve monitor information display
Avoid a nested listbox, show the connector,
don't show information we don't have. Also,
disconnect all signal handlers from the display
when the inspector is going away.
2021-05-03 21:20:08 -04:00
Matthias Clasen 6a5f93ff95 shortcuts: Ignore consumed modifiers for mnemonics
This is necessary to make mnemonics like Alt-1 work in
layouts where numeric keys are shifted, like AZERTY.

Fixes: #3912
2021-05-03 21:19:43 -04:00
Matthias Clasen 7578a18cd6 contentdeserializer: Fix an oversight
The argument passed with string_deserializer must be
a charset name. Passing the mimetype there does not
make sense.
2021-05-03 21:19:28 -04:00
Ivan Molodetskikh a5895b5995 gtkgstmediafile: Fix callback argument type 2021-05-03 21:19:14 -04:00
Matthias Clasen 37582c6bf9 wayland: Rewrite shm format debug spew
Rewrite this in a way that doesn't depend on kernel
header defines at the time the wayland scanner was run.

This was causing the build to break on Centos 8, where
a bunch of fourcc formats are missing.
2021-05-03 21:19:07 -04:00
Matthias Clasen 84f02c633c Check for root being a GtkWindow in a few places
These things were showing up as crashes during DND,
when the root is a GtkDragIcon. I'm sure there's more.
2021-05-03 21:18:59 -04:00
Bilal Elmoussaoui fdb2776577 gdk: add zero-terminated annotation to content_formats_get_gtypes 2021-05-03 21:18:48 -04:00
Bilal Elmoussaoui 94539d469c gdk: fix content_formats_get_mime_types annotation 2021-05-03 21:18:42 -04:00
Chun-wei Fan f6a2d8148b gdkglcontext-win32.c: Fix running with Mesa drivers
Some GL drivers such as Mesa-D3D12 do not allow one to call SetPixelFormat() on
a given HDC if one pixel format has been already set for it, so first check the
HDC with GetPixelFormat() to see whether a pixel format has already been set
with the HDC, and only attempt to acquire the pixel format if one has not been
set.

This will fix running with GL/NGL on Windows using the Mesa drivers.
2021-05-03 21:18:26 -04:00
Geyslan G. Bem 35e3eaf8cb gtkplacessidebar.c: fix coding style
Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-03 21:18:20 -04:00
Emmanuele Bassi 2bc7b64004 docs: Add missing extra files for gdk4 sub-references
The Wayland and X11 references need the gtk-logo.svg and the urlmap.js
extra files.

Fixes: #3905
2021-05-03 21:18:03 -04:00
David Lechner 2df07f0564 gdk/wayland/cursor/os-compatibility: fix build when memfd_create is not available
When building for homebrew/linuxbrew on Ubuntu 16.04, memfd_create() is
not available and causes the build to fail.

This adds a proper check for the function.
2021-05-03 21:17:53 -04:00
Geyslan G. Bem 2d747cca3c gtkplacessidebar.c: add bookmark null checking
This fixes nautilus crash and perhaps other callers issues.
Nautilus (and sometimes glib) crashes with malformed URI inside of the
bookmarks file .config/gtk-3.0/bookmarks when it has no LABEL.

This is result from the closed glib MR #2065 analysis and agreement.
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2065#note_1091979

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-03 21:17:48 -04:00
Matthias Clasen f795a75d2b x11: Try harder to find the right monitor
If we deal with a panel, we end up with no monitor,
and crash, which isn't great and isn't necessary.

Fixes: #3900
2021-05-03 21:17:37 -04:00
Benjamin Otte 8748d9511b clipboard: Fix reading of files
Make sure writing a terminating null byte actually works and we don't
just ignore the error message.
2021-05-03 21:17:27 -04:00
Benjamin Otte 0fe3a26122 clipboard: Make sure G_TYPE_STRING is nul-terminated
When reading text, we need to check we terminate the G_TYPE_STRING
string with a null byte, because the clipboard does not guarantee one.

So just append a \0 to the stream.

Fixes #3899
2021-05-03 21:17:21 -04:00
Matthias Clasen 9145365331 window: Don't let solid-csd linger
Just from reading the code, it seems that we
should unset .csd and .solid-csd at the same
time, since the are mutually exclusive and
we unset them here so realize() can set one
of them again.
2021-05-03 21:17:03 -04:00
Matthias Clasen 84295147fd Simplify shadow conditions
The code in gtkwindow.c for dealing with the various
combinations of client-side decorations and client-side
shadows is entirely too complicated.

This commit does not really clean it up, but simplifies
one of the shadow conditions far enough to make some
sense.

With this change, I get the expected decorations in
all the cases I can easily reproduce locally.
2021-05-03 21:16:55 -04:00
Matthias Clasen 7ec50b1dd3 x11: Fix shadows
Commit a2cd21cab6 changed a condition and inadvertedly
broke client-side shadows on X11. Change this back.

Fixes: #3896
2021-05-03 21:16:44 -04:00
Matthias Clasen a5b4c2bb48 a11y: Don't sent redundant property changes
We were sending a property changed event for every set
property whenever we were sending any updates.
2021-05-03 21:16:35 -04:00
Matthias Clasen d26a3c28d0 gdk: Avoid synthetic motion confusion
Don't emit a synthetic motion event on a surface
that is grab-shadowed by a popup. This has been
known to confuse GTK, at times.

Fixes: #3439
2021-05-03 21:16:22 -04:00
Matthias Clasen e75df3dcd3 window: Make resize border size independent
Deriving the resize border size from the shadows
carries the risk that we might end up with uneven
resize borders (or none at all, on some sides).

So, justs enforce that we have a big enough shadow
width on all sides.
2021-05-03 21:12:16 -04:00
Ulli Kehrle db5eef5a81 imcontextsimple: Ignore more modifiers in compose
Previously it was impossible to compose characters on higher levels of
some keyboard layouts as pressing the level selection key would just
exit compose mode.

Examples for affected keyboard layouts include the Latvian
apostrophe-variant "lv(apostrophe)" (latched third level), the extended
German keyboard layout "de(e1)" (latched fifth level) as well as the
multilingual Canadian keyboard layout "ca(multix)" and the German
neo-layout "de(neo)" and its descendants (shifted fifth level).

To reproduce, set a compose key and select the Latvian apostrophe layout.
Notice that you now can input [ by pressing first the ' and then the 8-key.
Then pressing <compose>'8'8 should produce ⟦, but prior to this patch it
did not.
2021-05-03 21:12:07 -04:00
Matthias Clasen 0b0d7d3877 window: Tweak resize borders
Make windows resizable in the padding and border
area of the css box as well. This naturally makes
solid-csd borders work again.
2021-05-03 21:12:01 -04:00
Matthias Clasen 10b302ac29 window: Fix up resize borders
The invisible resize borders have been wider than they
should, for a while. Go back to a size close to what
we have in GTK3.

To summarize: resize borders will be at most 12 pixels
on each size, but never wider than the windows shadow.
The resize corners have 'legs' of 24 pixels where you
still get a corner resize cursor.

Fixes: #3856
2021-05-03 21:11:53 -04:00
John Renner f1bfbeba45 Allow repeated selection extension on gktlistbox 2021-05-03 21:11:46 -04:00
Emmanuele Bassi ca405f1060 a11y: Update the labelled-by relation of GtkTreeExpander
Whenever we change the :child property, we need to update the
labelled-by relation.
2021-05-03 21:11:36 -04:00
Emmanuele Bassi 4baec1ef22 a11y: Set state on the GtkTreeExpander widget
Instead of setting it on its internal child.
2021-05-03 21:11:21 -04:00
Matthias Clasen d35e069436 imcontext: Fix cursor positions
gtk_im_context_get_preedit_string is documented to
return the cursor position as a character offset,
not a byte count. So return that.

Fixed: #3885
2021-05-03 21:11:12 -04:00
Emmanuele Bassi 6a95ca6995 a11y: Pair window:activate with window:deactivate signal
Orca needs both events in order to decide whether or not to subscribe to
other event/state changes in a window.
2021-05-03 21:11:01 -04:00
Matthias Clasen 268c174506 x11: Don't beep on untrusted displays
This can trigger BadAccess, and we don't
want that.

Fixes: #3862
2021-05-03 21:10:56 -04:00
Matthias Clasen 7e3493b15e a11y: Realize notebook tabs when switching
We're not moving focus here, so we can't rely
on that to conjure the a11y objects into existence.
2021-05-03 21:10:46 -04:00
Alberts Muktupāvels be65bab5f6 theme: fix solid-csd style
Move .solid-csd style out of .csd parent and adjust it so windows
look similar / same to GTK 3 windows:
- 4px padding.
- extra shadow.

https://gitlab.gnome.org/GNOME/gtk/-/issues/3879#note_1086351
https://gitlab.gnome.org/GNOME/gtk/-/issues/3879#note_1086377
2021-05-03 21:10:39 -04:00
Matthias Clasen c04139405a a11y: Avoid spurious selection changed events
Only send selection-changed events when we either
had a non-empty selection before, or have one now.

This should help orca speak the right things, and
not the wrong things.

Related: #3549
2021-05-03 21:10:29 -04:00
Emmanuele Bassi 5fc008024b a11y: Emit window:activate event
Orca uses the window:activate event type to track top levels, and avoid
being spammed by events coming from non-focused windows.
2021-05-03 21:10:24 -04:00
Matthias Clasen f6bec2edf2 stackswitcher: Set accessible label properties
This makes the tabs in about dialogs come out as
'About', 'Credits', and 'System', instead of
'Tab', 'Tab', 'Tab'.
2021-05-03 21:10:14 -04:00
Matthias Clasen c1e68f6044 a11y: Emit focus events
Orca relies on these to keep track of the focus location,
ignoring the focused state. With this change, orca can
once again speak text in entries as I type.
2021-05-03 21:10:08 -04:00
Matthias Clasen 549e5a8e3a a11y: Make things appear on focus in
We are starting with a pretty empty a11y object tree,
and we want orca to bring more of it into existence
by navigating the tree. But that only happens when we
send it events. Primarily focus events, which come in
from GTK via the platform_change mechanism. So realize
the context when we are sending platform_changes,
otherwise, orca never gets the mesage.
2021-05-03 21:10:03 -04:00
Matthias Clasen 5783d8af91 Fix a possible crash in gtk_show_uri
g_file_get_basename can return NULL.
Deal with it somehow.

Fixes: #3883
2021-05-03 21:09:54 -04:00
Matthias Clasen 1926d91e1d a11y: Actually set accessible roles
With most context realization happening inside
GtkAtspiContext in response to D-Bus calls, the
code in gtk_widget_realize_at_context that sets
the role is not executed for most accessibles,
causing them to be stuck with the 'filler' role
that makes orca ignore them.

To fix this, split gtk_widget_realize_at_context
into the actual context realization (getting on
the bus) and the setting of widget-specific
properties, and do the latter part when the
widget is rooted.

This makes accerciser report proper roles for
entries and buttons. Orca still has an issue
with getting the hierarchy populated.
2021-05-03 21:08:11 -04:00
Matthias Clasen 0441101786 a11y: Track window states more closely
Orca ignores events unless the object is inside an object
with role window and states ACTIVE and SHOWING. To arrange
for this, introduce a new ACTIVE platform state, and set it
for windows when they are active.

This gets orca to be a lot more talkative.
2021-05-03 21:07:53 -04:00
Matthias Clasen eb8fce3645 a11y: Add the root object to the cache
Not 100% sure this is necessary, but maybe it helps
to get orca up to speed.
2021-05-03 21:06:36 -04:00
Matthias Clasen 016294ba6e atspicontext: Remove an unused field
We don't make any use of the cache field, so drop it.
2021-05-03 21:06:31 -04:00
Jason Francis b9ce81b912 meson: check for madvise() 2021-05-03 21:06:03 -04:00
Matthew Garrett a9d0563085 gtksecurememory: Request that secure memory not be dumped to disk
Linux 3.4 added support for the MADV_DONTDUMP option to madvise(), which
requests that the covered memory not be included in coredumps. It makes
sense to use this to prevent cases where application crashes could
result in secrets being persisted to disk or included in dumps that are
uploaded to remote servers for analysis. I've avoided making this fatal
since there's a chance this code could be built on systems that have
MADV_DONTDUMP but run on systems that don't.
2021-05-03 21:05:57 -04:00
Matthias Clasen e6bab9b64c placesview: Fix server mount feedback
We weren't properly resetting the in-entry progress.
2021-05-03 21:05:44 -04:00
Matthias Clasen 513aa20f76 placesview: Fix mounting remote locations
This was broken by a stupid copy-paste error.
2021-05-03 21:05:37 -04:00
Matthias Clasen 83b38e55c0 window: Fix deferred focus unsetting
In commit 4a76abffd4, we deferred unsetting focus
and default until after the next draw, overlooking the
case where the focus is set to another widget before we
ever get to the unsetting.

Fixes: #3413
2021-05-03 21:05:14 -04:00
Chun-wei Fan 22b23a6d19 GTK: Fix builds against latest stable GLib with MSVC
GLib-2.68.x now considers warning C4098 ('void' function returning a value) as
an error, so avoid doing that.
2021-05-03 21:05:04 -04:00
Chun-wei Fan 908f5dc142 GSK: Fix builds against latest stable GLib with MSVC
GLib-2.68.x now considers warning C4098 ('void' function returning a value) as
an error, so avoid doing that.
2021-05-03 21:04:58 -04:00
Chun-wei Fan 7ef493ec88 GDK: Fix builds against latest stable GLib with MSVC
GLib-2.68.x now considers warning C4098 ('void' function returning a value) as
an error, so avoid doing that.
2021-05-03 21:04:51 -04:00
Matthias Clasen 6edfd29df0 imcontext: Eat key events during preedit
Avoid passing through random key press or release
events while we are showing preedit. That prevents
'accidents' like typing Ctrl-. bringing up the
Emoji chooser during preedit, or hitting Ctrl-a
after the Compose key moving the 'dot' around in
vim in terminals.
2021-05-03 21:04:38 -04:00
nana-4 eabbc0ef30 theme: Use -gtk-icon-filter for full-color icons
Not for symbolic icons.

Don't apply `-gtk-icon-filter: opacity(0.5);` to the symbolic icons as
they already have the "gray" colors indicating the disabled state.
Symbolic icons can be styled using the `color` property.

Also remove the obsolete comment.
2021-05-03 21:04:26 -04:00
Eli Schwartz bfcd5f4881 meson: only build demo manpages when demos are enabled
Installing them even when manpages are enabled, but the demos are
disabled, produces manpages for unavailable programs...
2021-05-03 21:04:13 -04:00
Matthias Clasen 201fc28a67 x11: Be quiet on exit by default
The condition we check for to catch X servers going away
may not be accurate anymore, and the warning shows up in
logs, causing customers to be concerned. So, be quiet by
default, unless the user explicitly asked for a message.
2021-05-03 21:04:02 -04:00
Ondrej Holy 0026f74dbe placesview: Open location even if mount was not found
Some locations have to be mounted, but their mounts are not user-visible
(e.g. smb-browse). Though this is maybe a bit weird, it is how it works
for years. The problem is that the commit 267ea755, which tries to get the
default location for opening, caused regression as it doesn't expect such
possibility. Before this commit, such locations were opened without any
issue, but nothing happens currently after clicking to "Connect" except of
clearing the "Connect to Server" entry. Let's fallback to the original
location if the mount was not found to fix this regression.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1811
2021-05-03 21:03:56 -04:00
Matthias Clasen d116ba348f ngl: Fix a rare assertion violation
When we clean up the uniform allocations after a frame,
it can happen that our space requirements actually increase,
due to padding that depends on the order of allocations.

Instead of asserting that it doesn't happen, just make
it work by growing our allocation.

Fixes: #3853
2021-05-03 21:03:40 -04:00
Matthias Clasen 06c0012dd4 togglebutton: Fix expected group behavior
The expectation is that a grouped button stays
active when you click it. Grouped check buttons
behave this way, and grouped toggle buttons should
too.
2021-05-03 21:02:53 -04:00
Matthias Clasen 7b84ffd378 icon browser: Make header buttons not steal focus
This is rarely useful, and is confusing when it
happens as side-effect of dragging the window.
2021-05-03 21:02:45 -04:00
Matthias Clasen cc5d2f24e8 widget-factory: Make header buttons not steal focus
This is rarely useful, and is confusing when it
happens as side-effect of dragging the window.
2021-05-03 21:02:38 -04:00
Matthias Clasen c06462aec0 gtk-demo: Make header buttons not steal focus
This is rarely useful, and is confusing when it
happens as side-effect of dragging the window.
2021-05-03 21:02:32 -04:00
Matthias Clasen a4aaab2e5b menubutton: Propagate focus-on-click
Propagate the focus-on-click setting to the button
inside, so that setting menubuttons as !focus-on-click
works as expected. This helps for menubuttons in
header bars, where dragging on the button will otherwise
steal focus from the content.
2021-05-03 21:02:26 -04:00
Matthias Clasen fe237c4030 roundedrect: Speed up contains_rect and friends
gsk_rounded_rect_contains_rect was calling
gsk_rounded_rect_contains_point, which potentially
checks all four corners, for a total of up to 16
corner/point checks. But there is no need to do
more than 4 such checks to answer the question.
2021-05-03 21:02:08 -04:00
Matthias Clasen ff8f32bf10 nodeeditor: Make the help window wide enough
Make the help window wide enough to show the
tables without wrapping.
2021-05-03 21:01:54 -04:00
Matthias Clasen 8a8edde78d media: Fix a memory leak
This was introduced in e7dc82fa32.
2021-05-03 21:01:46 -04:00
Matthias Clasen 3852512446 gsk: Don't overshadow
Reduce the cairo shadows to the same size as their GL brethren.
2021-05-03 21:01:39 -04:00
Matthias Clasen c926f9491a window: Defer focus setting until after paint
Commit 3dbf5038fa tried to defer focus changes
until after rendering is done. But it failed to do so, since
the toplevel ::render handler is still before rendering of
popups that are attached to that toplevel. To do this
properly, we need to do it in the AFTER_PAINT frame clock
phase.

Fixes: #3725
2021-05-03 21:01:28 -04:00
Matthias Clasen 03176fe23c scrolledwindow: Stop using scroll cursors
We used to override cursor to use all-scroll while the
content is being scrolled. Unfortunately, there is several
problems with this:
- It is really only expected certain devices, and we don't
  have the device information on Wayland
- With the way cursor setting works in GTK4, non-NULL cursors
  of the content (eg the text views ibeam) win, making the
  scroll cursor not show up
- Under X11, we seem to miss scroll end events and then
  the scroll cursor gets stuck
Therefore, just remove this feature.
2021-05-03 21:01:13 -04:00
Matthias Clasen d0cb76fff4 ngl: Fix an oversight
All the rest of debug spew goes to stderr here.
2021-05-03 21:00:57 -04:00
Matthias Clasen d76e106382 wayland: Improve font setting fallback more
We may get a response from the portal that contains
no useful settings at all. In that case, we should
fallback as well.

Fixes: #3838
2021-05-03 21:00:32 -04:00
Carlos Garnacho f7ab0b19c7 surface: Always set PHASE_PAINT as pending when updates are scheduled
At times (most often when closing subsurfaces that are scheduling
relayouts) the PHASE_PAINT handling gets broken with the following
sequence:

1. Surface receives wl_callback.done for the previous frame.
   Surface is thawed.
2. A new update on the surface is scheduled. PHASE_PAINT is
   requested directly on the frame clock. priv->pending_phase is
   left unset in the surface.
3. Surface gets frozen
4. Frame clock processes the update scheduled at 2. The surface
   is frozen, so paint is prevented. PHASE_PAINT is considered
   handled.
5. Compositor emits wl_callback.done again. Surface is thawed.
6. At this point the machinery is off
   - The surface didn't paint but has pending update regions
   - priv->draw_needed is set in the toplevel and other portions
     of the widget tree
   - So queueing redraws is ineffective at eventually calling
     gdk_surface_schedule_update() again on the toplevel surface.
   - We don't paint anymore, so this broken state is not flushed
     until other subsurface changes manage to schedule the missing
     update.

To fix this, always set PHASE_PAINT in priv->pending_phase when
doing gdk_surface_schedule_update(). If the frame clock turns
around before the surface is thawed, it will still be waiting to
be processed the next iteration.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3750
2021-05-03 21:00:19 -04:00
Emmanuele Bassi b50df28e38 Install documentation in the appropriate place
We're already installing each reference into its own namespaced
directory, so we don't need to add further path elements.

Additionally, with the changes in:

  https://gitlab.gnome.org/GNOME/devhelp/-/merge_requests/20
  https://gitlab.gnome.org/GNOME/gi-docgen/-/merge_requests/54

we can browse the GTK API references in DevHelp.
2021-05-03 21:00:06 -04:00
Matthias Clasen f97d32e253 wayland: Improve font setting fallback
When we don't get stettings from the portal, the current
fallback is 'awful fonts'. There is no need for that. Instead,
set the fallback values to grayscale antialiasing with slight
hinting.
2021-05-03 20:59:46 -04:00
Matthias Clasen b7a0744324 modelbutton: Avoid a crash
We may not have a popover menu ancestor. The check for
this was forgotten in one of the branches here.

Fixes: #3831
2021-05-03 20:59:32 -04:00
Matthias Clasen 3ef8ff2a43 window: Actually enable the inspector by default
427d216081 changed the default in the schema,
but didn't handle cases where the schema isn't found.
2021-05-03 20:59:25 -04:00
Matthias Clasen b4844e2ace ngl: Fix an oversight
We were special-casing 2D affine transforms,
but overlooked even simpler transforms.
2021-05-03 20:59:16 -04:00
Matthias Clasen 610f5ce75c settings: Make font-size changes apply immediately
We need to invalidate the style when font-size changes,
because we propagate this value through the initial
value of the CSS font-size property, and it will not
be recomputed otherwise.
2021-05-03 20:58:20 -04:00
Matthias Clasen 3c4c7896fc immulticontext: Unset client widget on delegate change
Forgetting to do so was causing the Wayland im context
to leave behind a dead event controller. This was showing
up as a crash when closing the inspector after changing
the im-module property of a GtkText widget. The crash
was delayed until closing the inspector because the
inspector keeps a ref on the event controllers of the
currently shown widget.
2021-05-03 20:58:13 -04:00
Matthias Clasen 686752a852 comboboxtext: Remove misleading docs
The entry is no longer accessible.
The docs were outdated.

Fixes: #3824
2021-05-03 20:57:38 -04:00
Matthias Clasen 8bb1b8da57 ngl: Avoid huge intermediate textures
Instead of rendering the unclipped child to a texture
(and risking blowing the texture size limit, and bad
downscaling), just render the clipped region, and live
with the fact that we can't cache the rendered texture.

This avoid bad artifacts when scrolling long textviews
in rounded clips.
2021-05-03 20:57:16 -04:00
Matthias Clasen 1b81af591d ngl: Plug a memory leak
This was introduced in f9457af128.
2021-05-03 20:57:10 -04:00
Matthias Clasen 88a8287c1d ngl: Fix downscaled textures
It is not pretty, but at least it works now.
2021-05-03 20:57:05 -04:00
Chris Mayo 8cc2dbe6f8 button: Style .keyboard-activating on frameless buttons
The use of the keyboard-activating CSS class for buttons was added
in [1], but the style did not apply to buttons with has-frame=FALSE.

[1] 00923615f4 ("button: Add back visual feedback for keynav", 2021-04-01)
2021-05-03 20:56:56 -04:00
Matthias Clasen aec29503bf fontchooser: Fix initial font selection
The change in 740559a54f to populate the list incrementally
broke initial font selection. Fix that, by trying to select
until the incremental filling is done.

Fixes: #3687
2021-05-03 20:56:36 -04:00
Matthias Clasen 1506a41448 button: Add back visual feedback for keynav
We lost the visual feedback for activating a button
via Space or Enter when the :active pseudo-state became
managed. Bring it back with a style class.

Fixes: #3813
2021-05-03 20:56:01 -04:00
Matthias Clasen 63622923f0 Add one more compose test 2021-05-03 20:55:56 -04:00
Matthias Clasen 59c87b8387 Add more compose tests
Test the sequences whose demise made people
unhappy.
2021-05-03 20:55:46 -04:00
Matthias Clasen fdf71e13c4 Revert Compose sequence changes
This was breaking muscle memory of people with
the us intl keyboard layout, for important keys
such as '. The unfortunate side-effect is that
our handling of <dead_acute> is a bit hampered
by sequences that don't fit the pattern. But
such is life.

Fixes: #3807
2021-05-03 20:55:32 -04:00
Chris Mayo 5d49dabade docs: Escape tags in GtkBuilder description
Fixes the tags and the rest of the gi-docgen created HTML page not being
visible in a browser.
2021-05-03 20:55:24 -04:00
102 changed files with 7256 additions and 6636 deletions
+2 -2
View File
@@ -24,9 +24,9 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v28"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v31"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v27"
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v31"
.only-default:
only:
+76
View File
@@ -1,3 +1,79 @@
Overview of Changes in 4.2.1
============================
* GtkVideo:
- Detect stream metadata when using gstreamer
* GtkFileChooser:
- Fix a crash
* GtkButton:
- Add back visual feedback for keynav activation
* GtkFontChooser:
- Fix initial font selection
* Text widgets:
- Support translucent selections
* GtkScrolledWindow:
- Stop using scroll cursors
* GtkMenuButton:
- Make focus-on-click work
* GtkToggleButton:
- Make grouped buttons mutually exclusive
* GtkPasswordEntry:
- Use MADV_DONTDUMP for secure memory
* GtkListBox:
- Allow repeated selection extension for MULTIPLE
* Themes:
- Fix resize border sizing
- Fix solid-csd window decorations
* Input:
- Revert some Compose sequence changes (mainly around dead
acute and apostrophe)
- Consume all key events during preedit, to avoid unexpected
interactions
- Ignore more modifiers during preedit, to allow using 3rd and
5th level choosers
- Fix handling of cursor positions in non-ASCII preedit text
- Fix a problem with deferred focus setting
* GdkClipboard:
- Ensure strings are nul-terminated
* GSK:
- Improvements to the ngl renderer
- Fix offscreen rendering with transforms
- Fix downscaled textures
- Avoid huge intermediate textures
- Make shadow rendering match across renderers
* Accessibility:
- Various fixes to get Orca to speak (still a work in progress)
* Wayland:
- Improve font settings fallback
- Avoid unintentional rendering freezes with popovers
* X11:
- Don't beep on untrusted displays
- Don't crash when popovers are outside the workarea
* Windows:
- Fix using GL rendering with Mesa drivers
* Inspector:
- Enable the inspector by default, in all cases
- Improve monitor information
Overview of Changes in 4.2.0
============================
+3
View File
@@ -76,6 +76,9 @@
/* Define to 1 if you have a working `mmap' system call. */
#mesondefine HAVE_MMAP
/* Define to 1 if you have a working `madvise' system call. */
#mesondefine HAVE_MADVISE
/* Define to 1 if you have the `posix_fallocate' function. */
#mesondefine HAVE_POSIX_FALLOCATE
+3
View File
@@ -25,6 +25,7 @@
<object class="GtkButton">
<property name="valign">center</property>
<property name="action-name">win.run</property>
<property name="focus-on-click">0</property>
<property name="label" translatable="yes">Run</property>
</object>
</child>
@@ -32,6 +33,7 @@
<object class="GtkToggleButton">
<property name="icon-name">edit-find-symbolic</property>
<property name="valign">center</property>
<property name="focus-on-click">0</property>
<property name="active" bind-source="searchbar" bind-property="search-mode-enabled" bind-flags="bidirectional|sync-create"/>
<accessibility>
<property name="label" translatable="yes">Search</property>
@@ -41,6 +43,7 @@
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="valign">center</property>
<property name="focus-on-click">0</property>
<property name="menu-model">gear_menu</property>
<property name="icon-name">open-menu-symbolic</property>
<accessibility>
+4
View File
@@ -25,12 +25,14 @@
</style>
<child>
<object class="GtkToggleButton" id="normal_radio">
<property name="focus-on-click">0</property>
<property name="label" translatable="yes">Normal</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="symbolic_radio">
<property name="focus-on-click">0</property>
<property name="label" translatable="yes">Symbolic</property>
<property name="group">normal_radio</property>
<signal name="notify::active" handler="symbolic_toggled" swapped="yes" after="yes"/>
@@ -40,6 +42,7 @@
</child>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="focus-on-click">0</property>
<property name="valign">center</property>
<property name="menu-model">gear_menu</property>
<property name="icon-name">open-menu-symbolic</property>
@@ -47,6 +50,7 @@
</child>
<child type="end">
<object class="GtkToggleButton" id="search">
<property name="focus-on-click">0</property>
<style>
<class name="image-button"/>
</style>
+2 -2
View File
@@ -2,8 +2,8 @@
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Help</property>
<property name="default-width">720</property>
<property name="default-height">520</property>
<property name="default-width">920</property>
<property name="default-height">600</property>
<child>
<object class="GtkScrolledWindow">
<child>
+1
View File
@@ -438,6 +438,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="valign">center</property>
<property name="focus-on-click">0</property>
<property name="popover">
<object class="GtkPopoverMenu" id="gear_menu">
<property name="menu-model">gear_menu_model</property>
+6
View File
@@ -21,3 +21,9 @@ show_index_summary = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
content_images = [
"images/gtk-logo.svg",
]
urlmap_file = "urlmap.js"
+6
View File
@@ -21,3 +21,9 @@ show_index_summary = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
content_images = [
"images/gtk-logo.svg",
]
urlmap_file = "urlmap.js"
+9 -4
View File
@@ -70,16 +70,21 @@ if get_option('man-pages') and xsltproc.found()
man_files = [
[ 'gtk4-broadwayd', '1', ],
[ 'gtk4-builder-tool', '1', ],
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-icon-browser', '1', ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-settings', '1', ],
[ 'gtk4-update-icon-cache', '1', ],
[ 'gtk4-widget-factory', '1', ],
]
if get_option('demos')
man_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
[ 'gtk4-icon-browser', '1', ],
]
endif
foreach man: man_files
man_name = man.get(0)
man_section = man.get(1, '1')
+2 -2
View File
@@ -271,7 +271,7 @@ holds a reference on them, and GTK holds a reference on toplevel windows.
and cause the whole widget hierarchy to be finalized unless there are other
references that keep widgets alive.
The [signals@Gtk.Widget::destroy] signal is emitted when a widget is
The [signal@Gtk.Widget::destroy] signal is emitted when a widget is
disposed, and therefore can no longer be used to break reference cycles. A
typical sign of a reference cycle involving a toplevel window is when
closing the window does not make the application quit.
@@ -555,7 +555,7 @@ for you, so templates work like before.
A few changes to the event controller and [class@Gtk.Gesture] APIs
did not make it back to GTK 3, and have to be taken into account
when moving to GTK 4. One is that the [signal@Gtk.EventControllerMotion::enter]
and [signals@Gtk.EventControllerMotion::leave] signals have gained new arguments.
and [signal@Gtk.EventControllerMotion::leave] signals have gained new arguments.
Another is that `GtkGestureMultiPress` has been renamed to [class@Gtk.GestureClick],
and has lost its area property. A [class@Gtk.EventControllerFocus] has been
split off from [class@Gtk.EventControllerKey].
+1 -1
View File
@@ -3,7 +3,7 @@ toml_conf.set('version', meson.project_version())
gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
docs_dir = gtk_datadir / 'doc/gtk4/reference'
docs_dir = gtk_datadir / 'doc'
subdir('gdk')
subdir('gsk')
+11 -11
View File
@@ -554,19 +554,19 @@ gdk_clipboard_store_async (GdkClipboard *clipboard,
if (priv->local)
{
return GDK_CLIPBOARD_GET_CLASS (clipboard)->store_async (clipboard,
io_priority,
cancellable,
callback,
user_data);
GDK_CLIPBOARD_GET_CLASS (clipboard)->store_async (clipboard,
io_priority,
cancellable,
callback,
user_data);
}
else
{
return gdk_clipboard_store_default_async (clipboard,
io_priority,
cancellable,
callback,
user_data);
gdk_clipboard_store_default_async (clipboard,
io_priority,
cancellable,
callback,
user_data);
}
}
@@ -905,7 +905,7 @@ gdk_clipboard_read_value_finish (GdkClipboard *clipboard,
* call [method@Gdk.Clipboard.read_texture_finish] to get the result.
*
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
* Use that function or [methos@Gdk.Clipboard.read_async] directly if you
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
* need more control over the operation.
*/
void
+16 -6
View File
@@ -672,9 +672,18 @@ string_deserializer_finish (GObject *source,
}
else
{
GOutputStream *mem_stream = g_filter_output_stream_get_base_stream (G_FILTER_OUTPUT_STREAM (stream));
/* write a terminating NULL byte */
if (g_output_stream_write (mem_stream, "", 1, NULL, &error) < 0 ||
!g_output_stream_close (mem_stream, NULL, &error))
{
gdk_content_deserializer_return_error (deserializer, error);
return;
}
g_value_take_string (gdk_content_deserializer_get_value (deserializer),
g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (
g_filter_output_stream_get_base_stream (G_FILTER_OUTPUT_STREAM (stream)))));
g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (mem_stream)));
}
gdk_content_deserializer_return_success (deserializer);
}
@@ -703,7 +712,7 @@ string_deserializer (GdkContentDeserializer *deserializer)
g_output_stream_splice_async (filter,
gdk_content_deserializer_get_input_stream (deserializer),
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
gdk_content_deserializer_get_priority (deserializer),
gdk_content_deserializer_get_cancellable (deserializer),
string_deserializer_finish,
@@ -731,7 +740,8 @@ file_uri_deserializer_finish (GObject *source,
}
/* write terminating NULL */
if (!g_output_stream_write (stream, "", 1, NULL, &error))
if (g_output_stream_write (stream, "", 1, NULL, &error) < 0 ||
!g_output_stream_close (stream, NULL, &error))
{
gdk_content_deserializer_return_error (deserializer, error);
return;
@@ -771,7 +781,7 @@ file_uri_deserializer (GdkContentDeserializer *deserializer)
g_output_stream_splice_async (output,
gdk_content_deserializer_get_input_stream (deserializer),
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
gdk_content_deserializer_get_priority (deserializer),
gdk_content_deserializer_get_cancellable (deserializer),
file_uri_deserializer_finish,
@@ -921,7 +931,7 @@ init (void)
gdk_content_register_deserializer (mime,
G_TYPE_STRING,
string_deserializer,
mime,
(gpointer) charset,
g_free);
}
gdk_content_register_deserializer ("text/plain",
+3 -3
View File
@@ -461,7 +461,7 @@ gdk_content_formats_contain_mime_type (const GdkContentFormats *formats,
* Note that @formats may not contain any #GTypes, in particular when
* they are empty. In that case %NULL will be returned.
*
* Returns: (transfer none) (nullable) (array length=n_gtypes):
* Returns: (transfer none) (nullable) (array length=n_gtypes zero-terminated=1):
* %G_TYPE_INVALID-terminated array of types included in @formats or
* %NULL if none.
*/
@@ -480,7 +480,7 @@ gdk_content_formats_get_gtypes (const GdkContentFormats *formats,
/**
* gdk_content_formats_get_mime_types:
* @formats: a `GdkContentFormats`
* @n_mime_types: (out) (allow-none): optional pointer to take the
* @n_mime_types: (out) (optional): optional pointer to take the
* number of mime types contained in the return value
*
* Gets the mime types included in @formats.
@@ -488,7 +488,7 @@ gdk_content_formats_get_gtypes (const GdkContentFormats *formats,
* Note that @formats may not contain any mime types, in particular
* when they are empty. In that case %NULL will be returned.
*
* Returns: (transfer none) (nullable): %NULL-terminated array of
* Returns: (transfer none) (nullable) (array length=n_mime_types zero-terminated=1): %NULL-terminated array of
* interned strings of mime types included in @formats or %NULL
* if none.
*/
+2 -2
View File
@@ -377,7 +377,7 @@ gdk_content_provider_attach_clipboard (GdkContentProvider *provider,
g_return_if_fail (GDK_IS_CONTENT_PROVIDER (provider));
g_return_if_fail (GDK_IS_CLIPBOARD (clipboard));
return GDK_CONTENT_PROVIDER_GET_CLASS (provider)->attach_clipboard (provider, clipboard);
GDK_CONTENT_PROVIDER_GET_CLASS (provider)->attach_clipboard (provider, clipboard);
}
void
@@ -387,5 +387,5 @@ gdk_content_provider_detach_clipboard (GdkContentProvider *provider,
g_return_if_fail (GDK_IS_CONTENT_PROVIDER (provider));
g_return_if_fail (GDK_IS_CLIPBOARD (clipboard));
return GDK_CONTENT_PROVIDER_GET_CLASS (provider)->detach_clipboard (provider, clipboard);
GDK_CONTENT_PROVIDER_GET_CLASS (provider)->detach_clipboard (provider, clipboard);
}
+1 -1
View File
@@ -51,7 +51,7 @@
* `GdkFrameClock` class for documentation of the phases.
* %GDK_FRAME_CLOCK_PHASE_UPDATE and the [signal@GdkFrameClock::update] signal
* are most interesting for application writers, and are used to update the
* animations, using the frame time given by [metohd@Gdk.FrameClock.get_frame_time].
* animations, using the frame time given by [method@Gdk.FrameClock.get_frame_time].
*
* The frame time is reported in microseconds and generally in the same
* timescale as g_get_monotonic_time(), however, it is not the same
+1 -1
View File
@@ -26,7 +26,7 @@
* GdkPopupLayout:
*
* The `GdkPopupLayout` struct contains information that is
* necessary position a [interface@Gdk.Popup] relative to its parent.
* necessary position a [iface@Gdk.Popup] relative to its parent.
*
* The positioning requires a negotiation with the windowing system,
* since it depends on external constraints, such as the position of
+10 -4
View File
@@ -1299,12 +1299,11 @@ gdk_surface_schedule_update (GdkSurface *surface)
g_return_if_fail (surface);
surface->pending_phases |= GDK_FRAME_CLOCK_PHASE_PAINT;
if (surface->update_freeze_count ||
gdk_surface_is_toplevel_frozen (surface))
{
surface->pending_phases |= GDK_FRAME_CLOCK_PHASE_PAINT;
return;
}
return;
/* If there's no frame clock (a foreign surface), then the invalid
* region will just stick around unless gdk_surface_process_updates()
@@ -2444,6 +2443,7 @@ gdk_surface_ensure_motion (GdkSurface *surface)
GdkEvent *event;
double x, y;
GdkModifierType state;
GdkSurface *grab_surface;
if (!surface->request_motion)
return;
@@ -2460,6 +2460,12 @@ gdk_surface_ensure_motion (GdkSurface *surface)
if (!gdk_surface_get_device_position (surface, device, &x, &y, &state))
return;
if (gdk_device_grab_info (display, device, &grab_surface, NULL))
{
if (grab_surface != surface)
return;
}
event = gdk_motion_event_new (surface,
device,
NULL,
+1 -1
View File
@@ -446,7 +446,7 @@ gdk_texture_download_area (GdkTexture *texture,
g_assert (area->x + area->width <= texture->width);
g_assert (area->y + area->height <= texture->height);
return GDK_TEXTURE_GET_CLASS (texture)->download (texture, area, data, stride);
GDK_TEXTURE_GET_CLASS (texture)->download (texture, area, data, stride);
}
/**
+1 -1
View File
@@ -364,7 +364,7 @@ gdk_toplevel_focus (GdkToplevel *toplevel,
{
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
return GDK_TOPLEVEL_GET_IFACE (toplevel)->focus (toplevel, timestamp);
GDK_TOPLEVEL_GET_IFACE (toplevel)->focus (toplevel, timestamp);
}
/**
+1
View File
@@ -145,6 +145,7 @@ ensure_gl_view (GdkMacosGLContext *self)
[nsview setPostsFrameChangedNotifications: YES];
[nsview setNeedsDisplay:YES];
[nswindow setContentView:nsview];
[nswindow makeFirstResponder:nsview];
[nsview release];
if (self->dummy_view != NULL)
-1
View File
@@ -32,7 +32,6 @@
#include <string.h>
#include <stdlib.h>
#define HAVE_MEMFD_CREATE
#ifdef HAVE_MEMFD_CREATE
#include <sys/mman.h>
#endif
+5 -1
View File
@@ -1518,6 +1518,7 @@ pointer_handle_leave (void *data,
GdkWaylandSeat *seat = data;
GdkEvent *event;
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
GdkDeviceGrabInfo *grab;
if (!surface)
return;
@@ -1529,8 +1530,11 @@ pointer_handle_leave (void *data,
return;
_gdk_wayland_display_update_serial (display_wayland, serial);
grab = _gdk_display_get_last_device_grab (seat->display,
seat->logical_pointer);
if (seat->pointer_info.button_modifiers != 0)
if (seat->pointer_info.button_modifiers != 0 &&
grab && grab->implicit)
{
gulong display_serial;
+32 -120
View File
@@ -256,122 +256,23 @@ postpone_on_globals_closure (GdkWaylandDisplay *display_wayland,
#ifdef G_ENABLE_DEBUG
static const char *
get_format_name (enum wl_shm_format format)
get_format_name (uint32_t format,
char name[10])
{
int i;
#define FORMAT(s) { WL_SHM_FORMAT_ ## s, #s }
struct { int format; const char *name; } formats[] = {
FORMAT(ARGB8888),
FORMAT(XRGB8888),
FORMAT(C8),
FORMAT(RGB332),
FORMAT(BGR233),
FORMAT(XRGB4444),
FORMAT(XBGR4444),
FORMAT(RGBX4444),
FORMAT(BGRX4444),
FORMAT(ARGB4444),
FORMAT(ABGR4444),
FORMAT(RGBA4444),
FORMAT(BGRA4444),
FORMAT(XRGB1555),
FORMAT(XBGR1555),
FORMAT(RGBX5551),
FORMAT(BGRX5551),
FORMAT(ARGB1555),
FORMAT(ABGR1555),
FORMAT(RGBA5551),
FORMAT(BGRA5551),
FORMAT(RGB565),
FORMAT(BGR565),
FORMAT(RGB888),
FORMAT(BGR888),
FORMAT(XBGR8888),
FORMAT(RGBX8888),
FORMAT(BGRX8888),
FORMAT(ABGR8888),
FORMAT(RGBA8888),
FORMAT(BGRA8888),
FORMAT(XRGB2101010),
FORMAT(XBGR2101010),
FORMAT(RGBX1010102),
FORMAT(BGRX1010102),
FORMAT(ARGB2101010),
FORMAT(ABGR2101010),
FORMAT(RGBA1010102),
FORMAT(BGRA1010102),
FORMAT(YUYV),
FORMAT(YVYU),
FORMAT(UYVY),
FORMAT(VYUY),
FORMAT(AYUV),
FORMAT(NV12),
FORMAT(NV21),
FORMAT(NV16),
FORMAT(NV61),
FORMAT(YUV410),
FORMAT(YVU410),
FORMAT(YUV411),
FORMAT(YVU411),
FORMAT(YUV420),
FORMAT(YVU420),
FORMAT(YUV422),
FORMAT(YVU422),
FORMAT(YUV444),
FORMAT(YVU444),
FORMAT(R8),
FORMAT(R16),
FORMAT(RG88),
FORMAT(GR88),
FORMAT(RG1616),
FORMAT(GR1616),
FORMAT(XRGB16161616F),
FORMAT(XBGR16161616F),
FORMAT(ARGB16161616F),
FORMAT(ABGR16161616F),
FORMAT(XYUV8888),
FORMAT(VUY888),
FORMAT(VUY101010),
FORMAT(Y210),
FORMAT(Y212),
FORMAT(Y216),
FORMAT(Y410),
FORMAT(Y412),
FORMAT(Y416),
FORMAT(XVYU12_16161616),
FORMAT(XVYU16161616),
FORMAT(Y0L0),
FORMAT(X0L0),
FORMAT(Y0L2),
FORMAT(X0L2),
FORMAT(YUV420_8BIT),
FORMAT(YUV420_10BIT),
FORMAT(XRGB8888_A8),
FORMAT(XBGR8888_A8),
FORMAT(RGBX8888_A8),
FORMAT(BGRX8888_A8),
FORMAT(RGB888_A8),
FORMAT(BGR888_A8),
FORMAT(RGB565_A8),
FORMAT(BGR565_A8),
FORMAT(NV24),
FORMAT(NV42),
FORMAT(P210),
FORMAT(P010),
FORMAT(P012),
FORMAT(P016),
if (format == 0)
g_strlcpy (name, "ARGB8888", 10);
else if (format == 1)
g_strlcpy (name, "XRGB8888", 10);
else
g_snprintf (name, 10, "4cc %c%c%c%c",
(char) (format & 0xff),
(char) ((format >> 8) & 0xff),
(char) ((format >> 16) & 0xff),
(char) ((format >> 24) & 0xff));
{ 0xffffffff, NULL }
};
#undef FORMAT
for (i = 0; formats[i].name; i++)
{
if (formats[i].format == format)
return formats[i].name;
}
return NULL;
return name;
}
#endif
static void
@@ -379,7 +280,10 @@ wl_shm_format (void *data,
struct wl_shm *wl_shm,
uint32_t format)
{
GDK_NOTE (MISC, g_message ("supported pixel format %s", get_format_name (format)));
GDK_NOTE (MISC,
char buf[10];
g_message ("supported pixel format %s", get_format_name (format, buf));
);
}
static const struct wl_shm_listener wl_shm_listener = {
@@ -1708,13 +1612,13 @@ static TranslationEntry translations[] = {
{ FALSE, "org.gnome.desktop.privacy", "recent-files-max-age", "gtk-recent-files-max-age", G_TYPE_INT, { .i = 30 } },
{ FALSE, "org.gnome.desktop.privacy", "remember-recent-files", "gtk-recent-files-enabled", G_TYPE_BOOLEAN, { .b = TRUE } },
{ FALSE, "org.gnome.desktop.wm.preferences", "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
{ FALSE, "org.gnome.desktop.interface", "font-antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "font-antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "text-scaling-factor", "gtk-xft-dpi" , G_TYPE_NONE, { .i = 0 } }, /* We store the factor as 16.16 */
{ FALSE, "org.gnome.desktop.wm.preferences", "action-double-click-titlebar", "gtk-titlebar-double-click", G_TYPE_STRING, { .s = "toggle-maximize" } },
@@ -1917,6 +1821,14 @@ init_settings (GdkDisplay *display)
g_variant_get (ret, "(a{sa{sv}})", &iter);
if (g_variant_n_children (ret) == 0)
{
g_debug ("Received no portal settings");
g_clear_pointer (&ret, g_variant_unref);
goto fallback;
}
while (g_variant_iter_loop (iter, "{s@a{sv}}", &schema_str, &val))
{
GVariantIter *iter2 = g_variant_iter_new (val);
+1 -1
View File
@@ -58,7 +58,7 @@
*
* The Wayland implementation of `GdkToplevel`.
*
* Beyond the [interface@Gdk.Toplevel] API, the Wayland implementation
* Beyond the [iface@Gdk.Toplevel] API, the Wayland implementation
* has API to set up cross-process parent-child relationships between
* surfaces with [method@GdkWayland.WaylandToplevel.export_handle] and
* [method@GdkWayland.WaylandToplevel.set_transient_for_exported].
+2 -2
View File
@@ -2345,8 +2345,8 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
state = gdk_event_get_modifier_state (event);
gdk_event_get_position (event, &x, &y);
x_root = x + _gdk_offset_x;
y_root = y + _gdk_offset_y;
x_root = event->surface->x + x;
y_root = event->surface->y + y;
if (drag_win32->drag_surface)
move_drag_surface (drag, x_root, y_root);
-1
View File
@@ -2343,7 +2343,6 @@ gdk_event_translate (MSG *msg,
current_root_x = (msg->pt.x + _gdk_offset_x) / impl->surface_scale;
current_root_y = (msg->pt.y + _gdk_offset_y) / impl->surface_scale;
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
gdk_win32_surface_do_move_resize_drag (window, current_root_x, current_root_y);
else if (_gdk_input_ignore_core == 0)
+18 -8
View File
@@ -712,20 +712,30 @@ _set_pixformat_for_hdc (HDC hdc,
int *best_idx,
GdkWin32Display *display)
{
PIXELFORMATDESCRIPTOR pfd;
gboolean set_pixel_format_result = FALSE;
gboolean already_checked = TRUE;
*best_idx = GetPixelFormat (hdc);
/* one is only allowed to call SetPixelFormat(), and so ChoosePixelFormat()
* one single time per window HDC
*/
*best_idx = _get_wgl_pfd (hdc, &pfd, display);
if (*best_idx == 0)
{
PIXELFORMATDESCRIPTOR pfd;
gboolean set_pixel_format_result = FALSE;
if (*best_idx != 0)
set_pixel_format_result = SetPixelFormat (hdc, *best_idx, &pfd);
GDK_NOTE (OPENGL, g_print ("requesting pixel format...\n"));
already_checked = FALSE;
*best_idx = _get_wgl_pfd (hdc, &pfd, display);
/* ChoosePixelFormat() or SetPixelFormat() failed, bail out */
if (*best_idx == 0 || !set_pixel_format_result)
return FALSE;
if (*best_idx != 0)
set_pixel_format_result = SetPixelFormat (hdc, *best_idx, &pfd);
/* ChoosePixelFormat() or SetPixelFormat() failed, bail out */
if (*best_idx == 0 || !set_pixel_format_result)
return FALSE;
}
GDK_NOTE (OPENGL, g_print ("%s""requested and set pixel format: %d\n", already_checked ? "already " : "", *best_idx));
return TRUE;
}
+30 -21
View File
@@ -1227,6 +1227,7 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
&shadow_right,
&shadow_top,
&shadow_bottom);
gdk_win32_surface_set_shadow_width (surface,
shadow_left,
shadow_right,
@@ -1236,10 +1237,10 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
gdk_surface_layout_popup_helper (surface,
width,
height,
impl->shadow.left,
impl->shadow.right,
impl->shadow.top,
impl->shadow.bottom,
shadow_left,
shadow_right,
shadow_top,
shadow_bottom,
monitor,
&bounds,
layout,
@@ -1259,9 +1260,7 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
final_rect.height);
}
else
{
gdk_win32_surface_move (surface, x, y);
}
gdk_win32_surface_move (surface, x, y);
}
static void
@@ -4415,9 +4414,9 @@ gdk_win32_surface_set_shadow_width (GdkSurface *window,
if (impl->zero_shadow)
return;
impl->shadow.left = left;
impl->shadow.left = left * impl->surface_scale;;
impl->shadow.right = right * impl->surface_scale;
impl->shadow.top = top;
impl->shadow.top = top * impl->surface_scale;;
impl->shadow.bottom = bottom * impl->surface_scale;
impl->shadow_x = left + right;
impl->shadow_y = top + bottom;
@@ -4553,7 +4552,7 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
int scale = impl->surface_scale;
RECT rect;
if (GDK_IS_TOPLEVEL (surface) && impl->drag_move_resize_context.native_move_resize_pending)
if (impl->drag_move_resize_context.native_move_resize_pending)
{
surface->width = impl->next_layout.configured_width;
surface->height = impl->next_layout.configured_height;
@@ -4564,8 +4563,18 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
impl->next_layout.configured_width = (rect.right - rect.left + scale - 1) / scale;
impl->next_layout.configured_height = (rect.bottom - rect.top + scale - 1) / scale;
surface->x = rect.left / scale;
surface->y = rect.top / scale;
if (GDK_IS_TOPLEVEL (surface))
{
surface->x = rect.left / scale;
surface->y = rect.top / scale;
}
else if (GDK_IS_POPUP (surface))
{
gdk_win32_surface_get_geometry (surface,
&surface->x, &surface->y,
NULL, NULL);
}
}
}
@@ -4655,9 +4664,9 @@ gdk_win32_popup_init (GdkWin32Popup *popup)
static void
gdk_win32_popup_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdkSurface *surface = GDK_SURFACE (object);
@@ -4679,9 +4688,9 @@ gdk_win32_popup_get_property (GObject *object,
static void
gdk_win32_popup_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GdkSurface *surface = GDK_SURFACE (object);
@@ -4716,9 +4725,9 @@ gdk_win32_popup_class_init (GdkWin32PopupClass *class)
static gboolean
gdk_win32_popup_present (GdkPopup *popup,
int width,
int height,
GdkPopupLayout *layout)
int width,
int height,
GdkPopupLayout *layout)
{
return gdk_win32_surface_present_popup (GDK_SURFACE (popup), width, height, layout);
}
+3
View File
@@ -45,6 +45,9 @@ get_display_name (GFile *file,
if (name == NULL)
{
name = g_file_get_basename (file);
if (name == NULL)
name = g_file_get_uri (file);
if (!g_utf8_validate (name, -1, NULL))
{
tmp = name;
+3
View File
@@ -1795,6 +1795,9 @@ _gdk_x11_display_update_grab_info_ungrab (GdkDisplay *display,
static void
gdk_x11_display_beep (GdkDisplay *display)
{
if (!GDK_X11_DISPLAY (display)->trusted_client)
return;
#ifdef HAVE_XKB
XkbBell (GDK_DISPLAY_XDISPLAY (display), None, 0, None);
#else
+6 -17
View File
@@ -185,24 +185,13 @@ gdk_x_io_error (Display *display)
/* This is basically modelled after the code in XLib. We need
* an explicit error handler here, so we can disable our atexit()
* which would otherwise cause a nice segfault.
* We fprintf(stderr, instead of g_warning() because g_warning()
* could possibly be redirected to a dialog
* We g_debug() instead of g_warning(), because g_warning()
* could possibly be redirected to the log
*/
if (errno == EPIPE)
{
g_message ("The application '%s' lost its connection to the display %s;\n"
"most likely the X server was shut down or you killed/destroyed\n"
"the application.\n",
g_get_prgname (),
display ? DisplayString (display) : NULL);
}
else
{
g_message ("%s: Fatal IO error %d (%s) on X server %s.\n",
g_get_prgname (),
errno, g_strerror (errno),
display ? DisplayString (display) : NULL);
}
g_debug ("%s: Fatal IO error %d (%s) on X server %s.\n",
g_get_prgname (),
errno, g_strerror (errno),
display ? DisplayString (display) : "");
_exit (1);
}
+13 -2
View File
@@ -1822,9 +1822,16 @@ gdk_x11_surface_layout_popup (GdkSurface *surface,
monitor = gdk_surface_get_layout_monitor (surface, layout,
gdk_x11_monitor_get_workarea);
gdk_x11_monitor_get_workarea (monitor, &bounds);
if (monitor)
gdk_x11_monitor_get_workarea (monitor, &bounds);
else
{
monitor = gdk_surface_get_layout_monitor (surface, layout,
gdk_monitor_get_geometry);
gdk_monitor_get_geometry (monitor, &bounds);
}
gdk_popup_layout_get_shadow_width (layout,
gdk_popup_layout_get_shadow_width (layout,
&impl->shadow_left,
&impl->shadow_right,
&impl->shadow_top,
@@ -4367,6 +4374,7 @@ create_moveresize_surface (MoveResizeData *mv_resize,
NULL,
-100, -100, 1, 1);
gdk_surface_set_is_mapped (mv_resize->moveresize_emulation_surface, TRUE);
gdk_x11_surface_show (mv_resize->moveresize_emulation_surface, FALSE);
status = gdk_seat_grab (gdk_device_get_seat (mv_resize->device),
@@ -4542,6 +4550,9 @@ gdk_x11_surface_beep (GdkSurface *surface)
display = GDK_SURFACE_DISPLAY (surface);
if (!GDK_X11_DISPLAY (display)->trusted_client)
return FALSE;
#ifdef HAVE_XKB
if (GDK_X11_DISPLAY (display)->use_xkb)
{
+7 -7
View File
@@ -549,14 +549,14 @@ gsk_render_node_diff (GskRenderNode *node1,
return;
if (_gsk_render_node_get_node_type (node1) == _gsk_render_node_get_node_type (node2))
return GSK_RENDER_NODE_GET_CLASS (node1)->diff (node1, node2, region);
GSK_RENDER_NODE_GET_CLASS (node1)->diff (node1, node2, region);
if (_gsk_render_node_get_node_type (node1) == GSK_CONTAINER_NODE)
return gsk_container_node_diff_with (node1, node2, region);
if (_gsk_render_node_get_node_type (node2) == GSK_CONTAINER_NODE)
return gsk_container_node_diff_with (node2, node1, region);
return gsk_render_node_diff_impossible (node1, node2, region);
else if (_gsk_render_node_get_node_type (node1) == GSK_CONTAINER_NODE)
gsk_container_node_diff_with (node1, node2, region);
else if (_gsk_render_node_get_node_type (node2) == GSK_CONTAINER_NODE)
gsk_container_node_diff_with (node2, node1, region);
else
gsk_render_node_diff_impossible (node1, node2, region);
}
/**
+18 -12
View File
@@ -1867,6 +1867,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
GskRoundedRect box, clip_box;
int clip_radius;
double x1c, y1c, x2c, y2c;
double blur_radius;
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (&self->color))
@@ -1876,7 +1877,9 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
if (!gsk_rounded_rect_intersects_rect (&self->outline, &GRAPHENE_RECT_INIT (x1c, y1c, x2c - x1c, y2c - y1c)))
return;
clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius);
blur_radius = self->blur_radius / 2;
clip_radius = gsk_cairo_blur_compute_pixels (blur_radius);
cairo_save (cr);
@@ -1890,8 +1893,8 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
gsk_rounded_rect_init_copy (&clip_box, &self->outline);
gsk_rounded_rect_shrink (&clip_box, -clip_radius, -clip_radius, -clip_radius, -clip_radius);
if (!needs_blur (self->blur_radius))
draw_shadow (cr, TRUE, &box, &clip_box, self->blur_radius, &self->color, GSK_BLUR_NONE);
if (!needs_blur (blur_radius))
draw_shadow (cr, TRUE, &box, &clip_box, blur_radius, &self->color, GSK_BLUR_NONE);
else
{
cairo_region_t *remaining;
@@ -1922,7 +1925,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
/* Always clip with remaining to ensure we never draw any area twice */
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
draw_shadow_corner (cr, TRUE, &box, &clip_box, self->blur_radius, &self->color, i, &r);
draw_shadow_corner (cr, TRUE, &box, &clip_box, blur_radius, &self->color, i, &r);
cairo_restore (cr);
/* We drew the region, remove it from remaining */
@@ -1936,7 +1939,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
/* Always clip with remaining to ensure we never draw any area twice */
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
draw_shadow_side (cr, TRUE, &box, &clip_box, self->blur_radius, &self->color, i, &r);
draw_shadow_side (cr, TRUE, &box, &clip_box, blur_radius, &self->color, i, &r);
cairo_restore (cr);
/* We drew the region, remove it from remaining */
@@ -1948,7 +1951,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
cairo_save (cr);
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
draw_shadow (cr, TRUE, &box, &clip_box, self->blur_radius, &self->color, GSK_BLUR_NONE);
draw_shadow (cr, TRUE, &box, &clip_box, blur_radius, &self->color, GSK_BLUR_NONE);
cairo_restore (cr);
cairo_region_destroy (remaining);
@@ -2159,6 +2162,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
int clip_radius;
double x1c, y1c, x2c, y2c;
float top, right, bottom, left;
double blur_radius;
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (&self->color))
@@ -2168,7 +2172,9 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
if (gsk_rounded_rect_contains_rect (&self->outline, &GRAPHENE_RECT_INIT (x1c, y1c, x2c - x1c, y2c - y1c)))
return;
clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius);
blur_radius = self->blur_radius / 2;
clip_radius = gsk_cairo_blur_compute_pixels (blur_radius);
cairo_save (cr);
@@ -2186,8 +2192,8 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
gsk_rounded_rect_offset (&box, self->dx, self->dy);
gsk_rounded_rect_shrink (&box, -self->spread, -self->spread, -self->spread, -self->spread);
if (!needs_blur (self->blur_radius))
draw_shadow (cr, FALSE, &box, &clip_box, self->blur_radius, &self->color, GSK_BLUR_NONE);
if (!needs_blur (blur_radius))
draw_shadow (cr, FALSE, &box, &clip_box, blur_radius, &self->color, GSK_BLUR_NONE);
else
{
int i;
@@ -2217,7 +2223,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
/* Always clip with remaining to ensure we never draw any area twice */
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
draw_shadow_corner (cr, FALSE, &box, &clip_box, self->blur_radius, &self->color, i, &r);
draw_shadow_corner (cr, FALSE, &box, &clip_box, blur_radius, &self->color, i, &r);
cairo_restore (cr);
/* We drew the region, remove it from remaining */
@@ -2231,7 +2237,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
/* Always clip with remaining to ensure we never draw any area twice */
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
draw_shadow_side (cr, FALSE, &box, &clip_box, self->blur_radius, &self->color, i, &r);
draw_shadow_side (cr, FALSE, &box, &clip_box, blur_radius, &self->color, i, &r);
cairo_restore (cr);
/* We drew the region, remove it from remaining */
@@ -2243,7 +2249,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
cairo_save (cr);
gdk_cairo_region (cr, remaining);
cairo_clip (cr);
draw_shadow (cr, FALSE, &box, &clip_box, self->blur_radius, &self->color, GSK_BLUR_NONE);
draw_shadow (cr, FALSE, &box, &clip_box, blur_radius, &self->color, GSK_BLUR_NONE);
cairo_restore (cr);
cairo_region_destroy (remaining);
+77 -51
View File
@@ -203,7 +203,7 @@ gsk_rounded_rect_offset (GskRoundedRect *self,
return self;
}
static void
static inline void
border_radius_shrink (graphene_size_t *corner,
double width,
double height,
@@ -252,26 +252,29 @@ gsk_rounded_rect_shrink (GskRoundedRect *self,
float bottom,
float left)
{
if (self->bounds.size.width - left - right < 0)
float width = left + right;
float height = top + bottom;
if (self->bounds.size.width - width < 0)
{
self->bounds.origin.x += left * self->bounds.size.width / (left + right);
self->bounds.origin.x += left * self->bounds.size.width / width;
self->bounds.size.width = 0;
}
else
{
self->bounds.origin.x += left;
self->bounds.size.width -= left + right;
self->bounds.size.width -= width;
}
if (self->bounds.size.height - bottom - top < 0)
if (self->bounds.size.height - height < 0)
{
self->bounds.origin.y += top * self->bounds.size.height / (top + bottom);
self->bounds.origin.y += top * self->bounds.size.height / height;
self->bounds.size.height = 0;
}
else
{
self->bounds.origin.y += top;
self->bounds.size.height -= top + bottom;
self->bounds.size.height -= height;
}
border_radius_shrink (&self->corner[GSK_CORNER_TOP_LEFT], left, top, &self->bounds.size);
@@ -311,9 +314,7 @@ gsk_rounded_rect_scale_affine (GskRoundedRect *dest,
gboolean
gsk_rounded_rect_is_circular (const GskRoundedRect *self)
{
guint i;
for (i = 0; i < 4; i++)
for (guint i = 0; i < 4; i++)
{
if (self->corner[i].width != self->corner[i].height)
return FALSE;
@@ -337,9 +338,7 @@ gsk_rounded_rect_is_circular (const GskRoundedRect *self)
gboolean
gsk_rounded_rect_is_rectilinear (const GskRoundedRect *self)
{
guint i;
for (i = 0; i < 4; i++)
for (guint i = 0; i < 4; i++)
{
if (self->corner[i].width > 0 ||
self->corner[i].height > 0)
@@ -349,8 +348,8 @@ gsk_rounded_rect_is_rectilinear (const GskRoundedRect *self)
return TRUE;
}
static gboolean
ellipsis_contains_point (const graphene_size_t *ellipsis,
static inline gboolean
ellipsis_contains_point (const graphene_size_t *ellipsis,
const graphene_point_t *point)
{
return (point->x * point->x) / (ellipsis->width * ellipsis->width)
@@ -371,46 +370,42 @@ static Location
gsk_rounded_rect_locate_point (const GskRoundedRect *self,
const graphene_point_t *point)
{
float px, py;
float ox, oy;
ox = self->bounds.origin.x + self->bounds.size.width;
oy = self->bounds.origin.y + self->bounds.size.height;
if (point->x < self->bounds.origin.x ||
point->y < self->bounds.origin.y ||
point->x > self->bounds.origin.x + self->bounds.size.width ||
point->y > self->bounds.origin.y + self->bounds.size.height)
point->x > ox ||
point->y > oy)
return OUTSIDE;
if (self->bounds.origin.x + self->corner[GSK_CORNER_TOP_LEFT].width > point->x &&
self->bounds.origin.y + self->corner[GSK_CORNER_TOP_LEFT].height > point->y &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_LEFT],
&GRAPHENE_POINT_INIT (
self->bounds.origin.x + self->corner[GSK_CORNER_TOP_LEFT].width - point->x,
self->bounds.origin.y + self->corner[GSK_CORNER_TOP_LEFT].height- point->y
)))
px = self->bounds.origin.x + self->corner[GSK_CORNER_TOP_LEFT].width - point->x;
py = self->bounds.origin.y + self->corner[GSK_CORNER_TOP_LEFT].height - point->y;
if (px > 0 && py > 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_LEFT], &GRAPHENE_POINT_INIT (px, py)))
return OUTSIDE_TOP_LEFT;
if (self->bounds.origin.x + self->bounds.size.width - self->corner[GSK_CORNER_TOP_RIGHT].width < point->x &&
self->bounds.origin.y + self->corner[GSK_CORNER_TOP_RIGHT].height > point->y &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_RIGHT],
&GRAPHENE_POINT_INIT (
self->bounds.origin.x + self->bounds.size.width - self->corner[GSK_CORNER_TOP_RIGHT].width - point->x,
self->bounds.origin.y + self->corner[GSK_CORNER_TOP_RIGHT].height- point->y
)))
px = ox - self->corner[GSK_CORNER_TOP_RIGHT].width - point->x;
py = self->bounds.origin.y + self->corner[GSK_CORNER_TOP_RIGHT].height - point->y;
if (px < 0 && py > 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_RIGHT], &GRAPHENE_POINT_INIT (px, py)))
return OUTSIDE_TOP_RIGHT;
if (self->bounds.origin.x + self->corner[GSK_CORNER_BOTTOM_LEFT].width > point->x &&
self->bounds.origin.y + self->bounds.size.height - self->corner[GSK_CORNER_BOTTOM_LEFT].height < point->y &&
px = self->bounds.origin.x + self->corner[GSK_CORNER_BOTTOM_LEFT].width - point->x;
py = oy - self->corner[GSK_CORNER_BOTTOM_LEFT].height - point->y;
if (px > 0 && py < 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_LEFT],
&GRAPHENE_POINT_INIT (
self->bounds.origin.x + self->corner[GSK_CORNER_BOTTOM_LEFT].width - point->x,
self->bounds.origin.y + self->bounds.size.height - self->corner[GSK_CORNER_BOTTOM_LEFT].height- point->y
)))
&GRAPHENE_POINT_INIT (px, py)))
return OUTSIDE_BOTTOM_LEFT;
if (self->bounds.origin.x + self->bounds.size.width - self->corner[GSK_CORNER_BOTTOM_RIGHT].width < point->x &&
self->bounds.origin.y + self->bounds.size.height - self->corner[GSK_CORNER_BOTTOM_RIGHT].height < point->y &&
px = ox - self->corner[GSK_CORNER_BOTTOM_RIGHT].width - point->x;
py = oy - self->corner[GSK_CORNER_BOTTOM_RIGHT].height - point->y;
if (px < 0 && py < 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_RIGHT],
&GRAPHENE_POINT_INIT (
self->bounds.origin.x + self->bounds.size.width - self->corner[GSK_CORNER_BOTTOM_RIGHT].width - point->x,
self->bounds.origin.y + self->bounds.size.height - self->corner[GSK_CORNER_BOTTOM_RIGHT].height- point->y
)))
&GRAPHENE_POINT_INIT (px, py)))
return OUTSIDE_BOTTOM_RIGHT;
return INSIDE;
@@ -445,16 +440,45 @@ gboolean
gsk_rounded_rect_contains_rect (const GskRoundedRect *self,
const graphene_rect_t *rect)
{
float tx, ty;
float px, py;
float ox, oy;
tx = rect->origin.x + rect->size.width;
ty = rect->origin.y + rect->size.height;
ox = self->bounds.origin.x + self->bounds.size.width;
oy = self->bounds.origin.y + self->bounds.size.height;
if (rect->origin.x < self->bounds.origin.x ||
rect->origin.y < self->bounds.origin.y ||
rect->origin.x + rect->size.width > self->bounds.origin.x + self->bounds.size.width ||
rect->origin.y + rect->size.height > self->bounds.origin.y + self->bounds.size.height)
tx > ox ||
ty > oy)
return FALSE;
if (!gsk_rounded_rect_contains_point (self, &rect->origin) ||
!gsk_rounded_rect_contains_point (self, &GRAPHENE_POINT_INIT (rect->origin.x + rect->size.width, rect->origin.y)) ||
!gsk_rounded_rect_contains_point (self, &GRAPHENE_POINT_INIT (rect->origin.x, rect->origin.y + rect->size.height)) ||
!gsk_rounded_rect_contains_point (self, &GRAPHENE_POINT_INIT (rect->origin.x + rect->size.width, rect->origin.y + rect->size.height)))
px = self->bounds.origin.x + self->corner[GSK_CORNER_TOP_LEFT].width - rect->origin.x;
py = self->bounds.origin.y + self->corner[GSK_CORNER_TOP_LEFT].height - rect->origin.y;
if (px > 0 && py > 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_LEFT], &GRAPHENE_POINT_INIT (px, py)))
return FALSE;
px = ox - self->corner[GSK_CORNER_TOP_RIGHT].width - tx;
py = self->bounds.origin.y + self->corner[GSK_CORNER_TOP_RIGHT].height - rect->origin.y;
if (px < 0 && py > 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_TOP_RIGHT], &GRAPHENE_POINT_INIT (px, py)))
return FALSE;
px = self->bounds.origin.x + self->corner[GSK_CORNER_BOTTOM_LEFT].width - rect->origin.x;
py = oy - self->corner[GSK_CORNER_BOTTOM_LEFT].height - ty;
if (px > 0 && py < 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_LEFT],
&GRAPHENE_POINT_INIT (px, py)))
return FALSE;
px = ox - self->corner[GSK_CORNER_BOTTOM_RIGHT].width - tx;
py = oy - self->corner[GSK_CORNER_BOTTOM_RIGHT].height - ty;
if (px < 0 && py < 0 &&
!ellipsis_contains_point (&self->corner[GSK_CORNER_BOTTOM_RIGHT],
&GRAPHENE_POINT_INIT (px, py)))
return FALSE;
return TRUE;
@@ -476,8 +500,10 @@ gsk_rounded_rect_intersects_rect (const GskRoundedRect *self,
if (!graphene_rect_intersection (&self->bounds, rect, NULL))
return FALSE;
/* If the bounding boxes intersect but the rectangles don't, one of the rect's corners
* must be in the opposite corner's outside region */
/* If the bounding boxes intersect but the rectangles don't,
* one of the rect's corners must be in the opposite corner's
* outside region
*/
if (gsk_rounded_rect_locate_point (self, &rect->origin) == OUTSIDE_BOTTOM_RIGHT ||
gsk_rounded_rect_locate_point (self, &GRAPHENE_POINT_INIT (rect->origin.x + rect->size.width, rect->origin.y)) == OUTSIDE_BOTTOM_LEFT ||
gsk_rounded_rect_locate_point (self, &GRAPHENE_POINT_INIT (rect->origin.x, rect->origin.y + rect->size.height)) == OUTSIDE_TOP_RIGHT ||
+6 -2
View File
@@ -169,7 +169,7 @@ gsk_ngl_command_queue_print_batch (GskNglCommandQueue *self,
for (guint i = 0; i < batch->draw.bind_count; i++)
{
const GskNglCommandBind *bind = &self->batch_binds.items[batch->draw.bind_offset + i];
g_print (" Bind[%d]: %u\n", bind->texture, bind->id);
g_printerr (" Bind[%d]: %u\n", bind->texture, bind->id);
}
for (guint i = 0; i < batch->draw.uniform_count; i++)
@@ -444,9 +444,12 @@ gsk_ngl_command_queue_new (GdkGLContext *context,
else
self->uniforms = gsk_ngl_uniform_state_new ();
/* Determine max texture size immediately and restore context */
/* Determine max texture size and other limitations immediately
* and restore context
*/
gdk_gl_context_make_current (context);
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &self->max_texture_size);
glGetIntegerv (GL_MAX_ELEMENTS_VERTICES, &self->max_elements_vertices);
return g_steal_pointer (&self);
}
@@ -617,6 +620,7 @@ gsk_ngl_command_queue_end_draw (GskNglCommandQueue *self)
last_batch->any.viewport.height == batch->any.viewport.height &&
last_batch->draw.framebuffer == batch->draw.framebuffer &&
last_batch->draw.vbo_offset + last_batch->draw.vbo_count == batch->draw.vbo_offset &&
last_batch->draw.vbo_count + batch->draw.vbo_count <= self->max_elements_vertices &&
snapshots_equal (self, last_batch, batch))
{
last_batch->draw.vbo_count += batch->draw.vbo_count;
+6
View File
@@ -231,6 +231,12 @@ struct _GskNglCommandQueue
*/
int max_texture_size;
/* Discovered max element count. We must not create batches that contain
* more vertices than this number.
*/
int max_elements_vertices;
/* The index of the last batch in @batches, which may not be the element
* at the end of the array, as batches can be reordered. This is used to
* update the "next" index when adding a new batch.
+13 -13
View File
@@ -726,7 +726,7 @@ gsk_ngl_render_job_transform_bounds (GskNglRenderJob *job,
/* Our most common transform is 2d-affine, so inline it.
* Both identity and 2d-translate are virtually unseen here.
*/
if G_LIKELY (category == GSK_TRANSFORM_CATEGORY_2D_AFFINE)
if G_LIKELY (category >= GSK_TRANSFORM_CATEGORY_2D_AFFINE)
{
float dx, dy, scale_x, scale_y;
@@ -1498,20 +1498,14 @@ gsk_ngl_render_job_visit_clipped_child (GskNglRenderJob *job,
}
else
{
GskRoundedRect scaled_clip;
GskNglRenderOffscreen offscreen = {0};
offscreen.bounds = &child->bounds;
offscreen.bounds = clip;
offscreen.force_offscreen = TRUE;
offscreen.reset_clip = TRUE;
offscreen.do_not_cache = TRUE;
scaled_clip = GSK_ROUNDED_RECT_INIT ((job->offset_x + clip->origin.x) * job->scale_x,
(job->offset_y + clip->origin.y) * job->scale_y,
clip->size.width * job->scale_x,
clip->size.height * job->scale_y);
gsk_ngl_render_job_push_clip (job, &scaled_clip);
gsk_ngl_render_job_visit_node_with_offscreen (job, child, &offscreen);
gsk_ngl_render_job_pop_clip (job);
g_assert (offscreen.texture_id);
@@ -1521,7 +1515,7 @@ gsk_ngl_render_job_visit_clipped_child (GskNglRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
gsk_ngl_render_job_draw_offscreen_rect (job, &child->bounds);
gsk_ngl_render_job_draw_offscreen_rect (job, clip);
gsk_ngl_render_job_end_draw (job);
}
}
@@ -1898,6 +1892,7 @@ gsk_ngl_render_job_visit_transform_node (GskNglRenderJob *job,
GskNglRenderOffscreen offscreen = {0};
offscreen.bounds = &child->bounds;
offscreen.force_offscreen = FALSE;
offscreen.reset_clip = TRUE;
if (!result_is_axis_aligned (transform, &child->bounds))
@@ -3624,6 +3619,13 @@ gsk_ngl_render_job_visit_node_with_offscreen (GskNglRenderJob *job,
render_target->framebuffer_id);
}
if (downscale_x != 1 || downscale_y != 1)
{
GskTransform *transform = gsk_transform_scale (NULL, downscale_x, downscale_y);
gsk_ngl_render_job_push_modelview (job, transform);
gsk_transform_unref (transform);
}
gsk_ngl_render_job_transform_bounds (job, offscreen->bounds, &viewport);
/* Code above will scale the size with the scale we use in the render ops,
* but for the viewport size, we need our own size limited by the texture size */
@@ -3632,8 +3634,6 @@ gsk_ngl_render_job_visit_node_with_offscreen (GskNglRenderJob *job,
gsk_ngl_render_job_set_viewport (job, &viewport, &prev_viewport);
gsk_ngl_render_job_set_projection_from_rect (job, &job->viewport, &prev_projection);
if (downscale_x != 1 || downscale_y != 1)
gsk_ngl_render_job_push_modelview (job, gsk_transform_scale (NULL, downscale_x, downscale_y));
prev_alpha = gsk_ngl_render_job_set_alpha (job, 1.0f);
prev_fbo = gsk_ngl_command_queue_bind_framebuffer (job->command_queue, render_target->framebuffer_id);
+11 -1
View File
@@ -215,7 +215,17 @@ gsk_ngl_uniform_state_end_frame (GskNglUniformState *state)
state->values_pos = allocator;
g_assert (allocator <= state->values_len);
/* It can happen that our space requirements grow due to
* difference in order increasing padding. As a pragmatic
* solution to this, just increase the allocation to cover
* the predefined mappins.
*/
if (allocator > state->values_len)
{
while (allocator > state->values_len)
state->values_len *= 2;
state->values_buf = g_realloc (state->values_buf, state->values_len);
}
memset (state->apply_hash, 0, sizeof state->apply_hash);
}
+49 -5
View File
@@ -27,6 +27,8 @@
#include "gtkatspiutilsprivate.h"
#include "gtkdebug.h"
#include "a11y/atspi/atspi-accessible.h"
#include "a11y/atspi/atspi-application.h"
#include "a11y/atspi/atspi-cache.h"
/* Cached item:
@@ -61,6 +63,8 @@ struct _GtkAtSpiCache
/* Re-entrancy guard */
gboolean in_get_items;
GtkAtSpiRoot *root;
};
enum
@@ -144,6 +148,36 @@ collect_object (GtkAtSpiCache *self,
g_variant_builder_add (builder, "@au", gtk_at_spi_context_get_states (context));
}
static void
collect_root (GtkAtSpiCache *self,
GVariantBuilder *builder)
{
g_variant_builder_add (builder, "@(so)", gtk_at_spi_root_to_ref (self->root));
g_variant_builder_add (builder, "@(so)", gtk_at_spi_root_to_ref (self->root));
g_variant_builder_add (builder, "@(so)", gtk_at_spi_null_ref ());
g_variant_builder_add (builder, "i", -1);
g_variant_builder_add (builder, "i", 0);
GVariantBuilder interfaces = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("as"));
g_variant_builder_add (&interfaces, "s", atspi_accessible_interface.name);
g_variant_builder_add (&interfaces, "s", atspi_application_interface.name);
g_variant_builder_add (builder, "@as", g_variant_builder_end (&interfaces));
g_variant_builder_add (builder, "s", g_get_prgname () ? g_get_prgname () : "Unnamed");
g_variant_builder_add (builder, "u", ATSPI_ROLE_APPLICATION);
g_variant_builder_add (builder, "s", g_get_application_name () ? g_get_application_name () : "No description");
GVariantBuilder states = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("au"));
g_variant_builder_add (&states, "u", 0);
g_variant_builder_add (&states, "u", 0);
g_variant_builder_add (builder, "@au", g_variant_builder_end (&states));
}
static void
collect_cached_objects (GtkAtSpiCache *self,
GVariantBuilder *builder)
@@ -160,6 +194,10 @@ collect_cached_objects (GtkAtSpiCache *self,
while (g_hash_table_iter_next (&iter, &key_p, &value_p))
g_hash_table_add (collection, value_p);
g_variant_builder_open (builder, G_VARIANT_TYPE ("(" ITEM_SIGNATURE ")"));
collect_root (self, builder);
g_variant_builder_close (builder);
g_hash_table_iter_init (&iter, collection);
while (g_hash_table_iter_next (&iter, &key_p, &value_p))
{
@@ -350,15 +388,21 @@ gtk_at_spi_cache_init (GtkAtSpiCache *self)
GtkAtSpiCache *
gtk_at_spi_cache_new (GDBusConnection *connection,
const char *cache_path)
const char *cache_path,
GtkAtSpiRoot *root)
{
GtkAtSpiCache *cache;
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
g_return_val_if_fail (cache_path != NULL, NULL);
return g_object_new (GTK_TYPE_AT_SPI_CACHE,
"connection", connection,
"cache-path", cache_path,
NULL);
cache = g_object_new (GTK_TYPE_AT_SPI_CACHE,
"connection", connection,
"cache-path", cache_path,
NULL);
cache->root = root;
return cache;
}
void
+2 -1
View File
@@ -31,7 +31,8 @@ G_DECLARE_FINAL_TYPE (GtkAtSpiCache, gtk_at_spi_cache, GTK, AT_SPI_CACHE, GObjec
GtkAtSpiCache *
gtk_at_spi_cache_new (GDBusConnection *connection,
const char *cache_path);
const char *cache_path,
GtkAtSpiRoot *root);
void
gtk_at_spi_cache_add_context (GtkAtSpiCache *self,
+64 -4
View File
@@ -25,7 +25,6 @@
#include "gtkaccessibleprivate.h"
#include "gtkatspiactionprivate.h"
#include "gtkatspicacheprivate.h"
#include "gtkatspieditabletextprivate.h"
#include "gtkatspiprivate.h"
#include "gtkatspirootprivate.h"
@@ -91,9 +90,6 @@ struct _GtkAtSpiContext
/* The root object, used as a entry point */
GtkAtSpiRoot *root;
/* The cache object, used to retrieve ATContexts */
GtkAtSpiCache *cache;
/* The address for the ATSPI accessibility bus */
char *bus_address;
@@ -154,6 +150,13 @@ collect_states (GtkAtSpiContext *self,
set_atspi_state (&states, ATSPI_STATE_VISIBLE);
if (ctx->accessible_role == GTK_ACCESSIBLE_ROLE_WINDOW)
{
set_atspi_state (&states, ATSPI_STATE_SHOWING);
if (gtk_accessible_get_platform_state (accessible, GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE))
set_atspi_state (&states, ATSPI_STATE_ACTIVE);
}
if (ctx->accessible_role == GTK_ACCESSIBLE_ROLE_TEXT_BOX ||
ctx->accessible_role == GTK_ACCESSIBLE_ROLE_SEARCH_BOX ||
ctx->accessible_role == GTK_ACCESSIBLE_ROLE_SPIN_BUTTON)
@@ -857,6 +860,43 @@ emit_children_changed (GtkAtSpiContext *self,
context_ref);
}
static void
emit_focus (GtkAtSpiContext *self,
gboolean focus_in)
{
if (self->connection == NULL)
return;
if (focus_in)
g_dbus_connection_emit_signal (self->connection,
NULL,
self->context_path,
"org.a11y.atspi.Event.Focus",
"Focus",
g_variant_new ("(siiva{sv})",
"", 0, 0, g_variant_new_string ("0"), NULL),
NULL);
}
static void
emit_window_event (GtkAtSpiContext *self,
const char *event_type)
{
if (self->connection == NULL)
return;
g_dbus_connection_emit_signal (self->connection,
NULL,
self->context_path,
"org.a11y.atspi.Event.Window",
event_type,
g_variant_new ("(siiva{sv})",
"", 0, 0,
g_variant_new_string("0"),
NULL),
NULL);
}
static void
gtk_at_spi_context_state_change (GtkATContext *ctx,
GtkAccessibleStateChange changed_states,
@@ -888,6 +928,7 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
if (GTK_IS_ROOT (accessible))
{
gtk_at_spi_root_child_changed (self->root, change, accessible);
emit_state_changed (self, "showing", gtk_boolean_accessible_value_get (value));
}
else
{
@@ -1083,6 +1124,25 @@ gtk_at_spi_context_platform_change (GtkATContext *ctx,
gboolean state = gtk_accessible_get_platform_state (GTK_ACCESSIBLE (widget),
GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED);
emit_state_changed (self, "focused", state);
emit_focus (self, state);
}
if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_ACTIVE)
{
gboolean state = gtk_accessible_get_platform_state (GTK_ACCESSIBLE (widget),
GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE);
emit_state_changed (self, "active", state);
/* Orca tracks the window:activate and window:deactivate events on top
* levels to decide whether to track other AT-SPI events
*/
if (gtk_accessible_get_accessible_role (accessible) == GTK_ACCESSIBLE_ROLE_WINDOW)
{
if (state)
emit_window_event (self, "activate");
else
emit_window_event (self, "deactivate");
}
}
}
+1 -1
View File
@@ -503,7 +503,7 @@ on_registration_reply (GObject *gobject,
}
/* Register the cache object */
self->cache = gtk_at_spi_cache_new (self->connection, ATSPI_CACHE_PATH);
self->cache = gtk_at_spi_cache_new (self->connection, ATSPI_CACHE_PATH, self);
/* Drain the list of queued GtkAtSpiContexts, and add them to the cache */
if (self->queued_contexts != NULL)
+4 -1
View File
@@ -1326,9 +1326,12 @@ update_selection (TextChanged *changed,
int selection_bound)
{
gboolean caret_moved, bound_moved;
gboolean had_selection, has_selection;
caret_moved = cursor_position != changed->cursor_position;
bound_moved = selection_bound != changed->selection_bound;
had_selection = changed->cursor_position != changed->selection_bound;
has_selection = cursor_position != selection_bound;
if (!caret_moved && !bound_moved)
return;
@@ -1339,7 +1342,7 @@ update_selection (TextChanged *changed,
if (caret_moved)
changed->selection_changed (changed->data, "text-caret-moved", changed->cursor_position);
if (caret_moved || bound_moved)
if (had_selection || has_selection)
changed->selection_changed (changed->data, "text-selection-changed", 0);
}
-4
View File
@@ -403,7 +403,3 @@
<Multi_key> <Greek_omicron> <apostrophe> : "ό" U03CC
<Multi_key> <Greek_upsilon> <apostrophe> : "ύ" U03CD
<Multi_key> <Greek_omega> <apostrophe> : "ώ" U03CE
# This sequence matches our handling of dead keys better.
# We remove the xorg sequence that maps this to '
<dead_acute> <space> : "´" acute # ACUTE ACCENT
-14
View File
@@ -1,14 +0,0 @@
<dead_tilde> <dead_tilde> : "~" asciitilde # TILDE
<dead_acute> <space> : "'" apostrophe # APOSTROPHE
<dead_acute> <dead_acute> : "´" acute # ACUTE ACCENT
<dead_grave> <dead_grave> : "`" grave # GRAVE ACCENT
<dead_abovering> <dead_abovering> : "°" degree # DEGREE SIGN
<dead_macron> <dead_macron> : "¯" macron # MACRON
<dead_breve> <dead_breve> : "˘" breve # BREVE
<dead_abovedot> <dead_abovedot> : "˙" abovedot # DOT ABOVE
<dead_diaeresis> <dead_diaeresis> : "¨" diaeresis # DIAERESIS
<dead_doubleacute> <dead_doubleacute> : "˝" U2dd # DOUBLE ACUTE ACCENT
<dead_caron> <dead_caron> : "ˇ" caron # CARON
<dead_cedilla> <dead_cedilla> : "¸" cedilla # CEDILLA
<dead_ogonek> <dead_ogonek> : "˛" ogonek # OGONEK
<dead_iota> <dead_iota> : "ͺ" U37a # GREEK YPOGEGRAMMENI
+2 -10
View File
@@ -696,15 +696,8 @@ gtk_at_context_update (GtkATContext *self)
self->updated_states == 0)
return;
GtkAccessibleStateChange changed_states =
gtk_accessible_attribute_set_get_changed (self->states);
GtkAccessiblePropertyChange changed_properties =
gtk_accessible_attribute_set_get_changed (self->properties);
GtkAccessibleRelationChange changed_relations =
gtk_accessible_attribute_set_get_changed (self->relations);
GTK_AT_CONTEXT_GET_CLASS (self)->state_change (self,
changed_states, changed_properties, changed_relations,
self->updated_states, self->updated_properties, self->updated_relations,
self->states, self->properties, self->relations);
g_signal_emit (self, obj_signals[STATE_CHANGE], 0);
@@ -1172,8 +1165,7 @@ void
gtk_at_context_platform_changed (GtkATContext *self,
GtkAccessiblePlatformChange change)
{
if (!self->realized)
return;
gtk_at_context_realize (self);
GTK_AT_CONTEXT_GET_CLASS (self)->platform_change (self, change);
}
+2
View File
@@ -83,11 +83,13 @@ typedef enum {
typedef enum {
GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSABLE,
GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED,
GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE
} GtkAccessiblePlatformState;
typedef enum {
GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSABLE = 1 << GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSABLE,
GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSED = 1 << GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED,
GTK_ACCESSIBLE_PLATFORM_CHANGE_ACTIVE = 1 << GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE,
} GtkAccessiblePlatformChange;
typedef enum {
+5 -5
View File
@@ -66,13 +66,13 @@
* calling [method@Gtk.Builder.set_translation_domain] on the builder.
*
* Objects are described by `<object>` elements, which can contain
* <property> elements to set properties, `<signal>` elements which
* `<property>` elements to set properties, `<signal>` elements which
* connect signals to handlers, and `<child>` elements, which describe
* child objects (most often widgets inside a container, but also e.g.
* actions in an action group, or columns in a tree model). A `<child>`
* element contains an `<object>` element which describes the child object.
*
* The target toolkit version(s) are described by <requires> elements,
* The target toolkit version(s) are described by `<requires>` elements,
* the lib attribute specifies the widget library in question (currently
* the only supported value is gtk) and the version attribute specifies
* the target version in the form `<major>`.`<minor>`. `GtkBuilder` will
@@ -93,7 +93,7 @@
* underscores) for its own purposes.
*
* Setting properties of objects is pretty straightforward with the
* <property> element: the name attribute specifies the name of the
* `<property>` element: the name attribute specifies the name of the
* property, and the content of the element specifies the value.
* If the translatable attribute is set to a true value, GTK uses
* `gettext()` (or `dgettext()` if the builder has a translation domain set)
@@ -148,7 +148,7 @@
*
* # Signal handlers and function pointers
*
* Signal handlers are set up with the <signal> element. The name
* Signal handlers are set up with the `<signal>` element. The name
* attribute specifies the name of the signal, and the handler attribute
* specifies the function to connect to the signal.
* The remaining attributes, after, swapped and object, have the
@@ -198,7 +198,7 @@
* These XML fragments are explained in the documentation of the
* respective objects.
*
* A <template> tag can be used to define a widget classs components.
* A `<template>` tag can be used to define a widget classs components.
* See the [GtkWidget documentation](class.Widget.html#building-composite-widgets-from-template-xml) for details.
*/
+1 -1
View File
@@ -41,7 +41,7 @@ G_DECLARE_INTERFACE (GtkBuilderScope, gtk_builder_scope, GTK, BUILDER_SCOPE, GOb
* The list of flags that can be passed to gtk_builder_create_closure().
*
* New values may be added in the future for new features, so external
* implementations of [interface@Gtk.BuilderScope] should test the flags
* implementations of [iface@Gtk.BuilderScope] should test the flags
* for unknown values and raise a %GTK_BUILDER_ERROR_INVALID_ATTRIBUTE error
* when they encounter one.
*/
+6
View File
@@ -39,6 +39,8 @@
* `GtkButton` has a single CSS node with name button. The node will get the
* style classes .image-button or .text-button, if the content is just an
* image or label, respectively. It may also receive the .flat style class.
* When activating a button via the keyboard, the button will temporarily
* gain the .keyboard-activating style class.
*
* Other style classes that are commonly used with `GtkButton` include
* .suggested-action and .destructive-action. In special cases, buttons
@@ -780,6 +782,8 @@ gtk_real_button_activate (GtkButton *button)
{
priv->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT, button_activate_timeout, button);
g_source_set_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
gtk_widget_add_css_class (GTK_WIDGET (button), "keyboard-activating");
priv->button_down = TRUE;
}
}
@@ -790,6 +794,8 @@ gtk_button_finish_activate (GtkButton *button,
{
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
gtk_widget_remove_css_class (GTK_WIDGET (button), "keyboard-activating");
g_source_remove (priv->activate_timeout);
priv->activate_timeout = 0;
+10
View File
@@ -3424,8 +3424,18 @@ gtk_cell_area_inner_cell_area (GtkCellArea *area,
*inner_area = *cell_area;
if (border.left + border.right > cell_area->width)
{
border.left = cell_area->width / 2;
border.right = (cell_area->width + 1) / 2;
}
inner_area->x += border.left;
inner_area->width -= border.left + border.right;
if (border.top + border.bottom > cell_area->height)
{
border.top = cell_area->height / 2;
border.bottom = (cell_area->height + 1) / 2;
}
inner_area->y += border.top;
inner_area->height -= border.top + border.bottom;
}
+1 -1
View File
@@ -915,7 +915,7 @@ gtk_check_button_set_label (GtkCheckButton *self,
*
* Setting up groups in a cycle leads to undefined behavior.
*
* Note that the same effect can be achieved via the [interface@Gtk.Actionable]
* Note that the same effect can be achieved via the [iface@Gtk.Actionable]
* API, by using the same action with parameter type and state type 's'
* for all buttons in the group, and giving each button its own target
* value.
+1 -1
View File
@@ -58,7 +58,7 @@
* is specified in the form of a tree model, and the display of the choices
* can be adapted to the data in the model by using cell renderers, as you
* would in a tree view. This is possible since `GtkComboBox` implements the
* [interface@Gtk.CellLayout] interface. The tree model holding the valid
* [iface@Gtk.CellLayout] interface. The tree model holding the valid
* choices is not restricted to a flat list, it can be a real tree, and the
* popup will reflect the tree structure.
*
+2 -3
View File
@@ -49,11 +49,10 @@
*
* If the `GtkComboBoxText` contains an entry (via the
* [property@Gtk.ComboBox:has-entry] property), its contents can be retrieved
* using [method@Gtk.ComboBoxText.get_active_text]. The entry itself can be
* accessed by calling [method@Gtk.ComboBox.get_child] on the combo box.
* using [method@Gtk.ComboBoxText.get_active_text].
*
* You should not call [method@Gtk.ComboBox.set_model] or attempt to pack more
* cells into this combo box via its [interface@Gtk.CellLayout] interface.
* cells into this combo box via its [iface@Gtk.CellLayout] interface.
*
* # GtkComboBoxText as GtkBuildable
*
+3 -3
View File
@@ -66,9 +66,9 @@ gtk_css_image_paintable_snapshot (GtkCssImage *image,
{
GtkCssImagePaintable *paintable = GTK_CSS_IMAGE_PAINTABLE (image);
return gdk_paintable_snapshot (get_paintable (paintable),
snapshot,
width, height);
gdk_paintable_snapshot (get_paintable (paintable),
snapshot,
width, height);
}
static GtkCssImage *
+1 -1
View File
@@ -953,7 +953,7 @@ gtk_dialog_add_buttons_valist (GtkDialog *dialog,
*
* This is the same as calling [method@Gtk.Dialog.add_button]
* repeatedly. The variable argument list should be %NULL-terminated
* as with [new@Gtk.Dialog.new_with_buttons]. Each button must have both
* as with [ctor@Gtk.Dialog.new_with_buttons]. Each button must have both
* text and response ID.
*/
void
+4
View File
@@ -470,6 +470,7 @@ drag_end (GtkDragSource *source,
gdk_drag_drop_done (source->drag, success);
g_clear_object (&source->drag);
g_object_unref (source);
}
static void
@@ -593,6 +594,9 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
gtk_drag_source_ensure_icon (source, source->drag);
/* Keep the source alive until the drag is done */
g_object_ref (source);
g_signal_connect (source->drag, "dnd-finished",
G_CALLBACK (gtk_drag_source_dnd_finished_cb), source);
g_signal_connect (source->drag, "cancel",
+2
View File
@@ -351,6 +351,8 @@ gtk_entry_accessible_get_platform_state (GtkAccessible *self,
return gtk_widget_get_focusable (GTK_WIDGET (priv->text));
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED:
return gtk_widget_has_focus (GTK_WIDGET (priv->text));
case GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE:
return FALSE;
default:
g_assert_not_reached ();
}
+16 -3
View File
@@ -1095,6 +1095,9 @@ add_languages_from_font (GtkFontChooserWidget *self,
}
#endif
static gboolean
gtk_font_chooser_widget_ensure_matching_selection (GtkFontChooserWidget *self);
/* We incrementally populate our fontlist to prevent blocking
* the font chooser for a long time with expensive FcFontSort
* calls in pango for every row in the list).
@@ -1135,6 +1138,9 @@ add_to_fontlist (GtkWidget *widget,
gtk_slice_list_model_set_size (model, n);
if (gtk_single_selection_get_selected (GTK_SINGLE_SELECTION (self->selection)) == GTK_INVALID_LIST_POSITION)
gtk_font_chooser_widget_ensure_matching_selection (self);
if (n == G_MAXUINT)
return G_SOURCE_REMOVE;
else
@@ -1348,7 +1354,7 @@ my_pango_font_family_equal (const char *familya,
return g_ascii_strcasecmp (familya, familyb) == 0;
}
static void
static gboolean
gtk_font_chooser_widget_ensure_matching_selection (GtkFontChooserWidget *self)
{
const char *desc_family;
@@ -1358,7 +1364,7 @@ gtk_font_chooser_widget_ensure_matching_selection (GtkFontChooserWidget *self)
if (desc_family == NULL)
{
gtk_single_selection_set_selected (self->selection, GTK_INVALID_LIST_POSITION);
return;
return TRUE;
}
n = g_list_model_get_n_items (G_LIST_MODEL (self->selection));
@@ -1397,7 +1403,13 @@ gtk_font_chooser_widget_ensure_matching_selection (GtkFontChooserWidget *self)
pango_font_description_free (merged);
}
gtk_single_selection_set_selected (self->selection, i);
if (i < n)
{
gtk_single_selection_set_selected (self->selection, i);
return TRUE;
}
return FALSE;
}
static PangoFontFace *
@@ -2352,6 +2364,7 @@ gtk_font_chooser_widget_take_font_desc (GtkFontChooserWidget *fontchooser,
if (mask & (PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | PANGO_FONT_MASK_VARIANT |
PANGO_FONT_MASK_WEIGHT | PANGO_FONT_MASK_STRETCH))
{
gtk_single_selection_set_selected (fontchooser->selection, GTK_INVALID_LIST_POSITION);
gtk_font_chooser_widget_ensure_matching_selection (fontchooser);
}
+1 -1
View File
@@ -1644,7 +1644,7 @@ gtk_icon_theme_add_resource_path (GtkIconTheme *self,
* overriding system configuration.
*
* This function cannot be called on the icon theme objects returned
* from [type_func@Gtk.IconTheme.get_for_display].
* from [func@Gtk.IconTheme.get_for_display].
*/
void
gtk_icon_theme_set_theme_name (GtkIconTheme *self,
+34 -10
View File
@@ -90,6 +90,9 @@ G_LOCK_DEFINE_STATIC (global_tables);
static GSList *global_tables;
static const guint16 gtk_compose_ignore[] = {
0, /* Yes, XKB will send us key press events with NoSymbol :( */
GDK_KEY_Overlay1_Enable,
GDK_KEY_Overlay2_Enable,
GDK_KEY_Shift_L,
GDK_KEY_Shift_R,
GDK_KEY_Control_L,
@@ -105,7 +108,10 @@ static const guint16 gtk_compose_ignore[] = {
GDK_KEY_Hyper_L,
GDK_KEY_Hyper_R,
GDK_KEY_Mode_switch,
GDK_KEY_ISO_Level3_Shift
GDK_KEY_ISO_Level3_Shift,
GDK_KEY_ISO_Level3_Latch,
GDK_KEY_ISO_Level5_Shift,
GDK_KEY_ISO_Level5_Latch
};
static void gtk_im_context_simple_finalize (GObject *obj);
@@ -761,13 +767,21 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
}
}
if (priv->in_hex_sequence || priv->in_compose_sequence)
return TRUE; /* Don't leak random key events during preedit */
return FALSE;
}
/* Ignore modifier key presses */
for (i = 0; i < G_N_ELEMENTS (gtk_compose_ignore); i++)
if (keyval == gtk_compose_ignore[i])
return FALSE;
{
if (priv->in_hex_sequence || priv->in_compose_sequence)
return TRUE; /* Don't leak random key events during preedit */
return FALSE;
}
hex_mod_mask = GDK_CONTROL_MASK|GDK_SHIFT_MASK;
@@ -802,16 +816,23 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
no_text_input_mask = GDK_ALT_MASK|GDK_CONTROL_MASK;
if (state & no_text_input_mask ||
(priv->in_hex_sequence && priv->modifiers_dropped &&
(keyval == GDK_KEY_Return ||
keyval == GDK_KEY_ISO_Enter ||
keyval == GDK_KEY_KP_Enter)))
if (priv->in_hex_sequence && priv->modifiers_dropped &&
(keyval == GDK_KEY_Return ||
keyval == GDK_KEY_ISO_Enter ||
keyval == GDK_KEY_KP_Enter))
{
return FALSE;
}
if (state & no_text_input_mask)
{
if (priv->in_hex_sequence || priv->in_compose_sequence)
return TRUE; /* Don't leak random key events during preedit */
return FALSE;
}
}
/* Handle backspace */
if (priv->in_hex_sequence && have_hex_mods && is_backspace)
{
@@ -1059,9 +1080,12 @@ gtk_im_context_simple_reset (GtkIMContext *context)
priv->compose_buffer[0] = 0;
if (priv->tentative_match->len > 0 || priv->in_hex_sequence)
if (priv->tentative_match->len > 0 ||
priv->in_hex_sequence ||
priv->in_compose_sequence)
{
priv->in_hex_sequence = FALSE;
priv->in_compose_sequence = FALSE;
g_string_set_size (priv->tentative_match, 0);
priv->tentative_match_len = 0;
g_signal_emit_by_name (context_simple, "preedit-changed");
@@ -1137,7 +1161,7 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext *context,
}
if (cursor_pos)
*cursor_pos = s->len;
*cursor_pos = g_utf8_strlen (s->str, s->len);
if (attrs)
{
+43 -30
View File
@@ -66,35 +66,35 @@
static const guint16 gtk_compose_seqs_compact[] = {
GDK_KEY_Greek_accentdieresis, 180, 184, 184, 184, 184,
GDK_KEY_dead_grave, 184, 244, 331, 543, 543,
GDK_KEY_dead_acute, 543, 605, 701, 977, 977,
GDK_KEY_dead_circumflex, 977, 1101, 1101, 1301, 1301,
GDK_KEY_dead_tilde, 1301, 1383, 1446, 1586, 1586,
GDK_KEY_dead_macron, 1586, 1630, 1648, 1720, 1720,
GDK_KEY_dead_breve, 1720, 1768, 1768, 1792, 1792,
GDK_KEY_dead_abovedot, 1792, 1820, 1823, 1859, 1859,
GDK_KEY_dead_diaeresis, 1859, 1945, 1957, 1981, 1981,
GDK_KEY_dead_abovering, 1981, 1989, 1989, 1989, 1989,
GDK_KEY_dead_doubleacute, 1989, 1997, 1997, 1997, 1997,
GDK_KEY_dead_caron, 1997, 2037, 2037, 2045, 2045,
GDK_KEY_dead_cedilla, 2045, 2055, 2061, 2061, 2061,
GDK_KEY_dead_ogonek, 2061, 2069, 2069, 2069, 2069,
GDK_KEY_dead_iota, 2069, 2089, 2188, 2620, 3280,
GDK_KEY_dead_voiced_sound, 3280, 3326, 3326, 3326, 3326,
GDK_KEY_dead_semivoiced_sound, 3326, 3336, 3336, 3336, 3336,
GDK_KEY_dead_belowdot, 3336, 3352, 3352, 3368, 3368,
GDK_KEY_dead_hook, 3368, 3446, 3449, 3505, 3505,
GDK_KEY_dead_horn, 3505, 3515, 3515, 3515, 3515,
GDK_KEY_dead_stroke, 3515, 3603, 3615, 3615, 3615,
GDK_KEY_dead_psili, 3615, 3643, 3643, 3643, 3643,
GDK_KEY_dead_dasia, 3643, 3675, 3675, 3675, 3675,
GDK_KEY_dead_belowring, 3675, 3677, 3677, 3677, 3677,
GDK_KEY_dead_belowtilde, 3677, 3679, 3679, 3679, 3679,
GDK_KEY_dead_belowdiaeresis, 3679, 3679, 3682, 3682, 3682,
GDK_KEY_dead_belowcomma, 3682, 3696, 3696, 3696, 3696,
GDK_KEY_dead_currency, 3696, 3794, 3800, 3800, 3800,
GDK_KEY_dead_greek, 3800, 3902, 3926, 3926, 3926,
GDK_KEY_Multi_key, 3926, 3926, 10637, 14345, 16220,
GDK_KEY_dead_grave, 184, 246, 333, 545, 545,
GDK_KEY_dead_acute, 545, 609, 705, 981, 981,
GDK_KEY_dead_circumflex, 981, 1105, 1105, 1305, 1305,
GDK_KEY_dead_tilde, 1305, 1389, 1452, 1592, 1592,
GDK_KEY_dead_macron, 1592, 1638, 1656, 1728, 1728,
GDK_KEY_dead_breve, 1728, 1778, 1778, 1802, 1802,
GDK_KEY_dead_abovedot, 1802, 1832, 1835, 1871, 1871,
GDK_KEY_dead_diaeresis, 1871, 1959, 1971, 1995, 1995,
GDK_KEY_dead_abovering, 1995, 2005, 2005, 2005, 2005,
GDK_KEY_dead_doubleacute, 2005, 2015, 2015, 2015, 2015,
GDK_KEY_dead_caron, 2015, 2057, 2057, 2065, 2065,
GDK_KEY_dead_cedilla, 2065, 2077, 2083, 2083, 2083,
GDK_KEY_dead_ogonek, 2083, 2093, 2093, 2093, 2093,
GDK_KEY_dead_iota, 2093, 2115, 2214, 2646, 3306,
GDK_KEY_dead_voiced_sound, 3306, 3352, 3352, 3352, 3352,
GDK_KEY_dead_semivoiced_sound, 3352, 3362, 3362, 3362, 3362,
GDK_KEY_dead_belowdot, 3362, 3378, 3378, 3394, 3394,
GDK_KEY_dead_hook, 3394, 3472, 3475, 3531, 3531,
GDK_KEY_dead_horn, 3531, 3541, 3541, 3541, 3541,
GDK_KEY_dead_stroke, 3541, 3629, 3641, 3641, 3641,
GDK_KEY_dead_psili, 3641, 3669, 3669, 3669, 3669,
GDK_KEY_dead_dasia, 3669, 3701, 3701, 3701, 3701,
GDK_KEY_dead_belowring, 3701, 3703, 3703, 3703, 3703,
GDK_KEY_dead_belowtilde, 3703, 3705, 3705, 3705, 3705,
GDK_KEY_dead_belowdiaeresis, 3705, 3705, 3708, 3708, 3708,
GDK_KEY_dead_belowcomma, 3708, 3722, 3722, 3722, 3722,
GDK_KEY_dead_currency, 3722, 3820, 3826, 3826, 3826,
GDK_KEY_dead_greek, 3826, 3928, 3952, 3952, 3952,
GDK_KEY_Multi_key, 3952, 3952, 10663, 14371, 16246,
GDK_KEY_Greek_iota, 0x0390,
GDK_KEY_Greek_upsilon, 0x03B0,
GDK_KEY_space, 0x0060,
@@ -127,6 +127,7 @@ GDK_KEY_Greek_iota, 0x1F76,
GDK_KEY_Greek_omicron, 0x1F78,
GDK_KEY_Greek_upsilon, 0x1F7A,
GDK_KEY_Greek_omega, 0x1F7C,
GDK_KEY_dead_grave, 0x0060,
GDK_KEY_dead_diaeresis, GDK_KEY_Greek_iota, 0x1FD2,
GDK_KEY_dead_diaeresis, GDK_KEY_Greek_upsilon, 0x1FE2,
GDK_KEY_dead_psili, GDK_KEY_Greek_ALPHA, 0x1F0A,
@@ -209,7 +210,7 @@ GDK_KEY_Multi_key, GDK_KEY_macron, GDK_KEY_E, 0x1E14,
GDK_KEY_Multi_key, GDK_KEY_macron, GDK_KEY_O, 0x1E50,
GDK_KEY_Multi_key, GDK_KEY_macron, GDK_KEY_e, 0x1E15,
GDK_KEY_Multi_key, GDK_KEY_macron, GDK_KEY_o, 0x1E51,
GDK_KEY_space, 0x00B4,
GDK_KEY_space, 0x0027,
GDK_KEY_V, 0x01D7,
GDK_KEY_v, 0x01D8,
GDK_KEY_nobreakspace, 0x0301,
@@ -240,6 +241,7 @@ GDK_KEY_Greek_iota, 0x03AF,
GDK_KEY_Greek_omicron, 0x03CC,
GDK_KEY_Greek_upsilon, 0x03CD,
GDK_KEY_Greek_omega, 0x03CE,
GDK_KEY_dead_acute, 0x00B4,
GDK_KEY_dead_diaeresis, GDK_KEY_space, 0x0385,
GDK_KEY_dead_diaeresis, GDK_KEY_Greek_iota, 0x0390,
GDK_KEY_dead_diaeresis, GDK_KEY_Greek_upsilon, 0x03B0,
@@ -494,6 +496,7 @@ GDK_KEY_Greek_omega, 0x1FF6,
0x1F61, 0x1F67,
0x1F68, 0x1F6E,
0x1F69, 0x1F6F,
GDK_KEY_dead_tilde, 0x007E,
GDK_KEY_dead_diaeresis, GDK_KEY_Greek_iota, 0x1FD7,
GDK_KEY_dead_diaeresis, GDK_KEY_Greek_upsilon, 0x1FE7,
GDK_KEY_dead_psili, GDK_KEY_Greek_ALPHA, 0x1F0E,
@@ -572,6 +575,7 @@ GDK_KEY_Greek_UPSILON, 0x1FE9,
GDK_KEY_Greek_alpha, 0x1FB1,
GDK_KEY_Greek_iota, 0x1FD1,
GDK_KEY_Greek_upsilon, 0x1FE1,
GDK_KEY_dead_macron, 0x00AF,
GDK_KEY_dead_greek, GDK_KEY_A, 0x1FB9,
GDK_KEY_dead_greek, GDK_KEY_I, 0x1FD9,
GDK_KEY_dead_greek, GDK_KEY_U, 0x1FE9,
@@ -620,6 +624,7 @@ GDK_KEY_Greek_UPSILON, 0x1FE8,
GDK_KEY_Greek_alpha, 0x1FB0,
GDK_KEY_Greek_iota, 0x1FD0,
GDK_KEY_Greek_upsilon, 0x1FE0,
GDK_KEY_dead_breve, 0x02D8,
GDK_KEY_Multi_key, GDK_KEY_exclam, GDK_KEY_A, 0x1EB6,
GDK_KEY_Multi_key, GDK_KEY_exclam, GDK_KEY_a, 0x1EB7,
GDK_KEY_Multi_key, GDK_KEY_comma, GDK_KEY_E, 0x1E1C,
@@ -640,6 +645,7 @@ GDK_KEY_Amacron, 0x01E0,
GDK_KEY_Omacron, 0x0230,
GDK_KEY_amacron, 0x01E1,
GDK_KEY_omacron, 0x0231,
GDK_KEY_dead_abovedot, 0x02D9,
GDK_KEY_dead_stroke, GDK_KEY_j, 0x025F,
GDK_KEY_Multi_key, GDK_KEY_exclam, GDK_KEY_S, 0x1E68,
GDK_KEY_Multi_key, GDK_KEY_exclam, GDK_KEY_s, 0x1E69,
@@ -693,6 +699,7 @@ GDK_KEY_Greek_IOTA, 0x03AA,
GDK_KEY_Greek_UPSILON, 0x03AB,
GDK_KEY_Greek_iota, 0x03CA,
GDK_KEY_Greek_upsilon, 0x03CB,
GDK_KEY_dead_diaeresis, 0x00A8,
GDK_KEY_dead_acute, GDK_KEY_space, 0x0385,
GDK_KEY_dead_acute, GDK_KEY_Greek_iota, 0x0390,
GDK_KEY_dead_acute, GDK_KEY_Greek_upsilon, 0x03B0,
@@ -707,10 +714,12 @@ GDK_KEY_space, 0x00B0,
GDK_KEY_nobreakspace, 0x030A,
GDK_KEY_Aacute, 0x01FA,
GDK_KEY_aacute, 0x01FB,
GDK_KEY_dead_abovering, 0x00B0,
GDK_KEY_space, 0x02DD,
GDK_KEY_nobreakspace, 0x030B,
GDK_KEY_Cyrillic_u, 0x04F3,
GDK_KEY_Cyrillic_U, 0x04F2,
GDK_KEY_dead_doubleacute, 0x02DD,
GDK_KEY_space, 0x02C7,
GDK_KEY_parenleft, 0x208D,
GDK_KEY_parenright, 0x208E,
@@ -731,6 +740,7 @@ GDK_KEY_V, 0x01D9,
GDK_KEY_v, 0x01DA,
GDK_KEY_nobreakspace, 0x030C,
0x01F2, 0x01C5,
GDK_KEY_dead_caron, 0x02C7,
GDK_KEY_Multi_key, GDK_KEY_quotedbl, GDK_KEY_U, 0x01D9,
GDK_KEY_Multi_key, GDK_KEY_quotedbl, GDK_KEY_u, 0x01DA,
GDK_KEY_space, 0x00B8,
@@ -738,12 +748,14 @@ GDK_KEY_nobreakspace, 0x0327,
GDK_KEY_cent, 0x20B5,
GDK_KEY_Cacute, 0x1E08,
GDK_KEY_cacute, 0x1E09,
GDK_KEY_dead_cedilla, 0x00B8,
GDK_KEY_dead_currency, GDK_KEY_C, 0x20B5,
GDK_KEY_dead_currency, GDK_KEY_c, 0x20B5,
GDK_KEY_space, 0x02DB,
GDK_KEY_nobreakspace, 0x0328,
GDK_KEY_Omacron, 0x01EC,
GDK_KEY_omacron, 0x01ED,
GDK_KEY_dead_ogonek, 0x02DB,
GDK_KEY_space, 0x037A,
GDK_KEY_Greek_alphaaccent, 0x1FB4,
GDK_KEY_Greek_etaaccent, 0x1FC4,
@@ -754,6 +766,7 @@ GDK_KEY_Greek_OMEGA, 0x1FFC,
GDK_KEY_Greek_alpha, 0x1FB3,
GDK_KEY_Greek_eta, 0x1FC3,
GDK_KEY_Greek_omega, 0x1FF3,
GDK_KEY_dead_iota, 0x037A,
GDK_KEY_dead_grave, GDK_KEY_Greek_alpha, 0x1FB2,
GDK_KEY_dead_grave, GDK_KEY_Greek_eta, 0x1FC2,
GDK_KEY_dead_grave, GDK_KEY_Greek_omega, 0x1FF2,
+3
View File
@@ -205,6 +205,9 @@ gtk_im_multicontext_set_delegate (GtkIMMulticontext *multicontext,
gtk_im_multicontext_delete_surrounding_cb,
multicontext);
if (priv->client_widget)
gtk_im_context_set_client_widget (priv->delegate, NULL);
g_object_unref (priv->delegate);
priv->delegate = NULL;
+13 -3
View File
@@ -2970,8 +2970,18 @@ gtk_label_recalculate (GtkLabel *self)
gtk_label_clear_layout (self);
gtk_label_clear_select_info (self);
if (self->use_markup || self->use_underline)
gtk_label_set_markup_internal (self, self->label, self->use_underline);
if (self->use_markup)
{
gtk_label_set_markup_internal (self, self->label, self->use_underline);
}
else if (self->use_underline)
{
char *text;
text = g_markup_escape_text (self->label, -1);
gtk_label_set_markup_internal (self, text, TRUE);
g_free (text);
}
else
{
g_clear_pointer (&self->markup_attrs, pango_attr_list_unref);
@@ -4998,7 +5008,7 @@ gtk_label_get_layout (GtkLabel *self)
* inside the [class@Pango.Layout], e.g. to take some action if some part
* of the label is clicked. Remember when using the [class@Pango.Layout]
* functions you need to convert to and from pixels using PANGO_PIXELS()
* or [constant@Pango.SCALE].
* or [const@Pango.SCALE].
*/
void
gtk_label_get_layout_offsets (GtkLabel *self,
+4 -1
View File
@@ -1782,7 +1782,10 @@ gtk_list_box_update_selection_full (GtkListBox *box,
g_signal_emit (box, signals[ROW_SELECTED], 0, row);
}
else
gtk_list_box_select_all_between (box, selected_row, row, FALSE);
{
gtk_list_box_select_all_between (box, selected_row, row, FALSE);
box->selected_row = selected_row;
}
}
else
{
+11 -7
View File
@@ -334,6 +334,7 @@ gtk_list_item_widget_click_gesture_pressed (GtkGestureClick *gesture,
{
if (n_press == 2 && !priv->single_click_activate)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
gtk_widget_activate_action (GTK_WIDGET (self),
"list.activate-item",
"u",
@@ -356,14 +357,17 @@ gtk_list_item_widget_click_gesture_released (GtkGestureClick *gesture,
{
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
if (priv->single_click_activate)
if (!priv->list_item || priv->list_item->activatable)
{
gtk_widget_activate_action (GTK_WIDGET (self),
"list.activate-item",
"u",
priv->position);
return;
if (n_press == 1 && priv->single_click_activate)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
gtk_widget_activate_action (GTK_WIDGET (self),
"list.activate-item",
"u",
priv->position);
return;
}
}
if (!priv->list_item || priv->list_item->selectable)
+17
View File
@@ -214,6 +214,22 @@ gtk_menu_button_get_property (GObject *object,
}
}
static void
gtk_menu_button_notify (GObject *object,
GParamSpec *pspec)
{
if (strcmp (pspec->name, "focus-on-click") == 0)
{
GtkMenuButton *self = GTK_MENU_BUTTON (object);
gtk_widget_set_focus_on_click (self->button,
gtk_widget_get_focus_on_click (GTK_WIDGET (self)));
}
if (G_OBJECT_CLASS (gtk_menu_button_parent_class)->notify)
G_OBJECT_CLASS (gtk_menu_button_parent_class)->notify (object, pspec);
}
static void
gtk_menu_button_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state_flags)
@@ -318,6 +334,7 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
gobject_class->set_property = gtk_menu_button_set_property;
gobject_class->get_property = gtk_menu_button_get_property;
gobject_class->notify = gtk_menu_button_notify;
gobject_class->dispose = gtk_menu_button_dispose;
widget_class->measure = gtk_menu_button_measure;
+2 -1
View File
@@ -1404,7 +1404,8 @@ pointer_cb (GObject *object,
GtkModelButton *button = data;
stop_open (button);
gtk_popover_menu_set_active_item (GTK_POPOVER_MENU (popover), NULL);
if (popover)
gtk_popover_menu_set_active_item (GTK_POPOVER_MENU (popover), NULL);
}
}
+2 -2
View File
@@ -102,7 +102,7 @@ gtk_native_layout (GtkNative *self,
int width,
int height)
{
return GTK_NATIVE_GET_IFACE (self)->layout (self, width, height);
GTK_NATIVE_GET_IFACE (self)->layout (self, width, height);
}
static void
@@ -258,7 +258,7 @@ gtk_native_get_surface_transform (GtkNative *self,
g_return_if_fail (x != NULL);
g_return_if_fail (y != NULL);
return GTK_NATIVE_GET_IFACE (self)->get_surface_transform (self, x, y);
GTK_NATIVE_GET_IFACE (self)->get_surface_transform (self, x, y);
}
/**
+5 -2
View File
@@ -5461,6 +5461,9 @@ gtk_notebook_real_switch_page (GtkNotebook *notebook,
gtk_widget_set_state_flags (page->tab_widget, GTK_STATE_FLAG_CHECKED, FALSE);
gtk_widget_set_visible (notebook->header_widget, notebook->show_tabs);
if (gtk_widget_get_realized (GTK_WIDGET (notebook)))
gtk_widget_realize_at_context (notebook->cur_page->tab_widget);
gtk_accessible_update_state (GTK_ACCESSIBLE (notebook->cur_page->tab_widget),
GTK_ACCESSIBLE_STATE_SELECTED, TRUE,
-1);
@@ -5649,8 +5652,8 @@ gtk_notebook_menu_item_recreate (GtkNotebook *notebook,
GtkNotebookPage *page = list->data;
GtkWidget *menu_item = gtk_widget_get_parent (page->menu_label);
gtk_box_remove (GTK_BOX (menu_item), page->menu_label);
gtk_widget_unparent (menu_item);
gtk_button_set_child (GTK_BUTTON (menu_item), NULL);
gtk_box_remove (GTK_BOX (notebook->menu_box), menu_item);
gtk_notebook_menu_item_create (notebook, page);
}
+2
View File
@@ -532,6 +532,8 @@ gtk_password_entry_accessible_get_platform_state (GtkAccessible *se
return gtk_widget_get_focusable (GTK_WIDGET (entry->entry));
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED:
return gtk_widget_has_focus (GTK_WIDGET (entry->entry));
case GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE:
return FALSE;
default:
g_assert_not_reached ();
}
+3
View File
@@ -795,6 +795,9 @@ on_bookmark_query_info_complete (GObject *source,
{
/* Don't add non-UTF-8 bookmarks */
bookmark_name = g_file_get_basename (root);
if (bookmark_name == NULL)
goto out;
if (!g_utf8_validate (bookmark_name, -1, NULL))
{
g_free (bookmark_name);
+18 -7
View File
@@ -550,7 +550,7 @@ populate_servers (GtkPlacesView *view)
/* clear previous items */
while ((child = gtk_widget_get_first_child (GTK_WIDGET (view->recent_servers_listbox))))
gtk_list_box_remove (GTK_LIST_BOX (view->listbox), child);
gtk_list_box_remove (GTK_LIST_BOX (view->recent_servers_listbox), child);
gtk_list_store_clear (view->completion_store);
@@ -1215,12 +1215,14 @@ server_mount_ready_cb (GObject *source_file,
g_clear_error (&error);
}
if (view->destroyed) {
g_object_unref (view);
return;
}
if (view->destroyed)
{
g_object_unref (view);
return;
}
view->should_pulse_entry = FALSE;
gtk_entry_set_progress_fraction (GTK_ENTRY (view->address_entry), 0);
/* Restore from Cancel to Connect */
gtk_button_set_label (GTK_BUTTON (view->connect_button), _("Con_nect"));
@@ -1243,6 +1245,11 @@ server_mount_ready_cb (GObject *source_file,
GMount *mount;
GFile *root;
/*
* If the mount is not found at this point, it is probably user-
* invisible, which happens e.g for smb-browse, but the location
* should be opened anyway...
*/
mount = g_file_find_enclosing_mount (location, view->cancellable, NULL);
if (mount)
{
@@ -1253,6 +1260,10 @@ server_mount_ready_cb (GObject *source_file,
g_object_unref (root);
g_object_unref (mount);
}
else
{
emit_open_location (view, location, view->open_flags);
}
}
}
@@ -1388,8 +1399,7 @@ pulse_entry_cb (gpointer user_data)
}
else
{
gtk_entry_set_progress_pulse_step (GTK_ENTRY (view->address_entry), 0.0);
gtk_entry_set_progress_fraction (GTK_ENTRY (view->address_entry), 0.0);
gtk_entry_set_progress_fraction (GTK_ENTRY (view->address_entry), 0);
view->entry_pulse_timeout_id = 0;
return G_SOURCE_REMOVE;
@@ -1443,6 +1453,7 @@ mount_server (GtkPlacesView *view,
view->should_pulse_entry = TRUE;
gtk_entry_set_progress_pulse_step (GTK_ENTRY (view->address_entry), 0.1);
gtk_entry_set_progress_fraction (GTK_ENTRY (view->address_entry), 0.1);
/* Allow to cancel the operation */
gtk_button_set_label (GTK_BUTTON (view->connect_button), _("Cance_l"));
gtk_widget_set_sensitive (view->address_entry, FALSE);
+1 -1
View File
@@ -720,7 +720,7 @@ build_recent_items_list (GtkRecentManager *manager)
* signal each time something inside the list changes.
*
* `GtkRecentManager` objects are expensive: be sure to create them
* only when needed. You should use [type_func@Gtk.RecentManager.get_default]
* only when needed. You should use [func@Gtk.RecentManager.get_default]
* instead.
*
* Returns: A newly created `GtkRecentManager` object
+1 -21
View File
@@ -401,9 +401,6 @@ static void indicator_start_fade (Indicator *indicator,
static void indicator_set_over (Indicator *indicator,
gboolean over);
static void install_scroll_cursor (GtkScrolledWindow *scrolled_window);
static void uninstall_scroll_cursor (GtkScrolledWindow *scrolled_window);
static void scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
double delta_x,
double delta_y,
@@ -1335,10 +1332,7 @@ start_scroll_deceleration_cb (gpointer user_data)
priv->scroll_events_overshoot_id = 0;
if (!priv->deceleration_id)
{
uninstall_scroll_cursor (scrolled_window);
gtk_scrolled_window_start_deceleration (scrolled_window);
}
gtk_scrolled_window_start_deceleration (scrolled_window);
return FALSE;
}
@@ -1349,7 +1343,6 @@ scroll_controller_scroll_begin (GtkEventControllerScroll *scroll,
{
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
install_scroll_cursor (scrolled_window);
priv->smooth_scroll = TRUE;
}
@@ -1442,7 +1435,6 @@ scroll_controller_scroll_end (GtkEventControllerScroll *scroll,
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
priv->smooth_scroll = FALSE;
uninstall_scroll_cursor (scrolled_window);
}
static void
@@ -3184,18 +3176,6 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
*allocation = child_allocation;
}
static void
install_scroll_cursor (GtkScrolledWindow *scrolled_window)
{
gtk_widget_set_cursor_from_name (GTK_WIDGET (scrolled_window), "all-scroll");
}
static void
uninstall_scroll_cursor (GtkScrolledWindow *scrolled_window)
{
gtk_widget_set_cursor (GTK_WIDGET (scrolled_window), NULL);
}
static void
_gtk_scrolled_window_set_adjustment_value (GtkScrolledWindow *scrolled_window,
GtkAdjustment *adjustment,
+2
View File
@@ -475,6 +475,8 @@ gtk_search_entry_accessible_get_platform_state (GtkAccessible *self
return gtk_widget_get_focusable (GTK_WIDGET (entry->entry));
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED:
return gtk_widget_has_focus (GTK_WIDGET (entry->entry));
case GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE:
return FALSE;
default:
g_assert_not_reached ();
}
+13
View File
@@ -943,6 +943,19 @@ sec_acquire_pages (size_t *sz,
DEBUG_ALLOC ("gtk-secure-memory: new block ", *sz);
#if defined(HAVE_MADVISE) && defined(MADV_DONTDUMP)
if (madvise (pages, *sz, MADV_DONTDUMP) < 0) {
if (show_warning && gtk_secure_warnings) {
/*
* Not fatal - this was added in Linux 3.4 and older
* kernels will legitimately fail this at runtime
*/
fprintf (stderr, "couldn't MADV_DONTDUMP %lu bytes of memory (%s): %s\n",
(unsigned long)*sz, during_tag, strerror (errno));
}
}
#endif
show_warning = 1;
return pages;
+3 -2
View File
@@ -89,7 +89,7 @@
* configuration facility.
*
* There is one `GtkSettings` instance per display. It can be obtained with
* [type_func@GtkSettings.get_for_display], but in many cases, it is more
* [func@Gtk.Settings.get_for_display], but in many cases, it is more
* convenient to use [method@Gtk.Widget.get_settings].
*/
@@ -1333,7 +1333,7 @@ gtk_settings_get_for_display (GdkDisplay *display)
* Gets the `GtkSettings` object for the default display, creating
* it if necessary.
*
* See [type_func@Gtk.Settings.get_for_display].
* See [func@Gtk.Settings.get_for_display].
*
* Returns: (nullable) (transfer none): a `GtkSettings` object. If there is
* no default display, then returns %NULL.
@@ -1432,6 +1432,7 @@ gtk_settings_notify (GObject *object,
settings_update_theme (settings);
break;
case PROP_XFT_DPI:
settings_invalidate_style (settings);
gtk_system_setting_changed (settings->display, GTK_SYSTEM_SETTING_DPI);
break;
case PROP_XFT_ANTIALIAS:
+1 -1
View File
@@ -132,7 +132,7 @@ gtk_shortcut_action_print (GtkShortcutAction *self,
g_return_if_fail (GTK_IS_SHORTCUT_ACTION (self));
g_return_if_fail (string != NULL);
return GTK_SHORTCUT_ACTION_GET_CLASS (self)->print (self, string);
GTK_SHORTCUT_ACTION_GET_CLASS (self)->print (self, string);
}
/**
+4 -2
View File
@@ -432,9 +432,11 @@ gtk_shortcut_controller_handle_event (GtkEventController *controller,
if (event_type == GDK_KEY_PRESS)
{
GdkModifierType modifiers;
GdkModifierType modifiers, consumed_modifiers;
modifiers = gdk_event_get_modifier_state (event);
enable_mnemonics = (modifiers & gtk_accelerator_get_default_mod_mask ()) == self->mnemonics_modifiers;
consumed_modifiers = gdk_key_event_get_consumed_modifiers (event);
enable_mnemonics = (modifiers & ~consumed_modifiers & gtk_accelerator_get_default_mod_mask ()) == self->mnemonics_modifiers;
}
else
{
+10 -3
View File
@@ -208,6 +208,7 @@ struct _GtkSpinButton
double climb_rate;
double timer_step;
double swipe_remainder;
int width_chars;
@@ -633,6 +634,8 @@ gtk_spin_button_accessible_get_platform_state (GtkAccessible *self,
return gtk_widget_get_focusable (spin_button->entry);
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED:
return gtk_widget_has_focus (spin_button->entry);
case GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE:
return FALSE;
default:
g_assert_not_reached ();
}
@@ -836,6 +839,7 @@ swipe_gesture_begin (GtkGesture *gesture,
{
gtk_gesture_set_state (gesture, GTK_EVENT_SEQUENCE_CLAIMED);
gtk_widget_grab_focus (GTK_WIDGET (spin_button));
spin_button->swipe_remainder = 0;
}
static void
@@ -843,10 +847,12 @@ swipe_gesture_update (GtkGesture *gesture,
GdkEventSequence *sequence,
GtkSpinButton *spin_button)
{
double vel_y;
double vel_y, step;
gtk_gesture_swipe_get_velocity (GTK_GESTURE_SWIPE (gesture), NULL, &vel_y);
gtk_spin_button_real_spin (spin_button, -vel_y / 20);
step = (-vel_y / 20) + spin_button->swipe_remainder;
spin_button->swipe_remainder = fmod (step, gtk_adjustment_get_step_increment (spin_button->adjustment));
gtk_spin_button_real_spin (spin_button, step - spin_button->swipe_remainder);
}
static gboolean
@@ -1076,7 +1082,8 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
G_CALLBACK (swipe_gesture_begin), spin_button);
g_signal_connect (gesture, "update",
G_CALLBACK (swipe_gesture_update), spin_button);
gtk_widget_add_controller (GTK_WIDGET (spin_button), GTK_EVENT_CONTROLLER (gesture));
gtk_widget_add_controller (GTK_WIDGET (spin_button->entry),
GTK_EVENT_CONTROLLER (gesture));
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
+4
View File
@@ -154,6 +154,10 @@ rebuild_child (GtkWidget *self,
gtk_widget_set_halign (GTK_WIDGET (button_child), GTK_ALIGN_CENTER);
gtk_button_set_child (GTK_BUTTON (self), button_child);
}
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL, title,
-1);
}
static void
+25
View File
@@ -78,12 +78,37 @@ gtk_test_at_context_state_change (GtkATContext *self,
}
}
static void
gtk_test_at_context_platform_change (GtkATContext *self,
GtkAccessiblePlatformChange changed_platform)
{
if (GTK_DEBUG_CHECK (A11Y))
{
GtkAccessible *accessible;
accessible = gtk_at_context_get_accessible (self);
g_print ("*** Accessible platform state changed for accessible “%s”:\n",
G_OBJECT_TYPE_NAME (accessible));
if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSABLE)
g_print ("*** focusable = %d\n",
gtk_accessible_get_platform_state (accessible, GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSABLE));
if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSED)
g_print ("*** focused = %d\n",
gtk_accessible_get_platform_state (accessible, GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED));
if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_ACTIVE)
g_print ("*** active = %d\n",
gtk_accessible_get_platform_state (accessible, GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE));
}
}
static void
gtk_test_at_context_class_init (GtkTestATContextClass *klass)
{
GtkATContextClass *context_class = GTK_AT_CONTEXT_CLASS (klass);
context_class->state_change = gtk_test_at_context_state_change;
context_class->platform_change = gtk_test_at_context_platform_change;
}
static void
+4 -1
View File
@@ -199,6 +199,9 @@ gtk_toggle_button_clicked (GtkButton *button)
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button);
if (priv->active && (priv->group_prev || priv->group_next))
return;
gtk_toggle_button_set_active (toggle_button, !priv->active);
}
@@ -475,7 +478,7 @@ gtk_toggle_button_toggled (GtkToggleButton *toggle_button)
*
* Setting up groups in a cycle leads to undefined behavior.
*
* Note that the same effect can be achieved via the [interface@Gtk.Actionable]
* Note that the same effect can be achieved via the [iface@Gtk.Actionable]
* API, by using the same action with parameter type and state type 's'
* for all buttons in the group, and giving each button its own target
* value.
+12 -5
View File
@@ -151,6 +151,8 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
gtk_widget_unparent (child);
}
self->expander = NULL;
gtk_accessible_reset_state (GTK_ACCESSIBLE (self), GTK_ACCESSIBLE_STATE_EXPANDED);
}
else
{
@@ -192,22 +194,19 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
gtk_accessible_update_property (GTK_ACCESSIBLE (self->expander),
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Expand"),
-1);
gtk_accessible_update_relation (GTK_ACCESSIBLE (self->expander),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, self->child, NULL,
-1);
}
if (gtk_tree_list_row_get_expanded (self->list_row))
{
gtk_widget_set_state_flags (self->expander, GTK_STATE_FLAG_CHECKED, FALSE);
gtk_accessible_update_state (GTK_ACCESSIBLE (self->expander),
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
-1);
}
else
{
gtk_widget_unset_state_flags (self->expander, GTK_STATE_FLAG_CHECKED);
gtk_accessible_update_state (GTK_ACCESSIBLE (self->expander),
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
-1);
}
@@ -725,6 +724,14 @@ gtk_tree_expander_set_child (GtkTreeExpander *self,
{
self->child = child;
gtk_widget_set_parent (child, GTK_WIDGET (self));
gtk_accessible_update_relation (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, self->child, NULL,
-1);
}
else
{
gtk_accessible_reset_relation (GTK_ACCESSIBLE (self), GTK_ACCESSIBLE_RELATION_LABELLED_BY);
}
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CHILD]);
+2 -2
View File
@@ -37,7 +37,7 @@ G_BEGIN_DECLS
/**
* GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID:
*
* Uses the default sort function in a [interface@Gtk.TreeSortable].
* Uses the default sort function in a [iface@Gtk.TreeSortable].
*
* See also: [method@Gtk.TreeSortable.set_sort_column_id]
*/
@@ -46,7 +46,7 @@ G_BEGIN_DECLS
/**
* GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID:
*
* Disables sorting in a [interface@Gtk.TreeSortable].
* Disables sorting in a [iface@Gtk.TreeSortable].
*
* See also: [method@Gtk.TreeSortable.set_sort_column_id]
*/
+1
View File
@@ -855,6 +855,7 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
priv->button = gtk_button_new ();
g_object_ref_sink (priv->button);
gtk_widget_set_focus_on_click (priv->button, FALSE);
gtk_widget_set_overflow (priv->button, GTK_OVERFLOW_HIDDEN);
g_signal_connect (priv->button, "clicked",
G_CALLBACK (gtk_tree_view_column_button_clicked),
+21 -5
View File
@@ -74,6 +74,7 @@
#include "gtkwidgetpaintableprivate.h"
#include "gtkwindowgroup.h"
#include "gtkwindowprivate.h"
#include "gtktestatcontextprivate.h"
#include "inspector/window.h"
@@ -2449,13 +2450,13 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
priv->at_context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (widget));
}
void
gtk_widget_realize_at_context (GtkWidget *self)
static void
gtk_widget_root_at_context (GtkWidget *self)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (self);
GtkAccessibleRole role = priv->accessible_role;
if (priv->at_context == NULL || gtk_at_context_is_realized (priv->at_context))
if (priv->at_context == NULL)
return;
/* Reset the accessible role to its current value */
@@ -2468,6 +2469,17 @@ gtk_widget_realize_at_context (GtkWidget *self)
gtk_at_context_set_accessible_role (priv->at_context, role);
gtk_at_context_set_display (priv->at_context, gtk_root_get_display (priv->root));
}
void
gtk_widget_realize_at_context (GtkWidget *self)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (self);
if (priv->at_context == NULL || gtk_at_context_is_realized (priv->at_context))
return;
gtk_widget_root_at_context (self);
gtk_at_context_realize (priv->at_context);
}
@@ -2511,6 +2523,8 @@ gtk_widget_root (GtkWidget *widget)
if (priv->layout_manager)
gtk_layout_manager_set_root (priv->layout_manager, priv->root);
gtk_widget_root_at_context (widget);
GTK_WIDGET_GET_CLASS (widget)->root (widget);
if (!GTK_IS_ROOT (widget))
@@ -7812,7 +7826,7 @@ _gtk_widget_list_devices (GtkWidget *widget,
}
root = gtk_widget_get_root (widget);
if (!root)
if (!GTK_IS_WINDOW (root))
{
*out_n_devices = 0;
return NULL;
@@ -8492,6 +8506,8 @@ gtk_widget_accessible_get_platform_state (GtkAccessible *self,
return gtk_widget_get_focusable (GTK_WIDGET (self));
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED:
return gtk_widget_has_focus (GTK_WIDGET (self));
case GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE:
return FALSE;
default:
g_assert_not_reached ();
}
@@ -12146,7 +12162,7 @@ gtk_widget_set_cursor (GtkWidget *widget,
return;
root = _gtk_widget_get_root (widget);
if (root)
if (GTK_IS_WINDOW (root))
gtk_window_maybe_update_cursor (GTK_WINDOW (root), widget, NULL);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CURSOR]);
+107 -51
View File
@@ -26,6 +26,7 @@
#include "gtkwindowprivate.h"
#include "gtkaccessibleprivate.h"
#include "gtkaccelgroupprivate.h"
#include "gtkactionable.h"
#include "gtkapplicationprivate.h"
@@ -148,7 +149,8 @@
*/
#define MENU_BAR_ACCEL GDK_KEY_F10
#define RESIZE_HANDLE_SIZE 20
#define RESIZE_HANDLE_SIZE 12 /* Width of resize borders */
#define RESIZE_HANDLE_CORNER_SIZE 24 /* How resize corners extend */
#define MNEMONICS_DELAY 300 /* ms */
#define NO_CONTENT_CHILD_NAT 200 /* ms */
#define VISIBLE_FOCUS_DURATION 3 /* s */
@@ -371,6 +373,8 @@ static gboolean surface_render (GdkSurface *surface,
static gboolean surface_event (GdkSurface *surface,
GdkEvent *event,
GtkWidget *widget);
static void after_paint (GdkFrameClock *clock,
GtkWindow *window);
static int gtk_window_focus (GtkWidget *widget,
GtkDirectionType direction);
@@ -477,6 +481,9 @@ static void gtk_window_shortcut_manager_interface_init (GtkShor
static void gtk_window_root_interface_init (GtkRootInterface *iface);
static void gtk_window_native_interface_init (GtkNativeInterface *iface);
static void gtk_window_accessible_interface_init (GtkAccessibleInterface *iface);
static void ensure_state_flag_backdrop (GtkWidget *widget);
static void unset_titlebar (GtkWindow *window);
@@ -491,6 +498,8 @@ gtk_window_update_csd_size (GtkWindow *window,
G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_WIDGET,
G_ADD_PRIVATE (GtkWindow)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE,
gtk_window_accessible_interface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_window_buildable_interface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_NATIVE,
@@ -500,6 +509,32 @@ G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ROOT,
gtk_window_root_interface_init))
static GtkAccessibleInterface *parent_accessible_iface;
static gboolean
gtk_window_accessible_get_platform_state (GtkAccessible *self,
GtkAccessiblePlatformState state)
{
switch (state)
{
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSABLE:
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED:
return parent_accessible_iface->get_platform_state (self, state);
case GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE:
return gtk_window_is_active (GTK_WINDOW (self));
default:
g_assert_not_reached ();
}
}
static void
gtk_window_accessible_interface_init (GtkAccessibleInterface *iface)
{
parent_accessible_iface = g_type_interface_peek_parent (iface);
iface->get_at_context = parent_accessible_iface->get_at_context;
iface->get_platform_state = gtk_window_accessible_get_platform_state;
}
static void
add_tab_bindings (GtkWidgetClass *widget_class,
GdkModifierType modifiers,
@@ -1329,10 +1364,10 @@ static void
get_box_border (GtkCssStyle *style,
GtkBorder *border)
{
border->top = get_number (style->border->border_top_width);
border->left = get_number (style->border->border_left_width);
border->bottom = get_number (style->border->border_bottom_width);
border->right = get_number (style->border->border_right_width);
border->top = get_number (style->border->border_top_width) + get_number (style->size->padding_top);
border->left = get_number (style->border->border_left_width) + get_number (style->size->padding_left);
border->bottom = get_number (style->border->border_bottom_width) + get_number (style->size->padding_bottom);
border->right = get_number (style->border->border_right_width) + get_number (style->size->padding_right);
}
static int
@@ -1361,7 +1396,10 @@ get_edge_for_coordinates (GtkWindow *window,
return -1;
gtk_css_boxes_init (&css_boxes, GTK_WIDGET (window));
border_rect = gtk_css_boxes_get_padding_rect (&css_boxes);
border_rect = gtk_css_boxes_get_content_rect (&css_boxes);
get_box_border (gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (window))),
&handle_size);
if (priv->use_client_shadow)
{
@@ -1370,16 +1408,10 @@ get_edge_for_coordinates (GtkWindow *window,
get_shadow_width (window, &shadow);
/* This logic is duplicated in update_realized_window_properties() */
handle_size.left = MIN (RESIZE_HANDLE_SIZE, shadow.left);
handle_size.top = MIN (RESIZE_HANDLE_SIZE, shadow.top);
handle_size.right = MIN (RESIZE_HANDLE_SIZE, shadow.right);
handle_size.bottom = MIN (RESIZE_HANDLE_SIZE, shadow.bottom);
}
else
{
/* Use border */
get_box_border (gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (window))),
&handle_size);
handle_size.left += shadow.left;
handle_size.top += shadow.top;
handle_size.right += shadow.right;
handle_size.bottom += shadow.bottom;
}
left = border_rect->origin.x;
@@ -1387,10 +1419,10 @@ get_edge_for_coordinates (GtkWindow *window,
if (x < left && x >= left - handle_size.left)
{
if (y < top + handle_size.top && y >= top - handle_size.top)
if (y < top + RESIZE_HANDLE_CORNER_SIZE && y >= top - handle_size.top)
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
if (y > top + border_rect->size.height - handle_size.bottom &&
if (y > top + border_rect->size.height - RESIZE_HANDLE_CORNER_SIZE &&
y <= top + border_rect->size.height + handle_size.bottom)
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
@@ -1399,10 +1431,10 @@ get_edge_for_coordinates (GtkWindow *window,
else if (x > left + border_rect->size.width &&
x <= left + border_rect->size.width + handle_size.right)
{
if (y < top + handle_size.top && y >= top - handle_size.top)
if (y < top + RESIZE_HANDLE_CORNER_SIZE && y >= top - handle_size.top)
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
if (y > top + border_rect->size.height - handle_size.bottom &&
if (y > top + border_rect->size.height - RESIZE_HANDLE_CORNER_SIZE &&
y <= top + border_rect->size.height + handle_size.bottom)
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);
@@ -1410,10 +1442,10 @@ get_edge_for_coordinates (GtkWindow *window,
}
else if (y < top && y >= top - handle_size.top)
{
if (x < left + handle_size.left && x >= left - handle_size.left)
if (x < left + RESIZE_HANDLE_CORNER_SIZE && x >= left - handle_size.left)
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
if (x > left + border_rect->size.width - handle_size.right &&
if (x > left + border_rect->size.width - RESIZE_HANDLE_CORNER_SIZE &&
x <= left + border_rect->size.width + handle_size.right)
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
@@ -1422,10 +1454,10 @@ get_edge_for_coordinates (GtkWindow *window,
else if (y > top + border_rect->size.height &&
y <= top + border_rect->size.height + handle_size.bottom)
{
if (x < left + handle_size.left && x >= left - handle_size.left)
if (x < left + RESIZE_HANDLE_CORNER_SIZE && x >= left - handle_size.left)
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
if (x > left + border_rect->size.width - handle_size.right &&
if (x > left + border_rect->size.width - RESIZE_HANDLE_CORNER_SIZE &&
x <= left + border_rect->size.width + handle_size.right)
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);
@@ -2009,6 +2041,8 @@ gtk_window_root_set_focus (GtkRoot *root,
g_clear_object (&old_focus);
priv->move_focus = FALSE;
g_object_notify (G_OBJECT (self), "focus-widget");
}
@@ -2286,6 +2320,8 @@ gtk_window_set_default_widget (GtkWindow *window,
priv->default_widget = default_widget;
priv->unset_default = FALSE;
if (priv->default_widget)
{
if (priv->focus_widget == NULL ||
@@ -3002,8 +3038,10 @@ gtk_window_set_titlebar (GtkWindow *window,
if (titlebar == NULL)
{
/* these are updated in realize() */
priv->client_decorated = FALSE;
gtk_widget_remove_css_class (widget, "csd");
gtk_widget_remove_css_class (widget, "solid-csd");
goto out;
}
@@ -3969,9 +4007,8 @@ get_shadow_width (GtkWindow *window,
if (!priv->decorated)
goto out;
if (!priv->client_decorated &&
!(gtk_window_should_use_csd (window) &&
gtk_window_supports_client_shadow (window)))
if (!priv->client_decorated ||
!priv->use_client_shadow)
goto out;
if (priv->maximized ||
@@ -3982,6 +4019,12 @@ get_shadow_width (GtkWindow *window,
/* Calculate the size of the drop shadows ... */
gtk_css_shadow_value_get_extents (style->background->box_shadow, shadow_width);
shadow_width->left = MAX (shadow_width->left, RESIZE_HANDLE_SIZE);
shadow_width->top = MAX (shadow_width->top, RESIZE_HANDLE_SIZE);
shadow_width->bottom = MAX (shadow_width->bottom, RESIZE_HANDLE_SIZE);
shadow_width->right = MAX (shadow_width->right, RESIZE_HANDLE_SIZE);
return;
out:
@@ -4088,7 +4131,6 @@ update_realized_window_properties (GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkBorder shadow;
GtkBorder resize_handle;
GdkRectangle rect;
GtkCssBoxes css_boxes;
const graphene_rect_t *border_rect;
@@ -4097,7 +4139,7 @@ update_realized_window_properties (GtkWindow *window)
get_shadow_width (window, &shadow);
update_opaque_region (window, &shadow);
if (!priv->client_decorated)
if (!priv->client_decorated || !priv->use_client_shadow)
return;
gtk_native_get_surface_transform (GTK_NATIVE (window), &native_x, &native_y);
@@ -4108,15 +4150,10 @@ update_realized_window_properties (GtkWindow *window)
border_rect = gtk_css_boxes_get_border_rect (&css_boxes);
/* This logic is duplicated in get_edge_for_coordinates() */
resize_handle.left = MIN (shadow.left, RESIZE_HANDLE_SIZE);
resize_handle.top = MIN (shadow.top, RESIZE_HANDLE_SIZE);
resize_handle.right = MIN (shadow.right, RESIZE_HANDLE_SIZE);
resize_handle.bottom = MIN (shadow.bottom, RESIZE_HANDLE_SIZE);
rect.x = native_x + border_rect->origin.x - resize_handle.left;
rect.y = native_y + border_rect->origin.y - resize_handle.top;
rect.width = border_rect->size.width + resize_handle.left + resize_handle.right;
rect.height = border_rect->size.height + resize_handle.top + resize_handle.bottom;
rect.x = native_x + border_rect->origin.x - RESIZE_HANDLE_SIZE;
rect.y = native_y + border_rect->origin.y - RESIZE_HANDLE_SIZE;
rect.width = border_rect->size.width + 2 * RESIZE_HANDLE_SIZE;
rect.height = border_rect->size.height + 2 * RESIZE_HANDLE_SIZE;
if (rect.width > 0 && rect.height > 0)
{
@@ -4256,6 +4293,7 @@ gtk_window_realize (GtkWidget *widget)
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GdkSurface *surface;
GdkFrameClock *frame_clock;
/* Create default title bar */
if (!priv->client_decorated && gtk_window_should_use_csd (window))
@@ -4292,6 +4330,9 @@ gtk_window_realize (GtkWidget *widget)
g_signal_connect (surface, "event", G_CALLBACK (surface_event), widget);
g_signal_connect (surface, "compute-size", G_CALLBACK (toplevel_compute_size), widget);
frame_clock = gdk_surface_get_frame_clock (surface);
g_signal_connect (frame_clock, "after-paint", G_CALLBACK (after_paint), widget);
GTK_WIDGET_CLASS (gtk_window_parent_class)->realize (widget);
gtk_root_start_layout (GTK_ROOT (window));
@@ -4363,6 +4404,7 @@ gtk_window_unrealize (GtkWidget *widget)
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWindowGeometryInfo *info;
GdkSurface *surface;
GdkFrameClock *frame_clock;
gtk_native_unrealize (GTK_NATIVE (window));
@@ -4403,6 +4445,10 @@ gtk_window_unrealize (GtkWidget *widget)
g_signal_handlers_disconnect_by_func (surface, surface_render, widget);
g_signal_handlers_disconnect_by_func (surface, surface_event, widget);
frame_clock = gdk_surface_get_frame_clock (surface);
g_signal_handlers_disconnect_by_func (frame_clock, after_paint, widget);
gtk_root_stop_layout (GTK_ROOT (window));
GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize (widget);
@@ -4660,16 +4706,10 @@ maybe_unset_focus_and_default (GtkWindow *window)
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
if (priv->move_focus)
{
gtk_widget_child_focus (GTK_WIDGET (window), GTK_DIR_TAB_FORWARD);
priv->move_focus = FALSE;
}
gtk_widget_child_focus (GTK_WIDGET (window), GTK_DIR_TAB_FORWARD);
if (priv->unset_default)
{
gtk_window_set_default_widget (window, NULL);
priv->unset_default = FALSE;
}
gtk_window_set_default_widget (window, NULL);
}
static gboolean
@@ -4677,14 +4717,18 @@ surface_render (GdkSurface *surface,
cairo_region_t *region,
GtkWidget *widget)
{
GtkWindow *window = GTK_WINDOW (widget);
gtk_widget_render (widget, surface, region);
maybe_unset_focus_and_default (window);
return TRUE;
}
static void
after_paint (GdkFrameClock *clock,
GtkWindow *window)
{
maybe_unset_focus_and_default (window);
}
static gboolean
surface_event (GdkSurface *surface,
GdkEvent *event,
@@ -5129,6 +5173,16 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
child = priv->default_widget;
if (child && (child == widget || gtk_widget_is_ancestor (child, widget)))
priv->unset_default = TRUE;
if ((priv->move_focus || priv->unset_default) &&
priv->surface != NULL)
{
GdkFrameClock *frame_clock;
frame_clock = gdk_surface_get_frame_clock (priv->surface);
gdk_frame_clock_request_phase (frame_clock,
GDK_FRAME_CLOCK_PHASE_AFTER_PAINT);
}
}
#undef INCLUDE_CSD_SIZE
@@ -5805,6 +5859,8 @@ _gtk_window_set_is_active (GtkWindow *window,
g_object_unref (focus);
}
gtk_accessible_platform_changed (GTK_ACCESSIBLE (window), GTK_ACCESSIBLE_PLATFORM_CHANGE_ACTIVE);
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_IS_ACTIVE]);
}
@@ -6120,8 +6176,8 @@ inspector_keybinding_enabled (gboolean *warn)
GSettings *settings;
gboolean enabled;
enabled = FALSE;
*warn = FALSE;
enabled = TRUE;
*warn = TRUE;
schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (),
"org.gtk.gtk4.Settings.Debug",
+58 -27
View File
@@ -568,26 +568,23 @@ populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
gdk_display_is_composited (display));
}
static GtkWidget *
populate_monitor (gpointer item,
gpointer gen)
static void
add_monitor (GtkInspectorGeneral *gen,
GdkMonitor *monitor,
guint i)
{
GtkListBox *list;
GdkMonitor *monitor = item;
char *name;
char *value;
GdkRectangle rect;
int scale;
char *name;
char *scale_str = NULL;
const char *manufacturer;
const char *model;
list = GTK_LIST_BOX (gtk_list_box_new ());
gtk_widget_add_css_class (GTK_WIDGET (list), "rich-list");
gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE);
list = GTK_LIST_BOX (gen->monitor_box);
/* XXX: add monitor # here when porting to listview */
name = g_strdup_printf ("Monitor %d", 1);
name = g_strdup_printf ("Monitor %u", i);
manufacturer = gdk_monitor_get_manufacturer (monitor);
model = gdk_monitor_get_model (monitor);
value = g_strdup_printf ("%s%s%s",
@@ -595,13 +592,15 @@ populate_monitor (gpointer item,
manufacturer || model ? " " : "",
model ? model : "");
add_label_row (gen, list, name, value, 0);
g_free (name);
g_free (value);
g_free (name);
add_label_row (gen, list, "Connector", gdk_monitor_get_connector (monitor), 10);
gdk_monitor_get_geometry (monitor, &rect);
scale = gdk_monitor_get_scale_factor (monitor);
if (scale != 1)
scale_str = g_strdup_printf (" @ %d", scale);
scale_str = g_strdup_printf ("@%d", scale);
value = g_strdup_printf ("%d × %d%s at %d, %d",
rect.width, rect.height,
@@ -611,25 +610,46 @@ populate_monitor (gpointer item,
g_free (value);
g_free (scale_str);
value = g_strdup_printf ("%d × %d mm²",
value = g_strdup_printf ("%d × %dmm²",
gdk_monitor_get_width_mm (monitor),
gdk_monitor_get_height_mm (monitor));
add_label_row (gen, list, "Size", value, 10);
g_free (value);
if (gdk_monitor_get_refresh_rate (monitor) != 0)
value = g_strdup_printf ("%.2f Hz",
0.001 * gdk_monitor_get_refresh_rate (monitor));
else
value = g_strdup ("unknown");
add_label_row (gen, list, "Refresh rate", value, 10);
g_free (value);
{
value = g_strdup_printf ("%.2fHz",
0.001 * gdk_monitor_get_refresh_rate (monitor));
add_label_row (gen, list, "Refresh rate", value, 10);
g_free (value);
}
value = g_strdup (translate_subpixel_layout (gdk_monitor_get_subpixel_layout (monitor)));
add_label_row (gen, list, "Subpixel layout", value, 10);
g_free (value);
if (gdk_monitor_get_subpixel_layout (monitor) != GDK_SUBPIXEL_LAYOUT_UNKNOWN)
{
add_label_row (gen, list, "Subpixel layout",
translate_subpixel_layout (gdk_monitor_get_subpixel_layout (monitor)),
10);
}
}
return GTK_WIDGET (list);
static void
populate_monitors (GdkDisplay *display,
GtkInspectorGeneral *gen)
{
GtkWidget *child;
GListModel *list;
while ((child = gtk_widget_get_first_child (gen->monitor_box)))
gtk_list_box_remove (GTK_LIST_BOX (gen->monitor_box), child);
list = gdk_display_get_monitors (gen->display);
for (guint i = 0; i < g_list_model_get_n_items (list); i++)
{
GdkMonitor *monitor = g_list_model_get_item (list, i);
add_monitor (gen, monitor, i);
g_object_unref (monitor);
}
}
static void
@@ -640,16 +660,25 @@ populate_display_notify_cb (GdkDisplay *display,
populate_display (display, gen);
}
static void
monitors_changed_cb (GListModel *monitors,
guint position,
guint removed,
guint added,
GtkInspectorGeneral *gen)
{
populate_monitors (gen->display, gen);
}
static void
init_display (GtkInspectorGeneral *gen)
{
g_signal_connect (gen->display, "notify", G_CALLBACK (populate_display_notify_cb), gen);
gtk_list_box_bind_model (GTK_LIST_BOX (gen->monitor_box),
gdk_display_get_monitors (gen->display),
populate_monitor,
gen, NULL);
g_signal_connect (gdk_display_get_monitors (gen->display), "items-changed",
G_CALLBACK (monitors_changed_cb), gen);
populate_display (gen->display, gen);
populate_monitors (gen->display, gen);
}
static void
@@ -953,6 +982,8 @@ gtk_inspector_general_dispose (GObject *object)
g_signal_handlers_disconnect_by_func (gen->display, G_CALLBACK (seat_added), gen);
g_signal_handlers_disconnect_by_func (gen->display, G_CALLBACK (seat_removed), gen);
g_signal_handlers_disconnect_by_func (gen->display, G_CALLBACK (populate_display_notify_cb), gen);
g_signal_handlers_disconnect_by_func (gdk_display_get_monitors (gen->display), G_CALLBACK (monitors_changed_cb), gen);
list = gdk_display_list_seats (gen->display);
for (l = list; l; l = l->next)
+18 -1
View File
@@ -1116,11 +1116,28 @@ libgtk_static = static_library('gtk',
link_with: [libgtk_css, libgdk, libgsk ],
)
# `link_whole:` is actually only supported on Visual Studio 2015 Update 2
# or later via the linker flag `/WHOLEARCHIVE:<static_lib>`, so we need
# to work around it for Visual Studio 2013. Note that all needed static
# libs are required so that we grab the object files from each of them to
# link the final GTK DLL.
whole_archives = []
gtk4_objs = []
if cc.get_id() == 'msvc' and cc.version().split('.').get(0) < '19'
foreach target : [ libgtk_static, libgtk_css, libgdk, libgdk_win32, libgsk ]
gtk4_objs += target.extract_all_objects(recursive: false)
endforeach
else
whole_archives = [libgtk_static, libgtk_css, libgdk, libgsk ]
endif
libgtk = shared_library('gtk-4',
c_args: gtk_cargs + common_cflags,
include_directories: [confinc, gdkinc, gskinc, gtkinc],
dependencies: gtk_deps + [libgtk_css_dep, libgdk_dep, libgsk_dep],
link_whole: [libgtk_static, libgtk_css, libgdk, libgsk ],
link_whole: whole_archives,
objects: gtk4_objs,
link_args: common_ldflags,
soversion: gtk_soversion,
version: gtk_library_version,
+16 -22
View File
@@ -38,19 +38,9 @@ dnd {
-gtk-icon-size: 32px;
}
/*
These wildcard seems unavoidable, need to investigate.
Wildcards are bad and troublesome, use them with care,
or better, just don't.
Every time a wildcard is used a kitten dies, painfully.
*/
spinner:disabled,
arrow:disabled,
scrollbar:disabled,
check:disabled,
radio:disabled,
treeview.expander:disabled { -gtk-icon-filter: opacity(0.5); }
image:disabled {
-gtk-icon-filter: opacity(0.5);
}
.view,
%view {
@@ -492,6 +482,7 @@ button {
-gtk-icon-filter: brightness(1.2);
}
&.keyboard-activating,
&:active,
&:checked {
@include button(active);
@@ -507,7 +498,8 @@ button {
@include button(backdrop);
transition: $backdrop_transition;
-gtk-icon-filter: none;
&:not(:disabled) { -gtk-icon-filter: none; }
&:active,
&:checked { @include button(backdrop-active); }
@@ -523,6 +515,7 @@ button {
&:disabled {
@include button(insensitive);
-gtk-icon-filter: opacity(0.5);
&:active,
&:checked { @include button(insensitive-active); }
@@ -542,6 +535,7 @@ button {
transition: $button_transition;
transition-duration: 500ms;
}
&.keyboard-activating,
&:active,
&:checked {
@include button(undecorated-active);
@@ -4073,16 +4067,16 @@ window {
box-shadow: 0 1px 2px transparentize(black, 0.8),
0 0 0 1px transparentize($_wm_border, 0.1);
}
}
&.solid-csd {
margin: 0;
padding: 0;
border: solid 1px $borders_color;
border-radius: 0;
box-shadow: inset 0 0 0 3px $headerbar_bg_color, inset 0 1px $top_hilight;
&.solid-csd {
margin: 0;
padding: 4px;
border: solid 1px $borders_color;
border-radius: 0;
box-shadow: inset 0 0 0 4px $borders_color, inset 0 0 0 3px $headerbar_bg_color, inset 0 1px $top_hilight;
&:backdrop { box-shadow: inset 0 0 0 3px $backdrop_bg_color, inset 0 1px $top_hilight; }
}
&:backdrop { box-shadow: inset 0 0 0 4px $borders_color, inset 0 0 0 3px $backdrop_bg_color, inset 0 1px $top_hilight; }
}
&.maximized,
+7 -3
View File
@@ -1,5 +1,5 @@
project('gtk', 'c',
version: '4.2.0',
version: '4.2.1',
default_options: [
'buildtype=debugoptimized',
'warning_level=1',
@@ -193,6 +193,7 @@ check_functions = [
'getpagesize',
'getresuid',
'lstat',
'memfd_create',
'mmap',
'posix_fallocate',
'_lock_file',
@@ -220,10 +221,13 @@ if cc.compiles(uint128_t_src, name : '__uint128_t available')
cdata.set('HAVE_UINT128_T', 1)
endif
# Check for mlock
# Check for mlock and madvise
if cc.has_function('mlock', prefix: '#include <sys/mman.h>')
cdata.set('HAVE_MLOCK', 1)
endif
if cc.has_function('madvise', prefix: '#include <sys/mman.h>')
cdata.set('HAVE_MADVISE', 1)
endif
# Disable deprecation checks for all libraries we depend on on stable branches.
# This is so newer versions of those libraries don't cause more warnings with
@@ -384,7 +388,7 @@ pangocairo_dep = dependency('pangocairo', version: pango_req,
fallback : ['pango', 'libpangocairo_dep'])
pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'],
default_options: ['png=true', 'jpeg=true', 'builtin_loaders=png,jpeg', 'man=false'])
default_options: ['png=enabled', 'jpeg=enabled', 'builtin_loaders=png,jpeg', 'man=false'])
epoxy_dep = dependency('epoxy', version: epoxy_req,
fallback: ['libepoxy', 'libepoxy_dep'])
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false,
+2 -10
View File
@@ -142,6 +142,8 @@ gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self)
gst_player_media_info_get_video_streams (media_info) != NULL,
gst_player_media_info_is_seekable (media_info),
FROM_GST_TIME (gst_player_media_info_get_duration (media_info)));
g_object_unref (media_info);
}
else
{
@@ -168,14 +170,6 @@ gtk_gst_media_file_position_updated_cb (GstPlayer *player,
gtk_media_stream_update (GTK_MEDIA_STREAM (self), FROM_GST_TIME (time));
}
static void
gtk_gst_media_file_media_info_updated_cb (GstPlayer *player,
GstClockTime duration,
GtkGstMediaFile *self)
{
gtk_gst_media_file_ensure_prepared (self);
}
static void
gtk_gst_media_file_seek_done_cb (GstPlayer *player,
GstClockTime time,
@@ -223,7 +217,6 @@ gtk_gst_media_file_destroy_player (GtkGstMediaFile *self)
if (self->player == NULL)
return;
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_media_info_updated_cb, self);
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_position_updated_cb, self);
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_end_of_stream_cb, self);
g_signal_handlers_disconnect_by_func (self->player, gtk_gst_media_file_seek_done_cb, self);
@@ -242,7 +235,6 @@ gtk_gst_media_file_create_player (GtkGstMediaFile *file)
self->player = gst_player_new (GST_PLAYER_VIDEO_RENDERER (g_object_ref (self->paintable)),
gst_player_g_main_context_signal_dispatcher_new (NULL));
g_signal_connect (self->player, "media-info-updated", G_CALLBACK (gtk_gst_media_file_media_info_updated_cb), self);
g_signal_connect (self->player, "position-updated", G_CALLBACK (gtk_gst_media_file_position_updated_cb), self);
g_signal_connect (self->player, "end-of-stream", G_CALLBACK (gtk_gst_media_file_end_of_stream_cb), self);
g_signal_connect (self->player, "seek-done", G_CALLBACK (gtk_gst_media_file_seek_done_cb), self);
+1733 -1708
View File
File diff suppressed because it is too large Load Diff
+1711 -1693
View File
File diff suppressed because it is too large Load Diff
+1711 -1691
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More