Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Newer edit →
Features/GTK3/Porting/Typing Turtle
(view source)
Revision as of 09:00, 2 August 2012
716 bytes added
,
09:00, 2 August 2012
→Notes
Line 224:
Line 224:
# Hack to get the current modifier state - which will not be represented by the event.
# Hack to get the current modifier state - which will not be represented by the event.
state = gtk.gdk.device_get_core_pointer().get_state(self.window)[1]
state = gtk.gdk.device_get_core_pointer().get_state(self.window)[1]
+
+
+
* I used a HACK related to Pango fonts and DPI:
+
+
<pre>
+
# Set correct DPI for Rsvg and Screen
+
from gi.repository import PangoCairo
+
+
def _get_screen_dpi():
+
xft_dpi = Gtk.Settings.get_default().get_property('gtk-xft-dpi')
+
dpi = float(xft_dpi / 1024)
+
logging.debug('Setting dpi to: %f', dpi)
+
# HACK: if the DPI detected is 200.0 it seems we are on an XO, so
+
# we return 133 because the XO manage its resolution in a complex
+
# way. More information here:
+
# http://wiki.laptop.org/go/Display
+
if 200 == int(dpi):
+
return 133
+
return dpi
+
+
dpi = _get_screen_dpi()
+
font_map_default = PangoCairo.font_map_get_default()
+
font_map_default.set_resolution(dpi)
+
</pre>
= Missing / problematic things =
= Missing / problematic things =
Humitos
266
edits