summaryrefslogtreecommitdiff
path: root/gtk/gtkwidget.c
Commit message (Collapse)AuthorAgeFilesLines
* GtkWidget: Add some missing nullable annotationsTimm Bäder2015-12-011-10/+10
|
* GtkWidget: Add some missing nullable annotationsTimm Bäder2015-11-241-2/+3
|
* Don't pass widget state flags to GtkStyleContext APITimm Bäder2015-11-221-1/+1
|
* widget: Avoid critical warnings when disconnecting plain GtkEventControllersCarlos Garnacho2015-11-051-1/+3
| | | | | This signal is only set on GtkGesture objects, so check it's really there before disconnecting.
* widget: Queue resize on parent, not selfBenjamin Otte2015-11-031-1/+1
| | | | | | | | When setting the parent of a widget, queue_resize() on the widget will be optimized away if the widget already had a resize queued. Plus, we do not need to resize the widget as its size request is not going to change.
* widget: Queue an allocate on hideBenjamin Otte2015-11-031-0/+2
| | | | | | | | | | | | | This makes sure that hidden widgets always have priv->alloc_needed set on them. The constructor sets that flag, so we want to have it back when we revert to this state. This fixes GtkWindow skipping a size_allocate() when reshowing a previously hidden window and thereby not updating its allocation and clip. And that in turn would lead to draws not happening and us beig left with a black window.
* widget: Add :focus-on-click propertyFlorian Müllner2015-11-031-1/+81
| | | | | | | | | There are currently three widget that implement such a property, and there are other widgets for which the behavior can make sense. It seems like a good time to add the property to GtkWidget itself so subclasses can choose to respect it without adding their own property. https://bugzilla.gnome.org/show_bug.cgi?id=757269
* widget: Queue redraw on gtk_widget_queue_allocate()Benjamin Otte2015-10-301-0/+3
| | | | | | | | | | | | | | | Mirror the behavior of gtk_widget_queue_resize() and always queue a redraw. If we ever want to cause allocates without redraws we can add gtk_widget_queue_allocate_no_redraw() then. I had initially assumed gtk_widget_size_allocate() would take care of queueing redraws, but it does not do that when neither size nor position change. And that is obviously what's happening after gtk_widget_queue_allocate(). Fixes buttons sometimes not redrawing (the record button in widget-factory after locking it, all buttons when switching to the dark theme).
* widget: Queue resize on parent on show/hideBenjamin Otte2015-10-291-13/+18
| | | | | | | | | | | | | When gtk_widget_show() or gtk_widget_hide() is called, don't queue a resize on the widget itself but on the parent. The widget itself may already be marked as in need of a resize and the call would be optimized out and never reach the parent. The parent size will change though because a child widget just changed its visibility. Fixes a bunch of issues with menus appearing black, toolbas not hiding in widget-factory and also various reftests.
* container: Don't keep our own variable trying to track need for resizeBenjamin Otte2015-10-281-3/+17
| | | | Insteaad, introduce gtk_widget_needs_allocate() and use that.
* widget: Make invisible widgets not propagate resizesBenjamin Otte2015-10-281-1/+1
| | | | | Do not queue a resize on the parent if the widget is not visible. Invisible widgets do not influence the parents size.
* widget: Make gtk_widget_queue_allocate() not resizeBenjamin Otte2015-10-281-2/+48
| | | | | | | | This commit toggles the big switch. We now don't run size_allocate() from the toplevel up anymore in cases where we don't need to. Things might be broken in subtle ways as a result of this commit. We'll have to find them and fix them.
* widget: Track if a child needs an allocationBenjamin Otte2015-10-281-1/+30
| | | | This is not used so far.
* widget: Refactor functionBenjamin Otte2015-10-281-24/+20
| | | | Turn it from a loop into tail-calling itself.
* widget: Move resize function into gtkwidget.cBenjamin Otte2015-10-281-2/+49
| | | | | There's no sizegroup specific code left in it, but lots of widget-specifics.
* widget: Warn on calls to queue_resize() during size_allocate()Benjamin Otte2015-10-281-0/+7
| | | | | | | | This happens way too much, so it's disabled unless GTK_DEBUG=geometry is on. Also, we can't detect it in the call to queue_resize() yet, only during size_allocate(), so the warning comes after the signal emission.
* widget: Clear pending resizes after size_allocate()Benjamin Otte2015-10-281-0/+1
| | | | | This catches the cases where widgets call gtk_widget_queue_resize() in their size_allocate() callback.
* widget: Warn if size-unqueried widgets get allocatedBenjamin Otte2015-10-281-0/+7
| | | | | | Widgets should have gtk_widget_get_preferred_width/height() called on them before gtk_widget_size_allocate() gets called. Add a check for this.
* widget: Add a resize_needed flagBenjamin Otte2015-10-281-0/+12
| | | | | | | | | ... and API to set and unset it. It is set when gtk_widget_queue_resize() is called. It is unset when gtk_widget_get_preferred_width/height() is called. So far it is not used.
* widget: Add a function that does actual resizeBenjamin Otte2015-10-281-3/+5
| | | | It's just shuffling code around.
* widget: Use gtk_widget_queue_allocate() when clip changesBenjamin Otte2015-10-281-2/+5
| | | | There's no need to queue a full resize there.
* API: widget: Add gtk_widget_queue_allocate()Benjamin Otte2015-10-281-3/+25
| | | | | | | This is so widgets can queue a rerun of their allocation logic, but without triggering resizes everywhere. For now, it just calls gtk_widget_queue_resize().
* API: widget: Add gtk_widget_get_allocated_size()Benjamin Otte2015-10-281-0/+41
| | | | See docs for what this is.
* sizegroup: Remove GtkQueueResizeFlagsBenjamin Otte2015-10-281-17/+10
| | | | They were only used with geometry widgets.
* widget: Remove _gtk_widget_override_size_request()Benjamin Otte2015-10-281-46/+0
| | | | The function was only used by the geometry widget.
* widget: Add name to widget pathsBenjamin Otte2015-10-271-0/+1
| | | | | | | | This changes widget paths for widgets with a CSS name to return that CSS name, now that we have added API for it. This means that style properties are now matches using the CSS name. Also fix the theme to use the correct name when matching style properties.
* widget: Always set the type on css nodesMatthias Clasen2015-10-221-4/+3
| | | | | | | | | | See the previous commit for why this is necessary. Also make gtk_widget_class_set_css_name work by looking at the correct class for the name. Note for future reference: GTK_WIDGET_GET_CLASS() does not work in the instance init function.
* Add since tags to new apiMatthias Clasen2015-10-221-5/+9
| | | | gtk_widget_class_set/get_css_name were missing it.
* window: Add gtk_widget_class_set_css_name()Benjamin Otte2015-10-221-1/+46
| | | | This is to replace using class names as CSS names.
* widget: fix typo in warning messagePaolo Borelli2015-10-191-1/+1
|
* Drop some redundant cairo_save callsMatthias Clasen2015-09-291-4/+2
| | | | | | | Almost all callers of _gtk_widget_draw already did their own cairo_save/restore, so drop the save/restore calls inside _gtk_widget_draw and instead fix the last caller, gtk_widget_draw, to do the same.
* Add a few more inlined gettersMatthias Clasen2015-09-281-19/+15
|
* Avoid copying lists during drawMatthias Clasen2015-09-271-55/+66
| | | | | | | | We can use gdk_window_peek_children here, instead of copying the list. Note that we preserve the bottom-to-top ordering by iterating the list from the end. gdk_window_get_children_with_user_data was doing a list reversal while filtering the list.
* Refactor gtk_widget_add_events_internal_listMatthias Clasen2015-09-271-22/+23
| | | | Avoid copying the child window lists. It is not necessary.
* Refactor gtk_widget_set_device_enabled_internalMatthias Clasen2015-09-271-59/+43
| | | | | | Instead of constructing a single list of all windows associated to a widget, just iterate the children lists recursively, avoiding allocations.
* Use stupid quotes instead of dumb quotesMatthias Clasen2015-09-231-10/+10
| | | | | | Following a similar change in GLib a while ago. 'bla' may by stupid, but it looks less dumb than `bla'.
* widget: Add a few more inlined gettersMatthias Clasen2015-09-231-33/+33
|
* size group: Streamline disposalMatthias Clasen2015-09-231-0/+11
| | | | | Remove widgets from their size groups in dispose, without connecting to ::destroy. The signal handler is not necessary.
* widget: get_widget_windows() don't modify window child listsAlexander Larsson2015-09-211-3/+2
| | | | | We can't modify the lists returned from gdk_window_peek_children, instead use get_children().
* widget: Make sure we only run controllers on realized widgetsCarlos Garnacho2015-09-211-0/+3
| | | | | | | | The default event bubbling paths are prone to just running event controllers even after the widget was potentially unrealized/destroyed in an event handler callback, so bail out early if that's the case. https://bugzilla.gnome.org/show_bug.cgi?id=755352
* Revert "gtkwidget: Ensure unrealization during event dispatching cancels ↵Carlos Garnacho2015-09-181-32/+2
| | | | | | gestures" This reverts commit 13873d2c507783042df55ad2c48f37a346121fd0.
* Revert "widget: Fix propagation of gesture cancellation on widget ↵Carlos Garnacho2015-09-181-8/+4
| | | | | | unrealize/destroy" This reverts commit 3aaf730901d04a3e4a102cb95e769a48ec5027e3.
* Revert "widget: Cancel also denied sequences"Carlos Garnacho2015-09-181-0/+3
| | | | This reverts commit 63e255e7b5326888e83bf84f1147012938c81000.
* widget: Cancel also denied sequencesCarlos Garnacho2015-09-161-3/+0
| | | | | | | | | It makes no sense to skip denied sequences here, the gestures are still carrying out the accounting for these, which must be also put to an end if we're possibly not receiving any further events from this sequence. https://bugzilla.gnome.org/show_bug.cgi?id=754098
* widget: Fix propagation of gesture cancellation on widget unrealize/destroyCarlos Garnacho2015-09-161-4/+8
| | | | | | | | | | At the time event_check_cancel_sequence_on_hierarchy() is called, the widget has been already unparented. Given the widget itself is being destroyed, cancellation on it is impending in one way or another, we still must propagate cancellation across all parents, so retrieve it early before possible widget destruction. https://bugzilla.gnome.org/show_bug.cgi?id=754098
* Fix a copy-paste errorMatthias Clasen2015-09-141-1/+1
| | | | | We were notifying can-focus when can-default changes. Unit tests save the day.
* gtkwidget: Do not listen to notifications from nonexistent propertiesCarlos Garnacho2015-09-141-13/+0
| | | | | | | The GtkEventController event mask is private, and set early by GtkGesture implementations. Being this private data, there is no corresponding property, so this code is a no-op, there is just no need to listen to changes there.
* gtkwidget: Ensure unrealization during event dispatching cancels gesturesCarlos Garnacho2015-09-141-2/+32
| | | | | | | | | | | | We use to rely on grab broken events for most of the event sequence lifetime, this breaks though on GDK_BUTTON_RELEASE/GDK_TOUCH_END, as there's no longer a grab at that time. For these cases (and all others where there's destroy/unrealize calls involved during event dispatching), catch this on the late WIDGET_REALIZED_FOR_EVENT calls on widget event handling functions. https://bugzilla.gnome.org/show_bug.cgi?id=754098
* gtkwidget: refactor code into separate functionCarlos Garnacho2015-09-141-15/+23
| | | | | | | This "cancel sequence across widget hierarchy" code will be useful in other places, so take it out to a separate function. https://bugzilla.gnome.org/show_bug.cgi?id=754098
* widget: Call size_allocate vfunc directly when possibleAlexander Larsson2015-09-141-1/+4
| | | | This avoids all the overhead of signal emissions when it is not used.