Commit Graph

52303 Commits

Author SHA1 Message Date
Benjamin Otte
67b60b54ac gskslcompiler: Add support for adding defines
gtk-glsl implements this via the usual -D and -U options.

Preprocessor directives aren't implemented yet, but defines are replaced
in the source code already.
2017-10-30 02:58:02 +01:00
Benjamin Otte
f8299719b4 gsksl: Introduce GskSlCompiler
This is the object that is used to create programs from. It also holds
(or will hold) all the settings necessary to parse GLSL - like defines
or include directories.
2017-10-30 02:58:02 +01:00
Benjamin Otte
eee9142397 gsksl: Split out GskSlProgram
And turn it into public API.
2017-10-30 02:58:02 +01:00
Benjamin Otte
d3511003cf gsksltokenizer: Always return idents
Turning idents into keywords is the job of the preprocessor and has to
be done after processing #defines.
2017-10-30 02:58:02 +01:00
Benjamin Otte
9417507829 gsksl: Implement skeleton SPIRV output 2017-10-30 02:58:02 +01:00
Benjamin Otte
45ad50a61c gsk: Add GskSlPointerType
This describes a type with qualifiers like const, volatile and so on.
2017-10-30 02:58:02 +01:00
Benjamin Otte
447f52502a gtk: Add gtk-glsl binary
That's supposed to become the command-line compiler.

So far all it does is parse and then dump as text again the provided
input file(s).
2017-10-30 02:58:02 +01:00
Benjamin Otte
c7590f310f gskslnode: Parse return statements 2017-10-30 02:58:02 +01:00
Benjamin Otte
f607087201 gskslnode: Add builtin constructors
Do this by implementing function call nodes and adding GskSlFunction,
which is meant to be used for anything that is callable.
2017-10-30 02:58:02 +01:00
Benjamin Otte
36a61f0ad0 gskslnode: Add comparison and shift operators 2017-10-30 02:58:02 +01:00
Benjamin Otte
b6adb44dfd gsksltype: Add matrix type 2017-10-30 02:58:02 +01:00
Benjamin Otte
0e56c28725 gsksltype: Add support for vector types 2017-10-30 02:58:02 +01:00
Benjamin Otte
0362778524 gskslnode: Add GskSlNodeOperation
This is for operations in expressions, like and, or, shift, addition or
multiplication.

These operations need to do sophisticated type checks that can't be done
yet, so only the logical operations are implemented so far.
2017-10-30 02:58:02 +01:00
Benjamin Otte
ad4b45639b gskslnode: Add variables
This requires keeping a scope object that we can use to store and load
variables.
2017-10-30 02:58:02 +01:00
Benjamin Otte
dc519ad2a2 gskslnode: Add gsk_sl_node_is_constant()
And use it to emit a compile error when trying to assign to a constant
value.
2017-10-30 02:58:02 +01:00
Benjamin Otte
7a215a6b39 gskslnode: Add gsk_sl_node_get_return_type()
It's unused for now.

But the idea is that (most) nodes return a value and we can know the
type of value they return at compile-time. And then we can check type
compatibility while parsing using this function.
2017-10-30 02:58:02 +01:00
Benjamin Otte
da5417def4 gsksl: Add gsksltypesprivate.h
All those types are recursively needing each other in their functions,
so add a generic header for all those types and only include that
header.
2017-10-30 02:58:02 +01:00
Benjamin Otte
4e0def2806 gsksl: Parse assignments 2017-10-30 02:58:02 +01:00
Benjamin Otte
bc5c3e1b56 gsksl: Start parsing statements by parsing constants 2017-10-30 02:58:02 +01:00
Benjamin Otte
3a298f8f9c gsk: Add a skeleton for a GLSL parser 2017-10-30 02:58:02 +01:00
Benjamin Otte
916981f66e cssimagescaled: Remove now unused struct member 2017-10-30 02:55:46 +01:00
Benjamin Otte
f29b7744bb gdk: Remove leftovers from GdkScreen::size-changed removal 2017-10-30 02:30:44 +01:00
Benjamin Otte
481189867a inspector: Use the new monitor change signals
And on't use the GdkScreen anymore now that the GdkDisplay provides all
the information we care about.
2017-10-30 02:30:44 +01:00
Benjamin Otte
d5155ef982 screen: Remove unused vfuncs 2017-10-30 02:30:44 +01:00
Timm Bäder
91f40eb088 widget: Make parent property read-only 2017-10-29 18:03:10 +01:00
Timm Bäder
09239eb670 widget: Don't notify :parent when rearranging widgets
gtk_widget_reposition_after is also valid to call if the widget already
has a parent, so don't notify the parent property in that case.
2017-10-29 17:27:53 +01:00
Timm Bäder
ff6cd8f75e widget: Remove parent-set signal
When a widget unparents its child widget manually in finalize, this can
lead to the parent-set signal being emitted for those child widgets. The
parent already has a ref_count of 0 though, so it can't be used in a
meaningful way. Specifically, emitting the signal will already try to
ref the parent which prints a critical.

Since GtkWidget already has a "parent" property, one can use its notify
signal instead to get notified when the parent widget changes.
2017-10-29 17:24:12 +01:00
Timm Bäder
0be4166b89 inspector: Remove node != NULL check from recorder model
We use NULL to remove the selection.
2017-10-29 13:44:12 +01:00
Timm Bäder
8b0f60bb6f checkbutton: Destroy indicator widget when draw-indicator is FALSE 2017-10-29 13:27:03 +01:00
Benjamin Otte
457bd2b9ee cssimagescaled: Just return the computed image
... instead of returning either itself with uncomputed images or a
copy of itself with only one computed image and lots of other
uncomputed images that we're never gonna look at again.

This fixes expressions like -gtk-scaled(-gtk-recolor(...),-gtk-recolor(...))
which Adwaita uses for checkmarks and bullets.
2017-10-29 06:41:12 -04:00
Matthias Clasen
598d22d194 Avoid creating trivial shadow nodes
The Vulkan renderer creates a fallback surface for each shadow
node, even if we end up not rendering anything to it. Avoiding
this is a nice optimization.
2017-10-28 16:10:46 -04:00
Matthias Clasen
99d3d31314 Adwaita: Use scaled icons for checks and bullets
This gives us crip rendering on hidpi screens.
2017-10-28 15:22:54 -04:00
Matthias Clasen
1dbc50f3f8 Adwaita: Add scaled version of bullets and checks
We use these assets as .symbolic.png now, so for hidpi, we
should provide @2 variants.
2017-10-28 15:20:11 -04:00
Matthias Clasen
ca7c148687 gsk: Apply scale factor for fallback rendering
This fixes blurry text and icons whenever we apply shadows
in a hidpi window. Shadow nodes are the last ones that we
still use fallback for, and this was causing us to render
the text blurry.
2017-10-28 14:38:49 -04:00
Matthias Clasen
439e1054c4 Triival cleanup
No need to go to the window, we store a copy of the scale factor
in the render pass object.
2017-10-28 14:38:21 -04:00
Matthias Clasen
a48015d3c6 inspector: Show details for shadow nodes
One of the few node types that we're not detailing yet.
2017-10-28 14:30:03 -04:00
Matthias Clasen
a0bbd14325 gsk: Scale glyphs in the glyph cache
Pass a scale factor when caching glyphs or looking them
up in the cache. The glyphs in the cache are rendered
with subpixel precision determined by the scale. Update
all callers to pass a scale factor according to the window
scale. This lets us render crisp glyphs on hidpi systems.
2017-10-28 13:13:31 -04:00
Matthias Clasen
6560961c59 vulkan: Handle changing window scale
The code that checks for the proper size of the our swapchain
was not taking window scale fully into account. With this change,
setting the window scale to 2 in the inspector causes the window
to grow and rendering to be scaled up as expected, with Vulkan,
in the same way it already is with cairo.
2017-10-28 11:57:53 -04:00
Matthias Clasen
dc0570cc17 gsk: Drop the GskRenderer::scale-factor property
This is can always be obtained from the window that is already
associated with the renderer, no need to maintain a separate
property for it.
2017-10-28 11:49:39 -04:00
Emmanuele Bassi
02eb344950 x11: Query whether we have GLX support
Epoxy 1.4 has new ad hoc API that we can use to check whether GLX is
available on the current system.

If we didn't use this API, we'd have to manually dlopen libGL (or its
equivalent on different OSes) and check if it had GLX symbols; since
Epoxy already does all of this internally, we can simply ask it instead.

https://bugzilla.gnome.org/show_bug.cgi?id=775279
2017-10-28 09:46:15 -04:00
Emmanuele Bassi
183538c2e2 Bump up the dependency on libepoxy
We are going to use new API to detect whether or not GLX is available
before calling GL API.

https://bugzilla.gnome.org/show_bug.cgi?id=775279
2017-10-28 09:46:15 -04:00
Timm Bäder
50d9484083 Adwaita: Add back visible focus outlines for list rows 2017-10-28 11:46:35 +02:00
Timm Bäder
4dee08dd52 sizerequest: Don't pass uninitialized values to measure
The GtkWidgetClass::measure vfunc is not required to assign a value to
any of the (out) parameters, so we need to initialize the locals we pass
to it, otherwise we can end up with a garbage size request.
2017-10-28 11:42:08 +02:00
Federico Mena Quintero
559d32420c GtkPathBar: Centralize handling of outstanding cancellables
The path bar would crash if we disposed it before all pending I/O
operations had finished.  Now we remember all the outstanding
operations directly in the GtkPathBarPrivate, and deal with them
consistently.
2017-10-27 17:18:38 -05:00
Matthias Clasen
ea91ab1d99 gsk: Make text nodes more compact
The copy of the PangoGlyphString we do here was showing up
in some profiles. To avoid it, allocate the PangoGlyphInfo array
as part of the node itself. Update all callers to deal with
the slight api change required for this.
2017-10-27 17:13:40 -04:00
Olivier Fourdan
999848e0c6 wayland: scale down reported monitor geometry
According to the documentation, gdk_monitor_get_geometry() reports the
monitor geometry in ”application pixels”, not in ”device pixels”,
meaning that the actual device resolution needs to be scaled down by the
scale factor of the output.

x11 backend does that downscaling, whereas Wayland backend did not,
causing a discrepancy depending on the backend used.

https://bugzilla.gnome.org/show_bug.cgi?id=783995
2017-10-27 16:01:38 -04:00
Simon McVittie
bdd2ca9a60 GtkHeaderBar: Reconsider buttons if any tiling state changes
Looking at the 1-bit "tiled or not?" state is not necessarily
enough.

Signed-off-by: Simon McVittie <smcv@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=789357
2017-10-27 12:14:44 -02:00
Drew DeVault
1b279e3d4a Wayland: Implement KDE's SSD protocol
If the compositor prefers server-side decorations and the client doesn't
customize the title bar, we disable client-side decorations and let the
compositor know. Otherwise, we continue to use client-side decorations.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

https://bugzilla.gnome.org/show_bug.cgi?id=781909
2017-10-26 15:51:56 -04:00
Olivier Fourdan
028e39d6ee wayland: Do not constrain saved window size
Under Wayland, an xdg_surface.configure with size 0x0 means it's up to
the client to set its size.

When transitioning from maximized state to un-maximized, the Wayland
compositor will send such an 0x0 configure so that the client can
restore its original size.

However, the original size was already constrained, so re-applying
size constrains can lead to a smaller size when using size increments.

Avoid this caveat by not applying size constrains when we are restoring
the original size.

https://bugzilla.gnome.org/show_bug.cgi?id=777072
2017-10-26 15:49:42 -04:00
Florian Müllner
07beb6dba2 appchooserwidget: Don't limit application list unconditionally
As documented, GtkAppChooser is "typically [used] for the purpose of
opening a file". However given that applications that support neither
opening files nor URLs are filtered out, the chooser is not actual
useful for any other (atypical) usage. Change that by only applying
the filtering if a content-type was set, and use the full unfiltered
list otherwise.

https://bugzilla.gnome.org/show_bug.cgi?id=789327
2017-10-26 06:18:01 -04:00