Mercurial > vim
comparison src/gui_gtk_x11.c @ 14471:2f6f886d9a87 v8.1.0249
patch 8.1.0249: GTK: when screen DPI changes Vim does not handle it
commit https://github.com/vim/vim/commit/7ebf4e1c346783b25624258e5bcc599130fd18f9
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 7 20:01:40 2018 +0200
patch 8.1.0249: GTK: when screen DPI changes Vim does not handle it
Problem: GTK: when screen DPI changes Vim does not handle it.
Solution: Handle the gtk-xft-dpi signal. (Roel van de Kraats,
closes #2357)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 07 Aug 2018 20:15:05 +0200 |
parents | 1feeefd8cddb |
children | f8cd07a1cbb5 |
comparison
equal
deleted
inserted
replaced
14470:e9ca6470e8c2 | 14471:2f6f886d9a87 |
---|---|
786 } | 786 } |
787 return FALSE; | 787 return FALSE; |
788 } | 788 } |
789 #endif /* defined(FEAT_CLIENTSERVER) */ | 789 #endif /* defined(FEAT_CLIENTSERVER) */ |
790 | 790 |
791 /* | |
792 * Handle changes to the "Xft/DPI" setting | |
793 */ | |
794 static void | |
795 gtk_settings_xft_dpi_changed_cb(GtkSettings *gtk_settings UNUSED, | |
796 GParamSpec *pspec UNUSED, | |
797 gpointer data UNUSED) | |
798 { | |
799 // Create a new PangoContext for this screen, and initialize it | |
800 // with the current font if necessary. | |
801 if (gui.text_context != NULL) | |
802 g_object_unref(gui.text_context); | |
803 | |
804 gui.text_context = gtk_widget_create_pango_context(gui.mainwin); | |
805 pango_context_set_base_dir(gui.text_context, PANGO_DIRECTION_LTR); | |
806 | |
807 if (gui.norm_font != NULL) | |
808 { | |
809 // force default font | |
810 gui_mch_init_font(*p_guifont == NUL ? NULL : p_guifont, FALSE); | |
811 gui_set_shellsize(TRUE, FALSE, RESIZE_BOTH); | |
812 } | |
813 } | |
791 | 814 |
792 #if GTK_CHECK_VERSION(3,0,0) | 815 #if GTK_CHECK_VERSION(3,0,0) |
793 typedef gboolean timeout_cb_type; | 816 typedef gboolean timeout_cb_type; |
794 #else | 817 #else |
795 typedef gint timeout_cb_type; | 818 typedef gint timeout_cb_type; |
4381 #endif | 4404 #endif |
4382 | 4405 |
4383 /* Pretend we don't have input focus, we will get an event if we do. */ | 4406 /* Pretend we don't have input focus, we will get an event if we do. */ |
4384 gui.in_focus = FALSE; | 4407 gui.in_focus = FALSE; |
4385 | 4408 |
4409 // Handle changes to the "Xft/DPI" setting. | |
4410 { | |
4411 GtkSettings *gtk_settings = | |
4412 gtk_settings_get_for_screen(gdk_screen_get_default()); | |
4413 | |
4414 g_signal_connect(gtk_settings, "notify::gtk-xft-dpi", | |
4415 G_CALLBACK(gtk_settings_xft_dpi_changed_cb), NULL); | |
4416 } | |
4417 | |
4386 return OK; | 4418 return OK; |
4387 } | 4419 } |
4388 | 4420 |
4389 #if (defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)) || defined(PROTO) | 4421 #if (defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)) || defined(PROTO) |
4390 /* | 4422 /* |