Commit Graph

27160 Commits

Author SHA1 Message Date
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
Timm Bäder
a864f4d474 widget: Not all toplevels are also containers 2016-10-18 00:34:41 +02:00
Timm Bäder
f7d22fec7b Remove GtkRecentAction 2016-10-18 00:34:41 +02:00
Timm Bäder
d963ede668 Remove GtkUIManager 2016-10-18 00:34:41 +02:00
Timm Bäder
62b2949fa2 Remove GtkActivatable 2016-10-18 00:34:41 +02:00
Timm Bäder
a8a2588cab recentchooser: Stop implementing GtkActivatable 2016-10-18 00:34:41 +02:00
Timm Bäder
d0c087be37 recentchooserdefault: Stop implementing GtkActivatable 2016-10-18 00:34:40 +02:00
Timm Bäder
0c7d091651 toolitem: Stop implementing GtkActivatable 2016-10-18 00:34:40 +02:00
Timm Bäder
41f5d3b14c Remove GtkToggleAction 2016-10-18 00:34:40 +02:00
Timm Bäder
53ab8eb46d Remove GtkRadioAction 2016-10-18 00:34:40 +02:00
Timm Bäder
bc7206d70f Remove GtkStock 2016-10-18 00:29:20 +02:00
Timm Bäder
cf56decbb4 infobar: Stop looking at stock items
GtkButton doesn't have a use-stock property anymore anyway.
2016-10-18 00:29:20 +02:00
Timm Bäder
301e1a4d55 window: Remove decoration-button-layout style property
GtkSettings has a gtk-decoration-layout property for this.
2016-10-18 00:29:20 +02:00
Timm Bäder
7823406db4 window: Remove decoration-resize-handle style property 2016-10-18 00:29:20 +02:00
Timm Bäder
4bf1e4ebe6 toolbar: Remove max-child-expand child property 2016-10-18 00:29:20 +02:00
Timm Bäder
dece018994 Remove GtkAlignment 2016-10-18 00:29:19 +02:00