Commit Graph

562 Commits

Author SHA1 Message Date
Timm Bäder
5201c876d5 GtkLabel: Use :visited and :link for link colors
https://bugzilla.gnome.org/show_bug.cgi?id=709629
2013-11-04 16:36:11 +01:00
Stefan Sauer
d4679c0a13 frame: annotate the @label params with (allow-none) 2013-08-29 09:06:31 +02:00
Benjamin Otte
4787a1ac61 label: Initialize lines value to -1
Fixes defaultvalue test.
2013-08-23 18:27:12 +02:00
Benjamin Otte
64a1f30468 label: Fix gcc warning 2013-08-23 18:24:20 +02:00
Matthias Clasen
eab0ff8e4e Add api to ellipsize labels to multiple lines
When setting the lines property, the label will be ellipsized
to that many lines, with the ellipsis only appearing in the
last line. This is different from how ellipsization of multi-line
labels normally works in GTK+.
2013-08-22 20:38:01 -04:00
Matthias Clasen
624ec0fb7d Add a style class for context menus
Attached widgets inherit from the style of the widget they are
attached to. This can sometimes have unintended consequences,
like a context menu in the main view of gedit inheriting the font
that is configured for documents, or the context menu of the preview
in the font chooser coming up with humongous font size.

To fix this problem, we introduce a context menu style class
and use it for all menus that are used like that. The theme
can then set a font for this style class.

https://bugzilla.gnome.org/show_bug.cgi?id=697127
2013-08-18 13:46:48 -04:00
Jasper St. Pierre
030b62d122 gtkdnd: Introduce a new API for more accurate drag origin data
When trying to drag, we currently the position of the first motion
event to determine where the drag came from. This might be alright
in the case of the old animation, but the data will be inaccurate
if the user has moved the pointer quite a bit since pressing the
cursor to start dragging. While we could monkey patch the GdkEvent
at the widget layer, this is unintuitive and strange.

Add a new API that takes a set of pointer coordinates describing
the origin of the drag. Additionally, adapt most widgets to use
it and use it with correct coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=705605
2013-08-14 07:12:52 -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
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
7e3a494fac Deprecate and ignore gtk-enable-mnemonics and gtk-auto-mnemonics" properties
They are both enabled by default.
2013-06-26 11:16:12 -04:00
William Jon McCann
02c793f24a Start migrating internals away from GtkStock 2013-06-24 22:20:49 -04:00
Stefan Sauer
a725b06363 label: fix return value type for _draw()
Change from gint to gboolean.
2013-05-08 22:05:56 +02:00
Alexander Larsson
e253a414b0 GtkLabel: Minor cleanup
Make sure we always compare for a set baseline in the same way.
I.e. baseline != -1, never baseline >= 0.
2013-04-23 05:58:08 +02:00
Alexander Larsson
1e1cf89e4f GtkLabel: Support baseline
Report the baseline in get_preferred_height_and_baseline_for_width().
2013-04-23 05:50:37 +02:00
Sébastien Wilmet
30788062f7 GtkLabel: fix underlining of mnemonics
The underscore was shown in front of the mnemonic instead of underlining
it (e.g., _Save).

Thanks to Lars Uebernickel.

https://bugzilla.gnome.org/show_bug.cgi?id=674759
2013-03-24 15:07:40 +01:00
Matthias Clasen
02a0759c5d csd: Make link activation work reliably
The label code was just letting some button press events bubble
up, which caused misbehaviour with the window dragging code.
https://bugzilla.gnome.org/show_bug.cgi?id=695506
2013-03-21 18:07:21 -04:00
Sébastien Wilmet
8e65fa1b43 GtkLabel: fix mnemonic-keyval when use-markup is true
To extract the mnemonic key value, the string must contain the
underscore. But when the "gtk-auto-mnemonics" setting is true and when
the Alt key is not pressed, the underscore must not be displayed. The
problem was that the 'new_str' variable was used for both purposes:
extract the text to display, and extract the accelerator character.

When the underscore must not be visible, the underscores were removed
from the 'new_str' variable before extracting the accelerator character.

Now there are two strings, one for each purpose.

https://bugzilla.gnome.org/show_bug.cgi?id=674759
2013-03-17 16:10:10 -04:00
Benjamin Otte
feb64f40b0 a11y: Emit text-changed signals directly
When setting new text on the label, the text-changed::delete signal
needs to be emitted before deleting the text (so that atk-bridge can
query the old text) while the text-changed::insert event needs to happen
afterwards (for the same reason). The old code using the notify signal
was only emitted after changing the text.
2013-03-15 00:58:29 +01:00
Carl-Anton Ingmarsson
5d011386a6 label: Fix memleak
Caused by recent refactoring in e09957a47d
2013-03-12 20:23:09 +01:00
Benjamin Otte
e09957a47d label: refactor code
If text didn't change, don't change it.

And if that sentence made no sense, that might explain why I refactored.
2013-03-12 12:46: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
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
7747910b9d gtk: Use context's font
Instead of using gtk_style_context_get_font() in
pango_context_get_metrics(), use pango_context_get_font_description().
The context contains the font description we are about to use after all.
2012-12-06 02:57:18 +01:00
Matthias Clasen
5230cfe805 GtkLabel: Fix a pointless expression
Clearly, what was meant here was that we create a new attribute
list if either of the input attribute lists are non-NULL.
This was found by Coverity.
2012-11-29 23:10:34 -05:00
Benjamin Otte
0d9a45d460 label: Fix another sizing corner case causing segfaults
If the "wider" label is the smaller one, use the wider size for both
cases. This can happen when ellipsizing a single character, which is
often smaller than the ellipsizing glpyph(s).
2012-11-08 23:34:30 +01:00
Benjamin Otte
debe81b1ea label: Handle crazy corner cases
With ellipsizing, the ellipsized text can have a smaller height than the
non-ellipsized text. So the wider text is also higher. Example:
  .<big>TEXT</big>
will ellipsize to the small text.

Reported-By: Rico Tzschichholz <ricotz@t-online.de>
2012-11-05 19:34:23 +01:00
Benjamin Otte
aba0c5cc3b label: Redo get_preferred_width/height()
This is important for size groups mostly, but also has some small fixes.
The label-sizing reftest as been updated accordingly.
2012-11-04 15:28:43 +01:00
Benjamin Otte
f55fe7e20b label: Fix ellipsize and wrap being set
The label code assumed that Pango treats this as "wrap to as much space
as possible and then ellipsize all the lines", but for Pango, ellipsize
takes precedence over wrap. So do the same thing in GtkLabel.

Also updated is the reftest that checked this behavior.
2012-11-04 15:28:43 +01:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Paolo Borelli
03bf85ba07 Paint label background
Make GtkLabel respect background css properties.

https://bugzilla.gnome.org/show_bug.cgi?id=670743
2012-04-30 13:13:25 -04:00
Matthias Clasen
ad1c0f7155 label: Don't use the selection too easily
When we are re-setting the same text for internal reasons
(e.g. when applying the mnemonics-visible change upon Alt press),
we should not needlessly loos the selection.

https://bugzilla.gnome.org/show_bug.cgi?id=671588
2012-03-20 01:05:05 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Carlos Garcia Campos
38d869cb8e gtklabel: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Paolo Borelli
e34589ddea Factor out _gtk_misc_get_padding_and_border
The new semi-private function will allow to implement support for css
padding and border in widgets inheriting from GtkMisc.
Use the new function for GtkLabel, GtkArrow and GtkImage.
2012-01-22 13:36:47 +01:00
Benjamin Otte
00e84f1cdb label: Avoid deprecation warning 2012-01-06 05:23:43 +01:00
Benjamin Otte
42d0a6de23 label: Actually mark visited labels as visited
A recalculate will clear the labels and compute them again, which will
clear the information if something was visited...
2012-01-06 05:23:43 +01:00
Benjamin Otte
d6bb8a63aa label: Make attr_list_merge() use sane merging rules
Instead of "attribute with later start index wins, make sure the
attribute list that is merged from takes precedence. This now gives the
multiple attribute lists we use in the label an order:

1) gtk_label_set_attributes()
  These attributes override everything. It's what the function's there
  for after all.
2) markup of label
  Other user-specified attributes come next.
3) attributes for links
  When we apply custom attributes on parts of the text, we put them
  last. We don't want to mess with what the user does. Also, we change
  color and underline, so we usually have something to show.
2012-01-06 05:23:42 +01:00
Benjamin Otte
e78e4d8dd8 label: Rename variable
The effective attributes aren't that anymore. They're now just the
attributes from the parsed markup.
2012-01-06 05:23:42 +01:00
Benjamin Otte
f1c9a3e633 label: Don't excessively recalculate
We don't merge attributes anymore, so no need to call the function that
used to do this job.
2012-01-06 05:23:42 +01:00
Benjamin Otte
396b177e3b label: Redo attribute application
- Don't compute link color attributes until layout creation
This is useful as a performance enhancement, because we don't have to
lookup the property after setting the text, so multiple markup sets
don't cost style lookups.
- Don't merge attrs into effective_attrs
We do this when applying link colors now. Keeping them separate allows
invalidating them separately.
2012-01-06 05:23:42 +01:00
Benjamin Otte
15ac572822 ilabel: Redo gtk_label_get_link_colors()
Don't pass out an allocated color, assign it instead. Gets rid of having
to call gdk_color_free() all the time.
2012-01-06 05:23:42 +01:00
Benjamin Otte
dd4df24382 label: Split out function that merges attr lists 2012-01-06 05:23:42 +01:00
Benjamin Otte
712d577531 label: Redo links parsing
Instead of getting confused by applied underline or color tags in the
regular markup, we store the link start/end when we actually parse the
text. As a bonus, we can avoid rescanning links when creating the
markup.
2012-01-06 05:23:42 +01:00
Benjamin Otte
18ce0b21a0 label: Move function into only caller 2012-01-06 05:23:42 +01:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Rui Matos
5b4cc2f0b6 label: Use the widget state flags as a base for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
02dd7df653 label: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Benjamin Otte
c3cccf586c label: Clear layout on state change
Selected or active text might be rendered differently.
2011-12-05 18:27:05 +01:00
Benjamin Otte
5ac6950dd6 label: Move callback to new stuff
We want to react to state flags changing, not to the (deprecated) state
type changing.
2011-12-05 18:27:05 +01:00
Paolo Borelli
2ef5844bac Introduce gtk_render_insertion_cursor
The new function provides an API that takes the PangoLayout and index
as input params, this way it handles strong and weak cursors internally
factoring out all code duplicated in the widgets that need to render
cursors.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Paolo Borelli
f18bbdff53 Remove draw_insertion_cursor in label and entry
Remove the the draw_insertion_cursor wrapper which just converts from
GtkTextDir to PangoDirection

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:38 +01:00
Paolo Borelli
58d247d7ae Avoid shadowing a variable
Move bg_color variable to an inner scope.
2011-11-29 21:28:30 +01:00
Benjamin Otte
b526375e8f gtk: Fix compiler warnings from include fixes 2011-11-16 04:31:06 +01:00
Rico Tzschichholz
4a43c062ac Fix some implicit declaration warnings
There were some includes of gtkmain.h missing
2011-11-11 13:06:56 +01:00
Michael Natterer
5c4f2ef0c1 gtk: move _gtk_modules_has_mixed_deps() to gtkmodlesprivate.h
and remove gtkmainprivate.h completely.
2011-10-23 13:57:07 +02:00
Javier Jardón
0853ce3077 Use G_VALUE_INIT
Instead of an explicit { 0, } when declaring the variable.
2011-10-15 16:45:16 +01:00
Michael Natterer
2d3db3421f Bug 659406 - Abstract what triggers a context menu
Add gdk_event_triggers_context_menu(), using the new modifier
abstraction API. Remove _gtk_button_event_triggers_context_menu()
and port all callers.
2011-09-27 15:45:18 +02:00
Michael Natterer
b663f3a00b Bug 659406 - Abstract what triggers a context menu
Add _gtk_button_event_triggers_context_menu() and use it instead
of checking for event->button == 3, so context menus are invoked
correctly on the Mac.
2011-09-26 16:01:50 +02:00
Matthias Clasen
dc898e3f84 GtkLabel: make patterns work a little better
When a pattern has been set, we must not throw away
the attributes that contain it.

https://bugzilla.gnome.org/show_bug.cgi?id=658111
2011-09-04 00:01:37 -04:00
Tristan Van Berkom
d7696bd25f Avoid dereferencing NULL pointer in gtk_label_drag_data_get()
It's possible the GtkLabel receives drag'n'drop related signals
if it was setup to receive them by a container or other external
code, just avoid dereferencing priv->select_info in this case.
2011-08-26 19:02:36 +02:00
Chun-wei Fan
ad73ed298d Include C89 fallback code
gtk/gtkborderimage.c, gtk/gtklabel.c and gtk/gtkstyleproperty.c call
round() and/or rint(), which was only available in C99 compilers.

This adds the inclusion of the fallback implementation (gtk/fallback-c89.c)
to define these functions if they are not initially made available by the
compiler.

Also remove the rint() implementation in gtk/gtklabel.c as it is now in
the fallback implmentation.
2011-08-20 11:17:44 +08:00
Matthias Clasen
2ba9c4b4a7 Make focus rectangles optional
This commit introduces a new setting, gtk-visible-focus, backed
by the Gtk/VisibleFocus X setting. Its three values control how
focus rectangles are displayed.

'always' is equivalent to the traditional GTK+ behaviour of always
rendering focus rectangles.

'never' does what it says, and is intended for keyboardless
situations, e.g. tablets.

'automatic' hides focus rectangles initially, until the user
interacts with the keyboard, at which point focus rectangles
become visible.

https://bugzilla.gnome.org/show_bug.cgi?id=649567
2011-08-10 16:34:20 +02:00
Javier Jardon
ad0c0b8eb3 Do not initialize the priv pointer before check type 2011-07-06 14:25:06 +01:00
Matthias Clasen
3e84cc9b17 GtkLabel: optimize away some ::notify emissions 2011-07-05 16:08:09 -04:00
Matthias Clasen
c2d1e3eeb0 Avoid warnings in clipboard code
The a11y selection tests poke the selection on unrealized
labels. Don't spew warnings in this case.
2011-07-05 16:08:08 -04:00
Matthias Clasen
889b2714d5 GtkLabel: factor out two getters
Make the get_property switch look a little nicer.
We export these functions privately for use in the label
accessible implementation later on.
2011-07-05 16:08:07 -04:00
Matthias Clasen
dddf587aec GtkLabel: freeze property notification where appropriate
When setting properties that require recalculating the label
text, freeze notification until the label is properly updated.
This fixes bug 126797.
2011-07-05 16:08:06 -04:00
Matthias Clasen
a381fd288c GailLabel -> GtkLabelAccessible
A first experimental conversion from the gail namespace to gtkaccessible.
At the same time, use gtk_widget_class_set_accessible_type() to register
the accessible type for GtkLabel.
2011-07-05 16:08:06 -04:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
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
Carlos Garnacho
90dd2eb42b GtkLabel: Use style context for rendering. 2010-12-04 15:39:40 +01:00
Benjamin Otte
0b6c184eaa label: Clarify docs for gtk_label_get_layout() 2010-12-02 20:21:05 +01:00
Chun-wei Fan
8c674c5d84 gtklabel.c: Added hack for rint() 2010-11-10 10:21:08 +08:00
Emmanuele Bassi
9f9edb662e settings: Move setting property registration in gtksettings.c
Some GtkSettings property are registered by other classes. This leads
to the "interesting" issue that setting GtkSettings:gtk-button-images
requires that the GtkButton class is referenced first - or that a
GtkButton is created.

https://bugzilla.gnome.org/show_bug.cgi?id=632538
2010-10-20 10:34:25 +01:00
Benjamin Otte
dec47f062e label: Fix rendering of rotated labels
gtk_paint_layout is utterly broken. Someone needs to fix it so we use
the cairo_t's matrix and don't juggle with both Pango and cairo matrices
everywhere.
2010-09-27 20:49:39 +02:00
Javier Jardón
eac1959d2c Move destroy signal to GtkWidget
Also make GtkWidget derive from GInitiallyUnowned
2010-09-26 22:18:18 -04:00
Benjamin Otte
d9c9259861 Move GtkSizeRequest into GtkWidget
It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.

Also, the names would translate to gtk_widget_get_width() and people
agreed that this would be a too generic name, so a "preferred" was added
to the names.

So this patch moves the functions:
gtk_size_request_get_request_mode() => gtk_widget_get_request_mode()
gtk_size_request_get_width() => gtk_widget_get_preferred_width()
gtk_size_request_get_height() => gtk_widget_get_preferred_height()
gtk_size_request_get_size() => gtk_widget_get_preferred_size()
gtk_size_request_get_width_for_height() =>
  gtk_widget_get_preferred_width_for_height()
gtk_size_request_get_height_for_width() =>
  gtk_widget_get_preferred_height_for_width()
... and moves the corresponding vfuncs to the GtkWidgetClass.

The patch also renames the implementations of the vfuncs in widgets to
include the word "preferrred".
2010-09-26 15:11:45 +02:00
Benjamin Otte
67284a57de API: Get rid of gtk_draw_insertion_cursor()
and rename gtk_cairo_draw_insertion_cursor() to
gtk_draw_insertion_cursor().
2010-09-26 15:11:43 +02:00
Benjamin Otte
1d3f6b30b0 API: Rename gtk_cairo_paint_*() to gtk_paint_*()
Large patch, but just renaming.
Indentation should still mostly be correct because I took care of
keeping the indentation for this function name.
2010-09-26 15:11:42 +02:00
Benjamin Otte
4aefc82496 label: Port to draw vfunc 2010-09-26 15:11:36 +02:00
Benjamin Otte
3d340d7449 text: Make _gtk_text_util_create_drag_icon() return a surface
And change its callers to handle it that way.
2010-09-26 15:03:00 +02:00
Matthias Clasen
e0aa12eb0a Tons of transfer annotations 2010-09-21 00:18:11 -04:00
Javier Jardón
b140884fec Use gtk_size_request_get_size() instead deprecated gtk_widget_size_request()
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=629598

Signed-off-by: Javier Jardón <jjardon@gnome.org>
Signed-off-by: Tristan Van Berkom <tristanvb@openismus.com>
2010-09-15 03:02:58 +02:00
Colin Walters
913cdf3be7 GDK: Prefix key names with KEY_
The keysyms create a lot of potential namespace conflicts for
C, and are especially problematic for introspection, where we take
constants into the namespace, so GDK_Display conflicts with GdkDisplay.

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

Just one user in GTK+ continues to use gdkkeysyms-compat.h, which is
the gtkimcontextsimple.c, since porting that requires porting more
custom Perl code.
2010-09-08 18:51:44 -04:00
Javier Jardón
1e5d7c0225 Use GtkFooPrivate instead GtkFooPriv 2010-08-27 04:48:23 +02:00
Javier Jardón
991eaa7580 gtk/gtklabel.c: Use accessor functions to access GtkWindow 2010-08-23 20:18:55 +02:00
Javier Jardón
69b6dbdb08 gtk/gtklabel.c: use accessor functions to access GtkWidget 2010-08-22 22:56:10 +02:00
Benjamin Otte
805e0d1082 label: Draw all text using PangoCairo
This includes the addition of a "small" helper function,
_gtk_pango_fill_layout() that ignores color information. This
functionality is not available inside Pango and until that happens, we
need this fix. The bug is filed at:

https://bugzilla.gnome.org/show_bug.cgi?id=624917
2010-08-10 21:02:28 +02:00
Tristan Van Berkom
59e7571aae Fixed alignment of wrapping labels allocated a greater width than needed
When wrapping labels to allocation width, never set the label wrap
width to a size greater than needed for the label's text (closes bug 625715)
2010-08-06 22:44:11 -04:00
Benjamin Otte
32d365f476 label: Make angle part of GtkLabelPrivate 2010-08-07 02:24:00 +02:00
Javier Jardón
978a031b76 Use accessor functions to access GtkMisc 2010-07-13 19:40:49 +02:00
Javier Jardón
bf9875860b GtkLabel: move public members to private structure 2010-07-13 19:40:48 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00
Benjamin Otte
300e6b84cd s/GdkRegion/cairo_region_t/ in all of gtk
https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +02:00
Benjamin Otte
3e96cfe8fc Deprecate the GdkRegion API
Includes fixing all callers to use the cairo region API instead. This is
usually just replacing the function names, the only difference is
gdk_region_get_rectangles() being replaced by
cairo_region_num_rectangles() and cairo_region_get_rectangle() which
required a bit more work.

https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +02:00
Tristan Van Berkom
edd57602b8 Mass api change from GtkExtendedLayout --> GtkSizeRequest
This commit makes a few massive changes to the extended layout
code:
  a.) gtkextendedlayout.c --> gtksizerequest.c
  b.) _is_height_for_width --> get_request_mode()
  c.) get_desired_size(), get_desired_width(), get_desired_height() -->
      get_size(), get_width(), get_height()

This is the first partial commit and only effects portions
of the tree that have already been merged in master (in order to
easily cherry pick this commit).

Conflicts:

	gtk/Makefile.am
	gtk/gtk.h
	gtk/gtk.symbols
	gtk/gtkextendedlayout.h
2010-06-18 00:11:26 -04:00
Matthias Clasen
bd4609b140 Merge the xi2-for-master branch 2010-05-25 18:38:44 -04:00
Matthias Clasen
77d4d3cdae Merge branch 'gtk-2-90'
Conflicts:
	gtk/gtkentry.h
2010-05-06 22:55:02 -04:00
Javier Jardón
c1d36af3e8 Do not use C99 constant INFINITY
Use G_MAXDOUBLE instead
2010-05-03 22:47:21 +02:00
Javier Jardón
fead8cd49a Remove deprecated code: GtkLabel 2010-05-03 01:48:45 +02:00