Commit Graph

27912 Commits

Author SHA1 Message Date
Timm Bäder
9b76badb50 widget: Add construct-only css-name property
So we can set the css name of a widget to something that's not related
to the class name. If the css-name property is set to NULL, we will
still fall back to the one set using gtk_widget_class_set_css_name which
is alwasys non-NULL since GtkWidget itself sets it to "widget".
2017-01-08 16:44:46 +01:00
Timm Bäder
d15ca3b2b4 actionbar: Fix class and instance struct parent member 2017-01-08 15:12:45 +01:00
Timm Bäder
3d5a62a0c9 actionbar: Add revealed property
So we can show and hide it with a transition as well as bind another
property to it.
2017-01-08 14:57:11 +01:00
Timm Bäder
c392f41bb2 builderparser: Shuffle if-statements around once more
The previous reordering broke the builderparser test case.
2017-01-08 13:07:12 +01:00
Timm Bäder
de6b788a91 printunixdialog: Remove leftover draw handler 2017-01-08 11:06:49 +01:00
Timm Bäder
48d5f7843b actionbar: Add revealer as internal child 2017-01-08 10:49:06 +01:00
Timm Bäder
12c2274750 actionbar: Remove show() and hide() implementations
They only show/hide the widget in a delayed fashion which doesn't
work, just like it doesn't work with infobars and popovers.
2017-01-08 10:46:26 +01:00
Benjamin Otte
2a9ae1e8df tests: Remove gtk_widget_send_key()
It's unused in GTK.
2017-01-08 03:46:30 +01:00
Benjamin Otte
daf0270f1a tests: Remove widget find functions
They are all unused by GTK.

And other people can write their own find functions if they need any in
their tests.
2017-01-08 03:36:05 +01:00
Matthias Clasen
507a1e4d7a Make GTK_DEBUG=interactive work better
We currently have various ways to initialize GTK+, and not
all of them were supporting this way of bringing up the
inspector. Fix this.

https://bugzilla.gnome.org/show_bug.cgi?id=776807
2017-01-07 19:16:15 -05:00
Benjamin Otte
c1f1dae997 viewport: Remove API to query GdkWindows 2017-01-08 00:48:13 +01:00
Benjamin Otte
d50b73f66d treeview: Remove gtk_tree_view_get_bin_window()
We don't want to expose GdkWindows in the public API.
2017-01-08 00:48:12 +01:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Timm Bäder
f486805ba0 Unparent child widgets 2017-01-07 17:19:30 +01:00
Timm Bäder
5f98597a0c Add gtk_widget_set_focus_child
With a very useful implementation, but at least now we don't get runtime
warnings.
2017-01-07 17:19:30 +01:00
Timm Bäder
52aed5d607 Add gtk_widget_snapshot_child 2017-01-07 17:19:30 +01:00
Timm Bäder
08d644c4a5 widget: Warn if children are left in finalize() 2017-01-07 17:19:30 +01:00
Timm Bäder
7d0e534969 gtkmain: Correctly notify all widgets of a grab 2017-01-07 17:19:30 +01:00
Timm Bäder
8960bb7c8e widget: Fix :parent property type
Parent widgets can now also be widgets, not just containers.
2017-01-07 17:19:30 +01:00
Timm Bäder
9aedbc376b inspector: Don't try to access child props of non-containers 2017-01-07 17:19:30 +01:00
Timm Bäder
5ab2377afa widget: Remove gtk_widget_style_get_property 2017-01-07 17:19:30 +01:00
Timm Bäder
25236dbed8 spinbutton: Use widgets for up/down buttons 2017-01-07 17:19:30 +01:00
Timm Bäder
b2b4d9e418 switch: Use GtkLabels for on/off labels 2017-01-07 17:19:30 +01:00
Timm Bäder
42f1ff0123 inspector: Show child widgets of widgets 2017-01-07 17:19:29 +01:00
Timm Bäder
d77b288e65 widget: Implement create_path for widgets with non-container parent 2017-01-07 17:19:26 +01:00
Timm Bäder
af9d932e47 widget: Unparent widgets in dispose()
If they have a non-container parent.
2017-01-07 16:44:01 +01:00
Timm Bäder
ef44d05894 widget: Check for containerness before calling container API 2017-01-07 16:44:01 +01:00
Timm Bäder
8ef73660e4 widget: Implement map/unmap with child widgets
Once again, do what GtkContainer did before.
2017-01-07 16:44:01 +01:00
Timm Bäder
b15b9e028f widget: Implement show_all
Do what gtk_container_forall did: show_all all children, then the widget
itself.
2017-01-07 16:44:01 +01:00
Timm Bäder
8a55a6975c widget: Iterate over child widgets instead of gtk_container_forall 2017-01-07 16:44:01 +01:00
Timm Bäder
1e031cba99 widget: Add children and sibling pointers
and a (private) way to access them. We will later use these pointers to
manage children of non-container widgets and containers alike.
2017-01-07 16:44:00 +01:00
Timm Bäder
626868c7ba combobox: Remove unused define 2017-01-07 16:15:12 +01:00
Matthias Clasen
5fa1b14a96 Revert "Use CSS for styling links in labels"
This reverts commit 60a8769e7f0c952fdc8090b1ecd96cca00123ad9.

This needs more work to work properly.
2017-01-05 20:57:42 -05:00
Matthias Clasen
4170f79eea Use CSS for styling links in labels
This was implemented only halfway, and was hardcoding the
underline. We don't need to do that anymore.
2017-01-05 20:57:42 -05:00
Matthias Clasen
f3779b42c5 Make it possible to set style classes for label links
This makes it possible to style links in labels differently
in certain situations.
2017-01-05 16:55:45 -05:00
Sébastien Wilmet
88699f588d docs: improve the documentation of GtkEntry:attributes
See the implementation of gtk_entry_create_layout():
pango_attr_list_splice() is used to add the PangoAttrList of the preedit
string. And that is done *after* applying the PangoAttrList of the
"attributes" property.

https://bugzilla.gnome.org/show_bug.cgi?id=776868
2017-01-04 19:56:30 +01:00
Benjamin Otte
b993acfe2c gsk: Add GskRepeatNode
Also add gtk_snapshot_push_repeat() and use that to draw backgrounds.

With that change, CSS background snapshots are created without Cairo
nodes.
2017-01-01 19:53:36 +01:00
Benjamin Otte
aa917ce3b7 css: Redo GtkCssAffects
We now have GTK_CSS_AFFECTS_CONTENT for properties that have an effect
on content rendering.

Using GTK_CSS_AFFECTS_ICON is wrong for icon-transform and icon-filter
as they don't change the icon, just how the icon is rendered, so we use
GTK_CSS_AFFECTS_CONTENT for those.

We also introduce GTK_CSS_AFFECTS_POSTEFFECT for opacity and filter -
properties that affect the whole drawing of the widget by applying an
effect after everything is said and done.
2017-01-01 19:53:36 +01:00
Benjamin Otte
2571036c07 gsk: Turn GskTexture into a GObject 2017-01-01 19:53:36 +01:00
Benjamin Otte
4ead5c3ba8 colorplane: Implement snapshot() 2017-01-01 19:53:36 +01:00
Benjamin Otte
e542d411ac accellabel: Initialize allocation variable
I have no idea why gcc didn't catch this.
2016-12-31 14:37:20 +01:00
Benjamin Otte
fb43807fbb cssfiltervalue: Change node name
We're not just using this for icon filters, but for regular filters, so
the existing name is confusing.
2016-12-31 14:37:20 +01:00
Daniel Boles
0259312142 scrolledwindow: Fix func summary being cut off in bindings using doxygen
...which treats the first '.' in doc comments as the end of the summary.
So, e.g., in gtkmm, get_kinetic_scrolling() is currently summarised as
"Changes the behaviour of @scrolled_window wrt." Not very informative!

No need for a period there & anyway, the phrase "wrt to" is superfluous,
and we have space to actually say "with regard to", so just do that now.
2016-12-31 13:27:15 +00:00
Benjamin Otte
959f80e6e9 css: Implement filter
So far, it's only implemented for widgets, not for gadgets.

Not sure how to do it for gadgets without conflicts for widget gadgets
yet...
2016-12-31 02:49:47 +01:00
Benjamin Otte
45fbc25e5e css: Remove -gtk-icon-effect
-gtk-icon-filter replaces this now.
2016-12-31 02:49:47 +01:00
Benjamin Otte
5b33127692 gtk: Replace -gtk-icon-effect with -gtk-icon-filter
Instead of
  -gtk-icon-effect: dim;
  -gtk-icon-effect: hilight;
we now use
  -gtk-icon-filter: opacity(0.5);
  -gtk-icon-filter: brightness(1.2);
respectively.
2016-12-31 02:49:47 +01:00
Benjamin Otte
2645b5a7d7 gtk: Implement -gtk-icon-filter
This uses the new GskColorMatrixNode to implement a filter that applies
to icons. It's meant to replace -gtk-icon-effect.
2016-12-31 02:49:47 +01:00
Benjamin Otte
8973191278 snapshot: Add gtk_snapshot_push_color_matrix()
So far, this is unused.
2016-12-31 02:49:47 +01:00
Benjamin Otte
7540702cf0 gsk: Add GskColorMatrixNode
This node essentially implements the feColorMatrix SVG filter. I got the
idea yesterday after looking at the opacity implementation.

It can be used for opacity (not sure if we want to) and to implement a
bunch of the CSS filters.
2016-12-31 02:49:47 +01:00
Benjamin Otte
d82e8bf3d6 debugupdates: Draw without cairo node 2016-12-31 02:49:47 +01:00
Chris Mayo
051a7eceb1 GtkAboutDialog: Fix formatting of example email address in html
Signed-off-by: Chris Mayo <aklhfex@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=776524
2016-12-30 10:36:50 -05:00
Matthias Clasen
e62696b145 about dialog: Simplify the template a bit
Remove some unnecessary complications, like an extraneous
box, and some child property settings that are not needed.
2016-12-30 10:33:16 -05:00
Matthias Clasen
7e6820415d Avoid a possible crash in ::activate-url handlers
If the signal handler ends up changing the label text,
the link is no longer around to update the css node.
Check for this possibility to avoid a crash here.
2016-12-29 11:09:20 -05:00
Benjamin Otte
599cc995f3 css: Handle repeating gradients with only one offset
Example:
  repeating-linear-gradient(red 50%, blue 50%)

Those gradients in Firefox draw a solid image of the last color, so do
the same here.
2016-12-26 17:22:01 +01:00
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
Benjamin Otte
3e26fadb24 css: Replace custom blend modes with GskBlendMode 2016-12-20 18:01:11 +01:00
Benjamin Otte
58b2c1d009 cssimage: Port a few more simple ones to snapshots 2016-12-20 18:01:10 +01:00
Benjamin Otte
cd68c93b4c render: Fall back later when rendering backgrounds
We can now render most backgrounds fine.
2016-12-20 18:01:10 +01:00
Benjamin Otte
3d5173d4ac gtk: Fix memleaks
It turns out, some simple getters - such as
gdk_drawing_context_get_clip() - love copying things before returning
them.

I guess somebody has to burn cycles...
2016-12-20 18:01:10 +01:00
Benjamin Otte
dd1cf1ac0f css: An opaque background does not allow omitting push_group
When the background-clip of the background is smaller than the
background-clip of blended images, not pushing a group is wrong.

Test testing exactly that included.
2016-12-20 18:01:10 +01:00
Benjamin Otte
23e35706b4 gsk: Add support for rounded clip rectangles
Also add support to GtkSnapshot, so people can push rounded clips.
2016-12-20 18:01:10 +01:00
Benjamin Otte
f96f16899d roundedbox: Remove _gtk_rounded_box_path()
Use gsk_rounded_rect_path() instead.

That's a private GSK function, be we can just include its header.
2016-12-20 18:01:10 +01:00
Benjamin Otte
fa9b0f9965 roundedbox: Remove _gtk_rounded_box_move()
Use gsk_rounded_rect_offset() instead.
2016-12-20 18:01:10 +01:00
Benjamin Otte
e26f84fca0 gtk: Remove GtkRoundedBox struct
Use GskRoundedRect instead.
2016-12-20 18:01:10 +01:00
Benjamin Otte
a2dfb1e93f roundedbox: typedef to GskRoundedRect 2016-12-20 18:01:10 +01:00
Benjamin Otte
c04bece131 roundedbox: Use a graphene_size_t for the corners
Obviously, I'm trying to port GtkRoundedBox to GskRoundedRect.

This is the second step on that path.
2016-12-20 18:01:10 +01:00
Benjamin Otte
6d012fb4ea gtk: Get rid of GtkCssCorner
We have GskCorner now which is identical.
2016-12-20 18:01:10 +01:00
Benjamin Otte
0a0cbcdcb6 viewport: implement snapshot() 2016-12-20 18:01:10 +01:00
Benjamin Otte
b0175421f2 stack: Implement snapshot()
This uses the new push()/pop() mechanism to its fullest extent when
implementing transitions. It's fun to inspect the results in the
inspector.

Crossfades don't work yet, they continue using a Cairo fallback.

A side effect of the stack conversion is that widget-factory now uses
snapshots for a lot more things.
2016-12-20 18:01:10 +01:00
Benjamin Otte
1137483d15 snapshot: Work on pushing and popping again
It is now possible to call push() subfunctions for simple container
nodes with just a single child. So you can for example
gtk_snapshot_push_clip() a clip region that all the nodes that get
appended later will then obey.

gtk_snapshot_pop() will then not return a container node, but a clip
node containing the container node (and similar for the transform
example).

This is implemented internally by providing a "collect function" when
pushing that is called when popping to collects all the accumulated
nodes and combine them into the single node that gets returned.

To simplify things even more, gtk_snapshot_pop_and_append() has been
added, which pops the currently pushed node and appends it to the
parent.

The icon rendering code has been converted to this approach.
2016-12-20 18:01:10 +01:00
Benjamin Otte
1f988d8b05 gsk: Add gsk_clip_node_new()
The node is a simple clipping node: It does a rectangular clip of its
contents.
2016-12-20 18:01:10 +01:00
Benjamin Otte
68a54ae81f stack: Don't draw an extra background
The gadget draws a background for us, we don't need another one.
2016-12-20 18:01:10 +01:00
Benjamin Otte
07d39299ea gsk: Replace gsk_render_node_set_opacity()
... with gsk_opacity_node_new().

Also implement support for opacity in gtk_widget_snapshot() using this
new node.
2016-12-20 18:01:10 +01:00
Benjamin Otte
671d43b873 cssimage: Implement snapshot() in the fallback image 2016-12-20 18:01:10 +01:00
Benjamin Otte
ed6643cf69 cssimage: Use textures in GtkCssImageSurface
We now use textures instead of surfaces and implement the snapshot()
vfunc instead of draw().
2016-12-20 18:01:10 +01:00
Benjamin Otte
429346fa7e cssimage: Implement a fallback draw() vfunc
... that chains into snapshot. This way, we can stop implementing draw()
in GtkCssImage subclasses and focus on snapshot() instead.
2016-12-20 18:01:10 +01:00
Benjamin Otte
c258ee403a snapshot: Make gtk_snapshot_get_renderer() private
Public API doesn't need to be concerned with renderers. Worst case, they
can use NULL instead of the actual renderer.
2016-12-20 18:01:10 +01:00
Benjamin Otte
e6d423e0e2 gsk: Remove gsk_renderer_create_fallback()
Use gsk_render_node_draw() instead.
2016-12-20 18:01:10 +01:00
Benjamin Otte
b120075698 snapshot: Add API for colors and textures 2016-12-20 18:01:10 +01:00
Benjamin Otte
6129daf29b gsk: Add gsk_color_node_new() 2016-12-20 18:01:10 +01:00
Benjamin Otte
361e2cda27 Call gsk_render_node_draw() instead of creating fallback renderers 2016-12-20 18:01:10 +01:00
Benjamin Otte
02131d590e snapshot: Change how gtk_snapshot_push/pop works
Instead of appending a container node and adding the nodes to it as they
come in, we now collect the nodes until gtk_snapshot_pop() is called and
then hand them out in a container node.

The caller of gtk_snapshot_push() is then responsible for doing whatever
he wants with the created node.

Another addigion is the keep_coordinates flag to gtk_snapshot_push()
which allows callers to keep the current offset and clip region or
discard it. Discarding is useful when doing transforms, keeping it is
useful when inserting effect nodes (like the ones I'm about to add).
2016-12-20 18:01:10 +01:00
Benjamin Otte
ca80e9decf snapshot: Handle clip region as part of the state
This is in preparation for further changes.
2016-12-20 18:01:10 +01:00
Benjamin Otte
67fb129ed7 gsk: gsk_render_node_set_transform() => GskTransformNode
Instead of having a setter for the transform, have a GskTransformNode.

Most of the oprations that GTK does do not require a transform, so it
doesn't make sense to have it as a primary attribute.

Also, changing the transform requires updating the uniforms of the GL
renderer, so we're happy if we can avoid that.
2016-12-20 18:01:10 +01:00
Benjamin Otte
19753062c4 gsK: Move children handling to GskContainerNode 2016-12-20 18:01:09 +01:00
Benjamin Otte
d691dfc894 inspector: Prepare TreeModelRenderNode for brave new world
I'm about to move children handling to the container node, which means
the generic code can no longer assume children APIs existing.

So rewrite the treemodel to work without it.
2016-12-20 18:01:09 +01:00
Benjamin Otte
3eb7c4719b gsk: Remove gsk_render_node_set_bounds()
gsk_render_node_get_bounds() still exists and is computed via vfunc
call:
- containers dynamically compute the bounds from their children
- surface and texture nodes get bounds passed on construction
2016-12-20 18:01:09 +01:00
Benjamin Otte
a97b819b81 gsk: Add gsk_container_node_new()
It replaces gsk_renderer_create_render_node() which was doing the eact
same thing, only taking an unused extra argument.
2016-12-20 18:01:09 +01:00
Benjamin Otte
8830a1a1ad gtk: Remove gtk_snapshot_append()
It does not make sense to append an empty container node. Those should
only be push()'d.
2016-12-20 18:01:09 +01:00
Benjamin Otte
abd184efc9 gsk: Remove gsk_render_node_is_surface/texture()
Use gsk_render_node_get_node_type() instead.
2016-12-20 18:01:09 +01:00
Benjamin Otte
52d2faef88 gsk: Add gsk_cairo_node_new()
Split off Cairo drawn content nodes and require you to allocate them
using this new function.
2016-12-20 18:01:09 +01:00
Benjamin Otte
d1b80a6baa gtk: Don't push cairo nodes
We want to split nodes into containers and nodes that do actual drawing.
So pushing nodes that do drawing is exactly the wrong thing.

Also fix up GtkPopover. There's no need for it to push anything.
2016-12-20 18:01:09 +01:00
Benjamin Otte
8c8691b469 gsk: Add gsk_texture_node_new()
Start the transition into the different node types.
2016-12-20 18:01:09 +01:00
Benjamin Otte
ff884385c0 gsk: Remove GskRenderNode::hidden
If you want to hide something, don't render it.
2016-12-20 18:01:09 +01:00
Debarshi Ray
7ea199c831 flowbox: Export gtk_flow_box_get_child_at_pos as public API
https://bugzilla.gnome.org/show_bug.cgi?id=776187
2016-12-20 00:35:17 +01:00
Debarshi Ray
faf2295440 GtkStack: Remove redundant code
Commit 7ce96cb6ac avoids notifications
during destruction by using gtk_widget_in_destruction. Therefore this
code is no longer needed.

This reverts commit 39e7afecb1

https://bugzilla.gnome.org/show_bug.cgi?id=749012
2016-12-20 00:32:15 +01:00
Philip Chimento
76e5fd4d0f GtkApplication: Lack of optional components shouldn't warn
When running uninstalled tests with GtkApplication on an autobuilder with
a fake session bus, warnings will cause the tests to abort. The GNOME
session manager, the Xfce session manager, and the Inhibit portal are all
not needed for normal operation of GTK, so we should not log warnings if
they are not found.

As well as not being present on a fake session bus, it's also not
expected that they'll be present on all platforms.

https://bugzilla.gnome.org/show_bug.cgi?id=774784
2016-12-19 15:20:58 -08:00
Piotr Drąg
a2da4ddceb Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2016-12-19 15:08:10 -05:00
Debarshi Ray
7331735499 flowbox: Don't emit selected-children-changed during destruction
https://bugzilla.gnome.org/show_bug.cgi?id=776012
2016-12-19 18:05:59 +01:00
Debarshi Ray
f5818c594c listbox: Don't emit selected-rows-changed, etc. during destruction
https://bugzilla.gnome.org/show_bug.cgi?id=776012
2016-12-19 18:05:51 +01:00
Debarshi Ray
9791641d43 flowbox: Rename gtk_flow_box_find_child_at_pos for consistency
... with gtk_list_box_get_row_at_y. It would be nice to avoid the
'find' versus 'get' discrepancy since we are planning to expose it as
public API.

https://bugzilla.gnome.org/show_bug.cgi?id=776187
2016-12-19 15:07:53 +01:00
Benjamin Otte
2090219abb scrolledwindow: Implement snapshot() 2016-12-19 05:36:06 +01:00
Benjamin Otte
e09fd1eb8a scrolledwindow: Fix rendering
We used to allocate the gadget relative to the view window. We allocate
relative to widget->window now.
2016-12-19 05:36:06 +01:00
Benjamin Otte
e755d9357d notebook: Implement snapshot 2016-12-19 05:36:06 +01:00
Benjamin Otte
3ba5c70028 iconhelper: Implement snapshot 2016-12-19 05:36:06 +01:00
Benjamin Otte
d9619abb11 progressbar: Implement snapshot() 2016-12-19 05:36:06 +01:00
Benjamin Otte
1733a3de0e toolbar: Implement snapshot() 2016-12-19 05:36:06 +01:00
Benjamin Otte
182dad304a eventbox: Implement snapshot() 2016-12-19 05:36:06 +01:00
Benjamin Otte
8900d6cc45 separatortoolitem: Implement snapshot() 2016-12-19 05:36:06 +01:00
Benjamin Otte
edf8ffecdf levelbar: Implement snapshot() 2016-12-19 05:36:06 +01:00
Benjamin Otte
96a94fc21d frame: Remove the border node
It does weird clipping that
(a) nobody likes
(b) is hard to support in the new rendering world.
So we take the easy way out.

The actual frame is now drawn by the frame node around the label.
2016-12-19 05:36:06 +01:00
Benjamin Otte
795f38b4cc cellview: Remove code to modify the background
GtkCellView has a gadget, so peopl can do all their shenanigans with
CSS.

And the original use case (overriding the background so that the
cellview's GdkWindow shares the background color of the combobox) is
outdated since we have transparent backgrounds.
2016-12-19 05:36:06 +01:00
Benjamin Otte
0eecc6f686 grid: Implement support for CSS border-spacing 2016-12-10 04:32:55 +01:00
Benjamin Otte
404cdd5d02 boxgadget: Implement CSS border-spacing 2016-12-10 04:32:55 +01:00
Benjamin Otte
75c3d193f6 box: Implement support for border-spacing 2016-12-10 04:32:55 +01:00
Benjamin Otte
5aea108802 box: Remove unused member variable 2016-12-10 04:32:55 +01:00
Benjamin Otte
d7148a4718 css: Add "border-spacing" CSS property
It's using a GtkCssPositionValue, even though that name is wrong. But
the functionality of managing 2 lengths is exactly what we want.

Nobody is using this yet.
2016-12-10 04:32:55 +01:00
Benjamin Otte
cb8483b0a6 gtk: Remove unneeded gtk_snapshot_push()/pop() calls 2016-12-09 21:39:43 +01:00
Benjamin Otte
f8932d643d snapshot: Always create an initial node
This way we ensure that there is only one root node and everybody can
append() with impunity.
2016-12-09 21:39:43 +01:00
Timm Bäder
489aee5d00 widget: Remove unused adjust_* vfuncs
Expose them privately to gtksizerequest.c using normal functions
instead.
2016-12-07 18:12:54 +01:00
Timm Bäder
1aa1676d9d menu: Replace button-press-handler with gesture 2016-12-07 18:06:37 +01:00
Timm Bäder
be9adea58e toolbar: Replace button-press-event handler with gesture 2016-12-07 18:06:32 +01:00
Timm Bäder
55b1f231fb linkbutton: Replace button-press-event handler with gesture 2016-12-07 18:06:28 +01:00
Timm Bäder
c4a6c37767 separatortoolitem: Remove button-event/motion-event handlers
These only exist for the window dragging which does not exist anymore
currently. It will be reintroduced later in a form that does not require
these handlers.
2016-12-07 18:06:23 +01:00
Timm Bäder
4c12c4ba02 snapshot: Add annotations to parameters/return values 2016-12-07 18:06:17 +01:00
Timm Bäder
ea22bd9d40 widget: Use gtk_widget_measure to measure widget sizes 2016-12-07 08:19:22 +01:00
Timm Bäder
07a9b202ab widget: Remove _gtk_widget_supports_clip 2016-12-07 08:19:22 +01:00
Timm Bäder
3063d4a5e3 widget: Remove gtk_widget_invalidate_style_context 2016-12-07 08:19:22 +01:00
William Hua
fdec3e8a3f build: add gir depends for GdkX11, GdkWin32, and Gsk on Gdk
https://bugzilla.gnome.org/show_bug.cgi?id=775651
2016-12-05 12:56:50 -05:00
Benjamin Otte
582ea50faa inspector: Add support for displayin the render region
Now I just need a UI designer that makes this look nice...
2016-12-05 15:02:47 +01:00
Benjamin Otte
60567db486 gskrenderer: Add gsk_renderer_begin_draw_frame()
This way, we can hijack the begin/end draw process and do out own
processing before passing it on to GDK.
2016-12-05 15:02:47 +01:00
Benjamin Otte
e950a5190d inspector: Pass the drawing context into the recorder
That way we can capture both the actual changes (clip region) and the
area that was redrawn (render region), which in OpenGL might not be
identical.

Nothing shows the render region yet though...
2016-12-05 15:02:47 +01:00
Benjamin Otte
bddfd7bb41 gdk: Remove all code that only existed because of use_gl
Now that we don't use GL anymore, this code is unnecessary.
2016-12-05 15:02:47 +01:00
Benjamin Otte
e42e27304a gskrenderer: Store the GL context
And use it to create the drawing context with it.

Note that this doesn't yet have any effect and is all infrastructure
preparation work.
2016-12-05 15:02:47 +01:00
Benjamin Otte
332ed7be5b API: Require passing a GLContext to begin_draw_frame()
This is in preparation for requiring explicit passing of GL contexts
when drawing.
2016-12-05 15:02:47 +01:00
Benjamin Otte
633631a47b cssgadget: Compute relative to own allocation, not widget allocation
This would lead to clipped gadgets when the gadget allocation differed
from the widget allocation, like in GtkListBox.
2016-12-05 15:02:46 +01:00
Timm Bäder
ac20c3eb22 frame: Use gtk_widget_measure to measure child sizes 2016-12-04 12:00:46 +01:00
Timm Bäder
7096d6dd28 viewport: Use gtk_widget_measure to measure child sizes
and rewrite the adjustment handling in a orientation-agnostic way.
2016-12-04 12:00:46 +01:00
Timm Bäder
5ee590fbc8 scrolledwindow: measure child widgets using gtk_widget_measure 2016-12-04 12:00:46 +01:00
Timm Bäder
1ab3d32808 revealer: Measure child widget size using gtk_widget_measure 2016-12-04 12:00:46 +01:00
Timm Bäder
7f8d0acfd3 headerbar: measure children using gtk_widget_measure 2016-12-04 12:00:46 +01:00
Timm Bäder
5b05c12780 toolpalette: call set_has_window 2016-12-04 12:00:45 +01:00
Timm Bäder
9f98138ffb printunixdialog: Remove GtkDrawingArea::draw handler
the source file has been updated to use gtk_drawing_area_set_draw_func,
but the draw_cb handler in the ui file is still left.
2016-12-04 12:00:38 +01:00
Benjamin Otte
0d68b22479 stylecontext: Remove a bunch of unneeded headers 2016-12-03 18:15:49 +01:00
Daniel Boles
8efc91c4e0 GtkProgressBar: trivial conditional optimisation
I'd hope the compiler would realise this for us, but let's be explicit.
2016-12-03 16:27:03 +00:00
Timm Bäder
3dac21f20b entry: Refactor get_icon_pixbuf
This way it will only return a pixbuf if the icon helper has a pixbuf.
2016-12-03 13:19:26 +01:00
Timm Bäder
8a543ab23c iconhelper: Ensure the surface used for textures is ARGB32 2016-12-03 13:19:26 +01:00
Timm Bäder
49508ddfdb iconhelper: Remove allocate implementation 2016-12-03 13:19:26 +01:00
Timm Bäder
31ed68dbfa listbox: Fix row hovering
GtkListBox is not a windowed widget anymore so we can't use
gtk_widget_get_window. Just directly access priv->view_window instead to
get the right window.
2016-12-03 13:19:26 +01:00
Timm Bäder
fa4d6e8918 spinbutton: Remove _get_panels 2016-12-03 13:19:26 +01:00
Timm Bäder
36377e9964 Remove gtk_widget_get_preferred_height_and_baseline_for_width
It's just a wrapper around gtk_widget_measure nowadays.
2016-12-03 13:19:25 +01:00