Commit Graph

218 Commits

Author SHA1 Message Date
Matthias Clasen
6e602e052b text: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
e9203eeef7 text: Convert to GtkDragSource 2020-01-08 18:48:19 -05:00
Timm Bäder
c38c5c4ce1 text: Reset cursor opacity when unmapping
Otherwise we might get mapped again with a half-transparent cursor.
2020-01-07 17:27:18 +01:00
Matthias Clasen
7ee5779efc gtk: Remove menu code
GtkMenu, GtkMenuBar, GtkMenuItem and their subclasses
and supporting classes are replaced by model-based popover
implementations.
2019-12-29 20:31:58 -05:00
Christian Hergert
fb4fbfb2a8 text: add undo support to GtkText
This adds support using the GtkTextHistory helper for undo/redo to the
GtkText widget. It is similar in use to GtkTextView, but with a simplified
interface.

You can disable undo support using the GtkText:enable-undo property. By
default, it is enabled.
2019-11-05 10:27:29 -08:00
Timm Bäder
dfcc40ef9a text: Propagate pango attributes to placeholder
Not sure if this is really always wanted or whether we need to filter
the attributes, or even create a separate property for them.
2019-10-22 09:37:08 +02:00
Timm Bäder
1882034323 text: Fix _set_attributes docs
The list is nullable.
2019-10-22 09:37:08 +02:00
Timm Bäder
640db05b18 text: Remove some unused members 2019-10-22 09:37:08 +02:00
Timm Bäder
31ae93475d text: Fix context menu position
Fixes #2209
2019-10-22 09:37:08 +02:00
Timm Bäder
8fc4d229da text: Inline function into only caller 2019-10-22 09:37:08 +02:00
Timm Bäder
a62efb8257 text: Remove gtk_text_get_text_allocation
We can just replace that with get_width/get_height everywhere.
2019-10-22 09:37:08 +02:00
Timm Bäder
acf927fe14 text: Don't destroy pango layout in size_allocate
It's not needed.
2019-10-22 09:37:08 +02:00
Timm Bäder
17a111968b text: Remove an unnecessary queue_draw() call 2019-10-22 09:37:07 +02:00
Benjamin Otte
c2a32afe97 Initialize cursor alpha to 1.0
That way, non-animated cursors don't disappear.
2019-10-16 21:45:33 +02:00
Benjamin Otte
427deb4f13 widget: Make gtk_widget_grab_focus() return a boolean
So now it can actually fail.

It doesn't yet though.
2019-10-15 16:33:05 +02:00
Matthias Clasen
222e05c2d2 Remove unused includes
Don't include gtkmenu.h in places where
it isn't used anymore.
2019-09-16 07:23:17 -04:00
Timm Bäder
74208e9e0c text: Fix a crash when retrieving the selected text 2019-09-09 17:36:25 +02:00
Matthias Clasen
a4e427b44a text: Delay initial cursor blinking
We used to have a solid cursor for 2/3 of the cycle,
now we start fading after 1/4th. To make up for it,
add half a cycle of delay.
2019-07-23 21:08:47 -04:00
Matthias Clasen
fb06b7fa94 text: Remove an outdated comment 2019-07-23 15:14:38 -04:00
Matthias Clasen
7b451678f5 fix the build 2019-07-23 14:26:32 -04:00
Matthias Clasen
758c54eab8 text: Fix incomplete invalidation
When a style change affects the text, we need to
clear the cached content, in order to pick up the
new text style.
2019-07-23 10:41:52 -04:00
Matthias Clasen
51161fb0d6 text: Smooth cursor blinking
Fade the text cursor in and out, instead
of abruptly turning it on and off.
2019-07-21 11:35:13 -07:00
Timm Bäder
4f11bbc59b text: Don't leak emoji chooser 2019-07-15 06:56:19 +02:00
Timm Bäder
4bb4a98493 text: Move some locals into the closest scope 2019-07-15 05:38:25 +02:00
Timm Bäder
70b0f712ad text: Remove some useless casts 2019-07-15 05:19:02 +02:00
Timm Bäder
c6e9372ba3 text: Move some locals into the closest scope 2019-07-15 05:17:46 +02:00
Matthias Clasen
35a88c1440 widget: Rename a function
set_enabled is shorter and more to the point
than enabled_changed, now that we no longer have
a callback to query the state.

Adapt all callers.
2019-06-22 17:03:51 -04:00
Matthias Clasen
d1f4068b94 Replace stateful actions by property actions
The only cases of stateful actions we've seen
so far have been boolean properties, and we
don't really want to add much state handling
API, so lets just go with property actions
for now.

Adapt the only user in GtkText.
2019-06-22 17:03:38 -04:00
Matthias Clasen
7e73da5f73 widget: Add parameter type back to install_action
Adapt all callers.
2019-06-22 16:48:16 -04:00
Matthias Clasen
152eabbaba widget actions: Add an explicit state type
Make the state type part of the API for installing
stateful widget actions. That lets us introspect it.

Update all callers.
2019-06-21 22:47:40 -04:00
Matthias Clasen
421e9c3502 text: Use the new action machinery
Port GtkText to use widget class actions.

Note that this also changes the names of
the GtkText actions away from a generic
"context" prefix.
2019-06-18 14:47:33 -04:00
Matthias Clasen
6030465cdf text: Add a context action for visibility
This will be used by GtkPasswordEntry for amending
the context menu.
2019-06-13 11:59:50 +00:00
Matthias Clasen
a28d5d1888 text, entry: Implement context menu api
Drop the ::populate-popup signal and implement
the new context menu api.
2019-06-13 11:59:50 +00:00
Matthias Clasen
f03c7c379a text: Fix selection bubble handling
Same fix as the previous commit.
2019-06-11 17:46:01 +00:00
Matthias Clasen
7f65e5f96b Rename GtkGestureMultiPress to GtkGestureClick
The name just made it hard for people to find the
right gesture to use.
2019-05-29 17:10:46 +00:00
Matthias Clasen
7447abb52b Stop using gtk_widget_get_toplevel
All uses of it can be replaced by gtk_widget_get_root.
2019-05-28 20:25:16 +00:00
Matthias Clasen
25aef96d5d popover: Rename modal to autohide
This is the term we use for the surface,
and it matches the behavior a bit better
than modal.

Update all callers.
2019-05-28 20:25:15 +00:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Matthias Clasen
e6f71d841e text: Allocate popovers
We need to do the same thing the menu button
does, and call gtk_native_check_resize for
all our popovers
2019-05-28 20:25:15 +00:00
Matthias Clasen
4bf4f04d1f Adapt to new popover lifecycle
We need to unparent popovers in dispose.
2019-05-28 20:25:13 +00:00
Benjamin Otte
2bad613cb0 text: Ensure indexes are ordered properly 2019-05-18 17:06:08 +02:00
Matthias Clasen
965d0e04d1 gtk: Use root/unroot instead of display-changed
The display-changed signal is going away
2019-05-02 01:33:41 +00:00
Matthias Clasen
e41596d6a1 text: Make Emoji insertion work properly
We are now getting focus-out and focus-in events
when the Emoji chooser is shown and hidden, and
this is causing the text to select-on-entry before
inserting the Emoji, which then deletes the selection.

Avoid this by saving and restoring the selection
when presenting the Emoji chooser.
2019-05-01 05:13:52 +00:00
Matthias Clasen
218d635ca2 entry: Activate default via action
Switch to the new way of activating default.
2019-04-28 23:20:13 +00:00
Matthias Clasen
e37f4d0ea6 text: Stop juggling cursors
We have a convenience api for this.
2019-04-18 15:06:35 -04:00
Matthias Clasen
836b5a217a text: Refine the touch popup
The touch popup was meant to have linked buttons.
2019-04-17 23:40:26 +00:00
Timm Bäder
20ccb53c42 text: Remove useless gtk_widget_get_allocation call 2019-04-13 06:26:27 +02:00
Matthias Clasen
8bae5348f9 text: Handle 'inverted' selections
We must handle selection_bound > cursor in
various places. This was lost in the big
entry refactoring.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1792
2019-03-31 12:36:09 -04:00
Matthias Clasen
7843382784 text: Allow growing entries
Add a propagate-text-width property, which, when set,
makes the entry request a natural width that is just
enough to fit the content, within the limits given
by width-chars and max-width-chars.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1721
2019-03-27 01:42:00 -04:00
Matthias Clasen
2bf1561b48 Port widgets to the root focus API 2019-03-16 21:24:44 -04:00