Commit Graph

1872 Commits

Author SHA1 Message Date
Benjamin Otte
4a43229d0b invisible: Make it use display, not screen 2017-10-31 08:25:37 +01:00
Benjamin Otte
07164e098a window: Turn gtk_window_set_screen() into gtk_window_set_display()
And have a priv->display instead of a priv->screen.

Includes turning gtk_menu_set_screen() into gtk_menu_set_display(),
because that function just forwards to its window.
2017-10-31 08:25:37 +01:00
Benjamin Otte
1c36c6ed4d widget: Remove gtk_widget_has_screen()
All widgets always have a screen (or display).
2017-10-31 04:33:11 +01:00
Benjamin Otte
9151e0b9f5 stylecontext: Port to use display instead of screen 2017-10-31 03:05:54 +01:00
Benjamin Otte
44614394e6 widget: Turn screen-changed signal into display-changed 2017-10-31 00:43:11 +01:00
Matthias Clasen
2926669a9b gtk: Stop handling settings events
We don't need this anymore, now that we use the ::setting-changed
signal.
2017-10-30 09:48:51 -04:00
Timm Bäder
91f40eb088 widget: Make parent property read-only 2017-10-29 18:03:10 +01:00
Timm Bäder
09239eb670 widget: Don't notify :parent when rearranging widgets
gtk_widget_reposition_after is also valid to call if the widget already
has a parent, so don't notify the parent property in that case.
2017-10-29 17:27:53 +01:00
Timm Bäder
ff6cd8f75e widget: Remove parent-set signal
When a widget unparents its child widget manually in finalize, this can
lead to the parent-set signal being emitted for those child widgets. The
parent already has a ref_count of 0 though, so it can't be used in a
meaningful way. Specifically, emitting the signal will already try to
ref the parent which prints a critical.

Since GtkWidget already has a "parent" property, one can use its notify
signal instead to get notified when the parent widget changes.
2017-10-29 17:24:12 +01:00
Matthias Clasen
46d4deeb1e Remove a shortcut in gtk_widget_set_focus_child
Since focus can now be represented by more than one state,
just looking at the focus_child is no longer sufficient - we
may fail to propagate :focus(visible) if we do so. For now,
just remove the shortcut and always do the work.
2017-10-25 18:26:06 -04:00
Matthias Clasen
0d4bd034c6 Always draw outline
We can now control with CSS where there the outline
is drawn.
2017-10-25 17:59:00 -04:00
Matthias Clasen
8b15eabad2 Set the new state flag
For now, we only set the new visible focus state
on the focus widget, when we have visible focus.
Later on, we will allow setting it on other widgets.
2017-10-25 17:49:43 -04:00
Timm Bäder
f5b0692cfc widget: Remove outdated comment on get_allocation
The allocation passed to gtk_widget_size_allocate can be retrieved these
days, using gtk_widget_get_allocated_size.
2017-10-20 14:55:53 +02:00
Timm Bäder
c02e04b7b8 widget: Whitespace fix
Fallout from one of my earlier commits so not changing ownership here.
2017-10-14 08:12:05 +02:00
Timm Bäder
ec18661bbb widget: Only check display debug flags if the global ones are set
The gtk_widget_get_display call in this if statement is showing up in
profiles. It ends up walking up the hierarchy to the toplevel to get its
GdkScreen, etc. so it is relatively costly. Avoid that call in most
cases by first checking if the RESIZE debugging is enabled for any of
the displays and only then checking if it is enabled for the widget's
display.
2017-10-14 07:37:06 +02:00
Timm Bäder
eee335557c widget: Avoid some type checks when invalidating window
Use the private _gtk_widget_get_has_window instead of the public version
2017-10-14 07:26:09 +02:00
Timm Bäder
9bc7581f1c css: Replace _AFFECTS_TEXT with _TEXT_SIZE and _TEXT_CLIP
It was used to mark css properties that affect widgets with text, but it
caused unnecessary invalidations. E.g. 'color' was marked as
AFFECTS_TEXT but changing just the color of a label should not
automatically queue a resize, which is what the code in
gtk_widget_real_style_updated does.

Replace this flag with GTK_CSS_AFFECTS_TEXT_SIZE and
GTK_CSS_AFFECTS_TEXT_CLIP, which GtkWidget can use only if the widget
actually has text.
2017-10-12 15:42:03 +02:00
Timm Bäder
a6904ba2cc widget: Use blue for resize debugging
Red is already taken by drawing.
2017-10-12 15:42:03 +02:00
Carlos Garnacho
d4a6c2c241 gtkwidget: Check return value before running bubble phase
If the target widget gets the event consumed on the target phase,
we should not attempt to bubble up, not even within the same widget.
2017-10-12 14:47:15 +02:00
Carlos Garnacho
564ae6967d gtkwidget: Lookup target widget when propagating emulated pressed
After a gesture first claims, and later rejects a touch sequence,
a press event will be propagated further along. However propagation
got messed up since we only emitted as far as the toplevel.
2017-10-12 14:47:15 +02:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Timm Bäder
869d9e8fe7 Widget: make sure windowed widgets have a 1×1 min size 2017-10-06 14:38:07 +02:00
Timm Bäder
3b9aa2f8d9 widget: Allow 0×0 allocations
Don't MAX the allocations with 1 anymore.
2017-10-06 14:38:07 +02:00
Timm Bäder
a196ad725a widget: Fix inserting child widgets at the beginning
We have to care about the child widget's current prev/next sibling as
well.
2017-09-29 12:15:23 +02:00
Carlos Garnacho
44cb3ccfa1 gdk: Remove motion hints
Motion hints are now literally a thing of the past. Everything should be
using the full motion event stream.
2017-09-19 18:40:51 +02:00
Carlos Garnacho
a9988e18b0 gtk: Remove 2BUTTON and 3BUTTON events and event types
Those should be interpreted by widget-local gestures, not guessed at a
high level with no notions of the specific context. Users will want
GtkGestureMultiPress to replace these events.
2017-09-19 18:40:50 +02:00
Carlos Garnacho
f2ded6a685 gtk: Change gtk_propagate_event() to propagate both ways.
This change is made for consistency, it doesn't make sense to expose
one-way propagation, as it can only break expectations from GTK+. This
function might be made entirely private in the future, but it still
makes sense to do this in one go for our internal usecases.
2017-09-19 18:39:03 +02:00
Carlos Garnacho
5b9287ed77 gtkwidget: Drop pointer emulation out of touch events
Users of touch events are required to either use a GtkGesture, or handle
touch events themselves.
2017-09-19 18:39:03 +02:00
Carlos Garnacho
8c350459ae gtk: Run GtkWidgetClass event signals inside a GtkEventController
This will allow further cleanups and optimizations in capture/target/bubble
event delivery. For simplicity, ATM every widget will receive its own
GtkEventControllerLegacy, it could be desirable to add finer control over
this in the future, so widgets that fully use event controllers for input
management can do away without this legacy piece.
2017-09-19 18:39:03 +02:00
Matthias Clasen
880d44aa48 widget: Give up on GdkEvent api for now 2017-09-19 18:39:03 +02:00
Matthias Clasen
a05895e029 Record node names for debug output
This is useful for GSK_NOTE output as well.
2017-09-03 11:32:09 -04:00
Timm Bäder
a23ea01c8f widget: Fix UPDATES debug rendering
Choose the right widget to add the debug updates to (the one with the
window) and the correct region (the one in that window's coordinates).
2017-08-23 13:58:21 +02:00
Timm Bäder
8e0ed691e3 widget: Remove unused draw_internal prototype
gtk_widget_draw_internal is now only used inside gtkwidget.c, so remove
the prototype from gtkwidgetprivate.h. And since all incovacations call
it with clip_to_size=TRUE, remove that parameter.
2017-08-23 11:05:36 +02:00
Timm Bäder
3613f96f59 widget: Remove outdated comment about widget coordinates
Not so odd anymore.
2017-08-19 11:43:29 +02:00
Timm Bäder
5204802f61 widget: Remove some always-true precondition checks 2017-08-15 21:45:03 +02:00
Daniel Boles
915d8197a0 Widget: Fix outdated comments about tooltips
They are not usually yellow anymore, the previous advice about how to
style them was for pre-3.20 versions, and the immediate replacement (CSS
class .tooltip) does not seem ready for primetime.

https://bugzilla.gnome.org/show_bug.cgi?id=784421
2017-08-15 19:17:57 +01:00
Timm Bäder
9f3f640c0d widget: Remove gtk_widget_get_border_allocation 2017-08-14 12:22:39 +02:00
Timm Bäder
5f859a1f24 widget: Remove gtk_widget_get_content_allocation
Replace it where we still need something similar, e.g. in
gtk_widget_translate_coordinates
2017-08-14 12:22:39 +02:00
Timm Bäder
9c7e089fc2 widget: Remove gtk_widget_get_margin_allocation
It's not needed anymore with get_outer_allocation (which will be
replaced by something more appropriately named).
2017-08-14 12:22:39 +02:00
Timm Bäder
07d6c7817d widget: Remove private _gtk_widget_set_has_focus
The css state here is now handled in gtk_widget_set_focus_child
2017-08-12 15:56:53 +02: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
Daniel Boles
bae6d3d45c Fix some nullable Returns annotations
based on reports and patches by Iñaki García Etxebarria:

https://bugzilla.gnome.org/show_bug.cgi?id=781246
https://bugzilla.gnome.org/show_bug.cgi?id=785423
2017-08-03 20:27:29 +01:00
Timm Bäder
e70a3fab0d widget: Constify state parameter of propagate_state
Makes sense.
2017-08-02 08:58:30 +02:00
Timm Bäder
8c08a33220 widget: Don't try to propagate 0 state flags
This happens quite often and has no effect anyway.
2017-08-02 08:58:30 +02:00
Timm Bäder
9a3049009e widget: Fix size_allocate's out_clip annotation 2017-08-02 08:58:30 +02:00
Timm Bäder
f7bb6a7aa8 widget: Unset PRELIGHT and ACTIVE state in _set_sensitive
They both depend on input, which an insensitive widget does not receive.
2017-08-01 18:43:42 +02:00
Timm Bäder
2cbcee8549 widget: Don't access highlight_resize in non-debug builds
The GtkWidgetPrivate struct only contains that member if G_ENABLE_DEBUG
is defined.
2017-07-28 21:28:32 +02:00
Timm Bäder
3f9bcf3b31 widget: Stop invalidating recursively 2017-07-24 14:32:06 +02:00
Timm Bäder
5720f2a845 widget: Make _set_clip private
We don't need this anymore since clips are now reported in
size-allocate.
2017-07-19 21:27:16 -04:00
Timm Bäder
5116ce19b7 widget: Remove queue_draw_region vfunc
Unused
2017-07-19 21:27:16 -04:00
Timm Bäder
65209da486 widget: Set :focus on focus children 2017-07-19 21:27:16 -04: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
95bd58ac00 widget: Don't propagate size-allocate if only the position changed
We can do this now so we should
2017-07-19 21:27:15 -04:00
Timm Bäder
2e6b1158ee widget: Fix priv dereference in size_allocate_with_baseline
Accessing ->priv is only safe *after* the GTK_IS_WIDGET precondition, so
use the get_instance_private function instead.
2017-07-19 21:27:15 -04:00
Timm Bäder
6d9a0d432a widget: Fix a widget/container mixup 2017-07-19 21:27:15 -04:00
Timm Bäder
0ebd8840a8 widget: Remove gtk_cairo_transform_to_window
Useless in a world without windows and cairo.
2017-07-19 21:27:15 -04:00
Timm Bäder
097ab2baed widget: Draw css box after pushing a opacity node 2017-07-19 21:27:15 -04:00
Timm Bäder
eb34c68ff4 widget: Move get_resize_needed to gtkwidget.c
It's only used in there so we don't need it in the private header.
2017-07-19 21:27:15 -04:00
Timm Bäder
f0d6cb5f40 widget: Propagate correct baseline 2017-07-19 21:27:15 -04:00
Timm Bäder
e19e3b72a3 widget: Always pass on baselines 2017-07-19 21:27:15 -04:00
Timm Bäder
fb2bb87bb1 widget: Simplify snapshot_child 2017-07-19 21:27:15 -04:00
Timm Bäder
0726148ca5 widget: Draw debug nodes for widget margins too 2017-07-19 21:27:15 -04:00
Timm Bäder
fa5203e700 widget: Fix copy&paste error when creating debug nodes 2017-07-19 21:27:15 -04:00
Timm Bäder
cef4df1e7e widget: Unset PRELIGHT and ACTIVE state flags in unmap 2017-07-19 21:27:15 -04:00
Timm Bäder
451a991488 window: Move updates debugging to GtkWidget
Which has the necessary information.
2017-07-19 21:27:15 -04:00
Timm Bäder
42aa7453ab Fix baselines wrt css values
The reported minimum baseline is for the reported min height, but if the
css min-height is greater than that, we need to account for that fact
when saving the baseline.

Since the reported baseline is relative to the widget's origin, we also
need to add the top values for margin, border and padding to the
reported baseline.
2017-07-19 21:27:14 -04:00
Timm Bäder
ea3876d26a widget: black is the new red 2017-07-19 21:27:14 -04:00
Timm Bäder
bc4c32505a menu: Popup at window coordinates if widget is given
Since widget allocations are now relative to the parent's origin, we
need to pass the window allocation here.
2017-07-19 21:27:14 -04:00
Timm Bäder
2cbaa998db widget: Fix drawing invalidation with windowed widgets
E.g. popovers. Find the parent of the given widget with the window and
invalidate the given region in that window.
2017-07-19 21:27:14 -04:00
Timm Bäder
e36ddfec17 Remove all widget style property code 2017-07-19 21:27:14 -04:00
Timm Bäder
a826ee37ca widget: Remove _set_simple_clip
Unused.
2017-07-19 21:27:14 -04:00
Timm Bäder
1bad3e1f28 widget: Transform clips into right coordinate space
The values passed to gtk_widget_set_clip are relative to the widget's
origin, but we need the values to be relative to priv->allocation.
2017-07-19 21:27:14 -04:00
Timm Bäder
63ba8fa355 widget: Consider opacity when drawing toplevels
This used to work in gtk3 and is used e.g. in the inspector when using
wayland.
2017-07-19 21:27:14 -04:00
Timm Bäder
b17d998eb5 widget: Add new allocation accessors 2017-07-19 21:27:14 -04:00
Timm Bäder
360b075164 widget: Avoid some type checks in snapshot_child 2017-07-19 21:27:13 -04:00
Timm Bäder
2b06986c38 widget: "fix" event and invalidation coordinates 2017-07-19 21:27:13 -04:00
Timm Bäder
241a009938 widget: Adapt translate_coordinates to coordinate changes 2017-07-19 21:27:13 -04:00
Timm Bäder
bccaeb0e2d widget: Make allocations parent-content-allocation relative 2017-07-19 21:27:13 -04:00
Timm Bäder
ec6184c2af widget: Remove queue_draw_child vfunc 2017-07-19 21:27:13 -04:00
Timm Bäder
73f5f45456 widget: Draw widget clips with GEOMETRY debugging 2017-07-19 21:27:13 -04:00
Timm Bäder
90c8a3f920 widget: Bring back layout debugging 2017-07-19 21:27:13 -04:00
Timm Bäder
ec51c63313 widget: Bring resize and baseline debug rendering back 2017-07-19 21:27:13 -04:00
Timm Bäder
dd713e0ae2 widget: Consider css margins when setting clip
This is optional for positive margins as they just increase the widget
allocation. However, with negative css margins, the allocation is
smaller than the clip.

This fixes scale sliders leaving a small trail behind.
2017-07-19 21:27:13 -04:00
Timm Bäder
2651fcbef9 widget: Special-case popover in snapshot
Just like we do it for GtkWindow.
2017-07-19 21:27:12 -04:00
Timm Bäder
2cedf1be9c widget: Remove gtk_widget_set_allocation 2017-07-19 21:27:12 -04:00
Timm Bäder
a71edd2925 widget: Add private get_margin_allocation 2017-07-19 21:27:12 -04:00
Timm Bäder
ede6f2ab59 Slightly rework clip handling
always initialize clips to the (content) allocation, don't walk up the
widget hierarchy in gtk_widget_set_clip, implement
gtk_widget_size_allocate in GtkSeparator. This way we don't end up using
uninitialized clip values.

The entire clip handling is up for major rework since we can't and don't
want to force every single widget to call _set_clip in size-allocate
implementations.
2017-07-19 21:27:12 -04:00
Timm Bäder
c87be0a27a widget: Don't set the allocation in size-allocate
If widgets chain up in their size-allocate implementation, they pass the
content allocation and not the widget allocation which will cause the
wrong allocation to be set.
2017-07-19 21:27:12 -04:00
Timm Bäder
ff6db012d9 widget: Add private get_border_allocation 2017-07-19 21:27:11 -04:00
Timm Bäder
a1b3a26ba4 widget: Add private gtk_widget_get_content_allocation 2017-07-19 21:27:11 -04:00
Timm Bäder
4e0f569b26 widget: Union clip with allocation and box shadow size 2017-07-19 21:27:11 -04:00
Timm Bäder
bcbcff5db9 widget: Pass content allocation to size-allocate vfunc 2017-07-19 21:27:11 -04:00
Timm Bäder
8761d4d609 widget: Add default snapshot implementation
gtk_widget_snapshot will snapshot the css box, the default snapshot
vfunc now gtk_widget_snapshot_child's all child widgets.
2017-07-19 21:27:11 -04:00
Timm Bäder
442d084a2a widget: Draw focus outline 2017-07-19 21:27:10 -04:00
Timm Bäder
4b75b20c34 Widget: Disable css box drawing for GtkWindow
Until we know how we solve that.
2017-07-19 21:27:10 -04:00
Timm Bäder
7656bd9bc3 widget: Draw background and border for every widget 2017-07-19 21:27:10 -04:00
Kjell Ahlstedt
1b697fd7c2 widget: Fix gtk_widget_insert_after/before() docs
Add beginning double asterisks and function names. Correct the parameter
names (next/previous_child -> next/previous_sibling). Make the documentation
of the two functions more similar.

https://bugzilla.gnome.org/show_bug.cgi?id=783445
2017-06-06 14:57:52 +02:00
Carlos Garnacho
690eb8ede6 gtkwidget: Lookup the event target when cancelling GdkEventSequences
We were getting the toplevel most often here, so the gestures weren't
properly cleaned up.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
b62b33c1d9 gtk: Fix event delivery on GTK_PHASE_TARGET controllers
Look up the event target, not the "event widget" which is based on the
event window, and thus points to the toplevel.
2017-05-25 16:25:59 +02:00
Timm Bäder
eef33d34d4 widget: Make sure we're not calling _get_parent on NULL
We already issue the first _get_parent call before even entering that
loop, so make sure `parent` is not NULL. This happens when event_widget
is already a toplevel, and this change fixes row-dragging in treeviews.
2017-05-25 16:25:59 +02:00
Timm Bäder
a0016758a8 widget: Copy event in gtk_widget_event and _captured_event
To ensure that we never translate the coordinates to widget coordinates
twice.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
e2c38ddc22 gtkwidget: Add private set_pass_through() call
We could eventually support pointer-event in CSS here, in the mean
time add this call to replace the GdkWindow API.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a595f92b7b gtkwidget: Visually update cursors inside widget when changing cursor 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
Carlos Garnacho
ef4f0e5336 gtkwidget: Make gtk_widget_event() Accept pointing events in root coordinates
This function will, at the last minute, ensure the event contains the right
widget-relative coordinates for the widget the event is being emitted to.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
7c16bb93b5 gtkwidget: Add private cursor setter/getter
This should be eventually replaced by CSS cursors, but at the moment
it must be handled on the gtk/ side.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
8f24df1c19 gtk: Update GtkPointerFocus targets on mapping/sensitivity changes
Those are situations that must cause foci on these widgets to repick
themselves.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
f50875f8d0 gtkwidget: Expose gtk_widget_common_ancestor()
This function will be useful in other places, such as determining the
widgets that must receive crossing events after pointer picking points
to another widget.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
9c97bf0c02 GtkWidget: Add ::pick vmethod
The default implementation iterates through all children, so should suffice
for most widgets.
2017-05-25 16:25:58 +02:00
Timm Bäder
8b2c71703e widget: Remove useless assignment
We don't use adjusted_allocation after this line.
2017-05-05 11:18:05 +02:00
Timm Bäder
c405fe23bf widget: remove double assignment
We never read the value we assign here.
2017-04-30 20:22:42 +02:00
Timm Bäder
1b36c325eb widget: Fold queue_resize_on_widget into its only caller 2017-04-30 18:38:10 +02:00
Timm Bäder
fe429f8806 gtkwidget: Queue a resize on the parent when unparenting
gtk_widget_set_parent (via gtk_widget_reposition_after) will queue a
resize on the parent widget automatically when adding a child widget, so
unparent should do the same
2017-04-25 20:30:37 +02:00
Timm Bäder
7e1373a08c widget: Fix set_parent/unparent docs to not mention GtkContainer
They can both be used by non-container widgets these days.
2017-04-25 20:30:37 +02:00
Timm Bäder
ba363fbb71 widget: Add gtk_widget_insert_before/after
To insert a widget into the widget tree before or after a child widget
of the soon-to-be parent.
2017-04-25 20:29:02 +02:00
Timm Bäder
c9fc201f77 Implement tab/up-down/left-right focus sorting for widgets
basically do what GtkContainer already did.
2017-03-31 09:50:40 +02:00
Timm Bäder
6e9d857714 Widget: Shuffle focus code around 2017-03-31 09:50:40 +02:00
Timm Bäder
0153147ca2 widget: Allow focusing widgets with non-container parent
Especially if said parent also has can-focus set to FALSE, which is a
special-case we had before for GtkContainer instances.
2017-03-31 09:50:40 +02:00
Timm Bäder
cc05fc574c window: Remove _gtk_window_set_is_toplevel
All GtkWindow instances are toplevels.
2017-03-31 09:50:39 +02:00
Timm Bäder
0d0cb6e192 widget: Emit ::focus regardless of container-ness and can-focus 2017-03-31 09:50:39 +02:00
Timm Bäder
885bcd9fe4 container: Remove focus_child pointer
Use GtkWidget's instead.
2017-03-31 09:50:39 +02:00
Timm Bäder
64544968e9 widget: Also reset focus on non-container widgets 2017-03-31 09:50:39 +02:00
Timm Bäder
43cdeee3c4 widget: Save pointer to focus child
Do the same thing GtkContainer does.
2017-03-31 09:50:39 +02:00
Timm Bäder
8f2d0bc5a3 widget: Fix checks in gtk_widget_snapshot()
If the widget isn't drawable anyway, just return;

If the widget needs an allocate, print a warning, since it indicates a
problem in the widget workflow (e.g. forgot to size_allocate a child
widget).

This maches the previous checks in gtk_widget_draw (with the same
problems).
2017-03-31 09:50:39 +02:00
Timm Bäder
653b766e30 widget: Add a GtkBuildable::add_child implementation
Just call gtk_widget_set_parent in there.
2017-03-31 09:50:38 +02:00
Christoph Reiter
e4b0bedb5d gtk_widget_intersect: fix annotations
https://bugzilla.gnome.org/show_bug.cgi?id=773228
2017-03-30 11:19:32 +02:00
Timm Bäder
1aa37687be widget: Prepend style classes to list when parsing
Since the later gtk_style_context_add_class doesn't care about the order
of the style classes, we can as well just prepend style classes to the
list and avoid the squared behavior when appending to a linked list.
2017-03-21 19:04:58 +01:00
Timm Bäder
73f8636687 widget: Remove direction-dependent margin code
Since margin-left and margin-right are gone, we don't have to care
about the difference between them and start/end anymore and we can just
save start as left and end as right.
2017-03-05 16:24:20 +01:00
Timm Bäder
f860ff8647 widget: Remove get_valign_with_baseline
This only existed for backwards compat reasons which aren't interesting
for gtk4.
2017-03-05 15:18:32 +01:00
Timm Bäder
a29343d4cf widget: Reword size request documentation 2017-03-04 08:57:50 +01:00
Lionel Landwerlin
72801a27eb widget: propagate scale factor upon reparenting a widget
When a widget is created, its default scale is the scale of the
primary screen (for instance 2). But once parented to another widget
its scale factor should be the one of its parent (if parented to a
widget on a screen at scale factor 1, it should be 1).

The problem is that we don't emit the notify::scale-factor signal when
reparenting happens.

https://bugzilla.gnome.org/show_bug.cgi?id=776821
2017-02-18 02:53:57 +00:00
Daniel Boles
02e9fb5a78 widget: Document signal mnemonic-activate
Name the extra bool argument, and move the explanatory paragraph from
the emitting method to the signal, with some minor tweaks to wording.

https://bugzilla.gnome.org/show_bug.cgi?id=778534
2017-02-15 21:44:29 +00:00
Timm Bäder
6a6b6549ea widget: Remove get_preferred_width/height mention in warning 2017-02-14 16:56:55 +01:00
Timm Bäder
6c6ed7496c widget: Remove gtk_widget_class_list_style_properties
Unused.
2017-01-30 18:11:00 +01:00
Timm Bäder
572639fed7 widget: Remove gtk_widget_get_preferred_size mention from docs
Mention gtk_widget_measure instead.
2017-01-22 15:01:53 +01:00
Timm Bäder
f05402ce2b widget: Remove warning about already visible widgets
That was just added by mistake of course.
2017-01-22 14:48:28 +01:00
Timm Bäder
56a58655fe Remove unnecessary gtk_widget_show calls 2017-01-22 14:38:21 +01:00
Piotr Drąg
e47bd31e6a Fix CSS spelling in a translatable string 2017-01-20 23:46:38 +01:00
Timm Bäder
ab051fd53f Don't hide windows and popovers in init()
Instead, don't make them visible in gtk_widget_init in the first place.
2017-01-20 21:51:05 +01:00
Timm Bäder
f4341ee9f7 widget: Remove show-all property
Doesn't make sense anymore now that gtk_widget_show_all is gone.
2017-01-20 21:37:07 +01:00
Timm Bäder
ea897c6df4 Remove gtk_widget_show_all 2017-01-20 21:37:04 +01:00
Timm Bäder
13b001b77c widget: Remove show_all vfunc 2017-01-20 21:33:38 +01:00
Timm Bäder
fee788cd4a widget: Be visible by default 2017-01-20 21:33:36 +01:00
Benjamin Otte
87497ca2e1 snapshot: Rename gtk_snapshot_translate_2d()
It's now called gtk_snapshot_offset().
2017-01-13 14:37:48 +01:00
Benjamin Otte
6055028c96 snapshot: Rename append APIs
Instead of having gtk_snapshot_append_foo_node(), just have
gtk_snapshot_append_foo(). Nobody needs to know that this internally
uses nodes.
2017-01-13 04:46:09 +01: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
c00f8dce9f GtkSnapshot: Always use int for the translation
We already take ints when setting the translation, so it can't
currently take any other values. Additionally, I was seeing large
costs in int -> double -> int for the rects in
gtk_snapshot_clips_rect(), as all callers really are ints (widget
allocations) and the clip region is int-based.

This change completely cleared a 2% rectangle_init_from_graphene from
the profile and is likely to have nice performance effects elsewhere
too.
2017-01-11 16:14:03 +01:00
Alexander Larsson
275185d415 widget: Avoid typechecks when accessing ->clip and ->allocation 2017-01-11 15:30:30 +01:00
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Alexander Larsson
65ad2541d7 Snapshot: Only record names if inspector is recording
Otherwise we do a lot of allocations and vprintf calls which are
not used.
2017-01-11 10:22:40 +01:00