Commit Graph

325 Commits

Author SHA1 Message Date
Matthias Clasen
e6f413c6a7 GtkRange: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:07 -04:00
Carlos Garnacho
26dff0d783 range: Use GtkGesture for event management
A multipress gesture takes care of clicks, and where those happened.
If the click is meant to move the slider while pressed, the drag gesture
takes over, dragging the slider while active.
2014-06-05 16:15:54 +02:00
Carlos Garnacho
d05a9f9a7b gesture: Replace gtk_gesture_attach/detach with event controller API
Event controllers now auto-attach, and the GtkCapturePhase only determines
when are events dispatched, but all controllers are managed by the widget wrt
grabs.

All callers have been updated.
2014-05-27 17:47:12 +02:00
Carlos Garnacho
5369c77029 gesture: Simplify gesture/widget interaction public API
The propagation phase property/methods in GtkEventController are gone,
This is now set directly on the GtkWidget add/remove controller API,
which has been made private.

The only public bit now are the new functions gtk_gesture_attach() and
gtk_gesture_detach() that will use the private API underneath.

All callers have been updated.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
75b6f4aa52 range: Replace GtkPressAndHold with GtkGestureLongPress 2014-05-23 19:54:26 +02:00
Cosimo Cecchi
e2f2571dee range: don't use focus-line-width 2014-05-09 11:02:46 -07:00
Cosimo Cecchi
83b4e67307 range: remove unused code 2014-05-09 11:02:44 -07:00
Cosimo Cecchi
365ab7f73b range: don't use focus padding 2014-05-09 11:02:43 -07:00
Benjamin Otte
73aa7bd2f5 widgets: Remove (GtkTickCallback) casts
Instead, make the functions conform to the prototype, so that casting
isn't needed.
2014-04-29 19:35:29 +02:00
Matthias Clasen
fee33b1a81 Clean up private headers
This commit adds a few missing private headers, and cleans up
some irregularities in the existing ones
2014-04-05 02:06:29 -04:00
Matthias Clasen
07fc894020 GtkRange: make autoscrolling work for inverted ranges
This problem was discovered in
https://bugzilla.gnome.org/show_bug.cgi?id=725225
2014-03-03 17:49:38 -05: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
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
Bastien Nocera
438cd857c4 all: Add names to timeouts
Add names to every timeout we setup, so it's easier to track their
usage, and debug possible misbehaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=710651
2013-10-23 13:31:18 +02:00
William Jon McCann
9fc3e59673 range: start autoscrolling near the edges of ranges
If a range goes all the way to the edge of the screen then we don't
have any way to activate autoscrolling. By adding a small region
at the ends of the range we can handle this case. This is the same
approach used in treeviews.
2013-10-07 16:38:49 -04:00
William Jon McCann
8c7a8e9314 Add autoscroll when dragging past boundary of range
A problem with the zoom scroll mode is that you have to restart
if you hit the bottom of the screen before you hit the bottom
of your document.

This commit adds an autoscroll feature to the zoom scroll: if
you move outside the window while in zoom scroll mode, we keep
scrolling in the direction you were going until you let go
of the mouse button.

https://bugzilla.gnome.org/show_bug.cgi?id=704703
2013-08-05 08:47:27 +02:00
William Jon McCann
c3e172e546 Add press and hold support to set zoom scroll mode
Triggering zoom scroll mode by Shift click was too much
of an easter egg. It also requires using keyboard and
mouse together, which is hard to do for many users.

Instead, we now trigger zoom scroll mode by click-and-hold
(or touch-and-hold).

https://bugzilla.gnome.org/show_bug.cgi?id=704703
2013-08-05 08:47:27 +02:00
Benjamin Otte
40506cf648 range: Remove dead assignment 2013-08-04 17:27:30 +02:00
William Jon McCann
57fc8763e9 Deprecate and ignore the timeout-initial and timeout-repeat settings 2013-07-11 17:08:15 -04: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
William Jon McCann
b101d465be Deprecate and ignore gtk-keynav-cursor-only and gtk-keynav-wrap-around 2013-06-26 15:33:10 -04:00
Cosimo Cecchi
d434a9103c range: don't draw origin when the slider is invisible
When the range of the GtkRange is zero (i.e. the upper and lower bounds
of the adjustment have the same value), don't use an origin to draw the
trough, as the slider will also be hidden, and the juncture between the
two sections of the trough will be visible.
2013-02-27 17:20:59 -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
aa77cd6501 range: don't trim the trough rectange by the trough margin
Commit e32da246a8 made GtkRange's trough
respect the CSS margin property, but it also trimmed the box in which
the trough reacts to click events by the margin.
We still want to catch events in that area instead, and just make sure
the margin is applied when drawing (which was already implemented by
that commit).

This commit reverts the parts of
e32da246a8 that didn't involve drawing,
fixing the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=691677
2013-01-14 10:20:43 -05:00
Kristian Rietveld
64324a5da0 Implement gtk-primary-button-warps-slider GtkSetting
Make GtkRange honor the setting and implement it in the
quartz backend, it proxies the "click in the scroll bar to"
property from the OS X PrefPane.
2012-09-11 11:19:09 +02:00
Cosimo Cecchi
e32da246a8 range: read and use CSS margin values for the trough component
Many themes want to render the trough background/stroke thinner than the
full height/width (which is constructed around the value of the
'slider-width' style property).
Read and apply the CSS margin from the theme on the trough component, so
that themes can make it smaller at their will without the need to
override the render_background, render_frame and render_activity methods
of GtkThemingEngine.

https://bugzilla.gnome.org/show_bug.cgi?id=676196
2012-05-17 09:42:42 -04:00
Cosimo Cecchi
fb968e6e74 range: remove commented out code
We wouldn't need any detail anyway, since we use a progressbar style
class for the progress part of GtkRange.

https://bugzilla.gnome.org/show_bug.cgi?id=676196
2012-05-17 09:42:42 -04:00
Matthias Clasen
22eb687264 Add a 'fine adjustment' mode to ranges
Shift-click in the slider now starts a drag in 'fine adjustment'
mode, where we move the slider 10-times slower than the mouse.

This can be very helpful when scrolling through a very long document
or webpage, and moving the scrollbar even a single pixel already
jumps too far in the content.

https://bugzilla.gnome.org/show_bug.cgi?id=563688
2012-04-27 12:08:16 -04:00
Matthias Clasen
162614aab4 Change button bindings for range widgets around
It seems to be general consensus that button 1 should do the jumping,
so we now jump to the clicked position on primary button clicks and
page on secondary button clicks. Touch behaves like primary.

https://bugzilla.gnome.org/show_bug.cgi?id=563688
2012-04-27 12:08:15 -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
Matthias Clasen
de115c3fd3 Avoid infinite recursion when removing a grab
https://bugzilla.gnome.org/show_bug.cgi?id=671819
2012-03-12 22:01:18 -04:00
Matthias Clasen
5714454a73 range: Straighten the wheel delta calculation
Scroll events report normalized deltas in terms of an abstract
'scroll unit' now, so our job is to determine a suitable scroll
unit here. Since we are changing the value of the adjustment,
the allocation of the widget does not factor into this at all.
2012-03-04 19:15:32 -05: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
Matthias Clasen
6ecc1089f2 range: Use the correct size for scaling
When scaling the scroll delta, always use the 'large' dimension
of a range widget. When dx was 0, the code code accidentally
use the small dimension.
2012-03-01 16:29:01 -05:00
Michael Natterer
2a72e7b7b8 gtk: Implement smooth scrolling in scrolledwindow/range
If delta_x/y information is provided in scroll events, use it
to modify the underlying adjustment in steps proportional to
the deltas provided.

If the child widget of a scrolledwindow doesn't set
GDK_SMOOTH_SCROLL_MASK, regular scroll events will be dispatched,
and still handled by these 2 widgets.
2012-03-01 16:28:58 -05:00
Carlos Garnacho
518a579838 range: Have slider jump to the pointer coordinates on touch devices
This widget is too narrow to make touch interaction tricky enough, so
don't add the penalty of having the slider run farther from the touch
coordinates if it happens to miss the slider.
2012-03-01 16:25:24 -05:00
Carlos Garnacho
6427fdb291 range: Remove gtk-touchscreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already cater dynamically for the "don't prelight on touch devices"
usecase.
2012-03-01 16:25:24 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Carlos Garnacho
170b391e74 range: Don't perform a GTK+ grab
The implicit grab on priv->event_window already warrants that this
widget is the only one getting events while the button is pressed,
so avoid the extra GTK+ grab here.
2012-02-23 16:47:06 -05:00
Matthias Clasen
bad24bc119 Consistently private headers
Add a 'private' suffix to all newly introduced private
headers.
2012-02-14 16:36:58 -05:00
Matthias Clasen
cd300835d7 Allow context menus on scale sliders
This will be used for a popup in the color chooser.
2012-02-14 16:36:53 -05:00
Matthias Clasen
5bd4c234fb Draw no trough for color scales 2012-02-14 16:36:52 -05:00
Carlos Garcia Campos
99c903ec04 gtkrange: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Matthias Clasen
b9b23f4f18 GtkRange: fix resize-grip overlap handling
We only want to shrink the scrollbar allocation by the actual
overlap, not always by the full size of the resize grip.
2012-01-14 20:35:19 -05:00
Rui Matos
b2f5959147 range: Use the widget state flags as a base for drawing 2012-01-09 16:31:11 +00:00
Andrea Cimitan
40423df234 Add has-origin property for GtkScale
If the scale has an origin (it will have one by default), GtkRange will
render the two sides before/after the current value with different style
classes, making it possible for themes to use different colors and
properties for the two areas.
This was possible in GTK 2 with style details, but got lost during the
road to 3.0.

https://bugzilla.gnome.org/show_bug.cgi?id=665140
2011-12-14 17:16:09 +01:00
Matthias Clasen
7814718152 Drop uses of @returns syntax 2011-11-21 13:12:58 -05:00
Alexander Larsson
a038c589db Add top/left/bottom/right style classes to steppers
This is needed for e.g. win32 theming, but is also generally
useful.
2011-11-17 17:34:05 +01:00
Benjamin Otte
b526375e8f gtk: Fix compiler warnings from include fixes 2011-11-16 04:31:06 +01:00
Rico Tzschichholz
4a43c062ac Fix some implicit declaration warnings
There were some includes of gtkmain.h missing
2011-11-11 13:06:56 +01: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
Cosimo Cecchi
18a638a7d3 GtkRange: use the right widget for coordinate translation
GtkRange needs to check if its allocation intersects with the resize
grip allocation (trimming its own allocation if it does).
In order to do that, it needs to translate its allocation into window
coordinates, and before that, find the window to whose the allocation
is relative; code goes all the way finding the right parent widget, but
then doesn't actually use it when translating the coordinates, leading
to using the wrong rectangles for the intersection check.

https://bugzilla.gnome.org/show_bug.cgi?id=662308
2011-10-21 16:30:34 -04: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
7f58482d4e Convert GailRange to GtkRangeAccessible 2011-07-05 16:08:54 -04:00
Matthias Clasen
93ed62e69c GtkRangePrivate: Improve struct packing 2011-04-12 12:42:14 -04:00
Cosimo Cecchi
9205abe374 range: allow stepper-spacing > 0 and trough-under-steppers = TRUE
Commit 4bb3d64414 introduced a limitation
to GtkRange style properties; when stepper-spacing is > 0,
trough-under-steppers is automatically set to FALSE; this means that
setting a spacing between the steppers (e.g. the scrollbar buttons) and
the trough (i.e. the area over which the slider is free to move) would
make the buttons always get the full allocation on the !orientation
direction.
The rationale is without this limitation, you would get an area which
seems clickable, but it's actually not.

While this is true, and undesirable, for big stepper spacings, themes
that use trough-under-steppers (which is TRUE by default anyway),
might want to set smaller spacings to avoid drawing a double line between
the button and the slider borders.

To add confusion, the documentation got it flipped, i.e. it stated
setting a positive stepper-spacing would set trough-under-steppers to
TRUE (which would also make the behavior expected by commit
4bb3d64414 impossible).

I don't think hardcoding either of the two limitations is a good thing.
We should let themes handle this instead, and remove this limitation. If
you want the old behavior, you can manually set trough-under-steppers to
FALSE if you set a positive stepper-spacing in your theme.

https://bugzilla.gnome.org/show_bug.cgi?id=644777
2011-03-16 13:20:07 -04:00
Cosimo Cecchi
230bd4b461 range: x and y coordinates of the arrow rendering should be double
To prevent off-by-one rounding errors when drawing them later.
2011-03-03 17:48:25 -05:00
Cosimo Cecchi
11f07f9bdc range: don't set junction sides on scrollbar steppers 2011-03-03 17:48:25 -05: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
4a0aa41742 Add gtkorientableprivate.h header 2011-01-30 03:12:49 -05: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
Pavel Holejsovsky
2fb1c06402 [GI] Add missing (out) and (array) annotations 2011-01-20 13:57:20 +01:00
Carlos Garnacho
0c5ceaf757 Set horizontal/vertical style classes to GtkRanges 2011-01-19 04:28:49 +01:00
Matthias Clasen
cc92d6da03 Fix a typo 2011-01-15 00:16:51 -05:00
Matthias Clasen
ccc3d874ef Add accessors for GtkRange::round-digits
Patch by Christian Dywan,
https://bugzilla.gnome.org/show_bug.cgi?id=351755
2011-01-15 00:08:39 -05:00
Tristan Van Berkom
fdba9f281d Fixed issues with "hierarchy-changed" signal.
GtkFileChooserDefault watches the toplevel and montitors "set-focus"
signal on it... however the connection needs to be remade when the
GtkFileChooserDialog is in an embedded toplevel.

Measure's taken: GtkWindow propagates hierarchy changes when
_gtk_window_set_is_toplevel() is called, gtk_widget_unparent()
unsets the widget's parent window earlier in the function so that
the possible hierarchy change is still able to properly access the hierarchy.

GtkFileChooserDefault checks if the "new" toplevel is indeed
gtk_widget_is_toplevel() but not the old one, GtkRange has been
updated to use gtk_widget_is_toplevel() inside it's hierarhcy_changed
vfunc, other classes already do this properly.
2011-01-06 14:39:40 +09:00
Benjamin Otte
801ba1c758 range: Update adjustment usage for sealing 2011-01-05 23:50:22 +01:00
Benjamin Otte
95e9f4c0c1 range: Rewrite attachment setters to use sealed API 2011-01-05 23:50:22 +01:00
Benjamin Otte
c43a31ea33 API: range: Remove update policy
It's unused and complicates code a lot. In particular, it breaks the
adjustment/range abstractions.
2011-01-05 14:30:58 +01:00
Matthias Clasen
b123bc41fd Move docs for gtkmain inline
At the same time, introduce a gtkmainprivate.h header
and various other cleanups.

Based on a patch by Tadej Borovšak.
https://bugzilla.gnome.org/show_bug.cgi?id=617471
2011-01-04 17:32:12 -05:00
Matthias Clasen
98440ad031 Remove gtktypeutils altogether
Based on patches by Javier Jardón.

https://bugzilla.gnome.org/show_bug.cgi?id=629955
2011-01-04 14:51:19 -05:00
Matthias Clasen
b5c6904c2f Drop explicit includes of gdkkeysyms.h
These are no longer needed. At the same time, port gtkimcontextsimpleseqs.h
to use the new GDK_KEY_ symbols.
2011-01-04 12:21:41 -05:00
Carlos Garnacho
c64a1891f8 Port GtkRange widgets to GtkStyleContext 2010-12-13 22:31:29 +01:00
Michael Natterer
e4cbe47a11 gtk: properly indent calls to gdk_threads_add_timeout() 2010-12-02 23:01:12 +01:00
Bastien Nocera
959fc60c47 gtk: Allow hiding the trough/slider in GtkScale
When setting a GtkRange's upper and lower values to the same
value, the slider will not be drawn any more.

https://bugzilla.gnome.org/show_bug.cgi?id=549720
2010-12-01 15:39:50 +00:00
Chun-wei Fan
76dc9e6b53 gtk: fix C99-style variable declarations in various sources 2010-11-10 10:08:14 +08:00
Matthias Clasen
d95f8ae2e2 Remove size_request from GtkRange 2010-10-27 08:10:40 -04:00
Matthias Clasen
9d750ad13e Fix a problem with 'resize grip avoidance' in scrollbars
We need to be a little more careful when determining the overlap
between the new allocation and the grip area. This was causing
vertical scrollbars in evince to overlap with the grip.
2010-10-08 22:04:33 -04:00
Matthias Clasen
8ed725bad8 Get scrollbars out of the way of the window's resize grip
If there are both horizontal and vertical scrollbars, there is
an unused 'corner' into which the resize grip fits. Individual
scrollbars need to be shortened and moved to make room for the
resize grip.
2010-10-08 02:14:19 -04: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
Javier Jardón
eac1959d2c Move destroy signal to GtkWidget
Also make GtkWidget derive from GInitiallyUnowned
2010-09-26 22:18:18 -04:00
Benjamin Otte
1d3f6b30b0 API: Rename gtk_cairo_paint_*() to gtk_paint_*()
Large patch, but just renaming.
Indentation should still mostly be correct because I took care of
keeping the indentation for this function name.
2010-09-26 15:11:42 +02:00
Benjamin Otte
e605272436 range: Port to draw vfunc 2010-09-26 15:11:36 +02:00
Benjamin Otte
745f110814 range: Make drawing use a single cairo context 2010-09-26 15:11:36 +02:00
Matthias Clasen
e0aa12eb0a Tons of transfer annotations 2010-09-21 00:18:11 -04:00
Colin Walters
913cdf3be7 GDK: Prefix key names with KEY_
The keysyms create a lot of potential namespace conflicts for
C, and are especially problematic for introspection, where we take
constants into the namespace, so GDK_Display conflicts with GdkDisplay.

For C application compatiblity, add gdkkeysyms-compat.h which uses
the old names.

Just one user in GTK+ continues to use gdkkeysyms-compat.h, which is
the gtkimcontextsimple.c, since porting that requires porting more
custom Perl code.
2010-09-08 18:51:44 -04:00
Benjamin Otte
9c2eca5b06 range: Unused variable 2010-09-03 13:39:10 +02:00
Matthias Clasen
1956cf8d28 Remove GtkRange::activate-slider
This was a style property to let theme engines 'opt-in' to more
correct behaviour while maintaining compatibility with existing
themes. GTK+ 3 engines are expected to handle the more correct
behaviour.
2010-09-01 22:09:44 -04:00
Matthias Clasen
d28af9cbb9 Remove GtkRange::stepper-position-details
This was a style property to let theme engines 'opt-in' to more
correct behaviour while maintaining compatibility with existing
themes. GTK+ 3 engines are expected to handle the more correct
behaviour.
2010-09-01 21:48:44 -04:00
Matthias Clasen
658f99b8ee Remove GtkRange::trough-side-details
This was a style property to let theme engines 'opt-in' to more
correct behaviour while maintaining compatibility with existing
themes. GTK+ 3 engines are expected to handle the more correct
behaviour.
2010-09-01 21:30:47 -04:00
Javier Jardón
1e5d7c0225 Use GtkFooPrivate instead GtkFooPriv 2010-08-27 04:48:23 +02:00
Javier Jardón
f4f607690d GtkRange: move public members to private structure 2010-08-23 20:48:03 +02:00
Javier Jardón
f300aefa7e Added _gtk_range_set_steppers () internal function
It's needed by gtkscrollbar
2010-08-23 20:47:30 +02:00
Javier Jardón
1814ea6abd Added _gtk_range_set_round_digits() insternal function
It's needed by gtkscale
2010-08-23 20:47:23 +02:00
Javier Jardón
d38bf4825a gtkrange: Add some checks to gtk_range_set_slider_size_fixed()
Recalculate layout only if the range is already mapped and
adjustment is not NULL.
2010-08-23 20:47:16 +02:00
Javier Jardón
c6f4e71a31 gtk/gtkrange.c: use accessor functions to access GtkWidget 2010-08-22 21:25:25 +02:00
Javier Jardón
05e33f69eb gtk_range_set_min_slider_size() should receive an gint, not a gboolean 2010-08-13 02:49:27 +02:00
Javier Jardón
de9c5f8d3d Use accessor functions to access GtkScale 2010-07-13 19:40:50 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00