Commit Graph

742 Commits

Author SHA1 Message Date
Matthias Clasen
eea16f03f5 Stop using GDK_POINTER_MOTION_HINT_MASK in widgets
It is deprecated and no longer needed, and,as observed in
https://bugzilla.gnome.org/show_bug.cgi?id=746253 it
interferes with turning off event compression.
2015-03-22 17:33:38 -04:00
Benjamin Otte
c5905b13b9 entry: Make code do what it's meant to do
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.
2015-03-14 15:46:13 +01:00
Philip Withnall
61c46d911f gtkentry: Return early from gtk_entry_clear() if no icon info exists
This helps scan-build avoid some false positive potential NULL pointer
dereference warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall
19222a6364 gtkentry: Remove dead assignments
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall
7479133753 gtkentry: Call get_*_size() vfuncs unconditionally
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
2015-03-09 13:41:37 +00:00
Philip Withnall
0282714d86 gtkentry: Fix potential use of uninitialised variables
Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Matthias Clasen
8c3f04e754 GtkEntry: Refresh when activity ends
We need to queue a redraw when pulse mode is ended by
setting a fraction. Noticed in gtk3-demo's search entry demo.
2014-12-08 06:39:56 -05:00
Matthias Clasen
f74a75ae7e Handle KP keys in copy/paste keybindings
We currently handle KP variants of some keys, but not consistenly.

https://bugzilla.gnome.org/show_bug.cgi?id=364566
2014-12-07 23:28:52 -05:00
Ankita Patil
a4e827e4bf GtkEntry: Added gtk_entry_grab_focus_without_selection()
Providing a way to focus an entry without selecting its contents.

https://bugzilla.gnome.org/show_bug.cgi?id=735838
2014-12-05 23:17:25 -05:00
Jasper St. Pierre
e3bf31886a gtkentry: Optimize GtkStyleContext usage 2014-11-26 18:10:55 -08:00
Benjamin Otte
9b970d5f22 entry: Use correct state when computing icon padding 2014-11-26 13:53:57 +01:00
Jasper St. Pierre
442fd63ea6 gtkentry: Pass the correct set of state flags to gtk_style_context_get*
This eliminates a lot of overhead in the CSS engine recalculating
cached CSS rules, and is overall the correct thing to do.
2014-11-25 11:04:36 -08:00
Lapo Calamandrei
df7b275de8 entry: remove osd style class from touch selection popover
The touch-selection class is sufficient since that needs special
casing whatever.
2014-11-15 16:08:15 +01:00
Matthias Clasen
1a1c30adfa GtkEntry: plug a small memleak
GtkEntry was leaking a pango attribute list, if one was set.
2014-10-16 21:48:11 -04:00
Matthias Clasen
f93795d272 Add a style class for touch selection popovers 2014-10-07 13:27:52 -04:00
Benjamin Otte
91467a45fc stylecontext: Deprecate functions
- 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.
2014-10-03 06:18:06 +02:00
Marek Kasik
8b5d30d439 Remove redundant checks for NULL
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
2014-10-02 19:06:03 +02:00
Matthias Clasen
423868b408 entry: Revisit Ctrl-u one more time
Add a Ctrl-k binding too, and make them match their traditional
commandline meaning or 'erase line to the beginning/end'.
2014-09-26 11:14:28 -04:00
Matthias Clasen
414bc202e7 GtkEntry: Add a key binding for clearing the entry
Ctrl-u is a fine, well-established keybinding for this purpose,
lets just use it.
2014-09-26 10:29:10 -04:00
Carlos Garnacho
9629fd07e3 entry: Handle touch events on entry icons
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
2014-09-04 16:43:16 +02:00
Benjamin Otte
b5a8b7ef3b widget: Make _gtk_set_simple_clip() take an optional content clip 2014-08-21 00:54:07 +02:00
Benjamin Otte
6c06bd55da gtk: Don't use gtk_render_activity()
... 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.
2014-08-16 16:34:14 +02:00
Carlos Garnacho
0c2da16c0e entry: Update to new GtkGestureSingle/GtkEventController defaults
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
2014-08-15 13:53:39 +02:00
Matthias Clasen
34245515e5 Add a 'touchscreen' debug flag
This has the same effect as the GTK_TEST_TOUCHSCREEN environment
variable, but can be toggled at runtime.
2014-07-10 10:12:02 -04:00
Carlos Garnacho
5fe9ebfe11 entry: Do not unset selection if failing to update the primary selection
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.
2014-07-02 18:57:39 +02:00
Matthias Clasen
ef0e164a4c GtkEntry: Make progress pulsing smooth
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.
2014-06-28 15:51:33 -04:00
Matthias Clasen
17679c168a GtkEntry: Make has-frame use style classes
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
2014-06-26 22:02:19 -04:00
Matthias Clasen
ec6056a574 GtkEntry: Explicitly notify for populate-all 2014-06-09 13:30:59 -04:00
Matthias Clasen
056acf92ec GtkEntry: Don't forget to notify for the tooltip markup props 2014-06-09 13:30:59 -04:00
Matthias Clasen
126942f04c GtkEntry: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:30:54 -04:00
Evan Nemerson
54ec42f035 gtk: port many nullability annotation fixes from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-30 13:24:20 -07:00
Carlos Garnacho
907e9f1946 gtk: Update GtkGesture users to the GtkPropagationPhase semantics change
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.
2014-05-27 17:47:12 +02:00
Carlos Garnacho
d05a9f9a7b gesture: Replace gtk_gesture_attach/detach with event controller API
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.
2014-05-27 17:47:12 +02:00
Benjamin Otte
750178e1ed entry: Implement clip 2014-05-24 16:20:48 +02:00
Carlos Garnacho
f54277204f entry: Check first whether the sequence is handled, fetch later the event
And always unset/hide the selection popover if unhandled, that means the
sequence went grabbed/claimed somewhere else and cancelled here.
2014-05-23 19:54:33 +02:00
Carlos Garnacho
e70e3963dd entry: Ensure the cursor text handle is shown after touching to reposition cursor. 2014-05-23 19:54:31 +02:00
Carlos Garnacho
15f7170358 entry: Obey implementations' frame when placing handles/popovers around
Y=0 was assumed in a few places, not necessarily right on eg. vertical
spinbuttons.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
10c47fa6d6 entry: Improve touch popover interaction
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)
2014-05-23 19:54:31 +02:00
Carlos Garnacho
e580c29f07 entry: Use gestures to handle pointer/touch events
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.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
e3d25b3c3c entry: Don't show text handles too eagerly on button press
Instead do so on button release, or after text selection dragging
starts.
2014-05-23 19:54:26 +02:00
Cosimo Cecchi
9f7bab0aca entry: remove unused code 2014-05-09 11:02:45 -07:00
Cosimo Cecchi
779707fabb entry: always use interior focus 2014-05-09 11:02:41 -07:00
Cosimo Cecchi
a5bd1474d5 entry: consider ascent and descent when requesting height
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
2014-04-11 18:58:16 -07:00
Bastien Nocera
f71f7215ab all: Name more idles and timeouts
Following up from 438cd857c4,
name more timeouts and idles.

The original grep was missing checking for gdk_threads_add_*()
functions (at least for some of the files).

https://bugzilla.gnome.org/show_bug.cgi?id=726870
2014-03-26 20:09:30 -04:00
Carlos Garnacho
130d8f100e entry: revert text handles to cursor mode after cut/paste
The current text selection goes away in that case, so reflect
that too in the handles.
2014-03-10 23:07:21 +01:00
Carlos Garnacho
60b0e89804 entry: postpone text handles creation until when needed
This is only necessary for touch devices, so unlikely in many setups.
2014-03-10 23:07:21 +01:00
Carlos Garnacho
45d9076f49 entry: postpone magnifier creation until when needed 2014-03-10 23:07:21 +01:00
Carlos Garnacho
43b0eee81d entry: Make DnD coordinate calculation compensate for entry icons
This made DnD have effect farther on the left when dragging text over
any entry with icons in it.

https://bugzilla.gnome.org/show_bug.cgi?id=725866
2014-03-06 22:54:46 -05:00
Carlos Garnacho
adf39dd291 entry: use priv->dnd_position when rendering the DND cursor
This makes "cursor position" track the DnD point again, looks much
more intuitive than just rendering it on the pre-DnD position.

https://bugzilla.gnome.org/show_bug.cgi?id=725866
2014-03-06 22:54:46 -05:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00