Commit Graph

18588 Commits

Author SHA1 Message Date
Tristan Van Berkom
11be64d3fe GtkComboBoxText: Improved GtkBuildable documentation.
Also removed a bogus FIXME comment which might have been true
a long time ago. Clarification: the "domain" attribute specified
in the builder script overrides any domain previously set with
gtk_builder_set_translation_domain(), so the translation of items
here is perfectly correct and does not need to be fixed.
2013-05-12 21:56:40 +09:00
Matthias Clasen
42ee21e34c Make gtk_window_resize work again
This hunk of code was lost by accident in the previous commit.
2013-05-11 19:44:57 -04:00
Matthias Clasen
fc10ee8d4a GtkWindow: default size is only for initial map
Bring back need_default_size. We need it to preserve this
documented behavior:

The default size of a window only affects the first time a window is
shown; if a window is hidden and re-shown, it will remember the size
it had prior to hiding, rather than using the default size.

With this patch, all of the window sizing tests in
gtk/tests/window pass again.
2013-05-11 18:49:51 -04:00
Benjamin Otte
689905c1b4 widget: make gtk_widget_compute_size_for_orientation() static
It's not used anywhere outside of gtksizerequest.c anymore.
2013-05-11 15:11:53 +02:00
Benjamin Otte
bd4d00918e API: Don't export gtk_widget_preferred_size_and_baseline()
gtk_widget_preferred_size() is only useful if you want to quickly port a
widget from GTK2 sizing code to GTK3 but does not properly work with
height-for-width as used in GTK. So we don't want to encourage people to
use it. In particular we want people to convert to height-for-width
before adding baseline support to their widgets.
2013-05-11 14:48:01 +02:00
Matthias Clasen
31fd014c93 Add more window-size related tests 2013-05-10 13:55:00 -04:00
Colin Walters
33f6730249 GtkBookmarksManager: Only save if we have data to save
Otherwise we write an empty file, which is lame.
2013-05-09 16:48:38 -04:00
Colin Walters
4f01c0b159 GtkBookmarksManager: Ensure parent directory exists when saving
Otherwise we fail when the user doesn't have ~/.config yet.
2013-05-09 16:48:03 -04:00
Benjamin Otte
20e8675106 widget: Remove unused variable 2013-05-09 19:09:50 +02:00
Benjamin Otte
ecaf09c918 build: remove --disable-rebuilds
It's unused and was only useful when perl wasn't installed. But perl is
a dependency of glib these days, so it's useless.
2013-05-09 19:09:50 +02:00
Matthias Clasen
1800dc4709 Remove gtk_widget_size_allocate from gtk_menu_popup_for_device
GtkMenu calls gtk_widget_size_allocate on its GtkWindow during
gtk_menu_popup_for_device if the menu has not been realised. This can cause the
allocation of the GtkWindow and the size of the GdkWindow to become out of sync
because a top level GtkWindow does not attempt to re-size the GdkWindow when
its allocation is set.
https://bugzilla.gnome.org/show_bug.cgi?id=695120
2013-05-09 12:06:05 -04:00
Ryan Lortie
434dfc20c7 GtkCheckMenuItem: remove an unused boolean field
always_show_toggle was always set to TRUE in _init() and never changed
from anywhere else.  Remove it and remove the if() statements based on
it.

https://bugzilla.gnome.org/show_bug.cgi?id=699929
2013-05-09 12:04:41 -04:00
Stefan Sauer
a725b06363 label: fix return value type for _draw()
Change from gint to gboolean.
2013-05-08 22:05:56 +02:00
Matthias Clasen
c77e12a215 Make key themes work again
This was inadvertedly broken in commit
44ba5d253f.
Thanks to Matthew Francis for tracking this down and providing
a fix in https://bugzilla.gnome.org/show_bug.cgi?id=699901
2013-05-08 10:21:36 -04:00
Alexander Larsson
bb7054b508 overlay/paned: Ensure we set the right visual on windows
This was always "needed", but the problems with not doing it
now are worse, since any CSD window will have a nonstandard
rgba visual.
2013-05-08 15:51:00 +02:00
Rico Tzschichholz
d08d7f2c5a Remove abi checking scripts (2)
In addition to 019ad96479
2013-05-07 17:34:32 +02:00
Alexander Larsson
8ae7defad5 GtkPixelCache: Free cache if not used in 20 seconds
No need to keep a performance enhancing cache around if its not
actually in use.
2013-05-07 16:40:24 +02:00
Alexander Larsson
e2c8a95af6 GtkStack: Fix double-draw in crossfade
We should only draw the cross-fade on the bin window, not doing this
was causing us to draw it multiple times using ADD which resulted
in weird colors.
2013-05-07 16:40:24 +02:00
Alexander Larsson
0600d3d7e4 GtkWidget: Use gdk_window_get_children_for_user_data
This makes iterating over the children a lot faster, as we're
not doing lots of intra-library calls and type checks. We're still
in some sence O(n^2) since we iterate over each child window for each
widget, but the profiles look much better.
2013-05-07 16:40:24 +02:00
Alexander Larsson
cad751c762 GtkTreeView: port to PixelCache
We register an invalidate handler on the bin window to get told
of child widget invalidations, although we manually need to discard
invalidates from the scroll operation.

Additionally we invalidate all of the pixel cache whenever
the TreeView itself is queue_draw()n to handle e.g. style (bg)
changes, or changes due to model changes causing queue_draw() in
the tree view.
2013-05-07 16:34:05 +02:00
Alexander Larsson
2df27ce7f8 Make GtkViewport use GtkPixelCache
Since gdk_window_move() no longer uses XCopyArea all scrolling
now re-renders everything in the window. To get performance
back we use a GtkPixelCache to store already drawn children,
and we when we expose the viewport we just blit the
offscreen to the right place.
2013-05-07 16:34:05 +02:00
Alexander Larsson
dde714386d GtkPixelCache: Add debug feature to track redraws
Each time we redraw we tint it in a different color so that
you can see which regions are redrawn.
2013-05-07 16:34:05 +02:00
Alexander Larsson
30dc399b72 Add GtkPixelCache
GtkPixelCache is a helper utility that lets you implement
faster scrolling of a viewport of a canvas by using an
offscreen pixmap cache.

You call _gtk_pixel_cache_draw with a callback function that
does the drawing, and additionally you specify the size and the
position of the viewport in the widget, and the position and size
of the canvas wrt the viewport. The callback will be called to
draw on an offscreen surface, and the surface will be drawn
on the window. The next time you do the same, any already drawn
pieces of the surface are re-used from the offscreen and need
not be rendered again.

If things inside the canvas change you need to call
_gtk_pixel_cache_invalidate to tell the cache about this.

Some other details:

* The offscreen surface is generally a bit larger than
  the viewport, so scrolling a small amount can often
  be done without redrawing children.
* If the canvas is not larger than the viewport no
  offscreen surface is used.

GtkPixelCache: Make sure we always copy using SOURCE

We were using OVER for the first copy (from source to group surface.

GtkPixelCache: Fix x/y typos

GtkPixelCache: Allow NULL for invalidate region

gtkpixelcache: Use CONTENT_COLOR for solid bg windows
2013-05-07 16:34:05 +02:00
Alexander Larsson
cb2882a273 GtkWidget: Add a vfunc for queue_draw_region
Since widgets now cache drawn state we allow them to override
queue_draw_region to detect when some region of the widget
should be redrawn. For instance, if a widget draws the
background color in a pixel cache we will need to invalidate
that when the style context changes which queues a repaint.
2013-05-07 16:34:05 +02:00
Alexander Larsson
6c7689506f GtkWindow: Move cairo_save/restore from marshaller
We do the save/restore when emitting ::draw rather than in a custom
marshaller, as this saves an extra stack frame, which is helpfull now
that we do painting fully recursive. This is also likely to save a few
cycles.
2013-05-07 16:33:01 +02:00
Alexander Larsson
d22fd7223c Only handle exposes on native window, propagate to children via draw()
We now consider non-native windows non-opaque, which means any invalid
area in a subwindow will also be invalid all the way up to the nearest
native windows. We take advantage of this by ignoring all expose events
on non-native windows (which typically means just the toplevel) and instead
propagating down the draw() calls to children directly via
gtk_container_propagate_draw.

This is nice as it means we always draw widgets the same way, and it
will let us do some interesting ways in the future.

We also clean up the GtkWidget opacity handling as we can now always
rely on the draing happening via cairo.

We can't really just draw by walking down the widget hierarchy, as
this doesn't get the clipping right (so e.g. widgets doing cairo_paint
may draw outside the expected gdkwindow subarea) nor does it let
us paint window backgrounds.

So, we now do multiple draws for each widget, once for each GdkWindow,
although we still do it on the same base cairo_t that we get for the
toplevel native window. The difference is only the clipping, the rendering
order, and which other widgets we propagate into.

We also collect all the windows of a widget so we can expose them inside
the same opacity group if needed.

NOTE: This change neuters gtk_widget_set_double_buffered for
widgets without native windows. Its impossible to disable
the double buffering in this model.
2013-05-07 16:33:01 +02:00
Matthias Clasen
e9122eca68 Add more test cases
These are taken from
https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-05-07 08:54:05 -04:00
Benjamin Otte
a0aa367458 checkbutton: Implement height-for-width 2013-05-07 14:06:11 +02:00
Benjamin Otte
4ea26b619b checkbutton: Split out a common function
Makes size request / allocation code easier to understand.
2013-05-07 14:06:11 +02:00
Kalev Lember
34c0deb006 GtkPlacesSidebar: Fix an uninitialized variable in the error code path
Initialize it to NULL early so that we won't try to free an
uninitialized variable when handling an error.
2013-05-07 14:01:54 +02:00
Kalev Lember
19e6db7997 gtksizegroup: Add explicit braces to avoid dangling else
Otherwise the else after the for loop becomes attached to the wrong if.
2013-05-07 13:59:53 +02:00
Matthias Clasen
1391a0be1c Add a testcase for the dnd window breakage 2013-05-07 06:11:42 -04:00
Matthias Clasen
019ad96479 Remove abi checking scripts
The exported symbols are now controlled explicitly from the headers,
no need to double-check.
2013-05-07 06:01:18 -04:00
Alexander Larsson
c6a5b800c2 GtkEventBox: Correctly handle height for width
We need to pass on the width to the child.

https://bugzilla.gnome.org/show_bug.cgi?id=699140
2013-05-06 17:49:58 +02:00
Alexander Larsson
dcb84f158b css shadow: Add extra slop to the blur clipping
Turns out our blurring function isn't very nice, it has a lot
of energy past the blur radius, so clipping at exactly the
blur radius causes ugly gradient stops. This just adds 4
extra pixels of slop, which makes this better in most cases.
2013-05-06 16:20:04 +02:00
Alexander Larsson
66d3b5a9cd css shadows: Split up rendering of shadows
We split up the rendering of blurred shadows into 9 parts, the
corners, the sides and the rest. This lets us only blur the "blurry"
part, and it lets us completely skip blurry parts that are fully
clipped.
2013-05-06 16:20:04 +02:00
Alexander Larsson
5ba5306dc9 css shadows: Exit early if clip is empty 2013-05-06 16:20:03 +02:00
Alexander Larsson
70774bf978 GtkCssShadowValue: Break out the shadow rendering code
This makes it easier to call it multiple times which we
want to do later.
2013-05-06 16:20:03 +02:00
Alexander Larsson
c91e706e2b css: Clip outset box-shadow to outside of box
As per css3-background 7.2. Drop Shadows: the ‘box-shadow’ property:

  An outer box-shadow casts a shadow as if the border-box of the element
  were opaque. The shadow is drawn outside the border edge only: it
  is clipped inside the border-box of the element.

Also verified vs firefox behaviour.
2013-05-06 16:20:03 +02:00
Stef Walter
ed1eddabf0 gtksettings: Fix loading of uint settings
https://bugzilla.gnome.org/show_bug.cgi?id=699739
2013-05-06 14:20:48 +02:00
Matthias Clasen
ec724fe0fd Remove regex-based export control
All export control is now happening through annotations
in the headers.
2013-05-05 15:38:48 -04:00
Matthias Clasen
92597da3a0 Add visibility flags in gtk/a11y 2013-05-05 15:38:48 -04:00
Matthias Clasen
feedd371f6 New visibility handling in gtk 2013-05-05 15:38:48 -04:00
Matthias Clasen
f5f5b70355 Ignore deprecations where needed
There are a few places where we are still using deprecated
API internally - ignore deprecations around these uses.
2013-05-05 15:38:48 -04:00
Matthias Clasen
7d8e755d16 Fix up headerless symbols
Some symbols are exported from GTK+, but do not appear in any
headers. For these, use _GDK_EXTERN in the source file to make
sure they are exported.
2013-05-05 15:38:47 -04:00
Matthias Clasen
4cec2337ab Add annotations in a11y headers 2013-05-05 15:38:47 -04:00
Matthias Clasen
20c8c8b91c Add annotations to gtk headers
Add annotations to all exported functions in GTK+ headers.
2013-05-05 15:38:47 -04:00
Matthias Clasen
8470eb84c0 gtk: Use GDK_AVAILABLE_IN_ALL for generated enum types
glib-mkenums is not currently clever enough to know which version an
enum type was added in, so just mark all the _get_type() functions as
available in all versions.
2013-05-05 15:38:47 -04:00
Matthias Clasen
28fb54256b Just ignore deprecations inside deprecated/
Not worth tracking uses of deprecated API individually here.
2013-05-05 15:38:47 -04:00
Matthias Clasen
111cc604f5 Remove an unused private function
_gtk_text_layout_get_line_xrange was not exported and not used
inside GTK+ either.
2013-05-05 15:38:46 -04:00
Matthias Clasen
3b4804bbf1 Always use gint for border_width
This avoids an evil trap when doing MAX (..., ... - 2 * border_width)
and the expression on the right gets promoted to unsigned, instead
of going negative as you would expect.
https://bugzilla.gnome.org/show_bug.cgi?id=699633
2013-05-04 19:21:56 -04:00
Ignacio Casal Quinteiro
38688cad00 window: handle titlebar property for the buildable interface 2013-05-04 23:04:55 +02:00
Matthias Clasen
96e0d9db72 Some window size test tweaks
Draw a checkerboard pattern, and add an interactive mode that
waits for events before moving on. This makes it easier to see
when a size is wrong.
2013-05-04 16:16:20 -04:00
Matthias Clasen
7fd0836567 Add some more GtkWindow tests
These tests check that a toplevel window ends up with the expected
size after setting default sizes or resizing. It currently passes
on X, but fails with client-side decorations under X and Wayland.
2013-05-04 16:16:11 -04:00
Matthias Clasen
ed5ef04127 Fix setting child properties
This was broken in e9f182e37a
2013-05-03 22:29:20 -04:00
Matthias Clasen
97caad1fec Don't clear data on a NULL screen
This makes GtkSettings survive the object finalize test.
2013-05-03 20:05:00 -04:00
Stefan Sauer
b8366027b3 widget: fix two typos in api-docs 2013-05-03 20:40:00 +02:00
Guillaume Desmottes
c15a7877e9 treemodelsort: destroy the root only if we are removing the latest row of the level
GtkIconView doesn't ref the rows of the model so we have to make sure that a
level is actually empty before destroying it.

https://bugzilla.gnome.org/show_bug.cgi?id=698846
2013-05-03 13:06:08 +02:00
Matthias Clasen
2b6c684569 Make it possible to finalize theming engines
This was broken since forever. Good that we never finalize
theme engines...
2013-05-02 21:36:45 -04:00
Matthias Clasen
c538bdc7dc GtkInvisible behaves like GtkWindow
As far as refcounting is concerned, invisibles are like
windows: you have to destroy them.
2013-05-02 20:43:34 -04:00
Matthias Clasen
b980057764 Only check for finalization after a grace period
This makes the file chooser pass this test
2013-05-02 20:42:24 -04:00
Matthias Clasen
1afca5510a Prevent a segfault if GtkAppChooserDialog gets disposed early
If the async call is finished after the dialog is already disposed,
bad things happen. Prevent that by marking the dialog as dismissed
in this case.
2013-05-02 20:00:49 -04:00
Benjamin Otte
01c810b4d7 gdk: Remove new gdk_display_manager_peek() API
It's not necessary anymore because gdk_display_manager_get() always
succeeds and the value is independant of when it was called as it's no
longer backend specific.
2013-05-02 16:27:47 +02:00
Benjamin Otte
43e6b3aa03 window: Handle attach widget disappearing without weak pointers
Fixes the window not emitting a "notify::attached-to" signal when the
attach-widget goes away.
2013-05-02 16:26:37 +02:00
Benjamin Otte
7cecc8e524 a11y: Remove AtkSelection implementation from combobox
AtkSelection requires that the immediate children of the object are the
selectable items. The combobox however is implemented with just 1 child:
The popup menu.

The popup menu is implementing the selectable interface.

Test are updated to reflect this change.
2013-05-02 15:31:26 +02:00
Matthias Clasen
c6894cd606 Try this again
When the hostnamed call is cancelled, we get a G_IO_ERROR_CANCELLED
error back. Handle it properly.
2013-05-02 09:29:35 -04:00
Matthias Clasen
f7f63ae3ee Revert "Remove a superfluous ref"
This reverts commit f326c0eac8.

Grr, turns out that cancelling is not that reliable :-(
2013-05-02 08:23:58 -04:00
Matthias Clasen
117c86d08a Clear list of attached windows when disposing a widget
We were silently relying on everybody to detach their windows,
and would leak memory otherwise.
2013-05-02 08:02:40 -04:00
Matthias Clasen
fb08a26acd GtkWindow: use a weak ref to keep track of attach_widget
Taking a full reference of the attach widget creates a reference
cycle, and keeps the attach_widget alive longer than it should.
2013-05-02 08:01:14 -04:00
Matthias Clasen
f326c0eac8 Remove a superfluous ref
If we cancel the call in dispose, no need to ref the object
we pass as userdata. Avoids the risk of leaking the ref if
the call is actually canceled.
2013-05-02 05:53:40 -04:00
Matthias Clasen
4dc01aca43 Fix build 2013-05-02 05:37:58 -04:00
Matthias Clasen
e399798da8 Revert "Disable the filechooser template tests"
This reverts commit 17b9733372.
2013-05-01 22:22:22 -04:00
Matthias Clasen
8eeb379f7c Revert "Disable the object-finalize test for now"
This reverts commit a021dc793c.
2013-05-01 22:22:09 -04:00
Matthias Clasen
0d49b97fce Silence a compiler warning 2013-05-01 21:35:39 -04:00
Matthias Clasen
210451e86f Minor doc comment fix 2013-05-01 21:27:06 -04:00
Matthias Clasen
3f397d6b38 Make gtkplacessidebar.h look like a gtk header 2013-05-01 21:23:55 -04:00
Matthias Clasen
2f0a5dd541 GtkPlacesSidebar: Correct all since tags 2013-05-01 21:19:37 -04:00
Benjamin Otte
327a164744 paned: Fixup recent commit
d90e3670ce had a bunch of embarrassing
bugs.

Fixes paned-undersized reftest.
2013-05-01 23:26:27 +02:00
Benjamin Otte
61f47829ba tests: Comment out unused functions 2013-05-01 17:46:50 +02:00
Benjamin Otte
2d29c4a43f window: last size is more important than default size
reorder size computation code to reflect that.

https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-05-01 16:41:12 +02:00
Benjamin Otte
01f7ed1d07 window: Deprecate gtk_window_reshow_with_initial_size() 2013-05-01 16:41:12 +02:00
Benjamin Otte
d90e3670ce paned: Correctly compute child sizes in size requests 2013-05-01 16:41:12 +02:00
Benjamin Otte
6146bf7a32 gtkprivate: #define OPPOSITE_ORIENTATION
and use it
2013-05-01 16:41:11 +02:00
Benjamin Otte
ea98c61f3c paned: Split size request code
The code is pretty different for both cases, so better split things
here.
2013-05-01 16:41:11 +02:00
Benjamin Otte
9c2eb4f233 paned: Split out a function 2013-05-01 16:41:11 +02:00
Benjamin Otte
cb99cd2052 button: Rework size request/allocation code
- Split out a common function
- Implement hfw properly.
2013-05-01 16:41:11 +02:00
Benjamin Otte
41e8d3df6d widget: Improve debug output 2013-05-01 16:41:11 +02:00
Benjamin Otte
01fe4ce7f4 button: Use _gtk_widget_get_preferred_size_for_size()
This was accidently lost when merging baseline support.
2013-05-01 16:41:11 +02:00
Benjamin Otte
1349292e47 widget: Adapt _gtk_widget_get_preferred_size_for_size()
... for baseline support byu taking two extra (possible NULL) arguments.
2013-05-01 16:41:11 +02:00
Matthias Clasen
17b9733372 Disable the filechooser template tests
The places sidebar breaks the finalization checks in these tests
https://bugzilla.gnome.org/show_bug.cgi?id=699393
2013-05-01 10:28:53 -04:00
Matthias Clasen
a021dc793c Disable the object-finalize test for now
GtkPlacesSidebar breaks this:
https://bugzilla.gnome.org/show_bug.cgi?id=699393
2013-05-01 10:28:03 -04:00
Matthias Clasen
032636f3ea Add missing symbols 2013-05-01 10:27:48 -04:00
Hib Eris
4dcd49352b Revert "Don't build gtk-launch when gio-unix is not available"
The gtk-launch tool can be build without gio-unix (although it
will not really do much without an alternative implementation for
g_desktop_app_info).

So there is no need to not build gtk-launch anymore.

This reverts commit 9a1235bf0d.

https://bugzilla.gnome.org/show_bug.cgi?id=682824
2013-05-01 07:39:36 +02:00
Matthias Clasen
f47e578737 Fix a typo
Modifed should be Modified.
https://bugzilla.gnome.org/show_bug.cgi?id=699225
2013-04-29 13:08:18 -04:00
Alexander Larsson
8cb78d82d6 gtksizerequestcache: Fix typo that lead to crash/leak
We were checking for cache->requests_x but freeing cache->requests_y
which could cause a crash/leak.
2013-04-29 18:17:02 +02:00
David King
59c3e7bfe8 docs: Add GtkWidget::show,hide,map,unmap,realize,unrealize
Add gtk-doc comments for several signals on GtkWidget.

https://bugzilla.gnome.org/show_bug.cgi?id=688896
2013-04-29 07:23:46 +01:00
David King
402985077b docs: Add (inout) to requisition of gtk_menu_item_toggle_size_request()
https://bugzilla.gnome.org/show_bug.cgi?id=675571
2013-04-29 07:18:54 +01:00
Matthias Clasen
e9f182e37a Fix a few memory leaks wrt to translations
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=699016
The fix here is slightly different. We make
_gtk_builder_parser_translate return a const char * instead of
a dup'ed string, and fix up the callers.
2013-04-28 21:43:49 -04:00
Matthias Clasen
13858fde29 GtkGrid: Undo a size allocation tweak
Revert 5e1a06d1b1

This change caused empty rows to 'open up', which was not
intended and causes problems as seen in bug 698660.
2013-04-28 18:46:41 -04:00
Matthias Clasen
1f17efb81c Add some tests for GtkWindow
These tests may have some assumptions on reasonable window manager
behaviour.  For now, we just test that the default size of the
window ends up as the allocated size of the content. This test
currently fails with client-side decorations, because we are
not properly discriminating between overall window size and
content size.
2013-04-27 13:41:17 -04:00
Paolo Borelli
d35596fe92 GtkImage: do not leak metrics in baseline align
https://bugzilla.gnome.org/show_bug.cgi?id=699020
2013-04-27 13:59:29 +02:00
Rico Tzschichholz
b957e16695 gtk: Add COMPOSITE_TEMPLATES to EXTRA_DIST 2013-04-26 09:25:44 +02:00
Matthias Clasen
8dc090b9b1 GtkStack: improve docs 2013-04-24 22:07:09 -04:00
Matthias Clasen
a8a41b52ad GtkStackSwitcher: unset tooltip
It was pointed out to me that we leave the tooltip behind
when setting and unsetting an icon.
2013-04-24 20:10:05 -04:00
Matthias Clasen
af49dd33cf GtkNotebook: Consistent boolean handling
Normalize boolean parameters in gtk_notebook_set_tab_reorderable and
gtk_notebook_set_tab_detachable before comparing them. Pointed out in
https://bugzilla.gnome.org/show_bug.cgi?id=697196
2013-04-24 19:58:22 -04:00
Cosimo Cecchi
06c8e8fa43 docs: fix some typos in newly introduced methods 2013-04-24 13:10:54 -04:00
Benjamin Otte
174664b235 overlay: Silence gcc warnings 2013-04-23 14:13:51 -04:00
Owen W. Taylor
0032b2dc5a GtkSpinButton: don't constantly recreate style contexts for buttons
Cache the style contexts for the up and down panels, instead of recreating
them each time they are drawn or size requested. GtkSpinButtons were
many times slower to draw than other widgets because of the constant
style matching.

https://bugzilla.gnome.org/show_bug.cgi?id=698682
2013-04-23 14:04:39 -04:00
Federico Mena Quintero
d9b9ba5da0 Merge branch 'places-sidebar' 2013-04-23 13:58:09 -04:00
Alexander Larsson
316d450421 Handle non-baseline supporting subclasses overriding baseline supporting classes
If a subclass (say a child of GtkButton) overrides the non-baseline
size request methods we need to call these, rather than the new
get_height_and_baseline_for_width method.

In order to handle this we make the default for this method to be
NULL, and instead check at runtime which method to call. If any
non-baseline vfunc has changed in a class but the baseline one
hasn't, then we can't use the baseline one.
2013-04-23 05:58:48 +02:00
Alexander Larsson
e8d4bfd04b Add baseline alignment functions to gtk.symbols 2013-04-23 05:58:08 +02:00
Alexander Larsson
e253a414b0 GtkLabel: Minor cleanup
Make sure we always compare for a set baseline in the same way.
I.e. baseline != -1, never baseline >= 0.
2013-04-23 05:58:08 +02:00
Alexander Larsson
ac8817d34b GtkWidget: Add missing Since docs 2013-04-23 05:58:08 +02:00
Alexander Larsson
c630804647 GtkImage: Reuse previously calculated baseline_align in draw()
No need to recalculate this every time we draw.
2013-04-23 05:58:08 +02:00
Alexander Larsson
43f1ac2b8f GtkBox: Add missing Since in docs 2013-04-23 05:58:08 +02:00
Alexander Larsson
ebbc7791dd GtkGrid: Add missing Since docs 2013-04-23 05:58:07 +02:00
Alexander Larsson
f354cef61b GtkDialog: Baseline align buttons in action area 2013-04-23 05:58:07 +02:00
Alexander Larsson
8fbd6e2edc GtkEventBox: Support baseline alignment
This allows baselines to propagate from the child of the eventbox.
2013-04-23 05:58:07 +02:00
Alexander Larsson
e64c1f8929 GtkButtonBox: Support baseline alignment 2013-04-23 05:58:07 +02:00
Alexander Larsson
1df8d18ad2 GtkCheckButton and GtkRadioButton: Implement baseline alignment 2013-04-23 05:58:07 +02:00
Alexander Larsson
433c0c2134 GtkSpinButton: Support baseline alignment 2013-04-23 05:58:07 +02:00
Alexander Larsson
627685e2a2 GtkGrid: Support baseline alignment in GtkGrid
We support a local baseline in each row, as well as selecting
a specific row for the global baseline of the entire GtkGrid.
2013-04-23 05:58:07 +02:00
Alexander Larsson
72cd8b4dab GtkEntry: Support baselines 2013-04-23 05:58:06 +02:00
Alexander Larsson
d6684b5748 GtkButton: Add baseline align support 2013-04-23 05:58:06 +02:00
Alexander Larsson
7523b25942 GtkImage: Support baselines
This uses the current font metrics to guess the baseline of the image.
Without this any non-centered baseline in buttons with images look weird.
2013-04-23 05:50:38 +02:00
Alexander Larsson
6acc8c0817 GtkAlignment: Support baselines
We now report any baselines from the child, and allocate it.
Also, in the case of a baselign aligned child we ignore yscale/yalign
as that is not supportable.
2013-04-23 05:50:38 +02:00
Alexander Larsson
9a42942afb GtkBox: Add baseline alignment for horizontal boxes
Report a baseline based height and baseline whenever there
are children with ALIGN_BASELINE.

Assign baseline to childen in size_allocate. Either the one inherited
from the parent if set, or otherwise calculate one based on any
ALIGN_BASELINE children.
2013-04-23 05:50:38 +02:00
Alexander Larsson
1e1cf89e4f GtkLabel: Support baseline
Report the baseline in get_preferred_height_and_baseline_for_width().
2013-04-23 05:50:37 +02:00
Alexander Larsson
5ad618cb95 GtkSizeRequestCache: Don't store baselines in horizontal case
This saves memory for every widget (maximum 48 bytes per widget) at
a cost of a few duplicated codepaths in the size request cache.
2013-04-23 05:50:37 +02:00
Alexander Larsson
77e0f18eda Add GTK_DEBUG=baselines support
This draws red lines to show where the baselines are
2013-04-23 05:50:37 +02:00
Alexander Larsson
852cbb62b8 Initial support for baselines
This modifies the size machinery in order to allow baseline support.

We add a new widget vfunc get_preferred_height_and_baseline_for_width
which queries the normal height_for_width (or non-for-width if width
is -1) and additionally returns optional (-1 means "no baseline")
baselines for the minimal and natural heights.

We also add a new gtk_widget_size_allocate_with_baseline() which
baseline-aware containers can use to allocate children with a specific
baseline, either one inherited from the parent, or one introduced due
to requested baseline alignment in the container
itself. size_allocate_with_baseline() works just like a normal size
allocation, except the baseline gets recorded so that the child can
access it via gtk_widget_get_allocated_baseline() when it aligns
itself.

There are also adjust_baseline_request/allocation similar to the
allocation adjustment, and we extend the size request cache to also
store the baselines.
2013-04-23 05:50:37 +02:00
Alexander Larsson
f15bc7818e Add GTK_ALIGN_BASELINE to GtkAlign
Setting this means baseline aware containers should align the widget
according to the baseline. For other containers this behaves like
FILL.

In order to not suprise old code with a new enum value we always
return _FILL for _BASELINE unless you specifically request it via
gtk_widget_get_valign_with_baseline().
2013-04-23 05:47:31 +02:00
John Ralls
655c781b6e Fix automake warning about CFLAGS etc. being user variables 2013-04-22 15:48:35 -07:00
Benjamin Otte
315261260c button: Implement height-for-width
https://bugzilla.gnome.org/show_bug.cgi?id=698433
2013-04-22 18:29:21 -04:00
Benjamin Otte
3450388ff0 sizerequest: Split out a common function 2013-04-22 18:29:01 -04:00
Cosimo Cecchi
009aadf378 window: remove unused code
We don't need to add these style classes.
2013-04-22 18:10:22 -04:00
Cosimo Cecchi
7bbbb01ff5 window: rework the CSD theming layer
Instead of having three different boxes and style classes, we can just
get away with the regular background box, plus a window-frame, which
contains the external frame, together with the window drop shadows.

GtkWindow now has special code to ensure the backing actual window is
allocated big enough to accomodate the shadows (using the shadow size
calculations introduced in the previous commit). We also use the margin
value to determine the size of the invisible borders (which can then be
different than the shadow).
2013-04-22 18:10:22 -04:00
Cosimo Cecchi
a44d6816d3 cssshadow: add a method to get the size of a shadows value
The method returns the size of each side of a GtkCssShadowsValue.
2013-04-22 18:10:21 -04:00
Cosimo Cecchi
7846bedebd window: factor out a gtk_window_get_maximized() function
Simplify code that does this same check over and over.
2013-04-22 18:10:21 -04:00
Cosimo Cecchi
87922575d3 window: remove title_border
We don't actually need this additional title border.
2013-04-22 18:10:21 -04:00
Federico Mena Quintero
0c1423d962 Remove GtkPlacesSidebar from our private Glade catalog
Now, Glade already knows about GtkPlacesSidebar AND MY MAD ICONS.
2013-04-22 17:00:08 -04:00
Ryan Lortie
ca0a18918c GtkModelMenuItem: add support for 'icon' attribute
Add support for icons on a GMenuModel.

https://bugzilla.gnome.org/show_bug.cgi?id=688820
2013-04-22 15:55:08 -04:00
Federico Mena Quintero
5322420145 Use friendlier property names for Glade 2013-04-22 15:46:59 -04:00
Matthias Clasen
15bba87e9a Add new symbols
Add the GtkRevealer functions to gtk.symbols
2013-04-22 12:42:39 -04:00
Matthias Clasen
8ff96b3bb2 Do rtl flipping for GtkRevealer transitions 2013-04-22 12:42:39 -04:00
Matthias Clasen
aec62e1c10 Add docs for GtkRevealer 2013-04-22 12:42:38 -04:00
Matthias Clasen
d7f43c30a3 GtkRevealer: Add a fading animation
Using a container for this is not necessarily the most
elegant solution, but it lets us reuse the animation
machinery in GtkRevealer.
2013-04-22 12:42:38 -04:00
Matthias Clasen
443459b52e Add GtkRevealer
This is a widget that can hide or show (ie reveal) its child
in an animated fashion.

This widget was initially developed in libgd.
2013-04-22 12:42:37 -04:00
Cosimo Cecchi
d82257e1c8 stack: fix a typo in docs 2013-04-22 11:20:06 -04:00
Matthias Clasen
b88c0d7387 Typo fix in GtkStack docs 2013-04-22 10:25:30 -04:00