Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-09-30 20:29:32 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-09-30 20:29:32 +0400
commit6fa46ad315ceb46dbf47d6c6ffdda032d0e885ed (patch)
treeb1454974f24b9d7020ddd26a6c86c0cdc12d454d /source/blender/makesrna/intern/rna_userdef.c
parentc7684b456a3236549b17e731288365331beec2ed (diff)
Support for "virtual pixelsize" on 4k screens.
On 4k devices the default pixel size leads to tiny OpenGL drawing that is hardly usable without doubling the DPI. The retina system on OSX aims to alleviate this problem by introducing a general 2x pixel size. No equivalent feature exists on other platforms so far. However, to emulate the effect this patch introduces a "virtual" pixel size factor for OpenGL drawing. Note that the user currently has to enable this manually by selecting the "Virtual Pixel Mode" in the user preferences (defaults to native). All windows of a Blender instance share the same virtual pixel size as well. It may be possible to handle this on a per-window basis and automate the selection somewhat (if enabled by the user), so working with multiple screens becomes more convenient, but technical limitations make this a bit difficult (on X11 with nvidia drivers the actual screen size is not reported correctly). Reviewers: ton, campbellbarton Differential Revision: https://developer.blender.org/D669
Diffstat (limited to 'source/blender/makesrna/intern/rna_userdef.c')
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index aa378955fb0..7fdc9ba1e79 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -120,6 +120,16 @@ static void rna_userdef_dpi_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
}
+static void rna_userdef_virtual_pixel_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+{
+ /* font's are stored at each DPI level, without this we can easy load 100's of fonts */
+ BLF_cache_clear();
+
+ BKE_userdef_state();
+ WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
+}
+
static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
BLF_cache_clear();
@@ -3743,6 +3753,12 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem virtual_pixel_mode_items[] = {
+ {VIRTUAL_PIXEL_NATIVE, "NATIVE", 0, "Native", "Use native pixel size of the display"},
+ {VIRTUAL_PIXEL_DOUBLE, "DOUBLE", 0, "Double", "Use double the native pixel size of the display"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna = RNA_def_struct(brna, "UserPreferencesSystem", NULL);
RNA_def_struct_sdna(srna, "UserDef");
RNA_def_struct_nested(brna, srna, "UserPreferences");
@@ -3762,6 +3778,12 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
+ prop = RNA_def_property(srna, "virtual_pixel_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "virtual_pixel");
+ RNA_def_property_enum_items(prop, virtual_pixel_mode_items);
+ RNA_def_property_ui_text(prop, "Virtual Pixel Mode", "Modify the pixel size for hi-res devices");
+ RNA_def_property_update(prop, 0, "rna_userdef_virtual_pixel_update");
+
prop = RNA_def_property(srna, "font_path_ui", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "font_path_ui");
RNA_def_property_ui_text(prop, "Interface Font", "Path to interface font");