This reverts commit 8e29222d95.
This needs more work - spin buttons need to be converted at
the same time, and we should make sure that text still appears.
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
The cursor was set using gdk_window_set_cursor() even in
gdk_window_new().
So instead of having yet another flag, just make the users of that flag
call gdk_window_set_cursor() directly after the window was created.
We currently beep when a character is appended at the end in
overwrite mode. That is obviously not right. Patch based on
a patch by Ian MacDonald.
https://bugzilla.gnome.org/show_bug.cgi?id=772389
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.
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).
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
(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.
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.
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.
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.
If the window has not yet been created, then we can't set the invisible
cursor yet. This can happen in situations where the widget is in a
revealer with type-to-search functionality.
Use G_PARAM_DEPRECATED with deprecated style properties.
This will make it easier to identify and remove such stale
properties from css, since it will now trigger warnings.
Calling gtk_render_background for each rectangle in the region
leads to suboptimal and sometimes weird results. Getting this
right requires more work in Pango first. Go back to just rendering
a single background, and clip it to the selection region. This
matches what GtkLabel does.
This commit creates entry and button subnodes for the buttons
in GtkSpinButton. The nodes are ordered like this for horizontal
spinbutton
+ entry
+ image.left
+ image.right
+ progress
+ button.down
+ button.up
and like this for vertical ones:
spinbutton
+ button.down
+ entry
+ button.up
This arrangement requires cooperation from GtkEntry to place
the entry subnodes correctly, and some small changes in the theme.
This commit also fixes progress rendering in vertical spin buttons.
And remove the API to set that variable.
If you want the entry to not fill its whole allocated area,
gtk_widget_set_valign (entry, GTK_ALIGN_FILL);
will give you the old behavior.
Create css nodes for icons in entries, with name image, and use
gtk_style_context_save_to_node() for them. We still set the
style classes .left and .right on them.
Previously, we just hid the cursor if a key event was adding text,
but not when you used backspace, or Ctrl-V. Rearrange things so that
we obscure the cursor whenever the buffer contents change while we
are handling key events.
https://bugzilla.gnome.org/show_bug.cgi?id=754535
The buttons on the popover where stealing the focus from the text
view on click, causing the popover to be dismissed before the action
was taken. Fix this by making the buttons not take focus on click.
After the recent changes, we could end up calling
gtk_entry_update_handles in cases where the text_handle
has not be created (e.g. when dragging text from an entry).
Avoid that.
Use the drag-started signal to differentiate between drags that
move a handle and taps on a handle. Show the touch selection popup
for the latter, but not the former.
Hide the handles when the popover appears, and brind them back
when it disappears. This will need revisiting if we start using
the popover for mouse interaction as well, where we may not
want handles to show up.
We don't want the popup to appear spontaneously, so eventually
the timeout may go away altogether. For now, shorten it to 50ms,
to avoid rewriting all the places where the timeout is set or
unset.
Update style for touch selection in GtkEntry and GtkTextView
according to https://wiki.gnome.org/Design/OS/Selections
Add 'Select All' to the default actions, change actions
to use icons and move the popover to the bottom. If there is
no selection, just offer to paste.
the drag_begin() vmethod is meant for this, and the internal DnD code
will set up a drag icon if ::drag_begin didn't do so, which means
we are first getting a "default" icon, and then replacing it with the
text surface.
This is completely harmless in X11, but causes issues on wayland as
the DnD icon window is expected to remain unchanged during DnD there.
https://bugzilla.gnome.org/show_bug.cgi?id=748763
With the 3.0 transition, this code went from just querying the entry's
height request to doing a full size request.
Then it got code to revert the features that a full size request does.
And then it grew code that manually computed the baseline.
Avoid this and just do what happened back in the days: Do a regular
height request.
This changes the semantics of the get_frame_size() vfunc wrt its
behavior towards subclasses overwriting the get_height() vfuncs, but I'm
happy to live with that.
These vfuncs cannot be NULL: implementations are provided by GtkEntry,
and subclasses should not set them to NULL. Instead of conditionalising
the calls to the vfuncs, assert that they’re set and call them
unconditionally.
This prevents the possibility of a subclass setting the vfunc to NULL
and then a gtk_entry_get_*_size() call returning undefined values in its
out variables.
https://bugzilla.gnome.org/show_bug.cgi?id=712760
- gtk_style_context_get_background_color()
- gtk_style_context_get_border_color()
Those functions shouldn't be used anymore, because they don't represent
anything from the CSS styling we support. The background color often
isn't used due to background images and there are actually 4 different
border colors (1 for each side) - if there isn't also a border image in
use.
Remove checks for NULL before g_free() and g_clear_object().
Merge check for NULL, freeing of pointer and its setting
to NULL by g_clear_pointer().
https://bugzilla.gnome.org/show_bug.cgi?id=733157
Those used to work indirectly due to GtkEntry not setting GDK_TOUCH_MASK,
so pointer emulation would happen on those, but the event handlers on icons
and its icon-pressed/released signals have never been explicitly touch
aware, and this broke since the GDK_TOUCH_MASK can be set indirectly by
GtkGestures.
So make the icon event handler handle touch events, each icon can get hold
of one GdkEventSequence, reacting exclusively to it. This is still not
ported to GtkGesture due to GdkEvent exposure in these icon signals, as
users might expect GDK_2/3BUTTON_PRESS while GtkGesture ignores those.
Also, unset all icon pressed/sequence state on grab-notify, this used to
happen ad-hoc when initiating icon DnD, but that doesn't cut it for
user-defined reasons to initiate a grab (eg. popovers).
https://bugzilla.gnome.org/show_bug.cgi?id=736004
... in places where we draw a background. This was changed for GTK 3.0.0
to allow animations, but these days it doesn't make sense anymore to use
gtk_render_activity() for backgrounds.
GtkGestureSingle::button is set to 0 on the drag/multipress gestures, as several
buttons are managed by these gestures. Also, avoid some extra lines of code
setting what nowadays are default values.
https://bugzilla.gnome.org/show_bug.cgi?id=734285
This is expected to happen on wayland and other platforms with no primary selection,
and just leads to the selected text being cleared after any attempt to change the
text selection itself through either mouse/keyboard.
This changes the calculation of activity mode progress in the
same way as was done in GtkProgressBar a while ago, and make it
smooth, using a tick callback.
Instead of code that internally does weird things, use the FLAT style
class if has-frame is FALSE and remove it otherwise.
Based on a patch by Benjamin Otte.
https://bugzilla.gnome.org/show_bug.cgi?id=732256
fixup entry
Mainly doing s/TARGET/BUBBLE/ on the fully ported widgets, but GtkTreeView
where the double click handler has moved to GTK_PHASE_TARGET so it runs
parallelly to the still existing event handlers.
Event controllers now auto-attach, and the GtkCapturePhase only determines
when are events dispatched, but all controllers are managed by the widget wrt
grabs.
All callers have been updated.
Presses alternatively show and dismiss the popover, the popover is still
always shown invariably after any dragging happens (either text selection,
or dragging a text handle)
Similarly to GtkTextView, a GtkGestureMultiPress gesture handles
button/touch presses to initiate one selection mode or other, and
a GtkGestureDrag is used to handle text selection and DnD checks.
The code from button press/release, motion, and grab_notify handlers
has been shuffled into the actions triggered by those gestures.
Commit d05191a010 change the height
requisition to be completely dependent on the PangoLayout, but that
breaks when the font has special characters with different metrics.
Use the maximum between the two instead.
https://bugzilla.gnome.org/show_bug.cgi?id=728054
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.
We don't want the size request to change as icons come and
go (thinking e.g. about the caps lock warning). Just make
sure that we have enough room for showing the icons.
This property is TRUE by default, when a popover is modal, it
will automatically set a GTK+ grab on the popover, and grab
the keyboard focus into the popover.
GdkWindows are gone now from the API, the pointed_to rectangle
is from now on relative to the widget allocation. GtkTextView
and GtkEntry were updated to adapt to this change.