Commit Graph

27708 Commits

Author SHA1 Message Date
Daniel Boles
2a7171534e Box: Restore an accidentally deleted comment
Also, split a MAX() onto its own line to match the others.
2016-12-26 10:57:51 +00:00
Daniel Boles
71bbd8881f Box: avoid recalc/reassignments, improve var names
Homogeneous branches repeated the calculation/assignment of the initial
space available to children. This avoids that by shuffling some code.

Perhaps more importantly, in doing that, I ended up with some ambiguous
names, and Company and I realised how vague the pre-existing naming was.
"size" becomes "extra_space", as this is what it represents. Conversely,
"extra" becomes "size_given_to_child" (albeit still given out in two
different ways depending on whether the Box is homogeneous). My hope is
that these sections of code are now somewhat less baffling than before!
2016-12-25 23:16:14 +00:00
Daniel Boles
5d10174031 Box: Don't unnecessarily repeat a function call
The spacing was already saved in a variable just above.
2016-12-25 21:46:40 +00:00
Benjamin Otte
1d84555729 iconhelper: Invalidate style before accessing texture
Invalidating the style might cause invalidation of the texture. So we
end up with a pointer to freed memory.
SAD!
2016-12-24 06:19:16 +01:00
Benjamin Otte
6cc08d60ef calendar: Implement snapshot() 2016-12-23 12:07:22 +01:00
Benjamin Otte
a36e5ceea7 cellrenderer: Remove render() vfunc
Make the last 2 cell renderers create the cairo node themselves.
2016-12-23 11:11:52 +01:00
Benjamin Otte
513a8c46af cellrendererpixbuf: Implement snapshot() 2016-12-23 10:50:04 +01:00
Benjamin Otte
a0f65d16bc cellrendererprogress: Implement snapshot() 2016-12-23 10:44:49 +01:00
Benjamin Otte
b901572d86 cellrenderertoggle: Implement snapshot() 2016-12-23 09:31:54 +01:00
Benjamin Otte
c412a717f1 cellrenderertext: Implement snapshot() 2016-12-23 09:23:07 +01:00
Benjamin Otte
677c5bdedf cellrenderer: Move snapshotting down into cell renderers
Now that every call to GtkCellArea is a snapshot call and no more cairo
calls are left, move the actual differentiation between Cairo and
Snapshot down to the cell renderer.
2016-12-23 09:23:04 +01:00
Benjamin Otte
91c71b10e6 inspector: Add a render node save button
Now we can select buggy nodes, save them to a file, and add that file to
our testsuite.
2016-12-23 08:11:00 +01:00
Benjamin Otte
3a38bc9bf7 gsk: Remove spread member from GskShadow
I had originally thought I'd use GskShadow for box-shadow, but didn't in
the end.

So now it's only used for text-shadow and icon-shadow, and those don't
have a spread.
2016-12-23 08:11:00 +01:00
Benjamin Otte
0efeaf9508 treeview: Port rest of stuff to snapshot()
The only thing still drawn with Cairo are grid lines.
2016-12-22 03:37:32 +01:00
Benjamin Otte
f1825f5eff treeview: Partially convert to snapshot()
The big fat scary bin drawing function that actually draws the cell
renderers - that one is still missing.
2016-12-22 03:37:32 +01:00
Chun-wei Fan
23edff1606 gtkcssimagelinear.c: Avoid VLAs
VLAs are not supported by Visual Studio and possibly other compilers that
are supported by GTK+-3.90+, and probably never will be, although it is a
C99 specification, and it became optional for C11.  It is also not a part
of the newer compiler requirements that are listed out for GTK+-3.90.x.

There exist concerns about the implementation of VLAs in compilers that
support them as well, so change it to a g_newa() approach.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2016-12-22 08:40:32 +08:00
Rico Tzschichholz
a571e53491 snapshot: Fix some annoations 2016-12-21 18:16:34 +01:00
Benjamin Otte
def94f03e2 debug: Add GTK_DEBUG=snapshot
This causes the snapshotting algorithm to dump all widget nodes into
their own container node. We then name that group accordingly (ie
"GtkSwitch<0xdeadbeef>") so you can easily see which node belongs where.

The feature is toggleable in the inspector's visual tab.

There's a few problems with it, becuse GtkSnapshot optimized container
nodes away if they are not needed, so we are losing some widgets...
2016-12-20 19:26:40 +01:00
Benjamin Otte
acaa04c031 revealer: Implement snapshot()
The revealer needs to clip the child during animations, whcih draw() did
automatically, but snapshot() does not.
2016-12-20 19:26:40 +01:00
Benjamin Otte
c4065b9ee0 API: Export gtk_container_snapshot_child()
It's equivalent to gtk_container_propagate_draw() and then one is
public, too.
2016-12-20 19:26:40 +01:00
Benjamin Otte
22a657004b debug: Remove pixel-cache debug categories
We have no more pixel cache, so they are kind of useless.
2016-12-20 19:26:40 +01:00
Debarshi Ray
2cbe057351 flowbox: Don't emit child-activated while dragging the pointer
https://bugzilla.gnome.org/show_bug.cgi?id=776306
2016-12-20 18:48:03 +01:00
Benjamin Otte
1b553478f6 cssimageradial: Handle "partial" gradients correctly
When the first/last color stop is not at 0%/100%, we need to start the
repeating at their offsets and not at 0%/100%.

Attached reftest demonstrates the problem.
2016-12-20 18:01:12 +01:00
Benjamin Otte
6c20ddc119 searchbar: Implement snapshot() 2016-12-20 18:01:12 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Benjamin Otte
613194a246 colorswatch: Implement snapshot 2016-12-20 18:01:12 +01:00
Benjamin Otte
4d9eedafcd roundedbox: Add gtk_rounded_boxes_init_for_style()
Instead of making people intiialize a rectangle and then applying border
radius manually, provide a constructor that does it for them.
While doing that, also allow people to instead request the padding box
or the content box.

Refactor all relevant code to use this new constructor.
2016-12-20 18:01:12 +01:00
Benjamin Otte
95a2a5c54c gtk: Remove GtkJunctionSides 2016-12-20 18:01:12 +01:00
Benjamin Otte
3f75b11982 frame: Implement snapshot() 2016-12-20 18:01:12 +01:00
Benjamin Otte
c87db76cb5 iconview: Implement snapshot() 2016-12-20 18:01:12 +01:00
Benjamin Otte
94e906c802 cellview: Implement snapshot()
This also adds gtk_cell_area_snapshot().
2016-12-20 18:01:12 +01:00
Benjamin Otte
2034e83a20 gsk: Add GskOutsetShadowNode 2016-12-20 18:01:12 +01:00
Benjamin Otte
fcc1f554d6 gsk: Add GskInsetShadowNode
And again lots of shadow code gets copied to GSK. But we're now almost
at a stage where widget-factory does not use cairo nodes anymore.
2016-12-20 18:01:12 +01:00
Benjamin Otte
4fc64ae3dd gsk: Add contains/intersect functions for GskRoundedRect
... and use them.
2016-12-20 18:01:12 +01:00
Benjamin Otte
2480e0d575 gsk: Add GskShadowNode
... and make the icon rendering code use it.

This requires moving even more shadow renering code into GSK, but so be
it. At least the "shadows not implemented" warning is now gone!
2016-12-20 18:01:12 +01:00
Benjamin Otte
071c9a8221 API: gdk: Add gdk_rgba_is_clear() and gdk_rgba_is_opaque()
I want to use these inside GSK, and I'm not a fan of putting GdkRGBA
APIs into it or duplicating it into GTK.

So public API it is.
2016-12-20 18:01:12 +01:00
Benjamin Otte
15e8a22f08 gsk: Move gtk/gtkcairoblur.c to gsk/gskcairoblur.c 2016-12-20 18:01:11 +01:00
Benjamin Otte
6e31fc4300 inspector: Print node type in node properties 2016-12-20 18:01:11 +01:00
Benjamin Otte
75b76af221 gsk: Add GskBorderNode
The node draws a solid CSS border, which can be used to cover everything
but dashed and dotted borders (double, groove, inset, ...).

For different border styles, we overlay multiple nodes and set their
colors to transparent for sides with non-matching styles.
2016-12-20 18:01:11 +01:00
Benjamin Otte
9af468cdec gtk: Remove unused argument from function 2016-12-20 18:01:11 +01:00
Benjamin Otte
a9809e5d30 gsk: Add gsk_rounded_rect_shrink()
... and replace _gtk_rounded_box_grow() and _gtk_rounded_box_shrink()
with it.
2016-12-20 18:01:11 +01:00
Benjamin Otte
65e9894450 menu: Implement snapshot() for the menu code 2016-12-20 18:01:11 +01:00
Benjamin Otte
e492a63e4c paned: Implement snapshot() 2016-12-20 18:01:11 +01:00
Benjamin Otte
8ad7c435ca cssimage: Implement snapshot() for cross-fade 2016-12-20 18:01:11 +01:00
Benjamin Otte
9822fe81a3 snapshot: Implement gtk_snapshot_push_opacity()
Use it in GtkWidget's opacity handling.
2016-12-20 18:01:11 +01:00
Benjamin Otte
6b29dbf26a snapshot: Handle NULL returns in pop_and_append() 2016-12-20 18:01:11 +01:00
Benjamin Otte
30438c6e8b gsk: Add cross-fade node
And implement stack crossfades with it.
2016-12-20 18:01:11 +01:00
Benjamin Otte
81297857cc snapshot: Convert Range, Scale, ColorScale
And of course Scrollbar, but that one does no drawing itself.
2016-12-20 18:01:11 +01:00
Benjamin Otte
e8cd71228a gsk: Implement linear gradient render nodes 2016-12-20 18:01:11 +01:00
Benjamin Otte
cf520b7a1f gsk: Add blend nodes
Implement blend mode support in GTK background compositing with it.
2016-12-20 18:01:11 +01:00