]> git.pld-linux.org Git - packages/control-center.git/blob - control-center-dpi.patch
- def-apps-capplet-browsers.patch
[packages/control-center.git] / control-center-dpi.patch
1 diff -Nuard control-center-2.4.0.orig/capplets/font/font-properties.glade control-center-2.4.0/capplets/font/font-properties.glade
2 --- control-center-2.4.0.orig/capplets/font/font-properties.glade       2003-08-04 17:33:22.000000000 +0200
3 +++ control-center-2.4.0/capplets/font/font-properties.glade    2003-11-14 21:01:26.000000000 +0100
4 @@ -723,6 +723,24 @@
5                       <property name="fill">False</property>
6                     </packing>
7                   </child>
8 +
9 +                 <child>
10 +                   <widget class="GtkCheckButton" id="dpi_calculate">
11 +                     <property name="visible">True</property>
12 +                     <property name="can_focus">True</property>
13 +                     <property name="label" translatable="yes">Calculate DPI</property>
14 +                     <property name="use_underline">True</property>
15 +                     <property name="relief">GTK_RELIEF_NORMAL</property>
16 +                     <property name="active">False</property>
17 +                     <property name="inconsistent">False</property>
18 +                     <property name="draw_indicator">True</property>
19 +                   </widget>
20 +                   <packing>
21 +                     <property name="padding">0</property>
22 +                     <property name="expand">False</property>
23 +                     <property name="fill">False</property>
24 +                   </packing>
25 +                 </child>
26                 </widget>
27               </child>
28             </widget>
29 diff -Nuard control-center-2.4.0.orig/capplets/font/main.c control-center-2.4.0/capplets/font/main.c
30 --- control-center-2.4.0.orig/capplets/font/main.c      2003-08-02 18:02:47.000000000 +0200
31 +++ control-center-2.4.0/capplets/font/main.c   2003-11-14 21:01:26.000000000 +0100
32 @@ -38,6 +38,7 @@
33  #define FONT_HINTING_KEY      FONT_RENDER_DIR "/hinting"
34  #define FONT_RGBA_ORDER_KEY   FONT_RENDER_DIR "/rgba_order"
35  #define FONT_DPI_KEY          FONT_RENDER_DIR "/dpi"
36 +#define FONT_CALCULATE_DPI_KEY          FONT_RENDER_DIR "/calculate_dpi"
37  
38  #endif /* HAVE_XFT2 */
39  static gboolean in_change = FALSE;
40 @@ -749,6 +750,33 @@
41  }
42  
43  static void
44 +dpi_toggle_changed (GtkToggleButton *toggle,
45 +                  GtkWidget   *spinner)
46 +{
47 +       GConfClient *client = gconf_client_get_default ();
48 +       GdkScreen *screen = gdk_screen_get_default ();
49 +       gboolean active = gtk_toggle_button_get_active (toggle);
50 +        int width_mm, width_px, dpi;
51 +        double xres;
52 +       
53 +       gconf_client_set_bool (client, FONT_CALCULATE_DPI_KEY, active, NULL);
54 +       
55 +       if (active)
56 +         gtk_widget_set_sensitive( GTK_WIDGET(spinner) , FALSE);
57 +        else
58 +         gtk_widget_set_sensitive( GTK_WIDGET(spinner) , TRUE);
59 +       
60 +        width_mm = gdk_screen_get_width_mm(screen);
61 +        width_px  = gdk_screen_get_width(screen);
62 +
63 +        xres = ((((double)width_px) * 25.4) / ((double)width_mm));
64 +        dpi = (int)(xres + 0.5);
65 +
66 +       gtk_spin_button_set_value ( GTK_SPIN_BUTTON (spinner), dpi);
67 +
68 +}
69 +
70 +static void
71  dpi_value_changed (GtkSpinButton *spinner,
72                    GConfClient   *client)
73  {
74 @@ -790,7 +818,7 @@
75         if (!details_dialog) {
76                 GConfClient *client = gconf_client_get_default ();
77                 GladeXML *dialog = glade_xml_new (GLADEDIR "/font-properties.glade", "render_details", NULL);
78 -               GtkWidget *dpi_spinner;
79 +               GtkWidget *dpi_spinner, *dpi_toggle;
80                 GnomeVFSURI *uri;
81  
82                 details_dialog = WID ("render_details");
83 @@ -809,9 +837,16 @@
84                 g_signal_connect (dpi_spinner, "value_changed",
85                                   G_CALLBACK (dpi_value_changed), client);
86  
87 +               dpi_toggle = WID ("dpi_calculate");
88 +               g_signal_connect (GTK_TOGGLE_BUTTON (dpi_toggle), "toggled",
89 +                                 G_CALLBACK (dpi_toggle_changed), dpi_spinner);
90 +
91 +               gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (dpi_toggle), gconf_client_get_bool (client, FONT_CALCULATE_DPI_KEY, NULL));
92 +
93                 gconf_client_notify_add (client, FONT_DPI_KEY,
94                                          dpi_changed,
95                                          dpi_spinner, NULL, NULL);
96 +                                        
97  
98                 setup_font_sample (WID ("antialias_none_sample"),      ANTIALIAS_NONE,      HINT_FULL);
99                 setup_font_sample (WID ("antialias_grayscale_sample"), ANTIALIAS_GRAYSCALE, HINT_FULL);
100 diff -Nuard control-center-2.4.0.orig/gnome-settings-daemon/gnome-settings-xsettings.c control-center-2.4.0/gnome-settings-daemon/gnome-settings-xsettings.c
101 --- control-center-2.4.0.orig/gnome-settings-daemon/gnome-settings-xsettings.c  2003-07-31 20:25:42.000000000 +0200
102 +++ control-center-2.4.0/gnome-settings-daemon/gnome-settings-xsettings.c       2003-11-14 21:34:46.000000000 +0100
103 @@ -17,6 +17,7 @@
104  #define FONT_HINTING_KEY      FONT_RENDER_DIR "/hinting"
105  #define FONT_RGBA_ORDER_KEY   FONT_RENDER_DIR "/rgba_order"
106  #define FONT_DPI_KEY          FONT_RENDER_DIR "/dpi"
107 +#define FONT_CALCULATE_DPI_KEY          FONT_RENDER_DIR "/calculate_dpi"
108  #endif /* HAVE_XFT2 */
109  
110  typedef struct _TranslationEntry TranslationEntry;
111 @@ -268,10 +269,11 @@
112  gnome_xft_settings_get (GConfClient      *client,
113                         GnomeXftSettings *settings)
114  {
115 -  char *antialiasing = gconf_client_get_string (client, FONT_ANTIALIASING_KEY, NULL);
116 -  char *hinting = gconf_client_get_string (client, FONT_HINTING_KEY, NULL);
117 -  char *rgba_order = gconf_client_get_string (client, FONT_RGBA_ORDER_KEY, NULL);
118 -  double dpi = gconf_client_get_float (client, FONT_DPI_KEY, NULL);
119 +  gchar *antialiasing = gconf_client_get_string (client, FONT_ANTIALIASING_KEY, NULL);
120 +  gchar *hinting = gconf_client_get_string (client, FONT_HINTING_KEY, NULL);
121 +  gchar *rgba_order = gconf_client_get_string (client, FONT_RGBA_ORDER_KEY, NULL);
122 +  gdouble  dpi = gconf_client_get_float (client, FONT_DPI_KEY, NULL);
123 +  gboolean calculate_dpi = gconf_client_get_bool (client, FONT_CALCULATE_DPI_KEY ,NULL);
124  
125    settings->antialias = TRUE;
126    settings->hinting = TRUE;
127 @@ -279,12 +281,28 @@
128    settings->dpi = 96;
129    settings->rgba = "rgb";
130  
131 -  if ((int)(1024 * dpi + 0.5) > 0)
132 -    settings->dpi = (int)(1024 * dpi + 0.5);
133 +  if (calculate_dpi == TRUE)
134 +    {
135 +      gdouble xres;
136 +      gint width_mm, width_px;
137 +      GdkScreen *screen = gdk_screen_get_default();
138 +         
139 +      width_mm = gdk_screen_get_width_mm(screen);
140 +      width_px  = gdk_screen_get_width(screen);
141 +
142 +      xres = ((((gdouble)width_px) * 25.4) / ((gdouble)width_mm));
143 +      dpi = xres;
144 +      
145 +      gconf_client_set_float (client, FONT_DPI_KEY, (gint)(xres + 0.5) ,NULL);
146 +    } 
147 +    
148 +  if ((gint)(1024 * dpi + 0.5) > 0)
149 +    settings->dpi = (gint)(1024 * dpi + 0.5);
150 +
151  
152    if (rgba_order)
153      {
154 -      int i;
155 +      gint i;
156        gboolean found = FALSE;
157  
158        for (i = 0; i < G_N_ELEMENTS (rgba_types) && !found; i++)
159 diff -Nuard control-center-2.4.0.orig/schemas/desktop_gnome_font_rendering.schemas control-center-2.4.0/schemas/desktop_gnome_font_rendering.schemas
160 --- control-center-2.4.0.orig/schemas/desktop_gnome_font_rendering.schemas      2003-09-08 16:58:39.000000000 +0200
161 +++ control-center-2.4.0/schemas/desktop_gnome_font_rendering.schemas   2003-11-14 21:01:26.000000000 +0100
162 @@ -1,6 +1,21 @@
163  <?xml version="1.0"?>
164  <gconfschemafile>
165      <schemalist>
166 +       <schema>
167 +           <key>/schemas/desktop/gnome/font_rendering/calculate_dpi</key>
168 +           <applyto>/desktop/gnome/font_rendering/calculate_dpi</applyto>
169 +            <owner>gnome</owner>
170 +           <type>bool</type>
171 +            <default>false</default>
172 +            <locale name="C">
173 +               <short>Automatic DPI calculation</short>
174 +                <long>Automaticac DPI calculation</long>
175 +            </locale>
176 +            <locale name="pl">
177 +               <short>Automatyczne obliczanie DPI</short>
178 +                <long>Automatyczne obliczanie DPI</long>
179 +            </locale>
180 +       </schema>
181         <schema>
182             <key>/schemas/desktop/gnome/font_rendering/dpi</key>
183             <applyto>/desktop/gnome/font_rendering/dpi</applyto>
This page took 0.052161 seconds and 3 git commands to generate.