Permalink
Browse files

Add pixel doubling option.

  • Loading branch information...
spl237 committed Nov 29, 2017
1 parent bcedb9b commit 248f33ed562940d571dbfefa9c9aefd8d93c22a9
Showing with 86 additions and 2 deletions.
  1. +70 −0 data/rc_gui.ui
  2. +16 −2 src/rc_gui.c
View
@@ -534,6 +534,76 @@
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1a">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkLabel" id="label1a">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Pixel Doubling:</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="null1a">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_pd_on">
<property name="label" translatable="yes">Enable</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Enable pixel doubling to improve usability on high-res screens</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_pd_off">
<property name="label" translatable="yes">Disable</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Disable pixel doubling for standard resolution screens</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">rb_pd_on</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">8</property>
</packing>
</child>
</object>
</child>
<child type="tab">
View
@@ -37,6 +37,8 @@
#define SET_SPLASH "raspi-config nonint do_boot_splash %d"
#define GET_OVERSCAN "raspi-config nonint get_overscan"
#define SET_OVERSCAN "raspi-config nonint do_overscan %d"
#define GET_PIXDUB "raspi-config nonint get_pixdub"
#define SET_PIXDUB "raspi-config nonint do_pixdub %d"
#define GET_CAMERA "raspi-config nonint get_camera"
#define SET_CAMERA "raspi-config nonint do_camera %d"
#define GET_SSH "raspi-config nonint get_ssh"
@@ -73,7 +75,7 @@
/* Controls */
static GObject *expandfs_btn, *passwd_btn, *res_btn, *locale_btn, *timezone_btn, *keyboard_btn, *wifi_btn;
static GObject *boot_desktop_rb, *boot_cli_rb, *camera_on_rb, *camera_off_rb;
static GObject *boot_desktop_rb, *boot_cli_rb, *camera_on_rb, *camera_off_rb, *pixdub_on_rb, *pixdub_off_rb;
static GObject *overscan_on_rb, *overscan_off_rb, *ssh_on_rb, *ssh_off_rb, *rgpio_on_rb, *rgpio_off_rb, *vnc_on_rb, *vnc_off_rb;
static GObject *spi_on_rb, *spi_off_rb, *i2c_on_rb, *i2c_off_rb, *serial_on_rb, *serial_off_rb, *onewire_on_rb, *onewire_off_rb;
static GObject *autologin_cb, *netwait_cb, *splash_on_rb, *splash_off_rb;
@@ -90,7 +92,7 @@ static GtkWidget *main_dlg, *msg_dlg;
static char orig_hostname[128];
static int orig_boot, orig_overscan, orig_camera, orig_ssh, orig_spi, orig_i2c, orig_serial, orig_splash;
static int orig_clock, orig_gpumem, orig_autolog, orig_netwait, orig_onewire, orig_rgpio, orig_vnc;
static int orig_clock, orig_gpumem, orig_autolog, orig_netwait, orig_onewire, orig_rgpio, orig_vnc, orig_pixdub;
/* Reboot flag set after locale change */
@@ -1070,6 +1072,13 @@ static int process_changes (void)
reboot = 1;
}
if (orig_pixdub != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pixdub_off_rb)))
{
sprintf (buffer, SET_PIXDUB, (1 - orig_pixdub));
system (buffer);
reboot = 1;
}
if (orig_ssh != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ssh_off_rb)))
{
sprintf (buffer, SET_SSH, (1 - orig_ssh));
@@ -1278,6 +1287,11 @@ int main (int argc, char *argv[])
get_string (GET_HOSTNAME, orig_hostname);
gtk_entry_set_text (GTK_ENTRY (hostname_tb), orig_hostname);
pixdub_on_rb = gtk_builder_get_object (builder, "rb_pd_on");
pixdub_off_rb = gtk_builder_get_object (builder, "rb_pd_off");
if (orig_pixdub = get_status (GET_PIXDUB)) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pixdub_off_rb), TRUE);
else gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pixdub_on_rb), TRUE);
#ifdef __arm__
res_btn = gtk_builder_get_object (builder, "button_res");
g_signal_connect (res_btn, "clicked", G_CALLBACK (on_set_res), NULL);

2 comments on commit 248f33e

@ZanderBrown

This comment has been minimized.

Show comment
Hide comment
@ZanderBrown

ZanderBrown Nov 29, 2017

Horray!

This will be very helpful when using Pi on a TV

ZanderBrown replied Nov 29, 2017

Horray!

This will be very helpful when using Pi on a TV

@spl237

This comment has been minimized.

Show comment
Hide comment
@spl237

spl237 Nov 29, 2017

Contributor

You'll need the latest version of raspi-config from the RPi-Distro GitHub to use it. It's also a very early version of the code - it won't be in a release for some time.

Contributor

spl237 replied Nov 29, 2017

You'll need the latest version of raspi-config from the RPi-Distro GitHub to use it. It's also a very early version of the code - it won't be in a release for some time.

Please sign in to comment.