Commit Graph

1468 Commits

Author SHA1 Message Date
Jasper St. Pierre
f4c2c4c667 gtkwidget: Actually mark set_double_buffered as deprecated 2014-06-23 17:53:48 -04:00
Jasper St. Pierre
24b9e91f47 Revert "gtkwidget: Widgets are now always double-buffered"
This reverts commit b875572f2a.

Apps like Abiword, gnumeric and gnome-chess, and toolkits like
ClutterGTK were all using this for various purposes, and this made them
break. Bring back this feature for now.

It still won't work under Wayland.
2014-06-23 17:50:01 -04:00
Matthias Clasen
4617fa7568 Docs: Reword deprecation notes
Mainly, make sure that deprecated properties are
documented as such. In this case: double-buffered.
2014-06-22 12:11:17 -04:00
Jasper St. Pierre
6bc251692a gtkwidget: Add a warning about set_double_buffered
As requested on the mailing list.
2014-06-21 00:31:17 -04:00
Jasper St. Pierre
b875572f2a gtkwidget: Widgets are now always double-buffered
gtk_widget_set_double_buffered is now deprecated, and we don't support
non-double-buffered widgets. This means that under normal circumstances,
paints are never outside of a begin_paint / end_paint sequence, which
natively-double-buffered backends like Wayland can't possibly support.
2014-06-20 20:41:54 -04:00
Benjamin Otte
4a6957f50d stylecontext: Remove state from _peek_style_property()
It evaluates to "current state" in all cases, so no need to special case
it.
2014-06-11 01:18:04 +02:00
Matthias Clasen
acad03f77b GtkWidget: Use G_PARAM_EXPLICIT_NOTIFY
A few properties here are special, and can't benefit from it:
those which are just shorthands, like ::margin and ::expand,
and those that have explicit -set properties, like::hexpand
and ::vexpand.
2014-06-09 13:30:54 -04:00
Carlos Garnacho
90424289fb widget: reset all controllers when the widget becomes insensitive
Widgets becoming insensitive won't receive further events, but there
could be chances the controllers don't get properly notified and reset
in those situations.
2014-06-05 16:15:54 +02:00
Carlos Garnacho
cb059bfc1b widget: Set GDK_BUTTON1_MASK on emulated pointer events
The touch_event handler was missing those when emulating pointer events
for the widgets that get GDK_TOUCH_MASK set, but have no specialized
touch handlers.
2014-06-04 13:44:56 +02:00
Carlos Garnacho
25f5da5018 widget: Ensure all gestures outside a grab scope are cancelled
This code is a product of early stages in the gestures branch, where
capturing would have an effect outside grab boundaries. But this isn't
really the case, so every gesture outside the grab scope must be reset
to avoid keeping stale data.
2014-06-03 16:13:25 +02:00
Carlos Garnacho
26ced6abad widget: Only deny a sequence if it was previously claimed
Before this change, a sequence being claimed deep in the event propagation
chain would make the sequence go denied on every ancestor, regardless of
previous state.

To make things more consistent, only deny the sequence if it was previously
claimed, so the behavior is the same for gesture groups within the widget
than for those outside the widget.

The gestures testsuite has been updated to reflect this new behavior.
2014-06-03 15:59:03 +02:00
Debarshi Ray
047d2b5f6d Update GtkImage icons when the direction is changed
Don't call gtk_widget_set_state_flags(), it filters the direction flags.
Instead, call gtk_widget_update_state_flags() directly.

https://bugzilla.gnome.org/show_bug.cgi?id=730833
2014-05-31 05:19:41 +02:00
Evan Nemerson
54ec42f035 gtk: port many nullability annotation fixes from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-30 13:24:20 -07:00
Evan Nemerson
07d825574f gtk: add missing type annotations ported from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-27 21:10:33 -07:00
Evan Nemerson
bda145b19f gtk: fix annotation syntax and missing some missing annotations
These changes clean up various errors and omissions resulting from
either slightly incorrect G-I/gtk-doc syntax or missing documentation
blocks.

https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-27 21:10:32 -07:00
Carlos Garnacho
505efbb3f3 widget: Change GtkCapturePhase behavior in event controllers' handling
Previously, there would be globally just a capture and a bubble phase,
with the event just going down the hierarchy once, and the up once.
GTK_PHASE_TARGET actually meaning "run within event handlers", so in
a hierarchy of 3 widgets, emission would be:

  Capture(C)
  Capture(B)
  Capture(A)
  Target(A) (if event handlers allow)
  Bubble(A)
  Target(B) (if event handlers allow)
  Bubble(B)
  Target(C) (if event handlers allow)
  Bubble(C)

This commit changes this behavior and uses GTK_PHASE_TARGET in a less
misleading way, running only on the widget that was meant to receive
the event. And GTK_PHASE_BUBBLE has taken over the execution place of
GTK_PHASE_TARGET, so the emission remains:

  Capture(C)
  Capture(B)
  Capture(A)
  Target(A)
  Bubble(A) (if event handlers allow)
  Bubble(B) (...)
  Bubble(C) (...)

As it was, GTK_PHASE_BUBBLE was useful for running event controllers
paralelly to event handlers, without modifying a single line in those.
For those mixed scenarios, Any of the other phases will have to be
used at discretion, or the event handlers eventually changed to chain
up and let the default event handlers in GtkWidget to be run.
2014-05-27 17:47:12 +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
Matthias Clasen
8a6aca31a8 Typo fixes 2014-05-24 18:20:31 -04:00
Benjamin Otte
f5b1e75d93 widget: Include box-shadow in the clip
This allows all widgets that implement clip to use box shadows.
2014-05-24 16:12:21 +02:00
Benjamin Otte
0cd63faee2 widget: Add _gtk_widget_set_css_clip()
... and use it in GtkBox and GtkGrid.
2014-05-24 16:12:21 +02:00
Benjamin Otte
4f89eb05cf API: widget: Add gtk_widget_set_clip() API
And handle the fact that drawing bounds are now handled by this API and
the corresponding gtk_widget_get_clip().

Also add _gtk_widget_supports_clip() function to check if a widget has
been ported to the new world.
2014-05-24 16:12:20 +02:00
Carlos Garnacho
01d74f86a0 widget: Flip execution order of GTK_PHASE_TARGET/BUBBLE
the "bubble" phase used to run before event handlers before GTK_PHASE_TARGET
was added, in order to keep phases in the expected order, move GTK_PHASE_BUBBLE
to be run (still invariably) after event handlers.

The only behavioral change should be wrt widgets wanting mixed event handler/
gesture handling, they could previously attach the gesture to the bubble phase
and check for gtk_gesture_is_active() in the event handler to bail out, they'll
have to use GTK_PHASE_CAPTURE for that purpose from now on.
2014-05-23 19:54:33 +02:00
Matthias Clasen
a727c41e4a Add back a private api to list controllers
This will let us show them in the inspector.
2014-05-23 19:54:32 +02:00
Carlos Garnacho
f81f00ed6b widget: 3-way merge ate my g_object_ref()
Move it to the right place.
2014-05-23 19:54:32 +02:00
Carlos Garnacho
57eca4f445 widget: remove check on whether the controller was already added
Multiple calls are supposedly allowed to change the phase (although
unlikely to happen), so remove the g_return_if_fail() checking whether
the controller was already added.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
dd164502f7 widget: Hook GTK_PHASE_TARGET controllers to the default event handlers
Just call the controllers on that phase if the default widget handlers
are run.

For compatibility reasons, in the touch event handler, let the pointer
emulating touch be transformed to a pointer event as usual, in order to
have widget handlers a chance to run at all. If they have to be managed
by a controller in that phase, it'll have to be through the default pointer
event handlers.
2014-05-23 19:54:30 +02:00
Carlos Garnacho
1c48cc253d gesture: Add GTK_PHASE_TARGET
This phase is meant to run in the default widget handlers, as opposed
to externally as in the bubble/capture phase. This will be most usually
the expected phase for every controller replacing code in event handlers
in GTK+, just so invocation and triggering order is kept unaltered.
2014-05-23 19:54:30 +02:00
Matthias Clasen
bad1dd4ac7 Be careful about the list of event controllers
We can end up with _gtk_widget_remove_controller getting called
while we are iterating over the list in _gtk_widget_run_controllers.
To avoid trouble, only mark the event controller as dead by
setting data->controller to NULL, and defer the actual freeing
and list manipulation to the loop in _gtk_widget_run_controllers.
Update other places that operate on controllers to handle
data->controller being NULL.
2014-05-23 19:54:30 +02:00
Carlos Garnacho
fe9685bca1 widget: tighten the conditions at which a press event is emulated
Make it really sure that the event is only emitted after every gesture
that consumed the button press is done with the sequence.
The event must only be emulated if a gesture in the capture phase happened
to consume the event, be cancelled, and
2014-05-23 19:54:30 +02:00
Carlos Garnacho
6e9b054543 widget: Fix gesture event handler retval for bubbled events
Do not clobber the return value if the regular event handler happens
to return FALSE, even if the gesture meant to consume the event.
2014-05-23 19:54:30 +02:00
Carlos Garnacho
8ab35016a6 gesture: make gtk_gesture_cancel_sequence() private 2014-05-23 19:54:29 +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
f0940c962f widget: Keep a widget reference around _gtk_widget_run_controllers()
The widget may be destroyed within the loop, in reaction to the signals
sent by the controllers. Protect against that.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
134acf3fda widget: Change slightly the gesture cancellation policy in a same widget
Within a widget, if a gesture accepts a sequence, it would previously
cancel every other gesture that not in the same group. Change this to
only cancelling gestures that previously claimed the gesture, and let
gestures with state=NONE for that sequence remain like that.

This enables late recognition of gestures, even on the presence of
another gesture group that was more eager at claiming the gesture.

One usecase is user-defined panning gestures on scrolledwindows,
if ::capture-button-press is TRUE (eg. the default), the gesture is
claimed early in order to consume the button press, but that would
tipically make every other gesture group deny the sequence. With
this change, the pan gesture can keep state=NONE, and later claim
the sequence for itself if the panning gesture is recognized.

Also, do not propagate state=DENIED to every gesture in the widget,
that was unintended.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
f73f4d82e0 widget: remove GtkGesture-related signals
The utility of those signals is somewhat dubious now that there is
gtk_gesture_group(), so make that the only way to coordinate gestures.
The cooperation model offered by gtk_gesture_group() is flexible
enough,
2014-05-23 19:54:28 +02:00
Carlos Garnacho
35bed1ac14 widget: Add docs for GtkGesture-related API 2014-05-23 19:54:28 +02:00
Carlos Garnacho
7a71c16317 widget: refactor gesture integration
Listen for notify::sequence-state-changed on the controller, so the
only way to manipulate a sequence state are gtk_gesture_set_sequence_state()
and gtk_gesture_set_state().

Also, make use of gesture groups, so the sequence state is set at once
on all gestures pertaining to a single group. Within a widget, if a sequence
is claimed on one group, it is made to be denied on every other group.
2014-05-23 19:54:25 +02:00
Carlos Garnacho
38e40a55f4 widget: Add gtk_widget_set_gesture_state()
This helper function ensures the state is propagated for
all the active sequences in the given gesture.
2014-05-23 19:54:24 +02:00
Carlos Garnacho
8e1d5f98de widget: Improve button press emulation on sequence denied
Ensure that state being set on pointer emulating touches actually
gets propagated properly on widgets with gestures that only handle
pointer events.
2014-05-23 19:54:24 +02:00
Carlos Garnacho
a56a9e4a62 widget: Reset gestures on grab-notify
If it is determined that the gesture will stop receiving
events, reset the gesture altogether.
2014-05-23 19:54:23 +02:00
Carlos Garnacho
997f05d99b widget: Make helper gesture API take GtkGestures
GtkEventController may be certainly useful to keep event
handling self-contained in other places than gestures, but
the current widget API is highly related to gestures, so
just using GtkGesture as the argument there will be quite
more convenient. The other places where GtkEventController
make sense as a base object will better provide their own
hooks.
2014-05-23 19:54:23 +02:00
Carlos Garnacho
026b5014e8 Add: GTK_PHASE_NONE value to GtkCapturePhase.
Gestures attached with this phase will expect callers to have it
receive events through gtk_event_controller_handle_event(), but
the gesture will still be notified of sequence state changes,
grabs, etc...
2014-05-23 19:54:23 +02:00
Carlos Garnacho
36106c19d4 widget: Propagate touch/button press events when a sequence is denied
If the captured touch begin or button press event have been consumed
for the given sequence, propagate it upwards if the sequence goes from
claimed to denied, so the widgets on the way to the event widget receive
a coherent event stream now that they're going to receive events.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
a9fa0151f1 widget: Implement hierarchy-level mechanism to claim/deny sequences
The policy of sequence states has been made tighter on GtkGesture,
so gestures can never return to a "none" state, nor get out of a
"denied" state, a "claimed" sequence can go "denied" though.

The helper API at the widget level will first emit
GtkWidget::sequence-state-changed on the called widget, and then
notify through the same signal to every other widget in the captured
event chain. So the effect of that signal is twofold, on one hand
it lets the original widget set the state on its attached controllers,
and on the other hand it lets the other widgets freely adapt to the
sequence state changing elsewhere in the event widget chain.

By default, that signal updates every controller on the first usecase,
and propagates the default gesture policy to every other widget in the
chain on the second. This means that, by default:

1) Sequences start out on the "none" state, and get propagated through
   all the event widget chain.
2) If a widget in the chain denies the sequence, all other widgets are
   unaffected.
3) If a widget in the chain claims the sequence, then:
  3.1) Every widget below the claiming widget (ie. towards the event widget)
       will get the sequence cancelled.
  3.2) Every widget above the claiming widget that had the sequence as "none"
       will remain as such, if it was claimed it will go denied, but that should
       rarely happen.

This behavior can be tweaked through the GtkWidget::sequence-state-changed and
GtkGesture::event-handled vmethods, although this should be very rarely done.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
76213ab209 widget: Add widget-level handling of touch sequence state.
These functions ATM do nothing but proxying the controller(s) state
with the given sequence.
2014-05-23 19:54:22 +02:00
Carlos Garnacho
f1bb0283dd widget: Hook GtkEventController to widget event processing.
A controller can be optionally hooked on the capture or the bubble
phase, so the controller will automatically receive and handle events
as they arrive without further interaction.
2014-05-23 19:54:22 +02:00
Matthias Clasen
49cf5142ba Deprecate GdkColor
It has been replaced by GdkRGBA. Time to make it official.
http://bugzilla.gnome.org/show_bug.cgi?id=636695
2014-05-22 09:09:55 -04:00
Matthias Clasen
70cb91a827 docs: syntax fix
It is just 'Deprecated:' in doc comments, not '@Deprecated:'.
2014-05-20 09:55:29 -04:00
Benjamin Otte
d260694a37 widget: Untagle if statements
Reduces the number of nested ifs and makes the code clearer.
2014-05-19 04:25:10 +02:00
Benjamin Otte
3cb5e58b1a API: Deprecate gtk_widget_region_intersect()
It's unused and would become disambiguous once we split between
allocation and draw region.
2014-05-18 02:29:56 +02:00
Benjamin Otte
2a99584c68 API: Deprecate gtk_widget_reparent() 2014-05-17 23:36:57 +02:00
Matthias Clasen
93204d3ba8 Don't lie about baselines so much
Let g_object_get (w, "valign",...) report the truth, so that the
inspector can show it without special cases.
2014-05-15 08:43:43 -04:00
Matthias Clasen
3f224a7165 Add private GtkWidget api for action groups
Similar to the just-added action muxer api for enumerating
action prefixes and for getting the action group for a
prefix.

https://bugzilla.gnome.org/show_bug.cgi?id=730095
2014-05-14 21:28:53 -04:00
Owen W. Taylor
8f9e50de80 GtkPopover: inherit actions from the relative_to widget
Make the relative_to widget the parent for a GtkPopover's
GtkActionGroup. This, for example, makes the menu model of a
GtkMenuButton find action groups attached to the button.

https://bugzilla.gnome.org/show_bug.cgi?id=729915
2014-05-12 16:39:44 -04:00
Matthias Clasen
5cd5db1f57 Remove a redundant check
gtk_widget_show/_hide already check the widget's visibility.

https://bugzilla.gnome.org/show_bug.cgi?id=728135
2014-05-11 11:56:22 -04:00
Cosimo Cecchi
b0ace67712 widget: deprecate focus-line-width style property
Nothing in GTK uses it anymore.
2014-05-09 11:02:46 -07:00
Cosimo Cecchi
e8c906966e widget: deprecate focus-line-pattern style property
Nothing in GTK uses it.
2014-05-09 11:02:44 -07:00
Cosimo Cecchi
a2decd1f2f widget: deprecate focus-padding style property
There's no use left inside GTK.
2014-05-09 11:02:44 -07:00
Cosimo Cecchi
b03c22e0c9 widget: deprecate interior-focus style property
Nothing uses it anymore inside GTK.
2014-05-09 11:02:42 -07:00
Matthias Clasen
d495ab1ca0 Small documentation update
Don't show an example that doesn't work anymore.
2014-05-05 09:41:06 -04:00
Matthias Clasen
456dffcbfd GtkWidget: Mark deprecated properties as such
The ::style, ::margin-left and ::margin-right properties are all
deprecated.
2014-05-02 19:25:27 -04:00
Benjamin Otte
db791ba3f5 widget: 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
Marcus Karlsson
3d956db500 docs: fix GtkWidget::size-allocate description
The documentation for the GtkWidget::size-allocate signal is missing the
description of the "allocation" parameter. Add the missing description
to the parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=726179
2014-04-13 14:43:47 -07: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
Bastien Nocera
f71f7215ab all: Name more idles and timeouts
Following up from 438cd857c4,
name more timeouts and idles.

The original grep was missing checking for gdk_threads_add_*()
functions (at least for some of the files).

https://bugzilla.gnome.org/show_bug.cgi?id=726870
2014-03-26 20:09:30 -04:00
Benjamin Otte
fbf99febf3 docs: Add more information to gtk_widget_set_realized()
It's important to point out that widgets should only be marked as
realized very late in the process. Even GTK widgets don't get this
right.

https://bugzilla.gnome.org/show_bug.cgi?id=726717
2014-03-20 14:34:31 +01:00
Matthias Clasen
ac96c35230 Update documentation about link styling
The ::link-color and ::visited-link-color style properties
are ignored now. Document that.
2014-03-17 15:00:45 -04:00
Owen W. Taylor
2f43800aa3 _gtk_widget_get_device_window: Fix for keyboard devices
Avoid a warning by returning NULL for keyboard devices, which can
never have an active pointer for a widget.
2014-03-13 10:31:08 -04:00
Owen W. Taylor
40b6d907bf Use GDK's current window tracking when synthesizing events in GTK+
Add gdk_device_get_last_event_window(), and use to implement the window
tracking we need for synthesizing crossing events for sensitivity changes
and gtk grabs, rather than keeping the information in qdata and updating
it based when GTK+ gets events.

https://bugzilla.gnome.org/show_bug.cgi?id=726187
2014-03-12 23:03:53 -04:00
Matthias Clasen
2ffeb591b1 Fix up signal deprecation 2014-03-03 23:31:48 -05:00
Matthias Clasen
7fae042208 Deprecate GdkEventVisibility and ::visibility-notify-event
These don't really work anymore in a composited world.
Lets make it official.
https://bugzilla.gnome.org/show_bug.cgi?id=481073
2014-03-03 21:39:03 -05:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
e79842d64c Document gtk_widget_get_scale_factor 2014-02-19 01:03:36 -05:00
Matthias Clasen
c779b42476 Docs: use // for comments in examples
Without sgml mode, we can't escape /* as /* anymore,
so just switch to // for comments in examples.
2014-02-14 23:34:22 -05:00
William Jon McCann
37a8ee6e95 docs: fully break lines in examples
Try to do a better job of keeping example content
from being too wide. It is often rendered as <pre>
text so the only time we can wrap it is in the source.

It is best to full break lines at all punctuation and
to try to keep the width under 70 chars or so.
2014-02-12 18:42:50 -05:00
Matthias Clasen
3459a0a273 Revert "Introduce API to get the preferred visual"
This reverts commit 2b95d1a34e.

Conflicts:
	gdk/gdkscreen.c
2014-02-10 22:15:28 -05:00
Matthias Clasen
d326507978 Revert "Use gdk_screen_get_preferred_visual()"
This reverts commit 30fa1426cf.

See the bugs
https://bugzilla.gnome.org/show_bug.cgi?id=724067
https://bugzilla.gnome.org/show_bug.cgi?id=723740
for the issues that are the reason for this revert.
2014-02-10 22:12:53 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
Matthias Clasen
c823498b4c Fix margin-start/end property implementation
The properties are declared read-write, but only the setter
was hooked up. This was leading to criticals in test apps using
the prop-editor.c code. Complete the implementation by adding the
getter side too.
2014-02-07 20:27:30 -05:00
William Jon McCann
13998c55e7 docs: use proper quotations instead of '*' 2014-02-07 14:22:39 -05:00
William Jon McCann
cb6483d382 docs: use apostrophe in *'d 2014-02-07 13:39:53 -05:00
William Jon McCann
fa3f1e1488 docs: use apostrophe in *'ve 2014-02-07 13:38:26 -05:00
William Jon McCann
a4b5929e81 docs: use apostrophe in *'re 2014-02-07 13:37:09 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -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
f116f0071e docs: use links instead of <xref> 2014-02-07 11:13:11 -05:00
William Jon McCann
0ce016650b docs: Use markup for links 2014-02-07 09:42:12 -05:00
Benjamin Otte
6d3347de63 widget: Ignore text direction in gtk_widget_set_state_flags()
Previously we did a semi-successful job at ignoring it. Unfortunately
this job was bad enough that we could lose the direction.

We still allow passing in the enum values, because we want code like
this to work:
  set_state_flags (get_state_flags() | SOME_FLAGS)
2014-02-07 14:48:54 +01:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
Bastien Nocera
4439453b75 widget: Fix margin-start and margin-end properties
The margin-start and margin-end properties were incorrectly
defined, so margins weren't respected for RTL languages.

https://bugzilla.gnome.org/show_bug.cgi?id=723627
2014-02-05 13:28:24 +01:00
William Jon McCann
3b3d8ca456 docs: Use "#" for refsect2 instead of ## 2014-02-04 21:00:58 -05:00
William Jon McCann
c6ef8bdc9c docs: don't use <para id=""> 2014-02-04 20:21:05 -05:00
William Jon McCann
8ad75bdfff docs: don't use <replaceable> 2014-02-04 19:20:16 -05:00
William Jon McCann
5dd751f006 docs: don't use ulink. use markdown instead 2014-02-04 18:53:51 -05:00
William Jon McCann
a22358c0c0 docs: use ` instead of <literal> 2014-02-04 18:24:29 -05:00
William Jon McCann
76447c3512 docs: use quotes instead of <firstterm> 2014-02-04 18:10:11 -05:00
Matthias Clasen
30fa1426cf Use gdk_screen_get_preferred_visual()
When creating windows, and when returning a widgets
visual, use the new API to get the preferred visual.
2014-02-04 13:15:47 -05:00
Matthias Clasen
2b95d1a34e Introduce API to get the preferred visual
Unless GDK_RGBA=0 is set, this will be the RGBA visual.
The new function is called gdk_screen_get_preferred_visual().

https://bugzilla.gnome.org/show_bug.cgi?id=630217
2014-02-04 13:15:46 -05:00
Olivier Brunel
a8d72a9c1e widget: Fix set_focus_child handling during focus changes
10b5ec20 made sure not to set focus_child to NULL all the way up to the
top, but only up to the common ancestor. However, it would never set it
on the common ancestor itself, which would therefore remain with a
focus_child set when it shouldn't.

A manifestation of the bug: focus column headers of a treeview, press Tab.
Now pressing Shift+Tab will go to another widget and not the column
headers, and Tab will (appear to) do nothing, all because the treeview
still has a focus_child set to column headers after a grab_focus().

Signed-off-by: Olivier Brunel <jjk@jjacky.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723402
2014-02-03 21:25:07 -05:00
Matthias Clasen
245c385ae7 Docs: Don't use note elements
In most cases, the text itself makes the message clear enough.
2014-02-02 01:22:14 -05:00
Matthias Clasen
09d1b28249 docs: Convert to markdown
Specifically, switch to using markdown syntax for sections.
2014-02-02 00:30:27 -05:00
William Jon McCann
4c8bd8e7cf docs: Identify examples that are C code
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
768bc44081 docs: use |[ ]| instead of <programlisting></programlisting>
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
Kjell Ahlstedt
3fa9846399 Improve doc of gtk_widget_override_color()
Mention that it's not recursively applied to a container's children.

https://bugzilla.gnome.org/show_bug.cgi?id=566945
2014-01-28 16:02:07 +01:00
William Jon McCann
2d003553e8 docs: don't use <emphasis>
It is a little heavy handed. The text can speak for itself.
2014-01-28 02:02:05 -05:00
William Jon McCann
0a1d276f4f docs: don't use <type> tags
Use # syntax where appropriate.
2014-01-28 00:21:26 -05:00
William Jon McCann
22586ea7c2 docs: use #*-struct instead of <structname> 2014-01-27 19:59:55 -05:00
Lionel Landwerlin
ed447eba08 widget: emit synthesized crossing event with correct device position
https://bugzilla.gnome.org/show_bug.cgi?id=704456
2014-01-27 13:25:55 +00:00
Matthias Clasen
5034920f78 Deprecate gtk_widget_get_root_window
The root window is a fairly X-centric concept, and it
really has no place in the GtkWidget API. Plus, this
is a rarely-used one-line convenience function with
poor documentation.
2014-01-24 20:16:34 -05:00
William Jon McCann
0426abd3c6 Improve docs for focus-line-pattern 2014-01-23 16:58:18 -05:00
William Jon McCann
6644b60999 docs: don't reference api that doesn't exist 2014-01-21 22:40:55 -05:00
William Jon McCann
889ba7abf8 docs: don't refer to NO_WINDOW as type 2014-01-21 22:40:55 -05:00
William Jon McCann
1f1a02b91f docs: don't use property syntax for style properties 2014-01-21 18:57:39 -05:00
William Jon McCann
e629a6b739 docs: fix name of function 2014-01-21 18:57:39 -05:00
William Jon McCann
8fb1335d69 docs: don't refer to NO_WINDOW flag 2014-01-21 18:57:38 -05:00
William Jon McCann
6a2190809e docs: don't use properties syntax for style properties 2014-01-21 18:57:38 -05:00
William Jon McCann
b1c31af18f docs: don't refer to TOPLEVEL flag 2014-01-21 18:57:38 -05:00
William Jon McCann
0d93930749 docs: refer to :has-focus property instead of HAS_FOCUS flag 2014-01-21 18:57:38 -05:00
William Jon McCann
255d6b9cd8 docs: fix typo in function name 2014-01-21 18:57:38 -05:00
William Jon McCann
c402c3343b docs: fix link to resource files overview 2014-01-21 18:57:38 -05:00
Volker Sobek
a4d69e7f14 docs/comments: Fix spelling of 'explicitly'
This replaces all occurrences of 'explicitely' with 'explicitly'. Only
code comments and gtk-doc statements are affected.

https://bugzilla.gnome.org/show_bug.cgi?id=722429
2014-01-18 03:47:46 +01:00
Debarshi Ray
a5ff70f949 widget: Add deprecation annotations for {get,set}_margin_{left,right}
Fallout from 9921bec63a
2014-01-17 18:03:52 +01:00
Matthias Clasen
8377c12b15 Code cleanup
Don't compare booleans to FALSE.
2013-12-01 17:54:00 -05:00
Jasper St. Pierre
1941f3ff17 gtkwidget: Fix up some deprecation warnings 2013-11-17 18:50:53 -05:00
Yosef Or Boczko
9921bec63a GtkWidget: Add margin-start and margin-end properties
Add margin-{start,end} and gtk_widget_{get,set}_margin_{start,end}
and drop margin-{left,right} and gtk_widget_{get,set}_margin_{left,right}.

margin-{start,end} handle right also in RTL.

https://bugzilla.gnome.org/show_bug.cgi?id=710238
2013-11-14 21:55:50 +01:00
Lionel Landwerlin
be5b6460e7 menushell/toolbar/window: implement toggle maximize on double click
https://bugzilla.gnome.org/show_bug.cgi?id=700419
2013-11-09 14:19:47 -05:00
Timm Bäder
9b1c943190 css parser: Add :link and :visited
... which are both to be used for links instead of the current
-GtkWidget-link-color and -GtkWidget-visited-link-color

https://bugzilla.gnome.org/show_bug.cgi?id=709629
2013-11-04 16:36:11 +01:00
Alexander Larsson
864f7f7ebc GtkWidget: Fix clipping to large subwindows
_gtk_widget_draw_internal() was clipping by passing the subwindow
sizes as a path to cairo_clip(). This was breaking for windows
larger than 23 bits in width/height, due to cairo using fixed point
(24.8) for the path coordinates.

We fix this by pre-clipping the subwindow region to the existing
cairo clip region in the full 32bit gdkwindow precision. This fixes
the GooCanvas Large Items test.

https://bugzilla.gnome.org/show_bug.cgi?id=710958
2013-10-28 11:56:52 +01:00
Bastien Nocera
7c12e6480b GtkWidget: Avoid lingering clock frame updates
For some widgets, like GtkTreeView, which setup a clock frame
update during realize, it was possible to call
gdk_frame_clock_begin_updating() twice, but only ever disconnecting
from it once. This happens because the realized flag is set at an
unpredictable time by the GtkWidget's realize implementation.

Keep the signal handler ID from us connecting to the "update" signal
to avoid connecting to it twice.

This fixes high wake-up count from any application using GtkTreeView,
even idle ones.

https://bugzilla.gnome.org/show_bug.cgi?id=710666
2013-10-23 15:22:27 +02:00
Ryan Lortie
abcddd3ae0 GtkWindow: change muxer setup with application
Previously, GtkWindow would add the "app" action group to its own
toplevel muxer.

Change the setup so that GtkApplication creates the toplevel muxer and
adds itself to it as "app".  Use this muxer as the parent muxer of any
GtkWindow associated with the application.

This saves a small amount of memory and will allow for accels to be
propagated from the application through to all of the windows.
2013-10-15 09:24:11 -04:00
Alexander Larsson
5bdfdcadff Remove opacity-groups
GtkWidget had a hack where if opacity is 0.999 we set up an opacity group when
rendering the widget. This is no longer needed in 3.10, and GtkStack doesn't
use it anymore.

GdStack is using it, so applications should be ported from GdStack to GtkStack
in 3.12.

https://bugzilla.gnome.org/show_bug.cgi?id=703603
2013-10-06 02:56:03 -04:00
Tristan Van Berkom
28a3638448 gtk-doc fixup for gtk_widget_class_bind_template_child_full()
Updated documentation to specify that '0' should be specified if
one does not need to automatically assign a bound child to a public
or private instance member (now that negative values are private
structure offsets).
2013-09-30 17:29:22 +02:00
Matthias Clasen
e5317f0f9a Improve struct packing in various places 2013-09-21 23:50:55 -04:00
Matthias Clasen
6aa56979dc More documentation fixes 2013-09-17 01:28:39 -04:00
Matthias Clasen
58e9e9d316 Improve gtk_widget_insert_action_group docs
Mention that group can be NULL. Related to

https://bugzilla.gnome.org/show_bug.cgi?id=708150
2013-09-16 21:13:00 -04:00
Murray Cumming
98ca9a865f GtkWidget: Improve drag-leave and drag-data-received docs.
* gtk/gtkwidget.c: drag-leave signal: Document that it is called before
      drag-drop.
      drag-data-received signal: Document that it is up to the application
      to know why the data was requested (e.g. drag motion or drop).
    * demos/gtk-demo/toolpalette.c: interactive_canvas_drag_drop():
      Do not transform the drop_item created in the drag-motion handler.
      Instead caused drag-data-received to be called, remembering why,
      and create a new item there.
      interactive_canvas_drag_leave(): Remove the idle-handler hack,
      now that we do not need to keep the drag-motion drop_item alive until
      the drop.

I noticed that this patch was sitting in bug #605611 from 2009
though it had been approved. I do not remember much about why I
created it.
2013-09-16 14:06:14 +02:00
Alexander Larsson
247c4cecfc Don't ever return BASELINE from gtk_widget_get_halign
This is the same behaviour as gtk_widget_get_valign, except
we have no gtk_wiget_get_halign_with_baseline, as baselines make
no sense for halign.

Without this some widgets (like e.g. GtkOverlay) crash if you accidentally
set a BASELINE halign.
2013-09-16 12:33:56 +02:00
Phil Clayton
59c4fb9d6a Add missing introspection annotations
https://bugzilla.gnome.org/show_bug.cgi?id=707519
2013-09-10 17:20:15 -04:00
Jasper St. Pierre
d6559251fb gtkwidget: Fix issues with baseline alignment comparison 2013-09-03 17:59:19 -04:00
Mike Gorse
d7e07a8470 Don't access memory after freeing it when destroying a tick callback
https://bugzilla.gnome.org/show_bug.cgi?id=704278
2013-08-30 09:42:41 -05:00
Piotr Drąg
60ec788489 Fix minor typos 2013-08-21 04:15:52 +02:00
Matthias Clasen
38e51b27c2 Trivial typo fix 2013-08-13 22:25:16 -04:00
Matthias Clasen
cda60c3c40 Another round of template binding api changes
We rename the gtk_widget_class_bind_template_child{_internal}
macros by appending a _private to their name. Otherwise, it
would be too magic to pass the 'public' names as arguments,
but affect a member of the Private struct. At the same time,

Add two new macros with the old names,
gtk_widget_class_bind_template_child{_internal} that operate
on members of the instance struct.
2013-07-26 16:29:12 -04:00
Emmanuele Bassi
89ae3524a3 Rename the widget template API
The macros and functions are inconsistently named, and are not tied to
the "template" concept - to the point that it seems plausible to use
them without setting the template.

The new naming scheme is as follows:

  gtk_widget_class_bind_template_child_full
  gtk_widget_class_bind_template_callback_full

With the convenience macros:

  gtk_widget_class_bind_template_child
  gtk_widget_class_bind_template_child_internal
  gtk_widget_class_bind_template_callback

https://bugzilla.gnome.org/show_bug.cgi?id=700898
https://bugzilla.gnome.org/show_bug.cgi?id=700896
2013-07-26 13:52:15 -04:00
Alexander Larsson
a8e84545d1 widget: Use a real offset in gtk_widget_class_automate_child
Using an offset from the struct means you can have children in
both the public and private (via G_PRIVATE_OFFSET) parts of the
instance. It also matches the new private macros nicer.

https://bugzilla.gnome.org/show_bug.cgi?id=702563

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2013-07-26 08:41:09 -04:00
Matthias Clasen
2f1fa7cdc3 Drop some unnecessary includes
Drop includes of deprecated headers where they are
no longer needed.
2013-07-19 22:32:23 -04:00
Matthias Clasen
0aa57d26b5 Move wholly deprecated classes to gtk/deprecated/
We've recently a number of classes wholly. For these cases,
move the headers and sources to gtk/deprecated/ and adjust
Makefiles and includes accordingly.

Affected classes:
GtkAction
GtkActionGroup
GtkActivatable
GtkIconFactory
GtkImageMenuItem
GtkRadioAction
GtkRecentAction
GtkStock
GtkToggleAction
GtkUIManager
2013-07-19 21:39:47 -04:00
Kjell Ahlstedt
16c08ae135 Fix some inconsistent deprecations
Some functions had only a deprecation comment in the .c file, or only a
deprecation annotation in the .h file. Add the missing parts.

https://bugzilla.gnome.org/show_bug.cgi?id=703616
2013-07-09 06:54:26 -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
e61c124509 Deprecate and hardcode values for gtk-tooltip* timeouts 2013-07-08 15:02:28 -04:00
Matthias Clasen
c0c752fab1 Cosmetics 2013-07-06 23:11:19 -04:00
Alexander Larsson
5f245374ed widget: Remove some leftover code
The norender stuff is not used anymore
2013-07-04 13:16:05 +02:00
Alexander Larsson
9e4af0b746 widget: Don't crash if setting alpha on non-realized widget.
https://bugzilla.gnome.org/show_bug.cgi?id=703154
2013-07-04 13:10:58 +02:00
Alexander Larsson
38e1748df8 GtkWidget: Propagate scale to GtkStyleContext 2013-07-03 14:39:25 +02:00
Alexander Larsson
6bf32999b1 widget: Track when the window scale factor changes and notify
The scale-factor property on the widgets will be notified, and the
scale will change on the style property, causing us to pick up
new css assets.
2013-07-03 14:34:13 +02:00
Michael Natterer
c0ea0b5aad gtk: add gtk_widget_get_scale_factor() 2013-07-03 14:34:13 +02: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
William Jon McCann
424e1d0059 Start deprecating some GtkStock API 2013-06-25 19:05:32 -04:00
Alexander Larsson
242d0c5d22 Revert "GtkWindow: Move cairo_save/restore from marshaller"
This reverts commit 6c7689506f.

This is not right as we need to save/restore around *each*
callback, not just each emission.
2013-06-18 11:32:18 +02:00
Alexander Larsson
6a77754c77 GtkWidget: Change which states propagate
Historically the following states propagated to children:
  GTK_STATE_FLAG_ACTIVE
  GTK_STATE_FLAG_PRELIGHT
  GTK_STATE_FLAG_SELECTED
  GTK_STATE_FLAG_INSENSITIVE
  GTK_STATE_FLAG_INCONSISTENT
  GTK_STATE_FLAG_BACKDROP

However, several of these are problematic on containers like GtkListBox.
For instance, if a row is ACTIVE or SELECTED then all children (like e.g
a button) inside the row will *also* look active/selected. This is almost
never right. The right way to theme this is to catch e.g. SELECTED on the
container itself and set e.g. the color and let the children inherit
the color instead of the flag.

We now propagate only these flags:
  GTK_STATE_FLAG_INSENSITIVE
  GTK_STATE_FLAG_BACKDROP

Which make sense to be recursive as they really affect every widget
inside the container.

However, this is a CSS theme break, and while most things continue working
as-is some themes may need minor tweaks.
2013-06-13 12:17:07 +02:00
Ryan Lortie
6c49cd0ea6 action stuff: stop abusing GLib's namespace
Rename our internal GActionMuxer, GActionObserver and GActionObservable
classes and interfaces to have names in our own namespace.

These classes were originally intended for GIO but turned out to be too
special-purpose to be useful there, so we never made them public API but
have just been copying them around (without bothering to properly rename
them).  Now that other people will be copying them out of Gtk, it's even
more important to prevent this namespace abuse from spreading further.
2013-05-13 16:33:42 -04:00
Benjamin Otte
20e8675106 widget: Remove unused variable 2013-05-09 19:09:50 +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
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
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
Stefan Sauer
b8366027b3 widget: fix two typos in api-docs 2013-05-03 20:40:00 +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
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
Benjamin Otte
41e8d3df6d widget: Improve debug output 2013-05-01 16:41:11 +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
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
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
ac8817d34b GtkWidget: Add missing Since docs 2013-04-23 05:58:08 +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
Simon Kågedal Reimer
d29a441106 doc: Clarify gtk_widget_queue_draw_region() doc 2013-04-15 15:43:26 +02:00
Benjamin Otte
72290fb538 docs: Fix Since tag for frame clock functions 2013-04-09 12:09:11 +02:00
Tristan Van Berkom
3b7fc8cdc9 Add Composite Child machinery and APIs to GtkWidget
This commit implements the needed machinery for GtkWidget
to build it's composite content from GtkBuilder XML and
adds the following API:

  o gtk_widget_init_template()

    An api to be called in instance initializers of any
    GtkWidget subclass that uses template XML to build it's components.

  o gtk_widget_class_set_template()

    API to associate GtkBuilder XML to a given GtkWidget subclass

  o gtk_widget_class_automate_child()

    API to declare an object built by GtkBuilder to be associated
    with an instance structure offset and automatically set.

 o gtk_widget_get_automated_child()

   API for bindings to fetch a child declared to be automated by
   gtk_widget_class_automate_child(), for the case where bindings
   do not generate GObjects under the hood and cannot use structure
   offsets to resolve composite object pointers.

 o gtk_widget_class_declare_callback[s]()

   Declare static functions to be used in signal callbacks from
   a given class's template XML

 o gtk_widget_class_set_connect_func()

   API for bindings to override the signal connection machinery
   for a given GtkWidget derived class.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
c6ab515735 Deprecate gtk_widget_push_composite_child & friends
Deprecate gtk_widget_push_composite_child, gtk_widget_pop_composite_child,
gtk_widget_set_composite_name, gtk_widget_get_composite_name.

This API is just bloat and was never useful, this patch deprecates
it and removes all internal calls to the composite child APIs
2013-04-08 21:19:27 +09:00
Alexander Larsson
a2c65d47b0 Fix gtk_window_set_opacity()
We *do* want to call gdk_window_set_opacity() on toplevels, because
this particular case does work.

https://bugzilla.gnome.org/show_bug.cgi?id=697263
2013-04-04 15:42:02 +02:00
Benjamin Otte
e69e609bd7 style: Add missing deprecation markers
Some functions in gtkstyle.h were overlooked when we added the
GDK_DEPRECATED macros.

Also add IGNORE_DEPRECATIONS to the few remaining callers of those
functions.
2013-04-02 11:45:45 +02:00
Benjamin Otte
231520af8f widget: Get rid of deprecation warnings 2013-04-02 11:45:44 +02:00
Sébastien Wilmet
6cb2816c45 GtkWidget: add missing deprecation marks
https://bugzilla.gnome.org/show_bug.cgi?id=696138
2013-03-24 14:22:38 -04:00
Alexander Larsson
76e466197a GtkWidget: Handle style updates before realize
If the style changes before we're realized we will delay the
style-updated signal until realize. However, we then lose
the changes bitmap. This means that gtk_widget_real_style_updated()
must treat a NULL change as "everything changed" and queue a resize.
2013-03-20 13:56:16 +01:00
Chun-wei Fan
b9e189150b gdk/gdkwindow.c, gtk/gtkwidget.c: Include fallback-c89.c
Both of them started to make use of round(), a C99 function.  So, include
fallback-c89.c to provide a fallback implementation for round() for
compilers that don't have round()

https://bugzilla.gnome.org/show_bug.cgi?id=694339
2013-03-13 13:22:48 +08:00
Will Thompson
507bf6e5cf docs: correct various spelling and grammar errors
I noticed a few cases of "wether", and while fixing them noticed a few
"its" which should be "it's". It all went downhill from there.
2013-03-04 22:48:22 +00:00
Alexander Larsson
c4539df2f2 Re-fix opacity group handling
The last change fixed the windowed widget case but broke
opacity group handling for windowed child widgets. This fixes
up the code by making sure we norender_children in when there
is an opacity group.

This also cleans up the comments about how this works to something
that is hopefully more understandable.
2013-03-01 14:56:30 +01:00
Alexander Larsson
bbfc8f9a9b Fix opacity group hack
We can't norender the main window for a windowed widget as we then
never get any expose events.
2013-02-27 12:59:19 +01:00
Matthias Clasen
b234025410 Some more documentation fixes
Make frame-clock-related symbols show up in the gtk docs.
2013-02-25 11:30:00 +01:00
Federico Mena Quintero
a41b73fbc7 GtkWidget::draw() - Document how to get the dirty region
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-21 18:48:13 -06:00
Cosimo Cecchi
7d4976b46e docs: add some missing gtk-doc blocks and Since tags for new API 2013-02-18 20:10:01 -05:00
Owen W. Taylor
3e81854351 gtk_widget_on_frame_clock_update: ref the widget
Handle a widget being destroyed while in a tick callback by
referencing the widget while dispatching tick callbacks.
2013-02-18 15:25:51 -05:00
Owen W. Taylor
1db87c897f Add gdk_frame_clock_begin/end_updating()
Add an API to start or stop continually updating the frame clock.
This is a slight convenience for applcations and avoids the problem
of getting one more frame run after an animation stops, but the
primary motivation for this is because it looks like we might have
to use timeBeginPeriod()/timeEndPeriod() on Windows to get reasonably
accurate timing, and for that we'll need to know if there is an
animation running.

https://bugzilla.gnome.org/show_bug.cgi?id=693934
2013-02-18 17:14:24 +01:00
Alexander Larsson
bbb981fd1a Fix gtk_widget_add_tick_callback sometimes not working
We clear GtkTickCallbackInfo on creation to ensure all fields start
as 0. Before we sometimes ended up with destroyed being 1
so the tick was never called.
2013-02-15 15:46:33 +01:00
Alexander Larsson
c6c33c5cd7 Fix up s/gtk_frame_clock/gdk_frame_clock/ in docs 2013-02-15 14:02:02 +01:00
Owen W. Taylor
ce835dee74 GtkContainer: fix disconnection from frame clock
We need to disconnect the frame clock when we unrealize (at which
point the old clock is still alive) not in destroy(). Since there
is no common unrealize for containers, trigger this from GtkWidget.
2013-02-14 17:19:53 -05:00
Owen W. Taylor
7bb07317f3 GtkTickCallback: document use of G_SOURCE_CONTINUE/REMOVE for return value
Document that G_SOURCE_CONTINUE and G_SOURCE_REMOVE are the preferred
return values from a tick callback.
2013-02-14 17:19:53 -05:00
Owen W. Taylor
449e8c8856 Add gtk_widget_add_tick_callback(), remove GtkTimeline, etc.
Add a very simple GtkWidget function for an "tick" callback, which
is connected to the ::update signal of GdkFrameClock.

Remove:

 - GtkTimeline. The consensus is that it is too complex.
 - GdkPaintClockTarget. In the rare cases where tick callbacks
    aren't sufficient, it's possible to track the
    paint clock with ::realize/::unrealize/::hierarchy-changed.

GtkTimeline is kept using ::update directly to allow using a GtkTimeline
with a paint clock but no widget.
2013-02-14 17:19:52 -05:00
Owen W. Taylor
344a69880a Add an UPDATE phase and GdkFrameClockTarget, use for GtkStyleContext
Switch GtkStyleContext to using GdkFrameClock. To do this, add a new
UPDATE phase to GdkFrameClock.

Add a GdkFrameClockTarget interface with a single set_clock() method,
and use this to deal with the fact that GtkWidget only has a frame
clock when realized.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:48 -05:00
Owen W. Taylor
c4545cc5d4 GdkFrameClock: Make the phase explicit when requesting the frame
Instead of having gdk_frame_clock_request_frame() have
gdk_frame_clock_request_phase() where we can say what phase we need.
This allows us to know if we get a frame-request during layout whether
it's just a request for drawing from the layout, or whether another
layout phase is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:48 -05:00
Owen W. Taylor
7753883add Use GdkFrameClock for relayout
Add a ::layout signal to GdkFrameClock and use it instead of an idle
handler to drive the restyling and relayout of containers.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:47 -05:00
Owen W. Taylor
77bac0d6ae Add GdkFrameClock
Add an object GdkFrameClock that we associate with a GdkWindow.
This tracks when the window needs to be repainted, and will also
be used for other operations in the future like relayout and
updating animations.

Based on a patch from Havoc Pennington:

 https://mail.gnome.org/archives/gtk-devel-list/2010-October/msg00004.html

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:47 -05:00
Alexander Larsson
8b9254c8a7 Add opacity_group hack
This adds a way to get the gtk_widget_set_opacity liike behaviour
of retargeting GdkWindows and exposing every child in ::draw, without
actually having an alpha. This is needed if you're doing more complex things
such as cross fading of widgets.

We do this as a hack by using opacity values that round to 255 yet not
really 1.0 in order to avoid having some magical API call for this
mainly internal call.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-12 17:02:53 +01:00
Alexander Larsson
7319f2934f Clean up the opacity handling
This cleans up the internals but doesn't really change the behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-11 20:38:59 +01:00
Matthias Clasen
2379445c1d Correct the documentation for how to set accessible names
The example in the GtkWidget docs was referring to a nonexisting
AtkObject::name property. The correct property name is
accessible-name.
2013-02-10 15:47:14 -05:00
Alexander Larsson
366b4db791 css: Support opacity
https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:38 +01:00
Alexander Larsson
fa8b71450c Add gtk_widget_get/set_opacity
This adds gtk_widget_get/set_opacity, as well as a GtkWidget.opacity
property. Additionally it deprectates gtk_window_get/set_opacity and
removes the GtkWindow.opacity property (in preference for the new
identical inherited property from GtkWidget, which should be ABI/API
compat).

The implementation is using the new gdk_window_set_opacity child
window support for windowed widgets, and cairo_push/pop_group()
bracketing in gtk_widget_draw() for non-window widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01: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
Benjamin Otte
af176efc0f widget: Another place to relax the visibility requirement
See commit 154204e891 for details
2013-01-26 21:04:55 +01:00
Benjamin Otte
154204e891 widget: Allow invisible toplevels to do sizing operations
This is a quickfix to keep things working.

It turns out GtkWindow assumes it can do sizing operations while not
being visible, or while in the process of show()ing/hide()ing itself.
And commit b495ce54 broke these operations.

Figuring this properly requires some more thinking and restructuring on
my part, so for now we relax the requirement of visiblility enough for
these things to start working again.
2013-01-24 14:28:58 +01:00
Cole Robinson
cbce906228 widget: Add annotation (allow-none) for set_tooltip_text
https://bugzilla.gnome.org/show_bug.cgi?id=691639
2013-01-20 22:03:49 -05:00
Benjamin Otte
ad723bd9a9 widget: Remove leftover debug statement
Seems we didn't hit this very often. :)
2013-01-08 16:10:30 +01:00
Benjamin Otte
b495ce5446 widget: Give some meaning to "visible"
GtkWidget::visible is required for the widget to:
- have a preferred size other than 0/0
- have a size allocated
- return other values than { -1, -1, 1, 1 } from get_allocation()

This is an experimental patch aiming to make concepts and behaviors
inside GTK more concreate. GtkWidget::visible is now essentially what
CSS does for "display: none".

Note that if you want the effect of CSS's "visibility: hidden", you'll
have to use a GtkNotebook with an empty page as the concept of reserving
space but not drawing anything isn't supported natively in GTK.
2013-01-08 14:56:02 +01:00
Benjamin Otte
6b9b925add widget: Fix initial state flags for RTL 2012-12-29 02:33:14 +01:00
Benjamin Otte
3e979d911b widget: Fix state propagation code
Previously, with STATE_FLAGS_REPLACE we would unset _all_ the state
flags on children, not just the ones that do propagate. This caused the
RTL/LTR flags to get lost.
2012-12-29 02:24:27 +01:00
Benjamin Otte
cc986fdc1c widget: Remove underscore prefix from static function 2012-12-29 02:06:51 +01:00
Benjamin Otte
a73cc55e02 stylecontext: Use state flags for direction
... instead of using a custom direction member.

And with that, GtkWidget doesn't need to call
gtk_style_context_set_direction() anymore.
2012-12-18 18:25:42 +01:00
Benjamin Otte
1bf3de223a widget: Set state flags for direction 2012-12-18 18:25:42 +01:00
Benjamin Otte
26186c74c6 API: Add state flags for RTL and LTR
See http://www.whatwg.org/specs/web-apps/current-work/#pseudo-classes
for the rationale.
2012-12-18 18:25:41 +01:00
Alexander Larsson
bf35c2f044 GtkLabel: Rely on the new pango support for context change tracking
Now that Pango tracks changes to the context automatically there is
no need to do it manually in e.g. style-updated or direction-changed,
in fact the only case we have to care about is when we re-create
the PangoContext due to a screen change, so we only have to clear
the layouts in GtkLabel in screen-changed.

This means we're not clearing all the layouts whenever the state changes,
which happens to every widget when the window is unfocused, which helps
performance a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=340066
2012-12-06 19:54:05 +01:00
Benjamin Otte
055b5d83d5 gtk: Use gtk_style_context_get()
... instead of soon-to-be-deprecated gtk_style_context_get_font().
2012-12-06 02:57:18 +01:00
Alexander Larsson
cd016ef8e3 Revert "Don't queue resize for hidden widgets without a size group"
This seems to break redraw of the middle pane in glade.

This reverts commit faaae520c9.
2012-12-04 21:30:04 +01:00
Alexander Larsson
faaae520c9 Don't queue resize for hidden widgets without a size group
queue_resize basically tells the parent widget that it may need
to pick a different size/layout. However, for a hidden child widget
that should never be needed. It may be that the widget is in a
sizegroup that has ignore_hidden == FALSE though, so it may
affect the size group calculations.

However, if a widget is not visible and not in a size group then
its safe to avoid the resize, as the widget will be resized on
becoming visible anyway.

This avoids a lot of size allocation for hidden things like menus
and tooltips.
2012-12-04 20:16:44 +01:00
Alexander Larsson
47714f55ee css: Avoid queue_resize in _gtk_widget_style_context_invalidated
We've already emitted style_updated, and the handler for that queues
a resize if necessary.
2012-12-04 20:16:44 +01:00
Benjamin Otte
35362337ec widget: Optimize away unndeeded redraws
If only styles were updated that don't require resizes, don't queue one.
2012-11-30 20:40:18 +01:00
Matthias Clasen
e75860e466 Add a missing va_end call
va_copy must be matched with va_end.
2012-11-29 23:18:49 -05:00
Benjamin Otte
da7a4089fe widget: Remove an unneeded queue_resize()
Resizes are queued via
   gtk_widget_propagate_state()
=> gtk_style_context_set_state()
=> gtk_style_context_queue_invalidate()
=> gtk_style_context_validate()
=> _gtk_widget_style_context_invalidated()
so there's no need to queue an extra one.
2012-11-25 04:46:36 +01:00
Benjamin Otte
4f9a8e6b3d symboliccolor: Remove extra includes
That header was included in way too many places.
2012-11-25 02:59:15 +01:00
David King
e677cee28f docs: Correct GtkWidget::scroll-event mask documentation
Since GTK+ 3.3.18, GDK_SCROLL_MASK has been used as the mask for scroll
events. Update the documentation to reflect this.

https://bugzilla.gnome.org/show_bug.cgi?id=677339
2012-11-22 21:36:40 +00:00
Benjamin Otte
14c8e33ab9 widget: Get rid of unused flags
Now that we clear the cache immediately, there's no need anymore to
track if a request has been queued.
2012-11-14 01:55:28 +01:00
Benjamin Otte
4366f80aab sizerequestcache: Move functions
... into the sizerequestcache.c file.
2012-11-14 01:55:28 +01:00
Benjamin Otte
0a1a2ac148 sizerequest: Split out size request cache code into separate header 2012-11-14 01:55:28 +01:00
Benjamin Otte
8bdff7a564 sizegroup: Construct the set of sizegroup peers as a hash table
This way we don't need a marker on GtkWidgetParivate that needs to be
unset later, so we have all our data in the same place and can avoid
problems with reentrancy and shenanigans like that.

But the main reason I wrote that is cleaner code.
2012-11-04 15:47:03 +01:00
Benjamin Otte
dd6931d1ba sizegroup: Use _gtk_widget_compute_size_for_orientation()
With this function now available, we can do size computation in 2
ways:
(1) Compute size with size groups
(2) Compute size without size groups

And have (1) use (2) instead of setting flags on widgets. This patch
does exactly that.
2012-11-04 15:28:43 +01:00
Benjamin Otte
48ff2fc7ed API: Add gtk_widget_is_visible()
This is a recursive gtk_widget_get_visible(): Returns TRUE if the widget
and all its parents are visible.
2012-11-04 15:24:17 +01:00
Tristan Van Berkom
8705c59f8c Amended documentation for gtk_widget_set_size_request().
It seems we missed updating this since GTK+3, widgets cannot be
allocated less than the size they requested in thier request
phase, and explicit sizes are used only to grow the size request.
2012-10-02 23:11:39 +09:00
Benjamin Otte
1e0fe40560 widget: Move style context update out of vfunc
Otherwise the evil widgets that don't chain up their map and unmap
vfuncs will not get updated style contexts. This is in particular true
for GtkWindow and the CSS Theming / animated backgrounds demo in
gtk-demo.
2012-10-01 15:53:17 +02:00
Benjamin Otte
7712d41b5e stylecontext: Refactor the way animations are started and stopped
We now create animation objects unconditionally, but we only run the
animation loop when gtk_style_context_should_animate() return TRUE.
2012-09-17 20:40:01 +02:00
Benjamin Otte
206aa209ae widget: Use gtk_widget_queue_draw() for queueing redraws
This change is necessary because the old code did not accound for corner
cases (like translucent child windows), which could stop
gtk_widget_queue_resize() to not trigger redraws.
2012-09-17 20:39:12 +02:00
Matthias Clasen
78c44d31d3 Small tweaks to the DND docs
As pointed out by Columban Wendling in
https://bugzilla.gnome.org/show_bug.cgi?id=684096,
the GtkWidget DND docs were referring to several drag context
members that are private, nowadays.
2012-09-15 16:17:03 -04:00
Carlos Garnacho
1f7e375c33 Add GtkTextHandle
This is a helper object to allow text widgets to implement
text selection on touch devices. It allows for both cursor
placement and text selection, displaying draggable handles
on/around the cursor and selection bound positions.

Currently, this is private to GTK+, and only available to
GtkEntry and GtkTextView.
2012-09-03 00:19:03 -04:00
Ryan Lortie
828a97d773 GtkWidget: fix insert_action_group(NULL)
gtk_widget_insert_action_group (widget, "foo", NULL) is valid, but
g_action_muxer_insert (muxer, "foo", NULL) is not.  Use
g_action_muxer_remove() for that case.
2012-08-23 08:18:11 -04:00
Matthias Clasen
79eeb78c46 Fix the doc build 2012-08-20 23:38:03 -04:00
Lars Uebernickel
d30d56452c GtkWidget: Add gtk_widget_insert_action_group()
This allows adding a GActionGroup with a given name at an arbitrary
point in the widget tree.

This patch also adds an internal _get_action_muxer() API.  Calling this
will create a GActionMuxer associated with the widget.  The parent of
the muxer will be the muxer of the widget's conceptual parent.  For
non-menus, that is the normal parent.  For menus, it is the attach
widget.

In this way, we end up with a hierarchy of GActionMuxer that largely
reflects the hierarchy of GtkWidget, but only in places that the action
context has been requested.  These muxers are the ones on which the
inserted actions groups are installed.

A following patch will add a user of this API.
2012-08-20 13:09:04 -04:00
Frédéric Péters
9399275089 doc: fix location of ATK documentation (GNOME bug 682193) 2012-08-19 19:07:22 +02:00
Philip Withnall
f92a092bac Bug 680822 — Document return value of GtkWidget::draw
Document the boolean accumulator used by GtkWidget::draw and a few other
GtkWidget signals.

Closes: https://bugzilla.gnome.org/show_bug.cgi?id=680822
2012-07-30 16:12:06 +02:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00