Commit Graph

1089 Commits

Author SHA1 Message Date
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
Benjamin Otte
27c9352df3 widget: Replace reset_style() calls
... with finer grained _gtk_widget_invalidate_style_context() calls.
2012-04-17 08:59:10 +02:00
Benjamin Otte
969daec353 widget: Don't go via path when resetting style
Instead, invalidate the path when the style context changes. And
invalidate the style context directly.
2012-04-17 08:59:09 +02:00
Benjamin Otte
d589566f40 widget: Add _gtk_widget_invalidate_style_context()
This is supposed to replace gtk_widget_reset_style().
2012-04-17 08:59:09 +02:00
Benjamin Otte
48a8ca8bbe widget: Merge function into only caller 2012-04-17 08:59:09 +02:00
Benjamin Otte
257d961a01 widget: Clear broken widget path in constructor
... where it belongs instead of fiddling with it in get_path().
2012-04-17 08:59:09 +02:00
Benjamin Otte
7f511f2b33 widget: Don't set widget path on style context
Instead, make the style context use the widget's path. Saves a bunch of
memory.
2012-04-17 08:59:09 +02:00
Benjamin Otte
e5ab48ac59 stylecontext: Notify widget directly of changes
This way, we don't need to g_signal_connect(), which saves a bunch of
memory and performance.
2012-04-17 08:59:08 +02:00
Benjamin Otte
1aa4a196dc stylecontext: Add setter for widget
... and actually set the widget on the style context. Note that this
function does not take a reference on the widget, which is a very good
reason to keep it private.
2012-04-17 08:59:08 +02:00
Matthias Clasen
050cba6a31 Fix malformed doc comments
Most of these are forgotten :'s and similar details
which gtk-doc now warns about.
2012-04-12 21:12:16 -04:00
Benjamin Otte
1ca8098543 widget: Create style context using regular API 2012-04-07 13:01:25 +02:00
Benjamin Otte
5d57981184 widget: Set up signals after initializing style context
Otherwise, signals would be emitted on semi set up style context which
would then cause crashes when the signal handlers tried to use them.

https://bugzilla.gnome.org/show_bug.cgi?id=662023
2012-03-09 13:23:05 +01:00
Chun-wei Fan
4e5a8b822d gtkwidget.c: Use G_VA_COPY instead of va_copy()
va_copy() is not universally available, and we already have a G_VA_COPY
macro that emulates the behaviour of va_copy() when it's not available, or
simply calls va_copy() if it's there
2012-03-08 18:56:32 +08:00
Alexander Larsson
2422c44f8e Add custom va_marshallers in some places
This is a slight performance optimization in the common case.
2012-03-05 12:39:09 +01:00
Carlos Garcia Campos
9f4bfff1b0 gtk: Add a way to do event capture
This patch adds a capture phase to GTK+'s event propagation
model. Events are first propagated from the toplevel (or the
grab widget, if a grab is in place) down to the target widget
 and then back up. The second phase is using the existing
::event signal, the new capture phase is using a private
API instead of a public signal for now.

This mechanism can be used in many places where we currently
have to prevent child widgets from getting events by putting
an input-only window over them. It will also be used to implement
kinetic scrolling in subsequent patches.

http://bugzilla.gnome.org/show_bug.cgi?id=641836

We automatically request more motion events in behalf of
the original widget if it listens to motion hints. So
the capturing widget doesn't need to handle such
implementation details.

We are not making event capture part of the public API for 3.4,
which is why there is no ::captured-event signal.
2012-03-01 16:25:21 -05:00
Matthias Clasen
6c257040a5 gtk: translate unhandled touch events to button events
We don't want to fallback for 'random' touch sequences, since
that could lead to all kinds of pairedness and other violations.
Since the X server already tells us what touch events it would
have used for emulating pointer events, we just use that information
here.
2012-03-01 16:25:21 -05:00
Matthias Clasen
680872815b gtk: Add a separate ::touch-event signal 2012-03-01 16:25:20 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Javier Jardón
392fdff8e5 docs: GtkWidget's "state-flags-changed" is a signal not a property 2012-02-15 13:43:58 +00:00
Murray Cumming
a0b4ab109d Documentation: Correct references to properties.
These should use :, not ::, though signals would use ::.
See
http://developer.gnome.org/gtk-doc-manual/unstable/documenting_syntax.html.en
and
http://developer.gnome.org/gtk-doc-manual/unstable/documenting_symbols.html.en
2012-02-15 11:43:33 +01:00
Andrea Cimitan
4a18fe7ef2 Introduce gtk_window_get/set_attached_to()
gtk_window_get/set_attached_to() is a new API that allows for windows to
be attached to a GtkWidget.
The attachment is a logical binding between the toplevel window and the
widget that generated it; this kind of information is currently used to
propagate style information from the widget to the window, but is also
useful e.g. for accessibility.

https://bugzilla.gnome.org/show_bug.cgi?id=666103
2012-01-12 14:03:00 -05:00
Rui Matos
e9adaabc5e Rename 'window-unfocused' to 'backdrop'
'window-unfocused' is too long and mentions "focus" which is historically
loaded with the meaning "input focus".

'backdrop' isn't generally used in GUI speak and still conveys the state the
widgets in an unfocused or background toplevel window are in.
2012-01-09 18:38:00 +01:00
Benjamin Otte
0ac519e8a1 widget: Set parent style context 2012-01-09 18:37:50 +01:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Benjamin Otte
8a83f0c2d1 widget: Print a g_warning() when a cairo_t is invalid
Only print the warning on internal code, so we aren't too verbose.
2011-12-23 00:15:59 +01:00
Rui Matos
cc8012eb32 widget: Set style flags on the style context when the flags are set
This will allow us to simplify most draw methods by not having to explicitly
set the style flags on the context.
2011-12-19 19:21:15 +00:00
Rui Matos
eecbdb6f57 widget: Always propagate state flags to all children
https://bugzilla.gnome.org/show_bug.cgi?id=666126
2011-12-19 19:21:15 +00:00
Matthias Clasen
2398d7e900 Introduce gtkaccelmapprivate.h
Move internal accel map API there and update all users.
Also, add an internal function to create an accel path for
an action and parameter, and use it in gtkapplication.c and
gtkmodelmenuitem.c instead of duplicating that code.
2011-12-19 12:51:11 -05:00
Benjamin Otte
0c1f2f2fc1 widget: Set widget in accessible's constructor
No need to add t manually later.
2011-12-19 16:17:13 +01:00
Benjamin Otte
03a63def24 widget: Unref accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
e042462674 widget: Unset self from accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
23b5f9c066 widget: Unset widget on accessibles 2011-12-19 16:17:13 +01:00
Rui Matos
9d6da33ff5 widget: Flip the sensitive flag even if the state doesn't change
Even if we can't change our sensitivity because the parent is insensitive we
should still flip the sensitive flag. Otherwise, with and insensitive parent,

child.set_sensitive(True)
...
parent.set_sensitive(True)

would result in child still being insensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=666392
2011-12-17 11:48:01 +00:00
Benjamin Otte
94f00eb04d widget: Don't change sensitive state with insensitve parent
This way child.set_sensitive(True) with an insensitive parent doesn't
cause child to become sensitive.
2011-12-16 04:50:11 +01:00
Rui Matos
1235dc320b widget: Synthesize crossing only if sensitivity changed while propagating state 2011-12-14 17:03:44 +00:00
Alexander Larsson
10b5ec20f2 Fix set_focus_child handling during focus changes
In many cases we used to set focus_child to NULL all the way up
to the top and then to the right value, even if there was
a common ancestor, meaning these see a temporary NULL value for
focus_child. Only when the new focus widgets direct parent was
in the previous ancestor list did we stop early.

This fixes that by always stopping propagation when reaching
the common ancestor.
2011-12-14 00:26:40 +01:00
Rui Matos
7a6babfd02 widget: Unset window-unfocused in gtk_widget_unparent()
Widgets without a parent aren't inside a toplevel window so we must remove
window-unfocused as it doesn't make sense outside a toplevel.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-12-07 22:41:58 +00:00
Benjamin Otte
4259a27cf5 widget: Update Pango context on state change
The layout depends on the state flags, so it must be updated when they
change.
2011-12-05 18:27:05 +01:00
Matthias Clasen
7814718152 Drop uses of @returns syntax 2011-11-21 13:12:58 -05:00
Murray Cumming
43dd705308 Fix tiny docs typo. 2011-11-18 11:30:07 +01:00
Benjamin Otte
0b716e77ea widget: Add _gtk_widget_peek_accessible()
This function returns the accessible if it already exists. This way we
can call functions on the accessible from the widget itself instead of
having to rely on signals.
2011-11-16 04:39:23 +01:00
Benjamin Otte
fd93e08a7c widget: Don't use deprecated symbols
Not even in deprecated functions!
2011-11-08 21:14:06 +01:00
Benjamin Otte
d41732b729 widget: Deprecate gtk_widget_get_pointer () 2011-11-08 21:14:06 +01:00
Rui Matos
70f87b8bd5 gtk: Add a GTK_STATE_FLAG_WINDOW_UNFOCUSED widget state flag
This allows themes to style widgets differently according to whether the
toplevel window they are in is presented as focused.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-11-08 19:33:22 +00:00
Matthias Clasen
2de4405c32 Move deprecated gtkwidget style api to gtkstyle 2011-11-02 08:10:42 -04:00
Matthias Clasen
df1e2cd128 Fix more test breakage 2011-10-25 07:38:36 -04:00
Benjamin Otte
b195c7dbb2 a11y: Hack around infinite loops in parent setting
This is kind of a hack to get rid of infinite loops that occur when
child accessibles try to set their parent upon creation but the parent
accessible creates its children in the initialize vfunc. Because in that
case, the parent will not have an accessible set when the child tries to
access it, because it is still initializing itself. Which will cause a
new accessible to be created.

https://bugzilla.gnome.org/show_bug.cgi?id=660687
2011-10-25 07:38:36 -04:00
Michael Natterer
5c4f2ef0c1 gtk: move _gtk_modules_has_mixed_deps() to gtkmodlesprivate.h
and remove gtkmainprivate.h completely.
2011-10-23 13:57:07 +02:00
Michael Natterer
4a7a67339a Bug 659602 - Provide an abstraction for the platform's use of modifier keys
Add enum GdkModifierIntent which identifies use cases for modifier masks
and GdkKeyMap::get_modifier_mask(). Add a default implementation which returns
what is currently hardcoded all over GTK+, and an implementation in the
quartz backend. Also add gtk_widget_get_modifier_mask() which simplifies
things by doing widget->display->keymap->get_modifier_mask().
2011-09-27 09:56:25 +02:00
Matthias Clasen
5ff8fe6971 Documentation fixes
Mostly making sure that return values and varargs don't loose
their docs.
2011-09-25 21:04:49 -04:00
Matthias Clasen
a233022934 Disable underallocation warnings in non-debug builds
It doesn't look like we have much traction of actually fixing
these, and there is very real cost to not being able to distcheck.
2011-08-30 11:28:52 -04:00
Jürg Billeter
c7bcef426b widget: Add transfer annotation for gtk_widget_set_window
gtk_widget_set_window does not add any reference to the window and
unrealize will destroy it.
2011-08-11 12:35:46 +02:00
Matthias Clasen
2ba9c4b4a7 Make focus rectangles optional
This commit introduces a new setting, gtk-visible-focus, backed
by the Gtk/VisibleFocus X setting. Its three values control how
focus rectangles are displayed.

'always' is equivalent to the traditional GTK+ behaviour of always
rendering focus rectangles.

'never' does what it says, and is intended for keyboardless
situations, e.g. tablets.

'automatic' hides focus rectangles initially, until the user
interacts with the keyboard, at which point focus rectangles
become visible.

https://bugzilla.gnome.org/show_bug.cgi?id=649567
2011-08-10 16:34:20 +02:00
Matthias Clasen
2983f3fc14 Update gtk_widget_get_accessible() docs
Don't mention GTK_MODULES for loading a11y implementations
anymore.
2011-07-23 21:28:29 -04:00
Benjamin Otte
9c81336830 widget: Reset the accessible role when a new accessible type is set
We want the role to be kept in the accessible object. Using
gtk_widget_class_set_accessible_role() is only meant as a quick
workaround to requiring subclassing of the accessibles in the quite
common case where a subclass does not change the accessible
implementation at all and only has a different role.
2011-07-18 18:30:50 +02:00
Benjamin Otte
b17ad131ea API: Add gtk_widget_class_set_accessible_role()
Easy access to modifying the roles of subclasses, as this is a thing
that commonly changes for various subclasses.
2011-07-18 18:30:49 +02:00
Matthias Clasen
d8c00cd537 Revert "Add a getter for the accessible type of a widget class"
This reverts commit 9a212b3120.
2011-07-14 19:28:07 -04:00
Matthias Clasen
9a212b3120 Add a getter for the accessible type of a widget class
This will be necessary to port out-of-tree a11y implementations
from the atk object factory approach to this new way of doing
things.
2011-07-13 23:02:25 -04:00
Matthias Clasen
775ccf39e7 Initial conversion of GailWidget to GtkWidgetAccessible 2011-07-05 16:09:57 -04:00
Benjamin Otte
4227a63f48 widget: Use g_type_add_class_private()
It turns out that that funciton does indeed exist and my rant was just
outdated. Shame on me.
2011-07-05 16:08:01 -04:00
Benjamin Otte
ebf8bf0000 API: Add gtk_widget_class_set_accessible_type()
The function is supposed to bypass the ATK registry. For 2 reasons:
1) We get rid of a lot of boilerplate madness.
2) The registry allows creating multiple accessibles per widget and we
   don't.

The old code for registries is still there.
2011-07-05 16:07:57 -04:00
Benjamin Otte
9ebcd66d43 widget: Add a GtkWidgetClassPrivate
As long as glib doesn't provide class privates, we'll have to ship our
own...
2011-07-05 16:07:57 -04:00
Matthias Clasen
f1a9c3efff Remove unused includes
Nothing is using gtkrc.h functionality any more.
2011-06-16 23:33:43 -04:00
Benjamin Otte
76f2aa737b docs: Add Since tag to GtkWidget::draw 2011-06-13 18:29:07 +02:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Javier Jardón
7b0d77def5 gtkcontainer: Move private functions to private header
https://bugzilla.gnome.org/show_bug.cgi?id=651707
2011-06-06 12:10:29 +01:00
Benjamin Otte
c6285387e3 widget: Update the font at the right place
Doing it unconditionally is not useful when the subclasses actually
using them can only ever do it in the style_updated signal. So do it in
the style_updated handler instead.
2011-06-04 21:18:09 +02:00
Benjamin Otte
a6daba5e78 API: Change semantics of gtk_container_get_child_path()
Include the child widget path in the returned path now. This allows
customizing the path of the current widgets - like adding flags to child
widgets (and maybe siblings in the future).
2011-06-02 02:03:50 +02:00
Benjamin Otte
b0616c8225 API: Add gtk_widget_path_append_for_widget()
Includes a bunch of header shuffling so we can use GtkWidget* in
gtkwidgetpath.h
2011-06-02 02:03:50 +02:00
Javier Jardón
fb9e4c2c37 all: avoid boxed structs copying where possible (and 2)
Use the GtkStyleContext accessors for boxed properties where possible,
to reduce allocations.
2011-05-31 19:18:11 +02:00
John Stowers
21761ce5fc Add missing gtk_widget_override_* annotations
https://bugzilla.gnome.org/show_bug.cgi?id=649779
2011-05-09 23:09:26 +12:00
Matthias Clasen
deb271d355 Add gtk_container_child_notify
This is a variant of gtk_widget_child_notify() that takes an
explicit container, instead of relying on widget->parent to
be the correct container to use.
2011-05-06 14:29:14 -04:00
Matthias Clasen
cf588d7404 GtkWidget: avoid an unused variable warning 2011-05-01 10:02:58 -04:00