Discussion:
Display scaling on GTK+
(too old to reply)
Colomban Wendling
2014-05-21 19:51:58 UTC
Permalink
[...]
The scaling factor is available from cairo_surface_get_device_scale
which returns floating point values for x and y. I have not found a
signal that says that this value is changing.
Watching the GtkWidget:scale-factor [1] property for changes (through
GObject::notify) should probably do it just fine.

g_signal_connect(wText, "notify::scale-factor", ...)

Also, since GtkStyleContext has a get_scale() method, I would imagine
the signal GtkStyleContext::changed would get emitted when scale changes.

All this is completely untested tho, I just gathered it from a quick
lookup at the docs.

Regards,
Colomban


[1]
https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget--scale-factor
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-05-22 05:27:44 UTC
Permalink
Colomban Wendling:

Watching the GtkWidget:scale-factor [1] property for changes (through
Post by Colomban Wendling
GObject::notify) should probably do it just fine.
g_signal_connect(wText, "notify::scale-factor", ...)
Also, since GtkStyleContext has a get_scale() method, I would imagine
the signal GtkStyleContext::changed would get emitted when scale changes.
OK, that works and a patch is attached.

However, that only sees the gross change when scale-factor switches
between 1 (for scaling below 2) to 2 (for 2 and above). It doesn't see the
finer changes.

There is a call to the size_allocate function when finer changes are
made so it should be possible to discover any changes to the scale factor
there. On Ubuntu 14.04 cairo_surface_get_device_scale always returns a
scale factor of 1.0.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...