Commit Graph

356 Commits

Author SHA1 Message Date
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
27a391bad8 gtkspinbutton: Remove motion notify handler
It does nothing nowadays.
2017-09-19 18:40:50 +02:00
Carlos Garnacho
ad05caedd3 gtkspinbutton: Use scroll event controller 2017-09-19 18:40:50 +02:00
Carlos Garnacho
e2eb20208b spinbutton: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
d31621256d spinbutton: Fix css node docs 2017-07-19 21:27:16 -04:00
Timm Bäder
bd446c48e9 spinbutton: expand the entry
It's supposed to fill the entire spinbutton allocation apart from the
buttons
2017-07-19 21:27:16 -04:00
Timm Bäder
348871d9fc Fix a few testsuite failures
Adjust default property values, skip GtkRange:adjustment.
2017-07-19 21:27:16 -04:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
c4f6cea111 fix a few documentation problems 2017-07-19 21:27:15 -04:00
Timm Bäder
f1813e8f88 spinbutton: Fix gesture state
We claimed the gesture previously to keep it from propagating to the
underlying entry, but now that the entry is in a box with the two
buttons, we can do this properly and restore the previous long-press
behavior.
2017-07-19 21:27:14 -04:00
Timm Bäder
70d90a9923 spinbutton: Remove unused import 2017-07-19 21:27:14 -04:00
Timm Bäder
a0ebad70cd spinbutton: Fix property notification 2017-07-19 21:27:14 -04:00
Timm Bäder
121cf9c78c spinbutton: Add docs for new public API 2017-07-19 21:27:13 -04:00
Timm Bäder
218e0b9929 spinbutton: Use 0 as default for (max-)width-chars
This mimics the old spinbutton size request better.
2017-07-19 21:27:13 -04:00
Timm Bäder
9ab43dfe9e spinbutton: Add accessors for (max-)width-chars 2017-07-19 21:27:12 -04:00
Timm Bäder
6aa9ca7b55 spinbutton: Fix activation 2017-07-19 21:27:12 -04:00
Timm Bäder
ede6f2ab59 Slightly rework clip handling
always initialize clips to the (content) allocation, don't walk up the
widget hierarchy in gtk_widget_set_clip, implement
gtk_widget_size_allocate in GtkSeparator. This way we don't end up using
uninitialized clip values.

The entire clip handling is up for major rework since we can't and don't
want to force every single widget to call _set_clip in size-allocate
implementations.
2017-07-19 21:27:12 -04:00
Timm Bäder
f736b071b4 spinbutton: Add text property 2017-07-19 21:27:11 -04:00
Timm Bäder
3c2d2545b2 spinbutton: Inherit from GtkWidget
Use a box, an entry and the current 2 buttons.
Remaining problems: Entry sizing and activation.
2017-07-19 21:27:11 -04:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Timm Bäder
a919f0c7f3 spinbutton: Add undershoot nodes to CSS docs 2017-04-24 16:24:32 +02:00
Timm Bäder
0acb404166 spinbutton: Remove an unused define 2017-04-24 16:24:20 +02:00
Timm Bäder
f251c5bf94 spinbutton: Fix right and middle click on +/- buttons
Tell the gesture that we handle all buttons and actually claim the
gesture in the ::pressed handler
2017-02-01 21:05:27 +01:00
Timm Bäder
ea897c6df4 Remove gtk_widget_show_all 2017-01-20 21:37:04 +01:00
Timm Bäder
3cfcbe2ccf spinbutton: Restore gtk3 focus behavior
Focus the spinbutton on button press, never focus the buttons.
2017-01-16 17:22:45 +01:00
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Timm Bäder
f486805ba0 Unparent child widgets 2017-01-07 17:19:30 +01:00
Timm Bäder
25236dbed8 spinbutton: Use widgets for up/down buttons 2017-01-07 17:19:30 +01:00
Piotr Drąg
a2da4ddceb Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2016-12-19 15:08:10 -05:00
Timm Bäder
fa4d6e8918 spinbutton: Remove _get_panels 2016-12-03 13:19:26 +01:00
Benjamin Otte
64e802c441 snapshot: Convert entry and spinbutton 2016-11-15 17:48:45 +01:00
Matthias Clasen
c7d119614f spinbutton: Fix some gadget handling issues
We were not adding the down_button gadget to the parent,
and we were not unreffing the button gadgets.

https://bugzilla.gnome.org/show_bug.cgi?id=774046
2016-11-10 14:46:21 -05:00
Timm Bäder
f483d931ec spinbutton: Convert to indirect rendering 2016-11-05 11:56:36 +01:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
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.
2016-10-22 19:05:47 +02:00
Benjamin Otte
4ab85723c8 spinbutton: Use gdk_window_new_input() 2016-10-18 00:22:35 +02:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Timm Bäder
601839c825 Remove various sizing related style properties 2016-10-16 18:17:21 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02: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
Ignacio Casal Quinteiro
b0f793c8e7 Use g_snprintf instead of snprintf.
snprintf is not compatible with msvc.
2016-08-10 12:45:39 +02:00
Chun-wei Fan
cd44f6d875 Fix build of commit f23e99b
Commit f23e99b made use of snprintf(), which is not universally available.
Fix this by using g_snprintf().
2016-06-27 11:53:30 +08:00
Matthias Clasen
f23e99b063 scale, spinbutton: Avoid -0.0
This is a very longstanding bug; time to finally put it to rest.

https://bugzilla.gnome.org/show_bug.cgi?id=118959
2016-06-07 23:04:40 -04:00
Matthias Clasen
2148708917 box gadget: Redo expand flag handling
We only keep one align flag per child, so it seems odd to
keep separate h/v expand flags. Just keep one expand flag
and interpret it according to orientation. Allow setting
the expand flag for child widgets too, though, so we can
make widget expand without interfering with the recursive
widget expand flag.

Update all callers.

Use the new possibility of expanding child widgets to make
the label of check and radio buttons expand. This fixes
unexpected behavior of these widgets in RTL in some places.

https://bugzilla.gnome.org/show_bug.cgi?id=765742
2016-04-28 21:59:34 -04:00
Matthias Clasen
3064e4e406 spinbutton: Fix drag highlight problems
Don't propagate :drop(active) to the buttons.
2016-03-11 08:07:30 -05:00
Matthias Clasen
4ab91f09cf spin button: Limit the entry width to reasonable values
When opening the value editor for any GtkAdjustment properties
in the inspector, the popover stretches out for miles, since
it reserves enough space to draw MAXDOUBLE. This is not useful.
Limit the space we reserve to 8 digits.
2016-03-05 23:45:35 -05:00
Jean-François Fortin Tam
cf6c0b09a5 spin button: Use the Ctrl modifier for Home and End key bindings
https://bugzilla.gnome.org/show_bug.cgi?id=309300
2016-02-23 21:20:00 -05:00
Timm Bäder
c44364f1d1 spinbutton: Free the gadget in finalize 2016-02-10 12:30:35 +01:00
Timm Bäder
c5369356e8 Various documentation fixes
Always have Since: annotations at the very bottom, use the correct
ClassName::signal-name/ClassName:property-name syntax, fix a few typos
in type names, wrong function names, non-existing type names, etc.
2016-02-08 22:56:52 +01:00
Matthias Clasen
79fb921ffc spin button: Document sizing peculiarities
Document that it is best to explicitly set width-chars and
max-width-chars to avoid surprises.

https://bugzilla.gnome.org/show_bug.cgi?id=727294
2016-01-27 23:30:25 -05:00
Benjamin Otte
ae31c00092 spinbutton: Don't expand the buttons
When the spinbutton grows larger, distribute horizontal size to the
entry and vertical size to the buttons.

Obviously, horizontal size only matters for horizontal spinbuttons and
vertical for vertical spinbuttons.
2016-01-26 17:59:08 +01:00