Commit Graph

37 Commits

Author SHA1 Message Date
Matthias Clasen
394ea32e93 Use gtk_widget_add/remove_css_class more
Replace most uses of gtk_style_context_add/remove_class
by the new APIs. The only remaining uses of the old API
are in save/restore situations.
2020-04-10 12:09:57 -04:00
Matthias Clasen
632524f679 Reinstate expected focus behavior
After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
2020-04-09 17:50:29 -04:00
Timm Bäder
9ba08a09cb shortcutlabel: Inherit from GtkWidget 2019-10-22 09:37:08 +02:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Benjamin Otte
a44ac75e65 gtk: Don't include gtkstylecontext.h from gtkcsstypesprivate.h
And make sure it's included everywhere it's needed.
2019-03-19 08:53:25 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Benjamin Otte
7437d34eb9 shortcuts: Don't include gtk.h
Clean up all shortcuts includes to only include the necessary files
while we're at it.
2018-02-08 06:16:01 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Matthias Clasen
dbfaa99107 image: Remove icon-size argument from icon setters
Instead, add a function gtk_image_set_icon_size() for the cases where
overriding the icon size is necessary.

Treat icon sizes the same way as pixel sizes, too. So gtk_image_clear()
no longer unsets the icon size.
2017-11-15 14:22:17 -05:00
Benjamin Otte
049cc6aa01 image: Change getters
Instead of returning the icon size with them, make
gtk_image_get_icon_name() and gtk_image_get_gicon() only return the icon
itself.

As a benefit, we can turn them into regular getters that return values
instead of requiring out parameters.

Instead, provide gtk_image_get_icon_size() to query the icon size.
2017-11-15 14:22:17 -05:00
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
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
f4341ee9f7 widget: Remove show-all property
Doesn't make sense anymore now that gtk_widget_show_all is gone.
2017-01-20 21:37:07 +01:00
Timm Bäder
524bf22db7 shortcutsshortcut: Be a GtkWidget
Instead of subclassing GtkBox and overriding _add to not work, subclass
GtkWidget and add a normal GtkBox as a child widget.
2017-01-20 21:33:37 +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
Emmanuele Bassi
9bb816f8ee gtk: Include the appropriate headers 2016-10-17 11:10:14 +01:00
Felix Riemann
b6cdc3961a GtkShortcutsShortcut: Support single finger swipe gestures
https://bugzilla.gnome.org/show_bug.cgi?id=772770
2016-10-13 15:02:36 -04:00
Georges Basile Stavracas Neto
7543cd8ce4 shortcut-label: make it public
GtkShortcutLabel is a widget that displays a single
shortcut accelerator or gesture in the user interface,
and is currently used by the shortcuts window.

This widget, however, has public value as other applications
also may want to expose their own shortcuts. For instance,
it'll be useful for the Keyboard panel on Control Center and
the new shortcut editor in Pitivi, among others.

This patch exposes GtkShortcutLabel as a public widget,
and adds the necessary documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=769205
2016-07-27 16:30:31 -03:00
Matthias Clasen
50f041bc57 shortcuts: Follow changes of accels
Add a way to associate a detailed action name with a shortcut.
If the action name is set, update the accelerator whenever
accels change on the window that the shortcuts window is
associated with.

https://bugzilla.gnome.org/show_bug.cgi?id=764975
2016-04-17 13:42:14 -04: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
Bastien Nocera
a56a8a8c02 shortcuts: Make sure that hidden shortcuts stay hidden
When doing a gtk_widget_show_all() on the shortcuts window,
accelerators for both RTL and LTR directions are being shown.

Make sure that no-show-all is set by default on hidden shortcuts, and
updated if the widget direction changes.

https://bugzilla.gnome.org/show_bug.cgi?id=759541
2015-12-16 12:22:58 +01:00
Matthias Clasen
27b24bb68f Add a css name to GtkShortcutsShortcut
This will be useful for tweaking the gesture image details,
among other things.
2015-12-04 13:22:26 -05:00
Matthias Clasen
8768c0b8ac shortcuts: Extend the accelerator syntax more
Cover cases like left+right control, and render them nicely.
The gtk3-demo builder shortcuts example shows the new
possibilities.
2015-12-04 10:56:48 -05:00
Matthias Clasen
b6e03dbc26 Load gesture images as symbolic icons
This makes them recolor in the dark theme, which looks better.
2015-11-23 10:08:14 -05:00
Matthias Clasen
50abc8b525 shortcuts: Add set properties for optional things
This makes it possible to switch between gesture and accelerator
types and override the builtin icons and subtitles for predefined
gestures.
2015-11-22 22:41:48 -05:00
Matthias Clasen
304c5ac226 shortcuts: Add support for standard gestures
Add an enum for gestures that GtkShortcutsShortcut knows how
to show an image and subtitle for.

https://bugzilla.gnome.org/show_bug.cgi?id=758187
2015-11-22 22:41:48 -05:00
Matthias Clasen
c6dc863e90 shortcuts shortcut: Take over gesture functionality
It turns out that it is nicer in glade to have just a single
widget that can show either a shortcut or a gesture, so make
GtkShortcutsShortcut do it both.

GtkShortcutsGesture is now redundant and will be removed before
the next stable release.
2015-11-22 22:41:48 -05:00
Matthias Clasen
530aa3cced shortcuts: Avoid excessive property notification
Notifying needlessly causes unnecessary work, and causes our
testsuite to fail.
2015-11-20 00:13:20 -05:00
Matthias Clasen
9b041ae930 shortcuts: Support direction-specific shortcuts
The prime example for direction-dependent shortcuts is using
<Alt>Left or <Alt>Right to go back. Support this by adding a
direction property to GtkShortcutsShortcut, and filtering by
the current text direction.

https://bugzilla.gnome.org/show_bug.cgi?id=757888
2015-11-14 22:34:19 -05:00
Matthias Clasen
705d371362 help overlay: Allow key sequences
Extend the syntax to allow sequences of keys or key combinations,
e.g. t+t or <ctl>c+<ctl>x.

https://bugzilla.gnome.org/show_bug.cgi?id=758051
2015-11-14 21:34:43 -05:00
Timm Bäder
3c22784328 GtkShortcutsShortcut: Add missing word 2015-11-13 14:12:35 +01:00
Matthias Clasen
bb5b711d4b shortcuts: Some property hygiene
Bring property notification for some of the new shortcuts widgets
up to the standards of our testsuite.
2015-10-27 09:25:17 -04:00
Matthias Clasen
67a54bf4ef shortcuts: Support ranges in the display of shortcuts
Repeating Alt-1 to Alt-9 as individual shortcuts looks really boring,
so allow compressing such ranges by specifying <Alt>1...9.
2015-10-22 14:32:50 -04:00
Matthias Clasen
1dfbae1aa4 Add GtkShortcutsWindow
This is a toplevel window that is tailored towards showing
help for shortcuts in an application. The implementation closely
follows this design: https://wiki.gnome.org/Design/OS/HelpOverlay

This implementation is inspired by earlier work in gnome-builder,
thanks to Christian Hergert.

https://bugzilla.gnome.org/show_bug.cgi?id=756428
2015-10-21 15:19:34 -04:00