How to get padding applied to a widget?

It is possible to get padding for a widget from GtkStyleContext. However, now it is marked as deprecated. So, what is current way for getting this information?

You can get info from the inspector, but I’m assuming that’s not what you need. What are you actually trying to achieve?

You can keep using deprecated API: it only makes a difference once you decide to port to the next major version of GTK.

You don’t. Padding, like every other CSS property, is automatically applied to widgets, so you should not be querying it at all.

What are you actually trying to achieve?

I have widget where I’m drawing a waveform. It is something similar to the WaveformView widget of Amberol. If I know the padding for the widget, I can draw the waveform with the padding.

Do width and height obtained from gtk_widget_get_width and gtk_widget_get_height include padding?

Yes, the padding is automatically managed by GTK.

I assume, since you referred to Amberol, that you have also checked how the waveform widget is implemented.

This answers my question. The padding is automatically managed by GTK, so I don’t have to worry about it when drawing or handling events. Thank you, @ebassi and @monster