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
573 changed files with 20505 additions and 31398 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:v29"
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:v29"
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v31"
.only-default:
only:
+89
View File
@@ -0,0 +1,89 @@
FROM fedora:33
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
cairo-devel \
cairo-gobject-devel \
ccache \
clang \
clang-analyzer \
colord-devel \
cups-devel \
dbus-daemon \
dbus-x11 \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
elfutils-libelf-devel \
fribidi-devel \
gcc \
gcc-c++ \
gdk-pixbuf2-devel \
gdk-pixbuf2-modules \
gettext \
git \
glib2-devel \
glib2-static \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
gobject-introspection-devel \
graphene-devel \
gstreamer1-devel \
gstreamer1-plugins-good \
gstreamer1-plugins-bad-free-devel \
gstreamer1-plugins-base-devel \
gtk-doc \
hicolor-icon-theme \
iso-codes \
itstool \
json-glib-devel \
lcov \
libasan \
libattr-devel \
libcloudproviders-devel \
libepoxy-devel \
libffi-devel \
libmount-devel \
librsvg2 \
libselinux-devel \
libubsan \
libXcomposite-devel \
libXcursor-devel \
libXcursor-devel \
libXdamage-devel \
libXfixes-devel \
libXi-devel \
libXinerama-devel \
libxkbcommon-devel \
libXrandr-devel \
libXrender-devel \
libXtst-devel \
libxslt \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
ninja-build \
pango-devel \
pcre-devel \
pcre-static \
python3 \
python3-jinja2 \
python3-pip \
python3-pygments \
python3-wheel \
redhat-rpm-config \
sassc \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \
wayland-protocols-devel \
weston \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf clean all
+18
View File
@@ -0,0 +1,18 @@
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v28
RUN dnf -y install \
graphviz \
python3-jinja2 \
python3-markdown \
python3-pygments \
python3-toml \
python3-typogrify
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
RUN useradd -u $HOST_USER_ID -ms /bin/bash user
USER user
WORKDIR /home/user
ENV LANG C.UTF-8
+1 -93
View File
@@ -1,96 +1,4 @@
FROM fedora:33
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
cairo-devel \
cairo-gobject-devel \
ccache \
clang \
clang-analyzer \
colord-devel \
cups-devel \
dbus-daemon \
dbus-x11 \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
elfutils-libelf-devel \
fribidi-devel \
gcc \
gcc-c++ \
gdk-pixbuf2-devel \
gdk-pixbuf2-modules \
gettext \
git \
glib2-devel \
glib2-static \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
gobject-introspection-devel \
graphene-devel \
graphviz \
gstreamer1-devel \
gstreamer1-plugins-good \
gstreamer1-plugins-bad-free-devel \
gstreamer1-plugins-base-devel \
gtk-doc \
hicolor-icon-theme \
iso-codes \
itstool \
json-glib-devel \
lcov \
libasan \
libattr-devel \
libcloudproviders-devel \
libepoxy-devel \
libffi-devel \
libmount-devel \
librsvg2 \
libselinux-devel \
libubsan \
libXcomposite-devel \
libXcursor-devel \
libXcursor-devel \
libXdamage-devel \
libXfixes-devel \
libXi-devel \
libXinerama-devel \
libxkbcommon-devel \
libXrandr-devel \
libXrender-devel \
libXtst-devel \
libxslt \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
ninja-build \
pango-devel \
pcre-devel \
pcre-static \
python3 \
python3-jinja2 \
python3-markdown \
python3-pip \
python3-pygments \
python3-toml \
python3-typogrify \
python3-wheel \
redhat-rpm-config \
sassc \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \
wayland-protocols-devel \
weston \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf clean all
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v28
# Enable sudo for wheel users
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
+1 -30
View File
@@ -1,4 +1,4 @@
Overview of Changes in 4.3.0
Overview of Changes in 4.2.1
============================
* GtkVideo:
@@ -14,12 +14,8 @@ Overview of Changes in 4.3.0
- Fix initial font selection
* Text widgets:
- Replace squiggly error underlines by dotted lines
- Support translucent selections
* GtkTextView:
- Various improvements to rendering performance
* GtkScrolledWindow:
- Stop using scroll cursors
@@ -36,12 +32,6 @@ Overview of Changes in 4.3.0
- Allow repeated selection extension for MULTIPLE
* Themes:
- Reorganize and rename included themes. The theme is now
called Default, with dark, hc and hc-dark variants.
Visually, the themes are unchanged.
- The theme variants are also available as standalone
themes called Default-dark, etc.
- The theme named Adwaita is moving to libadwaita
- Fix resize border sizing
- Fix solid-csd window decorations
@@ -63,10 +53,6 @@ Overview of Changes in 4.3.0
- Fix offscreen rendering with transforms
- Fix downscaled textures
- Avoid huge intermediate textures
- Use fp16 for colors
- Optimize handling of underlines in text
- Fix corner cases of shadow rendering
- Reorganize shader resources
- Make shadow rendering match across renderers
* Accessibility:
@@ -75,7 +61,6 @@ Overview of Changes in 4.3.0
* Wayland:
- Improve font settings fallback
- Avoid unintentional rendering freezes with popovers
- Support the xdg_activation_v1 protocol
* X11:
- Don't beep on untrusted displays
@@ -84,24 +69,10 @@ Overview of Changes in 4.3.0
* Windows:
- Fix using GL rendering with Mesa drivers
* Tools:
- Add support for copy/paste in gtk4-node-editor
- Make syntax highlighting work in the gtk4-demo flatpak
* Inspector:
- Enable the inspector by default, in all cases
- Show keyboard layouts
- Improve monitor information
* Translation updates:
Catalan
Chinese (Taiwan)
Dutch
Nepali
Polish
Swedish
Ukrainian
Overview of Changes in 4.2.0
============================
-7
View File
@@ -36,13 +36,6 @@ Nightly documentation can be found at
- Gdk: https://gnome.pages.gitlab.gnome.org/gtk/gdk4/
- Gsk: https://gnome.pages.gitlab.gnome.org/gtk/gsk4/
Nightly flatpaks of our demos can be installed from the
[GNOME Nightly](https://wiki.gnome.org/Apps/Nightly) repository:
- `flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo`
- `flatpak install gnome-nightly org.gtk.Demo4`
- `flatpak install gnome-nightly org.gtk.WidgetFactory4`
- `flatpak install gnome-nightly org.gtk.IconBrowser4`
Building and installing
-----------------------
-43
View File
@@ -1,43 +0,0 @@
diff -ur lua-5.1.4/src/Makefile lua-5.1.4-new/src/Makefile
--- lua-5.1.4/src/Makefile 2008-01-19 20:37:58.000000000 +0100
+++ lua-5.1.4-new/src/Makefile 2012-02-23 18:26:43.000000000 +0100
@@ -23,6 +23,7 @@
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
+LUA_SO= liblua.so
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o
@@ -36,7 +37,7 @@
LUAC_O= luac.o print.o
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)
default: $(PLAT)
@@ -51,6 +52,11 @@
$(AR) $@ $?
$(RANLIB) $@
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
--- lua-5.1.4/Makefile 2008-08-12 02:40:48.000000000 +0200
+++ lua-5.1.4-new/Makefile 2012-02-23 19:06:32.000000000 +0100
@@ -53,7 +53,7 @@
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$(V) R=$(R)
test: dummy
src/lua test/hello.lua
-71
View File
@@ -93,77 +93,6 @@
}
]
},
{
"name": "boost",
"buildsystem": "simple",
"build-commands": [
"./bootstrap.sh --prefix=/app --with-libraries=date_time,filesystem,iostreams,locale,regex,system,thread,python,program_options,test,serialization",
"./b2 --build-type=minimal link=shared -j $FLATPAK_BUILDER_N_JOBS",
"./b2 --build-type=minimal link=shared install"
],
"sources": [
{
"type": "archive",
"url": "https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2",
"sha256": "8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406"
}
]
},
{
"name": "lua-5.1",
"buildsystem": "simple",
"build-commands": [
"make -j $FLATPAK_BUILDER_N_JOBS CFLAGS=\"$CFLAGS -fPIC -DLUA_USE_LINUX\" linux",
"make INSTALL_TOP=$FLATPAK_DEST TO_LIB='liblua.a liblua.so.5.1.5' install",
"ln -sf liblua.so.5.1.5 $FLATPAK_DEST/lib/liblua.so",
"ln -sf liblua.so.5.1.5 $FLATPAK_DEST/lib/liblua.so.5.1",
"install -Dm0644 etc/lua.pc $FLATPAK_DEST/lib/pkgconfig/lua.pc",
"ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua51.pc",
"ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua5.1.pc",
"ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua-5.1.pc"
],
"sources": [
{
"type": "archive",
"url": "https://www.lua.org/ftp/lua-5.1.5.tar.gz",
"sha256": "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"
},
{
"type": "patch",
"path": "lua-5.1.5-so.patch"
},
{
"type": "shell",
"commands": [
"sed -i \"s|/usr/local|$FLATPAK_DEST|\" etc/lua.pc src/luaconf.h"
]
}
],
"cleanup": [
"*.a",
"/bin",
"/include",
"/lib/pkgconfig",
"/man"
]
},
{
"name" : "highlight",
"buildsystem" : "simple",
"builddir" : true,
"build-commands" : [
"sed -i -e 's#^PREFIX = /usr#PREFIX = /app#' makefile",
"make",
"make install"
],
"sources" : [
{
"type" : "archive",
"url" : "http://www.andre-simon.de/zip/highlight-4.0.tar.bz2",
"sha256" : "f40dcba26e011a2c67df874f4d9b0238c2c6b065163ce8de3d8371b9dfce864d"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",
+4 -4
View File
@@ -8,10 +8,10 @@ from pathlib import PurePath
stylesheets = [
'gtk/theme/Default/Default-light.css',
'gtk/theme/Default/Default-dark.css',
'gtk/theme/Default/Default-hc.css',
'gtk/theme/Default/Default-hc-dark.css',
'gtk/theme/Adwaita/Adwaita.css',
'gtk/theme/Adwaita/Adwaita-dark.css',
'gtk/theme/HighContrast/HighContrast.css',
'gtk/theme/HighContrast/HighContrast-dark.css',
]
references = [
-2
View File
@@ -282,5 +282,3 @@
/* Define if tracker3 is available */
#mesondefine HAVE_TRACKER3
#mesondefine HAVE_F16C
+5 -10
View File
@@ -116,25 +116,20 @@ populate_emoji_text (void)
GtkWidget *textview;
GtkTextBuffer *buffer;
GString *s;
GtkTextIter iter;
s = g_string_sized_new (500 * 30 * 4);
s = g_string_sized_new (1000 * 30 * 4);
for (int i = 0; i < 500; i++)
for (int i = 0; i < 1000; i++)
{
if (i % 2)
g_string_append (s, "<span underline=\"single\" underline_color=\"red\">x</span>");
g_string_append (s, "x");
for (int j = 0; j < 30; j++)
{
g_string_append (s, "💓");
g_string_append (s, "<span underline=\"single\" underline_color=\"red\">x</span>");
}
g_string_append (s, "💓x");
g_string_append (s, "\n");
}
buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_insert_markup (buffer, &iter, s->str, s->len);
gtk_text_buffer_set_text (buffer, s->str, s->len);
g_string_free (s, TRUE);
+2 -1
View File
@@ -751,6 +751,7 @@ demo_filter_by_name (gpointer item,
gpointer user_data)
{
GtkTreeListRow *row = item;
GtkFilterListModel *model = user_data;
GListModel *children;
GtkDemo *demo;
guint i, n;
@@ -761,7 +762,7 @@ demo_filter_by_name (gpointer item,
return TRUE;
g_assert (GTK_IS_TREE_LIST_ROW (row));
g_assert (GTK_IS_FILTER_LIST_MODEL (user_data));
g_assert (GTK_IS_FILTER_LIST_MODEL (model));
/* Show a row if itself of any parent matches */
for (parent = row; parent; parent = gtk_tree_list_row_get_parent (parent))
-19
View File
@@ -635,24 +635,6 @@ export_image_cb (GtkWidget *button,
gtk_widget_show (dialog);
}
static void
clip_image_cb (GtkWidget *button,
NodeEditorWindow *self)
{
GdkTexture *texture;
GdkClipboard *clipboard;
texture = create_texture (self);
if (texture == NULL)
return;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (self));
gdk_clipboard_set_texture (clipboard, texture);
g_object_unref (texture);
}
static void
testcase_name_entry_changed_cb (GtkWidget *button,
GParamSpec *pspec,
@@ -844,7 +826,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_callback (widget_class, open_cb);
gtk_widget_class_bind_template_callback (widget_class, save_cb);
gtk_widget_class_bind_template_callback (widget_class, export_image_cb);
gtk_widget_class_bind_template_callback (widget_class, clip_image_cb);
gtk_widget_class_bind_template_callback (widget_class, testcase_save_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, testcase_name_entry_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, dark_mode_cb);
+2 -11
View File
@@ -102,7 +102,6 @@
<object class="GtkHeaderBar" id="header">
<child type="start">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="icon-name">document-open-symbolic</property>
<property name="tooltip-text">Open node file</property>
<signal name="clicked" handler="open_cb"/>
@@ -110,7 +109,6 @@
</child>
<child type="start">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="icon-name">document-save-symbolic</property>
<property name="tooltip-text">Save to node file</property>
<signal name="clicked" handler="save_cb"/>
@@ -118,30 +116,24 @@
</child>
<child type="start">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="icon-name">insert-image-symbolic</property>
<property name="tooltip-text">Export to image</property>
<signal name="clicked" handler="export_image_cb"/>
</object>
</child>
<child type="start">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="icon-name">edit-copy-symbolic</property>
<property name="tooltip-text">Copy image to clipboard</property>
<signal name="clicked" handler="clip_image_cb"/>
<object class="GtkSeparator">
<property name="orientation">vertical</property>
</object>
</child>
<child type="start">
<object class="GtkMenuButton">
<property name="focus-on-click">0</property>
<property name="label">Save Testcase</property>
<property name="popover">testcase_popover</property>
</object>
</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>
@@ -149,7 +141,6 @@
</child>
<child type="end">
<object class="GtkToggleButton" id="dark_bg_button">
<property name="focus-on-click">0</property>
<property name="valign">center</property>
<property name="has-frame">0</property>
<property name="icon-name">display-brightness-symbolic</property>
+22 -10
View File
@@ -50,19 +50,32 @@ change_theme_state (GSimpleAction *action,
GtkSettings *settings = gtk_settings_get_default ();
const char *s;
const char *theme;
gboolean prefer_dark = FALSE;
g_simple_action_set_state (action, state);
s = g_variant_get_string (state, NULL);
if (strcmp (s, "default") == 0)
theme = "Default";
else if (strcmp (s, "dark") == 0)
theme = "Default-dark";
else if (strcmp (s, "hc") == 0)
theme = "Default-hc";
else if (strcmp (s, "hc-dark") == 0)
theme = "Default-hc-dark";
if (strcmp (s, "adwaita") == 0)
{
theme = "Adwaita";
prefer_dark = FALSE;
}
else if (strcmp (s, "adwaita-dark") == 0)
{
theme = "Adwaita";
prefer_dark = TRUE;
}
else if (strcmp (s, "highcontrast") == 0)
{
theme = "HighContrast";
prefer_dark = FALSE;
}
else if (strcmp (s, "highcontrast-inverse") == 0)
{
theme = "HighContrastInverse";
prefer_dark = FALSE;
}
else if (strcmp (s, "current") == 0)
{
gtk_settings_reset_property (settings, "gtk-theme-name");
@@ -74,7 +87,7 @@ change_theme_state (GSimpleAction *action,
g_object_set (G_OBJECT (settings),
"gtk-theme-name", theme,
"gtk-application-prefer-dark-theme", FALSE,
"gtk-application-prefer-dark-theme", prefer_dark,
NULL);
}
@@ -1873,7 +1886,6 @@ set_up_context_popover (GtkWidget *widget,
gtk_widget_set_parent (popover, widget);
gtk_popover_set_has_arrow (GTK_POPOVER (popover), FALSE);
gesture = gtk_gesture_click_new ();
gtk_event_controller_set_name (GTK_EVENT_CONTROLLER (gesture), "widget-factory-context-click");
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked_cb), popover);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture));
+8 -8
View File
@@ -15,24 +15,24 @@
<attribute name="target">current</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Default</attribute>
<attribute name="label" translatable="yes">Adwaita</attribute>
<attribute name="action">win.theme</attribute>
<attribute name="target">default</attribute>
<attribute name="target">adwaita</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Dark</attribute>
<attribute name="label" translatable="yes">Adwaita dark</attribute>
<attribute name="action">win.theme</attribute>
<attribute name="target">dark</attribute>
<attribute name="target">adwaita-dark</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Highcontrast</attribute>
<attribute name="label" translatable="yes">High contrast</attribute>
<attribute name="action">win.theme</attribute>
<attribute name="target">hc</attribute>
<attribute name="target">highcontrast</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Highcontrast inverse</attribute>
<attribute name="label" translatable="yes">High contrast inverse</attribute>
<attribute name="action">win.theme</attribute>
<attribute name="target">hc-dark</attribute>
<attribute name="target">highcontrast-inverse</attribute>
</item>
</section>
</submenu>
+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
@@ -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
+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
-2
View File
@@ -150,7 +150,6 @@ gdk_toplevel_size_set_shadow_width (GdkToplevelSize *size,
void
gdk_toplevel_size_validate (GdkToplevelSize *size)
{
#if 0
int geometry_width, geometry_height;
geometry_width = size->width;
@@ -160,5 +159,4 @@ gdk_toplevel_size_validate (GdkToplevelSize *size)
geometry_width -= size->shadow.left + size->shadow.right;
geometry_height -= size->shadow.top + size->shadow.bottom;
}
#endif
}
-23
View File
@@ -86,14 +86,6 @@
*/
#define GDK_VERSION_4_2 (G_ENCODE_VERSION (4, 2))
/**
* GDK_VERSION_4_4:
*
* A macro that evaluates to the 4.4 version of GDK, in a format
* that can be used by the C pre-processor.
*/
#define GDK_VERSION_4_4 (G_ENCODE_VERSION (4, 4))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
@@ -206,19 +198,4 @@
# define GDK_DEPRECATED_IN_4_2_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_4
# define GDK_AVAILABLE_IN_4_4 GDK_UNAVAILABLE(4, 4)
#else
# define GDK_AVAILABLE_IN_4_4 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_4
# define GDK_DEPRECATED_IN_4_4 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_4_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_4 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_4_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */
+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 -46
View File
@@ -29,24 +29,6 @@
#include "gdkinternals.h"
#include "gdkintl.h"
typedef struct {
gchar *token;
} AppLaunchData;
static void
token_done (gpointer data,
struct xdg_activation_token_v1 *provider,
const char *token)
{
AppLaunchData *app_launch_data = data;
app_launch_data->token = g_strdup (token);
}
static const struct xdg_activation_token_v1_listener token_listener = {
token_done,
};
static char *
gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
@@ -57,34 +39,7 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
g_object_get (context, "display", &display, NULL);
if (display->xdg_activation)
{
struct xdg_activation_token_v1 *token;
GdkWaylandSeat *seat;
GdkSurface *focus_surface;
AppLaunchData app_launch_data = { 0 };
seat = GDK_WAYLAND_SEAT (gdk_display_get_default_seat (GDK_DISPLAY (display)));
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
token = xdg_activation_v1_get_activation_token (display->xdg_activation);
xdg_activation_token_v1_add_listener (token,
&token_listener,
&app_launch_data);
xdg_activation_token_v1_set_serial (token,
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
xdg_activation_token_v1_set_surface (token,
gdk_wayland_surface_get_wl_surface (focus_surface));
xdg_activation_token_v1_commit (token);
while (app_launch_data.token == NULL)
wl_display_roundtrip (display->wl_display);
xdg_activation_token_v1_destroy (token);
id = app_launch_data.token;
}
else if (display->gtk_shell_version >= 3)
if (display->gtk_shell_version >= 3)
{
id = g_uuid_string_random ();
gtk_shell1_notify_launch (display->gtk_shell, id);
+7 -57
View File
@@ -656,7 +656,7 @@ device_emit_grab_crossing (GdkDevice *device,
}
}
GdkSurface *
static GdkSurface *
gdk_wayland_device_get_focus (GdkDevice *device)
{
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
@@ -848,12 +848,7 @@ gdk_wayland_device_pad_get_n_groups (GdkDevicePad *pad)
data = gdk_wayland_seat_find_pad (GDK_WAYLAND_SEAT (seat),
GDK_DEVICE (pad));
#ifdef G_DISABLE_ASSERT
if (data == NULL)
return 0;
#else
g_assert (data != NULL);
#endif
return g_list_length (data->mode_groups);
}
@@ -868,12 +863,7 @@ gdk_wayland_device_pad_get_group_n_modes (GdkDevicePad *pad,
data = gdk_wayland_seat_find_pad (GDK_WAYLAND_SEAT (seat),
GDK_DEVICE (pad));
#ifdef G_DISABLE_ASSERT
if (data == NULL)
return 0;
#else
g_assert (data != NULL);
#endif
group = g_list_nth_data (data->mode_groups, n_group);
if (!group)
@@ -919,12 +909,7 @@ gdk_wayland_device_pad_get_feature_group (GdkDevicePad *pad,
data = gdk_wayland_seat_find_pad (GDK_WAYLAND_SEAT (seat),
GDK_DEVICE (pad));
#ifdef G_DISABLE_ASSERT
if (data == NULL)
return -1;
#else
g_assert (data != NULL);
#endif
for (l = data->mode_groups, i = 0; l; l = l->next, i++)
{
@@ -1037,23 +1022,6 @@ gdk_wayland_device_get_wl_keyboard (GdkDevice *device)
return seat->wl_keyboard;
}
/**
* gdk_wayland_device_get_xkb_keymap:
* @device: (type GdkWaylandDevice): a `GdkDevice`
*
* Returns the `xkb_keymap` of a `GdkDevice`.
*
* Returns: (transfer none): a `struct xkb_keymap`
*
* Since: 4.4
*/
struct xkb_keymap *
gdk_wayland_device_get_xkb_keymap (GdkDevice *device)
{
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
return _gdk_wayland_keymap_get_xkb_keymap (seat->keymap);
}
GdkKeymap *
_gdk_wayland_device_get_keymap (GdkDevice *device)
{
@@ -1550,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;
@@ -1561,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;
@@ -1932,22 +1904,7 @@ keyboard_handle_keymap (void *data,
_gdk_wayland_keymap_update_from_fd (seat->keymap, format, fd, size);
GDK_DISPLAY_NOTE(seat->keymap->display, INPUT,
{
GString *s = g_string_new ("");
struct xkb_keymap *xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (seat->keymap);
struct xkb_state *xkb_state = _gdk_wayland_keymap_get_xkb_state (seat->keymap);
for (int i = 0; i < xkb_keymap_num_layouts (xkb_keymap); i++)
{
if (s->len > 0)
g_string_append (s, ", ");
if (xkb_state_layout_index_is_active (xkb_state, i, XKB_STATE_LAYOUT_EFFECTIVE))
g_string_append (s, "*");
g_string_append (s, xkb_keymap_layout_get_name (xkb_keymap, i));
}
g_print ("layouts: %s\n", s->str);
g_string_free (s, TRUE);
});
GDK_DISPLAY_NOTE(seat->keymap->display, INPUT, g_print ("active layout now: %s\n", get_active_layout_name (seat->keymap)));
g_signal_emit_by_name (seat->keymap, "keys-changed");
g_signal_emit_by_name (seat->keymap, "state-changed");
@@ -4283,14 +4240,7 @@ tablet_pad_handle_button (void *data,
wp_tablet_pad, button, state));
group = tablet_pad_lookup_button_group (pad, button);
#ifdef G_DISABLE_ASSERT
if (group == NULL)
return;
#else
g_assert (group != NULL);
#endif
n_group = g_list_index (pad->mode_groups, group);
event = gdk_pad_event_new_button (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED
+1 -24
View File
@@ -58,19 +58,6 @@
#include "gdk/gdk-private.h"
/* Keep g_assert() defined even if we disable it globally,
* as we use it in many places as a handy mechanism to check
* for non-NULL
*/
#ifdef G_DISABLE_ASSERT
# undef g_assert
# define g_assert(expr) G_STMT_START { \
if G_LIKELY (expr) ; else \
g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
#expr); \
} G_STMT_END
#endif
/**
* GdkWaylandDisplay:
*
@@ -90,7 +77,6 @@
#define GTK_SHELL1_VERSION 4
#define OUTPUT_VERSION_WITH_DONE 2
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
#define XDG_ACTIVATION_VERSION 1
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
@@ -494,15 +480,6 @@ gdk_registry_handle_global (void *data,
wl_registry_bind (display_wayland->wl_registry, id,
&zwp_idle_inhibit_manager_v1_interface, 1);
}
else if (strcmp (interface, "xdg_activation_v1") == 0)
{
display_wayland->xdg_activation_version =
MIN (version, XDG_ACTIVATION_VERSION);
display_wayland->xdg_activation =
wl_registry_bind (display_wayland->wl_registry, id,
&xdg_activation_v1_interface,
display_wayland->xdg_activation_version);
}
g_hash_table_insert (display_wayland->known_globals,
GUINT_TO_POINTER (id), g_strdup (interface));
@@ -867,7 +844,7 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
return;
}
if (!display_wayland->xdg_activation && display_wayland->gtk_shell)
if (display_wayland->gtk_shell)
gtk_shell1_set_startup_id (display_wayland->gtk_shell, startup_id);
g_free (free_this);
-3
View File
@@ -37,7 +37,6 @@
#include <gdk/wayland/xdg-output-unstable-v1-client-protocol.h>
#include <gdk/wayland/idle-inhibit-unstable-v1-client-protocol.h>
#include <gdk/wayland/primary-selection-unstable-v1-client-protocol.h>
#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
#include <glib.h>
#include <gdk/gdkkeys.h>
@@ -113,7 +112,6 @@ struct _GdkWaylandDisplay
struct org_kde_kwin_server_decoration_manager *server_decoration_manager;
struct zxdg_output_manager_v1 *xdg_output_manager;
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
struct xdg_activation_v1 *xdg_activation;
GList *async_roundtrips;
@@ -141,7 +139,6 @@ struct _GdkWaylandDisplay
int data_device_manager_version;
int gtk_shell_version;
int xdg_output_manager_version;
int xdg_activation_version;
uint32_t server_decoration_mode;
-2
View File
@@ -140,8 +140,6 @@ uint32_t _gdk_wayland_seat_get_implicit_grab_serial(GdkSeat *seat,
GdkEvent *event);
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
GdkEventSequence **sequence);
GdkSurface * gdk_wayland_device_get_focus (GdkDevice *device);
struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
struct wl_data_source *source);
+68 -73
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].
@@ -1570,7 +1570,7 @@ static void
gdk_wayland_surface_configure_popup (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkRectangle parent_geometry;
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (surface->parent);
int x, y, width, height;
if (impl->display_server.xdg_popup)
@@ -1610,9 +1610,8 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
width = impl->pending.popup.width;
height = impl->pending.popup.height;
gdk_wayland_surface_get_window_geometry (surface->parent, &parent_geometry);
x += parent_geometry.x;
y += parent_geometry.y;
x += parent_impl->shadow_left;
y += parent_impl->shadow_top;
update_popup_layout_state (surface,
x, y,
@@ -1721,52 +1720,6 @@ static const struct xdg_surface_listener xdg_surface_listener = {
xdg_surface_configure,
};
static void
zxdg_surface_v6_configure (void *data,
struct zxdg_surface_v6 *xdg_surface,
uint32_t serial)
{
GdkSurface *surface = GDK_SURFACE (data);
gdk_wayland_surface_handle_configure (surface, serial);
}
static const struct zxdg_surface_v6_listener zxdg_surface_v6_listener = {
zxdg_surface_v6_configure,
};
static void
gdk_wayland_surface_create_xdg_surface_resources (GdkSurface *surface)
{
GdkWaylandDisplay *display =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
switch (display->shell_variant)
{
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
impl->display_server.xdg_surface =
xdg_wm_base_get_xdg_surface (display->xdg_wm_base,
impl->display_server.wl_surface);
wl_proxy_set_queue ((struct wl_proxy *) impl->display_server.xdg_surface,
impl->event_queue);
xdg_surface_add_listener (impl->display_server.xdg_surface,
&xdg_surface_listener,
surface);
break;
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
impl->display_server.zxdg_surface_v6 =
zxdg_shell_v6_get_xdg_surface (display->zxdg_shell_v6,
impl->display_server.wl_surface);
zxdg_surface_v6_add_listener (impl->display_server.zxdg_surface_v6,
&zxdg_surface_v6_listener,
surface);
break;
default:
g_assert_not_reached ();
}
}
static void
xdg_toplevel_configure (void *data,
struct xdg_toplevel *xdg_toplevel,
@@ -1826,8 +1779,19 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = {
static void
create_xdg_toplevel_resources (GdkSurface *surface)
{
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
impl->display_server.xdg_surface =
xdg_wm_base_get_xdg_surface (display_wayland->xdg_wm_base,
impl->display_server.wl_surface);
wl_proxy_set_queue ((struct wl_proxy *) impl->display_server.xdg_surface,
impl->event_queue);
xdg_surface_add_listener (impl->display_server.xdg_surface,
&xdg_surface_listener,
surface);
impl->display_server.xdg_toplevel =
xdg_surface_get_toplevel (impl->display_server.xdg_surface);
xdg_toplevel_add_listener (impl->display_server.xdg_toplevel,
@@ -1835,6 +1799,20 @@ create_xdg_toplevel_resources (GdkSurface *surface)
surface);
}
static void
zxdg_surface_v6_configure (void *data,
struct zxdg_surface_v6 *xdg_surface,
uint32_t serial)
{
GdkSurface *surface = GDK_SURFACE (data);
gdk_wayland_surface_handle_configure (surface, serial);
}
static const struct zxdg_surface_v6_listener zxdg_surface_v6_listener = {
zxdg_surface_v6_configure,
};
static void
zxdg_toplevel_v6_configure (void *data,
struct zxdg_toplevel_v6 *xdg_toplevel,
@@ -1894,8 +1872,17 @@ static const struct zxdg_toplevel_v6_listener zxdg_toplevel_v6_listener = {
static void
create_zxdg_toplevel_v6_resources (GdkSurface *surface)
{
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
impl->display_server.zxdg_surface_v6 =
zxdg_shell_v6_get_xdg_surface (display_wayland->zxdg_shell_v6,
impl->display_server.wl_surface);
zxdg_surface_v6_add_listener (impl->display_server.zxdg_surface_v6,
&zxdg_surface_v6_listener,
surface);
impl->display_server.zxdg_toplevel_v6 =
zxdg_surface_v6_get_toplevel (impl->display_server.zxdg_surface_v6);
zxdg_toplevel_v6_add_listener (impl->display_server.zxdg_toplevel_v6,
@@ -1954,7 +1941,6 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
const char *app_id;
gdk_surface_freeze_updates (surface);
gdk_wayland_surface_create_xdg_surface_resources (surface);
switch (display_wayland->shell_variant)
{
@@ -2532,7 +2518,6 @@ create_dynamic_positioner (GdkSurface *surface,
GdkGravity rect_anchor;
GdkGravity surface_anchor;
GdkAnchorHints anchor_hints;
GdkRectangle parent_geometry;
int shadow_left;
int shadow_right;
int shadow_top;
@@ -2550,11 +2535,9 @@ create_dynamic_positioner (GdkSurface *surface,
.height = height - (shadow_top + shadow_bottom),
};
gdk_wayland_surface_get_window_geometry (surface->parent, &parent_geometry);
anchor_rect = gdk_popup_layout_get_anchor_rect (layout);
real_anchor_rect_x = anchor_rect->x - parent_geometry.x;
real_anchor_rect_y = anchor_rect->y - parent_geometry.y;
real_anchor_rect_x = anchor_rect->x - parent_impl->shadow_left;
real_anchor_rect_y = anchor_rect->y - parent_impl->shadow_top;
anchor_rect_width = MAX (anchor_rect->width, 1);
anchor_rect_height = MAX (anchor_rect->height, 1);
@@ -2613,9 +2596,17 @@ create_dynamic_positioner (GdkSurface *surface,
xdg_positioner_get_version (positioner) >=
XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION)
{
int parent_width;
int parent_height;
parent_width = parent->width - (parent_impl->shadow_left +
parent_impl->shadow_right);
parent_height = parent->height - (parent_impl->shadow_top +
parent_impl->shadow_bottom);
xdg_positioner_set_parent_size (positioner,
parent_geometry.width,
parent_geometry.height);
parent_width,
parent_height);
xdg_positioner_set_parent_configure (positioner,
parent_impl->last_configure_serial);
}
@@ -2725,11 +2716,19 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
gdk_surface_freeze_updates (surface);
positioner = create_dynamic_positioner (surface, width, height, layout, FALSE);
gdk_wayland_surface_create_xdg_surface_resources (surface);
switch (display->shell_variant)
{
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
impl->display_server.xdg_surface =
xdg_wm_base_get_xdg_surface (display->xdg_wm_base,
impl->display_server.wl_surface);
wl_proxy_set_queue ((struct wl_proxy *) impl->display_server.xdg_surface,
impl->event_queue);
xdg_surface_add_listener (impl->display_server.xdg_surface,
&xdg_surface_listener,
surface);
impl->display_server.xdg_popup =
xdg_surface_get_popup (impl->display_server.xdg_surface,
parent_impl->display_server.xdg_surface,
@@ -2740,6 +2739,12 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
xdg_positioner_destroy (positioner);
break;
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
impl->display_server.zxdg_surface_v6 =
zxdg_shell_v6_get_xdg_surface (display->zxdg_shell_v6,
impl->display_server.wl_surface);
zxdg_surface_v6_add_listener (impl->display_server.zxdg_surface_v6,
&zxdg_surface_v6_listener,
surface);
impl->display_server.zxdg_popup_v6 =
zxdg_surface_v6_get_popup (impl->display_server.zxdg_surface_v6,
parent_impl->display_server.zxdg_surface_v6,
@@ -3464,20 +3469,10 @@ gdk_wayland_surface_focus (GdkSurface *surface,
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
if (display_wayland->startup_notification_id)
if (display_wayland->gtk_shell_version >= 3)
{
if (display_wayland->xdg_activation)
{
xdg_activation_v1_activate (display_wayland->xdg_activation,
display_wayland->startup_notification_id,
impl->display_server.wl_surface);
}
else if (display_wayland->gtk_shell_version >= 3)
{
gtk_surface1_request_focus (impl->display_server.gtk_surface,
display_wayland->startup_notification_id);
}
gtk_surface1_request_focus (impl->display_server.gtk_surface,
display_wayland->startup_notification_id);
g_clear_pointer (&display_wayland->startup_notification_id, g_free);
}
}
-2
View File
@@ -52,8 +52,6 @@ GDK_AVAILABLE_IN_ALL
struct wl_pointer *gdk_wayland_device_get_wl_pointer (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
struct wl_keyboard *gdk_wayland_device_get_wl_keyboard (GdkDevice *device);
GDK_AVAILABLE_IN_4_4
struct xkb_keymap *gdk_wayland_device_get_xkb_keymap (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
const char *gdk_wayland_device_get_node_path (GdkDevice *device);
-5
View File
@@ -56,7 +56,6 @@ proto_sources = [
['server-decoration', 'private' ],
['xdg-output', 'unstable', 'v1', ],
['idle-inhibit', 'unstable', 'v1', ],
['xdg-activation', 'staging', 'v1', ],
]
gdk_wayland_gen_headers = []
@@ -68,10 +67,6 @@ foreach p: proto_sources
if proto_stability == 'stable'
output_base = proto_name
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
elif proto_stability == 'staging'
proto_version = p.get(2)
output_base = '@0@-@1@'.format(proto_name, proto_version)
input = join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
elif proto_stability == 'private'
output_base = proto_name
input = files('protocol/@0@.xml'.format(proto_name))
+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)
+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 -4
View File
@@ -624,12 +624,10 @@ maybe_sync_counter_for_end_frame (GdkSurface *surface)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
gboolean frame_sync_negotiated = _gdk_x11_surface_syncs_frames (surface);
gboolean frame_done_painting;
gboolean frame_done_painting = !impl->toplevel->frame_pending;
#ifdef HAVE_XDAMAGE
frame_done_painting = !impl->toplevel->frame_still_painting && frame_sync_negotiated;
#else
frame_done_painting = !impl->toplevel->frame_pending;
#endif
if (!impl->toplevel->frame_pending)
@@ -1584,6 +1582,7 @@ gdk_x11_surface_show (GdkSurface *surface, gboolean already_mapped)
GdkToplevelX11 *toplevel;
Display *xdisplay = GDK_SURFACE_XDISPLAY (surface);
Window xwindow = GDK_SURFACE_XID (surface);
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
if (!already_mapped)
set_initial_hints (surface);
@@ -1599,7 +1598,6 @@ gdk_x11_surface_show (GdkSurface *surface, gboolean already_mapped)
if (GDK_PROFILER_IS_RUNNING)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
if (impl->map_time == 0)
impl->map_time = g_get_monotonic_time ();
}
@@ -4376,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),
+3 -3
View File
@@ -45,7 +45,7 @@ xml = '''<?xml version='1.0' encoding='UTF-8'?>
'''
for f in gl_source_shaders:
xml += ' <file alias=\'gl/{0}\'>gl/resources/{0}</file>\n'.format(os.path.basename(f))
xml += ' <file alias=\'glsl/{0}\'>resources/glsl/{0}</file>\n'.format(os.path.basename(f))
xml += '\n'
@@ -55,12 +55,12 @@ for f in ngl_source_shaders:
xml += '\n'
for f in vulkan_compiled_shaders:
xml += ' <file alias=\'vulkan/{0}\'>vulkan/resources/{0}</file>\n'.format(os.path.basename(f))
xml += ' <file alias=\'vulkan/{0}\'>resources/vulkan/{0}</file>\n'.format(os.path.basename(f))
xml += '\n'
for f in vulkan_shaders:
xml += ' <file alias=\'vulkan/{0}\'>vulkan/resources/{0}</file>\n'.format(os.path.basename(f))
xml += ' <file alias=\'vulkan/{0}\'>resources/vulkan/{0}</file>\n'.format(os.path.basename(f))
xml += '''
</gresource>
+3 -1
View File
@@ -433,6 +433,8 @@ gsk_gl_driver_slice_texture (GskGLDriver *self,
guint *out_n_slices)
{
const int max_texture_size = gsk_gl_driver_get_max_texture_size (self) / 4; // XXX Too much?
const int tex_width = texture->width;
const int tex_height = texture->height;
const int cols = (texture->width / max_texture_size) + 1;
const int rows = (texture->height / max_texture_size) + 1;
int col, row;
@@ -440,7 +442,7 @@ gsk_gl_driver_slice_texture (GskGLDriver *self,
TextureSlice *slices;
Texture *tex;
g_assert (texture->width > max_texture_size || texture->height > max_texture_size);
g_assert (tex_width > max_texture_size || tex_height > max_texture_size);
tex = gdk_texture_get_render_data (texture, self);
+24 -23
View File
@@ -1129,13 +1129,13 @@ compile_glshader (GskGLRenderer *self,
}
gsk_gl_shader_builder_init (&shader_builder,
"/org/gtk/libgsk/gl/preamble.glsl",
"/org/gtk/libgsk/gl/preamble.vs.glsl",
"/org/gtk/libgsk/gl/preamble.fs.glsl");
"/org/gtk/libgsk/glsl/preamble.glsl",
"/org/gtk/libgsk/glsl/preamble.vs.glsl",
"/org/gtk/libgsk/glsl/preamble.fs.glsl");
init_shader_builder (self, &shader_builder);
program_id = gsk_gl_shader_builder_create_program (&shader_builder,
"/org/gtk/libgsk/gl/custom.glsl",
"/org/gtk/libgsk/glsl/custom.glsl",
shader_source, shader_source_len,
error);
gsk_gl_shader_builder_finish (&shader_builder);
@@ -1997,11 +1997,12 @@ render_unblurred_inset_shadow_node (GskGLRenderer *self,
GskRenderNode *node,
RenderOpBuilder *builder)
{
const float blur_radius = gsk_inset_shadow_node_get_blur_radius (node);
const float dx = gsk_inset_shadow_node_get_dx (node);
const float dy = gsk_inset_shadow_node_get_dy (node);
const float spread = gsk_inset_shadow_node_get_spread (node);
g_assert (gsk_inset_shadow_node_get_blur_radius (node) == 0);
g_assert (blur_radius == 0);
ops_set_program (builder, &self->programs->inset_shadow_program);
ops_set_inset_shadow (builder, transform_rect (self, builder, gsk_inset_shadow_node_get_outline (node)),
@@ -3312,27 +3313,27 @@ gsk_gl_renderer_create_programs (GskGLRenderer *self,
const char *resource_path;
const char *name;
} program_definitions[] = {
{ "/org/gtk/libgsk/gl/blend.glsl", "blend" },
{ "/org/gtk/libgsk/gl/blit.glsl", "blit" },
{ "/org/gtk/libgsk/gl/blur.glsl", "blur" },
{ "/org/gtk/libgsk/gl/border.glsl", "border" },
{ "/org/gtk/libgsk/gl/color_matrix.glsl", "color matrix" },
{ "/org/gtk/libgsk/gl/color.glsl", "color" },
{ "/org/gtk/libgsk/gl/coloring.glsl", "coloring" },
{ "/org/gtk/libgsk/gl/cross_fade.glsl", "cross fade" },
{ "/org/gtk/libgsk/gl/inset_shadow.glsl", "inset shadow" },
{ "/org/gtk/libgsk/gl/linear_gradient.glsl", "linear gradient" },
{ "/org/gtk/libgsk/gl/radial_gradient.glsl", "radial gradient" },
{ "/org/gtk/libgsk/gl/conic_gradient.glsl", "conic gradient" },
{ "/org/gtk/libgsk/gl/outset_shadow.glsl", "outset shadow" },
{ "/org/gtk/libgsk/gl/repeat.glsl", "repeat" },
{ "/org/gtk/libgsk/gl/unblurred_outset_shadow.glsl", "unblurred_outset shadow" },
{ "/org/gtk/libgsk/glsl/blend.glsl", "blend" },
{ "/org/gtk/libgsk/glsl/blit.glsl", "blit" },
{ "/org/gtk/libgsk/glsl/blur.glsl", "blur" },
{ "/org/gtk/libgsk/glsl/border.glsl", "border" },
{ "/org/gtk/libgsk/glsl/color_matrix.glsl", "color matrix" },
{ "/org/gtk/libgsk/glsl/color.glsl", "color" },
{ "/org/gtk/libgsk/glsl/coloring.glsl", "coloring" },
{ "/org/gtk/libgsk/glsl/cross_fade.glsl", "cross fade" },
{ "/org/gtk/libgsk/glsl/inset_shadow.glsl", "inset shadow" },
{ "/org/gtk/libgsk/glsl/linear_gradient.glsl", "linear gradient" },
{ "/org/gtk/libgsk/glsl/radial_gradient.glsl", "radial gradient" },
{ "/org/gtk/libgsk/glsl/conic_gradient.glsl", "conic gradient" },
{ "/org/gtk/libgsk/glsl/outset_shadow.glsl", "outset shadow" },
{ "/org/gtk/libgsk/glsl/repeat.glsl", "repeat" },
{ "/org/gtk/libgsk/glsl/unblurred_outset_shadow.glsl", "unblurred_outset shadow" },
};
gsk_gl_shader_builder_init (&shader_builder,
"/org/gtk/libgsk/gl/preamble.glsl",
"/org/gtk/libgsk/gl/preamble.vs.glsl",
"/org/gtk/libgsk/gl/preamble.fs.glsl");
"/org/gtk/libgsk/glsl/preamble.glsl",
"/org/gtk/libgsk/glsl/preamble.vs.glsl",
"/org/gtk/libgsk/glsl/preamble.fs.glsl");
g_assert (G_N_ELEMENTS (program_definitions) == GL_N_PROGRAMS);
+12 -10
View File
@@ -2439,9 +2439,9 @@ render_node_print (Printer *p,
{
start_node (p, "cross-fade");
append_node_param (p, "end", gsk_cross_fade_node_get_end_child (node));
append_float_param (p, "progress", gsk_cross_fade_node_get_progress (node), 0.5f);
append_node_param (p, "start", gsk_cross_fade_node_get_start_child (node));
append_node_param (p, "end", gsk_cross_fade_node_get_end_child (node));
end_node (p);
}
@@ -2456,8 +2456,8 @@ render_node_print (Printer *p,
start_node (p, "linear-gradient");
append_rect_param (p, "bounds", &node->bounds);
append_point_param (p, "start", gsk_linear_gradient_node_get_start (node));
append_point_param (p, "end", gsk_linear_gradient_node_get_end (node));
append_point_param (p, "start", gsk_linear_gradient_node_get_start (node));
append_stops_param (p, "stops", gsk_linear_gradient_node_get_color_stops (node, NULL),
gsk_linear_gradient_node_get_n_color_stops (node));
@@ -2506,8 +2506,8 @@ render_node_print (Printer *p,
{
start_node (p, "opacity");
append_float_param (p, "opacity", gsk_opacity_node_get_opacity (node), 0.5f);
append_node_param (p, "child", gsk_opacity_node_get_child (node));
append_float_param (p, "opacity", gsk_opacity_node_get_opacity (node), 0.5f);
end_node (p);
}
@@ -2535,8 +2535,8 @@ render_node_print (Printer *p,
{
start_node (p, "clip");
append_rect_param (p, "clip", gsk_clip_node_get_clip (node));
append_node_param (p, "child", gsk_clip_node_get_child (node));
append_rect_param (p, "clip", gsk_clip_node_get_clip (node));
end_node (p);
}
@@ -2546,8 +2546,8 @@ render_node_print (Printer *p,
{
start_node (p, "rounded-clip");
append_rounded_rect_param (p, "clip", gsk_rounded_clip_node_get_clip (node));
append_node_param (p, "child", gsk_rounded_clip_node_get_child (node));
append_rounded_rect_param (p, "clip", gsk_rounded_clip_node_get_clip (node));
end_node (p);
@@ -2559,9 +2559,9 @@ render_node_print (Printer *p,
GskTransform *transform = gsk_transform_node_get_transform (node);
start_node (p, "transform");
append_node_param (p, "child", gsk_transform_node_get_child (node));
if (gsk_transform_get_category (transform) != GSK_TRANSFORM_CATEGORY_IDENTITY)
append_transform_param (p, "transform", transform);
append_node_param (p, "child", gsk_transform_node_get_child (node));
end_node (p);
}
@@ -2571,11 +2571,11 @@ render_node_print (Printer *p,
{
start_node (p, "color-matrix");
append_node_param (p, "child", gsk_color_matrix_node_get_child (node));
if (!graphene_matrix_is_identity (gsk_color_matrix_node_get_color_matrix (node)))
append_matrix_param (p, "matrix", gsk_color_matrix_node_get_color_matrix (node));
if (!graphene_vec4_equal (gsk_color_matrix_node_get_color_offset (node), graphene_vec4_zero ()))
append_vec4_param (p, "offset", gsk_color_matrix_node_get_color_offset (node));
append_node_param (p, "child", gsk_color_matrix_node_get_child (node));
end_node (p);
}
@@ -2649,6 +2649,8 @@ render_node_print (Printer *p,
start_node (p, "shadow");
append_node_param (p, "child", gsk_shadow_node_get_child (node));
_indent (p);
g_string_append (p->str, "shadows: ");
for (i = 0; i < n_shadows; i ++)
@@ -2676,7 +2678,6 @@ render_node_print (Printer *p,
g_string_append_c (p->str, ';');
g_string_append_c (p->str, '\n');
append_node_param (p, "child", gsk_shadow_node_get_child (node));
end_node (p);
}
@@ -2916,9 +2917,9 @@ render_node_print (Printer *p,
if (!graphene_rect_equal (&node->bounds, &child->bounds))
append_rect_param (p, "bounds", &node->bounds);
append_node_param (p, "child", gsk_repeat_node_get_child (node));
if (!graphene_rect_equal (child_bounds, &child->bounds))
append_rect_param (p, "child-bounds", child_bounds);
append_node_param (p, "child", gsk_repeat_node_get_child (node));
end_node (p);
}
@@ -2931,6 +2932,8 @@ render_node_print (Printer *p,
start_node (p, "blend");
append_node_param (p, "bottom", gsk_blend_node_get_bottom_child (node));
if (mode != GSK_BLEND_MODE_DEFAULT)
{
_indent (p);
@@ -2943,7 +2946,6 @@ render_node_print (Printer *p,
}
}
}
append_node_param (p, "bottom", gsk_blend_node_get_bottom_child (node));
append_node_param (p, "top", gsk_blend_node_get_top_child (node));
end_node (p);
+20 -21
View File
@@ -1,23 +1,23 @@
gsk_private_gl_shaders = [
'gl/resources/preamble.glsl',
'gl/resources/preamble.fs.glsl',
'gl/resources/preamble.vs.glsl',
'gl/resources/border.glsl',
'gl/resources/blit.glsl',
'gl/resources/coloring.glsl',
'gl/resources/color.glsl',
'gl/resources/linear_gradient.glsl',
'gl/resources/radial_gradient.glsl',
'gl/resources/conic_gradient.glsl',
'gl/resources/color_matrix.glsl',
'gl/resources/blur.glsl',
'gl/resources/inset_shadow.glsl',
'gl/resources/outset_shadow.glsl',
'gl/resources/unblurred_outset_shadow.glsl',
'gl/resources/cross_fade.glsl',
'gl/resources/blend.glsl',
'gl/resources/repeat.glsl',
'gl/resources/custom.glsl',
'resources/glsl/preamble.glsl',
'resources/glsl/preamble.fs.glsl',
'resources/glsl/preamble.vs.glsl',
'resources/glsl/border.glsl',
'resources/glsl/blit.glsl',
'resources/glsl/coloring.glsl',
'resources/glsl/color.glsl',
'resources/glsl/linear_gradient.glsl',
'resources/glsl/radial_gradient.glsl',
'resources/glsl/conic_gradient.glsl',
'resources/glsl/color_matrix.glsl',
'resources/glsl/blur.glsl',
'resources/glsl/inset_shadow.glsl',
'resources/glsl/outset_shadow.glsl',
'resources/glsl/unblurred_outset_shadow.glsl',
'resources/glsl/cross_fade.glsl',
'resources/glsl/blend.glsl',
'resources/glsl/repeat.glsl',
'resources/glsl/custom.glsl',
]
gsk_private_ngl_shaders = [
@@ -85,7 +85,6 @@ gsk_private_sources = files([
'ngl/gskngltexturelibrary.c',
'ngl/gskngluniformstate.c',
'ngl/gskngltexturepool.c',
'ngl/fp16.c',
])
gsk_public_headers = files([
@@ -159,7 +158,7 @@ if have_vulkan
'vulkan/gskvulkanshader.c',
])
subdir('vulkan/resources')
subdir('resources/vulkan')
endif # have_vulkan
if get_variable('broadway_enabled')
-207
View File
@@ -1,207 +0,0 @@
/* fp16.c
*
* Copyright 2021 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <config.h>
#include "fp16private.h"
#ifdef HAVE_F16C
#include <immintrin.h>
#endif
static inline guint
as_uint (const float x)
{
return *(guint*)&x;
}
static inline float
as_float (const guint x)
{
return *(float*)&x;
}
// IEEE-754 16-bit floating-point format (without infinity): 1-5-10
static inline float
half_to_float (const guint16 x)
{
const guint e = (x&0x7C00)>>10; // exponent
const guint m = (x&0x03FF)<<13; // mantissa
const guint v = as_uint((float)m)>>23;
return as_float((x&0x8000)<<16 | (e!=0)*((e+112)<<23|m) | ((e==0)&(m!=0))*((v-37)<<23|((m<<(150-v))&0x007FE000)));
}
static inline guint16
float_to_half (const float x)
{
const guint b = as_uint(x)+0x00001000; // round-to-nearest-even
const guint e = (b&0x7F800000)>>23; // exponent
const guint m = b&0x007FFFFF; // mantissa
return (b&0x80000000)>>16 | (e>112)*((((e-112)<<10)&0x7C00)|m>>13) | ((e<113)&(e>101))*((((0x007FF000+m)>>(125-e))+1)>>1) | (e>143)*0x7FFF; // sign : normalized : denormalized : saturate
}
static void
float_to_half4_c (const float f[4],
guint16 h[4])
{
h[0] = float_to_half (f[0]);
h[1] = float_to_half (f[1]);
h[2] = float_to_half (f[2]);
h[3] = float_to_half (f[3]);
}
static void
half_to_float4_c (const guint16 h[4],
float f[4])
{
f[0] = half_to_float (h[0]);
f[1] = half_to_float (h[1]);
f[2] = half_to_float (h[2]);
f[3] = half_to_float (h[3]);
}
#ifdef HAVE_F16C
#if defined(_MSC_VER) && !defined(__clang__)
#define CAST_M128I_P(a) (__m128i const *) a
#else
#define CAST_M128I_P(a) (__m128i_u const *) a
#endif
static void
float_to_half4_f16c (const float f[4],
guint16 h[4])
{
__m128 s = _mm_loadu_ps (f);
__m128i i = _mm_cvtps_ph (s, 0);
_mm_storel_epi64 ((__m128i*)h, i);
}
static void
half_to_float4_f16c (const guint16 h[4],
float f[4])
{
__m128i i = _mm_loadl_epi64 (CAST_M128I_P (h));
__m128 s = _mm_cvtph_ps (i);
_mm_store_ps (f, s);
}
#undef CAST_M128I_P
#if defined(_MSC_VER) && !defined(__clang__)
/* based on info from https://walbourn.github.io/directxmath-f16c-and-fma/ */
static gboolean
have_f16c_msvc (void)
{
static gboolean result = FALSE;
static gsize inited = 0;
if (g_once_init_enter (&inited))
{
int cpuinfo[4] = { -1 };
__cpuid (cpuinfo, 0);
if (cpuinfo[0] > 0)
{
__cpuid (cpuinfo, 1);
if ((cpuinfo[2] & 0x8000000) != 0)
result = (cpuinfo[2] & 0x20000000) != 0;
}
g_once_init_leave (&inited, 1);
}
return result;
}
void
float_to_half4 (const float f[4], guint16 h[4])
{
if (have_f16c_msvc ())
float_to_half4_f16c (f, h);
else
float_to_half4_c (f, h);
}
void
half_to_float4 (const guint16 h[4], float f[4])
{
if (have_f16c_msvc ())
half_to_float4_f16c (h, f);
else
half_to_float4_c (h, f);
}
#else
void float_to_half4 (const float f[4], guint16 h[4]) __attribute__((ifunc ("resolve_float_to_half4")));
void half_to_float4 (const guint16 h[4], float f[4]) __attribute__((ifunc ("resolve_half_to_float4")));
static void *
resolve_float_to_half4 (void)
{
__builtin_cpu_init ();
if (__builtin_cpu_supports ("f16c"))
return float_to_half4_f16c;
else
return float_to_half4_c;
}
static void *
resolve_half_to_float4 (void)
{
__builtin_cpu_init ();
if (__builtin_cpu_supports ("f16c"))
return half_to_float4_f16c;
else
return half_to_float4_c;
}
#endif
#else
#if defined(__APPLE__) || (defined(_MSC_VER) && !defined(__clang__))
// turns out aliases don't work on Darwin nor Visual Studio
void
float_to_half4 (const float f[4],
guint16 h[4])
{
float_to_half4_c (f, h);
}
void
half_to_float4 (const guint16 h[4],
float f[4])
{
half_to_float4_c (h, f);
}
#else
void float_to_half4 (const float f[4], guint16 h[4]) __attribute__((alias ("float_to_half4_c")));
void half_to_float4 (const guint16 h[4], float f[4]) __attribute__((alias ("half_to_float4_c")));
#endif
#endif /* GTK_HAS_F16C */
-40
View File
@@ -1,40 +0,0 @@
/* fp16private.h
*
* Copyright 2021 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef __FP16_PRIVATE_H__
#define __FP16_PRIVATE_H__
#include <glib.h>
G_BEGIN_DECLS
#define FP16_ZERO ((guint16)0)
#define FP16_ONE ((guint16)15360)
#define FP16_MINUS_ONE ((guint16)48128)
void float_to_half4 (const float f[4],
guint16 h[4]);
void half_to_float4 (const guint16 h[4],
float f[4]);
G_END_DECLS
#endif
+7 -8
View File
@@ -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;
@@ -951,7 +955,6 @@ gsk_ngl_command_queue_execute (GskNglCommandQueue *self,
guint n_binds = 0;
guint n_fbos = 0;
guint n_uniforms = 0;
guint n_programs = 0;
guint vao_id;
guint vbo_id;
int textures[4];
@@ -1004,13 +1007,13 @@ gsk_ngl_command_queue_execute (GskNglCommandQueue *self,
/* 2 = color location */
glEnableVertexAttribArray (2);
glVertexAttribPointer (2, 4, GL_HALF_FLOAT, GL_FALSE,
glVertexAttribPointer (2, 4, GL_FLOAT, GL_FALSE,
sizeof (GskNglDrawVertex),
(void *) G_STRUCT_OFFSET (GskNglDrawVertex, color));
/* 3 = color2 location */
glEnableVertexAttribArray (3);
glVertexAttribPointer (3, 4, GL_HALF_FLOAT, GL_FALSE,
glVertexAttribPointer (3, 4, GL_FLOAT, GL_FALSE,
sizeof (GskNglDrawVertex),
(void *) G_STRUCT_OFFSET (GskNglDrawVertex, color2));
@@ -1063,8 +1066,6 @@ gsk_ngl_command_queue_execute (GskNglCommandQueue *self,
{
program = batch->any.program;
glUseProgram (program);
n_programs++;
}
if (apply_framebuffer (&framebuffer, batch->draw.framebuffer))
@@ -1147,7 +1148,6 @@ gsk_ngl_command_queue_execute (GskNglCommandQueue *self,
gdk_profiler_set_int_counter (self->metrics.n_binds, n_binds);
gdk_profiler_set_int_counter (self->metrics.n_uniforms, n_uniforms);
gdk_profiler_set_int_counter (self->metrics.n_fbos, n_fbos);
gdk_profiler_set_int_counter (self->metrics.n_programs, n_programs);
gdk_profiler_set_int_counter (self->metrics.n_uploads, self->n_uploads);
gdk_profiler_set_int_counter (self->metrics.queue_depth, self->batches.len);
@@ -1419,7 +1419,6 @@ gsk_ngl_command_queue_set_profiler (GskNglCommandQueue *self,
self->metrics.n_fbos = gdk_profiler_define_int_counter ("fbos", "Number of framebuffers attached");
self->metrics.n_uniforms = gdk_profiler_define_int_counter ("uniforms", "Number of uniforms changed");
self->metrics.n_uploads = gdk_profiler_define_int_counter ("uploads", "Number of texture uploads");
self->metrics.n_programs = gdk_profiler_define_int_counter ("programs", "Number of program changes");
self->metrics.queue_depth = gdk_profiler_define_int_counter ("gl-queue-depth", "Depth of GL command batches");
}
#endif
+6 -1
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.
@@ -250,7 +256,6 @@ struct _GskNglCommandQueue
guint n_fbos;
guint n_uniforms;
guint n_uploads;
guint n_programs;
guint queue_depth;
} metrics;
+4 -4
View File
@@ -1074,16 +1074,16 @@ gsk_ngl_driver_lookup_shader (GskNglDriver *self,
gsk_ngl_compiler_set_preamble_from_resource (compiler,
GSK_NGL_COMPILER_ALL,
"/org/gtk/libgsk/ngl/preamble.glsl");
"/org/gtk/libgsk/glsl/preamble.glsl");
gsk_ngl_compiler_set_preamble_from_resource (compiler,
GSK_NGL_COMPILER_VERTEX,
"/org/gtk/libgsk/ngl/preamble.vs.glsl");
"/org/gtk/libgsk/glsl/preamble.vs.glsl");
gsk_ngl_compiler_set_preamble_from_resource (compiler,
GSK_NGL_COMPILER_FRAGMENT,
"/org/gtk/libgsk/ngl/preamble.fs.glsl");
"/org/gtk/libgsk/glsl/preamble.fs.glsl");
gsk_ngl_compiler_set_source_from_resource (compiler,
GSK_NGL_COMPILER_ALL,
"/org/gtk/libgsk/ngl/custom.glsl");
"/org/gtk/libgsk/glsl/custom.glsl");
gsk_ngl_compiler_set_suffix (compiler, GSK_NGL_COMPILER_FRAGMENT, suffix);
/* Setup attributes that are provided via VBO */
+150 -259
View File
@@ -43,7 +43,6 @@
#include "gsknglshadowlibraryprivate.h"
#include "ninesliceprivate.h"
#include "fp16private.h"
#define ORTHO_NEAR_PLANE -10000
#define ORTHO_FAR_PLANE 10000
@@ -212,13 +211,6 @@ node_is_invisible (const GskRenderNode *node)
node->bounds.size.height == 0.0f;
}
static inline gboolean G_GNUC_PURE
rounded_rect_equal (const GskRoundedRect *r1,
const GskRoundedRect *r2)
{
return memcmp (r1, r2, sizeof (GskRoundedRect)) == 0;
}
static inline void
gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self)
{
@@ -818,9 +810,9 @@ interval_contains (float p1, float w1,
}
static inline gboolean
gsk_ngl_render_job_update_clip (GskNglRenderJob *job,
const graphene_rect_t *bounds,
gboolean *pushed_clip)
gsk_ngl_render_job_update_clip (GskNglRenderJob *job,
const GskRenderNode *node,
gboolean *pushed_clip)
{
graphene_rect_t transformed_bounds;
gboolean no_clip = FALSE;
@@ -834,7 +826,7 @@ gsk_ngl_render_job_update_clip (GskNglRenderJob *job,
return TRUE;
}
gsk_ngl_render_job_transform_bounds (job, bounds, &transformed_bounds);
gsk_ngl_render_job_transform_bounds (job, &node->bounds, &transformed_bounds);
if (!rect_intersects (&job->current_clip->rect.bounds, &transformed_bounds))
{
@@ -892,13 +884,6 @@ gsk_ngl_render_job_update_clip (GskNglRenderJob *job,
return TRUE;
}
static inline void
rgba_to_half (const GdkRGBA *rgba,
guint16 h[4])
{
float_to_half4 ((const float *)rgba, h);
}
/* fill_vertex_data */
static void
gsk_ngl_render_job_draw_coords (GskNglRenderJob *job,
@@ -910,16 +895,16 @@ gsk_ngl_render_job_draw_coords (GskNglRenderJob *job,
float min_v,
float max_u,
float max_v,
guint16 c[4])
const GdkRGBA *color)
{
GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue);
vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .uv = { min_u, min_v }, .color = { c[0], c[1], c[2], c[3] } };
vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { min_u, max_v }, .color = { c[0], c[1], c[2], c[3] } };
vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { max_u, min_v }, .color = { c[0], c[1], c[2], c[3] } };
vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .uv = { max_u, max_v }, .color = { c[0], c[1], c[2], c[3] } };
vertices[4] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { min_u, max_v }, .color = { c[0], c[1], c[2], c[3] } };
vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { max_u, min_v }, .color = { c[0], c[1], c[2], c[3] } };
vertices[0] = (GskNglDrawVertex) { { min_x, min_y }, { min_u, min_v }, { color->red, color->green, color->blue, color->alpha } };
vertices[1] = (GskNglDrawVertex) { { min_x, max_y }, { min_u, max_v }, { color->red, color->green, color->blue, color->alpha } };
vertices[2] = (GskNglDrawVertex) { { max_x, min_y }, { max_u, min_v }, { color->red, color->green, color->blue, color->alpha } };
vertices[3] = (GskNglDrawVertex) { { max_x, max_y }, { max_u, max_v }, { color->red, color->green, color->blue, color->alpha } };
vertices[4] = (GskNglDrawVertex) { { min_x, max_y }, { min_u, max_v }, { color->red, color->green, color->blue, color->alpha } };
vertices[5] = (GskNglDrawVertex) { { max_x, min_y }, { max_u, min_v }, { color->red, color->green, color->blue, color->alpha } };
}
/* load_vertex_data_with_region */
@@ -927,7 +912,7 @@ static inline void
gsk_ngl_render_job_draw_offscreen_with_color (GskNglRenderJob *job,
const graphene_rect_t *bounds,
const GskNglRenderOffscreen *offscreen,
guint16 color[4])
const GdkRGBA *color)
{
float min_x = job->offset_x + bounds->origin.x;
float min_y = job->offset_y + bounds->origin.y;
@@ -947,8 +932,7 @@ gsk_ngl_render_job_draw_offscreen (GskNglRenderJob *job,
const graphene_rect_t *bounds,
const GskNglRenderOffscreen *offscreen)
{
gsk_ngl_render_job_draw_offscreen_with_color (job, bounds, offscreen,
(guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO });
gsk_ngl_render_job_draw_offscreen_with_color (job, bounds, offscreen, &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f });
}
/* load_float_vertex_data */
@@ -958,7 +942,7 @@ gsk_ngl_render_job_draw_with_color (GskNglRenderJob *job,
float y,
float width,
float height,
guint16 color[4])
const GdkRGBA *color)
{
float min_x = job->offset_x + x;
float min_y = job->offset_y + y;
@@ -975,15 +959,14 @@ gsk_ngl_render_job_draw (GskNglRenderJob *job,
float width,
float height)
{
gsk_ngl_render_job_draw_with_color (job, x, y, width, height,
(guint16[]) { FP_ZERO, FP_ZERO, FP_ZERO, FP_ZERO });
gsk_ngl_render_job_draw_with_color (job, x, y, width, height, &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f });
}
/* load_vertex_data */
static inline void
gsk_ngl_render_job_draw_rect_with_color (GskNglRenderJob *job,
const graphene_rect_t *bounds,
guint16 color[4])
const GdkRGBA *color)
{
gsk_ngl_render_job_draw_with_color (job,
bounds->origin.x,
@@ -1012,12 +995,11 @@ gsk_ngl_render_job_draw_offscreen_rect (GskNglRenderJob *job,
float min_y = job->offset_y + bounds->origin.y;
float max_x = min_x + bounds->size.width;
float max_y = min_y + bounds->size.height;
guint16 color[4] = { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO };
gsk_ngl_render_job_draw_coords (job,
min_x, min_y, max_x, max_y,
0, 1, 1, 0,
color);
&(GdkRGBA) { 0.f, 0.f, 0.f, 0.f } );
}
static inline void
@@ -1271,7 +1253,7 @@ blur_offscreen (GskNglRenderJob *job,
gsk_ngl_render_job_draw_coords (job,
0, 0, texture_to_blur_width, texture_to_blur_height,
0, 1, 1, 0,
(guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO });
&(GdkRGBA) { 0.f, 0.f, 0.f, 0.f });
gsk_ngl_render_job_end_draw (job);
/* Bind second pass framebuffer and clear it */
@@ -1298,7 +1280,7 @@ blur_offscreen (GskNglRenderJob *job,
gsk_ngl_render_job_draw_coords (job,
0, 0, texture_to_blur_width, texture_to_blur_height,
0, 1, 1, 0,
(guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO });
&(GdkRGBA) { 0.f, 0.f, 0.f, 0.f });
gsk_ngl_render_job_end_draw (job);
gsk_ngl_render_job_pop_modelview (job);
@@ -1367,54 +1349,15 @@ blur_node (GskNglRenderJob *job,
*max_y = job->offset_y + node->bounds.origin.y + node->bounds.size.height + half_blur_extra;
}
#define ATLAS_SIZE 512
static inline void
gsk_ngl_render_job_visit_color_node (GskNglRenderJob *job,
const GskRenderNode *node)
{
guint16 color[4];
GskNglProgram *program;
GskNglCommandBatch *batch;
rgba_to_half (gsk_color_node_get_color (node), color);
/* Avoid switching away from the coloring program for
* rendering a solid color.
*/
program = CHOOSE_PROGRAM (job, coloring);
batch = gsk_ngl_command_queue_get_batch (job->command_queue);
if (batch->any.kind == GSK_NGL_COMMAND_KIND_DRAW &&
batch->any.program == program->id)
{
GskNglRenderOffscreen offscreen = {0};
gsk_ngl_render_job_begin_draw (job, program);
/* The top left few pixels in our atlases are always
* solid white, so we can use it here, without
* having to choose any particular atlas texture.
*/
offscreen.was_offscreen = FALSE;
offscreen.area.x = 1.f / ATLAS_SIZE;
offscreen.area.y = 1.f / ATLAS_SIZE;
offscreen.area.x2 = 2.f / ATLAS_SIZE;
offscreen.area.y2 = 2.f / ATLAS_SIZE;
gsk_ngl_render_job_draw_offscreen_with_color (job,
&node->bounds,
&offscreen,
color);
gsk_ngl_render_job_end_draw (job);
}
else
{
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color));
gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, color);
gsk_ngl_render_job_end_draw (job);
}
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color));
gsk_ngl_render_job_draw_rect_with_color (job,
&node->bounds,
gsk_color_node_get_color (node));
gsk_ngl_render_job_end_draw (job);
}
static inline void
@@ -1684,41 +1627,28 @@ gsk_ngl_render_job_visit_rect_border_node (GskNglRenderJob *job,
const float *widths = gsk_border_node_get_widths (node);
const graphene_point_t *origin = &node->bounds.origin;
const graphene_size_t *size = &node->bounds.size;
guint16 color[4];
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color));
if (widths[0] > 0)
{
rgba_to_half (&colors[0], color);
gsk_ngl_render_job_draw_rect_with_color (job,
&GRAPHENE_RECT_INIT (origin->x, origin->y, size->width - widths[1], widths[0]),
color);
}
gsk_ngl_render_job_draw_rect_with_color (job,
&GRAPHENE_RECT_INIT (origin->x, origin->y, size->width - widths[1], widths[0]),
&colors[0]);
if (widths[1] > 0)
{
rgba_to_half (&colors[1], color);
gsk_ngl_render_job_draw_rect_with_color (job,
&GRAPHENE_RECT_INIT (origin->x + size->width - widths[1], origin->y, widths[1], size->height - widths[2]),
color);
}
gsk_ngl_render_job_draw_rect_with_color (job,
&GRAPHENE_RECT_INIT (origin->x + size->width - widths[1], origin->y, widths[1], size->height - widths[2]),
&colors[0]);
if (widths[2] > 0)
{
rgba_to_half (&colors[2], color);
gsk_ngl_render_job_draw_rect_with_color (job,
&GRAPHENE_RECT_INIT (origin->x + widths[3], origin->y + size->height - widths[2], size->width - widths[1], widths[2]),
color);
}
gsk_ngl_render_job_draw_rect_with_color (job,
&GRAPHENE_RECT_INIT (origin->x + widths[3], origin->y + size->height - widths[2], size->width - widths[1], widths[2]),
&colors[0]);
if (widths[3] > 0)
{
rgba_to_half (&colors[3], color);
gsk_ngl_render_job_draw_rect_with_color (job,
&GRAPHENE_RECT_INIT (origin->x, origin->y + widths[0], widths[3], size->height - widths[0]),
color);
}
gsk_ngl_render_job_draw_rect_with_color (job,
&GRAPHENE_RECT_INIT (origin->x, origin->y + widths[0], widths[3], size->height - widths[0]),
&colors[0]);
gsk_ngl_render_job_end_draw (job);
}
@@ -1728,7 +1658,7 @@ gsk_ngl_render_job_visit_border_node (GskNglRenderJob *job,
const GskRenderNode *node)
{
const GskRoundedRect *rounded_outline = gsk_border_node_get_outline (node);
const GdkRGBA *colors = gsk_border_node_get_colors (node);
const GdkRGBA *c = gsk_border_node_get_colors (node);
const float *widths = gsk_border_node_get_widths (node);
struct {
float w;
@@ -1739,7 +1669,6 @@ gsk_ngl_render_job_visit_border_node (GskNglRenderJob *job,
float max_x = min_x + node->bounds.size.width;
float max_y = min_y + node->bounds.size.height;
GskRoundedRect outline;
guint16 color[4];
memset (sizes, 0, sizeof sizes);
@@ -1783,60 +1712,52 @@ gsk_ngl_render_job_visit_border_node (GskNglRenderJob *job,
{
GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue);
rgba_to_half (&colors[0], color);
vertices[0] = (GskNglDrawVertex) { { min_x, min_y }, { 0, 1 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha } };
vertices[1] = (GskNglDrawVertex) { { min_x + sizes[0].w, min_y + sizes[0].h }, { 0, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha } };
vertices[2] = (GskNglDrawVertex) { { max_x, min_y }, { 1, 1 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha } };
vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .uv = { 0, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[1] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[3] = (GskNglDrawVertex) { .position = { max_x - sizes[1].w, min_y + sizes[1].h }, .uv = { 1, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[4] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[3] = (GskNglDrawVertex) { { max_x - sizes[1].w, min_y + sizes[1].h }, { 1, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha } };
vertices[4] = (GskNglDrawVertex) { { min_x + sizes[0].w, min_y + sizes[0].h }, { 0, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha } };
vertices[5] = (GskNglDrawVertex) { { max_x, min_y }, { 1, 1 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha } };
}
if (widths[1] > 0)
{
GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue);
rgba_to_half (&colors[1], color);
vertices[0] = (GskNglDrawVertex) { { max_x - sizes[1].w, min_y + sizes[1].h }, { 0, 1 }, { c[1].red, c[1].green, c[1].blue, c[1].alpha } };
vertices[1] = (GskNglDrawVertex) { { max_x - sizes[2].w, max_y - sizes[2].h }, { 0, 0 }, { c[1].red, c[1].green, c[1].blue, c[1].alpha } };
vertices[2] = (GskNglDrawVertex) { { max_x, min_y }, { 1, 1 }, { c[1].red, c[1].green, c[1].blue, c[1].alpha } };
vertices[0] = (GskNglDrawVertex) { .position = { max_x - sizes[1].w, min_y + sizes[1].h }, .uv = { 0, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[1] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .uv = { 1, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[4] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[3] = (GskNglDrawVertex) { { max_x, max_y }, { 1, 0 }, { c[1].red, c[1].green, c[1].blue, c[1].alpha } };
vertices[4] = (GskNglDrawVertex) { { max_x - sizes[2].w, max_y - sizes[2].h }, { 0, 0 }, { c[1].red, c[1].green, c[1].blue, c[1].alpha } };
vertices[5] = (GskNglDrawVertex) { { max_x, min_y }, { 1, 1 }, { c[1].red, c[1].green, c[1].blue, c[1].alpha } };
}
if (widths[2] > 0)
{
GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue);
rgba_to_half (&colors[2], color);
vertices[0] = (GskNglDrawVertex) { { min_x + sizes[3].w, max_y - sizes[3].h }, { 0, 1 }, { c[2].red, c[2].green, c[2].blue, c[2].alpha } };
vertices[1] = (GskNglDrawVertex) { { min_x, max_y }, { 0, 0 }, { c[2].red, c[2].green, c[2].blue, c[2].alpha } };
vertices[2] = (GskNglDrawVertex) { { max_x - sizes[2].w, max_y - sizes[2].h }, { 1, 1 }, { c[2].red, c[2].green, c[2].blue, c[2].alpha } };
vertices[0] = (GskNglDrawVertex) { .position = { min_x + sizes[3].w, max_y - sizes[3].h }, .uv = { 0, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[2] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .uv = { 1, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[4] = (GskNglDrawVertex) { .position = { min_x , max_y }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[5] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[3] = (GskNglDrawVertex) { { max_x, max_y }, { 1, 0 }, { c[2].red, c[2].green, c[2].blue, c[2].alpha } };
vertices[4] = (GskNglDrawVertex) { { min_x , max_y }, { 0, 0 }, { c[2].red, c[2].green, c[2].blue, c[2].alpha } };
vertices[5] = (GskNglDrawVertex) { { max_x - sizes[2].w, max_y - sizes[2].h }, { 1, 1 }, { c[2].red, c[2].green, c[2].blue, c[2].alpha } };
}
if (widths[3] > 0)
{
GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue);
rgba_to_half (&colors[3], color);
vertices[0] = (GskNglDrawVertex) { { min_x, min_y }, { 0, 1 }, { c[3].red, c[3].green, c[3].blue, c[3].alpha } };
vertices[1] = (GskNglDrawVertex) { { min_x, max_y }, { 0, 0 }, { c[3].red, c[3].green, c[3].blue, c[3].alpha } };
vertices[2] = (GskNglDrawVertex) { { min_x + sizes[0].w, min_y + sizes[0].h }, { 1, 1 }, { c[3].red, c[3].green, c[3].blue, c[3].alpha } };
vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .uv = { 0, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[2] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[3] = (GskNglDrawVertex) { .position = { min_x + sizes[3].w, max_y - sizes[3].h }, .uv = { 1, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[4] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[5] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } };
vertices[3] = (GskNglDrawVertex) { { min_x + sizes[3].w, max_y - sizes[3].h }, { 1, 0 }, { c[3].red, c[3].green, c[3].blue, c[3].alpha } };
vertices[4] = (GskNglDrawVertex) { { min_x, max_y }, { 0, 0 }, { c[3].red, c[3].green, c[3].blue, c[3].alpha } };
vertices[5] = (GskNglDrawVertex) { { min_x + sizes[0].w, min_y + sizes[0].h }, { 1, 1 }, { c[3].red, c[3].green, c[3].blue, c[3].alpha } };
}
gsk_ngl_render_job_end_draw (job);
@@ -1854,6 +1775,8 @@ gsk_ngl_render_job_visit_css_background (GskNglRenderJob *job,
const GskRenderNode *node2)
{
const GskRenderNode *child = gsk_rounded_clip_node_get_child (node);
const GdkRGBA *c2 = gsk_color_node_get_color (child);
const GdkRGBA *c = gsk_border_node_get_colors (node2);
const GskRoundedRect *rounded_outline = gsk_border_node_get_outline (node2);
const float *widths = gsk_border_node_get_widths (node2);
float min_x = job->offset_x + node2->bounds.origin.x;
@@ -1862,15 +1785,10 @@ gsk_ngl_render_job_visit_css_background (GskNglRenderJob *job,
float max_y = min_y + node2->bounds.size.height;
GskRoundedRect outline;
GskNglDrawVertex *vertices;
guint16 color[4];
guint16 color2[4];
if (node_is_invisible (node2))
return;
rgba_to_half (&gsk_border_node_get_colors (node2)[0], color);
rgba_to_half (gsk_color_node_get_color (child), color2);
gsk_ngl_render_job_transform_rounded_rect (job, rounded_outline, &outline);
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, filled_border));
@@ -1885,12 +1803,12 @@ gsk_ngl_render_job_visit_css_background (GskNglRenderJob *job,
vertices = gsk_ngl_command_queue_add_vertices (job->command_queue);
vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } };
vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } };
vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } };
vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } };
vertices[4] = (GskNglDrawVertex) { .position = { min_x, max_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } };
vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } };
vertices[0] = (GskNglDrawVertex) { { min_x, min_y }, { 0, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha }, { c2->red, c2->green, c2->blue, c2->alpha } };
vertices[1] = (GskNglDrawVertex) { { min_x, max_y }, { 0, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha }, { c2->red, c2->green, c2->blue, c2->alpha } };
vertices[2] = (GskNglDrawVertex) { { max_x, min_y }, { 0, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha }, { c2->red, c2->green, c2->blue, c2->alpha } };
vertices[3] = (GskNglDrawVertex) { { max_x, max_y }, { 0, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha }, { c2->red, c2->green, c2->blue, c2->alpha } };
vertices[4] = (GskNglDrawVertex) { { min_x, max_y }, { 0, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha }, { c2->red, c2->green, c2->blue, c2->alpha } };
vertices[5] = (GskNglDrawVertex) { { max_x, min_y }, { 0, 0 }, { c[0].red, c[0].green, c[0].blue, c[0].alpha }, { c2->red, c2->green, c2->blue, c2->alpha } };
gsk_ngl_render_job_end_draw (job);
}
@@ -2015,7 +1933,6 @@ gsk_ngl_render_job_visit_unblurred_inset_shadow_node (GskNglRenderJob *job,
{
const GskRoundedRect *outline = gsk_inset_shadow_node_get_outline (node);
GskRoundedRect transformed_outline;
guint16 color[4];
gsk_ngl_render_job_transform_rounded_rect (job, outline, &transformed_outline);
@@ -2030,8 +1947,7 @@ gsk_ngl_render_job_visit_unblurred_inset_shadow_node (GskNglRenderJob *job,
UNIFORM_INSET_SHADOW_OFFSET, 0,
gsk_inset_shadow_node_get_dx (node),
gsk_inset_shadow_node_get_dy (node));
rgba_to_half (gsk_inset_shadow_node_get_color (node), color);
gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, color);
gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, gsk_inset_shadow_node_get_color (node));
gsk_ngl_render_job_end_draw (job);
}
@@ -2052,7 +1968,6 @@ gsk_ngl_render_job_visit_blurred_inset_shadow_node (GskNglRenderJob *job,
int blurred_texture_id;
GskTextureKey key;
GskNglRenderOffscreen offscreen = {0};
guint16 color[4];
g_assert (blur_radius > 0);
@@ -2132,10 +2047,9 @@ gsk_ngl_render_job_visit_blurred_inset_shadow_node (GskNglRenderJob *job,
UNIFORM_INSET_SHADOW_OFFSET, 0,
offset_x * scale_x,
offset_y * scale_y);
rgba_to_half (gsk_inset_shadow_node_get_color (node), color);
gsk_ngl_render_job_draw_with_color (job,
0, 0, texture_width, texture_height,
color);
gsk_inset_shadow_node_get_color (node));
gsk_ngl_render_job_end_draw (job);
gsk_ngl_render_job_pop_modelview (job);
@@ -2218,7 +2132,7 @@ gsk_ngl_render_job_visit_unblurred_outset_shadow_node (GskNglRenderJob *job,
float spread = gsk_outset_shadow_node_get_spread (node);
float dx = gsk_outset_shadow_node_get_dx (node);
float dy = gsk_outset_shadow_node_get_dy (node);
guint16 color[4];
const GdkRGBA *color = gsk_outset_shadow_node_get_color (node);
const float edge_sizes[] = { // Top, right, bottom, left
spread - dy, spread + dx, spread + dy, spread - dx
};
@@ -2229,8 +2143,6 @@ gsk_ngl_render_job_visit_unblurred_outset_shadow_node (GskNglRenderJob *job,
{ outline->corner[3].width + spread - dx, outline->corner[3].height + spread + dy },
};
rgba_to_half (gsk_outset_shadow_node_get_color (node), color);
gsk_ngl_render_job_transform_rounded_rect (job, outline, &transformed_outline);
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, unblurred_outset_shadow));
@@ -2293,14 +2205,16 @@ static inline void
gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
const GskRenderNode *node)
{
static const GdkRGBA white = { 1, 1, 1, 1 };
const GskRoundedRect *outline = gsk_outset_shadow_node_get_outline (node);
const GdkRGBA *color = gsk_outset_shadow_node_get_color (node);
float scale_x = job->scale_x;
float scale_y = job->scale_y;
float blur_radius = gsk_outset_shadow_node_get_blur_radius (node);
float blur_extra = blur_radius * 2.0f; /* 2.0 = shader radius_multiplier */
float half_blur_extra = blur_extra / 2.0f;
int extra_blur_pixels_x = ceilf (half_blur_extra * scale_x);
int extra_blur_pixels_y = ceilf (half_blur_extra * scale_y);
int extra_blur_pixels = ceilf (half_blur_extra * scale_x);
float spread = gsk_outset_shadow_node_get_spread (node);
float dx = gsk_outset_shadow_node_get_dx (node);
float dy = gsk_outset_shadow_node_get_dy (node);
@@ -2311,26 +2225,13 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
int blurred_texture_id;
int cached_tid;
gboolean do_slicing;
guint16 color[4];
float half_width = outline->bounds.size.width / 2;
float half_height = outline->bounds.size.height / 2;
rgba_to_half (gsk_outset_shadow_node_get_color (node), color);
/* scaled_outline is the minimal outline we need to draw the given drop shadow,
* enlarged by the spread and offset by the blur radius. */
scaled_outline = *outline;
if (outline->bounds.size.width < blur_extra ||
outline->bounds.size.height < blur_extra ||
outline->corner[0].width >= half_width ||
outline->corner[1].width >= half_width ||
outline->corner[2].width >= half_width ||
outline->corner[3].width >= half_width ||
outline->corner[0].height >= half_height ||
outline->corner[1].height >= half_height ||
outline->corner[2].height >= half_height ||
outline->corner[3].height >= half_height)
outline->bounds.size.height < blur_extra)
{
do_slicing = FALSE;
gsk_rounded_rect_shrink (&scaled_outline, -spread, -spread, -spread, -spread);
@@ -2353,10 +2254,10 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
texture_width = (int)ceil ((scaled_outline.bounds.size.width + blur_extra) * scale_x);
texture_height = (int)ceil ((scaled_outline.bounds.size.height + blur_extra) * scale_y);
scaled_outline.bounds.origin.x = extra_blur_pixels_x;
scaled_outline.bounds.origin.y = extra_blur_pixels_y;
scaled_outline.bounds.size.width = texture_width - (extra_blur_pixels_x * 2);
scaled_outline.bounds.size.height = texture_height - (extra_blur_pixels_y * 2);
scaled_outline.bounds.origin.x = extra_blur_pixels;
scaled_outline.bounds.origin.y = extra_blur_pixels;
scaled_outline.bounds.size.width = texture_width - (extra_blur_pixels * 2);
scaled_outline.bounds.size.height = texture_height - (extra_blur_pixels * 2);
for (guint i = 0; i < G_N_ELEMENTS (scaled_outline.corner); i++)
{
@@ -2405,8 +2306,7 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
/* Draw the outline using color program */
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color));
gsk_ngl_render_job_draw_with_color (job, 0, 0, texture_width, texture_height,
(guint16[]){ FP16_ONE, FP16_ONE, FP16_ONE, FP16_ONE });
gsk_ngl_render_job_draw_with_color (job, 0, 0, texture_width, texture_height, &white);
gsk_ngl_render_job_end_draw (job);
/* Reset state from offscreen */
@@ -2444,7 +2344,7 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
float min_x = floorf (outline->bounds.origin.x - spread - half_blur_extra + dx);
float min_y = floorf (outline->bounds.origin.y - spread - half_blur_extra + dy);
offscreen.was_offscreen = TRUE;
offscreen.was_offscreen = FALSE;
offscreen.texture_id = blurred_texture_id;
init_full_texture_region (&offscreen);
@@ -2469,8 +2369,6 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
return;
}
/* slicing */
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, outset_shadow));
gsk_ngl_program_set_uniform_texture (job->current_program,
UNIFORM_SHARED_SOURCE, 0,
@@ -2489,36 +2387,24 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
float max_y = ceilf (outline->bounds.origin.y + outline->bounds.size.height +
half_blur_extra + dy + spread);
const GskNglTextureNineSlice *slices;
float left_width, center_width, right_width;
float top_height, center_height, bottom_height;
GskNglTexture *texture;
texture = gsk_ngl_driver_get_texture_by_id (job->driver, blurred_texture_id);
slices = gsk_ngl_texture_get_nine_slice (texture, &scaled_outline, extra_blur_pixels_x, extra_blur_pixels_y);
slices = gsk_ngl_texture_get_nine_slice (texture, &scaled_outline, extra_blur_pixels);
offscreen.was_offscreen = TRUE;
/* Our texture coordinates MUST be scaled, while the actual vertex coords
* MUST NOT be scaled.
*/
left_width = slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x;
right_width = slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x;
center_width = (max_x - min_x) - (left_width + right_width);
top_height = slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y;
bottom_height = slices[NINE_SLICE_BOTTOM_LEFT].rect.height / scale_y;
center_height = (max_y - min_y) - (top_height + bottom_height);
* MUST NOT be scaled. */
/* Top left */
if (nine_slice_is_visible (&slices[NINE_SLICE_TOP_LEFT]))
{
memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_LEFT].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x,
min_y,
left_width,
top_height),
&GRAPHENE_RECT_INIT (min_x, min_y,
slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x,
slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y),
&offscreen,
color);
}
@@ -2527,11 +2413,13 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
if (nine_slice_is_visible (&slices[NINE_SLICE_TOP_CENTER]))
{
memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_CENTER].area, sizeof offscreen.area);
float width = (max_x - min_x) - (slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x +
slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x + left_width,
&GRAPHENE_RECT_INIT (min_x + (slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x),
min_y,
center_width,
top_height),
width,
slices[NINE_SLICE_TOP_CENTER].rect.height / scale_y),
&offscreen,
color);
}
@@ -2541,10 +2429,10 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
{
memcpy (&offscreen.area, &slices[NINE_SLICE_TOP_RIGHT].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (max_x - right_width,
&GRAPHENE_RECT_INIT (max_x - (slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x),
min_y,
right_width,
top_height),
slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x,
slices[NINE_SLICE_TOP_RIGHT].rect.height / scale_y),
&offscreen,
color);
}
@@ -2554,10 +2442,10 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
{
memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_RIGHT].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (max_x - right_width,
max_y - bottom_height,
right_width,
bottom_height),
&GRAPHENE_RECT_INIT (max_x - (slices[NINE_SLICE_BOTTOM_RIGHT].rect.width / scale_x),
max_y - (slices[NINE_SLICE_BOTTOM_RIGHT].rect.height / scale_y),
slices[NINE_SLICE_BOTTOM_RIGHT].rect.width / scale_x,
slices[NINE_SLICE_BOTTOM_RIGHT].rect.height / scale_y),
&offscreen,
color);
}
@@ -2568,9 +2456,9 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_LEFT].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x,
max_y - bottom_height,
left_width,
bottom_height),
max_y - (slices[NINE_SLICE_BOTTOM_LEFT].rect.height / scale_y),
slices[NINE_SLICE_BOTTOM_LEFT].rect.width / scale_x,
slices[NINE_SLICE_BOTTOM_LEFT].rect.height / scale_y),
&offscreen,
color);
}
@@ -2579,11 +2467,13 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
if (nine_slice_is_visible (&slices[NINE_SLICE_LEFT_CENTER]))
{
memcpy (&offscreen.area, &slices[NINE_SLICE_LEFT_CENTER].area, sizeof offscreen.area);
float height = (max_y - min_y) - (slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y +
slices[NINE_SLICE_BOTTOM_LEFT].rect.height / scale_y);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x,
min_y + top_height,
left_width,
center_height),
min_y + (slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y),
slices[NINE_SLICE_LEFT_CENTER].rect.width / scale_x,
height),
&offscreen,
color);
}
@@ -2592,11 +2482,13 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
if (nine_slice_is_visible (&slices[NINE_SLICE_RIGHT_CENTER]))
{
memcpy (&offscreen.area, &slices[NINE_SLICE_RIGHT_CENTER].area, sizeof offscreen.area);
float height = (max_y - min_y) - (slices[NINE_SLICE_TOP_RIGHT].rect.height / scale_y +
slices[NINE_SLICE_BOTTOM_RIGHT].rect.height / scale_y);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (max_x - right_width,
min_y + top_height,
right_width,
center_height),
&GRAPHENE_RECT_INIT (max_x - (slices[NINE_SLICE_RIGHT_CENTER].rect.width / scale_x),
min_y + (slices[NINE_SLICE_TOP_LEFT].rect.height / scale_y),
slices[NINE_SLICE_RIGHT_CENTER].rect.width / scale_x,
height),
&offscreen,
color);
}
@@ -2605,11 +2497,13 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
if (nine_slice_is_visible (&slices[NINE_SLICE_BOTTOM_CENTER]))
{
memcpy (&offscreen.area, &slices[NINE_SLICE_BOTTOM_CENTER].area, sizeof offscreen.area);
float width = (max_x - min_x) - (slices[NINE_SLICE_BOTTOM_LEFT].rect.width / scale_x +
slices[NINE_SLICE_BOTTOM_RIGHT].rect.width / scale_x);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x + left_width,
max_y - bottom_height,
center_width,
bottom_height),
&GRAPHENE_RECT_INIT (min_x + (slices[NINE_SLICE_BOTTOM_LEFT].rect.width / scale_x),
max_y - (slices[NINE_SLICE_BOTTOM_CENTER].rect.height / scale_y),
width,
slices[NINE_SLICE_BOTTOM_CENTER].rect.height / scale_y),
&offscreen,
color);
}
@@ -2617,20 +2511,17 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
/* Middle */
if (nine_slice_is_visible (&slices[NINE_SLICE_CENTER]))
{
if (!gsk_rounded_rect_contains_rect (outline, &GRAPHENE_RECT_INIT (min_x + left_width,
min_y + top_height,
center_width,
center_height)))
{
memcpy (&offscreen.area, &slices[NINE_SLICE_CENTER].area, sizeof offscreen.area);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x + left_width,
min_y + top_height,
center_width,
center_height),
&offscreen,
color);
}
memcpy (&offscreen.area, &slices[NINE_SLICE_CENTER].area, sizeof offscreen.area);
float width = (max_x - min_x) - (slices[NINE_SLICE_LEFT_CENTER].rect.width / scale_x +
slices[NINE_SLICE_RIGHT_CENTER].rect.width / scale_x);
float height = (max_y - min_y) - (slices[NINE_SLICE_TOP_CENTER].rect.height / scale_y +
slices[NINE_SLICE_BOTTOM_CENTER].rect.height / scale_y);
gsk_ngl_render_job_draw_offscreen_with_color (job,
&GRAPHENE_RECT_INIT (min_x + (slices[NINE_SLICE_LEFT_CENTER].rect.width / scale_x),
min_y + (slices[NINE_SLICE_TOP_CENTER].rect.height / scale_y),
width, height),
&offscreen,
color);
}
}
@@ -2799,7 +2690,7 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
guint last_texture = 0;
GskNglDrawVertex *vertices;
guint used = 0;
guint16 c[4] = { FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE };
GdkRGBA c;
const PangoGlyphInfo *gi;
guint i;
int yshift;
@@ -2811,8 +2702,10 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
/* If the font has color glyphs, we don't need to recolor anything.
* We tell the shader by setting the color to vec4(-1).
*/
if (force_color || !gsk_text_node_has_color_glyphs (node))
rgba_to_half (color, c);
if (!force_color && gsk_text_node_has_color_glyphs (node))
c = (GdkRGBA) { -1.f, -1.f, -1.f, -1.f };
else
c = *color;
lookup.font = (PangoFont *)font;
lookup.scale = (guint) (text_scale * 1024);
@@ -2890,13 +2783,13 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
glyph_x2 = glyph_x + glyph->ink_rect.width;
glyph_y2 = glyph_y + glyph->ink_rect.height;
*(vertices++) = (GskNglDrawVertex) { .position = { glyph_x, glyph_y }, .uv = { tx, ty }, .color = { c[0], c[1], c[2], c[3] } };
*(vertices++) = (GskNglDrawVertex) { .position = { glyph_x, glyph_y2 }, .uv = { tx, ty2 }, .color = { c[0], c[1], c[2], c[3] } };
*(vertices++) = (GskNglDrawVertex) { .position = { glyph_x2, glyph_y }, .uv = { tx2, ty }, .color = { c[0], c[1], c[2], c[3] } };
*(vertices++) = (GskNglDrawVertex) { { glyph_x, glyph_y }, { tx, ty }, { c.red, c.green, c.blue, c.alpha } };
*(vertices++) = (GskNglDrawVertex) { { glyph_x, glyph_y2 }, { tx, ty2 }, { c.red, c.green, c.blue, c.alpha } };
*(vertices++) = (GskNglDrawVertex) { { glyph_x2, glyph_y }, { tx2, ty }, { c.red, c.green, c.blue, c.alpha } };
*(vertices++) = (GskNglDrawVertex) { .position = { glyph_x2, glyph_y2 }, .uv = { tx2, ty2 }, .color = { c[0], c[1], c[2], c[3] } };
*(vertices++) = (GskNglDrawVertex) { .position = { glyph_x, glyph_y2 }, .uv = { tx, ty2 }, .color = { c[0], c[1], c[2], c[3] } };
*(vertices++) = (GskNglDrawVertex) { .position = { glyph_x2, glyph_y }, .uv = { tx2, ty }, .color = { c[0], c[1], c[2], c[3] } };
*(vertices++) = (GskNglDrawVertex) { { glyph_x2, glyph_y2 }, { tx2, ty2 }, { c.red, c.green, c.blue, c.alpha } };
*(vertices++) = (GskNglDrawVertex) { { glyph_x, glyph_y2 }, { tx, ty2 }, { c.red, c.green, c.blue, c.alpha } };
*(vertices++) = (GskNglDrawVertex) { { glyph_x2, glyph_y }, { tx2, ty }, { c.red, c.green, c.blue, c.alpha } };
batch->draw.vbo_count += GSK_NGL_N_VERTICES;
used++;
@@ -2929,7 +2822,6 @@ gsk_ngl_render_job_visit_shadow_node (GskNglRenderJob *job,
const float dy = shadow->dy;
GskNglRenderOffscreen offscreen = {0};
graphene_rect_t bounds;
guint16 color[4];
if (shadow->radius == 0 &&
gsk_render_node_get_node_type (shadow_child) == GSK_TEXT_NODE)
@@ -2992,8 +2884,7 @@ gsk_ngl_render_job_visit_shadow_node (GskNglRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
rgba_to_half (&shadow->color, color);
gsk_ngl_render_job_draw_offscreen_with_color (job, &bounds, &offscreen, color);
gsk_ngl_render_job_draw_offscreen_with_color (job, &bounds, &offscreen, &shadow->color);
gsk_ngl_render_job_end_draw (job);
gsk_ngl_render_job_offset (job, -dx, -dy);
}
@@ -3050,7 +2941,7 @@ gsk_ngl_render_job_visit_blur_node (GskNglRenderJob *job,
gsk_ngl_render_job_draw_coords (job,
min_x, min_y, max_x, max_y,
0, 1, 1, 0,
(guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO } );
&(GdkRGBA) { 0.f, 0.f, 0.f, 0.f } );
gsk_ngl_render_job_end_draw (job);
}
@@ -3156,10 +3047,10 @@ static inline void
gsk_ngl_render_job_visit_gl_shader_node_fallback (GskNglRenderJob *job,
const GskRenderNode *node)
{
guint16 pink[4] = { 15360, 13975, 14758, 15360 }; /* 255 105 180 */
static const GdkRGBA pink = { 255 / 255., 105 / 255., 180 / 255., 1.0 };
gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color));
gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, pink);
gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, &pink);
gsk_ngl_render_job_end_draw (job);
}
@@ -3365,7 +3256,7 @@ gsk_ngl_render_job_visit_texture_node (GskNglRenderJob *job,
gsk_ngl_render_job_draw_coords (job,
x1, y1, x2, y2,
0, 0, 1, 1,
(guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO });
&(GdkRGBA) { 0.f, 0.f, 0.f, 0.f });
}
gsk_ngl_render_job_end_draw (job);
@@ -3441,7 +3332,7 @@ gsk_ngl_render_job_visit_node (GskNglRenderJob *job,
if (node_is_invisible (node))
return;
if (!gsk_ngl_render_job_update_clip (job, &node->bounds, &has_clip))
if (!gsk_ngl_render_job_update_clip (job, node, &has_clip))
return;
switch (gsk_render_node_get_node_type (node))
@@ -3501,8 +3392,8 @@ gsk_ngl_render_job_visit_node (GskNglRenderJob *job,
if (gsk_render_node_get_node_type (grandchild) == GSK_COLOR_NODE &&
gsk_render_node_get_node_type (child2) == GSK_BORDER_NODE &&
gsk_border_node_get_uniform_color (child2) &&
rounded_rect_equal (gsk_rounded_clip_node_get_clip (child),
gsk_border_node_get_outline (child2)))
gsk_rounded_rect_equal (gsk_rounded_clip_node_get_clip (child),
gsk_border_node_get_outline (child2)))
{
gsk_ngl_render_job_visit_css_background (job, child, child2);
i++; /* skip the border node */
-33
View File
@@ -202,31 +202,6 @@ gsk_ngl_shadow_library_lookup (GskNglShadowLibrary *self,
return ret->texture_id;
}
#if 0
static void
write_shadow_to_png (const Shadow *shadow)
{
int width = shadow->outline.bounds.size.width + (shadow->outline.bounds.origin.x * 2);
int height = shadow->outline.bounds.size.height + (shadow->outline.bounds.origin.y * 2);
int stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width);
guchar *data = g_malloc (height * stride);
cairo_surface_t *s;
char *filename = g_strdup_printf ("shadow_cache_%d_%d_%d.png",
width, height, shadow->texture_id);
glBindTexture (GL_TEXTURE_2D, shadow->texture_id);
glGetTexImage (GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
s = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32,
width, height,
stride);
cairo_surface_write_to_png (s, filename);
cairo_surface_destroy (s);
g_free (data);
g_free (filename);
}
#endif
void
gsk_ngl_shadow_library_begin_frame (GskNglShadowLibrary *self)
{
@@ -236,14 +211,6 @@ gsk_ngl_shadow_library_begin_frame (GskNglShadowLibrary *self)
g_return_if_fail (GSK_IS_NGL_SHADOW_LIBRARY (self));
#if 0
for (i = 0, p = self->shadows->len; i < p; i++)
{
const Shadow *shadow = &g_array_index (self->shadows, Shadow, i);
write_shadow_to_png (shadow);
}
#endif
watermark = self->driver->current_frame_id - MAX_UNUSED_FRAMES;
for (i = 0, p = self->shadows->len; i < p; i++)
-48
View File
@@ -20,7 +20,6 @@
#include "config.h"
#include <gdk/gdkglcontextprivate.h>
#include <gsk/gskdebugprivate.h>
#include "gsknglcommandqueueprivate.h"
@@ -240,51 +239,6 @@ gsk_ngl_texture_atlas_pack (GskNglTextureAtlas *self,
return rect.was_packed;
}
static void
gsk_ngl_texture_atlas_initialize (GskNglDriver *driver,
GskNglTextureAtlas *atlas)
{
/* Insert a single pixel at 0,0 for use in coloring */
gboolean packed G_GNUC_UNUSED;
int x, y;
guint gl_format;
guint gl_type;
guint8 pixel_data[4 * 3 * 3];
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
"Initializing Atlas");
packed = gsk_ngl_texture_atlas_pack (atlas, 3, 3, &x, &y);
g_assert (packed);
g_assert (x == 0 && y == 0);
memset (pixel_data, 255, sizeof pixel_data);
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
{
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
}
else
{
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
glTexSubImage2D (GL_TEXTURE_2D, 0,
0, 0,
3, 3,
gl_format, gl_type,
pixel_data);
gdk_gl_context_pop_debug_group (gdk_gl_context_get_current ());
driver->command_queue->n_uploads++;
}
static void
gsk_ngl_texture_atlases_pack (GskNglDriver *driver,
int width,
@@ -311,8 +265,6 @@ gsk_ngl_texture_atlases_pack (GskNglDriver *driver,
/* No atlas has enough space, so create a new one... */
atlas = gsk_ngl_driver_create_atlas (driver);
gsk_ngl_texture_atlas_initialize (driver, atlas);
/* Pack it onto that one, which surely has enough space... */
if (!gsk_ngl_texture_atlas_pack (atlas, width, height, &x, &y))
g_assert_not_reached ();
+2 -3
View File
@@ -170,8 +170,7 @@ gsk_ngl_texture_new (guint texture_id,
const GskNglTextureNineSlice *
gsk_ngl_texture_get_nine_slice (GskNglTexture *texture,
const GskRoundedRect *outline,
float extra_pixels_x,
float extra_pixels_y)
float extra_pixels)
{
g_assert (texture != NULL);
g_assert (outline != NULL);
@@ -181,7 +180,7 @@ gsk_ngl_texture_get_nine_slice (GskNglTexture *texture,
texture->nine_slice = g_new0 (GskNglTextureNineSlice, 9);
nine_slice_rounded_rect (texture->nine_slice, outline);
nine_slice_grow (texture->nine_slice, extra_pixels_x, extra_pixels_y);
nine_slice_grow (texture->nine_slice, extra_pixels);
nine_slice_to_texture_coords (texture->nine_slice, texture->width, texture->height);
}
+1 -2
View File
@@ -94,8 +94,7 @@ GskNglTexture *gsk_ngl_texture_new (guint
gint64 frame_id);
const GskNglTextureNineSlice *gsk_ngl_texture_get_nine_slice (GskNglTexture *texture,
const GskRoundedRect *outline,
float extra_pixels_x,
float extra_pixels_y);
float extra_pixels);
void gsk_ngl_texture_free (GskNglTexture *texture);
G_END_DECLS
+3 -5
View File
@@ -54,11 +54,9 @@ typedef struct _GskNglDriver GskNglDriver;
struct _GskNglDrawVertex
{
float position[2];
union {
float uv[2];
guint16 color2[4];
};
guint16 color[4];
float uv[2];
float color[4];
float color2[4];
};
G_END_DECLS
+50 -51
View File
@@ -159,122 +159,121 @@ nine_slice_to_texture_coords (GskNglTextureNineSlice *slices,
static inline void
nine_slice_grow (GskNglTextureNineSlice *slices,
int amount_x,
int amount_y)
int amount)
{
if (amount_x == 0 && amount_y == 0)
if (amount == 0)
return;
/* top left */
slices[0].rect.x -= amount_x;
slices[0].rect.y -= amount_y;
if (amount_x > slices[0].rect.width)
slices[0].rect.width += amount_x * 2;
slices[0].rect.x -= amount;
slices[0].rect.y -= amount;
if (amount > slices[0].rect.width)
slices[0].rect.width += amount * 2;
else
slices[0].rect.width += amount_x;
slices[0].rect.width += amount;
if (amount_y > slices[0].rect.height)
slices[0].rect.height += amount_y * 2;
if (amount > slices[0].rect.height)
slices[0].rect.height += amount * 2;
else
slices[0].rect.height += amount_y;
slices[0].rect.height += amount;
/* Top center */
slices[1].rect.y -= amount_y;
if (amount_y > slices[1].rect.height)
slices[1].rect.height += amount_y * 2;
slices[1].rect.y -= amount;
if (amount > slices[1].rect.height)
slices[1].rect.height += amount * 2;
else
slices[1].rect.height += amount_y;
slices[1].rect.height += amount;
/* top right */
slices[2].rect.y -= amount_y;
if (amount_x > slices[2].rect.width)
slices[2].rect.y -= amount;
if (amount > slices[2].rect.width)
{
slices[2].rect.x -= amount_x;
slices[2].rect.width += amount_x * 2;
slices[2].rect.x -= amount;
slices[2].rect.width += amount * 2;
}
else
{
slices[2].rect.width += amount_x;
slices[2].rect.width += amount;
}
if (amount_y > slices[2].rect.height)
slices[2].rect.height += amount_y * 2;
if (amount > slices[2].rect.height)
slices[2].rect.height += amount * 2;
else
slices[2].rect.height += amount_y;
slices[2].rect.height += amount;
slices[3].rect.x -= amount_x;
if (amount_x > slices[3].rect.width)
slices[3].rect.width += amount_x * 2;
slices[3].rect.x -= amount;
if (amount > slices[3].rect.width)
slices[3].rect.width += amount * 2;
else
slices[3].rect.width += amount_x;
slices[3].rect.width += amount;
/* Leave center alone */
if (amount_x > slices[5].rect.width)
if (amount > slices[5].rect.width)
{
slices[5].rect.x -= amount_x;
slices[5].rect.width += amount_x * 2;
slices[5].rect.x -= amount;
slices[5].rect.width += amount * 2;
}
else
{
slices[5].rect.width += amount_x;
slices[5].rect.width += amount;
}
/* Bottom left */
slices[6].rect.x -= amount_x;
if (amount_x > slices[6].rect.width)
slices[6].rect.x -= amount;
if (amount > slices[6].rect.width)
{
slices[6].rect.width += amount_x * 2;
slices[6].rect.width += amount * 2;
}
else
{
slices[6].rect.width += amount_x;
slices[6].rect.width += amount;
}
if (amount_y > slices[6].rect.height)
if (amount > slices[6].rect.height)
{
slices[6].rect.y -= amount_y;
slices[6].rect.height += amount_y * 2;
slices[6].rect.y -= amount;
slices[6].rect.height += amount * 2;
}
else
{
slices[6].rect.height += amount_y;
slices[6].rect.height += amount;
}
/* Bottom center */
if (amount_y > slices[7].rect.height)
if (amount > slices[7].rect.height)
{
slices[7].rect.y -= amount_y;
slices[7].rect.height += amount_y * 2;
slices[7].rect.y -= amount;
slices[7].rect.height += amount * 2;
}
else
{
slices[7].rect.height += amount_y;
slices[7].rect.height += amount;
}
if (amount_x > slices[8].rect.width)
if (amount > slices[8].rect.width)
{
slices[8].rect.x -= amount_x;
slices[8].rect.width += amount_x * 2;
slices[8].rect.x -= amount;
slices[8].rect.width += amount * 2;
}
else
{
slices[8].rect.width += amount_x;
slices[8].rect.width += amount;
}
if (amount_y > slices[8].rect.height)
if (amount > slices[8].rect.height)
{
slices[8].rect.y -= amount_y;
slices[8].rect.height += amount_y * 2;
slices[8].rect.y -= amount;
slices[8].rect.height += amount * 2;
}
else
{
slices[8].rect.height += amount_y;
slices[8].rect.height += amount;
}
#ifdef DEBUG_NINE_SLICE

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