Commit Graph

951 Commits

Author SHA1 Message Date
Timm Bäder
86dbe591d2 entry: Remove deprecated style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
1add02879e entry: Remove inner-border (style) property 2016-10-16 18:17:21 +02:00
Timm Bäder
ad155fb26c Remove GtkStock API from GtkImage 2016-10-16 18:17:21 +02:00
Benjamin Otte
fcbd480c76 API: Remove GDK_WA_CURSOR
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.
2016-10-16 18:17:21 +02:00
Matthias Clasen
ddd1ac0934 entry: Fix a corner case of overwrite mode
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
2016-10-05 12:22:21 -04:00
Christian Hergert
b684b23c74 entry: handle NULL cursor when updating cursors
If we got a NULL cursor from gdk_cursor_new_from_name(), we need
to handle that when unreffing.
2016-09-27 14:12:43 -07:00
Christian Hergert
7ecd337877 entry: handle NULL cursor when releasing reference
If we happen to have gotten NULL back for a cursor, then we
need to check before unreffing it.
2016-09-27 14:09:02 -07:00
Benjamin Otte
e1a03ead7a Use NULL for generic marshallers in g_signal_new()
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02:00
Timm Bäder
a985e62b25 Use gtk_popover_popdown/popup where appropriate
https://bugzilla.gnome.org/show_bug.cgi?id=769706
2016-08-16 11:49:26 -04:00
William Hua
8701e34f74 port to new gtk_menu_popup_at_* () functions
https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
Timm Bäder
4dbe7c99c2 entry: Fix undershoot position wrt entry icons
Draw them inside of the icons, which is where the text scrolls.
2016-05-31 09:41:08 +02:00
Timm Bäder
301652de1f Remove useless casts from gdk_event_triggers_context_menu calls 2016-05-12 20:39:51 +02:00
Matthias Clasen
b5fb9ae3b7 gtk: Port to new monitor api
Use the GdkDisplay monitor api instead of the GdkScreen one.
2016-04-27 23:18:16 -04:00
Matt Watson
511f138328 entry: port to progress tracker 2016-04-08 16:09:30 -07:00
Matthias Clasen
2fee5fbda7 entry: Fix drag highlight problems
We don't want drag highlights around icons or progress, so don't
propagate the :drop(active) state to them.
2016-03-11 08:02:10 -05:00
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
Timm Bäder
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Christian Hergert
0a0213bc1c entry: ensure valid GdkWindow before set_invisible_cursor()
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.
2015-11-18 14:41:29 -08:00
Matthias Clasen
43f822e70f Annotate deprecated style properties
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.
2015-11-16 15:13:33 -05:00
Matthias Clasen
46b7b0ac9f entry: Ignore the icon-prelight style property
The icon prelight effect can be controlled with regular CSS,
so deprecate and ignore this style property.
2015-11-16 07:20:18 -05:00
Matthias Clasen
27d70cbb10 entry: Simplify selection rendering
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.
2015-11-10 20:18:39 -05:00
Matthias Clasen
2a03107677 entry: Use a CSS node for selection rendering
This adds new possibilities for themes to render the selection
in fancy ways.
2015-11-10 13:36:16 -05:00
Matthias Clasen
0a136004c9 Document text handle styling
Since GtkTextHandle is private, document text handle style
classes in the GtkEntry and GtkTextView documentation.
2015-11-09 23:45:29 -05:00
Matthias Clasen
6328cf5ee5 entry: Add a diagram to CSS node docs 2015-11-03 09:53:00 -05:00
Florian Müllner
e364ae3ea8 Use gtk_widget_set_focus_on_click() instead of deprecated setters
https://bugzilla.gnome.org/show_bug.cgi?id=757269
2015-11-03 07:44:17 -05:00
Matthias Clasen
d5ff9af94e entry, textview: Use a dedicated style class for magnifier
This will free up "osd" as an application-level style class,
and lets us style magnifiers differently.
2015-11-02 12:40:38 -05:00
Matthias Clasen
bb7d7851ac entry, spinbutton: Finish css node conversion
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.
2015-10-28 23:43:32 -04:00
Matthias Clasen
ebcad63e31 wip: spinbutton 2015-10-28 21:55:13 -04:00
Benjamin Otte
624fb8b360 entry: Always render like with is_cellrenderer
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.
2015-10-28 19:44:26 +01:00
Matthias Clasen
d717afd4d4 entry: properly update css subnode state
Update the state of the css subnodes for icons when
appropriate, and avoid calling set_state after save_to_node.
2015-10-26 22:09:07 -04:00
Matthias Clasen
c72d094ae0 entry: Use better element name for progress
Change the name of the CSS subnode for progress rendering from
progressbar to progress. This will align better with GtkProgressBar.
2015-10-26 21:34:16 -04:00
Matthias Clasen
ed8641ff26 entry: Only set one of the .left, .right style classes
We were not removing the old style class when adding a new one.
2015-10-26 15:28:50 -04:00
Matthias Clasen
431089f769 entry: Add css node documentation
List the css names and the typical style classes that can be
expected to occur with entries.
2015-10-23 16:22:25 -04:00
Matthias Clasen
6a768ba218 entry: Use a permanent css node for progress
Create a css node with name progressbar when we start showing progress
in the entry. The node gets the style class .pulse added when we
do pulse mode.
2015-10-23 16:11:08 -04:00
Matthias Clasen
f5e77d0c67 entry: Use css nodes for icons
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.
2015-10-23 15:39:29 -04:00
Matthias Clasen
b2dd9cbc59 entry: Use the element name entry
Set the element name on the css node and drop the .entry class.
2015-10-23 14:51:35 -04:00
Matthias Clasen
b1bf153c99 entry: Use qdata with preallocated quarks 2015-09-23 07:01:15 -04:00
Matthias Clasen
15411aa032 entry: Drop the Ctrl-K keybinding
This interferes with a well-loved firefox shortcut, and we
are more interested in a gtk3 firefox than in legacy keybindings.
2015-09-14 11:49:15 -04:00
Matthias Clasen
dbd5513276 entry: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:35 -04:00
Matthias Clasen
587afb5b1c entry: Improve cursor hiding logic
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
2015-09-03 14:00:27 -04:00
Matthias Clasen
5aa1f0923c entry: Use gtk_simulate_touchscreen
Instead of repeated manual checks.
2015-07-31 13:46:34 -04:00
Matthias Clasen
5c2759af3c Use standard cursor names
This changes GTK+ to use gdk_cursor_new_from_name() with the
'standard' css names, instead of GdkCursorType.

https://bugzilla.gnome.org/show_bug.cgi?id=652085
2015-07-26 01:45:06 -04:00
Paolo Borelli
803430a779 pango: make merge_attrs return the merged list
This simplifies all the callers
2015-07-06 00:31:56 +02:00
Paolo Borelli
9e26fa9a42 entry: add css letter-spacing 2015-07-06 00:04:06 +02:00
Matthias Clasen
8cbed0b04a entry: Drop an unused variable 2015-06-13 21:10:26 -04:00
Carlos Garnacho
a2d1d5244b entry: Ensure we unset the magnifier widget on ::destroy
Otherwise there's dangling signal handlers which cause warnings
at the time we attempt to disconnect these.
2015-06-12 13:33:13 +02:00
Carlos Garnacho
10cb7f90e4 entry: Set text direction information on text handles
This way the handles point to the right side on the presence of rtl/ltr
text.
2015-06-11 17:14:23 +02:00
Matthias Clasen
90a331c84a entry: Select word on double tap
The same approach as taken for GtkTextView in the previous commit.
2015-06-10 06:20:18 -04:00
Matthias Clasen
70f1e2306d entry: Make touch selection work with mouse
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.
2015-06-09 15:50:30 -04:00
Matthias Clasen
ca077a085c entry: Avoid criticals
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.
2015-06-08 19:04:06 -04:00
Matthias Clasen
3c1a2c8d24 entry: Always clear handles for mouse interaction
There were some cases where we left a handle visible
during mouse interaction, which is a little weird.
2015-06-08 06:56:12 -04:00
Matthias Clasen
d055f8e64c entry: Move touch selection a little further away
Otherwise, it looks cramped, and we end up under the finger.
2015-06-08 06:56:12 -04:00
Matthias Clasen
3e386e0abb entry: Hide popover when touching elsewhere
Otherwise, the popover becomes 'sticky' and hard-to-dismiss.
2015-06-08 06:56:12 -04:00
Matthias Clasen
bd65c14813 entry: Use the drag-started signal
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.
2015-06-08 06:56:12 -04:00
Matthias Clasen
79b09cccce entry: Make handles come back reliably
We were setting the text handle mode to NONE too aggressively.
2015-06-08 06:56:12 -04:00
Matthias Clasen
a219e6b4cd entry: Never show handles and popover at the same time
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.
2015-06-08 06:56:12 -04:00
Matthias Clasen
1bd10f2a7b entry: Shorten touch selection timeout
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.
2015-06-08 06:56:12 -04:00
Matthias Clasen
6bbaa70c4c Update touch selection style
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.
2015-06-07 01:08:33 -04:00
Matthias Clasen
d71c5bf983 entry: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Carlos Garnacho
9ff5d2e1ac entry: Set up text drag icon within drag_begin()
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
2015-05-26 18:05:36 +02:00
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