Commit Graph

1306 Commits

Author SHA1 Message Date
Benjamin Otte
bd31310c40 widget: Add debug spew for setting the clip 2015-01-22 16:25:30 +01:00
Benjamin Otte
dbb8d1dd07 stylecontext: Keep track of the CSS ID
This is necessary since we do the new caching and need to distinguish
between styles with different IDs.

Fixes various test cases.
2015-01-20 01:07:13 +01:00
Carlos Garnacho
b8e87d4762 widget: Free the controller list on finalize()
If this is done on dispose(), the widget may be destroyed (and its
controllers list NULLified) within _gtk_widget_run_controllers(),
causing warnings/crashes when it just tried to hop on the next
controllers.

Freeing the controllers here should be a safety net for implementations,
so it also makes sense to do this late. The widgets that choose to
free their controllers on dispose can still do so, and get
_gtk_widget_remove_controller() called for these as an indirect result.
2015-01-14 17:11:25 +01:00
Matthias Clasen
53c388b724 Some formatting cleanups 2014-12-21 22:58:23 -05:00
Benjamin Otte
42a6ae6c6c widget: Set the allocation via gtk_widget_set_allocation()
There is no good reason to assign the value directly.

Also, this fixes d23f3254b7
where widgets that chained up instead of calling
gtk_widget_set_allocation() would not draw becaues of empty clip.
2014-12-20 20:41:18 +01:00
Benjamin Otte
d23f3254b7 widget: Handle setting clip differently
(1) Get rid of supports_clip flag. All widgets (implicitly) support
clip.

(2) Don't reset the clip to { 0, 0, 0, 0 } before the "size-allocate"
signal.

(3) Make gtk_widget_set_allocation() set the clip (to the allocation).
This ensures that eveyr widget has a clip set.
Note: It overrides previous calls to gtk_widget_set_clip(), while in
3.14 this didn't happen.

(4) As the clip is set by gtk_widget_set_allocation() now, don't set
it after the "size-allocate" signal anymore.

This fixes calls to gtk_widget_queue_draw() from inside the
size_allocate vfunc.
2014-12-19 19:20:07 +01:00
Christian Hergert
661da5558c widget: add helpers to resolve GActionGroups available to GtkWidget
These functions, while added for use by the GTK inspector, are generally
useful to applications that need to resolve what action groups are
available to a particular GtkWidget.

https://bugzilla.gnome.org/show_bug.cgi?id=741386
2014-12-11 15:25:41 -08:00
Carlos Soriano
235837ad49 gtkwindow: Use actions from focused widget to activate accel
Currently we only take into account the window GActionGroup for
activating the accels.

However, the application could have some custom GActionGroup in the
chain of focused widgets that could want to activate some action if
some accel is activated while that widget is focused.

To allow applications to set accels on widgets that use custom
GActionGroups, simply use the muxer of the focused widget, which
already contains the actions of the parents.

https://bugzilla.gnome.org/show_bug.cgi?id=740682
2014-12-08 20:19:33 -08:00
Matthias Clasen
64fd964703 GtkWidget: Don't return FALSE as a pointer
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=741251
2014-12-08 09:16:24 -05:00
Matthias Clasen
06745bc0aa Add a note to the ::destroy docs
Clarify that ::destroy is not suitable for saving widget state.

https://bugzilla.gnome.org/show_bug.cgi?id=710793
2014-12-07 18:12:46 -05:00
Jasper St. Pierre
579c7f80a0 gtkwidget: Fix a typo preventing the CSD input shape from applying
We were setting "csd-shade" but reading from "csd-region".
2014-12-01 18:01:49 -08:00
Benjamin Otte
7ecdaaacb2 widget: Clarify some corner cases
I checked Cairo source code (actually pixman, as Cairo just passes
through) to make sure that the behavior stays identical: negative values
cause an error message from pixman, zero is allowed. Both return an
empty region which gtk_widget_queue_draw_region() would then proceed to
ignore.
2014-11-29 03:42:28 +01:00
Jasper St. Pierre
0c09d44509 gtkwidget: Remove unnecessary code in get_state_flags
Any time has_focus is called, we will call gtk_widget_update_state_flags
which will assign the state flags properly.
2014-11-25 11:04:36 -08:00
Matthias Clasen
8765970ba1 Remove a redundant call
No need to set shapes twice in a row.
2014-10-29 06:49:59 -04:00
Matthias Clasen
c9ad936011 Drop an unused variable 2014-10-29 06:49:58 -04:00
Matthias Clasen
778865f316 Fix toplevel input shape for csd windows
We need to maintain the application-set and the the csd
input shape separately, and intersect them to pass them
down.
2014-10-28 20:23:47 -04:00
Matthias Clasen
4cf6edda55 wayland: Make window opacity work
Under wayland, the compositor doesn't have a 'overall window alpha'
knob, we just need to add the alpha to the buffers we send.
Client-side alpha, if you want to call it that.

Implement this by reusing the existing alpha support for non-toplevel
widgets. As a side-effect of the implementation, windows with RGBA
visual under X will now also use per-pixel alpha, instead of
overall alpha.
2014-10-28 10:28:23 -04:00
Matthias Clasen
a55000613a Add private API to query tick callbacks
This information can be useful for debugging purposes.
2014-10-24 08:34:13 -04:00
Bastien Nocera
d0f4e73999 gtkwidget: Fix typo in comment 2014-10-21 10:10:50 +02:00
Matthias Clasen
d7b64c63e0 Improve tooltip-text/markup docs
Clarify priorities between the two,
https://bugzilla.gnome.org/show_bug.cgi?id=681185
2014-10-19 23:28:34 -04:00
Matthias Clasen
e3ef5d6fd2 GtkTooltip: Move nonexported API to a private header
This is our standard practice nowadays.
2014-10-19 22:51:21 -04:00
Alexander Larsson
d0147a6f2c Add gdk_window_mark_paint_from_clip and call from widget drawing
This is a new function that gets called every time we're drawing
some area in the Gtk paint machinery. It is a no-op right now, but
it will be required later to keep track of what areas which
we previously rendered with GL was overwritten with cairo contents.
2014-10-13 10:43:31 -04:00
Matthias Clasen
63efdca223 Deprecate GtkWidget override APIs
This is better done with css and style classes nowadays.
2014-09-30 00:08:59 -04:00
Benjamin Otte
9a8a4a8b14 widget: Don't assume opacity is 100%
... just because there is no style context instantiated yet. Instead,
instantiate a style context during realize() and ask it.

Fixes problems with dim labels not being dimmed on first show.

Testcase included.

https://bugzilla.gnome.org/show_bug.cgi?id=735240
2014-09-07 01:57:10 +02:00
Matthias Clasen
d55e3b25a7 Fix various compiler warnings
Mostly missing declarations and missing statics.
2014-09-05 21:21:49 -04:00
Benjamin Otte
01d644b7ee widget: Don't connect to GtkModifierStyle::changed
Changes to the modifier style will be picked up by the
GtkStyleProviderPrivate::changed signal. And that signal will actually
invalidate properly.
2014-08-27 17:57:10 +02:00
Benjamin Otte
b5a8b7ef3b widget: Make _gtk_set_simple_clip() take an optional content clip 2014-08-21 00:54:07 +02:00
Matthias Clasen
c9da8bf2b3 Revert "docs: Fix broken gtk-doc formatting"
This reverts commit a7562dd38f.

I prefer to not confuse gtk-doc with doc comments for private
functions.
2014-08-18 08:18:02 -04:00
Rico Tzschichholz
a7562dd38f docs: Fix broken gtk-doc formatting
Fixes broken introspection of GtkTranslateFunc
2014-08-18 13:27:05 +02:00
Matthias Clasen
d206d694fd GtkWidget: fix up docs minimally 2014-08-16 21:40:39 -04:00
Benjamin Otte
65cc3630c8 widget: Add checks for setting state flags
This is more for GTK developers to catch when they forgot to change
GTK_STATE_FLAGS_BITS after adding a new state flag than to prevent
widget developers from using the wrong flags.
2014-08-16 16:34:15 +02:00
Benjamin Otte
36a2e7ca8e css: Add a :checked pseudoclass
https://bugzilla.gnome.org/show_bug.cgi?id=733967
2014-08-16 16:34:14 +02:00
Carlos Garnacho
62507776fe widget: Include event controllers' event mask on gtk_widget_get_events()
gtk_widget_get_events() must indeed tell about events enabled purely through
a GtkEventController, those events will most surely trigger event handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=734357
2014-08-12 14:28:34 +02:00
Matthias Clasen
327b097725 Trivial: Use g_clear_object more
It no longer has atomic overhead, so we can use it everywhere.
2014-08-09 10:16:27 +02:00
Benjamin Otte
52dd0f5014 widget: Add widget state when appending to widget path
Make gtk_widget_path_append_for_widget() add the state flags of the
widget, too.

This enables the ability to select pseudoclasses on all elements in a
selector.
2014-07-19 23:42:39 +02:00
Benjamin Otte
3e82d12abd widget: Remove special case for clipping
Labels now call gtk_widget_set_clip() so there is no longer a need to
exclude them from clipping.
2014-07-10 18:56:35 +02:00
Sébastien Wilmet
03b4c82f77 docs: make GtkWidget:margin-start and margin-end clearer
margin-start and margin-end have been added for RTL support, see:
https://bugzilla.gnome.org/show_bug.cgi?id=710238

So those properties are used only for the horizontal direction: left or
right, not top or bottom.

https://bugzilla.gnome.org/show_bug.cgi?id=732681
2014-07-03 14:50:22 +02:00
Emmanuele Bassi
5b571ff4b6 docs: Show examples of how to use templates API
The template documentation is lacking inlined examples on how to use the
templates API, like binding children and callbacks. This makes looking
for best practices a bit harder than it ought to be, for a feature this
useful.
2014-06-26 19:29:06 +01:00
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