Commit Graph

47850 Commits

Author SHA1 Message Date
Emmanuele Bassi
c672682668 docs: Add more GSK documentation 2016-07-04 00:23:19 +01:00
Emmanuele Bassi
5aaf111862 gsk: Add more modes to the blend shader
Use the compositing CSS spec at:

  https://www.w3.org/TR/compositing-1/#blending

For the implementation.
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
dee52aec7c gsk: Don't store the uniform and attribute location twice
We should keep the ShaderBuilder around and use it to query the various
uniform and attribute locations when needed, instead of storing those
offsets into the Renderer instance, and copying them. This allows a bit
more flexibility, once we have more than one program built into the
renderer.
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
4dd866c08f gsk: Add getter for program id in ShaderBuilder
Since we store it into the ShaderBuilder instance we should also allow
getting the program id.
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
8d2df67388 gsk: Add debugging notes to ShaderBuilder
Print out the generated shader and the list of available uniforms and
attributes.
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
d7a5c2ccf6 gsk: Rework how GLSL shaders are built
The GL renderer should build the GLSL shaders using GskShaderBuilder.
This allows us to separate the common parts into separate files, and
assemble them as necessary, instead of shipping one big shader per type
of GL API (GL3, GL legacy, and GLES).
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
b5db5fb601 gsk: Add ShaderBuilder
GskShaderBuilder is an ancillary, private type that deals with the
internals of taking GLSL shaders from resources and building them,
with the additional feature of being able to compose shaders from a
common preamble, as well as adding conditional defines (useful for
enabling debugging code in the shaders themselves).
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
c9420c4b3b gsk: Add rendering debug mode for shaders
It's going to be useful to inject debugging data into the shaders used
by GSK.
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
0634f221e3 gdk: Add more GDK_GL_ERROR error ids
We're going to use them in other locations.
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
0de191ca62 build: Fix dependency on GDK for introspection scanner
Otherwise libtool may attempt to use the installed copy of GDK.
2016-07-03 23:30:26 +01:00
Emmanuele Bassi
6e9988cb8b gsk: Use the node's blend mode in the GL renderer 2016-07-03 23:30:26 +01:00
Emmanuele Bassi
88f575d611 gsk: Store blend mode in the render node 2016-07-03 23:30:26 +01:00
Emmanuele Bassi
20848c5eea gsk: Make GskBlendMode enumeration public 2016-07-03 23:30:26 +01:00
Emmanuele Bassi
545a8892ce gsk: Allow sampling between parent and child nodes 2016-07-03 23:30:26 +01:00
Emmanuele Bassi
1319ded55e gsk: Group render state attributes 2016-07-03 23:30:25 +01:00
Emmanuele Bassi
120e8454c3 gsk: Turn GskRenderNode into a pure GTypeInstance
Using GObject as the base type for a transient tree may prove to be too
intensive, especially when creating a lot of node instances. Since we
don't need properties or signals, and we don't need complex destruction
semantics, we can use GTypeInstance directly as the base type for
GskRenderNode.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
4e07f8234d gtk: Use GskRenderNode to render widgets
We need a virtual function to retrieve the GskRenderNode for each
widget, which is supposed to attach its own children's GskRenderNodes.
Additionally, we want to maintain the existing GtkWidget::draw mechanism
for widgets that do not implement get_render_node() — as well as widgets
that have handlers connected to the ::draw signal.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
119654155e gtk: Add a GskRenderer to GtkWindow
Each top-level should have its own GskRenderer, to be used when drawing
the render node tree.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
bb785ad689 gsk: Rework GskRenderer and GskRenderNode semantics
This commit changes the way GskRenderer and GskRenderNode interact and
are meant to be used.

GskRenderNode should represent a transient tree of rendering nodes,
which are submitted to the GskRenderer at render time; this allows the
renderer to take ownership of the render tree. Once the toolkit and
application code have finished assembling it, the render tree ownership
is transferred to the renderer.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
7c64170a13 gsk: Flush the GL render items cache
Whenever the render tree changes we want to drop the RenderItem arrays,
as each item contains a pointer to the GskRenderNode which becomes
dangling once the root node changed.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
c6a83f1ba4 gsk: Add GskRenderer::clear_tree
We need a way to clear eventual caches inside GskRenderer subclasses if
the root node has changed.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
e7309b1474 gsk: Port GskGLRenderer to GLES
Use the appropriate API and shaders if the GdkGLContext was created for
OpenGL ES instead of OpenGL.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
9e50de3a56 gsk: Use surface-to-texture utility function
Now that we have it.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
c0c7cf46d6 gsk: Rename shaders for OpenGL 2016-07-03 23:30:25 +01:00
Emmanuele Bassi
b35b32f5dd gdk: Add utility for uploading Cairo surfaces to GL
The surface-to-GL upload logic has become more complicated with the
addition of the GLES code paths; it's more logical to have a public
utility function that can be called from GDK users, instead of copy
pasting the whole thing multiple times.
2016-07-03 23:30:25 +01:00
Emmanuele Bassi
c4262644ea build: Add GSK deps to GTK 2016-07-03 23:30:24 +01:00
Emmanuele Bassi
a3c32b738a Initial implementation of GSK rendering pipeline
GSK is conceptually split into two scene graphs:

 * a simple rendering tree of operations
 * a complex set of logical layers

The latter is built on the former, and adds convenience and high level
API for application developers.

The lower layer, though, is what gets transformed into the rendering
pipeline, as it's simple and thus can be transformed into appropriate
rendering commands with minimal state changes.

The lower layer is also suitable for reuse from more complex higher
layers, like the CSS machinery in GTK, without necessarily port those
layers to the GSK high level API.

This lower layer is based on GskRenderNode instances, which represent
the tree of rendering operations; and a GskRenderer instance, which
takes the render nodes and submits them (after potentially reordering
and transforming them to a more appropriate representation) to the
underlying graphic system.
2016-07-03 23:30:24 +01:00
Emmanuele Bassi
ad8b82f8bd gsk: Initial commit / build environment 2016-07-03 23:30:24 +01:00
Matthias Clasen
507e58df4e gtk3-demo: Make blendmodes example non-resizable
It doesn't need to.
2016-07-03 18:29:21 -04:00
Matthias Clasen
3c4be3c912 Fix parsing of some css properties
Our property parser stops at the first match when looking for
enums, so we need to order our values so that we don't end up
with prefixes of longer names being found first.

I noticed this when the parser tried to interpret
background-blend-mode: color-burn; as "color, with junk at the end".

It also affects animation-direction, which is also fixed here.
2016-07-03 17:54:19 -04:00
Matthias Clasen
34986231f4 css parser: Improve an error message
Say what property we are dealing with when we complain about the
value.
2016-07-03 17:46:30 -04:00
Georges Basile Stavracas Neto
1d93cc2b0b demo: add a demo for blend modes
After introducing the CSS blend mode enum values and including
the background-blend-mode CSS property, it is very important to
actually provide an example of the new feature.

This patch adds a new demo to gtk3-demo which shows how the
background-blend-mode CSS property works.

https://bugzilla.gnome.org/show_bug.cgi?id=768305
2016-07-03 17:24:47 -04:00
Georges Basile Stavracas Neto
27fea1c4fc css: add documentation for background-blend-mode
After introducing the new CSS property, it is natural to
add some documentation explaining the behavior of it and
our support coverage.

https://bugzilla.gnome.org/show_bug.cgi?id=768305
2016-07-03 17:24:47 -04:00
Georges Basile Stavracas Neto
369db4a406 css: add background-blend-mode support
CSS supports blend modes, in which a series of layers are
merged together according to the given operation or set of
operations.

Support for blend modes landed on Cairo, which exposes all
the commons and also the exquisites blend modes available.
Adding support for blend modes, then, is just a matter of
using the available Cairo operations.

This patch adds the background-blend-mode CSS enum property,
and adapts the background rendering code to blend the backgrounds
using the available blend modes when they're set.

https://bugzilla.gnome.org/show_bug.cgi?id=768305
2016-07-03 17:24:47 -04:00
Matthias Clasen
c8a74a1f50 Simplify the xfce session manager support
We don't have to check name owners twice; reuse the information
we already have.
2016-07-03 17:22:14 -04:00
Eric Koegel
3c7cd7ac23 GtkApplication: Add support for the Xfce session manager
Xfce4-session-manager added support for managing dbus based clients.
This patch adds support for checking if Xfce session manager is
around after trying the gnome one.
https://bugzilla.gnome.org/show_bug.cgi?id=693203
2016-07-03 14:56:48 -04:00
Matthias Clasen
22b6df025e Fix example Makefiles
Put OBJS before LIBS on the commandline to make things
work better.

https://bugzilla.gnome.org/show_bug.cgi?id=768142
2016-07-03 13:54:11 -04:00
Matthias Clasen
a43fce058c print dialog: Apply initial capabilities
I was struggling to understand why calling
gtk_print_unix_dialog_set_manual_capabilities (...,0)
was not having the expected effect of hiding the preview
button. The initial capabilities were not applied at all.
2016-07-02 18:08:38 -04:00
Carlos Garnacho
0d30ad279f wayland: Separate selection buffers and other per-selection atom data
This has most notably impact in selection buffers, because those were
shared across all selection atoms. This turned out wrong on 2 situations:
- Because the selection atom was set at SelectionBuffer creation time, the
  GDK_SELECTION_NOTIFY events generated will have unexpected info if the
  buffer is attempted to be reused for another selection.
- Anytime different selections imply different stored content for the same
  target.

This is better separated into per-selection buffers, so it's not possible
to get collisions if a same target is used across different selections.

https://bugzilla.gnome.org/show_bug.cgi?id=768177
2016-06-30 14:10:26 +02:00
Carlos Garnacho
4b003a75aa wayland: Implement gdk_utf8_to_string_target
The sanitize_utf8() function has been copied from X11 so both
backends behave the same. This allows interaction with older clients
(mainly through Xwayland, and the STRING selection target) that
request non-utf8 text.

https://bugzilla.gnome.org/show_bug.cgi?id=768082
2016-06-30 14:10:26 +02:00
Chun-wei Fan
51444b7909 gtk/gtkstylecascade.c: Fix formatting
My previous patch on this file did not take into the account of the
formatting, sorry!
2016-06-30 18:00:47 +08:00
Ray Strode
386d17db6d headerbar: don't throw a warning if title widget is hidden
commit 0015ebc4a8 reworked
some of the titlebar size allocation code.  Those changes
inadvertently introduced a warning when the application sets
the headerbar title widget to be hidden.

This commit fixes that warning.

https://bugzilla.gnome.org/show_bug.cgi?id=768184
2016-06-29 09:27:33 -04:00
Ignacio Casal Quinteiro
b480d9c2ed configure: fix "AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS" 2016-06-29 15:16:54 +02:00
Ignacio Casal Quinteiro
46748b420a gdk: actually fix the previous commit
We do not want it on windows
2016-06-29 15:10:39 +02:00
Ignacio Casal Quinteiro
38fbe68e83 gdk: do not provide display command line argument on windows
There is no need to specify a display on windows.
2016-06-29 15:07:17 +02:00
Timm Bäder
92de947d5e GtkWindow: Check for GtkWidget-window-dragging in multipress gesture
This partly reverts 9f5b9c0e07, which
removed the check for GtkWidget-window-dragging in the multipress
gesture. This check is still needed for widgets which have this style
property set (e.g. menubars and toolbars) can maximize the window on
double click -- but those widgets which have it set to FALSE shouldn't
maximize the window.
2016-06-28 21:42:55 +02:00
Ondrej Holy
0c1cc9832f gtkfilesystem: Improve heuristics to detect remote filesystem
Use G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE to detect remote filesystems
instead of hardcoded list of filesystem types.

Bump required GLib version accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=767965
2016-06-28 10:55:06 +02:00
Timm Bäder
9f5b9c0e07 GtkWindow: Fix dragging on non-titlebar widgets 2016-06-27 19:23:12 +02:00
Timm Bäder
d52f6ff710 widget: Don't unnecessarily export function
_gtk_widget_get_translation_to_window is only used in gtkwidget.c
2016-06-27 14:43:53 +02:00
Chun-wei Fan
5f525839da gtk/gtkstylecascade.c: Declare variables at beginning of block 2016-06-27 11:58:42 +08:00