Commit Graph

937 Commits

Author SHA1 Message Date
Benjamin Otte
92f9892cca widget: Warn when allocation for gtk_widget_size_allocate() is too small
Widgets may not be underallocated, it is the responsibility of the
caller to ensure this never happens.
2011-04-28 05:13:30 +02:00
Benjamin Otte
9bb145a677 widget: Add hack to make label mnemonics work again
Mnemonics for characters that go beyond the baseline (q, y, g) were not
being shown, because they are drawn outside of the label's allocated
size.
This patch just disables the clip-to-size for labels, so that the label
can draw outsize of its allocation. In most cases, that works around
this bug.

https://bugzilla.gnome.org/show_bug.cgi?id=648570
2011-04-26 14:15:34 +02:00
Benjamin Otte
10fd53970c docs: Strictify the docs for gtk_cairo_should_draw_window()
We don't actually enforce the docs, but we will in the future. (in fact,
I only added this because widgets were doing stupid things.)
2011-04-19 22:18:18 +02:00
Benjamin Otte
b5dc24fd28 widget: Make gtk_widget_get_aux_info() private 2011-04-19 22:18:18 +02:00
David King
e279210522 widget: add Since tags for margin accessors 2011-04-18 08:22:54 +02:00
Benjamin Otte
71e9606e16 docs: Fix wrong description for query-tooltip
Coordinates are not relative to widget->window
2011-04-16 22:31:24 +02:00
Matthias Clasen
304989291d GtkWidgetPrivate: Improve struct packing 2011-04-12 12:50:30 -04:00
Benjamin Otte
0bfc95faa3 widget: Propagate the right states to the widget when setting the parent 2011-03-30 16:40:06 +02:00
Benjamin Otte
1e43965350 widget: Get rid of parent_sensitive flag
Instead rely on state_flags & GTK_STATE_FLAG_INSENSITIVE to tell us if a
widget is sensitive.
This has the huge benefit that the way the widget is actually rendered
corresponds to the return value of gtk_widget_is_sensitive().

As a side effect, we do not ever allow unsetting the
GTK_STATE_FLAG_INSENSITIVE for a widget the is set to not be sensitive
(via gtk_widget_set_sensitive()). This way we stop propagation of making
stuff sensitive at insensitive widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=642918
2011-03-30 16:40:06 +02:00
Matthias Clasen
b2f872112a Make GtkWidget::halign RTL-save
This commit makes GTK_ALIGN_START/_END pay attention to
the text direction when used in horizontal context.

This is how similar parameters in GtkMisc and GtkAlignment work,
and is generally expected of GTK+ positioning parameters. And this
is new GTK+ 3 api, so it is basically still unused at this point.

If explicit right/left turn out to be needed at some point, we
can expand the enumeration with new values.
2011-03-30 10:34:02 -04:00
Benjamin Otte
179cec87c8 widget: Only reemit style-set signal after gtk_widget_get_style()
If the widget does not care about the compat code, just ignore it.
2011-03-27 03:44:19 +02:00
Benjamin Otte
9d3465412e widget: Don't invalidate style context in its invalidate callback 2011-03-27 03:39:43 +02:00
Benjamin Otte
bb879b6954 widget: Update path unconditionally in gtk_widget_reset_style()
Also, don't set the new path twice on the style context.
2011-03-27 01:53:04 +01:00
Benjamin Otte
d7ca207133 widget: Don't duplicate style context updates
The screen changes are done in do_screen_change(), the widget path is
updated in gtk_widget_reset_style().
2011-03-27 01:52:16 +01:00
Benjamin Otte
fb65806c8c widget: Call the non-deprecated function
Both functions are identical, just that one isn't deprecated.
2011-03-27 01:51:20 +01:00
Benjamin Otte
fafee4e276 widget: Emit initial style-set signal in the same situations as GTK2
This ensures that widgets that aren't ported and rely on the style-set
signal being emitted work as well as before. They should not rely on
style-set being emitted however.

Note that this function is a no-op if the initial style has been set
already and is very cheap if it has not been set yet. It only becomes
relevant if the resulting style actually gets used.

https://bugzilla.gnome.org/show_bug.cgi?id=639584
2011-03-27 00:48:26 +01:00
Benjamin Otte
af8a6a7abd widget: Create the widget's style lazily
That way we don't have to update the style's colors all the time on
theme changes when the widget is not actually using GtkStyle.
2011-03-27 00:48:26 +01:00
Benjamin Otte
1891b790b3 widget: Don't call gtk_style_attach() and gtk_style_detach() anymore 2011-03-27 00:48:26 +01:00
Benjamin Otte
080ae55e87 docs: Make clear that gtk_widget_set_style() does not do anything 2011-03-27 00:48:26 +01:00
Benjamin Otte
29444cc30e widget: Use a priv variable 2011-03-27 00:48:26 +01:00
Benjamin Otte
2bb64c868c widget: Widgets always have a style, so no need to check for NULL 2011-03-27 00:48:26 +01:00
Benjamin Otte
963c0905f2 widget: Reshuffle code for style context getter
The intention of this patch is to make the code clearer, shorter and
most of all to avoid recreating the widget path and setting it path
twice on the style context when the style context was recreated.
2011-03-27 00:48:25 +01:00
Benjamin Otte
757087e9b4 widget: Don't create the style context if not necessary
If all we want to do is update the context's screen, we don't need to
create it if it doesn't exist yet.
2011-03-27 00:48:25 +01:00
Benjamin Otte
0cdebc8bd5 Revert "Ensure GtkWidget::style-updated is emitted before first size negociation"
This reverts commit b7f772eb93.

The commit just poked around things and added lots of workarounds
instead of actually fixing the bug it set out to fix.

See https://bugzilla.gnome.org/show_bug.cgi?id=639584 for details.
2011-03-26 23:52:28 +01:00
Benjamin Otte
8ce533265e gtk: Reset children styles when changing name
Changing the name of a widget does not just change the current widget's
path, but also the path of all its children.
2011-03-26 23:51:51 +01:00
Tristan Van Berkom
38b5c8cf45 Cache heights-for-range-of-widths instead of height for every width.
This patch optimizes window resizes by assuming that if a widget
has the same height at a width of 50 as with a width of 150, the
height for width 100 will also be the same.

The patch also further optimizes the cache allocator, now there
are 2 pointer arrays of up to a maximum of 5 requests, the arrays
will only be allocated if a request is ever made in that orientation
and the array will be sparse until each request is made (i.e. if a
label can only wrap to 3 lines, there will only be 3 out of a
possible 5 SizeRequest structures allocated to cache it).
2011-03-25 18:42:08 +09:00
Tristan Van Berkom
82ae7b77ca Reduce memory consumption of the size request cache.
This patch makes contextual height-for-width request caching
optional (the contextual cache is not allocated for widgets that
report GTK_SIZE_REQUEST_CONSTANT_SIZE).
2011-03-25 18:42:08 +09:00
Tristan Van Berkom
887142f1f5 Added GTK_SIZE_REQUEST_CONSTANT_SIZE to GtkSizeRequestMode
The constant size request mode defines a request mode where
height-for-width geometry is unneeded, thus optimizing GTK+
by reducing the overall amount of requests that need to be
performed and cached while resizing an interface.
2011-03-25 18:42:07 +09:00
Carlos Garnacho
b7f772eb93 Ensure GtkWidget::style-updated is emitted before first size negociation
Fixes Bug 639584 - initial emission of GtkWidget:style-set is
not happening.

GtkWidget was filtering out ::style-updated (and ::style-set)
emissions until the widget was realized in order to avoid often
useless updates during widget construction and placing.

This is now done instead until the widget has a parent/screen,
which ensures the initial emission happen prior to the first
size negociation, while still filtering out all early emissions
during construction.
2011-03-25 14:33:54 +01:00
Benjamin Otte
9b93ca2848 gtk: Make region argument to gtk_widget_queue_draw_region() const 2011-03-18 16:27:59 +01:00
Benjamin Otte
58f0bc62a9 widget: Don't override state data when recursing to children
Writing onto the passed-in GtkStateData could cause changes that would
propagate to siblings, as the data was not reset again.
By copying the data structure, this is avoided and the proper values are
passed to sibling widgets.
2011-03-17 16:47:48 +01:00
Benjamin Otte
261bcb1ed8 widget: Fix typo in docs 2011-03-17 16:47:48 +01:00
Benjamin Otte
665da2c499 widget: Queue a resize when setting widget to insensitive.
See 015f227776 for details on why this is
necessary.
2011-03-17 11:59:17 +01:00
Cosimo Cecchi
f4930dca55 widget: reset widget style after applying style classes from GtkBuilder
Otherwise, the parsed style classes do not get propagated to the
children.

https://bugzilla.gnome.org/show_bug.cgi?id=644925
2011-03-16 10:52:32 -04:00
Benjamin Otte
015f227776 gtk: Queue a resize after state changes
Lots of style properties - border-width in this case - can change the
size of widgets, so we need to queue a resize instead of just redrawing.
2011-03-11 19:51:25 +01:00
John (J5) Palmieri
cdf69b4bed [gi] add missing annotations for signals that emit Gdk.Events 2011-03-03 16:05:28 -05:00
Matthias Clasen
a3883683e5 Add GtkBuilder custom attributes for style classes
GtkWidget now parses custom attributes like

  <style>
     <class name="dark-label"/>
     <class name="big-heading"/>
  </style>

to add style classes to widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=643347
2011-03-02 20:12:23 -05:00
Tristan Van Berkom
db4fa1a941 Removed unused EXPOSE_EVENT enumeration from the GtkWidget signals. 2011-02-23 22:07:27 +09:00
Tristan Van Berkom
30f03a1c65 Remove mention of GtkWidget::expose-event from docs in gtkwidget.c 2011-02-23 21:58:48 +09:00
Murray Cumming
f91c04e284 Minor documentation improvements
Mostly correcting it's to its and changing some , to .
2011-02-23 10:26:21 +01:00
Matthias Clasen
bdacdfb78b Check if the accessible is actually an AtkAction 2011-02-17 13:29:59 -05:00
Matthias Clasen
49433673fc Don't export GtkModifierStyle symbols
This is not public API, so don't export it.
2011-02-08 23:21:39 -05:00
Matthias Clasen
3a50b460c6 Update the context direction when emitting ::direction-changed
This makes the flipping example in testgtk work as expected again.
https://bugzilla.gnome.org/show_bug.cgi?id=632775
2011-02-07 20:37:09 -05:00
Matthias Clasen
23f9bdd586 Fix problems with state propagation
Sensitivity changes were not properly propagated down the
hierarchy. There were two issues here:

a) correctly identifying when a state change request affects
   sensitivity
b) not filtering out sensitivity in gtk_widget_propagate_state(),
  since gtk_widget_set_sensitivity() uses that to do its work

https://bugzilla.gnome.org/show_bug.cgi?id=641431
2011-02-07 11:27:50 -05:00
Tristan Van Berkom
1c20c93423 Optimize queue_resize_on_widget()
Optimized GtkSizeGroup code that is invoked for every queued resize
and every request that is not previously cached by trading qdata on
widgets for 3 extra bitfields on the GtkWidgetPrivate structure.
2011-02-08 00:39:51 +09:00
Carlos Garnacho
217d3fd796 GtkStyleContext is meant to have a GdkScreen
It is used to get the default providers, without them
the style context can't do much. A check for NULL screen
is done before any sensitive call to
gtk_style_context_set_screen(), in the hope that any widget
will open the display before doing anything related to
styling. Fixes bug #641429, reported by Bastien Nocera.
2011-02-06 11:21:42 +01:00
Matthias Clasen
bfaf472e70 Avoid tons of warnings from stylecontext initialization without screen
This reverts part of commit 4dc9b29.
2011-02-05 11:21:21 -05:00
Matthias Clasen
4dc9b294d8 Don't assume a screen exists before realize()
Fix for https://bugzilla.gnome.org/show_bug.cgi?id=641429
2011-02-04 22:03:11 -05:00
Benjamin Otte
fac914d70c API: gtk: Remove client_event vfunc from GtkWidget
Also remove the (de-facto unused) implementation from GtkWindow that was
only used for sockets/plugs.
2011-02-01 06:33:01 +01:00
Kristian Rietveld
9dcdca2501 Don't use GTK_IS_PLUG for non-X11 backends 2011-02-01 00:26:04 +01:00