Commit Graph

27175 Commits

Author SHA1 Message Date
Matthias Clasen
bed5e6fb16 Convert GtkAccelLabel to indirect rendering 2016-10-18 11:49:15 +01:00
Matthias Clasen
be0de54237 Convert GtkLabel to indirect rendering
Warning! This breaks GtkAccelLabel. It will be fixed in the next
commit.
2016-10-18 11:49:15 +01:00
Matthias Clasen
f101ef7cd1 Convert GtkFlowBox to indirect rendering 2016-10-18 11:49:15 +01:00
Matthias Clasen
58b38d59c5 container: Prepare to prune render nodes
Add a should_propagate function for render nodes. Eventually,
this is meant to avoid creating render nodes for child widgets
that are outside the parents clip area. Since we don't have
that information available right now, just filter out nondrawable
children for now.
2016-10-18 11:49:15 +01:00
Matthias Clasen
39c1aa5e27 Split css background into individual render nodes
Use separate render nodes for each layer in a multi-image
background. WARNING: blend modes don't work right yet.
2016-10-18 11:49:15 +01:00
Matthias Clasen
b660361fb7 Don't create render nodes for empty backgrounds 2016-10-18 11:49:14 +01:00
Matthias Clasen
cffb8ae4b5 Break out the css background render node in a function
This is in preparation for creating separate render nodes
for individual backgrounds.
2016-10-18 11:49:14 +01:00
Matthias Clasen
f74dd416d6 Make outer shadows work again
Change get_render_node to return nodes that are sized to the clip
area and expect to be placed at the clip position; change
gtk_container_propagate_render_node to place child render nodes
accordingly, and change gtk_css_gadget_get_render_node to return
nodes that are sized accordingly as well.
2016-10-18 11:49:14 +01:00
Emmanuele Bassi
f764d03cfd gsk: Remove :use-alpha from GskRenderer
It's unused, and we always assume we render with an alpha channel
enabled because it's 2016.
2016-10-18 11:49:14 +01:00
Emmanuele Bassi
ce67336577 gsk: Drop modelview/projection from GskRenderer API
The details of the modelview and projection matrices are only useful for
the GL renderer; there's really no point in having those details
available in the generic API — especially as the Cairo fallback renderer
cannot really set up a complex modelview or a projection matrix.
2016-10-18 11:49:14 +01:00
Emmanuele Bassi
23a009a408 gtk: Sort children by window depth when rendering
This makes popovers pop over instead of under.
2016-10-18 11:49:14 +01:00
Emmanuele Bassi
b2f5a69742 gtk: Add a box render node for gadgets
Instead of using the background as the gadget's node, we add a
non-drawing node that can be used to apply offsets; all other nodes are
children of the "box" node.
2016-10-18 11:49:13 +01:00
Matthias Clasen
fd4a1cdad6 Covert GtkOverlay to indirect rendering
There is no gadget, so we use the gtk_widget_create_render_node
function for the first time here.
2016-10-18 11:49:13 +01:00
Matthias Clasen
579b43b8e8 Convert GtkComboBox to indirect rendering
The removal of the draw method in GtkComboBox reveals another
instance of parent-child invariant violation in GtkComboBoxText.
2016-10-18 11:49:13 +01:00
Matthias Clasen
b8acd23a86 GtkButtonBox: Convert to indirect rendering 2016-10-18 11:49:13 +01:00
Matthias Clasen
ea549a3ce4 GtkListBox: Convert to indirect rendering
Note that there is a problem with the pixel cache that causes
listboxes to come out black when in a scrolled window.
2016-10-18 11:49:13 +01:00
Matthias Clasen
1046262048 gadget: Fix handling of custom content
The transformations here were wrong, causing content to go nowhere.
This patch fixes check and radio buttons to appear as expected.
2016-10-18 11:49:13 +01:00
Matthias Clasen
6a1edb0960 GtkCheckButton: Convert to indirect rendering
This is another example of indirect rendering with a box gadget.
There is currently still some positioning problem with the
checkmark.
2016-10-18 11:49:13 +01:00
Matthias Clasen
f68eaae581 Prevent box gadget content from being drawn twice
Now that we split out box gadget children into separate
render nodes, we must not draw them onto the box gadgets
node anymore.
2016-10-18 11:49:12 +01:00
Matthias Clasen
ac52abcedc GtkExpander: Convert to indirect rendering
This is the first example of indirect rendering involving
a box gadget. For now, we iterate the child gadgets manually,
and rely on gtk_container_propagate_render_node for the
child widgets. Eventually, we may want a better solution
here.
2016-10-18 11:49:12 +01:00
Matthias Clasen
62eb900b83 gadget: Add a has_content vfunc
...and implement it for GtkCssGadget and GtkCssCustomGadget.
This allows us to decide on a per-object basis if a custom
gadget needs a render node for content or not.
2016-10-18 11:49:12 +01:00
Matthias Clasen
9d06ee637b button: Restore focus
The custom gadget draw function has the side effect of informing
the gadget machinery wether to draw focus or not. Bring the
draw function back, just for its boolean return value. We may
want to find a better solution for this.
2016-10-18 11:49:12 +01:00
Matthias Clasen
02187371a2 Add details to css render nodes
Give all nodes the same detail about the owner widget.
This reveals that every GtkCssCustomGadget gets a
DrawGadgetContents node, even if their draw_func is NULL.
We may want to come up with a better solution for that.
2016-10-18 11:49:12 +01:00
Matthias Clasen
b371b5da42 Drop an unused variable 2016-10-18 11:49:12 +01:00
Emmanuele Bassi
9fe18f6561 gtk: Clean up render fallback node creation in GtkWidget 2016-10-18 11:49:12 +01:00
Emmanuele Bassi
e58965a3cc gtk: Port GtkHeaderBar to render nodes 2016-10-18 11:49:12 +01:00
Emmanuele Bassi
2e0d3ef866 gtk: Port GtkActionBar to render nodes 2016-10-18 11:49:12 +01:00
Emmanuele Bassi
abe19f1826 gtk: Attempt at handling CSS coordinates
When creating the GskRenderNodes for the gadgets we should not translate
the coordinates inside the Cairo context, but we should tweak the
coordinates of the anchor point.

This is still not enough to get an appropriate rendering, as the result
is still slightly offset to the left.
2016-10-18 11:49:12 +01:00
Matthias Clasen
a0b2b3745f GtkFrame: Convert to indirect rendering
Create a GskRenderNode for the contents of the frame.
2016-10-18 11:49:11 +01:00
Emmanuele Bassi
354d4435b1 gtk: Add convenience function for creating render nodes
GtkWidget.create_render_node() sets up a GskRenderNode appropriate for
rendering the contents of a widget, including its bounds,
transformation, and anchor point.
2016-10-18 11:49:11 +01:00
Emmanuele Bassi
a146618de0 gsk: Rename set_offset() to set_anchor_point()
The naming is consistent with other scene graph libraries, as it
represents an additional translation transformation applied on top of
the provided transformation matrices.

We can also simplify the implementation by applying the translation when
we compute the world matrix.
2016-10-18 11:49:11 +01:00
Matthias Clasen
e7c7932d72 Fix fallback render nodes
We were allocating a surface thats big enough for the clip, and
we were setting the transform for that, but then GtkContainer
was overriding the transform with the one for the allocation.
Also, we were drawing at the clip position, not the allocation
position.
2016-10-18 11:49:11 +01:00
Matthias Clasen
1d5e05b0d1 button: Convert to indirect rendering
WARNING! This commit breaks GtkButton subclasses.
2016-10-18 11:49:11 +01:00
Matthias Clasen
72ccb39f66 Convert GtkGrid to indirect rendering
Following the example of GtkBox.
2016-10-18 11:49:11 +01:00
Emmanuele Bassi
137ff8ede7 box: Port from immediate to deferred rendering
Drop the ::draw() vfunc implementation in favour of the
::get_render_node() vfunc.
2016-10-18 11:49:10 +01:00
Emmanuele Bassi
e5dace2d51 Integrate CSS gadget with GSK render nodes
First stab at an internal API that generates render nodes when drawing a
CSS gadget.
2016-10-18 11:49:10 +01:00
Emmanuele Bassi
bfad9fe4ee gtk: Update the coordinates when propagating render nodes
Just like gtk_container_propagate_draw() does for the immediate mode
rendering.
2016-10-18 11:49:10 +01:00
Emmanuele Bassi
1ab1fd4391 Use the projection to flip around the content
Since we use an FBO to render the contents of the render node tree, the
coordinate space is going to be flipped in GL. We can undo the flip by
using an appropriate projection matrix, instead of changing the sampling
coordinates in the shaders and updating all our coordinates at render
time.
2016-10-18 11:49:10 +01:00
Emmanuele Bassi
6c92846936 widget: Fix compatibility fallbacks 2016-10-18 11:49:10 +01:00
Emmanuele Bassi
3d90a070d5 gsk: Tie render nodes to renderers
Render nodes need access to rendering information like scaling factors.
If we keep render nodes separate from renderers until we submit a nodes
tree for rendering we're going to have to duplicate all that information
in a way that makes the API more complicated and fuzzier on its
semantics.

By having GskRenderer create GskRenderNode instances we can tie nodes
and renderers together; since higher layers will also have access to
the renderer instance, this does not add any burden to callers.

Additionally, if memory measurements indicate that we are spending too
much time in the allocation of new render nodes, we can now easily
implement a free-list or a renderer-specific allocator without breaking
the API.
2016-10-18 11:49:10 +01:00
Emmanuele Bassi
f0c04cdd09 gtk: Port GtkWindow to render nodes
WARNING: BROKEN COMMIT
2016-10-18 11:49:09 +01:00
Emmanuele Bassi
cd0de3f87c gtk: Add GtkContainer API to gather render nodes
We cannot implement GtkWidgetClass.get_render_node() in GtkContainer
without breaking the fallback path that renders a widget to a single
render node rasterization. For GtkContainer subclasses we should provide
a simple API, similar to gtk_container_propagate_draw(), that gathers
all the render nodes for each child.
2016-10-18 11:49:09 +01:00
Emmanuele Bassi
43904892bc gtk: Name GSK render nodes
For debugging purposes it's helpful to name the nodes.
2016-10-18 11:49:09 +01:00
Emmanuele Bassi
dc3b240c20 Ensure that render nodes are translated
The clip rectangle may have non-zero offsets, so we need to ensure that
the GskRenderNode associated to the rendered area is translated by those
same offsets.
2016-10-18 11:49:08 +01:00
Emmanuele Bassi
b997f4c575 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-10-18 11:49:06 +01:00
Emmanuele Bassi
258af60c18 gtk: Add a GskRenderer to GtkWindow
Each top-level should have its own GskRenderer, to be used when drawing
the render node tree.
2016-10-18 11:49:06 +01:00
Emmanuele Bassi
0e2a87a4bc build: Add GSK deps to GTK 2016-10-18 11:29:34 +01:00
Emmanuele Bassi
3fb413beea label: Avoid shadowing variables 2016-10-18 11:29:34 +01:00
Timm Bäder
4384628afb Remove GtkAction 2016-10-18 00:34:41 +02:00
Timm Bäder
ead36206a3 Remove GtkActionGroup 2016-10-18 00:34:41 +02:00