Commit Graph

392 Commits

Author SHA1 Message Date
Matthias Clasen
1371a86fb1 GtkLabel: Make selection behave more similar to GtkEntry
For shift-clicks inside the selection, shrink the selection.
https://bugzilla.gnome.org/show_bug.cgi?id=353712
2011-06-01 01:08:13 -04:00
Javier Jardón
fb9e4c2c37 all: avoid boxed structs copying where possible (and 2)
Use the GtkStyleContext accessors for boxed properties where possible,
to reduce allocations.
2011-05-31 19:18:11 +02:00
Benjamin Otte
03fbb1f34f label: Account for y-translation when rotating 2011-05-22 05:56:11 +02:00
Cosimo Cecchi
c8a59a6f92 all: avoid boxed structs copying where possible
Use the GtkStyleContext accessors for boxed properties where possible,
to reduce allocations.

https://bugzilla.gnome.org/show_bug.cgi?id=650420
2011-05-18 10:27:21 -04:00
Benjamin Otte
33e6479554 label: Compute label offset properly for wrapped justified labels
label offsets were computed wrong for wrapped or ellipsized labels that
were right- or center-justified and had excess space available.
2011-05-05 17:33:44 +02:00
Benjamin Otte
69300df1fc label: Allow using more underline modes 2011-05-03 15:38:43 +02:00
Benjamin Otte
187f91eb90 label: Don't crash when a builder file contains unknown attributes 2011-04-27 00:43:16 +02:00
Benjamin Otte
bf41392861 label: Fix an invariant leading to required > minimum 2011-04-22 02:51:52 +02:00
Benjamin Otte
9bd206a65c label: No need to special case single-line mode
It's already taken care of by the layout.
2011-04-19 22:18:18 +02:00
Benjamin Otte
38676ef718 label: Request more natural size for ellipsizing wrapping labels 2011-04-19 22:18:18 +02:00
Benjamin Otte
484e04aed2 label: Pass the desired height to measuring layout
We always pass -1 for now.
2011-04-19 22:18:18 +02:00
Benjamin Otte
403815f96f label: Remove wrap width leftovers
They're not used anymore, so we can just delete all of this code.
2011-04-19 22:18:18 +02:00
Benjamin Otte
2ecab7b90d label: Set the height of the label when ellipsized or wrapped
Obviously, we want to set it to the label's allocated height.

Also simplifies the size allocation code.
2011-04-19 22:18:18 +02:00
Benjamin Otte
5cb260075e label: Don't use a rectangle variable if we don't use a rectangle 2011-04-19 22:18:18 +02:00
Benjamin Otte
26b2f3127a label: Redo size computation
This gets use closer to the label sizing discussed on the mailing lists.
2011-04-19 22:18:18 +02:00
Benjamin Otte
8e34bff045 label: Set wrap on the layout unconditionally 2011-04-19 22:18:18 +02:00
Benjamin Otte
ffb23fb827 label: Remove duplicated comment 2011-04-19 22:18:18 +02:00
Benjamin Otte
c8ce1106c1 label: Don't try to guess a label's size
People should use window default sizes or label
width-chars/max-width-chars to find the idea layout for a label inside
of relying on magic.
2011-04-19 22:18:18 +02:00
Benjamin Otte
c7cae341a1 label: Don't care about aux info
aux info is something that GtkWidget should do, not any of its
subclasses.
2011-04-19 22:18:18 +02:00
Paolo Borelli
1ad1c33f52 Small cleanup in label sizing code.
Move ellipsized_chars calculation in the scope where it is used.

https://bugzilla.gnome.org/show_bug.cgi?id=647284
2011-04-17 17:23:26 +02:00
Paolo Borelli
af7650ce1f Factor out a get_char_pixels method for clarity.
https://bugzilla.gnome.org/show_bug.cgi?id=647284
2011-04-17 17:16:47 +02:00
Javier Jardón
c1e8577a66 Move documentation to inline comments: GtkLabel 2011-04-15 01:41:13 +01:00
Benjamin Otte
8632ec43eb label: we can't ignore sizes on ellipsized labels
So don't use this optimization when a label is ellipsized.

https://bugzilla.gnome.org/show_bug.cgi?id=646517
2011-04-14 14:59:24 +02:00
Matthias Clasen
8377ecd694 GtkLabelPrivate: Improve struct packing 2011-04-12 12:34:11 -04:00
Benjamin Otte
93b0cecd7e label: Remove dead code
This code has been useless for a while, and now it's breaking things.
Moving the paned in tests/testheightforwidth's wrapping label shows that
bug.

Broken since 9992efdb0e
2011-03-30 13:17:01 +02:00
Benjamin Otte
21f117c695 label: Add another special case for measuring 2011-03-29 15:33:27 +02:00
Benjamin Otte
9992efdb0e label: Don't create the layout in size_allocate() if not needed
Just update its size if it already exists.
2011-03-29 15:33:27 +02:00
Benjamin Otte
c94dca36ca label: Move ellipsized layout width computation
... from size_allocate() to update_layout_width().
2011-03-29 15:33:27 +02:00
Benjamin Otte
bd3e947485 label: Factor out layout size measuring into its own function
Instead of doing half of it in get_preferred_size() and the other half
in get_label_width(), put it all in one place.
2011-03-29 15:33:27 +02:00
Benjamin Otte
e824bb4aab label: Move function to a better location
This patch does not change anything, it just moves the get_label_width
function.
2011-03-29 15:33:27 +02:00
Benjamin Otte
5e80c06d41 label: Factor out layout size setting into a separate function 2011-03-29 15:33:27 +02:00
Benjamin Otte
0930de9446 label: Only get font metrics if we have to
Getting these metrics is expensive, so avoid it if possible.
2011-03-29 15:33:27 +02:00
Benjamin Otte
6ba3ef5d82 label: Add optimization for a common special case
Oftentimes we want to measure a layout that is as wide or wider than the
current layout's maximal width. In that case we can safely reuse the
current layout.
2011-03-29 15:33:27 +02:00
Benjamin Otte
20b90cb793 label: Remove unused boolean argument from ensure_layout()
It's always FALSE.

Note that this patch changes the layout for allocations that are
smaller than 1px, but that's just the default layout that is never
rendered.
2011-03-29 15:33:27 +02:00
Benjamin Otte
db474e82c4 label: Don't recreate the layout just for measuring
Instead, create a custom one.
2011-03-29 15:33:27 +02:00
Benjamin Otte
d579166a63 label: Add internal gtk_label_get_measuring_layout() and use it
Avoids useless pango_layout_copy() calls and invalidations of an
existing layout when measuring sizes for a given label.
2011-03-29 15:33:27 +02:00
Tristan Van Berkom
887142f1f5 Added GTK_SIZE_REQUEST_CONSTANT_SIZE to GtkSizeRequestMode
The constant size request mode defines a request mode where
height-for-width geometry is unneeded, thus optimizing GTK+
by reducing the overall amount of requests that need to be
performed and cached while resizing an interface.
2011-03-25 18:42:07 +09:00
Matthias Clasen
4a86e5b138 Make selectable labels work again
You can select something, but moving the focus somewhere else, or bringing up
the context menu makes the selection go away. This makes it impossible to
copy-paste the text.

The reason for this regression is that gtk_label_state_changed was sloppy and
assumed that it would only ever be called when a labels goes insensitive, which
is no longer the case.

The patch fixes things by explicitly checking if the widget is insensitive, and
only resetting the selection in that case, which is the same behaviour we have
for e.g. GtkEntry.
2011-03-24 12:45:59 -04:00
Matthias Clasen
beb8c290d1 Always chain up in ::style-updated
This was not handled consistently, but the default handler
does useful things, so we should always chain up.
2011-02-07 07:30:37 -05:00
Matthias Clasen
7894ff4bcb Don't g_object_unref cairo surfaces
This was causing warnings when dragging text from labels.
2011-02-02 22:05:26 -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
Pavel Holejsovsky
2f0d40335b [GI] Add missing (transfer) annotations 2011-01-20 13:57:18 +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
Matthias Clasen
2ed81aa57c Remove sealed members from GtkMenuShell 2010-12-23 18:21:53 -05:00
Benjamin Otte
8f1f743903 gtk: Use g_object_unref instead of gdk_cursor_unref 2010-12-21 12:07:05 -05:00
Cosimo Cecchi
503be10148 label: plug a memory leak 2010-12-07 10:13:32 +01:00
Paolo Borelli
4a7e746bbc Use the new style context API in GtkLabel. 2010-12-05 22:07:30 +01:00