Commit Graph

232 Commits

Author SHA1 Message Date
Timm Bäder
93df23d962 Remove some more gtk_widget_get_content_size uses 2017-12-04 12:42:52 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
73077c4e90 viewport: Implement clipping for picking
This is necessary because picking is no longer automatically constrained
to a widget's box. So all clipping widgets need to constrain their
clipping, too.

This patch does that for GtkViewport only.
2017-11-05 07:19:22 +01:00
Timm Bäder
23a1328fda viewport: Simplify child allocation
allocation->x and allocation->y are always 0
2017-10-31 10:10:53 +01:00
Timm Bäder
a8a755e5cd widget: Remove gtk_widget_set_redraw_on_alloc
Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
2017-08-09 16:26:26 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
c2abb698be Replace a few get_content_allocation calls with get_content_size
The position of the content allocation is almost never relevant since
it's 0/0 for measure, size_allocate and snapshot.
2017-07-19 21:27:14 -04:00
Timm Bäder
c462105d78 viewport: Remove bin_window 2017-07-19 21:27:13 -04:00
Timm Bäder
3f5626a3f7 viewport: Remove gadget 2017-07-19 21:27:11 -04:00
Carlos Garnacho
2f6c4ef68d gtkviewport: Remove view window
It is not really necessary for clipping nor receiving events.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Benjamin Otte
b58de2d16c snapshot: Redo pop() API
gtk_snapshot_pop() => removed
gtk_snapshot_pop_and_append() => gtk_snapshot_pop()

So now there is no way to get a rendernode out of the snapshotting API
until you gtk_snapshot_finish().
2017-01-13 03:38:36 +01:00
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Benjamin Otte
c1f1dae997 viewport: Remove API to query GdkWindows 2017-01-08 00:48:13 +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
0a0cbcdcb6 viewport: implement snapshot() 2016-12-20 18:01:10 +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
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Benjamin Otte
d818f3fcd4 viewport: Turn into no-window widget
While doing so, get rid of the GdkWindow instead of keeping it.
2016-11-02 22:00:29 +01:00
Benjamin Otte
a750f942ac viewport: Remove pixelcache
With the rework for GSK and queueing of redraws pending, the pixel cache
just gets in the way. So we remove it everywhere.
2016-10-26 19:52:02 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
019960f131 viewport: remove deprecated api 2016-10-18 00:29:17 +02:00
Benjamin Otte
3cf7b21256 viewport: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Matthias Clasen
c8cab6a79a viewport: Free gadgets in finalize
This is the right place for this.
2016-06-05 20:00:43 -04:00
Benjamin Otte
4e8fb33f56 pixelcache: Don't have a style context argument
That would imply the pixelcache monitors the style context for changes
and it doesn't do that.

Its only use case was opacity checks, so add
gtk_pixel_cache_se_is_opaque() instead.
2016-02-25 16:52:58 +01:00
Benjamin Otte
e3f8316d08 viewport: Don't destroy pixelcache while it's still used
Removing the child unsets the pxielcache's style context...
2016-01-20 05:10:16 +01:00
Benjamin Otte
9cb0a97bb5 viewport: Set the pixel cache background from the child
The viewport itself doesn't move, so we cannot use it as the pixel
cache's background. Use the bottommost using element instead, which is
the viewport's child.

This might need adaptations in themes as we want the backgroud to be
opaque to speed up pixel cache performance.
2016-01-20 04:37:05 +01:00
Cosimo Cecchi
09835b4c39 viewport: don't render a background over the bin window
GtkViewport currently tries to draw a background over the bin window.
The feature is a bit broken at the moment, as it does not take into
account padding that might have been set on the GtkViewport, but in
general it does not seem very useful, and goes somewhat against the CSS
box model where every widget/gadget is responsible to draw its own
background. For a fix, we could either have the viewport gain a "bin"
gadget, or we could stop drawing the background.

As it isn't clear that there are any users of this feature, stop drawing
the background; a client can achieve the same effect by drawing the
background on the widget inside the viewport itself.
2015-12-29 13:50:19 -08:00
Cosimo Cecchi
5daede51f7 viewport: port to use a gadget
This will get us margin support, among other things, and simplifies the
code.
2015-12-29 13:50:19 -08:00
Cosimo Cecchi
71d7b10dad viewport: trivial code cleanup 2015-12-29 13:50:19 -08:00
Cosimo Cecchi
a37129fd60 viewport: use gtk_container_class_handle_border_width()
No need to do this manually.
2015-12-29 13:50:19 -08:00
Timm Bäder
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Matthias Clasen
93629325d5 Cosmetic: Avoid explicit state variables
Using the state of the context makes this more obviously correct.
2015-11-14 12:32:57 -05:00
Matthias Clasen
b6dbfc791f viewport: Add an element name to the css node
This lets us avoid hardcoding the type in CSS.
2015-10-29 07:47:31 -04:00
Alexander Larsson
d5f1754981 gtk: Stop setting GDK_EXPOSURE_MASK on random widgets
These days exposure happens only on the native windows (generally the
toplevel window) and is propagated down recursively. The expose event
is only useful for backwards compat, and in fact, for double buffered
widgets we totally ignore the event (and non-double buffering breaks
on wayland).

So, by not setting the mask we avoid emitting these events and then
later ignoring them.

We still keep it on eventbox, fixed and layout as these are used
in weird ways that want backwards compat.
2015-09-14 11:01:13 +02:00
Christian Hergert
7c1ce9f3ad viewport: share style context with pixelcache
This allows the pixel cache to opportunistically use CAIRO_CONTENT_COLOR
instead of CAIRO_CONTENT_COLOR_ALPHA during surface creation.

https://bugzilla.gnome.org/show_bug.cgi?id=754658
2015-09-13 13:41:19 -07:00
Cosimo Cecchi
d4ecdbd300 viewport: don't call gtk_style_context_set_background() 2015-07-01 16:09:23 -07:00
Benjamin Otte
b09fbadddf viewport: Remove wrong save/restore 2014-10-13 04:39:57 +02:00
Benjamin Otte
d3c147a62d stylecontext: Split render functions out into gtkrender.[ch] 2014-10-03 06:18:05 +02:00
Matthias Clasen
dbeb0c9ca8 GtkViewport: Use style classes for shadow
Translate shadow != None into the FRAME style class.
This doesn't change the style classes used for drawing,
it only sets the style class permanently instead of
saving and restoring in draw().
https://bugzilla.gnome.org/show_bug.cgi?id=732256
2014-06-26 21:56:20 -04:00
Benjamin Otte
cdd341ed7d viewport: Remove unused variable 2014-06-10 13:47:51 +02:00
Matthias Clasen
b22b2298be GtkViewport: Don't do silly things in a setter
Just queue a resize instead of fiddling with the size allocation.
2014-06-09 13:51:58 -04:00
Matthias Clasen
bcd804613f GtkViewport: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:14 -04:00
Benjamin Otte
352e28a138 viewport: Don't subtract borders and padding from -1
-1 is a special value for "undefined" and needs to stay that way

https://bugzilla.gnome.org/show_bug.cgi?id=729607
2014-05-06 04:02:40 +02:00
Benjamin Otte
9652b8cf82 viewport: Remove unneeded checks
Size vfuncs always get non-null out variables passed, so no need to
check for NULL.
2014-05-01 14:51:27 +02:00
Benjamin Otte
29a4f0131e viewport: Implement hfw properly
Previously, the code would fall back on GtkBin's hfw implementation
which didn't account for padding and borders.
2014-05-01 14:51:27 +02:00
Benjamin Otte
b261fc64e2 viewport: Use a convenience function
That function looks longer than not using it, but we'll need it in the
next commit.
2014-05-01 14:51:27 +02:00