Commit Graph

192 Commits

Author SHA1 Message Date
Benjamin Otte
b09fbadddf viewport: Remove wrong save/restore 2014-10-13 04:39:57 +02:00
Benjamin Otte
d3c147a62d stylecontext: Split render functions out into gtkrender.[ch] 2014-10-03 06:18:05 +02:00
Matthias Clasen
dbeb0c9ca8 GtkViewport: Use style classes for shadow
Translate shadow != None into the FRAME style class.
This doesn't change the style classes used for drawing,
it only sets the style class permanently instead of
saving and restoring in draw().
https://bugzilla.gnome.org/show_bug.cgi?id=732256
2014-06-26 21:56:20 -04:00
Benjamin Otte
cdd341ed7d viewport: Remove unused variable 2014-06-10 13:47:51 +02:00
Matthias Clasen
b22b2298be GtkViewport: Don't do silly things in a setter
Just queue a resize instead of fiddling with the size allocation.
2014-06-09 13:51:58 -04:00
Matthias Clasen
bcd804613f GtkViewport: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:14 -04:00
Benjamin Otte
352e28a138 viewport: Don't subtract borders and padding from -1
-1 is a special value for "undefined" and needs to stay that way

https://bugzilla.gnome.org/show_bug.cgi?id=729607
2014-05-06 04:02:40 +02:00
Benjamin Otte
9652b8cf82 viewport: Remove unneeded checks
Size vfuncs always get non-null out variables passed, so no need to
check for NULL.
2014-05-01 14:51:27 +02:00
Benjamin Otte
29a4f0131e viewport: Implement hfw properly
Previously, the code would fall back on GtkBin's hfw implementation
which didn't account for padding and borders.
2014-05-01 14:51:27 +02:00
Benjamin Otte
b261fc64e2 viewport: Use a convenience function
That function looks longer than not using it, but we'll need it in the
next commit.
2014-05-01 14:51:27 +02:00
Benjamin Otte
2e2e3a5e24 viewport: Request 2x border-width
It's nice that bugs get pointed out in code comments. Fixing them would
probably have been preferrable though.
2014-05-01 14:51:27 +02:00
Benjamin Otte
461f1900f2 viewport: Call map/unmap functions on pixel cache
https://bugzilla.gnome.org/show_bug.cgi?id=726475
2014-04-10 00:16:53 +02:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01: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
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
Torsten Schönfeld
afc57cabf0 GtkViewport: annotate the adjustment args of the constructor
NULL is accepted here, so add (allow-none).

https://bugzilla.gnome.org/show_bug.cgi?id=694022
2013-02-18 19:39:12 -05: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
Cosimo Cecchi
9efa28591c scrolledwindow: make gtk_scrolled_window_add() smart
There's really no reason why we shouldn't automatically create a
GtkViewport when the widget added to GtkScrolledWindow is not a
GtkScrollable, instead of just printing a g_warning.
Copy the viewport special case into the scrolled window implementation
of gtk_container_add().

https://bugzilla.gnome.org/show_bug.cgi?id=693015
2013-02-01 22:58:53 -05:00
Alexander Larsson
0cb714fe62 Use GTK_RESIZE_PARENT resize_mode for GtkViewport
We used to use GTK_RESIZE_QUEUE, but that is problematic for e.g
a GtkScrolledWindow with NEVER scroll policies, as size changes
in ancestors will never get propagated to the scrolled window, causing
it to not have the correct size.

This is a slight performance hit, but in practice its not bound to be
problematic. In typical UIs there is only a single "large" GtkScrolledWindow
visible at a time, so a size requeust propagating out of such a window
will only hit the smaller amount of widgetry outside the scrolled window,
and additionally all such widgets will have their size request caches
still valid.

https://bugzilla.gnome.org/show_bug.cgi?id=690099
2012-12-12 15:03:24 +01:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Benjamin Otte
917ca6a802 gtk: Don't call gdk_window_process_updates() when scrolling
This can cause lagging when scrolling as it causes us to repaint
on every scroll event. This wasn't historically a great problem,
but with smooth scrolling we get a lot more events, so this
now creates visible lagging on slower machines.
2012-04-05 15:48:51 +02:00
Benjamin Otte
2353d60b8a types: Move GtkAdustment declaration to gtktypes.h
... and make all the headers to not include gtkadjustment.h anymore. Of
course, also include it in the source files instead.
2012-03-03 19:45:03 +01:00
Carlos Garnacho
f34a236814 viewport: set GDK_SMOOTH_SCROLL_MASK
This is so smooth scroll events are send/handled by the
parent GtkScrolledWindow if any.
2012-03-01 16:28:59 -05:00
Matthias Clasen
42c75d28b8 viewport: select for touch events
This makes kinetic scrolling work with viewports where the
content does not otherwise select for button or touch events,
such as testscrolledwindow's label.
2012-03-01 16:25:22 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Alexander Larsson
8e4b17738e Fix padding handling in GtkViewport 2012-02-20 12:12:05 +01:00
Alexander Larsson
fed1cfb122 Make the default background for GdkWindows transparent
With the changes in default CSS to make the default background transparent
we ran into issues where intermediate GdkWindow (for instance the
view_window in GtkViewport) where we didn't set an explicit background
(because before they were always covered). So instead of showing throught
the transparent windows were showing the default backgroind of the intermediate
window (i.e. black).

With this change we also needed to fix GtkViewport, as it was previously
relying on the bin and view windows to cover widget->window so that the
border was not visible if shadow_type was NONE.
2012-02-09 16:39:23 +01:00
Alexander Larsson
6723feae8a viewport: Set frame styleclass when getting border size during size allocation
Without this you don't get the right border/padding for widget->window
and the border shows up under the scrolled contents.
2012-02-09 16:39:23 +01:00
Benjamin Otte
73e54ab727 viewport: Get rid of deprecation warnings 2011-11-17 00:46:15 +01:00
Benjamin Otte
65ceff35f9 viewport: Don't use deprecated functions 2011-11-17 00:46:15 +01:00
Benjamin Otte
5bacd8e019 viewport: adjustments are never NULL
So there's no need to check for that in the getters.
2011-11-17 00:46:15 +01:00
Benjamin Otte
2939eae20f viewport: Initialize the adjustment in the init function 2011-11-17 00:46:15 +01:00
Benjamin Otte
0ef224766a viewport: Don't unset the adjustment on finalize
We unset it on destroy already. This makes it consistent with all other
scrollables.
2011-11-17 00:46:15 +01:00
Javier Jardón
b0a7db76fb Replace some references to the GtkTable, use GtkGrid instead 2011-09-29 12:38:49 +01: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
Benjamin Otte
96245d4efb viewport: Use gtk_widget_class_set_accessible_role() 2011-07-18 18:30:50 +02:00
Matthias Clasen
beb8c290d1 Always chain up in ::style-updated
This was not handled consistently, but the default handler
does useful things, so we should always chain up.
2011-02-07 07:30:37 -05:00
Carlos Garnacho
6f3706ac28 Make GtkViewport use GtkStyleContext 2011-01-10 03:50:02 +01:00
Benjamin Otte
7210e6e1cd viewport: Update adjustment usage for sealing 2011-01-05 23:50:22 +01:00
Benjamin Otte
2b4bb071a3 viewport: Rewrite adjustment modification code for sealing 2011-01-05 23:50:21 +01:00
Matthias Clasen
16877b4d7b Reduce includes of gtktypeutils.h to a minimum 2011-01-04 12:05:05 -05:00
Javier Jardón
d0974d4f02 Re-enable deprecation guards 2010-10-30 17:37:02 +09:00
Tristan Van Berkom
3fe0fb4ed9 Added GtkScrollablePolicy property to scrollable interface
This patch adds the GtkScrollablePolicy type property to GtkScrollable
and implements it in all subclasses. GtkScrolledWindow observes this
property to make a good guess about when to show/hide scrollbars for
height-for-width content.

Most scrollable children do not do height-for-width *yet* but
most certainly will (toolpalette, treeview, iconview, textview
widgets all TODO), for scrollable widgets that do have a minimum
and natural size, it's important for them to observe the state
of this property in order to properly drive the scroll adjustments
according to the desired GtkScrollablePolicy. This patch makes
GtkViewport do this.

Patch also adds tests/testscrolledwindow.c to display the effects
of this property.
2010-10-26 10:15:56 +09:00
Matthias Clasen
0d9ebb501d Move min-display-width/height to GtkScrolledWindow
It is just too annoying to have to implement these properties in
every scrollable. Instead, we now have ::min-content-height/width
in GtkScrolledWindow.

We also add GtkScrollablePolicy to determine how to size the
scrollable content.
2010-10-22 19:21:17 +02:00
Michael Natterer
1f77384ab3 gtk: undef DISABLE_DEPRECATED around including our own header
so we can see our own deprecated API and don't get warnings.
2010-10-22 17:10:49 +02:00
Tadej Borovšak
55196a705f Add GtkScrollable interface
The GtkScrollable interface provides "hadjustment" and "vadjustment"
properties that are used by GtkScrolledWindow. It replaces
the ::set_scroll_adjustment signal. The scrollable interface
also has ::min-display-width/height properties that can be
used to control the minimally visible part inside a scrolled window.
2010-10-22 11:03:45 +02:00
Benjamin Otte
04c630d0fd viewport: Clip contents properly when called via gtk_widget_draw() 2010-10-05 23:22:55 +02:00
Javier Jardón
b072ea220c Remove unneded casts
As gtk_adjustment_new() returns a GtkAdjustment* now

https://bugzilla.gnome.org/show_bug.cgi?id=630731
2010-09-29 01:18:10 +02:00