Commit Graph

1061 Commits

Author SHA1 Message Date
Matthias Clasen
2379445c1d Correct the documentation for how to set accessible names
The example in the GtkWidget docs was referring to a nonexisting
AtkObject::name property. The correct property name is
accessible-name.
2013-02-10 15:47:14 -05:00
Alexander Larsson
366b4db791 css: Support opacity
https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:38 +01:00
Alexander Larsson
fa8b71450c Add gtk_widget_get/set_opacity
This adds gtk_widget_get/set_opacity, as well as a GtkWidget.opacity
property. Additionally it deprectates gtk_window_get/set_opacity and
removes the GtkWindow.opacity property (in preference for the new
identical inherited property from GtkWidget, which should be ABI/API
compat).

The implementation is using the new gdk_window_set_opacity child
window support for windowed widgets, and cairo_push/pop_group()
bracketing in gtk_widget_draw() for non-window widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01:00
Alexander Larsson
3d4cd4db3e Add gtk_widget_(un)register_window
This replaces the previously hardcoded calls to gdk_window_set_user_data,
and also lets us track which windows are a part of a widget. Old code
should continue working as is, but new features that require the
windows may not work perfectly.

We need this for the transparent widget support to work, as we need
to specially mark the windows of child widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01:00
Benjamin Otte
af176efc0f widget: Another place to relax the visibility requirement
See commit 154204e891 for details
2013-01-26 21:04:55 +01:00
Benjamin Otte
154204e891 widget: Allow invisible toplevels to do sizing operations
This is a quickfix to keep things working.

It turns out GtkWindow assumes it can do sizing operations while not
being visible, or while in the process of show()ing/hide()ing itself.
And commit b495ce54 broke these operations.

Figuring this properly requires some more thinking and restructuring on
my part, so for now we relax the requirement of visiblility enough for
these things to start working again.
2013-01-24 14:28:58 +01:00
Cole Robinson
cbce906228 widget: Add annotation (allow-none) for set_tooltip_text
https://bugzilla.gnome.org/show_bug.cgi?id=691639
2013-01-20 22:03:49 -05:00
Benjamin Otte
ad723bd9a9 widget: Remove leftover debug statement
Seems we didn't hit this very often. :)
2013-01-08 16:10:30 +01:00
Benjamin Otte
b495ce5446 widget: Give some meaning to "visible"
GtkWidget::visible is required for the widget to:
- have a preferred size other than 0/0
- have a size allocated
- return other values than { -1, -1, 1, 1 } from get_allocation()

This is an experimental patch aiming to make concepts and behaviors
inside GTK more concreate. GtkWidget::visible is now essentially what
CSS does for "display: none".

Note that if you want the effect of CSS's "visibility: hidden", you'll
have to use a GtkNotebook with an empty page as the concept of reserving
space but not drawing anything isn't supported natively in GTK.
2013-01-08 14:56:02 +01:00
Benjamin Otte
6b9b925add widget: Fix initial state flags for RTL 2012-12-29 02:33:14 +01:00
Benjamin Otte
3e979d911b widget: Fix state propagation code
Previously, with STATE_FLAGS_REPLACE we would unset _all_ the state
flags on children, not just the ones that do propagate. This caused the
RTL/LTR flags to get lost.
2012-12-29 02:24:27 +01:00
Benjamin Otte
cc986fdc1c widget: Remove underscore prefix from static function 2012-12-29 02:06:51 +01:00
Benjamin Otte
a73cc55e02 stylecontext: Use state flags for direction
... instead of using a custom direction member.

And with that, GtkWidget doesn't need to call
gtk_style_context_set_direction() anymore.
2012-12-18 18:25:42 +01:00
Benjamin Otte
1bf3de223a widget: Set state flags for direction 2012-12-18 18:25:42 +01:00
Benjamin Otte
26186c74c6 API: Add state flags for RTL and LTR
See http://www.whatwg.org/specs/web-apps/current-work/#pseudo-classes
for the rationale.
2012-12-18 18:25:41 +01:00
Alexander Larsson
bf35c2f044 GtkLabel: Rely on the new pango support for context change tracking
Now that Pango tracks changes to the context automatically there is
no need to do it manually in e.g. style-updated or direction-changed,
in fact the only case we have to care about is when we re-create
the PangoContext due to a screen change, so we only have to clear
the layouts in GtkLabel in screen-changed.

This means we're not clearing all the layouts whenever the state changes,
which happens to every widget when the window is unfocused, which helps
performance a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=340066
2012-12-06 19:54:05 +01:00
Benjamin Otte
055b5d83d5 gtk: Use gtk_style_context_get()
... instead of soon-to-be-deprecated gtk_style_context_get_font().
2012-12-06 02:57:18 +01:00
Alexander Larsson
cd016ef8e3 Revert "Don't queue resize for hidden widgets without a size group"
This seems to break redraw of the middle pane in glade.

This reverts commit faaae520c9.
2012-12-04 21:30:04 +01:00
Alexander Larsson
faaae520c9 Don't queue resize for hidden widgets without a size group
queue_resize basically tells the parent widget that it may need
to pick a different size/layout. However, for a hidden child widget
that should never be needed. It may be that the widget is in a
sizegroup that has ignore_hidden == FALSE though, so it may
affect the size group calculations.

However, if a widget is not visible and not in a size group then
its safe to avoid the resize, as the widget will be resized on
becoming visible anyway.

This avoids a lot of size allocation for hidden things like menus
and tooltips.
2012-12-04 20:16:44 +01:00
Alexander Larsson
47714f55ee css: Avoid queue_resize in _gtk_widget_style_context_invalidated
We've already emitted style_updated, and the handler for that queues
a resize if necessary.
2012-12-04 20:16:44 +01:00
Benjamin Otte
35362337ec widget: Optimize away unndeeded redraws
If only styles were updated that don't require resizes, don't queue one.
2012-11-30 20:40:18 +01:00
Matthias Clasen
e75860e466 Add a missing va_end call
va_copy must be matched with va_end.
2012-11-29 23:18:49 -05:00
Benjamin Otte
da7a4089fe widget: Remove an unneeded queue_resize()
Resizes are queued via
   gtk_widget_propagate_state()
=> gtk_style_context_set_state()
=> gtk_style_context_queue_invalidate()
=> gtk_style_context_validate()
=> _gtk_widget_style_context_invalidated()
so there's no need to queue an extra one.
2012-11-25 04:46:36 +01:00
Benjamin Otte
4f9a8e6b3d symboliccolor: Remove extra includes
That header was included in way too many places.
2012-11-25 02:59:15 +01:00
David King
e677cee28f docs: Correct GtkWidget::scroll-event mask documentation
Since GTK+ 3.3.18, GDK_SCROLL_MASK has been used as the mask for scroll
events. Update the documentation to reflect this.

https://bugzilla.gnome.org/show_bug.cgi?id=677339
2012-11-22 21:36:40 +00:00
Benjamin Otte
14c8e33ab9 widget: Get rid of unused flags
Now that we clear the cache immediately, there's no need anymore to
track if a request has been queued.
2012-11-14 01:55:28 +01:00
Benjamin Otte
4366f80aab sizerequestcache: Move functions
... into the sizerequestcache.c file.
2012-11-14 01:55:28 +01:00
Benjamin Otte
0a1a2ac148 sizerequest: Split out size request cache code into separate header 2012-11-14 01:55:28 +01:00
Benjamin Otte
8bdff7a564 sizegroup: Construct the set of sizegroup peers as a hash table
This way we don't need a marker on GtkWidgetParivate that needs to be
unset later, so we have all our data in the same place and can avoid
problems with reentrancy and shenanigans like that.

But the main reason I wrote that is cleaner code.
2012-11-04 15:47:03 +01:00
Benjamin Otte
dd6931d1ba sizegroup: Use _gtk_widget_compute_size_for_orientation()
With this function now available, we can do size computation in 2
ways:
(1) Compute size with size groups
(2) Compute size without size groups

And have (1) use (2) instead of setting flags on widgets. This patch
does exactly that.
2012-11-04 15:28:43 +01:00
Benjamin Otte
48ff2fc7ed API: Add gtk_widget_is_visible()
This is a recursive gtk_widget_get_visible(): Returns TRUE if the widget
and all its parents are visible.
2012-11-04 15:24:17 +01:00
Tristan Van Berkom
8705c59f8c Amended documentation for gtk_widget_set_size_request().
It seems we missed updating this since GTK+3, widgets cannot be
allocated less than the size they requested in thier request
phase, and explicit sizes are used only to grow the size request.
2012-10-02 23:11:39 +09:00
Benjamin Otte
1e0fe40560 widget: Move style context update out of vfunc
Otherwise the evil widgets that don't chain up their map and unmap
vfuncs will not get updated style contexts. This is in particular true
for GtkWindow and the CSS Theming / animated backgrounds demo in
gtk-demo.
2012-10-01 15:53:17 +02:00
Benjamin Otte
7712d41b5e stylecontext: Refactor the way animations are started and stopped
We now create animation objects unconditionally, but we only run the
animation loop when gtk_style_context_should_animate() return TRUE.
2012-09-17 20:40:01 +02:00
Benjamin Otte
206aa209ae widget: Use gtk_widget_queue_draw() for queueing redraws
This change is necessary because the old code did not accound for corner
cases (like translucent child windows), which could stop
gtk_widget_queue_resize() to not trigger redraws.
2012-09-17 20:39:12 +02:00
Matthias Clasen
78c44d31d3 Small tweaks to the DND docs
As pointed out by Columban Wendling in
https://bugzilla.gnome.org/show_bug.cgi?id=684096,
the GtkWidget DND docs were referring to several drag context
members that are private, nowadays.
2012-09-15 16:17:03 -04:00
Carlos Garnacho
1f7e375c33 Add GtkTextHandle
This is a helper object to allow text widgets to implement
text selection on touch devices. It allows for both cursor
placement and text selection, displaying draggable handles
on/around the cursor and selection bound positions.

Currently, this is private to GTK+, and only available to
GtkEntry and GtkTextView.
2012-09-03 00:19:03 -04:00
Ryan Lortie
828a97d773 GtkWidget: fix insert_action_group(NULL)
gtk_widget_insert_action_group (widget, "foo", NULL) is valid, but
g_action_muxer_insert (muxer, "foo", NULL) is not.  Use
g_action_muxer_remove() for that case.
2012-08-23 08:18:11 -04:00
Matthias Clasen
79eeb78c46 Fix the doc build 2012-08-20 23:38:03 -04:00
Lars Uebernickel
d30d56452c GtkWidget: Add gtk_widget_insert_action_group()
This allows adding a GActionGroup with a given name at an arbitrary
point in the widget tree.

This patch also adds an internal _get_action_muxer() API.  Calling this
will create a GActionMuxer associated with the widget.  The parent of
the muxer will be the muxer of the widget's conceptual parent.  For
non-menus, that is the normal parent.  For menus, it is the attach
widget.

In this way, we end up with a hierarchy of GActionMuxer that largely
reflects the hierarchy of GtkWidget, but only in places that the action
context has been requested.  These muxers are the ones on which the
inserted actions groups are installed.

A following patch will add a user of this API.
2012-08-20 13:09:04 -04:00
Frédéric Péters
9399275089 doc: fix location of ATK documentation (GNOME bug 682193) 2012-08-19 19:07:22 +02:00
Philip Withnall
f92a092bac Bug 680822 — Document return value of GtkWidget::draw
Document the boolean accumulator used by GtkWidget::draw and a few other
GtkWidget signals.

Closes: https://bugzilla.gnome.org/show_bug.cgi?id=680822
2012-07-30 16:12:06 +02:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Cosimo Cecchi
8ff9770c7f widget: silence g-i scanner warning
The parameter should be named the same in the definition and the
declararion.

https://bugzilla.gnome.org/show_bug.cgi?id=677127
2012-06-25 14:49:11 -04:00
Benjamin Otte
9b47bc5c95 widget: don't call gtk_style_context_set_background if app_paintable
When a widget is app_paintable, its background should not be drawn by
the theme, thus we should not try to override its background again when
style-updated is fired.
This is a bit of a hack, but it fixes gray surfaces observed for DnD
windows with recent GTK+.
2012-06-18 10:33:42 -04:00
Benjamin Otte
17ccbe4843 container: needs_resize is a container flag, not a widget flag
The widget flag is alloc_needed, needs_resize is used for "is queued
into the container resize queue".
2012-04-17 08:59:23 +02:00
Benjamin Otte
1d54e4e867 widget: Set .default class when widget is default
Don't just conditionally set it on buttons.
2012-04-17 08:59:22 +02:00
Benjamin Otte
fe89e710ea stylecontext: Add public API to stop animations
... and use it.

Of course, there still are no animations, so we don't turn anything off
yet.
2012-04-17 08:59:22 +02:00
Benjamin Otte
33f111a47c widget: Don't cache widget paths all the time
Add an internal API that allows GtkStyleContext to create a widget path
for the widget and with that bypassing gtk_widget_get_path() and that
  function caching the path.
2012-04-17 08:59:21 +02:00
Benjamin Otte
04c5fdaca6 css: Remove old animation code
Deprecate public API where appropriate and make it no-ops.
Remove all calls to it.
Get rid of the 'transition' css property.

For now, this means spinners don't animate anymore.
2012-04-17 08:59:19 +02:00