Commit Graph

836 Commits

Author SHA1 Message Date
Matthias Clasen
6b2cde94b4 entry: Make progress node invisible when appropriate
We were failing to do that, leading to progress not disappearing
anymore after it was initially shown, in the gtk3-widget-factory
entry progress example.
2016-03-04 08:04:45 -05:00
Benjamin Otte
cf71d98b05 entry: Make the get_text_area() vfunc relative to top left of entry
This fixes GdTaggedEntry. I hope.
2016-02-23 04:22:19 +01:00
Matthias Clasen
966dd56e45 entry: Fix baseline allocation
Position the text on the baseline again.
2016-02-20 18:55:17 -05:00
Benjamin Otte
d2fb069426 entry: Make get_text_area_size() vfunc work again
GdTaggedEntry needs that. Though there's probably a bunch of work left
inside GdTaggedEntry to make it look cute again (like storing the area
it reserves for itself to allocate tags in).
2016-02-20 03:25:39 +01:00
Chun-wei Fan
0e9f24b5a4 gtk/gtkentry.c: Fix build on pre-C99
This file now uses nearbyint(), so include fallback-c89.c so that
compilers that don't provide the function will not get upset.
2016-02-15 17:22:00 +08:00
Benjamin Otte
c95087c70a entry: queue an allocate when pulsing
We need to reposition the progress gadget and that's done during
allocation.
2016-02-04 12:25:13 +01:00
Benjamin Otte
429bec54e5 entry: Turn progress node into a gadget 2016-02-03 22:53:22 +01:00
Benjamin Otte
3316d69abb entry: Simplify drawing code 2016-02-03 22:53:22 +01:00
Benjamin Otte
bfb727d37e entry: Draw progress in the right place 2016-02-02 15:26:01 +01:00
Timm Bäder
6e2c551896 entry: Fix icon areas
Do the same thing we already do in gtk_entry_get_text_area.
2016-01-31 20:05:52 +01:00
Krzesimir Nowak
09677f7331 entry: Fix a typo 2016-01-27 14:29:40 +01:00
Benjamin Otte
c4f7fbecfa entry: Fix a case of disagreeing coordinate systems
gesture_get_current_point() returned x/y in layout coordiantes, but
callers assumed it in textarea coordinates.
2016-01-27 14:04:21 +01:00
Matthias Clasen
a9222146d3 entry: give a visual clue that content is scrolled
This has been requested long ago, and we now have the
machinery to implement it easily.
2016-01-26 23:36:18 -05:00
Benjamin Otte
a222aa66d5 entry: Compute selection range correctly
gtk_editable_get_selection_bounds() returns UTF-8 character offsets,
but gdk_pango_layout_get_clip_region() wants byte ranges, so convert
from one to the other.
With English, this is especially visible for passwords, which use ●
as the invisible character.

https://bugzilla.gnome.org/show_bug.cgi?id=761128
2016-01-27 02:11:06 +01:00
Benjamin Otte
fefc370f6c entry: Chain up in realize()
... instead of copy/pasting what gtk_widget_real_realize() does.
2016-01-26 15:53:56 +01:00
Benjamin Otte
ad7bbbf9d8 entry: Use cleverer method to get the entry node 2016-01-25 15:49:17 +01:00
Benjamin Otte
3982f05be4 entry: Move spinbutton size hack
If we want to do special sizing for the text, we need to do it for the
text. Otherwise paddings, borders and entyr icons will screw up
everything.
2016-01-25 15:49:17 +01:00
Benjamin Otte
02fab14b3b entry: Move code
This movement is necessary for future gadgetization of GtkSpinButton.
2016-01-25 15:49:17 +01:00
Benjamin Otte
b52b4068af entry: Redo textarea handling
(1) Keep priv->text_allocation for the area used by the text
(2) Compute all text coordinates with the help of priv->text_allocation

As a side effect the get_text_area_size and get_frame_size vfuncs are
now unused. If we wanted them back, they should get a single use durig
size_allocate() and then their results should be stored for further
processing.
2016-01-25 15:49:17 +01:00
Benjamin Otte
c709072567 entry: Use gtk_render_layout()
It's funny that nobody has yet noticed that we don't draw the text using
the theme.

We had no text-shadow in entries!!!!!
2016-01-25 15:49:17 +01:00
Benjamin Otte
a363fd5fd3 entry: Draw selection the same way as GtkLabel 2016-01-25 15:49:17 +01:00
Benjamin Otte
ca690162af entry: Fold function into only caller 2016-01-25 15:49:17 +01:00
Benjamin Otte
0ae8b30210 entry: Don't allow different text over progress
This complicates refactorings, so remove that feature. It's not used
anywhere and doesn't play well with nodes the way it's implemented.
If we want it back, we can add it back later.
2016-01-25 15:49:17 +01:00
Benjamin Otte
a6845091f9 spinbutton: Make the entry gadget be the entry's gadget
This is a big and somewhat evil hack: We replace the entry's gadget's
node with the spinbutton's entry node.
2016-01-22 13:46:01 +01:00
Matthias Clasen
b08fe985cc entry: Expand the css node docs
Mention the context menu.
2016-01-18 10:52:26 -05:00
Timm Bäder
d73f6b8c50 entry: Deprecate shadow-type
Things like that should be handled using css. Also, the property value
is unused inside GtkEntry.
2016-01-18 12:53:53 +01:00
Timm Bäder
a5fabee202 entry: Don't draw icons twice 2016-01-14 16:02:12 +01:00
Timm Bäder
49d251a330 entry: Remove unused code 2016-01-14 16:02:12 +01:00
Matthias Clasen
ea4cff1ea4 Use convenience API that was introduced recently
Use gtk_css_gadget_set_state in all the places where we previously
were getting a node from a gadget, just to call gtk_css_node_set_state.
2016-01-13 00:19:31 -05:00
Timm Bäder
19fa893067 entry: typo 2016-01-12 21:54:45 +01:00
Michael Catanzaro
c3d611fcf2 entry: Fix typo 2015-12-20 11:52:30 -06:00
Matthias Clasen
18e8842a7e entry: Don't clear when setting icons
Clearing the icon doesn't appear to be necessary with
todays code, and it has the unfortunate side-effect of
temoorarily hiding the icon's window, which breaks grabs
and makes us miss the button release event when the icon
is changed from a button press handler.
2015-12-18 19:38:07 -05:00
Matthias Clasen
51ba8421c3 entry: Remove some dead code
These defines are no longer used.
2015-12-18 10:55:26 -05:00
Matthias Clasen
2e25407638 Fix a problem with entry gadgets
place_windows is accessing the gadgets allocation, so make sure
to allocate the gadget before calling it.
2015-12-17 15:17:23 -05:00
Matthias Clasen
35c243b26f entry: use a gadget
Use a gadget for the entry. Selection and progress still
just use a CSS node. Most things seem to work correctly
with non-zero margin or padding.
2015-12-17 00:01:58 -05:00
Benjamin Otte
3a77da9df2 entry: Turn icons into gadgets 2015-12-15 08:41:16 -05:00
Benjamin Otte
b79a187d47 iconhelper: Handle invalidation
When CSS, direction or scale factor change, handle the invalidation
inside the iconhelper.
This way the widgets using them don't have to.
2015-12-15 08:41:16 -05:00
Benjamin Otte
ad22612ab2 iconhelper: Require passing a cssnode to the constructor
Note that we don't use it yet.
2015-12-15 08:41:16 -05:00
Benjamin Otte
ccfc4d3f12 iconhelper: Remove the context argument
Instead, use the widget's context.
2015-12-09 13:30:40 +01:00
Benjamin Otte
e95e2d5048 iconhelper: Get rid of _gtk_icon_helper_set_window()
Instead use the window of the owner widget.
2015-12-09 13:30:40 +01:00
Benjamin Otte
c9d1a45d30 iconhelper: Require a widget as construction argument
Note that the caller needs to ensure the widget lives as long as the
iconhelper as the iconhelper will not ref the widget.
2015-12-09 13:30:40 +01:00
Matthias Clasen
f76fa0411f entry: Always use cursor names
The names are the preferred API for cursors, so use it.
2015-12-05 19:17:52 -05:00
Timm Bäder
ecc5342b0d GtkEntry: Recompute in text-inserted/text-deleted
The text-inserted/text-deleted handlers rely on the cursor positions
being unadjusted after the text change, so we can't do it in
buffer_notify_text.
2015-12-04 20:41:16 +01:00
Timm Bäder
3ba11782db GtkEntry: nullable annotations 2015-12-03 20:20:58 +01:00
Timm Bäder
da477575cd GtkEntry: Return proper constants from signal handlers 2015-12-03 20:01:30 +01:00
Timm Bäder
f11f989f1f GtkEntry: Remove recompute idle
Just do it directly
2015-12-03 20:01:30 +01:00
Timm Bäder
cfc23cbf32 GtkEntry: Remove unused fields 2015-12-03 20:01:30 +01:00
Matthias Clasen
058dfb0723 entry: Use regular drag highlight
The entry code passes GTK_DEST_DEFAULT_HIGHLIGHT when setting
up the drop target, but that is ineffective because of the
custom drag_motion implementation. Instead, call
gtk_drag_[un]hightlight ourselves.
2015-12-02 23:52:55 -05:00
Benjamin Otte
7a154d9acd dnd: Add gtk_drag_set_icon_definition()
... and use it for entry icons.

As a side effect, icons dragged from entries will now resize to DND
size.
2015-12-02 00:29:30 +01:00
Benjamin Otte
85423ea278 entry: Use gtk_icon_helper_load_surface()
This is the first step towards getting rid of pixbuf loading code in the
icon helper.
2015-12-02 00:29:30 +01:00