Scrolling X-screen (Solved with Scaled X Screen)

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read this

Scrolling X-screen (Solved with Scaled X Screen)

Postby grimdestripador on Thu Apr 07, 2011 4:07 pm

I have a small netbook with a 1024 x 600 screen. Many applications (including qtoctave) don't support these window sizes and someone has hard coded minimum sizes of 1024x768. This ends up actucally breaking qtoctave, as the window is unclickable even when moved.

I have found many issues of people trying to stop screen scrolling after installing the nvidia driver. But I have missed where I can declare my screen size begger than my monitor, such that it will result is scrolling.

I would like some advice on how to configure xorg.conf such that my screen will scroll. I am using the default settings and have no integrated graphics, so this will be all done on xorg X11 I believe.
Last edited by grimdestripador on Tue Apr 12, 2011 2:34 pm, edited 2 times in total.
User avatar
grimdestripador
Level 6
Level 6
 
Posts: 1069
Joined: Fri Feb 16, 2007 2:26 am

Linux Mint is funded by ads and donations.
 

Re: Scrolling X-screen

Postby nunol on Sat Apr 09, 2011 10:21 pm

I also have a 1024x600 netbook and think that a scrolling X and compressed X feature would be very nice to have as a Mint Tool.

Here you have the compressed X feature Howto: https://help.ubuntu.com/community/EeePC/Using

What you think?
User avatar
nunol
Level 9
Level 9
 
Posts: 2664
Joined: Sun Mar 06, 2011 9:25 pm
Location: Portugal

Re: Scrolling X-screen

Postby nunol on Mon Apr 11, 2011 8:58 pm

By following the instructions on the post above and just messing around with the ratios I can compress a given resolution and return to standard mode.

I just noted that my desktop NVIDIA X Server Settings panel has a button that says "Advanced..." and inside there is a panning option. So what grimdestripador asks is possible at least on some hardware.

The question asked in this thread is still unanswered but it should be interesting to solve (on a dual monitor setup rotate only on screen):
viewtopic.php?f=141&t=69411&start=0
User avatar
nunol
Level 9
Level 9
 
Posts: 2664
Joined: Sun Mar 06, 2011 9:25 pm
Location: Portugal

Re: Scrolling X-screen

Postby grimdestripador on Tue Apr 12, 2011 2:31 pm

I took the suggested page for EE PC. and ran the following code.
Code: Select all
mkdir ~/bin
nano ~/bin/toggle-zoom

Then append the following code
#!/bin/sh
if xrandr | head -n1 | grep -q '1024 x 600'; then
xrandr --output LVDS1 --scale 1.0x1.28
else
xrandr --output LVDS1 --scale 1.0x1.0
fi


Then press ctrl-x to exit, and save.
Code: Select all
sudo chmod 755 ~/bin/toggle-zoom
User avatar
grimdestripador
Level 6
Level 6
 
Posts: 1069
Joined: Fri Feb 16, 2007 2:26 am

Re: Scrolling X-screen (Solved with Scaled X Screen)

Postby nunol on Tue Apr 12, 2011 3:06 pm

The command "xrandr --output LVDS1 --scale 1.0x1.28" says to leave horizontal resolution as it is (1.0x) and compress vertical by 1.28x and 1.28x600=768.

To get back to normal just use this command: "xrandr --output LVDS1 --scale 1.0x1.0"

You can compress to any resolution, example: 1280x768: "xrandr --output LVDS1 --scale 1.25x1.28".

While I have the zoom script I like more to just issue the commands at the terminal.
User avatar
nunol
Level 9
Level 9
 
Posts: 2664
Joined: Sun Mar 06, 2011 9:25 pm
Location: Portugal

Re: Scrolling X-screen (Solved with Scaled X Screen)

Postby grimdestripador on Tue Apr 12, 2011 3:58 pm

While you like to use the terminal, i went and wrote a borne shell script using dialog

create the script, name it scale-x.sh
Code: Select all
#!/bin/sh
if [ -z $1 ] ; then
echo argument 1 is null
exit
fi
if [ -z $2 ] ; then
echo arguemnt 2 is null
exit
fi

echo "Setting aspect ratio $1x$2"
if xrandr | head -n1 | grep -q '1024 x 600'; then
       xrandr --output LVDS1 --scale $1x$2
else
        xrandr --output LVDS1 --scale 1.0x1.0
fi



Also create scale_dialog.sh, and chmod 755
Code: Select all
#!/bin/sh

dialog --inputbox "Enter the Horizontal Scale" 10 30 "1" --title "Scale Dialog" 2>~/bin/scalex_h
dialog --inputbox "Enter the Vertical Scale" 10 30 "1.26" 2>~/bin/scalex_v

~/bin/scale-x.sh `cat ~/bin/scalex_h` `cat ~/bin/scalex_v`

User avatar
grimdestripador
Level 6
Level 6
 
Posts: 1069
Joined: Fri Feb 16, 2007 2:26 am

Re: Scrolling X-screen (Solved with Scaled X Screen)

Postby nunol on Tue Apr 12, 2011 8:07 pm

Very nice, put a GUI on top and send it to Clem and you have a new Mint Tool.
User avatar
nunol
Level 9
Level 9
 
Posts: 2664
Joined: Sun Mar 06, 2011 9:25 pm
Location: Portugal

Re: Scrolling X-screen (Solved with Scaled X Screen)

Postby nunol on Sun Apr 24, 2011 8:45 pm

User avatar
nunol
Level 9
Level 9
 
Posts: 2664
Joined: Sun Mar 06, 2011 9:25 pm
Location: Portugal

Re: Scrolling X-screen (Solved with Scaled X Screen)

Postby Garvan on Mon Jul 04, 2011 9:57 am

I read this thread some time back, and inspired by it, I wrote a Gtk program to zoom the display of my netbook. Instead of entering numbers, I have a simpler interface.

Image

I wrote the program in FreeBASIC which is a modern opens source version of Quick Basic that works with Windows and Linux.

This is the full source code of the program except for the icon resource.

Code: Select all
'' GNU GPL 2 or later
#include once "gtk/gtk.bi"
#include once "vbcompat.bi"
#include once "nr_res.bi"      '' icon resource
#define NULL 0

type globaldata
   connected as string
   currentzoom as double
end type

dim shared gd as globaldata

declare function menuitem_zoom_out cdecl(byval widget as GtkWidget ptr, byval event as GdkEvent, _
      byval user_data as gpointer) as integer
declare function menuitem_zoom_100 cdecl(byval widget as GtkWidget ptr, byval event as GdkEvent, _
      byval user_data as gpointer) as integer
declare function menuitem_zoom_in cdecl(byval widget as GtkWidget ptr, byval event as GdkEvent, _
      byval user_data as gpointer) as integer
declare function init() as integer

''------------------------------------------------------------------------------
''
'' Function:   main()
''
''------------------------------------------------------------------------------

   dim as GtkWidget ptr win
   dim as GtkWidget ptr vbox1
   dim as GtkToolbar ptr zoom_tools
   dim as GdkPixbuf ptr pixbuf
   
   '' initialize Gtk
   gtk_init( NULL, NULL )

   '' create a window
   win = gtk_window_new( GTK_WINDOW_TOPLEVEL )
   gtk_window_set_title( GTK_WINDOW(win), "ZOOM NETBOOK" )
   gtk_window_set_policy (GTK_WINDOW (win), FALSE, FALSE, TRUE)   ''fixed border
   gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ALWAYS)
   
   pixbuf = gdk_pixbuf_new_from_xpm_data(@xpm_icon(0))
   if pixbuf <> NULL then gtk_window_set_icon(GTK_WINDOW(win), pixbuf)
   
   '' create a vertical box (vbox) with a 10 pixel border
   vbox1 = gtk_vbox_new (FALSE, 10)
   
   '' rest of GUI
   gtk_container_set_border_width (GTK_CONTAINER (vbox1), 10)

   ''snd toolbar
   zoom_tools = g_object_new(GTK_TYPE_TOOLBAR, NULL)
   gtk_toolbar_set_style(GTK_TOOLBAR (zoom_tools ), GTK_TOOLBAR_ICONS)
   gtk_container_set_border_width (GTK_CONTAINER (zoom_tools), 10)
   gtk_toolbar_insert_stock(zoom_tools, GTK_STOCK_ZOOM_OUT, "Zoom out", NULL, _
      GTK_SIGNAL_FUNC (@menuitem_zoom_out), NULL, -1)
   gtk_toolbar_insert_stock(zoom_tools, GTK_STOCK_ZOOM_100, "Zoom 1:1", NULL, _
      GTK_SIGNAL_FUNC (@menuitem_zoom_100), NULL, -1)
   gtk_toolbar_insert_stock(zoom_tools, GTK_STOCK_ZOOM_IN, "Zoom in", NULL, _
      GTK_SIGNAL_FUNC (@menuitem_zoom_in), NULL, -1)
   gtk_toolbar_insert_stock(zoom_tools, GTK_STOCK_QUIT, "Quit", NULL, _
      G_CALLBACK (@gtk_main_quit), NULL, -1)


   gtk_container_add (GTK_CONTAINER (vbox1), GTK_WIDGET(zoom_tools))
   

   gtk_container_add( GTK_CONTAINER(win), vbox1 )
   
   '' attach signals to widgets
   g_signal_connect (G_OBJECT (win), "destroy", G_CALLBACK (@gtk_main_quit), NULL)
   g_signal_connect (G_OBJECT (win), "delete_event", G_CALLBACK (@gtk_main_quit), NULL)
   
   '' Show GUI
   gtk_widget_show_all( win )
   ''
   if init() = false then print "Call to xrandr failed"
   
   ' Enter the event loop
   gtk_main ()


'' Purpose:      Zoom Out
function menuitem_zoom_out cdecl(byval widget as GtkWidget ptr, byval event as GdkEvent, _
      byval user_data as gpointer) as integer
   if gd.connected = "" then return 0
   gd.currentzoom *= 1.1
   return exec("xrandr", "--output " & gd.connected & " --scale " & str(gd.currentzoom) & "x" & str(gd.currentzoom))
end function

'' Purpose:      Zoom 100
function menuitem_zoom_100 cdecl(byval widget as GtkWidget ptr, byval event as GdkEvent, _
      byval user_data as gpointer) as integer
   if gd.connected = "" then return 0
   gd.currentzoom = 1
   return exec("xrandr", "--output " & gd.connected & " --scale 1.0x1.0")
end function

'' Purpose:      Zoom In
function menuitem_zoom_in cdecl(byval widget as GtkWidget ptr, byval event as GdkEvent, _
      byval user_data as gpointer) as integer
   if gd.connected = "" then return 0
   gd.currentzoom /= 1.1
   return exec("xrandr", "--output " & gd.connected & " --scale " & str(gd.currentzoom) & "x" & str(gd.currentzoom))
end function

'' Make sure we can find the connected video name
function init() as integer
   dim as integer f1
   dim as string ln, vid
   
   gd.currentzoom = 1
   
   f1 = freefile
   if (open pipe("xrandr -q", for input, as #f1)) then
      print "couldn't run xrandr"
      return 0
   end if

   do until (eof(f1))
      line input #f1, ln
      if (len(ln) > 0) then
         if instr(ln, " connected") then
            vid = left(ln, instr(ln, " connected")-1)
            if len(vid) then gd.connected = vid
         end if
      end if
   loop
   close #f1

   if len(vid) then return true else return false
end function


A compiled binary (made on Mint 11 and tested on UNR 10.04) is available on my web site.
http://weekendcode.phatcode.net/files/nbz.zip

Garvan
Desktop: Dell, Intel Core 2 Duo E7500 @ 2.93GHz, 2GiB RAM, Lubuntu 14.04 (trusty)
Notebook: HP 14 Notebook PC 14-r003TX, i5-4210U @ 1.7 GHz, 4GB RAM, Linux Mint 17
Notebook: DELL latitude E5520, i5-2520M @ 2.50 GHz, 4GB RAM, Windows 7
User avatar
Garvan
Level 4
Level 4
 
Posts: 276
Joined: Sun May 29, 2011 3:26 am
Location: Lao PDR

Linux Mint is funded by ads and donations.
 

Return to Installation & Boot

Who is online

Users browsing this forum: konrad, Matte#91 and 22 guests