Commit Graph

325 Commits

Author SHA1 Message Date
Carlos Garnacho
a4e0de1839 button: Ensure the button is "left" when a gesture is cancelled
This prevents from stale widget states if the gesture happens to be
cancelled mid-press.
2015-03-02 12:01:07 +01: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
6d3c61856b GtkButton: Use GtkLabel:xalign 2014-09-29 23:57:13 -04:00
Carlos Garnacho
d17fd81d9b button: Fix ::clicked emission on touchscreens sending pointer events
When GtkGestureMultiPress::released happens, in_button should be unset
after emitting GtkButton::released, whose default implementation uses it.
Moreover, in_button should only be unset there for real touch events, not
guaranteed to trigger crossing events, as opposed to every pointer/touch
events from touchscreens.

https://bugzilla.gnome.org/show_bug.cgi?id=737297
2014-09-25 21:25:52 +02:00
Matthias Clasen
be97bad3a0 Avoid criticals when drags end
Its seems that gtk_gesture_get_last_event may return NULL,
protect against that to avoid critical warnings.
2014-09-07 21:24:01 -04:00
Carlos Garnacho
ea830aee5d button: Track gesture point to maintain priv->in_button
This makes the active state work invariably with both mouse/touch, and
regardless of X11 pointer emulation being friendly and sending crossing
events for the emulated pointer events in the latter.

This makes GtkButtons' active state look correct when pressing on
touchscreens on wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=731380
2014-08-26 23:21:24 +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
b520d3b7fb button: Remove unnecessary queue_redraw() calls
Setting a state automatically triggers redraws via the CSS machinery.
2014-08-17 06:47:17 +02:00
Benjamin Otte
b675a13233 button: Remove depressed_on_activate
All buttons should always be marked as :active when they are pressed.
That includes checkboxes (which are never activated in real code anyway,
so this change pretty much doesn't matter).
2014-08-16 16:34:14 +02:00
Benjamin Otte
bb069b781b button: Remove depressed variable
It is not used anymore.
2014-08-16 16:34:14 +02:00
Benjamin Otte
e9f1d6d85c button: Don't honor child-displacement anymore
It doesn't make sense to support child displacement in a world where
pseudoclasses behave different from the actual displacement states.
Nobody would ever understand why a widget is displaced.

It is easily possible to simulate child displacement by using padding
CSS properties.
2014-08-16 16:34:14 +02:00
Matthias Clasen
733a590fbe GtkButton: warn slightly less
Use gtk_misc_set_alignment when setting x/align on button children
where possible, to avoid the runtime warning that g_object_set
incurs nowadays.
2014-06-28 10:56:54 -04:00
Matthias Clasen
598777166f GtkButton: Use FLAT style class
This commit makes button always draw background and frame.
Buttons with relief none get a new style class, FLAT, which
allows themes to style these buttons as they like.

We also (finally) mark GTK_RELIEF_HALF as deprecated. It
has never done anything different from GTK_RELIEF_NORMAL.

https://bugzilla.gnome.org/show_bug.cgi?id=732256
2014-06-26 22:02:18 -04:00
Jasper St. Pierre
9c37b3de74 gtk: Don't use GObjectClass.constructor
Use the newer constructed instead, which has a fast path in GObject.
2014-06-26 19:06:43 -04:00
Matthias Clasen
d09c458ced GtkButton: Queue a redraw on enter/leave
We currently getting a redraw for buttons, but that is just luck.
Better to make it explicit.
2014-06-24 13:21:05 -04:00
Matthias Clasen
41fd2ae898 Deprecate outside-border style properties
These should just be replaced by CSS margins, etc.
2014-06-11 19:38:22 -04:00
Matthias Clasen
48db936b70 GtkButton: Don't use a non-zero border by default
The non-zero default default-border was causing buttons to shrink as
the focus moves around them. Themes which want a default-border should
define it explicitly.
2014-06-11 19:06:36 -04:00
Matthias Clasen
d218e17a2a GtkButton: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:30:52 -04:00
Matthias Clasen
62d591a550 GtkButton: Convert to g_object_class_install_properties 2014-06-09 13:30:51 -04:00
Carlos Garnacho
2012b67c5b button: Claim the sequence on multipress::pressed
In order to avoid the event from bubbling, as it used to (not) do.
2014-05-27 17:47:12 +02: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
a9bcea5118 button: Implement clip 2014-05-24 16:12:21 +02:00
Matthias Clasen
04703689b8 Deprecate GtkAligment
This has been dangling ever since 3.0.

https://bugzilla.gnome.org/show_bug.cgi?id=645781
2014-05-23 20:31:25 -04:00
Carlos Garnacho
ced7e7c08d button: Make multipress gesture exclusive
We only want actions to be triggered by a single sequence there,
so buttons trigger no actions on further simultaneous touches
happening.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
fd9925141b button: Use GtkGestureMultiPress for signal emission
It is now useful for that purpose with a ::release signal, so replace
the custom GtkGestureSingle with one of these.
2014-05-23 19:54:31 +02:00
Carlos Garnacho
5369c77029 gesture: Simplify gesture/widget interaction public API
The propagation phase property/methods in GtkEventController are gone,
This is now set directly on the GtkWidget add/remove controller API,
which has been made private.

The only public bit now are the new functions gtk_gesture_attach() and
gtk_gesture_detach() that will use the private API underneath.

All callers have been updated.
2014-05-23 19:54:29 +02:00
Matthias Clasen
487ac50e93 GtkButton: Don't leak the gesture 2014-05-23 19:54:28 +02:00
Matthias Clasen
0106099f5b GtkButton: Port to GtkGesture
Quick-and-dirty patch to use a GtkGestureSingle for both
button press/release and touch event handling.
2014-05-23 19:54:28 +02:00
Matthias Clasen
d769f338f2 GtkButton: tighten code a bit
Make it so we only use GtkMisc in one place.
2014-05-22 23:15:08 -04:00
Matthias Clasen
f6af96723c GtkButton: Deprecated setters and getters as well
gtk_button_set/get_alignment should be deprecated together
with the properties they are setters/getters for.
2014-05-13 22:19:30 -04:00
Matthias Clasen
ec0a60a248 Deprecate GtkMisc
This has been dangling ever since 3.0.
2014-05-13 08:45:00 -04:00
Matthias Clasen
42f8b4b48b GtkButton: Deprecate xalign and yalign properties
These are directly passed through to GtkMisc/GtkAlignment, which
are both on the way to deprecation.
2014-05-13 06:26:19 -04:00
Cosimo Cecchi
694b209094 button: don't use focus-line-width 2014-05-09 11:02:44 -07:00
Cosimo Cecchi
bbadfbcd2a button: remove unused code 2014-05-09 11:02:44 -07:00
Cosimo Cecchi
8b068e996f button: don't read focus padding property
We're going to deprecate it.
2014-05-09 11:02:42 -07:00
Cosimo Cecchi
4c06925ec2 button: always use interior focus
We're going to deprecate the property, and this is what everyone has
been using.
2014-05-09 11:02:41 -07:00
Benjamin Otte
3914bc9ce6 button: Remove unneeded checks
Size vfuncs always get non-null out variables passed, so no need to
check for NULL.
2014-05-01 14:51:27 +02:00
Matthias Clasen
bf8a169cb9 docs: Another round of markup removal 2014-03-29 00:24:15 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
13998c55e7 docs: use proper quotations instead of '*' 2014-02-07 14:22:39 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
Benjamin Otte
b6f9ce8a73 button: Allow :hover on insensitive buttons
You can still hover a mouse on insensitive elements; it's up to the
theme to disable that.
This is in line with the HTML/CSS interpretation of :hover.

Insensitive elements still cannot be clicked.

https://bugzilla.gnome.org/show_bug.cgi?id=719486
2013-12-07 01:39:38 +01:00
Benjamin Otte
9a0064c684 button: Call the new function
This simplifies a lot of code and doesn't require hacks setting
in_button anymore.
2013-12-03 01:57:38 +01:00
Benjamin Otte
804be65a09 button: Split out function
This is in preparation of the following cleanup commits.
2013-12-03 01:57:38 +01:00
Benjamin Otte
85b17e778c button: Don't emit a signal on broken grabs
We don't emit one on grab notify, so we don't want one for broken grabs
either.
2013-12-03 01:57:38 +01:00
Matthias Clasen
9a04a27ba6 GtkButton: don't propagate double-clicks
It is basically always unexpected to have a container handle
double-clicks on a widget that handles single-clicks itself.
2013-11-15 23:43:05 -05:00
Matthias Clasen
c46aca463a Respect deprecated button images setting
I have been convinced that it is a bad idea to change the behaviour
at the same time as deprecating it, so go back to respecting the
Gtk/ButtonImages xsetting in buttons created with
gtk_button_new_from_stock() when it is set.

The setting as well as the function are still deprecated, and the
default value of the setting will remain FALSE.
2013-10-24 20:35:55 -04:00