Commit Graph

527 Commits

Author SHA1 Message Date
Timm Bäder
57714b9774 gtklabel: Don't accept unhandled mouse buttons
If the pressed mouse button neither triggers a context menu nor
activates a link, set the sequence's state to DENIED.

https://bugzilla.gnome.org/show_bug.cgi?id=742010
2015-01-08 21:52:26 -05:00
Jasper St. Pierre
59629fa9e2 gtklabel: Optimize GtkStyleContext usage 2014-11-26 18:10:55 -08:00
Matthias Clasen
75bcecb363 Add a label style class 2014-10-04 21:53:29 -04:00
Benjamin Otte
8d1227a97c label: Simplify rendering code
Instead of drawing text for selections and links manually, use the
gtk_render_background() and gtk_render_layout() functions.

As a side effect, this allows shadows on selected text and links
and real backgrounds (like gradients or images), too.
2014-10-03 06:18:06 +02:00
Jasper St. Pierre
91d9ae1cc4 label: Don't add in the allocation to our clip again
_gtk_widget_set_simple_clip already takes the allocation into account,
so we don't need to do it here.
2014-09-30 13:43:36 -06:00
Matthias Clasen
d39424fc1c GtkLabel: add x/yalign properties
Since it turns out that x/yalign can't be quite equivalently
replaced by h/valign, bring them back as label properties, so
we can eventually get rid of GtkMisc.

https://bugzilla.gnome.org/show_bug.cgi?id=735841
2014-09-29 23:56:20 -04:00
Benjamin Otte
e9ce9a814b label: Clear layout after setting GtkLabel::lines property
Otherwise the label will not pick up the property.
2014-09-15 16:35:40 +02:00
Matthias Clasen
656deeb489 Fix a missing id in the docs
label-text-layout was missing, causing two broken links further
down in the page.
2014-09-08 15:36:15 -04:00
Matthias Clasen
1cc5cf3797 GtkLabel: better treatment for selection with ellipsis
This commit arranges things so that we treat an ellipsized
region like a single character for the purpose of selection
and cursor navigation.

https://bugzilla.gnome.org/show_bug.cgi?id=328449
2014-09-03 22:23:08 -04:00
Matthias Clasen
fc5f7cc138 GtkLabel: Make it possible to get the ellipsis range
This will be used in the next commit to expand the selection.
2014-09-03 22:23:08 -04:00
Matthias Clasen
1cddd14ab4 GtkLabel: better treatment for ellipsized links
When links are entirely hidden in an ellipsis, don't let
them be activated by clicking and skip them when moving
the focus around.

This commit depends on enhancements in pango 1.36.7 which
make it possible to find the ellipsed runs in a PangoLayout.
With older pango, things will work the same way as before.

https://bugzilla.gnome.org/show_bug.cgi?id=668258
2014-09-03 22:23:08 -04:00
Matthias Clasen
1c1b51d52d Don't return from a void function
And don't return the value of void functions, either.
2014-08-30 00:53:35 -04:00
Benjamin Otte
1126a34353 label: Respect box-shadow when computing clip
Testclase included.

Also reorder headers to be alphabetic.
2014-08-21 00:54:07 +02:00
Carlos Garnacho
261bbd8d8e label: Update to new GtkGestureSingle/GtkEventController defaults
GtkGestureSingle::button is set to 0 on the multipress gesture, as several
buttons are managed by that gesture. Also avoid some extra lines of code
setting what nowadays are default values.

https://bugzilla.gnome.org/show_bug.cgi?id=734285
2014-08-15 13:53:39 +02:00
Benjamin Otte
a3d1db608b label: Don't clip text shadows
The previous code for computing the clip rectangle forgot to respect
the text-shadow CSS property. This is usually not very visible because
text shadows usually don't extend the ink rectangle by very much.

See attached testcase for an example.
2014-07-31 17:50:24 +02:00
Benjamin Otte
f35ec11578 label: Include all of the allocation in the clip
Otherwise, the CSS background we draw would be clipped if the ink rect
was smaller than the allocation (a very common thing).

Broken since 37030a7710 where we clipped
to the ink rect.
2014-07-12 07:13:28 +02:00
Timm Bäder
0840f13c15 gtklabel: Set the correct initial cursor
Use GDK_XTERM only if the label is really selectable.

https://bugzilla.gnome.org/show_bug.cgi?id=732970
2014-07-11 21:24:21 -04:00
Benjamin Otte
37030a7710 label: Add ink rect support to GtkLabel 2014-07-10 18:56:34 +02:00
Benjamin Otte
a97901b1f7 label: Move function
This just moves the function, no actual code changes.
2014-07-10 18:56:34 +02:00
Matthias Clasen
8677446fe0 GtkLabel: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:30:55 -04:00
Carlos Garnacho
8dcdec58eb label: Use gestures for event management
A multipress gesture takes care of link handling, and char/word/all
selection mode on selectable labels. A drag gesture is used for both
text selection and DnD checks on selectable labels.
2014-06-05 16:15:54 +02:00
Matthias Clasen
24863a0b6a Revert "GtkLabel: Drop use of GtkMisc::x/yalign"
This reverts commit b320c198b6.
2014-05-27 13:07:03 -04:00
Matthias Clasen
6ce2a8fb13 Revert "Fix up GtkLabel and GtkImage sizing"
This reverts commit 3b30cfa344.
2014-05-27 13:04:43 -04:00
Matthias Clasen
7c83a71239 Revert "More label and image sizing fixes"
This reverts commit 68c1e83cf0.
2014-05-27 13:04:34 -04:00
Matthias Clasen
68c1e83cf0 More label and image sizing fixes
Go back to respecting GtkMisc::xpad/ypad. Not doing so breaks
the misc-alignment reftest. As long as we still derive from
GtkMisc, we may as well do this.
2014-05-27 06:00:21 -04:00
Matthias Clasen
3b30cfa344 Fix up GtkLabel and GtkImage sizing
When GtkMisc was removed, I forgot to apply the style context
padding. This caused the info-bar-message-types reftest to fail.
2014-05-27 00:22:40 -04:00
Matthias Clasen
b320c198b6 GtkLabel: Drop use of GtkMisc::x/yalign
Instead, use GtkWidget::h/valign to position the text inside
the allocation. And just stop using GtkMisc::x/ypad.

https://bugzilla.gnome.org/show_bug.cgi?id=730613
2014-05-24 00:04:41 -04: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
6b26410d38 GtkLabel: Make context menus on links work
We see an active link when creating the menu, but by the time
the menuitem is activated, we've received a leave notify that
makes the label clear its active link. Instead, give the
menuitems a direct reference to the link that is active when
the menu is created.

Problem pointed out by Tim Baedert
2014-05-21 10:29:17 -04:00
Matthias Clasen
ec0a60a248 Deprecate GtkMisc
This has been dangling ever since 3.0.
2014-05-13 08:45:00 -04:00
Matthias Clasen
49188aeeda GtkLabel: Drop references to GtkMisc
GtkMisc is heading for retirement. Point to the GtkWidget h/valign
properties instead.
2014-05-13 07:14:38 -04: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
Matthias Clasen
ba0542dc51 Allow applications to use gtk-enable-mnemonics in 3.12
gnome-terminal is still using this setting, so we'll let
applications override it for another cycle. It is no longer
backed by a system-wide setting, though, and it will still
go away eventually.

This partically reverts 7e3a494fac
2014-03-03 18:58:26 -05:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
62254456f7 GtkLabel: don't eat too many button release events
We should only eat button release events when the label is
actually selectable, since the comment indicates that we
want to eat the release events belonging to press events
that triggered a selection. This fixes problems with actions
on parent widgets that are triggered by button release,
as seen in this bug:

https://bugzilla.gnome.org/show_bug.cgi?id=724541
2014-02-17 23:09:44 -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
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
William Jon McCann
326da2da58 docs: don't use <anchor> 2014-02-07 15:40:52 -05:00
William Jon McCann
13998c55e7 docs: use proper quotations instead of '*' 2014-02-07 14:22:39 -05:00
William Jon McCann
a4b5929e81 docs: use apostrophe in *'re 2014-02-07 13:37:09 -05:00
William Jon McCann
285d216d3e docs: use apostrophe in *'ll 2014-02-07 13:35:54 -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
0ce016650b docs: Use markup for links 2014-02-07 09:42:12 -05:00
William Jon McCann
16db6bbccf docs: fix quotes in example 2014-02-06 10:55:12 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
Benjamin Otte
25d02909c8 label: Invalidate link colors on style change
Discovered-by: Timm Bäder <mail@baedert.org>

https://bugzilla.gnome.org/show_bug.cgi?id=721309
2014-02-05 13:38:54 +01:00
Benjamin Otte
219357d69c label: refactor code
Split out function for setting attributes. This will be needed in future
patches.
2014-02-05 13:38:54 +01:00
Benjamin Otte
a0bfbc8ae1 label: Avoid creating new attribute list
Only create an attribute list for merging if we actually need to merge.

This bug was introduced in 5230cfe805
2014-02-05 13:38:54 +01:00