DSL Ideas and Suggestions :: Dirty rdesktop.lua 'choose resolution' code



I made this modifications to my own /usr/local/bin/rdesktop.lua (DSL 3.1) for personal use.

I concede I mostly borrowed code from fdtools.lua to make the quick and dirty hack, but it works.

This is the diff
Code Sample

5c5
< w = fltk:Fl_Window(320,75, "Rdesktop")
---
> w = fltk:Fl_Window(320,120, "Rdesktop")
8c8,25
< cancel = fltk:Fl_Button(90,40,70,25,"C&ancel")
---
> sel640x480 = fltk:Fl_Round_Button(2,40,75,25,"640x480")
> sel640x480:type(fltk.FL_RADIO_BUTTON)
> sel640x480:selection_color(fltk.FL_RED)
>
> sel800x600 = fltk:Fl_Round_Button(76,40,75,25,"800x600")
> sel800x600:value(1)
> sel800x600:type(fltk.FL_RADIO_BUTTON)
> sel800x600:selection_color(fltk.FL_RED)
>
> sel1024x768 = fltk:Fl_Round_Button(150,40,83,25,"1024x768")
> sel1024x768:type(fltk.FL_RADIO_BUTTON)
> sel1024x768:selection_color(fltk.FL_RED)
>
> selfull = fltk:Fl_Round_Button(232,40,88,25,"Fullscreen")
> selfull:type(fltk.FL_RADIO_BUTTON)
> selfull:selection_color(fltk.FL_RED)
>
> cancel = fltk:Fl_Button(90,80,70,25,"C&ancel")
14c31
< connect = fltk:Fl_Button(160,40,70,25,"&Connect")
---
> connect = fltk:Fl_Button(160,80,70,25,"&Connect")
20c37,48
<      os.execute('/usr/bin/rdesktop ' .. input:value())
---
>      if sel800x600:value() == 1 then
>         os.execute('/usr/bin/rdesktop -g 800x600 ' .. input:value())
>      end
>      if sel640x480:value() == 1 then
>         os.execute('/usr/bin/rdesktop -g 640x480 ' .. input:value())
>      end
>      if sel1024x768:value() == 1 then
>         os.execute('/usr/bin/rdesktop -g 1024x768 ' .. input:value())
>      end
>      if selfull:value() == 1 then
>         os.execute('/usr/bin/rdesktop -f ' .. input:value())
>      end

If you want to, why don't you add the bit depth as well while you're at it?

But this should be quite handy for those not using the cmdline...

Submit it when you are done. It wil make a nice ehancement for those who regularly use rdesktop. Send to me at extensions@damnsmalllinux.org
Quote (^thehatsrule^ @ Jan. 13 2007,22:06)
If you want to, why don't you add the bit depth as well while you're at it?

I set the default resolution to 800x600 because that is what the DSL rdesktop defaults to if not specified otherwise in the input box, or (for what is worth) if you only specify an IP there.

I think the GUI should provide the least astonishing results, and I think a GUI user with no knowledge of bandwith constraints, cmd and the like, would expect the maximum of his/ her hardware (if not even more).

That presents a dilemma for me, because rdesktop defaults to 8 bit depth, when an average user would expect to see all the fancy colors he/ she is accustomed to. I'll set the default to 16 bit depth, that as I've read in rdesktop man is the maximum supported by xp and the like and let rdesktop fallback to 8 bit depth if the server don't support more.

Whatever the content of the checkboxes, the input box content takes prevalence (and it should behave that way), so -f -a 8 -u Sales 192.168.1.100 would override the 800x600 checkbox, or for what matters, a 'upgrade' to 16 bit depth as DSL default from to date default of 8 bit.

Comments?

Quote (^thehatsrule^ @ Jan. 13 2007,17:06)
If you want to, why don't you add the bit depth as well while you're at it?

Finally done :)
Code Sample

4c4
< -- resolution selection by MakoFilu from the DSL forums Jan 14, 2007
---
> -- resolution, bit depth selection by Daniel Plata Lorenzo "MakodFilu"
6c6,9
< w = fltk:Fl_Window(320,120, "Rdesktop")
---
> width=400
> height=150
>
> w = fltk:Fl_Window(width,height, "Rdesktop")
9c12,13
< sel640x480 = fltk:Fl_Round_Button(2,40,75,25,"640x480")
---
> frame1=fltk:Fl_Group(1,69,320,27,"Resolution")
> sel640x480 = fltk:Fl_Round_Button(2,70,75,25,"640x480")
13c17
< sel800x600 = fltk:Fl_Round_Button(76,40,75,25,"800x600")
---
> sel800x600 = fltk:Fl_Round_Button(76,70,75,25,"800x600")
18c22
< sel1024x768 = fltk:Fl_Round_Button(150,40,83,25,"1024x768")
---
> sel1024x768 = fltk:Fl_Round_Button(150,70,83,25,"1024x768")
22c26
< selfull = fltk:Fl_Round_Button(232,40,88,25,"Fullscreen")
---
> selfull = fltk:Fl_Round_Button(232,70,88,25,"Fullscreen")
24a29,40
> fltk:Fl_End()
>
> frame2=fltk:Fl_Group(width-70,30,60,100,"Color Depth")
> sel8bit = fltk:Fl_Round_Button(width-65,31,45,25,"8bit")
> sel8bit:value(1)
> sel8bit:type(fltk.FL_RADIO_BUTTON)
> sel8bit:selection_color(fltk.FL_RED)
>
> sel16bit = fltk:Fl_Round_Button(width-65,60,50,25,"16bit")
> sel16bit:type(fltk.FL_RADIO_BUTTON)
> sel16bit:selection_color(fltk.FL_RED)
> fltk:Fl_End()
26c42
< cancel = fltk:Fl_Button(90,80,70,25,"C&ancel")
---
> cancel = fltk:Fl_Button(90,height-40,70,25,"C&ancel")
32c48
< connect = fltk:Fl_Button(160,80,70,25,"&Connect")
---
> connect = fltk:Fl_Button(160,height-40,70,25,"&Connect")
38,49c54,60
<      if sel800x600:value() == 1 then
<         os.execute('/usr/bin/rdesktop -g 800x600 ' .. input:value())
<      end
<      if sel640x480:value() == 1 then
<         os.execute('/usr/bin/rdesktop -g 640x480 ' .. input:value())
<      end
<      if sel1024x768:value() == 1 then
<         os.execute('/usr/bin/rdesktop -g 1024x768 ' .. input:value())
<      end
<      if selfull:value() == 1 then
<         os.execute('/usr/bin/rdesktop -f ' .. input:value())
<      end
---
>      if sel800x600:value() == 1 then resolution="-g 800x600 " end
>      if sel640x480:value() == 1 then resolution="-g 640x480 " end
>      if sel1024x768:value() == 1 then resolution="-g 1024x768 " end
>      if selfull:value() == 1 then resolution="-f " end
>      if sel8bit:value() == 1 then depth="-a 8 " end
>      if sel16bit:value() == 1 then depth="-a 16 " end
>      os.execute('/usr/bin/rdesktop '..resolution..depth..input:value())

Next Page...
original here.