Commit Graph

917 Commits

Author SHA1 Message Date
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
Stefan Kost
1f3a5a8d92 Clarify key-{press,release}-event docs.
Mention key-repeat in key-press and fix a copy'n'paste in key-release docs.
2011-01-31 23:10:10 +02:00
Matthias Clasen
0208539c4b Remove RC file references from docs where appropriate 2011-01-31 09:34:46 -05:00
Matthias Clasen
5caa76c5df Fix compiler warnings about unused variables 2011-01-30 01:50:58 -05:00
Matthias Clasen
10b6afa1f5 Improve some deprecation notes 2011-01-29 23:09:51 -05:00
Matthias Clasen
f783a75d61 Add a gtkx.h header for X11-specific GTK+ api
This keeps us from pulling gdkx.h into gtk.h

https://bugzilla.gnome.org/show_bug.cgi?id=640902
2011-01-29 14:16:47 -05:00
Carlos Garnacho
8a056d4774 Move "widget/window under device" accounting to be per-widget
This management is better done per-widget rather than per-screen,
as windows being destroyed won't trigger a leave notify for the
devices on top of it, and this information is too transitive
to keep weak refs and such.

This fixes the critical warning seen in gtk/tests/testing.
2011-01-29 14:45:05 +01:00
Tristan Van Berkom
5a5854f6f6 Add default class implementation of gtk_widget_get_request_mode().
Instead of checking if klass->get_request_mode is != NULL from
the gtk_widget_get_request_mode() api, this allows classes to
trust that there is a default implementation and chain up (specifically
added this for gtkmm wrapper objects).
2011-01-28 15:58:07 +09:00
Matthias Clasen
96af68529b Document that gtk_widget_queue_draw_area is in widget coordinates 2011-01-26 18:20:51 -05:00
Carlos Garnacho
e521158973 Make gtk_widget_get_state() only handle GtkStateType values available in 2.x
GtkStateType was generally used as an index in GtkStyle color arrays, so
bigger values will cause invalid memory accesses in widgets that are still
doing that. this was seen in focused GtkIconViews for example
2011-01-25 13:36:13 +01:00
Matthias Clasen
d9fcc4c630 Silence new gcc warnings
gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
2011-01-23 21:51:38 -05:00
Matthias Clasen
a12dad75a2 Split out private style context api into a private header 2011-01-23 18:29:28 -05:00
Carlos Garnacho
b3ba85a01c Simplify GTK_STATE_FLAG_FOCUSED handling in state propagation.
Just unsetting it before propagating to the children suffices.
2011-01-23 19:34:50 +01:00
Carlos Garnacho
0c7772f0cf Do not unset sensitivity mistakenly in gtk_widget_set_state_flags()
together with commit 8903615a34, this finally fixes bug #640282.
Insensitivity is handled separatedly in _gtk_widget_update_state_flags(),
but the insensitive flag is mistakenly unset afterwards if clear is TRUE
in gtk_widget_set_state_flags().
2011-01-23 19:34:44 +01:00
Carlos Garnacho
6e553324f9 Make gtk_widget_get_state_flags() avoid propagating the focused flag down the hierarchy
There is only one widget supposed to have the focused flag at a given time,
so avoid propagating the state down the hierarchy, the focused flag is now
also set in _gtk_widget_set_has_focus().
2011-01-21 15:25:29 +01:00
Pavel Holejsovsky
374e76a19d [GI] Mark unintrospectable constructs as (skip)
Also adds 'Rename to:' annotation to some constructs replacing the
skipped ones.
2011-01-20 13:57:21 +01:00
Pavel Holejsovsky
2fb1c06402 [GI] Add missing (out) and (array) annotations 2011-01-20 13:57:20 +01:00
Pavel Holejsovsky
2f0d40335b [GI] Add missing (transfer) annotations 2011-01-20 13:57:18 +01:00
Pavel Holejsovsky
3c8fc21e9b [GI] Fixes of existing incorrect annotations 2011-01-20 13:56:06 +01:00
Carlos Garnacho
5f43a51a83 Make gtk_widget_get_path() also add all persistent style classes the widget has. 2011-01-17 04:44:03 +01:00
Javier Jardón
46f0994417 docs: gtkwidget: Add some "Since: 3.0" 2011-01-15 16:43:49 +00:00